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[cosapp.multimode.event.Event])[source]¶ Bases:
NamedTupleNamed tuple associating a list of joint events and their occurrence time.
-
events: List[cosapp.multimode.event.Event]¶ Alias for field number 1
-
time: float¶ Alias for field number 0
-
-
class
cosapp.drivers.time.interfaces.ExplicitTimeDriver(name='Explicit time driver', owner: Optional[cosapp.systems.System] = None, time_interval: Tuple[float, float] = None, dt: float = None, record_dt: bool = False, **options)[source]¶ Bases:
cosapp.drivers.driver.DriverGeneric 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: Optional[numbers.Number] = None) → Recorder[source]¶ Add an internal recorder storing the time evolution of values of interest.
- Parameters
recorder [BaseRecorder] (-) – The recorder to be added.
period [Number (-) – 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¶ Nominal time step (None if unspecified)
-
property
event_data¶ 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: logging.LogRecord, format: cosapp.utils.logging.LogFormat = <LogFormat.RAW: 0>) → 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¶ list of time steps recorded during driver execution
- Type
numpy.ndarray
-
property
recorded_events¶ list of recorded event cascades
- Type
List[EventRecord]
-
property
recording_period¶ Recording period of time driver’s internal recorder
- Type
float
-
set_scenario(name='scenario', init: Dict[str, Any] = {}, values: Dict[str, Any] = {}, stop: Optional[Union[str, cosapp.multimode.event.Event]] = 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¶ Current simulation time
-
property
time_interval¶ Time interval covered by driver
-