From a86696a15ab27a5f3533903dbb7328700466bc27 Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Mon, 17 Apr 2023 15:18:01 +0200 Subject: [PATCH 01/13] Remove executions goals from sld-cgmes-dl-iidm-extensions Signed-off-by: Thomas ADAM --- .../single-line-diagram-cgmes-dl-iidm-extensions/pom.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml index b732b3e0c..ba3c1590c 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml @@ -24,13 +24,6 @@ org.apache.maven.plugins maven-jar-plugin - - - - test-jar - - - From 8a30a91356b902c7847738c1472304747414d91d Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Mon, 17 Apr 2023 16:43:40 +0200 Subject: [PATCH 02/13] Add new module powsybl-single-line-diagram-cgmes-iidm-extensions-test Signed-off-by: Thomas ADAM --- pom.xml | 3 +- .../single-line-diagram-cgmes/pom.xml | 1 + .../pom.xml | 52 +++++++++++++++++++ .../dl/iidm/extensions/test}/Networks.java | 2 +- 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/pom.xml rename single-line-diagram/single-line-diagram-cgmes/{single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions => single-line-diagram-cgmes-dl-iidm-extensions-test/src/main/java/com/powsybl/sld/cgmes/dl/iidm/extensions/test}/Networks.java (99%) diff --git a/pom.xml b/pom.xml index 7370c8406..da910977c 100644 --- a/pom.xml +++ b/pom.xml @@ -149,9 +149,8 @@ com.powsybl - powsybl-single-line-diagram-cgmes-iidm-extensions + powsybl-single-line-diagram-cgmes-iidm-extensions-test ${project.version} - test-jar test diff --git a/single-line-diagram/single-line-diagram-cgmes/pom.xml b/single-line-diagram/single-line-diagram-cgmes/pom.xml index 72771411a..248d1b36f 100644 --- a/single-line-diagram/single-line-diagram-cgmes/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/pom.xml @@ -26,6 +26,7 @@ single-line-diagram-cgmes-dl-conversion single-line-diagram-cgmes-dl-iidm-extensions + single-line-diagram-cgmes-dl-iidm-extensions-test single-line-diagram-cgmes-layout diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/pom.xml new file mode 100644 index 000000000..81ee77d0e --- /dev/null +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + + + com.powsybl + powsybl-single-line-diagram-cgmes + 4.0.0-SNAPSHOT + + + powsybl-single-line-diagram-cgmes-iidm-extensions-test + Single line diagram CGMES-DL IIDM extensions tests + A collection of testing IIDM extensions to store CGMES-DL data + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + powsybl.single.line.diagram.cgmes.iidm.extensions.test + + + + + + + + + + + com.powsybl + powsybl-iidm-api + + + com.powsybl + powsybl-commons + + + diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/Networks.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/src/main/java/com/powsybl/sld/cgmes/dl/iidm/extensions/test/Networks.java similarity index 99% rename from single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/Networks.java rename to single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/src/main/java/com/powsybl/sld/cgmes/dl/iidm/extensions/test/Networks.java index efde6c2ad..e8b23d3c1 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/Networks.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/src/main/java/com/powsybl/sld/cgmes/dl/iidm/extensions/test/Networks.java @@ -4,7 +4,7 @@ * 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.sld.cgmes.dl.iidm.extensions; +package com.powsybl.sld.cgmes.dl.iidm.extensions.test; import com.powsybl.iidm.network.*; import org.joda.time.DateTime; From ea0f0da635c37e63324e971c411567de5f85d2eb Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Mon, 17 Apr 2023 16:44:42 +0200 Subject: [PATCH 03/13] Import Networks class from powsybl-single-line-diagram-cgmes-iidm-extensions-test Signed-off-by: Thomas ADAM --- .../sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java | 2 +- .../powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java | 1 + .../dl/conversion/exporters/BusDiagramDataExporterTest.java | 2 +- .../dl/conversion/exporters/BusbarDiagramDataExporterTest.java | 2 +- .../exporters/DanglingLineDiagramDataExporterTest.java | 2 +- .../conversion/exporters/GeneratorDiagramDataExporterTest.java | 2 +- .../conversion/exporters/HvdcLineDiagramDataExporterTest.java | 2 +- .../dl/conversion/exporters/LineDiagramDataExporterTest.java | 2 +- .../dl/conversion/exporters/LoadDiagramDataExporterTest.java | 2 +- .../dl/conversion/exporters/ShuntDiagramDataExporterTest.java | 2 +- .../dl/conversion/exporters/SvcDiagramDataExporterTest.java | 2 +- .../dl/conversion/exporters/SwitchDiagramDataExporterTest.java | 2 +- .../exporters/Transformer3WDiagramDataExporterTest.java | 2 +- .../exporters/TransformerDiagramDataExporterTest.java | 2 +- .../exporters/VoltageLevelDiagramDataExporterTest.java | 2 +- .../sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java | 1 + .../sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java | 1 + .../cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java | 1 + .../sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java | 1 + .../sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java | 1 + .../sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java | 1 + .../sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java | 1 + .../sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java | 1 + .../sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java | 1 + .../dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java | 1 + .../sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java | 1 + .../extensions/ThreeWindingsTransformerDiagramDataTest.java | 1 + .../cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java | 1 + .../cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java | 1 + .../com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java | 1 + .../powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java | 1 + 31 files changed, 31 insertions(+), 14 deletions(-) diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java index 18c92c466..54017f2a9 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.BusbarSection; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.NodeDiagramData; import org.junit.jupiter.api.Test; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java index c1e4fb34c..799df99fc 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.*; import com.powsybl.sld.cgmes.dl.iidm.extensions.*; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.triplestore.api.PropertyBags; import org.junit.jupiter.api.BeforeEach; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusDiagramDataExporterTest.java index 5d8d2d530..22471a8f0 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.NodeDiagramData; import com.powsybl.iidm.network.Bus; import com.powsybl.triplestore.api.PropertyBags; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusbarDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusbarDiagramDataExporterTest.java index f2c86203f..880cf9232 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusbarDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusbarDiagramDataExporterTest.java @@ -13,7 +13,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.NodeDiagramData; import com.powsybl.iidm.network.BusbarSection; import com.powsybl.triplestore.api.PropertyBag; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/DanglingLineDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/DanglingLineDiagramDataExporterTest.java index b0bee2c0c..d47e9c58b 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/DanglingLineDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/DanglingLineDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.LineDiagramData; import com.powsybl.iidm.network.DanglingLine; import com.powsybl.triplestore.api.PropertyBags; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/GeneratorDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/GeneratorDiagramDataExporterTest.java index bbe43e379..8ee56ee49 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/GeneratorDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/GeneratorDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.InjectionDiagramData; import com.powsybl.iidm.network.Generator; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/HvdcLineDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/HvdcLineDiagramDataExporterTest.java index 6118f159b..2bd549e58 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/HvdcLineDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/HvdcLineDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.LineDiagramData; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.triplestore.api.PropertyBags; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LineDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LineDiagramDataExporterTest.java index a81bde8fb..e8fd707b7 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LineDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LineDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.LineDiagramData; import com.powsybl.iidm.network.Line; import com.powsybl.triplestore.api.PropertyBags; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LoadDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LoadDiagramDataExporterTest.java index 567a84b28..4417fa8e0 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LoadDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LoadDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.InjectionDiagramData; import com.powsybl.iidm.network.Load; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/ShuntDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/ShuntDiagramDataExporterTest.java index 1d0d4db02..e6710a186 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/ShuntDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/ShuntDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.InjectionDiagramData; import com.powsybl.iidm.network.ShuntCompensator; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SvcDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SvcDiagramDataExporterTest.java index 44a8955f3..814232468 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SvcDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SvcDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.InjectionDiagramData; import com.powsybl.iidm.network.StaticVarCompensator; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SwitchDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SwitchDiagramDataExporterTest.java index 33817fee3..17d37b5b6 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SwitchDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SwitchDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.CouplingDeviceDiagramData; import com.powsybl.sld.cgmes.dl.iidm.extensions.DiagramTerminal; import com.powsybl.iidm.network.Switch; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/Transformer3WDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/Transformer3WDiagramDataExporterTest.java index ec9608bc2..5b03e3542 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/Transformer3WDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/Transformer3WDiagramDataExporterTest.java @@ -13,7 +13,7 @@ import org.mockito.Mockito; import com.powsybl.sld.cgmes.dl.conversion.AbstractCgmesDLExporterTest; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.DiagramPoint; import com.powsybl.sld.cgmes.dl.iidm.extensions.DiagramTerminal; import com.powsybl.sld.cgmes.dl.iidm.extensions.ThreeWindingsTransformerDiagramData; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/TransformerDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/TransformerDiagramDataExporterTest.java index 7d90402f9..474dae4db 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/TransformerDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/TransformerDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.CouplingDeviceDiagramData; import com.powsybl.sld.cgmes.dl.iidm.extensions.DiagramTerminal; import com.powsybl.iidm.network.TwoWindingsTransformer; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/VoltageLevelDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/VoltageLevelDiagramDataExporterTest.java index 64db11767..104602853 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/VoltageLevelDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/VoltageLevelDiagramDataExporterTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.VoltageLevel; import com.powsybl.sld.cgmes.dl.iidm.extensions.NetworkDiagramData; -import com.powsybl.sld.cgmes.dl.iidm.extensions.Networks; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.VoltageLevelDiagramData; import com.powsybl.triplestore.api.PropertyBags; import org.junit.jupiter.api.BeforeEach; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java index 104a70af2..1496cf46b 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.Network; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java index 0071fd81c..721a482b4 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.BusbarSection; import com.powsybl.iidm.network.Network; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java index 54a5f81d9..ea37e3b25 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.DanglingLine; import com.powsybl.iidm.network.Network; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java index 97cc491a4..9ce0b56b3 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.Network; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java index 96cbcf36c..857388b49 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.Network; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java index c1addece6..5ec65ea25 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Network; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java index f31a1b3c2..143f396f1 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.Network; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; /** diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java index cf0ade0f4..12f7ec2b4 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java @@ -7,6 +7,7 @@ package com.powsybl.sld.cgmes.dl.iidm.extensions; import com.powsybl.iidm.network.Network; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java index e21c80ba0..581afd9ec 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.ShuntCompensator; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; /** diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java index dc7ed120e..aecd588bb 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.StaticVarCompensator; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; /** diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java index dcbd19990..bd9fb6b58 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.Switch; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ThreeWindingsTransformerDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ThreeWindingsTransformerDiagramDataTest.java index 44b6c2377..22976375a 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ThreeWindingsTransformerDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ThreeWindingsTransformerDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.ThreeWindingsTransformer; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java index 6c8b66d7c..b2cdbc581 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoWindingsTransformer; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; /** diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java index 6bbc97679..1ac128faf 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java @@ -8,6 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.VoltageLevel; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java index 7d870d589..7a2a131e8 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java @@ -9,6 +9,7 @@ import com.powsybl.iidm.network.*; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.cgmes.dl.iidm.extensions.*; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import com.powsybl.sld.layout.LayoutParameters; import com.powsybl.sld.model.coordinate.Orientation; import com.powsybl.sld.model.graphs.VoltageLevelGraph; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java index b5d2ca9bf..3ff8fea1b 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java @@ -9,6 +9,7 @@ import com.powsybl.iidm.network.*; import com.powsybl.sld.cgmes.dl.iidm.extensions.*; +import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; From 502fdb3acda77bc44640c4da51998385af5d14e0 Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Mon, 17 Apr 2023 16:46:20 +0200 Subject: [PATCH 04/13] Use new module powsybl-single-line-diagram-cgmes-iidm-extensions-test instead of using test-jars Signed-off-by: Thomas ADAM --- .../single-line-diagram-cgmes-dl-conversion/pom.xml | 3 +-- .../single-line-diagram-cgmes-dl-iidm-extensions/pom.xml | 6 ++++++ .../single-line-diagram-cgmes-layout/pom.xml | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml index fb15fab81..db5aa827d 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml @@ -46,8 +46,7 @@ com.powsybl - powsybl-single-line-diagram-cgmes-iidm-extensions - test-jar + powsybl-single-line-diagram-cgmes-iidm-extensions-test test diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml index ba3c1590c..8fc516eae 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml @@ -29,6 +29,7 @@ + com.powsybl powsybl-iidm-api @@ -38,6 +39,11 @@ powsybl-commons + + com.powsybl + powsybl-single-line-diagram-cgmes-iidm-extensions-test + test + com.powsybl powsybl-config-test diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml index 7912f6b93..c968e7700 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml @@ -44,8 +44,7 @@ com.powsybl - powsybl-single-line-diagram-cgmes-iidm-extensions - test-jar + powsybl-single-line-diagram-cgmes-iidm-extensions-test test From 09a8bd61098c734b4dbd107a5ee18702ee916872 Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Mon, 17 Apr 2023 17:09:12 +0200 Subject: [PATCH 05/13] Rename & move module powsybl-single-line-diagram-cgmes-iidm-extensions-test to diagram-test Signed-off-by: Thomas ADAM --- .../pom.xml | 23 ++++++++----------- .../com/powsybl/diagram}/test/Networks.java | 2 +- pom.xml | 3 ++- .../single-line-diagram-cgmes/pom.xml | 1 - .../pom.xml | 2 +- .../CgmesDLImportPostProcessorTest.java | 2 +- .../dl/conversion/CgmesDLImporterTest.java | 2 +- .../exporters/BusDiagramDataExporterTest.java | 2 +- .../BusbarDiagramDataExporterTest.java | 2 +- .../DanglingLineDiagramDataExporterTest.java | 2 +- .../GeneratorDiagramDataExporterTest.java | 2 +- .../HvdcLineDiagramDataExporterTest.java | 2 +- .../LineDiagramDataExporterTest.java | 2 +- .../LoadDiagramDataExporterTest.java | 2 +- .../ShuntDiagramDataExporterTest.java | 2 +- .../exporters/SvcDiagramDataExporterTest.java | 2 +- .../SwitchDiagramDataExporterTest.java | 2 +- .../Transformer3WDiagramDataExporterTest.java | 2 +- .../TransformerDiagramDataExporterTest.java | 2 +- .../VoltageLevelDiagramDataExporterTest.java | 2 +- .../pom.xml | 2 +- .../iidm/extensions/BusDiagramDataTest.java | 2 +- .../extensions/BusbarDiagramDataTest.java | 2 +- .../DanglingLineDiagramDataTest.java | 2 +- .../extensions/GeneratorDiagramDataTest.java | 2 +- .../extensions/HvdcLineDiagramDataTest.java | 2 +- .../iidm/extensions/LineDiagramDataTest.java | 2 +- .../iidm/extensions/LoadDiagramDataTest.java | 2 +- .../extensions/NetworkDiagramDataTest.java | 2 +- .../iidm/extensions/ShuntDiagramDataTest.java | 2 +- .../StaticVarCompensatorDiagramDataTest.java | 2 +- .../extensions/SwitchDiagramDataTest.java | 2 +- ...reeWindingsTransformerDiagramDataTest.java | 2 +- .../TransformerDiagramDataTest.java | 2 +- .../VoltageLevelDiagramDataTest.java | 2 +- .../single-line-diagram-cgmes-layout/pom.xml | 2 +- .../cgmes/layout/DoubleBusbarSectionTest.java | 2 +- .../layout/LayoutToCgmesExtensionsTest.java | 2 +- 38 files changed, 47 insertions(+), 50 deletions(-) rename {single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test => diagram-test}/pom.xml (60%) rename {single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/src/main/java/com/powsybl/sld/cgmes/dl/iidm/extensions => diagram-test/src/main/java/com/powsybl/diagram}/test/Networks.java (99%) diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/pom.xml b/diagram-test/pom.xml similarity index 60% rename from single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/pom.xml rename to diagram-test/pom.xml index 81ee77d0e..c6bd892ef 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/pom.xml +++ b/diagram-test/pom.xml @@ -14,26 +14,23 @@ com.powsybl - powsybl-single-line-diagram-cgmes + powsybl-diagram 4.0.0-SNAPSHOT - powsybl-single-line-diagram-cgmes-iidm-extensions-test - Single line diagram CGMES-DL IIDM extensions tests - A collection of testing IIDM extensions to store CGMES-DL data + powsybl-diagram-test + PowSyBl diagram test + Set of testing classes for PowSyBl Diagram - org.apache.maven.plugins - maven-jar-plugin - - - - powsybl.single.line.diagram.cgmes.iidm.extensions.test - - - + org.codehaus.mojo + templating-maven-plugin + + + org.codehaus.mojo + buildnumber-maven-plugin diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/src/main/java/com/powsybl/sld/cgmes/dl/iidm/extensions/test/Networks.java b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java similarity index 99% rename from single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/src/main/java/com/powsybl/sld/cgmes/dl/iidm/extensions/test/Networks.java rename to diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java index e8b23d3c1..ed54a437f 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions-test/src/main/java/com/powsybl/sld/cgmes/dl/iidm/extensions/test/Networks.java +++ b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java @@ -4,7 +4,7 @@ * 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.sld.cgmes.dl.iidm.extensions.test; +package com.powsybl.diagram.test; import com.powsybl.iidm.network.*; import org.joda.time.DateTime; diff --git a/pom.xml b/pom.xml index da910977c..ee1b6bddf 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,7 @@ network-area-diagram single-line-diagram diagram-util + diagram-test @@ -149,7 +150,7 @@ com.powsybl - powsybl-single-line-diagram-cgmes-iidm-extensions-test + powsybl-diagram-test ${project.version} test diff --git a/single-line-diagram/single-line-diagram-cgmes/pom.xml b/single-line-diagram/single-line-diagram-cgmes/pom.xml index 248d1b36f..72771411a 100644 --- a/single-line-diagram/single-line-diagram-cgmes/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/pom.xml @@ -26,7 +26,6 @@ single-line-diagram-cgmes-dl-conversion single-line-diagram-cgmes-dl-iidm-extensions - single-line-diagram-cgmes-dl-iidm-extensions-test single-line-diagram-cgmes-layout diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml index db5aa827d..b14a99418 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/pom.xml @@ -46,7 +46,7 @@ com.powsybl - powsybl-single-line-diagram-cgmes-iidm-extensions-test + powsybl-diagram-test test diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java index 54017f2a9..197b71947 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImportPostProcessorTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.BusbarSection; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.NodeDiagramData; import org.junit.jupiter.api.Test; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java index 799df99fc..547b94d62 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/CgmesDLImporterTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.*; import com.powsybl.sld.cgmes.dl.iidm.extensions.*; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.triplestore.api.PropertyBags; import org.junit.jupiter.api.BeforeEach; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusDiagramDataExporterTest.java index 22471a8f0..f7b988b2d 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.NodeDiagramData; import com.powsybl.iidm.network.Bus; import com.powsybl.triplestore.api.PropertyBags; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusbarDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusbarDiagramDataExporterTest.java index 880cf9232..1716591bc 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusbarDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/BusbarDiagramDataExporterTest.java @@ -13,7 +13,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.NodeDiagramData; import com.powsybl.iidm.network.BusbarSection; import com.powsybl.triplestore.api.PropertyBag; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/DanglingLineDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/DanglingLineDiagramDataExporterTest.java index d47e9c58b..19fdbb0ef 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/DanglingLineDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/DanglingLineDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.LineDiagramData; import com.powsybl.iidm.network.DanglingLine; import com.powsybl.triplestore.api.PropertyBags; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/GeneratorDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/GeneratorDiagramDataExporterTest.java index 8ee56ee49..c2cdf5e22 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/GeneratorDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/GeneratorDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.InjectionDiagramData; import com.powsybl.iidm.network.Generator; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/HvdcLineDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/HvdcLineDiagramDataExporterTest.java index 2bd549e58..04c2b4ad0 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/HvdcLineDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/HvdcLineDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.LineDiagramData; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.triplestore.api.PropertyBags; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LineDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LineDiagramDataExporterTest.java index e8fd707b7..de40b38f6 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LineDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LineDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.LineDiagramData; import com.powsybl.iidm.network.Line; import com.powsybl.triplestore.api.PropertyBags; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LoadDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LoadDiagramDataExporterTest.java index 4417fa8e0..7f199fb3a 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LoadDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/LoadDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.InjectionDiagramData; import com.powsybl.iidm.network.Load; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/ShuntDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/ShuntDiagramDataExporterTest.java index e6710a186..804bc3526 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/ShuntDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/ShuntDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.InjectionDiagramData; import com.powsybl.iidm.network.ShuntCompensator; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SvcDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SvcDiagramDataExporterTest.java index 814232468..933640b8d 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SvcDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SvcDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.InjectionDiagramData; import com.powsybl.iidm.network.StaticVarCompensator; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SwitchDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SwitchDiagramDataExporterTest.java index 17d37b5b6..afa228454 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SwitchDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/SwitchDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.CouplingDeviceDiagramData; import com.powsybl.sld.cgmes.dl.iidm.extensions.DiagramTerminal; import com.powsybl.iidm.network.Switch; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/Transformer3WDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/Transformer3WDiagramDataExporterTest.java index 5b03e3542..f0b284a95 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/Transformer3WDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/Transformer3WDiagramDataExporterTest.java @@ -13,7 +13,7 @@ import org.mockito.Mockito; import com.powsybl.sld.cgmes.dl.conversion.AbstractCgmesDLExporterTest; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.DiagramPoint; import com.powsybl.sld.cgmes.dl.iidm.extensions.DiagramTerminal; import com.powsybl.sld.cgmes.dl.iidm.extensions.ThreeWindingsTransformerDiagramData; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/TransformerDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/TransformerDiagramDataExporterTest.java index 474dae4db..06770c09b 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/TransformerDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/TransformerDiagramDataExporterTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.mockito.Mockito; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.CouplingDeviceDiagramData; import com.powsybl.sld.cgmes.dl.iidm.extensions.DiagramTerminal; import com.powsybl.iidm.network.TwoWindingsTransformer; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/VoltageLevelDiagramDataExporterTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/VoltageLevelDiagramDataExporterTest.java index 104602853..c06d292ca 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/VoltageLevelDiagramDataExporterTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-conversion/src/test/java/com/powsybl/sld/cgmes/dl/conversion/exporters/VoltageLevelDiagramDataExporterTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.VoltageLevel; import com.powsybl.sld.cgmes.dl.iidm.extensions.NetworkDiagramData; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.cgmes.dl.iidm.extensions.VoltageLevelDiagramData; import com.powsybl.triplestore.api.PropertyBags; import org.junit.jupiter.api.BeforeEach; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml index 8fc516eae..8d0b32cbc 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/pom.xml @@ -41,7 +41,7 @@ com.powsybl - powsybl-single-line-diagram-cgmes-iidm-extensions-test + powsybl-diagram-test test diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java index 1496cf46b..9ad77079e 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java index 721a482b4..0453d2dc2 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/BusbarDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.BusbarSection; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java index ea37e3b25..88fbbdf7f 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/DanglingLineDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.DanglingLine; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java index 9ce0b56b3..c0b009e4a 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/GeneratorDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java index 857388b49..4ba247636 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/HvdcLineDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java index 5ec65ea25..3d57486cf 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LineDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java index 143f396f1..947ea42d2 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/LoadDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; /** diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java index 12f7ec2b4..1af8aaff3 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/NetworkDiagramDataTest.java @@ -7,7 +7,7 @@ package com.powsybl.sld.cgmes.dl.iidm.extensions; import com.powsybl.iidm.network.Network; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java index 581afd9ec..456ca0d53 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ShuntDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.ShuntCompensator; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; /** diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java index aecd588bb..281bc7d1b 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/StaticVarCompensatorDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.StaticVarCompensator; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; /** diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java index bd9fb6b58..914f772f2 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/SwitchDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.Switch; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ThreeWindingsTransformerDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ThreeWindingsTransformerDiagramDataTest.java index 22976375a..7cc918b25 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ThreeWindingsTransformerDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/ThreeWindingsTransformerDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.ThreeWindingsTransformer; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java index b2cdbc581..ca63961da 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/TransformerDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoWindingsTransformer; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; /** diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java index 1ac128faf..722faf222 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-dl-iidm-extensions/src/test/java/com/powsybl/sld/cgmes/dl/iidm/extensions/VoltageLevelDiagramDataTest.java @@ -8,7 +8,7 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.VoltageLevel; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml index c968e7700..68c562688 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/pom.xml @@ -44,7 +44,7 @@ com.powsybl - powsybl-single-line-diagram-cgmes-iidm-extensions-test + powsybl-diagram-test test diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java index 7a2a131e8..7194d7db5 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/DoubleBusbarSectionTest.java @@ -9,7 +9,7 @@ import com.powsybl.iidm.network.*; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.cgmes.dl.iidm.extensions.*; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.layout.LayoutParameters; import com.powsybl.sld.model.coordinate.Orientation; import com.powsybl.sld.model.graphs.VoltageLevelGraph; diff --git a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java index 3ff8fea1b..eceb4dc4b 100644 --- a/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java +++ b/single-line-diagram/single-line-diagram-cgmes/single-line-diagram-cgmes-layout/src/test/java/com/powsybl/sld/cgmes/layout/LayoutToCgmesExtensionsTest.java @@ -9,7 +9,7 @@ import com.powsybl.iidm.network.*; import com.powsybl.sld.cgmes.dl.iidm.extensions.*; -import com.powsybl.sld.cgmes.dl.iidm.extensions.test.Networks; +import com.powsybl.diagram.test.Networks; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; From ae5d054644a273d3d0afc4f2a35f12bd717dd612 Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Mon, 17 Apr 2023 17:40:58 +0200 Subject: [PATCH 06/13] Fix sonar bug Signed-off-by: Thomas ADAM --- .../main/java/com/powsybl/diagram/test/Networks.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java index ed54a437f..2f127e543 100644 --- a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java +++ b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java @@ -9,6 +9,8 @@ import com.powsybl.iidm.network.*; import org.joda.time.DateTime; +import java.util.Optional; + /** * * @author Massimo Ferraro @@ -516,10 +518,10 @@ public static Network createNetworkWithDoubleBusbarSections() { public static Network createNetworkWithPhaseShiftTransformer() { Network network = Networks.createNetworkWithTwoWindingsTransformer(); - TwoWindingsTransformer twt = network.getTwoWindingsTransformerStream().findFirst().get(); - twt.newPhaseTapChanger() + Optional twt = network.getTwoWindingsTransformerStream().findFirst(); + twt.ifPresent(twoWindingsTransformer -> twoWindingsTransformer.newPhaseTapChanger() .setTapPosition(1) - .setRegulationTerminal(twt.getTerminal2()) + .setRegulationTerminal(twoWindingsTransformer.getTerminal2()) .setRegulationMode(PhaseTapChanger.RegulationMode.FIXED_TAP) .setRegulationValue(200) .beginStep() @@ -546,7 +548,7 @@ public static Network createNetworkWithPhaseShiftTransformer() { .setG(0.0) .setB(0.0) .endStep() - .add(); + .add()); return network; } From 459c84751cb2af1b8cc993c9d9699847c46833ed Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Tue, 18 Apr 2023 14:36:44 +0200 Subject: [PATCH 07/13] Use Networks class instead of duplication code Signed-off-by: Thomas ADAM --- .../single-line-diagram-core/pom.xml | 5 ++ .../powsybl/sld/iidm/TestCase13ZoneGraph.java | 5 +- .../com/powsybl/sld/model/ZoneGraphTest.java | 51 +------------------ 3 files changed, 11 insertions(+), 50 deletions(-) diff --git a/single-line-diagram/single-line-diagram-core/pom.xml b/single-line-diagram/single-line-diagram-core/pom.xml index 078767601..a939f4095 100644 --- a/single-line-diagram/single-line-diagram-core/pom.xml +++ b/single-line-diagram/single-line-diagram-core/pom.xml @@ -71,6 +71,11 @@ powsybl-config-test test + + com.powsybl + powsybl-diagram-test + test + com.powsybl powsybl-iidm-impl diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java index 995d7ca0d..80b14406f 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.layout.LayoutParameters; import com.powsybl.sld.model.graphs.ZoneGraph; @@ -26,7 +27,9 @@ class TestCase13ZoneGraph extends AbstractTestCaseIidm { @BeforeEach public void setUp() { layoutParameters.setCssLocation(LayoutParameters.CssLocation.INSERTED_IN_SVG); - network = ZoneGraphTest.createNetwork(); + network = Networks.createNetworkWithLine(); + // In order to keep same results -> can be removed later + network.getVoltageLevelStream().forEach(vl -> vl.setNominalV(380)); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java index c163aa731..53c3dec26 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.model; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.model.graphs.SubstationGraph; @@ -13,7 +14,6 @@ import com.powsybl.sld.model.graphs.ZoneGraph; import com.powsybl.sld.model.nodes.BranchEdge; import com.powsybl.sld.model.nodes.Node; -import org.joda.time.DateTime; import org.junit.jupiter.api.Test; import java.util.Arrays; @@ -32,59 +32,12 @@ public class ZoneGraphTest { public static final String SUBSTATION_ID_2 = "Substation2"; private static final String VOLTAGELEVEL_ID_1 = "VoltageLevel1"; private static final String VOLTAGELEVEL_ID_2 = "VoltageLevel2"; - private static final String BUS_ID_1 = "Bus1"; - private static final String BUS_ID_2 = "Bus2"; private static final String LINE_ID = "Line"; - public static Network createNetwork() { - Network network = Network.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); - Substation substation1 = network.newSubstation() - .setId(SUBSTATION_ID_1) - .setCountry(Country.FR) - .add(); - VoltageLevel voltageLevel1 = substation1.newVoltageLevel() - .setId(VOLTAGELEVEL_ID_1) - .setNominalV(380) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - voltageLevel1.getBusBreakerView().newBus() - .setId(BUS_ID_1) - .add(); - Substation substation2 = network.newSubstation() - .setId(SUBSTATION_ID_2) - .setCountry(Country.FR) - .add(); - VoltageLevel voltageLevel2 = substation2.newVoltageLevel() - .setId(VOLTAGELEVEL_ID_2) - .setNominalV(380) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - voltageLevel2.getBusBreakerView().newBus() - .setId(BUS_ID_2) - .add(); - network.newLine() - .setId(LINE_ID) - .setVoltageLevel1(voltageLevel1.getId()) - .setBus1(BUS_ID_1) - .setConnectableBus1(BUS_ID_1) - .setVoltageLevel2(voltageLevel2.getId()) - .setBus2(BUS_ID_2) - .setConnectableBus2(BUS_ID_2) - .setR(3.0) - .setX(33.0) - .setG1(0.0) - .setB1(386E-6 / 2) - .setG2(0.0) - .setB2(386E-6 / 2) - .add(); - return network; - } - @Test void test() { List zone = Arrays.asList(SUBSTATION_ID_1, SUBSTATION_ID_2); - ZoneGraph graph = new NetworkGraphBuilder(createNetwork()).buildZoneGraph(zone); + ZoneGraph graph = new NetworkGraphBuilder(Networks.createNetworkWithLine()).buildZoneGraph(zone); assertEquals(2, graph.getSubstations().size()); assertEquals(SUBSTATION_ID_1, graph.getSubstations().get(0).getSubstationId()); assertEquals(SUBSTATION_ID_2, graph.getSubstations().get(1).getSubstationId()); From d94c9c48c2acc9fdd0998346f9fa3eceee8552a7 Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Tue, 18 Apr 2023 14:37:39 +0200 Subject: [PATCH 08/13] Merge NetworkTestFactory into Networks class Signed-off-by: Thomas ADAM --- .../com/powsybl/diagram/test/Networks.java | 233 ++++++++++++++++ network-area-diagram/pom.xml | 15 +- .../powsybl/nad/NetworkAreaDiagramTest.java | 4 +- .../powsybl/nad/layout/FixedLayoutTest.java | 4 +- .../com/powsybl/nad/svg/DanglingLineTest.java | 5 +- .../java/com/powsybl/nad/svg/EdgeIdTest.java | 5 +- .../powsybl/nad/svg/EdgeInfoLabelTest.java | 5 +- .../powsybl/nad/svg/EdgeInfoShiftTest.java | 3 +- .../java/com/powsybl/nad/svg/LimitsTest.java | 5 +- .../powsybl/nad/svg/NetworkTestFactory.java | 254 ------------------ .../nad/svg/ParallelTransformerTest.java | 3 +- .../com/powsybl/nad/svg/TextNodeTest.java | 11 +- .../powsybl/nad/svg/TypeOfEdgeInfoTest.java | 3 +- 13 files changed, 271 insertions(+), 279 deletions(-) delete mode 100644 network-area-diagram/src/test/java/com/powsybl/nad/svg/NetworkTestFactory.java diff --git a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java index 2f127e543..484aeb8b4 100644 --- a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java +++ b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java @@ -673,4 +673,237 @@ public static Network createNetworkWithBridge() { return network; } + + /** + *
+     *  g1     dl1
+     *  |       |
+     *  b1 ---- b2
+     *      l1 
+ */ + public static Network createTwoVoltageLevels() { + Network network = Network.create("dl", "test"); + Substation s = network.newSubstation().setId("s1").setName("Substation 1").add(); + VoltageLevel vl1 = s.newVoltageLevel() + .setId("vl1") + .setName("Voltage level 1") + .setNominalV(400) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + vl1.getBusBreakerView().newBus() + .setId("b1") + .add(); + vl1.newGenerator() + .setId("g1") + .setConnectableBus("b1") + .setBus("b1") + .setTargetP(101.3664) + .setTargetV(390) + .setMinP(0) + .setMaxP(150) + .setVoltageRegulatorOn(true) + .add(); + VoltageLevel vl2 = s.newVoltageLevel() + .setId("vl2") + .setName("Voltage level 2") + .setNominalV(400) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + vl2.getBusBreakerView().newBus() + .setId("b2") + .add(); + vl2.newDanglingLine() + .setId("dl1") + .setConnectableBus("b2") + .setBus("b2") + .setR(0.7) + .setX(1) + .setG(1e-6) + .setB(3e-6) + .setP0(101) + .setQ0(150) + .newGeneration() + .setTargetP(0) + .setTargetQ(0) + .setTargetV(390) + .setVoltageRegulationOn(false) + .add() + .add(); + network.newLine() + .setId("l1") + .setVoltageLevel1("vl1") + .setBus1("b1") + .setVoltageLevel2("vl2") + .setBus2("b2") + .setR(1) + .setX(3) + .setG1(0) + .setG2(0) + .setB1(0) + .setB2(0) + .add(); + return network; + } + + public static Network createTwoVoltageLevelsThreeBuses() { + Network network = createTwoVoltageLevels(); + network.getVoltageLevel("vl1").getBusBreakerView().newBus() + .setId("b0") + .add(); + network.newLine() + .setId("l2") + .setVoltageLevel1("vl1") + .setBus1("b0") + .setVoltageLevel2("vl2") + .setConnectableBus2("b2") + .setR(1) + .setX(3) + .setG1(0) + .setG2(0) + .setB1(0) + .setB2(0) + .add(); + return network; + } + + public static Network createThreeVoltageLevelsFiveBuses() { + + Network network = createTwoVoltageLevelsThreeBuses(); + + Substation s = network.getSubstation("s1"); + VoltageLevel vl3 = s.newVoltageLevel() + .setId("vl3") + .setNominalV(200) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + vl3.getBusBreakerView().newBus() + .setId("b3") + .add(); + vl3.getBusBreakerView().newBus() + .setId("b4") + .add(); + vl3.newLoad() + .setId("load3") + .setBus("b3") + .setP0(10.0) + .setQ0(5.0) + .add(); + + s.newTwoWindingsTransformer() + .setId("tr1") + .setVoltageLevel1("vl1") + .setBus1("b0") + .setVoltageLevel2("vl3") + .setBus2("b3") + .setRatedU1(380) + .setRatedU2(190) + .setR(1) + .setX(30) + .setG(0) + .setB(0) + .add(); + s.newTwoWindingsTransformer() + .setId("tr2") + .setVoltageLevel1("vl2") + .setBus1("b2") + .setVoltageLevel2("vl3") + .setBus2("b4") + .setRatedU1(380) + .setRatedU2(190) + .setR(1) + .setX(30) + .setG(0) + .setB(0) + .add(); + + return network; + } + + /** + *
+     *   g1         dl1
+     *   |    tr1    |
+     *   |  --oo--   |
+     *  b1 /      \ b2
+     *     \      /
+     *      --oo--
+     *       tr2
+ */ + public static Network createTwoVoltageLevelsTwoTransformers() { + Network network = Network.create("dl", "test"); + Substation s = network.newSubstation().setId("s1").add(); + VoltageLevel vl1 = s.newVoltageLevel() + .setId("vl1") + .setNominalV(400) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + network.getVoltageLevel("vl1").getBusBreakerView().newBus() + .setId("b0") + .add(); + vl1.getBusBreakerView().newBus() + .setId("b1") + .add(); + vl1.newGenerator() + .setId("g1") + .setConnectableBus("b1") + .setBus("b1") + .setTargetP(101.3664) + .setTargetV(390) + .setMinP(0) + .setMaxP(150) + .setVoltageRegulatorOn(true) + .add(); + VoltageLevel vl2 = s.newVoltageLevel() + .setId("vl2") + .setNominalV(200) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + vl2.getBusBreakerView().newBus() + .setId("b2") + .add(); + vl2.newDanglingLine() + .setId("dl1") + .setConnectableBus("b2") + .setBus("b2") + .setR(0.7) + .setX(1) + .setG(1e-6) + .setB(3e-6) + .setP0(101) + .setQ0(150) + .newGeneration() + .setTargetP(0) + .setTargetQ(0) + .setTargetV(390) + .setVoltageRegulationOn(false) + .add() + .add(); + s.newTwoWindingsTransformer() + .setId("tr1") + .setVoltageLevel1("vl1") + .setBus1("b0") + .setVoltageLevel2("vl2") + .setBus2("b2") + .setRatedU1(380) + .setRatedU2(190) + .setR(1) + .setX(30) + .setG(0) + .setB(0) + .add(); + s.newTwoWindingsTransformer() + .setId("tr2") + .setVoltageLevel1("vl1") + .setBus1("b1") + .setVoltageLevel2("vl2") + .setBus2("b2") + .setRatedU1(380) + .setRatedU2(190) + .setR(1) + .setX(30) + .setG(0) + .setB(0) + .add(); + return network; + } } diff --git a/network-area-diagram/pom.xml b/network-area-diagram/pom.xml index 737979585..6479b33bc 100644 --- a/network-area-diagram/pom.xml +++ b/network-area-diagram/pom.xml @@ -59,27 +59,32 @@
com.powsybl - powsybl-iidm-impl + powsybl-config-test test - + + com.powsybl + powsybl-diagram-test + test + + com.powsybl powsybl-ieee-cdf-converter test com.powsybl - powsybl-iidm-test + powsybl-iidm-impl test com.powsybl - powsybl-ucte-converter + powsybl-iidm-test test com.powsybl - powsybl-config-test + powsybl-ucte-converter test
diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/NetworkAreaDiagramTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/NetworkAreaDiagramTest.java index e3662218e..8f34133d9 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/NetworkAreaDiagramTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/NetworkAreaDiagramTest.java @@ -17,7 +17,7 @@ import com.powsybl.nad.layout.LayoutFactory; import com.powsybl.nad.layout.LayoutParameters; import com.powsybl.nad.svg.LabelProvider; -import com.powsybl.nad.svg.NetworkTestFactory; +import com.powsybl.diagram.test.Networks; import com.powsybl.nad.svg.StyleProvider; import com.powsybl.nad.svg.SvgParameters; import com.powsybl.nad.svg.iidm.DefaultLabelProvider; @@ -78,7 +78,7 @@ private String getContentFile(Path svgFile) { @Test void testDrawSvg() { - Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); + Network network = Networks.createThreeVoltageLevelsFiveBuses(); NetworkAreaDiagram nad = new NetworkAreaDiagram(network, VoltageLevelFilter.NO_FILTER); Path svgFile = fileSystem.getPath("nad-test.svg"); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/layout/FixedLayoutTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/layout/FixedLayoutTest.java index 93520aebf..b9e4625c5 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/layout/FixedLayoutTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/layout/FixedLayoutTest.java @@ -11,7 +11,7 @@ import com.powsybl.nad.build.iidm.VoltageLevelFilter; import com.powsybl.nad.model.Graph; import com.powsybl.nad.model.Point; -import com.powsybl.nad.svg.NetworkTestFactory; +import com.powsybl.diagram.test.Networks; import java.util.Map; @@ -26,7 +26,7 @@ class FixedLayoutTest { @Test void testCurrentLimits() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); Map expected = Map.of( "dl1", new Point(0, 0), diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/DanglingLineTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/DanglingLineTest.java index ce2084900..33ef5e11b 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/DanglingLineTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/DanglingLineTest.java @@ -7,6 +7,7 @@ */ package com.powsybl.nad.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.nad.AbstractTest; import com.powsybl.nad.layout.LayoutParameters; @@ -42,13 +43,13 @@ protected LabelProvider getLabelProvider(Network network) { @Test void testConnected() { - Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); + Network network = Networks.createThreeVoltageLevelsFiveBuses(); assertEquals(toString("/dangling_line_connected.svg"), generateSvgString(network, "/dangling_line_connected.svg")); } @Test void testDisconnected() { - Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); + Network network = Networks.createThreeVoltageLevelsFiveBuses(); network.getDanglingLines().iterator().next().getTerminal().disconnect(); assertEquals(toString("/dangling_line_disconnected.svg"), generateSvgString(network, "/dangling_line_disconnected.svg")); } diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeIdTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeIdTest.java index b39ac1e10..619c2b44e 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeIdTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeIdTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.nad.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.nad.AbstractTest; import com.powsybl.nad.layout.LayoutParameters; @@ -41,14 +42,14 @@ protected LabelProvider getLabelProvider(Network network) { @Test void testNameOnEdgeDisplayed() { - Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); + Network network = Networks.createThreeVoltageLevelsFiveBuses(); getSvgParameters().setEdgeNameDisplayed(true); assertEquals(toString("/edge_with_id.svg"), generateSvgString(network, "/edge_with_id.svg")); } @Test void testNameOnEdgeNotDisplayed() { - Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); + Network network = Networks.createThreeVoltageLevelsFiveBuses(); getSvgParameters().setEdgeNameDisplayed(false); assertEquals(toString("/edge_without_id.svg"), generateSvgString(network, "/edge_without_id.svg")); } diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoLabelTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoLabelTest.java index 488b446da..c8d381471 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoLabelTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoLabelTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.nad.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.ThreeWindingsTransformerNetworkFactory; import com.powsybl.nad.AbstractTest; @@ -69,14 +70,14 @@ public String getArrowPathDOut() { // thinner arrow @Test void testMissingLabels() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); getSvgParameters().setArrowShift(10); assertEquals(toString("/edge_info_missing_label.svg"), generateSvgString(network, "/edge_info_missing_label.svg")); } @Test void testPerpendicularLabels() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); internalLabel = "int"; externalLabel = "ext"; getSvgParameters().setEdgeInfoAlongEdge(false) diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoShiftTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoShiftTest.java index 97860d70b..2064db8a3 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoShiftTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/EdgeInfoShiftTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.nad.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.nad.AbstractTest; import com.powsybl.nad.layout.LayoutParameters; @@ -41,7 +42,7 @@ protected LabelProvider getLabelProvider(Network network) { @Test void testArrowShift() { - Network network = NetworkTestFactory.createThreeVoltageLevelsFiveBuses(); + Network network = Networks.createThreeVoltageLevelsFiveBuses(); getSvgParameters().setArrowShift(20); assertEquals(toString("/edge_info_shift.svg"), generateSvgString(network, "/edge_info_shift.svg")); } diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/LimitsTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/LimitsTest.java index a761b3559..f7b425f0b 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/LimitsTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/LimitsTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.nad.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.nad.AbstractTest; import com.powsybl.nad.layout.LayoutParameters; @@ -40,7 +41,7 @@ protected LabelProvider getLabelProvider(Network network) { @Test void testVoltageLimits() { - Network network = NetworkTestFactory.createTwoVoltageLevelsThreeBuses(); + Network network = Networks.createTwoVoltageLevelsThreeBuses(); network.getVoltageLevel("vl1") .setHighVoltageLimit(385) .getBusView().getBus("vl1_0").setV(385.1); @@ -52,7 +53,7 @@ void testVoltageLimits() { @Test void testCurrentLimits() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); network.getLine("l1").newCurrentLimits1().setPermanentLimit(250).add(); network.getLine("l1").getTerminal1().setP(101).setQ(150).getBusView().getBus().setV(390); assertEquals(toString("/current_limits.svg"), generateSvgString(network, "/current_limits.svg")); diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/NetworkTestFactory.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/NetworkTestFactory.java deleted file mode 100644 index 4a4f8bd46..000000000 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/NetworkTestFactory.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * 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.nad.svg; - -import com.powsybl.iidm.network.Network; -import com.powsybl.iidm.network.Substation; -import com.powsybl.iidm.network.TopologyKind; -import com.powsybl.iidm.network.VoltageLevel; - -/** - * @author Florian Dupuy - */ -public final class NetworkTestFactory { - - private NetworkTestFactory() { - } - - /** - *
-     *  g1     dl1
-     *  |       |
-     *  b1 ---- b2
-     *      l1 
- */ - public static Network createTwoVoltageLevels() { - Network network = Network.create("dl", "test"); - Substation s = network.newSubstation().setId("s1").setName("Substation 1").add(); - VoltageLevel vl1 = s.newVoltageLevel() - .setId("vl1") - .setName("Voltage level 1") - .setNominalV(400) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - vl1.getBusBreakerView().newBus() - .setId("b1") - .add(); - vl1.newGenerator() - .setId("g1") - .setConnectableBus("b1") - .setBus("b1") - .setTargetP(101.3664) - .setTargetV(390) - .setMinP(0) - .setMaxP(150) - .setVoltageRegulatorOn(true) - .add(); - VoltageLevel vl2 = s.newVoltageLevel() - .setId("vl2") - .setName("Voltage level 2") - .setNominalV(400) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - vl2.getBusBreakerView().newBus() - .setId("b2") - .add(); - vl2.newDanglingLine() - .setId("dl1") - .setConnectableBus("b2") - .setBus("b2") - .setR(0.7) - .setX(1) - .setG(1e-6) - .setB(3e-6) - .setP0(101) - .setQ0(150) - .newGeneration() - .setTargetP(0) - .setTargetQ(0) - .setTargetV(390) - .setVoltageRegulationOn(false) - .add() - .add(); - network.newLine() - .setId("l1") - .setVoltageLevel1("vl1") - .setBus1("b1") - .setVoltageLevel2("vl2") - .setBus2("b2") - .setR(1) - .setX(3) - .setG1(0) - .setG2(0) - .setB1(0) - .setB2(0) - .add(); - return network; - } - - public static Network createTwoVoltageLevelsThreeBuses() { - Network network = createTwoVoltageLevels(); - network.getVoltageLevel("vl1").getBusBreakerView().newBus() - .setId("b0") - .add(); - network.newLine() - .setId("l2") - .setVoltageLevel1("vl1") - .setBus1("b0") - .setVoltageLevel2("vl2") - .setConnectableBus2("b2") - .setR(1) - .setX(3) - .setG1(0) - .setG2(0) - .setB1(0) - .setB2(0) - .add(); - return network; - } - - public static Network createThreeVoltageLevelsFiveBuses() { - - Network network = createTwoVoltageLevelsThreeBuses(); - - Substation s = network.getSubstation("s1"); - VoltageLevel vl3 = s.newVoltageLevel() - .setId("vl3") - .setNominalV(200) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - vl3.getBusBreakerView().newBus() - .setId("b3") - .add(); - vl3.getBusBreakerView().newBus() - .setId("b4") - .add(); - vl3.newLoad() - .setId("load3") - .setBus("b3") - .setP0(10.0) - .setQ0(5.0) - .add(); - - s.newTwoWindingsTransformer() - .setId("tr1") - .setVoltageLevel1("vl1") - .setBus1("b0") - .setVoltageLevel2("vl3") - .setBus2("b3") - .setRatedU1(380) - .setRatedU2(190) - .setR(1) - .setX(30) - .setG(0) - .setB(0) - .add(); - s.newTwoWindingsTransformer() - .setId("tr2") - .setVoltageLevel1("vl2") - .setBus1("b2") - .setVoltageLevel2("vl3") - .setBus2("b4") - .setRatedU1(380) - .setRatedU2(190) - .setR(1) - .setX(30) - .setG(0) - .setB(0) - .add(); - - return network; - } - - /** - *
-     *   g1         dl1
-     *   |    tr1    |
-     *   |  --oo--   |
-     *  b1 /      \ b2
-     *     \      /
-     *      --oo--
-     *       tr2
- */ - public static Network createTwoVoltageLevelsTwoTransformers() { - Network network = Network.create("dl", "test"); - Substation s = network.newSubstation().setId("s1").add(); - VoltageLevel vl1 = s.newVoltageLevel() - .setId("vl1") - .setNominalV(400) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - network.getVoltageLevel("vl1").getBusBreakerView().newBus() - .setId("b0") - .add(); - vl1.getBusBreakerView().newBus() - .setId("b1") - .add(); - vl1.newGenerator() - .setId("g1") - .setConnectableBus("b1") - .setBus("b1") - .setTargetP(101.3664) - .setTargetV(390) - .setMinP(0) - .setMaxP(150) - .setVoltageRegulatorOn(true) - .add(); - VoltageLevel vl2 = s.newVoltageLevel() - .setId("vl2") - .setNominalV(200) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - vl2.getBusBreakerView().newBus() - .setId("b2") - .add(); - vl2.newDanglingLine() - .setId("dl1") - .setConnectableBus("b2") - .setBus("b2") - .setR(0.7) - .setX(1) - .setG(1e-6) - .setB(3e-6) - .setP0(101) - .setQ0(150) - .newGeneration() - .setTargetP(0) - .setTargetQ(0) - .setTargetV(390) - .setVoltageRegulationOn(false) - .add() - .add(); - s.newTwoWindingsTransformer() - .setId("tr1") - .setVoltageLevel1("vl1") - .setBus1("b0") - .setVoltageLevel2("vl2") - .setBus2("b2") - .setRatedU1(380) - .setRatedU2(190) - .setR(1) - .setX(30) - .setG(0) - .setB(0) - .add(); - s.newTwoWindingsTransformer() - .setId("tr2") - .setVoltageLevel1("vl1") - .setBus1("b1") - .setVoltageLevel2("vl2") - .setBus2("b2") - .setRatedU1(380) - .setRatedU2(190) - .setR(1) - .setX(30) - .setG(0) - .setB(0) - .add(); - return network; - } -} diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/ParallelTransformerTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/ParallelTransformerTest.java index 82b227d1a..53c7810e6 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/ParallelTransformerTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/ParallelTransformerTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.nad.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.nad.AbstractTest; import com.powsybl.nad.layout.LayoutParameters; @@ -40,7 +41,7 @@ protected LabelProvider getLabelProvider(Network network) { @Test void test() { - Network network = NetworkTestFactory.createTwoVoltageLevelsTwoTransformers(); + Network network = Networks.createTwoVoltageLevelsTwoTransformers(); assertEquals(toString("/parallel_transformers.svg"), generateSvgString(network, "/parallel_transformers.svg")); } } diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/TextNodeTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/TextNodeTest.java index f85c0053c..9b8a4a6a4 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/TextNodeTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/TextNodeTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.nad.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.VoltageLevel; import com.powsybl.nad.AbstractTest; @@ -59,7 +60,7 @@ public List getVoltageLevelDetails(VoltageLevelNode vlNode) { @Test void testVlId() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); getSvgParameters().setIdDisplayed(true).setBusLegend(false); labelProvider = new DefaultLabelProvider(network, getSvgParameters()); assertEquals(toString("/vl_description_id.svg"), generateSvgString(network, "/vl_description_id.svg")); @@ -67,7 +68,7 @@ void testVlId() { @Test void testSubstationDescription() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); getSvgParameters().setSubstationDescriptionDisplayed(true).setBusLegend(false).setVoltageLevelDetails(true); labelProvider = new DefaultLabelProvider(network, getSvgParameters()); assertEquals(toString("/vl_description_substation.svg"), generateSvgString(network, "/vl_description_substation.svg")); @@ -75,21 +76,21 @@ void testSubstationDescription() { @Test void testSubstationId() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); getSvgParameters().setSubstationDescriptionDisplayed(true).setIdDisplayed(true).setBusLegend(false); assertEquals(toString("/vl_description_substation_id.svg"), generateSvgString(network, "/vl_description_substation_id.svg")); } @Test void testDetailedTextNodeNoBusLegend() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); getSvgParameters().setVoltageLevelDetails(true).setBusLegend(false); assertEquals(toString("/detailed_text_node_no_legend.svg"), generateSvgString(network, "/detailed_text_node_no_legend.svg")); } @Test void testDetailedTextNode() { - Network network = NetworkTestFactory.createTwoVoltageLevels(); + Network network = Networks.createTwoVoltageLevels(); getSvgParameters().setVoltageLevelDetails(true).setSubstationDescriptionDisplayed(true); assertEquals(toString("/detailed_text_node.svg"), generateSvgString(network, "/detailed_text_node.svg")); } diff --git a/network-area-diagram/src/test/java/com/powsybl/nad/svg/TypeOfEdgeInfoTest.java b/network-area-diagram/src/test/java/com/powsybl/nad/svg/TypeOfEdgeInfoTest.java index 282fff446..79ba24518 100644 --- a/network-area-diagram/src/test/java/com/powsybl/nad/svg/TypeOfEdgeInfoTest.java +++ b/network-area-diagram/src/test/java/com/powsybl/nad/svg/TypeOfEdgeInfoTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.nad.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Network; import com.powsybl.nad.AbstractTest; @@ -33,7 +34,7 @@ public void setup() { .setVoltageLevelDetails(false) .setFixedWidth(800) .setEdgeStartShift(2)); - network = NetworkTestFactory.createTwoVoltageLevels(); + network = Networks.createTwoVoltageLevels(); Line l1 = network.getLine("l1"); l1.getTerminal1().setP(100).setQ(10); l1.getTerminal2().setP(99).setQ(11); From 1c543a363348d79dabbe1f9a4787b4d069c84184 Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Tue, 18 Apr 2023 15:03:42 +0200 Subject: [PATCH 09/13] Fix code smells on Networks class Signed-off-by: Thomas ADAM --- .../com/powsybl/diagram/test/Networks.java | 138 ++++++++++-------- 1 file changed, 76 insertions(+), 62 deletions(-) diff --git a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java index 484aeb8b4..450f2ffdd 100644 --- a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java +++ b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java @@ -17,18 +17,32 @@ */ public final class Networks { + private static final String NETWORK_ID = "Network"; + + private static final String CASE_DATE = "2018-01-01T00:30:00.000+01:00"; + + private static final String SUBSTATION_ID = "Substation"; + + private static final String SUBSTATION_1_ID = "Substation1"; + + private static final String VOLTAGELEVEL_ID = "VoltageLevel"; + + private static final String VOLTAGELEVEL_1_ID = "VoltageLevel1"; + + private static final String VOLTAGELEVEL_2_ID = "VoltageLevel2"; + private Networks() { } public static Network createNetworkWithBusbar() { - Network network = NetworkFactory.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel = substation.newVoltageLevel() - .setId("VoltageLevel") + .setId(VOLTAGELEVEL_ID) .setNominalV(400) .setTopologyKind(TopologyKind.NODE_BREAKER) .add(); @@ -40,14 +54,14 @@ public static Network createNetworkWithBusbar() { } public static Network createNetworkWithBus() { - Network network = NetworkFactory.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel = substation.newVoltageLevel() - .setId("VoltageLevel") + .setId(VOLTAGELEVEL_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -58,14 +72,14 @@ public static Network createNetworkWithBus() { } public static Network createNetworkWithGenerator() { - Network network = NetworkFactory.create("test", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create("test", "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel = substation.newVoltageLevel() - .setId("VoltageLevel") + .setId(VOLTAGELEVEL_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -86,14 +100,14 @@ public static Network createNetworkWithGenerator() { } public static Network createNetworkWithLine() { - Network network = NetworkFactory.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation1 = network.newSubstation() - .setId("Substation1") + .setId(SUBSTATION_1_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel1 = substation1.newVoltageLevel() - .setId("VoltageLevel1") + .setId(VOLTAGELEVEL_1_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -105,7 +119,7 @@ public static Network createNetworkWithLine() { .setCountry(Country.FR) .add(); VoltageLevel voltageLevel2 = substation2.newVoltageLevel() - .setId("VoltageLevel2") + .setId(VOLTAGELEVEL_2_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -131,14 +145,14 @@ public static Network createNetworkWithLine() { } public static Network createNetworkWithLoad() { - Network network = NetworkFactory.create("test", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create("test", "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel = substation.newVoltageLevel() - .setId("VoltageLevel") + .setId(VOLTAGELEVEL_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -156,14 +170,14 @@ public static Network createNetworkWithLoad() { } public static Network createNetworkWithShuntCompensator() { - Network network = NetworkFactory.create("test", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create("test", "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel = substation.newVoltageLevel() - .setId("VoltageLevel") + .setId(VOLTAGELEVEL_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -184,14 +198,14 @@ public static Network createNetworkWithShuntCompensator() { } public static Network createNetworkWithStaticVarCompensator() { - Network network = NetworkFactory.create("test", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create("test", "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel = substation.newVoltageLevel() - .setId("VoltageLevel") + .setId(VOLTAGELEVEL_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -205,21 +219,21 @@ public static Network createNetworkWithStaticVarCompensator() { .setBmin(0.0002) .setBmax(0.0008) .setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE) - .setVoltageSetPoint(390.0) - .setReactivePowerSetPoint(1.0) + .setVoltageSetpoint(390.0) + .setReactivePowerSetpoint(1.0) .add(); return network; } public static Network createNetworkWithSwitch() { - Network network = NetworkFactory.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel = substation.newVoltageLevel() - .setId("VoltageLevel") + .setId(VOLTAGELEVEL_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -239,14 +253,14 @@ public static Network createNetworkWithSwitch() { } public static Network createNetworkWithThreeWindingsTransformer() { - Network network = NetworkFactory.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel1 = substation.newVoltageLevel() - .setId("VoltageLevel1") + .setId(VOLTAGELEVEL_1_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -254,7 +268,7 @@ public static Network createNetworkWithThreeWindingsTransformer() { .setId("Bus1") .add(); VoltageLevel voltageLevel2 = substation.newVoltageLevel() - .setId("VoltageLevel2") + .setId(VOLTAGELEVEL_2_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -299,14 +313,14 @@ public static Network createNetworkWithThreeWindingsTransformer() { } public static Network createNetworkWithTwoWindingsTransformer() { - Network network = NetworkFactory.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel1 = substation.newVoltageLevel() - .setId("VoltageLevel1") + .setId(VOLTAGELEVEL_1_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -314,7 +328,7 @@ public static Network createNetworkWithTwoWindingsTransformer() { .setId("Bus1") .add(); VoltageLevel voltageLevel2 = substation.newVoltageLevel() - .setId("VoltageLevel2") + .setId(VOLTAGELEVEL_2_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -341,14 +355,14 @@ public static Network createNetworkWithTwoWindingsTransformer() { } public static Network createNetworkWithDanglingLine() { - Network network = NetworkFactory.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation = network.newSubstation() - .setId("Substation") + .setId(SUBSTATION_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel = substation.newVoltageLevel() - .setId("VoltageLevel") + .setId(VOLTAGELEVEL_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); @@ -369,21 +383,21 @@ public static Network createNetworkWithDanglingLine() { } public static Network createNetworkWithHvdcLine() { - Network network = NetworkFactory.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation substation1 = network.newSubstation() - .setId("Substation1") + .setId(SUBSTATION_1_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel1 = substation1.newVoltageLevel() - .setId("VoltageLevel1") + .setId(VOLTAGELEVEL_1_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); voltageLevel1.getBusBreakerView().newBus() .setId("Bus1") .add(); - VscConverterStation cs1 = voltageLevel1.newVscConverterStation() + voltageLevel1.newVscConverterStation() .setId("Converter1") .setConnectableBus("Bus1") .setBus("Bus1") @@ -396,14 +410,14 @@ public static Network createNetworkWithHvdcLine() { .setCountry(Country.FR) .add(); VoltageLevel voltageLevel2 = substation2.newVoltageLevel() - .setId("VoltageLevel2") + .setId(VOLTAGELEVEL_2_ID) .setNominalV(400) .setTopologyKind(TopologyKind.BUS_BREAKER) .add(); voltageLevel2.getBusBreakerView().newBus() .setId("Bus2") .add(); - VscConverterStation cs2 = voltageLevel2.newVscConverterStation() + voltageLevel2.newVscConverterStation() .setId("Converter2") .setConnectableBus("Bus2") .setBus("Bus2") @@ -425,8 +439,8 @@ public static Network createNetworkWithHvdcLine() { } public static Network createNetworkWithBusbarAndSwitch() { - Network network = Network.create("Network", "test"); - network.setCaseDate(DateTime.parse("2018-01-01T00:30:00.000+01:00")); + Network network = Network.create(NETWORK_ID, "test"); + network.setCaseDate(DateTime.parse(CASE_DATE)); Substation s = network.newSubstation() .setId("S") .setCountry(Country.FR) @@ -460,17 +474,17 @@ public static Network createNetworkWithDoubleBusbarSections() { int bbN1 = countNodes++; int bbN2 = countNodes++; int iN1 = countNodes++; - int gN1 = countNodes++; + int gN1 = countNodes; Network network = Network.create("network1", "test"); Substation substation1 = network.newSubstation() - .setId("Substation1") + .setId(SUBSTATION_1_ID) .setCountry(Country.FR) .add(); VoltageLevel voltageLevel1 = substation1.newVoltageLevel() - .setId("VoltageLevel1") + .setId(VOLTAGELEVEL_1_ID) .setTopologyKind(TopologyKind.NODE_BREAKER) .setNominalV(400) .add(); @@ -553,7 +567,7 @@ public static Network createNetworkWithPhaseShiftTransformer() { } public static Network createNetworkWithBridge() { - Network network = NetworkFactory.findDefault().createNetwork("Network", "test"); + Network network = NetworkFactory.findDefault().createNetwork(NETWORK_ID, "test"); network.setCaseDate(DateTime.parse("2020-01-01T00:30:00.000+01:00")); Substation substation = network.newSubstation() From 1dde36d4b40ad3fc05a761d2da5b4eb828664574 Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Tue, 18 Apr 2023 16:41:15 +0200 Subject: [PATCH 10/13] Replace CreateNetworksUtil & NetworkFactory by Networks class Signed-off-by: Thomas ADAM --- diagram-test/pom.xml | 6 + .../com/powsybl/diagram/test/Networks.java | 1002 +++++++++++++++++ .../sld/iidm/AbstractTestCaseIidm.java | 298 ----- .../powsybl/sld/iidm/CreateNetworksUtil.java | 551 --------- .../com/powsybl/sld/iidm/NetworkFactory.java | 203 ---- .../com/powsybl/sld/iidm/TestBattery.java | 3 +- .../java/com/powsybl/sld/iidm/TestCase1.java | 13 +- .../sld/iidm/TestCase10TestBreakerToBus.java | 11 +- .../iidm/TestCase11FlatDesignComponents.java | 3 +- .../sld/iidm/TestCase11SubstationGraph.java | 7 +- .../sld/iidm/TestCase12GraphWith3WT.java | 197 ++-- .../TestCase15GraphWithVoltageIndicator.java | 3 +- .../powsybl/sld/iidm/TestCase1BusBreaker.java | 5 +- .../powsybl/sld/iidm/TestCase1inverted.java | 13 +- .../sld/iidm/TestCase2StackedCell.java | 17 +- .../powsybl/sld/iidm/TestCase3Coupling.java | 23 +- .../sld/iidm/TestCase3TripleCoupling.java | 29 +- .../sld/iidm/TestCase4NotParallelel.java | 35 +- .../sld/iidm/TestCase5ShuntHorizontal.java | 21 +- .../sld/iidm/TestCase5ShuntVertical.java | 21 +- .../TestCase6CouplingNonFlatHorizontal.java | 23 +- .../sld/iidm/TestCase6InternalConnection.java | 23 +- .../sld/iidm/TestCase7CellDetectionIssue.java | 9 +- .../powsybl/sld/iidm/TestCase7DoubleDJ.java | 17 +- .../sld/iidm/TestCase8JumpOverStacked.java | 27 +- .../sld/iidm/TestCaseFictitiousBus.java | 13 +- .../iidm/TestCaseFictitiousSwitchNode.java | 13 +- ...TestCaseGraphAdaptCellHeightToContent.java | 71 +- .../sld/iidm/TestCaseLoadBreakSwitch.java | 31 +- .../iidm/TestCaseMissingBusbarPosition.java | 21 +- .../sld/iidm/TestComplexParallelLegs.java | 3 +- .../TestComplexParallelLegsInternalPst.java | 3 +- .../powsybl/sld/iidm/TestDoubleForkNode.java | 3 +- .../com/powsybl/sld/iidm/TestFeederInfos.java | 17 +- .../com/powsybl/sld/iidm/TestFlatSection.java | 3 +- .../iidm/TestInternalBranchesBusBreaker.java | 3 +- .../iidm/TestInternalBranchesNodeBreaker.java | 3 +- .../iidm/TestNodeDecoratorsBusBreaker.java | 3 +- .../iidm/TestNodeDecoratorsNodeBreaker.java | 3 +- .../com/powsybl/sld/iidm/TestSerialBlock.java | 13 +- .../sld/iidm/TestSerialParallelBlock.java | 19 +- .../sld/iidm/TestSingleLineDiagramClass.java | 37 +- .../sld/iidm/TestTopologyCalculation.java | 53 +- .../TestUnicityNodeIdWithMutipleNetwork.java | 25 +- .../sld/iidm/TestUnknownComponent.java | 3 +- .../sld/layout/ComponentsOnBusTest.java | 4 +- .../powsybl/sld/model/AddNodeGraphTest.java | 3 +- .../sld/svg/FeederInfoProviderTest.java | 4 +- .../sld/util/NominalVoltageStyleTest.java | 45 +- .../sld/util/TopologicalStyleTest.java | 43 +- 50 files changed, 1499 insertions(+), 1500 deletions(-) delete mode 100644 single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/CreateNetworksUtil.java delete mode 100644 single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/NetworkFactory.java diff --git a/diagram-test/pom.xml b/diagram-test/pom.xml index c6bd892ef..e9bbb7c29 100644 --- a/diagram-test/pom.xml +++ b/diagram-test/pom.xml @@ -45,5 +45,11 @@ com.powsybl powsybl-commons
+ + com.powsybl + powsybl-iidm-extensions + 5.2.0 + compile + diff --git a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java index 450f2ffdd..987d78087 100644 --- a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java +++ b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java @@ -6,7 +6,9 @@ */ package com.powsybl.diagram.test; +import com.powsybl.commons.extensions.Extendable; import com.powsybl.iidm.network.*; +import com.powsybl.iidm.network.extensions.*; import org.joda.time.DateTime; import java.util.Optional; @@ -920,4 +922,1004 @@ public static Network createTwoVoltageLevelsTwoTransformers() { .add(); return network; } + + public static Network createTestCase11Network() { + Network network = Network.create("testCase11", "test"); + + Substation substation = createSubstation(network, "subst", "subst", Country.FR); + + // first voltage level + // + VoltageLevel vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 50); + + createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); + createBusBarSection(vl1, "bbs2", "bbs2", 1, 1, 2); + createBusBarSection(vl1, "bbs3", "bbs3", 2, 2, 1); + createBusBarSection(vl1, "bbs4", "bbs4", 3, 2, 2); + + createSwitch(vl1, "dsect11", "dsect11", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); + createSwitch(vl1, "dtrct11", "dtrct11", SwitchKind.BREAKER, true, false, true, 14, 15); + createSwitch(vl1, "dsect12", "dsect12", SwitchKind.DISCONNECTOR, false, false, true, 15, 1); + + createSwitch(vl1, "dsect21", "dsect21", SwitchKind.DISCONNECTOR, false, false, true, 2, 16); + createSwitch(vl1, "dtrct21", "dtrct21", SwitchKind.BREAKER, true, false, true, 16, 17); + createSwitch(vl1, "dsect22", "dsect22", SwitchKind.DISCONNECTOR, false, false, true, 17, 3); + + createLoad(vl1, "load1", "load1", "load1", 0, ConnectablePosition.Direction.TOP, 4, 10, 10); + createSwitch(vl1, "dload1", "dload1", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); + createSwitch(vl1, "bload1", "bload1", SwitchKind.BREAKER, true, false, true, 4, 5); + + createGenerator(vl1, "gen1", "gen1", "gen1", 2, ConnectablePosition.Direction.BOTTOM, 6, 0, 20, false, 10, 10); + createSwitch(vl1, "dgen1", "dgen1", SwitchKind.DISCONNECTOR, false, false, true, 2, 7); + createSwitch(vl1, "bgen1", "bgen1", SwitchKind.BREAKER, true, false, true, 6, 7); + + createLoad(vl1, "load2", "load2", "load2", 8, ConnectablePosition.Direction.TOP, 8, 10, 10); + createSwitch(vl1, "dload2", "dload2", SwitchKind.DISCONNECTOR, false, false, true, 1, 9); + createSwitch(vl1, "bload2", "bload2", SwitchKind.BREAKER, true, false, true, 8, 9); + + createGenerator(vl1, "gen2", "gen2", "gen2", 12, ConnectablePosition.Direction.BOTTOM, 10, 0, 20, false, 10, 10); + createSwitch(vl1, "dgen2", "dgen2", SwitchKind.DISCONNECTOR, false, false, true, 3, 11); + createSwitch(vl1, "bgen2", "bgen2", SwitchKind.BREAKER, true, false, true, 10, 11); + + // second voltage level + // + VoltageLevel vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 30); + + createBusBarSection(vl2, "bbs5", "bbs5", 0, 1, 1); + createBusBarSection(vl2, "bbs6", "bbs6", 1, 2, 1); + + createSwitch(vl2, "dscpl1", "dscpl1", SwitchKind.DISCONNECTOR, false, false, true, 0, 6); + createSwitch(vl2, "ddcpl1", "ddcpl1", SwitchKind.BREAKER, true, false, true, 6, 7); + createSwitch(vl2, "dscpl2", "dscpl2", SwitchKind.DISCONNECTOR, false, false, true, 7, 1); + + createLoad(vl2, "load3", "load3", "load3", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + createSwitch(vl2, "dload3", "dload3", SwitchKind.DISCONNECTOR, false, false, true, 0, 3); + createSwitch(vl2, "bload3", "bload3", SwitchKind.BREAKER, true, false, true, 2, 3); + + createGenerator(vl2, "gen4", "gen4", "gen4", 2, ConnectablePosition.Direction.BOTTOM, 4, 0, 20, false, 10, 10); + createSwitch(vl2, "dgen4", "dgen4", SwitchKind.DISCONNECTOR, false, false, true, 1, 5); + createSwitch(vl2, "bgen4", "bgen4", SwitchKind.BREAKER, true, false, true, 4, 5); + + // third voltage level + // + VoltageLevel vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 50, 20); + + createBusBarSection(vl3, "bbs7", "bbs7", 0, 1, 1); + + createLoad(vl3, "load4", "load4", "load4", 0, ConnectablePosition.Direction.TOP, 1, 10, 10); + createSwitch(vl3, "dload4", "dload4", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); + createSwitch(vl3, "bload4", "bload4", SwitchKind.BREAKER, true, false, true, 2, 1); + + // two windings transformers between voltage levels + // + createSwitch(vl1, "dtrf11", "dtrf11", SwitchKind.DISCONNECTOR, false, false, true, 0, 18); + createSwitch(vl1, "btrf11", "btrf11", SwitchKind.BREAKER, true, false, true, 18, 19); + createSwitch(vl2, "dtrf21", "dtrf21", SwitchKind.DISCONNECTOR, false, false, true, 0, 8); + createSwitch(vl2, "btrf21", "btrf21", SwitchKind.BREAKER, true, false, true, 8, 9); + createTwoWindingsTransformer(substation, "trf1", "trf1", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + 19, 9, vl1.getId(), vl2.getId(), + "trf1", 1, ConnectablePosition.Direction.TOP, + "trf1", 1, ConnectablePosition.Direction.TOP); + + createSwitch(vl1, "dtrf12", "dtrf12", SwitchKind.DISCONNECTOR, false, false, true, 1, 20); + createSwitch(vl1, "btrf12", "btrf12", SwitchKind.BREAKER, true, false, true, 20, 21); + createSwitch(vl2, "dtrf22", "dtrf22", SwitchKind.DISCONNECTOR, false, false, true, 1, 10); + createSwitch(vl2, "btrf22", "btrf22", SwitchKind.BREAKER, true, false, true, 10, 11); + createTwoWindingsTransformer(substation, "trf2", "trf2", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + 21, 11, vl1.getId(), vl2.getId(), + "trf2", 11, ConnectablePosition.Direction.TOP, + "trf2", 7, ConnectablePosition.Direction.BOTTOM); + + createSwitch(vl1, "dtrf13", "dtrf13", SwitchKind.DISCONNECTOR, false, false, true, 2, 22); + createSwitch(vl1, "btrf13", "btrf13", SwitchKind.BREAKER, true, false, true, 22, 23); + createSwitch(vl2, "dtrf23", "dtrf23", SwitchKind.DISCONNECTOR, false, false, true, 1, 12); + createSwitch(vl2, "btrf23", "btrf23", SwitchKind.BREAKER, true, false, true, 12, 13); + createTwoWindingsTransformer(substation, "trf3", "trf3", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + 23, 13, vl1.getId(), vl2.getId(), + "trf3", 3, ConnectablePosition.Direction.BOTTOM, + "trf3", 8, ConnectablePosition.Direction.BOTTOM); + + createSwitch(vl1, "dtrf14", "dtrf14", SwitchKind.DISCONNECTOR, false, false, true, 3, 24); + createSwitch(vl1, "btrf14", "btrf14", SwitchKind.BREAKER, true, false, true, 24, 25); + createSwitch(vl2, "dtrf24", "dtrf24", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); + createSwitch(vl2, "btrf24", "btrf24", SwitchKind.BREAKER, true, false, true, 14, 15); + createTwoWindingsTransformer(substation, "trf4", "trf4", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + 25, 15, vl1.getId(), vl2.getId(), + "trf4", 10, ConnectablePosition.Direction.BOTTOM, + "trf4", 3, ConnectablePosition.Direction.TOP); + + createSwitch(vl1, "dtrf15", "dtrf15", SwitchKind.DISCONNECTOR, false, false, true, 0, 26); + createSwitch(vl1, "btrf15", "btrf15", SwitchKind.BREAKER, true, false, true, 26, 27); + createSwitch(vl3, "dtrf25", "dtrf25", SwitchKind.DISCONNECTOR, false, false, true, 0, 3); + createSwitch(vl3, "btrf25", "btrf25", SwitchKind.BREAKER, true, false, true, 3, 4); + createTwoWindingsTransformer(substation, "trf5", "trf5", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + 27, 4, vl1.getId(), vl3.getId(), + "trf5", 4, ConnectablePosition.Direction.TOP, + "trf5", 1, ConnectablePosition.Direction.BOTTOM); + + // three windings transformers between voltage levels + // + createSwitch(vl1, "dtrf16", "dtrf16", SwitchKind.DISCONNECTOR, false, false, true, 0, 28); + createSwitch(vl1, "btrf16", "btrf16", SwitchKind.BREAKER, true, false, true, 28, 29); + createSwitch(vl2, "dtrf26", "dtrf26", SwitchKind.DISCONNECTOR, false, false, true, 1, 16); + createSwitch(vl2, "btrf26", "btrf26", SwitchKind.BREAKER, true, false, true, 16, 17); + createSwitch(vl3, "dtrf36", "dtrf36", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); + createSwitch(vl3, "btrf36", "btrf36", SwitchKind.BREAKER, true, false, true, 5, 6); + + createThreeWindingsTransformer(substation, "trf6", "trf6", vl1.getId(), vl2.getId(), vl3.getId(), + 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, + 400., 225., 50., + 29, 17, 6, + "trf61", 5, ConnectablePosition.Direction.TOP, + "trf62", 5, ConnectablePosition.Direction.TOP, + "trf63", 2, ConnectablePosition.Direction.TOP); + + createSwitch(vl1, "dtrf17", "dtrf17", SwitchKind.DISCONNECTOR, false, false, true, 2, 30); + createSwitch(vl1, "btrf17", "btrf17", SwitchKind.BREAKER, true, false, true, 30, 31); + createSwitch(vl2, "dtrf27", "dtrf27", SwitchKind.DISCONNECTOR, false, false, true, 0, 18); + createSwitch(vl2, "btrf27", "btrf27", SwitchKind.BREAKER, true, false, true, 18, 19); + createSwitch(vl3, "dtrf37", "dtrf37", SwitchKind.DISCONNECTOR, false, false, true, 0, 7); + createSwitch(vl3, "btrf37", "btrf37", SwitchKind.BREAKER, true, false, true, 7, 8); + + createThreeWindingsTransformer(substation, "trf7", "trf7", vl1.getId(), vl2.getId(), vl3.getId(), + 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, + 400., 225., 50., + 31, 19, 8, + "trf71", 6, ConnectablePosition.Direction.BOTTOM, + "trf72", 4, ConnectablePosition.Direction.TOP, + "trf73", 3, ConnectablePosition.Direction.BOTTOM); + + createSwitch(vl1, "dtrf18", "dtrf18", SwitchKind.DISCONNECTOR, false, false, true, 1, 32); + createSwitch(vl1, "btrf18", "btrf18", SwitchKind.BREAKER, true, false, true, 32, 33); + createSwitch(vl2, "dtrf28", "dtrf28", SwitchKind.DISCONNECTOR, false, false, true, 1, 20); + createSwitch(vl2, "btrf28", "btrf28", SwitchKind.BREAKER, true, false, true, 20, 21); + createSwitch(vl3, "dtrf38", "dtrf38", SwitchKind.DISCONNECTOR, false, false, true, 0, 9); + createSwitch(vl3, "btrf38", "btrf38", SwitchKind.BREAKER, true, false, true, 9, 10); + + createThreeWindingsTransformer(substation, "trf8", "trf8", vl1.getId(), vl2.getId(), vl3.getId(), + 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, + 400., 225., 50., + 33, 21, 10, + "trf81", 9, ConnectablePosition.Direction.TOP, + "trf82", 6, ConnectablePosition.Direction.BOTTOM, + "trf83", 4, ConnectablePosition.Direction.TOP); + + // Creation of another substation, another voltageLevel and a line between the two substations + // + Substation substation2 = createSubstation(network, "subst2", "subst2", Country.FR); + VoltageLevel vlSubst2 = createVoltageLevel(substation2, "vlSubst2", "vlSubst2", TopologyKind.NODE_BREAKER, 380, 50); + + createBusBarSection(vlSubst2, "bbs1_2", "bbs1_2", 0, 1, 1); + + createSwitch(vl1, "dline11_2", "dline11_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 34); + createSwitch(vl1, "bline11_2", "bline11_2", SwitchKind.BREAKER, true, false, true, 34, 35); + createSwitch(vlSubst2, "dline21_2", "dline21_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 1); + createSwitch(vlSubst2, "bline21_2", "bline21_2", SwitchKind.BREAKER, true, false, true, 1, 2); + createLine(network, "line1", "line1", 2.0, 14.745, 1.0, 1.0, 1.0, 1.0, + 35, 2, vl1.getId(), vlSubst2.getId(), + "line1", 7, ConnectablePosition.Direction.TOP, + "line1", 1, ConnectablePosition.Direction.TOP); + + return network; + } + + public static Network createNodeBreakerNetworkWithBranchStatus(String id, String sourceFormat) { + Network network = createNodeBreakerNetworkWithInternalBranches(id, sourceFormat); + + createStatusExtensions(network); + + return network; + } + + public static Network createBusBreakerNetworkWithBranchStatus(String id, String sourceFormat) { + Network network = createBusBreakerNetworkWithInternalBranches(id, sourceFormat); + + createStatusExtensions(network); + + return network; + } + + private static void createStatusExtensions(Network network) { + network.getLine("L11").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.PLANNED_OUTAGE).add(); + network.getLine("L12").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); + + network.getTwoWindingsTransformer("T11").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.PLANNED_OUTAGE).add(); + network.getTwoWindingsTransformer("T12").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); + + network.getThreeWindingsTransformer("T3_12").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); + } + + public static Network createNodeBreakerNetworkWithInternalBranches(String id, String sourceFormat) { + Network network = Network.create(id, sourceFormat); + Substation substation = createSubstation(network, "S1", "S1", Country.FR); + + VoltageLevel vl1 = createVoltageLevel(substation, "VL1", "VL1", TopologyKind.NODE_BREAKER, 400, 24); + + createBusBarSection(vl1, "BBS11", "BBS11", 10, 1, 1); + createBusBarSection(vl1, "BBS12", "BBS12", 20, 2, 1); + + createSwitch(vl1, "D10", "D10", SwitchKind.DISCONNECTOR, false, false, false, 10, 120); + createSwitch(vl1, "BR1", "BR1", SwitchKind.BREAKER, false, false, false, 120, 121); + createSwitch(vl1, "D20", "D20", SwitchKind.DISCONNECTOR, false, false, false, 121, 20); + + createLoad(vl1, "L1", "L1", "L1", null, ConnectablePosition.Direction.TOP, 12, 1, 1); + + createSwitch(vl1, "D11", "D11", SwitchKind.DISCONNECTOR, false, false, false, 10, 11); + createSwitch(vl1, "BR12", "BR12", SwitchKind.BREAKER, false, false, false, 11, 12); + + createGenerator(vl1, "G", "G", "G", null, ConnectablePosition.Direction.TOP, 22, 50, 100, false, 100, 400); + + createSwitch(vl1, "D21", "D21", SwitchKind.DISCONNECTOR, false, false, false, 20, 21); + createSwitch(vl1, "BR22", "BR22", SwitchKind.BREAKER, false, false, false, 21, 22); + + createSwitch(vl1, "D13", "D13", SwitchKind.DISCONNECTOR, false, false, false, 10, 13); + createSwitch(vl1, "BR14", "BR14", SwitchKind.BREAKER, false, false, false, 13, 14); + + createSwitch(vl1, "D23", "D23", SwitchKind.DISCONNECTOR, false, false, false, 20, 23); + createSwitch(vl1, "BR24", "BR24", SwitchKind.BREAKER, false, false, false, 23, 24); + + createLine(network, "L11", "L11", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, + 14, 24, vl1.getId(), vl1.getId(), + "L11", null, ConnectablePosition.Direction.TOP, + "L11", null, ConnectablePosition.Direction.TOP); + + VoltageLevel vl2 = createVoltageLevel(substation, "VL2", "VL2", TopologyKind.NODE_BREAKER, 400, 9); + + createBusBarSection(vl2, "BBS2", "BBS2", 30, 1, 1); + + createLoad(vl2, "L2", "L2", "L2", null, ConnectablePosition.Direction.TOP, 32, 1, 1); + + createSwitch(vl2, "D31", "D31", SwitchKind.DISCONNECTOR, false, false, false, 30, 31); + createSwitch(vl2, "BR32", "BR32", SwitchKind.BREAKER, false, false, false, 31, 32); + + createSwitch(vl1, "D15", "D15", SwitchKind.DISCONNECTOR, false, false, false, 10, 15); + createSwitch(vl1, "BR16", "BR16", SwitchKind.BREAKER, false, false, false, 15, 16); + + createSwitch(vl2, "D33", "D33", SwitchKind.DISCONNECTOR, false, false, false, 30, 33); + createSwitch(vl2, "BR34", "BR34", SwitchKind.BREAKER, false, false, false, 33, 34); + + createLine(network, "L12", "L12", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, + 16, 34, vl1.getId(), vl2.getId(), + "L12", null, ConnectablePosition.Direction.TOP, + "L12", null, ConnectablePosition.Direction.TOP); + + createSwitch(vl1, "D17", "D17", SwitchKind.DISCONNECTOR, false, false, false, 10, 17); + createSwitch(vl1, "BR18", "BR18", SwitchKind.BREAKER, false, false, false, 17, 18); + + createSwitch(vl1, "D25", "D25", SwitchKind.DISCONNECTOR, false, false, false, 20, 25); + createSwitch(vl1, "BR26", "BR26", SwitchKind.BREAKER, false, false, false, 25, 26); + + createTwoWindingsTransformer(substation, "T11", "T11", 250, 100, 52, 12, 65, 90, + 18, 26, vl1.getId(), vl1.getId(), + "T11", null, ConnectablePosition.Direction.TOP, + "T11", null, ConnectablePosition.Direction.TOP); + + TwoWindingsTransformer twoWindingsTransformer = network.getTwoWindingsTransformer("T11"); + twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setP(375); + twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setP(375); + twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setQ(48); + twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setQ(48); + + createSwitch(vl1, "D27", "D27", SwitchKind.DISCONNECTOR, false, false, false, 20, 27); + createSwitch(vl1, "BR28", "BR28", SwitchKind.BREAKER, false, false, false, 27, 28); + + createSwitch(vl2, "D35", "D35", SwitchKind.DISCONNECTOR, false, false, false, 30, 35); + createSwitch(vl2, "BR36", "BR36", SwitchKind.BREAKER, false, false, false, 35, 36); + + createTwoWindingsTransformer(substation, "T12", "T12", 250, 100, 52, 12, 65, 90, + 28, 36, vl1.getId(), vl2.getId(), + "T12", null, ConnectablePosition.Direction.TOP, + "T12", null, ConnectablePosition.Direction.TOP); + + twoWindingsTransformer = network.getTwoWindingsTransformer("T12"); + twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setP(375); + twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setP(375); + twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setQ(48); + twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setQ(48); + + createSwitch(vl1, "D19", "D19", SwitchKind.DISCONNECTOR, false, false, false, 10, 19); + createSwitch(vl1, "BR20", "BR20", SwitchKind.BREAKER, false, false, false, 19, 190); + + createSwitch(vl1, "D29", "D29", SwitchKind.DISCONNECTOR, false, false, false, 20, 29); + createSwitch(vl1, "BR30", "BR30", SwitchKind.BREAKER, false, false, false, 29, 290); + + createSwitch(vl2, "D37", "D37", SwitchKind.DISCONNECTOR, false, false, false, 30, 37); + createSwitch(vl2, "BR38", "BR38", SwitchKind.BREAKER, false, false, false, 37, 38); + + createThreeWindingsTransformer(substation, "T3_12", "T3_12", vl1.getId(), vl1.getId(), vl2.getId(), + 45, 47, 49, 35, 32, 39., 25, 15, + 5, 7, 9, + 190, 290, 38, + "T3_12", null, ConnectablePosition.Direction.TOP, + "T3_12", null, ConnectablePosition.Direction.TOP, + "T3_12", null, ConnectablePosition.Direction.TOP); + + return network; + } + + public static Network createBusBreakerNetworkWithInternalBranches(String id, String sourceFormat) { + Network network = Network.create(id, sourceFormat); + Substation substation = createSubstation(network, "S1", "S1", Country.FR); + + VoltageLevel vl1 = createVoltageLevel(substation, "VL1", "VL1", TopologyKind.BUS_BREAKER, 400, -1); + + vl1.getBusBreakerView().newBus() + .setId("B11") + .add(); + vl1.newLoad() + .setId("LD1") + .setConnectableBus("B11") + .setBus("B11") + .setP0(1.0) + .setQ0(1.0) + .add(); + + network.getVoltageLevel("VL1").getBusBreakerView().newBus() + .setId("B12") + .add(); + vl1.getBusBreakerView().newSwitch() + .setId("BR1") + .setBus1("B12") + .setBus2("B11") + .setOpen(true) + .add(); + + vl1.newGenerator() + .setId("G") + .setBus("B12") + .setConnectableBus("B12") + .setMaxP(100.0) + .setMinP(50.0) + .setTargetP(100.0) + .setTargetV(400.0) + .setVoltageRegulatorOn(true) + .add(); + + network.newLine() + .setId("L11") + .setVoltageLevel1("VL1") + .setConnectableBus1("B11") + .setBus1("B11") + .setVoltageLevel2("VL1") + .setConnectableBus2("B12") + .setBus2("B12") + .setR(1.0) + .setX(1.0) + .setG1(0.0) + .setB1(0.0) + .setG2(0.0) + .setB2(0.0) + .add(); + + TwoWindingsTransformer twt = substation.newTwoWindingsTransformer() + .setId("T11") + .setVoltageLevel1("VL1") + .setBus1("B11") + .setConnectableBus1("B11") + .setVoltageLevel2("VL1") + .setBus2("B12") + .setConnectableBus2("B12") + .setR(250) + .setX(100) + .setG(52) + .setB(12) + .setRatedU1(65) + .setRatedU2(90) + .add(); + twt.newPhaseTapChanger() + .setTapPosition(1) + .setRegulationTerminal(twt.getTerminal2()) + .setRegulationMode(PhaseTapChanger.RegulationMode.FIXED_TAP) + .setRegulationValue(400) + .beginStep() + .setAlpha(-20.0) + .setRho(1.0) + .setR(0.0) + .setX(0.0) + .setG(0.0) + .setB(0.0) + .endStep() + .beginStep() + .setAlpha(0.0) + .setRho(1.0) + .setR(0.0) + .setX(0.0) + .setG(0.0) + .setB(0.0) + .endStep() + .beginStep() + .setAlpha(20.0) + .setRho(1.0) + .setR(0.0) + .setX(0.0) + .setG(0.0) + .setB(0.0) + .endStep() + .add(); + + VoltageLevel vl2 = substation.newVoltageLevel() + .setId("VL2") + .setNominalV(400.0) + .setTopologyKind(TopologyKind.BUS_BREAKER) + .add(); + vl2.getBusBreakerView().newBus() + .setId("B21") + .add(); + vl2.newLoad() + .setId("LD2") + .setConnectableBus("B21") + .setBus("B21") + .setP0(1.0) + .setQ0(1.0) + .add(); + + network.newLine() + .setId("L12") + .setVoltageLevel1("VL1") + .setConnectableBus1("B11") + .setBus1("B11") + .setVoltageLevel2("VL2") + .setConnectableBus2("B21") + .setBus2("B21") + .setR(1.0) + .setX(1.0) + .setG1(0.0) + .setB1(0.0) + .setG2(0.0) + .setB2(0.0) + .add(); + + substation.newTwoWindingsTransformer() + .setId("T12") + .setVoltageLevel1("VL1") + .setBus1("B12") + .setConnectableBus1("B12") + .setVoltageLevel2("VL2") + .setBus2("B21") + .setConnectableBus2("B21") + .setR(250) + .setX(100) + .setG(52) + .setB(12) + .setRatedU1(65) + .setRatedU2(90) + .add(); + + ThreeWindingsTransformer threeWindingsTransformer = substation.newThreeWindingsTransformer() + .setId("T3_12") + .setRatedU0(234) + .newLeg1() + .setVoltageLevel("VL1") + .setBus("B11") + .setConnectableBus("B11") + .setR(45) + .setX(35) + .setG(25) + .setB(15) + .setRatedU(5) + .add() + .newLeg2() + .setVoltageLevel("VL1") + .setBus("B12") + .setConnectableBus("B12") + .setR(47) + .setX(37) + .setG(27) + .setB(17) + .setRatedU(7) + .add() + .newLeg3() + .setVoltageLevel("VL2") + .setBus("B21") + .setConnectableBus("B21") + .setR(49) + .setX(39) + .setG(29) + .setB(19) + .setRatedU(9) + .add() + .add(); + + return network; + } + + public static Network createNetworkWithSvcVscScDl() { + Network network = Network.create("testCase1", "test"); + Substation substation = network.newSubstation().setId("s").setCountry(Country.FR).add(); + VoltageLevel vl = substation.newVoltageLevel().setId("vl").setTopologyKind(TopologyKind.NODE_BREAKER).setNominalV(380).add(); + VoltageLevel.NodeBreakerView view = vl.getNodeBreakerView(); + BusbarSection bbs = view.newBusbarSection().setId("bbs").setNode(0).add(); + bbs.newExtension(BusbarSectionPositionAdder.class).withBusbarIndex(1).withSectionIndex(1); + BusbarSection bbs2 = view.newBusbarSection().setId("bbs2").setNode(3).add(); + bbs2.newExtension(BusbarSectionPositionAdder.class).withBusbarIndex(2).withSectionIndex(2); + StaticVarCompensator svc = vl.newStaticVarCompensator() + .setId("svc") + .setName("svc") + .setNode(2) + .setBmin(0.0002) + .setBmax(0.0008) + .setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE) + .setVoltageSetPoint(390) + .add(); + svc.getTerminal() + .setP(100.0) + .setQ(50.0); + VscConverterStation vsc = vl.newVscConverterStation() + .setId("vsc") + .setName("Converter1") + .setNode(1) + .setLossFactor(0.011f) + .setVoltageSetpoint(405.0) + .setVoltageRegulatorOn(true) + .add(); + vsc.getTerminal() + .setP(100.0) + .setQ(50.0); + ShuntCompensator c1 = vl.newShuntCompensator() + .setId("C1") + .setName("Filter 1") + .setNode(4) + .setSectionCount(1) + .newLinearModel() + .setBPerSection(1e-5) + .setMaximumSectionCount(1) + .add() + .add(); + DanglingLine dl1 = vl.newDanglingLine() + .setId("dl1") + .setName("Dangling line 1") + .setNode(5) + .setP0(1) + .setQ0(1) + .setR(0) + .setX(0) + .setB(0) + .setG(0) + .add(); + dl1.getTerminal() + .setP(100.0) + .setQ(50.0); + view.newDisconnector().setId("d").setNode1(0).setNode2(1).add(); + view.newBreaker().setId("b").setNode1(1).setNode2(2).add(); + view.newBreaker().setId("b2").setNode1(3).setNode2(4).add(); + view.newBreaker().setId("b3").setNode1(3).setNode2(5).add(); + view.newBreaker().setId("bt").setNode1(0).setNode2(3).add(); + + VoltageLevel vl2 = substation.newVoltageLevel().setId("vl2").setTopologyKind(TopologyKind.NODE_BREAKER).setNominalV(380).add(); + VoltageLevel.NodeBreakerView view2 = vl2.getNodeBreakerView(); + BusbarSection bbs1Vl2 = view2.newBusbarSection().setId("bbs1Vl2").setNode(0).add(); + bbs1Vl2.newExtension(BusbarSectionPositionAdder.class).withBusbarIndex(1).withSectionIndex(1); + BusbarSection bbs2Vl2 = view2.newBusbarSection().setId("bbs2Vl2").setNode(3).add(); + bbs2Vl2.newExtension(BusbarSectionPositionAdder.class).withBusbarIndex(2).withSectionIndex(2); + + VscConverterStation vsc2 = vl2.newVscConverterStation() + .setId("vsc2") + .setName("Converter2") + .setNode(1) + .setLossFactor(0.011f) + .setVoltageSetpoint(405.0) + .setVoltageRegulatorOn(true) + .add(); + vsc2.getTerminal() + .setP(300.0) + .setQ(75.0); + view2.newDisconnector().setId("d2").setNode1(0).setNode2(1).add(); + + network.newHvdcLine() + .setId("hvdc") + .setName("hvdc") + .setR(1) + .setNominalV(380) + .setMaxP(200) + .setActivePowerSetpoint(150) + .setConvertersMode(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER) + .setConverterStationId1("vsc") + .setConverterStationId2("vsc2") + .add(); + + return network; + } + + public static Network createNetworkWithFiveBusesFourLoads() { + Network network = createNetworkWithTwoParallelLoads(); + VoltageLevel vl = network.getVoltageLevel("vl1"); + + createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); + createBusBarSection(vl, "bbs21", "bbs21", 1, 2, 1); + createBusBarSection(vl, "bbs22", "bbs22", 2, 2, 2); + createSwitch(vl, "bA", "bA", SwitchKind.BREAKER, false, false, false, 3, 4); + createLoad(vl, "loadA", "loadA", "loadA", null, ConnectablePosition.Direction.TOP, 4, 10, 10); + createSwitch(vl, "dA1", "dA1", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); + createSwitch(vl, "dA2", "dA2", SwitchKind.DISCONNECTOR, false, false, false, 1, 3); + + createSwitch(vl, "bB", "bB", SwitchKind.BREAKER, false, false, false, 5, 6); + createLoad(vl, "loadB", "loadB", "loadB", null, ConnectablePosition.Direction.TOP, 6, 10, 10); + createSwitch(vl, "dB1", "dB1", SwitchKind.DISCONNECTOR, false, false, false, 2, 5); + createSwitch(vl, "dB2", "dB2", SwitchKind.DISCONNECTOR, false, false, false, 0, 5); + + createSwitch(vl, "link", "link", SwitchKind.BREAKER, false, false, false, 5, 9); + + return network; + } + + public static Network createNetworkWithTwoParallelLoads() { + Network network = Network.create("TestSingleLineDiagramClass", "test"); + Substation substation = createSubstation(network, "s", "s", Country.FR); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + createBusBarSection(vl, "bbs13", "bbs13", 7, 1, 3); + createBusBarSection(vl, "bbs23", "bbs23", 8, 2, 3); + createLoad(vl, "loadC", "loadC", "loadC", null, ConnectablePosition.Direction.TOP, 9, 10, 10); + createSwitch(vl, "bCD1", "bCD1", SwitchKind.BREAKER, false, false, false, 8, 9); + createSwitch(vl, "bCD2", "bCD2", SwitchKind.BREAKER, false, false, false, 7, 9); + createSwitch(vl, "bCD3", "bCD3", SwitchKind.BREAKER, false, false, false, 7, 9); + createSwitch(vl, "bD1", "bD1", SwitchKind.BREAKER, false, false, false, 20, 9); + createLoad(vl, "loadD", "loadD", "loadD", null, ConnectablePosition.Direction.TOP, 20, 10, 10); + return network; + } + + public static Network createNetworkWithFourParallelLegs() { + Network network = Network.create("networkWithFourParallelLegs", "test"); + Substation substation = createSubstation(network, "s", "s", Country.FR); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 3); + createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 3); + createSwitch(vl, "d1a", "d1an", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); + createSwitch(vl, "d2a", "d2an", SwitchKind.DISCONNECTOR, false, false, false, 1, 2); + createSwitch(vl, "b1", "b1n", SwitchKind.BREAKER, false, false, false, 2, 3); + createSwitch(vl, "d1b", "d1bn", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); + createSwitch(vl, "d2b", "d2bn", SwitchKind.DISCONNECTOR, false, false, false, 1, 3); + createSwitch(vl, "bl", "bln", SwitchKind.BREAKER, false, false, false, 3, 4); + createLoad(vl, "load", "load", "load displayed name", null, ConnectablePosition.Direction.BOTTOM, 4, 10, 10); + return network; + } + + public static Network createNetworkWithInternalPst() { + Network network = Network.create("networkWithInternalPst", "test"); + Substation substation = createSubstation(network, "s", "s", Country.FR); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 3); + createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 3); + createSwitch(vl, "d1a", "d1an", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); + createSwitch(vl, "d2a", "d2an", SwitchKind.DISCONNECTOR, false, false, false, 1, 2); + createSwitch(vl, "bpst", "bpstn", SwitchKind.BREAKER, false, false, false, 2, 3); + createPhaseShiftTransformer(substation, "trf3", "trf3", 1.0, 14.745, 0.0, 3.2E-5, 380.0, 380.0, + 3, 4, vl.getId(), vl.getId(), + "pst1a", 1, ConnectablePosition.Direction.BOTTOM, + "pst1b", 1, ConnectablePosition.Direction.BOTTOM); + createSwitch(vl, "dpst", "dpstn", SwitchKind.BREAKER, false, true, false, 4, 5); + createSwitch(vl, "d1b", "d1bn", SwitchKind.DISCONNECTOR, false, true, false, 0, 5); + createSwitch(vl, "d2b", "d2bn", SwitchKind.DISCONNECTOR, false, true, false, 1, 5); + createSwitch(vl, "bl", "bln", SwitchKind.BREAKER, false, false, false, 5, 6); + createLoad(vl, "load", "load", "l", null, ConnectablePosition.Direction.BOTTOM, 6, 10, 10); + return network; + } + + public static Network createNetworkWithFlatSections() { + Network network = Network.create("TestSingleLineDiagramClass", "test"); + Substation substation = createSubstation(network, "s", "s", Country.FR); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); + createBusBarSection(vl, "bbs21", "bbs21", 1, 2, 1); + createBusBarSection(vl, "bbs12", "bbs12", 2, 1, 2); + createBusBarSection(vl, "bbs22", "bbs22", 3, 2, 2); + createBusBarSection(vl, "bbs13", "bbs13", 4, 1, 3); + createBusBarSection(vl, "bbs23", "bbs23", 5, 2, 3); + createSwitch(vl, "d112", "d112", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); + createSwitch(vl, "d212", "d212", SwitchKind.DISCONNECTOR, false, false, false, 1, 3); + createSwitch(vl, "d123a", "d123a", SwitchKind.DISCONNECTOR, false, false, false, 2, 6); + createSwitch(vl, "b123", "b123", SwitchKind.BREAKER, false, false, false, 6, 7); + createSwitch(vl, "d123b", "d123b", SwitchKind.DISCONNECTOR, false, false, false, 7, 4); + createSwitch(vl, "d223a", "d223a", SwitchKind.DISCONNECTOR, false, false, false, 3, 8); + createSwitch(vl, "b223", "b223", SwitchKind.BREAKER, false, false, false, 8, 9); + createSwitch(vl, "d223b", "d223b", SwitchKind.DISCONNECTOR, false, false, false, 9, 5); + return network; + } + + public static Network createNetworkWithBatteries() { + Network network = Network.create("TestBatteries", "test"); + Substation substation = createSubstation(network, "s", "s", Country.FR); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); + createSwitch(vl, "d1b", "d1b", SwitchKind.DISCONNECTOR, true, false, false, 1, 2); + createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, true, false, false, 0, 1); + createBattery(vl, "batt1", "batt1", "batt1", null, ConnectablePosition.Direction.TOP, 2, 1, 10, 5, 5); + createSwitch(vl, "d2b", "d2b", SwitchKind.DISCONNECTOR, true, true, false, 3, 4); + createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, true, true, false, 0, 3); + createBattery(vl, "batt2", "batt2", "batt2", null, ConnectablePosition.Direction.BOTTOM, 4, 3, 10, 6, 6); + return network; + } + + public static Substation createSubstation(Network n, String id, String name, Country country) { + return n.newSubstation() + .setId(id) + .setName(name) + .setCountry(country) + .add(); + } + + public static VoltageLevel createVoltageLevel(Substation s, String id, String name, + TopologyKind topology, double vNom, int nodeCount) { + VoltageLevel vl = s.newVoltageLevel() + .setId(id) + .setName(name) + .setTopologyKind(topology) + .setNominalV(vNom) + .add(); + return vl; + } + + public static void createSwitch(VoltageLevel vl, String id, String name, SwitchKind kind, boolean retained, boolean open, boolean fictitious, int node1, int node2) { + vl.getNodeBreakerView().newSwitch() + .setId(id) + .setName(name) + .setKind(kind) + .setRetained(retained) + .setOpen(open) + .setFictitious(fictitious) + .setNode1(node1) + .setNode2(node2) + .add(); + } + + public static void createInternalConnection(VoltageLevel vl, int node1, int node2) { + vl.getNodeBreakerView().newInternalConnection() + .setNode1(node1) + .setNode2(node2) + .add(); + } + + public static void createBusBarSection(VoltageLevel vl, String id, String name, int node, int busbarIndex, int sectionIndex) { + BusbarSection bbs = vl.getNodeBreakerView().newBusbarSection() + .setId(id) + .setName(name) + .setNode(node) + .add(); + bbs.newExtension(BusbarSectionPositionAdder.class) + .withBusbarIndex(busbarIndex) + .withSectionIndex(sectionIndex) + .add(); + } + + public static void createLoad(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, + ConnectablePosition.Direction direction, int node, double p0, double q0) { + Load load = vl.newLoad() + .setId(id) + .setName(name) + .setNode(node) + .setP0(p0) + .setQ0(q0) + .add(); + addFeederPosition(load, feederName, feederOrder, direction); + } + + public static void createGenerator(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, + ConnectablePosition.Direction direction, int node, + double minP, double maxP, boolean voltageRegulator, + double targetP, double targetQ) { + Generator gen = vl.newGenerator() + .setId(id) + .setName(name) + .setNode(node) + .setMinP(minP) + .setMaxP(maxP) + .setVoltageRegulatorOn(voltageRegulator) + .setTargetP(targetP) + .setTargetQ(targetQ) + .add(); + addFeederPosition(gen, feederName, feederOrder, direction); + } + + protected static void createBattery(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, + ConnectablePosition.Direction direction, int node, + double minP, double maxP, + double targetP, double targetQ) { + Battery battery = vl.newBattery() + .setId(id) + .setName(name) + .setNode(node) + .setMinP(minP) + .setMaxP(maxP) + .setTargetP(targetP) + .setTargetQ(targetQ) + .add(); + addFeederPosition(battery, feederName, feederOrder, direction); + } + + public static void createShunt(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, + ConnectablePosition.Direction direction, int node, + double bPerSection, int maximumSectionCount, int currentSectionCount) { + ShuntCompensator shunt = vl.newShuntCompensator() + .setId(id) + .setName(name) + .setNode(node) + .setSectionCount(currentSectionCount) + .newLinearModel() + .setBPerSection(bPerSection) + .setMaximumSectionCount(maximumSectionCount) + .add() + .add(); + addFeederPosition(shunt, feederName, feederOrder, direction); + } + + public static TwoWindingsTransformer createTwoWindingsTransformer(Substation s, String id, String name, + double r, double x, double g, double b, + double ratedU1, double ratedU2, + int node1, int node2, + String idVoltageLevel1, String idVoltageLevel2, + String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, + String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { + TwoWindingsTransformer t = s.newTwoWindingsTransformer() + .setId(id) + .setName(name) + .setR(r) + .setX(x) + .setG(g) + .setB(b) + .setRatedU1(ratedU1) + .setRatedU2(ratedU2) + .setNode1(node1) + .setVoltageLevel1(idVoltageLevel1) + .setNode2(node2) + .setVoltageLevel2(idVoltageLevel2) + .add(); + addTwoFeedersPosition(t, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2); + return t; + } + + protected static void createPhaseShiftTransformer(Substation s, String id, String name, + double r, double x, double g, double b, + double ratedU1, double ratedU2, + int node1, int node2, + String idVoltageLevel1, String idVoltageLevel2, + String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, + String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { + TwoWindingsTransformer twt = createTwoWindingsTransformer(s, id, name, r, x, g, b, ratedU1, ratedU2, node1, node2, + idVoltageLevel1, idVoltageLevel2, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2); + twt.newPhaseTapChanger() + .setTapPosition(1) + .setRegulationTerminal(twt.getTerminal2()) + .setRegulationMode(PhaseTapChanger.RegulationMode.FIXED_TAP) + .setRegulationValue(200) + .beginStep() + .setAlpha(-20.0) + .setRho(1.0) + .setR(0.0) + .setX(0.0) + .setG(0.0) + .setB(0.0) + .endStep() + .beginStep() + .setAlpha(0.0) + .setRho(1.0) + .setR(0.0) + .setX(0.0) + .setG(0.0) + .setB(0.0) + .endStep() + .beginStep() + .setAlpha(20.0) + .setRho(1.0) + .setR(0.0) + .setX(0.0) + .setG(0.0) + .setB(0.0) + .endStep() + .add(); + } + + public static void createThreeWindingsTransformer(Substation s, String id, String name, + String vl1, String vl2, String vl3, + double r1, double r2, double r3, + double x1, double x2, double x3, + double g1, double b1, + double ratedU1, double ratedU2, double ratedU3, + int node1, int node2, int node3, + String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, + String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2, + String feederName3, Integer feederOrder3, ConnectablePosition.Direction direction3) { + ThreeWindingsTransformer t = s.newThreeWindingsTransformer() + .setId(id) + .setName(name) + .newLeg1() + .setR(r1) + .setX(x1) + .setG(g1) + .setB(b1) + .setRatedU(ratedU1) + .setVoltageLevel(vl1) + .setNode(node1) + .add() + .newLeg2() + .setR(r2) + .setX(x2) + .setRatedU(ratedU2) + .setVoltageLevel(vl2) + .setNode(node2) + .add() + .newLeg3() + .setR(r3) + .setX(x3) + .setRatedU(ratedU3) + .setVoltageLevel(vl3) + .setNode(node3) + .add() + .add(); + + addThreeFeedersPosition(t, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2, feederName3, feederOrder3, direction3); + } + + public static void createLine(Network network, + String id, String name, + double r, double x, + double g1, double b1, + double g2, double b2, + int node1, int node2, + String idVoltageLevel1, String idVoltageLevel2, + String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, + String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { + Line line = network.newLine() + .setId(id) + .setName(name) + .setR(r) + .setX(x) + .setG1(g1) + .setB1(b1) + .setG2(g2) + .setB2(b2) + .setNode1(node1) + .setVoltageLevel1(idVoltageLevel1) + .setNode2(node2) + .setVoltageLevel2(idVoltageLevel2) + .add(); + addTwoFeedersPosition(line, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2); + } + + private static void addFeederPosition(Extendable extendable, String feederName, Integer feederOrder, ConnectablePosition.Direction direction) { + ConnectablePositionAdder.FeederAdder feederAdder = extendable.newExtension(ConnectablePositionAdder.class).newFeeder(); + if (feederOrder != null) { + feederAdder.withOrder(feederOrder); + } + feederAdder.withDirection(direction).withName(feederName).add() + .add(); + } + + private static void addTwoFeedersPosition(Extendable extendable, + String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, + String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { + ConnectablePositionAdder extensionAdder = extendable.newExtension(ConnectablePositionAdder.class); + ConnectablePositionAdder.FeederAdder feederAdder1 = extensionAdder.newFeeder1(); + if (feederOrder1 != null) { + feederAdder1.withOrder(feederOrder1); + } + feederAdder1.withName(feederName1).withDirection(direction1).add(); + ConnectablePositionAdder.FeederAdder feederAdder2 = extensionAdder.newFeeder2(); + if (feederOrder2 != null) { + feederAdder2.withOrder(feederOrder2); + } + feederAdder2.withName(feederName2).withDirection(direction2).add(); + extensionAdder.add(); + } + + private static void addThreeFeedersPosition(Extendable extendable, + String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, + String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2, + String feederName3, Integer feederOrder3, ConnectablePosition.Direction direction3) { + ConnectablePositionAdder extensionAdder = extendable.newExtension(ConnectablePositionAdder.class); + ConnectablePositionAdder.FeederAdder feederAdder1 = extensionAdder.newFeeder1(); + if (feederOrder1 != null) { + feederAdder1.withOrder(feederOrder1); + } + feederAdder1.withName(feederName1).withDirection(direction1).add(); + ConnectablePositionAdder.FeederAdder feederAdder2 = extensionAdder.newFeeder2(); + if (feederOrder2 != null) { + feederAdder2.withOrder(feederOrder2); + } + feederAdder2.withName(feederName2).withDirection(direction2).add(); + ConnectablePositionAdder.FeederAdder feederAdder3 = extensionAdder.newFeeder3(); + if (feederOrder3 != null) { + feederAdder3.withOrder(feederOrder3); + } + feederAdder3.withName(feederName3).withDirection(direction3).add(); + extensionAdder.add(); + } } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/AbstractTestCaseIidm.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/AbstractTestCaseIidm.java index 053c8b94d..184fa2dab 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/AbstractTestCaseIidm.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/AbstractTestCaseIidm.java @@ -6,11 +6,7 @@ */ package com.powsybl.sld.iidm; -import com.powsybl.commons.extensions.Extendable; import com.powsybl.iidm.network.*; -import com.powsybl.iidm.network.extensions.BusbarSectionPositionAdder; -import com.powsybl.iidm.network.extensions.ConnectablePosition; -import com.powsybl.iidm.network.extensions.ConnectablePositionAdder; import com.powsybl.sld.AbstractTestCase; import com.powsybl.sld.builders.GraphBuilder; import com.powsybl.sld.layout.HorizontalSubstationLayoutFactory; @@ -51,300 +47,6 @@ protected StyleProvider getDefaultDiagramStyleProvider() { return new StyleProvidersList(new TopologicalStyleProvider(network), new HighlightLineStateStyleProvider(network)); } - protected static Substation createSubstation(Network n, String id, String name, Country country) { - return n.newSubstation() - .setId(id) - .setName(name) - .setCountry(country) - .add(); - } - - protected static VoltageLevel createVoltageLevel(Substation s, String id, String name, - TopologyKind topology, double vNom, int nodeCount) { - VoltageLevel vl = s.newVoltageLevel() - .setId(id) - .setName(name) - .setTopologyKind(topology) - .setNominalV(vNom) - .add(); - return vl; - } - - protected static void createSwitch(VoltageLevel vl, String id, String name, SwitchKind kind, boolean retained, boolean open, boolean fictitious, int node1, int node2) { - vl.getNodeBreakerView().newSwitch() - .setId(id) - .setName(name) - .setKind(kind) - .setRetained(retained) - .setOpen(open) - .setFictitious(fictitious) - .setNode1(node1) - .setNode2(node2) - .add(); - } - - protected static void createInternalConnection(VoltageLevel vl, int node1, int node2) { - vl.getNodeBreakerView().newInternalConnection() - .setNode1(node1) - .setNode2(node2) - .add(); - } - - protected static void createBusBarSection(VoltageLevel vl, String id, String name, int node, int busbarIndex, int sectionIndex) { - BusbarSection bbs = vl.getNodeBreakerView().newBusbarSection() - .setId(id) - .setName(name) - .setNode(node) - .add(); - bbs.newExtension(BusbarSectionPositionAdder.class) - .withBusbarIndex(busbarIndex) - .withSectionIndex(sectionIndex) - .add(); - } - - protected static void createLoad(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, - ConnectablePosition.Direction direction, int node, double p0, double q0) { - Load load = vl.newLoad() - .setId(id) - .setName(name) - .setNode(node) - .setP0(p0) - .setQ0(q0) - .add(); - addFeederPosition(load, feederName, feederOrder, direction); - } - - protected static void createGenerator(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, - ConnectablePosition.Direction direction, int node, - double minP, double maxP, boolean voltageRegulator, - double targetP, double targetQ) { - Generator gen = vl.newGenerator() - .setId(id) - .setName(name) - .setNode(node) - .setMinP(minP) - .setMaxP(maxP) - .setVoltageRegulatorOn(voltageRegulator) - .setTargetP(targetP) - .setTargetQ(targetQ) - .add(); - addFeederPosition(gen, feederName, feederOrder, direction); - } - - protected static void createBattery(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, - ConnectablePosition.Direction direction, int node, - double minP, double maxP, - double targetP, double targetQ) { - Battery battery = vl.newBattery() - .setId(id) - .setName(name) - .setNode(node) - .setMinP(minP) - .setMaxP(maxP) - .setTargetP(targetP) - .setTargetQ(targetQ) - .add(); - addFeederPosition(battery, feederName, feederOrder, direction); - } - - protected static void createShunt(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, - ConnectablePosition.Direction direction, int node, - double bPerSection, int maximumSectionCount, int currentSectionCount) { - ShuntCompensator shunt = vl.newShuntCompensator() - .setId(id) - .setName(name) - .setNode(node) - .setSectionCount(currentSectionCount) - .newLinearModel() - .setBPerSection(bPerSection) - .setMaximumSectionCount(maximumSectionCount) - .add() - .add(); - addFeederPosition(shunt, feederName, feederOrder, direction); - } - - protected static TwoWindingsTransformer createTwoWindingsTransformer(Substation s, String id, String name, - double r, double x, double g, double b, - double ratedU1, double ratedU2, - int node1, int node2, - String idVoltageLevel1, String idVoltageLevel2, - String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, - String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { - TwoWindingsTransformer t = s.newTwoWindingsTransformer() - .setId(id) - .setName(name) - .setR(r) - .setX(x) - .setG(g) - .setB(b) - .setRatedU1(ratedU1) - .setRatedU2(ratedU2) - .setNode1(node1) - .setVoltageLevel1(idVoltageLevel1) - .setNode2(node2) - .setVoltageLevel2(idVoltageLevel2) - .add(); - addTwoFeedersPosition(t, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2); - return t; - } - - protected static void createPhaseShiftTransformer(Substation s, String id, String name, - double r, double x, double g, double b, - double ratedU1, double ratedU2, - int node1, int node2, - String idVoltageLevel1, String idVoltageLevel2, - String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, - String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { - TwoWindingsTransformer twt = createTwoWindingsTransformer(s, id, name, r, x, g, b, ratedU1, ratedU2, node1, node2, - idVoltageLevel1, idVoltageLevel2, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2); - twt.newPhaseTapChanger() - .setTapPosition(1) - .setRegulationTerminal(twt.getTerminal2()) - .setRegulationMode(PhaseTapChanger.RegulationMode.FIXED_TAP) - .setRegulationValue(200) - .beginStep() - .setAlpha(-20.0) - .setRho(1.0) - .setR(0.0) - .setX(0.0) - .setG(0.0) - .setB(0.0) - .endStep() - .beginStep() - .setAlpha(0.0) - .setRho(1.0) - .setR(0.0) - .setX(0.0) - .setG(0.0) - .setB(0.0) - .endStep() - .beginStep() - .setAlpha(20.0) - .setRho(1.0) - .setR(0.0) - .setX(0.0) - .setG(0.0) - .setB(0.0) - .endStep() - .add(); - } - - protected static void createThreeWindingsTransformer(Substation s, String id, String name, - String vl1, String vl2, String vl3, - double r1, double r2, double r3, - double x1, double x2, double x3, - double g1, double b1, - double ratedU1, double ratedU2, double ratedU3, - int node1, int node2, int node3, - String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, - String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2, - String feederName3, Integer feederOrder3, ConnectablePosition.Direction direction3) { - ThreeWindingsTransformer t = s.newThreeWindingsTransformer() - .setId(id) - .setName(name) - .newLeg1() - .setR(r1) - .setX(x1) - .setG(g1) - .setB(b1) - .setRatedU(ratedU1) - .setVoltageLevel(vl1) - .setNode(node1) - .add() - .newLeg2() - .setR(r2) - .setX(x2) - .setRatedU(ratedU2) - .setVoltageLevel(vl2) - .setNode(node2) - .add() - .newLeg3() - .setR(r3) - .setX(x3) - .setRatedU(ratedU3) - .setVoltageLevel(vl3) - .setNode(node3) - .add() - .add(); - - addThreeFeedersPosition(t, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2, feederName3, feederOrder3, direction3); - } - - protected static void createLine(Network network, - String id, String name, - double r, double x, - double g1, double b1, - double g2, double b2, - int node1, int node2, - String idVoltageLevel1, String idVoltageLevel2, - String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, - String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { - Line line = network.newLine() - .setId(id) - .setName(name) - .setR(r) - .setX(x) - .setG1(g1) - .setB1(b1) - .setG2(g2) - .setB2(b2) - .setNode1(node1) - .setVoltageLevel1(idVoltageLevel1) - .setNode2(node2) - .setVoltageLevel2(idVoltageLevel2) - .add(); - addTwoFeedersPosition(line, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2); - } - - private static void addFeederPosition(Extendable extendable, String feederName, Integer feederOrder, ConnectablePosition.Direction direction) { - ConnectablePositionAdder.FeederAdder feederAdder = extendable.newExtension(ConnectablePositionAdder.class).newFeeder(); - if (feederOrder != null) { - feederAdder.withOrder(feederOrder); - } - feederAdder.withDirection(direction).withName(feederName).add() - .add(); - } - - private static void addTwoFeedersPosition(Extendable extendable, - String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, - String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { - ConnectablePositionAdder extensionAdder = extendable.newExtension(ConnectablePositionAdder.class); - ConnectablePositionAdder.FeederAdder feederAdder1 = extensionAdder.newFeeder1(); - if (feederOrder1 != null) { - feederAdder1.withOrder(feederOrder1); - } - feederAdder1.withName(feederName1).withDirection(direction1).add(); - ConnectablePositionAdder.FeederAdder feederAdder2 = extensionAdder.newFeeder2(); - if (feederOrder2 != null) { - feederAdder2.withOrder(feederOrder2); - } - feederAdder2.withName(feederName2).withDirection(direction2).add(); - extensionAdder.add(); - } - - private static void addThreeFeedersPosition(Extendable extendable, - String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, - String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2, - String feederName3, Integer feederOrder3, ConnectablePosition.Direction direction3) { - ConnectablePositionAdder extensionAdder = extendable.newExtension(ConnectablePositionAdder.class); - ConnectablePositionAdder.FeederAdder feederAdder1 = extensionAdder.newFeeder1(); - if (feederOrder1 != null) { - feederAdder1.withOrder(feederOrder1); - } - feederAdder1.withName(feederName1).withDirection(direction1).add(); - ConnectablePositionAdder.FeederAdder feederAdder2 = extensionAdder.newFeeder2(); - if (feederOrder2 != null) { - feederAdder2.withOrder(feederOrder2); - } - feederAdder2.withName(feederName2).withDirection(direction2).add(); - ConnectablePositionAdder.FeederAdder feederAdder3 = extensionAdder.newFeeder3(); - if (feederOrder3 != null) { - feederAdder3.withOrder(feederOrder3); - } - feederAdder3.withName(feederName3).withDirection(direction3).add(); - extensionAdder.add(); - } - @Override protected void voltageLevelGraphLayout(VoltageLevelGraph voltageLevelGraph) { new SmartVoltageLevelLayoutFactory(network).create(voltageLevelGraph).run(layoutParameters); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/CreateNetworksUtil.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/CreateNetworksUtil.java deleted file mode 100644 index a3d8b0962..000000000 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/CreateNetworksUtil.java +++ /dev/null @@ -1,551 +0,0 @@ -/** - * Copyright (c) 2021, 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.sld.iidm; - -import com.powsybl.iidm.network.*; -import com.powsybl.iidm.network.extensions.BranchStatus; -import com.powsybl.iidm.network.extensions.BranchStatusAdder; -import com.powsybl.iidm.network.extensions.BusbarSectionPositionAdder; -import com.powsybl.iidm.network.extensions.ConnectablePosition; - -import static com.powsybl.sld.iidm.AbstractTestCaseIidm.*; - -/** - * @author Slimane Amar - */ -public final class CreateNetworksUtil { - - private CreateNetworksUtil() { - } - - static Network createNodeBreakerNetworkWithBranchStatus(String id, String sourceFormat) { - Network network = createNodeBreakerNetworkWithInternalBranches(id, sourceFormat); - - createStatusExtensions(network); - - return network; - } - - static Network createBusBreakerNetworkWithBranchStatus(String id, String sourceFormat) { - Network network = createBusBreakerNetworkWithInternalBranches(id, sourceFormat); - - createStatusExtensions(network); - - return network; - } - - private static void createStatusExtensions(Network network) { - network.getLine("L11").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.PLANNED_OUTAGE).add(); - network.getLine("L12").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); - - network.getTwoWindingsTransformer("T11").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.PLANNED_OUTAGE).add(); - network.getTwoWindingsTransformer("T12").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); - - network.getThreeWindingsTransformer("T3_12").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); - } - - static Network createNodeBreakerNetworkWithInternalBranches(String id, String sourceFormat) { - Network network = Network.create(id, sourceFormat); - Substation substation = createSubstation(network, "S1", "S1", Country.FR); - - VoltageLevel vl1 = createVoltageLevel(substation, "VL1", "VL1", TopologyKind.NODE_BREAKER, 400, 24); - - createBusBarSection(vl1, "BBS11", "BBS11", 10, 1, 1); - createBusBarSection(vl1, "BBS12", "BBS12", 20, 2, 1); - - createSwitch(vl1, "D10", "D10", SwitchKind.DISCONNECTOR, false, false, false, 10, 120); - createSwitch(vl1, "BR1", "BR1", SwitchKind.BREAKER, false, false, false, 120, 121); - createSwitch(vl1, "D20", "D20", SwitchKind.DISCONNECTOR, false, false, false, 121, 20); - - createLoad(vl1, "L1", "L1", "L1", null, ConnectablePosition.Direction.TOP, 12, 1, 1); - - createSwitch(vl1, "D11", "D11", SwitchKind.DISCONNECTOR, false, false, false, 10, 11); - createSwitch(vl1, "BR12", "BR12", SwitchKind.BREAKER, false, false, false, 11, 12); - - createGenerator(vl1, "G", "G", "G", null, ConnectablePosition.Direction.TOP, 22, 50, 100, false, 100, 400); - - createSwitch(vl1, "D21", "D21", SwitchKind.DISCONNECTOR, false, false, false, 20, 21); - createSwitch(vl1, "BR22", "BR22", SwitchKind.BREAKER, false, false, false, 21, 22); - - createSwitch(vl1, "D13", "D13", SwitchKind.DISCONNECTOR, false, false, false, 10, 13); - createSwitch(vl1, "BR14", "BR14", SwitchKind.BREAKER, false, false, false, 13, 14); - - createSwitch(vl1, "D23", "D23", SwitchKind.DISCONNECTOR, false, false, false, 20, 23); - createSwitch(vl1, "BR24", "BR24", SwitchKind.BREAKER, false, false, false, 23, 24); - - createLine(network, "L11", "L11", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, - 14, 24, vl1.getId(), vl1.getId(), - "L11", null, ConnectablePosition.Direction.TOP, - "L11", null, ConnectablePosition.Direction.TOP); - - VoltageLevel vl2 = createVoltageLevel(substation, "VL2", "VL2", TopologyKind.NODE_BREAKER, 400, 9); - - createBusBarSection(vl2, "BBS2", "BBS2", 30, 1, 1); - - createLoad(vl2, "L2", "L2", "L2", null, ConnectablePosition.Direction.TOP, 32, 1, 1); - - createSwitch(vl2, "D31", "D31", SwitchKind.DISCONNECTOR, false, false, false, 30, 31); - createSwitch(vl2, "BR32", "BR32", SwitchKind.BREAKER, false, false, false, 31, 32); - - createSwitch(vl1, "D15", "D15", SwitchKind.DISCONNECTOR, false, false, false, 10, 15); - createSwitch(vl1, "BR16", "BR16", SwitchKind.BREAKER, false, false, false, 15, 16); - - createSwitch(vl2, "D33", "D33", SwitchKind.DISCONNECTOR, false, false, false, 30, 33); - createSwitch(vl2, "BR34", "BR34", SwitchKind.BREAKER, false, false, false, 33, 34); - - createLine(network, "L12", "L12", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, - 16, 34, vl1.getId(), vl2.getId(), - "L12", null, ConnectablePosition.Direction.TOP, - "L12", null, ConnectablePosition.Direction.TOP); - - createSwitch(vl1, "D17", "D17", SwitchKind.DISCONNECTOR, false, false, false, 10, 17); - createSwitch(vl1, "BR18", "BR18", SwitchKind.BREAKER, false, false, false, 17, 18); - - createSwitch(vl1, "D25", "D25", SwitchKind.DISCONNECTOR, false, false, false, 20, 25); - createSwitch(vl1, "BR26", "BR26", SwitchKind.BREAKER, false, false, false, 25, 26); - - createTwoWindingsTransformer(substation, "T11", "T11", 250, 100, 52, 12, 65, 90, - 18, 26, vl1.getId(), vl1.getId(), - "T11", null, ConnectablePosition.Direction.TOP, - "T11", null, ConnectablePosition.Direction.TOP); - - TwoWindingsTransformer twoWindingsTransformer = network.getTwoWindingsTransformer("T11"); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setP(375); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setP(375); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setQ(48); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setQ(48); - - createSwitch(vl1, "D27", "D27", SwitchKind.DISCONNECTOR, false, false, false, 20, 27); - createSwitch(vl1, "BR28", "BR28", SwitchKind.BREAKER, false, false, false, 27, 28); - - createSwitch(vl2, "D35", "D35", SwitchKind.DISCONNECTOR, false, false, false, 30, 35); - createSwitch(vl2, "BR36", "BR36", SwitchKind.BREAKER, false, false, false, 35, 36); - - createTwoWindingsTransformer(substation, "T12", "T12", 250, 100, 52, 12, 65, 90, - 28, 36, vl1.getId(), vl2.getId(), - "T12", null, ConnectablePosition.Direction.TOP, - "T12", null, ConnectablePosition.Direction.TOP); - - twoWindingsTransformer = network.getTwoWindingsTransformer("T12"); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setP(375); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setP(375); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setQ(48); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setQ(48); - - createSwitch(vl1, "D19", "D19", SwitchKind.DISCONNECTOR, false, false, false, 10, 19); - createSwitch(vl1, "BR20", "BR20", SwitchKind.BREAKER, false, false, false, 19, 190); - - createSwitch(vl1, "D29", "D29", SwitchKind.DISCONNECTOR, false, false, false, 20, 29); - createSwitch(vl1, "BR30", "BR30", SwitchKind.BREAKER, false, false, false, 29, 290); - - createSwitch(vl2, "D37", "D37", SwitchKind.DISCONNECTOR, false, false, false, 30, 37); - createSwitch(vl2, "BR38", "BR38", SwitchKind.BREAKER, false, false, false, 37, 38); - - createThreeWindingsTransformer(substation, "T3_12", "T3_12", vl1.getId(), vl1.getId(), vl2.getId(), - 45, 47, 49, 35, 32, 39., 25, 15, - 5, 7, 9, - 190, 290, 38, - "T3_12", null, ConnectablePosition.Direction.TOP, - "T3_12", null, ConnectablePosition.Direction.TOP, - "T3_12", null, ConnectablePosition.Direction.TOP); - - return network; - } - - static Network createBusBreakerNetworkWithInternalBranches(String id, String sourceFormat) { - Network network = Network.create(id, sourceFormat); - Substation substation = createSubstation(network, "S1", "S1", Country.FR); - - VoltageLevel vl1 = createVoltageLevel(substation, "VL1", "VL1", TopologyKind.BUS_BREAKER, 400, -1); - - vl1.getBusBreakerView().newBus() - .setId("B11") - .add(); - vl1.newLoad() - .setId("LD1") - .setConnectableBus("B11") - .setBus("B11") - .setP0(1.0) - .setQ0(1.0) - .add(); - - network.getVoltageLevel("VL1").getBusBreakerView().newBus() - .setId("B12") - .add(); - vl1.getBusBreakerView().newSwitch() - .setId("BR1") - .setBus1("B12") - .setBus2("B11") - .setOpen(true) - .add(); - - vl1.newGenerator() - .setId("G") - .setBus("B12") - .setConnectableBus("B12") - .setMaxP(100.0) - .setMinP(50.0) - .setTargetP(100.0) - .setTargetV(400.0) - .setVoltageRegulatorOn(true) - .add(); - - network.newLine() - .setId("L11") - .setVoltageLevel1("VL1") - .setConnectableBus1("B11") - .setBus1("B11") - .setVoltageLevel2("VL1") - .setConnectableBus2("B12") - .setBus2("B12") - .setR(1.0) - .setX(1.0) - .setG1(0.0) - .setB1(0.0) - .setG2(0.0) - .setB2(0.0) - .add(); - - TwoWindingsTransformer twt = substation.newTwoWindingsTransformer() - .setId("T11") - .setVoltageLevel1("VL1") - .setBus1("B11") - .setConnectableBus1("B11") - .setVoltageLevel2("VL1") - .setBus2("B12") - .setConnectableBus2("B12") - .setR(250) - .setX(100) - .setG(52) - .setB(12) - .setRatedU1(65) - .setRatedU2(90) - .add(); - twt.newPhaseTapChanger() - .setTapPosition(1) - .setRegulationTerminal(twt.getTerminal2()) - .setRegulationMode(PhaseTapChanger.RegulationMode.FIXED_TAP) - .setRegulationValue(400) - .beginStep() - .setAlpha(-20.0) - .setRho(1.0) - .setR(0.0) - .setX(0.0) - .setG(0.0) - .setB(0.0) - .endStep() - .beginStep() - .setAlpha(0.0) - .setRho(1.0) - .setR(0.0) - .setX(0.0) - .setG(0.0) - .setB(0.0) - .endStep() - .beginStep() - .setAlpha(20.0) - .setRho(1.0) - .setR(0.0) - .setX(0.0) - .setG(0.0) - .setB(0.0) - .endStep() - .add(); - - VoltageLevel vl2 = substation.newVoltageLevel() - .setId("VL2") - .setNominalV(400.0) - .setTopologyKind(TopologyKind.BUS_BREAKER) - .add(); - vl2.getBusBreakerView().newBus() - .setId("B21") - .add(); - vl2.newLoad() - .setId("LD2") - .setConnectableBus("B21") - .setBus("B21") - .setP0(1.0) - .setQ0(1.0) - .add(); - - network.newLine() - .setId("L12") - .setVoltageLevel1("VL1") - .setConnectableBus1("B11") - .setBus1("B11") - .setVoltageLevel2("VL2") - .setConnectableBus2("B21") - .setBus2("B21") - .setR(1.0) - .setX(1.0) - .setG1(0.0) - .setB1(0.0) - .setG2(0.0) - .setB2(0.0) - .add(); - - substation.newTwoWindingsTransformer() - .setId("T12") - .setVoltageLevel1("VL1") - .setBus1("B12") - .setConnectableBus1("B12") - .setVoltageLevel2("VL2") - .setBus2("B21") - .setConnectableBus2("B21") - .setR(250) - .setX(100) - .setG(52) - .setB(12) - .setRatedU1(65) - .setRatedU2(90) - .add(); - - ThreeWindingsTransformer threeWindingsTransformer = substation.newThreeWindingsTransformer() - .setId("T3_12") - .setRatedU0(234) - .newLeg1() - .setVoltageLevel("VL1") - .setBus("B11") - .setConnectableBus("B11") - .setR(45) - .setX(35) - .setG(25) - .setB(15) - .setRatedU(5) - .add() - .newLeg2() - .setVoltageLevel("VL1") - .setBus("B12") - .setConnectableBus("B12") - .setR(47) - .setX(37) - .setG(27) - .setB(17) - .setRatedU(7) - .add() - .newLeg3() - .setVoltageLevel("VL2") - .setBus("B21") - .setConnectableBus("B21") - .setR(49) - .setX(39) - .setG(29) - .setB(19) - .setRatedU(9) - .add() - .add(); - - return network; - } - - public static Network createNetworkWithSvcVscScDl() { - Network network = Network.create("testCase1", "test"); - Substation substation = network.newSubstation().setId("s").setCountry(Country.FR).add(); - VoltageLevel vl = substation.newVoltageLevel().setId("vl").setTopologyKind(TopologyKind.NODE_BREAKER).setNominalV(380).add(); - VoltageLevel.NodeBreakerView view = vl.getNodeBreakerView(); - BusbarSection bbs = view.newBusbarSection().setId("bbs").setNode(0).add(); - bbs.newExtension(BusbarSectionPositionAdder.class).withBusbarIndex(1).withSectionIndex(1); - BusbarSection bbs2 = view.newBusbarSection().setId("bbs2").setNode(3).add(); - bbs2.newExtension(BusbarSectionPositionAdder.class).withBusbarIndex(2).withSectionIndex(2); - StaticVarCompensator svc = vl.newStaticVarCompensator() - .setId("svc") - .setName("svc") - .setNode(2) - .setBmin(0.0002) - .setBmax(0.0008) - .setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE) - .setVoltageSetPoint(390) - .add(); - svc.getTerminal() - .setP(100.0) - .setQ(50.0); - VscConverterStation vsc = vl.newVscConverterStation() - .setId("vsc") - .setName("Converter1") - .setNode(1) - .setLossFactor(0.011f) - .setVoltageSetpoint(405.0) - .setVoltageRegulatorOn(true) - .add(); - vsc.getTerminal() - .setP(100.0) - .setQ(50.0); - ShuntCompensator c1 = vl.newShuntCompensator() - .setId("C1") - .setName("Filter 1") - .setNode(4) - .setSectionCount(1) - .newLinearModel() - .setBPerSection(1e-5) - .setMaximumSectionCount(1) - .add() - .add(); - DanglingLine dl1 = vl.newDanglingLine() - .setId("dl1") - .setName("Dangling line 1") - .setNode(5) - .setP0(1) - .setQ0(1) - .setR(0) - .setX(0) - .setB(0) - .setG(0) - .add(); - dl1.getTerminal() - .setP(100.0) - .setQ(50.0); - view.newDisconnector().setId("d").setNode1(0).setNode2(1).add(); - view.newBreaker().setId("b").setNode1(1).setNode2(2).add(); - view.newBreaker().setId("b2").setNode1(3).setNode2(4).add(); - view.newBreaker().setId("b3").setNode1(3).setNode2(5).add(); - view.newBreaker().setId("bt").setNode1(0).setNode2(3).add(); - - VoltageLevel vl2 = substation.newVoltageLevel().setId("vl2").setTopologyKind(TopologyKind.NODE_BREAKER).setNominalV(380).add(); - VoltageLevel.NodeBreakerView view2 = vl2.getNodeBreakerView(); - BusbarSection bbs1Vl2 = view2.newBusbarSection().setId("bbs1Vl2").setNode(0).add(); - bbs1Vl2.newExtension(BusbarSectionPositionAdder.class).withBusbarIndex(1).withSectionIndex(1); - BusbarSection bbs2Vl2 = view2.newBusbarSection().setId("bbs2Vl2").setNode(3).add(); - bbs2Vl2.newExtension(BusbarSectionPositionAdder.class).withBusbarIndex(2).withSectionIndex(2); - - VscConverterStation vsc2 = vl2.newVscConverterStation() - .setId("vsc2") - .setName("Converter2") - .setNode(1) - .setLossFactor(0.011f) - .setVoltageSetpoint(405.0) - .setVoltageRegulatorOn(true) - .add(); - vsc2.getTerminal() - .setP(300.0) - .setQ(75.0); - view2.newDisconnector().setId("d2").setNode1(0).setNode2(1).add(); - - network.newHvdcLine() - .setId("hvdc") - .setName("hvdc") - .setR(1) - .setNominalV(380) - .setMaxP(200) - .setActivePowerSetpoint(150) - .setConvertersMode(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER) - .setConverterStationId1("vsc") - .setConverterStationId2("vsc2") - .add(); - - return network; - } - - public static Network createNetworkWithFiveBusesFourLoads() { - Network network = createNetworkWithTwoParallelLoads(); - VoltageLevel vl = network.getVoltageLevel("vl1"); - - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); - createBusBarSection(vl, "bbs21", "bbs21", 1, 2, 1); - createBusBarSection(vl, "bbs22", "bbs22", 2, 2, 2); - createSwitch(vl, "bA", "bA", SwitchKind.BREAKER, false, false, false, 3, 4); - createLoad(vl, "loadA", "loadA", "loadA", null, ConnectablePosition.Direction.TOP, 4, 10, 10); - createSwitch(vl, "dA1", "dA1", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); - createSwitch(vl, "dA2", "dA2", SwitchKind.DISCONNECTOR, false, false, false, 1, 3); - - createSwitch(vl, "bB", "bB", SwitchKind.BREAKER, false, false, false, 5, 6); - createLoad(vl, "loadB", "loadB", "loadB", null, ConnectablePosition.Direction.TOP, 6, 10, 10); - createSwitch(vl, "dB1", "dB1", SwitchKind.DISCONNECTOR, false, false, false, 2, 5); - createSwitch(vl, "dB2", "dB2", SwitchKind.DISCONNECTOR, false, false, false, 0, 5); - - createSwitch(vl, "link", "link", SwitchKind.BREAKER, false, false, false, 5, 9); - - return network; - } - - public static Network createNetworkWithTwoParallelLoads() { - Network network = Network.create("TestSingleLineDiagramClass", "test"); - Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs13", "bbs13", 7, 1, 3); - createBusBarSection(vl, "bbs23", "bbs23", 8, 2, 3); - createLoad(vl, "loadC", "loadC", "loadC", null, ConnectablePosition.Direction.TOP, 9, 10, 10); - createSwitch(vl, "bCD1", "bCD1", SwitchKind.BREAKER, false, false, false, 8, 9); - createSwitch(vl, "bCD2", "bCD2", SwitchKind.BREAKER, false, false, false, 7, 9); - createSwitch(vl, "bCD3", "bCD3", SwitchKind.BREAKER, false, false, false, 7, 9); - createSwitch(vl, "bD1", "bD1", SwitchKind.BREAKER, false, false, false, 20, 9); - createLoad(vl, "loadD", "loadD", "loadD", null, ConnectablePosition.Direction.TOP, 20, 10, 10); - return network; - } - - public static Network createNetworkWithFourParallelLegs() { - Network network = Network.create("networkWithFourParallelLegs", "test"); - Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 3); - createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 3); - createSwitch(vl, "d1a", "d1an", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); - createSwitch(vl, "d2a", "d2an", SwitchKind.DISCONNECTOR, false, false, false, 1, 2); - createSwitch(vl, "b1", "b1n", SwitchKind.BREAKER, false, false, false, 2, 3); - createSwitch(vl, "d1b", "d1bn", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); - createSwitch(vl, "d2b", "d2bn", SwitchKind.DISCONNECTOR, false, false, false, 1, 3); - createSwitch(vl, "bl", "bln", SwitchKind.BREAKER, false, false, false, 3, 4); - createLoad(vl, "load", "load", "load displayed name", null, ConnectablePosition.Direction.BOTTOM, 4, 10, 10); - return network; - } - - public static Network createNetworkWithInternalPst() { - Network network = Network.create("networkWithInternalPst", "test"); - Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 3); - createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 3); - createSwitch(vl, "d1a", "d1an", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); - createSwitch(vl, "d2a", "d2an", SwitchKind.DISCONNECTOR, false, false, false, 1, 2); - createSwitch(vl, "bpst", "bpstn", SwitchKind.BREAKER, false, false, false, 2, 3); - createPhaseShiftTransformer(substation, "trf3", "trf3", 1.0, 14.745, 0.0, 3.2E-5, 380.0, 380.0, - 3, 4, vl.getId(), vl.getId(), - "pst1a", 1, ConnectablePosition.Direction.BOTTOM, - "pst1b", 1, ConnectablePosition.Direction.BOTTOM); - createSwitch(vl, "dpst", "dpstn", SwitchKind.BREAKER, false, true, false, 4, 5); - createSwitch(vl, "d1b", "d1bn", SwitchKind.DISCONNECTOR, false, true, false, 0, 5); - createSwitch(vl, "d2b", "d2bn", SwitchKind.DISCONNECTOR, false, true, false, 1, 5); - createSwitch(vl, "bl", "bln", SwitchKind.BREAKER, false, false, false, 5, 6); - createLoad(vl, "load", "load", "l", null, ConnectablePosition.Direction.BOTTOM, 6, 10, 10); - return network; - } - - public static Network createNetworkWithFlatSections() { - Network network = Network.create("TestSingleLineDiagramClass", "test"); - Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); - createBusBarSection(vl, "bbs21", "bbs21", 1, 2, 1); - createBusBarSection(vl, "bbs12", "bbs12", 2, 1, 2); - createBusBarSection(vl, "bbs22", "bbs22", 3, 2, 2); - createBusBarSection(vl, "bbs13", "bbs13", 4, 1, 3); - createBusBarSection(vl, "bbs23", "bbs23", 5, 2, 3); - createSwitch(vl, "d112", "d112", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); - createSwitch(vl, "d212", "d212", SwitchKind.DISCONNECTOR, false, false, false, 1, 3); - createSwitch(vl, "d123a", "d123a", SwitchKind.DISCONNECTOR, false, false, false, 2, 6); - createSwitch(vl, "b123", "b123", SwitchKind.BREAKER, false, false, false, 6, 7); - createSwitch(vl, "d123b", "d123b", SwitchKind.DISCONNECTOR, false, false, false, 7, 4); - createSwitch(vl, "d223a", "d223a", SwitchKind.DISCONNECTOR, false, false, false, 3, 8); - createSwitch(vl, "b223", "b223", SwitchKind.BREAKER, false, false, false, 8, 9); - createSwitch(vl, "d223b", "d223b", SwitchKind.DISCONNECTOR, false, false, false, 9, 5); - return network; - } - - public static Network createNetworkWithBatteries() { - Network network = Network.create("TestBatteries", "test"); - Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); - createSwitch(vl, "d1b", "d1b", SwitchKind.DISCONNECTOR, true, false, false, 1, 2); - createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, true, false, false, 0, 1); - createBattery(vl, "batt1", "batt1", "batt1", null, ConnectablePosition.Direction.TOP, 2, 1, 10, 5, 5); - createSwitch(vl, "d2b", "d2b", SwitchKind.DISCONNECTOR, true, true, false, 3, 4); - createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, true, true, false, 0, 3); - createBattery(vl, "batt2", "batt2", "batt2", null, ConnectablePosition.Direction.BOTTOM, 4, 3, 10, 6, 6); - return network; - } - -} diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/NetworkFactory.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/NetworkFactory.java deleted file mode 100644 index b71ffacf5..000000000 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/NetworkFactory.java +++ /dev/null @@ -1,203 +0,0 @@ -/** - * 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/. - * SPDX-License-Identifier: MPL-2.0 - */ -package com.powsybl.sld.iidm; - -import com.powsybl.iidm.network.*; -import com.powsybl.iidm.network.extensions.ConnectablePosition; - -import static com.powsybl.sld.iidm.AbstractTestCaseIidm.*; - -/** - * @author Florian Dupuy - */ -public final class NetworkFactory { - - private NetworkFactory() { - } - - public static Network createTestCase11Network() { - Network network = Network.create("testCase11", "test"); - - Substation substation = createSubstation(network, "subst", "subst", Country.FR); - - // first voltage level - // - VoltageLevel vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 50); - - createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); - createBusBarSection(vl1, "bbs2", "bbs2", 1, 1, 2); - createBusBarSection(vl1, "bbs3", "bbs3", 2, 2, 1); - createBusBarSection(vl1, "bbs4", "bbs4", 3, 2, 2); - - createSwitch(vl1, "dsect11", "dsect11", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); - createSwitch(vl1, "dtrct11", "dtrct11", SwitchKind.BREAKER, true, false, true, 14, 15); - createSwitch(vl1, "dsect12", "dsect12", SwitchKind.DISCONNECTOR, false, false, true, 15, 1); - - createSwitch(vl1, "dsect21", "dsect21", SwitchKind.DISCONNECTOR, false, false, true, 2, 16); - createSwitch(vl1, "dtrct21", "dtrct21", SwitchKind.BREAKER, true, false, true, 16, 17); - createSwitch(vl1, "dsect22", "dsect22", SwitchKind.DISCONNECTOR, false, false, true, 17, 3); - - createLoad(vl1, "load1", "load1", "load1", 0, ConnectablePosition.Direction.TOP, 4, 10, 10); - createSwitch(vl1, "dload1", "dload1", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); - createSwitch(vl1, "bload1", "bload1", SwitchKind.BREAKER, true, false, true, 4, 5); - - createGenerator(vl1, "gen1", "gen1", "gen1", 2, ConnectablePosition.Direction.BOTTOM, 6, 0, 20, false, 10, 10); - createSwitch(vl1, "dgen1", "dgen1", SwitchKind.DISCONNECTOR, false, false, true, 2, 7); - createSwitch(vl1, "bgen1", "bgen1", SwitchKind.BREAKER, true, false, true, 6, 7); - - createLoad(vl1, "load2", "load2", "load2", 8, ConnectablePosition.Direction.TOP, 8, 10, 10); - createSwitch(vl1, "dload2", "dload2", SwitchKind.DISCONNECTOR, false, false, true, 1, 9); - createSwitch(vl1, "bload2", "bload2", SwitchKind.BREAKER, true, false, true, 8, 9); - - createGenerator(vl1, "gen2", "gen2", "gen2", 12, ConnectablePosition.Direction.BOTTOM, 10, 0, 20, false, 10, 10); - createSwitch(vl1, "dgen2", "dgen2", SwitchKind.DISCONNECTOR, false, false, true, 3, 11); - createSwitch(vl1, "bgen2", "bgen2", SwitchKind.BREAKER, true, false, true, 10, 11); - - // second voltage level - // - VoltageLevel vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 30); - - createBusBarSection(vl2, "bbs5", "bbs5", 0, 1, 1); - createBusBarSection(vl2, "bbs6", "bbs6", 1, 2, 1); - - createSwitch(vl2, "dscpl1", "dscpl1", SwitchKind.DISCONNECTOR, false, false, true, 0, 6); - createSwitch(vl2, "ddcpl1", "ddcpl1", SwitchKind.BREAKER, true, false, true, 6, 7); - createSwitch(vl2, "dscpl2", "dscpl2", SwitchKind.DISCONNECTOR, false, false, true, 7, 1); - - createLoad(vl2, "load3", "load3", "load3", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl2, "dload3", "dload3", SwitchKind.DISCONNECTOR, false, false, true, 0, 3); - createSwitch(vl2, "bload3", "bload3", SwitchKind.BREAKER, true, false, true, 2, 3); - - createGenerator(vl2, "gen4", "gen4", "gen4", 2, ConnectablePosition.Direction.BOTTOM, 4, 0, 20, false, 10, 10); - createSwitch(vl2, "dgen4", "dgen4", SwitchKind.DISCONNECTOR, false, false, true, 1, 5); - createSwitch(vl2, "bgen4", "bgen4", SwitchKind.BREAKER, true, false, true, 4, 5); - - // third voltage level - // - VoltageLevel vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 50, 20); - - createBusBarSection(vl3, "bbs7", "bbs7", 0, 1, 1); - - createLoad(vl3, "load4", "load4", "load4", 0, ConnectablePosition.Direction.TOP, 1, 10, 10); - createSwitch(vl3, "dload4", "dload4", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); - createSwitch(vl3, "bload4", "bload4", SwitchKind.BREAKER, true, false, true, 2, 1); - - // two windings transformers between voltage levels - // - createSwitch(vl1, "dtrf11", "dtrf11", SwitchKind.DISCONNECTOR, false, false, true, 0, 18); - createSwitch(vl1, "btrf11", "btrf11", SwitchKind.BREAKER, true, false, true, 18, 19); - createSwitch(vl2, "dtrf21", "dtrf21", SwitchKind.DISCONNECTOR, false, false, true, 0, 8); - createSwitch(vl2, "btrf21", "btrf21", SwitchKind.BREAKER, true, false, true, 8, 9); - createTwoWindingsTransformer(substation, "trf1", "trf1", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, - 19, 9, vl1.getId(), vl2.getId(), - "trf1", 1, ConnectablePosition.Direction.TOP, - "trf1", 1, ConnectablePosition.Direction.TOP); - - createSwitch(vl1, "dtrf12", "dtrf12", SwitchKind.DISCONNECTOR, false, false, true, 1, 20); - createSwitch(vl1, "btrf12", "btrf12", SwitchKind.BREAKER, true, false, true, 20, 21); - createSwitch(vl2, "dtrf22", "dtrf22", SwitchKind.DISCONNECTOR, false, false, true, 1, 10); - createSwitch(vl2, "btrf22", "btrf22", SwitchKind.BREAKER, true, false, true, 10, 11); - createTwoWindingsTransformer(substation, "trf2", "trf2", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, - 21, 11, vl1.getId(), vl2.getId(), - "trf2", 11, ConnectablePosition.Direction.TOP, - "trf2", 7, ConnectablePosition.Direction.BOTTOM); - - createSwitch(vl1, "dtrf13", "dtrf13", SwitchKind.DISCONNECTOR, false, false, true, 2, 22); - createSwitch(vl1, "btrf13", "btrf13", SwitchKind.BREAKER, true, false, true, 22, 23); - createSwitch(vl2, "dtrf23", "dtrf23", SwitchKind.DISCONNECTOR, false, false, true, 1, 12); - createSwitch(vl2, "btrf23", "btrf23", SwitchKind.BREAKER, true, false, true, 12, 13); - createTwoWindingsTransformer(substation, "trf3", "trf3", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, - 23, 13, vl1.getId(), vl2.getId(), - "trf3", 3, ConnectablePosition.Direction.BOTTOM, - "trf3", 8, ConnectablePosition.Direction.BOTTOM); - - createSwitch(vl1, "dtrf14", "dtrf14", SwitchKind.DISCONNECTOR, false, false, true, 3, 24); - createSwitch(vl1, "btrf14", "btrf14", SwitchKind.BREAKER, true, false, true, 24, 25); - createSwitch(vl2, "dtrf24", "dtrf24", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); - createSwitch(vl2, "btrf24", "btrf24", SwitchKind.BREAKER, true, false, true, 14, 15); - createTwoWindingsTransformer(substation, "trf4", "trf4", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, - 25, 15, vl1.getId(), vl2.getId(), - "trf4", 10, ConnectablePosition.Direction.BOTTOM, - "trf4", 3, ConnectablePosition.Direction.TOP); - - createSwitch(vl1, "dtrf15", "dtrf15", SwitchKind.DISCONNECTOR, false, false, true, 0, 26); - createSwitch(vl1, "btrf15", "btrf15", SwitchKind.BREAKER, true, false, true, 26, 27); - createSwitch(vl3, "dtrf25", "dtrf25", SwitchKind.DISCONNECTOR, false, false, true, 0, 3); - createSwitch(vl3, "btrf25", "btrf25", SwitchKind.BREAKER, true, false, true, 3, 4); - createTwoWindingsTransformer(substation, "trf5", "trf5", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, - 27, 4, vl1.getId(), vl3.getId(), - "trf5", 4, ConnectablePosition.Direction.TOP, - "trf5", 1, ConnectablePosition.Direction.BOTTOM); - - // three windings transformers between voltage levels - // - createSwitch(vl1, "dtrf16", "dtrf16", SwitchKind.DISCONNECTOR, false, false, true, 0, 28); - createSwitch(vl1, "btrf16", "btrf16", SwitchKind.BREAKER, true, false, true, 28, 29); - createSwitch(vl2, "dtrf26", "dtrf26", SwitchKind.DISCONNECTOR, false, false, true, 1, 16); - createSwitch(vl2, "btrf26", "btrf26", SwitchKind.BREAKER, true, false, true, 16, 17); - createSwitch(vl3, "dtrf36", "dtrf36", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); - createSwitch(vl3, "btrf36", "btrf36", SwitchKind.BREAKER, true, false, true, 5, 6); - - createThreeWindingsTransformer(substation, "trf6", "trf6", vl1.getId(), vl2.getId(), vl3.getId(), - 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, - 400., 225., 50., - 29, 17, 6, - "trf61", 5, ConnectablePosition.Direction.TOP, - "trf62", 5, ConnectablePosition.Direction.TOP, - "trf63", 2, ConnectablePosition.Direction.TOP); - - createSwitch(vl1, "dtrf17", "dtrf17", SwitchKind.DISCONNECTOR, false, false, true, 2, 30); - createSwitch(vl1, "btrf17", "btrf17", SwitchKind.BREAKER, true, false, true, 30, 31); - createSwitch(vl2, "dtrf27", "dtrf27", SwitchKind.DISCONNECTOR, false, false, true, 0, 18); - createSwitch(vl2, "btrf27", "btrf27", SwitchKind.BREAKER, true, false, true, 18, 19); - createSwitch(vl3, "dtrf37", "dtrf37", SwitchKind.DISCONNECTOR, false, false, true, 0, 7); - createSwitch(vl3, "btrf37", "btrf37", SwitchKind.BREAKER, true, false, true, 7, 8); - - createThreeWindingsTransformer(substation, "trf7", "trf7", vl1.getId(), vl2.getId(), vl3.getId(), - 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, - 400., 225., 50., - 31, 19, 8, - "trf71", 6, ConnectablePosition.Direction.BOTTOM, - "trf72", 4, ConnectablePosition.Direction.TOP, - "trf73", 3, ConnectablePosition.Direction.BOTTOM); - - createSwitch(vl1, "dtrf18", "dtrf18", SwitchKind.DISCONNECTOR, false, false, true, 1, 32); - createSwitch(vl1, "btrf18", "btrf18", SwitchKind.BREAKER, true, false, true, 32, 33); - createSwitch(vl2, "dtrf28", "dtrf28", SwitchKind.DISCONNECTOR, false, false, true, 1, 20); - createSwitch(vl2, "btrf28", "btrf28", SwitchKind.BREAKER, true, false, true, 20, 21); - createSwitch(vl3, "dtrf38", "dtrf38", SwitchKind.DISCONNECTOR, false, false, true, 0, 9); - createSwitch(vl3, "btrf38", "btrf38", SwitchKind.BREAKER, true, false, true, 9, 10); - - createThreeWindingsTransformer(substation, "trf8", "trf8", vl1.getId(), vl2.getId(), vl3.getId(), - 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, - 400., 225., 50., - 33, 21, 10, - "trf81", 9, ConnectablePosition.Direction.TOP, - "trf82", 6, ConnectablePosition.Direction.BOTTOM, - "trf83", 4, ConnectablePosition.Direction.TOP); - - // Creation of another substation, another voltageLevel and a line between the two substations - // - Substation substation2 = createSubstation(network, "subst2", "subst2", Country.FR); - VoltageLevel vlSubst2 = createVoltageLevel(substation2, "vlSubst2", "vlSubst2", TopologyKind.NODE_BREAKER, 380, 50); - - createBusBarSection(vlSubst2, "bbs1_2", "bbs1_2", 0, 1, 1); - - createSwitch(vl1, "dline11_2", "dline11_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 34); - createSwitch(vl1, "bline11_2", "bline11_2", SwitchKind.BREAKER, true, false, true, 34, 35); - createSwitch(vlSubst2, "dline21_2", "dline21_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 1); - createSwitch(vlSubst2, "bline21_2", "bline21_2", SwitchKind.BREAKER, true, false, true, 1, 2); - createLine(network, "line1", "line1", 2.0, 14.745, 1.0, 1.0, 1.0, 1.0, - 35, 2, vl1.getId(), vlSubst2.getId(), - "line1", 7, ConnectablePosition.Direction.TOP, - "line1", 1, ConnectablePosition.Direction.TOP); - - return network; - } - -} diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestBattery.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestBattery.java index 0b3b6b043..2c31e37d0 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestBattery.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestBattery.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.model.graphs.VoltageLevelGraph; import org.junit.jupiter.api.BeforeEach; @@ -22,7 +23,7 @@ class TestBattery extends AbstractTestCaseIidm { @BeforeEach public void setUp() throws IOException { - network = CreateNetworksUtil.createNetworkWithBatteries(); + network = Networks.createNetworkWithBatteries(); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1.java index c170acb1a..5d95b2cdb 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -40,12 +41,12 @@ class TestCase1 extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase10TestBreakerToBus.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase10TestBreakerToBus.java index 18b614218..4aa213810 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase10TestBreakerToBus.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase10TestBreakerToBus.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -33,10 +34,10 @@ class TestCase10TestBreakerToBus extends AbstractTestCaseIidm { @Override public void setUp() { network = Network.create("testCase1", "AbstractTest"); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 0, 2); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 0, 2); } } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase11FlatDesignComponents.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase11FlatDesignComponents.java index 02c395400..5d0265b99 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase11FlatDesignComponents.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase11FlatDesignComponents.java @@ -7,6 +7,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.library.FlatDesignLibrary; import com.powsybl.sld.library.ResourcesComponentLibrary; @@ -25,7 +26,7 @@ class TestCase11FlatDesignComponents extends AbstractTestCaseIidm { @BeforeEach public void setUp() { - network = NetworkFactory.createTestCase11Network(); + network = Networks.createTestCase11Network(); substation = network.getSubstation("subst"); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase11SubstationGraph.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase11SubstationGraph.java index 2060aaebc..649eaef09 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase11SubstationGraph.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase11SubstationGraph.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.layout.HorizontalSubstationLayoutFactory; @@ -30,7 +31,7 @@ class TestCase11SubstationGraph extends AbstractTestCaseIidm { @BeforeEach public void setUp() { - network = NetworkFactory.createTestCase11Network(); + network = Networks.createTestCase11Network(); substation = network.getSubstation("subst"); graphBuilder = new NetworkGraphBuilder(network); } @@ -95,7 +96,7 @@ void testVertical() { void testRight3wtOrientation() { // build substation graph network.getThreeWindingsTransformer("trf7").remove(); - createThreeWindingsTransformer(substation, "trf7", "trf7", "vl3", "vl2", "vl1", + Networks.createThreeWindingsTransformer(substation, "trf7", "trf7", "vl3", "vl2", "vl1", 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, 50., 225., 400., 8, 19, 31, @@ -115,7 +116,7 @@ void testRight3wtOrientation() { void testLeft3wtOrientation() { // build substation graph network.getThreeWindingsTransformer("trf7").remove(); - createThreeWindingsTransformer(substation, "trf7", "trf7", "vl2", "vl1", "vl3", + Networks.createThreeWindingsTransformer(substation, "trf7", "trf7", "vl2", "vl1", "vl3", 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, 225., 400., 50., 19, 31, 8, diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java index 9804e2321..3f97c266f 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.sld.builders.NetworkGraphBuilder; @@ -39,130 +40,130 @@ public void setUp() { network = Network.create("testCase11", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "subst", "subst", Country.FR); + substation = Networks.createSubstation(network, "subst", "subst", Country.FR); // first voltage level // - vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 50); + vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 50); - createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); - createBusBarSection(vl1, "bbs2", "bbs2", 1, 1, 2); - createBusBarSection(vl1, "bbs3", "bbs3", 2, 2, 1); - createBusBarSection(vl1, "bbs4", "bbs4", 3, 2, 2); + Networks.createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); + Networks.createBusBarSection(vl1, "bbs2", "bbs2", 1, 1, 2); + Networks.createBusBarSection(vl1, "bbs3", "bbs3", 2, 2, 1); + Networks.createBusBarSection(vl1, "bbs4", "bbs4", 3, 2, 2); - createSwitch(vl1, "dsect11", "dsect11", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); - createSwitch(vl1, "dtrct11", "dtrct11", SwitchKind.BREAKER, true, false, true, 14, 15); - createSwitch(vl1, "dsect12", "dsect12", SwitchKind.DISCONNECTOR, false, false, true, 15, 1); + Networks.createSwitch(vl1, "dsect11", "dsect11", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); + Networks.createSwitch(vl1, "dtrct11", "dtrct11", SwitchKind.BREAKER, true, false, true, 14, 15); + Networks.createSwitch(vl1, "dsect12", "dsect12", SwitchKind.DISCONNECTOR, false, false, true, 15, 1); - createSwitch(vl1, "dsect21", "dsect21", SwitchKind.DISCONNECTOR, false, false, true, 2, 16); - createSwitch(vl1, "dtrct21", "dtrct21", SwitchKind.BREAKER, true, false, true, 16, 17); - createSwitch(vl1, "dsect22", "dsect22", SwitchKind.DISCONNECTOR, false, false, true, 17, 3); + Networks.createSwitch(vl1, "dsect21", "dsect21", SwitchKind.DISCONNECTOR, false, false, true, 2, 16); + Networks.createSwitch(vl1, "dtrct21", "dtrct21", SwitchKind.BREAKER, true, false, true, 16, 17); + Networks.createSwitch(vl1, "dsect22", "dsect22", SwitchKind.DISCONNECTOR, false, false, true, 17, 3); - createLoad(vl1, "load1", "load1", "load1", 0, ConnectablePosition.Direction.TOP, 4, 10, 10); - createSwitch(vl1, "dload1", "dload1", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); - createSwitch(vl1, "bload1", "bload1", SwitchKind.BREAKER, true, false, true, 4, 5); + Networks.createLoad(vl1, "load1", "load1", "load1", 0, ConnectablePosition.Direction.TOP, 4, 10, 10); + Networks.createSwitch(vl1, "dload1", "dload1", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); + Networks.createSwitch(vl1, "bload1", "bload1", SwitchKind.BREAKER, true, false, true, 4, 5); - createGenerator(vl1, "gen1", "gen1", "gen1", 2, ConnectablePosition.Direction.BOTTOM, 6, 0, 20, false, 10, 10); - createSwitch(vl1, "dgen1", "dgen1", SwitchKind.DISCONNECTOR, false, false, true, 2, 7); - createSwitch(vl1, "bgen1", "bgen1", SwitchKind.BREAKER, true, false, true, 6, 7); + Networks.createGenerator(vl1, "gen1", "gen1", "gen1", 2, ConnectablePosition.Direction.BOTTOM, 6, 0, 20, false, 10, 10); + Networks.createSwitch(vl1, "dgen1", "dgen1", SwitchKind.DISCONNECTOR, false, false, true, 2, 7); + Networks.createSwitch(vl1, "bgen1", "bgen1", SwitchKind.BREAKER, true, false, true, 6, 7); - createLoad(vl1, "load2", "load2", "load2", 7, ConnectablePosition.Direction.TOP, 8, 10, 10); - createSwitch(vl1, "dload2", "dload2", SwitchKind.DISCONNECTOR, false, false, true, 1, 9); - createSwitch(vl1, "bload2", "bload2", SwitchKind.BREAKER, true, false, true, 8, 9); + Networks.createLoad(vl1, "load2", "load2", "load2", 7, ConnectablePosition.Direction.TOP, 8, 10, 10); + Networks.createSwitch(vl1, "dload2", "dload2", SwitchKind.DISCONNECTOR, false, false, true, 1, 9); + Networks.createSwitch(vl1, "bload2", "bload2", SwitchKind.BREAKER, true, false, true, 8, 9); - createGenerator(vl1, "gen2", "gen2", "gen2", 11, ConnectablePosition.Direction.BOTTOM, 10, 0, 20, false, 10, 10); - createSwitch(vl1, "dgen2", "dgen2", SwitchKind.DISCONNECTOR, false, false, true, 3, 11); - createSwitch(vl1, "bgen2", "bgen2", SwitchKind.BREAKER, true, false, true, 10, 11); + Networks.createGenerator(vl1, "gen2", "gen2", "gen2", 11, ConnectablePosition.Direction.BOTTOM, 10, 0, 20, false, 10, 10); + Networks.createSwitch(vl1, "dgen2", "dgen2", SwitchKind.DISCONNECTOR, false, false, true, 3, 11); + Networks.createSwitch(vl1, "bgen2", "bgen2", SwitchKind.BREAKER, true, false, true, 10, 11); // second voltage level // - vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 50); + vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 50); - createBusBarSection(vl2, "bbs5", "bbs5", 0, 1, 1); - createBusBarSection(vl2, "bbs6", "bbs6", 1, 2, 1); + Networks.createBusBarSection(vl2, "bbs5", "bbs5", 0, 1, 1); + Networks.createBusBarSection(vl2, "bbs6", "bbs6", 1, 2, 1); - createSwitch(vl2, "dscpl1", "dscpl1", SwitchKind.DISCONNECTOR, false, false, true, 0, 6); - createSwitch(vl2, "ddcpl1", "ddcpl1", SwitchKind.BREAKER, true, false, true, 6, 7); - createSwitch(vl2, "dscpl2", "dscpl2", SwitchKind.DISCONNECTOR, false, false, true, 7, 1); + Networks.createSwitch(vl2, "dscpl1", "dscpl1", SwitchKind.DISCONNECTOR, false, false, true, 0, 6); + Networks.createSwitch(vl2, "ddcpl1", "ddcpl1", SwitchKind.BREAKER, true, false, true, 6, 7); + Networks.createSwitch(vl2, "dscpl2", "dscpl2", SwitchKind.DISCONNECTOR, false, false, true, 7, 1); - createLoad(vl2, "load3", "load3", "load3", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl2, "dload3", "dload3", SwitchKind.DISCONNECTOR, false, false, true, 0, 3); - createSwitch(vl2, "bload3", "bload3", SwitchKind.BREAKER, true, false, true, 2, 3); + Networks.createLoad(vl2, "load3", "load3", "load3", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl2, "dload3", "dload3", SwitchKind.DISCONNECTOR, false, false, true, 0, 3); + Networks.createSwitch(vl2, "bload3", "bload3", SwitchKind.BREAKER, true, false, true, 2, 3); - createGenerator(vl2, "gen4", "gen4", "gen4", 2, ConnectablePosition.Direction.BOTTOM, 4, 0, 20, false, 10, 10); - createSwitch(vl2, "dgen4", "dgen4", SwitchKind.DISCONNECTOR, false, false, true, 1, 5); - createSwitch(vl2, "bgen4", "bgen4", SwitchKind.BREAKER, true, false, true, 4, 5); + Networks.createGenerator(vl2, "gen4", "gen4", "gen4", 2, ConnectablePosition.Direction.BOTTOM, 4, 0, 20, false, 10, 10); + Networks.createSwitch(vl2, "dgen4", "dgen4", SwitchKind.DISCONNECTOR, false, false, true, 1, 5); + Networks.createSwitch(vl2, "bgen4", "bgen4", SwitchKind.BREAKER, true, false, true, 4, 5); // third voltage level // - vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 50); + vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 50); - createBusBarSection(vl3, "bbs7", "bbs7", 0, 1, 1); + Networks.createBusBarSection(vl3, "bbs7", "bbs7", 0, 1, 1); - createLoad(vl3, "load4", "load4", "load4", 0, ConnectablePosition.Direction.TOP, 1, 10, 10); - createSwitch(vl3, "dload4", "dload4", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); - createSwitch(vl3, "bload4", "bload4", SwitchKind.BREAKER, true, false, true, 2, 1); - createShunt(vl3, "self4", "self4", "self4", 1, ConnectablePosition.Direction.BOTTOM, 3, -1, 1, 1); - createSwitch(vl3, "dself4", "dself4", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); - createSwitch(vl3, "bself4", "bself4", SwitchKind.BREAKER, true, false, true, 4, 3); + Networks.createLoad(vl3, "load4", "load4", "load4", 0, ConnectablePosition.Direction.TOP, 1, 10, 10); + Networks.createSwitch(vl3, "dload4", "dload4", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); + Networks.createSwitch(vl3, "bload4", "bload4", SwitchKind.BREAKER, true, false, true, 2, 1); + Networks.createShunt(vl3, "self4", "self4", "self4", 1, ConnectablePosition.Direction.BOTTOM, 3, -1, 1, 1); + Networks.createSwitch(vl3, "dself4", "dself4", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); + Networks.createSwitch(vl3, "bself4", "bself4", SwitchKind.BREAKER, true, false, true, 4, 3); // two windings transformers between voltage levels // - createSwitch(vl1, "dtrf11", "dtrf11", SwitchKind.DISCONNECTOR, false, false, true, 0, 18); - createSwitch(vl1, "btrf11", "btrf11", SwitchKind.BREAKER, true, false, true, 18, 19); - createSwitch(vl2, "dtrf21", "dtrf21", SwitchKind.DISCONNECTOR, false, false, true, 0, 8); - createSwitch(vl2, "btrf21", "btrf21", SwitchKind.BREAKER, true, false, true, 8, 9); - createTwoWindingsTransformer(substation, "trf1", "trf1", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + Networks.createSwitch(vl1, "dtrf11", "dtrf11", SwitchKind.DISCONNECTOR, false, false, true, 0, 18); + Networks.createSwitch(vl1, "btrf11", "btrf11", SwitchKind.BREAKER, true, false, true, 18, 19); + Networks.createSwitch(vl2, "dtrf21", "dtrf21", SwitchKind.DISCONNECTOR, false, false, true, 0, 8); + Networks.createSwitch(vl2, "btrf21", "btrf21", SwitchKind.BREAKER, true, false, true, 8, 9); + Networks.createTwoWindingsTransformer(substation, "trf1", "trf1", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, 19, 9, vl1.getId(), vl2.getId(), "trf1", 1, ConnectablePosition.Direction.TOP, "trf1", 1, ConnectablePosition.Direction.TOP); - createSwitch(vl1, "dtrf12", "dtrf12", SwitchKind.DISCONNECTOR, false, false, true, 1, 20); - createSwitch(vl1, "btrf12", "btrf12", SwitchKind.BREAKER, true, false, true, 20, 21); - createSwitch(vl2, "dtrf22", "dtrf22", SwitchKind.DISCONNECTOR, false, false, true, 1, 10); - createSwitch(vl2, "btrf22", "btrf22", SwitchKind.BREAKER, true, false, true, 10, 11); - createTwoWindingsTransformer(substation, "trf2", "trf2", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + Networks.createSwitch(vl1, "dtrf12", "dtrf12", SwitchKind.DISCONNECTOR, false, false, true, 1, 20); + Networks.createSwitch(vl1, "btrf12", "btrf12", SwitchKind.BREAKER, true, false, true, 20, 21); + Networks.createSwitch(vl2, "dtrf22", "dtrf22", SwitchKind.DISCONNECTOR, false, false, true, 1, 10); + Networks.createSwitch(vl2, "btrf22", "btrf22", SwitchKind.BREAKER, true, false, true, 10, 11); + Networks.createTwoWindingsTransformer(substation, "trf2", "trf2", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, 21, 11, vl1.getId(), vl2.getId(), "trf2", 10, ConnectablePosition.Direction.TOP, "trf2", 7, ConnectablePosition.Direction.BOTTOM); - createSwitch(vl1, "dtrf13", "dtrf13", SwitchKind.DISCONNECTOR, false, false, true, 2, 22); - createSwitch(vl1, "btrf13", "btrf13", SwitchKind.BREAKER, true, false, true, 22, 23); - createSwitch(vl2, "dtrf23", "dtrf23", SwitchKind.DISCONNECTOR, false, false, true, 1, 12); - createSwitch(vl2, "btrf23", "btrf23", SwitchKind.BREAKER, true, false, true, 12, 13); - createTwoWindingsTransformer(substation, "trf3", "trf3", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + Networks.createSwitch(vl1, "dtrf13", "dtrf13", SwitchKind.DISCONNECTOR, false, false, true, 2, 22); + Networks.createSwitch(vl1, "btrf13", "btrf13", SwitchKind.BREAKER, true, false, true, 22, 23); + Networks.createSwitch(vl2, "dtrf23", "dtrf23", SwitchKind.DISCONNECTOR, false, false, true, 1, 12); + Networks.createSwitch(vl2, "btrf23", "btrf23", SwitchKind.BREAKER, true, false, true, 12, 13); + Networks.createTwoWindingsTransformer(substation, "trf3", "trf3", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, 23, 13, vl1.getId(), vl2.getId(), "trf3", 3, ConnectablePosition.Direction.BOTTOM, "trf3", 8, ConnectablePosition.Direction.BOTTOM); - createSwitch(vl1, "dtrf14", "dtrf14", SwitchKind.DISCONNECTOR, false, false, true, 3, 24); - createSwitch(vl1, "btrf14", "btrf14", SwitchKind.BREAKER, true, false, true, 24, 25); - createSwitch(vl2, "dtrf24", "dtrf24", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); - createSwitch(vl2, "btrf24", "btrf24", SwitchKind.BREAKER, true, false, true, 14, 15); - createTwoWindingsTransformer(substation, "trf4", "trf4", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + Networks.createSwitch(vl1, "dtrf14", "dtrf14", SwitchKind.DISCONNECTOR, false, false, true, 3, 24); + Networks.createSwitch(vl1, "btrf14", "btrf14", SwitchKind.BREAKER, true, false, true, 24, 25); + Networks.createSwitch(vl2, "dtrf24", "dtrf24", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); + Networks.createSwitch(vl2, "btrf24", "btrf24", SwitchKind.BREAKER, true, false, true, 14, 15); + Networks.createTwoWindingsTransformer(substation, "trf4", "trf4", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, 25, 15, vl1.getId(), vl2.getId(), "trf4", 9, ConnectablePosition.Direction.BOTTOM, "trf4", 3, ConnectablePosition.Direction.TOP); - createSwitch(vl1, "dtrf15", "dtrf15", SwitchKind.DISCONNECTOR, false, false, true, 0, 26); - createSwitch(vl1, "btrf15", "btrf15", SwitchKind.BREAKER, true, false, true, 26, 27); - createSwitch(vl3, "dtrf25", "dtrf25", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); - createSwitch(vl3, "btrf25", "btrf25", SwitchKind.BREAKER, true, false, true, 5, 6); - createTwoWindingsTransformer(substation, "trf5", "trf5", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + Networks.createSwitch(vl1, "dtrf15", "dtrf15", SwitchKind.DISCONNECTOR, false, false, true, 0, 26); + Networks.createSwitch(vl1, "btrf15", "btrf15", SwitchKind.BREAKER, true, false, true, 26, 27); + Networks.createSwitch(vl3, "dtrf25", "dtrf25", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); + Networks.createSwitch(vl3, "btrf25", "btrf25", SwitchKind.BREAKER, true, false, true, 5, 6); + Networks.createTwoWindingsTransformer(substation, "trf5", "trf5", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, 27, 6, vl1.getId(), vl3.getId(), "trf5", 4, ConnectablePosition.Direction.TOP, "trf5", 2, ConnectablePosition.Direction.BOTTOM); // three windings transformers between voltage levels // - createSwitch(vl1, "dtrf16", "dtrf16", SwitchKind.DISCONNECTOR, false, false, true, 0, 28); - createSwitch(vl1, "btrf16", "btrf16", SwitchKind.BREAKER, true, false, true, 28, 29); - createSwitch(vl2, "dtrf26", "dtrf26", SwitchKind.DISCONNECTOR, false, false, true, 1, 16); - createSwitch(vl2, "btrf26", "btrf26", SwitchKind.BREAKER, true, false, true, 16, 17); - createSwitch(vl3, "dtrf36", "dtrf36", SwitchKind.DISCONNECTOR, false, false, true, 0, 7); - createSwitch(vl3, "btrf36", "btrf36", SwitchKind.BREAKER, true, false, true, 7, 8); - - createThreeWindingsTransformer(substation, "trf6", "trf6", vl1.getId(), vl2.getId(), vl3.getId(), + Networks.createSwitch(vl1, "dtrf16", "dtrf16", SwitchKind.DISCONNECTOR, false, false, true, 0, 28); + Networks.createSwitch(vl1, "btrf16", "btrf16", SwitchKind.BREAKER, true, false, true, 28, 29); + Networks.createSwitch(vl2, "dtrf26", "dtrf26", SwitchKind.DISCONNECTOR, false, false, true, 1, 16); + Networks.createSwitch(vl2, "btrf26", "btrf26", SwitchKind.BREAKER, true, false, true, 16, 17); + Networks.createSwitch(vl3, "dtrf36", "dtrf36", SwitchKind.DISCONNECTOR, false, false, true, 0, 7); + Networks.createSwitch(vl3, "btrf36", "btrf36", SwitchKind.BREAKER, true, false, true, 7, 8); + + Networks.createThreeWindingsTransformer(substation, "trf6", "trf6", vl1.getId(), vl2.getId(), vl3.getId(), 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, 400., 225., 225., 29, 17, 8, @@ -170,14 +171,14 @@ public void setUp() { "trf62", 5, ConnectablePosition.Direction.TOP, "trf63", 3, ConnectablePosition.Direction.TOP); - createSwitch(vl1, "dtrf17", "dtrf17", SwitchKind.DISCONNECTOR, false, false, true, 2, 30); - createSwitch(vl1, "btrf17", "btrf17", SwitchKind.BREAKER, true, false, true, 30, 31); - createSwitch(vl2, "dtrf27", "dtrf27", SwitchKind.DISCONNECTOR, false, false, true, 0, 18); - createSwitch(vl2, "btrf27", "btrf27", SwitchKind.BREAKER, true, false, true, 18, 19); - createSwitch(vl3, "dtrf37", "dtrf37", SwitchKind.DISCONNECTOR, false, false, true, 0, 9); - createSwitch(vl3, "btrf37", "btrf37", SwitchKind.BREAKER, true, false, true, 9, 10); + Networks.createSwitch(vl1, "dtrf17", "dtrf17", SwitchKind.DISCONNECTOR, false, false, true, 2, 30); + Networks.createSwitch(vl1, "btrf17", "btrf17", SwitchKind.BREAKER, true, false, true, 30, 31); + Networks.createSwitch(vl2, "dtrf27", "dtrf27", SwitchKind.DISCONNECTOR, false, false, true, 0, 18); + Networks.createSwitch(vl2, "btrf27", "btrf27", SwitchKind.BREAKER, true, false, true, 18, 19); + Networks.createSwitch(vl3, "dtrf37", "dtrf37", SwitchKind.DISCONNECTOR, false, false, true, 0, 9); + Networks.createSwitch(vl3, "btrf37", "btrf37", SwitchKind.BREAKER, true, false, true, 9, 10); - createThreeWindingsTransformer(substation, "trf7", "trf7", vl1.getId(), vl2.getId(), vl3.getId(), + Networks.createThreeWindingsTransformer(substation, "trf7", "trf7", vl1.getId(), vl2.getId(), vl3.getId(), 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, 400., 225., 225., 31, 19, 10, @@ -185,14 +186,14 @@ public void setUp() { "trf72", 4, ConnectablePosition.Direction.TOP, "trf73", 4, ConnectablePosition.Direction.BOTTOM); - createSwitch(vl1, "dtrf18", "dtrf18", SwitchKind.DISCONNECTOR, false, false, true, 1, 32); - createSwitch(vl1, "btrf18", "btrf18", SwitchKind.BREAKER, true, false, true, 32, 33); - createSwitch(vl2, "dtrf28", "dtrf28", SwitchKind.DISCONNECTOR, false, false, true, 1, 20); - createSwitch(vl2, "btrf28", "btrf28", SwitchKind.BREAKER, true, false, true, 20, 21); - createSwitch(vl3, "dtrf38", "dtrf38", SwitchKind.DISCONNECTOR, false, false, true, 0, 11); - createSwitch(vl3, "btrf38", "btrf38", SwitchKind.BREAKER, true, false, true, 11, 12); + Networks.createSwitch(vl1, "dtrf18", "dtrf18", SwitchKind.DISCONNECTOR, false, false, true, 1, 32); + Networks.createSwitch(vl1, "btrf18", "btrf18", SwitchKind.BREAKER, true, false, true, 32, 33); + Networks.createSwitch(vl2, "dtrf28", "dtrf28", SwitchKind.DISCONNECTOR, false, false, true, 1, 20); + Networks.createSwitch(vl2, "btrf28", "btrf28", SwitchKind.BREAKER, true, false, true, 20, 21); + Networks.createSwitch(vl3, "dtrf38", "dtrf38", SwitchKind.DISCONNECTOR, false, false, true, 0, 11); + Networks.createSwitch(vl3, "btrf38", "btrf38", SwitchKind.BREAKER, true, false, true, 11, 12); - createThreeWindingsTransformer(substation, "trf8", "trf8", vl1.getId(), vl2.getId(), vl3.getId(), + Networks.createThreeWindingsTransformer(substation, "trf8", "trf8", vl1.getId(), vl2.getId(), vl3.getId(), 0.5, 0.5, 0.5, 1., 1., 1., 0.1, 0.1, 400., 225., 225., 33, 21, 12, @@ -200,15 +201,15 @@ public void setUp() { "trf82", 6, ConnectablePosition.Direction.BOTTOM, "trf83", 5, ConnectablePosition.Direction.TOP); - createShunt(vl3, "self5", "self5", "self5", 6, ConnectablePosition.Direction.BOTTOM, 13, -1, 1, 1); - createSwitch(vl3, "dself5", "dself5", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); - createSwitch(vl3, "bself5", "bself5", SwitchKind.BREAKER, true, false, true, 14, 13); + Networks.createShunt(vl3, "self5", "self5", "self5", 6, ConnectablePosition.Direction.BOTTOM, 13, -1, 1, 1); + Networks.createSwitch(vl3, "dself5", "dself5", SwitchKind.DISCONNECTOR, false, false, true, 0, 14); + Networks.createSwitch(vl3, "bself5", "bself5", SwitchKind.BREAKER, true, false, true, 14, 13); - createBusBarSection(vl3, "bbs8", "bbs8", 15, 1, 2); + Networks.createBusBarSection(vl3, "bbs8", "bbs8", 15, 1, 2); - createShunt(vl3, "self6", "self6", "self6", 7, ConnectablePosition.Direction.BOTTOM, 16, 1, 1, 1); - createSwitch(vl3, "dself6", "dself6", SwitchKind.DISCONNECTOR, false, false, true, 15, 17); - createSwitch(vl3, "bself6", "bself6", SwitchKind.BREAKER, true, false, true, 17, 16); + Networks.createShunt(vl3, "self6", "self6", "self6", 7, ConnectablePosition.Direction.BOTTOM, 16, 1, 1, 1); + Networks.createSwitch(vl3, "dself6", "dself6", SwitchKind.DISCONNECTOR, false, false, true, 15, 17); + Networks.createSwitch(vl3, "bself6", "bself6", SwitchKind.BREAKER, true, false, true, 17, 16); } private void separateBusVoltages() { diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase15GraphWithVoltageIndicator.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase15GraphWithVoltageIndicator.java index 3a99fabaf..d5f35dcf1 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase15GraphWithVoltageIndicator.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase15GraphWithVoltageIndicator.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.layout.PositionVoltageLevelLayoutFactory; import com.powsybl.sld.library.ResourcesComponentLibrary; @@ -58,7 +59,7 @@ public boolean isPowered() { @BeforeEach public void setUp() throws IOException { - network = CreateNetworksUtil.createNetworkWithFiveBusesFourLoads(); + network = Networks.createNetworkWithFiveBusesFourLoads(); graphBuilder = new NetworkGraphBuilder(network); withFullBusInfoProvider = new DefaultDiagramLabelProvider(network, componentLibrary, layoutParameters) { diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1BusBreaker.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1BusBreaker.java index 8d7a52753..525eed6a7 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1BusBreaker.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1BusBreaker.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.model.graphs.VoltageLevelGraph; @@ -25,8 +26,8 @@ class TestCase1BusBreaker extends AbstractTestCaseIidm { public void setUp() { network = Network.create("busBreakerTestCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.BUS_BREAKER, 380, 10); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.BUS_BREAKER, 380, 10); VoltageLevel.BusBreakerView view = vl.getBusBreakerView(); view.newBus() .setId("b1") diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1inverted.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1inverted.java index 02b14faa7..77c2cae3a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1inverted.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1inverted.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -41,12 +42,12 @@ class TestCase1inverted extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 0, 10, 10); - createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 2, 1); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 0); - createBusBarSection(vl, "bbs", "bbs", 2, 1, 1); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 0, 10, 10); + Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 2, 1); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 0); + Networks.createBusBarSection(vl, "bbs", "bbs", 2, 1, 1); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase2StackedCell.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase2StackedCell.java index f5c4828e4..533b28567 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase2StackedCell.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase2StackedCell.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -41,14 +42,14 @@ class TestCase2StackedCell extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); - createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 1); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 3, 10, 10); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 1, 2); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 2, 3); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); + Networks.createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 1); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 3, 10, 10); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 1, 2); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 2, 3); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3Coupling.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3Coupling.java index 8235121cb..a190c31e5 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3Coupling.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3Coupling.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -38,13 +39,13 @@ class TestCase3Coupling extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); - createBusBarSection(vl, "bbs2", "bbs2", 3, 2, 1); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); + Networks.createBusBarSection(vl, "bbs2", "bbs2", 3, 2, 1); } @Test @@ -61,8 +62,8 @@ void test() { @Test void test3Bars() { - createSwitch(vl, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 2, 4); - createBusBarSection(vl, "bbs3", "bbs3", 4, 3, 1); + Networks.createSwitch(vl, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 2, 4); + Networks.createBusBarSection(vl, "bbs3", "bbs3", 4, 3, 1); // build graph VoltageLevelGraph g = graphBuilder.buildVoltageLevelGraph(vl.getId()); @@ -76,8 +77,8 @@ void test3Bars() { @Test void test3Bars2Sections() { - createSwitch(vl, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 2, 4); - createBusBarSection(vl, "bbs3", "bbs3", 4, 1, 2); + Networks.createSwitch(vl, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 2, 4); + Networks.createBusBarSection(vl, "bbs3", "bbs3", 4, 1, 2); // build graph VoltageLevelGraph g = graphBuilder.buildVoltageLevelGraph(vl.getId()); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3TripleCoupling.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3TripleCoupling.java index 8c0e99b6b..91af2825d 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3TripleCoupling.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3TripleCoupling.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -37,24 +38,24 @@ class TestCase3TripleCoupling extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase2", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); - createBusBarSection(vl, "bbs2", "bbs2", 3, 2, 1); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); + Networks.createBusBarSection(vl, "bbs2", "bbs2", 3, 2, 1); // second coupling - createSwitch(vl, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); - createSwitch(vl, "d4", "d4", SwitchKind.DISCONNECTOR, false, false, false, 3, 4); - createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 4, 5); - createSwitch(vl, "d5", "d5", SwitchKind.DISCONNECTOR, false, false, false, 5, 3); + Networks.createSwitch(vl, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); + Networks.createSwitch(vl, "d4", "d4", SwitchKind.DISCONNECTOR, false, false, false, 3, 4); + Networks.createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 4, 5); + Networks.createSwitch(vl, "d5", "d5", SwitchKind.DISCONNECTOR, false, false, false, 5, 3); // third coupling - createSwitch(vl, "d6", "d6", SwitchKind.DISCONNECTOR, false, false, false, 0, 6); - createSwitch(vl, "b3", "b3", SwitchKind.BREAKER, false, false, false, 6, 7); - createSwitch(vl, "d7", "d7", SwitchKind.DISCONNECTOR, false, false, false, 7, 3); + Networks.createSwitch(vl, "d6", "d6", SwitchKind.DISCONNECTOR, false, false, false, 0, 6); + Networks.createSwitch(vl, "b3", "b3", SwitchKind.BREAKER, false, false, false, 6, 7); + Networks.createSwitch(vl, "d7", "d7", SwitchKind.DISCONNECTOR, false, false, false, 7, 3); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase4NotParallelel.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase4NotParallelel.java index 38834cfd1..9e2047797 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase4NotParallelel.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase4NotParallelel.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -49,23 +50,23 @@ class TestCase4NotParallelel extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); - createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); - createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); - createLoad(vl, "la", "la", "la", 10, ConnectablePosition.Direction.TOP, 3, 10, 10); - createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 3, 4); - createSwitch(vl, "da1", "da1", SwitchKind.DISCONNECTOR, false, false, false, 4, 0); - createSwitch(vl, "da2", "da2", SwitchKind.DISCONNECTOR, false, false, false, 4, 2); - createLoad(vl, "lb", "lb", "lb", 20, ConnectablePosition.Direction.BOTTOM, 5, 10, 10); - createSwitch(vl, "bb", "bb", SwitchKind.BREAKER, false, false, false, 5, 6); - createSwitch(vl, "db1", "db1", SwitchKind.DISCONNECTOR, false, false, false, 6, 1); - createSwitch(vl, "db2", "db2", SwitchKind.DISCONNECTOR, false, false, false, 6, 2); - createSwitch(vl, "ss1", "ss1", SwitchKind.DISCONNECTOR, false, false, false, 1, 0); - createGenerator(vl, "gc", "gc", "gc", 30, ConnectablePosition.Direction.TOP, 7, 0, 20, false, 10, 10); - createSwitch(vl, "bc", "bc", SwitchKind.BREAKER, false, false, false, 7, 8); - createSwitch(vl, "dc1", "dc1", SwitchKind.DISCONNECTOR, false, false, false, 8, 1); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); + Networks.createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); + Networks.createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); + Networks.createLoad(vl, "la", "la", "la", 10, ConnectablePosition.Direction.TOP, 3, 10, 10); + Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 3, 4); + Networks.createSwitch(vl, "da1", "da1", SwitchKind.DISCONNECTOR, false, false, false, 4, 0); + Networks.createSwitch(vl, "da2", "da2", SwitchKind.DISCONNECTOR, false, false, false, 4, 2); + Networks.createLoad(vl, "lb", "lb", "lb", 20, ConnectablePosition.Direction.BOTTOM, 5, 10, 10); + Networks.createSwitch(vl, "bb", "bb", SwitchKind.BREAKER, false, false, false, 5, 6); + Networks.createSwitch(vl, "db1", "db1", SwitchKind.DISCONNECTOR, false, false, false, 6, 1); + Networks.createSwitch(vl, "db2", "db2", SwitchKind.DISCONNECTOR, false, false, false, 6, 2); + Networks.createSwitch(vl, "ss1", "ss1", SwitchKind.DISCONNECTOR, false, false, false, 1, 0); + Networks.createGenerator(vl, "gc", "gc", "gc", 30, ConnectablePosition.Direction.TOP, 7, 0, 20, false, 10, 10); + Networks.createSwitch(vl, "bc", "bc", SwitchKind.BREAKER, false, false, false, 7, 8); + Networks.createSwitch(vl, "dc1", "dc1", SwitchKind.DISCONNECTOR, false, false, false, 8, 1); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntHorizontal.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntHorizontal.java index 5b37cb632..157cea4e5 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntHorizontal.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntHorizontal.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -42,16 +43,16 @@ class TestCase5ShuntHorizontal extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createLoad(vl, "la", "la", "la", 10, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); - createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 1, 0); - createLoad(vl, "lb", "lb", "lb", 20, ConnectablePosition.Direction.BOTTOM, 4, 10, 10); - createSwitch(vl, "bb", "bb", SwitchKind.BREAKER, false, false, false, 4, 3); - createSwitch(vl, "db", "db", SwitchKind.DISCONNECTOR, false, false, false, 3, 0); - createSwitch(vl, "bs", "bs", SwitchKind.BREAKER, false, false, false, 2, 4); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl, "la", "la", "la", 10, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); + Networks.createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 1, 0); + Networks.createLoad(vl, "lb", "lb", "lb", 20, ConnectablePosition.Direction.BOTTOM, 4, 10, 10); + Networks.createSwitch(vl, "bb", "bb", SwitchKind.BREAKER, false, false, false, 4, 3); + Networks.createSwitch(vl, "db", "db", SwitchKind.DISCONNECTOR, false, false, false, 3, 0); + Networks.createSwitch(vl, "bs", "bs", SwitchKind.BREAKER, false, false, false, 2, 4); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntVertical.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntVertical.java index 312dccaa9..30de5c48e 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntVertical.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntVertical.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -42,16 +43,16 @@ class TestCase5ShuntVertical extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createLoad(vl, "la", "la", "la", 20, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); - createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 1, 0); - createLoad(vl, "lb", "lb", "lb", 10, ConnectablePosition.Direction.TOP, 4, 10, 10); - createSwitch(vl, "bb", "bb", SwitchKind.BREAKER, false, false, false, 4, 3); - createSwitch(vl, "db", "db", SwitchKind.DISCONNECTOR, false, false, false, 3, 0); - createSwitch(vl, "bs", "bs", SwitchKind.BREAKER, false, false, false, 2, 3); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl, "la", "la", "la", 20, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); + Networks.createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 1, 0); + Networks.createLoad(vl, "lb", "lb", "lb", 10, ConnectablePosition.Direction.TOP, 4, 10, 10); + Networks.createSwitch(vl, "bb", "bb", SwitchKind.BREAKER, false, false, false, 4, 3); + Networks.createSwitch(vl, "db", "db", SwitchKind.DISCONNECTOR, false, false, false, 3, 0); + Networks.createSwitch(vl, "bs", "bs", SwitchKind.BREAKER, false, false, false, 2, 3); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6CouplingNonFlatHorizontal.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6CouplingNonFlatHorizontal.java index 27bfc4a37..983214da3 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6CouplingNonFlatHorizontal.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6CouplingNonFlatHorizontal.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -38,17 +39,17 @@ class TestCase6CouplingNonFlatHorizontal extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); - createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); - createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); - createBusBarSection(vl, "bbs2.2", "bbs2.2", 3, 2, 2); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 4, 5); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 5, 3); - createSwitch(vl, "ds1", "ds1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "ds2", "ds2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); + Networks.createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); + Networks.createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); + Networks.createBusBarSection(vl, "bbs2.2", "bbs2.2", 3, 2, 2); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 4, 5); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 5, 3); + Networks.createSwitch(vl, "ds1", "ds1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "ds2", "ds2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6InternalConnection.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6InternalConnection.java index fa46b4689..6290a702a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6InternalConnection.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6InternalConnection.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -35,17 +36,17 @@ class TestCase6InternalConnection extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); - createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); - createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); - createBusBarSection(vl, "bbs2.2", "bbs2.2", 3, 2, 2); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 4, 5); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 5, 3); - createInternalConnection(vl, 0, 1); - createSwitch(vl, "ds2", "ds2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); + Networks.createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); + Networks.createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); + Networks.createBusBarSection(vl, "bbs2.2", "bbs2.2", 3, 2, 2); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 4, 5); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 5, 3); + Networks.createInternalConnection(vl, 0, 1); + Networks.createSwitch(vl, "ds2", "ds2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7CellDetectionIssue.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7CellDetectionIssue.java index 8ce37bfbf..802469294 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7CellDetectionIssue.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7CellDetectionIssue.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TopologyKind; @@ -39,16 +40,16 @@ class TestCase7CellDetectionIssue extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 0, 10, 10); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 0, 10, 10); vl.getNodeBreakerView().newInternalConnection() .setNode1(0) .setNode2(1) .add(); - createBusBarSection(vl, "bbs", "bbs", 1, 1, 1); + Networks.createBusBarSection(vl, "bbs", "bbs", 1, 1, 1); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7DoubleDJ.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7DoubleDJ.java index fc5809496..e3e56ad1a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7DoubleDJ.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7DoubleDJ.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; /** @@ -25,13 +26,13 @@ class TestCase7DoubleDJ extends AbstractTestCaseIidm { @Override public void setUp() { network = Network.create("testCase", "test"); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 1, 2); - createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 2, 3); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 3, 4); - createBusBarSection(vl, "bbs2", "bbs2", 4, 1, 2); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 1, 2); + Networks.createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 2, 3); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 3, 4); + Networks.createBusBarSection(vl, "bbs2", "bbs2", 4, 1, 2); } } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase8JumpOverStacked.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase8JumpOverStacked.java index 9486b77af..f01fadb3a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase8JumpOverStacked.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase8JumpOverStacked.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; /** @@ -30,18 +31,18 @@ class TestCase8JumpOverStacked extends AbstractTestCaseIidm { @Override public void setUp() { network = Network.create("testCase", "test"); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 15); - createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); - createBusBarSection(vl, "bbs12", "bbs12", 1, 1, 2); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createBusBarSection(vl, "bbs21", "bbs21", 2, 2, 1); - createBusBarSection(vl, "bbs22", "bbs22", 3, 2, 2); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); - createSwitch(vl, "d11", "d11", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); - createSwitch(vl, "d12", "d12", SwitchKind.DISCONNECTOR, false, false, false, 1, 5); - createSwitch(vl, "d21", "d21", SwitchKind.DISCONNECTOR, false, false, false, 2, 4); - createSwitch(vl, "d22", "d22", SwitchKind.DISCONNECTOR, false, false, false, 3, 5); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 4, 5); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 15); + Networks.createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); + Networks.createBusBarSection(vl, "bbs12", "bbs12", 1, 1, 2); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createBusBarSection(vl, "bbs21", "bbs21", 2, 2, 1); + Networks.createBusBarSection(vl, "bbs22", "bbs22", 3, 2, 2); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 2, 3); + Networks.createSwitch(vl, "d11", "d11", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); + Networks.createSwitch(vl, "d12", "d12", SwitchKind.DISCONNECTOR, false, false, false, 1, 5); + Networks.createSwitch(vl, "d21", "d21", SwitchKind.DISCONNECTOR, false, false, false, 2, 4); + Networks.createSwitch(vl, "d22", "d22", SwitchKind.DISCONNECTOR, false, false, false, 3, 5); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 4, 5); } } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousBus.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousBus.java index 771c6b32f..2948dbf76 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousBus.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousBus.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TopologyKind; import com.powsybl.iidm.network.VoltageLevel; @@ -69,21 +70,21 @@ public void setUp() { .setTopologyKind(TopologyKind.NODE_BREAKER) .add(); - createInternalConnection(vl, 1, 0); - createInternalConnection(vl, 2, 0); - createInternalConnection(vl, 3, 0); + Networks.createInternalConnection(vl, 1, 0); + Networks.createInternalConnection(vl, 2, 0); + Networks.createInternalConnection(vl, 3, 0); - createLine(network, "L1", "L1", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, + Networks.createLine(network, "L1", "L1", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1, 10, vl.getId(), vl1.getId(), "L1", 0, ConnectablePosition.Direction.TOP, "L1", 1, ConnectablePosition.Direction.TOP); - createLine(network, "L2", "L2", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, + Networks.createLine(network, "L2", "L2", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 2, 20, vl.getId(), vl2.getId(), "L2", 1, ConnectablePosition.Direction.BOTTOM, "L2", 0, ConnectablePosition.Direction.TOP); - createLine(network, "L3", "L3", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, + Networks.createLine(network, "L3", "L3", 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 3, 30, vl.getId(), vl3.getId(), "L3", 2, ConnectablePosition.Direction.TOP, "L3", 0, ConnectablePosition.Direction.TOP); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousSwitchNode.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousSwitchNode.java index 7ee0cfc71..9741cf310 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousSwitchNode.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousSwitchNode.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.sld.builders.NetworkGraphBuilder; @@ -26,12 +27,12 @@ public void setUp() { network = Network.create("testFictitiousSwitchNode", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, true, 1, 2); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, true, 1, 2); factory = new PositionVoltageLevelLayoutFactory(); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseGraphAdaptCellHeightToContent.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseGraphAdaptCellHeightToContent.java index e09dc22fb..64e8eae44 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseGraphAdaptCellHeightToContent.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseGraphAdaptCellHeightToContent.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -31,53 +32,53 @@ public void setUp() { network = Network.create("testCaseGraphAdaptCellHeightToContent", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "subst", "subst", Country.FR); + substation = Networks.createSubstation(network, "subst", "subst", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 50); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 50); - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); - createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 1); + Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); + Networks.createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 1); // coupling (intern cell) - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); - createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 2, 3); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 3, 1); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); + Networks.createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 2, 3); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 3, 1); // load (huge feeder cell with serial blocks) - createSwitch(vl, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); - createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, true, false, 4, 5); - createSwitch(vl, "b3", "b3", SwitchKind.BREAKER, false, false, false, 5, 6); - createSwitch(vl, "b4", "b4", SwitchKind.BREAKER, false, true, false, 6, 7); - createSwitch(vl, "b5", "b5", SwitchKind.BREAKER, false, false, false, 7, 8); - createSwitch(vl, "b6", "b6", SwitchKind.BREAKER, false, false, false, 8, 9); - createSwitch(vl, "b7", "b7", SwitchKind.BREAKER, false, true, false, 9, 10); - createSwitch(vl, "b8", "b8", SwitchKind.BREAKER, false, true, false, 10, 11); - createSwitch(vl, "b9", "b9", SwitchKind.BREAKER, false, false, false, 11, 12); - createSwitch(vl, "b10", "b10", SwitchKind.BREAKER, false, false, false, 12, 13); - createSwitch(vl, "b11", "b11", SwitchKind.BREAKER, false, false, false, 13, 14); - createSwitch(vl, "b12", "b12", SwitchKind.BREAKER, false, false, false, 14, 15); - createLoad(vl, "load1", "load1", "load1", 0, ConnectablePosition.Direction.TOP, 15, 10, 10); + Networks.createSwitch(vl, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 0, 4); + Networks.createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, true, false, 4, 5); + Networks.createSwitch(vl, "b3", "b3", SwitchKind.BREAKER, false, false, false, 5, 6); + Networks.createSwitch(vl, "b4", "b4", SwitchKind.BREAKER, false, true, false, 6, 7); + Networks.createSwitch(vl, "b5", "b5", SwitchKind.BREAKER, false, false, false, 7, 8); + Networks.createSwitch(vl, "b6", "b6", SwitchKind.BREAKER, false, false, false, 8, 9); + Networks.createSwitch(vl, "b7", "b7", SwitchKind.BREAKER, false, true, false, 9, 10); + Networks.createSwitch(vl, "b8", "b8", SwitchKind.BREAKER, false, true, false, 10, 11); + Networks.createSwitch(vl, "b9", "b9", SwitchKind.BREAKER, false, false, false, 11, 12); + Networks.createSwitch(vl, "b10", "b10", SwitchKind.BREAKER, false, false, false, 12, 13); + Networks.createSwitch(vl, "b11", "b11", SwitchKind.BREAKER, false, false, false, 13, 14); + Networks.createSwitch(vl, "b12", "b12", SwitchKind.BREAKER, false, false, false, 14, 15); + Networks.createLoad(vl, "load1", "load1", "load1", 0, ConnectablePosition.Direction.TOP, 15, 10, 10); // generator (small feeder cell with serial blocks) - createSwitch(vl, "d4", "d4", SwitchKind.DISCONNECTOR, false, true, false, 1, 16); - createSwitch(vl, "b13", "b13", SwitchKind.BREAKER, true, false, false, 16, 17); - createGenerator(vl, "gen1", "gen1", "gen1", 3, ConnectablePosition.Direction.BOTTOM, 17, 0, 20, false, 10, 10); + Networks.createSwitch(vl, "d4", "d4", SwitchKind.DISCONNECTOR, false, true, false, 1, 16); + Networks.createSwitch(vl, "b13", "b13", SwitchKind.BREAKER, true, false, false, 16, 17); + Networks.createGenerator(vl, "gen1", "gen1", "gen1", 3, ConnectablePosition.Direction.BOTTOM, 17, 0, 20, false, 10, 10); // load (small feeder cell with parallel blocks) - createSwitch(vl, "d5", "d5", SwitchKind.DISCONNECTOR, false, true, false, 0, 18); - createSwitch(vl, "d6", "d6", SwitchKind.DISCONNECTOR, false, true, false, 1, 19); - createSwitch(vl, "b14", "b14", SwitchKind.BREAKER, true, false, false, 18, 20); - createSwitch(vl, "b15", "b15", SwitchKind.BREAKER, true, false, false, 19, 20); - createSwitch(vl, "b16", "b16", SwitchKind.BREAKER, true, false, false, 20, 21); - createLoad(vl, "load2", "load2", "load2", 1, ConnectablePosition.Direction.TOP, 21, 10, 10); + Networks.createSwitch(vl, "d5", "d5", SwitchKind.DISCONNECTOR, false, true, false, 0, 18); + Networks.createSwitch(vl, "d6", "d6", SwitchKind.DISCONNECTOR, false, true, false, 1, 19); + Networks.createSwitch(vl, "b14", "b14", SwitchKind.BREAKER, true, false, false, 18, 20); + Networks.createSwitch(vl, "b15", "b15", SwitchKind.BREAKER, true, false, false, 19, 20); + Networks.createSwitch(vl, "b16", "b16", SwitchKind.BREAKER, true, false, false, 20, 21); + Networks.createLoad(vl, "load2", "load2", "load2", 1, ConnectablePosition.Direction.TOP, 21, 10, 10); // undefined block - createSwitch(vl, "d7", "d7", SwitchKind.DISCONNECTOR, false, true, false, 0, 22); - createSwitch(vl, "b17", "b17", SwitchKind.BREAKER, true, false, false, 22, 23); - createSwitch(vl, "b18", "b18", SwitchKind.BREAKER, true, false, false, 23, 24); - createSwitch(vl, "b19", "b19", SwitchKind.BREAKER, true, false, false, 23, 24); - createSwitch(vl, "b20", "b20", SwitchKind.BREAKER, true, false, false, 24, 25); - createGenerator(vl, "gen2", "gen2", "gen2", 2, ConnectablePosition.Direction.BOTTOM, 25, 0, 20, false, 10, 10); + Networks.createSwitch(vl, "d7", "d7", SwitchKind.DISCONNECTOR, false, true, false, 0, 22); + Networks.createSwitch(vl, "b17", "b17", SwitchKind.BREAKER, true, false, false, 22, 23); + Networks.createSwitch(vl, "b18", "b18", SwitchKind.BREAKER, true, false, false, 23, 24); + Networks.createSwitch(vl, "b19", "b19", SwitchKind.BREAKER, true, false, false, 23, 24); + Networks.createSwitch(vl, "b20", "b20", SwitchKind.BREAKER, true, false, false, 24, 25); + Networks.createGenerator(vl, "gen2", "gen2", "gen2", 2, ConnectablePosition.Direction.BOTTOM, 25, 0, 20, false, 10, 10); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseLoadBreakSwitch.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseLoadBreakSwitch.java index 8dcadb22f..268d06418 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseLoadBreakSwitch.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseLoadBreakSwitch.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -28,24 +29,24 @@ class TestCaseLoadBreakSwitch extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCaseLoadBreakSwitch", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 2); - createGenerator(vl, "G", "G", "G", 0, ConnectablePosition.Direction.TOP, 2, 50, 100, false, 100, 400); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.BOTTOM, 3, 10, 10); - createSwitch(vl, "d", "d", SwitchKind.LOAD_BREAK_SWITCH, false, false, false, 0, 2); - createSwitch(vl, "b", "b", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 1, 3); - createSwitch(vl, "b1", "b1", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 0, 1); - - createTwoWindingsTransformer(substation, "T11", "T11", 250, 100, 52, 12, 65, 90, + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 2); + Networks.createGenerator(vl, "G", "G", "G", 0, ConnectablePosition.Direction.TOP, 2, 50, 100, false, 100, 400); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.BOTTOM, 3, 10, 10); + Networks.createSwitch(vl, "d", "d", SwitchKind.LOAD_BREAK_SWITCH, false, false, false, 0, 2); + Networks.createSwitch(vl, "b", "b", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 1, 3); + Networks.createSwitch(vl, "b1", "b1", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 0, 1); + + Networks.createTwoWindingsTransformer(substation, "T11", "T11", 250, 100, 52, 12, 65, 90, 4, 6, vl.getId(), vl.getId(), "T11", null, ConnectablePosition.Direction.TOP, "T11", null, ConnectablePosition.Direction.BOTTOM); - createSwitch(vl, "b2", "b2", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 0, 4); - createSwitch(vl, "b3", "b3", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 1, 5); - createSwitch(vl, "b4", "b4", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 5, 6); - createSwitch(vl, "b5", "b5", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 5, 3); + Networks.createSwitch(vl, "b2", "b2", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 0, 4); + Networks.createSwitch(vl, "b3", "b3", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 1, 5); + Networks.createSwitch(vl, "b4", "b4", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 5, 6); + Networks.createSwitch(vl, "b5", "b5", SwitchKind.LOAD_BREAK_SWITCH, false, true, false, 5, 3); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseMissingBusbarPosition.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseMissingBusbarPosition.java index 69bf638bf..c1c75c817 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseMissingBusbarPosition.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseMissingBusbarPosition.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.sld.builders.NetworkGraphBuilder; @@ -38,18 +39,18 @@ class TestCaseMissingBusbarPosition extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); vl.getNodeBreakerView().newBusbarSection().setId("bbs1").setName("bbs1").setNode(0).add(); // no position extension - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 1, 2); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 1, 2); - createBusBarSection(vl, "bbs2", "bbs2", 3, 1, 1); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 3, 4); - createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 4, 5); - createGenerator(vl, "g", "g", "generator", 2, ConnectablePosition.Direction.BOTTOM, 5, 0, 20, false, 10, 10); + Networks.createBusBarSection(vl, "bbs2", "bbs2", 3, 1, 1); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 3, 4); + Networks.createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 4, 5); + Networks.createGenerator(vl, "g", "g", "generator", 2, ConnectablePosition.Direction.BOTTOM, 5, 0, 20, false, 10, 10); } @Test @@ -66,7 +67,7 @@ void busApartTest() { @Test void busParallelTest() { - createSwitch(vl, "d2l", "d2l", SwitchKind.DISCONNECTOR, false, false, false, 3, 1); + Networks.createSwitch(vl, "d2l", "d2l", SwitchKind.DISCONNECTOR, false, false, false, 3, 1); // build graph VoltageLevelGraph g = graphBuilder.buildVoltageLevelGraph(vl.getId()); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestComplexParallelLegs.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestComplexParallelLegs.java index 85e744b20..7699a80e9 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestComplexParallelLegs.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestComplexParallelLegs.java @@ -7,6 +7,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.model.graphs.VoltageLevelGraph; import org.junit.jupiter.api.BeforeEach; @@ -23,7 +24,7 @@ class TestComplexParallelLegs extends AbstractTestCaseIidm { @BeforeEach public void setUp() throws IOException { - network = CreateNetworksUtil.createNetworkWithFourParallelLegs(); + network = Networks.createNetworkWithFourParallelLegs(); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestComplexParallelLegsInternalPst.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestComplexParallelLegsInternalPst.java index 625bf5188..765a476ed 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestComplexParallelLegsInternalPst.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestComplexParallelLegsInternalPst.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.library.FlatDesignLibrary; import com.powsybl.sld.library.ResourcesComponentLibrary; @@ -24,7 +25,7 @@ class TestComplexParallelLegsInternalPst extends AbstractTestCaseIidm { @BeforeEach public void setUp() throws IOException { - network = CreateNetworksUtil.createNetworkWithInternalPst(); + network = Networks.createNetworkWithInternalPst(); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestDoubleForkNode.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestDoubleForkNode.java index 5b136acca..232121033 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestDoubleForkNode.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestDoubleForkNode.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.model.graphs.VoltageLevelGraph; @@ -23,7 +24,7 @@ class TestDoubleForkNode extends AbstractTestCaseIidm { @BeforeEach public void setUp() throws IOException { - network = CreateNetworksUtil.createNetworkWithTwoParallelLoads(); + network = Networks.createNetworkWithTwoParallelLoads(); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFeederInfos.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFeederInfos.java index 51dc5147f..ce8d6f6ef 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFeederInfos.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFeederInfos.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; import com.powsybl.iidm.network.*; @@ -54,12 +55,12 @@ class TestFeederInfos extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase14", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); } @Test @@ -165,8 +166,8 @@ void testBuildFeederInfosWithoutCurrent() { void testAnimation() { // Add load at bottom - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); - createLoad(vl, "l2", "l2", "l2", 0, ConnectablePosition.Direction.BOTTOM, 3, 10, 10); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); + Networks.createLoad(vl, "l2", "l2", "l2", 0, ConnectablePosition.Direction.BOTTOM, 3, 10, 10); // Add power values to the load network.getLoad("l").getTerminal().setP(1200.29); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFlatSection.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFlatSection.java index 5e540dabb..34949c1e6 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFlatSection.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFlatSection.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.model.graphs.VoltageLevelGraph; import org.junit.jupiter.api.BeforeEach; @@ -22,7 +23,7 @@ class TestFlatSection extends AbstractTestCaseIidm { @BeforeEach public void setUp() throws IOException { - network = CreateNetworksUtil.createNetworkWithFlatSections(); + network = Networks.createNetworkWithFlatSections(); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestInternalBranchesBusBreaker.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestInternalBranchesBusBreaker.java index 921399b90..3c7621052 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestInternalBranchesBusBreaker.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestInternalBranchesBusBreaker.java @@ -9,6 +9,7 @@ import com.powsybl.commons.config.BaseVoltagesConfig; import com.powsybl.commons.config.ModuleConfigRepository; import com.powsybl.commons.config.PlatformConfig; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.layout.PositionVoltageLevelLayoutFactory; import com.powsybl.sld.layout.VerticalSubstationLayoutFactory; @@ -37,7 +38,7 @@ public StyleProvider getDefaultDiagramStyleProvider() { @BeforeEach public void setUp() { - network = CreateNetworksUtil.createBusBreakerNetworkWithInternalBranches("TestInternalBranchesBusBreaker", "test"); + network = Networks.createBusBreakerNetworkWithInternalBranches("TestInternalBranchesBusBreaker", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = network.getSubstation("S1"); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestInternalBranchesNodeBreaker.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestInternalBranchesNodeBreaker.java index e11fdcbed..8e790e80e 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestInternalBranchesNodeBreaker.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestInternalBranchesNodeBreaker.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.layout.PositionVoltageLevelLayoutFactory; import com.powsybl.sld.layout.VerticalSubstationLayoutFactory; @@ -23,7 +24,7 @@ class TestInternalBranchesNodeBreaker extends AbstractTestCaseIidm { @BeforeEach public void setUp() { - network = CreateNetworksUtil.createNodeBreakerNetworkWithInternalBranches("TestInternalBranchesNodeBreaker", "test"); + network = Networks.createNodeBreakerNetworkWithInternalBranches("TestInternalBranchesNodeBreaker", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = network.getSubstation("S1"); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestNodeDecoratorsBusBreaker.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestNodeDecoratorsBusBreaker.java index bf4fd8f11..09d4a224a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestNodeDecoratorsBusBreaker.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestNodeDecoratorsBusBreaker.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.model.graphs.VoltageLevelGraph; import org.junit.jupiter.api.BeforeEach; @@ -21,7 +22,7 @@ class TestNodeDecoratorsBusBreaker extends AbstractTestCaseIidm { @BeforeEach public void setUp() { - network = CreateNetworksUtil.createBusBreakerNetworkWithBranchStatus("TestNodeDecorators", "test"); + network = Networks.createBusBreakerNetworkWithBranchStatus("TestNodeDecorators", "test"); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestNodeDecoratorsNodeBreaker.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestNodeDecoratorsNodeBreaker.java index 222bdc482..ab2de3c36 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestNodeDecoratorsNodeBreaker.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestNodeDecoratorsNodeBreaker.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.library.ComponentSize; @@ -33,7 +34,7 @@ class TestNodeDecoratorsNodeBreaker extends AbstractTestCaseIidm { @BeforeEach public void setUp() { - network = CreateNetworksUtil.createNodeBreakerNetworkWithBranchStatus("TestNodeDecorators", "test"); + network = Networks.createNodeBreakerNetworkWithBranchStatus("TestNodeDecorators", "test"); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialBlock.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialBlock.java index bc43e5bb1..a2f8f78ef 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialBlock.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialBlock.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -44,12 +45,12 @@ class TestSerialBlock extends AbstractTestCaseIidm { public void setUp() { Network network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createLoad(vl, "la", "la", "la", 10, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); - createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 1, 0); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl, "la", "la", "la", 10, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); + Networks.createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 1, 0); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialParallelBlock.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialParallelBlock.java index c9f77366f..444d94fd8 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialParallelBlock.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialParallelBlock.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -44,15 +45,15 @@ class TestSerialParallelBlock extends AbstractTestCaseIidm { public void setUp() { Network network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 1, 2); - createSwitch(vl, "ba1", "ba1", SwitchKind.BREAKER, false, false, false, 2, 4); - createSwitch(vl, "ba2", "ba2", SwitchKind.BREAKER, false, false, false, 2, 5); - createLoad(vl, "la1", "la1", "la1", 10, ConnectablePosition.Direction.TOP, 4, 10, 10); - createLoad(vl, "la2", "la2", "la2", 10, ConnectablePosition.Direction.TOP, 5, 10, 10); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 1, 2); + Networks.createSwitch(vl, "ba1", "ba1", SwitchKind.BREAKER, false, false, false, 2, 4); + Networks.createSwitch(vl, "ba2", "ba2", SwitchKind.BREAKER, false, false, false, 2, 5); + Networks.createLoad(vl, "la1", "la1", "la1", 10, ConnectablePosition.Direction.TOP, 4, 10, 10); + Networks.createLoad(vl, "la2", "la2", "la2", 10, ConnectablePosition.Direction.TOP, 5, 10, 10); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSingleLineDiagramClass.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSingleLineDiagramClass.java index 0c373eff6..3e7228466 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSingleLineDiagramClass.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSingleLineDiagramClass.java @@ -9,6 +9,7 @@ import com.google.common.jimfs.Configuration; import com.google.common.jimfs.Jimfs; import com.powsybl.commons.PowsyblException; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.sld.SingleLineDiagram; @@ -49,24 +50,24 @@ public void setUp() throws IOException { network = Network.create("TestSingleLineDiagramClass", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 1, 2); - createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); - createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 3, 4); - - VoltageLevel vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); - createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); - createGenerator(vl2, "g", "g", "g", -1, ConnectablePosition.Direction.BOTTOM, 2, 0, 20, false, 10, 10); - createSwitch(vl2, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl2, "b3", "b3", SwitchKind.BREAKER, false, false, false, 1, 2); - createSwitch(vl2, "d4", "d4", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); - createSwitch(vl2, "b4", "b4", SwitchKind.BREAKER, false, false, false, 3, 4); - - createTwoWindingsTransformer(substation, "trf", "trf", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 1, 2); + Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); + Networks.createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 3, 4); + + VoltageLevel vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); + Networks.createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); + Networks.createGenerator(vl2, "g", "g", "g", -1, ConnectablePosition.Direction.BOTTOM, 2, 0, 20, false, 10, 10); + Networks.createSwitch(vl2, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl2, "b3", "b3", SwitchKind.BREAKER, false, false, false, 1, 2); + Networks.createSwitch(vl2, "d4", "d4", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); + Networks.createSwitch(vl2, "b4", "b4", SwitchKind.BREAKER, false, false, false, 3, 4); + + Networks.createTwoWindingsTransformer(substation, "trf", "trf", 2.0, 14.745, 0.0, 3.2E-5, 400.0, 225.0, 4, 4, vl.getId(), vl2.getId(), "trf", -1, ConnectablePosition.Direction.BOTTOM, "trf", -1, ConnectablePosition.Direction.TOP); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestTopologyCalculation.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestTopologyCalculation.java index 80ebc28a3..834e6aa08 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestTopologyCalculation.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestTopologyCalculation.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.SwitchKind; @@ -47,32 +48,32 @@ class TestTopologyCalculation extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 12); - createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); - createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); - createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); - createBusBarSection(vl, "bbs2.2", "bbs2.2", 3, 2, 2); - - createLoad(vl, "lA", "lA", "lA", 0, ConnectablePosition.Direction.TOP, 4, 10, 10); - createSwitch(vl, "bA1", "bA1", SwitchKind.BREAKER, false, false, false, 4, 5); - createSwitch(vl, "bA2", "bA2", SwitchKind.BREAKER, false, false, false, 4, 5); - createSwitch(vl, "dA", "dA", SwitchKind.DISCONNECTOR, false, false, false, 0, 5); - - createSwitch(vl, "d11", "d11", SwitchKind.DISCONNECTOR, false, false, false, 0, 6); - createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 6, 7); - createSwitch(vl, "d12", "d12", SwitchKind.DISCONNECTOR, false, false, false, 7, 3); - - createSwitch(vl, "d21", "d21", SwitchKind.DISCONNECTOR, false, false, false, 2, 8); - createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 8, 9); - createSwitch(vl, "d22", "d22", SwitchKind.DISCONNECTOR, false, false, false, 9, 3); - - createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - - createLoad(vl, "lB", "lB", "lB", 1, ConnectablePosition.Direction.TOP, 10, 10, 10); - createSwitch(vl, "bB", "bB", SwitchKind.BREAKER, false, false, false, 10, 11); - createSwitch(vl, "dB1", "dB1", SwitchKind.DISCONNECTOR, false, false, false, 11, 1); - createSwitch(vl, "dB2", "dB2", SwitchKind.DISCONNECTOR, false, false, false, 11, 3); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 12); + Networks.createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); + Networks.createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); + Networks.createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); + Networks.createBusBarSection(vl, "bbs2.2", "bbs2.2", 3, 2, 2); + + Networks.createLoad(vl, "lA", "lA", "lA", 0, ConnectablePosition.Direction.TOP, 4, 10, 10); + Networks.createSwitch(vl, "bA1", "bA1", SwitchKind.BREAKER, false, false, false, 4, 5); + Networks.createSwitch(vl, "bA2", "bA2", SwitchKind.BREAKER, false, false, false, 4, 5); + Networks.createSwitch(vl, "dA", "dA", SwitchKind.DISCONNECTOR, false, false, false, 0, 5); + + Networks.createSwitch(vl, "d11", "d11", SwitchKind.DISCONNECTOR, false, false, false, 0, 6); + Networks.createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 6, 7); + Networks.createSwitch(vl, "d12", "d12", SwitchKind.DISCONNECTOR, false, false, false, 7, 3); + + Networks.createSwitch(vl, "d21", "d21", SwitchKind.DISCONNECTOR, false, false, false, 2, 8); + Networks.createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 8, 9); + Networks.createSwitch(vl, "d22", "d22", SwitchKind.DISCONNECTOR, false, false, false, 9, 3); + + Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + + Networks.createLoad(vl, "lB", "lB", "lB", 1, ConnectablePosition.Direction.TOP, 10, 10, 10); + Networks.createSwitch(vl, "bB", "bB", SwitchKind.BREAKER, false, false, false, 10, 11); + Networks.createSwitch(vl, "dB1", "dB1", SwitchKind.DISCONNECTOR, false, false, false, 11, 1); + Networks.createSwitch(vl, "dB2", "dB2", SwitchKind.DISCONNECTOR, false, false, false, 11, 3); } public void assertTopo(List tcnss, diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnicityNodeIdWithMutipleNetwork.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnicityNodeIdWithMutipleNetwork.java index 35102961d..92aadcd33 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnicityNodeIdWithMutipleNetwork.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnicityNodeIdWithMutipleNetwork.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.sld.builders.GraphBuilder; @@ -37,22 +38,22 @@ public void setUp() { network = Network.create("n1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); - vl = createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); - createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); + substation = Networks.createSubstation(network, "s", "s", Country.FR); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); // Create second network with a substation and a voltageLevel network2 = Network.create("n2", "test"); graphBuilder2 = new NetworkGraphBuilder(network2); - substation2 = createSubstation(network2, "s", "s", Country.FR); - vl2 = createVoltageLevel(substation2, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl2, "bbs", "bbs", 0, 1, 1); - createLoad(vl2, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl2, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl2, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); + substation2 = Networks.createSubstation(network2, "s", "s", Country.FR); + vl2 = Networks.createVoltageLevel(substation2, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl2, "bbs", "bbs", 0, 1, 1); + Networks.createLoad(vl2, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl2, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl2, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); } @Test diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnknownComponent.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnknownComponent.java index 93a5f165b..e86f11a96 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnknownComponent.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnknownComponent.java @@ -7,6 +7,7 @@ */ package com.powsybl.sld.iidm; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.library.ResourcesComponentLibrary; import com.powsybl.sld.model.graphs.VoltageLevelGraph; @@ -24,7 +25,7 @@ class TestUnknownComponent extends AbstractTestCaseIidm { public void setUp() { layoutParameters.setCellWidth(80); - network = NetworkFactory.createTestCase11Network(); + network = Networks.createTestCase11Network(); substation = network.getSubstation("subst"); graphBuilder = new NetworkGraphBuilder(network); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/layout/ComponentsOnBusTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/layout/ComponentsOnBusTest.java index db0b072f4..8c6b660c7 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/layout/ComponentsOnBusTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/layout/ComponentsOnBusTest.java @@ -6,9 +6,9 @@ */ package com.powsybl.sld.layout; +import com.powsybl.diagram.test.Networks; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.iidm.AbstractTestCaseIidm; -import com.powsybl.sld.iidm.CreateNetworksUtil; import com.powsybl.sld.library.ComponentTypeName; import com.powsybl.sld.model.graphs.VoltageLevelGraph; import org.junit.jupiter.api.BeforeEach; @@ -26,7 +26,7 @@ class ComponentsOnBusTest extends AbstractTestCaseIidm { @BeforeEach public void setUp() { - network = CreateNetworksUtil.createNetworkWithSvcVscScDl(); + network = Networks.createNetworkWithSvcVscScDl(); graphBuilder = new NetworkGraphBuilder(network); vl = network.getVoltageLevel("vl"); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/AddNodeGraphTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/AddNodeGraphTest.java index 46c75a9d9..f9d2c93fd 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/AddNodeGraphTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/AddNodeGraphTest.java @@ -7,6 +7,7 @@ package com.powsybl.sld.model; import com.powsybl.commons.PowsyblException; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.SwitchKind; import com.powsybl.iidm.network.test.FourSubstationsNodeBreakerFactory; import com.powsybl.sld.builders.NetworkGraphBuilder; @@ -89,7 +90,7 @@ void testSubstitute() { // Creates new node non-connected to any equipments (connected to fictitious nodes) String replacingNodeId = "s1vl2_replacingBreaker"; - createSwitch(vl, replacingNodeId, "replacingNode", SwitchKind.BREAKER, false, false, false, 100, 101); + Networks.createSwitch(vl, replacingNodeId, "replacingNode", SwitchKind.BREAKER, false, false, false, 100, 101); // graph construction VoltageLevelGraph graph = graphBuilder.buildVoltageLevelGraph(vl.getId()); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/FeederInfoProviderTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/FeederInfoProviderTest.java index a48434194..e223a0af0 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/FeederInfoProviderTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/svg/FeederInfoProviderTest.java @@ -6,11 +6,11 @@ */ package com.powsybl.sld.svg; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.VoltageLevel; import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.iidm.AbstractTestCaseIidm; -import com.powsybl.sld.iidm.CreateNetworksUtil; import com.powsybl.sld.library.ComponentLibrary; import com.powsybl.sld.library.ConvergenceComponentLibrary; import com.powsybl.sld.model.graphs.VoltageLevelGraph; @@ -34,7 +34,7 @@ class FeederInfoProviderTest extends AbstractTestCaseIidm { @BeforeEach public void setUp() { - network = CreateNetworksUtil.createNetworkWithSvcVscScDl(); + network = Networks.createNetworkWithSvcVscScDl(); graphBuilder = new NetworkGraphBuilder(network); vl = network.getVoltageLevel("vl"); vl2 = network.getVoltageLevel("vl2"); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/NominalVoltageStyleTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/NominalVoltageStyleTest.java index f99e70208..f40720402 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/NominalVoltageStyleTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/NominalVoltageStyleTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.util; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.sld.builders.NetworkGraphBuilder; @@ -48,50 +49,50 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); - substation = createSubstation(network, "s", "s", Country.FR); + substation = Networks.createSubstation(network, "s", "s", Country.FR); styleProvider = new StyleProvidersList( new NominalVoltageStyleProvider(), new HighlightLineStateStyleProvider(network)); // first voltage level - vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); - createLoad(vl1, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl1, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl1, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); + vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); + Networks.createLoad(vl1, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl1, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl1, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); // second voltage level - vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); - createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); + vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); + Networks.createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); // third voltage level - vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 10); - createBusBarSection(vl3, "bbs3", "bbs3", 0, 1, 1); + vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 10); + Networks.createBusBarSection(vl3, "bbs3", "bbs3", 0, 1, 1); // 2WT between first and second voltage level - createTwoWindingsTransformer(substation, "2WT", "2WT", 1, 1, 1, 1, 1, 1, + Networks.createTwoWindingsTransformer(substation, "2WT", "2WT", 1, 1, 1, 1, 1, 1, 3, 1, vl1.getId(), vl2.getId(), "2WT_1", 1, ConnectablePosition.Direction.TOP, "2WT_2", 0, ConnectablePosition.Direction.TOP); - createSwitch(vl1, "d2WT_1", "d2WT_1", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); - createSwitch(vl1, "b2WT_1", "b2WT_1", SwitchKind.BREAKER, true, false, true, 3, 4); - createSwitch(vl2, "d2WT_2", "d2WT_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); - createSwitch(vl2, "b2WT_2", "b2WT_2", SwitchKind.BREAKER, true, true, true, 1, 2); + Networks.createSwitch(vl1, "d2WT_1", "d2WT_1", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); + Networks.createSwitch(vl1, "b2WT_1", "b2WT_1", SwitchKind.BREAKER, true, false, true, 3, 4); + Networks.createSwitch(vl2, "d2WT_2", "d2WT_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); + Networks.createSwitch(vl2, "b2WT_2", "b2WT_2", SwitchKind.BREAKER, true, true, true, 1, 2); // 3WT between the 3 voltage levels - createThreeWindingsTransformer(substation, "3WT", "3WT", vl1.getId(), vl2.getId(), vl3.getId(), + Networks.createThreeWindingsTransformer(substation, "3WT", "3WT", vl1.getId(), vl2.getId(), vl3.getId(), 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 3, 1, "3WT_1", 2, ConnectablePosition.Direction.TOP, "3WT_2", 1, ConnectablePosition.Direction.TOP, "3WT_3", 0, ConnectablePosition.Direction.TOP); - createSwitch(vl1, "d3WT_1", "d3WT_1", SwitchKind.DISCONNECTOR, false, false, true, 0, 6); - createSwitch(vl1, "b3WT_1", "b3WT_1", SwitchKind.BREAKER, true, true, true, 5, 6); - createSwitch(vl2, "d3WT_2", "d3WT_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); - createSwitch(vl2, "b3WT_2", "b3WT_2", SwitchKind.BREAKER, true, false, true, 3, 4); - createSwitch(vl3, "d3WT_3", "d3WT_3", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); - createSwitch(vl3, "b3WT_3", "b3WT_3", SwitchKind.BREAKER, true, true, true, 1, 2); + Networks.createSwitch(vl1, "d3WT_1", "d3WT_1", SwitchKind.DISCONNECTOR, false, false, true, 0, 6); + Networks.createSwitch(vl1, "b3WT_1", "b3WT_1", SwitchKind.BREAKER, true, true, true, 5, 6); + Networks.createSwitch(vl2, "d3WT_2", "d3WT_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); + Networks.createSwitch(vl2, "b3WT_2", "b3WT_2", SwitchKind.BREAKER, true, false, true, 3, 4); + Networks.createSwitch(vl3, "d3WT_3", "d3WT_3", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); + Networks.createSwitch(vl3, "b3WT_3", "b3WT_3", SwitchKind.BREAKER, true, true, true, 1, 2); } private class NoFeederInfoProvider extends DefaultDiagramLabelProvider { diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/TopologicalStyleTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/TopologicalStyleTest.java index 7b1841125..cf4806b9f 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/TopologicalStyleTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/TopologicalStyleTest.java @@ -6,6 +6,7 @@ */ package com.powsybl.sld.util; +import com.powsybl.diagram.test.Networks; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ConnectablePosition; import com.powsybl.sld.builders.NetworkGraphBuilder; @@ -42,43 +43,43 @@ public void setUp() throws IOException { substation = network.newSubstation().setId("s").setCountry(Country.FR).add(); // first voltage level - vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); - createLoad(vl1, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); - createSwitch(vl1, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); - createSwitch(vl1, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); + vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + Networks.createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); + Networks.createLoad(vl1, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + Networks.createSwitch(vl1, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); + Networks.createSwitch(vl1, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); // second voltage level - vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); - createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); + vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); + Networks.createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); // third voltage level - vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 10); - createBusBarSection(vl3, "bbs3", "bbs3", 0, 1, 1); + vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 10); + Networks.createBusBarSection(vl3, "bbs3", "bbs3", 0, 1, 1); // 2WT between first and second voltage level - createTwoWindingsTransformer(substation, "2WT", "2WT", 1, 1, 1, 1, 1, 1, + Networks.createTwoWindingsTransformer(substation, "2WT", "2WT", 1, 1, 1, 1, 1, 1, 3, 1, vl1.getId(), vl2.getId(), "2WT_1", 1, ConnectablePosition.Direction.TOP, "2WT_2", 0, ConnectablePosition.Direction.TOP); - createSwitch(vl1, "d2WT_1", "d2WT_1", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); - createSwitch(vl1, "b2WT_1", "b2WT_1", SwitchKind.BREAKER, true, false, true, 3, 4); - createSwitch(vl2, "d2WT_2", "d2WT_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); - createSwitch(vl2, "b2WT_2", "b2WT_2", SwitchKind.BREAKER, true, true, true, 1, 2); + Networks.createSwitch(vl1, "d2WT_1", "d2WT_1", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); + Networks.createSwitch(vl1, "b2WT_1", "b2WT_1", SwitchKind.BREAKER, true, false, true, 3, 4); + Networks.createSwitch(vl2, "d2WT_2", "d2WT_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); + Networks.createSwitch(vl2, "b2WT_2", "b2WT_2", SwitchKind.BREAKER, true, true, true, 1, 2); // 3WT between the 3 voltage levels - createThreeWindingsTransformer(substation, "3WT", "3WT", vl1.getId(), vl2.getId(), vl3.getId(), + Networks.createThreeWindingsTransformer(substation, "3WT", "3WT", vl1.getId(), vl2.getId(), vl3.getId(), 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 3, 1, "3WT_1", 2, ConnectablePosition.Direction.TOP, "3WT_2", 1, ConnectablePosition.Direction.TOP, "3WT_3", 0, ConnectablePosition.Direction.TOP); - createSwitch(vl1, "d3WT_1", "d3WT_1", SwitchKind.DISCONNECTOR, false, false, true, 0, 6); - createSwitch(vl1, "b3WT_1", "b3WT_1", SwitchKind.BREAKER, true, false, true, 5, 6); - createSwitch(vl2, "d3WT_2", "d3WT_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); - createSwitch(vl2, "b3WT_2", "b3WT_2", SwitchKind.BREAKER, true, true, true, 3, 4); - createSwitch(vl3, "d3WT_3", "d3WT_3", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); - createSwitch(vl3, "b3WT_3", "b3WT_3", SwitchKind.BREAKER, true, false, true, 1, 2); + Networks.createSwitch(vl1, "d3WT_1", "d3WT_1", SwitchKind.DISCONNECTOR, false, false, true, 0, 6); + Networks.createSwitch(vl1, "b3WT_1", "b3WT_1", SwitchKind.BREAKER, true, false, true, 5, 6); + Networks.createSwitch(vl2, "d3WT_2", "d3WT_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 4); + Networks.createSwitch(vl2, "b3WT_2", "b3WT_2", SwitchKind.BREAKER, true, true, true, 3, 4); + Networks.createSwitch(vl3, "d3WT_3", "d3WT_3", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); + Networks.createSwitch(vl3, "b3WT_3", "b3WT_3", SwitchKind.BREAKER, true, false, true, 1, 2); } @Test From a6498884518ba61dadb458c8d437f44f0d0ae2ac Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Wed, 19 Apr 2023 10:36:49 +0200 Subject: [PATCH 11/13] Fix code smells on Netorks Signed-off-by: Thomas ADAM --- .../com/powsybl/diagram/test/Networks.java | 152 ++++++++++-------- .../java/com/powsybl/sld/iidm/TestCase1.java | 2 +- .../sld/iidm/TestCase10TestBreakerToBus.java | 2 +- .../sld/iidm/TestCase12GraphWith3WT.java | 6 +- .../powsybl/sld/iidm/TestCase1BusBreaker.java | 2 +- .../powsybl/sld/iidm/TestCase1inverted.java | 2 +- .../sld/iidm/TestCase2StackedCell.java | 2 +- .../powsybl/sld/iidm/TestCase3Coupling.java | 2 +- .../sld/iidm/TestCase3TripleCoupling.java | 2 +- .../sld/iidm/TestCase4NotParallelel.java | 2 +- .../sld/iidm/TestCase5ShuntHorizontal.java | 2 +- .../sld/iidm/TestCase5ShuntVertical.java | 2 +- .../TestCase6CouplingNonFlatHorizontal.java | 2 +- .../sld/iidm/TestCase6InternalConnection.java | 2 +- .../sld/iidm/TestCase7CellDetectionIssue.java | 2 +- .../powsybl/sld/iidm/TestCase7DoubleDJ.java | 2 +- .../sld/iidm/TestCase8JumpOverStacked.java | 2 +- .../iidm/TestCaseFictitiousSwitchNode.java | 2 +- ...TestCaseGraphAdaptCellHeightToContent.java | 2 +- .../sld/iidm/TestCaseLoadBreakSwitch.java | 2 +- .../iidm/TestCaseMissingBusbarPosition.java | 2 +- .../com/powsybl/sld/iidm/TestFeederInfos.java | 2 +- .../com/powsybl/sld/iidm/TestSerialBlock.java | 2 +- .../sld/iidm/TestSerialParallelBlock.java | 2 +- .../sld/iidm/TestSingleLineDiagramClass.java | 4 +- .../sld/iidm/TestTopologyCalculation.java | 2 +- .../TestUnicityNodeIdWithMutipleNetwork.java | 4 +- .../sld/util/NominalVoltageStyleTest.java | 6 +- .../sld/util/TopologicalStyleTest.java | 6 +- 29 files changed, 121 insertions(+), 103 deletions(-) diff --git a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java index 987d78087..41f16b11c 100644 --- a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java +++ b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java @@ -32,6 +32,25 @@ public final class Networks { private static final String VOLTAGELEVEL_1_ID = "VoltageLevel1"; private static final String VOLTAGELEVEL_2_ID = "VoltageLevel2"; + private static final String CONVERTER_1_ID = "Converter1"; + + private static final String CONVERTER_2_ID = "Converter2"; + private static final String LOAD_3_ID = "load3"; + private static final String LOAD_1_ID = "load1"; + private static final String LOAD_2_ID = "load2"; + private static final String LOAD_4_ID = "load4"; + private static final String LINE_1_ID = "line1"; + private static final String BBS_21_ID = "bbs21"; + private static final String BBS_22_ID = "bbs22"; + private static final String LOAD_A_ID = "loadA"; + private static final String LOAD_B_ID = "loadB"; + private static final String BATT_2_ID = "batt2"; + private static final String BATT_1_ID = "batt1"; + private static final String BBS_11_ID = "bbs11"; + private static final String BBS_13_ID = "bbs13"; + private static final String BBS_23_ID = "bbs23"; + private static final String LOAD_C_ID = "loadC"; + private static final String LOAD_D_ID = "loadD"; private Networks() { } @@ -400,7 +419,7 @@ public static Network createNetworkWithHvdcLine() { .setId("Bus1") .add(); voltageLevel1.newVscConverterStation() - .setId("Converter1") + .setId(CONVERTER_1_ID) .setConnectableBus("Bus1") .setBus("Bus1") .setLossFactor(0.011f) @@ -420,7 +439,7 @@ public static Network createNetworkWithHvdcLine() { .setId("Bus2") .add(); voltageLevel2.newVscConverterStation() - .setId("Converter2") + .setId(CONVERTER_2_ID) .setConnectableBus("Bus2") .setBus("Bus2") .setLossFactor(0.011f) @@ -429,8 +448,8 @@ public static Network createNetworkWithHvdcLine() { .add(); network.newHvdcLine() .setId("HvdcLine") - .setConverterStationId1("Converter1") - .setConverterStationId2("Converter2") + .setConverterStationId1(CONVERTER_1_ID) + .setConverterStationId2(CONVERTER_2_ID) .setR(1) .setNominalV(400) .setConvertersMode(HvdcLine.ConvertersMode.SIDE_1_INVERTER_SIDE_2_RECTIFIER) @@ -799,7 +818,7 @@ public static Network createThreeVoltageLevelsFiveBuses() { .setId("b4") .add(); vl3.newLoad() - .setId("load3") + .setId(LOAD_3_ID) .setBus("b3") .setP0(10.0) .setQ0(5.0) @@ -930,7 +949,7 @@ public static Network createTestCase11Network() { // first voltage level // - VoltageLevel vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 50); + VoltageLevel vl1 = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); createBusBarSection(vl1, "bbs2", "bbs2", 1, 1, 2); @@ -945,7 +964,7 @@ public static Network createTestCase11Network() { createSwitch(vl1, "dtrct21", "dtrct21", SwitchKind.BREAKER, true, false, true, 16, 17); createSwitch(vl1, "dsect22", "dsect22", SwitchKind.DISCONNECTOR, false, false, true, 17, 3); - createLoad(vl1, "load1", "load1", "load1", 0, ConnectablePosition.Direction.TOP, 4, 10, 10); + createLoad(vl1, LOAD_1_ID, LOAD_1_ID, LOAD_1_ID, 0, ConnectablePosition.Direction.TOP, 4, 10, 10); createSwitch(vl1, "dload1", "dload1", SwitchKind.DISCONNECTOR, false, false, true, 0, 5); createSwitch(vl1, "bload1", "bload1", SwitchKind.BREAKER, true, false, true, 4, 5); @@ -953,7 +972,7 @@ public static Network createTestCase11Network() { createSwitch(vl1, "dgen1", "dgen1", SwitchKind.DISCONNECTOR, false, false, true, 2, 7); createSwitch(vl1, "bgen1", "bgen1", SwitchKind.BREAKER, true, false, true, 6, 7); - createLoad(vl1, "load2", "load2", "load2", 8, ConnectablePosition.Direction.TOP, 8, 10, 10); + createLoad(vl1, LOAD_2_ID, LOAD_2_ID, LOAD_2_ID, 8, ConnectablePosition.Direction.TOP, 8, 10, 10); createSwitch(vl1, "dload2", "dload2", SwitchKind.DISCONNECTOR, false, false, true, 1, 9); createSwitch(vl1, "bload2", "bload2", SwitchKind.BREAKER, true, false, true, 8, 9); @@ -963,7 +982,7 @@ public static Network createTestCase11Network() { // second voltage level // - VoltageLevel vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 30); + VoltageLevel vl2 = createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225); createBusBarSection(vl2, "bbs5", "bbs5", 0, 1, 1); createBusBarSection(vl2, "bbs6", "bbs6", 1, 2, 1); @@ -972,7 +991,7 @@ public static Network createTestCase11Network() { createSwitch(vl2, "ddcpl1", "ddcpl1", SwitchKind.BREAKER, true, false, true, 6, 7); createSwitch(vl2, "dscpl2", "dscpl2", SwitchKind.DISCONNECTOR, false, false, true, 7, 1); - createLoad(vl2, "load3", "load3", "load3", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); + createLoad(vl2, LOAD_3_ID, LOAD_3_ID, LOAD_3_ID, 0, ConnectablePosition.Direction.TOP, 2, 10, 10); createSwitch(vl2, "dload3", "dload3", SwitchKind.DISCONNECTOR, false, false, true, 0, 3); createSwitch(vl2, "bload3", "bload3", SwitchKind.BREAKER, true, false, true, 2, 3); @@ -982,11 +1001,11 @@ public static Network createTestCase11Network() { // third voltage level // - VoltageLevel vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 50, 20); + VoltageLevel vl3 = createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 50); createBusBarSection(vl3, "bbs7", "bbs7", 0, 1, 1); - createLoad(vl3, "load4", "load4", "load4", 0, ConnectablePosition.Direction.TOP, 1, 10, 10); + createLoad(vl3, LOAD_4_ID, LOAD_4_ID, LOAD_4_ID, 0, ConnectablePosition.Direction.TOP, 1, 10, 10); createSwitch(vl3, "dload4", "dload4", SwitchKind.DISCONNECTOR, false, false, true, 0, 2); createSwitch(vl3, "bload4", "bload4", SwitchKind.BREAKER, true, false, true, 2, 1); @@ -1087,7 +1106,7 @@ public static Network createTestCase11Network() { // Creation of another substation, another voltageLevel and a line between the two substations // Substation substation2 = createSubstation(network, "subst2", "subst2", Country.FR); - VoltageLevel vlSubst2 = createVoltageLevel(substation2, "vlSubst2", "vlSubst2", TopologyKind.NODE_BREAKER, 380, 50); + VoltageLevel vlSubst2 = createVoltageLevel(substation2, "vlSubst2", "vlSubst2", TopologyKind.NODE_BREAKER, 380); createBusBarSection(vlSubst2, "bbs1_2", "bbs1_2", 0, 1, 1); @@ -1095,10 +1114,10 @@ public static Network createTestCase11Network() { createSwitch(vl1, "bline11_2", "bline11_2", SwitchKind.BREAKER, true, false, true, 34, 35); createSwitch(vlSubst2, "dline21_2", "dline21_2", SwitchKind.DISCONNECTOR, false, false, true, 0, 1); createSwitch(vlSubst2, "bline21_2", "bline21_2", SwitchKind.BREAKER, true, false, true, 1, 2); - createLine(network, "line1", "line1", 2.0, 14.745, 1.0, 1.0, 1.0, 1.0, + createLine(network, LINE_1_ID, LINE_1_ID, 2.0, 14.745, 1.0, 1.0, 1.0, 1.0, 35, 2, vl1.getId(), vlSubst2.getId(), - "line1", 7, ConnectablePosition.Direction.TOP, - "line1", 1, ConnectablePosition.Direction.TOP); + LINE_1_ID, 7, ConnectablePosition.Direction.TOP, + LINE_1_ID, 1, ConnectablePosition.Direction.TOP); return network; } @@ -1133,7 +1152,7 @@ public static Network createNodeBreakerNetworkWithInternalBranches(String id, St Network network = Network.create(id, sourceFormat); Substation substation = createSubstation(network, "S1", "S1", Country.FR); - VoltageLevel vl1 = createVoltageLevel(substation, "VL1", "VL1", TopologyKind.NODE_BREAKER, 400, 24); + VoltageLevel vl1 = createVoltageLevel(substation, "VL1", "VL1", TopologyKind.NODE_BREAKER, 400); createBusBarSection(vl1, "BBS11", "BBS11", 10, 1, 1); createBusBarSection(vl1, "BBS12", "BBS12", 20, 2, 1); @@ -1163,7 +1182,7 @@ public static Network createNodeBreakerNetworkWithInternalBranches(String id, St "L11", null, ConnectablePosition.Direction.TOP, "L11", null, ConnectablePosition.Direction.TOP); - VoltageLevel vl2 = createVoltageLevel(substation, "VL2", "VL2", TopologyKind.NODE_BREAKER, 400, 9); + VoltageLevel vl2 = createVoltageLevel(substation, "VL2", "VL2", TopologyKind.NODE_BREAKER, 400); createBusBarSection(vl2, "BBS2", "BBS2", 30, 1, 1); @@ -1195,10 +1214,10 @@ public static Network createNodeBreakerNetworkWithInternalBranches(String id, St "T11", null, ConnectablePosition.Direction.TOP); TwoWindingsTransformer twoWindingsTransformer = network.getTwoWindingsTransformer("T11"); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setP(375); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setP(375); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setQ(48); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setQ(48); + twoWindingsTransformer.getTerminal(Branch.Side.ONE).setP(375); + twoWindingsTransformer.getTerminal(Branch.Side.TWO).setP(375); + twoWindingsTransformer.getTerminal(Branch.Side.ONE).setQ(48); + twoWindingsTransformer.getTerminal(Branch.Side.TWO).setQ(48); createSwitch(vl1, "D27", "D27", SwitchKind.DISCONNECTOR, false, false, false, 20, 27); createSwitch(vl1, "BR28", "BR28", SwitchKind.BREAKER, false, false, false, 27, 28); @@ -1212,10 +1231,10 @@ public static Network createNodeBreakerNetworkWithInternalBranches(String id, St "T12", null, ConnectablePosition.Direction.TOP); twoWindingsTransformer = network.getTwoWindingsTransformer("T12"); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setP(375); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setP(375); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setQ(48); - twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setQ(48); + twoWindingsTransformer.getTerminal(Branch.Side.ONE).setP(375); + twoWindingsTransformer.getTerminal(Branch.Side.TWO).setP(375); + twoWindingsTransformer.getTerminal(Branch.Side.ONE).setQ(48); + twoWindingsTransformer.getTerminal(Branch.Side.TWO).setQ(48); createSwitch(vl1, "D19", "D19", SwitchKind.DISCONNECTOR, false, false, false, 10, 19); createSwitch(vl1, "BR20", "BR20", SwitchKind.BREAKER, false, false, false, 19, 190); @@ -1241,7 +1260,7 @@ public static Network createBusBreakerNetworkWithInternalBranches(String id, Str Network network = Network.create(id, sourceFormat); Substation substation = createSubstation(network, "S1", "S1", Country.FR); - VoltageLevel vl1 = createVoltageLevel(substation, "VL1", "VL1", TopologyKind.BUS_BREAKER, 400, -1); + VoltageLevel vl1 = createVoltageLevel(substation, "VL1", "VL1", TopologyKind.BUS_BREAKER, 400); vl1.getBusBreakerView().newBus() .setId("B11") @@ -1385,7 +1404,7 @@ public static Network createBusBreakerNetworkWithInternalBranches(String id, Str .setRatedU2(90) .add(); - ThreeWindingsTransformer threeWindingsTransformer = substation.newThreeWindingsTransformer() + substation.newThreeWindingsTransformer() .setId("T3_12") .setRatedU0(234) .newLeg1() @@ -1439,14 +1458,14 @@ public static Network createNetworkWithSvcVscScDl() { .setBmin(0.0002) .setBmax(0.0008) .setRegulationMode(StaticVarCompensator.RegulationMode.VOLTAGE) - .setVoltageSetPoint(390) + .setVoltageSetpoint(390) .add(); svc.getTerminal() .setP(100.0) .setQ(50.0); VscConverterStation vsc = vl.newVscConverterStation() .setId("vsc") - .setName("Converter1") + .setName(CONVERTER_1_ID) .setNode(1) .setLossFactor(0.011f) .setVoltageSetpoint(405.0) @@ -1455,7 +1474,7 @@ public static Network createNetworkWithSvcVscScDl() { vsc.getTerminal() .setP(100.0) .setQ(50.0); - ShuntCompensator c1 = vl.newShuntCompensator() + vl.newShuntCompensator() .setId("C1") .setName("Filter 1") .setNode(4) @@ -1494,7 +1513,7 @@ public static Network createNetworkWithSvcVscScDl() { VscConverterStation vsc2 = vl2.newVscConverterStation() .setId("vsc2") - .setName("Converter2") + .setName(CONVERTER_2_ID) .setNode(1) .setLossFactor(0.011f) .setVoltageSetpoint(405.0) @@ -1525,15 +1544,15 @@ public static Network createNetworkWithFiveBusesFourLoads() { VoltageLevel vl = network.getVoltageLevel("vl1"); createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); - createBusBarSection(vl, "bbs21", "bbs21", 1, 2, 1); - createBusBarSection(vl, "bbs22", "bbs22", 2, 2, 2); + createBusBarSection(vl, BBS_21_ID, BBS_21_ID, 1, 2, 1); + createBusBarSection(vl, BBS_22_ID, BBS_22_ID, 2, 2, 2); createSwitch(vl, "bA", "bA", SwitchKind.BREAKER, false, false, false, 3, 4); - createLoad(vl, "loadA", "loadA", "loadA", null, ConnectablePosition.Direction.TOP, 4, 10, 10); + createLoad(vl, LOAD_A_ID, LOAD_A_ID, LOAD_A_ID, null, ConnectablePosition.Direction.TOP, 4, 10, 10); createSwitch(vl, "dA1", "dA1", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); createSwitch(vl, "dA2", "dA2", SwitchKind.DISCONNECTOR, false, false, false, 1, 3); createSwitch(vl, "bB", "bB", SwitchKind.BREAKER, false, false, false, 5, 6); - createLoad(vl, "loadB", "loadB", "loadB", null, ConnectablePosition.Direction.TOP, 6, 10, 10); + createLoad(vl, LOAD_B_ID, LOAD_B_ID, LOAD_B_ID, null, ConnectablePosition.Direction.TOP, 6, 10, 10); createSwitch(vl, "dB1", "dB1", SwitchKind.DISCONNECTOR, false, false, false, 2, 5); createSwitch(vl, "dB2", "dB2", SwitchKind.DISCONNECTOR, false, false, false, 0, 5); @@ -1545,22 +1564,22 @@ public static Network createNetworkWithFiveBusesFourLoads() { public static Network createNetworkWithTwoParallelLoads() { Network network = Network.create("TestSingleLineDiagramClass", "test"); Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs13", "bbs13", 7, 1, 3); - createBusBarSection(vl, "bbs23", "bbs23", 8, 2, 3); - createLoad(vl, "loadC", "loadC", "loadC", null, ConnectablePosition.Direction.TOP, 9, 10, 10); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); + createBusBarSection(vl, BBS_13_ID, BBS_13_ID, 7, 1, 3); + createBusBarSection(vl, BBS_23_ID, BBS_23_ID, 8, 2, 3); + createLoad(vl, LOAD_C_ID, LOAD_C_ID, LOAD_C_ID, null, ConnectablePosition.Direction.TOP, 9, 10, 10); createSwitch(vl, "bCD1", "bCD1", SwitchKind.BREAKER, false, false, false, 8, 9); createSwitch(vl, "bCD2", "bCD2", SwitchKind.BREAKER, false, false, false, 7, 9); createSwitch(vl, "bCD3", "bCD3", SwitchKind.BREAKER, false, false, false, 7, 9); createSwitch(vl, "bD1", "bD1", SwitchKind.BREAKER, false, false, false, 20, 9); - createLoad(vl, "loadD", "loadD", "loadD", null, ConnectablePosition.Direction.TOP, 20, 10, 10); + createLoad(vl, LOAD_D_ID, LOAD_D_ID, LOAD_D_ID, null, ConnectablePosition.Direction.TOP, 20, 10, 10); return network; } public static Network createNetworkWithFourParallelLegs() { Network network = Network.create("networkWithFourParallelLegs", "test"); Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 3); createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 3); createSwitch(vl, "d1a", "d1an", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); @@ -1576,7 +1595,7 @@ public static Network createNetworkWithFourParallelLegs() { public static Network createNetworkWithInternalPst() { Network network = Network.create("networkWithInternalPst", "test"); Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 3); createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 3); createSwitch(vl, "d1a", "d1an", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); @@ -1597,13 +1616,13 @@ public static Network createNetworkWithInternalPst() { public static Network createNetworkWithFlatSections() { Network network = Network.create("TestSingleLineDiagramClass", "test"); Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); - createBusBarSection(vl, "bbs21", "bbs21", 1, 2, 1); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); + createBusBarSection(vl, BBS_11_ID, BBS_11_ID, 0, 1, 1); + createBusBarSection(vl, BBS_21_ID, BBS_21_ID, 1, 2, 1); createBusBarSection(vl, "bbs12", "bbs12", 2, 1, 2); - createBusBarSection(vl, "bbs22", "bbs22", 3, 2, 2); - createBusBarSection(vl, "bbs13", "bbs13", 4, 1, 3); - createBusBarSection(vl, "bbs23", "bbs23", 5, 2, 3); + createBusBarSection(vl, BBS_22_ID, BBS_22_ID, 3, 2, 2); + createBusBarSection(vl, BBS_13_ID, BBS_13_ID, 4, 1, 3); + createBusBarSection(vl, BBS_23_ID, BBS_23_ID, 5, 2, 3); createSwitch(vl, "d112", "d112", SwitchKind.DISCONNECTOR, false, false, false, 0, 2); createSwitch(vl, "d212", "d212", SwitchKind.DISCONNECTOR, false, false, false, 1, 3); createSwitch(vl, "d123a", "d123a", SwitchKind.DISCONNECTOR, false, false, false, 2, 6); @@ -1618,14 +1637,14 @@ public static Network createNetworkWithFlatSections() { public static Network createNetworkWithBatteries() { Network network = Network.create("TestBatteries", "test"); Substation substation = createSubstation(network, "s", "s", Country.FR); - VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); - createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); + VoltageLevel vl = createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); + createBusBarSection(vl, BBS_11_ID, BBS_11_ID, 0, 1, 1); createSwitch(vl, "d1b", "d1b", SwitchKind.DISCONNECTOR, true, false, false, 1, 2); createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, true, false, false, 0, 1); - createBattery(vl, "batt1", "batt1", "batt1", null, ConnectablePosition.Direction.TOP, 2, 1, 10, 5, 5); + createBattery(vl, BATT_1_ID, BATT_1_ID, BATT_1_ID, null, ConnectablePosition.Direction.TOP, 2, 1, 10, 5, 5); createSwitch(vl, "d2b", "d2b", SwitchKind.DISCONNECTOR, true, true, false, 3, 4); createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, true, true, false, 0, 3); - createBattery(vl, "batt2", "batt2", "batt2", null, ConnectablePosition.Direction.BOTTOM, 4, 3, 10, 6, 6); + createBattery(vl, BATT_2_ID, BATT_2_ID, BATT_2_ID, null, ConnectablePosition.Direction.BOTTOM, 4, 3, 10, 6, 6); return network; } @@ -1638,14 +1657,13 @@ public static Substation createSubstation(Network n, String id, String name, Cou } public static VoltageLevel createVoltageLevel(Substation s, String id, String name, - TopologyKind topology, double vNom, int nodeCount) { - VoltageLevel vl = s.newVoltageLevel() + TopologyKind topology, double vNom) { + return s.newVoltageLevel() .setId(id) .setName(name) .setTopologyKind(topology) .setNominalV(vNom) .add(); - return vl; } public static void createSwitch(VoltageLevel vl, String id, String name, SwitchKind kind, boolean retained, boolean open, boolean fictitious, int node1, int node2) { @@ -1709,10 +1727,10 @@ public static void createGenerator(VoltageLevel vl, String id, String name, Stri addFeederPosition(gen, feederName, feederOrder, direction); } - protected static void createBattery(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, - ConnectablePosition.Direction direction, int node, - double minP, double maxP, - double targetP, double targetQ) { + private static void createBattery(VoltageLevel vl, String id, String name, String feederName, Integer feederOrder, + ConnectablePosition.Direction direction, int node, + double minP, double maxP, + double targetP, double targetQ) { Battery battery = vl.newBattery() .setId(id) .setName(name) @@ -1766,13 +1784,13 @@ public static TwoWindingsTransformer createTwoWindingsTransformer(Substation s, return t; } - protected static void createPhaseShiftTransformer(Substation s, String id, String name, - double r, double x, double g, double b, - double ratedU1, double ratedU2, - int node1, int node2, - String idVoltageLevel1, String idVoltageLevel2, - String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, - String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { + private static void createPhaseShiftTransformer(Substation s, String id, String name, + double r, double x, double g, double b, + double ratedU1, double ratedU2, + int node1, int node2, + String idVoltageLevel1, String idVoltageLevel2, + String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, + String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { TwoWindingsTransformer twt = createTwoWindingsTransformer(s, id, name, r, x, g, b, ratedU1, ratedU2, node1, node2, idVoltageLevel1, idVoltageLevel2, feederName1, feederOrder1, direction1, feederName2, feederOrder2, direction2); twt.newPhaseTapChanger() diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1.java index 5d95b2cdb..b673fe7b3 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1.java @@ -42,7 +42,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase10TestBreakerToBus.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase10TestBreakerToBus.java index 4aa213810..117feab95 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase10TestBreakerToBus.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase10TestBreakerToBus.java @@ -35,7 +35,7 @@ class TestCase10TestBreakerToBus extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase1", "AbstractTest"); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 0, 2); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java index 3f97c266f..0731f9a02 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase12GraphWith3WT.java @@ -44,7 +44,7 @@ public void setUp() { // first voltage level // - vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 50); + vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); Networks.createBusBarSection(vl1, "bbs2", "bbs2", 1, 1, 2); @@ -77,7 +77,7 @@ public void setUp() { // second voltage level // - vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 50); + vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225); Networks.createBusBarSection(vl2, "bbs5", "bbs5", 0, 1, 1); Networks.createBusBarSection(vl2, "bbs6", "bbs6", 1, 2, 1); @@ -96,7 +96,7 @@ public void setUp() { // third voltage level // - vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 50); + vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63); Networks.createBusBarSection(vl3, "bbs7", "bbs7", 0, 1, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1BusBreaker.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1BusBreaker.java index 525eed6a7..c19d7ab7c 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1BusBreaker.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1BusBreaker.java @@ -27,7 +27,7 @@ public void setUp() { network = Network.create("busBreakerTestCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.BUS_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.BUS_BREAKER, 380); VoltageLevel.BusBreakerView view = vl.getBusBreakerView(); view.newBus() .setId("b1") diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1inverted.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1inverted.java index 77c2cae3a..173e66755 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1inverted.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase1inverted.java @@ -43,7 +43,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 0, 10, 10); Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 2, 1); Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 0); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase2StackedCell.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase2StackedCell.java index 533b28567..4f0381345 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase2StackedCell.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase2StackedCell.java @@ -43,7 +43,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); Networks.createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 1); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 3, 10, 10); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3Coupling.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3Coupling.java index a190c31e5..55ef0599a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3Coupling.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3Coupling.java @@ -40,7 +40,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3TripleCoupling.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3TripleCoupling.java index 91af2825d..eddfbc854 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3TripleCoupling.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase3TripleCoupling.java @@ -39,7 +39,7 @@ public void setUp() { network = Network.create("testCase2", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); Networks.createSwitch(vl, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase4NotParallelel.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase4NotParallelel.java index 9e2047797..ee8b42945 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase4NotParallelel.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase4NotParallelel.java @@ -51,7 +51,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); Networks.createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); Networks.createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntHorizontal.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntHorizontal.java index 157cea4e5..51078c8c3 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntHorizontal.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntHorizontal.java @@ -44,7 +44,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl, "la", "la", "la", 10, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntVertical.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntVertical.java index 30de5c48e..43228b9f4 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntVertical.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase5ShuntVertical.java @@ -44,7 +44,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl, "la", "la", "la", 20, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6CouplingNonFlatHorizontal.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6CouplingNonFlatHorizontal.java index 983214da3..405e662d0 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6CouplingNonFlatHorizontal.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6CouplingNonFlatHorizontal.java @@ -40,7 +40,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); Networks.createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); Networks.createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6InternalConnection.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6InternalConnection.java index 6290a702a..ecf4f7ed3 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6InternalConnection.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase6InternalConnection.java @@ -37,7 +37,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); Networks.createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); Networks.createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7CellDetectionIssue.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7CellDetectionIssue.java index 802469294..d6771340e 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7CellDetectionIssue.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7CellDetectionIssue.java @@ -41,7 +41,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 0, 10, 10); vl.getNodeBreakerView().newInternalConnection() diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7DoubleDJ.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7DoubleDJ.java index e3e56ad1a..8f9daaca2 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7DoubleDJ.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase7DoubleDJ.java @@ -27,7 +27,7 @@ class TestCase7DoubleDJ extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase", "test"); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); Networks.createSwitch(vl, "b1", "b1", SwitchKind.BREAKER, false, false, false, 1, 2); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase8JumpOverStacked.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase8JumpOverStacked.java index f01fadb3a..652c21cb1 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase8JumpOverStacked.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase8JumpOverStacked.java @@ -32,7 +32,7 @@ class TestCase8JumpOverStacked extends AbstractTestCaseIidm { public void setUp() { network = Network.create("testCase", "test"); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 15); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs11", "bbs11", 0, 1, 1); Networks.createBusBarSection(vl, "bbs12", "bbs12", 1, 1, 2); Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousSwitchNode.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousSwitchNode.java index 9741cf310..5c644c999 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousSwitchNode.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseFictitiousSwitchNode.java @@ -28,7 +28,7 @@ public void setUp() { network = Network.create("testFictitiousSwitchNode", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseGraphAdaptCellHeightToContent.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseGraphAdaptCellHeightToContent.java index 64e8eae44..8b180de65 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseGraphAdaptCellHeightToContent.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseGraphAdaptCellHeightToContent.java @@ -34,7 +34,7 @@ public void setUp() { substation = Networks.createSubstation(network, "subst", "subst", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 50); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); Networks.createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseLoadBreakSwitch.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseLoadBreakSwitch.java index 268d06418..7b5c98f6f 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseLoadBreakSwitch.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseLoadBreakSwitch.java @@ -30,7 +30,7 @@ public void setUp() { network = Network.create("testCaseLoadBreakSwitch", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createBusBarSection(vl, "bbs2", "bbs2", 1, 2, 2); Networks.createGenerator(vl, "G", "G", "G", 0, ConnectablePosition.Direction.TOP, 2, 50, 100, false, 100, 400); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseMissingBusbarPosition.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseMissingBusbarPosition.java index c1c75c817..fc8e19b70 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseMissingBusbarPosition.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCaseMissingBusbarPosition.java @@ -40,7 +40,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); vl.getNodeBreakerView().newBusbarSection().setId("bbs1").setName("bbs1").setNode(0).add(); // no position extension Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFeederInfos.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFeederInfos.java index ce8d6f6ef..73125b53a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFeederInfos.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestFeederInfos.java @@ -56,7 +56,7 @@ public void setUp() { network = Network.create("testCase14", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialBlock.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialBlock.java index a2f8f78ef..4edcef9f5 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialBlock.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialBlock.java @@ -46,7 +46,7 @@ public void setUp() { Network network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl, "la", "la", "la", 10, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 2, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialParallelBlock.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialParallelBlock.java index 444d94fd8..aceff0176 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialParallelBlock.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSerialParallelBlock.java @@ -46,7 +46,7 @@ public void setUp() { Network network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createSwitch(vl, "da", "da", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); Networks.createSwitch(vl, "ba", "ba", SwitchKind.BREAKER, false, false, false, 1, 2); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSingleLineDiagramClass.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSingleLineDiagramClass.java index 3e7228466..4bba5eeff 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSingleLineDiagramClass.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestSingleLineDiagramClass.java @@ -51,7 +51,7 @@ public void setUp() throws IOException { network = Network.create("TestSingleLineDiagramClass", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1", "bbs1", 0, 1, 1); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "d1", "d1", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); @@ -59,7 +59,7 @@ public void setUp() throws IOException { Networks.createSwitch(vl, "d2", "d2", SwitchKind.DISCONNECTOR, false, false, false, 0, 3); Networks.createSwitch(vl, "b2", "b2", SwitchKind.BREAKER, false, false, false, 3, 4); - VoltageLevel vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); + VoltageLevel vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225); Networks.createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); Networks.createGenerator(vl2, "g", "g", "g", -1, ConnectablePosition.Direction.BOTTOM, 2, 0, 20, false, 10, 10); Networks.createSwitch(vl2, "d3", "d3", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestTopologyCalculation.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestTopologyCalculation.java index 834e6aa08..e43f64f67 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestTopologyCalculation.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestTopologyCalculation.java @@ -49,7 +49,7 @@ public void setUp() { network = Network.create("testCase1", "test"); graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 12); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs1.1", "bbs1.1", 0, 1, 1); Networks.createBusBarSection(vl, "bbs1.2", "bbs1.2", 1, 1, 2); Networks.createBusBarSection(vl, "bbs2.1", "bbs2.1", 2, 2, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnicityNodeIdWithMutipleNetwork.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnicityNodeIdWithMutipleNetwork.java index 92aadcd33..3aa8c4cf2 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnicityNodeIdWithMutipleNetwork.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestUnicityNodeIdWithMutipleNetwork.java @@ -39,7 +39,7 @@ public void setUp() { graphBuilder = new NetworkGraphBuilder(network); substation = Networks.createSubstation(network, "s", "s", Country.FR); - vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); @@ -49,7 +49,7 @@ public void setUp() { network2 = Network.create("n2", "test"); graphBuilder2 = new NetworkGraphBuilder(network2); substation2 = Networks.createSubstation(network2, "s", "s", Country.FR); - vl2 = Networks.createVoltageLevel(substation2, "vl", "vl", TopologyKind.NODE_BREAKER, 380, 10); + vl2 = Networks.createVoltageLevel(substation2, "vl", "vl", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl2, "bbs", "bbs", 0, 1, 1); Networks.createLoad(vl2, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl2, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/NominalVoltageStyleTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/NominalVoltageStyleTest.java index f40720402..4bb82b0e4 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/NominalVoltageStyleTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/NominalVoltageStyleTest.java @@ -56,18 +56,18 @@ public void setUp() { new HighlightLineStateStyleProvider(network)); // first voltage level - vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); Networks.createLoad(vl1, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl1, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); Networks.createSwitch(vl1, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); // second voltage level - vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); + vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225); Networks.createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); // third voltage level - vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 10); + vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63); Networks.createBusBarSection(vl3, "bbs3", "bbs3", 0, 1, 1); // 2WT between first and second voltage level diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/TopologicalStyleTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/TopologicalStyleTest.java index cf4806b9f..141935a62 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/TopologicalStyleTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/util/TopologicalStyleTest.java @@ -43,18 +43,18 @@ public void setUp() throws IOException { substation = network.newSubstation().setId("s").setCountry(Country.FR).add(); // first voltage level - vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380, 10); + vl1 = Networks.createVoltageLevel(substation, "vl1", "vl1", TopologyKind.NODE_BREAKER, 380); Networks.createBusBarSection(vl1, "bbs1", "bbs1", 0, 1, 1); Networks.createLoad(vl1, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); Networks.createSwitch(vl1, "d", "d", SwitchKind.DISCONNECTOR, false, false, false, 0, 1); Networks.createSwitch(vl1, "b", "b", SwitchKind.BREAKER, false, false, false, 1, 2); // second voltage level - vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225, 10); + vl2 = Networks.createVoltageLevel(substation, "vl2", "vl2", TopologyKind.NODE_BREAKER, 225); Networks.createBusBarSection(vl2, "bbs2", "bbs2", 0, 1, 1); // third voltage level - vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63, 10); + vl3 = Networks.createVoltageLevel(substation, "vl3", "vl3", TopologyKind.NODE_BREAKER, 63); Networks.createBusBarSection(vl3, "bbs3", "bbs3", 0, 1, 1); // 2WT between first and second voltage level From 4fdef9d77f21d0b575535f4001f1b79648dd7886 Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Tue, 2 May 2023 12:13:18 +0200 Subject: [PATCH 12/13] Taking into account PR comments Signed-off-by: Thomas ADAM --- .../java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java | 8 +++++--- .../test/java/com/powsybl/sld/model/ZoneGraphTest.java | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java index 80b14406f..e7721dbf0 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestCase13ZoneGraph.java @@ -10,7 +10,6 @@ import com.powsybl.sld.builders.NetworkGraphBuilder; import com.powsybl.sld.layout.LayoutParameters; import com.powsybl.sld.model.graphs.ZoneGraph; -import com.powsybl.sld.model.ZoneGraphTest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -24,6 +23,9 @@ */ class TestCase13ZoneGraph extends AbstractTestCaseIidm { + private static final String SUBSTATION_ID_1 = "Substation1"; + private static final String SUBSTATION_ID_2 = "Substation2"; + @BeforeEach public void setUp() { layoutParameters.setCssLocation(LayoutParameters.CssLocation.INSERTED_IN_SVG); @@ -34,7 +36,7 @@ public void setUp() { @Test void test() { - List zone = Arrays.asList(ZoneGraphTest.SUBSTATION_ID_1, ZoneGraphTest.SUBSTATION_ID_2); + List zone = Arrays.asList(SUBSTATION_ID_1, SUBSTATION_ID_2); ZoneGraph g = new NetworkGraphBuilder(network).buildZoneGraph(zone); // write Json and compare to reference assertEquals(toString("/TestCase13ZoneGraph.json"), toJson(g, "/TestCase13ZoneGraph.json")); @@ -42,7 +44,7 @@ void test() { @Test void test2() { - List zone = Arrays.asList(ZoneGraphTest.SUBSTATION_ID_1, ZoneGraphTest.SUBSTATION_ID_2); + List zone = Arrays.asList(SUBSTATION_ID_1, SUBSTATION_ID_2); ZoneGraph g = new NetworkGraphBuilder(network).buildZoneGraph(zone); // write Json and compare to reference assertEquals(toString("/TestCase13ZoneGraphNoCoords.json"), toJson(g, "/TestCase13ZoneGraphNoCoords.json", false)); diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java index 53c3dec26..2e7be4d1a 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java @@ -28,8 +28,8 @@ */ public class ZoneGraphTest { - public static final String SUBSTATION_ID_1 = "Substation1"; - public static final String SUBSTATION_ID_2 = "Substation2"; + private static final String SUBSTATION_ID_1 = "Substation1"; + private static final String SUBSTATION_ID_2 = "Substation2"; private static final String VOLTAGELEVEL_ID_1 = "VoltageLevel1"; private static final String VOLTAGELEVEL_ID_2 = "VoltageLevel2"; private static final String LINE_ID = "Line"; From c083f55d463108108f703544fa2c29d34c490c7e Mon Sep 17 00:00:00 2001 From: Thomas ADAM Date: Tue, 2 May 2023 12:24:41 +0200 Subject: [PATCH 13/13] Fix code smells on Networks class Signed-off-by: Thomas ADAM --- .../com/powsybl/diagram/test/Networks.java | 30 ++++++++++--------- .../com/powsybl/sld/model/ZoneGraphTest.java | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java index 41f16b11c..ce9222e6b 100644 --- a/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java +++ b/diagram-test/src/main/java/com/powsybl/diagram/test/Networks.java @@ -52,6 +52,8 @@ public final class Networks { private static final String LOAD_C_ID = "loadC"; private static final String LOAD_D_ID = "loadD"; + private static final String THREE_WINDING_TRANSFORMER_12_ID = "T3_12"; + private Networks() { } @@ -1145,7 +1147,7 @@ private static void createStatusExtensions(Network network) { network.getTwoWindingsTransformer("T11").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.PLANNED_OUTAGE).add(); network.getTwoWindingsTransformer("T12").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); - network.getThreeWindingsTransformer("T3_12").newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); + network.getThreeWindingsTransformer(THREE_WINDING_TRANSFORMER_12_ID).newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add(); } public static Network createNodeBreakerNetworkWithInternalBranches(String id, String sourceFormat) { @@ -1245,13 +1247,13 @@ public static Network createNodeBreakerNetworkWithInternalBranches(String id, St createSwitch(vl2, "D37", "D37", SwitchKind.DISCONNECTOR, false, false, false, 30, 37); createSwitch(vl2, "BR38", "BR38", SwitchKind.BREAKER, false, false, false, 37, 38); - createThreeWindingsTransformer(substation, "T3_12", "T3_12", vl1.getId(), vl1.getId(), vl2.getId(), + createThreeWindingsTransformer(substation, THREE_WINDING_TRANSFORMER_12_ID, THREE_WINDING_TRANSFORMER_12_ID, vl1.getId(), vl1.getId(), vl2.getId(), 45, 47, 49, 35, 32, 39., 25, 15, 5, 7, 9, 190, 290, 38, - "T3_12", null, ConnectablePosition.Direction.TOP, - "T3_12", null, ConnectablePosition.Direction.TOP, - "T3_12", null, ConnectablePosition.Direction.TOP); + THREE_WINDING_TRANSFORMER_12_ID, null, ConnectablePosition.Direction.TOP, + THREE_WINDING_TRANSFORMER_12_ID, null, ConnectablePosition.Direction.TOP, + THREE_WINDING_TRANSFORMER_12_ID, null, ConnectablePosition.Direction.TOP); return network; } @@ -1405,7 +1407,7 @@ public static Network createBusBreakerNetworkWithInternalBranches(String id, Str .add(); substation.newThreeWindingsTransformer() - .setId("T3_12") + .setId(THREE_WINDING_TRANSFORMER_12_ID) .setRatedU0(234) .newLeg1() .setVoltageLevel("VL1") @@ -1893,7 +1895,7 @@ public static void createLine(Network network, } private static void addFeederPosition(Extendable extendable, String feederName, Integer feederOrder, ConnectablePosition.Direction direction) { - ConnectablePositionAdder.FeederAdder feederAdder = extendable.newExtension(ConnectablePositionAdder.class).newFeeder(); + ConnectablePositionAdder.FeederAdder feederAdder = extendable.newExtension(ConnectablePositionAdder.class).newFeeder(); if (feederOrder != null) { feederAdder.withOrder(feederOrder); } @@ -1904,13 +1906,13 @@ private static void addFeederPosition(Extendable extendable, String feederNam private static void addTwoFeedersPosition(Extendable extendable, String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2) { - ConnectablePositionAdder extensionAdder = extendable.newExtension(ConnectablePositionAdder.class); - ConnectablePositionAdder.FeederAdder feederAdder1 = extensionAdder.newFeeder1(); + ConnectablePositionAdder extensionAdder = extendable.newExtension(ConnectablePositionAdder.class); + ConnectablePositionAdder.FeederAdder feederAdder1 = extensionAdder.newFeeder1(); if (feederOrder1 != null) { feederAdder1.withOrder(feederOrder1); } feederAdder1.withName(feederName1).withDirection(direction1).add(); - ConnectablePositionAdder.FeederAdder feederAdder2 = extensionAdder.newFeeder2(); + ConnectablePositionAdder.FeederAdder feederAdder2 = extensionAdder.newFeeder2(); if (feederOrder2 != null) { feederAdder2.withOrder(feederOrder2); } @@ -1922,18 +1924,18 @@ private static void addThreeFeedersPosition(Extendable extendable, String feederName1, Integer feederOrder1, ConnectablePosition.Direction direction1, String feederName2, Integer feederOrder2, ConnectablePosition.Direction direction2, String feederName3, Integer feederOrder3, ConnectablePosition.Direction direction3) { - ConnectablePositionAdder extensionAdder = extendable.newExtension(ConnectablePositionAdder.class); - ConnectablePositionAdder.FeederAdder feederAdder1 = extensionAdder.newFeeder1(); + ConnectablePositionAdder extensionAdder = extendable.newExtension(ConnectablePositionAdder.class); + ConnectablePositionAdder.FeederAdder feederAdder1 = extensionAdder.newFeeder1(); if (feederOrder1 != null) { feederAdder1.withOrder(feederOrder1); } feederAdder1.withName(feederName1).withDirection(direction1).add(); - ConnectablePositionAdder.FeederAdder feederAdder2 = extensionAdder.newFeeder2(); + ConnectablePositionAdder.FeederAdder feederAdder2 = extensionAdder.newFeeder2(); if (feederOrder2 != null) { feederAdder2.withOrder(feederOrder2); } feederAdder2.withName(feederName2).withDirection(direction2).add(); - ConnectablePositionAdder.FeederAdder feederAdder3 = extensionAdder.newFeeder3(); + ConnectablePositionAdder.FeederAdder feederAdder3 = extensionAdder.newFeeder3(); if (feederOrder3 != null) { feederAdder3.withOrder(feederOrder3); } diff --git a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java index 2e7be4d1a..91f427c76 100644 --- a/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java +++ b/single-line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/model/ZoneGraphTest.java @@ -26,7 +26,7 @@ * * @author Massimo Ferraro */ -public class ZoneGraphTest { +class ZoneGraphTest { private static final String SUBSTATION_ID_1 = "Substation1"; private static final String SUBSTATION_ID_2 = "Substation2";