question

Kade G avatar image
0 Likes"
Kade G asked Kade G commented

Pulling from queue once stock in another queue drops below a certain value

Hello,

I'm new to Flexsim, and I want to know how to pull inventory from a queue once another queue downstream dips below a certain inventory threshold.

My initial thought was to utilize the "pull" feature in the flow tab of the downstream queue and pull based on the expression that the downstream queue is less than the specified threshold value. My issue with this is that I can't figure out how to create the conditional statement in the expression window "downstream_queue.length<=threshold_value". Any help on solving this problem or directing me to a useful online resource would be greatly appreciated. Thanks.

FlexSim 20.1.2
flexsim 20.1.2queue length
· 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.

Benjamin W2 avatar image Benjamin W2 commented ·

Hi @Kade G, was tanner.p's answer helpful? If so, please click the red "Accept" button on their answer!

0 Likes 0 ·

1 Answer

·
tannerp avatar image
0 Likes"
tannerp answered Kade G commented

There are a lot of posts about this on the forum. I'll place a links here for a few:

https://answers.flexsim.com/questions/33836/refill-with-level-percentage.html

https://answers.flexsim.com/questions/43479/refill-a-rack-or-queue-depending-its-level.html

https://answers.flexsim.com/questions/43021/how-to-use-current-content-of-the-queue-to-reload.html

Additionally, some code that might help based on what you posted is the code to get the content of a queue. I'll add that below. You can compare this to a label or other variable to know when to replenish.

downstream_queue.subnodes.length; //Accesses number of items in a queue

You may also consider using Process Flow (I believe this method is outlined in the third link on this response.) because it has an Event-Triggered Source that can listen to "OnContentChange" for queue and other 3D objects.

If you have a model that you're building that you'd like us to take a look at, feel free to upload it. Hopefully this information at least gets you started.

· 8
5 |100000

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

Kade G avatar image Kade G commented ·
Thanks. The third link was very helpful.
0 Likes 0 ·
Kade G avatar image Kade G commented ·

Hello again,

I've made some edits to one of the examples you posted in the previous comment. Essentially, I have just replaced the transporter with a process.

Now, I want to close the input of the processor when the inventory increases to a certain value, and open that same input when inventory drops below a certain value, but my changes to the triggers don't seem to work. Do you have any idea as to how I can fix my issue?


Close Input of Process.fsm

0 Likes 0 ·
tannerp avatar image tannerp Kade G commented ·

It seems like the Raw Material Stock is unable to release because there's not an object connected to its center port and you had "Use Transport" selected. So I added an operator as a center object on that queue.

The second thing is that there's a default trigger option for "Close and Open Ports".

This means you don't have to write your own code in a Custom Code window on the trigger.

I tried updating your model, but I was unable to because of some issues with the compiler. I'm not sure what was done in your model, but it wasn't really cooperating. Anyway, I created a new model that's identical and it uses the triggers I've described. Hope this helps!

kade model help.fsm

1 Like 1 ·
Kade G avatar image Kade G tannerp commented ·

Thanks for your response. Unfortunately, I cannot download this file for some reason.

0 Likes 0 ·
Show more comments
Kade G avatar image Kade G Kade G commented ·
0 Likes 0 ·

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.