andes.core.observable.Observable#

class andes.core.observable.Observable(e_str: str | None = None, name: str | None = None, tex_name: str | None = None, info: str | None = None, unit: str | None = None, discrete=None)[source]#

A variable computed by explicit assignment rather than solved in the DAE system.

At code generation time, the Observable's expression is substituted into all referencing equations so that Jacobians are correctly computed via direct differentiation. Post-solve, values are evaluated and stored in dae.b for recording.

Parameters:
e_strstr, optional

Assignment expression string. Unlike Algeb where e_str means residual (0 = e_str), for Observable it means direct assignment (b = e_str).

Attributes:
e_codeNone

Observable has no equation residual.

v_codestr

Variable code string, equals string literal b.

Examples

To define an observable vd computed from bus voltage and angle:

self.vd = Observable(e_str='v * cos(delta - a)',
                     info='d-axis voltage',
                     tex_name='V_d')

The symbol vd can then be used in other equations. At code generation time, vd will be replaced by v * cos(delta - a) in those equations.

__init__(e_str: str | None = None, name: str | None = None, tex_name: str | None = None, info: str | None = None, unit: str | None = None, discrete=None)[source]#

Methods

get_names()

reset()

Reset the internal numpy arrays and flags.

set_address(addr[, contiguous])

Set the address of this Observable in dae.b.

set_arrays(dae[, inplace, alloc])

Set the value array for this Observable.

Attributes

class_name

e_code

v_code