Network Reduction#
The grid-data-models (GDM) package provides helper functions to facilitate the reduction of distribution models, making them more computationally efficient for specific analyses. Model reduction techniques are particularly useful when studying large distribution networks where simulating the entire model is unnecessary or resource-intensive.
GDM currently supports two model reduction formulations:
Three-phase balanced representation
Primary network representation
We start by loading a sample DistributionSystem.
import sys
from gdm.distribution import DistributionSystem
from gdmloader.constants import GCS_CASE_SOURCE
from gdmloader.source import SystemLoader
from IPython.display import display, HTML
from loguru import logger
import plotly.io as pio
logger.remove()
# Add a new sink with the desired minimum level
logger.add(sys.stderr, level="WARNING")
gdm_loader = SystemLoader()
gdm_loader.add_source(GCS_CASE_SOURCE)
distribution_system: DistributionSystem = gdm_loader.load_dataset(
source_name=GCS_CASE_SOURCE.name,
system_type=DistributionSystem,
dataset_name="p1rhs7_1247",
)
distribution_system.name = "p1rhs7_1247"
distribution_system.info()
System ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ Property ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ System name │ p1rhs7_1247 │ │ Data format version │ 2.1.4 │ │ Components attached │ 13370 │ │ Time Series attached │ 0 │ │ Description │ │ └──────────────────────┴─────────────┘
Component Information ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓ ┃ Type ┃ Count ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩ │ DistributionBus │ 2510 │ │ DistributionLoad │ 1896 │ │ DistributionTransformer │ 503 │ │ DistributionTransformerEquipment │ 10 │ │ DistributionVoltageSource │ 1 │ │ LoadEquipment │ 1896 │ │ Location │ 2510 │ │ MatrixImpedanceBranch │ 1841 │ │ MatrixImpedanceBranchEquipment │ 38 │ │ MatrixImpedanceFuse │ 81 │ │ MatrixImpedanceFuseEquipment │ 6 │ │ MatrixImpedanceSwitch │ 84 │ │ MatrixImpedanceSwitchEquipment │ 15 │ │ PhaseLoadEquipment │ 1948 │ │ PhaseVoltageSourceEquipment │ 3 │ │ TimeCurrentCurve │ 1 │ │ VoltageLimitSet │ 8 │ │ VoltageSourceEquipment │ 1 │ │ WindingEquipment │ 18 │ └──────────────────────────────────┴───────┘
from gdm.distribution.enums import MapType, PlotingStyle
fig = distribution_system.plot(
map_type=MapType.SCATTER_MAP,
style=PlotingStyle.OPEN_STREET_MAP,
flip_coordinates=True,
show=False
)
display(HTML(pio.to_html(fig, include_plotlyjs="cdn", full_html=False)))
Three-Phase Balanced Representation#
The model is reduced by representing only the three-phase buses in the system. This formulation is particularly useful for system-level studies where maintaining a balanced representation of the network is sufficient.
from gdm.distribution.model_reduction import reduce_to_three_phase_system
three_phase_gdm_model: DistributionSystem = reduce_to_three_phase_system(
distribution_system, name="reduced_system", agg_timeseries=False
)
three_phase_gdm_model.info()
System ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ ┃ Property ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩ │ System name │ reduced_system │ │ Data format version │ 2.1.4 │ │ Components attached │ 1953 │ │ Time Series attached │ 0 │ │ Description │ │ └──────────────────────┴────────────────┘
Component Information ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓ ┃ Type ┃ Count ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩ │ DistributionBus │ 328 │ │ DistributionLoad │ 190 │ │ DistributionTransformer │ 22 │ │ DistributionTransformerEquipment │ 2 │ │ DistributionVoltageSource │ 1 │ │ LoadEquipment │ 190 │ │ Location │ 328 │ │ MatrixImpedanceBranch │ 248 │ │ MatrixImpedanceBranchEquipment │ 8 │ │ MatrixImpedanceSwitch │ 57 │ │ MatrixImpedanceSwitchEquipment │ 9 │ │ PhaseLoadEquipment │ 556 │ │ PhaseVoltageSourceEquipment │ 3 │ │ VoltageLimitSet │ 6 │ │ VoltageSourceEquipment │ 1 │ │ WindingEquipment │ 4 │ └──────────────────────────────────┴───────┘
fig = three_phase_gdm_model.plot(
map_type=MapType.SCATTER_MAP,
style=PlotingStyle.OPEN_STREET_MAP,
flip_coordinates=True,
show=False
)
display(HTML(pio.to_html(fig, include_plotlyjs="cdn", full_html=False)))
Primary Network Representation#
This approach involves lumping loads, generation, and capacitors and representing them on the primary network. All secondary networks are removed, resulting in a streamlined model that captures the essential characteristics of the primary distribution network while discarding unnecessary details.
from gdm.distribution.model_reduction import reduce_to_primary_system
primary_gdm_model: DistributionSystem = reduce_to_primary_system(
distribution_system, name="reduced_system", agg_timeseries=False
)
primary_gdm_model.info()
Exception ignored in: <bound method IPythonKernel._clean_thread_parent_frames of <ipykernel.ipkernel.IPythonKernel object at 0x7fcbdae99d90>>
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/ipykernel/ipkernel.py", line 781, in _clean_thread_parent_frames
def _clean_thread_parent_frames(
KeyboardInterrupt:
fig = primary_gdm_model.plot(
map_type=MapType.SCATTER_MAP,
style=PlotingStyle.OPEN_STREET_MAP,
flip_coordinates=True,
show=False
)
display(HTML(pio.to_html(fig, include_plotlyjs="cdn", full_html=False)))
Support for Time Series Aggregation#
Model reduction algorithms aggregate components. Additionally, agg_timeseries
can be set to true to aggregate time series profiles.
from infrasys.time_series_models import SingleTimeSeries
three_phase_gdm_model: DistributionSystem = reduce_to_three_phase_system(
distribution_system,
name="reduced_system",
agg_timeseries=True,
time_series_type=SingleTimeSeries,
)