hermess.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
- hermess.devices.device.sin
- hermess.devices.device.cos
- hermess.devices.device.sqrt
- class hermess.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 hermess.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] = []
- class hermess.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 hermess.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: hermess.system.GridSim, dae: hermess.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:
grid (hermess.system.GridSim)
dae (hermess.system.DaeSim)
- Return type:
None
- class hermess.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 the simulation.
- 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
- 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
- _algebs: list[str] = ['vre', 'vim']
- vre
- vim
- _algebs_int: list[str] = []
- _algebs_int_x0: dict[str, float]
- _algebs_int_units: dict[str, str]
- _x0: dict[str, float]
- _descr
- xy_index(dae: hermess.system.Dae, grid: hermess.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
- save_data(dae: hermess.system.Dae) None[source]
- Parameters:
dae (hermess.system.Dae)
- Return type:
None
- finit_anchor_residuals(dae: hermess.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 joint init pins each device’s state ODEs (
f = 0) plus two quantities through the bus-current balance (g[vre]/g[vim]), so a square system requiresn_setpoints == 2(the SG: Pref + Vref). A device with more setpoints returnsn_setpoints - 2anchor residuals to balance them. Empty by default.Example: the inverter has 3 setpoints (Pref/Qref/Vref) but the bus equations pin only 2; it returns one anchor (Qref = Qc) here.
- Parameters:
dae (hermess.system.Dae)
- Return type:
list
- finit(dae: hermess.system.Dae) None[source]
Initialize the device, dispatching on
_init_method("joint"->_finit_joint(),"sequential"->_finit_sequential()).- Parameters:
dae (hermess.system.Dae)
- Return type:
None
- abstract _finit_sequential(dae: hermess.system.Dae) None[source]
Staged, device-specific initialization. Devices that declare
_init_method = 'sequential'implement this; the default has none.- Parameters:
dae (hermess.system.Dae)
- Return type:
None
- finit_guess(dae: hermess.system.Dae)[source]
Newton seed for the joint init, machine-major
[states of inst 0 | states of inst 1 | ...], or None for the default (class-level_x0repeated per instance). Overrides may also refresh setpoint arrays (e.g.Pref), which the joint solve consumes as setpoint guesses.- Parameters:
dae (hermess.system.Dae)
- _finit_joint(dae: hermess.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:
dae (hermess.system.Dae)
- Return type:
None
- fgcall(dae: hermess.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