From 817531f71478d711d19e7dd905644e39e6fe5ba8 Mon Sep 17 00:00:00 2001 From: Mathieu Bague Date: Mon, 16 Jan 2017 15:28:35 +0100 Subject: [PATCH 1/3] Fix #196 --- cim1-import/pom.xml | 30 +- .../iidm/import_/cim1/CIM1Importer.java | 40 +- .../iidm/import_/cim1/CIM1ImporterTest.java | 116 ++ .../resources/ENTSO-E_Boundary_Set_EU_EQ.xml | 13 + .../resources/ENTSO-E_Boundary_Set_EU_TP.xml | 13 + .../src/test/resources/ieee14bus_EQ.xml | 1323 +++++++++++++ .../src/test/resources/ieee14bus_ME.xml | 1704 +++++++++++++++++ .../src/test/resources/ieee14bus_SV.xml | 169 ++ .../src/test/resources/ieee14bus_TP.xml | 332 ++++ 9 files changed, 3724 insertions(+), 16 deletions(-) create mode 100644 cim1-import/src/test/java/eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java create mode 100644 cim1-import/src/test/resources/ENTSO-E_Boundary_Set_EU_EQ.xml create mode 100644 cim1-import/src/test/resources/ENTSO-E_Boundary_Set_EU_TP.xml create mode 100644 cim1-import/src/test/resources/ieee14bus_EQ.xml create mode 100644 cim1-import/src/test/resources/ieee14bus_ME.xml create mode 100644 cim1-import/src/test/resources/ieee14bus_SV.xml create mode 100644 cim1-import/src/test/resources/ieee14bus_TP.xml diff --git a/cim1-import/pom.xml b/cim1-import/pom.xml index 43841b5e..c52c1c60 100644 --- a/cim1-import/pom.xml +++ b/cim1-import/pom.xml @@ -23,13 +23,14 @@ CIM ENTSO-E V1 import + com.google.auto.service auto-service - org.slf4j - slf4j-api + com.google.jimfs + jimfs org.apache.servicemix.bundles @@ -40,16 +41,20 @@ jgrapht-core - ${project.groupId} + org.slf4j + slf4j-api + + + eu.itesla_project iidm-converter-api - ${project.groupId} + eu.itesla_project iidm-network-api - + - eu.itesla_project + ${project.groupId} cim1-model ${project.version} @@ -58,5 +63,18 @@ entsoe-util ${project.version} + + + + commons-io + commons-io + test + + + junit + junit + test + + diff --git a/cim1-import/src/main/java/eu/itesla_project/iidm/import_/cim1/CIM1Importer.java b/cim1-import/src/main/java/eu/itesla_project/iidm/import_/cim1/CIM1Importer.java index 80ed3d37..dbed03ef 100644 --- a/cim1-import/src/main/java/eu/itesla_project/iidm/import_/cim1/CIM1Importer.java +++ b/cim1-import/src/main/java/eu/itesla_project/iidm/import_/cim1/CIM1Importer.java @@ -13,6 +13,7 @@ import com.google.common.base.Suppliers; import com.google.gdata.util.io.base.UnicodeReader; import eu.itesla_project.commons.config.PlatformConfig; +import eu.itesla_project.iidm.datasource.DataSourceUtil; import eu.itesla_project.iidm.datasource.ReadOnlyDataSource; import eu.itesla_project.iidm.import_.Importer; import eu.itesla_project.iidm.import_.Importers; @@ -38,7 +39,6 @@ import java.util.Properties; /** - * * @author Olivier Bretteville */ @AutoService(Importer.class) @@ -99,10 +99,10 @@ public String getComment() { } private Packaging detectPackaging(ReadOnlyDataSource dataSource) throws IOException { - if (dataSource.exists("_ME", "xml")) { + if (exists(dataSource, "_ME", "xml")) { return Packaging.MERGED; } - if (dataSource.exists("_EQ", "xml") && dataSource.exists("_TP", "xml") && dataSource.exists("_SV", "xml")) { + if (exists(dataSource, "_EQ", "xml") && exists(dataSource, "_TP", "xml") && exists(dataSource, "_SV", "xml")) { return Packaging.SPLIT; } return null; @@ -158,11 +158,11 @@ public boolean exists(ReadOnlyDataSource dataSource) { if (packaging != null) { switch (packaging) { case MERGED: - try (InputStream is = dataSource.newInputStream("_ME", "xml")) { + try (InputStream is = newInputStream(dataSource, "_ME", "xml")) { return isCim14(is); } case SPLIT: - try (InputStream eqIs = dataSource.newInputStream("_EQ", "xml")) { // just test eq file to save time + try (InputStream eqIs = newInputStream(dataSource, "_EQ", "xml")) { // just test eq file to save time return isCim14(eqIs); } default: @@ -179,7 +179,7 @@ public boolean exists(ReadOnlyDataSource dataSource) { private CIMModel loadMergedModel(ReadOnlyDataSource dataSource, Reader bseqr, Reader bstpr) throws Exception { CIMModel model = new CIMModel(); - try (Reader mer = new UnicodeReader(dataSource.newInputStream("_ME", "xml"), null)) { + try (Reader mer = new UnicodeReader(newInputStream(dataSource, "_ME", "xml"), null)) { long startTime2 = System.currentTimeMillis(); @@ -195,9 +195,9 @@ private CIMModel loadMergedModel(ReadOnlyDataSource dataSource, Reader bseqr, Re private CIMModel loadSplitModel(ReadOnlyDataSource dataSource, Reader bseqr, Reader bstpr) throws Exception { CIMModel model = new CIMModel(); - try (Reader eqr = new UnicodeReader(dataSource.newInputStream("_EQ", "xml"), null); - Reader tpr = new UnicodeReader(dataSource.newInputStream("_TP", "xml"), null); - Reader svr = new UnicodeReader(dataSource.newInputStream("_SV", "xml"), null)) { + try (Reader eqr = new UnicodeReader(newInputStream(dataSource, "_EQ", "xml"), null); + Reader tpr = new UnicodeReader(newInputStream(dataSource, "_TP", "xml"), null); + Reader svr = new UnicodeReader(newInputStream(dataSource, "_SV", "xml"), null)) { long startTime2 = System.currentTimeMillis(); @@ -278,7 +278,7 @@ public Network import_(ReadOnlyDataSource dataSource, Properties parameters) { } CIM1NamingStrategyFactory namingStrategyFactory; - try (InputStream eqIs = dataSource.newInputStream("_EQ", "xml")) { // just test eq file to save time + try (InputStream eqIs = newInputStream(dataSource, "_EQ", "xml")) { // just test eq file to save time namingStrategyFactory = usePsseNamingStrategy && isPtiCim14(eqIs) ? new CIM1PSSENamingStrategyFactory() : new CIM1DefaultNamingStrategyFactory(); } @@ -301,4 +301,24 @@ public Network import_(ReadOnlyDataSource dataSource, Properties parameters) { return network; } + private String getBaseName(ReadOnlyDataSource dataSource) { + String basename = dataSource.getBaseName(); + if (basename.endsWith("_ME") || basename.endsWith("_EQ") || basename.endsWith("_TP") || basename.endsWith("_SV")) { + basename = basename.substring(0, basename.length() - 3); + } + + return basename; + } + + private InputStream newInputStream(ReadOnlyDataSource dataSource, String suffix, String ext) throws IOException { + String baseName = getBaseName(dataSource); + String fileName = DataSourceUtil.getFileName(baseName, suffix, ext); + return dataSource.newInputStream(fileName); + } + + private boolean exists(ReadOnlyDataSource dataSource, String suffix, String ext) throws IOException { + String baseName = getBaseName(dataSource); + String fileName = DataSourceUtil.getFileName(baseName, suffix, ext); + return dataSource.exists(fileName); + } } diff --git a/cim1-import/src/test/java/eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java b/cim1-import/src/test/java/eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java new file mode 100644 index 00000000..8849eaa0 --- /dev/null +++ b/cim1-import/src/test/java/eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) 2017, 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 eu.itesla_project.iidm.import_.cim1; + +import com.google.common.jimfs.Configuration; +import com.google.common.jimfs.Jimfs; +import eu.itesla_project.iidm.datasource.DataSource; +import eu.itesla_project.iidm.datasource.FileDataSource; +import eu.itesla_project.iidm.datasource.ReadOnlyDataSource; +import eu.itesla_project.iidm.datasource.ZipFileDataSource; +import org.apache.commons.io.IOUtils; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.FileSystem; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Properties; + +/** + * @author Mathieu Bague + */ +public class CIM1ImporterTest { + + private FileSystem fileSystem; + + private DataSource zdsMerged; + private DataSource zdsSplit; + private DataSource fdsMerged; + private DataSource fdsUnzippedMerged; + private DataSource fdsSplit; + private DataSource fdsUnzippedSplit; + + private void copyFile(DataSource dataSource, String filename) throws IOException { + try (OutputStream stream = dataSource.newOutputStream(filename, false)) { + IOUtils.copy(getClass().getResourceAsStream("/" + filename), stream); + } + } + + @Before + public void setUp() throws IOException { + fileSystem = Jimfs.newFileSystem(Configuration.unix()); + + Path test1 = Files.createDirectory(fileSystem.getPath("test1")); + fdsMerged = new FileDataSource(test1, "ieee14bus"); + fdsUnzippedMerged = new FileDataSource(test1, "ieee14bus_ME"); + copyFile(fdsMerged, "ieee14bus_ME.xml"); + copyFile(fdsMerged, "ENTSO-E_Boundary_Set_EU_EQ.xml"); + copyFile(fdsMerged, "ENTSO-E_Boundary_Set_EU_TP.xml"); + + Path test2 = Files.createDirectory(fileSystem.getPath("test2")); + zdsMerged = new ZipFileDataSource(test2, "ieee14bus"); + copyFile(zdsMerged, "ieee14bus_ME.xml"); + copyFile(fdsMerged, "ENTSO-E_Boundary_Set_EU_EQ.xml"); + copyFile(fdsMerged, "ENTSO-E_Boundary_Set_EU_TP.xml"); + + Path test3 = Files.createDirectory(fileSystem.getPath("test3")); + fdsSplit = new FileDataSource(test3, "ieee14bus"); + fdsUnzippedSplit = new FileDataSource(test3, "ieee14bus_EQ"); + copyFile(fdsSplit, "ieee14bus_EQ.xml"); + copyFile(fdsSplit, "ieee14bus_TP.xml"); + copyFile(fdsSplit, "ieee14bus_SV.xml"); + copyFile(fdsSplit, "ENTSO-E_Boundary_Set_EU_EQ.xml"); + copyFile(fdsSplit, "ENTSO-E_Boundary_Set_EU_TP.xml"); + + Path test4 = Files.createDirectory(fileSystem.getPath("test4")); + zdsSplit = new ZipFileDataSource(test4, "ieee14bus"); + copyFile(zdsSplit, "ieee14bus_EQ.xml"); + copyFile(zdsSplit, "ieee14bus_TP.xml"); + copyFile(zdsSplit, "ieee14bus_SV.xml"); + copyFile(zdsSplit, "ENTSO-E_Boundary_Set_EU_EQ.xml"); + copyFile(zdsSplit, "ENTSO-E_Boundary_Set_EU_TP.xml"); + } + + @After + public void tearDown() throws IOException { + fileSystem.close(); + } + + @Test + public void exists() + { + CIM1Importer importer = new CIM1Importer(); + Assert.assertEquals(true, importer.exists(fdsMerged)); + Assert.assertEquals(true, importer.exists(fdsUnzippedMerged)); + Assert.assertEquals(true, importer.exists(zdsMerged)); + Assert.assertEquals(true, importer.exists(fdsSplit)); + Assert.assertEquals(true, importer.exists(fdsUnzippedSplit)); + Assert.assertEquals(true, importer.exists(zdsSplit)); + } + + @Test + public void testImport() { + testImport(fdsMerged); + testImport(fdsUnzippedMerged); + testImport(fdsSplit); + testImport(fdsUnzippedSplit); + } + + private void testImport(ReadOnlyDataSource dataSource) { + CIM1Importer importer = new CIM1Importer(); + try { + importer.import_(dataSource, new Properties()); + Assert.fail(); + } catch (RuntimeException ignored) { + } + } +} diff --git a/cim1-import/src/test/resources/ENTSO-E_Boundary_Set_EU_EQ.xml b/cim1-import/src/test/resources/ENTSO-E_Boundary_Set_EU_EQ.xml new file mode 100644 index 00000000..04d23440 --- /dev/null +++ b/cim1-import/src/test/resources/ENTSO-E_Boundary_Set_EU_EQ.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/cim1-import/src/test/resources/ENTSO-E_Boundary_Set_EU_TP.xml b/cim1-import/src/test/resources/ENTSO-E_Boundary_Set_EU_TP.xml new file mode 100644 index 00000000..0c901a75 --- /dev/null +++ b/cim1-import/src/test/resources/ENTSO-E_Boundary_Set_EU_TP.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/cim1-import/src/test/resources/ieee14bus_EQ.xml b/cim1-import/src/test/resources/ieee14bus_EQ.xml new file mode 100644 index 00000000..3ee5fe18 --- /dev/null +++ b/cim1-import/src/test/resources/ieee14bus_EQ.xml @@ -0,0 +1,1323 @@ + + + + + 45000 + PATL + + + 0 + 0.099769 + 1 + + + BANK 9 + + + false + 0 + + 0 + + BANK 9_SC_RC + + + 1 + + BANK 9_SC_TE + + + 0 + 0.365778 + 0 + 0.156256 + + BUS 10-BUS 11-1 + + + 4183.7 + + + BUS 10-BUS 11-1_AC_CL + + + + BUS 10-BUS 11-1_AC_OLS + + + 2 + + BUS 10-BUS 11-1_AC_TE_EX + + + 1 + + BUS 10-BUS 11-1_AC_TE_OR + + + + BUS 10_SS + + + + + BUS 10_VL + + + + BUS 11_SS + + + + + BUS 11_VL + + + 0 + 0.380651 + 0 + 0.42072 + + BUS 12-BUS 13-1 + + + 4183.7 + + + BUS 12-BUS 13-1_AC_CL + + + + BUS 12-BUS 13-1_AC_OLS + + + 2 + + BUS 12-BUS 13-1_AC_TE_EX + + + 1 + + BUS 12-BUS 13-1_AC_TE_OR + + + + BUS 12_SS + + + + + BUS 12_VL + + + 0 + 0.662769 + 0 + 0.325519 + + BUS 13-BUS 14-1 + + + 4183.7 + + + BUS 13-BUS 14-1_AC_CL + + + + BUS 13-BUS 14-1_AC_OLS + + + 2 + + BUS 13-BUS 14-1_AC_TE_EX + + + 1 + + BUS 13-BUS 14-1_AC_TE_OR + + + + BUS 13_SS + + + + + BUS 13_VL + + + + BUS 14_SS + + + + + BUS 14_VL + + + 0 + 2.81708 + 0.00110901 + 0.922682 + + BUS 1-BUS 2-1 + + + 836.74 + + + BUS 1-BUS 2-1_AC_CL + + + + BUS 1-BUS 2-1_AC_OLS + + + 2 + + BUS 1-BUS 2-1_AC_TE_EX + + + 1 + + BUS 1-BUS 2-1_AC_TE_OR + + + 0 + 10.6189 + 0.0010334 + 2.57237 + + BUS 1-BUS 5-1 + + + 836.74 + + + BUS 1-BUS 5-1_AC_CL + + + + BUS 1-BUS 5-1_AC_OLS + + + 2 + + BUS 1-BUS 5-1_AC_TE_EX + + + 1 + + BUS 1-BUS 5-1_AC_TE_OR + + + + BUS 1_SS + + + + + BUS 1_VL + + + 0 + 9.42535 + 0.000919975 + 2.23719 + + BUS 2-BUS 3-1 + + + 836.74 + + + BUS 2-BUS 3-1_AC_CL + + + + BUS 2-BUS 3-1_AC_OLS + + + 2 + + BUS 2-BUS 3-1_AC_TE_EX + + + 1 + + BUS 2-BUS 3-1_AC_TE_OR + + + 0 + 8.3946 + 0.000714136 + 2.76662 + + BUS 2-BUS 4-1 + + + 836.74 + + + BUS 2-BUS 4-1_AC_CL + + + + BUS 2-BUS 4-1_AC_OLS + + + 2 + + BUS 2-BUS 4-1_AC_TE_EX + + + 1 + + BUS 2-BUS 4-1_AC_TE_OR + + + 0 + 8.27843 + 0.000726738 + 2.71139 + + BUS 2-BUS 5-1 + + + 836.74 + + + BUS 2-BUS 5-1_AC_CL + + + + BUS 2-BUS 5-1_AC_OLS + + + 2 + + BUS 2-BUS 5-1_AC_TE_EX + + + 1 + + BUS 2-BUS 5-1_AC_TE_OR + + + + BUS 2_SS + + + + + BUS 2_VL + + + 0 + 8.14274 + 0.000268851 + 3.19035 + + BUS 3-BUS 4-1 + + + 836.74 + + + BUS 3-BUS 4-1_AC_CL + + + + BUS 3-BUS 4-1_AC_OLS + + + 2 + + BUS 3-BUS 4-1_AC_TE_EX + + + 1 + + BUS 3-BUS 4-1_AC_TE_OR + + + + BUS 3_SS + + + + + BUS 3_VL + + + 0 + 2.00486 + 0 + 0.635593 + + BUS 4-BUS 5-1 + + + 836.74 + + + BUS 4-BUS 5-1_AC_CL + + + + BUS 4-BUS 5-1_AC_OLS + + + 2 + + BUS 4-BUS 5-1_AC_TE_EX + + + 1 + + BUS 4-BUS 5-1_AC_TE_OR + + + + BUS 4-BUS 7-1 + + + + 11 + 69 + 6 + 2 + 1 + BUS 4-BUS 7-1_RTC_OR + + + + + 0 + 0 + + 0 + 100 + 13.8 + 0 + + + + 4183.7 + + + BUS 4-BUS 7-1_TW_EX_CL + + + + BUS 4-BUS 7-1_TW_EX_OLS + + + 2 + + BUS 4-BUS 7-1_TW_EX_TE + + + + + 0 + -0 + + 0 + 100 + 69 + 9.9562 + + + + 836.74 + + + BUS 4-BUS 7-1_TW_OR_CL + + + + BUS 4-BUS 7-1_TW_OR_OLS + + + 1 + + BUS 4-BUS 7-1_TW_OR_TE + + + + BUS 4-BUS 9-1 + + + + 11 + 69 + 6 + 2 + 1 + BUS 4-BUS 9-1_RTC_OR + + + + + 0 + 0 + + 0 + 100 + 13.8 + 0 + + + + 4183.7 + + + BUS 4-BUS 9-1_TW_EX_CL + + + + BUS 4-BUS 9-1_TW_EX_OLS + + + 2 + + BUS 4-BUS 9-1_TW_EX_TE + + + + + 0 + -0 + + 0 + 100 + 69 + 26.4797 + + + + 836.74 + + + BUS 4-BUS 9-1_TW_OR_CL + + + + BUS 4-BUS 9-1_TW_OR_OLS + + + 1 + + BUS 4-BUS 9-1_TW_OR_TE + + + + BUS 4_SS + + + + + BUS 4_VL + + + + BUS 5-BUS 6-1 + + + + 11 + 69 + 6 + 2 + 1 + BUS 5-BUS 6-1_RTC_OR + + + + + 0 + 0 + + 0 + 100 + 13.8 + 0 + + + + 4183.7 + + + BUS 5-BUS 6-1_TW_EX_CL + + + + BUS 5-BUS 6-1_TW_EX_OLS + + + 2 + + BUS 5-BUS 6-1_TW_EX_TE + + + + + 0 + -0 + + 0 + 100 + 69 + 11.9987 + + + + 836.74 + + + BUS 5-BUS 6-1_TW_OR_CL + + + + BUS 5-BUS 6-1_TW_OR_OLS + + + 1 + + BUS 5-BUS 6-1_TW_OR_TE + + + + BUS 5_SS + + + + + BUS 5_VL + + + 0 + 0.378785 + 0 + 0.18088 + + BUS 6-BUS 11-1 + + + 4183.7 + + + BUS 6-BUS 11-1_AC_CL + + + + BUS 6-BUS 11-1_AC_OLS + + + 2 + + BUS 6-BUS 11-1_AC_TE_EX + + + 1 + + BUS 6-BUS 11-1_AC_TE_OR + + + 0 + 0.487165 + 0 + 0.23407 + + BUS 6-BUS 12-1 + + + 4183.7 + + + BUS 6-BUS 12-1_AC_CL + + + + BUS 6-BUS 12-1_AC_OLS + + + 2 + + BUS 6-BUS 12-1_AC_TE_EX + + + 1 + + BUS 6-BUS 12-1_AC_TE_OR + + + 0 + 0.248086 + 0 + 0.125976 + + BUS 6-BUS 13-1 + + + 4183.7 + + + BUS 6-BUS 13-1_AC_CL + + + + BUS 6-BUS 13-1_AC_OLS + + + 2 + + BUS 6-BUS 13-1_AC_TE_EX + + + 1 + + BUS 6-BUS 13-1_AC_TE_OR + + + + + BUS 6_VL + + + 0 + 0.33546 + 0 + 0 + + BUS 7-BUS 8-1 + + + 4183.7 + + + BUS 7-BUS 8-1_AC_CL + + + + BUS 7-BUS 8-1_AC_OLS + + + 2 + + BUS 7-BUS 8-1_AC_TE_EX + + + 1 + + BUS 7-BUS 8-1_AC_TE_OR + + + 0 + 0.209503 + 0 + 0 + + BUS 7-BUS 9-1 + + + 4183.7 + + + BUS 7-BUS 9-1_AC_CL + + + + BUS 7-BUS 9-1_AC_OLS + + + 2 + + BUS 7-BUS 9-1_AC_TE_EX + + + 1 + + BUS 7-BUS 9-1_AC_TE_OR + + + + + BUS 7_VL + + + + BUS 8_SS + + + + + BUS 8_VL + + + 0 + 0.160922 + 0 + 0.060579 + + BUS 9-BUS 10-1 + + + 4183.7 + + + BUS 9-BUS 10-1_AC_CL + + + + BUS 9-BUS 10-1_AC_OLS + + + 2 + + BUS 9-BUS 10-1_AC_TE_EX + + + 1 + + BUS 9-BUS 10-1_AC_TE_OR + + + 0 + 0.514912 + 0 + 0.242068 + + BUS 9-BUS 14-1 + + + 4183.7 + + + BUS 9-BUS 14-1_AC_CL + + + + BUS 9-BUS 14-1_AC_OLS + + + 2 + + BUS 9-BUS 14-1_AC_TE_EX + + + 1 + + BUS 9-BUS 14-1_AC_TE_OR + + + + + BUS 9_VL + + + false + 69 + 0 + + + false + 69 + 1 + + + false + 13.8 + 10 + + + false + 13.8 + 11 + + + false + 13.8 + 12 + + + false + 13.8 + 13 + + + false + 69 + 2 + + + false + 69 + 3 + + + false + 69 + 4 + + + false + 13.8 + 5 + + + false + 13.8 + 6 + + + false + 13.8 + 7 + + + false + 13.8 + 8 + + + false + 13.8 + 9 + + + 0 + 0 + _CA_1 + + + 0 + -9999 + 9999 + + GEN 1 + + + 0 + 0 + 0 + 1 + + + 0 + + 0 + + + GEN 1 + + + false + 0 + + 73.14 + + + + 1 + + GEN 1 + + + 0 + -9999 + 9999 + + GEN 2 + + + 0 + -40 + 0 + 1 + + + 0 + + 50 + + + GEN 2 + + + false + 0 + + 72.105 + + + + 1 + + GEN 2 + + + 0 + -9999 + 9999 + + GEN 3 + + + 0 + 0 + 0 + 1 + + + 0 + + 40 + + + GEN 3 + + + false + 0 + + 69.69 + + + + 1 + + GEN 3 + + + 0 + -9999 + 9999 + + GEN 6 + + + 0 + -6 + 0 + 1 + + + 0 + + 24 + + + GEN 6 + + + false + 0 + + 14.766 + + + + 1 + + GEN 6 + + + 0 + -9999 + 9999 + + GEN 8 + + + 0 + -6 + 0 + 1 + + + 0 + + 24 + + + GEN 8 + + + false + 0 + + 15.042 + + + + 1 + + GEN 8 + + + 01 + + + + + LOAD 10 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 10_EC_LRC + + + 1 + + LOAD 10_EC_TE + + + + + LOAD 11 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 11_EC_LRC + + + 1 + + LOAD 11_EC_TE + + + + + LOAD 12 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 12_EC_LRC + + + 1 + + LOAD 12_EC_TE + + + + + LOAD 13 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 13_EC_LRC + + + 1 + + LOAD 13_EC_TE + + + + + LOAD 14 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 14_EC_LRC + + + 1 + + LOAD 14_EC_TE + + + + + LOAD 2 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 2_EC_LRC + + + 1 + + LOAD 2_EC_TE + + + + + LOAD 3 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 3_EC_LRC + + + 1 + + LOAD 3_EC_TE + + + + + LOAD 4 + + + 0 + 1 + -0 + false + 0 + 0 + -0 + 1 + 0 + LOAD 4_EC_LRC + + + 1 + + LOAD 4_EC_TE + + + + + LOAD 5 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 5_EC_LRC + + + 1 + + LOAD 5_EC_TE + + + + + LOAD 6 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 6_EC_LRC + + + 1 + + LOAD 6_EC_TE + + + + + LOAD 9 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 9_EC_LRC + + + 1 + + LOAD 9_EC_TE + + + + 01 + + + + 45000 + PATL + + + + 45000 + PATL + + + IEC61970CIM14v02 + 2009-05-10 + + diff --git a/cim1-import/src/test/resources/ieee14bus_ME.xml b/cim1-import/src/test/resources/ieee14bus_ME.xml new file mode 100644 index 00000000..af929654 --- /dev/null +++ b/cim1-import/src/test/resources/ieee14bus_ME.xml @@ -0,0 +1,1704 @@ + + + + + 45000 + PATL + + + 0 + 0.099769 + 1 + + + BANK 9 + + + + 1 + + + false + 0 + + 0 + + BANK 9_SC_RC + + + 1 + + + true + BANK 9_SC_TE + + + 0 + 0.365778 + 0 + 0.156256 + + BUS 10-BUS 11-1 + + + 4183.7 + + + BUS 10-BUS 11-1_AC_CL + + + + BUS 10-BUS 11-1_AC_OLS + + + 2 + + + true + BUS 10-BUS 11-1_AC_TE_EX + + + 1 + + + true + BUS 10-BUS 11-1_AC_TE_OR + + + + BUS 10_SS + + + + + + + BUS 10 + + + + + BUS 10_VL + + + + BUS 11_SS + + + + + + + BUS 11 + + + + + BUS 11_VL + + + 0 + 0.380651 + 0 + 0.42072 + + BUS 12-BUS 13-1 + + + 4183.7 + + + BUS 12-BUS 13-1_AC_CL + + + + BUS 12-BUS 13-1_AC_OLS + + + 2 + + + true + BUS 12-BUS 13-1_AC_TE_EX + + + 1 + + + true + BUS 12-BUS 13-1_AC_TE_OR + + + + BUS 12_SS + + + + + + + BUS 12 + + + + + BUS 12_VL + + + 0 + 0.662769 + 0 + 0.325519 + + BUS 13-BUS 14-1 + + + 4183.7 + + + BUS 13-BUS 14-1_AC_CL + + + + BUS 13-BUS 14-1_AC_OLS + + + 2 + + + true + BUS 13-BUS 14-1_AC_TE_EX + + + 1 + + + true + BUS 13-BUS 14-1_AC_TE_OR + + + + BUS 13_SS + + + + + + + BUS 13 + + + + + BUS 13_VL + + + + BUS 14_SS + + + + + + + BUS 14 + + + + + BUS 14_VL + + + 0 + 2.81708 + 0.00110901 + 0.922682 + + BUS 1-BUS 2-1 + + + 836.74 + + + BUS 1-BUS 2-1_AC_CL + + + + BUS 1-BUS 2-1_AC_OLS + + + 2 + + + true + BUS 1-BUS 2-1_AC_TE_EX + + + 1 + + + true + BUS 1-BUS 2-1_AC_TE_OR + + + 0 + 10.6189 + 0.0010334 + 2.57237 + + BUS 1-BUS 5-1 + + + 836.74 + + + BUS 1-BUS 5-1_AC_CL + + + + BUS 1-BUS 5-1_AC_OLS + + + 2 + + + true + BUS 1-BUS 5-1_AC_TE_EX + + + 1 + + + true + BUS 1-BUS 5-1_AC_TE_OR + + + + BUS 1_SS + + + + + + + BUS 1 + + + + + BUS 1_VL + + + 0 + 9.42535 + 0.000919975 + 2.23719 + + BUS 2-BUS 3-1 + + + 836.74 + + + BUS 2-BUS 3-1_AC_CL + + + + BUS 2-BUS 3-1_AC_OLS + + + 2 + + + true + BUS 2-BUS 3-1_AC_TE_EX + + + 1 + + + true + BUS 2-BUS 3-1_AC_TE_OR + + + 0 + 8.3946 + 0.000714136 + 2.76662 + + BUS 2-BUS 4-1 + + + 836.74 + + + BUS 2-BUS 4-1_AC_CL + + + + BUS 2-BUS 4-1_AC_OLS + + + 2 + + + true + BUS 2-BUS 4-1_AC_TE_EX + + + 1 + + + true + BUS 2-BUS 4-1_AC_TE_OR + + + 0 + 8.27843 + 0.000726738 + 2.71139 + + BUS 2-BUS 5-1 + + + 836.74 + + + BUS 2-BUS 5-1_AC_CL + + + + BUS 2-BUS 5-1_AC_OLS + + + 2 + + + true + BUS 2-BUS 5-1_AC_TE_EX + + + 1 + + + true + BUS 2-BUS 5-1_AC_TE_OR + + + + BUS 2_SS + + + + + + + BUS 2 + + + + + BUS 2_VL + + + 0 + 8.14274 + 0.000268851 + 3.19035 + + BUS 3-BUS 4-1 + + + 836.74 + + + BUS 3-BUS 4-1_AC_CL + + + + BUS 3-BUS 4-1_AC_OLS + + + 2 + + + true + BUS 3-BUS 4-1_AC_TE_EX + + + 1 + + + true + BUS 3-BUS 4-1_AC_TE_OR + + + + BUS 3_SS + + + + + + + BUS 3 + + + + + BUS 3_VL + + + 0 + 2.00486 + 0 + 0.635593 + + BUS 4-BUS 5-1 + + + 836.74 + + + BUS 4-BUS 5-1_AC_CL + + + + BUS 4-BUS 5-1_AC_OLS + + + 2 + + + true + BUS 4-BUS 5-1_AC_TE_EX + + + 1 + + + true + BUS 4-BUS 5-1_AC_TE_OR + + + + BUS 4-BUS 7-1 + + + + 11 + 69 + 6 + 2 + 1 + BUS 4-BUS 7-1_RTC_OR + + + 5 + + + + + + 0 + 0 + + 0 + 100 + 13.8 + 0 + + + + 4183.7 + + + BUS 4-BUS 7-1_TW_EX_CL + + + + BUS 4-BUS 7-1_TW_EX_OLS + + + 2 + + + true + BUS 4-BUS 7-1_TW_EX_TE + + + + + 0 + -0 + + 0 + 100 + 69 + 9.9562 + + + + 836.74 + + + BUS 4-BUS 7-1_TW_OR_CL + + + + BUS 4-BUS 7-1_TW_OR_OLS + + + 1 + + + true + BUS 4-BUS 7-1_TW_OR_TE + + + + BUS 4-BUS 9-1 + + + + 11 + 69 + 6 + 2 + 1 + BUS 4-BUS 9-1_RTC_OR + + + 4 + + + + + + 0 + 0 + + 0 + 100 + 13.8 + 0 + + + + 4183.7 + + + BUS 4-BUS 9-1_TW_EX_CL + + + + BUS 4-BUS 9-1_TW_EX_OLS + + + 2 + + + true + BUS 4-BUS 9-1_TW_EX_TE + + + + + 0 + -0 + + 0 + 100 + 69 + 26.4797 + + + + 836.74 + + + BUS 4-BUS 9-1_TW_OR_CL + + + + BUS 4-BUS 9-1_TW_OR_OLS + + + 1 + + + true + BUS 4-BUS 9-1_TW_OR_TE + + + + BUS 4_SS + + + + + + + BUS 4 + + + + + BUS 4_VL + + + + BUS 5-BUS 6-1 + + + + 11 + 69 + 6 + 2 + 1 + BUS 5-BUS 6-1_RTC_OR + + + 3 + + + + + + 0 + 0 + + 0 + 100 + 13.8 + 0 + + + + 4183.7 + + + BUS 5-BUS 6-1_TW_EX_CL + + + + BUS 5-BUS 6-1_TW_EX_OLS + + + 2 + + + true + BUS 5-BUS 6-1_TW_EX_TE + + + + + 0 + -0 + + 0 + 100 + 69 + 11.9987 + + + + 836.74 + + + BUS 5-BUS 6-1_TW_OR_CL + + + + BUS 5-BUS 6-1_TW_OR_OLS + + + 1 + + + true + BUS 5-BUS 6-1_TW_OR_TE + + + + BUS 5_SS + + + + + + + BUS 5 + + + + + BUS 5_VL + + + 0 + 0.378785 + 0 + 0.18088 + + BUS 6-BUS 11-1 + + + 4183.7 + + + BUS 6-BUS 11-1_AC_CL + + + + BUS 6-BUS 11-1_AC_OLS + + + 2 + + + true + BUS 6-BUS 11-1_AC_TE_EX + + + 1 + + + true + BUS 6-BUS 11-1_AC_TE_OR + + + 0 + 0.487165 + 0 + 0.23407 + + BUS 6-BUS 12-1 + + + 4183.7 + + + BUS 6-BUS 12-1_AC_CL + + + + BUS 6-BUS 12-1_AC_OLS + + + 2 + + + true + BUS 6-BUS 12-1_AC_TE_EX + + + 1 + + + true + BUS 6-BUS 12-1_AC_TE_OR + + + 0 + 0.248086 + 0 + 0.125976 + + BUS 6-BUS 13-1 + + + 4183.7 + + + BUS 6-BUS 13-1_AC_CL + + + + BUS 6-BUS 13-1_AC_OLS + + + 2 + + + true + BUS 6-BUS 13-1_AC_TE_EX + + + 1 + + + true + BUS 6-BUS 13-1_AC_TE_OR + + + + + + + BUS 6 + + + + + BUS 6_VL + + + 0 + 0.33546 + 0 + 0 + + BUS 7-BUS 8-1 + + + 4183.7 + + + BUS 7-BUS 8-1_AC_CL + + + + BUS 7-BUS 8-1_AC_OLS + + + 2 + + + true + BUS 7-BUS 8-1_AC_TE_EX + + + 1 + + + true + BUS 7-BUS 8-1_AC_TE_OR + + + 0 + 0.209503 + 0 + 0 + + BUS 7-BUS 9-1 + + + 4183.7 + + + BUS 7-BUS 9-1_AC_CL + + + + BUS 7-BUS 9-1_AC_OLS + + + 2 + + + true + BUS 7-BUS 9-1_AC_TE_EX + + + 1 + + + true + BUS 7-BUS 9-1_AC_TE_OR + + + + + + + BUS 7 + + + + + BUS 7_VL + + + + BUS 8_SS + + + + + + + BUS 8 + + + + + BUS 8_VL + + + 0 + 0.160922 + 0 + 0.060579 + + BUS 9-BUS 10-1 + + + 4183.7 + + + BUS 9-BUS 10-1_AC_CL + + + + BUS 9-BUS 10-1_AC_OLS + + + 2 + + + true + BUS 9-BUS 10-1_AC_TE_EX + + + 1 + + + true + BUS 9-BUS 10-1_AC_TE_OR + + + 0 + 0.514912 + 0 + 0.242068 + + BUS 9-BUS 14-1 + + + 4183.7 + + + BUS 9-BUS 14-1_AC_CL + + + + BUS 9-BUS 14-1_AC_OLS + + + 2 + + + true + BUS 9-BUS 14-1_AC_TE_EX + + + 1 + + + true + BUS 9-BUS 14-1_AC_TE_OR + + + + + + + BUS 9 + + + + + BUS 9_VL + + + false + 69 + 0 + + + false + 69 + 1 + + + false + 13.8 + 10 + + + false + 13.8 + 11 + + + false + 13.8 + 12 + + + false + 13.8 + 13 + + + false + 69 + 2 + + + false + 69 + 3 + + + false + 69 + 4 + + + false + 13.8 + 5 + + + false + 13.8 + 6 + + + false + 13.8 + 7 + + + false + 13.8 + 8 + + + false + 13.8 + 9 + + + 0 + 0 + _CA_1 + + + 0 + -9999 + 9999 + + GEN 1 + + + 0 + 0 + 0 + 1 + + + 0 + + 0 + + + GEN 1 + + + false + 0 + + 73.14 + + + + 1 + + + true + GEN 1 + + + 0 + -9999 + 9999 + + GEN 2 + + + 0 + -40 + 0 + 1 + + + 0 + + 50 + + + GEN 2 + + + false + 0 + + 72.105 + + + + 1 + + + true + GEN 2 + + + 0 + -9999 + 9999 + + GEN 3 + + + 0 + 0 + 0 + 1 + + + 0 + + 40 + + + GEN 3 + + + false + 0 + + 69.69 + + + + 1 + + + true + GEN 3 + + + 0 + -9999 + 9999 + + GEN 6 + + + 0 + -6 + 0 + 1 + + + 0 + + 24 + + + GEN 6 + + + false + 0 + + 14.766 + + + + 1 + + + true + GEN 6 + + + 0 + -9999 + 9999 + + GEN 8 + + + 0 + -6 + 0 + 1 + + + 0 + + 24 + + + GEN 8 + + + false + 0 + + 15.042 + + + + 1 + + + true + GEN 8 + + + 01 + + + + + LOAD 10 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 10_EC_LRC + + + 1 + + + true + LOAD 10_EC_TE + + + + + LOAD 11 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 11_EC_LRC + + + 1 + + + true + LOAD 11_EC_TE + + + + + LOAD 12 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 12_EC_LRC + + + 1 + + + true + LOAD 12_EC_TE + + + + + LOAD 13 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 13_EC_LRC + + + 1 + + + true + LOAD 13_EC_TE + + + + + LOAD 14 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 14_EC_LRC + + + 1 + + + true + LOAD 14_EC_TE + + + + + LOAD 2 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 2_EC_LRC + + + 1 + + + true + LOAD 2_EC_TE + + + + + LOAD 3 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 3_EC_LRC + + + 1 + + + true + LOAD 3_EC_TE + + + + + LOAD 4 + + + 0 + 1 + -0 + false + 0 + 0 + -0 + 1 + 0 + LOAD 4_EC_LRC + + + 1 + + + true + LOAD 4_EC_TE + + + + + LOAD 5 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 5_EC_LRC + + + 1 + + + true + LOAD 5_EC_TE + + + + + LOAD 6 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 6_EC_LRC + + + 1 + + + true + LOAD 6_EC_TE + + + + + LOAD 9 + + + 0 + 1 + 0 + false + 0 + 0 + 0 + 1 + 0 + LOAD 9_EC_LRC + + + 1 + + + true + LOAD 9_EC_TE + + + + 01 + + + + -232.346 + 16.759 + + + + -40 + -42.4 + + + + 29.5 + 16.6 + + + + 9 + 5.8 + + + + 3.5 + 1.8 + + + + 6.1 + 1.6 + + + + 13.5 + 5.8 + + + + 14.9 + 5 + + + + -0 + -23.4 + + + + -0 + -12.2 + + + + -0 + -17.4 + + + + 21.7 + 12.7 + + + + 94.2 + 19 + + + + 47.8 + -3.9 + + + + 7.6 + 1.6 + + + + 11.2 + 7.5 + + + 0 + + 73.14 + + + -4.98 + + 72.105 + + + -14.79 + + 14.5866 + + + -15.07 + + 14.559 + + + -15.16 + + 14.49 + + + -16.04 + + 14.2968 + + + -12.72 + + 69.69 + + + -10.33 + + 70.311 + + + -8.78 + + 70.38 + + + -14.22 + + 14.766 + + + -13.37 + + 14.6556 + + + -13.36 + + 15.042 + + + -14.94 + + 14.5728 + + + -15.1 + + 14.5038 + + + + 45000 + PATL + + + + + + + 45000 + PATL + + + IEC61970CIM14v02 + 2009-05-10 + + diff --git a/cim1-import/src/test/resources/ieee14bus_SV.xml b/cim1-import/src/test/resources/ieee14bus_SV.xml new file mode 100644 index 00000000..e112da05 --- /dev/null +++ b/cim1-import/src/test/resources/ieee14bus_SV.xml @@ -0,0 +1,169 @@ + + + + + 1 + + + 5 + + + + 4 + + + + 3 + + + + + -232.346 + 16.759 + + + + -40 + -42.4 + + + + 29.5 + 16.6 + + + + 9 + 5.8 + + + + 3.5 + 1.8 + + + + 6.1 + 1.6 + + + + 13.5 + 5.8 + + + + 14.9 + 5 + + + + -0 + -23.4 + + + + -0 + -12.2 + + + + -0 + -17.4 + + + + 21.7 + 12.7 + + + + 94.2 + 19 + + + + 47.8 + -3.9 + + + + 7.6 + 1.6 + + + + 11.2 + 7.5 + + + 0 + + 73.14 + + + -4.98 + + 72.105 + + + -14.79 + + 14.5866 + + + -15.07 + + 14.559 + + + -15.16 + + 14.49 + + + -16.04 + + 14.2968 + + + -12.72 + + 69.69 + + + -10.33 + + 70.311 + + + -8.78 + + 70.38 + + + -14.22 + + 14.766 + + + -13.37 + + 14.6556 + + + -13.36 + + 15.042 + + + -14.94 + + 14.5728 + + + -15.1 + + 14.5038 + + diff --git a/cim1-import/src/test/resources/ieee14bus_TP.xml b/cim1-import/src/test/resources/ieee14bus_TP.xml new file mode 100644 index 00000000..8355c76b --- /dev/null +++ b/cim1-import/src/test/resources/ieee14bus_TP.xml @@ -0,0 +1,332 @@ + + + + true + + + + true + + + + true + + + + + + + + BUS 10 + + + + + + + BUS 11 + + + true + + + + true + + + + + + + + BUS 12 + + + true + + + + true + + + + + + + + BUS 13 + + + + + + + BUS 14 + + + true + + + + true + + + + true + + + + true + + + + + + + + BUS 1 + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + + + + + BUS 2 + + + true + + + + true + + + + + + + + BUS 3 + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + + + + + BUS 4 + + + true + + + + true + + + + + + + + BUS 5 + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + + + + + BUS 6 + + + true + + + + true + + + + true + + + + true + + + + + + + + BUS 7 + + + + + + + BUS 8 + + + true + + + + true + + + + true + + + + true + + + + + + + + BUS 9 + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + true + + + + + + From 1532dbfcead04e9679e1c8cf562cea323f5febd6 Mon Sep 17 00:00:00 2001 From: Mathieu Bague Date: Mon, 16 Jan 2017 15:49:34 +0100 Subject: [PATCH 2/3] Fix compilation --- pom.xml | 56 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index b52890b8..0c0e9d62 100644 --- a/pom.xml +++ b/pom.xml @@ -77,39 +77,40 @@ 1.1-ITESLA 1.0-ITESLA - 4.12 - 1.7.21 - 1.1.7 - 20.0 - 3.0.3 - 3.6.1 - 2.4 - 1.3.1 - 2.4.0 - 4.5.2 - 1.2.6 - 2.9.6 1.0-rc2 - 1.0 - 2.7.3 - 1.4.191 - 1.41.1_1 - 2.6 + 1.12 + 1.3.1 1.10 - 20160212 + 1.10 + 2.4 + 2.6 3.4 + 3.6.1 + 1.41.1_1 + 1.1 + 2.6.2 + 20.0 + 1.4.191 + 4.5.2 + 0.1-SNAPSHOT + 2.7.3 2.0 - 1.0 0.9.1 - 1.1 + 1.1 + 1.0 + 2.9.6 + 20160212 + 2.4 + 4.12 + 1.1.7 1.10.19 - 1.10 3.14 - 2.6.2 - 2.4 + 1.2.6 + 1.0 + 1.7.21 + 2.4.0 + 3.0.3 2.3.0 - 1.12 - 0.1-SNAPSHOT @@ -276,6 +277,11 @@ guava ${guava.version} + + com.google.jimfs + jimfs + ${jimfs.version} + commons-cli commons-cli From cdc15c7ad74ef3d02151a0dda718cf6cdbc59660 Mon Sep 17 00:00:00 2001 From: Mathieu BAGUE Date: Tue, 17 Jan 2017 11:00:15 +0100 Subject: [PATCH 3/3] Fix style --- .../eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cim1-import/src/test/java/eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java b/cim1-import/src/test/java/eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java index 8849eaa0..246c4533 100644 --- a/cim1-import/src/test/java/eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java +++ b/cim1-import/src/test/java/eu/itesla_project/iidm/import_/cim1/CIM1ImporterTest.java @@ -86,8 +86,7 @@ public void tearDown() throws IOException { } @Test - public void exists() - { + public void exists() { CIM1Importer importer = new CIM1Importer(); Assert.assertEquals(true, importer.exists(fdsMerged)); Assert.assertEquals(true, importer.exists(fdsUnzippedMerged));