cosapp.multimode.event¶
Classes
|
Class for events, to be used as local variables |
Interface describing the inner state of an event |
|
|
Inner state of an event triggered by another event, filtered by a Boolean condition. |
|
Inner state of an event triggered by the merging of of other, external events. |
|
Inner state of an event synchronized with another event. |
Inner state of an undefined, never occurring event |
|
|
Inner state of an event triggered by a zero-crossing expression |
- class cosapp.multimode.event.Event(name: str, context: System, desc: str = '', trigger: str | ZeroCrossing | EventState | Event | None = None, final: bool = False)[source]¶
Bases:
object
Class for events, to be used as local variables
- property contextual_name: str¶
Join context system name and event name.
If the event has no context, only its name is returned.
- Type:
str
- property desc: str¶
Event description
- Type:
str
- filter(condition: str) FilteredEvent [source]¶
Filters event with an additional boolean condition.
Parameters:¶
- condition [str]:
Evaluable boolean condition.
Returns:¶
- trigger [FilteredEvent]:
The filtered event state, to be used as trigger.
- property final: bool¶
- full_name(trim_root=False) str [source]¶
Returns full name up to root context.
- Parameters:
trim_root (bool (optional, default False)) – Exclude root context name if True.
- Returns:
The event full name
- Return type:
str
- property is_primitive: bool¶
- static merge(*events: Event) MergedEvents [source]¶
Merges events into a trigger condition.
Parameters:¶
- *events [Event]:
Enumeration of events to be merged.
Returns:¶
- trigger [MergedEvents]:
The merged event state, to be used as trigger.
- property name: str¶
Event name
- Type:
str
- property present: bool¶
- reevaluate() None [source]¶
Reevaluates the current state of the event; used to update information about zero-crossing events after an integration time step was interrupted by the triggering of an event.
- tick() None [source]¶
Ticks the event, and locks it if it is a primitive event that has just been triggered.
- to_trigger() bool [source]¶
bool : Indicates whether the event has to be triggered in the next discrete step
- property trigger: ZeroCrossing | EventState | Event¶
- class cosapp.multimode.event.EventState[source]¶
Bases:
ABC
Interface describing the inner state of an event
- property is_primitive: bool¶
True if event triggering condition is self-contained, False otherwise
- Type:
bool
- class cosapp.multimode.event.FilteredEvent(event: Event, condition: str)[source]¶
Bases:
EventState
Inner state of an event triggered by another event, filtered by a Boolean condition.
- class cosapp.multimode.event.MergedEvents(*events: Event)[source]¶
Bases:
EventState
Inner state of an event triggered by the merging of of other, external events.
- class cosapp.multimode.event.SynchronizedEvent(event: Event)[source]¶
Bases:
EventState
Inner state of an event synchronized with another event.
- class cosapp.multimode.event.UndefinedEvent[source]¶
Bases:
EventState
Inner state of an undefined, never occurring event
- class cosapp.multimode.event.ZeroCrossingEvent(event: Event, zeroxing: ZeroCrossing)[source]¶
Bases:
EventState
Inner state of an event triggered by a zero-crossing expression
- initialize() None [source]¶
Initialize the event using the current value of the zero-crossing function. If the value is nil, it is discarded, and the event is simply reset. This prevents the event from occurring at the beginning of a simulation.
- property is_primitive: bool¶
True if event triggering condition is self-contained, False otherwise
- Type:
bool