ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 02-02-2010
KelvinHo KelvinHo is offline
Flexsim User
 
Join Date: Jan 2008
Location: Hong Kong
Posts: 129
Downloads: 18
Uploads: 1
Thanks: 44
Thanked 23 Times in 7 Posts
Rep Power: 171
KelvinHo will become famous soon enough
Default 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  
Old 02-03-2010
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

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  
Old 02-03-2010
KelvinHo KelvinHo is offline
Flexsim User
 
Join Date: Jan 2008
Location: Hong Kong
Posts: 129
Downloads: 18
Uploads: 1
Thanks: 44
Thanked 23 Times in 7 Posts
Rep Power: 171
KelvinHo will become famous soon enough
Default

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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.