简体   繁体   中英

Releasing agent from queue based on conditions anylogic

Agents currently get sent into a queue based on a condition put in a selectOuput previously. I would like the agents to be released from the queue upon satisfying a condition in the Queue block. The condition being if the agent is a morning agent or not AND there is an idle doctor for that morning or afternoon patient. Currently I have the code below in the On at exit section:

if (agent.isMorning == true && doctorMorning.idle()  > 0)
    queue1.release(agent);

if (agent.isMorning == false && doctorAfternoon.idle()  > 0)
    queue1.release(agent);

The problem is that the agents never get held up in the queue but instead pass right through it, even when there are no idle doctors ie even when both conditions are satisfied

instead of a queue use a wait block (you can find that one on at the end on the auxiliary blocks when you look it up on the process modeling library)

then you can do the same you are already doing, but instead you use wait.free(agent)

the queue object doesn't stop the agents from moving forward, unless there's no space...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM