power-grid-model-io 1.3.16__py3-none-any.whl → 1.3.18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of power-grid-model-io might be problematic. Click here for more details.
- power_grid_model_io/converters/pandapower_converter.py +44 -70
- {power_grid_model_io-1.3.16.dist-info → power_grid_model_io-1.3.18.dist-info}/METADATA +1 -1
- {power_grid_model_io-1.3.16.dist-info → power_grid_model_io-1.3.18.dist-info}/RECORD +6 -6
- {power_grid_model_io-1.3.16.dist-info → power_grid_model_io-1.3.18.dist-info}/WHEEL +0 -0
- {power_grid_model_io-1.3.16.dist-info → power_grid_model_io-1.3.18.dist-info}/licenses/LICENSE +0 -0
- {power_grid_model_io-1.3.16.dist-info → power_grid_model_io-1.3.18.dist-info}/top_level.txt +0 -0
|
@@ -342,13 +342,13 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
342
342
|
self._pp_buses_output()
|
|
343
343
|
self._pp_lines_output()
|
|
344
344
|
self._pp_ext_grids_output()
|
|
345
|
-
self.
|
|
345
|
+
self._pp_load_elements_output(element="load", symmetric=True)
|
|
346
|
+
self._pp_load_elements_output(element="ward", symmetric=True)
|
|
347
|
+
self._pp_load_elements_output(element="motor", symmetric=True)
|
|
346
348
|
self._pp_shunts_output()
|
|
347
349
|
self._pp_trafos_output()
|
|
348
350
|
self._pp_sgens_output()
|
|
349
351
|
self._pp_trafos3w_output()
|
|
350
|
-
self._pp_ward_output()
|
|
351
|
-
self._pp_motor_output()
|
|
352
352
|
self._pp_asym_gens_output()
|
|
353
353
|
self._pp_asym_loads_output()
|
|
354
354
|
# Switches derive results from branches pp_output_data and pgm_output_data of links. Hence, placed in the end.
|
|
@@ -360,13 +360,14 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
360
360
|
Furthermore, creates a global node lookup table, which stores nodes' voltage magnitude per unit and the voltage
|
|
361
361
|
angle in degrees
|
|
362
362
|
"""
|
|
363
|
-
# TODO create output_data_3ph for
|
|
364
|
-
# Although Pandapower itself did not implmenet res_shunt_3ph
|
|
365
|
-
# Since results are avaiable in PGM output, these should be converted.
|
|
363
|
+
# TODO create output_data_3ph for trafos3w, switches
|
|
366
364
|
self._pp_buses_output_3ph()
|
|
367
365
|
self._pp_lines_output_3ph()
|
|
368
366
|
self._pp_ext_grids_output_3ph()
|
|
369
|
-
self.
|
|
367
|
+
self._pp_load_elements_output(element="load", symmetric=False)
|
|
368
|
+
self._pp_load_elements_output(element="ward", symmetric=False)
|
|
369
|
+
self._pp_load_elements_output(element="motor", symmetric=False)
|
|
370
|
+
self._pp_shunts_output_3ph()
|
|
370
371
|
self._pp_trafos_output_3ph()
|
|
371
372
|
self._pp_sgens_output_3ph()
|
|
372
373
|
self._pp_asym_gens_output_3ph()
|
|
@@ -426,7 +427,6 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
426
427
|
pgm_lines["x1"] = self._get_pp_attr("line", "x_ohm_per_km", expected_type="f8") * multiplier
|
|
427
428
|
pgm_lines["c1"] = c_nf_per_km * length_km * parallel * 1e-9
|
|
428
429
|
# The formula for tan1 = R_1 / Xc_1 = (g * 1e-6) / (2 * pi * f * c * 1e-9) = g / (2 * pi * f * c * 1e-3)
|
|
429
|
-
pgm_lines["tan1"] = 0.0
|
|
430
430
|
pgm_lines["tan1"] = np.divide(
|
|
431
431
|
self._get_pp_attr("line", "g_us_per_km", expected_type="f8", default=0),
|
|
432
432
|
c_nf_per_km * (2 * np.pi * self.system_frequency * 1e-3),
|
|
@@ -440,7 +440,6 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
440
440
|
pgm_lines["r0"] = self._get_pp_attr("line", "r0_ohm_per_km", expected_type="f8", default=np.nan) * multiplier
|
|
441
441
|
pgm_lines["x0"] = self._get_pp_attr("line", "x0_ohm_per_km", expected_type="f8", default=np.nan) * multiplier
|
|
442
442
|
pgm_lines["c0"] = c0_nf_per_km * length_km * parallel * 1e-9
|
|
443
|
-
pgm_lines["tan0"] = 0.0
|
|
444
443
|
pgm_lines["tan0"] = np.divide(
|
|
445
444
|
self._get_pp_attr("line", "g0_us_per_km", expected_type="f8", default=0),
|
|
446
445
|
c0_nf_per_km * (2 * np.pi * self.system_frequency * 1e-3),
|
|
@@ -1562,64 +1561,35 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
1562
1561
|
|
|
1563
1562
|
self.pp_output_data["res_asymmetric_sgen"] = pp_output_asym_gens
|
|
1564
1563
|
|
|
1565
|
-
def
|
|
1564
|
+
def _pp_load_elements_output(self, element, symmetric):
|
|
1566
1565
|
"""
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1566
|
+
Utility function to convert output of elements represented as load
|
|
1567
|
+
in power grid model.
|
|
1568
|
+
element: "load", "motor" or "ward"
|
|
1569
|
+
symmetric: True or False
|
|
1571
1570
|
"""
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
ComponentType.sym_load not in self.pgm_output_data
|
|
1577
|
-
or self.pgm_output_data[ComponentType.sym_load].size == 0
|
|
1578
|
-
or ("load", load_id_names[0]) not in self.idx
|
|
1579
|
-
):
|
|
1580
|
-
return
|
|
1581
|
-
|
|
1582
|
-
# Store the results, while assuring that we are not overwriting any data
|
|
1583
|
-
assert "res_load" not in self.pp_output_data
|
|
1584
|
-
self.pp_output_data["res_load"] = self._pp_load_result_accumulate(
|
|
1585
|
-
pp_component_name="load", load_id_names=load_id_names
|
|
1586
|
-
)
|
|
1587
|
-
|
|
1588
|
-
def _pp_ward_output(self):
|
|
1589
|
-
load_id_names = ["ward_const_power_load", "ward_const_impedance_load"]
|
|
1590
|
-
assert "res_ward" not in self.pp_output_data
|
|
1591
|
-
|
|
1592
|
-
if (
|
|
1593
|
-
ComponentType.sym_load not in self.pgm_output_data
|
|
1594
|
-
or self.pgm_output_data[ComponentType.sym_load].size == 0
|
|
1595
|
-
or ("ward", load_id_names[0]) not in self.idx
|
|
1596
|
-
):
|
|
1597
|
-
return
|
|
1598
|
-
|
|
1599
|
-
accumulated_loads = self._pp_load_result_accumulate(pp_component_name="ward", load_id_names=load_id_names)
|
|
1600
|
-
# TODO Find a better way for mapping vm_pu from bus
|
|
1601
|
-
# accumulated_loads["vm_pu"] = np.nan
|
|
1602
|
-
|
|
1603
|
-
# Store the results, while assuring that we are not overwriting any data
|
|
1604
|
-
assert "res_ward" not in self.pp_output_data
|
|
1605
|
-
self.pp_output_data["res_ward"] = accumulated_loads
|
|
1606
|
-
|
|
1607
|
-
def _pp_motor_output(self):
|
|
1608
|
-
load_id_names = ["motor_load"]
|
|
1571
|
+
if symmetric:
|
|
1572
|
+
res_table = "res_" + element
|
|
1573
|
+
else:
|
|
1574
|
+
res_table = "res_" + element + "_3ph"
|
|
1609
1575
|
|
|
1610
|
-
|
|
1576
|
+
if element == "load":
|
|
1577
|
+
load_id_names = ["const_power", "const_impedance", "const_current"]
|
|
1578
|
+
elif element == "ward":
|
|
1579
|
+
load_id_names = ["ward_const_power_load", "ward_const_impedance_load"]
|
|
1580
|
+
elif element == "motor":
|
|
1581
|
+
load_id_names = ["motor_load"]
|
|
1611
1582
|
|
|
1612
1583
|
if (
|
|
1613
1584
|
ComponentType.sym_load not in self.pgm_output_data
|
|
1614
1585
|
or self.pgm_output_data[ComponentType.sym_load].size == 0
|
|
1615
|
-
or (
|
|
1586
|
+
or (element, load_id_names[0]) not in self.idx
|
|
1616
1587
|
):
|
|
1617
1588
|
return
|
|
1618
|
-
|
|
1619
1589
|
# Store the results, while assuring that we are not overwriting any data
|
|
1620
|
-
assert
|
|
1621
|
-
self.pp_output_data[
|
|
1622
|
-
pp_component_name=
|
|
1590
|
+
assert res_table not in self.pp_output_data
|
|
1591
|
+
self.pp_output_data[res_table] = self._pp_load_result_accumulate(
|
|
1592
|
+
pp_component_name=element, load_id_names=load_id_names
|
|
1623
1593
|
)
|
|
1624
1594
|
|
|
1625
1595
|
def _pp_load_result_accumulate(self, pp_component_name: str, load_id_names: List[str]) -> pd.DataFrame:
|
|
@@ -2133,26 +2103,30 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
2133
2103
|
assert "res_trafo_3ph" not in self.pp_output_data
|
|
2134
2104
|
self.pp_output_data["res_trafo_3ph"] = pp_output_trafos_3ph
|
|
2135
2105
|
|
|
2136
|
-
def
|
|
2106
|
+
def _pp_shunts_output_3ph(self):
|
|
2137
2107
|
"""
|
|
2138
|
-
This function converts a power-grid-model
|
|
2108
|
+
This function converts a power-grid-model Shunt output array to a Shunt Dataframe of PandaPower.
|
|
2139
2109
|
|
|
2140
2110
|
Returns:
|
|
2141
|
-
a PandaPower Dataframe for the
|
|
2111
|
+
a PandaPower Dataframe for the Shunt component
|
|
2142
2112
|
"""
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
or ("load", load_id_names[0]) not in self.idx
|
|
2148
|
-
):
|
|
2113
|
+
# TODO: create unit tests for the function
|
|
2114
|
+
assert "res_shunt_3ph" not in self.pp_output_data
|
|
2115
|
+
|
|
2116
|
+
if ComponentType.shunt not in self.pgm_output_data or self.pgm_output_data[ComponentType.shunt].size == 0:
|
|
2149
2117
|
return
|
|
2150
2118
|
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2119
|
+
pgm_output_shunts = self.pgm_output_data[ComponentType.shunt]
|
|
2120
|
+
|
|
2121
|
+
pp_output_shunts = pd.DataFrame(
|
|
2122
|
+
columns=["p_mw", "q_mvar", "vm_pu"],
|
|
2123
|
+
index=self._get_pp_ids("shunt", pgm_output_shunts["id"]),
|
|
2155
2124
|
)
|
|
2125
|
+
pp_output_shunts["p_mw"] = pgm_output_shunts["p"].sum() * 1e-6
|
|
2126
|
+
pp_output_shunts["q_mvar"] = pgm_output_shunts["q"].sum() * 1e-6
|
|
2127
|
+
# TODO Find a better way for mapping vm_pu from bus
|
|
2128
|
+
# pp_output_shunts["vm_pu"] = np.nan
|
|
2129
|
+
self.pp_output_data["res_shunt_3ph"] = pp_output_shunts
|
|
2156
2130
|
|
|
2157
2131
|
def _pp_asym_loads_output_3ph(self):
|
|
2158
2132
|
"""
|
|
@@ -10,7 +10,7 @@ power_grid_model_io/config/excel/vision_en_9_8.yaml,sha256=yCa4v5VUK1xCZ0PrHG2Zf
|
|
|
10
10
|
power_grid_model_io/config/excel/vision_nl.yaml,sha256=0IOh5Ug9QwP2dgNMsl90RARV_v-xxcA6rv8Ya0WCPuI,21426
|
|
11
11
|
power_grid_model_io/converters/__init__.py,sha256=qng1-O8kfpgalPms_C_zAwBuiuKUoquf27u6JkVH-9k,487
|
|
12
12
|
power_grid_model_io/converters/base_converter.py,sha256=ifF-U1kmJIW9Tj9uW7d0XJlsBrmvpUZoi3WxNPAbKO4,6170
|
|
13
|
-
power_grid_model_io/converters/pandapower_converter.py,sha256=
|
|
13
|
+
power_grid_model_io/converters/pandapower_converter.py,sha256=sxtKymhic8Bka4fMoAWGw8WMQQYDDWjlNi96ALyUr68,117827
|
|
14
14
|
power_grid_model_io/converters/pgm_json_converter.py,sha256=7Z1Qmoxn0qo4fkLXvmNTWNMHOJHhnyGTvxlRlcHbMLg,14210
|
|
15
15
|
power_grid_model_io/converters/tabular_converter.py,sha256=XmUDVthYyJQiHXxzspVCjUo3ZGsv4XXwZ_VRQLn4bvs,35666
|
|
16
16
|
power_grid_model_io/converters/vision_excel_converter.py,sha256=hiEOqXgfM3XbHDJ-ri-Os2a4Dh5lZFqF0m9_YFBaYs4,4166
|
|
@@ -43,8 +43,8 @@ power_grid_model_io/utils/modules.py,sha256=DJLmYKt9cV_GvqJI8wkXppNycqD4b8n5-o_8
|
|
|
43
43
|
power_grid_model_io/utils/parsing.py,sha256=cw6d3S89BvB8dncN0SeFHDhFG7ZlDNx9iGYWjZk5fVU,4684
|
|
44
44
|
power_grid_model_io/utils/uuid_excel_cvtr.py,sha256=FFsfnvELVTkIXE_qfEPjFlphsikAr7GyjnNwsDZ-AgY,7581
|
|
45
45
|
power_grid_model_io/utils/zip.py,sha256=VXHX4xWPPZbhOlZUAbMDy3MgQFzK6_l7sRvGXihNUY4,3875
|
|
46
|
-
power_grid_model_io-1.3.
|
|
47
|
-
power_grid_model_io-1.3.
|
|
48
|
-
power_grid_model_io-1.3.
|
|
49
|
-
power_grid_model_io-1.3.
|
|
50
|
-
power_grid_model_io-1.3.
|
|
46
|
+
power_grid_model_io-1.3.18.dist-info/licenses/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
|
|
47
|
+
power_grid_model_io-1.3.18.dist-info/METADATA,sha256=W4Xjr3ZA230XyiLs0lKqLTHdgJNWkHSLln7oF1B2B9A,8196
|
|
48
|
+
power_grid_model_io-1.3.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
49
|
+
power_grid_model_io-1.3.18.dist-info/top_level.txt,sha256=7sq9VveemMm2R0RgTBa4tH8y_xF4_1hxbufmX9OjCTo,20
|
|
50
|
+
power_grid_model_io-1.3.18.dist-info/RECORD,,
|
|
File without changes
|
{power_grid_model_io-1.3.16.dist-info → power_grid_model_io-1.3.18.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|