question

kimsh avatar image
0 Likes"
kimsh asked Jeanette F commented

Setting Multiple Outport Input Conditions

From the source conveyor, item type 1 goes to the conveyor connected to the sink, and the rest goes to one of the 2, 3, 4 rails...!

Here I want to go one step further.
As shown in the picture below, one of the rails 2, 3, and 4 is full and often does not receive items from the source conveyor. (For example, lines 3 and 4 are empty, but lines 2 are often full and cannot enter the entire line.)

So I want to put lines 2, 3 and 4 evenly so that they don't get stuck in certain places. If each line has more than a few items, I want to create a trigger to go to another line. (or photoye block trigger etc...)


ExitTransfer4

exittransfer4-send-to-port-code.png


need limit condition.fsmlimit-condition.png

FlexSim 23.2.2
setting multiple outport input conditions
· 2
5 |100000

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

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @kimsh, was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

Hi @kimsh,

Thank you for contributing to our community! We couldn't identify a maintained license or subscription linked to your account.

You may need to update your profile information to identify yourself as a license owner or their associate. Check out our article for how to ensure you receive timely support. If you update your profile comment back to let us know - we'll adjust the priority of your post accordingly.

If your current license is expired, please contact your local distributor to renew.

0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered kimsh edited

If you want to follow a strict pattern to send them evenly then you can use the output of the conveyor minus the number sent to the sink and the function fmod() to determine the port:

if (item.Type == 1){
   current.port1qty++;
   return 1;
}
int numOut=current.stats.output.value-current.port1qty;
int port=Math.fmod(numOut,3)+1;
return port;

For this I've added a label to the exit transfer called port1qty which is set to zero on reset.


· 3
5 |100000

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

kimsh avatar image kimsh commented ·

Um... That's a good idea. I don't put the lines 2, 3 and 4 in order. Items should be evenly included in all lines 2, 3, and 4. If items are evenly included in each line and a certain line is blocked, we should make sure to supply them to other lines.

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann kimsh commented ·

You could read the content of the connected conveyors and choose the one with the least items on it as the output direction.

need-limit-condition-fm.fsm

The downside to this method is that items in transit are not counted towards the content. So using a counter label might be a better option.

Also, if the conveyors have different length, it would be better to determine the available capacity per conveyor and choose the one with the highest value.

0 Likes 0 ·
kimsh avatar image kimsh Felix Möhlmann commented ·

port.fsm

Thank you.

That's a good idea.

But I've done basic coding indirectly, but I don't know the details.

/**Custom Code*/

Object item = param(1);

Object current = ownerobject(c);


if (item.Type == 1)

return 1;


// Get conveyor with least content

int minContent = 5;

int outIndex = 0;

for(int i = 2; i <= current.outObjects.length; i++)

{

Object conveyor = ownerobject(getvarnode(current.outObjects[i], "transferPoint").first.value);

int content = conveyor.stats.content.value;

if(content < minContent)

{

minContent = content;

outIndex = i;

}

}

return outIndex;


Looking at the script, I start with i=2 in the for statement, can I fit the range from i=2 to 5 like this?
May I know what i++ means?

And I would like to apply the if type = 1, return 1 state as follows.
I want to let type 1 and 2 enter empty place among ports 1 and 2.

The best way is to make it available, but I don't know how to express it in the script.

0 Likes 0 ·
port.fsm (55.0 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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