andes.core.service.ExtService#
- class andes.core.service.ExtService(model: str, src: str, indexer: BaseParam | BaseService, attr: str = 'v', allow_none: bool = False, default=0, name: str = None, tex_name: str = None, vtype=None, info: str = None)[source]#
Service constants whose value is from an external model or group.
- Parameters:
- srcstr
Variable or parameter name in the source model or group
- modelstr
A model name or a group name
- indexerIdxParam or BaseParam
An "Indexer" instance whose
vfield contains theidxof devices in the model or group.
Examples
A synchronous generator needs to retrieve the
pandqvalues from static generators for initialization.ExtServiceis used for this purpose.In a synchronous generator, one can define the following to retrieve
StaticGen.pasp0:class GENCLSModel(Model): def __init__(...): ... self.p0 = ExtService(src='p', model='StaticGen', indexer=self.gen, tex_name='P_0')
- __init__(model: str, src: str, indexer: BaseParam | BaseService, attr: str = 'v', allow_none: bool = False, default=0, name: str = None, tex_name: str = None, vtype=None, info: str = None)[source]#
Methods
assign_memory(n)Assign memory for
self.vand set the array to zero.get_names()Return name in a list
link_external(ext_model)Method to be called by
Systemfor getting values from the external model or group.Attributes
class_nameReturn the class name
nReturn the count of values in
self.v.