question

Krish S avatar image
1 Like"
Krish S asked Jason Lightfoot commented

Making items wait till it has space to move again

Hi, I have the following problem. I need to send a pallet to 3 stations from a conveyor. I am adding a decision point to select which station it needs to go. But if none of them are free, it will wait till one of it is empty.

Currently if I do this it is sending to the last processor regardless of whether its empty or full. Attaching the file. I need the part to wait till one of them is free.

DP sender Example.fsm

FlexSim 18.1.2
decision pointsflexsim 18.1.2wait
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

·
Brandon Peterson avatar image
1 Like"
Brandon Peterson answered Jason Lightfoot commented

@krish.s,

I didn't have version 18.1.2 on my computer so I had to use the latest version. As a result I will post the pictures of the changes that I made in case you can't open the model.

The reason that the items are not waiting at the decision point is because you are not telling them to do so. So, the first thing that I did was change the decision point logic so that on arrival it would stop the item is all three variables were set and so that it would store the item as a new global variable "variable4".

Next, I moved your original code to the OnContinue trigger and added 4 additional lines. The first line is at the very beginning and just resets variable4 to 0. The other three lines are in the if statements and set the colors of the items (I did this so that I could see where each item had been assigned) but are not necessary for the fix.

Lastly, I needed to modify the ExitTrigger of each processor to check for a waiting item and resume it if it existed.

With these changes I believe that the model is functioning the way that you envisioned. That last little bit of code looks scary but I simply looked at the underlying code for the StopItem portion of the OnArrival of the decision point and copied most of that.

I Hope this helps,

Brandon

dp-sender-example.fsm



1597182911335.png (18.9 KiB)
1597182921794.png (13.3 KiB)
1597183090554.png (54.1 KiB)
1597183153966.png (20.2 KiB)
· 4
5 |100000

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

Krish S avatar image Krish S commented ·

Amazing. It works!

if(objectexists(variable4))

variable4.up.as(Conveyor).itemData[variable4].resume();

What does this code mean?

1 Like 1 ·
Brandon Peterson avatar image Brandon Peterson ♦ Krish S commented ·

@krish.s

variable4 is set to 0 whenever an item is not waiting for an open processor and it is set to the item when one is waiting for a processor.

The first line of code checks to see if there is an item waiting for a processor. If there is then the second line of code tells the conveyor to resume conveying the item that is waiting. This allows the OnContinue trigger to fire and send the item to the available processor.

"variable4" is the item waiting

"variable4.up.as(Conveyor)" returns the conveyor that the item is on

" variable4.up.as(Conveyor).itemData[variable4].resume()" tells the conveyor to resume the item referenced by variable4

I hope this clears things up a little. I'm sure a developer could get more into the details with you. I don't try to remember exactly how it works. I just select the resume item picklist option in another object and then edit the code so that I can copy the basic idea and modify it to what I need where I need it.

Good Luck,

Brandon




1 Like 1 ·
Krish S avatar image Krish S Brandon Peterson ♦ commented ·

Makes sense. Thanks!

0 Likes 0 ·
Show more comments

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.