andes.core.service.PostInitService#
- class andes.core.service.PostInitService(v_str: str | None = None, v_numeric: Callable | None = None, vtype: type | None = None, name: str | None = None, tex_name: str | None = None, info: str | None = None, unit: str | None = None)[source]#
Constant service that gets stored once after init.
This service is useful when one need to store initialization values stored in variables.
Examples
In ESST3A model, the vf variable is initialized followed by other variables. One can store the initial vf into vf0 so that equation
vf - vf0 = 0will hold.self.vref0 = PostInitService(info='Initial reference voltage input', tex_name='V_{ref0}', v_str='vref', )
Since all ConstService are evaluated before equation evaluation, without using PostInitService, one will need to create lots of ConstService to store values in the initialization path towards vf0, in order to correctly initialize vf.
- __init__(v_str: str | None = None, v_numeric: Callable | None = None, vtype: type | None = None, name: str | None = None, tex_name: str | None = None, info: str | None = None, unit: str | None = None)#
Methods
assign_memory(n)Assign memory for
self.vand set the array to zero.get_names()Return name in a list
restore_init()Restore
vfrom_v_t0saved bysnapshot_init().snapshot_init()Save the current
vinto_v_t0forrestore_init().Attributes
class_nameReturn the class name
nReturn the count of values in
self.v.