question

Levi P avatar image
0 Likes"
Levi P asked Levi P commented

manage sends from source to queue

Hello, I would like to know how to make my source send only my queue is empty. I have a stock of 10,000 tags but I want them to appear in the queue only in increments of 500. How do I do this? Thanks

FlexSim 22.2.2
output source
5 |100000

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

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

Close the input of the queue when you reach an input increment of 500. If your queue gets empty you open the input again. The last item leaving a queue is still counted as inventory stock when you check the content of a queue. This mean you check, if current.subnodes.length is one and not zero to identify an empty queue. [current is a reference to the queue, if you add a code snippet into a this queue trigger]

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

Levi P avatar image Levi P commented ·

Thank you for your reply,

I think I understand a little bit, but I'm still a beginner so I'm not totally following your instructions. Could you be more precise about the "add a code snippet into a this queue trigger"?
Here are the parameters of the queue, what should I do at this level in the input?

Thank you very much for your help.1666892984467.png

0 Likes 0 ·
1666892673338.png (242.4 KiB)
1666892984467.png (242.4 KiB)
Jacob W2 avatar image Jacob W2 ♦ Levi P commented ·

Hi @Levi P,

Once you have opened the properties for the queue, you can select the trigger tab at the bottom of the options. The little green plus sign allows you to specify what trigger will cause your specified action to occur.

triggers.jpg

Once you have selected what trigger to use, you can then select what will occur when the trigger is activated.

trigger-code-snippet.jpg

In this case you will want to use the code snipped option to write the code that will check the current content of the queue. @Joerg Vogel, explained what code will work best for what you are doing. You may need to set a trigger for on entry as well as on exit so that you check the current queue content even when nothing is entering the queue.

0 Likes 0 ·
triggers.jpg (29.3 KiB)
Levi P avatar image Levi P commented ·

Greaaaaat! Thanks, it's solved! Thanks for your time !

0 Likes 0 ·
Levi P avatar image
0 Likes"
Levi P answered Felix Möhlmann commented

Thank you very much for your help! Really !

So, I know my programming basics are far away, it will come back to me slowly. I'm in the code snippet of the queue and I have to tell it "you close Input when current.subnodes.length is at its max content and you open once current.subnodes.length ==1 "

Is that right? I just don't know how to rewrite this in code anymore.

Thanks again for your help! I really need it for my jury in a month, I have to present my project. I'm glad you are so active.

1666941457023.png


1666941457023.png (428.1 KiB)
· 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.

Felix Möhlmann avatar image Felix Möhlmann commented ·

There is actually a pre-defined option for closing/opening the ports of objects. You then only have to fill in the condition.

1666942136514.png

If you want, you can then inspect the code that gets pasted into the trigger by selecting the option to see how it works.

1666942203855.png

The grey parts are just markup used by the GUI. The rest would work the same if you were to put it into a code snippet.

1 Like 1 ·
1666942136514.png (37.1 KiB)
1666942203855.png (34.5 KiB)