cosapp.drivers.time.interfaces¶
Classes
|
Named tuple associating a list of joint events and their occurrence time. |
|
Generic implementation of an explicit time driver with constant time step. |
- class cosapp.drivers.time.interfaces.EventRecord(time: float, events: List[Event])[source]¶
Bases:
NamedTuple
Named tuple associating a list of joint events and their occurrence time.
- time: float¶
Alias for field number 0
- class cosapp.drivers.time.interfaces.ExplicitTimeDriver(name='Explicit time driver', owner: cosapp.systems.System | None = None, time_interval: Tuple[float, float] = None, dt: float = None, record_dt: bool = False, **options)[source]¶
Bases:
Driver
Generic implementation of an explicit time driver with constant time step. Specialization of derived classes is achieved by the implementation of abstract method _update_transients
- add_recorder(recorder: Recorder, period: Number | None = None) Recorder [source]¶
Add an internal recorder storing the time evolution of values of interest.
- Parameters:
[BaseRecorder] (- recorder) – The recorder to be added.
[Number (- period) – Recording period. If None (default), data are recorded at all time steps.
optional] – Recording period. If None (default), data are recorded at all time steps.
- compute() None [source]¶
Simulate the time-evolution of owner System over a prescribed time interval
- property dt: None | Number¶
Nominal time step (None if unspecified)
- property event_data: DataFrame¶
DataFrame detailing all event cascades occurring during simulation
- Type:
pandas.DataFrame
- is_standalone() bool [source]¶
Is this Driver able to solve a system?
- Returns:
Ability to solve a system or not.
- Return type:
bool
- log_debug_message(handler: HandlerWithContextFilters, record: LogRecord, format: LogFormat = LogFormat.RAW) bool [source]¶
Callback method on the system to log more detailed information.
This method will be called by the log handler when
log_context()
is active if the logging level is lower or equals to VERBOSE_LEVEL. It allows the object to send additional log message to help debugging a simulation.- Parameters:
handler (HandlerWithContextFilters) – Log handler on which additional message should be published.
record (logging.LogRecord) – Log record
format (LogFormat) – Format of the message
- Returns:
Should the provided record be logged?
- Return type:
bool
- record_dt¶
- property recorded_dt: ndarray¶
list of time steps recorded during driver execution
- Type:
numpy.ndarray
- property recorded_events: List[EventRecord]¶
list of recorded event cascades
- Type:
List[EventRecord]
- property recording_period: Number¶
Recording period of time driver’s internal recorder
- Type:
float
- property scenario: Scenario¶
the simulation scenario, defining initial and boundary conditions
- Type:
- set_scenario(name='scenario', init: Dict[str, Any] = {}, values: Dict[str, Any] = {}, stop: str | Event | None = None) None [source]¶
Define a simulation scenario, from initial and boundary conditions.
- Parameters:
init (dict) – Dictionary of initial conditions, of the kind {variable: value}
values (dict) – Dictionary of boundary conditions, of the kind {variable: value} Explicit time dependency may be specified, as {variable: ‘cos(omega * t)’}, for example
name (str) – Name of the scenario (by default, ‘scenario’)
- setup_run() None [source]¶
Setup the driver once before starting the simulation and before calling the systems setup_run.
- property time: Number¶
Current simulation time
- property time_interval: Tuple[Number, Number]¶
Time interval covered by driver