time load/unload

time load/unload

alexandra_d
Not applicable
39 Views
22 Replies
Message 1 of 23

time load/unload

alexandra_d
Not applicable

[ FlexSim 19.0.0 ]

Hi! In order to simulate correctly, the system must enter in the production supply chain a different loading time and a unloading time depending on the destination of the operator (Operator_P1, Operator_P2, Operator_P3). So, I created 2 tables:

Unloading (1 row, 2 columns: pp-uri; vp-uri, tp_1, cp_1); 1623922230394.png

Loading (1 row, 2 columns: pp-uri; vp-uri, tp_1, cp_1) 

1623922269946.pngand I set the number label (row_number) to each processor with value 1 for pp-uri

ex1.jpg...........................................................

ex13.jpg and value 2 for vp-uri, tp_1, cp_1.

ex14.jpg...........................................

ex18.jpg

ex18.jpg

Process flow now looks like this
ex21.jpgCode Snippet: 
for Load Code_P1: 
setvarnum(Model.find("Operator_P1"), "loadtime",Table("Load")[token.machine.row_number][1]);
for Load Code_P2: 
setvarnum(Model.find("Operator_P2"), "loadtime",Table("Load")[token.machine.row_number][1]);
for Load Code_P3:
setvarnum(Model.find("Operator_P3"), "loadtime",Table("Load")[token.machine.row_number][1]);
for Unload Code_P1:
setvarnum(Model.find("Operator_P1"),"unloadtime",Table("Unload")[token.machine.row_number][2]);
for Unload Code_P2:
setvarnum(Model.find("Operator_P2"), "unloadtime",Table("Unload")[token.machine.row_number][2]);
for Unload Code_P3:
setvarnum(Model.find("Operator_P3"), "unloadtime",Table("Unload")[token.machine.row_number][2]);
I have done all these steps and it does not take into account my loading and unloading times.
Can anyone tell me what I'm wrong about and what I should change? Please, help me!

LICENTA FIN.fsm

0 Likes
Accepted solutions (1)
40 Views
22 Replies
Replies (22)
Message 2 of 23

moehlmann_fe
Explorer
Explorer
Accepted solution

Hi @Alexandra D,

there are a couple things going wrong here:

First, the label "machine" that the "Load_Code_Px" activities refererences is not yet set when the token enters the activity for the first time. Just move the "Machine_Px" assign label activity up so it is done before the custom codes.

Also, that label actually points to the queue in front of the processor at that point (to make the operator unload the item there, probably to not overload processors?). The queues do not have the label "row_number".

To avoid adding labels to all queues, you can set the "machine" label to the processor itself, so the row_number can be read from there and then use

token.machine.inObjects[1] 

as destination in the unload acitivity.

In "Code_Unload_Px" you are trying to read from column two which doesn't exist.

In several "Load/Unload_Code_P2/3" activities you are setting the times for "Operator_P1" instead of P2 or P3.

Also, in "Table Code_x" you are referencing "token.label_with_time" - there is no such label defined on the token.

Lastly - and the hardest to find - the data in your "Load" and "Unload" tables is defined as "strings" (text) not numbers (the visual distinction is that text is aligned to the left of the cells, numbers to the right). To change this, right click on the column header and choose "Assign Data" -> "Assign Number Data".

setdatatype.png

licenta-fin_fixed.fsm

0 Likes
Message 3 of 23

alexandra_d
Not applicable

Thanks for the help! I took the steps you described, except for this one because I don't really understand it:

ex24.jpg

Could you explain through some pictures from my model?
I get an error with Operator_P3 in the model attached to you.
LICENTA FIN.fsm
0 Likes
Message 4 of 23

moehlmann_fe
Explorer
Explorer

I guess there were some misunderstandings, as the order of Process Flow activities seems different than what i assumed.

Could you tell me a little more about what you are trying to achieve?

