Home > Back-end >  Anylogic: how to end wait block on schedule, not on timeout
Anylogic: how to end wait block on schedule, not on timeout

Time:06-23

I want a boat to leave the port every 120 minutes, from the start of my model.

The boat arrives on an exponential distribution, it enters in a restricted area (the port) and enters in a wait block in order to embark all the passengers. I tried to use "Enable exit on timeout", but the timeout starts when the boat enters the wait block and I want the boat to respect the scheduled intervals. (I don't care about hour or day, but only about fixed intervals)

I used a schedule block, I removed "Enable exit on timeout" on wait block, but I cannot establish a connection between Schedule and Wait block: for the moment the boat remains at the port and doesn't leave.

Thank you in advance for your help

CodePudding user response:

Disable the "exit on timeout". Boats will now be in the Wait block forever, unless you free them explicitly.

Use the Schedule action code to call myWaitBlock.free(agent) where agent is the boat you want to leave.

If you only have 1 boat in the wait block, it can be myWaitBlock.free(myWaitBlock.get(0)), else loop across all agents inside it to free whichever boat you want.

  • Related