Skip to content

Time mode

pyrung.core.time_mode

Time modes for PLC simulation.

TimeMode

Bases: Enum

Simulation time modes.

Each scan advances by a fixed dt, regardless of wall clock.

Use for unit tests and deterministic simulations.

Simulation clock tracks actual elapsed time.

Use for integration tests and hardware-in-loop.

TimeUnit

Bases: Enum

Timer time units for Click PLC.

The accumulator stores integer values in the specified unit. Conversion from dt (seconds) uses appropriate scaling.

dt_to_units

dt_to_units(dt_seconds: float) -> float

Convert dt in seconds to timer units (with fractional part).