cosapp.drivers.driver

Classes driving simulation on CoSApp System.

Classes

Driver(name[, owner])

Abstract base class for all systems drivers.

class cosapp.drivers.driver.Driver(name: str, owner: System | None = None, **options)[source]

Bases: Module

Abstract base class for all systems drivers.

Parameters:
  • name (str) – Name of the driver

  • owner (System, optional) – System to which this driver belongs; default None

  • **kwargs (Any) – Keyword arguments used to set driver options

name

Name of the driver

Type:

str

parent

Top driver containing this driver; default None.

Type:

Driver, optional

owner

System to which this driver belong.

Type:

System

children

Drivers belonging to this one.

Type:

OrderedDict[str, Driver]

options
Options for the current driver:
verbose : int, {0, 1}
Verbosity level of the driver; default 0 (i.e. minimal information)
Type:

OptionsDictionary

solution

List of (name, value) for the iteratives when a solution is reached

Type:

List[Tuple[str, float]]

accept(visitor: Visitor) None[source]

Specifies course of action when visited by visitor

add_child(child: AnyDriver, execution_index: int | None = None, desc='') AnyDriver[source]

Add a child Driver to the current Driver.

When adding a child Driver, it is possible to specified its position in the execution order.

Parameters:
  • child (-) – Driver to add to the current Driver

  • execution_index (-) – Index of the execution order list at which the Module should be inserted; default latest.

  • [str (- desc) – Sub-driver description in the context of its parent driver.

  • optional] – Sub-driver description in the context of its parent driver.

Return type:

child

Notes

The added child will have its owner set to that of current driver.

add_driver(child: AnyDriver, execution_index: int | None = None, desc='') AnyDriver[source]

Alias for add_child().

add_recorder(recorder: AnyRecorder) AnyRecorder[source]
available_options(level=1) List[str] | Dict[str, Any] | None[source]

Prints out the driver options.

Parameters:

level (int, optional) – Level of detail displayed: 0: show option names only; 1: show options as a (name, value) dictionary (default); 2: print out a detailed description of the options.

Return type:

list[str] | dict[str, str] | None, depending on level.

check_owner_attr(item: str) None[source]
error_code: str
is_standalone() bool[source]

Is this Driver able to solve a system?

Returns:

Ability to solve a system or not.

Return type:

bool

options: OptionsDictionary
property owner: System

System owning the driver and its children.

Type:

System

property recorder: BaseRecorder | None

Recorder attached to this Driver.

Type:

BaseRecorder or None

setup_run() None[source]

Set execution order and start the recorder.

start_time: float
status: str