andes.core.var.ExtVar#

class andes.core.var.ExtVar(model: str, src: str, indexer: Optional[Union[List, numpy.ndarray, andes.core.param.BaseParam, andes.core.service.BaseService]] = None, allow_none: Optional[bool] = False, name: Optional[str] = None, tex_name: Optional[str] = None, ename: Optional[str] = None, tex_ename: Optional[str] = None, info: Optional[str] = None, unit: Optional[str] = None, v_str: Optional[Union[str, float]] = None, v_iter: Optional[str] = None, e_str: Optional[str] = None, v_setter: Optional[bool] = False, e_setter: Optional[bool] = False, addressable: Optional[bool] = True, export: Optional[bool] = True, diag_eps: Optional[float] = 0.0, is_input: Optional[bool] = False)[source]#

Algebraic variable that links to an external model.

This class is used to retrieve the addresses of a variable defined in an external model. An equation can be defined for the ExtVar. The evaluated value for the equation will be stored in the ExtVar.e attribute and added to the equations corresponding to the external variables.

Parameters
modelstr

Name of the source model

srcstr

Source variable name

indexerBaseParam, BaseService

A parameter of the hosting model, used as indices into the source model and variable. If is None, the source variable address will be fully copied.

allow_nonebool, optional, default=False

True to allow None in indexer

e_strstring, optional, default=None

Equation string, the evaluated value of which will be added to the source residual equation

Attributes
parent_modelModel

The parent model providing the original parameter.

uidarray-like

An array containing the absolute indices into the parent_instance values.

e_codestr

Equation code string; copied from the parent instance.

v_codestr

Variable code string; copied from the parent instance.

__init__(model: str, src: str, indexer: Optional[Union[List, numpy.ndarray, andes.core.param.BaseParam, andes.core.service.BaseService]] = None, allow_none: Optional[bool] = False, name: Optional[str] = None, tex_name: Optional[str] = None, ename: Optional[str] = None, tex_ename: Optional[str] = None, info: Optional[str] = None, unit: Optional[str] = None, v_str: Optional[Union[str, float]] = None, v_iter: Optional[str] = None, e_str: Optional[str] = None, v_setter: Optional[bool] = False, e_setter: Optional[bool] = False, addressable: Optional[bool] = True, export: Optional[bool] = True, diag_eps: Optional[float] = 0.0, is_input: Optional[bool] = False)[source]#

Methods

get_names()

link_external(ext_model)

Update variable addresses provided by external models

reset()

Reset the internal numpy arrays and flags.

set_address(addr[, contiguous])

Assigns address for equation RHS.

set_arrays(dae[, inplace, alloc])

Access dae.h or dae.i for the RHS of external variables when e_str exists..

Attributes

class_name