ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
output order of objects
Hi all,
I have four objects in the queue, and I would like to choose the Output order of the queue. I create a label on objects called proirity. I read the label of the four items and want to send out the object with the label "priority" = 1, then priority = 2 and so on. . . Thanks. |
#2
|
||||
|
||||
I would connect the Queue and the Conveyor 4 times and set the "Send to Port" in the Queue to:
/**Custom Code*/ treenode item = parnode(1); treenode current = ownerobject(c); int value = getlabelnum(item,"priority"); switch(value){ case 1: return 1; case 2: return 2; case 3: return 3; case 4: return 4; default: return 0; } Now you only have to close and open the ports in the way you want. Probably in the triggers of the Queue and the Conveyor. I tried it with setting "Round Robin" in the "Pull From Port" of the Conveyor, but this doesn´t work the way you wanted I expect. Sorry that I can´t load up a modell.
__________________
Hemmi |
The Following User Says Thank You to Sebastian Hemmann For This Useful Post: | ||
juan alberto (06-21-2010) |
#3
|
|||
|
|||
Attached is a solution. I use a label on the queue to record the priority and time of entry as a table, then sort that table and find the rank of the new entry. Then set the rank of the item to match. When the item leaves, we assume it's rank 1 in the queue and remove the first row from the table. Because of that it's assuming no pull rules on the other objects are pulling other ranks. If you need that too, post here and I'll adjust this solution to make that work.
So Queue3 has modified entry, exit and sendto triggers. I've also changed the sendTo so that it no longer holds items (since you need to release them somehow later), and instead closed the output on reset and open it when we've a good queue accumulated (so that you can see the ordering). |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
juan alberto (06-21-2010) |
#4
|
||||
|
||||
You need all the 4 items in the queue. So set the queue to 'Perform Batching' and the Target Batch size to 4.
In the OnEntry Trigger you can sort the order of the items: if(content(current)==4) { // the last item is entering for(int x=1;x<=4;x++) { // set the rank of all items to the given priority setrank(rank(current,x),getlabelnum(rank(current,x ),"priority")); } } (int the attached file the items are sorted by their itemtype)
__________________
kind regards Nico. |
The Following User Says Thank You to Nico Zahn For This Useful Post: | ||
juan alberto (06-21-2010) |
Thread | Thread Starter | Forum | Replies | Last Post |
What is the maximum output of the model in 10 hours? | john mic | Q&A | 1 | 05-14-2010 11:57 AM |
Problem with Send to Output Port | Joe Allen | Q&A | 3 | 05-14-2009 02:38 PM |
change the objects in self modeled objects | Manuel Kraenzle | Q&A | 7 | 10-27-2008 02:29 PM |
Output high volume data | Liu Bin | Q&A | 8 | 06-16-2008 09:18 AM |
Problem with Processor Output | avinash | Q&A | 2 | 03-26-2008 09:19 AM |