Skip to content

Commit

Permalink
add mapping and validation for regulators
Browse files Browse the repository at this point in the history
Signed-off-by: Nitish Bharambe <[email protected]>
  • Loading branch information
nitbharambe committed Jun 26, 2024
1 parent 7f5666a commit 1cd8074
Show file tree
Hide file tree
Showing 8 changed files with 306 additions and 41 deletions.
62 changes: 43 additions & 19 deletions src/power_grid_model_io/config/excel/vision_en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,12 @@ grid:
id:
auto_id:
key: Number
status:
multiply:
- Control
- State
regulated_object:
auto_id:
table: Transformers
key:
Number: Number
status: 1
control_side: Measuring side
u_set: Uset
u_band: Uband
Expand All @@ -239,6 +241,10 @@ grid:
extra:
- ID
- Name
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Control
value: 0
Special transformers:
transformer:
id:
Expand Down Expand Up @@ -316,18 +322,24 @@ grid:
id:
auto_id:
key: Number
status:
multiply:
- Control
- At
control_side: Measure side
regulated_object:
auto_id:
table: Special transformers
key:
Number: Number
status: 1
control_side: Measuring side
u_set: Uset
u_band: Uband
line_drop_compensation_r: Rc
line_drop_compensation_x: Xc
extra:
- ID
- Name
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Control
value: FALSE
Transformer loads:
transformer:
id:
Expand Down Expand Up @@ -837,7 +849,28 @@ grid:
extra:
- ID
- Name

transformer_tap_regulator:
id:
auto_id:
key: Number
regulated_object:
auto_id:
table: Three Winding transformers
key:
Number: Number
status: 1
control_side: Measuring side
u_set: Uset
u_band: Uband
line_drop_compensation_r: Rc
line_drop_compensation_x: Xc
extra:
- ID
- Name
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Control
value: 0
units:
A: null
F:
Expand Down Expand Up @@ -909,12 +942,3 @@ substitutions:
Measuring side:
1: 0
2: 1
Control:
FALSE: 0
TRUE: 1
At:
FALSE: 0
TRUE: 1
Back_c:
FALSE: 0
TRUE: 1
60 changes: 42 additions & 18 deletions src/power_grid_model_io/config/excel/vision_en_9_7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,12 @@ grid:
id:
auto_id:
key: Number
status:
multiply:
- Own control
- State
regulated_object:
auto_id:
table: Transformers
key:
Number: Number
status: State
control_side: Measure side
u_set: Uset
u_band: Uband
Expand All @@ -240,6 +242,10 @@ grid:
extra:
- ID
- Name
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Own control
value: FALSE
Special transformers:
transformer:
id:
Expand Down Expand Up @@ -317,10 +323,12 @@ grid:
id:
auto_id:
key: Number
status:
multiply:
- Control
- At
regulated_object:
auto_id:
table: Special transformers
key:
Number: Number
status: At
control_side: Measure side
u_set: Uset
u_band: Uband
Expand All @@ -329,6 +337,10 @@ grid:
extra:
- ID
- Name
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Control
value: FALSE
Transformer loads:
transformer:
id:
Expand Down Expand Up @@ -838,7 +850,28 @@ grid:
extra:
- ID
- Name

transformer_tap_regulator:
id:
auto_id:
key: Number
regulated_object:
auto_id:
table: Three winding transformers
key:
Number: Number
status: 1
control_side: Measure side
u_set: Uset
u_band: Uband
line_drop_compensation_r: Rc
line_drop_compensation_x: Xc
extra:
- ID
- Name
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Control
value: 0
units:
A: null
F:
Expand Down Expand Up @@ -910,15 +943,6 @@ substitutions:
Measure side:
1: 0
2: 1
Own control:
FALSE: 0
TRUE: 1
Control:
FALSE: 0
TRUE: 1
At:
FALSE: 0
TRUE: 1
Back_c:
FALSE: 0
TRUE: 1
72 changes: 70 additions & 2 deletions src/power_grid_model_io/config/excel/vision_nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,28 @@ grid:
extra:
- ID
- Naam
transformer_tap_regulator:
id:
auto_id:
key: Nummer
regulated_object:
auto_id:
table: Transformatoren
key:
Nummer: Nummer
status: 1
control_side: Meetzijde
u_set: Uset
u_band: Uband
line_drop_compensation_r: Rc
line_drop_compensation_x: Xc
extra:
- ID
- Naam
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Regeling
value: 0
Speciale transformatoren:
transformer:
id:
Expand Down Expand Up @@ -290,6 +312,28 @@ grid:
extra:
- ID
- Naam
transformer_tap_regulator:
id:
auto_id:
key: Nummer
regulated_object:
auto_id:
table: Speciale transformatoren
key:
Nummer: Nummer
status: 1
control_side: Meetzijde
u_set: Uset
u_band: Uband
line_drop_compensation_r: Rc
line_drop_compensation_x: Xc
extra:
- ID
- Naam
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Regeling
value: FALSE
Transformatorbelastingen:
transformer:
id:
Expand Down Expand Up @@ -793,7 +837,28 @@ grid:
extra:
- ID
- Naam

