Skip to content

Commit

Permalink
Add a test with an ACLineSegment having both its nodes in the Line co…
Browse files Browse the repository at this point in the history
…ntainer, and check import with two alternatives for fictitious VoltageLevel creation

Signed-off-by: Romain Courtier <[email protected]>
  • Loading branch information
rcourtier committed Oct 18, 2024
1 parent c067041 commit 09dc49b
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 58 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@

package com.powsybl.cgmes.conversion.test;

import com.powsybl.cgmes.conversion.CgmesImport;
import com.powsybl.commons.test.AbstractSerDeTest;
import com.powsybl.iidm.network.*;
import org.junit.jupiter.api.Test;

import java.util.Properties;
import java.util.Set;
import java.util.stream.Collectors;

import static com.powsybl.cgmes.conversion.test.ConversionUtil.readCgmesResources;
import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -79,6 +82,29 @@ void nodeOfTJunctionInLineContainerTest() {
assertEquals(3, innerVL.getBusBreakerView().getBuses().iterator().next().getConnectedTerminalCount());
}

@Test
void chainedLineSegmentsTest() {
// CGMES network:
// 2 Substations ST_1, ST_2 connected by 3 ACLineSegments in a row: ACL_1A, ACL_AB, ACL_B2.
// The 3 ACLineSegments are in the Line container LN_12.
// Extremity nodes CN_A and CN_B of ACL_AB are in LN_12, nodes CN_1, CN_2 are in VL_1, VL_2 of ST_1, ST_2.
// IIDM network:
// Nodes must be within a VoltageLevel. In case of multiple nodes in the same non-VoltageLevel container,
// a parameter allows to create a fictitious VoltageLevel for every node or for that container
Properties importParams = new Properties();
importParams.put(CgmesImport.CREATE_FICTITIOUS_VOLTAGE_LEVEL_FOR_EVERY_NODE, "false");
Network network = readCgmesResources(importParams, DIR, "chained_line_segments.xml");
assertNotNull(network);
assertEquals(Set.of("VL_1", "VL_2", "LN_12_VL"),
network.getVoltageLevelStream().map(Identifiable::getId).collect(Collectors.toSet()));

importParams.put(CgmesImport.CREATE_FICTITIOUS_VOLTAGE_LEVEL_FOR_EVERY_NODE, "true");
network = readCgmesResources(importParams, DIR, "chained_line_segments.xml");
assertNotNull(network);
assertEquals(Set.of("VL_1", "VL_2", "CN_A_VL", "CN_B_VL"),
network.getVoltageLevelStream().map(Identifiable::getId).collect(Collectors.toSet()));
}

