openg2g.metrics¶
openg2g.metrics.voltage
¶
Voltage violation metrics for all-bus, all-phase analysis.
VoltageStats
dataclass
¶
Summary voltage statistics over a simulation run.
Attributes:
| Name | Type | Description |
|---|---|---|
worst_vmin |
float
|
Lowest voltage observed across all buses and phases (pu). |
worst_vmax |
float
|
Highest voltage observed across all buses and phases (pu). |
violation_time_s |
float
|
Total time with at least one bus-phase violating voltage bounds (seconds). |
integral_violation_pu_s |
float
|
Integrated voltage violation magnitude across all bus-phase pairs (pu * s). |
Source code in openg2g/metrics/voltage.py
compute_allbus_voltage_stats(grid_states, *, v_min=0.95, v_max=1.05, exclude_buses=('rg60',))
¶
Compute voltage violation statistics across all buses and phases.
For each snapshot the integral violation sums
max(v_min - v, 0) + max(v - v_max, 0) over every non-excluded
bus-phase pair, then integrates over time. A snapshot counts as
"violated" when this sum is positive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_states
|
list[GridState]
|
Sequence of GridState objects from a simulation run. |
required |
v_min
|
float
|
Lower voltage bound (pu). |
0.95
|
v_max
|
float
|
Upper voltage bound (pu). |
1.05
|
exclude_buses
|
tuple[str, ...]
|
Bus names to exclude from statistics (case-insensitive). |
('rg60',)
|
Returns:
| Type | Description |
|---|---|
VoltageStats
|
VoltageStats with worst-case min/max voltages, violation time, |
VoltageStats
|
and integral violation magnitude. |