Skip to content

Commit

Permalink
CGMES 3.0: cim:Jumper support (#3235)
Browse files Browse the repository at this point in the history
* Add cim:Jumper support for CGMES 3.0
* Fix duplicate in groundTest
* Add unit test

Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup authored Dec 4, 2024
1 parent d66b8cc commit f235935
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ private SwitchKind kind() {
return SwitchKind.DISCONNECTOR;
} else if (type.contains("loadbreak")) {
return SwitchKind.LOAD_BREAK_SWITCH;
} else if (type.contains("jumper")) {
return SwitchKind.DISCONNECTOR;
}
return SwitchKind.BREAKER;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* 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/.
* SPDX-License-Identifier: MPL-2.0
*/

package com.powsybl.cgmes.conversion.test;

import com.powsybl.cgmes.conversion.Conversion;
import com.powsybl.commons.test.AbstractSerDeTest;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.Switch;
import com.powsybl.iidm.network.SwitchKind;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
* @author Florian Dupuy {@literal <florian.dupuy at rte-france.com>}
*/

class SwitchConversionTest extends AbstractSerDeTest {

@Test
void jumperImportTest() {
Network network = Network.read("jumperTest.xml", getClass().getResourceAsStream("/jumperTest.xml"));

Switch aswitch = network.getSwitch("Jumper");
assertEquals(SwitchKind.DISCONNECTOR, aswitch.getKind());
assertEquals("Jumper", aswitch.getProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "switchType"));
assertEquals("opened jumper", aswitch.getNameOrId());
assertTrue(aswitch.isOpen());
assertFalse(aswitch.isRetained());
}
}
4 changes: 0 additions & 4 deletions cgmes/cgmes-conversion/src/test/resources/groundTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@
<cim:ACDCTerminal.sequenceNumber>1</cim:ACDCTerminal.sequenceNumber>
<cim:IdentifiedObject.name>RK</cim:IdentifiedObject.name>
</cim:Terminal>
<cim:ConnectivityNode rdf:ID="RJ">
<cim:ConnectivityNode.ConnectivityNodeContainer rdf:resource="#S"/>
<cim:IdentifiedObject.name>AAP</cim:IdentifiedObject.name>
</cim:ConnectivityNode>
<cim:Terminal rdf:ID="ZM">
<cim:Terminal.ConnectivityNode rdf:resource="#RJ"/>
<cim:Terminal.ConductingEquipment rdf:resource="#CO"/>
Expand Down
78 changes: 78 additions & 0 deletions cgmes/cgmes-conversion/src/test/resources/jumperTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:base="urn:uuid:" xmlns:cim="http://iec.ch/TC57/CIM100#" 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:test">
<md:Model.scenarioTime>2023-01-01T00:00:00Z</md:Model.scenarioTime>
<md:Model.created>2023-01-01T00:00:00Z</md:Model.created>
<md:Model.description>Test Jumper import</md:Model.description>
<md:Model.version>1</md:Model.version>
<md:Model.profile>http://iec.ch/TC57/ns/CIM/CoreEquipment-EU/3.0</md:Model.profile>
<md:Model.profile>http://iec.ch/TC57/ns/CIM/Operation-EU/3.0</md:Model.profile>
<md:Model.modelingAuthoritySet>http://powsybl.org</md:Model.modelingAuthoritySet>
</md:FullModel>
<cim:GeographicalRegion rdf:ID="_Region">
<cim:IdentifiedObject.name>Region</cim:IdentifiedObject.name>
</cim:GeographicalRegion>
<cim:SubGeographicalRegion rdf:ID="_SubRegion">
<cim:SubGeographicalRegion.Region rdf:resource="#_Region"/>
<cim:IdentifiedObject.name>SubRegion</cim:IdentifiedObject.name>
</cim:SubGeographicalRegion>
<cim:BaseVoltage rdf:ID="_BaseVoltage67">
<cim:BaseVoltage.nominalVoltage>67.5</cim:BaseVoltage.nominalVoltage>
<cim:IdentifiedObject.name>67.5</cim:IdentifiedObject.name>
</cim:BaseVoltage>
<cim:Substation rdf:ID="_Substation">
<cim:Substation.Region rdf:resource="#_SubRegion"/>
<cim:IdentifiedObject.name>Substation</cim:IdentifiedObject.name>
</cim:Substation>
<cim:VoltageLevel rdf:ID="_VoltageLevel">
<cim:VoltageLevel.BaseVoltage rdf:resource="#_BaseVoltage67"/>
<cim:VoltageLevel.Substation rdf:resource="#_Substation"/>
<cim:IdentifiedObject.name>VoltageLevel</cim:IdentifiedObject.name>
</cim:VoltageLevel>
<cim:BusbarSection rdf:ID="_BBS">
<cim:Equipment.EquipmentContainer rdf:resource="#_VoltageLevel"/>
<cim:IdentifiedObject.name>BBS</cim:IdentifiedObject.name>
</cim:BusbarSection>
<cim:Terminal rdf:ID="_BBS_T">
<cim:Terminal.ConnectivityNode rdf:resource="#_BBS_CN"/>
<cim:Terminal.ConductingEquipment rdf:resource="#_BBS"/>
<cim:ACDCTerminal.sequenceNumber>1</cim:ACDCTerminal.sequenceNumber>
<cim:IdentifiedObject.name>BBS Terminal</cim:IdentifiedObject.name>
</cim:Terminal>
<cim:ConnectivityNode rdf:ID="_BBS_CN">
<cim:ConnectivityNode.ConnectivityNodeContainer rdf:resource="#_VoltageLevel"/>
<cim:IdentifiedObject.name>BBS ConnectivityNode</cim:IdentifiedObject.name>
</cim:ConnectivityNode>
<cim:EnergyConsumer rdf:ID="_Load">
<cim:IdentifiedObject.name>Load</cim:IdentifiedObject.name>
<cim:Equipment.EquipmentContainer rdf:resource="#_VoltageLevel"/>
</cim:EnergyConsumer>
<cim:Terminal rdf:ID="_Load_T">
<cim:Terminal.ConnectivityNode rdf:resource="#_Load_CN"/>
<cim:Terminal.ConductingEquipment rdf:resource="#_Load"/>
<cim:ACDCTerminal.sequenceNumber>1</cim:ACDCTerminal.sequenceNumber>
<cim:IdentifiedObject.name>Load Terminal</cim:IdentifiedObject.name>
</cim:Terminal>
<cim:ConnectivityNode rdf:ID="_Load_CN">
<cim:ConnectivityNode.ConnectivityNodeContainer rdf:resource="#_VoltageLevel"/>
<cim:IdentifiedObject.name>Load ConnectivityNode</cim:IdentifiedObject.name>
</cim:ConnectivityNode>
<cim:Jumper rdf:ID="_Jumper">
<cim:Switch.normalOpen>true</cim:Switch.normalOpen>
<cim:Switch.retained>false</cim:Switch.retained>
<cim:Equipment.EquipmentContainer rdf:resource="#_VoltageLevel"/>
<cim:IdentifiedObject.name>opened jumper</cim:IdentifiedObject.name>
</cim:Jumper>
<cim:Terminal rdf:ID="_Jumper_T1">
<cim:Terminal.ConnectivityNode rdf:resource="#_BBS_CN"/>
<cim:Terminal.ConductingEquipment rdf:resource="#_Jumper"/>
<cim:ACDCTerminal.sequenceNumber>1</cim:ACDCTerminal.sequenceNumber>
<cim:IdentifiedObject.name>Jumper Terminal1</cim:IdentifiedObject.name>
</cim:Terminal>
<cim:Terminal rdf:ID="_Jumper_T2">
<cim:Terminal.ConnectivityNode rdf:resource="#_Load_CN"/>
<cim:Terminal.ConductingEquipment rdf:resource="#_Jumper"/>
<cim:ACDCTerminal.sequenceNumber>2</cim:ACDCTerminal.sequenceNumber>
<cim:IdentifiedObject.name>Jumper Terminal2</cim:IdentifiedObject.name>
</cim:Terminal>
</rdf:RDF>
34 changes: 34 additions & 0 deletions cgmes/cgmes-model/src/main/resources/CIM100.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,37 @@ WHERE {
OPTIONAL {?OperationalLimit cim:VoltageLimit.value ?value }
}}
}

