power-grid-model-io 1.3.17__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.

@@ -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._pp_loads_output()
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 remaining components
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._pp_loads_output_3ph()
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()
@@ -1560,64 +1561,35 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
1560
1561
 
1561
1562
  self.pp_output_data["res_asymmetric_sgen"] = pp_output_asym_gens
1562
1563
 
1563
- def _pp_loads_output(self):
1564
+ def _pp_load_elements_output(self, element, symmetric):
1564
1565
  """
1565
- This function converts a power-grid-model Symmetrical Load output array to a Load Dataframe of PandaPower.
1566
-
1567
- Returns:
1568
- a PandaPower Dataframe for the Load component
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
1569
1570
  """
1570
- load_id_names = ["const_power", "const_impedance", "const_current"]
1571
- assert "res_load" not in self.pp_output_data
1572
-
1573
- if (
1574
- ComponentType.sym_load not in self.pgm_output_data
1575
- or self.pgm_output_data[ComponentType.sym_load].size == 0
1576
- or ("load", load_id_names[0]) not in self.idx
1577
- ):
1578
- return
1579
-
1580
- # Store the results, while assuring that we are not overwriting any data
1581
- assert "res_load" not in self.pp_output_data
1582
- self.pp_output_data["res_load"] = self._pp_load_result_accumulate(
1583
- pp_component_name="load", load_id_names=load_id_names
1584
- )
1585
-
1586
- def _pp_ward_output(self):
1587
- load_id_names = ["ward_const_power_load", "ward_const_impedance_load"]
1588
- assert "res_ward" not in self.pp_output_data
1589
-
1590
- if (
1591
- ComponentType.sym_load not in self.pgm_output_data
1592
- or self.pgm_output_data[ComponentType.sym_load].size == 0
1593
- or ("ward", load_id_names[0]) not in self.idx
1594
- ):
1595
- return
1596
-
1597
- accumulated_loads = self._pp_load_result_accumulate(pp_component_name="ward", load_id_names=load_id_names)
1598
- # TODO Find a better way for mapping vm_pu from bus
1599
- # accumulated_loads["vm_pu"] = np.nan
1600
-
1601
- # Store the results, while assuring that we are not overwriting any data
1602
- assert "res_ward" not in self.pp_output_data
1603
- self.pp_output_data["res_ward"] = accumulated_loads
1604
-
1605
- def _pp_motor_output(self):
1606
- load_id_names = ["motor_load"]
1571
+ if symmetric:
1572
+ res_table = "res_" + element
1573
+ else:
1574
+ res_table = "res_" + element + "_3ph"
1607
1575
 
1608
- assert "res_motor" not in self.pp_output_data
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"]
1609
1582
 
1610
1583
  if (
1611
1584
  ComponentType.sym_load not in self.pgm_output_data
1612
1585
  or self.pgm_output_data[ComponentType.sym_load].size == 0
1613
- or ("motor", load_id_names[0]) not in self.idx
1586
+ or (element, load_id_names[0]) not in self.idx
1614
1587
  ):
1615
1588
  return
1616
-
1617
1589
  # Store the results, while assuring that we are not overwriting any data
1618
- assert "res_motor" not in self.pp_output_data
1619
- self.pp_output_data["res_motor"] = self._pp_load_result_accumulate(
1620
- pp_component_name="motor", load_id_names=load_id_names
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
1621
1593
  )
1622
1594
 
1623
1595
  def _pp_load_result_accumulate(self, pp_component_name: str, load_id_names: List[str]) -> pd.DataFrame:
@@ -2131,26 +2103,30 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
2131
2103
  assert "res_trafo_3ph" not in self.pp_output_data
2132
2104
  self.pp_output_data["res_trafo_3ph"] = pp_output_trafos_3ph
2133
2105
 
2134
- def _pp_loads_output_3ph(self):
2106
+ def _pp_shunts_output_3ph(self):
2135
2107
  """
2136
- This function converts a power-grid-model Symmetrical Load output array to a Load Dataframe of PandaPower.
2108
+ This function converts a power-grid-model Shunt output array to a Shunt Dataframe of PandaPower.
2137
2109
 
2138
2110
  Returns:
2139
- a PandaPower Dataframe for the Load component
2111
+ a PandaPower Dataframe for the Shunt component
2140
2112
  """
2141
- load_id_names = ["const_power", "const_impedance", "const_current"]
2142
- if (
2143
- ComponentType.sym_load not in self.pgm_output_data
2144
- or self.pgm_output_data[ComponentType.sym_load].size == 0
2145
- or ("load", load_id_names[0]) not in self.idx
2146
- ):
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:
2147
2117
  return
2148
2118
 
2149
- # Store the results, while assuring that we are not overwriting any data
2150
- assert "res_load_3ph" not in self.pp_output_data
2151
- self.pp_output_data["res_load_3ph"] = self._pp_load_result_accumulate(
2152
- pp_component_name="load", load_id_names=load_id_names
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"]),
2153
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
2154
2130
 
2155
2131
  def _pp_asym_loads_output_3ph(self):
2156
2132
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: power-grid-model-io
3
- Version: 1.3.17
3
+ Version: 1.3.18
4
4
  Summary: Power Grid Model Input/Output
5
5
  Author-email: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
6
6
  License: MPL-2.0
@@ -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=1dyUauBBaumCRCozqCEfvlwIrGSbylSj2B-KCIBq21I,118611
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.17.dist-info/licenses/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
47
- power_grid_model_io-1.3.17.dist-info/METADATA,sha256=iyikNiMjBnDhLE6PwebIC1g5roaJj1au359twopZkTM,8196
48
- power_grid_model_io-1.3.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
- power_grid_model_io-1.3.17.dist-info/top_level.txt,sha256=7sq9VveemMm2R0RgTBa4tH8y_xF4_1hxbufmX9OjCTo,20
50
- power_grid_model_io-1.3.17.dist-info/RECORD,,
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,,