Skip to content

Add methods to create grid elements #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading