question

ana.pc2 avatar image
0 Likes"
ana.pc2 asked Ben Wilson commented

SendToPort First Available - Port num?

Hello!

I was wondering if there is any way to know exactly which port is selected after returning 0 on the SendToPort code at a Processor.

The thing is I need to know as soon as it returns 0 to save it on a Global List for future logic... I thought about putting it at the Use Transporter Custom Code but it doesn't do it immediately... any ideas??


Thanks for your time! :)

FlexSim 20.1.1
flexsim 20.1.1sendtoportfirst available destination
· 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.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @ana.pc2, was joerg.vogel's answer helpful? If so, please click the red "Accept" button on 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 unaccept or comment back to reopen your question.

0 Likes 0 ·

1 Answer

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Joerg Vogel commented

You can only identify the Port Number after the item has actually left the Object in the On Exit Trigger oder Event.

· 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.

ana.pc2 avatar image ana.pc2 commented ·

Hi @joerg.vogel Thanks for the answer! Yes, I tried that, but in my case the item takes a little longer to be on Exit, and I need to save the port number right away. So in case there are other items with the same type as that one on other processors, they all go to the same port as that one that has decided as first available, does it make sense?


0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel ana.pc2 commented ·

@ana.pc2, the return value of send to port is data in scope of items. If you decide to return first available, then this parameter will be accomplished if the item actually is able to leave the object. And at this time the port is chosen. You can’t predict the output port if the send to port is set to first available. It is an option to accelerate releasing items. You can set a single discrete output port, but then an item stays as long as this output port gets available.

You can accept this fact, that you can not predict a port with first available or choose a discrete direct value for send to port!

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel ana.pc2 commented ·

@ana.pc2, now you extended your question to push items to a processor still processing a distinct item type. As I said you can‘t predict the first available port. But you can check in send to port if an output port object processes the same item type and set this same output port as the return value. Please ask this as a new question and describe precisely the circumstances you want to achieve in your logic! Thanks. Jörg

0 Likes 0 ·