question

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

Set time variable in model parameter table

Hi,

I'm working on a reinforcement learning project. In my model I have 2 queue, one for the pallets and one for people, both with 5 types of objects. In my observation space, a model parameter table, I have 5 parameters, one for each type, that count how long a whole typology is waiting in the queue in time. A maximum of 25 people of the same type are moved on the pallet. How do I set these time parameters so that they tell me how long they’ve been in the queue and once they’ve been moved to start the timer again in case there are people of the same type or do it when they arrive?

To understand better, if I have "red wating time" as a parameter, this will tell me how long red people are waiting to be processed in the queue. Once this happens if there are other red people in the queue the timer starts again, otherwise it will start again when new ones are generated from the source.

Thank you for the answer.

FlexSim 22.0.16
reinforcement learningmodel parameters tabletiming
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
0 Likes"
Felix Möhlmann answered

You can read the time when an item entered an object with "getentrytime(object)". I would suggest to store the earliest entry time for each type (for example as labels) on the queue. Start with some huge value, so the entry time would always be in the future. When an item enters, set the label to the minimum of the current time and the current label value.

current.EarliestEntry = Math.min(Model.time, current.EarliestEntry)

After a batch has exited the queue, reset the label to the starting value and loop through all remaining items, again assigning the minimum value.

current.EarliestEntry = Math.min(getentrytime(itemRef), current.EarliestEntry)

When the waiting time is needed, you calculate it as the difference between the current model time and the label value.

5 |100000

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