cosapp.drivers.runonce¶
Classes
|
Driver running the model on its System owner. |
- class cosapp.drivers.runonce.RunOnce(name: str, owner: cosapp.systems.System | None = None, **kwargs)[source]¶
Bases:
Driver
Driver running the model on its System owner.
- Parameters:
- get_init(force_init: bool = False) 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() MathematicalProblem [source]¶
Returns the full mathematical for the case.
- Returns:
The full mathematical problem to solve for the case
- Return type:
- 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'})
- solution: Dict[str, float]¶