pyrk.timer module

class pyrk.timer.Timer(t0=<Quantity(0.0, 'second')>, tf=<Quantity(1.0, 'second')>, dt=<Quantity(1.0, 'second')>, t_feedback=<Quantity(0.0, 'second')>)[source]

Bases: object

This class holds information about time

advance_one_timestep()[source]

Advances the timer one timestep

advance_time(time)[source]

Advances the timer to a specific time

Parameters:time (Quantity units seconds) – the time to advance to
current_time()[source]
current_timestep()[source]
idx_from_t(time, t0, dt)[source]

given the any time, in seconds, this returns the index of t.

Parameters:
  • time (float, units of seconds) – any time to convert
  • time – start time for conversion calc
  • time – size of the timestep for the conversion calc
Returns:

index

t(t_idx)[source]

given the index of t, a dimensionless int, this returns the time in seconds

Parameters:t_idx – the index to convert to simulation time
t_idx(time)[source]

given the actual time, in seconds, this returns the index of t.

Parameters:time (float, units of seconds) – the actual time
Returns:index
timesteps()[source]

Returns the number of timesteps in this simulation