andes.core.service.DataSelect#

class andes.core.service.DataSelect(optional, fallback, name: str | None = None, tex_name: str | None = None, info: str | None = None)[source]#

Class for selecting values for optional DataParam or NumParam.

This service is a v-provider that uses optional DataParam when available. Otherwise, use the fallback value.

DataParam will be tested for None, and NumParam will be tested with np.isnan().

Notes

An use case of DataSelect is remote bus. One can do

self.buss = DataSelect(option=self.busr, fallback=self.bus)

Then, pass self.buss instead of self.bus as indexer to retrieve voltages.

Another use case is to allow an optional turbine rating. One can do

self.Tn = NumParam(default=None)
self.Sg = ExtParam(...)
self.Sn = DataSelect(Tn, Sg)
__init__(optional, fallback, name: str | None = None, tex_name: str | None = None, info: str | None = None)[source]#

Methods

assign_memory(n)

Assign memory for self.v and set the array to zero.

get_names()

Return name in a list

Attributes

class_name

Return the class name

n

Return the count of values in self.v.

v