Skip to content

Commit

Permalink
Merge pull request #227 from ie3-institute/df/#226-gridelements
Browse files Browse the repository at this point in the history
Add methods to create grid elements
  • Loading branch information
t-ober authored Sep 12, 2024
2 parents b926e9f + 3f759bc commit 16fab7b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- `PrimaryData` time series are now protected, introduced `add_time_series` method [#218](https://github.com/ie3-institute/pypsdm/pull/218)
- Added method to create nodes and lines [#223](https://github.com/ie3-institute/pypsdm/pull/223)
- Added graph traversal functionality [#224](https://github.com/ie3-institute/pypsdm/pull/224)
- Added method to create two winding transformer [#227](https://github.com/ie3-institute/pypsdm/pull/227)

### Changed

Expand Down
75 changes: 72 additions & 3 deletions pypsdm/models/input/create/grid_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pandas as pd

from pypsdm.models.input import Lines, Nodes
from pypsdm.models.input import Lines, Nodes, Transformers2W
from pypsdm.models.input.create.utils import create_data


Expand Down Expand Up @@ -51,7 +51,12 @@ def create_lines_data(
length,
node_a,
node_b,
type,
b,
g,
i_max,
r,
v_rated,
x,
olm_characteristic="olm:{(0.0,1.0)}",
uuid=None,
operates_from=None,
Expand All @@ -68,11 +73,75 @@ def create_lines_data(
"length": length,
"node_a": node_a,
"node_b": node_b,
"type": type,
"b": b,
"g": g,
"i_max": i_max,
"r": r,
"v_rated": v_rated,
"x": x,
"olm_characteristic": olm_characteristic,
"operates_from": operates_from,
"operates_until": operates_until,
"operator": operator,
"parallel_devices": parallel_devices,
}
).rename(uuid)


def create_2w_transformers(data_dict):
return Transformers2W(create_data(data_dict, create_2w_transformer_data))


def create_2w_transformer_data(
auto_tap,
id,
node_a,
node_b,
tap_pos,
tap_max,
tap_min,
tap_neutr,
tap_side,
v_rated_a,
v_rated_b,
d_phi,
d_v,
r_sc,
x_sc,
g_m,
b_m,
s_rated,
uuid=None,
operates_from=None,
operates_until=None,
operator=None,
parallel_devices=1,
):
if not uuid:
uuid = str(uuid4())
return pd.Series(
{
"auto_tap": auto_tap,
"id": id,
"node_a": node_a,
"node_b": node_b,
"tap_pos": tap_pos,
"tap_max": tap_max,
"tap_min": tap_min,
"tap_neutr": tap_neutr,
"tap_side": tap_side,
"v_rated_a": v_rated_a,
"v_rated_b": v_rated_b,
"d_phi": d_phi,
"d_v": d_v,
"r_sc": r_sc,
"x_sc": x_sc,
"g_m": g_m,
"b_m": b_m,
"s_rated": s_rated,
"operates_from": operates_from,
"operates_until": operates_until,
"operator": operator,
"parallel_devices": parallel_devices,
}
).rename(uuid)

0 comments on commit 16fab7b

Please sign in to comment.