andes.core.discrete.Derivative#

class andes.core.discrete.Derivative(u, name=None, tex_name=None, info=None)[source]#

Compute the derivative of a variable using numerical differentiation.

Derivative is based on the storage implemented in the Delay class. The delay is set to 1 step so that the current and the previous step are used.

A simple first order derivative is computed using u(t) - u(t-1) / tstep, where tstep is the current step size.

Derivative is intended to be used for algebraic variables because of discontinuity. It can be applied to a state variable, but one should instead implement the right-hand side equation of the state variable in an algebraic equation to obtain the accurate derivative.

Alternatively, the washout filter (andes.core.block.Washout) can be used to implement a numerically stable derivative.

The output of the Derivative class is named <INSTANCE_NAME>_v just like Delay.

__init__(u, name=None, tex_name=None, info=None)[source]#

Methods

check_eq(**kwargs)

This function is called in l_check_eq after updating equations.

check_iter_err([niter, err])

Check if the minimum iteration or maximum error is reached so that this discrete block should be enabled.

check_var(dae_t, *args, **kwargs)

Calculate the numerical differentiation.

get_limit_report()

Return a list of dicts describing variables clamped at limits.

get_names()

Available symbols from this class

get_tex_names()

Return tex_names of exported flags.

get_values()

list2array(n)

Allocate memory for storage arrays.

save_unconstrained()

Save the input variable's unconstrained value (call after init pass 1).

Attributes

class_name