Anylogic detect that agent stopped on conveyor

Viewed 39

is there any easy way to detect that agent stopped on a roller conveyor because there are other agents ahead? I tried to use dynamic variable and conditional event but it is consuming too much performence. I don´t want to go for dynamically checking condition (with cyclic event) because I have some bad experience with it.

Thanks!

2 Answers

Try this:

Create a LinkedList<YourAgentType> agentsOnConveyor.

Whenever an agent enters the conveyor, call agentsOnConveyor.addLast(agent). When it leaves, call agentsOnConveyor.removeFirst(agent).

Now you have a linked representation of the agents on the conveyor.

Last, you use the "on stopped" field in the conveyor and pass the message "upstream" through the linked list, i.e. use a for-loop from the first to the last entry and send them a msg "conveyor stopped".

You may still need to check if the individual agent is moving itself or has also stopped, but it might put you on a working path

I will try to explain the situation in deeper detail. We are using positions on conveyor as a buffer for transporters. When first transporter arrives to this position, it is added to buffet and we can easily detect it. When second transporter stops behind the first which is already in buffer, second transporter is as well aded to this buffer. You can see described situation in next picture:

Transporters going to buffer

Problem is, how to detect that the second transporter stopped, when it is still in the convey to buffer block as you can see in second picture:

Transporters in convey block

We generally don´t know when the second transporter arrives so we can´t use any dynamic events or something similar.

Related