question

Yue Y avatar image
0 Likes"
Yue Y asked David Seo commented

How to release flow item to specified port in order?

In the attached model, in the onReset trigger of the queue, I generated two red boxes, released them through port 1, generated two blue boxes and released them through port 2. However, the second red box exits through port 2 even though it was released to port 1. And the the boxes don't exit in the same order they are released (the brown boxes exit before the second blue box). I was wondering how to guarantee that the boxes

always exits through a specified port in the order they are released? Note that I am using a BasicFR in the actual model (I used a queue in the model for better illustration). So any queue specific solution won't apply to my use case.

Any help is appreciated!

releaseitem-test.fsm

Here is the same model using a BasicFR instead:

releaseitem-test-basicfr.fsm

I would like the flow item generated in BasicFR to be released to a certain port in the order they are released.

FlexSim 19.1.1
releaseitem
· 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.

Yue Y avatar image Yue Y commented ·

I am not sure if it is a problem caused by using createcopy and releaseitem right after creating it. After changing createcopy to insercopy, and put releaseitem in a senddelaymessage(), it works. Here a model comparing using createcopy and insertcopy: the upper model uses insertcopy while the lower model uses createcopy.

releaseitem-test-basicfr.fsm

0 Likes 0 ·

1 Answer

Yue Y avatar image
1 Like"
Yue Y answered

I think I figured it out. The problem with using createcopy() is that it will not populate the attribute "itemtype" of the flow item. The sendto variable is stored in this variable. if releaseitem(object, port) fails to release this item, it will store the port in the "sendto" variable in its itemtype. When the downstream input ports open again, the model will evaluate "sendto" variables of all released item and decide if this flow item can be released. Since the flow item generated by createcopy() doesn't have this variable, it's behavior after evaluating "sendto" is undefined. Not sure if I am correct, it would be wonderful if someone could confirm this.

5 |100000

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