andes.core.service.DeviceFinder#
- class andes.core.service.DeviceFinder(u, link, idx_name: str, default_model: str, auto_find: bool | None = True, auto_add: bool | None = True, name: str | None = None, tex_name: str | None = None, info: str | None = None)[source]#
Service for finding
idxof devices which are linked to the given devices.The
auto_findparameter controls if the device idx should be automatically looked up. Theauto_addparameter controls if the device will be automatically added. The two parameters are not exclusive. One can skip finding the device but automatically adding it.If
auto_findisTrueand theidxis None, DeviceFinder will look up for the device. If not found andauto_addisTrue, DevFinder will then automatically add the devices. Theidxof the devices that are found or added will be stored to the DeviceFinder instance, so that DeviceFinder can be used like any IdxParam.Adding new devices are called at the beginning of
andes.system.System.setup().Examples
The IEEEST stabilizer takes an optional parameter
busfof the type IdxParam for specifying the connected bus frequency measurement device, which is needed for mode 6. To avoid reimplementing BusFreq within IEEEST, one can doself.busfreq = DeviceFinder(self.busf, link=self.buss, idx_name='bus', default_model='BusFreq')
where
self.busfis for the optional parameter for theidxof bus frequency estimation devices (e.g., BusFreq),self.bussis for theidxof buses thatself.busfdevices should measure, andidx_nameis the name of the BusFreq parameter through which the indices of measured buses are given.For each
Noneor invalid values inself.busf, a BusFreq device will be created with itsbusset to the corresponding value inself.buss. That is,BusFreq.[idx_name].v = [link].At the end, the DeviceFinder instance will contain the list of
BusFreqthat are are connected to self.buss, respectively.In the case of any valid value in
self.busf, that is, the value is an existingBusFreqdevice, DeviceFinder will return it as is without checking if theBusFreqdevice actually measures the bus specified byself.buss. It allows to use the measurement at a different location, but the user have to perform the data consistency check.- __init__(u, link, idx_name: str, default_model: str, auto_find: bool | None = True, auto_add: bool | None = True, name: str | None = None, tex_name: str | None = None, info: str | None = None)[source]#
Methods
assign_memory(n)Assign memory for
self.vand set the array to zero.find_or_add(system)Find or add devices.
get_names()Return name in a list
Attributes
class_nameReturn the class name
nReturn the count of values in
self.v.