Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extensions getter to Importer #3067

Merged
merged 60 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
9741222
Add extensions getter to Importer
geofjamg Jun 17, 2024
344d97b
Add unit tests
geofjamg Jun 19, 2024
46b2bdf
Fix code duplication
geofjamg Jun 19, 2024
68a4b98
Merge branch 'main' into importer_extensions
geofjamg Jun 19, 2024
82e413b
Generic Area model in IIDM (#2955)
m-guibert Jun 19, 2024
4fd72a1
CGMES export: handle quick CGM export for SSHs and SV (#2927)
zamarrenolm Jun 19, 2024
9511a0d
Allow to use checkLimits methods with LimitReductions (#3056)
EtienneLt Jun 19, 2024
011f2e0
Support of condensers (#3065)
flo-dup Jun 19, 2024
27f39d0
Support ActivePowerControl extension v1.2 only since IIDM v1.13 (#3068)
olperr1 Jun 19, 2024
c24f8d1
Bump to v6.4.0-RC1
olperr1 Jun 19, 2024
f79a54d
Bump to v6.5.0-SNAPSHOT
olperr1 Jun 19, 2024
d15f6c4
Fix exception for connectable not found in Network Modification conne…
rolnico Jun 20, 2024
d1097ee
Introduce OdreConfig to be more flexible with column name changes (#3…
olperr1 Jun 20, 2024
d73fa95
ODRE data post-processing: Replace super-csv by apache commons-csv (#…
olperr1 Jun 20, 2024
309d05e
Fix ReferenceTerminals and SlackTerminal iIDM extension with merged n…
jeandemanged Jun 21, 2024
573a27c
TerminalsConnectionAction: fix javadoc (#3079)
annetill Jun 24, 2024
7e4fb45
Fix area listeners when merging and detaching Networks (#3081)
jeandemanged Jun 24, 2024
6701804
Fix omission of styles.css (#3064)
So-Fras Jun 24, 2024
cb5b396
Fix VoltageRegulation extension XSDs for compatibility (#3083)
olperr1 Jun 27, 2024
20478c3
Allow zero value for limits in loading limits (#3061)
nao1345678 Jun 27, 2024
09042bf
`ActivePowerControl` extension: Rename optional fields min/maxPOverri…
vidaldid-rte Jun 28, 2024
e1fac99
Add connect/disconnect on Tie Lines and HVDC Lines (#3072)
rolnico Jun 28, 2024
70ae502
Fix regression on assert command for tool tests (#3088)
rolnico Jun 28, 2024
a59d652
Upgrade math native to 1.4.0 (#3089)
geofjamg Jun 28, 2024
3b70ef0
CGMES: Fix equivalent injection missing regulation target (#3087)
zamarrenolm Jun 28, 2024
3bfc53e
Matpower: fix pv buses (#3003)
marqueslanauja Jul 1, 2024
da44759
Open setters for all properties in PsseTransformerWinding class (#3091)
rygx Jul 4, 2024
a0a2e9a
TCK: remove reference comparison for TapChangers step (#3090)
AbdelHedhili Jul 9, 2024
1f079a6
Fix: Update TapChanger neutralPosition after using a stepsReplacer (#…
AbdelHedhili Jul 9, 2024
d1b9269
Make method to compute hvdc line losses public (#3098)
annetill Jul 10, 2024
3075dea
CGMES export: report multiple model identifiers (#3093)
zamarrenolm Jul 11, 2024
e743988
CGMES metadata models: allow clear of supersedes (#3099)
zamarrenolm Jul 11, 2024
cc4cfa9
Rename Area acInterchangeTarget to interchangeTarget (#3095)
jeandemanged Jul 11, 2024
18ca455
Documentation: add special SVGs for dark mode (#3104)
colinepiloquet Jul 18, 2024
9111c59
Datasources: Rework datasource classes (#3101)
rolnico Jul 19, 2024
6612eea
[Short-circuit API] Add some javadoc (#3096)
colinepiloquet Jul 22, 2024
906d5fa
[Network modification] Modify log when no extension is created. (#3100)
colinepiloquet Jul 22, 2024
5bbc511
CGMES export of regulating controls (#2995)
nemanja-st Jul 25, 2024
ccda94f
Datasources - Part 2: data extension and builder (#3102)
rolnico Aug 1, 2024
5ce89f4
Datasources - part 3: TarArchiveDataSource (#3103)
rolnico Aug 2, 2024
2de7a0a
Quality: code cleaning (#2975)
EtienneLt Aug 5, 2024
05d2ec3
Docs: fix bad edge 7-8 and bad dotted edge 5-6 and make edges follow …
jonenst Aug 5, 2024
ce4be01
Datasources - part 5: fixes (#3114)
rolnico Aug 9, 2024
d6a71fe
UCTE Importer: create IIDM Areas (#3097)
jeandemanged Aug 21, 2024
ee90894
Documentation about limit reductions (#3119)
olperr1 Aug 28, 2024
73baf58
Create setters for temporary limits (#3113)
nao1345678 Aug 28, 2024
8c98c02
Limits copier (#3116)
nao1345678 Aug 28, 2024
b70d8f0
Add Overload Management System documentation (#3110)
bc-rte Sep 3, 2024
e8d8a13
CompletableFutureTask, fix spurious error logging when cancelling (#3…
jonenst Sep 6, 2024
8fb8cbd
Create directory for resources in TestPlatformConfigProvider (#3136)
rolnico Sep 9, 2024
bae7c6d
Distinguish between line and 2 windings transformer in TerminalFinder…
FranckLecuyer Sep 9, 2024
72b5296
Documentation wording corrections (#3124)
colinepiloquet Sep 11, 2024
faacf1f
Add anchors in the documentation (#3126)
colinepiloquet Sep 11, 2024
ad619aa
Fix CGM export dependencies issues (#3128)
rcourtier Sep 16, 2024
1a935cb
Fix CGMES importer documentation of parameter cgm-with-subnetworks-de…
jeandemanged Sep 17, 2024
b0ce0f5
Fix
geofjamg Sep 18, 2024
2f0593b
Merge branch 'main' into importer_extensions
geofjamg Sep 18, 2024
6c84801
Improve test
geofjamg Sep 18, 2024
4e8ca9e
Fix
geofjamg Sep 18, 2024
afd7e9f
Merge branch 'main' into importer_extensions
olperr1 Sep 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public String getFormat() {
return FORMAT;
}

@Override
public List<String> getSupportedExtensions() {
return List.of("xml");
}

@Override
public Network importData(ReadOnlyDataSource ds, NetworkFactory networkFactory, Properties p, ReportNode reportNode) {
Objects.requireNonNull(ds);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* 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.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import com.powsybl.cgmes.conversion.CgmesImport;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.List;

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

/**
* @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>}
*/
class CgmesImporterMetaInfoTest {

@Test
void test() throws IOException {
try (var fs = Jimfs.newFileSystem(Configuration.unix())) {
var importer = new CgmesImport(new InMemoryPlatformConfig(fs));
assertEquals("CGMES", importer.getFormat());
assertEquals("ENTSO-E CGMES version 2.4.15", importer.getComment());
assertEquals(List.of("xml"), importer.getSupportedExtensions());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public String getFormat() {
return FORMAT;
}

@Override
public List<String> getSupportedExtensions() {
return List.of(EXT);
}

@Override
public List<Parameter> getParameters() {
return Collections.singletonList(IGNORE_BASE_VOLTAGE_PARAMETER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

import static com.powsybl.commons.test.ComparisonUtils.assertXmlEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -40,6 +41,7 @@ void baseTest() {
Importer importer = new IeeeCdfImporter();
assertEquals("IEEE-CDF", importer.getFormat());
assertEquals("IEEE Common Data Format to IIDM converter", importer.getComment());
assertEquals(List.of("txt"), importer.getSupportedExtensions());
assertEquals(1, importer.getParameters().size());
assertEquals("ignore-base-voltage", importer.getParameters().get(0).getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public String getFormat() {
return importer.getFormat();
}

@Override
public List<String> getSupportedExtensions() {
return importer.getSupportedExtensions();
}

@Override
public List<Parameter> getParameters() {
return importer.getParameters();
Expand Down Expand Up @@ -276,6 +281,10 @@ static Importer find(ReadOnlyDataSource dataSource) {
*/
String getFormat();

default List<String> getSupportedExtensions() {
olperr1 marked this conversation as resolved.
Show resolved Hide resolved
return Collections.emptyList();
}

/**
* Get a description of import parameters
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.List;
import java.util.Properties;

/**
Expand All @@ -26,6 +27,11 @@ public String getFormat() {
return "TST";
}

@Override
public List<String> getSupportedExtensions() {
return List.of("tst");
}

@Override
public String getComment() {
return "Dummy importer to test Importers";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
import java.util.*;
import java.util.function.Supplier;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -106,6 +103,11 @@ private String findExtension(ReadOnlyDataSource dataSource) throws IOException {

protected abstract String[] getExtensions();

@Override
public List<String> getSupportedExtensions() {
return Arrays.asList(getExtensions());
}

@Override
public boolean exists(ReadOnlyDataSource dataSource) {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* 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.iidm.serde;

import org.junit.jupiter.api.Test;

import java.util.List;

import static com.powsybl.iidm.serde.IidmSerDeConstants.CURRENT_IIDM_VERSION;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>}
*/
class BinaryImporterTest {

@Test
void testMetaInfos() {
var importer = new BinaryImporter();
assertEquals("BIIDM", importer.getFormat());
assertEquals("IIDM binary v " + CURRENT_IIDM_VERSION.toString(".") + " importer", importer.getComment());
assertEquals(List.of("biidm", "bin"), importer.getSupportedExtensions());
assertEquals(5, importer.getParameters().size());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* 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.iidm.serde;

import org.junit.jupiter.api.Test;

import java.util.List;

import static com.powsybl.iidm.serde.IidmSerDeConstants.CURRENT_IIDM_VERSION;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>}
*/
class JsonImporterTest {

@Test
void testMetaInfos() {
var importer = new JsonImporter();
assertEquals("JIIDM", importer.getFormat());
assertEquals("IIDM JSON v " + CURRENT_IIDM_VERSION.toString(".") + " importer", importer.getComment());
assertEquals(List.of("jiidm", "json"), importer.getSupportedExtensions());
assertEquals(5, importer.getParameters().size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;

import static com.powsybl.commons.test.TestUtil.normalizeLineSeparator;
Expand Down Expand Up @@ -132,22 +133,15 @@ void backwardCompatibilityTest() throws IOException {
}

@Test
void getFormat() {
void testMetaInfos() {
assertEquals("XIIDM", importer.getFormat());
}

@Test
void getParameters() {
assertEquals("IIDM XML v " + CURRENT_IIDM_VERSION.toString(".") + " importer", importer.getComment());
assertEquals(List.of("xiidm", "iidm", "xml"), importer.getSupportedExtensions());
assertEquals(5, importer.getParameters().size());
assertEquals("iidm.import.xml.throw-exception-if-extension-not-found", importer.getParameters().get(0).getName());
assertEquals(Arrays.asList("iidm.import.xml.throw-exception-if-extension-not-found", "throwExceptionIfExtensionNotFound"), importer.getParameters().get(0).getNames());
}

@Test
void getComment() {
assertEquals("IIDM XML v " + CURRENT_IIDM_VERSION.toString(".") + " importer", importer.getComment());
}

@Test
void exists() {
assertTrue(importer.exists(new DirectoryDataSource(fileSystem.getPath("/"), "test0")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,11 @@ public String getFormat() {
return MatpowerConstants.FORMAT;
}

@Override
public List<String> getSupportedExtensions() {
return Collections.singletonList(MatpowerConstants.EXT);
}

@Override
public void copy(ReadOnlyDataSource fromDataSource, DataSource toDataSource) {
Objects.requireNonNull(fromDataSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.time.Month;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Properties;

import static com.powsybl.commons.test.ComparisonUtils.assertXmlEquals;
Expand All @@ -50,6 +51,7 @@ void baseTest() {
Importer importer = new MatpowerImporter();
assertEquals("MATPOWER", importer.getFormat());
assertEquals("MATPOWER Format to IIDM converter", importer.getComment());
assertEquals(List.of("mat"), importer.getSupportedExtensions());
assertEquals(1, importer.getParameters().size());
assertEquals("matpower.import.ignore-base-voltage", importer.getParameters().get(0).getName());
}
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,11 @@
<artifactId>powsybl-powerfactory-dgs</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-powerfactory-db</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-powerfactory-converter</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions powerfactory/powerfactory-converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,10 @@
<artifactId>powsybl-powerfactory-dgs</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-powerfactory-db</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public String getFormat() {
return FORMAT;
}

@Override
public List<String> getSupportedExtensions() {
return PowerFactoryDataLoader.find(StudyCase.class).stream().map(PowerFactoryDataLoader::getExtension).toList();
}

@Override
public String getComment() {
return "PowerFactory to IIDM converter";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

Expand All @@ -44,6 +45,7 @@ void testBase() {
assertEquals("POWER-FACTORY", importer.getFormat());
assertTrue(importer.getParameters().isEmpty());
assertEquals("PowerFactory to IIDM converter", importer.getComment());
assertEquals(List.of("json", "dgs", "properties"), importer.getSupportedExtensions());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public String getFormat() {
return FORMAT;
}

@Override
public List<String> getSupportedExtensions() {
return Arrays.asList(EXTENSIONS);
}

@Override
public List<Parameter> getParameters() {
return Collections.singletonList(IGNORE_BASE_VOLTAGE_PARAMETER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Properties;

import static com.powsybl.commons.test.ComparisonUtils.assertXmlEquals;
Expand All @@ -44,6 +45,7 @@ void baseTest() {
Importer importer = new PsseImporter();
assertEquals("PSS/E", importer.getFormat());
assertEquals("PSS/E Format to IIDM converter", importer.getComment());
assertEquals(List.of("raw", "RAW", "rawx", "RAWX"), importer.getSupportedExtensions());
assertEquals(1, importer.getParameters().size());
assertEquals("psse.import.ignore-base-voltage", importer.getParameters().get(0).getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,11 @@ public String getFormat() {
return "UCTE";
}

@Override
public List<String> getSupportedExtensions() {
return Arrays.asList(EXTENSIONS);
}

@Override
public String getComment() {
return "UCTE-DEF";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
*/
package com.powsybl.ucte.converter;

import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import com.powsybl.commons.datasource.ReadOnlyDataSource;
import com.powsybl.commons.datasource.ResourceDataSource;
import com.powsybl.commons.datasource.ResourceSet;
Expand All @@ -18,6 +21,7 @@
import com.powsybl.ucte.converter.util.UcteConstants;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.List;
import java.util.Properties;
import java.util.Set;
Expand Down Expand Up @@ -345,4 +349,14 @@ void testDontCreateAreas() {
assertEquals(0, network.getAreaTypeCount());
assertEquals(0, network.getAreaCount());
}

@Test
void testMetaInfos() throws IOException {
try (var fs = Jimfs.newFileSystem(Configuration.unix())) {
var importer = new UcteImporter(new InMemoryPlatformConfig(fs));
assertEquals("UCTE", importer.getFormat());
assertEquals("UCTE-DEF", importer.getComment());
assertEquals(List.of("uct", "UCT"), importer.getSupportedExtensions());
}
}
}