-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Peter Mitri <peter.mitri@rte-france.com>
- Loading branch information
Showing
4 changed files
with
173 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...r/swe-cne-exporter/src/test/java/com/powsybl/openrao/data/swecneexporter/TieLineTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package com.powsybl.openrao.data.swecneexporter; | ||
|
||
import com.powsybl.iidm.network.Network; | ||
import com.powsybl.openrao.data.craccreation.creator.cim.craccreator.CimCracCreationContext; | ||
import com.powsybl.openrao.data.swecneexporter.xsd.MonitoredRegisteredResource; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mockito; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
/** | ||
* Tests for tie-line CNECs results handling | ||
* @author Peter Mitri {@literal <peter.mitri at rte-france.com>} | ||
*/ | ||
public class TieLineTest { | ||
private Network network; | ||
private SweMonitoredSeriesCreator monitoredSeriesCreator; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
network = Network.read("SweTestCaseWith12NodesAndXnodes.uct", getClass().getResourceAsStream("/SweTestCaseWith12NodesAndXnodes.uct")); | ||
network.getDanglingLine("FFR2AA1 XES_FR11 1").setProperty("CGMES.TopologicalNode_Boundary", "XES_FR11_mRID"); | ||
network.getDanglingLine("XES_FR11 EES3AA1 1").setProperty("CGMES.TopologicalNode_Boundary", "XES_FR11_mRID"); | ||
network.getDanglingLine("EES2AA1 XES_PT11 1").setProperty("CGMES.TopologicalNode_Boundary", "XES_PT11_mRID"); | ||
network.getDanglingLine("XES_PT11 PPT3AA1 1").setProperty("CGMES.TopologicalNode_Boundary", "XES_PT11_mRID"); | ||
|
||
SweCneHelper helper = Mockito.mock(SweCneHelper.class); | ||
Mockito.when(helper.getNetwork()).thenReturn(network); | ||
|
||
monitoredSeriesCreator = new SweMonitoredSeriesCreator(helper, Mockito.mock(CimCracCreationContext.class)); | ||
} | ||
|
||
@Test | ||
void testSetInOutAggregateNodesFrEs() { | ||
MonitoredRegisteredResource rr = new MonitoredRegisteredResource(); | ||
|
||
monitoredSeriesCreator.setInOutAggregateNodes("FFR2AA1 XES_FR11 1 + XES_FR11 EES3AA1 1", "RTE_blabla", rr); | ||
assertEquals("FFR2AA1", rr.getInAggregateNodeMRID().getValue()); | ||
assertEquals("XES_FR11_mRID", rr.getOutAggregateNodeMRID().getValue()); | ||
|
||
monitoredSeriesCreator.setInOutAggregateNodes("FFR2AA1 XES_FR11 1 + XES_FR11 EES3AA1 1", "REEejcnc", rr); | ||
assertEquals("XES_FR11_mRID", rr.getInAggregateNodeMRID().getValue()); | ||
assertEquals("EES3AA1", rr.getOutAggregateNodeMRID().getValue()); | ||
} | ||
|
||
@Test | ||
void testSetInOutAggregateNodesPtEs() { | ||
MonitoredRegisteredResource rr = new MonitoredRegisteredResource(); | ||
|
||
monitoredSeriesCreator.setInOutAggregateNodes("EES2AA1 XES_PT11 1 + XES_PT11 PPT3AA1 1", "REN_blabla", rr); | ||
assertEquals("XES_PT11_mRID", rr.getInAggregateNodeMRID().getValue()); | ||
assertEquals("PPT3AA1", rr.getOutAggregateNodeMRID().getValue()); | ||
|
||
monitoredSeriesCreator.setInOutAggregateNodes("EES2AA1 XES_PT11 1 + XES_PT11 PPT3AA1 1", "REE", rr); | ||
assertEquals("EES2AA1", rr.getInAggregateNodeMRID().getValue()); | ||
assertEquals("XES_PT11_mRID", rr.getOutAggregateNodeMRID().getValue()); | ||
} | ||
|
||
@Test | ||
void testSetInOutAggregateNodesNoProperty() { | ||
MonitoredRegisteredResource rr = new MonitoredRegisteredResource(); | ||
network.getDanglingLine("EES2AA1 XES_PT11 1").removeProperty("CGMES.TopologicalNode_Boundary"); | ||
|
||
monitoredSeriesCreator.setInOutAggregateNodes("EES2AA1 XES_PT11 1 + XES_PT11 PPT3AA1 1", "REN_blabla", rr); | ||
assertEquals("EES2AA1", rr.getInAggregateNodeMRID().getValue()); | ||
assertEquals("PPT3AA1", rr.getOutAggregateNodeMRID().getValue()); | ||
|
||
monitoredSeriesCreator.setInOutAggregateNodes("EES2AA1 XES_PT11 1 + XES_PT11 PPT3AA1 1", "REE", rr); | ||
assertEquals("EES2AA1", rr.getInAggregateNodeMRID().getValue()); | ||
assertEquals("PPT3AA1", rr.getOutAggregateNodeMRID().getValue()); | ||
} | ||
|
||
@Test | ||
void testSetInOutAggregateNodesInternalLine() { | ||
MonitoredRegisteredResource rr = new MonitoredRegisteredResource(); | ||
monitoredSeriesCreator.setInOutAggregateNodes("EES1AA1 EES3AA1 1", "REN_blabla", rr); | ||
assertEquals("EES1AA1", rr.getInAggregateNodeMRID().getValue()); | ||
assertEquals("EES3AA1", rr.getOutAggregateNodeMRID().getValue()); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
data/result-exporter/swe-cne-exporter/src/test/resources/SweTestCaseWith12NodesAndXnodes.uct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
##C 2007.05.01 | ||
##N | ||
##ZBE | ||
BBE1AA1 BE1 0 2 400.00 2500.00 0.00000 -1500.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
BBE2AA1 BE2 0 2 400.00 1000.00 0.00000 -3000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
BBE3AA1 BE3 0 2 400.00 1500.00 0.00000 -2500.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
##ZES | ||
EES1AA1 ES1 0 2 400.00 3500.00 0.00000 -2500.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
EES2AA1 ES2 0 2 400.00 3000.00 0.00000 -2000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
EES3AA1 ES3 0 2 400.00 2000.00 0.00000 -1500.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
##ZFR | ||
FFR1AA1 FR1 0 2 400.00 1000.00 0.00000 -2000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
FFR2AA1 FR2 0 2 400.00 3500.00 0.00000 -2000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
FFR3AA1 FR3 0 2 400.00 1500.00 0.00000 -3000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
##ZPT | ||
PPT1AA1 PT1 0 2 400.00 1000.00 0.00000 -1500.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
PPT2AA1 PT2 0 2 400.00 1000.00 0.00000 -500.00 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
PPT3AA1 PT3 0 2 400.00 2500.00 0.00000 -2000.0 0.00000 9000.00 -9000.0 9000.00 -9000.0 | ||
##ZXX | ||
XES_PT11 0 0 0.00000 0.00000 0.00000 0.00000 | ||
XES_FR11 0 0 0.00000 0.00000 0.00000 0.00000 | ||
##L | ||
BBE1AA1 BBE2AA1 1 0 0.0000 10.000 0.000000 5000 | ||
BBE1AA1 BBE3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
FFR1AA1 FFR2AA1 1 0 0.0000 10.000 0.000000 5000 | ||
FFR1AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
FFR2AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
EES1AA1 EES2AA1 1 0 0.0000 10.000 0.000000 5000 | ||
EES1AA1 EES3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
EES2AA1 EES3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
PPT1AA1 PPT2AA1 1 0 0.0000 10.000 0.000000 5000 | ||
PPT1AA1 PPT3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
PPT2AA1 PPT3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
FFR2AA1 XES_FR11 1 0 0.0000 10.000 0.000000 5000 | ||
XES_FR11 EES3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
EES2AA1 XES_PT11 1 0 0.0000 10.000 0.000000 5000 | ||
XES_PT11 PPT3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
BBE2AA1 FFR3AA1 1 0 0.0000 10.000 0.000000 5000 | ||
##T | ||
BBE2AA1 BBE3AA1 1 0 400.0 400.0 1000. 0.0000 10.000 0.000000 0.0 5000 PST | ||
##R | ||
BBE2AA1 BBE3AA1 1 -0.68 90.00 16 0 SYMM |