question

tall_pauhl avatar image
0 Likes"
tall_pauhl asked Felix Möhlmann answered

Open and close ports based on Tracked Variable

Hello everyone,

I´m at a beginners level with the software and am trying to figure out how to open and close a Queue Port based on the amount of Items in the Queue.

First I added a tracked variable (Warteschlangeee), which is supposed to be monitored by Set Tracked Variable. Herefore I added Set Tracked Variable on Entry with increment by 1. I did the same thing for the Exit -> Set tracked variable and added decrement by 1. This should give me the amount in the Queue. If the Amount is 0 (or less), the Port (out Kasse 2) should be closed. If there are 20 items or more in the Queue it should open, so that those items distribute evenly.

Problems:

1. Somehow tho it only decrements the variable.

2. The port doesn`t open or close.

I would really appreciate feedback. If there`s another wa to tackle this, I´m open to use which ever way (process flow etc.).


Thanks in Advance

Paul

flexsim-kasse-wechseln-01.pngflexsim-kasse-wechseln-02.pngflexsim-kasse-wechseln-03.png

FlexSim 23.2.2
close and open ports
· 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.

1 Answer

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered

I can't say why the variable is only decrementing without looking at the model.

However, you don't really need to use a tracked variable. You can just use the content of the queue directly, to close/open the second register ("current.subnodes.length").

As Jörg said, you can't close an individual port, only the entire output. Currently your logic would close the output of Kasse2. Instead, you want to close the input of Kasse2, so the queue can no longer send items there. Lastly, according to what you wrote the input of Kasse2 should start closed, which you can do in its On Reset trigger.

5 |100000

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