-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SLD] Add feeder node and library component for batteries (#511)
* Add battery component in component libraries * draw batteries in SLD * update test references * take batteries into consideration in VoltageLevelRawBuilder Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com> Co-authored-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com> Signed-off-by: BenoitJeanson <benoit.jeanson@rte-france.com>
- Loading branch information
1 parent
eb81860
commit 4c0ddce
Showing
72 changed files
with
662 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...gram/single-line-diagram-core/src/main/resources/ConvergenceLibrary/battery.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...agram/single-line-diagram-core/src/main/resources/FlatDesignLibrary/battery.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...line-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/iidm/TestBattery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Copyright (c) 2023, 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.sld.builders.NetworkGraphBuilder; | ||
import com.powsybl.sld.model.graphs.VoltageLevelGraph; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* @author Sophie Frasnedo <sophie.frasnedo at rte-france.com> | ||
*/ | ||
public class TestBattery extends AbstractTestCaseIidm { | ||
|
||
@Before | ||
public void setUp() throws IOException { | ||
network = CreateNetworksUtil.createNetworkWithBatteries(); | ||
graphBuilder = new NetworkGraphBuilder(network); | ||
} | ||
|
||
@Test | ||
public void test() { | ||
// build graph | ||
VoltageLevelGraph g = graphBuilder.buildVoltageLevelGraph("vl1"); | ||
|
||
// Run layout | ||
voltageLevelGraphLayout(g); | ||
|
||
// write SVG and compare to reference | ||
assertEquals(toString("/TestBatteries.svg"), toSVG(g, "/TestBatteries.svg")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...-diagram/single-line-diagram-core/src/test/java/com/powsybl/sld/raw/TestAddBatteries.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Copyright (c) 2023, 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.raw; | ||
|
||
import com.powsybl.sld.builders.VoltageLevelRawBuilder; | ||
import com.powsybl.sld.library.FlatDesignLibrary; | ||
import com.powsybl.sld.library.ResourcesComponentLibrary; | ||
import com.powsybl.sld.model.graphs.VoltageLevelGraph; | ||
import com.powsybl.sld.model.nodes.BusNode; | ||
import com.powsybl.sld.model.nodes.FeederNode; | ||
import com.powsybl.sld.model.nodes.SwitchNode; | ||
import com.powsybl.sld.svg.BasicStyleProvider; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import static com.powsybl.sld.model.coordinate.Direction.TOP; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* @author Sophie Frasnedo <sophie.frasnedo at rte-france.com> | ||
*/ | ||
public class TestAddBatteries extends AbstractTestCaseRaw { | ||
|
||
@Before | ||
public void setUp() { | ||
VoltageLevelRawBuilder vlBuilder = rawGraphBuilder.createVoltageLevelBuilder("vl", 380); | ||
BusNode bbs = vlBuilder.createBusBarSection("bbs", 1, 1); | ||
FeederNode battery1 = vlBuilder.createBattery("batt1", 0, TOP); | ||
SwitchNode d1 = vlBuilder.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "d1", false, false); | ||
SwitchNode b1 = vlBuilder.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "b1", false, false); | ||
FeederNode battery2 = vlBuilder.createBattery("batt2"); | ||
SwitchNode d2 = vlBuilder.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "d2", false, false); | ||
SwitchNode b2 = vlBuilder.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "b2", false, false); | ||
vlBuilder.connectNode(bbs, b1); | ||
vlBuilder.connectNode(b1, d1); | ||
vlBuilder.connectNode(d1, battery1); | ||
vlBuilder.connectNode(bbs, b2); | ||
vlBuilder.connectNode(b2, d2); | ||
vlBuilder.connectNode(d2, battery2); | ||
} | ||
|
||
@Override | ||
protected ResourcesComponentLibrary getResourcesComponentLibrary() { | ||
return new FlatDesignLibrary(); | ||
} | ||
|
||
@Test | ||
public void test() { | ||
VoltageLevelGraph g = rawGraphBuilder.buildVoltageLevelGraph("vl"); | ||
voltageLevelGraphLayout(g); | ||
assertEquals(toString("/TestBatteriesRaw.svg"), | ||
toSVG(g, "/TestBatteriesRaw.svg", getRawLabelProvider(), new BasicStyleProvider())); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.