From 993a98eb9df5ad3b2a2cc80a933324ab529c9a20 Mon Sep 17 00:00:00 2001 From: miovd Date: Mon, 18 Jul 2022 12:58:54 +0200 Subject: [PATCH] Read base URI if present during CGMES triplestore import and apply to all files (#2197) Signed-off-by: VEDELAGO MIORA Co-authored-by: Luma --- .../CgmesConformity1ModifiedCatalog.java | 20 + ...MicroGridTestConfiguration_BC_BE_EQ_V2.xml | 2200 +++++++++++++++++ ...gmesConformity1ModifiedConversionTest.java | 7 + .../cgmes/model/CgmesOnDataSource.java | 25 +- .../powsybl/cgmes/model/NamespaceReader.java | 21 + .../cgmes/model/NamespaceReaderTest.java | 35 + .../empty_cim16_EQ_with_explicitBase.xml | 3 + 7 files changed, 2305 insertions(+), 6 deletions(-) create mode 100644 cgmes/cgmes-conformity/src/main/resources/conformity-modified/cas-1.1.3-data-4.0.3/MicroGrid/BaseCase/BC_BE_v2_explicitBase/MicroGridTestConfiguration_BC_BE_EQ_V2.xml create mode 100644 cgmes/cgmes-model/src/test/java/com/powsybl/cgmes/model/NamespaceReaderTest.java create mode 100644 cgmes/cgmes-model/src/test/resources/empty_cim16_EQ_with_explicitBase.xml diff --git a/cgmes/cgmes-conformity/src/main/java/com/powsybl/cgmes/conformity/CgmesConformity1ModifiedCatalog.java b/cgmes/cgmes-conformity/src/main/java/com/powsybl/cgmes/conformity/CgmesConformity1ModifiedCatalog.java index 834bcc7e8ea..348b4f877d7 100644 --- a/cgmes/cgmes-conformity/src/main/java/com/powsybl/cgmes/conformity/CgmesConformity1ModifiedCatalog.java +++ b/cgmes/cgmes-conformity/src/main/java/com/powsybl/cgmes/conformity/CgmesConformity1ModifiedCatalog.java @@ -19,6 +19,26 @@ public final class CgmesConformity1ModifiedCatalog { private CgmesConformity1ModifiedCatalog() { } + public static TestGridModelResources microGridBaseCaseBEExplicitBase() { + String base = ENTSOE_CONFORMITY_1_MODIFIED + + "/MicroGrid/BaseCase/BC_BE_v2_explicitBase/"; + String baseOriginal = ENTSOE_CONFORMITY_1 + + "/MicroGrid/BaseCase/CGMES_v2.4.15_MicroGridTestConfiguration_BC_BE_v2/"; + String baseBoundary = ENTSOE_CONFORMITY_1 + + "/MicroGrid/BaseCase/CGMES_v2.4.15_MicroGridTestConfiguration_BD_v2/"; + return new TestGridModelResources( + "MicroGrid-BaseCase-BE-explicitBase", + null, + new ResourceSet(base, + "MicroGridTestConfiguration_BC_BE_EQ_V2.xml"), + new ResourceSet(baseOriginal, + "MicroGridTestConfiguration_BC_BE_SSH_V2.xml", + "MicroGridTestConfiguration_BC_BE_SV_V2.xml", + "MicroGridTestConfiguration_BC_BE_TP_V2.xml"), + new ResourceSet(baseBoundary, "MicroGridTestConfiguration_EQ_BD.xml", + "MicroGridTestConfiguration_TP_BD.xml")); + } + public static TestGridModelResources microGridBaseCaseBERatioPhaseTapChangerTabular() { String base = ENTSOE_CONFORMITY_1_MODIFIED + "/MicroGrid/BaseCase/BC_BE_v2_rtc_ptc_tabular/"; diff --git a/cgmes/cgmes-conformity/src/main/resources/conformity-modified/cas-1.1.3-data-4.0.3/MicroGrid/BaseCase/BC_BE_v2_explicitBase/MicroGridTestConfiguration_BC_BE_EQ_V2.xml b/cgmes/cgmes-conformity/src/main/resources/conformity-modified/cas-1.1.3-data-4.0.3/MicroGrid/BaseCase/BC_BE_v2_explicitBase/MicroGridTestConfiguration_BC_BE_EQ_V2.xml new file mode 100644 index 00000000000..04c98580611 --- /dev/null +++ b/cgmes/cgmes-conformity/src/main/resources/conformity-modified/cas-1.1.3-data-4.0.3/MicroGrid/BaseCase/BC_BE_v2_explicitBase/MicroGridTestConfiguration_BC_BE_EQ_V2.xml @@ -0,0 +1,2200 @@ + + + + + 2014-10-24T11:42:40 + 2014-06-01T10:30:00 + 2 + + CGMES Conformity Assessment: 'MicroGridTestConfiguration....BC (MAS BE) Test Configuration. The model is owned by ENTSO-E and is provided by ENTSO-E “as it is”. To the fullest extent permitted by law, ENTSO-E shall not be liable for any damages of any kind arising out of the use of the model (including any of its subsequent modifications). ENTSO-E neither warrants, nor represents that the use of the model will not infringe the rights of third parties. Any use of the model shall include a reference to ENTSO-E. ENTSO-E web site is the only official source of information related to the model. + http://elia.be/CGMES/2.4.15 + http://entsoe.eu/CIM/EquipmentCore/3/1 + http://entsoe.eu/CIM/EquipmentShortCircuit/3/1 + + + BE-Line_1 + BE-L_1 + 10T-AT-DE-000061 + 10T-AT-DE-000061 + + 2.200000 + 68.200000 + 0.0000829380 + 22.000000 + 0.0000308000 + false + + 6.600000 + 204.600000 + 0.0000262637 + 0.0000308000 + 160.0000000000 + + + BE-Line_2 + BE-L_2 + 10T-AT-DE-00010A + 10T-AT-DE-00010A + + 1.935000 + 34.200000 + 0.0000424115 + 45.000000 + 0.0000675000 + true + + 3.195000 + 102.600000 + 0.0000664447 + 0.0000675000 + 160.0000000000 + + + BE-Line_3 + BE-L_3 + 10T-AT-DE-00008Y + 10T-AT-DE-00008Y + + 1.050000 + 12.000000 + 0.0001498540 + 30.000000 + 0.0000600000 + false + + 3.150000 + 36.000000 + 0.0000292168 + 0.0000600000 + 160.0000000000 + + + BE-Line_4 + BE-L_4 + to be connected to the boundary set + + 0.240000 + 2.000000 + 0.0000251956 + 40.000000 + 0.0000400000 + false + + 0.720000 + 6.000000 + 0.0000628319 + 0.0000400000 + 160.0000000000 + + + BE-Line_5 + BE-L_5 + 10T-AT-DE-00009W + 10T-AT-DE-00009W + + 0.420000 + 6.300000 + 0.0000659734 + 35.000000 + 0.0000420000 + false + + 1.260000 + 18.900000 + 0.0000340863 + 0.0000420000 + 160.0000000000 + + + BE-Line_6 + BE-L_6 + TYNDP project BE-4; map reference 567 + + 5.203000 + 71.000000 + 0.0000200119 + 100.000000 + 0.0001200000 + true + + 15.000000 + 213.000000 + 0.0001476549 + 0.0001200000 + 160.0000000000 + + + BE-Line_7 + BE-L_7 + 10T-AT-DE-000061 + 10T-AT-DE-000061 + + 4.600000 + 69.000000 + 0.0000216770 + 23.000000 + 0.0000575000 + false + + 13.800000 + 207.000000 + 0.0000289027 + 0.0000575000 + 160.0000000000 + + + 10.50 + Base Voltage Level + 10.50 + 10.50 kV + + + 110.00 + Base Voltage Level + 110.00 + 110.00 kV + + + 21.00 + Base Voltage Level + 21.00 + 21.00 kV + + + BE-Busbar_1 + + 0e+000 + + + BE-Busbar_2 + + 0e+000 + + + BE-Busbar_3 + + 0e+000 + + + BE-Busbar_4 + + 0e+000 + + + BE-Busbar_6 + + 5000.000000 + + + N1230992288 + + 0e+000 + + + N1230992291 + + 0e+000 + + + N1230992411 + + 0e+000 + + + N1230992414 + + 0e+000 + + + 90 + CL-2 + Ratings for element BE-Line_7 - Limit + 1062.000000 + + + + + 90 + CL-2 + Ratings for element BE-Line_7 - Limit + 1062.000000 + + + + + 90 + CL-2 + Ratings for element BE-Line_6 - Limit + 1062.000000 + + + + + 90 + CL-2 + Ratings for element BE-Line_6 - Limit + 1062.000000 + + + + + 90 + CL-2 + Ratings for element BE-Line_5 - Limit + 1623.600000 + + + + + 90 + CL-2 + Ratings for element BE-Line_5 - Limit + 1623.600000 + + + + + 90 + CL-2 + Ratings for element BE-Line_4 - Limit + 1103.400000 + + + + + 90 + CL-2 + Ratings for element BE-Line_4 - Limit + 1103.400000 + + + + + 90 + CL-2 + Ratings for element BE-Line_3 - Limit + 1233.900000 + + + + + 90 + CL-2 + Ratings for element BE-Line_3 - Limit + 1233.900000 + + + + + 90 + CL-2 + Ratings for element BE-Line_2 - Limit + 1298.700000 + + + + + 90 + CL-5 + Ratings for element BE-Line_2 - Limit + 1800.000000 + + + + + 90 + CL-2 + Ratings for element BE-Line_2 - Limit + 1298.700000 + + + + + 90 + CL-5 + Ratings for element BE-Line_2 - Limit + 1800.000000 + + + + + 90 + CL-2 + Ratings for element BE-Line_1 - Limit + 1298.700000 + + + + + 90 + CL-2 + Ratings for element BE-Line_1 - Limit + 1298.700000 + + + + + 90 + CL-2 + Ratings for element BE-TR2_1 - Limit + 844.380000 + + + + + 90 + CL-2 + Ratings for element BE-TR2_1 - Limit + 3070.440000 + + + + + 90 + CL-2 + Ratings for element BE-TR2_2 - Limit + 1535.220000 + + + + + 90 + CL-2 + Ratings for element BE-TR2_2 - Limit + 3070.440000 + + + + + 90 + CL-2 + Ratings for element BE-TR2_3 - Limit + 1177.290000 + + + + + 90 + CL-2 + Ratings for element BE-TR2_3 - Limit + 12371.760000 + + + + + 90 + CL-2 + Ratings for element BE-TR3_1 - Limit + 844.380000 + + + + + 90 + CL-2 + Ratings for element BE-TR3_1 - Limit + 1535.220000 + + + + + 90 + CL-2 + Ratings for element BE-TR3_1 - Limit + 16083.360000 + + + + + BE-Line_1 - CL-0 + CL-0 + Ratings for element BE-Line_1 - Limit + 1574.000000 + + + + + BE-Line_1 - CL-0 + CL-0 + Ratings for element BE-Line_1 - Limit + 1574.000000 + + + + + BE-Line_1 - CL-1 + CL-1 + Ratings for element BE-Line_1 - Limit + 1705.000000 + + + + + BE-Line_1 - CL-1 + CL-1 + Ratings for element BE-Line_1 - Limit + 1705.000000 + + + + + BE-Line_1 - CL-2 + CL-2 + Ratings for element BE-Line_1 - Limit + 1443.000000 + + + + + BE-Line_1 - CL-2 + CL-2 + Ratings for element BE-Line_1 - Limit + 1443.000000 + + + + + BE-Line_1 - CL-3 + CL-3 + Ratings for element BE-Line_1 - Limit + 1550.000000 + + + + + BE-Line_1 - CL-3 + CL-3 + Ratings for element BE-Line_1 - Limit + 1550.000000 + + + + + BE-Line_1 - CL-4 + CL-4 + Ratings for element BE-Line_1 - Limit + 1500.000000 + + + + + BE-Line_1 - CL-4 + CL-4 + Ratings for element BE-Line_1 - Limit + 1500.000000 + + + + + BE-Line_2 - CL-0 + CL-0 + Ratings for element BE-Line_2 - Limit + 1574.000000 + + + + + BE-Line_2 - CL-0 + CL-0 + Ratings for element BE-Line_2 - Limit + 1574.000000 + + + + + BE-Line_2 - CL-1 + CL-1 + Ratings for element BE-Line_2 - Limit + 1705.000000 + + + + + BE-Line_2 - CL-1 + CL-1 + Ratings for element BE-Line_2 - Limit + 1705.000000 + + + + + BE-Line_2 - CL-2 + CL-2 + Ratings for element BE-Line_2 - Limit + 1443.000000 + + + + + BE-Line_2 - CL-2 + CL-2 + Ratings for element BE-Line_2 - Limit + 1443.000000 + + + + + BE-Line_2 - CL-5 + CL-5 + Ratings for element BE-Line_2 - Limit + 2000.000000 + + + + + BE-Line_2 - CL-5 + CL-5 + Ratings for element BE-Line_2 - Limit + 2000.000000 + + + + + BE-Line_3 - CL-0 + CL-0 + Ratings for element BE-Line_3 - Limit + 1443.000000 + + + + + BE-Line_3 - CL-0 + CL-0 + Ratings for element BE-Line_3 - Limit + 1443.000000 + + + + + BE-Line_3 - CL-1 + CL-1 + Ratings for element BE-Line_3 - Limit + 1515.000000 + + + + + BE-Line_3 - CL-1 + CL-1 + Ratings for element BE-Line_3 - Limit + 1515.000000 + + + + + BE-Line_3 - CL-2 + CL-2 + Ratings for element BE-Line_3 - Limit + 1371.000000 + + + + + BE-Line_3 - CL-2 + CL-2 + Ratings for element BE-Line_3 - Limit + 1371.000000 + + + + + BE-Line_4 - CL-0 + CL-0 + Ratings for element BE-Line_4 - Limit + 1299.000000 + + + + + BE-Line_4 - CL-0 + CL-0 + Ratings for element BE-Line_4 - Limit + 1299.000000 + + + + + BE-Line_4 - CL-1 + CL-1 + Ratings for element BE-Line_4 - Limit + 1371.000000 + + + + + BE-Line_4 - CL-1 + CL-1 + Ratings for element BE-Line_4 - Limit + 1371.000000 + + + + + BE-Line_4 - CL-2 + CL-2 + Ratings for element BE-Line_4 - Limit + 1226.000000 + + + + + BE-Line_4 - CL-2 + CL-2 + Ratings for element BE-Line_4 - Limit + 1226.000000 + + + + + BE-Line_5 - CL-0 + CL-0 + Ratings for element BE-Line_5 - Limit + 1876.000000 + + + + + BE-Line_5 - CL-0 + CL-0 + Ratings for element BE-Line_5 - Limit + 1876.000000 + + + + + BE-Line_5 - CL-1 + CL-1 + Ratings for element BE-Line_5 - Limit + 1948.000000 + + + + + BE-Line_5 - CL-1 + CL-1 + Ratings for element BE-Line_5 - Limit + 1948.000000 + + + + + BE-Line_5 - CL-2 + CL-2 + Ratings for element BE-Line_5 - Limit + 1804.000000 + + + + + BE-Line_5 - CL-2 + CL-2 + Ratings for element BE-Line_5 - Limit + 1804.000000 + + + + + BE-Line_6 - CL-0 + CL-0 + Ratings for element BE-Line_6 - Limit + 1312.000000 + + + + + BE-Line_6 - CL-0 + CL-0 + Ratings for element BE-Line_6 - Limit + 1312.000000 + + + + + BE-Line_6 - CL-1 + CL-1 + Ratings for element BE-Line_6 - Limit + 1443.000000 + + + + + BE-Line_6 - CL-1 + CL-1 + Ratings for element BE-Line_6 - Limit + 1443.000000 + + + + + BE-Line_6 - CL-2 + CL-2 + Ratings for element BE-Line_6 - Limit + 1180.000000 + + + + + BE-Line_6 - CL-2 + CL-2 + Ratings for element BE-Line_6 - Limit + 1180.000000 + + + + + BE-Line_7 - CL-0 + CL-0 + Ratings for element BE-Line_7 - Limit + 1312.000000 + + + + + BE-Line_7 - CL-0 + CL-0 + Ratings for element BE-Line_7 - Limit + 1312.000000 + + + + + BE-Line_7 - CL-1 + CL-1 + Ratings for element BE-Line_7 - Limit + 1443.000000 + + + + + BE-Line_7 - CL-1 + CL-1 + Ratings for element BE-Line_7 - Limit + 1443.000000 + + + + + BE-Line_7 - CL-2 + CL-2 + Ratings for element BE-Line_7 - Limit + 1180.000000 + + + + + BE-Line_7 - CL-2 + CL-2 + Ratings for element BE-Line_7 - Limit + 1180.000000 + + + + + BE-TR2_1 - CL-0 + CL-0 + Ratings for element BE-TR2_1 - Limit + 958.200000 + + + + + BE-TR2_1 - CL-0 + CL-0 + Ratings for element BE-TR2_1 - Limit + 3611.600000 + + + + + BE-TR2_1 - CL-1 + CL-1 + Ratings for element BE-TR2_1 - Limit + 998.200000 + + + + + BE-TR2_1 - CL-1 + CL-1 + Ratings for element BE-TR2_1 - Limit + 3811.600000 + + + + + BE-TR2_1 - CL-2 + CL-2 + Ratings for element BE-TR2_1 - Limit + 938.200000 + + + + + BE-TR2_1 - CL-2 + CL-2 + Ratings for element BE-TR2_1 - Limit + 3411.600000 + + + + + BE-TR2_2 - CL-0 + CL-0 + Ratings for element BE-TR2_2 - Limit + 1805.800000 + + + + + BE-TR2_2 - CL-0 + CL-0 + Ratings for element BE-TR2_2 - Limit + 3611.600000 + + + + + BE-TR2_2 - CL-1 + CL-1 + Ratings for element BE-TR2_2 - Limit + 1905.800000 + + + + + BE-TR2_2 - CL-1 + CL-1 + Ratings for element BE-TR2_2 - Limit + 3811.600000 + + + + + BE-TR2_2 - CL-2 + CL-2 + Ratings for element BE-TR2_2 - Limit + 1705.800000 + + + + + BE-TR2_2 - CL-2 + CL-2 + Ratings for element BE-TR2_2 - Limit + 3411.600000 + + + + + BE-TR2_3 - CL-0 + CL-0 + Ratings for element BE-TR2_3 - Limit + 1408.100000 + + + + + BE-TR2_3 - CL-0 + CL-0 + Ratings for element BE-TR2_3 - Limit + 14746.400000 + + + + + BE-TR2_3 - CL-1 + CL-1 + Ratings for element BE-TR2_3 - Limit + 1508.100000 + + + + + BE-TR2_3 - CL-1 + CL-1 + Ratings for element BE-TR2_3 - Limit + 15746.400000 + + + + + BE-TR2_3 - CL-2 + CL-2 + Ratings for element BE-TR2_3 - Limit + 1308.100000 + + + + + BE-TR2_3 - CL-2 + CL-2 + Ratings for element BE-TR2_3 - Limit + 13746.400000 + + + + + BE-TR3_1 - CL-0 + CL-0 + Ratings for element BE-TR3_1 - Limit + 968.200000 + + + + + BE-TR3_1 - CL-0 + CL-0 + Ratings for element BE-TR3_1 - Limit + 1805.800000 + + + + + BE-TR3_1 - CL-0 + CL-0 + Ratings for element BE-TR3_1 - Limit + 18870.400000 + + + + + BE-TR3_1 - CL-1 + CL-1 + Ratings for element BE-TR3_1 - Limit + 998.200000 + + + + + BE-TR3_1 - CL-1 + CL-1 + Ratings for element BE-TR3_1 - Limit + 1905.800000 + + + + + BE-TR3_1 - CL-1 + CL-1 + Ratings for element BE-TR3_1 - Limit + 19870.400000 + + + + + BE-TR3_1 - CL-2 + CL-2 + Ratings for element BE-TR3_1 - Limit + 938.200000 + + + + + BE-TR3_1 - CL-2 + CL-2 + Ratings for element BE-TR3_1 - Limit + 1705.800000 + + + + + BE-TR3_1 - CL-2 + CL-2 + Ratings for element BE-TR3_1 - Limit + 17870.400000 + + + + + -100.000000 + -200.000000 + 200.000000 + + + + 0e+000 + -300.000000 + 300.000000 + + + + 100.000000 + -200.000000 + 200.000000 + + + + BE-Load_1 + BE-L_1 + Electrabel + false + + + + BE-Load_2 + BE-L_2 + EVN + false + + + + L-1230804819 + L-1230804819 + Eq_Injection + false + + + + + BE-Inj-XCA_AL11 + BE-I-XCA_AL1 + Eq_Injection + false + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + + + + BE-Inj-XKA_MA11 + BE-I-XKA_MA1 + Eq_Injection + false + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + + + + BE-Inj-XWI_GY11 + BE-I-XWI_GY1 + Eq_Injection + false + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + + + + BE-Inj-XZE_ST23 + BE-I-XZE_ST2 + Eq_Injection + false + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + + + + BE-Inj-XZE_ST24 + BE-I-XZE_ST2 + Eq_Injection + false + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + + + + Gen-1229753024 + Machine + 118.000000 + 255.000000 + 200.000000 + 50.000000 + + false + + + + Gen-1229753060 + Machine + 90.000000 + 255.000000 + 200.000000 + 50.000000 + + false + + + + BE + + + container of BE-Line_1 + + + + container of BE-Line_2 + + + + container of BE-Line_3 + + + + container of BE-Line_4 + + + + container of BE-Line_5 + + + + container of BE-Line_6 + + + + container of BE-Line_7 + + + + BE_S1 + BE_S1 + shunt with 4 sections + 1 + 1 + 0.024793 + 0e+000 + -0e+000 + 0e+000 + 110.000000 + + false + + + + BE_S2 + BE_S2 + another shunt + 1 + 1 + 0.000346 + 7e-006 + -0e+000 + 0e+000 + 380.000000 + + false + + + + L-1230804819 + L-1230804819 + true + 0e+000 + 0e+000 + 1.000000 + 0e+000 + 0e+000 + 0e+000 + 1.000000 + 0e+000 + 0e+000 + 0e+000 + + + Limits at Port 1 + Limit-Ratings for branch BE-Line_7 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-Line_6 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-Line_5 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-Line_4 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-Line_3 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-Line_2 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-Line_1 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-TR2_1 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-TR2_2 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-TR2_3 at Port 1 + + + + Limits at Port 1 + Limit-Ratings for branch BE-TR3_1 at Port 1 + + + + Limits at Port 2 + Limit-Ratings for branch BE-Line_7 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-Line_6 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-Line_5 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-Line_4 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-Line_3 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-Line_2 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-Line_1 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-TR2_1 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-TR2_2 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-TR2_3 at Port 2 + + + + Limits at Port 2 + Limit-Ratings for branch BE-TR3_1 at Port 2 + + + + Limits at Port 3 + Limit-Ratings for branch BE-TR3_1 at Port 3 + + + + PATL + patl + + + + + PATLT + patlt + + + + + TATL10 + tatl + + + 10.000000 + + + TATL20 + tatl + + + 20.000000 + + + TATL25 + tatl + + + 25.000000 + + + TATL30 + tatl + + + 30.000000 + + + TC + tc + + + + + TCT + tct + + + + + BE-TR2_1 + BE-T_1 + 400.000000 + 1 + 25 + 13 + 10 + 1.250000 + 14.518904 + 14.518904 + 90.000000 + + true + + + + BE-TR2_1 + BE-T_1 + T1 that is after maintenance + false + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + false + + + BE-TR2_2 + BE-T_2 + This is T2 in the center + false + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + false + + + BE-TR2_3 + BE-T_3 + This is free description + false + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + false + + + BE-TR3_1 + BE-T_1 + new in 2015 + false + + 0e+000 + 0e+000 + 0e+000 + 0e+000 + false + false + + + BE-TR2_1 + BE-T_1 + 2.707692 + 14.518904 + 0.0 + 0.0 + 2.720000 + 14.516604 + 0.0 + 0.0 + 0e+000 + 0.0 + 650.000000 + 400.000000 + 1 + 0 + false + + + + + + + BE-TR2_1 + BE-T_1 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0.0 + 650.000000 + 110.000000 + 2 + 0 + false + + + + + + + BE-TR2_2 + BE-T_2 + 0.822800 + 11.138883 + 0.0 + 0.0 + 0.822800 + 11.138883 + 0.0 + 0.0 + 0e+000 + 0.0 + 650.000000 + 220.000000 + 1 + 0 + false + + + + + + + BE-TR2_2 + BE-T_2 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0.0 + 650.000000 + 110.000000 + 2 + 0 + false + + + + + + + BE-TR2_3 + BE-T_3 + 0.104711 + 5.843419 + -0.0000830339 + 0.0000173295 + 0.104711 + 5.843419 + 0.0 + 0.0 + 0e+000 + 0.0 + 250.000000 + 110.343750 + 1 + 0 + false + + + + + + + BE-TR2_3 + BE-T_3 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0e+000 + 0.0 + 0.0 + 0e+000 + 0.0 + 250.000000 + 10.500000 + 2 + 0 + false + + + + + + + BE-TR3_1 + BE-T_1 + 0.898462 + 17.204128 + 0.0000024375 + 0.0 + 0e+000 + 17.230769 + 0.0 + 0.0 + 0e+000 + 0.0 + 650.000000 + 400.000000 + 1 + 0 + false + + + + + + + BE-TR3_1 + BE-T_1 + 0.323908 + 5.949086 + 0.0 + 0.0 + 0e+000 + 5.956923 + 0.0 + 0.0 + 0e+000 + 0.0 + 650.000000 + 220.000000 + 2 + 0 + false + + + + + + + BE-TR3_1 + BE-T_1 + 0.013332 + 0.059978 + 0.0 + 0.0 + 0e+000 + 0.061062 + 0.0 + 0.0 + 0e+000 + 0.0 + 650.000000 + 21.000000 + 3 + 0 + false + + + + + + + BE-TR2_2 + BE-T_2 + 220.000000 + 1 + 25 + 13 + 10 + 1.250000 + true + + + + + + BE-TR2_3 + BE-T_3 + 10.500000 + 1 + 33 + 17 + 14 + 0.800000 + true + + + + + + BE-TR3_1 + BE-T_1 + 220.000000 + 1 + 33 + 17 + 17 + 0.625000 + true + + + + + + + + + + BE-G1 + + + BE-G1 + BE-G1 + + + + + BE-G2 + BE-G2 + + + + + BE_S1 + BE_S1 + + + + + BE_S2 + BE_S2 + + + + + ELIA-Anvers + + + + ELIA-Brussels + + + + Anvers + Anvers + + + + PP_Brussels + PP_Brussels + + + + BE-G1 + BE-G1 + Machine + false + + 50.000000 + 0e+000 + 0e+000 + 300.000000 + + + + 10.500000 + 0.850000 + + 0e+000 + 0e+000 + 0.130000 + 0.171000 + 0e+000 + 0e+000 + 0e+000 + 0.200000 + 2.000000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + true + + + + BE-G2 + BE-G2 + Machine + false + + 100.000000 + 200.000000 + -200.000000 + 300.000000 + + + + 21.000000 + 0.850000 + + 0e+000 + 0e+000 + 0.130000 + 0.170000 + 0e+000 + 0e+000 + 0e+000 + 0.200000 + 2.000000 + 0e+000 + 0e+000 + 0e+000 + 0e+000 + true + + + BE-TR2_1 + BE-T_1 + + + + + BE-TR2_2 + BE-T_2 + + + + + BE-TR2_3 + BE-T_3 + + + + + BE-TR3_1 + BE-T_1 + + + + + BE-Busbar_1_Busbar_Section + BB + 1 + + + Busbar Section + + + BE-Busbar_2_Busbar_Section + BB + 1 + + + Busbar Section + + + BE-Busbar_3_Busbar_Section + BB + 1 + + + Busbar Section + + + BE-Busbar_4_Busbar_Section + BB + 1 + + + Busbar Section + + + BE-Busbar_6_Busbar_Section + BB + 1 + + + Busbar Section + + + BE-G1 - T1 + BE-G1 + 1 + + + + + BE-G2 - T1 + BE-G2 + 1 + + + + + BE-Inj-XCA_AL11 - T1 + BE-I-XCA_AL1 + 1 + + + + + BE-Inj-XKA_MA11 - T1 + BE-I-XKA_MA1 + 1 + + + + + BE-Inj-XWI_GY11 - T1 + BE-I-XWI_GY1 + 1 + + + + + BE-Inj-XZE_ST23 - T1 + BE-I-XZE_ST2 + 1 + + + + + BE-Inj-XZE_ST24 - T1 + BE-I-XZE_ST2 + 1 + + + + + BE-Line_1 - T1 + BE-L_1 + 1 + + + 10T-AT-DE-000061 + + + BE-Line_1 - T2 + BE-L_1 + 2 + + + 10T-AT-DE-000061 + + + BE-Line_2 - T1 + BE-L_2 + 1 + + + 10T-AT-DE-00010A + + + BE-Line_2 - T2 + BE-L_2 + 2 + + + 10T-AT-DE-00010A + + + BE-Line_3 - T1 + BE-L_3 + 1 + + + 10T-AT-DE-00008Y + + + BE-Line_3 - T2 + BE-L_3 + 2 + + + 10T-AT-DE-00008Y + + + BE-Line_4 - T1 + BE-L_4 + 1 + + + + + BE-Line_4 - T2 + BE-L_4 + 2 + + + + + BE-Line_5 - T1 + BE-L_5 + 1 + + + 10T-AT-DE-00009W + + + BE-Line_5 - T2 + BE-L_5 + 2 + + + 10T-AT-DE-00009W + + + BE-Line_6 - T1 + BE-L_6 + 1 + + + + + BE-Line_6 - T2 + BE-L_6 + 2 + + + + + BE-Line_7 - T1 + BE-L_7 + 1 + + + 10T-AT-DE-000061 + + + BE-Line_7 - T2 + BE-L_7 + 2 + + + 10T-AT-DE-000061 + + + BE-Load_1 - T1 + BE-L_1 + 1 + + + + + BE-Load_2 - T1 + BE-L_2 + 1 + + + + + BE-TR2_1 - T1 + BE-T_1 + 1 + + + + + BE-TR2_1 - T2 + BE-T_1 + 2 + + + + + BE-TR2_2 - T1 + BE-T_2 + 1 + + + + + BE-TR2_2 - T2 + BE-T_2 + 2 + + + + + BE-TR2_3 - T1 + BE-T_3 + 1 + + + + + BE-TR2_3 - T2 + BE-T_3 + 2 + + + + + BE-TR3_1 - T1 + BE-T_1 + 1 + + + + + BE-TR3_1 - T2 + BE-T_1 + 2 + + + + + BE-TR3_1 - T3 + BE-T_1 + 3 + + + + + BE_S1 - T1 + BE_S1 + 1 + + + + + BE_S2 - T1 + BE_S2 + 1 + + + + + L-1230804819 - T1 + L-1230804819 + 1 + + + + + N1230992288_Busbar_Section + BB + 1 + + + Busbar Section + + + N1230992291_Busbar_Section + BB + 1 + + + Busbar Section + + + N1230992411_Busbar_Section + BB + 1 + + + Busbar Section + + + N1230992414_Busbar_Section + BB + 1 + + + Busbar Section + + + 10.5 + 9.450000 + 11.550000 + + + + + 110.0 + 99.000000 + 121.000000 + + + + + 21.0 + 18.900000 + 23.100000 + + + + + 220.0 + 202.500000 + 247.500000 + + + + + 225.0 + 202.500000 + 247.500000 + + + + + 380.0 + 342.000000 + 418.000000 + + + + diff --git a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/conformity/modified/CgmesConformity1ModifiedConversionTest.java b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/conformity/modified/CgmesConformity1ModifiedConversionTest.java index 2f2ef8f9a51..846837f226b 100644 --- a/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/conformity/modified/CgmesConformity1ModifiedConversionTest.java +++ b/cgmes/cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/conformity/modified/CgmesConformity1ModifiedConversionTest.java @@ -57,6 +57,13 @@ public void tearDown() throws IOException { fileSystem.close(); } + @Test + public void microBEExplicitBase() { + Network network = new CgmesImport() + .importData(CgmesConformity1ModifiedCatalog.microGridBaseCaseBEExplicitBase().dataSource(), NetworkFactory.findDefault(), null); + assertNotNull(network); + } + @Test public void microBERatioPhaseTabularTest() { Network network = new CgmesImport() diff --git a/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/CgmesOnDataSource.java b/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/CgmesOnDataSource.java index afed60981d3..f845736966c 100644 --- a/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/CgmesOnDataSource.java +++ b/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/CgmesOnDataSource.java @@ -14,6 +14,7 @@ import java.io.InputStream; import java.io.UncheckedIOException; import java.util.HashSet; +import java.util.Objects; import java.util.Set; import static com.powsybl.cgmes.model.CgmesNamespace.*; @@ -57,12 +58,24 @@ public boolean existsCim14() { } public String baseName() { - // Build an absolute IRI from the data source base name - String name = dataSource.getBaseName().toLowerCase(); - if (name.isEmpty()) { - name = "default-cgmes-model"; - } - return "http://" + name; + // Get the base URI if present, else build an absolute URI from the data source base name + return names().stream() + .map(n -> { + try (InputStream is = dataSource.newInputStream(n)) { + return NamespaceReader.base(is); + } catch (IOException x) { + throw new UncheckedIOException(x); + } + }) + .filter(Objects::nonNull) + .findFirst() + .orElseGet(() -> { + String name = dataSource.getBaseName().toLowerCase(); + if (name.isEmpty()) { + name = "default-cgmes-model"; + } + return "http://" + name; + }); } public Set names() { diff --git a/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/NamespaceReader.java b/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/NamespaceReader.java index 80cec0ef376..6d8d5cdede4 100644 --- a/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/NamespaceReader.java +++ b/cgmes/cgmes-model/src/main/java/com/powsybl/cgmes/model/NamespaceReader.java @@ -56,5 +56,26 @@ public static Set namespaces1(InputStream is) throws XMLStreamException return found; } + public static String base(InputStream is) { + XMLStreamReader xmlsr; + try { + xmlsr = XML_INPUT_FACTORY_SUPPLIER.get().createXMLStreamReader(is); + try { + while (xmlsr.hasNext()) { + int eventType = xmlsr.next(); + if (eventType == XMLStreamConstants.START_ELEMENT) { + return xmlsr.getAttributeValue(null, "base"); + } + } + } finally { + xmlsr.close(); + XmlUtil.gcXmlInputFactory(XML_INPUT_FACTORY_SUPPLIER.get()); + } + return null; + } catch (XMLStreamException e) { + throw new CgmesModelException("base", e); + } + } + private static final Supplier XML_INPUT_FACTORY_SUPPLIER = Suppliers.memoize(XMLInputFactory::newInstance); } diff --git a/cgmes/cgmes-model/src/test/java/com/powsybl/cgmes/model/NamespaceReaderTest.java b/cgmes/cgmes-model/src/test/java/com/powsybl/cgmes/model/NamespaceReaderTest.java new file mode 100644 index 00000000000..a877294b902 --- /dev/null +++ b/cgmes/cgmes-model/src/test/java/com/powsybl/cgmes/model/NamespaceReaderTest.java @@ -0,0 +1,35 @@ +/** + * 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.model; + +import org.junit.Test; + +import java.io.IOException; +import java.io.InputStream; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +/** + * @author Miora Vedelago + */ +public class NamespaceReaderTest { + + @Test + public void base() throws IOException { + try (InputStream is = getClass().getResourceAsStream("/empty_cim16_EQ_with_explicitBase.xml")) { + assertEquals("http://example.com", NamespaceReader.base(is)); + } + } + + @Test + public void baseNull() throws IOException { + try (InputStream is = getClass().getResourceAsStream("/empty_cim16_EQ.xml")) { + assertNull(NamespaceReader.base(is)); + } + } +} diff --git a/cgmes/cgmes-model/src/test/resources/empty_cim16_EQ_with_explicitBase.xml b/cgmes/cgmes-model/src/test/resources/empty_cim16_EQ_with_explicitBase.xml new file mode 100644 index 00000000000..ed3f402b205 --- /dev/null +++ b/cgmes/cgmes-model/src/test/resources/empty_cim16_EQ_with_explicitBase.xml @@ -0,0 +1,3 @@ + + +