andes.core.service.InitChecker#
- class andes.core.service.InitChecker(u, lower=None, upper=None, equal=None, not_equal=None, enable=True, error_out=False, **kwargs)[source]#
Class for checking init values against known typical values.
Instances will be stored in Model.services_post and Model.services_icheck, which will be checked in Model.post_init_check() after initialization.
- Parameters:
- u
v-provider to be checked
- lowerfloat, BaseParam, BaseVar, BaseService
lower bound
- upperfloat, BaseParam, BaseVar, BaseService
upper bound
- equalfloat, BaseParam, BaseVar, BaseService
values that the value from v_str should equal
- not_equalfloat, BaseParam, BaseVar, BaseService
values that should not equal
- enablebool
True to enable checking
Examples
Let's say generator excitation voltages are known to be in the range of 1.6 - 3.0 per unit. One can add the following instance to GENBase
self._vfc = InitChecker(u=self.vf, info='vf range', lower=1.8, upper=3.0, )
lower and upper can also take v-providers instead of float values.
One can also pass float values from Config to make it adjustable as in our implementation of
GENBase._vfc.- __init__(u, lower=None, upper=None, equal=None, not_equal=None, enable=True, error_out=False, **kwargs)[source]#
Methods
assign_memory(n)Assign memory for
self.vand set the array to zero.check()Check the bounds and equality conditions.
get_names()Return name in a list
Attributes
class_nameReturn the class name
nReturn the count of values in
self.v.vReturn values stored in self._v.