simpy.rt — Real-time simulations¶
Provides an environment whose time passes according to the (scaled) real-time (aka wallclock time).
- class simpy.rt.RealtimeEnvironment(initial_time=0, factor=1.0, strict=True)¶
An Environment which uses the real (e.g. wallclock) time.
A time step will take factor seconds of real time (one second by default); e.g., if you step from 0 until 3 with factor=0.5, the simpy.core.BaseEnvironment.run() call will take at least 1.5 seconds.
If the processing of the events for a time step takes too long, a RuntimeError is raised in step(). You can disable this behavior by setting strict to False.
- factor = None¶
Scaling factor of the real-time.
- strict = None¶
Running mode of the environment. step() will raise a RuntimeError if this is set to True and the processing of events takes too long.
- step()¶
Waits until enough real-time has passed for the next event to happen.
The delay is scaled according to the real-time factor. If the events of a time step are processed too slowly for the given factor and if strict is enabled, a RuntimeError is raised.