From df3ba73669f4632df8e011782d2e15b0be1fce8e Mon Sep 17 00:00:00 2001 From: VEDELAGO MIORA Date: Fri, 11 Mar 2022 15:03:11 +0100 Subject: [PATCH] Fix: CGMES exporter and importer return a correct list in `getParameters()` Signed-off-by: VEDELAGO MIORA --- .../com/powsybl/cgmes/conversion/CgmesExport.java | 13 +++++++------ .../com/powsybl/cgmes/conversion/CgmesImport.java | 3 ++- .../test/export/CgmesExportContextTest.java | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesExport.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesExport.java index 65a8d237e79..6c4899ac222 100644 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesExport.java +++ b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesExport.java @@ -110,16 +110,21 @@ public String getFormat() { } public static final String BASE_NAME = "iidm.export.cgmes.base-name"; + public static final String CIM_VERSION = "iidm.export.cgmes.cim-version"; public static final String EXPORT_BOUNDARY_POWER_FLOWS = "iidm.export.cgmes.export-boundary-power-flows"; public static final String EXPORT_POWER_FLOWS_FOR_SWITCHES = "iidm.export.cgmes.export-power-flows-for-switches"; public static final String PROFILES = "iidm.export.cgmes.profiles"; - public static final String CIM_VERSION = "iidm.export.cgmes.cim-version"; private static final Parameter BASE_NAME_PARAMETER = new Parameter( BASE_NAME, ParameterType.STRING, "Basename for output files", null); + private static final Parameter CIM_VERSION_PARAMETER = new Parameter( + CIM_VERSION, + ParameterType.STRING, + "CIM version to export", + null); private static final Parameter EXPORT_BOUNDARY_POWER_FLOWS_PARAMETER = new Parameter( EXPORT_BOUNDARY_POWER_FLOWS, ParameterType.BOOLEAN, @@ -135,14 +140,10 @@ public String getFormat() { ParameterType.STRING_LIST, "Profiles to export", List.of("EQ", "TP", "SSH", "SV")); - private static final Parameter CIM_VERSION_PARAMETER = new Parameter( - CIM_VERSION, - ParameterType.STRING, - "CIM version to export", - null); private static final List STATIC_PARAMETERS = List.of( BASE_NAME_PARAMETER, + CIM_VERSION_PARAMETER, EXPORT_BOUNDARY_POWER_FLOWS_PARAMETER, EXPORT_POWER_FLOWS_FOR_SWITCHES_PARAMETER, PROFILES_PARAMETER); diff --git a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesImport.java b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesImport.java index de49fe7e4ca..b5832b75bd8 100644 --- a/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesImport.java +++ b/cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesImport.java @@ -329,12 +329,13 @@ private void copyStream(ReadOnlyDataSource from, DataSource to, String fromName, CHANGE_SIGN_FOR_SHUNT_REACTIVE_POWER_FLOW_INITIAL_STATE_PARAMETER, CONVERT_BOUNDARY_PARAMETER, CONVERT_SV_INJECTIONS_PARAMETER, - CREATE_CGMES_EXPORT_MAPPING_PARAMETER, CREATE_BUSBAR_SECTION_FOR_EVERY_CONNECTIVITY_NODE_PARAMETER, + CREATE_CGMES_EXPORT_MAPPING_PARAMETER, ENSURE_ID_ALIAS_UNICITY_PARAMETER, IMPORT_CONTROL_AREAS_PARAMETER, POST_PROCESSORS_PARAMETER, POWSYBL_TRIPLESTORE_PARAMETER, + PROFILE_FOR_INITIAL_VALUES_SHUNT_SECTIONS_TAP_POSITIONS_PARAMETER, STORE_CGMES_CONVERSION_CONTEXT_AS_NETWORK_EXTENSION_PARAMETER, STORE_CGMES_MODEL_AS_NETWORK_EXTENSION_PARAMETER); diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesExportContextTest.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesExportContextTest.java index 5ebdc5bd22a..df784a90a67 100644 --- a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesExportContextTest.java +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesExportContextTest.java @@ -38,7 +38,7 @@ public class CgmesExportContextTest { public void testExporter() { var exporter = new CgmesExport(); assertEquals("ENTSO-E CGMES version 2.4.15", exporter.getComment()); - assertEquals(4, exporter.getParameters().size()); + assertEquals(5, exporter.getParameters().size()); } @Test