question

gilbert jerald avatar image
3 Likes"
gilbert jerald asked Adrian Haws commented

Send pallet and two groups of 5 boxes to 3 different queues from a separator

a pallet consist of 10 items this movies from a processor to a separator,then the separator to three queue, the problem is that i want to send the pallet to one queue and 5 box to one queue,and remaining 5 box to another queue what is the separator and flow option to be given for doing this separation work

Choose One
combinerseparatorsend to port
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Kari Payton avatar image Kari Payton commented ·

Hey @gilbert jerald could you post your model?

0 Likes 0 ·

1 Answer

Adrian Haws avatar image
3 Likes"
Adrian Haws answered Adrian Haws commented

You can do this by editing the code within the "Default Separator Option" for "Send to Port" in the Separator. In the Code Editor replace lines 10-18 with the following:

if(getvarnum(current,"unpack")) { 
  if(getrank(item) == 1)
    return containerport;
  else if (content(current) >= 7)
    return contentport;
  else 
    return 3;
}
else
  return 0;

The default option simply sends the pallet to the first output port and the remaining items to the second output port. The changes we made in the code simply tell it to send to the third port once 5 items have left.

See attached example model.


· 7
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

gilbert jerald avatar image gilbert jerald commented ·

thank you for your reply sir

can u please explain me the meaning of each line in your code ,i am basely from mechanical engineering background.

you have answered for the question i have asked ,but if i want to do more separation by this separator. i want to know, what are the changes to be done on coding ,that's why i am asking the meaning of each line in coding. can u please help me sir

0 Likes 0 ·
Adrian Haws avatar image Adrian Haws gilbert jerald commented ·

@gilbert jerald You'll see that the first few lines in that code (which I didn't include) are as follows:

treenode  item = param(1);
treenode  current = ownerobject(c);
/**Default Separator Option*/
/** \nPort for container: */
int containerport = /**/1/**/;
/** \nPort for contents: */
int contentport = /**/2/**/;
/** \n\nNote: If not unpacking, just send to first available.*/

All this is doing is defining variables. That way we have another reference to the objects in our code.

Then in the code I put in the answer, we're setting conditions on which port to send the items to. I'm not sure if you're familiar at all with if/else statements but it's basically what it sounds like. We're saying that if the rank of the item is 1 (which will be the pallet), we're going to send it to "containerport", which we defined as port 1. Then the default option was to send all the rest of the items to port 2. However, we need to change that. So I added an "else if" line with another condition. Since the separator first sends the boxes (which have higher ranking than the pallet) we want to say that if there are at least 7 items in the separator we'll send it to port 2. Otherwise, if the rank isn't 1 and there are less than 7 items, we'll send it to port 3.

You'll see that I left most of the code how it was. The main difference is that I added an "else if" line to send it to one more port. You can select the "Default Separator Option" within a new separator to compare the differences in the code.

A better understanding of coding will come with time and practice, but a resource you might look into is the "FlexSim Coding" section of the User Manual.

3 Likes 3 ·
gilbert jerald avatar image gilbert jerald commented ·

how to set the speed of the conveyor when it is given as 1unit/sec

in my problem arrive rate of each box is given as 1 unit per sec

0 Likes 0 ·
Adrian Haws avatar image Adrian Haws gilbert jerald commented ·

@gilbert jerald To set conveyor speed, double-click on a conveyor, then click the icon with three dots next to "Conveyor Type." This will open up several options for customizing that conveyor type.

2 Likes 2 ·
gilbert jerald avatar image gilbert jerald commented ·

three processor or connected in series to a conveyor , how can i make connection that item arrives first should move to first processor and second to the next processor and further hear i have attached a model in starting time the item moves correctly but as time process the item does not move as per the condition.johnson-pharamaceutical-new-model.fsm

0 Likes 0 ·
Adrian Haws avatar image Adrian Haws gilbert jerald commented ·

@gilbert jerald We recommend asking new questions in a separate post.

0 Likes 0 ·
Adrian Haws avatar image Adrian Haws Adrian Haws commented ·

Which I see that you did already, thank you!

3 Likes 3 ·