transformer_tap_regulator:
id:
auto_id:
key: Nummer
regulated_object:
auto_id:
table: Driewikkelingstransformatoren
key:
Nummer: Nummer
status: 1
control_side: Meetzijde
u_set: Uset
u_band: Uband
line_drop_compensation_r: Rc
line_drop_compensation_x: Xc
extra:
- ID
- Naam
filters:
- power_grid_model_io.functions.filters.exclude_value:
col: Regeling
value: 0
units:
A: null
F:
Expand Down Expand Up @@ -857,4 +922,7 @@ substitutions:
2: 1
Synchrone generatoren.Q:
terugleveren: -1
leveren: 1
leveren: 1
Meetzijde:
1: 0
2: 1
4 changes: 4 additions & 0 deletions src/power_grid_model_io/functions/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def exclude_empty(row: pd.Series, col: str) -> bool:
"""
filter out empty
"""
if col not in row:
raise ValueError(f"The column: '{col}' cannot be found for the filter")
result = has_value(row[col])
if isinstance(result, pd.Series):
return result.item()
Expand All @@ -26,6 +28,8 @@ def exclude_value(row: pd.Series, col: str, value: Union[float, str]) -> bool:
"""
filter out by match value
"""
if col not in row:
raise ValueError(f"The column: '{col}' cannot be found for the filter")
result = row[col] != value
if isinstance(result, pd.Series):
return result.item()
Expand Down
6 changes: 6 additions & 0 deletions tests/data/vision/pgm_input_data_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
{"id": 11, "from_node": 2, "to_node": 13, "id_reference": {"table": "Transformer loads", "name": "transformer", "key": {"Node.Number": 3, "Subnumber": 4}}, "Name": "transformer_load_2"},
{"id": 12, "from_node": 2, "to_node": 14, "id_reference": {"table": "Transformer loads", "name": "transformer", "key": {"Node.Number": 3, "Subnumber": 2}}, "Name": "transformer_load_1"}
],
"transformer_tap_regulator":
[
{"id": 9, "id_reference": {"table": "Transformers", "key": {"Number": 1}}, "Name": "transformer1"},
{"id": 10, "id_reference": {"table": "Special transformers", "key": {"Number": 1}}, "Name": "special_trans1"},
{"id": 27, "id_reference": {"table": "Three winding transformers", "key": {"Number": 1}}}
],
"sym_load":
[
{"id": 15, "node": 13, "id_reference": {"table": "Transformer loads", "name": "load", "key": {"Node.Number": 3, "Subnumber": 4}}, "Name": "transformer_load_2"},
Expand Down
6 changes: 6 additions & 0 deletions tests/data/vision/pgm_input_data_nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
{"id": 11, "from_node": 2, "to_node": 13, "id_reference": {"table": "Transformatorbelastingen", "name": "transformer", "key": {"Knooppunt.Nummer": 3, "Subnummer": 4}}, "Naam": "transformer_load_2"},
{"id": 12, "from_node": 2, "to_node": 14, "id_reference": {"table": "Transformatorbelastingen", "name": "transformer", "key": {"Knooppunt.Nummer": 3, "Subnummer": 2}}, "Naam": "transformer_load_1"}
],
"transformer_tap_regulator":
[
{"id": 9, "id_reference": {"table": "Transformatoren", "key": {"Nummer": 1}}, "Naam": "transformer1"},
{"id": 10, "id_reference": {"table": "Speciale transformatoren", "key": {"Nummer": 1}}, "Naam": "special_trans1"},
{"id": 27, "id_reference": {"table": "Driewikkelingstransformatoren", "key": {"Nummer": 1}}}
],
"sym_load":
[
{"id": 15, "node": 13, "id_reference": {"table": "Transformatorbelastingen", "name": "load", "key": {"Knooppunt.Nummer": 3, "Subnummer": 4}}, "Naam": "transformer_load_2"},
Expand Down
Loading

0 comments on commit 1cd8074

Please sign in to comment.