Direct question: how to check if an agent is waiting in the wait block?
More details? below, thank you.
I was following Mr. Felipe's answer to a similar question (this one: Anylogic - Combined multiple items back to original owner )
On step number 4 of his answer, he said " On the passengerWait, on the onEnter action you will check if all the bags connected to the passenger are on the bagWait block... if they are... then you will free (wait.free(agent)) the passenger and the bags "
Do you know how to check this? I have the same problem between single patient and single drug.
I figured out how to do that:
variable_IsWaitingForBag
variable_IsWaitingForPassenger
onEnter
of passengerWait
, use the following:
if(agent.agentLink_myBag.getConnectedAgent().variable_IsWaitingForPassenger)
{
passengerWait.free(agent);
bagWait.free(agent.agentLink_myPassenger.getConnectedAgent());
}
agent.variable_IsWaitingForBag=true;
onEnter
of the bagWait
block