cosapp.drivers.driver

Classes driving simulation on CoSApp System.

Classes

Driver(name, owner, **kwargs)

Abstract base class for all systems drivers.

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

Bases: cosapp.core.module.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: cosapp.patterns.visitor.Visitor)None[source]

Specifies course of action when visited by visitor

add_child(child: AnyDriver, execution_index: Optional[int] = 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.

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

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

Returns

Return type

child

Notes

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

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

Alias for add_child().

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

Is this Driver able to solve a system?

Returns

Ability to solve a system or not.

Return type

bool

options
property owner

System owning the driver and its children.

Type

System

property recorder

Recorder attached to this Driver.

Type

BaseRecorder or None

setup_run()None[source]

Set execution order and start the recorder.

start_time
status