question

WillRS avatar image
0 Likes"
WillRS asked WillRS commented

Priority changing alternately over time

Hello everyone!

In this model, I have a truck loading process that works based on priority, depending on the schedule.

For example, Type 1 trucks have priority in the first 6 hours of simulation, then Type 3 trucks have priority for another 6 hours, alternating.

During the Type 1 priority schedule, I can have a maximum of 2 docks at the same time for Type 3 loading.

During the Type 3 priority schedule, I can have a maximum of 2 docks at the same time for Type 1 loading.

I tried to solve this in two ways:

1) I tried to create priorities for the docks and invert between Schedule 1 and Schedule 2. But this logic did not work!

2) I created a zone to restrict the access of tokens that were not priority, to a maximum of 2, through partition. This worked, but I cannot update the partition restrictions by code. I don't know if it's possible using Process Flow Variable

Another alternative, which might work, would be to emulate a zone from a list, but I couldn't create this logic.


Could you help me?

Priority_Change_by_time_Resource_v3.fsm

FlexSim 23.0.15
zonestoken priority
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 WillRS commented

I would probably use a list with a custom expression that is used to forbid a given type from pulling a dock when that would surpass the limit.

In the attached example model a partitioned zone is used to be able to tell how many docks (processors) are occupied by a given type. The limit is part of the list field code. During 12AM to 12PM type 2 must not pull more than 2 processors at a time, from 12PM to 12AM type 1 is limited.

limit-by-timeofday-fm.fsm


· 7
5 |100000

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

WillRS avatar image WillRS commented ·

Hello Felix

Thanks for the answer! This way, it worked perfectly.

But I confess that I couldn't understand the programming logic, I would like to ask for some clarifications:

- The operating logic of the code of the expression belowLimit and the filter "WHERE belowLimit > 0"

- I also didn't understand the tokens created in the "Source - Prio Change" block. Are they to reevaluate the restriction?

Why is it necessary to create the partitions in the Zone, before starting the simulation in the Processors?

Could you please give me a little more detail so that I can understand.

Thanks in advance!

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann WillRS commented ·

The code first checks if the type of the pulling token currently has priority. If so it returns 1, otherwise it only returns 1 if there are less than 2 tokens of that type currently in the zone, otherwise 0.

1730963257270.png

A token can only pull a value for which the "belowLimit" expression returns 1. The expression doesn't actually depend on the value (processor) but limits how many tokens of the not-prioritized type are allowed to pull a value.

Yes, the tokens from "Source - Prio Change" exist to reevaluate all backorders. Since the "prioType" will change some of the waiting tokens might now be allowed to continue. Backorders are normally only reevaluated when a new value is pushed to the list, so I do this 'manually' whenever the priority changes (midday and midnight).

At the start of the model, If you try to read the content of a partition that does not exist yet with "getstat()" the function will return some extremely large default value. Without initializing the partitions, this would prevent any tokens of the non-prioritized type from advancing.

0 Likes 0 ·
1730963257270.png (38.1 KiB)
WillRS avatar image WillRS Felix Möhlmann commented ·

Thanks for the explanation, Felix!

Now, my model has increased in complexity. In the schedule, I need to prioritize 3 types of trucks in the first 6 hours and then invert the priority:

Example:

Schedule a) Priority: 1, 2 and 3

Schedule b) Priority 4

How could I adapt this code?

If you prefer, I can open a new question.

Once again, thank you very much for your help!

0 Likes 0 ·
Show more comments