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 v field contains the idx of devices in the model or group.

Examples

A synchronous generator needs to retrieve the p and q values from static generators for initialization. ExtService is used for this purpose.

In a synchronous generator, one can define the following to retrieve StaticGen.p as p0:

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

get_names()

Return name in a list

link_external(ext_model)

Method to be called by System for getting values from the external model or group.

Attributes

class_name

Return the class name

n

Return the count of values in self.v.