Skip to content

Commit

Permalink
implement getV and getAngle for busbarsection
Browse files Browse the repository at this point in the history
Signed-off-by: HARPER Jon <[email protected]>
  • Loading branch information
jonenst committed Oct 5, 2021
1 parent 1e5ea17 commit ceb8dab
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ public <E extends Extension<BusbarSection>> Collection<E> getExtensions() {

@Override
public double getV() {
throw new UnsupportedOperationException("TODO");
return terminal.getBusBreakerView().getBus().getV();
}

@Override
public double getAngle() {
throw new UnsupportedOperationException("TODO");
return terminal.getBusBreakerView().getBus().getAngle();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* 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.network.store.iidm.impl;

import com.google.common.collect.Iterables;
import com.powsybl.iidm.network.*;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
* @author Jon Harper <jon.harper at rte-france.com>
*/
public class BusbarSectionTest {

@Test
public void testVAngle() {
Network network = CreateNetworksUtil.createNodeBreakerNetworkWithLine();
BusbarSection bbs = network.getBusbarSection("BBS1");
assertTrue(Double.isNaN(bbs.getV()));
assertTrue(Double.isNaN(bbs.getAngle()));
var bus = bbs.getTerminal().getBusBreakerView().getBus();
bus.setV(1.0d);
bus.setAngle(2.0d);
assertEquals(1.0d, bbs.getV(), 0.0);
assertEquals(2.0d, bbs.getAngle(), 0.0);
}

}

0 comments on commit ceb8dab

Please sign in to comment.