Pull until Subnode.length

Pull until Subnode.length

MikelST
Not applicable
1,833 Views
7 Replies
Message 1 of 8

Pull until Subnode.length

MikelST
Not applicable

[ FlexSim 23.0.2 ]

Good afternoon, I am new to flexsim and I have several questions about a model.

In the case of the model below, I would like to know if it is possible to start producing a certain number of products when there are less than a certain number of producers in the rack.

For example,

When(Model.find("Rack2")subnodes.length<9)

Start producing until(Model.find("Rack2")subnodes.length=14) without stopping when it reaches to 9.

Thank you.

pullsubnodeslenght.fsm

0 Likes
Accepted solutions (1)
1,834 Views
7 Replies
Replies (7)
Message 2 of 8

kavika_faleumu
Autodesk
Autodesk
Accepted solution

Hey @MikelST, with regards to the model you posted, there are several problems I see that will hinder your desired functionality. Firstly, you check the subnodes of a "Rack2", but there is only a "Rack3" and "Rack4" in your model. If you're trying to use "Rack3", then you have another problem when checking to see if the subnodes.length is == 14; Rack3 can only hold up to 12 of the items you are producing (due to their size). I suggest increasing the size of that Rack to hold more items.

As for your if/then statement, you can implement that in a Trigger. After clicking on Rack3, look in the Properties panel on the right of the screen; at the bottom there is a section called "Triggers". Here you can put custom code when an event happens on this Rack. I suggest you add two triggers: an OnEntry trigger and an OnExit trigger.

1674070778934.png

In the OnEntry trigger, click the green + button and go to "Control > Close and Open Ports". You can have the Rack close its input port after it reaches 14 boxes. That way it can't take in any more items.

1674071928920.png

You'll do a similar thing on the OnExit trigger, where you open the input port once the rack's subnodes.length is less than 9. That way it will take in boxes again. Just to be safe, we can also check if the input is currently open so we don't try to open it repeatedly. Your condition might look like this:

current.subnodes.length < 9 && !inputopen(current)

After fixing all the names (no calling Rack1 or Rack2 since they don't exist) and adding this logic, it seems to work as intended.

0 Likes
Message 3 of 8

Miguel49
Not applicable

Hello,

Regarding to this exercise, I have a doubt. What happens if we have different types for the items and for each one you have different number condition for the subnodes.lenght.

0 Likes
Message 4 of 8

Jose6
Not applicable
Hello @Kavika F ,

I'm creating a similar model, but mine has different item Types, and each type has a different threshold. So the thing is that I only want to close input for the Types that are above of their threshold. I don't know how to do it. I have created a global table, where there is the threshold number that has each type, but I don't know how to continue.

0 Likes
Message 5 of 8

joerg_vogel_HsH
Mentor
Mentor
@Jose433 , please ask a new question.

In the meantime you can elaborate with input pull or think about to use more queue objects. Sometimes a solution does not consist of more source code rather than more objects.

0 Likes
Message 6 of 8

joerg_vogel_HsH
Mentor
Mentor

@Miguel49 , please ask a new question, because such approach needs more than just closing an input of an object. You need a balance system. You need an input control mechanism. And you must evaluate events to continue input again after your input has been closed.

0 Likes
Message 7 of 8

jason_lightfoot_adsk
Autodesk
Autodesk
If you are pulling by matching type you won't need to close and open ports.
0 Likes
Message 8 of 8

jason_lightfoot_adsk
Autodesk
Autodesk

If you are pulling by matching type you won't need to close and open ports.

0 Likes