# query: switches
SELECT *
WHERE {
{ GRAPH ?graph {
?Switch
a ?type ;
cim:Equipment.EquipmentContainer ?EquipmentContainer .
VALUES ?type { cim:Switch cim:Breaker cim:Disconnector cim:LoadBreakSwitch cim:ProtectedSwitch cim:GroundDisconnector cim:Jumper } .
OPTIONAL {
?Switch cim:IdentifiedObject.name ?name ;
}
OPTIONAL {
?Switch cim:Switch.retained ?retained
}
OPTIONAL {
?Switch cim:Switch.normalOpen ?normalOpen
}
?Terminal1
a cim:Terminal ;
cim:Terminal.ConductingEquipment ?Switch .
OPTIONAL { ?Terminal1 cim:ACDCTerminal.sequenceNumber ?seq1 }
?Terminal2
a cim:Terminal ;
cim:Terminal.ConductingEquipment ?Switch .
OPTIONAL { ?Terminal2 cim:ACDCTerminal.sequenceNumber ?seq2 }
FILTER ( bound(?seq1) && ?seq1 = "1" && bound(?seq2) && ?seq2 = "2"
|| !bound(?seq1) && !bound(?seq2) && str(?Terminal1) < str(?Terminal2) )
}}
OPTIONAL { GRAPH ?graphSSH {
?Switch cim:Switch.open ?open
}}
}

0 comments on commit f235935

Please sign in to comment.