I’m trying to model a queue of ships that utilize a static resource which is a single dock (using flowcharts). The queue has three types of agents A, B, and C which have priorities 1, 2, and 3 respectively (this means that ship C has priority in the queue to utilize the dock). Now I need to model the following two behaviors related to preemption:
- The task of unloading the ship (the dock’s task when seized) must preempt when ship C arrives BUT not when ship A or B arrives. This means that the priorities defined in the “Task priority” field are valid to define the queue order of attention but not for preemption. The priorities for preemption should be: Ship A and B with priority 1 and Ship C with priority 2. How can I separate the priorities “ratings” for the queue from the priorities used to determine preemption?
shows the issue of having the same priority for queue and preemption
- When the task preempt, I need to move the current ship that is using the dock, to a waiting area, and when the task that caused the preemptions ends, the ship that preempted, must return to where the static resource is (the dock) and resume its delay block. How can I do this? I tried using the outPreempted port of the Seize block to add a moveTo block to move the agent to the waiting area, but this port seems to work only when preemption causes to end the task (terminate serving option). The flowchart of the described queue I’m trying to model is shown on the image with some red lines trying to explain intuitively (but wrong) what I’m trying to do:
