Count the number of boxes on a pallet

Count the number of boxes on a pallet

lorenzo_pio_g
Not applicable
25 Views
18 Replies
Message 1 of 19

Count the number of boxes on a pallet

lorenzo_pio_g
Not applicable

[ FlexSim 22.1.3 ]

Hi! My model has a combiner that groups 10 boxes on a pallet. How can I instantly count the number of boxes on the pallet?

0 Likes
Accepted solutions (1)
26 Views
18 Replies
Replies (18)
Message 2 of 19

Jeanette_Fullmer
Community Manager
Community Manager
Accepted solution

If you have a reference to the pallet then you can look at its subnodes length

pallet.subnodes.length
Message 3 of 19

lorenzo_pio_g
Not applicable

How can I create a reference to the pallet?

0 Likes
Message 4 of 19

Jeanette_Fullmer
Community Manager
Community Manager

There are many ways.

One way is to create an Event triggered source that looks at the combiner for on exit or on process finish and the exiting item label is the pallet.

1665158700808.png

0 Likes
Message 5 of 19

lorenzo_pio_g
Not applicable

Sorry, but I can't figure out which window is this.

0 Likes
Message 6 of 19

Jeanette_Fullmer
Community Manager
Community Manager
0 Likes
Message 7 of 19

lorenzo_pio_g
Not applicable

1665160349708.png

That's my model. I want to know instantly how many boxes are on the pallet on the combiner

0 Likes
Message 8 of 19

Jeanette_Fullmer
Community Manager
Community Manager
In the future please follow out best practices (Please read them) and attach your model with your questions.

Could you be more specific at what point you want to know? After each item is loaded? After its been processed? Just change the event on the source.

0 Likes
Message 9 of 19

lorenzo_pio_g
Not applicable

So do I have to use a processflow?

0 Likes
Message 10 of 19

Jeanette_Fullmer
Community Manager
Community Manager

It is one way you could do this. I could not tell you all the ways because there are so many. If you would like advice on the best way, could you provide more detail in what you are trying to accomplish?

0 Likes
Message 11 of 19

lorenzo_pio_g
Not applicable

Bakery1.fsm

In my model I have 2 robots. At the beginning both robots carry the boxes on the combiner at the bottom. Through reinforcement learning I want to train the second robot (the top one) to choose which combiner to deposit the boxes on. As you see, the combiner collects the boxes on a pallet: as soon as the boxes on a pallet become 10, the combiner passes the goods on the left queue. To use reinforcement learning, I would like to find a way to know instantly how many boxes are on the pallet on the combiner, waiting to be processed.

0 Likes
Message 12 of 19

Jeanette_Fullmer
Community Manager
Community Manager
Model.find("Combiner1").as(Object).getVariable("currentcomponentsum");

componentSum.fsm

0 Likes
Message 13 of 19

lorenzo_pio_g
Not applicable

Did you use process flow?

0 Likes
Message 14 of 19

lorenzo_pio_g
Not applicable

the process flows of the project you sent me are empty

0 Likes
Message 15 of 19

lorenzo_pio_g
Not applicable

Can I use the command you recommended to use in a trigger for the robot?

0 Likes
Message 16 of 19

Jeanette_Fullmer
Community Manager
Community Manager
Yes,

I used it in the script window to show you it worked.

0 Likes
Message 17 of 19

lorenzo_pio_g
Not applicable

Can I Use an On State Change Trigger? In this case i set:a variable called numItem that i will use as observation for the RL

numItem = Model.find("Combiner1").as(Object).getVariable("currentcomponentsum");


0 Likes
Message 18 of 19

Jeanette_Fullmer
Community Manager
Community Manager

Is numItem a parameter?

Model.parameters["numItem"].value = Model.find("Combiner1").as(Object).getVariable("currentcomponentsum");
0 Likes
Message 19 of 19

lorenzo_pio_g
Not applicable

Yes, numItem is an integer that I initialized in the Observation table

0 Likes