SHIFT#
Python package for creating synthetic power distribution model. This package uses Grid Data Models to represent power distribution components and Ditto for writing case files specific to simulators such as OpenDSS, Cyme, Synergi and others.
Currently, SHIFT uses open street parcel information and road networks to build the distribution model.
For model conversion. We will need to install DiTTo. To do that, use the command below
pip install nrel-shift --upgrade
pip install networkx~=3.0
Cell In[1], line 1
pip install nrel-shift --upgrade
^
SyntaxError: invalid syntax
We start by loading a sample GDM system using the gdmloader.
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)
catalog: DistributionSystem = gdm_loader.load_dataset(
source_name=GCS_CASE_SOURCE.name,
system_type=DistributionSystem,
dataset_name="p1rhs7_1247",
)
catalog.name = "p1rhs7_1247"
catalog.info()
/opt/homebrew/Caskroom/miniconda/base/envs/gdm2/lib/python3.12/site-packages/pydantic/_internal/_generate_schema.py:502: UserWarning: Ellipsis is not a Python type (it may be an instance of an object), Pydantic will allow any object with no validation since we cannot even enforce that the input is an instance of the given type. To get rid of this error wrap the type with `pydantic.SkipValidation`.
warn(
System ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ Property ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ System name │ p1rhs7_1247 │ │ Data format version │ 2.0.1 │ │ 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 │ └──────────────────────────────────┴───────┘
SHIFT builds synthetic distribution models in the GDM format. These can then be converted to OpenDSS using DiTTo as needed. Models can be built from a polygon of interest, an address or from single line diagrams. The example below builds a gdm models for a given address.
from shift_interface import shift_model_builder, SourceSelection
synthetic_distribution_system = shift_model_builder(
parcel_source="16550 Race Street, Thornton, CO, 80602",
catalog_sys = catalog,
radius_in_meters=1000,
homes_per_distribution_secondary=4,
source_placement=SourceSelection.CENTER,
is_single_phase=True,
primary_voltage_level_in_kilovolts=7.2,
secondary_voltage_level_in_kilovolts=0.12,
gdm_model_name="gdm_model"
)
synthetic_distribution_system.info()
2025-05-14 20:30:59.646 | INFO | shift.parcel:parcels_from_location:148 - Attempting to fetch parcels for 16550 Race Street, Thornton, CO, 80602
2025-05-14 20:30:59.707 | INFO | shift.parcel:parcels_from_geodataframe:24 - Length of geodataframe: 66, CRS: epsg:4326
2025-05-14 20:30:59.709 | INFO | shift.parcel:parcels_from_geodataframe:95 - Number of parcels: 66
2025-05-14 20:30:59.710 | INFO | shift_interface:shift_model_builder:183 - Found 66 parcels
2025-05-14 20:30:59.739 | INFO | shift_interface:shift_model_builder:186 - Created 16 clusters
2025-05-14 20:30:59.740 | INFO | shift_interface:shift_model_builder:191 - Source location: GeoLocation(longitude=-104.96594396888045, latitude=39.993612395066414)
2025-05-14 20:30:59.744 | DEBUG | shift.openstreet_roads:get_road_network:43 - Attempting to fecth road network for POLYGON ((-104.97554935483134 39.986908245168664, -104.95663284516866 39.986908245168664, -104.95663284516866 40.001680354831336, -104.97554935483134 40.001680354831336, -104.97554935483134 39.986908245168664))
2025-05-14 20:30:59.974 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.96743883333333, latitude=39.989592099999996): cd6f0177-d667-47a6-a600-08b155dbc4ec
2025-05-14 20:30:59.976 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.96631801111111, latitude=39.997292433333335): 6d37bc28-71f1-4a4e-ac7e-521b1364b881
2025-05-14 20:30:59.978 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.96120422222222, latitude=39.98817397777778): f8ec81d7-f32f-4772-91c8-ab56d89efb2f
2025-05-14 20:30:59.981 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.95903445, latitude=39.994927025): f375b342-5f07-4128-a95b-b1d6990a9ecb
2025-05-14 20:30:59.982 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.97454335, latitude=39.9944428): e409cd81-0f44-4244-9ab4-9bd597ae4544
2025-05-14 20:30:59.983 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.96748478571429, latitude=39.98741058571429): 0cf48a10-9b5a-413b-a330-af5aaa23d792
2025-05-14 20:30:59.984 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.9620206, latitude=40.0012541): 08b740ef-6964-48e0-a904-e10898aa3a37
2025-05-14 20:30:59.985 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.96494231428572, latitude=39.98991658571428): 4b399c23-d081-433a-8dbd-3243aef13d56
2025-05-14 20:30:59.987 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.9568128, latitude=39.9895988): 215acb9a-aae6-4701-ac8d-f7c6becf3804
2025-05-14 20:30:59.988 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.9649663, latitude=39.9871476): 14b663c2-5d66-4436-8ca9-7f559a8827b6
2025-05-14 20:30:59.989 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.9700745, latitude=39.9875375): 3158c2e4-a206-4b8c-98c1-f0d3fce03f84
2025-05-14 20:30:59.990 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.97335625, latitude=39.9968279): a0483b1b-81e6-4f91-aea2-734afcd1b640
2025-05-14 20:30:59.991 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.96700205833334, latitude=39.99768245833333): 26b4269d-91fa-4404-a78a-aae991faf1ee
2025-05-14 20:30:59.993 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.9685161, latitude=39.9887689): 99f8570b-224b-44da-9686-712e4de33ab9
2025-05-14 20:30:59.994 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.9716372, latitude=39.9950622): a6eed9e1-7fd2-4458-b5dc-4883e178bacf
2025-05-14 20:30:59.995 | DEBUG | shift.graph.openstreet_graph_builder:get_distribution_graph:309 - Building secondary for GeoLocation(longitude=-104.9643679, latitude=40.0005727): 7e1f86df-b54a-4361-9930-002896dd690b
2025-05-14 20:31:00.013 | INFO | shift_interface:shift_model_builder:194 - Created graph with 218 nodes and 217 edges
2025-05-14 20:31:00.035 | INFO | shift_interface:shift_model_builder:222 - Created transformer mappers
2025-05-14 20:31:00.062 | INFO | shift_interface:shift_model_builder:225 - Created phase mapper
2025-05-14 20:31:00.074 | INFO | shift_interface:shift_model_builder:241 - Created voltage mapper
2025-05-14 20:31:00.075 | INFO | shift_interface:shift_model_builder:249 - Created equipment mapper
2025-05-14 20:31:00.333 | INFO | shift_interface:shift_model_builder:257 - Sucessfully built the gdm system
System ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓ ┃ Property ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩ │ System name │ gdm_model │ │ Data format version │ 2.0.1 │ │ Components attached │ 864 │ │ Time Series attached │ 0 │ │ Description │ │ └──────────────────────┴───────────┘
Component Information ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓ ┃ Type ┃ Count ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩ │ DistributionBus │ 218 │ │ DistributionLoad │ 54 │ │ DistributionTransformer │ 16 │ │ DistributionTransformerEquipment │ 1 │ │ DistributionVoltageSource │ 1 │ │ LoadEquipment │ 54 │ │ Location │ 202 │ │ MatrixImpedanceBranch │ 201 │ │ MatrixImpedanceBranchEquipment │ 3 │ │ PhaseLoadEquipment │ 108 │ │ PhaseVoltageSourceEquipment │ 3 │ │ VoltageSourceEquipment │ 1 │ │ WindingEquipment │ 2 │ └──────────────────────────────────┴───────┘