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 = 0 will 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.v and set the array to zero.

get_names()

Return name in a list

restore_init()

Restore v from _v_t0 saved by snapshot_init().

snapshot_init()

Save the current v into _v_t0 for restore_init().

Attributes

class_name

Return the class name

n

Return the count of values in self.v.