What takes priority (1) Order by statement in Queue strategy or (2) Enforce Queue Order
What I am trying to do is allow urgent tokens, then pick tokens belonging to a random order group from remaining tokens.
What takes priority (1) Order by statement in Queue strategy or (2) Enforce Queue Order
What I am trying to do is allow urgent tokens, then pick tokens belonging to a random order group from remaining tokens.
As far as I'm aware "Enforce Queue Order" only serves a purpose when the zone is partitioned or has subsets with limited quantities. In that case, only the token that is first in the queue can enter the zone, even though others could enter earlier because their partition would have space while the one of the first token doesn't.
If the zone is not partitioned, the queue order is always adhered to anyway.
If I understand you correctly, you are trying to let token with the "urgentFlag" enter in the order they arrive at the activity. If there are no such tokens, a random one is chosen from the non-urgent tokens.
To do that you can use a extra label that orders the urgent tokens, but is equal for all non-urgent tokens. If you then order by urgentFlag first, the extra label second and random third, this should result in the behaviour described above.
If urgentFlag is set, the "prioFIFO" label is set according to the activities input statistic (so later tokens will have a higher value). If not, the label is set to 0.
Thanks for the response Felix! Probably I did not explain the non-urgent part clearly. Multiple tokens belong to an order and when I am picking a random non urgent token, I want to pick all the tokens associated with the selected (randomly selected) order. Adding an example for clarity
Would it be better to put all these tokens into a list? I started with a zone as I wanted to control the number of tokens in that portion of process flow.
Conceptually a list might be easier. You could build a logic that keeps pulling tokens while there is space in the zone, priotizing tokens with the same ID as the last pulled token over everything else, then by rules I use for the zone.
You can build the same logic with just the zone. It probably requires fewer activities but a bit of custom code.
The process flow itself gets two labels. An array label to keep track of the tokens that are still pending at the zone entry and a number (or string) label that holds the OrderID of the token that last entered the zone.
Before the tokens enter the "Enter Zone" activity they are added to the array and assigned a copy of the "LastOrderID" label of the process flow. This allows to use the expression "OrderID == LastOrderID" in the queue strategy. If the label values are equal, so if the token belongs to the same order as the token that last entered the zone, this evaluates to 1, otherwise to 0. Ordering by this expression is descending order first makes sure that tokens with the same ID have priority over all others.
Once an item enters the zone it updates the "LastOrderID" label on the process flow and each pending token, which is why the array is needed; to have a reference to the waiting tokens. The token also removes itself from the array.
This overall results in tokens of the same order always entering in direct succession, prioritized by the "urgentFlag" and otherwise random.
(The first urgent tokens are created after a delay, which is why OrderID 1 can enter first)
14 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved