andes.core.discrete.SortedLimiter#
- class andes.core.discrete.SortedLimiter(u, lower, upper, n_select: int = 5, name=None, tex_name=None, enable=True, abs_violation=True, min_iter: int = 2, err_tol: float = 0.01, allow_adjust: bool = True, zu=0.0, zl=0.0, zi=1.0, ql=0.0, qu=0.0)[source]#
A limiter that sorts inputs based on the absolute or relative amount of limit violations.
- Parameters:
- n_selectint
the number of violations to be flagged, for each of over-limit and under-limit cases. If n_select == 1, at most one over-limit and one under-limit inputs will be flagged. If n_select is zero, heuristics will be used.
- abs_violationbool
True to use the absolute violation. False if the relative violation abs(violation/limit) is used for sorting. Since most variables are in per unit, absolute violation is recommended.
- __init__(u, lower, upper, n_select: int = 5, name=None, tex_name=None, enable=True, abs_violation=True, min_iter: int = 2, err_tol: float = 0.01, allow_adjust: bool = True, zu=0.0, zl=0.0, zi=1.0, ql=0.0, qu=0.0)[source]#
Methods
calc_select()Set n_select automatically.
check_eq(**kwargs)This function is called in
l_check_eqafter 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(*args[, niter, err])Check for the largest and smallest n_select elements.
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)Initialize maximum and minimum n_select based on input size.
save_unconstrained()Save the input variable's unconstrained value (call after init pass 1).
Attributes
class_name