From e15f183fceab03f25a42bcf43c31b3d244a3c2da Mon Sep 17 00:00:00 2001 From: Yassine ABAINOU Date: Tue, 14 Sep 2021 11:22:09 +0200 Subject: [PATCH] add plasma components library + first unit test --- .../2-windings-transformer-winding1.svg | 4 + .../2-windings-transformer-winding2.svg | 4 + .../PlasmaLibrary/2-windings-transformer.svg | 10 + .../3-windings-transformer-winding1.svg | 4 + .../3-windings-transformer-winding2.svg | 4 + .../3-windings-transformer-winding3.svg | 4 + .../PlasmaLibrary/3-windings-transformer.svg | 6 + .../main/resources/PlasmaLibrary/arrow.svg | 8 + .../resources/PlasmaLibrary/base-voltages.yml | 48 +++ .../PlasmaLibrary/breaker-closed.svg | 13 + .../resources/PlasmaLibrary/breaker-open.svg | 13 + .../PlasmaLibrary/breaker-undefined.svg | 14 + .../resources/PlasmaLibrary/capacitor.svg | 8 + .../resources/PlasmaLibrary/components.css | 171 +++++++++++ .../resources/PlasmaLibrary/components.xml | 290 ++++++++++++++++++ .../PlasmaLibrary/disconnector-closed.svg | 11 + .../PlasmaLibrary/disconnector-open.svg | 10 + .../PlasmaLibrary/disconnector-undefined.svg | 17 + .../PlasmaLibrary/disconnectorsl-closed.svg | 13 + .../PlasmaLibrary/disconnectorsl-open.svg | 16 + .../disconnectorsl-undefined.svg | 17 + .../disconnectorsmalt-closed.svg | 15 + .../PlasmaLibrary/disconnectorsmalt-open.svg | 19 ++ .../disconnectorsmalt-undefined.svg | 20 ++ .../PlasmaLibrary/disconnectorsrb-closed.svg | 13 + .../PlasmaLibrary/disconnectorsrb-open.svg | 13 + .../disconnectorsrb-undefined.svg | 14 + .../PlasmaLibrary/disconnectorstl-closed.svg | 19 ++ .../PlasmaLibrary/disconnectorstl-open.svg | 20 ++ .../disconnectorstl-undefined.svg | 30 ++ .../resources/PlasmaLibrary/generator.svg | 6 + .../indicator_counter_1digit.svg | 12 + .../indicator_counter_2digit.svg | 14 + .../resources/PlasmaLibrary/indicator_eye.svg | 32 ++ .../main/resources/PlasmaLibrary/inductor.svg | 6 + .../src/main/resources/PlasmaLibrary/line.svg | 9 + .../PlasmaLibrary/load-break-switch.svg | 14 + .../src/main/resources/PlasmaLibrary/load.svg | 6 + .../src/main/resources/PlasmaLibrary/node.svg | 4 + .../resources/PlasmaLibrary/phaseShift.svg | 7 + .../src/main/resources/PlasmaLibrary/svc.svg | 6 + .../src/main/resources/PlasmaLibrary/vsc.svg | 7 + .../com/powsybl/sld/AbstractTestCase.java | 64 ++-- .../powsybl/sld/raw/AbstractTestCaseRaw.java | 5 + .../powsybl/sld/raw/TestPlasmaSvgLibrary.java | 288 +++++++++++++++++ 45 files changed, 1308 insertions(+), 20 deletions(-) create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer-winding1.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer-winding2.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding1.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding2.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding3.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/arrow.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/base-voltages.yml create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-closed.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-open.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-undefined.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/capacitor.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/components.css create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/components.xml create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-closed.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-open.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-undefined.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-closed.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-open.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-undefined.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-closed.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-open.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-undefined.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-closed.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-open.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-undefined.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-closed.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-open.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-undefined.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/generator.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_counter_1digit.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_counter_2digit.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_eye.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/inductor.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/line.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/load-break-switch.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/load.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/node.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/phaseShift.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/svc.svg create mode 100644 single-line-diagram-core/src/main/resources/PlasmaLibrary/vsc.svg create mode 100644 single-line-diagram-core/src/test/java/com/powsybl/sld/raw/TestPlasmaSvgLibrary.java diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer-winding1.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer-winding1.svg new file mode 100644 index 000000000..24ef73a96 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer-winding1.svg @@ -0,0 +1,4 @@ + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer-winding2.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer-winding2.svg new file mode 100644 index 000000000..450c9bb20 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer-winding2.svg @@ -0,0 +1,4 @@ + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer.svg new file mode 100644 index 000000000..b8d2de48f --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/2-windings-transformer.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding1.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding1.svg new file mode 100644 index 000000000..7773e8b47 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding1.svg @@ -0,0 +1,4 @@ + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding2.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding2.svg new file mode 100644 index 000000000..cbba32506 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding2.svg @@ -0,0 +1,4 @@ + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding3.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding3.svg new file mode 100644 index 000000000..5a9f66a67 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer-winding3.svg @@ -0,0 +1,4 @@ + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer.svg new file mode 100644 index 000000000..693cf7e9b --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/3-windings-transformer.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/arrow.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/arrow.svg new file mode 100644 index 000000000..fa7d76cdc --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/arrow.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/base-voltages.yml b/single-line-diagram-core/src/main/resources/PlasmaLibrary/base-voltages.yml new file mode 100644 index 000000000..ab1ffd96c --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/base-voltages.yml @@ -0,0 +1,48 @@ +baseVoltages: + - name: "0" + minValue: 0.0 + maxValue: 0.1 + color: "rgb(135,206,235)" + profile: "Default" + - name: "20" + minValue: 1.0 + maxValue: 1.1 + color: "#4AB6E4" + profile: "Default" + - name: "45" + minValue: 2.0 + maxValue: 2.1 + color: "#A4036F" + profile: "Default" + - name: "63" + minValue: 3.0 + maxValue: 3.1 + color: "#F2BB05" + profile: "Default" + - name: "90" + minValue: 4.0 + maxValue: 4.1 + color: "#32965D" + profile: "Default" + - name: "150" + minValue: 5.0 + maxValue: 5.1 + color: "#003F91" + profile: "Default" + - name: "225" + minValue: 6.0 + maxValue: 6.1 + color: "#E3170A" + profile: "Default" + - name: "400" + minValue: 7.0 + maxValue: 7.1 + color: "#6E2594" + profile: "Default" + - name: "AC" + minValue: 8.0 + maxValue: 8.1 + color: "#DC602E" + profile: "Default" + +defaultProfile: "Default" diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-closed.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-closed.svg new file mode 100644 index 000000000..8696a9a01 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-closed.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-open.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-open.svg new file mode 100644 index 000000000..619322931 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-open.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-undefined.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-undefined.svg new file mode 100644 index 000000000..cb2bd7c91 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/breaker-undefined.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/capacitor.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/capacitor.svg new file mode 100644 index 000000000..2b4cc6f41 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/capacitor.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/components.css b/single-line-diagram-core/src/main/resources/PlasmaLibrary/components.css new file mode 100644 index 000000000..0348020b7 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/components.css @@ -0,0 +1,171 @@ +svg { + overflow: auto !important; +} + +/* Default color, for previsualization */ + +.sld-vl1 { + stroke: #DA627D; + fill: #DA627D +} + +.sld-vl2 { + stroke: #A4036F; + fill: #A4036F +} + +.sld-vl3 { + stroke: #D19C1D; + fill: #D19C1D +} + +.sld-vl4 { + stroke: #32965D; + fill: #32965D +} + +.sld-vl5 { + stroke: #003F91; + fill: #003F91 +} + +.sld-vl6 { + stroke: #E3170A; + fill: #E3170A +} + +.sld-vl7 { + stroke: #6E2594; + fill: #6E2594 +} + + +.open, .closed { + visibility: hidden; +} + +.BUSBAR_SECTION { + stroke-width: 3; +} + +.BREAKER, .DISCONNECTORSRB, .DISCONNECTORSL, .DISCONNECTORSMALT, .DISCONNECTORSTL { + stroke-width: 2; + fill: white; + fill-opacity: 0; +} + +.DISCONNECTOR { + stroke-width: 1; +} + +.DISCONNECTORSMALT .closed { + fill: rgb(0, 0, 255); +} + + +.DISCONNECTORSL .closed { + fill: rgb(0, 0, 255); +} + +.DISCONNECTORSTL .open { + fill: rgb(0, 0, 255); +} + +.DISCONNECTOR .open { + stroke-width: 2 +} + +.DISCONNECTORSTL .closed { + fill: rgb(0, 0, 255); +} + +.undefined circle { +} + +.GENERATOR { + stroke-width: 1; +} + +.LOAD { + stroke-width: 1; +} + +.LOAD_BREAK_SWITCH { + stroke-width: 1; +} + +.NODE { + fill-opacity: 1; +} + +.CAPACITOR { + stroke-width: 1; + fill-opacity: 0; +} + +.INDUCTOR { + stroke-width: 1; + fill-opacity: 0; +} + +.STATIC_VAR_COMPENSATOR { +} + +.TWO_WINDINGS_TRANSFORMER { + fill-opacity: 0; +} + +.THREE_WINDINGS_TRANSFORMER { + fill-opacity: 0; +} + +.VSC_CONVERTER_STATION { + font-size: 7.4314661px; + line-height: 1.25; + font-family: sans-serif; + font-variant-ligatures: normal; + font-variant-caps: normal; + font-variant-numeric: normal; + font-feature-settings: normal; + text-align: start; + letter-spacing: 0px; + word-spacing: 0px; + writing-mode: lr-tb; + text-anchor: start; + stroke-miterlimit: 4; +} + +.PHASE_SHIFT_TRANSFORMER { + stroke-linecap: butt; + stroke-linejoin: miter; + stroke-miterlimit: 4; + stroke-width: 1; +} + +.wire { + stroke: rgb(200, 0, 0); + stroke-width: 1; + fill-opacity: 0; +} + +.grid { + stroke: rgb(0, 55, 0); + stroke-width: 1; + stroke-dasharray: 1, 10; +} + +.component-label { + fill: black; + color: black; + stroke: none; + fill-opacity: 1; +} + +.LINE { + stroke-width: 1; + fill-opacity: 0; +} + +.tooltip-panel { + fill: white; +} \ No newline at end of file diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/components.xml b/single-line-diagram-core/src/main/resources/PlasmaLibrary/components.xml new file mode 100644 index 000000000..ffcbbe424 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/components.xml @@ -0,0 +1,290 @@ + + + + + + + breaker-open.svg + + + breaker-closed.svg + + + breaker-undefined.svg + + + + true + + + + + + + load-break-switch.svg + + + + true + + + + + + + load.svg + + + + true + + + + + + + disconnector-open.svg + + + disconnector-closed.svg + + + disconnector-undefined.svg + + + false + + + + + + + disconnectorsmalt-open.svg + + + disconnectorsmalt-closed.svg + + + disconnectorsmalt-undefined.svg + + + + true + + + teg + + + + disconnectorsrb-open.svg + + + disconnectorsrb-closed.svg + + + disconnectorsrb-undefined.svg + + + + true + + + + + + + + disconnectorstl-open.svg + + + disconnectorstl-closed.svg + + + disconnectorstl-undefined.svg + + + + true + + + + + + + disconnectorsl-open.svg + + + disconnectorsl-closed.svg + + + disconnectorsl-undefined.svg + + + + true + + + + + + + generator.svg + + + + + + true + + + + + + + 2-windings-transformer.svg + + + + + + true + + + + + + + 3-windings-transformer-winding1.svg + + + 3-windings-transformer-winding2.svg + + + 3-windings-transformer-winding3.svg + + + + + true + + + + + + + capacitor.svg + + + + true + + + trans + + + + inductor.svg + + + + true + + + + + + sld-node + + node.svg + + + true + + + + + + + phaseShift.svg + + + true + + + + + + + svc.svg + + + + true + + + + + + + vsc.svg + + trans + + + true + + + + + + + indicator_eye.svg + + + + true + + + + + + + indicator_counter_1digit.svg + + + + true + + + + + + + indicator_counter_2digit.svg + + + + true + + + + + + + arrow.svg + + + true + + + + + + + line.svg + + + true + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-closed.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-closed.svg new file mode 100644 index 000000000..b9bbbc425 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-closed.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-open.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-open.svg new file mode 100644 index 000000000..c44b889a9 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-open.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-undefined.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-undefined.svg new file mode 100644 index 000000000..b68a348af --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnector-undefined.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-closed.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-closed.svg new file mode 100644 index 000000000..46d977bbb --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-closed.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-open.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-open.svg new file mode 100644 index 000000000..478547dac --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-open.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-undefined.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-undefined.svg new file mode 100644 index 000000000..53e956c64 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsl-undefined.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-closed.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-closed.svg new file mode 100644 index 000000000..e99ab189c --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-closed.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-open.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-open.svg new file mode 100644 index 000000000..d66f92ee2 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-open.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-undefined.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-undefined.svg new file mode 100644 index 000000000..acdd00853 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsmalt-undefined.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-closed.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-closed.svg new file mode 100644 index 000000000..cb735539e --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-closed.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-open.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-open.svg new file mode 100644 index 000000000..cc351e9f9 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-open.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-undefined.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-undefined.svg new file mode 100644 index 000000000..4d4bd5bf4 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorsrb-undefined.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-closed.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-closed.svg new file mode 100644 index 000000000..335beade0 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-closed.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-open.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-open.svg new file mode 100644 index 000000000..8f74b9777 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-open.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-undefined.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-undefined.svg new file mode 100644 index 000000000..7dda0bd8e --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/disconnectorstl-undefined.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/generator.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/generator.svg new file mode 100644 index 000000000..6212708de --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/generator.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_counter_1digit.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_counter_1digit.svg new file mode 100644 index 000000000..85981e863 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_counter_1digit.svg @@ -0,0 +1,12 @@ + + + 87CF2091-8814-4E63-BC6F-5265685BFB84 + + + + + 1 + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_counter_2digit.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_counter_2digit.svg new file mode 100644 index 000000000..95745865a --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_counter_2digit.svg @@ -0,0 +1,14 @@ + + + 53246067-393F-4FCD-A36E-3F0D55F585B2 + + + + + + + 10 + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_eye.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_eye.svg new file mode 100644 index 000000000..4dcce5c18 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/indicator_eye.svg @@ -0,0 +1,32 @@ + + + D7012428-E1FF-4B89-9A89-D7D354C52FE5 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/inductor.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/inductor.svg new file mode 100644 index 000000000..6840af87a --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/inductor.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/line.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/line.svg new file mode 100644 index 000000000..c2d5a56f7 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/line.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/load-break-switch.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/load-break-switch.svg new file mode 100644 index 000000000..a548c9671 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/load-break-switch.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/load.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/load.svg new file mode 100644 index 000000000..01630b582 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/load.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/node.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/node.svg new file mode 100644 index 000000000..61cb5375e --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/node.svg @@ -0,0 +1,4 @@ + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/phaseShift.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/phaseShift.svg new file mode 100644 index 000000000..ef6079eab --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/phaseShift.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/svc.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/svc.svg new file mode 100644 index 000000000..8438d7733 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/svc.svg @@ -0,0 +1,6 @@ + + + + + diff --git a/single-line-diagram-core/src/main/resources/PlasmaLibrary/vsc.svg b/single-line-diagram-core/src/main/resources/PlasmaLibrary/vsc.svg new file mode 100644 index 000000000..c9193e7a0 --- /dev/null +++ b/single-line-diagram-core/src/main/resources/PlasmaLibrary/vsc.svg @@ -0,0 +1,7 @@ + + + + AC / DC + + + diff --git a/single-line-diagram-core/src/test/java/com/powsybl/sld/AbstractTestCase.java b/single-line-diagram-core/src/test/java/com/powsybl/sld/AbstractTestCase.java index 479770d68..c556c296b 100644 --- a/single-line-diagram-core/src/test/java/com/powsybl/sld/AbstractTestCase.java +++ b/single-line-diagram-core/src/test/java/com/powsybl/sld/AbstractTestCase.java @@ -38,32 +38,36 @@ public abstract class AbstractTestCase { protected static LayoutParameters createDefaultLayoutParameters() { return new LayoutParameters() - .setTranslateX(20) - .setTranslateY(50) - .setInitialXBus(0) - .setInitialYBus(260) - .setVerticalSpaceBus(25) - .setHorizontalBusPadding(20) - .setCellWidth(50) - .setExternCellHeight(250) - .setInternCellHeight(40) - .setStackHeight(30) - .setShowGrid(true) - .setShowInternalNodes(true) - .setScaleFactor(1) - .setHorizontalSubstationPadding(50) - .setVerticalSubstationPadding(50) - .setArrowDistance(20) - .setDrawStraightWires(false) - .setHorizontalSnakeLinePadding(30) - .setVerticalSnakeLinePadding(30) - .setCssLocation(LayoutParameters.CssLocation.INSERTED_IN_SVG); + .setTranslateX(20) + .setTranslateY(50) + .setInitialXBus(0) + .setInitialYBus(260) + .setVerticalSpaceBus(25) + .setHorizontalBusPadding(20) + .setCellWidth(50) + .setExternCellHeight(250) + .setInternCellHeight(40) + .setStackHeight(30) + .setShowGrid(true) + .setShowInternalNodes(true) + .setScaleFactor(1) + .setHorizontalSubstationPadding(50) + .setVerticalSubstationPadding(50) + .setArrowDistance(20) + .setDrawStraightWires(false) + .setHorizontalSnakeLinePadding(30) + .setVerticalSnakeLinePadding(30) + .setCssLocation(LayoutParameters.CssLocation.INSERTED_IN_SVG); } protected ResourcesComponentLibrary getResourcesComponentLibrary() { return new ConvergenceComponentLibrary(); } + protected ResourcesComponentLibrary getPlasmaComponentLibrary() { + return new ResourcesComponentLibrary("Plasma", "/PlasmaLibrary"); + } + protected static String normalizeLineSeparator(String str) { return str.replace("\r\n", "\n") .replace("\r", "\n"); @@ -225,4 +229,24 @@ public String toString(String resourceName) { throw new UncheckedIOException(e); } } + + public String toPlasmaSVG(VoltageLevelGraph graph, + String filename, + LayoutParameters layoutParameters, + DiagramLabelProvider initValueProvider, + DiagramStyleProvider styleProvider) { + try (StringWriter writer = new StringWriter()) { + new DefaultSVGWriter(getPlasmaComponentLibrary(), layoutParameters) + .write("", graph, + initValueProvider, + styleProvider, + writer); + + writeToFileInHomeDir(filename, writer); + + return normalizeLineSeparator(writer.toString()); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } } diff --git a/single-line-diagram-core/src/test/java/com/powsybl/sld/raw/AbstractTestCaseRaw.java b/single-line-diagram-core/src/test/java/com/powsybl/sld/raw/AbstractTestCaseRaw.java index d866598e5..cf9006c1e 100644 --- a/single-line-diagram-core/src/test/java/com/powsybl/sld/raw/AbstractTestCaseRaw.java +++ b/single-line-diagram-core/src/test/java/com/powsybl/sld/raw/AbstractTestCaseRaw.java @@ -82,4 +82,9 @@ public List getNodeDecorators(Node node) { return new ArrayList<>(); } } + + public String toPlasmaSVG(VoltageLevelGraph graph, String filename) { + Stream nodeStream = graph.getNodes().stream(); + return toPlasmaSVG(graph, filename, getLayoutParameters(), new RawDiagramLabelProvider(nodeStream), new DefaultDiagramStyleProvider()); + } } diff --git a/single-line-diagram-core/src/test/java/com/powsybl/sld/raw/TestPlasmaSvgLibrary.java b/single-line-diagram-core/src/test/java/com/powsybl/sld/raw/TestPlasmaSvgLibrary.java new file mode 100644 index 000000000..bef63a60d --- /dev/null +++ b/single-line-diagram-core/src/test/java/com/powsybl/sld/raw/TestPlasmaSvgLibrary.java @@ -0,0 +1,288 @@ +package com.powsybl.sld.raw; + +import com.powsybl.sld.RawGraphBuilder; +import com.powsybl.sld.layout.BlockOrganizer; +import com.powsybl.sld.layout.ImplicitCellDetector; +import com.powsybl.sld.layout.PositionVoltageLevelLayout; +import com.powsybl.sld.model.*; +import org.junit.Before; +import org.junit.Test; + +import java.util.Map; + +import static org.junit.Assert.assertNotNull; + +public class TestPlasmaSvgLibrary extends AbstractTestCaseRaw { + + @Before + public void setUp() { + RawGraphBuilder.SubstationBuilder ssb1 = rawGraphBuilder.createSubstationBuilder("subst"); + RawGraphBuilder.VoltageLevelBuilder vlb1 = rawGraphBuilder.createVoltageLevelBuilder("vl1", 7, false); + ssb1.addVlBuilder(vlb1); + + BusNode bbs1 = vlb1.createBusBarSection("bbs1", 1, 1); + BusNode bbs2 = vlb1.createBusBarSection("bbs2", 1, 2); + BusNode bbs3 = vlb1.createBusBarSection("bbs3", 2, 1); + BusNode bbs4 = vlb1.createBusBarSection("bbs4", 2, 2); + + SwitchNode dsect11 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dsect11", false, false); + SwitchNode dtrct11 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "dtrct11", false, false); + SwitchNode dsect12 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dsect12", false, false); + vlb1.connectNode(bbs1, dsect11); + vlb1.connectNode(dsect11, dtrct11); + vlb1.connectNode(dtrct11, dsect12); + vlb1.connectNode(dsect12, bbs2); + + SwitchNode dsect21 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dsect21", false, false); + SwitchNode dtrct21 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "dtrct21", false, false); + SwitchNode dsect22 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dsect22", false, false); + vlb1.connectNode(bbs3, dsect21); + vlb1.connectNode(dsect21, dtrct21); + vlb1.connectNode(dtrct21, dsect22); + vlb1.connectNode(dsect22, bbs4); + + FeederNode load1 = vlb1.createLoad("load1", 0, BusCell.Direction.TOP); + SwitchNode dload1 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dload1", false, false); + SwitchNode bload1 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bload1", false, false); + vlb1.connectNode(bbs1, dload1); + vlb1.connectNode(dload1, bload1); + vlb1.connectNode(load1, bload1); + + FeederNode gen1 = vlb1.createGenerator("gen1", 2, BusCell.Direction.BOTTOM); + SwitchNode dgen1 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dgen1", false, false); + SwitchNode bgen1 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bgen1", false, false); + vlb1.connectNode(bbs3, dgen1); + vlb1.connectNode(dgen1, bgen1); + vlb1.connectNode(gen1, bgen1); + + FeederNode load2 = vlb1.createLoad("load2", 8, BusCell.Direction.TOP); + SwitchNode dload2 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dload2", false, false); + SwitchNode bload2 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bload2", false, false); + vlb1.connectNode(bbs2, dload2); + vlb1.connectNode(dload2, bload2); + vlb1.connectNode(load2, bload2); + + FeederNode gen2 = vlb1.createGenerator("gen2", 12, BusCell.Direction.BOTTOM); + SwitchNode dgen2 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dgen2", false, false); + SwitchNode bgen2 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bgen2", false, false); + vlb1.connectNode(bbs4, dgen2); + vlb1.connectNode(dgen2, bgen2); + vlb1.connectNode(gen2, bgen2); + + RawGraphBuilder.VoltageLevelBuilder vlb2 = rawGraphBuilder.createVoltageLevelBuilder("vl2", 225, false); + ssb1.addVlBuilder(vlb2); + + BusNode bbs5 = vlb2.createBusBarSection("bbs5", 1, 1); + BusNode bbs6 = vlb2.createBusBarSection("bbs6", 2, 1); + + SwitchNode dscpl1 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dscpl1", false, false); + SwitchNode ddcpl1 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "ddcpl1", false, false); + SwitchNode dscpl2 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dscpl2", false, false); + vlb2.connectNode(bbs5, dscpl1); + vlb2.connectNode(dscpl1, ddcpl1); + vlb2.connectNode(ddcpl1, dscpl2); + vlb2.connectNode(dscpl2, bbs6); + + FeederNode load3 = vlb2.createLoad("load3", 0, BusCell.Direction.TOP); + SwitchNode dload3 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dload3", false, false); + SwitchNode bload3 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bload3", false, false); + vlb2.connectNode(bbs5, dload3); + vlb2.connectNode(load3, bload3); + vlb2.connectNode(bload3, dload3); + + FeederNode gen4 = vlb2.createGenerator("gen4", 2, BusCell.Direction.BOTTOM); + SwitchNode dgen4 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dgen4", false, false); + SwitchNode bgen4 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bgen4", false, false); + vlb2.connectNode(bbs6, dgen4); + vlb2.connectNode(gen4, bgen4); + vlb2.connectNode(bgen4, dgen4); + + // third voltage level + RawGraphBuilder.VoltageLevelBuilder vlb3 = rawGraphBuilder.createVoltageLevelBuilder("vl3", 225, false); + ssb1.addVlBuilder(vlb3); + + BusNode bbs7 = vlb3.createBusBarSection("bbs7", 1, 1); + + FeederNode load4 = vlb3.createLoad("load4", 0, BusCell.Direction.TOP); + SwitchNode dload4 = vlb3.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dload4", false, false); + SwitchNode bload4 = vlb3.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bload4", false, false); + vlb3.connectNode(bbs7, dload4); + vlb3.connectNode(bload4, load4); + vlb3.connectNode(bload4, dload4); + + /* + // two windings transformers between voltage levels + // + */ + + Map feeder2WTs1 = ssb1.createFeeder2WT("trf1", vlb1, vlb2, + 1, 1, BusCell.Direction.TOP, BusCell.Direction.TOP); + SwitchNode dtrf11 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf11", false, false); + SwitchNode btrf11 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf11", false, false); + vlb1.connectNode(bbs1, dtrf11); + vlb1.connectNode(dtrf11, btrf11); + vlb1.connectNode(btrf11, feeder2WTs1.get(vlb1)); + + SwitchNode dtrf21 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf21", false, false); + SwitchNode btrf21 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf21", false, false); + vlb2.connectNode(bbs5, dtrf21); + vlb2.connectNode(dtrf21, btrf21); + vlb2.connectNode(btrf21, feeder2WTs1.get(vlb2)); + + Map feeder2WTs2 = ssb1.createFeeder2WT("trf2", vlb1, vlb2, + 11, 7, BusCell.Direction.TOP, BusCell.Direction.BOTTOM); + SwitchNode dtrf12 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf12", false, false); + SwitchNode btrf12 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf12", false, false); + vlb1.connectNode(bbs2, dtrf12); + vlb1.connectNode(dtrf12, btrf12); + vlb1.connectNode(btrf12, feeder2WTs2.get(vlb1)); + + SwitchNode dtrf22 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf22", false, false); + SwitchNode btrf22 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf22", false, false); + vlb2.connectNode(bbs6, dtrf22); + vlb2.connectNode(dtrf22, btrf22); + vlb2.connectNode(btrf22, feeder2WTs2.get(vlb2)); + + Map feeder2WTs3 = ssb1.createFeeder2WT("trf3", vlb1, vlb2, + 3, 8, BusCell.Direction.BOTTOM, BusCell.Direction.BOTTOM); + + SwitchNode dtrf13 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf13", false, false); + SwitchNode btrf13 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf13", false, false); + vlb1.connectNode(bbs3, dtrf13); + vlb1.connectNode(dtrf13, btrf13); + vlb1.connectNode(btrf13, feeder2WTs3.get(vlb1)); + + SwitchNode dtrf23 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf23", false, false); + SwitchNode btrf23 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf23", false, false); + vlb2.connectNode(bbs6, dtrf23); + vlb2.connectNode(dtrf23, btrf23); + vlb2.connectNode(btrf23, feeder2WTs3.get(vlb2)); + + Map feeder2WTs4 = ssb1.createFeeder2WT("trf4", vlb1, vlb2, + 10, 3, BusCell.Direction.BOTTOM, BusCell.Direction.TOP); + + SwitchNode dtrf14 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf14", false, false); + SwitchNode btrf14 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf14", false, false); + vlb1.connectNode(bbs4, dtrf14); + vlb1.connectNode(dtrf14, btrf14); + vlb1.connectNode(btrf14, feeder2WTs4.get(vlb1)); + + SwitchNode dtrf24 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf24", false, false); + SwitchNode btrf24 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf24", false, false); + vlb2.connectNode(bbs5, dtrf24); + vlb2.connectNode(dtrf24, btrf24); + vlb2.connectNode(btrf24, feeder2WTs4.get(vlb2)); + + Map feeder2WTs5 = ssb1.createFeeder2WT("trf5", vlb1, vlb3, + 4, 1, BusCell.Direction.TOP, BusCell.Direction.BOTTOM); + + SwitchNode dtrf15 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf15", false, false); + SwitchNode btrf15 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf15", false, false); + vlb1.connectNode(bbs1, dtrf15); + vlb1.connectNode(dtrf15, btrf15); + vlb1.connectNode(btrf15, feeder2WTs5.get(vlb1)); + + SwitchNode dtrf25 = vlb3.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf25", false, false); + SwitchNode btrf25 = vlb3.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf25", false, false); + vlb3.connectNode(bbs7, dtrf25); + vlb3.connectNode(dtrf25, btrf25); + vlb3.connectNode(btrf25, feeder2WTs5.get(vlb3)); + /* + // three windings transformers between voltage levels + // + */ + + Map feeder3WTs6 = ssb1.createFeeder3WT("trf6", vlb1, vlb2, vlb3, + 5, 5, 2, BusCell.Direction.TOP, BusCell.Direction.TOP, BusCell.Direction.TOP); + + SwitchNode dtrf16 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf16", false, false); + SwitchNode btrf16 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf16", false, false); + vlb1.connectNode(bbs1, dtrf16); + vlb1.connectNode(dtrf16, btrf16); + vlb1.connectNode(btrf16, feeder3WTs6.get(vlb1)); + + SwitchNode dtrf26 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf26", false, false); + SwitchNode btrf26 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf26", false, false); + vlb2.connectNode(bbs6, dtrf26); + vlb2.connectNode(dtrf26, btrf26); + vlb2.connectNode(btrf26, feeder3WTs6.get(vlb2)); + + SwitchNode dtrf36 = vlb3.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf36", false, false); + SwitchNode btrf36 = vlb3.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf36", false, false); + vlb3.connectNode(bbs7, dtrf36); + vlb3.connectNode(dtrf36, btrf36); + vlb3.connectNode(btrf36, feeder3WTs6.get(vlb3)); + + Map feeder3WTs7 = ssb1.createFeeder3WT("trf7", vlb1, vlb2, vlb3, + 6, 4, 3, BusCell.Direction.BOTTOM, BusCell.Direction.TOP, BusCell.Direction.BOTTOM); + + SwitchNode dtrf17 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf17", false, false); + SwitchNode btrf17 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf17", false, false); + vlb1.connectNode(bbs3, dtrf17); + vlb1.connectNode(dtrf17, btrf17); + vlb1.connectNode(btrf17, feeder3WTs7.get(vlb1)); + + SwitchNode dtrf27 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf27", false, false); + SwitchNode btrf27 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf27", false, false); + vlb2.connectNode(bbs5, dtrf27); + vlb2.connectNode(dtrf27, btrf27); + vlb2.connectNode(btrf27, feeder3WTs7.get(vlb2)); + + SwitchNode dtrf37 = vlb3.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf37", false, false); + SwitchNode btrf37 = vlb3.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf37", false, false); + vlb3.connectNode(bbs7, dtrf37); + vlb3.connectNode(dtrf37, btrf37); + vlb3.connectNode(btrf37, feeder3WTs7.get(vlb3)); + + Map feeder3WTs8 = ssb1.createFeeder3WT("trf8", vlb1, vlb2, vlb3, + 9, 6, 4, BusCell.Direction.TOP, BusCell.Direction.BOTTOM, BusCell.Direction.TOP); + + SwitchNode dtrf18 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf18", false, false); + SwitchNode btrf18 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf18", false, false); + vlb1.connectNode(bbs2, dtrf18); + vlb1.connectNode(dtrf18, btrf18); + vlb1.connectNode(btrf18, feeder3WTs8.get(vlb1)); + + SwitchNode dtrf28 = vlb2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf28", false, false); + SwitchNode btrf28 = vlb2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf28", false, false); + vlb2.connectNode(bbs6, dtrf28); + vlb2.connectNode(dtrf28, btrf28); + vlb2.connectNode(btrf28, feeder3WTs8.get(vlb2)); + + SwitchNode dtrf38 = vlb3.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dtrf38", false, false); + SwitchNode btrf38 = vlb3.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "btrf38", false, false); + vlb3.connectNode(bbs7, dtrf38); + vlb3.connectNode(dtrf38, btrf38); + vlb3.connectNode(btrf38, feeder3WTs8.get(vlb3)); + + RawGraphBuilder.SubstationBuilder ssb2 = rawGraphBuilder.createSubstationBuilder("subst2"); + RawGraphBuilder.VoltageLevelBuilder vlsubst2 = rawGraphBuilder.createVoltageLevelBuilder("vlSubst2", 380, false); + ssb2.addVlBuilder(vlsubst2); + + BusNode bbs12 = vlsubst2.createBusBarSection("bbs1_2", 1, 1); + + SwitchNode dline112 = vlb1.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dline11_2", false, false); + SwitchNode bline112 = vlb1.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bline11_2", false, false); + + SwitchNode dline212 = vlsubst2.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "dline21_2", false, false); + SwitchNode bline212 = vlsubst2.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "bline21_2", false, false); + Map line1 = + ssb2.createLine("line1", vlb1, vlsubst2, 7, 1, BusCell.Direction.TOP, BusCell.Direction.BOTTOM); + vlb1.connectNode(bbs1, dline112); + vlb1.connectNode(dline112, bline112); + vlb1.connectNode(bline112, line1.get(vlb1)); + vlsubst2.connectNode(bbs12, dline212); + vlsubst2.connectNode(dline212, bline212); + vlsubst2.connectNode(bline212, line1.get(vlsubst2)); + + } + + @Test + public void testSvg() { + VoltageLevelGraph g = rawGraphBuilder.buildVoltageLevelGraph("vl1", false, true); + new ImplicitCellDetector().detectCells(g); + new BlockOrganizer().organize(g); + new PositionVoltageLevelLayout(g).run(getLayoutParameters()); + assertNotNull(toPlasmaSVG(g, "/vl1_plasma_library.svg")); + } +}