How to destroy rack contents (without process flow) based on a schedule?

How to destroy rack contents (without process flow) based on a schedule?

robert_hambright
Not applicable
6 Views
5 Replies
Message 1 of 6

How to destroy rack contents (without process flow) based on a schedule?

robert_hambright
Not applicable

[ FlexSim 16.2.0 ]

I have recently asked two questions about "resetting" the 3D racks by clearing their contents every time the source delivers items based on scheduled arrivals. These questions are here:

https://answers.flexsim.com/questions/28225/how-do-i-reset-the-racks-when-new-items-arrive.html

https://answers.flexsim.com/questions/28744/replicating-a-3d-source-in-process-flow.html

They were both answered perfectly and work as intended using Process Flow.

I have created a larger model using all 3D objects (before I learned Process Flow) and I tried to integrate these answers into the model. I am having a lot of trouble doing this and I can't seem to make my model work correctly when I try to integrate process flow. Here is a small piece of my larger model: clearing-racks.fsm

I want to know if/how resetting all three racks can be done before arrival of new items in the model attached without using process flow.

The response below was answered on my first post and I understand the logic...I just don't understand how to execute it. I am not new to coding entirely but I am new to writing code in FlexSim.

2833-qmpxa.png

Any help will be very appreciated! Thanks!

Accepted solutions (1)
7 Views
5 Replies
Replies (5)
Message 2 of 6

matt_long
Not applicable
Accepted solution

I know you said to do this without Process Flow, but I found it easier than trying to send messages and write a bunch of code.

The attached model listens for the OnCreation of the two Sources to kick of tokens that will clear all of the Transporter's task sequences and destroy all of the flowitems. The extra things I had to do with this larger model were:

1) I added a bit of code to the OnReceiveTaskSequence trigger of the transporter to tag each flowitem with its destination, that way I can call transportincomplete().

2) One of the bigger tricks was to make sure the Source waited until the the Transporter finished its task before clearing the rack and allowing the new batch of items in. There is a label on each of the Source's that determine whether the rack should be cleared or not, and I close and open the inputs of the rack as needed.

2836-processflow.png

Since the Incoming Blue is connected to two racks, I get a reference to each of them and you'll see there are two Run Sub Flow's for clearing the rack contents. When the Incoming Black source's token moves through the Clear Second Rack, it just does nothing and immediately moves on as there is no second rack. If you end up adding more racks so you have 3 or 4 or more, it'd probably be better to loop through each of the Source's outputs instead of explicitly calling the Sub Flow on each rack.

clearing-racks-updated.fsm

Message 3 of 6

robert_hambright
Not applicable

Thank you for the response Matt. I tested your model and it works perfectly until the arrivals at 2880. For this time (and times after), I noticed two things. I think the new items are created first and then destroyed with the old objects. I also noticed that at delivery time 4320, the new objects are created but then after the forklift takes one item to a queue. Do you know why this happens only at this time and beyond? Thanks!

0 Likes
Message 4 of 6

matt_long
Not applicable

Right, you just need to add another Close Rack Inputs after the Open Rack Input so that we let all of the new items in and then close it off for the next batch.

2842-closeports.png

The Delay I put between the two is just for 1 second, just so all of the items exit the source before closing the inputs.

Basically the Close Rack Inputs on the left is important for the first set of items that come in, and this Close Rack Inputs handles the rest of them.

0 Likes
Message 5 of 6

robert_hambright
Not applicable

That makes sense. It worked, thanks! I got an error in the transportincomplete on my larger model but I will try to debug that. Last question: what would happen if you wanted to add a second forklift?

0 Likes
Message 6 of 6

matt_long
Not applicable

Right now the forklift is hardcoded, but if you wanted to add more I would suggest creating a Resource tied to the forklift with a quantity 2. Then you can use the Acquire and Release Resource activities.