diff --git a/docs/loadflow/loadflow.md b/docs/loadflow/loadflow.md index 981b4e7d25..52f9bd3d05 100644 --- a/docs/loadflow/loadflow.md +++ b/docs/loadflow/loadflow.md @@ -3,7 +3,7 @@ ## Grid modeling Open Load Flow computes power flows from IIDM grid model in bus/view topology. From the view, a very simple network, composed -of only buses and branches is created. In the graph vision, we rely on a $\Pi$ model for branches (lines, transformers, dangling lines, etc.): +of only buses and branches is created. In the graph vision, we rely on a $\Pi$ model for branches (lines, transformers, boundary lines, etc.): - $R$ and $X$ are respectively the real part (resistance) and the imaginary part (reactance) of the complex impedance ; - $G_1$ and $G_2$ are the real parts (conductance) on respectively side 1 and side 2 of the branch ; @@ -263,9 +263,9 @@ In such cases the involved areas are not considered in the Area Interchange Cont In iIDM each area defines the boundary points to be considered in the interchange. iIDM supports two ways of modeling area boundaries: - either via an equipment terminal, -- or via a DanglingLine boundary. +- or via a BoundaryLine boundary. -In the DanglingLine case, the flow at the boundary side is considered as it should be, for both unpaired DanglingLines and DanglingLines paired in a TieLine. +In the BoundaryLine case, the flow at the boundary side is considered as it should be, for both unpaired BoundaryLines and BoundaryLines paired in a TieLine. ### Slack bus mismatch attribution Depending on the location of the slack bus(es), the role of distributing the active power mismatch will be attributed based on the following logic: diff --git a/docs/sensitivity/getting_started.md b/docs/sensitivity/getting_started.md index 50ebe269cf..cdf991dcd9 100644 --- a/docs/sensitivity/getting_started.md +++ b/docs/sensitivity/getting_started.md @@ -47,10 +47,10 @@ Here is a table to summarize supported use cases: ## Input function types ### Branch sensitivity functions : -BRANCH_ACTIVE_POWER_#, BRANCH_REACTIVE_POWER_# or BRANCH_CURRENT_# are associated to branch objects (lines, transformers, dangling lines, tie lines). The # index corresponding to the side of the studied branch. +BRANCH_ACTIVE_POWER_#, BRANCH_REACTIVE_POWER_# or BRANCH_CURRENT_# are associated to branch objects (lines, transformers, boundary lines, tie lines). The # index corresponding to the side of the studied branch. - If it is a line, a tie line, or a two windings transformer : The side is 1 or 2. - If it is a three windings transformer : The side is 1, 2 or 3 corresponding to the studied leg of the transformer. -- If it is a dangling line : The side is 1 (network side) or 2 (boundary side). Note that if the dangling line is paired, only side 1 (network side) can be specified, and the sensitivity function is computed at the corresponding tie line side. +- If it is a boundary line : The side is 1 (network side) or 2 (boundary side). Note that if the boundary line is paired, only side 1 (network side) can be specified, and the sensitivity function is computed at the corresponding tie line side. ### Bus sensitivity functions : BUS_VOLTAGE or BUS_REACTIVE_POWER are associated to the bus of the given network element. diff --git a/pom.xml b/pom.xml index a26ad4564e..d51335ca0b 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 1.6.3 0.3.2 - 7.1.1 + 7.2.0-SNAPSHOT diff --git a/src/main/java/com/powsybl/openloadflow/network/LfBranch.java b/src/main/java/com/powsybl/openloadflow/network/LfBranch.java index 387db5d367..342ef6cc3f 100644 --- a/src/main/java/com/powsybl/openloadflow/network/LfBranch.java +++ b/src/main/java/com/powsybl/openloadflow/network/LfBranch.java @@ -30,7 +30,7 @@ enum BranchType { TRANSFO_3_LEG_1, TRANSFO_3_LEG_2, TRANSFO_3_LEG_3, - DANGLING_LINE, + BOUNDARY_LINE, SWITCH, TIE_LINE } diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/ContingencyTripping.java b/src/main/java/com/powsybl/openloadflow/network/impl/ContingencyTripping.java index 4c521a9767..dd880ccc9e 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/ContingencyTripping.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/ContingencyTripping.java @@ -104,7 +104,7 @@ public static ContingencyTripping createContingencyTripping(Network network, Ide TWO_WINDINGS_TRANSFORMER, TIE_LINE: return ContingencyTripping.createBranchTripping(network, (Branch) identifiable); - case DANGLING_LINE, + case BOUNDARY_LINE, GENERATOR, LOAD, SHUNT_COMPENSATOR, diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/LfAreaImpl.java b/src/main/java/com/powsybl/openloadflow/network/impl/LfAreaImpl.java index 92f75086fd..f274bcda07 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/LfAreaImpl.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/LfAreaImpl.java @@ -101,15 +101,15 @@ public double getP() { } if (branch instanceof LfTieLineBranch lfTieLineBranch) { if (side == TwoSides.ONE) { - DanglingLine danglingLine1 = lfTieLineBranch.getHalf1(); - double nominalV1 = danglingLine1.getTerminal().getVoltageLevel().getNominalV(); + BoundaryLine boundaryLine1 = lfTieLineBranch.getHalf1(); + double nominalV1 = boundaryLine1.getTerminal().getVoltageLevel().getNominalV(); return new SV(lfTieLineBranch.getP1().eval() * PerUnit.SB, lfTieLineBranch.getQ1().eval() * PerUnit.SB, lfTieLineBranch.getV1() * nominalV1, Math.toDegrees(lfTieLineBranch.getAngle1()), side) - .otherSideP(danglingLine1, false) / PerUnit.SB; + .otherSideP(boundaryLine1, false) / PerUnit.SB; } else if (side == TwoSides.TWO) { - DanglingLine danglingLine = lfTieLineBranch.getHalf2(); - double nominalV2 = danglingLine.getTerminal().getVoltageLevel().getNominalV(); + BoundaryLine boundaryLine = lfTieLineBranch.getHalf2(); + double nominalV2 = boundaryLine.getTerminal().getVoltageLevel().getNominalV(); return new SV(lfTieLineBranch.getP2().eval() * PerUnit.SB, lfTieLineBranch.getQ2().eval() * PerUnit.SB, lfTieLineBranch.getV2() * nominalV2, Math.toDegrees(lfTieLineBranch.getAngle2()), side) - .otherSideP(danglingLine, false) / PerUnit.SB; + .otherSideP(boundaryLine, false) / PerUnit.SB; } } return switch (side) { diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineBranch.java b/src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineBranch.java similarity index 70% rename from src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineBranch.java rename to src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineBranch.java index d26595ebd1..117cffd3c9 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineBranch.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineBranch.java @@ -7,7 +7,7 @@ */ package com.powsybl.openloadflow.network.impl; -import com.powsybl.iidm.network.DanglingLine; +import com.powsybl.iidm.network.BoundaryLine; import com.powsybl.iidm.network.LimitType; import com.powsybl.iidm.network.LoadingLimits; import com.powsybl.iidm.network.TwoSides; @@ -23,46 +23,46 @@ /** * @author Geoffroy Jamgotchian {@literal } */ -public class LfDanglingLineBranch extends AbstractImpedantLfBranch { +public class LfBoundaryLineBranch extends AbstractImpedantLfBranch { - private final Ref danglingLineRef; + private final Ref boundaryLineRef; - protected LfDanglingLineBranch(LfNetwork network, LfBus bus1, LfBus bus2, PiModel piModel, DanglingLine danglingLine, + protected LfBoundaryLineBranch(LfNetwork network, LfBus bus1, LfBus bus2, PiModel piModel, BoundaryLine boundaryLine, LfNetworkParameters parameters) { super(network, bus1, bus2, piModel, parameters); - this.danglingLineRef = Ref.create(danglingLine, parameters.isCacheEnabled()); + this.boundaryLineRef = Ref.create(boundaryLine, parameters.isCacheEnabled()); } - public static LfDanglingLineBranch create(DanglingLine danglingLine, LfNetwork network, LfBus bus1, LfBus bus2, + public static LfBoundaryLineBranch create(BoundaryLine boundaryLine, LfNetwork network, LfBus bus1, LfBus bus2, LfNetworkParameters parameters) { - Objects.requireNonNull(danglingLine); + Objects.requireNonNull(boundaryLine); Objects.requireNonNull(bus1); Objects.requireNonNull(bus2); Objects.requireNonNull(parameters); - double zb = PerUnit.zb(danglingLine.getTerminal().getVoltageLevel().getNominalV()); - // iIDM DanglingLine shunt admittance is network side only which is always side 1 (boundary is side 2). + double zb = PerUnit.zb(boundaryLine.getTerminal().getVoltageLevel().getNominalV()); + // iIDM BoundaryLine shunt admittance is network side only which is always side 1 (boundary is side 2). PiModel piModel = new SimplePiModel() - .setR(danglingLine.getR() / zb) - .setX(danglingLine.getX() / zb) - .setG1(danglingLine.getG() * zb) + .setR(boundaryLine.getR() / zb) + .setX(boundaryLine.getX() / zb) + .setG1(boundaryLine.getG() * zb) .setG2(0) - .setB1(danglingLine.getB() * zb) + .setB1(boundaryLine.getB() * zb) .setB2(0); - return new LfDanglingLineBranch(network, bus1, bus2, piModel, danglingLine, parameters); + return new LfBoundaryLineBranch(network, bus1, bus2, piModel, boundaryLine, parameters); } - private DanglingLine getDanglingLine() { - return danglingLineRef.get(); + private BoundaryLine getBoundaryLine() { + return boundaryLineRef.get(); } @Override public String getId() { - return getDanglingLine().getId(); + return getBoundaryLine().getId(); } @Override public BranchType getBranchType() { - return BranchType.DANGLING_LINE; + return BranchType.BOUNDARY_LINE; } @Override @@ -76,7 +76,7 @@ public List createBranchResult(double preContingencyBranchP1, doub LoadFlowModel loadFlowModel) { // in a security analysis, we don't have any way to monitor the flows at boundary side. So in the branch result, // we follow the convention side 1 for network side and side 2 for boundary side. - double currentScale = PerUnit.ib(getDanglingLine().getTerminal().getVoltageLevel().getNominalV()); + double currentScale = PerUnit.ib(getBoundaryLine().getTerminal().getVoltageLevel().getNominalV()); return List.of(buildBranchResult(loadFlowModel, zeroImpedanceFlows, currentScale, currentScale, Double.NaN, Double.NaN)); } @@ -84,11 +84,11 @@ public List createBranchResult(double preContingencyBranchP1, doub public List getLimits1(final LimitType type, LimitReductionManager limitReductionManager) { switch (type) { case ACTIVE_POWER: - return getLimits1(type, () -> getDanglingLine().getActivePowerLimits(), limitReductionManager); + return getLimits1(type, () -> getBoundaryLine().getActivePowerLimits(), limitReductionManager); case APPARENT_POWER: - return getLimits1(type, () -> getDanglingLine().getApparentPowerLimits(), limitReductionManager); + return getLimits1(type, () -> getBoundaryLine().getApparentPowerLimits(), limitReductionManager); case CURRENT: - return getLimits1(type, () -> getDanglingLine().getCurrentLimits(), limitReductionManager); + return getLimits1(type, () -> getBoundaryLine().getCurrentLimits(), limitReductionManager); case VOLTAGE: default: throw new UnsupportedOperationException(String.format("Getting %s limits is not supported.", type.name())); @@ -108,7 +108,7 @@ public void updateState(LfNetworkStateUpdateParameters parameters, LfNetworkUpda @Override public void updateFlows(double p1, double q1, double p2, double q2) { // Network side is always on side 1. - getDanglingLine().getTerminal().setP(p1 * PerUnit.SB) + getBoundaryLine().getTerminal().setP(p1 * PerUnit.SB) .setQ(q1 * PerUnit.SB); } } diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineBus.java b/src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineBus.java similarity index 56% rename from src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineBus.java rename to src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineBus.java index e62c0f12b4..03995246b3 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineBus.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineBus.java @@ -7,7 +7,7 @@ */ package com.powsybl.openloadflow.network.impl; -import com.powsybl.iidm.network.DanglingLine; +import com.powsybl.iidm.network.BoundaryLine; import com.powsybl.openloadflow.network.LfNetwork; import com.powsybl.openloadflow.network.LfNetworkParameters; import com.powsybl.openloadflow.network.LfNetworkStateUpdateParameters; @@ -18,45 +18,45 @@ /** * @author Geoffroy Jamgotchian {@literal } */ -public class LfDanglingLineBus extends AbstractLfBus { +public class LfBoundaryLineBus extends AbstractLfBus { - private final Ref danglingLineRef; + private final Ref boundaryLineRef; private final double nominalV; - public LfDanglingLineBus(LfNetwork network, DanglingLine danglingLine, LfNetworkParameters parameters, LfNetworkLoadingReport report) { - super(network, Networks.getPropertyV(danglingLine), Math.toRadians(Networks.getPropertyAngle(danglingLine)), parameters); - this.distributedOnConformLoad = false; // AbstractLfBus sets by default distributedOnConformLoad = true, we set it to false for LfDanglingLineBus - this.danglingLineRef = Ref.create(danglingLine, parameters.isCacheEnabled()); - nominalV = danglingLine.getTerminal().getVoltageLevel().getNominalV(); - getOrCreateLfLoad(null, parameters).add(danglingLine); - DanglingLine.Generation generation = danglingLine.getGeneration(); + public LfBoundaryLineBus(LfNetwork network, BoundaryLine boundaryLine, LfNetworkParameters parameters, LfNetworkLoadingReport report) { + super(network, Networks.getPropertyV(boundaryLine), Math.toRadians(Networks.getPropertyAngle(boundaryLine)), parameters); + this.distributedOnConformLoad = false; // AbstractLfBus sets by default distributedOnConformLoad = true, we set it to false for LfBoundaryLineBus + this.boundaryLineRef = Ref.create(boundaryLine, parameters.isCacheEnabled()); + nominalV = boundaryLine.getTerminal().getVoltageLevel().getNominalV(); + getOrCreateLfLoad(null, parameters).add(boundaryLine); + BoundaryLine.Generation generation = boundaryLine.getGeneration(); if (generation != null) { - add(LfDanglingLineGenerator.create(danglingLine, network, getId(), parameters, report)); + add(LfBoundaryLineGenerator.create(boundaryLine, network, getId(), parameters, report)); } } - private DanglingLine getDanglingLine() { - return danglingLineRef.get(); + private BoundaryLine getBoundaryLine() { + return boundaryLineRef.get(); } - public static String getId(DanglingLine danglingLine) { - return danglingLine.getId() + "_BUS"; + public static String getId(BoundaryLine boundaryLine) { + return boundaryLine.getId() + "_BUS"; } @Override public List getOriginalIds() { - return List.of(getDanglingLine().getId()); + return List.of(getBoundaryLine().getId()); } @Override public String getId() { - return getId(getDanglingLine()); + return getId(getBoundaryLine()); } @Override public String getVoltageLevelId() { - return getDanglingLine().getTerminal().getVoltageLevel().getId(); + return getBoundaryLine().getTerminal().getVoltageLevel().getId(); } @Override @@ -71,9 +71,9 @@ public double getNominalV() { @Override public void updateState(LfNetworkStateUpdateParameters parameters) { - var danglingLine = getDanglingLine(); - Networks.setPropertyV(danglingLine, v); - Networks.setPropertyAngle(danglingLine, Math.toDegrees(angle)); + var boundaryLine = getBoundaryLine(); + Networks.setPropertyV(boundaryLine, v); + Networks.setPropertyAngle(boundaryLine, Math.toDegrees(angle)); super.updateState(parameters); } diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineGenerator.java b/src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineGenerator.java similarity index 60% rename from src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineGenerator.java rename to src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineGenerator.java index 864fc9ed7b..fddc5672da 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/LfDanglingLineGenerator.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/LfBoundaryLineGenerator.java @@ -7,7 +7,7 @@ */ package com.powsybl.openloadflow.network.impl; -import com.powsybl.iidm.network.DanglingLine; +import com.powsybl.iidm.network.BoundaryLine; import com.powsybl.iidm.network.ReactiveLimits; import com.powsybl.openloadflow.network.LfNetwork; import com.powsybl.openloadflow.network.LfNetworkParameters; @@ -21,48 +21,48 @@ /** * @author Geoffroy Jamgotchian {@literal } */ -public final class LfDanglingLineGenerator extends AbstractLfGenerator { +public final class LfBoundaryLineGenerator extends AbstractLfGenerator { - private final Ref danglingLineRef; + private final Ref boundaryLineRef; - private LfDanglingLineGenerator(DanglingLine danglingLine, LfNetwork network, String controlledLfBusId, LfNetworkParameters parameters, + private LfBoundaryLineGenerator(BoundaryLine boundaryLine, LfNetwork network, String controlledLfBusId, LfNetworkParameters parameters, LfNetworkLoadingReport report) { - super(network, danglingLine.getGeneration().getTargetP() / PerUnit.SB, parameters); - this.danglingLineRef = Ref.create(danglingLine, parameters.isCacheEnabled()); + super(network, boundaryLine.getGeneration().getTargetP() / PerUnit.SB, parameters); + this.boundaryLineRef = Ref.create(boundaryLine, parameters.isCacheEnabled()); // local control only - if (danglingLine.getGeneration().isVoltageRegulationOn() && checkVoltageControlConsistency(parameters, report)) { - // The controlled bus cannot be reached from the DanglingLine parameters (there is no terminal in DanglingLine.Generation) - if (checkTargetV(getId(), danglingLine.getGeneration().getTargetV() / danglingLine.getTerminal().getVoltageLevel().getNominalV(), - danglingLine.getTerminal().getVoltageLevel().getNominalV(), parameters, report)) { + if (boundaryLine.getGeneration().isVoltageRegulationOn() && checkVoltageControlConsistency(parameters, report)) { + // The controlled bus cannot be reached from the BoundaryLine parameters (there is no terminal in BoundaryLine.Generation) + if (checkTargetV(getId(), boundaryLine.getGeneration().getTargetV() / boundaryLine.getTerminal().getVoltageLevel().getNominalV(), + boundaryLine.getTerminal().getVoltageLevel().getNominalV(), parameters, report)) { this.controlledBusId = Objects.requireNonNull(controlledLfBusId); - this.targetV = danglingLine.getGeneration().getTargetV() / danglingLine.getTerminal().getVoltageLevel().getNominalV(); + this.targetV = boundaryLine.getGeneration().getTargetV() / boundaryLine.getTerminal().getVoltageLevel().getNominalV(); this.generatorControlType = GeneratorControlType.VOLTAGE; } } } - public static LfDanglingLineGenerator create(DanglingLine danglingLine, LfNetwork network, String controlledLfBusId, LfNetworkParameters parameters, + public static LfBoundaryLineGenerator create(BoundaryLine boundaryLine, LfNetwork network, String controlledLfBusId, LfNetworkParameters parameters, LfNetworkLoadingReport report) { - Objects.requireNonNull(danglingLine); + Objects.requireNonNull(boundaryLine); Objects.requireNonNull(network); Objects.requireNonNull(parameters); Objects.requireNonNull(report); - return new LfDanglingLineGenerator(danglingLine, network, controlledLfBusId, parameters, report); + return new LfBoundaryLineGenerator(boundaryLine, network, controlledLfBusId, parameters, report); } - private DanglingLine getDanglingLine() { - return danglingLineRef.get(); + private BoundaryLine getBoundaryLine() { + return boundaryLineRef.get(); } @Override public String getId() { - return getDanglingLine().getId() + "_GEN"; + return getBoundaryLine().getId() + "_GEN"; } @Override public String getOriginalId() { - return getDanglingLine().getId(); + return getBoundaryLine().getId(); } @Override @@ -72,22 +72,22 @@ public OptionalDouble getRemoteControlReactiveKey() { @Override public double getTargetQ() { - return Networks.zeroIfNan(getDanglingLine().getGeneration().getTargetQ()) / PerUnit.SB; + return Networks.zeroIfNan(getBoundaryLine().getGeneration().getTargetQ()) / PerUnit.SB; } @Override public double getMinP() { - return getDanglingLine().getGeneration().getMinP() / PerUnit.SB; + return getBoundaryLine().getGeneration().getMinP() / PerUnit.SB; } @Override public double getMaxP() { - return getDanglingLine().getGeneration().getMaxP() / PerUnit.SB; + return getBoundaryLine().getGeneration().getMaxP() / PerUnit.SB; } @Override protected Optional getReactiveLimits() { - return Optional.ofNullable(getDanglingLine().getGeneration().getReactiveLimits()); + return Optional.ofNullable(getBoundaryLine().getGeneration().getReactiveLimits()); } @Override diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/LfLoadImpl.java b/src/main/java/com/powsybl/openloadflow/network/impl/LfLoadImpl.java index a955e5f854..9ec4107295 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/LfLoadImpl.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/LfLoadImpl.java @@ -7,7 +7,7 @@ */ package com.powsybl.openloadflow.network.impl; -import com.powsybl.iidm.network.DanglingLine; +import com.powsybl.iidm.network.BoundaryLine; import com.powsybl.iidm.network.LccConverterStation; import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.LoadType; @@ -120,9 +120,9 @@ void add(LccConverterStation lccCs, LfNetworkParameters parameters) { targetQ += HvdcUtils.getLccConverterStationLoadTargetQ(lccCs) / PerUnit.SB; } - public void add(DanglingLine danglingLine) { - targetP += danglingLine.getP0() / PerUnit.SB; - targetQ += danglingLine.getQ0() / PerUnit.SB; + public void add(BoundaryLine boundaryLine) { + targetP += boundaryLine.getP0() / PerUnit.SB; + targetQ += boundaryLine.getQ0() / PerUnit.SB; } @Override diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImpl.java b/src/main/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImpl.java index 3742f8730d..6e066c81b6 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImpl.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImpl.java @@ -48,7 +48,7 @@ private static final class LoadingContext { private final Set> branchSet = new LinkedHashSet<>(); - private final List danglingLines = new ArrayList<>(); + private final List boundaryLines = new ArrayList<>(); private final Set t3wtSet = new LinkedHashSet<>(); @@ -418,9 +418,9 @@ public void visitShuntCompensator(ShuntCompensator sc) { } @Override - public void visitDanglingLine(DanglingLine danglingLine) { - loadingContext.danglingLines.add(danglingLine); - postProcessors.forEach(pp -> pp.onInjectionAdded(danglingLine, lfBus)); + public void visitBoundaryLine(BoundaryLine boundaryLine) { + loadingContext.boundaryLines.add(boundaryLine); + postProcessors.forEach(pp -> pp.onInjectionAdded(boundaryLine, lfBus)); } @Override @@ -491,30 +491,30 @@ private static void createBranches(List lfBuses, LfNetwork lfNetwork, LfT postProcessors.forEach(pp -> pp.onBranchAdded(branch, lfBranch)); } - Set visitedDanglingLinesIds = new HashSet<>(); - for (DanglingLine danglingLine : loadingContext.danglingLines) { - danglingLine.getTieLine().ifPresentOrElse(tieLine -> { - if (!visitedDanglingLinesIds.contains(danglingLine.getId())) { - LfBus lfBus1 = getLfBus(tieLine.getDanglingLine1().getTerminal(), lfNetwork, parameters.isBreakers()); - LfBus lfBus2 = getLfBus(tieLine.getDanglingLine2().getTerminal(), lfNetwork, parameters.isBreakers()); + Set visitedBoundaryLinesIds = new HashSet<>(); + for (BoundaryLine boundaryLine : loadingContext.boundaryLines) { + boundaryLine.getTieLine().ifPresentOrElse(tieLine -> { + if (!visitedBoundaryLinesIds.contains(boundaryLine.getId())) { + LfBus lfBus1 = getLfBus(tieLine.getBoundaryLine1().getTerminal(), lfNetwork, parameters.isBreakers()); + LfBus lfBus2 = getLfBus(tieLine.getBoundaryLine2().getTerminal(), lfNetwork, parameters.isBreakers()); LfBranch lfBranch = LfTieLineBranch.create(tieLine, lfNetwork, lfBus1, lfBus2, parameters); addBranch(lfNetwork, lfBranch, report); addBranchAreaBoundaries(tieLine, lfBranch, loadingContext); postProcessors.forEach(pp -> pp.onBranchAdded(tieLine, lfBranch)); - visitedDanglingLinesIds.add(tieLine.getDanglingLine1().getId()); - visitedDanglingLinesIds.add(tieLine.getDanglingLine2().getId()); + visitedBoundaryLinesIds.add(tieLine.getBoundaryLine1().getId()); + visitedBoundaryLinesIds.add(tieLine.getBoundaryLine2().getId()); } }, () -> { - LfDanglingLineBus lfBus2 = new LfDanglingLineBus(lfNetwork, danglingLine, parameters, report); + LfBoundaryLineBus lfBus2 = new LfBoundaryLineBus(lfNetwork, boundaryLine, parameters, report); lfNetwork.addBus(lfBus2); lfBuses.add(lfBus2); - LfBus lfBus1 = getLfBus(danglingLine.getTerminal(), lfNetwork, parameters.isBreakers()); - LfBranch lfBranch = LfDanglingLineBranch.create(danglingLine, lfNetwork, lfBus1, lfBus2, parameters); + LfBus lfBus1 = getLfBus(boundaryLine.getTerminal(), lfNetwork, parameters.isBreakers()); + LfBranch lfBranch = LfBoundaryLineBranch.create(boundaryLine, lfNetwork, lfBus1, lfBus2, parameters); addBranch(lfNetwork, lfBranch, report); - addDanglingLineAreaBoundary(danglingLine, lfBranch, loadingContext); + addBoundaryLineAreaBoundary(boundaryLine, lfBranch, loadingContext); postProcessors.forEach(pp -> { - pp.onBusAdded(danglingLine, lfBus2); - pp.onBranchAdded(danglingLine, lfBranch); + pp.onBusAdded(boundaryLine, lfBus2); + pp.onBranchAdded(boundaryLine, lfBranch); }); }); } @@ -573,7 +573,7 @@ private static void updateArea(Bus bus, LfBus lfBus, LfNetworkParameters paramet loadingContext.areaBusMap.computeIfAbsent(area, k -> { area.getAreaBoundaryStream().forEach(boundary -> { boundary.getTerminal().ifPresent(t -> loadingContext.areaTerminalMap.put(t, area)); - boundary.getBoundary().ifPresent(b -> loadingContext.areaTerminalMap.put(b.getDanglingLine().getTerminal(), area)); + boundary.getBoundary().ifPresent(b -> loadingContext.areaTerminalMap.put(b.getBoundaryLine().getTerminal(), area)); }); return new HashSet<>(); }).add(lfBus) @@ -592,11 +592,11 @@ private static void addBranchAreaBoundaries(Branch branch, LfBranch lfBranch, } /** - * Adds the active power of the terminal of the dangling line to the calculation of the Area's interchange (load convention) if it is a boundary. - * The equivalent injection of the dangling line lfBranch model is P2; + * Adds the active power of the terminal of the boundary line to the calculation of the Area's interchange (load convention) if it is a boundary. + * The equivalent injection of the boundary line lfBranch model is P2; */ - private static void addDanglingLineAreaBoundary(DanglingLine danglingLine, LfBranch lfDanglingLineBranch, LoadingContext loadingContext) { - addAreaBoundary(danglingLine.getTerminal(), lfDanglingLineBranch, TwoSides.TWO, loadingContext); + private static void addBoundaryLineAreaBoundary(BoundaryLine boundaryLine, LfBranch lfBoundaryLineBranch, LoadingContext loadingContext) { + addAreaBoundary(boundaryLine.getTerminal(), lfBoundaryLineBranch, TwoSides.TWO, loadingContext); } private static void addAreaBoundary(Terminal terminal, LfBranch branch, TwoSides side, LoadingContext loadingContext) { @@ -644,7 +644,7 @@ private static boolean checkBoundariesComponent(LfNetwork network, Area area) { final int numSC = network.getNumSC(); List boundaryBuses = area.getAreaBoundaryStream() .map(areaBoundary -> areaBoundary.getTerminal() - .orElseGet(() -> areaBoundary.getBoundary().orElseThrow().getDanglingLine().getTerminal())) + .orElseGet(() -> areaBoundary.getBoundary().orElseThrow().getBoundaryLine().getTerminal())) .map(t -> t.getBusView().getBus()) .filter(Objects::nonNull) .toList(); diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/LfTieLineBranch.java b/src/main/java/com/powsybl/openloadflow/network/impl/LfTieLineBranch.java index 4d1f0a2239..7b30a8c42c 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/LfTieLineBranch.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/LfTieLineBranch.java @@ -22,16 +22,16 @@ */ public class LfTieLineBranch extends AbstractImpedantLfBranch { - private final Ref danglingLine1Ref; + private final Ref boundaryLine1Ref; - private final Ref danglingLine2Ref; + private final Ref boundaryLine2Ref; private final String id; protected LfTieLineBranch(LfNetwork network, LfBus bus1, LfBus bus2, PiModel piModel, TieLine tieLine, LfNetworkParameters parameters) { super(network, bus1, bus2, piModel, parameters); - this.danglingLine1Ref = Ref.create(tieLine.getDanglingLine1(), parameters.isCacheEnabled()); - this.danglingLine2Ref = Ref.create(tieLine.getDanglingLine2(), parameters.isCacheEnabled()); + this.boundaryLine1Ref = Ref.create(tieLine.getBoundaryLine1(), parameters.isCacheEnabled()); + this.boundaryLine2Ref = Ref.create(tieLine.getBoundaryLine2(), parameters.isCacheEnabled()); this.id = tieLine.getId(); } @@ -39,7 +39,7 @@ public static LfTieLineBranch create(TieLine line, LfNetwork network, LfBus bus1 Objects.requireNonNull(line); Objects.requireNonNull(network); Objects.requireNonNull(parameters); - double nominalV2 = line.getDanglingLine2().getTerminal().getVoltageLevel().getNominalV(); + double nominalV2 = line.getBoundaryLine2().getTerminal().getVoltageLevel().getNominalV(); double zb = PerUnit.zb(nominalV2); PiModel piModel = new SimplePiModel() .setR1(1 / Transformers.getRatioPerUnitBase(line)) @@ -59,7 +59,7 @@ public String getId() { @Override public List getOriginalIds() { - return List.of(id, danglingLine1Ref.get().getId(), danglingLine2Ref.get().getId()); + return List.of(id, boundaryLine1Ref.get().getId(), boundaryLine2Ref.get().getId()); } @Override @@ -67,12 +67,12 @@ public BranchType getBranchType() { return BranchType.TIE_LINE; } - public DanglingLine getHalf1() { - return danglingLine1Ref.get(); + public BoundaryLine getHalf1() { + return boundaryLine1Ref.get(); } - public DanglingLine getHalf2() { - return danglingLine2Ref.get(); + public BoundaryLine getHalf2() { + return boundaryLine2Ref.get(); } @Override diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/LfVscConverterStationImpl.java b/src/main/java/com/powsybl/openloadflow/network/impl/LfVscConverterStationImpl.java index 1e8af2c901..19cca5a1f3 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/LfVscConverterStationImpl.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/LfVscConverterStationImpl.java @@ -33,11 +33,11 @@ public class LfVscConverterStationImpl extends AbstractLfGenerator implements Lf private LfHvdc hvdc; - private final boolean hvdcDandlingInIidm; + private final boolean hvdcDanglingInIidm; public LfVscConverterStationImpl(VscConverterStation station, LfNetwork network, LfNetworkParameters parameters, LfNetworkLoadingReport report) { super(network, HvdcUtils.getConverterStationTargetP(station) / PerUnit.SB, parameters); - this.hvdcDandlingInIidm = HvdcConverterStations.isHvdcDanglingInIidm(station); + this.hvdcDanglingInIidm = HvdcConverterStations.isHvdcDanglingInIidm(station); this.stationRef = Ref.create(station, parameters.isCacheEnabled()); this.lossFactor = station.getLossFactor(); @@ -66,7 +66,7 @@ public void setHvdc(LfHvdc hvdc) { public double getTargetP() { if (hvdc == null) { // Because in case one node is not in the LfNetwork, the connectivity of that node is given by IIDM - return hvdcDandlingInIidm ? 0 : super.getTargetP(); + return hvdcDanglingInIidm ? 0 : super.getTargetP(); } else { // Because in case of AC emulation, active power is injected by HvdcAcEmulationSideXActiveFlowEquationTerm equations return hvdc.isAcEmulation() ? 0 : super.getTargetP(); diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/Networks.java b/src/main/java/com/powsybl/openloadflow/network/impl/Networks.java index c9c1761eca..cf7bc5a0e4 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/Networks.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/Networks.java @@ -64,7 +64,7 @@ public static void resetState(Network network) { resetInjectionsState(network.getLoads()); resetInjectionsState(network.getLccConverterStations()); resetInjectionsState(network.getBatteries()); - resetInjectionsState(network.getDanglingLines()); + resetInjectionsState(network.getBoundaryLines()); } private static double getDoubleProperty(Identifiable identifiable, String name) { diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/NodeBreakerTraverser.java b/src/main/java/com/powsybl/openloadflow/network/impl/NodeBreakerTraverser.java index 7a936151ad..b6906145b0 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/NodeBreakerTraverser.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/NodeBreakerTraverser.java @@ -92,7 +92,7 @@ private boolean isEquivalentToStopAfterSwitch(Switch sw, int nodeAfter) { || connectableAfter == IdentifiableType.STATIC_VAR_COMPENSATOR || connectableAfter == IdentifiableType.BATTERY || connectableAfter == IdentifiableType.SHUNT_COMPENSATOR - || connectableAfter == IdentifiableType.DANGLING_LINE + || connectableAfter == IdentifiableType.BOUNDARY_LINE || connectableAfter == IdentifiableType.LINE || connectableAfter == IdentifiableType.TWO_WINDINGS_TRANSFORMER || connectableAfter == IdentifiableType.THREE_WINDINGS_TRANSFORMER; diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/PropagatedContingency.java b/src/main/java/com/powsybl/openloadflow/network/impl/PropagatedContingency.java index 127eb699a1..e13d56920b 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/PropagatedContingency.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/PropagatedContingency.java @@ -196,13 +196,13 @@ private void complete(LfTopoConfig topoConfig, PropagatedContingencyCreationPara topoConfig.getBranchIdsOpenableSide2().add(connectable.getId()); } break; - case DANGLING_LINE: - DanglingLine dl = (DanglingLine) connectable; + case BOUNDARY_LINE: + BoundaryLine bl = (BoundaryLine) connectable; // as we terminal is only on network side, we open both sides in LF network - if (dl.isPaired()) { - addBranchToOpen(dl.getTieLine().orElseThrow().getId(), DisabledBranchStatus.BOTH_SIDES, branchIdsToOpen); + if (bl.isPaired()) { + addBranchToOpen(bl.getTieLine().orElseThrow().getId(), DisabledBranchStatus.BOTH_SIDES, branchIdsToOpen); } else { - addBranchToOpen(dl.getId(), DisabledBranchStatus.BOTH_SIDES, branchIdsToOpen); + addBranchToOpen(bl.getId(), DisabledBranchStatus.BOTH_SIDES, branchIdsToOpen); } break; @@ -274,7 +274,7 @@ private static List getTerminals(Identifiable identifiabl return List.of(hvdcLine.getConverterStation1().getTerminal(), hvdcLine.getConverterStation2().getTerminal()); } if (identifiable instanceof TieLine line) { - return List.of(line.getDanglingLine1().getTerminal(), line.getDanglingLine2().getTerminal()); + return List.of(line.getBoundaryLine1().getTerminal(), line.getBoundaryLine2().getTerminal()); } if (identifiable instanceof Switch) { return Collections.emptyList(); @@ -293,9 +293,9 @@ private static Identifiable getIdentifiable(Network network, ContingencyEleme identifiable = network.getHvdcLine(element.getId()); yield "HVDC line"; } - case DANGLING_LINE -> { - identifiable = network.getDanglingLine(element.getId()); - yield "Dangling line"; + case BOUNDARY_LINE -> { + identifiable = network.getBoundaryLine(element.getId()); + yield "Boundary line"; } case GENERATOR -> { identifiable = network.getGenerator(element.getId()); diff --git a/src/main/java/com/powsybl/openloadflow/network/impl/Transformers.java b/src/main/java/com/powsybl/openloadflow/network/impl/Transformers.java index af27b97b87..32b4276298 100644 --- a/src/main/java/com/powsybl/openloadflow/network/impl/Transformers.java +++ b/src/main/java/com/powsybl/openloadflow/network/impl/Transformers.java @@ -211,8 +211,8 @@ public static double getRatioPerUnitBase(Branch branch) { } public static double getRatioPerUnitBase(TieLine line) { - double nominalV1 = line.getDanglingLine1().getTerminal().getVoltageLevel().getNominalV(); - double nominalV2 = line.getDanglingLine2().getTerminal().getVoltageLevel().getNominalV(); + double nominalV1 = line.getBoundaryLine1().getTerminal().getVoltageLevel().getNominalV(); + double nominalV2 = line.getBoundaryLine2().getTerminal().getVoltageLevel().getNominalV(); return nominalV2 / nominalV1; } } diff --git a/src/main/java/com/powsybl/openloadflow/sa/PostContingencyNetworkResult.java b/src/main/java/com/powsybl/openloadflow/sa/PostContingencyNetworkResult.java index afa79b3aae..c38b890d65 100644 --- a/src/main/java/com/powsybl/openloadflow/sa/PostContingencyNetworkResult.java +++ b/src/main/java/com/powsybl/openloadflow/sa/PostContingencyNetworkResult.java @@ -50,7 +50,7 @@ public void addResults(StateMonitor monitor, Predicate isBranchDisable ContingencyElement contingencyElement = contingency.getElements().get(0); if (contingencyElement.getType() == ContingencyElementType.BRANCH || contingencyElement.getType() == ContingencyElementType.LINE - || contingencyElement.getType() == ContingencyElementType.DANGLING_LINE + || contingencyElement.getType() == ContingencyElementType.BOUNDARY_LINE || contingencyElement.getType() == ContingencyElementType.TWO_WINDINGS_TRANSFORMER) { BranchResult preContingencyBranchOfContingencyResult = preContingencyMonitorInfos.getBranchResult(contingencyElement.getId()); if (preContingencyBranchOfContingencyResult != null) { diff --git a/src/main/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysis.java b/src/main/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysis.java index cea00d15bf..d97eb9e4e1 100644 --- a/src/main/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysis.java +++ b/src/main/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysis.java @@ -339,7 +339,7 @@ public boolean isVariableInContingency(PropagatedContingency contingency) { switch (variableType) { case INJECTION_ACTIVE_POWER, HVDC_LINE_ACTIVE_POWER: - // a load, a generator, a dangling line, an LCC or a VSC converter station. + // a load, a generator, a boundary line, an LCC or a VSC converter station. return contingency.getGeneratorIdsToLose().contains(variableId) || contingency.getLoadIdsToLose().containsKey(variableId); case BUS_TARGET_VOLTAGE: // a generator or a two windings transformer. @@ -792,19 +792,19 @@ protected void checkLoadFlowParameters(LoadFlowParameters lfParameters) { } } - private Pair checkAndUpdateFunctionTypeDanglingLine(Network network, SensitivityFunctionType functionType, String functionId) { + private Pair checkAndUpdateFunctionTypeBoundaryLine(Network network, SensitivityFunctionType functionType, String functionId) { if (isFlowFunction(functionType) || isReactivePowerFunctionType(functionType)) { - DanglingLine danglingLine = network.getDanglingLine(functionId); - if (danglingLine != null && danglingLine.isPaired()) { - if (functionType.getSide().orElseThrow() != 1) { // Check that user wants side 1 of the dangling line (i.e. network side value and not boundary side) - throw new PowsyblException("Dangling line " + functionId + " is paired. Sensitivity function can only be computed on its side 1 (given type " + functionType + ")"); + BoundaryLine boundaryLine = network.getBoundaryLine(functionId); + if (boundaryLine != null && boundaryLine.isPaired()) { + if (functionType.getSide().orElseThrow() != 1) { // Check that user wants side 1 of the boundary line (i.e. network side value and not boundary side) + throw new PowsyblException("Boundary line " + functionId + " is paired. Sensitivity function can only be computed on its side 1 (given type " + functionType + ")"); } - TieLine tieLine = danglingLine.getTieLine().orElseThrow(); - TwoSides danglingLineSide = tieLine.getDanglingLine(TwoSides.ONE) == danglingLine ? TwoSides.ONE : TwoSides.TWO; // Search side of the tie line corresponding to the studied dangling line + TieLine tieLine = boundaryLine.getTieLine().orElseThrow(); + TwoSides boundaryLineSide = tieLine.getBoundaryLine(TwoSides.ONE) == boundaryLine ? TwoSides.ONE : TwoSides.TWO; // Search side of the tie line corresponding to the studied boundary line if (LOGGER.isInfoEnabled()) { - LOGGER.info("Dangling line {} is paired. Computing sensitivity function of its tie line {} on side {}", functionId, tieLine.getId(), danglingLineSide.getNum()); + LOGGER.info("Boundary line {} is paired. Computing sensitivity function of its tie line {} on side {}", functionId, tieLine.getId(), boundaryLineSide.getNum()); } - return Pair.of(updateFunctionTypeSide(functionType, danglingLineSide), tieLine.getId()); // Conversion to the corresponding tie line sensitivity function + return Pair.of(updateFunctionTypeSide(functionType, boundaryLineSide), tieLine.getId()); // Conversion to the corresponding tie line sensitivity function } } return Pair.of(functionType, functionId); // Returning input as it is @@ -815,8 +815,8 @@ private static LfBranch checkAndGetBranchOrLeg(Network network, String branchId, if (branch != null) { return lfNetwork.getBranchById(branchId); } - DanglingLine danglingLine = network.getDanglingLine(branchId); - if (danglingLine != null && !danglingLine.isPaired()) { + BoundaryLine boundaryLine = network.getBoundaryLine(branchId); + if (boundaryLine != null && !boundaryLine.isPaired()) { return lfNetwork.getBranchById(branchId); } ThreeWindingsTransformer twt = network.getThreeWindingsTransformer(branchId); @@ -827,7 +827,7 @@ private static LfBranch checkAndGetBranchOrLeg(Network network, String branchId, if (line != null) { return lfNetwork.getBranchById(branchId); } - throw new PowsyblException("Branch, tie line, dangling line or leg of '" + branchId + NOT_FOUND); + throw new PowsyblException("Branch, tie line, boundary line or leg of '" + branchId + NOT_FOUND); } private static void checkBus(Network network, String busId, Map busCache, boolean breakers) { @@ -930,11 +930,11 @@ private static Injection getInjection(Network network, String injectionId) { injection = network.getLoad(injectionId); } if (injection == null) { - injection = network.getDanglingLine(injectionId); - if (injection != null && network.getDanglingLine(injectionId).isPaired()) { - throw new PowsyblException("The dangling line " + injectionId + " is paired: it cannot be a sensitivity variable"); + injection = network.getBoundaryLine(injectionId); + if (injection != null && network.getBoundaryLine(injectionId).isPaired()) { + throw new PowsyblException("The boundary line " + injectionId + " is paired: it cannot be a sensitivity variable"); } - injection = network.getDanglingLine(injectionId); + injection = network.getBoundaryLine(injectionId); } if (injection == null) { injection = network.getLccConverterStation(injectionId); @@ -956,8 +956,8 @@ protected static String getInjectionBusId(Network network, String injectionId, b if (bus == null) { return null; } - if (injection instanceof DanglingLine dl) { - return LfDanglingLineBus.getId(dl); + if (injection instanceof BoundaryLine dl) { + return LfBoundaryLineBus.getId(dl); } else { return bus.getId(); } @@ -1013,9 +1013,9 @@ protected SensitivityFactorHolder readAndCheckFactors(Network network, Map factorReader.read((functionTypeToCheck, functionIdToCheck, variableType, variableId, variableSet, contingencyContext) -> { SensitivityFunctionType functionType = functionTypeToCheck; String functionId = functionIdToCheck; - if (network.getDanglingLine(functionIdToCheck) != null && network.getDanglingLine(functionIdToCheck).isPaired()) { - //In case of dangling line associated to a tie line, we have to update the sensitivity function - Pair updatedFunction = checkAndUpdateFunctionTypeDanglingLine(network, functionTypeToCheck, functionIdToCheck); + if (network.getBoundaryLine(functionIdToCheck) != null && network.getBoundaryLine(functionIdToCheck).isPaired()) { + //In case of boundary line associated to a tie line, we have to update the sensitivity function + Pair updatedFunction = checkAndUpdateFunctionTypeBoundaryLine(network, functionTypeToCheck, functionIdToCheck); functionType = updatedFunction.getLeft(); functionId = updatedFunction.getRight(); } diff --git a/src/test/java/com/powsybl/openloadflow/OperationalLimitsTest.java b/src/test/java/com/powsybl/openloadflow/OperationalLimitsTest.java index 787f0060a6..ec2b256f8b 100644 --- a/src/test/java/com/powsybl/openloadflow/OperationalLimitsTest.java +++ b/src/test/java/com/powsybl/openloadflow/OperationalLimitsTest.java @@ -10,7 +10,7 @@ import com.powsybl.iidm.network.LimitType; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; -import com.powsybl.iidm.network.test.DanglingLineNetworkFactory; +import com.powsybl.iidm.network.test.BoundaryLineNetworkFactory; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import com.powsybl.iidm.network.test.ThreeWindingsTransformerNetworkFactory; import com.powsybl.loadflow.LoadFlowParameters; @@ -84,8 +84,8 @@ private double getLimitValueFromAcceptableDuration(LfBranch branch, int acceptab } @Test - void testDanglingLineCurrentLimits() { - Network network = DanglingLineNetworkFactory.create(); + void testBoundaryLineCurrentLimits() { + Network network = BoundaryLineNetworkFactory.create(); List lfNetworks = Networks.load(network, new MostMeshedSlackBusSelector()); assertEquals(1, lfNetworks.size()); LfNetwork lfNetwork = lfNetworks.get(0); @@ -94,7 +94,7 @@ void testDanglingLineCurrentLimits() { new AcloadFlowEngine(context) .run(); } - LfBranch branch = lfNetwork.getBranchById("DL"); + LfBranch branch = lfNetwork.getBranchById("BL"); assertEquals(0.626, branch.getI1().eval(), DELTA); assertEquals(0.618, branch.getI2().eval(), DELTA); assertEquals(Double.NaN, getLimitValueFromAcceptableDuration(branch, Integer.MAX_VALUE, TwoSides.TWO, LimitType.CURRENT), DELTA); @@ -165,9 +165,9 @@ void testLineApparentPowerLimits() { } @Test - void testDanglingLineActivePowerLimits() { + void testBoundaryLineActivePowerLimits() { //FIXME: to be completed with new operational limits design. - Network network = DanglingLineNetworkFactory.create(); + Network network = BoundaryLineNetworkFactory.create(); List lfNetworks = Networks.load(network, new MostMeshedSlackBusSelector()); assertEquals(1, lfNetworks.size()); LfNetwork lfNetwork = lfNetworks.get(0); @@ -176,7 +176,7 @@ void testDanglingLineActivePowerLimits() { new AcloadFlowEngine(context) .run(); } - LfBranch branch = lfNetwork.getBranchById("DL"); + LfBranch branch = lfNetwork.getBranchById("BL"); assertEquals(54.815, branch.getP1().eval() * PerUnit.SB, 10E-3); assertEquals(-50.0, branch.getP2().eval() * PerUnit.SB, 10E-3); } diff --git a/src/test/java/com/powsybl/openloadflow/ZeroImpedanceFlowsTest.java b/src/test/java/com/powsybl/openloadflow/ZeroImpedanceFlowsTest.java index d7f6dae58f..7471b3bbe9 100644 --- a/src/test/java/com/powsybl/openloadflow/ZeroImpedanceFlowsTest.java +++ b/src/test/java/com/powsybl/openloadflow/ZeroImpedanceFlowsTest.java @@ -318,8 +318,8 @@ void fourBusesZeroImpedanceLeg3ThreeWindingsTransformerTest() { } @Test - void threeBusesZeroImpedanceDanglingLineTest() { - Network network = Network.create("ThreeBusesWithZeroImpedanceDanglingLine", "code"); + void threeBusesZeroImpedanceBoundaryLineTest() { + Network network = Network.create("ThreeBusesWithZeroImpedanceBoundaryLine", "code"); Bus b1 = createBus(network, "b1"); Bus b2 = createBus(network, "b2"); Bus b3 = createBus(network, "b3"); @@ -327,7 +327,7 @@ void threeBusesZeroImpedanceDanglingLineTest() { createLoad(b3, "l1", 1.9, 1); createLine(network, b1, b2, "l12", 0.01); createLine(network, b2, b3, "l23", 0.01); - DanglingLine dl3 = createDanglingLine(b3, "d3", 0.0, 1.5, 0.5); + BoundaryLine dl3 = createBoundaryLine(b3, "d3", 0.0, 1.5, 0.5); parametersExt.setSlackBusId("b1_vl_0") .setSlackBusSelectionMode(SlackBusSelectionMode.NAME) @@ -454,8 +454,8 @@ void fourBusesZeroImpedanceThreeWindingsTransformerDcTest() { } @Test - void threeBusesZeroImpedanceDanglingLineDcTest() { - Network network = Network.create("ThreeBusesWithZeroImpedanceDanglingLineDc", "code"); + void threeBusesZeroImpedanceBoundaryLineDcTest() { + Network network = Network.create("ThreeBusesWithZeroImpedanceBoundaryLineDc", "code"); Bus b1 = createBus(network, "b1"); Bus b2 = createBus(network, "b2"); Bus b3 = createBus(network, "b3"); @@ -463,7 +463,7 @@ void threeBusesZeroImpedanceDanglingLineDcTest() { createLoad(b3, "l1", 1.9, 1); createLine(network, b1, b2, "l12", 0.01); createLine(network, b2, b3, "l23", 0.01); - DanglingLine dl3 = createDanglingLine(b3, "d3", 0.0, 1.5, 0.5); + BoundaryLine dl3 = createBoundaryLine(b3, "d3", 0.0, 1.5, 0.5); parametersExt.setSlackBusId("b1_vl_0") .setSlackBusSelectionMode(SlackBusSelectionMode.NAME) diff --git a/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowBoundaryTest.java b/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowBoundaryTest.java index 6dac29b671..9f4da02c1b 100644 --- a/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowBoundaryTest.java +++ b/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowBoundaryTest.java @@ -31,7 +31,7 @@ class AcLoadFlowBoundaryTest { private Network network; private Bus bus1; private Bus bus2; - private DanglingLine dl1; + private BoundaryLine bl1; private Generator g1; private LoadFlow.Runner loadFlowRunner; @@ -45,7 +45,7 @@ void setUp() { network = BoundaryFactory.create(); bus1 = network.getBusBreakerView().getBus("b1"); bus2 = network.getBusBreakerView().getBus("b2"); - dl1 = network.getDanglingLine("dl1"); + bl1 = network.getBoundaryLine("bl1"); g1 = network.getGenerator("g1"); loadFlowRunner = new LoadFlow.Runner(new OpenLoadFlowProvider(new DenseMatrixFactory())); parameters = new LoadFlowParameters() @@ -64,18 +64,18 @@ void test() { assertAngleEquals(0.058104, bus1); assertVoltageEquals(388.582864, bus2); assertAngleEquals(0, bus2); - assertActivePowerEquals(101.302, dl1.getTerminal()); - assertReactivePowerEquals(149.764, dl1.getTerminal()); + assertActivePowerEquals(101.302, bl1.getTerminal()); + assertReactivePowerEquals(149.764, bl1.getTerminal()); } @Test void testWithVoltageRegulationOn() { g1.setTargetQ(0); g1.setVoltageRegulatorOn(false); - dl1.getGeneration().setVoltageRegulationOn(true); - dl1.getGeneration().setMinP(0); - dl1.getGeneration().setMaxP(10); - dl1.getGeneration().newMinMaxReactiveLimits() + bl1.getGeneration().setVoltageRegulationOn(true); + bl1.getGeneration().setMinP(0); + bl1.getGeneration().setMaxP(10); + bl1.getGeneration().newMinMaxReactiveLimits() .setMinQ(-100) .setMaxQ(100) .add(); @@ -86,8 +86,8 @@ void testWithVoltageRegulationOn() { assertAngleEquals(0.114371, bus1); assertVoltageEquals(390.181, bus2); assertAngleEquals(0, bus2); - assertActivePowerEquals(101.2, dl1.getTerminal()); - assertReactivePowerEquals(-0.202, dl1.getTerminal()); + assertActivePowerEquals(101.2, bl1.getTerminal()); + assertReactivePowerEquals(-0.202, bl1.getTerminal()); parameters.setDistributedSlack(true) .setUseReactiveLimits(true); @@ -98,8 +98,8 @@ void testWithVoltageRegulationOn() { assertAngleEquals(0.114371, bus1); assertVoltageEquals(390.181, bus2); assertAngleEquals(0, bus2); - assertActivePowerEquals(101.2, dl1.getTerminal()); - assertReactivePowerEquals(-0.202, dl1.getTerminal()); + assertActivePowerEquals(101.2, bl1.getTerminal()); + assertReactivePowerEquals(-0.202, bl1.getTerminal()); } @Test @@ -153,8 +153,8 @@ void testWithTieLine() { assertReactivePowerEquals(0.0044, network.getLine("l34").getTerminal2()); TieLine line = network.getTieLine("t12"); - line.getDanglingLine1().getTerminal().disconnect(); - line.getDanglingLine1().getTerminal().disconnect(); + line.getBoundaryLine1().getTerminal().disconnect(); + line.getBoundaryLine1().getTerminal().disconnect(); loadFlowRunner.run(network, parameters); assertVoltageEquals(400.0, network.getBusBreakerView().getBus("b3")); assertReactivePowerEquals(-0.00125, network.getLine("l34").getTerminal2()); @@ -179,51 +179,51 @@ void testEquivalentBranch() { } @Test - void testWithNonImpedantDanglingLine() { - dl1.setR(0.0).setX(0.0); + void testWithNonImpedantBoundaryLine() { + bl1.setR(0.0).setX(0.0); LoadFlowResult result = loadFlowRunner.run(network, parameters); assertTrue(result.isFullyConverged()); - assertActivePowerEquals(101.0, dl1.getTerminal()); - assertReactivePowerEquals(150.0, dl1.getTerminal()); - - dl1.getGeneration().setVoltageRegulationOn(true); - dl1.getGeneration().setTargetV(390.0); - dl1.getGeneration().setMinP(0); - dl1.getGeneration().setMaxP(10); - dl1.getGeneration().newMinMaxReactiveLimits() + assertActivePowerEquals(101.0, bl1.getTerminal()); + assertReactivePowerEquals(150.0, bl1.getTerminal()); + + bl1.getGeneration().setVoltageRegulationOn(true); + bl1.getGeneration().setTargetV(390.0); + bl1.getGeneration().setMinP(0); + bl1.getGeneration().setMaxP(10); + bl1.getGeneration().newMinMaxReactiveLimits() .setMinQ(-100) .setMaxQ(100) .add(); LoadFlowResult result2 = loadFlowRunner.run(network, parameters); assertTrue(result2.isFullyConverged()); - assertActivePowerEquals(101.0, dl1.getTerminal()); - assertReactivePowerEquals(-33.888, dl1.getTerminal()); + assertActivePowerEquals(101.0, bl1.getTerminal()); + assertReactivePowerEquals(-33.888, bl1.getTerminal()); parameters.setDc(true); LoadFlowResult result3 = loadFlowRunner.run(network, parameters); assertTrue(result3.isFullyConverged()); - assertActivePowerEquals(101.0, dl1.getTerminal()); - assertReactivePowerEquals(Double.NaN, dl1.getTerminal()); + assertActivePowerEquals(101.0, bl1.getTerminal()); + assertReactivePowerEquals(Double.NaN, bl1.getTerminal()); } @Test - void testDanglingLineShuntAdmittance() { - // verify dangling line shunt admittance is correctly accounted to be completely on network side (and not split with boundary side) + void testBoundaryLineShuntAdmittance() { + // verify boundary line shunt admittance is correctly accounted to be completely on network side (and not split with boundary side) - // setup zero flows flow at dangling line boundary side - dl1.setP0(0.0).setQ0(0.0).getGeneration().setTargetP(0.0).setTargetQ(0.0).setVoltageRegulationOn(false); + // setup zero flows flow at boundary line boundary side + bl1.setP0(0.0).setQ0(0.0).getGeneration().setTargetP(0.0).setTargetQ(0.0).setVoltageRegulationOn(false); // set higher B and G shunt values, and also much higher series impedance, so we would get very different results if the shunt admittance were split - dl1.setB(1e-3).setG(1e-4).setR(3.).setX(30.); + bl1.setB(1e-3).setG(1e-4).setR(3.).setX(30.); - // set g1 to regulate dl1 terminal at 400.0 kV - g1.setRegulatingTerminal(dl1.getTerminal()).setTargetV(400.0); + // set g1 to regulate bl1 terminal at 400.0 kV + g1.setRegulatingTerminal(bl1.getTerminal()).setTargetV(400.0); LoadFlowResult result = loadFlowRunner.run(network, parameters); assertTrue(result.isFullyConverged()); assertVoltageEquals(400.0, bus2); - assertActivePowerEquals(16., dl1.getTerminal()); // v^2 * B_shunt - assertReactivePowerEquals(-160., dl1.getTerminal()); // - v^2 * G_shunt + assertActivePowerEquals(16., bl1.getTerminal()); // v^2 * B_shunt + assertReactivePowerEquals(-160., bl1.getTerminal()); // - v^2 * G_shunt } } diff --git a/src/test/java/com/powsybl/openloadflow/ac/AreaInterchangeControlTest.java b/src/test/java/com/powsybl/openloadflow/ac/AreaInterchangeControlTest.java index 703f280617..7457e58115 100644 --- a/src/test/java/com/powsybl/openloadflow/ac/AreaInterchangeControlTest.java +++ b/src/test/java/com/powsybl/openloadflow/ac/AreaInterchangeControlTest.java @@ -72,9 +72,9 @@ void twoAreasWithXnodeTest() { } @Test - void twoAreasWithUnpairedDanglingLine() { - Network network = MultiAreaNetworkFactory.createTwoAreasWithDanglingLine(); - double interchangeTarget1 = -60; // area a1 has a boundary that is an unpaired dangling line with P0 = 20MW + void twoAreasWithUnpairedBoundaryLine() { + Network network = MultiAreaNetworkFactory.createTwoAreasWithBoundaryLine(); + double interchangeTarget1 = -60; // area a1 has a boundary that is an unpaired boundary line with P0 = 20MW double interchangeTarget2 = 40; runLfTwoAreas(network, interchangeTarget1, interchangeTarget2, -10, 3); parameters.setDc(true); @@ -83,9 +83,9 @@ void twoAreasWithUnpairedDanglingLine() { @Test void zeroImpedanceBoundaryBranchesNetworkConversion() { - Network network = MultiAreaNetworkFactory.createTwoAreasWithDanglingLine(); + Network network = MultiAreaNetworkFactory.createTwoAreasWithBoundaryLine(); network.getLine("l23_A1").setX(0); // boundary - network.getDanglingLine("dl1").setX(0); // boundary + network.getBoundaryLine("dl1").setX(0); // boundary network.getLine("l12").setX(0); // not boundary LfNetwork lfNetwork = Networks.load(network, new LfNetworkParameters().setAreaInterchangeControl(false)).get(0); @@ -104,11 +104,11 @@ void zeroImpedanceBoundaryBranchesNetworkConversion() { @Test void twoAreasWithZeroImpedanceBoundaryBranches() { - Network network = MultiAreaNetworkFactory.createTwoAreasWithDanglingLine(); + Network network = MultiAreaNetworkFactory.createTwoAreasWithBoundaryLine(); double interchangeTarget1 = -40; double interchangeTarget2 = 20; network.getLine("l23_A1").setX(0); - network.getDanglingLine("dl1").setX(0); + network.getBoundaryLine("dl1").setX(0); parametersExt.setLowImpedanceBranchMode(OpenLoadFlowParameters.LowImpedanceBranchMode.REPLACE_BY_ZERO_IMPEDANCE_LINE); runLfTwoAreas(network, interchangeTarget1, interchangeTarget2, -10, 2); parameters.setDc(true); diff --git a/src/test/java/com/powsybl/openloadflow/network/AbstractLoadFlowNetworkFactory.java b/src/test/java/com/powsybl/openloadflow/network/AbstractLoadFlowNetworkFactory.java index 02acc1b3e5..87349881c4 100644 --- a/src/test/java/com/powsybl/openloadflow/network/AbstractLoadFlowNetworkFactory.java +++ b/src/test/java/com/powsybl/openloadflow/network/AbstractLoadFlowNetworkFactory.java @@ -174,8 +174,8 @@ protected static ThreeWindingsTransformer createThreeWindingsTransformer(Network .add(); } - protected static DanglingLine createDanglingLine(Bus b, String id, double x, double p0, double q0) { - return b.getVoltageLevel().newDanglingLine() + protected static BoundaryLine createBoundaryLine(Bus b, String id, double x, double p0, double q0) { + return b.getVoltageLevel().newBoundaryLine() .setId(id) .setBus(b.getId()) .setConnectableBus(b.getId()) diff --git a/src/test/java/com/powsybl/openloadflow/network/BoundaryFactory.java b/src/test/java/com/powsybl/openloadflow/network/BoundaryFactory.java index bf25502f7e..e8f41d4658 100644 --- a/src/test/java/com/powsybl/openloadflow/network/BoundaryFactory.java +++ b/src/test/java/com/powsybl/openloadflow/network/BoundaryFactory.java @@ -15,13 +15,13 @@ public class BoundaryFactory extends AbstractLoadFlowNetworkFactory { /** - * g1 dl1 + * g1 bl1 * | | * b1 ---- b2 * l1 */ public static Network create() { - Network network = Network.create("dl", "test"); + Network network = Network.create("bl", "test"); Substation s1 = network.newSubstation() .setId("S1") .add(); @@ -54,8 +54,8 @@ public static Network create() { vl2.getBusBreakerView().newBus() .setId("b2") .add(); - vl2.newDanglingLine() - .setId("dl1") + vl2.newBoundaryLine() + .setId("bl1") .setConnectableBus("b2") .setBus("b2") .setR(0.7) @@ -82,7 +82,7 @@ public static Network create() { } /** - * g1 dl1 load3 + * g1 bl1 load3 * | | | * b1 ---- b2 ----- b3 * l1 l13 @@ -124,7 +124,7 @@ public static Network createWithLoad() { .setX(10) .add(); - network.getDanglingLine("dl1").setP0(91); + network.getBoundaryLine("bl1").setP0(91); return network; } @@ -322,7 +322,7 @@ public static Network createWithTieLine() { .setVoltageRegulatorOn(true) .add(); - DanglingLine dl1 = vl1.newDanglingLine() + BoundaryLine bl1 = vl1.newBoundaryLine() .setBus("b1") .setId("h1") .setR(0.0) @@ -331,7 +331,7 @@ public static Network createWithTieLine() { .setP0(0.0) .setQ0(0.0) .add(); - DanglingLine dl3 = vl3.newDanglingLine() + BoundaryLine bl3 = vl3.newBoundaryLine() .setBus("b3") .setId("h2") .setR(0.0) @@ -343,8 +343,8 @@ public static Network createWithTieLine() { network.newTieLine() .setId("t12") - .setDanglingLine1(dl1.getId()) - .setDanglingLine2(dl3.getId()) + .setBoundaryLine1(bl1.getId()) + .setBoundaryLine2(bl3.getId()) .add(); network.newLine() @@ -362,7 +362,7 @@ public static Network createWithTwoTieLines() { Network network = createWithTieLine(); - DanglingLine dl1 = network.getVoltageLevel("vl1").newDanglingLine() + BoundaryLine bl1 = network.getVoltageLevel("vl1").newBoundaryLine() .setBus("b1") .setId("h1bis") .setR(0.0) @@ -371,7 +371,7 @@ public static Network createWithTwoTieLines() { .setP0(0.0) .setQ0(0.0) .add(); - DanglingLine dl3 = network.getVoltageLevel("vl3").newDanglingLine() + BoundaryLine bl3 = network.getVoltageLevel("vl3").newBoundaryLine() .setBus("b3") .setId("h2bis") .setR(0.0) @@ -383,8 +383,8 @@ public static Network createWithTwoTieLines() { network.newTieLine() .setId("t12bis") - .setDanglingLine1(dl1.getId()) - .setDanglingLine2(dl3.getId()) + .setBoundaryLine1(bl1.getId()) + .setBoundaryLine2(bl3.getId()) .add(); return network; @@ -396,7 +396,7 @@ public static Network createWithTwoTieLines() { * g1 */ public static Network createWithoutLoads() { - Network network = Network.create("dl", "test"); + Network network = Network.create("bl", "test"); Substation s1 = network.newSubstation() .setId("S1") .add(); diff --git a/src/test/java/com/powsybl/openloadflow/network/DoubleBusNetworkFactory.java b/src/test/java/com/powsybl/openloadflow/network/DoubleBusNetworkFactory.java index 951592712c..d30b55e4b7 100644 --- a/src/test/java/com/powsybl/openloadflow/network/DoubleBusNetworkFactory.java +++ b/src/test/java/com/powsybl/openloadflow/network/DoubleBusNetworkFactory.java @@ -22,8 +22,8 @@ private DoubleBusNetworkFactory() { /** * vl1 : 400 kv Double bus Voltage Level * vlgens : 20 kv Two separated bus with a generator each and a tranformer connected to VL1 - * One of the generators is connected also to a dangling transformer and - * monitors voltage on the dangling terminal + * One of the generators is connected also to a boundary transformer and + * monitors voltage on the boundary terminal * vlload : 63 kV. A load connected by a transformer to vl1 * @return */ @@ -98,7 +98,7 @@ public static Network create() { } private static void createGenerator(AtomicInteger node, String suffix, Substation substation, VoltageLevel vlGens, - VoltageLevel vl, BusbarSection bbs1, BusbarSection bbs2, boolean withDanglingControlTerminal) { + VoltageLevel vl, BusbarSection bbs1, BusbarSection bbs2, boolean withBoundaryControlTerminal) { BusbarSection bbsgen = vlGens.getNodeBreakerView() .newBusbarSection() @@ -142,23 +142,23 @@ private static void createGenerator(AtomicInteger node, String suffix, Substatio .setNode2(bbsgen.getTerminal().getNodeBreakerView().getNode()) .add(); - if (withDanglingControlTerminal) { - TwoWindingsTransformer twDangling = substation.newTwoWindingsTransformer() + if (withBoundaryControlTerminal) { + TwoWindingsTransformer twBoundary = substation.newTwoWindingsTransformer() .setVoltageLevel1(vl.getId()) .setNode1(node.incrementAndGet()) .setVoltageLevel2(vlGens.getId()) .setNode2(node.incrementAndGet()) - .setId("twg" + suffix + "_dangling") + .setId("twg" + suffix + "_boundary") .setR(0) .setX(0.1) .add(); vlGens.getNodeBreakerView().newInternalConnection() - .setNode1(twDangling.getTerminal(vlGens.getId()).getNodeBreakerView().getNode()) + .setNode1(twBoundary.getTerminal(vlGens.getId()).getNodeBreakerView().getNode()) .setNode2(bbsgen.getTerminal().getNodeBreakerView().getNode()) .add(); - g.setRegulatingTerminal(twDangling.getTerminal1()); + g.setRegulatingTerminal(twBoundary.getTerminal1()); } vl.getNodeBreakerView().newSwitch() diff --git a/src/test/java/com/powsybl/openloadflow/network/LfNetworkTest.java b/src/test/java/com/powsybl/openloadflow/network/LfNetworkTest.java index 5685354652..ce963e7454 100644 --- a/src/test/java/com/powsybl/openloadflow/network/LfNetworkTest.java +++ b/src/test/java/com/powsybl/openloadflow/network/LfNetworkTest.java @@ -12,7 +12,7 @@ import com.powsybl.commons.test.ComparisonUtils; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.HvdcAngleDroopActivePowerControlAdder; -import com.powsybl.iidm.network.test.DanglingLineNetworkFactory; +import com.powsybl.iidm.network.test.BoundaryLineNetworkFactory; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import com.powsybl.iidm.network.test.PhaseShifterTestCaseFactory; import com.powsybl.loadflow.LoadFlow; @@ -121,13 +121,13 @@ void getBranchByIdtest() { } @Test - void testDanglingLine() { - Network network = DanglingLineNetworkFactory.create(); + void testBoundaryLine() { + Network network = BoundaryLineNetworkFactory.create(); List lfNetworks = Networks.load(network, new MostMeshedSlackBusSelector()); assertEquals(1, lfNetworks.size()); LfNetwork lfNetwork = lfNetworks.get(0); - assertFalse(lfNetwork.getBusById("DL_BUS").isDisabled()); - assertTrue(lfNetwork.getBusById("DL_BUS").createBusResults().isEmpty()); + assertFalse(lfNetwork.getBusById("BL_BUS").isDisabled()); + assertTrue(lfNetwork.getBusById("BL_BUS").createBusResults().isEmpty()); } @Test diff --git a/src/test/java/com/powsybl/openloadflow/network/MultiAreaNetworkFactory.java b/src/test/java/com/powsybl/openloadflow/network/MultiAreaNetworkFactory.java index 9291dd44da..07af13b110 100644 --- a/src/test/java/com/powsybl/openloadflow/network/MultiAreaNetworkFactory.java +++ b/src/test/java/com/powsybl/openloadflow/network/MultiAreaNetworkFactory.java @@ -242,10 +242,10 @@ public static Network createTwoAreasWithTwoXNodes() { * <--------------------------------> <-------------------> * Area 1 Area 2 */ - public static Network createTwoAreasWithDanglingLine() { + public static Network createTwoAreasWithBoundaryLine() { Network network = createTwoAreasWithXNode(); VoltageLevel vl2 = network.getVoltageLevel("vl2"); - vl2.newDanglingLine() + vl2.newBoundaryLine() .setId("dl1") .setConnectableBus("b2") .setBus("b2") @@ -264,7 +264,7 @@ public static Network createTwoAreasWithDanglingLine() { .add(); Area a1 = network.getArea("a1"); a1.newAreaBoundary() - .setBoundary(network.getDanglingLine("dl1").getBoundary()) + .setBoundary(network.getBoundaryLine("dl1").getBoundary()) .setAc(true) .add(); return network; @@ -282,7 +282,7 @@ public static Network createTwoAreasWithDanglingLine() { public static Network createTwoAreasWithTieLine() { Network network = createTwoAreasBase(); VoltageLevel vl2 = network.getVoltageLevel("vl2"); - DanglingLine dl1 = vl2.newDanglingLine() + BoundaryLine dl1 = vl2.newBoundaryLine() .setId("dl1") .setConnectableBus("b2") .setBus("b2") @@ -295,7 +295,7 @@ public static Network createTwoAreasWithTieLine() { .setPairingKey("tlA1A2") .add(); VoltageLevel vl3 = network.getVoltageLevel("vl3"); - DanglingLine dl2 = vl3.newDanglingLine() + BoundaryLine dl2 = vl3.newBoundaryLine() .setId("dl2") .setConnectableBus("b3") .setBus("b3") @@ -310,8 +310,8 @@ public static Network createTwoAreasWithTieLine() { network.newTieLine() .setId("tl1") .setName("Tie Line A1-A2") - .setDanglingLine1("dl1") - .setDanglingLine2("dl2") + .setBoundaryLine1("dl1") + .setBoundaryLine2("dl2") .add(); network.getArea("a1") .newAreaBoundary() @@ -346,7 +346,7 @@ public static Network createTwoAreasWithTieLine() { public static Network createTwoAreasWithUnconsideredTieLine() { Network network = createTwoAreasWithTieLine(); VoltageLevel vl2 = network.getVoltageLevel("vl2"); - vl2.newDanglingLine() + vl2.newBoundaryLine() .setId("dlA1_1") .setConnectableBus("b2") .setBus("b2") @@ -371,7 +371,7 @@ public static Network createTwoAreasWithUnconsideredTieLine() { .setMaxP(30) .setVoltageRegulatorOn(true) .add(); - vl5.newDanglingLine() + vl5.newBoundaryLine() .setId("dlA1_2") .setConnectableBus("b5") .setBus("b5") @@ -386,8 +386,8 @@ public static Network createTwoAreasWithUnconsideredTieLine() { network.newTieLine() .setId("tl2") .setName("Tie Line A1-A2 2") - .setDanglingLine1("dlA1_1") - .setDanglingLine2("dlA1_2") + .setBoundaryLine1("dlA1_1") + .setBoundaryLine2("dlA1_2") .add(); network.getArea("a2") .addVoltageLevel(vl5); @@ -511,8 +511,8 @@ public static Network createTenAreas() { for (int i = 0; i < 10; i++) { Bus b = createBus(network, "b" + i); - DanglingLine dl0 = createDanglingLine(b, "dlb" + i + "_0", 0.1, 0, 0); - DanglingLine dl1 = createDanglingLine(b, "dlb" + i + "_1", 0.1, 0, 0); + BoundaryLine dl0 = createBoundaryLine(b, "dlb" + i + "_0", 0.1, 0, 0); + BoundaryLine dl1 = createBoundaryLine(b, "dlb" + i + "_1", 0.1, 0, 0); dl0.setPairingKey("key_" + i); int key1 = i == 9 ? 0 : i + 1; dl1.setPairingKey("key_" + key1); @@ -537,12 +537,12 @@ public static Network createTenAreas() { .add(); } - network.getDanglingLineStream() - .collect(Collectors.groupingBy(DanglingLine::getPairingKey)) + network.getBoundaryLineStream() + .collect(Collectors.groupingBy(BoundaryLine::getPairingKey)) .forEach((key, value) -> network.newTieLine() .setId(key).setName(key) - .setDanglingLine1(value.get(0).getId()) - .setDanglingLine2(value.get(1).getId()) + .setBoundaryLine1(value.get(0).getId()) + .setBoundaryLine2(value.get(1).getId()) .add()); return network; diff --git a/src/test/java/com/powsybl/openloadflow/network/OriginalIdsTest.java b/src/test/java/com/powsybl/openloadflow/network/OriginalIdsTest.java index a642b1ed9e..7a2e8ff356 100644 --- a/src/test/java/com/powsybl/openloadflow/network/OriginalIdsTest.java +++ b/src/test/java/com/powsybl/openloadflow/network/OriginalIdsTest.java @@ -39,9 +39,9 @@ void testWithBoundaryNetwork() { LfNetwork lfNetwork = LfNetwork.load(network, new LfNetworkLoaderImpl(), new FirstSlackBusSelector()).get(0); assertEquals(List.of("l1"), lfNetwork.getBranchById("l1").getOriginalIds()); assertEquals(LfBranch.BranchType.LINE, lfNetwork.getBranchById("l1").getBranchType()); - assertEquals(List.of("dl1"), lfNetwork.getBranchById("dl1").getOriginalIds()); - assertEquals(LfBranch.BranchType.DANGLING_LINE, lfNetwork.getBranchById("dl1").getBranchType()); - assertEquals(List.of("dl1"), lfNetwork.getBusById("dl1_BUS").getOriginalIds()); - assertEquals("dl1", lfNetwork.getGeneratorById("dl1_GEN").getOriginalId()); + assertEquals(List.of("bl1"), lfNetwork.getBranchById("bl1").getOriginalIds()); + assertEquals(LfBranch.BranchType.BOUNDARY_LINE, lfNetwork.getBranchById("bl1").getBranchType()); + assertEquals(List.of("bl1"), lfNetwork.getBusById("bl1_BUS").getOriginalIds()); + assertEquals("bl1", lfNetwork.getGeneratorById("bl1_GEN").getOriginalId()); } } diff --git a/src/test/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImplTest.java b/src/test/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImplTest.java index 054a23f63c..c173a87ab7 100644 --- a/src/test/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImplTest.java +++ b/src/test/java/com/powsybl/openloadflow/network/impl/LfNetworkLoaderImplTest.java @@ -11,7 +11,7 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.ActivePowerControlAdder; -import com.powsybl.iidm.network.test.DanglingLineNetworkFactory; +import com.powsybl.iidm.network.test.BoundaryLineNetworkFactory; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import com.powsybl.iidm.network.test.ThreeWindingsTransformerNetworkFactory; import com.powsybl.openloadflow.network.*; @@ -130,16 +130,16 @@ void generatorNotStartedTest2() { } @Test - void networkWithDanglingLineTest() { - network = DanglingLineNetworkFactory.create(); + void networkWithBoundaryLineTest() { + network = BoundaryLineNetworkFactory.create(); List lfNetworks = Networks.load(network, new FirstSlackBusSelector()); assertEquals(1, lfNetworks.size()); LfNetwork mainNetwork = lfNetworks.get(0); - LfBus lfDanglingLineBus = mainNetwork.getBusById("DL_BUS"); - assertTrue(lfDanglingLineBus instanceof LfDanglingLineBus); - assertEquals("VL", lfDanglingLineBus.getVoltageLevelId()); - assertNull(lfDanglingLineBus.getViolationLocation()); + LfBus lfBoundaryLineBus = mainNetwork.getBusById("BL_BUS"); + assertTrue(lfBoundaryLineBus instanceof LfBoundaryLineBus); + assertEquals("VL", lfBoundaryLineBus.getVoltageLevelId()); + assertNull(lfBoundaryLineBus.getViolationLocation()); } @Test @@ -234,8 +234,8 @@ void defaultMethodsTest2() { assertEquals(1, lfNetworks.size()); LfNetwork mainNetwork = lfNetworks.get(0); - LfBus lfDanglingLineBus = mainNetwork.getBusById("dl1_BUS"); - LfGenerator generator = lfDanglingLineBus.getGenerators().get(0); + LfBus lfBoundaryLineBus = mainNetwork.getBusById("bl1_BUS"); + LfGenerator generator = lfBoundaryLineBus.getGenerators().get(0); assertEquals(0, generator.getDroop(), 10E-3); generator.setParticipating(true); assertFalse(generator.isParticipating()); @@ -284,7 +284,7 @@ void validationLevelTest4() { void validationLevelTest5() { network = BoundaryFactory.create(); network.setMinimumAcceptableValidationLevel(ValidationLevel.EQUIPMENT); - network.getDanglingLine("dl1").setP0(Double.NaN).setQ0(Double.NaN); + network.getBoundaryLine("bl1").setP0(Double.NaN).setQ0(Double.NaN); PowsyblException e = assertThrows(PowsyblException.class, () -> Networks.load(network, new FirstSlackBusSelector())); assertEquals("Only STEADY STATE HYPOTHESIS validation level of the network is supported", e.getMessage()); } diff --git a/src/test/java/com/powsybl/openloadflow/sa/LimitReductionManagerTest.java b/src/test/java/com/powsybl/openloadflow/sa/LimitReductionManagerTest.java index 791614a7aa..9ce565f6da 100644 --- a/src/test/java/com/powsybl/openloadflow/sa/LimitReductionManagerTest.java +++ b/src/test/java/com/powsybl/openloadflow/sa/LimitReductionManagerTest.java @@ -184,8 +184,8 @@ void unsupportedNetworkElementCriteriaTest() { LimitReduction lineCriterionReduction = LimitReduction.builder(LimitType.CURRENT, 0.9) .withNetworkElementCriteria(lineCriterion) .build(); - LimitReduction danglingLineCriterionReduction = LimitReduction.builder(LimitType.CURRENT, 0.9) - .withNetworkElementCriteria(new DanglingLineCriterion(new SingleCountryCriterion(List.of(Country.BE)), null)) + LimitReduction boundaryLineCriterionReduction = LimitReduction.builder(LimitType.CURRENT, 0.9) + .withNetworkElementCriteria(new BoundaryLineCriterion(new SingleCountryCriterion(List.of(Country.BE)), null)) .build(); LimitReduction networkElementIdListCriterionReduction = LimitReduction.builder(LimitType.CURRENT, 0.9) .withNetworkElementCriteria(new NetworkElementIdListCriterion(Set.of("Id1", "Id2"))) @@ -203,7 +203,7 @@ void unsupportedNetworkElementCriteriaTest() { .withNetworkElementCriteria(identifiableCriterion, lineCriterion) .build(); LimitReductionManager limitReductionManager = LimitReductionManager.create(List.of(lineCriterionReduction, - danglingLineCriterionReduction, networkElementIdListCriterionReduction, + boundaryLineCriterionReduction, networkElementIdListCriterionReduction, threeWindingsTransformerCriterionReduction, tieLineCriterionReduction, twoWindingsTransformerCriterionReduction, reductionWithALineCriterion)); diff --git a/src/test/java/com/powsybl/openloadflow/sa/OpenSecurityAnalysisTest.java b/src/test/java/com/powsybl/openloadflow/sa/OpenSecurityAnalysisTest.java index 7e00b2d12b..7af0db048b 100644 --- a/src/test/java/com/powsybl/openloadflow/sa/OpenSecurityAnalysisTest.java +++ b/src/test/java/com/powsybl/openloadflow/sa/OpenSecurityAnalysisTest.java @@ -477,10 +477,10 @@ void testSaWithStateMonitorDisconnectBranch() { } @Test - void testSaWithStateMonitorDanglingLine() { + void testSaWithStateMonitorBoundaryLine() { Network network = BoundaryFactory.createWithLoad(); List monitors = new ArrayList<>(); - monitors.add(new StateMonitor(ContingencyContext.all(), Collections.singleton("dl1"), Collections.singleton("vl1"), emptySet())); + monitors.add(new StateMonitor(ContingencyContext.all(), Collections.singleton("bl1"), Collections.singleton("vl1"), emptySet())); List contingencies = List.of(new Contingency("contingency", new LoadContingency("load3"))); SecurityAnalysisParameters securityAnalysisParameters = new SecurityAnalysisParameters(); OpenLoadFlowParameters openLoadFlowParameters = new OpenLoadFlowParameters(); @@ -488,7 +488,7 @@ void testSaWithStateMonitorDanglingLine() { securityAnalysisParameters.getLoadFlowParameters().addExtension(OpenLoadFlowParameters.class, openLoadFlowParameters); SecurityAnalysisResult result = runSecurityAnalysis(network, contingencies, monitors, securityAnalysisParameters, Collections.emptyList(), Collections.emptyList(), ReportNode.NO_OP); - BranchResult preContingencyBranchResult = result.getPreContingencyResult().getNetworkResult().getBranchResult("dl1"); + BranchResult preContingencyBranchResult = result.getPreContingencyResult().getNetworkResult().getBranchResult("bl1"); assertEquals(Double.NaN, preContingencyBranchResult.getFlowTransfer(), LoadFlowAssert.DELTA_POWER); assertEquals(91.294, preContingencyBranchResult.getP1(), LoadFlowAssert.DELTA_POWER); assertEquals(-91.000, preContingencyBranchResult.getP2(), LoadFlowAssert.DELTA_POWER); @@ -496,7 +496,7 @@ void testSaWithStateMonitorDanglingLine() { assertEquals(260.970, preContingencyBranchResult.getI2(), LoadFlowAssert.DELTA_POWER); assertEquals(149.751, preContingencyBranchResult.getQ1(), LoadFlowAssert.DELTA_POWER); assertEquals(-150.000, preContingencyBranchResult.getQ2(), LoadFlowAssert.DELTA_POWER); - BranchResult postContingencyBranchResult = getPostContingencyResult(result, "contingency").getNetworkResult().getBranchResult("dl1"); + BranchResult postContingencyBranchResult = getPostContingencyResult(result, "contingency").getNetworkResult().getBranchResult("bl1"); assertEquals(Double.NaN, postContingencyBranchResult.getFlowTransfer(), LoadFlowAssert.DELTA_POWER); assertEquals(91.294, postContingencyBranchResult.getP1(), LoadFlowAssert.DELTA_POWER); assertEquals(-91.000, postContingencyBranchResult.getP2(), LoadFlowAssert.DELTA_POWER); @@ -1878,17 +1878,17 @@ void testIndirectlyDisconnectedElements() { } @Test - void testDanglingLineContingency() { + void testBoundaryLineContingency() { Network network = BoundaryFactory.createWithLoad(); SecurityAnalysisParameters securityAnalysisParameters = new SecurityAnalysisParameters(); - List contingencies = List.of(new Contingency("dl1", new DanglingLineContingency("dl1"))); + List contingencies = List.of(new Contingency("bl1", new BoundaryLineContingency("bl1"))); List monitors = createAllBranchesMonitors(network); SecurityAnalysisResult result = runSecurityAnalysis(network, contingencies, monitors, securityAnalysisParameters); assertEquals(75.18, result.getPreContingencyResult().getNetworkResult().getBranchResult("l1").getP1(), LoadFlowAssert.DELTA_POWER); - var postContingencyResult = getPostContingencyResult(result, "dl1"); + var postContingencyResult = getPostContingencyResult(result, "bl1"); assertEquals(3.333, postContingencyResult.getNetworkResult().getBranchResult("l1").getP1(), LoadFlowAssert.DELTA_POWER); - assertEquals(Set.of("dl1"), postContingencyResult.getConnectivityResult().getDisconnectedElements()); + assertEquals(Set.of("bl1"), postContingencyResult.getConnectivityResult().getDisconnectedElements()); } @Test @@ -2608,15 +2608,15 @@ void testWithTieLineContingency(SecurityAnalysisParameters securityAnalysisParam assertEquals(0.002256, tieLineResultExt.getAngle1(), DELTA_ANGLE); assertEquals(0.0, tieLineResultExt.getAngle2(), DELTA_ANGLE); - Set allBranchIds = network.getDanglingLineStream(DanglingLineFilter.PAIRED).map(Identifiable::getId).collect(Collectors.toSet()); + Set allBranchIds = network.getBoundaryLineStream(BoundaryLineFilter.PAIRED).map(Identifiable::getId).collect(Collectors.toSet()); List monitors2 = List.of(new StateMonitor(ContingencyContext.all(), allBranchIds, Collections.emptySet(), Collections.emptySet())); SecurityAnalysisResult result2 = runSecurityAnalysis(network, contingencies, monitors2, securityAnalysisParameters); - BranchResult dl1Result = result2.getPreContingencyResult().getNetworkResult().getBranchResult("h1"); - assertEquals(35.0, dl1Result.getP1(), DELTA_POWER); - assertEquals(Double.NaN, dl1Result.getP2()); - BranchResult dl2Result = result2.getPreContingencyResult().getNetworkResult().getBranchResult("h2"); - assertEquals(-35.0, dl2Result.getP1(), DELTA_POWER); - assertEquals(Double.NaN, dl2Result.getP2()); + BranchResult bl1Result = result2.getPreContingencyResult().getNetworkResult().getBranchResult("h1"); + assertEquals(35.0, bl1Result.getP1(), DELTA_POWER); + assertEquals(Double.NaN, bl1Result.getP2()); + BranchResult bl2Result = result2.getPreContingencyResult().getNetworkResult().getBranchResult("h2"); + assertEquals(-35.0, bl2Result.getP1(), DELTA_POWER); + assertEquals(Double.NaN, bl2Result.getP2()); } @Test @@ -2624,7 +2624,7 @@ void testDuplicatedNetworkResultsIssueWithTieLineContingency() { Network network = BoundaryFactory.createWithTieLine(); SecurityAnalysisParameters securityAnalysisParameters = new SecurityAnalysisParameters(); securityAnalysisParameters.addExtension(OpenSecurityAnalysisParameters.class, new OpenSecurityAnalysisParameters().setCreateResultExtension(true)); - Set allBranchIds = network.getDanglingLineStream(DanglingLineFilter.PAIRED).map(Identifiable::getId).collect(Collectors.toSet()); + Set allBranchIds = network.getBoundaryLineStream(BoundaryLineFilter.PAIRED).map(Identifiable::getId).collect(Collectors.toSet()); List monitors = List.of(new StateMonitor(ContingencyContext.all(), allBranchIds, Collections.emptySet(), Collections.emptySet())); List contingencies = List.of(Contingency.branch("l34")); SecurityAnalysisResult result = runSecurityAnalysis(network, contingencies, monitors, securityAnalysisParameters); @@ -2637,9 +2637,9 @@ void testDuplicatedNetworkResultsIssueWithTieLineContingency() { @Test void testWithTieLineContingency2() { - // using one of the two dangling line ids. + // using one of the two boundary line ids. Network network = BoundaryFactory.createWithTieLine(); - List contingencies = List.of(new Contingency("contingency", List.of(new DanglingLineContingency("h1")))); + List contingencies = List.of(new Contingency("contingency", List.of(new BoundaryLineContingency("h1")))); List monitors = createNetworkMonitors(network); SecurityAnalysisParameters securityAnalysisParameters = new SecurityAnalysisParameters(); SecurityAnalysisResult result = runSecurityAnalysis(network, contingencies, monitors, securityAnalysisParameters); @@ -2728,8 +2728,8 @@ void testAcceptableDurations(SecurityAnalysisParameters securityAnalysisParamete ContingenciesProvider contingencies = n -> ImmutableList.of( new Contingency("contingency1", new BranchContingency("NHV1_NHV2_1")), new Contingency("contingency2", new TieLineContingency("NHV1_NHV2_2")), - new Contingency("contingency3", new DanglingLineContingency("NHV1_XNODE1")), - new Contingency("contingency4", new DanglingLineContingency("XNODE2_NHV2"))); + new Contingency("contingency3", new BoundaryLineContingency("NHV1_XNODE1")), + new Contingency("contingency4", new BoundaryLineContingency("XNODE2_NHV2"))); SecurityAnalysisResult result = runSecurityAnalysis(network, contingencies.getContingencies(network), Collections.emptyList(), securityAnalysisParameters); LimitViolation violation0 = new LimitViolation("NHV1_NHV2_2", null, LimitViolationType.CURRENT, "20'", @@ -4787,7 +4787,7 @@ void testDoubleBus() { .getBusbarSectionStream() .map(bbs -> Contingency.busbarSection(bbs.getId())).toList(); - List monitors = List.of(new StateMonitor(ContingencyContext.all(), Set.of("twg2", "twg2_dangling"), Collections.emptySet(), Collections.emptySet())); + List monitors = List.of(new StateMonitor(ContingencyContext.all(), Set.of("twg2", "twg2_boundary"), Collections.emptySet(), Collections.emptySet())); // The fact that a generators control voltage on a node that is disconneced should no longer trigger an exception SecurityAnalysisResult result = assertDoesNotThrow(() -> runSecurityAnalysis(network, contingencies, monitors)); @@ -4797,7 +4797,7 @@ void testDoubleBus() { // g2 is PQ although supposed to be in voltage control - Q is determined by the sum of Q entering in the two transfomers connected to g2 assertTrue(g2.isVoltageRegulatorOn()); assertEquals(1.23, - result.getPreContingencyResult().getNetworkResult().getBranchResult("twg2").getQ2() + result.getPreContingencyResult().getNetworkResult().getBranchResult("twg2_dangling").getQ2(), + result.getPreContingencyResult().getNetworkResult().getBranchResult("twg2").getQ2() + result.getPreContingencyResult().getNetworkResult().getBranchResult("twg2_boundary").getQ2(), DELTA_POWER); assertEquals(2, result.getPostContingencyResults().size()); @@ -4805,7 +4805,7 @@ void testDoubleBus() { result.getPostContingencyResults().forEach(r -> { assertEquals(PostContingencyComputationStatus.CONVERGED, r.getStatus()); assertEquals(1.23, - r.getNetworkResult().getBranchResult("twg2").getQ2() + r.getNetworkResult().getBranchResult("twg2_dangling").getQ2(), + r.getNetworkResult().getBranchResult("twg2").getQ2() + r.getNetworkResult().getBranchResult("twg2_boundary").getQ2(), DELTA_POWER); }); } diff --git a/src/test/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysisTest.java b/src/test/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysisTest.java index d99c7b5227..c9bdb35846 100644 --- a/src/test/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysisTest.java +++ b/src/test/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysisTest.java @@ -513,7 +513,7 @@ protected void testBranchNotFound(boolean dc) { .setParameters(sensiParameters); CompletionException e = assertThrows(CompletionException.class, () -> sensiRunner.run(network, factors, runParameters)); assertTrue(e.getCause() instanceof PowsyblException); - assertEquals("Branch, tie line, dangling line or leg of 'b' not found", e.getCause().getMessage()); + assertEquals("Branch, tie line, boundary line or leg of 'b' not found", e.getCause().getMessage()); } protected void testEmptyFactors(boolean dc) { diff --git a/src/test/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysisContingenciesTest.java b/src/test/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysisContingenciesTest.java index 1f324e0230..b469d5e6f7 100644 --- a/src/test/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysisContingenciesTest.java +++ b/src/test/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysisContingenciesTest.java @@ -684,7 +684,7 @@ void testContingencyPropagationLfSwitch() { } @Test - void testDanglingLineContingencyDistributedSlackOnLoads() { + void testBoundaryLineContingencyDistributedSlackOnLoads() { Network network = BoundaryFactory.createWithLoad(); SensitivityAnalysisParameters sensiParameters = createParameters(false, "vl3_0", true); @@ -692,7 +692,7 @@ void testDanglingLineContingencyDistributedSlackOnLoads() { List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "g1")); - List contingencies = List.of(new Contingency("dl1", new DanglingLineContingency("dl1"))); + List contingencies = List.of(new Contingency("bl1", new BoundaryLineContingency("bl1"))); SensitivityAnalysisRunParameters runParameters = new SensitivityAnalysisRunParameters() .setContingencies(contingencies) @@ -702,10 +702,10 @@ void testDanglingLineContingencyDistributedSlackOnLoads() { assertEquals(1, result.getPreContingencyValues().size()); assertEquals(0.3697, result.getBranchFlow1SensitivityValue("g1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_SENSITIVITY_VALUE); assertEquals(75.272, result.getBranchFlow1FunctionReferenceValue("l1"), LoadFlowAssert.DELTA_POWER); - assertEquals(0.3695, result.getBranchFlow1SensitivityValue("dl1", "g1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_SENSITIVITY_VALUE); - assertEquals(36.794, result.getBranchFlow1FunctionReferenceValue("dl1", "l1"), LoadFlowAssert.DELTA_POWER); + assertEquals(0.3695, result.getBranchFlow1SensitivityValue("bl1", "g1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_SENSITIVITY_VALUE); + assertEquals(36.794, result.getBranchFlow1FunctionReferenceValue("bl1", "l1"), LoadFlowAssert.DELTA_POWER); - network.getDanglingLine("dl1").getTerminal().disconnect(); + network.getBoundaryLine("bl1").getTerminal().disconnect(); LoadFlowParameters parameters = sensiParameters.getLoadFlowParameters(); parameters.getExtension(OpenLoadFlowParameters.class).setSlackBusPMaxMismatch(0.001); @@ -725,7 +725,7 @@ void testDanglingLineContingencyDistributedSlackOnLoads() { } @Test - void testDanglingLineContingencyDistributedSlackOnGenerators() { + void testBoundaryLineContingencyDistributedSlackOnGenerators() { Network network = BoundaryFactory.createWithLoad(); SensitivityAnalysisParameters sensiParameters = createParameters(false, "vl1_0", true); @@ -733,7 +733,7 @@ void testDanglingLineContingencyDistributedSlackOnGenerators() { List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "load3")); - List contingencies = List.of(new Contingency("dl1", new DanglingLineContingency("dl1"))); + List contingencies = List.of(new Contingency("bl1", new BoundaryLineContingency("bl1"))); SensitivityAnalysisRunParameters runParameters = new SensitivityAnalysisRunParameters() .setContingencies(contingencies) @@ -743,10 +743,10 @@ void testDanglingLineContingencyDistributedSlackOnGenerators() { assertEquals(1, result.getPreContingencyValues().size()); assertEquals(-0.3704, result.getBranchFlow1SensitivityValue("load3", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_SENSITIVITY_VALUE); assertEquals(75.336, result.getBranchFlow1FunctionReferenceValue("l1"), LoadFlowAssert.DELTA_POWER); - assertEquals(-0.3704, result.getBranchFlow1SensitivityValue("dl1", "load3", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_SENSITIVITY_VALUE); - assertEquals(3.0071, result.getBranchFlow1FunctionReferenceValue("dl1", "l1"), LoadFlowAssert.DELTA_POWER); + assertEquals(-0.3704, result.getBranchFlow1SensitivityValue("bl1", "load3", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_SENSITIVITY_VALUE); + assertEquals(3.0071, result.getBranchFlow1FunctionReferenceValue("bl1", "l1"), LoadFlowAssert.DELTA_POWER); - network.getDanglingLine("dl1").getTerminal().disconnect(); + network.getBoundaryLine("bl1").getTerminal().disconnect(); LoadFlowParameters parameters = sensiParameters.getLoadFlowParameters(); parameters.getExtension(OpenLoadFlowParameters.class).setSlackBusPMaxMismatch(0.001); diff --git a/src/test/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysisTest.java b/src/test/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysisTest.java index 7ed8aaa343..2e0c94a456 100644 --- a/src/test/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysisTest.java +++ b/src/test/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysisTest.java @@ -13,7 +13,7 @@ import com.powsybl.computation.local.LocalComputationManager; import com.powsybl.contingency.Contingency; import com.powsybl.contingency.ContingencyContext; -import com.powsybl.contingency.DanglingLineContingency; +import com.powsybl.contingency.BoundaryLineContingency; import com.powsybl.contingency.LineContingency; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.HvdcAngleDroopActivePowerControlAdder; @@ -1434,36 +1434,36 @@ void testEmptyFactors() { } @Test - void testDanglingLineSensi() { + void testBoundaryLineSensi() { Network network = BoundaryFactory.createWithLoad(); runAcLf(network); SensitivityAnalysisParameters sensiParameters = createParameters(false, "vl1_0"); - List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "dl1"), - createBranchFlowPerInjectionIncrease("dl1", "dl1"), - createBranchIntensityPerInjectionIncrease("dl1", "load3")); + List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "bl1"), + createBranchFlowPerInjectionIncrease("bl1", "bl1"), + createBranchIntensityPerInjectionIncrease("bl1", "load3")); SensitivityAnalysisRunParameters runParameters = new SensitivityAnalysisRunParameters() .setParameters(sensiParameters); - // dangling line is connected + // boundary line is connected SensitivityAnalysisResult result = sensiRunner.run(network, factors, runParameters); - assertEquals(-0.903d, result.getBranchFlow1SensitivityValue("dl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - assertEquals(91.293, result.getBranchFlow1FunctionReferenceValue("dl1"), LoadFlowAssert.DELTA_POWER); - assertEquals(-1.001d, result.getBranchFlow1SensitivityValue("dl1", "dl1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - assertEquals(260.51, result.getBranchCurrent1FunctionReferenceValue("dl1"), LoadFlowAssert.DELTA_I); + assertEquals(-0.903d, result.getBranchFlow1SensitivityValue("bl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(91.293, result.getBranchFlow1FunctionReferenceValue("bl1"), LoadFlowAssert.DELTA_POWER); + assertEquals(-1.001d, result.getBranchFlow1SensitivityValue("bl1", "bl1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(260.51, result.getBranchCurrent1FunctionReferenceValue("bl1"), LoadFlowAssert.DELTA_I); - // dangling line is connected on base case but will be disconnected by a contingency => 0 - List contingencies = List.of(new Contingency("c", new DanglingLineContingency("dl1"))); + // boundary line is connected on base case but will be disconnected by a contingency => 0 + List contingencies = List.of(new Contingency("c", new BoundaryLineContingency("bl1"))); runParameters.setContingencies(contingencies); result = sensiRunner.run(network, factors, runParameters); - assertEquals(-0.903d, result.getBranchFlow1SensitivityValue("dl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - assertEquals(0d, result.getBranchFlow1SensitivityValue("c", "dl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(-0.903d, result.getBranchFlow1SensitivityValue("bl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(0d, result.getBranchFlow1SensitivityValue("c", "bl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - // dangling line is disconnected on base case => 0 - network.getDanglingLine("dl1").getTerminal().disconnect(); + // boundary line is disconnected on base case => 0 + network.getBoundaryLine("bl1").getTerminal().disconnect(); runParameters.setContingencies(Collections.emptyList()); result = sensiRunner.run(network, factors, runParameters); - assertEquals(0d, result.getBranchFlow1SensitivityValue("dl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(0d, result.getBranchFlow1SensitivityValue("bl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); } @Test @@ -2099,20 +2099,20 @@ void testUnsupportedVariablesSensiV() { } @Test - void testWithTieLinesSpecifiedByDanglingLines() { + void testWithTieLinesSpecifiedByBoundaryLines() { SensitivityAnalysisParameters sensiParameters = createParameters(false, "b1_vl_0", true); sensiParameters.getLoadFlowParameters().setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX); Network network = BoundaryFactory.createWithTieLine(); //BRANCH_ACTIVE_POWER - List factors = network.getDanglingLineStream().map(line -> createBranchFlowPerInjectionIncrease(line.getId(), "g1")).collect(Collectors.toList()); + List factors = network.getBoundaryLineStream().map(line -> createBranchFlowPerInjectionIncrease(line.getId(), "g1")).collect(Collectors.toList()); factors.add(createBranchFlowPerInjectionIncrease("t12", "g1", TwoSides.ONE)); // Adding tie line BRANCH_ACTIVE_POWER_1 factors.add(createBranchFlowPerInjectionIncrease("t12", "g1", null, TwoSides.TWO)); // Adding tie line BRANCH_ACTIVE_POWER_2 //BRANCH_CURRENT - factors.addAll(network.getDanglingLineStream().map(line -> createBranchIntensityPerInjectionIncrease(line.getId(), "g1")).toList()); + factors.addAll(network.getBoundaryLineStream().map(line -> createBranchIntensityPerInjectionIncrease(line.getId(), "g1")).toList()); factors.add(createBranchIntensityPerInjectionIncrease("t12", "g1", TwoSides.ONE)); // Adding tie line BRANCH_CURRENT_1 factors.add(createBranchIntensityPerInjectionIncrease("t12", "g1", TwoSides.TWO)); // Adding tie line BRANCH_CURRENT_2 //BRANCH_REACTIVE_POWER - factors.addAll(network.getDanglingLineStream().map(line -> createBranchReactivePowerPerTargetV(line.getId(), "g1")).toList()); + factors.addAll(network.getBoundaryLineStream().map(line -> createBranchReactivePowerPerTargetV(line.getId(), "g1")).toList()); factors.add(createBranchReactivePowerPerTargetV("t12", "g1", TwoSides.ONE)); // Adding tie line BRANCH_CURRENT_1 factors.add(createBranchReactivePowerPerTargetV("t12", "g1", TwoSides.TWO)); // Adding tie line BRANCH_CURRENT_2 @@ -2121,7 +2121,7 @@ void testWithTieLinesSpecifiedByDanglingLines() { SensitivityAnalysisResult result = sensiRunner.run(network, factors, runParameters); assertEquals(12, result.getValues().size()); - // Dangling line h1 side 1 and Tie line t12 side 1 should represent the same sensitivity values + // Boundary line h1 side 1 and Tie line t12 side 1 should represent the same sensitivity values assertEquals(35.0, result.getBranchFlow1FunctionReferenceValue("h1"), LoadFlowAssert.DELTA_POWER); assertEquals(35.0, result.getBranchFlow1FunctionReferenceValue("t12"), LoadFlowAssert.DELTA_POWER); assertEquals(0.5, result.getBranchFlow1SensitivityValue("g1", "h1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); @@ -2135,7 +2135,7 @@ void testWithTieLinesSpecifiedByDanglingLines() { assertEquals(338.983, result.getSensitivityValue("g1", "h1", SensitivityFunctionType.BRANCH_REACTIVE_POWER_1, SensitivityVariableType.BUS_TARGET_VOLTAGE), LoadFlowAssert.DELTA_POWER); assertEquals(338.983, result.getSensitivityValue("g1", "t12", SensitivityFunctionType.BRANCH_REACTIVE_POWER_1, SensitivityVariableType.BUS_TARGET_VOLTAGE), LoadFlowAssert.DELTA_POWER); - // Dangling line h2 side 1 and Tie line t12 side 2 should represent the same sensitivity values + // Boundary line h2 side 1 and Tie line t12 side 2 should represent the same sensitivity values assertEquals(-35.0, result.getBranchFlow1FunctionReferenceValue("h2"), LoadFlowAssert.DELTA_POWER); assertEquals(-35.0, result.getBranchFlow2FunctionReferenceValue("t12"), LoadFlowAssert.DELTA_POWER); assertEquals(-0.5, result.getBranchFlow1SensitivityValue("g1", "h2", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); @@ -2184,10 +2184,10 @@ void testComputationInterrupted() { SensitivityAnalysisParameters sensiParameters = createParameters(false, "vl1_0"); - List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "dl1"), - createBranchFlowPerInjectionIncrease("dl1", "load3")); + List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "bl1"), + createBranchFlowPerInjectionIncrease("bl1", "load3")); - List contingencies = List.of(new Contingency("c", new DanglingLineContingency("dl1"))); + List contingencies = List.of(new Contingency("c", new BoundaryLineContingency("bl1"))); AcSensitivityAnalysis analysis = new AcSensitivityAnalysis(new SparseMatrixFactory(), new EvenShiloachGraphDecrementalConnectivityFactory<>(), sensiParameters); diff --git a/src/test/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysisContingenciesTest.java b/src/test/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysisContingenciesTest.java index 6e48c4b83a..ebf3396fdc 100644 --- a/src/test/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysisContingenciesTest.java +++ b/src/test/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysisContingenciesTest.java @@ -1872,7 +1872,7 @@ void testDebug() throws IOException { } @Test - void testDanglingLineContingencyDistributedSlackOnLoads() { + void testBoundaryLineContingencyDistributedSlackOnLoads() { Network network = BoundaryFactory.createWithLoad(); SensitivityAnalysisParameters sensiParameters = createParameters(true, "vl3_0", true); @@ -1880,7 +1880,7 @@ void testDanglingLineContingencyDistributedSlackOnLoads() { List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "g1")); - List contingencies = List.of(new Contingency("dl1", new DanglingLineContingency("dl1"))); + List contingencies = List.of(new Contingency("bl1", new BoundaryLineContingency("bl1"))); SensitivityAnalysisRunParameters runParameters = new SensitivityAnalysisRunParameters() .setContingencies(contingencies) @@ -1890,10 +1890,10 @@ void testDanglingLineContingencyDistributedSlackOnLoads() { assertEquals(1, result.getPreContingencyValues().size()); assertEquals(0.1875, result.getBranchFlow1SensitivityValue("g1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); assertEquals(75.881, result.getBranchFlow1FunctionReferenceValue("l1"), LoadFlowAssert.DELTA_POWER); - assertEquals(0.1875, result.getBranchFlow1SensitivityValue("dl1", "g1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - assertEquals(19.006, result.getBranchFlow1FunctionReferenceValue("dl1", "l1"), LoadFlowAssert.DELTA_POWER); + assertEquals(0.1875, result.getBranchFlow1SensitivityValue("bl1", "g1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(19.006, result.getBranchFlow1FunctionReferenceValue("bl1", "l1"), LoadFlowAssert.DELTA_POWER); - network.getDanglingLine("dl1").getTerminal().disconnect(); + network.getBoundaryLine("bl1").getTerminal().disconnect(); Line l1 = network.getLine("l1"); runLf(network, sensiParameters.getLoadFlowParameters(), ReportNode.NO_OP); double initialP = l1.getTerminal1().getP(); @@ -1906,7 +1906,7 @@ void testDanglingLineContingencyDistributedSlackOnLoads() { } @Test - void testDanglingLineContingencyDistributedSlackOnGenerators() { + void testBoundaryLineContingencyDistributedSlackOnGenerators() { Network network = BoundaryFactory.createWithLoad(); SensitivityAnalysisParameters sensiParameters = createParameters(true, "vl3_0", true); @@ -1914,7 +1914,7 @@ void testDanglingLineContingencyDistributedSlackOnGenerators() { List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "load3")); - List contingencies = List.of(new Contingency("dl1", new DanglingLineContingency("dl1"))); + List contingencies = List.of(new Contingency("bl1", new BoundaryLineContingency("bl1"))); SensitivityAnalysisRunParameters runParameters = new SensitivityAnalysisRunParameters() .setContingencies(contingencies) @@ -1924,10 +1924,10 @@ void testDanglingLineContingencyDistributedSlackOnGenerators() { assertEquals(1, result2.getPreContingencyValues().size()); assertEquals(-0.1874, result2.getBranchFlow1SensitivityValue("load3", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); assertEquals(75.813, result2.getBranchFlow1FunctionReferenceValue("l1"), LoadFlowAssert.DELTA_POWER); - assertEquals(-0.1875, result2.getBranchFlow1SensitivityValue("dl1", "load3", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - assertEquals(1.875, result2.getBranchFlow1FunctionReferenceValue("dl1", "l1"), LoadFlowAssert.DELTA_POWER); + assertEquals(-0.1875, result2.getBranchFlow1SensitivityValue("bl1", "load3", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(1.875, result2.getBranchFlow1FunctionReferenceValue("bl1", "l1"), LoadFlowAssert.DELTA_POWER); - network.getDanglingLine("dl1").getTerminal().disconnect(); + network.getBoundaryLine("bl1").getTerminal().disconnect(); Line l1 = network.getLine("l1"); runLf(network, sensiParameters.getLoadFlowParameters(), ReportNode.NO_OP); double initialP = l1.getTerminal1().getP(); diff --git a/src/test/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysisTest.java b/src/test/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysisTest.java index 04574ee6fa..5163136e95 100644 --- a/src/test/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysisTest.java +++ b/src/test/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysisTest.java @@ -13,7 +13,7 @@ import com.powsybl.contingency.BranchContingency; import com.powsybl.contingency.Contingency; import com.powsybl.contingency.ContingencyContext; -import com.powsybl.contingency.DanglingLineContingency; +import com.powsybl.contingency.BoundaryLineContingency; import com.powsybl.contingency.GeneratorContingency; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.HvdcAngleDroopActivePowerControlAdder; @@ -922,34 +922,34 @@ void testGlskNotFound() { } @Test - void testDanglingLineSensi() { + void testBoundaryLineSensi() { Network network = BoundaryFactory.createWithLoad(); runAcLf(network); SensitivityAnalysisParameters sensiParameters = createParameters(true, "vl1_0"); - List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "dl1"), - createBranchFlowPerInjectionIncrease("dl1", "load3")); + List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "bl1"), + createBranchFlowPerInjectionIncrease("bl1", "load3")); - // dangling line is connected + // boundary line is connected SensitivityAnalysisRunParameters runParameters = new SensitivityAnalysisRunParameters() .setParameters(sensiParameters); SensitivityAnalysisResult result = sensiRunner.run(network, factors, runParameters); - assertEquals(-0.812d, result.getBranchFlow1SensitivityValue("dl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - assertEquals(91.0, result.getBranchFlow1FunctionReferenceValue("dl1"), LoadFlowAssert.DELTA_POWER); + assertEquals(-0.812d, result.getBranchFlow1SensitivityValue("bl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(91.0, result.getBranchFlow1FunctionReferenceValue("bl1"), LoadFlowAssert.DELTA_POWER); - // dangling line is connected on base case but will be disconnected by a contingency => 0 - List contingencies = List.of(new Contingency("c", new DanglingLineContingency("dl1"))); + // boundary line is connected on base case but will be disconnected by a contingency => 0 + List contingencies = List.of(new Contingency("c", new BoundaryLineContingency("bl1"))); runParameters.setContingencies(contingencies); result = sensiRunner.run(network, factors, runParameters); - assertEquals(-0.812d, result.getBranchFlow1SensitivityValue("dl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - assertEquals(0d, result.getBranchFlow1SensitivityValue("c", "dl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(-0.812d, result.getBranchFlow1SensitivityValue("bl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(0d, result.getBranchFlow1SensitivityValue("c", "bl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - // dangling line is disconnected on base case => 0 - network.getDanglingLine("dl1").getTerminal().disconnect(); + // boundary line is disconnected on base case => 0 + network.getBoundaryLine("bl1").getTerminal().disconnect(); runParameters.setContingencies(Collections.emptyList()); result = sensiRunner.run(network, factors, runParameters); - assertEquals(0d, result.getBranchFlow1SensitivityValue("dl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); + assertEquals(0d, result.getBranchFlow1SensitivityValue("bl1", "l1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); } @Test @@ -1133,29 +1133,29 @@ void testWithTieLines() { .setParameters(sensiParameters); CompletionException e = assertThrows(CompletionException.class, () -> sensiRunner.run(network, factors, runParameters)); assertTrue(e.getCause() instanceof PowsyblException); - assertEquals("The dangling line h1 is paired: it cannot be a sensitivity variable", e.getCause().getMessage()); + assertEquals("The boundary line h1 is paired: it cannot be a sensitivity variable", e.getCause().getMessage()); } @Test - void testWithTieLinesWrongDanglingLine() { + void testWithTieLinesWrongBoundaryLine() { SensitivityAnalysisParameters sensiParameters = createParameters(true, "b1_vl_0", true); sensiParameters.getLoadFlowParameters().setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX); Network network = BoundaryFactory.createWithTieLine(); - // Specifying side 2 of dangling line as sensitivity function, which is not possible because the dangling line is paired (boundary side is not accessible) - List factors = network.getDanglingLineStream().map(line -> createBranchFlowPerInjectionIncrease(line.getId(), "g1", null, TwoSides.TWO)).collect(Collectors.toList()); + // Specifying side 2 of boundary line as sensitivity function, which is not possible because the boundary line is paired (boundary side is not accessible) + List factors = network.getBoundaryLineStream().map(line -> createBranchFlowPerInjectionIncrease(line.getId(), "g1", null, TwoSides.TWO)).collect(Collectors.toList()); SensitivityAnalysisRunParameters runParameters = new SensitivityAnalysisRunParameters() .setParameters(sensiParameters); CompletionException e = assertThrows(CompletionException.class, () -> sensiRunner.run(network, factors, runParameters)); assertTrue(e.getCause() instanceof PowsyblException); - assertEquals("Dangling line h1 is paired. Sensitivity function can only be computed on its side 1 (given type BRANCH_ACTIVE_POWER_2)", e.getCause().getMessage()); + assertEquals("Boundary line h1 is paired. Sensitivity function can only be computed on its side 1 (given type BRANCH_ACTIVE_POWER_2)", e.getCause().getMessage()); } @Test - void testWithTieLinesSpecifiedByDanglingLines() { + void testWithTieLinesSpecifiedByBoundaryLines() { SensitivityAnalysisParameters sensiParameters = createParameters(true, "b1_vl_0", true); sensiParameters.getLoadFlowParameters().setBalanceType(LoadFlowParameters.BalanceType.PROPORTIONAL_TO_GENERATION_P_MAX); Network network = BoundaryFactory.createWithTieLine(); - List factors = network.getDanglingLineStream().map(line -> createBranchFlowPerInjectionIncrease(line.getId(), "g1")).collect(Collectors.toList()); + List factors = network.getBoundaryLineStream().map(line -> createBranchFlowPerInjectionIncrease(line.getId(), "g1")).collect(Collectors.toList()); factors.add(createBranchFlowPerInjectionIncrease("t12", "g1", TwoSides.ONE)); // Adding tie line BRANCH_ACTIVE_POWER_1 factors.add(createBranchFlowPerInjectionIncrease("t12", "g1", TwoSides.TWO)); // Adding tie line BRANCH_ACTIVE_POWER_2 SensitivityAnalysisRunParameters runParameters = new SensitivityAnalysisRunParameters() @@ -1163,13 +1163,13 @@ void testWithTieLinesSpecifiedByDanglingLines() { SensitivityAnalysisResult result = sensiRunner.run(network, factors, runParameters); assertEquals(4, result.getValues().size()); - // Dangling line h1 side 1 and Tie line t12 side 1 should represent the same sensitivity values + // Boundary line h1 side 1 and Tie line t12 side 1 should represent the same sensitivity values assertEquals(35.0, result.getBranchFlow1FunctionReferenceValue("h1"), LoadFlowAssert.DELTA_POWER); assertEquals(35.0, result.getBranchFlow1FunctionReferenceValue("t12"), LoadFlowAssert.DELTA_POWER); assertEquals(0.5, result.getBranchFlow1SensitivityValue("g1", "h1", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); assertEquals(0.5, result.getBranchFlow1SensitivityValue("g1", "t12", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); - // Dangling line h2 side 1 and Tie line t12 side 2 should represent the same sensitivity values + // Boundary line h2 side 1 and Tie line t12 side 2 should represent the same sensitivity values assertEquals(-35.0, result.getBranchFlow1FunctionReferenceValue("h2"), LoadFlowAssert.DELTA_POWER); assertEquals(-35.0, result.getBranchFlow2FunctionReferenceValue("t12"), LoadFlowAssert.DELTA_POWER); assertEquals(-0.5, result.getBranchFlow1SensitivityValue("g1", "h2", SensitivityVariableType.INJECTION_ACTIVE_POWER), LoadFlowAssert.DELTA_POWER); @@ -1327,10 +1327,10 @@ void testComputationInterrupted() { SensitivityAnalysisParameters sensiParameters = createParameters(true, "vl1_0"); - List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "dl1"), - createBranchFlowPerInjectionIncrease("dl1", "load3")); + List factors = List.of(createBranchFlowPerInjectionIncrease("l1", "bl1"), + createBranchFlowPerInjectionIncrease("bl1", "load3")); - List contingencies = List.of(new Contingency("c", new DanglingLineContingency("dl1"))); + List contingencies = List.of(new Contingency("c", new BoundaryLineContingency("bl1"))); DcSensitivityAnalysis analysis = new DcSensitivityAnalysis(new SparseMatrixFactory(), new EvenShiloachGraphDecrementalConnectivityFactory<>(), sensiParameters); diff --git a/src/test/resources/contingencies.json b/src/test/resources/contingencies.json index c51d00da5e..153bd71f64 100644 --- a/src/test/resources/contingencies.json +++ b/src/test/resources/contingencies.json @@ -1,6 +1,6 @@ { "type" : "default", - "version" : "1.0", + "version" : "1.1", "name" : "", "contingencies" : [ { "id" : "L2", diff --git a/src/test/resources/debug-contingencies.json b/src/test/resources/debug-contingencies.json index 7b46a071c5..9f55b9f3e6 100644 --- a/src/test/resources/debug-contingencies.json +++ b/src/test/resources/debug-contingencies.json @@ -1,6 +1,6 @@ { "type" : "default", - "version" : "1.0", + "version" : "1.1", "name" : "default", "contingencies" : [ { "id" : "l34", diff --git a/src/test/resources/debug-network.xiidm b/src/test/resources/debug-network.xiidm index 066c80eb3d..edea9ecc9e 100644 --- a/src/test/resources/debug-network.xiidm +++ b/src/test/resources/debug-network.xiidm @@ -1,5 +1,5 @@ - +