cosapp.drivers.runonce

Classes

RunOnce(name, owner, **kwargs)

Driver running the model on its System owner.

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

Bases: cosapp.drivers.driver.Driver

Driver running the model on its System owner.

Parameters
  • name (str) – Name of the driver

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

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

compute()None[source]

Execute drivers on all child System belonging to the driver System owner.

get_init(force_init: bool = False)numpy.ndarray[source]

Get the System iteratives initial values for this driver.

Parameters

force_init (bool, optional) – Force the initial values to be used. Default is False.

Returns

List of iteratives initial values, in the same order as the unknowns in get_problem().

Return type

numpy.ndarray

get_problem()cosapp.core.numerics.basics.MathematicalProblem[source]

Returns the full mathematical for the case.

Returns

The full mathematical problem to solve for the case

Return type

MathematicalProblem

initial_values
set_init(modifications: Dict[str, Any])None[source]

Define initial values for one or more variables.

The variable can be contextual child1.port2.var. The only rule is that it should belong to the owner System of this driver or any of its descendants.

Parameters

modifications (Dict[str, Any]) – Dictionary of (variable name, value)

Examples

>>> driver.set_init({'myvar': 42, 'dummy': 'banana'})
setup_run()[source]

Method called once before starting any simulation.

solution