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
|
|||
|
|||
Mergesort problem
Hi all,
I have a problem to due with mergesort as shown in the attached sample model, thus seek for some help...... In the model, as it seems that the send requirement is evaluted realtime, so when queue 3 is full, a flowitem pass queue 3 and heading to queue 4, but before arrive queue 4, if queue 3 becomes available again, the flowitem will target to queue 3 again thus go to the end of the mergesort. But I want the shpt to go to queue 4 even queue 3 becomes avaialable once the shpt passed the exit point of queue 3. I typed below code in send requirement of the merge sort /**custom code */ int destport = 1; if (content(outobject(current, 1)) == 5) {destport = 2; if (content(outobject(current, 2)) == 5) {destport = 3; if (content(outobject(current, 3)) == 5) {destport = 4; }}} return destport == port; Thanks. Kelvin |
#2
|
||||
|
||||
Kelvin,
The send requirement is executed everytime a product is at an exit. So you are right when it then evaluates that it can go to 1 it will get that destination even if it is at 2. Actually you did too much. If you leave the send requirement to standard (always send) and change the max capacity of the queues to 5, you will have your functionality |
#3
|
|||
|
|||
Quote:
I know use always send will work in this demo, but I just extracted the problem in my building model which not all exits would be used in the merge sort as each flowitem would hv it own possible exit |
#4
|
||||
|
||||
Ok I didn't understand that complety. Then some extra comments. The send requirement is executed for every product and for every exit. And it has to return either a true or false.
So you might try some code like this: treenode current = ownerobject(c); treenode item = parnode(1); int port = parval(2); /**By Itemtype: */ /**Send the item if its itemtype matches the port.*/ if( ( getitemtype(item) == port && content(outobject(current, 1)) < 5 ) || getitemtype(item) < port ) { return 1; } else { return 0; } This code sends the right item to the right port based on the itemtype and space in the queue. But if it has passed the destination port it will go to any port. Hope this helps. Last edited by Steven Hamoen; 01-13-2010 at 07:37 AM. |
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with installation (new problem) | David Chan | Installation | 2 | 03-13-2009 10:41 AM |
Trouble with mergesort... | Paul Dowling | Q&A | 6 | 02-23-2009 11:20 PM |
Not overlapping when MergeSort Conveyor... | syseo | Q&A | 0 | 10-26-2008 07:24 AM |
MergeSort Spacing Rule For Recirculation | Sung Kim | Q&A | 2 | 01-21-2008 09:26 AM |