pydynamicestimator.devices.device
Attributes
Classes
Metaclass to be used for all elements to be added |
|
Metaclass to be used for all elements to be added |
|
Metaclass to be used for all elements to be added |
|
Dynamic or static device modeled in rectangular coordinates. Used as a parent class |
Module Contents
- pydynamicestimator.devices.device.sin
- pydynamicestimator.devices.device.cos
- pydynamicestimator.devices.device.sqrt
- class pydynamicestimator.devices.device.Element[source]
Metaclass to be used for all elements to be added
- n: int = 0
- u: list[bool] = []
- name: list[str] = []
- _type: str | None = None
- _name: str | None = None
- int: dict[str, str | int]
- _data: dict[str, Any]
- _params: dict[str, float]
- _setpoints: dict[str, float]
- _descr: dict[str, str]
- _mand: list[str] = []
- properties: dict[str, bool]
- add(idx: str | None = None, name: str | None = None, **kwargs) None[source]
Add an element device
Args: idx (str, optional): Unique identifier for the device. Generated if not provided. name (str, optional): Name of the device. Generated if not provided. **kwargs: Custom parameters to overwrite defaults.
- Parameters:
idx (Optional[str])
name (Optional[str])
- Return type:
None
- class pydynamicestimator.devices.device.BusInit[source]
Bases:
ElementMetaclass to be used for all elements to be added
- _type = 'Bus_init_or_unknwon'
- _name = 'Bus_init_or_unknown'
- bus: list[str | None] = []
- p: list[float] = []
- q: list[float] = []
- v: list[float] = []
- type: list[str | None] = []
- pydynamicestimator.devices.device.BusUnknown
- class pydynamicestimator.devices.device.Disturbance[source]
Bases:
ElementMetaclass to be used for all elements to be added
- _type = 'Disturbance'
- _name = 'Disturbance'
- type
- time
- bus_i
- bus_j
- y: numpy.ndarray
- bus
- p_delta
- q_delta
- class pydynamicestimator.devices.device.Line[source]
Bases:
Element- Parameters:
r (ndarray[float]) – Series resistance value in per unit (p.u.).
x (ndarray[float]) – Series reactance value in per unit (p.u.).
g (ndarray[float]) – Total shunt conductance value in per unit (p.u.).
b (ndarray[float]) – Total shunt susceptance value in per unit (p.u.).
trafo (ndarray[float]) – Off-nominal line transformer ratio.
bus_i (ndarray[str]) – Name of the sending-end bus.
bus_j (ndarray[str]) – Name of the receiving-end bus.
- _type = 'Transmission_line'
- _name = 'Transmission_line'
- states = ['i_ijr', 'i_iji']
- r
- x
- g
- b
- trafo
- bus_i
- bus_j
- fcall(grid: pydynamicestimator.system.GridSim, dae: pydynamicestimator.system.DaeSim) None[source]
Call all differential equations for all lines. This function should be used only in case lines are modeled dynamically. If they are modeled statically they are automatically incorporated within grid class
- Parameters:
- Return type:
None
- class pydynamicestimator.devices.device.DeviceRect[source]
Bases:
ElementDynamic or static device modeled in rectangular coordinates. Used as a parent class for all devices modeled in rectangular coordinates.
- properties
Flags for method calls (e.g., ‘gcall’, ‘fcall’).
- Type:
dict[str, bool]
- xf
Final state results for simulation/estimation.
- Type:
dict[str, np.ndarray]
- xinit
Initial state values for all devices of the instance.
- Type:
dict[State, list[float]]
- xmin
Minimum limited state value.
- Type:
list[float]
- xmax
Maximum limited state value.
- Type:
list[float]
- _params
Device parameters, such as rated voltage, power, and frequency and internal parameters.
- Type:
dict[str, float]
- _data
Additional data which will be used in a list, one entry for each device of this object instance.
- Type:
dict[str, str]
- bus
Buses where the device is connected. Each device has an entry in the list.
- Type:
list[Optional[str]]
- states
State variables.
- Type:
list[States]
- units
Units of state variables.
- Type:
list[States]
- ns
Total number of states in the model.
- Type:
float
- _states_noise
Noise for each state variable.
- Type:
dict[States, float]
- _states_init_error
Initial error for each state variable.
- Type:
dict[States, float]
- vre
Order of the real voltage value for each device in the overall DAE model.
- Type:
list[float]
- vim
Order of the real voltage value for each device in the overall DAE model.
- Type:
list[float]
- _algebs
Algebraic variables (‘vre’, ‘vim’).
- Type:
list[str]
- _descr
Descriptions for key parameters.
- Type:
dict[str, str]
- _init_method: str = 'joint'
- xf: dict[str, numpy.ndarray]
- yf_int: dict[str, numpy.ndarray]
- xinit: dict[str, list[float]]
- xmin: list[float] = []
- xmax: list[float] = []
- Vn
- fn
- Sn
- bus: list[str | None] = []
- states: list[str] = []
- units: list[str] = []
- ns: int = 0
- _states_noise: dict[str, float]
- _states_init_error: dict[str, float]
- _algebs: list[str] = ['vre', 'vim']
- vre
- vim
- _algebs_int: list[str] = []
- _algebs_int_x0: dict[str, float]
- _algebs_int_noise: dict[str, float]
- _algebs_int_units: dict[str, str]
- _x0: dict[str, float]
- _descr
- xy_index(dae: pydynamicestimator.system.Dae, grid: pydynamicestimator.system.Grid) None[source]
Initializes indices for states, algebraic variables, unknown inputs, and switches.
- add(idx=None, name=None, **kwargs) None[source]
Add an element device
Args: idx (str, optional): Unique identifier for the device. Generated if not provided. name (str, optional): Name of the device. Generated if not provided. **kwargs: Custom parameters to overwrite defaults.
- Return type:
None
- init_from_simulation(device_sim: DeviceRect, idx: str, dae: pydynamicestimator.system.DaeEst, dae_sim: pydynamicestimator.system.DaeSim) None[source]
Initialize the device state estimation based on simulation results.
- Parameters:
device_sim (DeviceRect) – The device simulation object containing simulation results.
idx (str) – unique index of the device
dae (DaeEst) – The DAE object responsible for managing the estimation of the system.
dae_sim (DaeSim) – The simulation object providing timing information.
- Return type:
None
- save_data(dae: pydynamicestimator.system.Dae) None[source]
- Parameters:
- Return type:
None
- finit_anchor_residuals(dae: pydynamicestimator.system.Dae) list[source]
Extra steady-state anchor residuals (each an n-vector that must equal 0) a device declares to keep its initialization Newton system square.
The generic
finit()pins each device’s state ODEs (f = 0) plus two quantities through the bus-current balance (g[vre]/g[vim]), so the square-system invariant isn_setpoints == 2(the SG: Pref + Vref). A device with more setpoints returnsn_setpoints - 2anchor residuals to balance them. Empty by default -> existing devices are unaffected.Example – the inverter has 3 setpoints (Pref/Qref/Vref) but the bus equations pin only 2; it returns one anchor (Qref = Qc) here. See
docs/inverter_modernization_design.md§7.- Parameters:
- Return type:
list
- finit(dae: pydynamicestimator.system.Dae) None[source]
Initialize the device, dispatching to the method this device class declares via
_init_method("joint"->_finit_joint(),"sequential"->_finit_sequential()).- Parameters:
- Return type:
None
- abstract _finit_sequential(dae: pydynamicestimator.system.Dae) None[source]
Staged, device-specific initialization. Devices that declare
_init_method = 'sequential'implement this; the default has none.- Parameters:
- Return type:
None
- _finit_joint(dae: pydynamicestimator.system.Dae) None[source]
One-shot initialization: solve the device’s steady state (states + setpoints + private algebraics, balanced by the bus equations and any device-declared anchor residuals) as a single Newton system, with a Levenberg-Marquardt fallback.
Initialize the device by setting up setpoints, initial states based on the power flow solution. :param dae: The DAE object used to simulate the system. :type dae: Dae
- Parameters:
- Return type:
None
- fgcall(dae: pydynamicestimator.system.Dae) None[source]
A method that executes the differential and algebraic equations of the model and adds them to the appropriate places in the Dae class
- Parameters:
dae – an instance of a class Dae
- Returns:
None
- Return type:
None
- qcall(dae: pydynamicestimator.system.DaeEst) None[source]
- Parameters:
- Return type:
None