How do I prevent service block from starting

2019-08-20 12:26发布

问题:

I'm new to Anylogic, and I was wondering if it's possible to hold delay process when the shift is over eve if the process already started.

I'm trying to write some code in the service action but i don't find the correct code lines.

i expect the flow process should stop until the next resource shift will start.

回答1:

You can do that using the custom resource choice in the service block:

self.delayTime(agent)<schedule.getTimeoutToNextValue()

This means that a resource can only be chosen if the delay time for that agent will be smaller that the time for the next schedule event.

If you have doubts on how time units are working on your model, you can play safe and explicitly define the time units like this if the delay time is in hours.

self.delayTime(agent, HOUR)<schedule.getTimeoutToNextValue()

Be sure that your model time is in hours, because the function getTimeoutToNextValue will be defined depending on the time units you are using in your model.



标签: java anylogic