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.
from gdm.distribution import DistributionSystem
from gdmloader.constants import GCS_CASE_SOURCE
from gdmloader.source import SystemLoader
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()
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/gdmloader/source.py:119, in SystemLoader.load_dataset(self, system_type, source_name, dataset_name, version)
118 try:
--> 119 source.fs.get(
120 remote_folder,
121 str(local_folder),
122 recursive=True,
123 )
124 except FileNotFoundError:
File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/fsspec/asyn.py:118, in sync_wrapper.<locals>.wrapper(*args, **kwargs)
117 self = obj or args[0]
--> 118 return sync(self.loop, func, *args, **kwargs)
File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/fsspec/asyn.py:103, in sync(loop, func, timeout, *args, **kwargs)
102 elif isinstance(return_result, BaseException):
--> 103 raise return_result
104 else:
File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/fsspec/asyn.py:56, in _runner(event, coro, result, timeout)
55 try:
---> 56 result[0] = await coro
57 except Exception as ex:
File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/fsspec/asyn.py:645, in AsyncFileSystem._get(self, rpath, lpath, recursive, callback, maxdepth, **kwargs)
644 rpath = self._strip_protocol(rpath)
--> 645 rpaths = await self._expand_path(
646 rpath, recursive=recursive, maxdepth=maxdepth
647 )
648 if source_is_str and (not recursive or maxdepth is not None):
649 # Non-recursive glob does not copy directories
File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/fsspec/asyn.py:883, in AsyncFileSystem._expand_path(self, path, recursive, maxdepth)
882 if isinstance(path, str):
--> 883 out = await self._expand_path([path], recursive, maxdepth)
884 else:
File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/fsspec/asyn.py:912, in AsyncFileSystem._expand_path(self, path, recursive, maxdepth)
911 if not out:
--> 912 raise FileNotFoundError(path)
913 return sorted(out)
FileNotFoundError: ['gdm_data/data/DistributionSystem/2_1_4/p1rhs7_1247']
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
Cell In[1], line 8
5 gdm_loader = SystemLoader()
6 gdm_loader.add_source(GCS_CASE_SOURCE)
----> 8 distribution_system: DistributionSystem = gdm_loader.load_dataset(
9 source_name=GCS_CASE_SOURCE.name,
10 system_type=DistributionSystem,
11 dataset_name="p1rhs7_1247",
12 )
13 distribution_system.name = "p1rhs7_1247"
14 distribution_system.info()
File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/gdmloader/source.py:126, in SystemLoader.load_dataset(self, system_type, source_name, dataset_name, version)
124 except FileNotFoundError:
125 msg = f"{remote_folder=} not found! Check the URL: {source.url}/{remote_folder}"
--> 126 raise ValueError(msg)
128 system_file = list(dataset_folder.rglob("*.json"))[0]
129 return system_type.from_json(system_file)
ValueError: remote_folder='gdm_data/data/DistributionSystem/2_1_4/p1rhs7_1247' not found! Check the URL: https://storage.googleapis.com/gdm_data/gdm_data/data/DistributionSystem/2_1_4/p1rhs7_1247
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
from gdm.distribution import DistributionSystem
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.0.1 │ │ 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 │ └──────────────────────────────────┴───────┘
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
from gdm.distribution import DistributionSystem
primary_gdm_model: DistributionSystem = reduce_to_primary_system(
distribution_system, name="reduced_system", agg_timeseries=False
)
primary_gdm_model.info()
System ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ ┃ Property ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩ │ System name │ reduced_system │ │ Data format version │ 2.0.1 │ │ Components attached │ 4289 │ │ Time Series attached │ 0 │ │ Description │ │ └──────────────────────┴────────────────┘
Component Information ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓ ┃ Type ┃ Count ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩ │ DistributionBus │ 796 │ │ DistributionLoad │ 502 │ │ DistributionTransformer │ 1 │ │ DistributionTransformerEquipment │ 1 │ │ DistributionVoltageSource │ 1 │ │ LoadEquipment │ 502 │ │ Location │ 796 │ │ MatrixImpedanceBranch │ 629 │ │ MatrixImpedanceBranchEquipment │ 8 │ │ MatrixImpedanceFuse │ 81 │ │ MatrixImpedanceFuseEquipment │ 6 │ │ MatrixImpedanceSwitch │ 84 │ │ MatrixImpedanceSwitchEquipment │ 15 │ │ PhaseLoadEquipment │ 856 │ │ PhaseVoltageSourceEquipment │ 3 │ │ TimeCurrentCurve │ 1 │ │ VoltageLimitSet │ 4 │ │ VoltageSourceEquipment │ 1 │ │ WindingEquipment │ 2 │ └──────────────────────────────────┴───────┘
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,
)