question

mUg24 avatar image
0 Likes"
mUg24 asked Felix Möhlmann answered

Problem with arrays in process flow with token.pulled.pop() function

I have a draft model of a warehouse where orders are received every 100 seconds and each of them requires a specific number of a given type of flowitem.

In the model there is a source that creates flowitems and gives to each of them a specific item type. The information is pushed to a Item List.

An operator must transport all the required items to the "Almacen" queue to complete an order. But there is a restriction of capacity, the operator can only load three items at max.

To achieve this I have defined two subflows where the token.pulled items of an order are carried three by three to the "Almacen queue".

The process flow seems to work but when I looked how the items are entering to the "Almacen" queue, the total requested quantity of an order is not completely delivered to Almacen. I don't know if I am missing something in the logic.

As well, I have a second problem. I am using at the subflow token.pulled.pop() function and it is erasing the array information at token.pulled, which is needed to move all the flowitems of a an order from "Almacen" queue to "Storefront" queue. I tried to copy the array information of token.pulled to another assigned a token label called contenidocajas, but once the subflows end and release the token all information is gone.

This is the model: Modelo pop.fsm

Thank you in advance!

@Felix Möhlmann @Joerg Vogel


FlexSim 21.2.2
process flowpull from listarraywarehousinglabel array
modelo-pop.fsm (62.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

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered

"token.pulled.pop() [...] is erasing the array information at token.pulled"

That's what array.pop() does - it removes the last element from an array and uses it as the return value of the function.

If you assign an array to a different label like you are doing currently, the two arrays will be linked. Changes to one label will be applied to the other as well. To create an inpedendent copy of an array, use "array.clone()" (token.pulled.clone()).

Also you are currently running the unload subflow only once. Because you want to unload all items the operator is currently carrying you can use "token.operador.subnodes.length". This returns the number of items currently being transported by the operator.

5 |100000

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

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.