1. Should be load time be dependent on the processor the item is going to or the one it is coming from?

2. What is the "label_with_time" that is missing in the "Table Code_Px" supposed to be?

3. Depending on the answer to question one: What should be the load time at the initial queues P1-P3?

0 Likes
Message 5 of 23

alexandra_d
Not applicable
So the load/unload time be dependent on the processor the item is going to. The label "label_with_time" appeared following a piece of advice received from a colleague on this forum, I don't know what it means, that's why I'm attaching your question:
ex26.jpg

ex25.jpg

The upload and download time should be taken from the created Load and Unload tables.

ex22.jpgand

ex23.jpg

0 Likes
Message 6 of 23

moehlmann_fe
Explorer
Explorer

Then I think the Process Flows should look like the following (Example for P1, the other two have to be changed accordingly):

rearrange-pf.png

1 and 8: I added two code activities to reset the load and unload times at the start and end of the Process Flow (so they are not still set from the last machine)

2 and 6: I set the label "StartTime" to the current model time to later write it to a table. Only the name of the activity is different, the label gets set the same way in both occurences.

3: This is the second "Machine_Px" activity from your Process Flow. Setting the label to a reference to the processor. It is important to set the label before you arrive at the "Load_Code_Px" activity for the first time.

4: The code i posted in my original answer returns the object that is connected to the first input port of the processor, so in this case the respective queue. This means you don't have to add another label to point to the queue.

5: Here I write to the table "MoveTimes": The operator, from where the item came, where it was transported, the start time and the finish time. The code for the second column is

Table("P1_process")[Math.max(token.operator_number-1, 1)][2]

This will get which machine the item visited last (or the current one if its the first).

7: Similar to five; writing to the table "ProcessTimes": The machine, which process, start and finish time.

I added both tables to model. They have five and four rows respectively and delete all rows on reset.

movetimestable.png

processtimestable.png

I also attach the model with the changes so you can compare to your model if necessary.

licenta-fin_FM.fsm

Message 7 of 23

alexandra_d
Not applicable
I tried the model attached by you and the same error occurred to all 3 operators. I redid the steps described by you in my model and I get the same error.
ex27.jpgWhat do you think is the cause?
0 Likes
Message 8 of 23

moehlmann_fe
Explorer
Explorer
Can you post a screenshot of the options in the unload activity and the labels on the token in that activity when the error occurs?
Message 9 of 23

alexandra_d
Not applicable
Did I understand correctly what you asked for?




ex29.jpg

Did I understand correctly what you asked for?

0 Likes
Message 10 of 23

moehlmann_fe
Explorer
Explorer

Ah, I didn't pay attention to what Flexsim version you are using, as the model opened without problem in the newest version (normally there is a message telling you if it was saved in an older one).

My apologies for that.

Try replacing the code in the "Unload_Px" activities with

token.machine.as(Object).inObjects[1]

so FlexSim recognizes it should treat "token.machine" as an object.

Also, from the error message it seems you might have set the "Item" setting in "Unload_P3" to "token.Type1" when it should be "token.Type3"

unloadp3settings.png


Message 11 of 23

alexandra_d
Not applicable

I succeeded! You are the best! Thank you for your patience and for helping me! Do you have any idea why the MoveTimes table is not filled in automatically?

ex30.jpg

0 Likes
Message 12 of 23

moehlmann_fe
Explorer
Explorer

Based on the error message it seems you missed the "T" of "Table" when pasting the code into the second field of one (or more) of the "Write Move Time to Table" activities.

In effect, FlexSim is complaining about an unknown command "able".

If it still doesn't work I would probably need the model again to view the entire log.

Message 13 of 23

