Set Loading time when loading boxes

Set Loading time when loading boxes

hicham_elbaz6949F
Advocate Advocate
209 Views
5 Replies
Message 1 of 6

Set Loading time when loading boxes

hicham_elbaz6949F
Advocate
Advocate

[ FlexSim 24.2.2 ]

I would like to set different loading time for each Part Number based on global table (if part is in global table take it if not take a defaults number)

1736524729318.png

I tried using task delay as loading time and doing look up for part but the fork(lifter) keeps going up and down for each box picked. the only way fork is working properly is setting loading time in 3D object. is there any way to get label from process flow to 3D object or if there is any other solution I can do to get this one working. here is model loading_1.fsm

1736524625525.png


0 Likes
Accepted solutions (1)
210 Views
5 Replies
Replies (5)
Message 2 of 6

moehlmann_fe
Advocate
Advocate
Accepted solution

You can just read from the table in the load time field.

capture1.png

capture2.png

(If the "PartNumber" label exists on the item, use that to read a time from the table, otherwise return 0)

0 Likes
Message 3 of 6

hicham_elbaz6949F
Advocate
Advocate

Thank you @Felix Möhlmann

0 Likes
Message 4 of 6

hicham_elbaz6949F
Advocate
Advocate

@Felix Möhlmann just a follow up question I am getting this error I know the part is not in the list normally it should return 0 but it is not working properly. I tried reversing the condition still the same problem.

FlexScript exception: 1/006 is not a valid row name for Global Table "Loadingtime" at MODEL:/Forklift8>variables/loadtime at line 8

0 Likes
Message 5 of 6

moehlmann_fe
Advocate
Advocate
The code I posted only checks if the label exists and is not 0. "1/006" is not, so it will throw an error if that header does not exist in the table.

Checking if a row header exists would require a for-loop. If you copy the headers into a separate column, you could first use 'Table.getRowByKey()' to check if a row with that value exists. If yes, return the time from that row. If not, return 0.

0 Likes
Message 6 of 6

hicham_elbaz6949F
Advocate
Advocate

Thank you @Felix Möhlmann I did use two "if statement it" look like it did work. here is the code

/** Custom Code */
Object item = param(1);
Object current = ownerobject(c);
treenode station = param(2);
Table pickingTable = Table("Loadingtime");

// Check if PartNumber label exists when I am loading pallet to load boxes
if (!item.PartNumber?) {
    return 0;
}

// Find the row index
int rowIndex = pickingTable.getRowByKey(item.PartNumber, 1);

// If row exists
if (rowIndex > 0) {
    return pickingTable[rowIndex][2];
}
return triangular(33,40,35);