diff --git a/cgmes/cgmes-conformity/src/test/java/com/powsybl/cgmes/conformity/test/CgmesConformity1NetworkCatalog.java b/cgmes/cgmes-conformity/src/test/java/com/powsybl/cgmes/conformity/test/CgmesConformity1NetworkCatalog.java index 127f55996e9..519e8c1c976 100644 --- a/cgmes/cgmes-conformity/src/test/java/com/powsybl/cgmes/conformity/test/CgmesConformity1NetworkCatalog.java +++ b/cgmes/cgmes-conformity/src/test/java/com/powsybl/cgmes/conformity/test/CgmesConformity1NetworkCatalog.java @@ -31,14 +31,14 @@ private static Network microBE(String modelId) { .setCountry(Country.BE) .setGeographicalTags("ELIA-Brussels") // _c1d5bfc88f8011e08e4d00247eb1f55e .add(); - sBrussels.setProperty("CGMES.regionId", "_c1d5bfc88f8011e08e4d00247eb1f55e"); + sBrussels.setProperty("CGMES.subRegionId", "_c1d5bfc88f8011e08e4d00247eb1f55e"); Substation sAnvers = network.newSubstation() .setId("_87f7002b-056f-4a6a-a872-1744eea757e3") .setName("Anvers") .setCountry(Country.BE) .setGeographicalTags("ELIA-Anvers") // _c1d5c0378f8011e08e4d00247eb1f55e .add(); - sAnvers.setProperty("CGMES.regionId", "_c1d5c0378f8011e08e4d00247eb1f55e"); + sAnvers.setProperty("CGMES.subRegionId", "_c1d5c0378f8011e08e4d00247eb1f55e"); VoltageLevel vlBrussels21 = sBrussels.newVoltageLevel() .setId("_929ba893-c9dc-44d7-b1fd-30834bd3ab85") .setName("21.0") diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/elements/SubstationConversion.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/elements/SubstationConversion.java index 5ad7cd5918f..042bd22fad4 100644 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/elements/SubstationConversion.java +++ b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/elements/SubstationConversion.java @@ -57,15 +57,16 @@ public void convert() { adder.setGeographicalTags(geoTag); } Substation s = adder.add(); - addAliasesAndProperties(s, p.getId("SubRegion")); + addAliasesAndProperties(s, p.getId("SubRegion"), p.getId("Region")); } - private void addAliasesAndProperties(Substation s, String regionId) { + private void addAliasesAndProperties(Substation s, String subRegionId, String regionId) { int index = 0; for (String mergedSub : context.substationIdMapping().mergedSubstations(s.getId())) { index++; s.addAlias(mergedSub, "MergedSubstation" + index, context.config().isEnsureIdAliasUnicity()); } + s.setProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "subRegionId", subRegionId); s.setProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "regionId", regionId); } } diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/CgmesExportContext.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/CgmesExportContext.java index ed93909bfd7..d5d6518a718 100644 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/CgmesExportContext.java +++ b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/CgmesExportContext.java @@ -141,6 +141,7 @@ public CgmesExportContext(Network network) { public void addIidmMappings(Network network) { // For a merging view we plan to call CgmesExportContext() and then addIidmMappings(network) for every network + addIidmMappingsSubstations(network); CgmesIidmMapping mapping = network.getExtension(CgmesIidmMapping.class); if (mapping == null) { network.newExtension(CgmesIidmMappingAdder.class).add(); @@ -154,6 +155,20 @@ public void addIidmMappings(Network network) { addIidmMappingsShuntCompensators(network); addIidmMappingsEndsAndTapChangers(network); addIidmMappingsEquivalentInjection(network); + addIidmMappingsControlArea(network); + } + + private void addIidmMappingsSubstations(Network network) { + for (Substation substation : network.getSubstations()) { + if (!substation.hasProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "regionId")) { + String regionId = CgmesExportUtil.getUniqueId(); + substation.setProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "regionId", regionId); + } + if (!substation.hasProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "subRegionId")) { + String subRegionId = CgmesExportUtil.getUniqueId(); + substation.setProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "subRegionId", subRegionId); + } + } } private void addIidmMappingsTopologicalNodes(CgmesIidmMapping mapping, Network network) { @@ -435,6 +450,24 @@ private static void addIidmMappingsEquivalentInjection(Network network) { } } + private void addIidmMappingsControlArea(Network network) { + CgmesControlAreas cgmesControlAreas = network.getExtension(CgmesControlAreas.class); + if (cgmesControlAreas == null) { + network.newExtension(CgmesControlAreasAdder.class).add(); + cgmesControlAreas = network.getExtension(CgmesControlAreas.class); + String cgmesControlAreaId = CgmesExportUtil.getUniqueId(); + cgmesControlAreas.newCgmesControlArea() + .setId(cgmesControlAreaId) + .setName("Network") + .setEnergyIdentificationCodeEic("Network--1") + .add(); + CgmesControlArea cgmesControlArea = cgmesControlAreas.getCgmesControlArea(cgmesControlAreaId); + for (DanglingLine danglingLine : network.getDanglingLines()) { + cgmesControlArea.add(danglingLine.getTerminal()); + } + } + } + public CgmesExportContext() { } diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/EquipmentExport.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/EquipmentExport.java index 68c8aa25ae5..cdcece4d9ba 100644 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/EquipmentExport.java +++ b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/EquipmentExport.java @@ -173,26 +173,17 @@ private static void writeSubstations(Network network, String cimNamespace, XMLSt Map geographicalRegionIds = new HashMap<>(); BiMap subGeographicalRegionIds = HashBiMap.create(); for (Substation substation : network.getSubstations()) { + String geographicalRegionId = substation.getProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "regionId"); String geoName = getGeographicalRegionName(substation, network); - geographicalRegionIds.computeIfAbsent(geoName, name -> writeGeographicalRegion(name, cimNamespace, writer)); - String subGeographicalRegionId = getSubGeographicalRegionId(substation, subGeographicalRegionIds); + geographicalRegionIds.computeIfAbsent(geoName, name -> writeGeographicalRegion(geographicalRegionId, name, cimNamespace, writer)); + String subGeographicalRegionId = substation.getProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "subRegionId"); subGeographicalRegionIds.computeIfAbsent(subGeographicalRegionId, id -> writeSubGeographicalRegion(id, geoName, substation, geographicalRegionIds, cimNamespace, writer)); SubstationEq.write(substation.getId(), substation.getNameOrId(), subGeographicalRegionId, cimNamespace, writer); } } - private static String getGeographicalRegionName(Substation substation, Network network) { - String geoName = network.getNameOrId(); - Optional country = substation.getCountry(); - if (country.isPresent()) { - geoName = country.get().toString(); - } - return geoName; - } - - private static String writeGeographicalRegion(String geoName, String cimNamespace, XMLStreamWriter writer) { + private static String writeGeographicalRegion(String geographicalRegionId, String geoName, String cimNamespace, XMLStreamWriter writer) { try { - String geographicalRegionId = CgmesExportUtil.getUniqueId(); GeographicalRegionEq.write(geographicalRegionId, geoName, cimNamespace, writer); return geographicalRegionId; } catch (XMLStreamException e) { @@ -200,15 +191,13 @@ private static String writeGeographicalRegion(String geoName, String cimNamespac } } - private static String getSubGeographicalRegionId(Substation substation, BiMap subGeographicalRegionIds) { - if (substation.hasProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "regionId")) { - return substation.getProperty(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "regionId"); - } else if (substation.getGeographicalTags().size() == 1) { - return subGeographicalRegionIds.inverse().getOrDefault(substation.getGeographicalTags().iterator().next(), - CgmesExportUtil.getUniqueId()); - } else { - return CgmesExportUtil.getUniqueId(); + private static String getGeographicalRegionName(Substation substation, Network network) { + String geoName = network.getNameOrId(); + Optional country = substation.getCountry(); + if (country.isPresent()) { + geoName = country.get().toString(); } + return geoName; } private static String writeSubGeographicalRegion(String subGeographicalRegionId, String geoName, Substation substation, Map geographicalRegionIds, String cimNamespace, XMLStreamWriter writer) { @@ -664,16 +653,8 @@ private static void writeAcdcConverterDCTerminal(String id, String conductingEqu private static void writeControlAreas(Network network, Map exportedTerminals, Map danglingLineBoundaries, String cimNamespace, XMLStreamWriter writer) throws XMLStreamException { CgmesControlAreas cgmesControlAreas = network.getExtension(CgmesControlAreas.class); - if (cgmesControlAreas != null) { - for (CgmesControlArea cgmesControlArea : cgmesControlAreas.getCgmesControlAreas()) { - writeControlArea(cgmesControlArea, exportedTerminals, danglingLineBoundaries, cimNamespace, writer); - } - } else { - String cgmesControlAreaId = CgmesExportUtil.getUniqueId(); - ControlAreaEq.write(cgmesControlAreaId, "Network", "Network--1", cimNamespace, writer); - for (DanglingLine danglingLine : network.getDanglingLines()) { - TieFlowEq.write(CgmesExportUtil.getUniqueId(), cgmesControlAreaId, exportedTerminalId(exportedTerminals, danglingLine.getTerminal()), cimNamespace, writer); - } + for (CgmesControlArea cgmesControlArea : cgmesControlAreas.getCgmesControlAreas()) { + writeControlArea(cgmesControlArea, exportedTerminals, danglingLineBoundaries, cimNamespace, writer); } } diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/cim14/Cim14SmallCasesNetworkCatalog.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/cim14/Cim14SmallCasesNetworkCatalog.java index fdcef37ecac..2d0b87b1597 100644 --- a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/cim14/Cim14SmallCasesNetworkCatalog.java +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/cim14/Cim14SmallCasesNetworkCatalog.java @@ -34,13 +34,13 @@ public static Network smallcase1() { .setName("GEN _SS") .setGeographicalTags(sGenGeoTag) .add(); - sGen.setProperty("CGMES.regionId", "_SGR_1_"); + sGen.setProperty("CGMES.subRegionId", "_SGR_1_"); Substation sInf = network.newSubstation() .setId("_INF______SS") .setName("INF _SS") .setGeographicalTags(sInfGeoTag) .add(); - sInf.setProperty("CGMES.regionId", "_SGR_1_"); + sInf.setProperty("CGMES.subRegionId", "_SGR_1_"); VoltageLevel vlInf = sInf.newVoltageLevel() .setId("_INF______VL") .setName("INF _VL") diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesMappingTest.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesMappingTest.java new file mode 100644 index 00000000000..352f54fde19 --- /dev/null +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesMappingTest.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) 2022, 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/. + */ +package com.powsybl.cgmes.conversion.test.export; + +import com.powsybl.cgmes.conversion.CgmesExport; +import com.powsybl.commons.AbstractConverterTest; +import com.powsybl.commons.datasource.*; +import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.NetworkFactory; +import com.powsybl.iidm.xml.NetworkXml; +import com.powsybl.iidm.xml.XMLImporter; +import org.apache.commons.io.FileUtils; +import org.junit.Test; +import org.xmlunit.diff.DifferenceEvaluator; +import org.xmlunit.diff.DifferenceEvaluators; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Properties; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author Marcos de Miguel + */ +public class CgmesMappingTest extends AbstractConverterTest { + + @Test + public void compareCgmesAndIidmExports() throws IOException { + String baseName = "nordic32"; + ReadOnlyDataSource dataSource = new ResourceDataSource(baseName, new ResourceSet("/cim14", "nordic32.xiidm")); + Network network = new XMLImporter().importData(dataSource, NetworkFactory.findDefault(), null); + DataSource exportDataSource1 = tmpDataSource("export1", baseName); + DataSource exportDataSource2 = tmpDataSource("export2", baseName); + exportNetwork(network, exportDataSource1, baseName); + Network network1 = export2IidmAndImport(network); + network1.setCaseDate(network.getCaseDate()); + exportNetwork(network1, exportDataSource2, baseName); + compareFiles("export1", "export2"); + } + + @Test + public void compare2Exports() throws IOException { + String baseName = "nordic32"; + ReadOnlyDataSource dataSource = new ResourceDataSource(baseName, new ResourceSet("/cim14", "nordic32.xiidm")); + Network network = new XMLImporter().importData(dataSource, NetworkFactory.findDefault(), null); + DataSource exportDataSource1 = tmpDataSource("export1", baseName); + DataSource exportDataSource2 = tmpDataSource("export2", baseName); + exportNetwork(network, exportDataSource1, baseName); + exportNetwork(network, exportDataSource2, baseName); + compareFiles("export1", "export2"); + } + + private void compareFiles(String export1, String export2) throws IOException { + List files; + try (Stream walk = Files.walk(tmpDir.resolve(export1))) { + files = walk.filter(Files::isRegularFile) + .collect(Collectors.toList()); + } + DifferenceEvaluator knownDiffs = DifferenceEvaluators.chain( + DifferenceEvaluators.Default, + ExportXmlCompare::numericDifferenceEvaluator, + ExportXmlCompare::ignoringFullModelAbout, + ExportXmlCompare::ignoringCurrentLimitIds, + ExportXmlCompare::ignoringSVIds); + for (Path file : files) { + ExportXmlCompare.compareNetworks(file, tmpDir.resolve(export2).resolve(file.getFileName().toString()), knownDiffs); + } + + } + + private void exportNetwork(Network network, DataSource exportDataSource, String baseName) { + CgmesExport e = new CgmesExport(); + Properties ep = new Properties(); + ep.setProperty(CgmesExport.BASE_NAME, baseName); + e.export(network, ep, exportDataSource); + } + + private Network export2IidmAndImport(Network network) { + NetworkXml.write(network, tmpDir.resolve("export.iidm")); + return NetworkXml.read(tmpDir.resolve("export.iidm")); + } + + private DataSource tmpDataSource(String name, String baseName) throws IOException { + Path exportFolder = tmpDir.resolve(name); + if (Files.exists(exportFolder)) { + FileUtils.cleanDirectory(exportFolder.toFile()); + } + Files.createDirectories(exportFolder); + return new FileDataSource(exportFolder, baseName); + } +} diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/ExportXmlCompare.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/ExportXmlCompare.java index 28647cc719d..67b4125c762 100644 --- a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/ExportXmlCompare.java +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/ExportXmlCompare.java @@ -499,6 +499,57 @@ static ComparisonResult ignoringControlAreaNetInterchange(Comparison comparison, return result; } + static ComparisonResult ignoringFullModelAbout(Comparison comparison, ComparisonResult result) { + if (result == ComparisonResult.DIFFERENT) { + if (comparison.getType() == ComparisonType.ATTR_VALUE) { + Comparison.Detail control = comparison.getControlDetails(); + if (control.getXPath().contains("FullModel") + && control.getTarget().getLocalName().equals("about")) { + return ComparisonResult.EQUAL; + } + } + } + return result; + } + + static ComparisonResult ignoringCurrentLimitIds(Comparison comparison, ComparisonResult result) { + if (result == ComparisonResult.DIFFERENT) { + if (comparison.getType() == ComparisonType.ATTR_VALUE) { + Comparison.Detail control = comparison.getControlDetails(); + if (control.getXPath().contains("CurrentLimit") + && (control.getTarget().getLocalName().equals("ID") || control.getTarget().getLocalName().equals("resource"))) { + return ComparisonResult.EQUAL; + } else if (control.getXPath().contains("OperationalLimit") + && control.getTarget().getLocalName().equals("ID")) { + return ComparisonResult.EQUAL; + } + } + } + return result; + } + + static ComparisonResult ignoringSVIds(Comparison comparison, ComparisonResult result) { + if (result == ComparisonResult.DIFFERENT) { + if (comparison.getType() == ComparisonType.ATTR_VALUE) { + Comparison.Detail control = comparison.getControlDetails(); + if (control.getXPath().contains("SvVoltage") + && control.getTarget().getLocalName().equals("ID")) { + return ComparisonResult.EQUAL; + } else if (control.getXPath().contains("SvPowerFlow") + && control.getTarget().getLocalName().equals("ID")) { + return ComparisonResult.EQUAL; + } else if (control.getXPath().contains("SvShuntCompensatorSections") + && control.getTarget().getLocalName().equals("ID")) { + return ComparisonResult.EQUAL; + } else if (control.getXPath().contains("SvStatus") + && control.getTarget().getLocalName().equals("ID")) { + return ComparisonResult.EQUAL; + } + } + } + return result; + } + static ComparisonResult numericDifferenceEvaluator(Comparison comparison, ComparisonResult result) { // If both control and test nodes are text that can be converted to a number // check that they represent the same number diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/SteadyStateHypothesisExportTest.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/SteadyStateHypothesisExportTest.java index 7726193e3d1..9e0a81e4373 100644 --- a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/SteadyStateHypothesisExportTest.java +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/SteadyStateHypothesisExportTest.java @@ -11,6 +11,7 @@ import com.powsybl.cgmes.conversion.CgmesImport; import com.powsybl.cgmes.conversion.export.CgmesExportContext; import com.powsybl.cgmes.conversion.export.SteadyStateHypothesisExport; +import com.powsybl.cgmes.extensions.CgmesControlAreas; import com.powsybl.commons.AbstractConverterTest; import com.powsybl.commons.datasource.ReadOnlyDataSource; import com.powsybl.commons.xml.XmlUtil; @@ -136,6 +137,10 @@ private void test(ReadOnlyDataSource dataSource, int version, DifferenceEvaluato Network actual = Importers.loadNetwork(repackaged, DefaultComputationManagerConfig.load().createShortTimeExecutionComputationManager(), ImportConfig.load(), properties); + // Remove ControlAreas extension + expected.removeExtension(CgmesControlAreas.class); + actual.removeExtension(CgmesControlAreas.class); + // Create topology mapping CgmesExportContext.updateTopologicalNodesMapping(actual); diff --git a/cgmes/cgmes-conversion/src/test/resources/cim14/7buses.xiidm b/cgmes/cgmes-conversion/src/test/resources/cim14/7buses.xiidm index e455036bc29..32a765eacf0 100644 --- a/cgmes/cgmes-conversion/src/test/resources/cim14/7buses.xiidm +++ b/cgmes/cgmes-conversion/src/test/resources/cim14/7buses.xiidm @@ -1,7 +1,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -107,7 +107,7 @@ - + diff --git a/cgmes/cgmes-conversion/src/test/resources/cim14/ieee14.xiidm b/cgmes/cgmes-conversion/src/test/resources/cim14/ieee14.xiidm index 9a9c61fc7d9..d3406435d87 100644 --- a/cgmes/cgmes-conversion/src/test/resources/cim14/ieee14.xiidm +++ b/cgmes/cgmes-conversion/src/test/resources/cim14/ieee14.xiidm @@ -1,7 +1,7 @@ - + @@ -10,7 +10,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -138,7 +138,7 @@ - + @@ -173,7 +173,7 @@ - + diff --git a/cgmes/cgmes-conversion/src/test/resources/cim14/nordic32.xiidm b/cgmes/cgmes-conversion/src/test/resources/cim14/nordic32.xiidm index 167eec629e6..a6f9be4630a 100644 --- a/cgmes/cgmes-conversion/src/test/resources/cim14/nordic32.xiidm +++ b/cgmes/cgmes-conversion/src/test/resources/cim14/nordic32.xiidm @@ -1,7 +1,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -109,7 +109,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -146,7 +146,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -201,7 +201,7 @@ - + @@ -209,7 +209,7 @@ - + @@ -221,7 +221,7 @@ - + @@ -233,7 +233,7 @@ - + @@ -242,7 +242,7 @@ - + @@ -262,7 +262,7 @@ - + @@ -286,7 +286,7 @@ - + @@ -307,7 +307,7 @@ - + @@ -328,7 +328,7 @@ - + @@ -352,7 +352,7 @@ - + @@ -373,7 +373,7 @@ - + @@ -394,7 +394,7 @@ - + @@ -418,7 +418,7 @@ - + @@ -439,7 +439,7 @@ - + @@ -460,7 +460,7 @@ - + @@ -480,7 +480,7 @@ - + @@ -500,7 +500,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -545,7 +545,7 @@ - + diff --git a/cgmes/cgmes-conversion/src/test/resources/cim14/tx-from-microBE-adapted.xiidm b/cgmes/cgmes-conversion/src/test/resources/cim14/tx-from-microBE-adapted.xiidm index 48dc745d566..1439ff56362 100644 --- a/cgmes/cgmes-conversion/src/test/resources/cim14/tx-from-microBE-adapted.xiidm +++ b/cgmes/cgmes-conversion/src/test/resources/cim14/tx-from-microBE-adapted.xiidm @@ -1,7 +1,7 @@ - + diff --git a/cgmes/cgmes-model/src/test/java/com/powsybl/cgmes/model/test/FakeCgmesModel.java b/cgmes/cgmes-model/src/test/java/com/powsybl/cgmes/model/test/FakeCgmesModel.java index a8d865d0675..61e10e9ed9d 100644 --- a/cgmes/cgmes-model/src/test/java/com/powsybl/cgmes/model/test/FakeCgmesModel.java +++ b/cgmes/cgmes-model/src/test/java/com/powsybl/cgmes/model/test/FakeCgmesModel.java @@ -149,7 +149,10 @@ public boolean hasBoundary() { public FakeCgmesModel substations(String... ids) { fakeObjectsFromIdentifiers("Substation", ids, substations); // Add a default SubRegion to every substation - substations.forEach(s -> s.put("SubRegion", "SubRegion0")); + substations.forEach(s -> { + s.put("SubRegion", "SubRegion0"); + s.put("Region", "Region0"); + }); return this; }