alexandra_d
Not applicable
I searched for the missing "T" and couldn't find it. I'm attaching the model to you. Thanks again for the help! You`re awesome!
finallllllll.fsm
0 Likes
Message 14 of 23

alexandra_d
Not applicable
I discovered the problem. Thank you very much!
0 Likes
Message 15 of 23

moehlmann_fe
Explorer
Explorer
Glad to hear you fixed it. Always happy to help.
Message 16 of 23

alexandra_d
Not applicable
I realized when analyzing the simulation results that I omitted the fact that if the operator moves from vp / tp_1 / cp_1 to pp the duration must be different. At this point in the simulation model only the idea of moving to pp and vp / tp_1 / cp_1 is considered. How could I do this in this model?
0 Likes
Message 17 of 23

moehlmann_fe
Explorer
Explorer

I'm not sure I understand what exactly the goal is but I can show you a general solution to make the loading/unloading times dependant on the machine(-group) the item comes from.

For this I added a second column to the Load and Unload table. The first column are going to be the times used when the item is taken from a machine with row_number one, column two when taken from one with row_number two.

In the Process Flow I add a new label in the "Machine_Px" activities called "last_machine", which references the machine the item visited before the current one. For that I use the same code that is used in the "Write Move Time to Table" activity ("P1_Process" has to be adjusted to P2 and P3 of course):

Table("P1_process")[Math.max(token.operator_number-1, 1)][2]

Instead of getting the current machine, it looks up the last machine (token.operator_number - 1). The "Math.max()" command is to make sure the row_number doesn't become 0 on the first run through. This means the loading/unloading times from the initial queues P1-P3 will take the same time as if the item came from a machine in group one.

lastmachinelabel.png

Then, in the "Load_Code_Px" and "Unload_Code_Px", the column number "1" gets replaced by "token.last_machine.row_number". The column the time is taken from thus depends on the row_number label of the machine the item is loaded from.

newcodeline.png

This solution is scaleable, so if you need more granularity you can subdivide the machine groups by introducing more values for "row_number", adding a new row and column to the Load/Unload tables for each additional value (Have to be consecutive 1,2,3,...).

This way, in theory, you could define separate times for each pair of machines if you give all machines a unique "row_number" value.

licenta-fin_FM_v20190.fsm

I hope this helps with what you are looking to do.

Message 18 of 23

alexandra_d
Not applicable

It is not 100% correct what is being simulated now. So the loading/ unloading time from any pp to any vp or from any pp to tp_1 or from any pp to cp_1 must be 3600 seconds (1 hour), the loading/ unloading time from any pp to any pp must be 1800 seconds (0.5 hours), the loading/ unloading time from any vp to any pp or from any vp to tp_1 or from any vp to cp_1 must be 3600 seconds ( 1 hour), the loading/ unloading time from tp_1 to any pp or from tp_1 to any vp must be 3600 seconds (1 hour). This time must be seen as a matrix. The table below describes perhaps more clearly how the problem should be solved.

ex31.jpg

I apologize for the inconvenience and    for not being careful. This is the last     problem to be solved in my simulation model. Please, help me to finish this.
0 Likes
Message 19 of 23

moehlmann_fe
Explorer
Explorer

You can do this with the model I attached in my last comment. Swap the rows and columns in your table (or don't as it is symmetrical) and paste it into the model as the "Load" and "Unload" table. Then adjust the "row_number" labels on the processors accordingly (PP -> 1, TP -> 2, VP -> 3, CP -> 4)

4by4table.png

I apparantly forgot to do what I wrote in my comment and didn't adjust the the assignment of the "last_machine" label for the P2 and P3 flows, so they were getting the wrong machine information. I apologize for that.

This version should now work according to your matrix:
2*1800 for transports inside the same group, 2*3600 for transports between different groups.

licenta-fin_FM2_v20190.fsm

movetimes.png



Message 20 of 23

alexandra_d
Not applicable

I don't know why, but it doesn't open the model attached to you correctly. In any case, I will reproduce the steps described by you. I'll be back with feedback. Thank you from my heart for your patience and help!

ex32.jpg

0 Likes