Skip to content
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

Add DanglingLine boundary side P, Q, Vmag, Vangle #792

Merged
merged 3 commits into from
Jul 1, 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
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ static NetworkDataframeMapper danglingLines() {
.doubles("p", getPerUnitP(), setPerUnitP())
.doubles("q", getPerUnitQ(), setPerUnitQ())
.doubles("i", (dl, context) -> perUnitI(context, dl.getTerminal()))
.doubles("boundary_p", (dl, context) -> perUnitPQ(context, dl.getBoundary().getP()), false)
.doubles("boundary_q", (dl, context) -> perUnitPQ(context, dl.getBoundary().getQ()), false)
.doubles("boundary_v_mag", (dl, context) -> perUnitV(context, dl.getBoundary().getV(), dl.getTerminal()), false)
.doubles("boundary_v_angle", (dl, context) -> perUnitAngle(context, dl.getBoundary().getAngle()), false)
.strings("voltage_level_id", getVoltageLevelId())
.strings("bus_id", dl -> getBusId(dl.getTerminal()))
.strings("bus_breaker_bus_id", getBusBreakerViewBusId(), NetworkDataframes::setBusBreakerViewBusId, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ void danglingLines() {
assertThat(allAttributeSeries)
.extracting(Series::getName)
.containsExactly("id", "name", "r", "x", "g", "b", "p0", "q0", "p", "q", "i",
"boundary_p", "boundary_q", "boundary_v_mag", "boundary_v_angle",
"voltage_level_id", "bus_id", "bus_breaker_bus_id", "node", "connected", "pairing_key", "ucte_xnode_code", "fictitious", "tie_line_id");
}

Expand Down
4 changes: 4 additions & 0 deletions pypowsybl/network/impl/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,10 @@ def get_dangling_lines(self, all_attributes: bool = False, attributes: List[str]
- **p**: active flow on the dangling line, ``NaN`` if no loadflow has been computed (in MW)
- **q**: the reactive flow on the dangling line, ``NaN`` if no loadflow has been computed (in MVAr)
- **i**: The current on the dangling line, ``NaN`` if no loadflow has been computed (in A)
- **boundary_p** (optional): active flow on the dangling line at boundary bus side, ``NaN`` if no loadflow has been computed (in MW)
- **boundary_q** (optional): reactive flow on the dangling line at boundary bus side, ``NaN`` if no loadflow has been computed (in MW)
- **boundary_v_mag** (optional): voltage magnitude of the boundary bus, ``NaN`` if no loadflow has been computed (in kV)
- **boundary_v_angle** (optional): voltage angle of the boundary bus, ``NaN`` if no loadflow has been computed (in degree)
- **voltage_level_id**: at which substation the dangling line is connected
- **bus_id**: bus where this line is connected
- **bus_breaker_bus_id** (optional): bus of the bus-breaker view where this line is connected
Expand Down
18 changes: 18 additions & 0 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,24 @@ def test_dangling_lines():
data=[['BUS', -1]])
pd.testing.assert_frame_equal(expected, dangling_lines, check_dtype=False, atol=1e-2)

# test boundary point columns
n = pp.network.create_micro_grid_be_network()
dangling_lines = n.get_dangling_lines(attributes=['p', 'q',
'boundary_p', 'boundary_q', 'boundary_v_mag', 'boundary_v_angle'])
expected = pd.DataFrame(
index=pd.Series(name='id', data=['17086487-56ba-4979-b8de-064025a6b4da',
'78736387-5f60-4832-b3fe-d50daf81b0a6',
'b18cd1aa-7808-49b9-a7cf-605eaf07b006',
'a16b4a6c-70b1-4abf-9a9d-bd0fa47f9fe4',
'ed0c5d75-4a54-43c8-b782-b20d7431630b']),
columns=['p', 'q', 'boundary_p', 'boundary_q', 'boundary_v_mag', 'boundary_v_angle'],
data=[[-25.77, -2.82, 27.36, -0.42, 225.49, -5.58],
[-36.59, 54.18, 46.81, -79.19, 411.15, -6.58],
[-82.84, 138.45, 90.03, -148.60, 410.88, -6.57],
[-23.83, 1.27, 26.80, -1.48, 224.96, -5.63],
[-36.85, 80.68, 43.68, -84.87, 412.61, -6.74]])
pd.testing.assert_frame_equal(expected, dangling_lines, check_dtype=False, atol=1e-2)


def test_batteries():
n = util.create_battery_network()
Expand Down
Loading