Skip to content

Commit

Permalink
Rework existing tests of missing patl and tatl limits: use now a smal…
Browse files Browse the repository at this point in the history
…l network instead of an entsoe conformity modified one.

Signed-off-by: Romain Courtier <[email protected]>
  • Loading branch information
rcourtier committed Oct 31, 2024
1 parent f8797ef commit ebe5ab4
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 4,461 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,20 +329,6 @@ public static GridModelReferenceResources microGridBaseCaseBEMissingShuntRegulat
microGridBaseCaseBoundaries());
}

public static GridModelReferenceResources microGridBaseCaseBEUndefinedPatl() {
String baseModified = ENTSOE_CONFORMITY_1_MODIFIED
+ "/MicroGrid/BaseCase/BC_BE_v2_undefined_PATL/";
return new GridModelReferenceResources("MicroGrid-BaseCase-BE-UndefinedPATL",
null,
new ResourceSet(baseModified,
MICRO_GRID_BE_EQ),
new ResourceSet(MICRO_GRID_BE_BASE,
MICRO_GRID_BE_TP,
MICRO_GRID_BE_SV,
MICRO_GRID_BE_SSH),
microGridBaseCaseBoundaries());
}

public static GridModelReference microGridBaseCaseBEEquivalentInjectionRegulatingVoltage() {
String baseModified = ENTSOE_CONFORMITY_1_MODIFIED
+ "/MicroGrid/BaseCase/BC_BE_v2_equivalent_injection_regulating_voltage/";
Expand Down Expand Up @@ -511,20 +497,6 @@ public static GridModelReferenceResources microGridBaseCaseBEIncorrectDate() {
microGridBaseCaseBoundaries());
}

public static GridModelReferenceResources microGridBaseCaseBEMissingLimitValue() {
String baseModified = ENTSOE_CONFORMITY_1_MODIFIED
+ "/MicroGrid/BaseCase/BC_BE_v2_missing_limit_value/";
return new GridModelReferenceResources("MicroGrid-BaseCase-BE-missing-limit-value",
null,
new ResourceSet(baseModified,
MICRO_GRID_BE_EQ),
new ResourceSet(MICRO_GRID_BE_BASE,
MICRO_GRID_BE_TP,
MICRO_GRID_BE_SV,
MICRO_GRID_BE_SSH),
microGridBaseCaseBoundaries());
}

