Skip to content
Advertisement

SimPy, How to incorporate a break for resources?

At the moment I am creating doctors as following:

JavaScript

These doctors are requested for a flow of patients using the following:

JavaScript

What I would like to do, is initialize the doctors with some kind of fatigue level (and other characteristics) like:

JavaScript

Then in the encounter I would like to access the doctor to add fatigue such as:

JavaScript

Where once the fatigue crosses a threshold the doctor goes on break and the fatigue is reset, such as:

JavaScript

Any idea on how to do this?

Advertisement

Answer

First I would use a store for your docs instead of using a resource. Second I would decorate the store with a get override to check if the doc needs a nap

something like this

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement