Anylogic:如何让座席排队等待更改状态? (离散事件流程图) [英] Anylogic: How to keep an agent waiting in queue until it changes state? (Discrete Events flowchart)
问题描述
我开始将Anylogic用于模拟类,为此,我需要对以下行为进行建模:有大量的代理进入FIFO队列,然后进入服务器(我对此进行了延迟建模)一次).代理具有两个状态(分别称为A和B),如果一个代理在状态A下到达队列的末尾,则必须等到返回状态B才能进入服务.
I'm starting to use Anylogic for a simulation class, and for this I need to model the following behaviour: there's a stream of agents that enter a FIFO queue, and then enter into a server (that I modeled with a delay block), one at a time. The agents have two states (call them A and B), and if an agent reaches the end of the queue in state A, it has to wait until it returns to state B to go into the service.
我认为在队列和延迟块之间有一个可以容纳一个代理的等待块可能会解决这种情况.但是我不知道如何使等待块在状态改变后立即释放代理.
I think a wait block with capacity for one agent, between the queue and the delay block could potentially solve this situation. But I don't know how to make the wait block to free the agent as soon as it changes state.
欢迎使用其他方法.我只需要将代理保留在延迟块之前,只要它处于状态A即可,但不再保留.预先感谢.
Other methods are welcome. I just need the agent to be retained before the delay block as long as it is in the state A, but not any longer. Thanks in advance.
推荐答案
是的...我将在您的队列块之后等待一个容量为1的等待块.
Yes... a wait block with capacity 1 after your queue block is what I would do.
现在,当您的代理进入状态时,在该stateB的进入操作上,您将执行以下操作:
Now when your agent enters the state, on the entry action of that stateB you do the following:
if(currentBlock().equals(main.waitBlock) && main.service.size()==0){
main.waitBlock.free(this);
}
您还需要在等待块的输入时"执行此操作:
You will also need to do this in the "on enter" of the wait block:
if(agent.inState(agent.stateB) && service.size()==0){
self.free(agent);
}
此外,以防万一,在main中添加您的座席类型填充0,以便可以使用main.在您的座席州代码中.
also, just in case, add a population of 0 of your agent type in main, to be able to use main. in your agent state code.
这篇关于Anylogic:如何让座席排队等待更改状态? (离散事件流程图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!