Great question! This is a difficult logic to implement. The nurse is assigned to up to 4 people and then she can serve 1 of them at a time.
To do this I would have a patient be assigned to a nurse upon entry. They would search for the first nurse that has less than 4 people assigned and then "register" with this nurse. Then if they need treatment you would have the patient wait to seize the nurse it has been assigned to.
To start create a new agent called nurse, with a variable of type LinkedHashSet that will store agent of type patient.
In the agent parameters remember to set the nurse as resource unit.
Create resource pool of nurses and a population for nurses, adding new resource units to the nurse population
Now when a patient need to assign it self to a nurse do this function on your nurse population.
You can call this code when ever a patient enters a process modelling library block where it gets assigned to a nurse. (I also added a nurse variable to the patient so that the patient knows which nurse it is assigned to)
Now when a patient needs to seize a nurse for an injection or some other activity it can know to seize the nurese assigned to it.
发布评论
评论(1)
很棒的问题!这是很难实现的逻辑。护士最多被分配给4个人,然后她可以一次服务1个人。
为此,我将在入境时将病人分配给护士。他们将寻找第一位分配不到4人的护士,然后在该护士中“注册”。然后,如果他们需要治疗,您将有患者等待抓住已分配的护士。
在代理参数中,请记住将护士设置为资源单位。

当患者进入过程建模库块时,您可以调用此代码,并将其分配给护士。 (我还向患者添加了一个护士变量,以便患者知道要分配的护士)
Great question! This is a difficult logic to implement. The nurse is assigned to up to 4 people and then she can serve 1 of them at a time.
To do this I would have a patient be assigned to a nurse upon entry. They would search for the first nurse that has less than 4 people assigned and then "register" with this nurse. Then if they need treatment you would have the patient wait to seize the nurse it has been assigned to.
In the agent parameters remember to set the nurse as resource unit.

You can call this code when ever a patient enters a process modelling library block where it gets assigned to a nurse. (I also added a nurse variable to the patient so that the patient knows which nurse it is assigned to)