The Simulation Clock

The components here provide implementations of different kinds of simulation clocks for use in vivarium.

For more information about time in the simulation, see the associated concept note.

class vivarium.framework.time.SimulationClock[source]

Defines a base implementation for a simulation clock.

name
time

The current simulation time.

Return type:Union[datetime, Number]
stop_time

The time at which the simulation will stop.

Return type:Union[datetime, Number]
step_size

The size of the next time step.

Return type:Union[timedelta, Number]
step_forward()[source]

Advances the clock by the current step size.

Return type:None
step_backward()[source]

Rewinds the clock by the current step size.

class vivarium.framework.time.SimpleClock[source]

A unitless step-count based simulation clock.

configuration_defaults = {'time': {'end': 100, 'start': 0, 'step_size': 1}}
name
setup(builder)[source]
vivarium.framework.time.get_time_stamp(time)[source]
class vivarium.framework.time.DateTimeClock[source]

A date-time based simulation clock.

configuration_defaults = {'time': {'end': {'day': 2, 'month': 7, 'year': 2010}, 'start': {'day': 2, 'month': 7, 'year': 2005}, 'step_size': 1}}
name
setup(builder)[source]
class vivarium.framework.time.TimeInterface(manager)[source]
clock()[source]

Gets a callable that returns the current simulation time.

Return type:Callable[[], Union[datetime, Number]]
step_size()[source]

Gets a callable that returns the current simulation step size.

Return type:Callable[[], Union[timedelta, Number]]