andes.variables.dae.DAE#

class andes.variables.dae.DAE(system)[source]#

Class for storing numerical values of the DAE system, including variables, equations and first order derivatives (Jacobian matrices).

Variable values and equation values are stored as numpy.ndarray, while Jacobians are stored as kvxopt.spmatrix. The defined arrays and descriptions are as follows:

DAE Array

Description

x

Array for state variable values

y

Array for algebraic variable values

z

Array for 0/1 limiter states (if enabled)

f

Array for differential equation derivatives

Tf

Left-hand side time constant array for f

g

Array for algebraic equation mismatches

The defined scalar member attributes to store array sizes are

Scalar

Description

m

The number of algebraic variables/equations

n

The number of state variables/equations

o

The number of limiter state flags

The derivatives of f and g with respect to x and y are stored in four kvxopt.spmatrix sparse matrices: fx, fy, gx, and gy, where the first letter is the equation name, and the second letter is the variable name.

Notes

DAE in ANDES is defined in the form of

\[\begin{split}T \dot{x} = f(x, y) \\ 0 = g(x, y)\end{split}\]

DAE does not keep track of the association of variable and address. Only a variable instance keeps track of its addresses.

__init__(system)[source]#

Methods

alloc_or_extend_names()

Allocate empty lists for names for the given size.

build_pattern(name)

Build sparse matrices with stored patterns.

clear_arrays()

Reset equation and variable arrays to empty.

clear_fg()

Resets equation arrays to empty.

clear_ijv()

Clear stored triplets.

clear_ts()

Drop the TimeSeries data and create a new one.

clear_xy()

Reset variable arrays to empty.

clear_z()

Reset status arrays to empty

get_name(arr)

Helper function for geting the list of variable names based on the array name.

get_size(name)

Get the size of an array or sparse matrix based on name.

print_array(name[, values, tol])

Debug helper to print array values and names.

request_address(array_name, ndevice, nvar[, ...])

Interface for requesting addresses for a model.

reset()

Reset array sizes to zero and clear all arrays.

resize_arrays()

Resize arrays to the new sizes m and n, and o.

restore_sparse([names])

Restore all sparse matrices to the sparsity pattern filled with zeros (for variable Jacobian elements) and non-zero constants.

set_t(t)

Helper function for setting time in-place.

store()

Store values for the current time step to the TimeSeries storage.

store_sparse_ijv(name, row, col, val)

Store the sparse pattern triplets.

write_lst(lst_path)

Dump the variable name lst file.

write_npy(file_path)

Write TDS data into NumPy uncompressed format.

write_npz(file_path)

Write TDS data into NumPy compressed format.

Attributes

fg

Return a concatenated array of [f, g].

x_name_output

Return a list of state var names selected by Output.

x_tex_name_output

Return a list of state var LaTeX names selected by Output.

xy

Return a concatenated array of [x, y].

xy_name

Return a concatenated list of all variable names without format.

xy_tex_name

Return a concatenated list of all variable names in LaTeX format.

xyz

Return a concatenated array of [x, y].

xyz_name

Return a concatenated list of all variable names without format.

xyz_tex_name

Return a concatenated list of all variable names in LaTeX format.

y_name_output

Return a list of algeb var names selected by Output.

y_tex_name_output

Return a list of algeb var LaTeX names selected by Output.