From b96924f63c62707169672ad1f905aa59e4fd2b50 Mon Sep 17 00:00:00 2001 From: Etienne LESOT Date: Thu, 28 Nov 2024 10:07:15 +0100 Subject: [PATCH] remove DanglingLineBoundaryImpl as it is a copy from powsybl Signed-off-by: Etienne LESOT --- .../iidm/impl/DanglingLineBoundaryImpl.java | 76 ------------------- .../store/iidm/impl/DanglingLineImpl.java | 1 + 2 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/DanglingLineBoundaryImpl.java diff --git a/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/DanglingLineBoundaryImpl.java b/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/DanglingLineBoundaryImpl.java deleted file mode 100644 index 4654423a2..000000000 --- a/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/DanglingLineBoundaryImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) 2024, 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.powsybl.iidm.network.*; -import com.powsybl.iidm.network.util.DanglingLineData; -import com.powsybl.iidm.network.util.SV; - -import java.util.Objects; - -/** - * @author Etienne Lesot - */ -class DanglingLineBoundaryImpl implements Boundary { - - private final DanglingLine parent; - - DanglingLineBoundaryImpl(DanglingLine parent) { - this.parent = Objects.requireNonNull(parent); - } - - @Override - public double getV() { - if (!parent.isPaired() && valid(parent.getP0(), parent.getQ0())) { - DanglingLineData danglingLineData = new DanglingLineData(parent); - return danglingLineData.getBoundaryBusU(); - } - Terminal t = parent.getTerminal(); - Bus b = t.getBusView().getBus(); - return new SV(t.getP(), t.getQ(), BaseBus.getV(b), BaseBus.getAngle(b), TwoSides.ONE).otherSideU(parent, false); - } - - @Override - public double getAngle() { - if (!parent.isPaired() && valid(parent.getP0(), parent.getQ0())) { - DanglingLineData danglingLineData = new DanglingLineData(parent); - return Math.toDegrees(danglingLineData.getBoundaryBusTheta()); - } - Terminal t = parent.getTerminal(); - Bus b = t.getBusView().getBus(); - return new SV(t.getP(), t.getQ(), BaseBus.getV(b), BaseBus.getAngle(b), TwoSides.ONE).otherSideA(parent, false); - } - - @Override - public double getP() { - if (!parent.isPaired() && valid(parent.getP0(), parent.getQ0())) { - return -parent.getP0(); - } - Terminal t = parent.getTerminal(); - Bus b = t.getBusView().getBus(); - return new SV(t.getP(), t.getQ(), BaseBus.getV(b), BaseBus.getAngle(b), TwoSides.ONE).otherSideP(parent, false); - } - - @Override - public double getQ() { - if (!parent.isPaired() && valid(parent.getP0(), parent.getQ0())) { - return -parent.getQ0(); - } - Terminal t = parent.getTerminal(); - Bus b = t.getBusView().getBus(); - return new SV(t.getP(), t.getQ(), BaseBus.getV(b), BaseBus.getAngle(b), TwoSides.ONE).otherSideQ(parent, false); - } - - @Override - public DanglingLine getDanglingLine() { - return parent; - } - - private static boolean valid(double p0, double q0) { - return !Double.isNaN(p0) && !Double.isNaN(q0); - } -} diff --git a/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/DanglingLineImpl.java b/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/DanglingLineImpl.java index 385e034cd..c0b1801a9 100644 --- a/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/DanglingLineImpl.java +++ b/network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/DanglingLineImpl.java @@ -7,6 +7,7 @@ package com.powsybl.network.store.iidm.impl; import com.powsybl.iidm.network.*; +import com.powsybl.iidm.network.util.DanglingLineBoundaryImpl; import com.powsybl.network.store.model.*; import java.util.Collection;