Skip to content

Commit

Permalink
Rework missing voltage level test and use a simple network instead of…
Browse files Browse the repository at this point in the history
… a modified conformity one (#3180)

Signed-off-by: Romain Courtier <[email protected]>
  • Loading branch information
rcourtier authored Nov 4, 2024
1 parent fa2b143 commit 081e93c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4,499 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import com.powsybl.cgmes.conformity.CgmesConformity1ModifiedCatalog;
import com.powsybl.cgmes.conversion.CgmesImport;
import com.powsybl.cgmes.conversion.CgmesModelExtension;
import com.powsybl.cgmes.model.CgmesModel;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import com.powsybl.commons.datasource.ReadOnlyDataSource;
import com.powsybl.commons.datasource.ResourceDataSource;
import com.powsybl.commons.datasource.ResourceSet;
import com.powsybl.computation.ComputationManager;
import com.powsybl.computation.local.LocalComputationManager;
import com.powsybl.iidm.network.Importers;
Expand Down Expand Up @@ -52,7 +53,8 @@ void tearDown() throws Exception {

@Test
void miniGridNodeBreakerMissingVoltageLevel() throws IOException {
ReadOnlyDataSource dataSource = CgmesConformity1ModifiedCatalog.miniGridNodeBreakerMissingVoltageLevel().dataSource();
ReadOnlyDataSource dataSource = new ResourceDataSource("CGMES file",
new ResourceSet("/", "missing_voltagelevel.xml"));
Properties importParams = new Properties();
importParams.put(CgmesImport.PRE_PROCESSORS, "createMissingContainers");

Expand All @@ -74,7 +76,7 @@ void miniGridNodeBreakerMissingVoltageLevel() throws IOException {

// Check that a specific terminal has a voltage level, navigating the CGMES model
CgmesModel cgmes = network.getExtension(CgmesModelExtension.class).getCgmesModel();
String terminalId = "4915762d-133e-4209-8545-2822d095d7cd";
String terminalId = "T_BBS";
String voltageLevelId = cgmes.voltageLevel(cgmes.terminal(terminalId), cgmes.isNodeBreaker());
if (voltageLevelId == null || voltageLevelId.isEmpty()) {
fail("Missing voltage level for terminal " + terminalId);
Expand Down
40 changes: 40 additions & 0 deletions cgmes/cgmes-completion/src/test/resources/missing_voltagelevel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<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>Nodes containers 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">
<cim:IdentifiedObject.name>Substation</cim:IdentifiedObject.name>
<cim:Substation.Region rdf:resource="#_SGR"/>
</cim:Substation>
<cim:ConnectivityNode rdf:ID="_CN">
<cim:IdentifiedObject.name>Node</cim:IdentifiedObject.name>
<cim:ConnectivityNode.ConnectivityNodeContainer rdf:resource="#_VL"/>
</cim:ConnectivityNode>
<cim:BusbarSection rdf:ID="_BBS">
<cim:IdentifiedObject.name>Busbar section</cim:IdentifiedObject.name>
<cim:Equipment.EquipmentContainer rdf:resource="#VL" />
<cim:ConductingEquipment.BaseVoltage rdf:resource="#_BV" />
</cim:BusbarSection>
<cim:Terminal rdf:ID="_T_BBS">
<cim:IdentifiedObject.name>Terminal BBS</cim:IdentifiedObject.name>
<cim:Terminal.ConductingEquipment rdf:resource="#_BBS"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN"/>
</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>
Original file line number Diff line number Diff line change
Expand Up @@ -1529,22 +1529,6 @@ public static GridModelReferenceResources smallGridBusBranchWithBusbarSectionsAn
SMALL_GRID_BD_TP));
}

public static GridModelReference miniGridNodeBreakerMissingVoltageLevel() {
String base = ENTSOE_CONFORMITY_1_MODIFIED
+ "/MiniGrid/NodeBreaker/BaseCase_Complete_v3_missing_voltage_level/";
return new GridModelReferenceResources(
"MiniGrid-NodeBreaker-BaseCase-Complete-v3-missing-voltage-levels",
null,
new ResourceSet(base,
MINI_GRID_EQ),
new ResourceSet(MINI_GRID_NODE_BREAKER_BASE,
MINI_GRID_SSH,
MINI_GRID_SV,
MINI_GRID_TP),
new ResourceSet(MINI_GRID_NODE_BREAKER_BD_BASE, MINI_GRID_BD_EQ,
MINI_GRID_BD_TP));
}

public static GridModelReferenceResources miniGridNodeBreakerSwitchTypePreserved() {
String base = ENTSOE_CONFORMITY_1_MODIFIED
+ "/MiniGrid/NodeBreaker/BaseCase_Complete_v3_switch_type_preserved/";
Expand Down
Loading

0 comments on commit 081e93c

Please sign in to comment.