@Test
void substationsConnectedByTransformerTest() {
// CGMES network:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<rdf:RDF xmlns:cim="http://iec.ch/TC57/2013/CIM-schema-cim16#" xmlns:md="http://iec.ch/TC57/61970-552/ModelDescription/1#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<md:FullModel rdf:about="urn:uuid:ModelID">
<md:Model.scenarioTime>2021-03-01T23:00:00Z</md:Model.scenarioTime>
<md:Model.created>2021-03-02T10:22:58Z</md:Model.created>
<md:Model.description>Container mapping</md:Model.description>
<md:Model.version>001</md:Model.version>
<md:Model.profile>http://entsoe.eu/CIM/EquipmentCore/3/1</md:Model.profile>
<md:Model.profile>http://entsoe.eu/CIM/EquipmentOperation/3/1</md:Model.profile>
<md:Model.modelingAuthoritySet>powsybl.org</md:Model.modelingAuthoritySet>
</md:FullModel>
<cim:GeographicalRegion rdf:ID="_GR">
<cim:IdentifiedObject.name>Geographical region</cim:IdentifiedObject.name>
</cim:GeographicalRegion>
<cim:SubGeographicalRegion rdf:ID="_SGR">
<cim:IdentifiedObject.name>Subgeographical region</cim:IdentifiedObject.name>
<cim:SubGeographicalRegion.Region rdf:resource="#_GR"/>
</cim:SubGeographicalRegion>
<cim:Substation rdf:ID="_ST_1">
<cim:IdentifiedObject.name>Substation 1</cim:IdentifiedObject.name>
<cim:Substation.Region rdf:resource="#_SGR"/>
</cim:Substation>
<cim:VoltageLevel rdf:ID="_VL_1">
<cim:IdentifiedObject.name>Voltage level 1</cim:IdentifiedObject.name>
<cim:VoltageLevel.BaseVoltage rdf:resource="#_BV"/>
<cim:VoltageLevel.Substation rdf:resource="#_ST_1"/>
</cim:VoltageLevel>
<cim:ConnectivityNode rdf:ID="_CN_1">
<cim:IdentifiedObject.name>Node 1</cim:IdentifiedObject.name>
<cim:ConnectivityNode.ConnectivityNodeContainer rdf:resource="#_VL_1"/>
</cim:ConnectivityNode>
<cim:Substation rdf:ID="_ST_2">
<cim:IdentifiedObject.name>Substation 2</cim:IdentifiedObject.name>
<cim:Substation.Region rdf:resource="#_SGR"/>
</cim:Substation>
<cim:VoltageLevel rdf:ID="_VL_2">
<cim:IdentifiedObject.name>Voltage level 2</cim:IdentifiedObject.name>
<cim:VoltageLevel.BaseVoltage rdf:resource="#_BV"/>
<cim:VoltageLevel.Substation rdf:resource="#_ST_2"/>
</cim:VoltageLevel>
<cim:ConnectivityNode rdf:ID="_CN_2">
<cim:IdentifiedObject.name>Node 2</cim:IdentifiedObject.name>
<cim:ConnectivityNode.ConnectivityNodeContainer rdf:resource="#_VL_2"/>
</cim:ConnectivityNode>
<cim:Line rdf:ID="_LN_12">
<cim:IdentifiedObject.name>Line 12</cim:IdentifiedObject.name>
<cim:Line.Region rdf:resource="#_SGR"/>
</cim:Line>
<cim:ConnectivityNode rdf:ID="_CN_A">
<cim:IdentifiedObject.name>Node A</cim:IdentifiedObject.name>
<cim:ConnectivityNode.ConnectivityNodeContainer rdf:resource="#_LN_12"/>
</cim:ConnectivityNode>
<cim:ConnectivityNode rdf:ID="_CN_B">
<cim:IdentifiedObject.name>Node B</cim:IdentifiedObject.name>
<cim:ConnectivityNode.ConnectivityNodeContainer rdf:resource="#_LN_12"/>
</cim:ConnectivityNode>
<cim:ACLineSegment rdf:ID="_ACL_1A">
<cim:ACLineSegment.b0ch>0</cim:ACLineSegment.b0ch>
<cim:ACLineSegment.bch>0</cim:ACLineSegment.bch>
<cim:ACLineSegment.g0ch>0</cim:ACLineSegment.g0ch>
<cim:ACLineSegment.gch>0</cim:ACLineSegment.gch>
<cim:IdentifiedObject.name>Line 1A</cim:IdentifiedObject.name>
<cim:ACLineSegment.r>0.1</cim:ACLineSegment.r>
<cim:ACLineSegment.r0>0.1</cim:ACLineSegment.r0>
<cim:ACLineSegment.shortCircuitEndTemperature>75</cim:ACLineSegment.shortCircuitEndTemperature>
<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_12"/>
</cim:ACLineSegment>
<cim:Terminal rdf:ID="_T_1A_1">
<cim:IdentifiedObject.name>Terminal 1A 1</cim:IdentifiedObject.name>
<cim:ACDCTerminal.sequenceNumber>1</cim:ACDCTerminal.sequenceNumber>
<cim:Terminal.ConductingEquipment rdf:resource="#_ACL_1A"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN_1"/>
</cim:Terminal>
<cim:Terminal rdf:ID="_T_1A_2">
<cim:IdentifiedObject.name>Terminal 1A 2</cim:IdentifiedObject.name>
<cim:ACDCTerminal.sequenceNumber>2</cim:ACDCTerminal.sequenceNumber>
<cim:Terminal.ConductingEquipment rdf:resource="#_ACL_1A"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN_A"/>
</cim:Terminal>
<cim:ACLineSegment rdf:ID="_ACL_AB">
<cim:ACLineSegment.b0ch>0</cim:ACLineSegment.b0ch>
<cim:ACLineSegment.bch>0</cim:ACLineSegment.bch>
<cim:ACLineSegment.g0ch>0</cim:ACLineSegment.g0ch>
<cim:ACLineSegment.gch>0</cim:ACLineSegment.gch>
<cim:IdentifiedObject.name>Line AB</cim:IdentifiedObject.name>
<cim:ACLineSegment.r>0.1</cim:ACLineSegment.r>
<cim:ACLineSegment.r0>0.1</cim:ACLineSegment.r0>
<cim:ACLineSegment.shortCircuitEndTemperature>75</cim:ACLineSegment.shortCircuitEndTemperature>
<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_12"/>
</cim:ACLineSegment>
<cim:Terminal rdf:ID="_T_AB_1">
<cim:IdentifiedObject.name>Terminal AB 1</cim:IdentifiedObject.name>
<cim:ACDCTerminal.sequenceNumber>1</cim:ACDCTerminal.sequenceNumber>
<cim:Terminal.ConductingEquipment rdf:resource="#_ACL_AB"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN_A"/>
</cim:Terminal>
<cim:Terminal rdf:ID="_T_AB_2">
<cim:IdentifiedObject.name>Terminal AB 2</cim:IdentifiedObject.name>
<cim:ACDCTerminal.sequenceNumber>2</cim:ACDCTerminal.sequenceNumber>
<cim:Terminal.ConductingEquipment rdf:resource="#_ACL_AB"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN_B"/>
</cim:Terminal>
<cim:ACLineSegment rdf:ID="_ACL_B2">
<cim:ACLineSegment.b0ch>0</cim:ACLineSegment.b0ch>
<cim:ACLineSegment.bch>0</cim:ACLineSegment.bch>
<cim:ACLineSegment.g0ch>0</cim:ACLineSegment.g0ch>
<cim:ACLineSegment.gch>0</cim:ACLineSegment.gch>
<cim:IdentifiedObject.name>Line B2</cim:IdentifiedObject.name>
<cim:ACLineSegment.r>0.1</cim:ACLineSegment.r>
<cim:ACLineSegment.r0>0.1</cim:ACLineSegment.r0>
<cim:ACLineSegment.shortCircuitEndTemperature>75</cim:ACLineSegment.shortCircuitEndTemperature>
<cim:ACLineSegment.x>1</cim:ACLineSegment.x>
<cim:ACLineSegment.x0>1</cim:ACLineSegment.x0>
<cim:ConductingEquipment.BaseVoltage rdf:resource="#_BV"/>
</cim:ACLineSegment>
<cim:Terminal rdf:ID="_T_B2_1">
<cim:IdentifiedObject.name>Terminal B2 1</cim:IdentifiedObject.name>
<cim:ACDCTerminal.sequenceNumber>1</cim:ACDCTerminal.sequenceNumber>
<cim:Terminal.ConductingEquipment rdf:resource="#_ACL_B2"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN_B"/>
</cim:Terminal>
<cim:Terminal rdf:ID="_T_B2_2">
<cim:IdentifiedObject.name>Terminal B2 2</cim:IdentifiedObject.name>
<cim:ACDCTerminal.sequenceNumber>2</cim:ACDCTerminal.sequenceNumber>
<cim:Terminal.ConductingEquipment rdf:resource="#_ACL_B2"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN_2"/>
</cim:Terminal>
<cim:BaseVoltage rdf:ID="_BV">
<cim:IdentifiedObject.name>110 kV</cim:IdentifiedObject.name>
<cim:BaseVoltage.nominalVoltage>110</cim:BaseVoltage.nominalVoltage>
</cim:BaseVoltage>
</rdf:RDF>

0 comments on commit 09dc49b

Please sign in to comment.