Skip to content

Commit

Permalink
Merge two similar tests (Line with T-junction and only 2 out of 3 seg…
Browse files Browse the repository at this point in the history
…ments in the line)

Signed-off-by: Romain Courtier <[email protected]>
  • Loading branch information
rcourtier committed Oct 18, 2024
1 parent 0e23705 commit 8d9f05f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.powsybl.iidm.network.*;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Properties;

import static org.junit.jupiter.api.Assertions.*;
Expand All @@ -25,40 +24,6 @@

class LineContainersTest {

@Test
void testLineContainerWithOneACLSnotAssociated() {
// This unit test reproduces a configuration observed in public data from a European TSO (NG)
// where three ACLSs lie on a common connectivity node inside a cim:Line container
// Two of the ACLSs have an association with the cim:Line container
// The other does not have any equipment container

// A fictitious voltage level is created to hold the connectivity node inside the cim:Line container,
// All three ACLSs must be imported
// And they have to share a bus

Network network = Network.read("line_container_3acls_EQ.xml", getClass().getResourceAsStream("/issues/line_container_3acls_EQ.xml"));
assertNotNull(network);

// Check all three ACLSs have been imported
Line l1 = network.getLine("ACLS1-without-Line-Container");
Line l2 = network.getLine("ACLS2");
Line l3 = network.getLine("ACLS3");
assertNotNull(l1);
assertNotNull(l2);
assertNotNull(l3);

VoltageLevel vlNodeInsideLineContainer = l1.getTerminal2().getVoltageLevel();
// Check that the fictitious voltage level created has a reference to the original Line container
assertEquals("LineContainer", vlNodeInsideLineContainer.getProperty("CGMES.LineContainerId"));
assertEquals("Line Container", vlNodeInsideLineContainer.getNameOrId());
// Check that the only bus in the fictitious voltage level has a terminal for each line
assertEquals(1, vlNodeInsideLineContainer.getBusBreakerView().getBusCount());
Bus tbus = vlNodeInsideLineContainer.getBusBreakerView().getBuses().iterator().next();
assertEquals(3, tbus.getConnectedTerminalCount());
assertEquals(List.of("ACLS1-without-Line-Container", "ACLS2", "ACLS3"),
tbus.getConnectedTerminalStream().map(Terminal::getConnectable).map(Connectable::getId).sorted().toList());
}

@Test
void testLineContainerWithSwitchConnectedToVoltageLevel() {
// This unit test reproduces a configuration observed in public data from a European TSO (NG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
package com.powsybl.cgmes.conversion.test;

import com.powsybl.commons.test.AbstractSerDeTest;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.VoltageLevel;
import com.powsybl.iidm.network.*;
import org.junit.jupiter.api.Test;

import java.util.Set;
Expand Down Expand Up @@ -61,6 +60,7 @@ void nodeContainersConnectedBySwitchesTest() {
void nodeOfTJunctionInLineContainerTest() {
// CGMES network:
// 3 VoltageLevels VL_1, VL_2, VL_3 are connected together through line segments in a T-junction.
// ACLineSegments ACL_1A, ACL_2A are in Line LN_A, but ACL_3A has no EquipmentContainer.
// Node CN_A of T-junction is directly in Line Container LN_A.
// IIDM network:
// Nodes must be within a VoltageLevel.
Expand All @@ -69,10 +69,14 @@ void nodeOfTJunctionInLineContainerTest() {
assertNotNull(network);

// There is no real representative VoltageLevel for node CN_A, so a fictitious one has been created.
VoltageLevel fictitiousVL = network.getVoltageLevel("CN_A_VL");
assertNotNull(fictitiousVL);
assertNull(fictitiousVL.getNullableSubstation());
assertEquals("LN_A", fictitiousVL.getProperty("CGMES.LineContainerId"));
VoltageLevel innerVL = network.getVoltageLevel("CN_A_VL");
assertNotNull(innerVL);
assertNull(innerVL.getNullableSubstation());
assertEquals("LN_A", innerVL.getProperty("CGMES.LineContainerId"));

// All line segments have been imported (even if not associated to an EquipmentContainer) and connected together
assertEquals(3, network.getLineCount());
assertEquals(3, innerVL.getBusBreakerView().getBuses().iterator().next().getConnectedTerminalCount());
}

@Test
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
<cim:ACLineSegment.x>1</cim:ACLineSegment.x>
<cim:ACLineSegment.x0>1</cim:ACLineSegment.x0>
<cim:ConductingEquipment.BaseVoltage rdf:resource="#_BV"/>
<cim:Equipment.EquipmentContainer rdf:resource="#_LN_A"/>
</cim:ACLineSegment>
<cim:Terminal rdf:ID="_T_3A_1">
<cim:IdentifiedObject.name>Terminal 3A 1</cim:IdentifiedObject.name>
Expand Down

0 comments on commit 8d9f05f

Please sign in to comment.