How do I prevent service block from starting

我与影子孤独终老i 提交于 2020-01-17 00:37:46

问题


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.



来源:https://stackoverflow.com/questions/56883613/how-do-i-prevent-service-block-from-starting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!