CADETProcess.dynamicEvents.Event#
- class CADETProcess.dynamicEvents.Event(name: str, event_handler: EventHandler, parameter_path: str, state: float, time: float = 0.0, indices: int | list[int] | None = None)[source]#
Bases:
objectDefines dynamic changes of model parameters based on events.
An Event is a time-based modification to an attribute of a performer. Its execution time can depend on other Events or Durations. To handle cyclic behavior, times are computed modulo the cycle time of the EventHandler.
- Attributes:
- namestr
The event’s name.
- event_handlerEventHandler
Object managing the performers and cycle time.
parameter_pathstrstr: Dot notation path to the target parameter within the evaluation_object.
statefloatReturn the state of the parameter event.
timefloat, default=0.0float: Time when the event is executed.
indicesint or list, default=Nonelist: Indices for events that modifies only specific entries of a parameter.
See also
- add_dependency(dependency: Event, factor: float = 1, transform: Callable | None = None) None[source]#
Add a time dependency on another event.
When an event is dependent, the time of the event is based on a linear combination of its dependencies.
- Parameters:
- dependencyEvent
Event that this event depends on.
- factorfloat, default=1
Weighting factor for the dependency.
- transformcallable, optional
A function to transform the dependent event’s time.
- Raises:
- CADETProcessError
If the dependency is already listed.
- property full_state: float | list#
Construct the full state based on indices and current value.
This method reconstructs the state from the stored state value,.
- Returns:
- float or list
The computed full state, either as a scalar or an array.
- Raises:
- ValueError
If the length of the state does not match the length of the indices.
- property index_states: dict[tuple, float]#
dict[tuple, float]: State values mapped to their respective indices.
- property indices: list[tuple[int]] | None#
list: Indices for events that modifies only specific entries of a parameter.
List of tuples for each entry. If parameter is scalar, None
- property is_index_specific: bool#
bool: True if event modifies entry of a parameter array, False otherwise.
- property is_polynomial: bool#
bool: True if descriptor is instance of NdPolynomial. False otherwise.
- property parameter_descriptor: ParameterBase | None#
Return parameter descriptor.
- property parameter_path: str#
str: Dot notation path to the target parameter within the evaluation_object.
- remove_dependency(dependency: Event) None[source]#
Remove dependencies of events.
- Parameters:
- dependencyEvent
Event object to remove from dependencies.
- Raises:
- CADETProcessError
If the dependency doesn’t exists in list dependencies.
- set_value(state: float | ndarray) None[source]#
Set the specified state to the associated event parameter.
- property state: float | ndarray#
Return the state of the parameter event.
When retrieving, it returns the current state of the event. When setting, the internal state is updated.
- Returns:
- float | np.ndarray
The state of the parameter event.