流程代理逐一anylogic

时间:2021-04-14 20:14:38

I'm simulating a Process in anylogic in which I need my agents to flow from a queue to a Service one by one, and only when the service is empity (namely when the preceding agent has finished with it). How can I do? I tried using an Hold between the queue and the service that's true only when the service is empty, and it is ok, but I need the agents to flow one by one and not all together.

我在任何逻辑中模拟一个进程,我需要我的代理逐个从队列流向服务,并且只有当服务是empity时(即前一个代理完成它)。我能怎么做?我尝试在队列和服务之间使用Hold,只有当服务为空时才是真的,并且没关系,但是我需要代理逐个流动而不是一起流动。

Thanks for your help!

谢谢你的帮助!

1 个解决方案

#1


1  

you can use a "wait" block before the service block and when your service block is empty you do the following:

您可以在服务块之前使用“等待”块,当服务块为空时,您可以执行以下操作:

if(wait.size()>0 && service.size()==0)
wait.free(wait.get(0))

you have to put this code in 2 places:

你必须把这个代码放在2个地方:

  • on seize of the service block
  • 抓住服务区块

  • On enter in the wait block
  • 输入等待块

Another way of doing this is to replace the service block by a combination of seize delay release and you use a restricted area start and restricted area end between the seize block and you restrict the number of agents to 1 (if you want to have a maximum of 1 in the service queue) or put the restrictions between the service block if you want the queue to always be zero.

另一种方法是通过抓住延迟释放的组合替换服务块,并在seize块之间使用限制区域开始和限制区域结束,并将代理程序数量限制为1(如果要有最大值)如果您希望队列始终为零,则在服务队列中添加1或服务块之间的限制。

Choose your favorite one

选择你最喜欢的一个

#1


1  

you can use a "wait" block before the service block and when your service block is empty you do the following:

您可以在服务块之前使用“等待”块,当服务块为空时,您可以执行以下操作:

if(wait.size()>0 && service.size()==0)
wait.free(wait.get(0))

you have to put this code in 2 places:

你必须把这个代码放在2个地方:

  • on seize of the service block
  • 抓住服务区块

  • On enter in the wait block
  • 输入等待块

Another way of doing this is to replace the service block by a combination of seize delay release and you use a restricted area start and restricted area end between the seize block and you restrict the number of agents to 1 (if you want to have a maximum of 1 in the service queue) or put the restrictions between the service block if you want the queue to always be zero.

另一种方法是通过抓住延迟释放的组合替换服务块,并在seize块之间使用限制区域开始和限制区域结束,并将代理程序数量限制为1(如果要有最大值)如果您希望队列始终为零,则在服务队列中添加1或服务块之间的限制。

Choose your favorite one

选择你最喜欢的一个