Skip to content

Commit

Permalink
add attribute paired for dangling lines
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne LESOT <[email protected]>
  • Loading branch information
EtienneLt committed Aug 5, 2024
1 parent 69b2ad6 commit 4eb9f67
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ static NetworkDataframeMapper danglingLines() {
.booleans("connected", dl -> dl.getTerminal().isConnected(), connectInjection())
.strings("pairing_key", dl -> Objects.toString(dl.getPairingKey(), ""), DanglingLine::setPairingKey)
.strings("ucte_xnode_code", dl -> Objects.toString(dl.getPairingKey(), ""))
.booleans("paired", DanglingLine::isPaired)
.booleans("fictitious", Identifiable::isFictitious, Identifiable::setFictitious, false)
.strings("tie_line_id", dl -> dl.getTieLine().map(Identifiable::getId).orElse(""))
.addProperties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ void danglingLines() {
assertThat(series)
.extracting(Series::getName)
.containsExactly("id", "name", "r", "x", "g", "b", "p0", "q0", "p", "q", "i", "voltage_level_id", "bus_id",
"connected", "pairing_key", "ucte_xnode_code", "tie_line_id");
"connected", "pairing_key", "ucte_xnode_code", "paired", "tie_line_id");
List<Series> allAttributeSeries = createDataFrame(DANGLING_LINE, network, new DataframeFilter(ALL_ATTRIBUTES, Collections.emptyList()));
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");
"voltage_level_id", "bus_id", "bus_breaker_bus_id", "node", "connected", "pairing_key", "ucte_xnode_code", "paired", "fictitious", "tie_line_id");
}

@Test
Expand Down
1 change: 1 addition & 0 deletions pypowsybl/network/impl/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,7 @@ def get_dangling_lines(self, all_attributes: bool = False, attributes: List[str]
- **fictitious** (optional): ``True`` if the dangling line is part of the model and not of the actual network
- **pairing_key**: the pairing key associated to the dangling line, to be used for creating tie lines.
- **ucte-xnode-code**: deprecated for pairing key.
- **paired**: if the dangling line is paired with a tie line
- **tie_line_id**: the ID of the tie line if the dangling line is paired
This dataframe is indexed by the id of the dangling lines
Expand Down
8 changes: 4 additions & 4 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,18 +1003,18 @@ def test_dangling_lines():
expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']),
columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id',
'bus_id',
'connected', 'pairing_key', 'ucte_xnode_code', 'tie_line_id'],
'connected', 'pairing_key', 'ucte_xnode_code', 'paired', 'tie_line_id'],
data=[['', 10.0, 1.0, 0.0001, 0.00001, 50.0, 30.0, nan, nan, nan, 'VL', 'VL_0', True,
'', '', '']])
'', '', False, '']])
pd.testing.assert_frame_equal(expected, n.get_dangling_lines(), check_dtype=False)
n.update_dangling_lines(
pd.DataFrame(index=['DL'], columns=['r', 'x', 'g', 'b', 'p0', 'q0', 'connected'],
data=[[11.0, 1.1, 0.0002, 0.00002, 40.0, 40.0, False]]))
updated = pd.DataFrame(index=pd.Series(name='id', data=['DL']),
columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id',
'bus_id', 'connected', 'pairing_key', 'ucte_xnode_code', 'tie_line_id'],
'bus_id', 'connected', 'pairing_key', 'ucte_xnode_code', 'paired', 'tie_line_id'],
data=[['', 11.0, 1.1, 0.0002, 0.00002, 40.0, 40.0, nan, nan, nan, 'VL', '', False,
'', '', '']])
'', '', False, '']])
pd.testing.assert_frame_equal(updated, n.get_dangling_lines(), check_dtype=False)
n = util.create_dangling_lines_network()
dangling_lines = n.get_dangling_lines(attributes=['bus_breaker_bus_id', 'node'])
Expand Down

0 comments on commit 4eb9f67

Please sign in to comment.