TestCase3.java
/**
* Copyright (c) 2020, 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.model.graphs.VoltageLevelGraph;
import com.powsybl.sld.model.nodes.BusNode;
import com.powsybl.sld.model.nodes.SwitchNode;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* <pre>
* b
* / \
* | |
* -d1---|---- bbs1
* -----d2---- bbs2
*
* </pre>
*
* @author Benoit Jeanson {@literal <benoit.jeanson at rte-france.com>}
*/
class TestCase3 extends AbstractTestCaseRaw {
@BeforeEach
public void setUp() {
VoltageLevelRawBuilder vlBuilder = rawGraphBuilder.createVoltageLevelBuilder("vl", 380);
BusNode bbs1 = vlBuilder.createBusBarSection("bbs1", 1, 1);
BusNode bbs2 = vlBuilder.createBusBarSection("bbs2", 2, 1);
SwitchNode d1 = vlBuilder.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "d1", false, false);
SwitchNode d2 = vlBuilder.createSwitchNode(SwitchNode.SwitchKind.DISCONNECTOR, "d2", false, false);
SwitchNode b = vlBuilder.createSwitchNode(SwitchNode.SwitchKind.BREAKER, "b", false, false);
vlBuilder.connectNode(bbs1, d1);
vlBuilder.connectNode(d1, b);
vlBuilder.connectNode(d2, bbs2);
vlBuilder.connectNode(b, d2);
}
@Test
void test() {
VoltageLevelGraph g = rawGraphBuilder.buildVoltageLevelGraph("vl");
voltageLevelGraphLayout(g);
assertEquals(toString("/TestCase3Coupling.json"), toJson(g, "/TestCase3Coupling.json"));
}
}