question

Robert Hambright avatar image
1 Like"
Robert Hambright asked Matt Long commented

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

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.

Any help will be very appreciated! Thanks!

FlexSim 16.2.0
racks
qmpxa.png (21.6 KiB)
clearing-racks.fsm (29.8 KiB)
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

Matt Long avatar image
3 Likes"
Matt Long answered Matt Long commented

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.

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


· 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.

Robert Hambright avatar image Robert Hambright commented ·

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 0 ·
Matt Long avatar image Matt Long Robert Hambright commented ·

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.

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 0 ·
closeports.png (79.1 KiB)
Robert Hambright avatar image Robert Hambright Matt Long commented ·

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 0 ·
Show more comments