power-grid-model-io 1.2.20__py3-none-any.whl → 1.2.21__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 +61 -7
- {power_grid_model_io-1.2.20.dist-info → power_grid_model_io-1.2.21.dist-info}/METADATA +5 -5
- {power_grid_model_io-1.2.20.dist-info → power_grid_model_io-1.2.21.dist-info}/RECORD +6 -6
- {power_grid_model_io-1.2.20.dist-info → power_grid_model_io-1.2.21.dist-info}/LICENSE +0 -0
- {power_grid_model_io-1.2.20.dist-info → power_grid_model_io-1.2.21.dist-info}/WHEEL +0 -0
- {power_grid_model_io-1.2.20.dist-info → power_grid_model_io-1.2.21.dist-info}/top_level.txt +0 -0
|
@@ -79,7 +79,8 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
79
79
|
|
|
80
80
|
# Construct extra_info
|
|
81
81
|
if extra_info is not None:
|
|
82
|
-
self.
|
|
82
|
+
self._fill_pgm_extra_info(extra_info=extra_info)
|
|
83
|
+
self._fill_pp_extra_info(extra_info=extra_info)
|
|
83
84
|
|
|
84
85
|
return self.pgm_input_data
|
|
85
86
|
|
|
@@ -135,22 +136,56 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
135
136
|
self._create_pgm_input_generators()
|
|
136
137
|
self._create_pgm_input_dclines()
|
|
137
138
|
|
|
138
|
-
def
|
|
139
|
+
def _fill_pgm_extra_info(self, extra_info: ExtraInfo):
|
|
140
|
+
"""
|
|
141
|
+
Fills in extra information of power-grid-model input after conversion from pandapower to the extra_info dict
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
extra_info: The extra info dict
|
|
145
|
+
"""
|
|
139
146
|
for (pp_table, name), indices in self.idx_lookup.items():
|
|
140
147
|
for pgm_id, pp_idx in zip(indices.index, indices):
|
|
141
148
|
if name:
|
|
142
149
|
extra_info[pgm_id] = {"id_reference": {"table": pp_table, "name": name, "index": pp_idx}}
|
|
143
150
|
else:
|
|
144
151
|
extra_info[pgm_id] = {"id_reference": {"table": pp_table, "index": pp_idx}}
|
|
152
|
+
|
|
145
153
|
for component_data in self.pgm_input_data.values():
|
|
146
154
|
for attr_name in component_data.dtype.names:
|
|
147
155
|
if not NODE_REF_RE.fullmatch(attr_name):
|
|
148
156
|
continue
|
|
149
157
|
for pgm_id, node_id in component_data[["id", attr_name]]:
|
|
150
|
-
if pgm_id in extra_info:
|
|
151
|
-
extra_info[pgm_id]
|
|
152
|
-
|
|
153
|
-
extra_info[pgm_id] = {
|
|
158
|
+
if pgm_id not in extra_info:
|
|
159
|
+
extra_info[pgm_id] = {}
|
|
160
|
+
if "pgm_input" not in extra_info[pgm_id]:
|
|
161
|
+
extra_info[pgm_id]["pgm_input"] = {}
|
|
162
|
+
extra_info[pgm_id]["pgm_input"][attr_name] = node_id
|
|
163
|
+
|
|
164
|
+
def _fill_pp_extra_info(self, extra_info: ExtraInfo):
|
|
165
|
+
"""
|
|
166
|
+
Fills extra information from pandapower input dataframes not available in power-grid-model input
|
|
167
|
+
to the extra_info dict.
|
|
168
|
+
Currently, it is possible to only store the derating factor (df) of trafo.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
extra_info: The extra info dict
|
|
172
|
+
"""
|
|
173
|
+
pp_input = {"trafo": {"df"}}
|
|
174
|
+
for pp_table, pp_attr in pp_input.items():
|
|
175
|
+
if pp_table in self.pp_input_data:
|
|
176
|
+
pp_attr = pp_attr & set(self.pp_input_data[pp_table].columns)
|
|
177
|
+
if not pp_attr:
|
|
178
|
+
continue
|
|
179
|
+
pgm_ids = self._get_pgm_ids(pp_table=pp_table)
|
|
180
|
+
pp_extra_data = self.pp_input_data[pp_table][pp_attr]
|
|
181
|
+
pp_extra_data.index = pgm_ids
|
|
182
|
+
for pgm_id, pp_element in pp_extra_data.iterrows():
|
|
183
|
+
if pgm_id not in extra_info:
|
|
184
|
+
extra_info[pgm_id] = {}
|
|
185
|
+
if "pp_input" not in extra_info[pgm_id]:
|
|
186
|
+
extra_info[pgm_id]["pp_input"] = {}
|
|
187
|
+
for attr in pp_attr:
|
|
188
|
+
extra_info[pgm_id]["pp_input"][attr] = pp_element[attr]
|
|
154
189
|
|
|
155
190
|
def _extra_info_to_idx_lookup(self, extra_info: ExtraInfo):
|
|
156
191
|
"""
|
|
@@ -202,10 +237,29 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
|
|
|
202
237
|
dtype={"names": ["id"] + node_cols, "formats": [dtype] * num_cols},
|
|
203
238
|
)
|
|
204
239
|
for i, pgm_id in enumerate(data["id"]):
|
|
205
|
-
extra = extra_info[pgm_id]
|
|
240
|
+
extra = extra_info[pgm_id].get("pgm_input", {})
|
|
206
241
|
ref[i] = (pgm_id,) + tuple(extra[col] for col in node_cols)
|
|
207
242
|
self.pgm_input_data[component] = ref
|
|
208
243
|
|
|
244
|
+
def _extra_info_to_pp_input_data(self, extra_info: ExtraInfo):
|
|
245
|
+
"""
|
|
246
|
+
Converts extra component info into node_lookup
|
|
247
|
+
Currently, it is possible to only retrieve the derating factor (df) of trafo.
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
extra_info: a dictionary where the node reference ids are stored
|
|
251
|
+
"""
|
|
252
|
+
assert not self.pp_input_data
|
|
253
|
+
assert self.pgm_output_data
|
|
254
|
+
|
|
255
|
+
if "transformer" not in self.pgm_output_data:
|
|
256
|
+
return
|
|
257
|
+
|
|
258
|
+
pgm_ids = self.pgm_output_data["transformer"]["id"]
|
|
259
|
+
pp_ids = self._get_pp_ids(pp_table="trafo", pgm_idx=pgm_ids)
|
|
260
|
+
derating_factor = (extra_info.get(pgm_id, {}).get("pp_input", {}).get("df", np.nan) for pgm_id in pgm_ids)
|
|
261
|
+
self.pp_input_data = {"trafo": pd.DataFrame(derating_factor, columns=["df"], index=pp_ids)}
|
|
262
|
+
|
|
209
263
|
def _create_output_data(self):
|
|
210
264
|
"""
|
|
211
265
|
Performs the conversion from power-grid-model to PandaPower by calling individual conversion functions.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: power-grid-model-io
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.21
|
|
4
4
|
Summary: Power Grid Model Input/Output
|
|
5
5
|
Author-email: Alliander Dynamic Grid Calculation <dynamic.grid.calculation@alliander.com>
|
|
6
6
|
License: MPL-2.0
|
|
@@ -67,15 +67,15 @@ SPDX-License-Identifier: MPL-2.0
|
|
|
67
67
|
For detailed documentation, see [Read the Docs](https://power-grid-model-io.readthedocs.io/en/stable/index.html).
|
|
68
68
|
|
|
69
69
|
# Examples
|
|
70
|
-
* [PGM JSON Example](https://github.com/alliander-opensource/power-grid-model-io/blob/
|
|
70
|
+
* [PGM JSON Example](https://github.com/alliander-opensource/power-grid-model-io/blob/d8dd031d970de476dcde7b42d76438ed4a09fd05/docs/examples/pgm_json_example.ipynb)
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
# License
|
|
74
|
-
This project is licensed under the Mozilla Public License, version 2.0 - see [LICENSE](https://github.com/alliander-opensource/power-grid-model-io/blob/
|
|
74
|
+
This project is licensed under the Mozilla Public License, version 2.0 - see [LICENSE](https://github.com/alliander-opensource/power-grid-model-io/blob/d8dd031d970de476dcde7b42d76438ed4a09fd05/LICENSE) for details.
|
|
75
75
|
|
|
76
76
|
# Contributing
|
|
77
|
-
Please read [CODE_OF_CONDUCT](https://github.com/alliander-opensource/power-grid-model-io/blob/
|
|
77
|
+
Please read [CODE_OF_CONDUCT](https://github.com/alliander-opensource/power-grid-model-io/blob/d8dd031d970de476dcde7b42d76438ed4a09fd05/CODE_OF_CONDUCT.md) and [CONTRIBUTING](https://github.com/alliander-opensource/power-grid-model-io/blob/d8dd031d970de476dcde7b42d76438ed4a09fd05/CONTRIBUTING.md) for details on the process
|
|
78
78
|
for submitting pull requests to us.
|
|
79
79
|
|
|
80
80
|
# Contact
|
|
81
|
-
Please read [SUPPORT](https://github.com/alliander-opensource/power-grid-model-io/blob/
|
|
81
|
+
Please read [SUPPORT](https://github.com/alliander-opensource/power-grid-model-io/blob/d8dd031d970de476dcde7b42d76438ed4a09fd05/SUPPORT.md) for how to connect and get into contact with the Power Gird Model IO project.
|
|
@@ -6,7 +6,7 @@ power_grid_model_io/config/excel/vision_en.yaml,sha256=SqzFUrzd-QQpQtselfWTZOuNO
|
|
|
6
6
|
power_grid_model_io/config/excel/vision_nl.yaml,sha256=x_m8nHokSlLT35-xwZrSpZEvUXVjMWsrZ0acV8DLizY,19128
|
|
7
7
|
power_grid_model_io/converters/__init__.py,sha256=WKvQi375_pb1I4x36aTUvRjAqXHNNlbg2yX8P0fvvsA,424
|
|
8
8
|
power_grid_model_io/converters/base_converter.py,sha256=1eljmenQSZx4hik4xwVJKFPwEVTx2lW1d965VykZnIQ,4927
|
|
9
|
-
power_grid_model_io/converters/pandapower_converter.py,sha256=
|
|
9
|
+
power_grid_model_io/converters/pandapower_converter.py,sha256=hpoMEbIDyN4JVeubPYtQt6vgZwl-CL2uO6Di0qurrOo,78866
|
|
10
10
|
power_grid_model_io/converters/pgm_json_converter.py,sha256=lwlnGNdODL_J1eD946kv8VzZYUhGudHSdt-92D7djrs,11780
|
|
11
11
|
power_grid_model_io/converters/tabular_converter.py,sha256=iKz0K0SNI7GozXirqQVxBuHVzmGlzq1qq3VPcFBwB8Q,28825
|
|
12
12
|
power_grid_model_io/converters/vision_excel_converter.py,sha256=EXxFebNiKPLYMU4m1aIf4bccSYCU6EiVUvvlvXc7Gm8,2322
|
|
@@ -34,8 +34,8 @@ power_grid_model_io/utils/dict.py,sha256=Y5fCB22qIwFVHinUq-TO1eXeNWU177sVPyOVVaA
|
|
|
34
34
|
power_grid_model_io/utils/json.py,sha256=Fw9GhCiwk4sXw48ljPOkWAR0LaRkdA8ZkUQu-K0z0vU,3343
|
|
35
35
|
power_grid_model_io/utils/modules.py,sha256=ZB8IIK96VuJk5FkoclrUCuXOSsGeVqT3B01bBAcodeU,944
|
|
36
36
|
power_grid_model_io/utils/regex.py,sha256=dbKTyQMaTWou9Cvk35R2_9SJlz6Rd5rfH6Xy3BCeFJg,1727
|
|
37
|
-
power_grid_model_io-1.2.
|
|
38
|
-
power_grid_model_io-1.2.
|
|
39
|
-
power_grid_model_io-1.2.
|
|
40
|
-
power_grid_model_io-1.2.
|
|
41
|
-
power_grid_model_io-1.2.
|
|
37
|
+
power_grid_model_io-1.2.21.dist-info/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
|
|
38
|
+
power_grid_model_io-1.2.21.dist-info/METADATA,sha256=ypD_fWN9H7CftOXjZImDIsfhR3SgpS7wtWsvOezh3IE,5679
|
|
39
|
+
power_grid_model_io-1.2.21.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
40
|
+
power_grid_model_io-1.2.21.dist-info/top_level.txt,sha256=7sq9VveemMm2R0RgTBa4tH8y_xF4_1hxbufmX9OjCTo,20
|
|
41
|
+
power_grid_model_io-1.2.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|