Search code examples
anylogic

How to access a unit of a resource pool for condition in function


I am currently utilizing a hold block to restrict agent of type Patient passing to a seize block. Upstream in the model, Patient are assigned only 1 unit of Doctor that it will interact with downstream in the model every time is seizes Doctor (This is shown in photo one, in the Doctor resource pool).

The problem is that I would like to access this particular unit of Doctors in a function that I have, in order to check if that specific unit of Doctor is idle. Photo 2 is the function im using at the moment, and I would like to add this solution as the third condition in the if statements. It already checks if an Surgeon is available, but I need to add a check to see if their specific Doctor is available.

Photo 1 enter image description here

Photo 2 enter image description here


Solution

  • The units of a pool have to be accessed using the functions specific to them, and not their resource pool. Here, to check if the desired doctor is available, the third condition would be

    myPatient.doctor.isIdle() == true