andes.core.discrete.Limiter#

class andes.core.discrete.Limiter(u, lower, upper, enable=True, name: str = None, tex_name: str = None, info: str = None, min_iter: int = 2, err_tol: float = 0.01, allow_adjust: bool = True, no_lower=False, no_upper=False, sign_lower=1, sign_upper=1, equal=True, no_warn=False, zu=0.0, zl=0.0, zi=1.0)[source]#

Base limiter class.

This class compares values and sets limit values. Exported flags are zi, zl and zu.

Parameters:
uBaseVar

Input Variable instance

lowerBaseParam

Parameter instance for the lower limit

upperBaseParam

Parameter instance for the upper limit

no_lowerbool

True to only use the upper limit

no_upperbool

True to only use the lower limit

sign_lower: 1 or -1

Sign to be multiplied to the lower limit

sign_upper: bool

Sign to be multiplied to the upper limit

equalbool

True to include equal signs in comparison (>= or <=).

no_warnbool

Disable initial limit warnings

zu0 or 1

Default value for zu if not enabled

zl0 or 1

Default value for zl if not enabled

zi0 or 1

Default value for zi if not enabled

Attributes:
zlarray-like

Flags of elements violating the lower limit; A array of zeros and/or ones.

ziarray-like

Flags for within the limits

zuarray-like

Flags for violating the upper limit

Notes

If not enabled, the default flags are zu = zl = 0, zi = 1.

__init__(u, lower, upper, enable=True, name: str = None, tex_name: str = None, info: str = None, min_iter: int = 2, err_tol: float = 0.01, allow_adjust: bool = True, no_lower=False, no_upper=False, sign_lower=1, sign_upper=1, equal=True, no_warn=False, zu=0.0, zl=0.0, zi=1.0)[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([allow_adjust, adjust_lower, ...])

Check the input variable and set flags.

do_adjust_lower(val, lower[, allow_adjust, ...])

Adjust the lower limit.

do_adjust_upper(val, upper[, allow_adjust, ...])

Adjust the upper limit.

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 the discrete flags specified in self.export_flags.

save_unconstrained()

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

Attributes

class_name