public static GridModelReferenceResources microGridBaseCaseBEReactivePowerGen() {
String baseModified = ENTSOE_CONFORMITY_1_MODIFIED
+ "/MicroGrid/BaseCase/BC_BE_v2_reactive_power_gen/";
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package com.powsybl.cgmes.conversion.test;

import com.powsybl.cgmes.conversion.CgmesExport;
import com.powsybl.cgmes.conversion.CgmesImport;
import com.powsybl.commons.test.AbstractSerDeTest;
import com.powsybl.iidm.network.*;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -148,4 +149,29 @@ void voltageLimitTest() {
assertEquals(380.0, vl2.getLowVoltageLimit());
}

@Test
void missingLimitsTest() {
// CGMES network:
// An ACLineSegment ACL with 1 OperationalLimitSet on each side.
// On side 1, the limit set is missing the PATL. On side 2, the limit set is missing the TATL value for 1200s.
// IIDM network:
// PATL are computed when missing as percentage * lowest tatl value.
// TATL are discarded when value is missing.
Properties importParams = new Properties();
importParams.setProperty(CgmesImport.MISSING_PERMANENT_LIMIT_PERCENTAGE, "80");
Network network = readCgmesResources(importParams, DIR, "missing_limits.xml");
Line line = network.getLine("ACL");

// Missing PATL in CGMES is calculated as percentage (0.80) * lowest tatl value (125) = 100.
assertTrue(line.getCurrentLimits1().isPresent());
CurrentLimits limits1 = line.getCurrentLimits1().get();
assertEquals(125, limits1.getTemporaryLimits().iterator().next().getValue());
assertEquals(100, limits1.getPermanentLimit());

// TATL for 1200s has no value, the limit is discarded.
assertTrue(line.getCurrentLimits2().isPresent());
CurrentLimits limits2 = line.getCurrentLimits2().get();
assertNull(limits2.getTemporaryLimit(1200));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import java.io.IOException;
import java.nio.file.FileSystem;
Expand All @@ -45,7 +42,6 @@
import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static com.powsybl.iidm.network.PhaseTapChanger.RegulationMode.CURRENT_LIMITER;
import static com.powsybl.iidm.network.StaticVarCompensator.RegulationMode.*;
Expand Down Expand Up @@ -368,32 +364,6 @@ void microBEMissingShuntRegulatingControlId() {
assertEquals(shunt.getTerminal(), shunt.getRegulatingTerminal());
}

@ParameterizedTest(name = "{1}")
@MethodSource("getMicroBEUndefinedPatlParameters")
void microBEUndefinedPatl(double expectedPermanentLimitValue, Double percentage) {
InMemoryPlatformConfig platformConfig = new InMemoryPlatformConfig(fileSystem);
if (percentage != null) {
platformConfig.createModuleConfig("import-export-parameters-default-value")
.setStringProperty(CgmesImport.MISSING_PERMANENT_LIMIT_PERCENTAGE, percentage.toString());
}

Network network = new CgmesImport(platformConfig).importData(CgmesConformity1ModifiedCatalog.microGridBaseCaseBEUndefinedPatl().dataSource(),
NetworkFactory.findDefault(), importParams);
Line line = network.getLine("ffbabc27-1ccd-4fdc-b037-e341706c8d29");
CurrentLimits limits = line.getCurrentLimits1().orElse(null);
assertNotNull(limits);
assertEquals(2, limits.getTemporaryLimits().size());
assertEquals(expectedPermanentLimitValue, limits.getPermanentLimit(), 0.001);
}

static Stream<Arguments> getMicroBEUndefinedPatlParameters() {
return Stream.of(
Arguments.of(1312., null),
Arguments.of(1312., 100.),
Arguments.of(984., 75.)
);
}

@Test
void microBEEquivalentInjectionRegulatingVoltage() {
Network network = new CgmesImport().importData(CgmesConformity1ModifiedCatalog.microGridBaseCaseBEEquivalentInjectionRegulatingVoltage().dataSource(),
Expand Down Expand Up @@ -497,16 +467,6 @@ void microBEIncorrectDate() {
assertEquals(1, svModel.get().getVersion());
}

@Test
void microBEMissingLimitValue() {
Network network = new CgmesImport().importData(CgmesConformity1ModifiedCatalog.microGridBaseCaseBEMissingLimitValue().dataSource(),
NetworkFactory.findDefault(), importParams);
DanglingLine line = network.getDanglingLine("17086487-56ba-4979-b8de-064025a6b4da");
CurrentLimits limits = line.getCurrentLimits().orElse(null);
assertNotNull(limits);
assertNull(limits.getTemporaryLimit(10));
}

@Test
void microBEReactivePowerGen() {
Network network = new CgmesImport().importData(CgmesConformity1ModifiedCatalog.microGridBaseCaseBEReactivePowerGen().dataSource(), NetworkFactory.findDefault(), importParams);
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:entsoe="http://entsoe.eu/CIM/SchemaExtension/3/1#" 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-12-07T19:43:00Z</md:Model.scenarioTime>
<md:Model.created>2021-12-07T12:00:00Z</md:Model.created>
<md:Model.description>Missing limits</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:ACLineSegment rdf:ID="_ACL">
<cim:Equipment.aggregate>false</cim:Equipment.aggregate>
<cim:ACLineSegment.b0ch>0</cim:ACLineSegment.b0ch>
<cim:ACLineSegment.bch>0</cim:ACLineSegment.bch>
<cim:IdentifiedObject.description>Line</cim:IdentifiedObject.description>
<cim:ACLineSegment.g0ch>0</cim:ACLineSegment.g0ch>
<cim:ACLineSegment.gch>0</cim:ACLineSegment.gch>
<cim:Conductor.length>1</cim:Conductor.length>
<cim:IdentifiedObject.name>Line</cim:IdentifiedObject.name>
<cim:ACLineSegment.r>0.1</cim:ACLineSegment.r>
<cim:ACLineSegment.r0>0.1</cim:ACLineSegment.r0>
<cim:ACLineSegment.shortCircuitEndTemperature>0</cim:ACLineSegment.shortCircuitEndTemperature>
<cim:ACLineSegment.x>1</cim:ACLineSegment.x>
<cim:ACLineSegment.x0>0.1</cim:ACLineSegment.x0>
<cim:ConductingEquipment.BaseVoltage rdf:resource="#_BV"/>
</cim:ACLineSegment>
<cim:Terminal rdf:ID="_T_1">
<cim:IdentifiedObject.name>Terminal 1</cim:IdentifiedObject.name>
<cim:ACDCTerminal.sequenceNumber>1</cim:ACDCTerminal.sequenceNumber>
<cim:Terminal.ConductingEquipment rdf:resource="#_ACL"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN_1"/>
</cim:Terminal>
<cim:Terminal rdf:ID="_T_2">
<cim:IdentifiedObject.name>Terminal 2</cim:IdentifiedObject.name>
<cim:ACDCTerminal.sequenceNumber>2</cim:ACDCTerminal.sequenceNumber>
<cim:Terminal.ConductingEquipment rdf:resource="#_ACL"/>
<cim:Terminal.ConnectivityNode rdf:resource="#_CN_2"/>
</cim:Terminal>
<cim:OperationalLimitSet rdf:ID="_OLS_1">
<cim:IdentifiedObject.name>Limit set 1</cim:IdentifiedObject.name>
<cim:OperationalLimitSet.Terminal rdf:resource="#_T_1"/>
</cim:OperationalLimitSet>
<!--cim:CurrentLimit rdf:ID="_CL_11">
<cim:IdentifiedObject.name>Limit 11</cim:IdentifiedObject.name>
<cim:CurrentLimit.value>100</cim:CurrentLimit.value>
<cim:OperationalLimit.OperationalLimitSet rdf:resource="#_OLS_1"/>
<cim:OperationalLimit.OperationalLimitType rdf:resource="#_OLT_PATL"/>
</cim:CurrentLimit!-->
<cim:CurrentLimit rdf:ID="_CL_12">
<cim:IdentifiedObject.name>Limit 12</cim:IdentifiedObject.name>
<cim:CurrentLimit.value>125</cim:CurrentLimit.value>
<cim:OperationalLimit.OperationalLimitSet rdf:resource="#_OLS_1"/>
<cim:OperationalLimit.OperationalLimitType rdf:resource="#_OLT_TATL_20"/>
</cim:CurrentLimit>
<cim:CurrentLimit rdf:ID="_CL_13">
<cim:IdentifiedObject.name>Limit 13</cim:IdentifiedObject.name>
<cim:CurrentLimit.value>135</cim:CurrentLimit.value>
<cim:OperationalLimit.OperationalLimitSet rdf:resource="#_OLS_1"/>
<cim:OperationalLimit.OperationalLimitType rdf:resource="#_OLT_TATL_5"/>
</cim:CurrentLimit>
<cim:OperationalLimitSet rdf:ID="_OLS_2">
<cim:IdentifiedObject.name>Limit set 2</cim:IdentifiedObject.name>
<cim:OperationalLimitSet.Terminal rdf:resource="#_T_2"/>
</cim:OperationalLimitSet>
<cim:CurrentLimit rdf:ID="_CL_21">
<cim:IdentifiedObject.name>Limit 21</cim:IdentifiedObject.name>
<cim:CurrentLimit.value>100</cim:CurrentLimit.value>
<cim:OperationalLimit.OperationalLimitSet rdf:resource="#_OLS_2"/>
<cim:OperationalLimit.OperationalLimitType rdf:resource="#_OLT_PATL"/>
</cim:CurrentLimit>
<cim:CurrentLimit rdf:ID="_CL_22">
<cim:IdentifiedObject.name>Limit 22</cim:IdentifiedObject.name>
<!--cim:CurrentLimit.value>125</cim:CurrentLimit.value-->
<cim:OperationalLimit.OperationalLimitSet rdf:resource="#_OLS_2"/>
<cim:OperationalLimit.OperationalLimitType rdf:resource="#_OLT_TATL_20"/>
</cim:CurrentLimit>
<cim:CurrentLimit rdf:ID="_CL_23">
<cim:IdentifiedObject.name>Limit 23</cim:IdentifiedObject.name>
<cim:CurrentLimit.value>135</cim:CurrentLimit.value>
<cim:OperationalLimit.OperationalLimitSet rdf:resource="#_OLS_2"/>
<cim:OperationalLimit.OperationalLimitType rdf:resource="#_OLT_TATL_5"/>
</cim:CurrentLimit>
<cim:OperationalLimitType rdf:ID="_OLT_PATL">
<cim:OperationalLimitType.direction rdf:resource="http://iec.ch/TC57/2013/CIM-schema-cim16#OperationalLimitDirectionKind.absoluteValue" />
<entsoe:OperationalLimitType.limitType rdf:resource="http://entsoe.eu/CIM/SchemaExtension/3/1#LimitTypeKind.patl" />
<cim:IdentifiedObject.name>PATL</cim:IdentifiedObject.name>
</cim:OperationalLimitType>
<cim:OperationalLimitType rdf:ID="_OLT_TATL_20">
<cim:OperationalLimitType.direction rdf:resource="http://iec.ch/TC57/2013/CIM-schema-cim16#OperationalLimitDirectionKind.absoluteValue" />
<entsoe:OperationalLimitType.limitType rdf:resource="http://entsoe.eu/CIM/SchemaExtension/3/1#LimitTypeKind.tatl" />
<cim:IdentifiedObject.name>TATL 20</cim:IdentifiedObject.name>
<cim:OperationalLimitType.acceptableDuration>1200</cim:OperationalLimitType.acceptableDuration>
</cim:OperationalLimitType>
<cim:OperationalLimitType rdf:ID="_OLT_TATL_5">
<cim:OperationalLimitType.direction rdf:resource="http://iec.ch/TC57/2013/CIM-schema-cim16#OperationalLimitDirectionKind.absoluteValue" />
<entsoe:OperationalLimitType.limitType rdf:resource="http://entsoe.eu/CIM/SchemaExtension/3/1#LimitTypeKind.tatl" />
<cim:IdentifiedObject.name>TATL 5</cim:IdentifiedObject.name>
<cim:OperationalLimitType.acceptableDuration>300</cim:OperationalLimitType.acceptableDuration>
</cim:OperationalLimitType>
<cim:BaseVoltage rdf:ID="_BV">
<cim:IdentifiedObject.name>400 kV</cim:IdentifiedObject.name>
<cim:BaseVoltage.nominalVoltage>400</cim:BaseVoltage.nominalVoltage>
</cim:BaseVoltage>
</rdf:RDF>
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@
<cim:IdentifiedObject.name>Limit type high</cim:IdentifiedObject.name>
<entsoe:OperationalLimitType.limitType rdf:resource="http://entsoe.eu/CIM/SchemaExtension/3/1#LimitTypeKind.highVoltage" />
</cim:OperationalLimitType>
<cim:OperationalLimitType rdf:ID="_OLT_L">
<cim:OperationalLimitType rdf:ID="_OLT_L">
<cim:IdentifiedObject.name>Limit type low</cim:IdentifiedObject.name>
<entsoe:OperationalLimitType.limitType rdf:resource="http://entsoe.eu/CIM/SchemaExtension/3/1#LimitTypeKind.lowVoltage" />
<entsoe:OperationalLimitType.limitType rdf:resource="http://entsoe.eu/CIM/SchemaExtension/3/1#LimitTypeKind.lowVoltage" />
</cim:OperationalLimitType>
<cim:BaseVoltage rdf:ID="_BV">
<cim:IdentifiedObject.name>400 kV</cim:IdentifiedObject.name>
Expand Down

0 comments on commit ebe5ab4

Please sign in to comment.