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 flow round robin
Hi,
Is it possible to made the output of mergesort as round robin?? I tried to copy and paste the round robin template code to a merge sort flow but it doesnt work |
#2
|
||||
|
||||
This is working for me:
MergeSortFlow / Send Requirement treenode curlabel = label(current,"f_cursendport");if( ! objectexists(curlabel) ) { curlabel = addlabel( current, "f_cursendport" ); setlabelnum(current, "f_cursendport", 1); } if( getoutput(current)==0 && getrank(item)==1 ) setnodenum(curlabel,1); //reset round robin counter if first part double returnvalue = getnodenum(curlabel); return returnvalue == port; Trigger OnExit treenode curlabel = label(current,"f_cursendport"); double returnvalue = getnodenum(curlabel); inc(curlabel, 1); if(getnodenum(curlabel) > nrop( current )) setnodenum(curlabel, 1); I guess your problem was that you did not divide the code into two sections and just used the MergeSortFlow and therefore the increment of the label was fired to often. As you can see I also just copied the round robin template and modified it a bit.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 4 Users Say Thank You to Tom David For This Useful Post: | ||
Steven Hamoen (02-03-2010) |
#3
|
|||
|
|||
Before i got the solution from Tom, I used a stupid method to solve as I want to distribute item to outport evenly
In Mergesort flow i typed : int value = duniform(1,4); switch(port){ /**/ case 1: return value == 1; case 2: return value == 2; case 3: return value == 3; case 4: return value == 4; default: return 1;/**/ } return 1; |
Thread | Thread Starter | Forum | Replies | Last Post |
Mergesort problem | KelvinHo | Q&A | 5 | 01-15-2010 03:16 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 |
Recycling Flow Items | Joe Allen | Q&A | 1 | 09-16-2008 03:57 PM |
MergeSort Spacing Rule For Recirculation | Sung Kim | Q&A | 2 | 01-21-2008 09:26 AM |