pyCBD.state_events module¶
This package contains the State Event Location logic and helper classes.
- class pyCBD.state_events.Direction(value)[source]¶
Bases:
enum.EnumSpecifies the direction of the level crossing to check.
- ANY = 0¶
Any crossing through the level requires an event.
- FROM_BELOW = 1¶
Only a crossing from below through the level causes an event.
- FROM_ABOVE = 2¶
Only a crossing from above through the level causes an event.
- class pyCBD.state_events.StateEvent(output_name, level=0.0, direction=Direction.ANY, event=<function StateEvent.<lambda>>)[source]¶
Bases:
objectData class that holds all generic state event information.
- Parameters
output_name (str) – The name of the output port to check.
level (float) – The value that the signal must pass through. Defaults to 0.
direction (Direction) – The direction of the crossing. Defaults to
Direction.ANY.event (callable) – A function that must be executed if the event occurs. It takes three arguments: event, time and model. In this function, it is allowed to alter any and all attributes/properties/components of the model. Defaults to a no-op.