simpy.rt — Real-time simulation¶
Execution environment for events that synchronizes passing of time with the real-time (aka wall-clock time).
RealtimeEnvironment(initial_time: Union[int, float] = 0, factor: float = 1.0, strict: bool = True)¶
Execution environment for an event-based simulation which is synchronized with the real-time (also known as wall-clock time). A time step will take factor seconds of real time (one second by default). A step from
factor=0.5will, for example, take at least 1.5 seconds.
The current simulation time.
The currently active process of the environment.
Scaling factor of the real-time.
Return a new
Eventinstance. Yielding this event suspends a process until another process triggers the event.
schedule(event: simpy.events.Event, priority: NewType.<locals>.new_type = 1, delay: Union[int, float] = 0) → None¶
Schedule an event with a given priority and a delay.
peek() → Union[int, float]¶
Get the time of the next scheduled event. Return
Infinityif there is no further event.
step() → None¶
Process the next event after enough real-time has passed for the event to happen.
sync() → None¶
Synchronize the internal time with the current wall-clock time.
run(until: Union[int, float, simpy.events.Event, None] = None) → Optional[Any]¶
step()until the given criterion until is met.
- If it is
None(which is the default), this method will return when there are no further events to be processed.
- If it is an
Event, the method will continue stepping until this event has been triggered and will return its value. Raises a
RuntimeErrorif there are no further events to be processed and the until event was not triggered.
- If it is a number, the method will continue stepping until the environment’s time reaches until.
- If it is