pathsim.events.schedule module

class pathsim.events.schedule.Schedule(t_start=0, t_end=None, t_period=1, func_act=None, tolerance=0.0001)[source]

Bases: Event

Subclass of base ‘Event’ that triggers dependent on the evaluation time.

Monitors time in every timestep and triggers periodically (period). This event does not have an event function as the event condition only depends on time.

time == next_schedule_time -> event
Parameters:
  • t_start (float) – starting time for schedule

  • t_end (float) – termination time for schedule

  • t_period (float) – time period of schedule, when events are triggered

  • func_act (callable) – action function for event resolution

  • tolerance (float) – tolerance to check if detection is close to actual event

buffer(t)[source]

Buffer the current time to history

Parameters:

t (float) – buffer time

detect(t)[source]

Check if the event condition is satisfied, i.e. if the time period switch is within the current timestep.

Parameters:

t (float) – evaluation time for detection

Returns:

  • detected (bool) – was an event detected?

  • close (bool) – are we close to the event?

  • ratio (float) – interpolated event location ratio in timestep