diff --git a/src/main/java/com/powsybl/openloadflow/ac/AcOuterLoopContext.java b/src/main/java/com/powsybl/openloadflow/ac/AcOuterLoopContext.java index 19d242a240..8b95f1f6bc 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/AcOuterLoopContext.java +++ b/src/main/java/com/powsybl/openloadflow/ac/AcOuterLoopContext.java @@ -17,7 +17,9 @@ */ public class AcOuterLoopContext extends AbstractOuterLoopContext { - private int iteration; + private int iteration; // current iterations of this single outer loop type + + private int outerLoopTotalIterations; // current total iterations over all outer loop types, for reporting purposes private AcSolverResult lastSolverResult; @@ -41,4 +43,12 @@ public AcSolverResult getLastSolverResult() { public void setLastSolverResult(AcSolverResult lastSolverResult) { this.lastSolverResult = lastSolverResult; } + + public int getOuterLoopTotalIterations() { + return outerLoopTotalIterations; + } + + public void setOuterLoopTotalIterations(int outerLoopTotalIterations) { + this.outerLoopTotalIterations = outerLoopTotalIterations; + } } diff --git a/src/main/java/com/powsybl/openloadflow/ac/AcloadFlowEngine.java b/src/main/java/com/powsybl/openloadflow/ac/AcloadFlowEngine.java index 359a3c66aa..98622d89bb 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/AcloadFlowEngine.java +++ b/src/main/java/com/powsybl/openloadflow/ac/AcloadFlowEngine.java @@ -8,7 +8,6 @@ import com.google.common.collect.Lists; import com.powsybl.commons.reporter.Reporter; -import com.powsybl.commons.reporter.TypedValue; import com.powsybl.openloadflow.ac.equations.AcEquationType; import com.powsybl.openloadflow.ac.equations.AcVariableType; import com.powsybl.openloadflow.ac.solver.*; @@ -76,6 +75,7 @@ private void runOuterLoop(AcOuterLoop outerLoop, AcOuterLoopContext outerLoopCon // check outer loop status outerLoopContext.setIteration(outerLoopIteration.getValue()); + outerLoopContext.setOuterLoopTotalIterations(runningContext.outerLoopTotalIterations); outerLoopContext.setLastSolverResult(runningContext.lastSolverResult); outerLoopContext.setLoadFlowContext(context); outerLoopStatus = outerLoop.check(outerLoopContext, olReporter); @@ -90,7 +90,8 @@ private void runOuterLoop(AcOuterLoop outerLoop, AcOuterLoopContext outerLoopCon solver.getName(), context.getNetwork().getNumCC(), context.getNetwork().getNumSC(), - outerLoopIteration.toInteger() + 1, outerLoop.getName()); + runningContext.outerLoopTotalIterations + 1, + outerLoop.getName()); } // if not yet stable, restart solver @@ -104,6 +105,10 @@ private void runOuterLoop(AcOuterLoop outerLoop, AcOuterLoopContext outerLoopCon } while (outerLoopStatus == OuterLoopStatus.UNSTABLE && runningContext.lastSolverResult.getStatus() == AcSolverStatus.CONVERGED && runningContext.outerLoopTotalIterations < context.getParameters().getMaxOuterLoopIterations()); + + if (outerLoopStatus != OuterLoopStatus.STABLE) { + Reports.reportUnsuccessfulOuterLoop(olReporter, outerLoopStatus.name()); + } } @Override @@ -206,8 +211,7 @@ public AcLoadFlowResult run() { LOGGER.info("Ac loadflow complete on network {} (result={})", context.getNetwork(), result); - Reports.reportAcLfComplete(context.getNetwork().getReporter(), result.getSolverStatus().name(), - result.getSolverStatus() == AcSolverStatus.CONVERGED ? TypedValue.INFO_SEVERITY : TypedValue.ERROR_SEVERITY); + Reports.reportAcLfComplete(context.getNetwork().getReporter(), result.isSuccess(), result.getSolverStatus().name(), result.getOuterLoopStatus().name()); context.setResult(result); diff --git a/src/main/java/com/powsybl/openloadflow/ac/outerloop/AcIncrementalPhaseControlOuterLoop.java b/src/main/java/com/powsybl/openloadflow/ac/outerloop/AcIncrementalPhaseControlOuterLoop.java index a3ebb65868..f1bf16e790 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/outerloop/AcIncrementalPhaseControlOuterLoop.java +++ b/src/main/java/com/powsybl/openloadflow/ac/outerloop/AcIncrementalPhaseControlOuterLoop.java @@ -22,8 +22,9 @@ import com.powsybl.openloadflow.lf.outerloop.OuterLoopStatus; import com.powsybl.openloadflow.network.*; import com.powsybl.openloadflow.util.PerUnit; +import com.powsybl.openloadflow.util.Reports; import org.apache.commons.lang3.Range; -import org.apache.commons.lang3.mutable.MutableBoolean; +import org.apache.commons.lang3.mutable.MutableInt; import org.slf4j.LoggerFactory; import java.util.ArrayList; @@ -77,6 +78,7 @@ public DenseMatrix calculateSensitivityValues(List controllerBranches, return rhs; } + @SuppressWarnings("unchecked") private EquationTerm getI1(LfBranch controlledBranch) { return (EquationTerm) controlledBranch.getI1(); } @@ -92,9 +94,9 @@ public double calculateSensitivityFromA2I(LfBranch controllerBranch, LfBranch co } } - private boolean checkCurrentLimiterPhaseControls(AcSensitivityContext sensitivityContext, IncrementalContextData contextData, - List currentLimiterPhaseControls) { - MutableBoolean updated = new MutableBoolean(false); + private int checkCurrentLimiterPhaseControls(AcSensitivityContext sensitivityContext, IncrementalContextData contextData, + List currentLimiterPhaseControls) { + MutableInt numOfCurrentLimiterPstsThatChangedTap = new MutableInt(0); for (TransformerPhaseControl phaseControl : currentLimiterPhaseControls) { LfBranch controllerBranch = phaseControl.getControllerBranch(); @@ -116,11 +118,11 @@ private boolean checkCurrentLimiterPhaseControls(AcSensitivityContext sensitivit Range tapPositionRange = piModel.getTapPositionRange(); piModel.updateTapPositionToExceedNewA1(da, MAX_TAP_SHIFT, controllerContext.getAllowedDirection()).ifPresent(direction -> { controllerContext.updateAllowedDirection(direction); - updated.setValue(true); + numOfCurrentLimiterPstsThatChangedTap.add(1); }); if (piModel.getTapPosition() != oldTapPosition) { - logger.debug("Controller branch '{}' change tap from {} to {} to limit current (full range: {})", controllerBranch.getId(), + logger.debug("Controller branch '{}' changed tap from {} to {} to limit current (full range: {})", controllerBranch.getId(), oldTapPosition, piModel.getTapPosition(), tapPositionRange); double discreteDa = piModel.getA1() - oldA1; @@ -129,8 +131,7 @@ private boolean checkCurrentLimiterPhaseControls(AcSensitivityContext sensitivit } } } - - return updated.booleanValue(); + return numOfCurrentLimiterPstsThatChangedTap.getValue(); } private void checkImpactOnOtherPhaseShifters(AcSensitivityContext sensitivityContext, TransformerPhaseControl phaseControl, @@ -169,7 +170,6 @@ private static double computeI(TransformerPhaseControl phaseControl) { @Override public OuterLoopStatus check(AcOuterLoopContext context, Reporter reporter) { - OuterLoopStatus status = OuterLoopStatus.STABLE; var contextData = (IncrementalContextData) context.getData(); @@ -195,24 +195,43 @@ public OuterLoopStatus check(AcOuterLoopContext context, Reporter reporter) { }); } - if (!currentLimiterPhaseControls.isEmpty() || !activePowerControlPhaseControls.isEmpty()) { - var sensitivityContext = new AcSensitivityContext(network, - controllerBranches, - context.getLoadFlowContext().getEquationSystem(), - context.getLoadFlowContext().getJacobianMatrix()); - - if (!currentLimiterPhaseControls.isEmpty() - && checkCurrentLimiterPhaseControls(sensitivityContext, - contextData, - currentLimiterPhaseControls)) { - status = OuterLoopStatus.UNSTABLE; - } + OuterLoopStatus status = OuterLoopStatus.STABLE; + + if (currentLimiterPhaseControls.isEmpty() && activePowerControlPhaseControls.isEmpty()) { + return status; + } + + var sensitivityContext = new AcSensitivityContext(network, + controllerBranches, + context.getLoadFlowContext().getEquationSystem(), + context.getLoadFlowContext().getJacobianMatrix()); + + final int numOfCurrentLimiterPstsThatChangedTap; + final int numOfActivePowerControlPstsThatChangedTap; + if (!currentLimiterPhaseControls.isEmpty()) { + numOfCurrentLimiterPstsThatChangedTap = checkCurrentLimiterPhaseControls(sensitivityContext, + contextData, + currentLimiterPhaseControls); + } else { + numOfCurrentLimiterPstsThatChangedTap = 0; + } - if (!activePowerControlPhaseControls.isEmpty() - && checkActivePowerControlPhaseControls(sensitivityContext, - contextData, - activePowerControlPhaseControls)) { - status = OuterLoopStatus.UNSTABLE; + if (!activePowerControlPhaseControls.isEmpty()) { + numOfActivePowerControlPstsThatChangedTap = checkActivePowerControlPhaseControls(sensitivityContext, + contextData, + activePowerControlPhaseControls); + } else { + numOfActivePowerControlPstsThatChangedTap = 0; + } + + if (numOfCurrentLimiterPstsThatChangedTap + numOfActivePowerControlPstsThatChangedTap != 0) { + status = OuterLoopStatus.UNSTABLE; + Reporter iterationReporter = Reports.createOuterLoopIterationReporter(reporter, context.getOuterLoopTotalIterations() + 1); + if (numOfCurrentLimiterPstsThatChangedTap != 0) { + Reports.reportCurrentLimiterPstsChangedTaps(iterationReporter, numOfCurrentLimiterPstsThatChangedTap); + } + if (numOfActivePowerControlPstsThatChangedTap != 0) { + Reports.reportActivePowerControlPstsChangedTaps(iterationReporter, numOfActivePowerControlPstsThatChangedTap); } } diff --git a/src/main/java/com/powsybl/openloadflow/ac/outerloop/DistributedSlackOuterLoop.java b/src/main/java/com/powsybl/openloadflow/ac/outerloop/DistributedSlackOuterLoop.java index 327d27f0d1..56fbf515e4 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/outerloop/DistributedSlackOuterLoop.java +++ b/src/main/java/com/powsybl/openloadflow/ac/outerloop/DistributedSlackOuterLoop.java @@ -53,68 +53,71 @@ public void initialize(AcOuterLoopContext context) { @Override public OuterLoopStatus check(AcOuterLoopContext context, Reporter reporter) { double slackBusActivePowerMismatch = context.getLastSolverResult().getSlackBusActivePowerMismatch(); - if (Math.abs(slackBusActivePowerMismatch) > slackBusPMaxMismatch / PerUnit.SB) { - ActivePowerDistribution.Result result = activePowerDistribution.run(context.getNetwork(), slackBusActivePowerMismatch); - double remainingMismatch = result.remainingMismatch(); - double distributedActivePower = slackBusActivePowerMismatch - remainingMismatch; - DistributedSlackContextData contextData = (DistributedSlackContextData) context.getData(); - contextData.addDistributedActivePower(distributedActivePower); - if (Math.abs(remainingMismatch) > ActivePowerDistribution.P_RESIDUE_EPS) { - OpenLoadFlowParameters.SlackDistributionFailureBehavior slackDistributionFailureBehavior = context.getLoadFlowContext().getParameters().getSlackDistributionFailureBehavior(); - LfGenerator referenceGenerator = context.getNetwork().getReferenceGenerator(); - if (OpenLoadFlowParameters.SlackDistributionFailureBehavior.DISTRIBUTE_ON_REFERENCE_GENERATOR == slackDistributionFailureBehavior) { - if (referenceGenerator == null) { - // no reference generator, fall back internally to FAIL mode - slackDistributionFailureBehavior = OpenLoadFlowParameters.SlackDistributionFailureBehavior.FAIL; - Reports.reportMismatchDistributionFailure(reporter, context.getIteration(), remainingMismatch * PerUnit.SB); - } - } else { - Reports.reportMismatchDistributionFailure(reporter, context.getIteration(), remainingMismatch * PerUnit.SB); - } + boolean shouldDistributeSlack = Math.abs(slackBusActivePowerMismatch) > slackBusPMaxMismatch / PerUnit.SB; + + if (!shouldDistributeSlack) { + LOGGER.debug("Already balanced"); + return OuterLoopStatus.STABLE; + } - switch (slackDistributionFailureBehavior) { - case THROW -> - throw new PowsyblException("Failed to distribute slack bus active power mismatch, " - + remainingMismatch * PerUnit.SB + " MW remains"); - case LEAVE_ON_SLACK_BUS -> { - LOGGER.warn("Failed to distribute slack bus active power mismatch, {} MW remains", - remainingMismatch * PerUnit.SB); - return result.movedBuses() ? OuterLoopStatus.UNSTABLE : OuterLoopStatus.STABLE; - } - case DISTRIBUTE_ON_REFERENCE_GENERATOR -> { - Objects.requireNonNull(referenceGenerator, () -> "No reference generator in " + context.getNetwork()); - // remaining goes to reference generator, without any limit consideration - referenceGenerator.setTargetP(referenceGenerator.getTargetP() + remainingMismatch); - reportAndLogSuccess(context, reporter, slackBusActivePowerMismatch, result); - return OuterLoopStatus.UNSTABLE; - } - case FAIL -> { - LOGGER.error("Failed to distribute slack bus active power mismatch, {} MW remains", - remainingMismatch * PerUnit.SB); - // Mismatches reported in LoadFlowResult on slack bus(es) are the mismatches of the last NR run. - // Since we will not be re-running an NR, revert distributedActivePower reporting which would otherwise be misleading. - // Said differently, we report that we didn't distribute anything, and this is indeed consistent with the network state. - contextData.addDistributedActivePower(-distributedActivePower); - return OuterLoopStatus.FAILED; - } + Reporter iterationReporter = Reports.createOuterLoopIterationReporter(reporter, context.getOuterLoopTotalIterations() + 1); + ActivePowerDistribution.Result result = activePowerDistribution.run(context.getNetwork(), slackBusActivePowerMismatch); + double remainingMismatch = result.remainingMismatch(); + double distributedActivePower = slackBusActivePowerMismatch - remainingMismatch; + DistributedSlackContextData contextData = (DistributedSlackContextData) context.getData(); + contextData.addDistributedActivePower(distributedActivePower); + if (Math.abs(remainingMismatch) > ActivePowerDistribution.P_RESIDUE_EPS) { + OpenLoadFlowParameters.SlackDistributionFailureBehavior slackDistributionFailureBehavior = context.getLoadFlowContext().getParameters().getSlackDistributionFailureBehavior(); + LfGenerator referenceGenerator = context.getNetwork().getReferenceGenerator(); + if (OpenLoadFlowParameters.SlackDistributionFailureBehavior.DISTRIBUTE_ON_REFERENCE_GENERATOR == slackDistributionFailureBehavior) { + if (referenceGenerator == null) { + // no reference generator, fall back internally to FAIL mode + slackDistributionFailureBehavior = OpenLoadFlowParameters.SlackDistributionFailureBehavior.FAIL; + Reports.reportMismatchDistributionFailure(iterationReporter, remainingMismatch * PerUnit.SB); } } else { - reportAndLogSuccess(context, reporter, slackBusActivePowerMismatch, result); - return OuterLoopStatus.UNSTABLE; + Reports.reportMismatchDistributionFailure(iterationReporter, remainingMismatch * PerUnit.SB); } - } - - Reports.reportNoMismatchDistribution(reporter, context.getIteration()); - - LOGGER.debug("Already balanced"); - return OuterLoopStatus.STABLE; + switch (slackDistributionFailureBehavior) { + case THROW -> + throw new PowsyblException("Failed to distribute slack bus active power mismatch, " + + remainingMismatch * PerUnit.SB + " MW remains"); + case LEAVE_ON_SLACK_BUS -> { + LOGGER.warn("Failed to distribute slack bus active power mismatch, {} MW remains", + remainingMismatch * PerUnit.SB); + return result.movedBuses() ? OuterLoopStatus.UNSTABLE : OuterLoopStatus.STABLE; + } + case DISTRIBUTE_ON_REFERENCE_GENERATOR -> { + Objects.requireNonNull(referenceGenerator, () -> "No reference generator in " + context.getNetwork()); + // remaining goes to reference generator, without any limit consideration + referenceGenerator.setTargetP(referenceGenerator.getTargetP() + remainingMismatch); + // create a new result with iteration++, 0.0 mismatch and movedBuses to true + result = new ActivePowerDistribution.Result(result.iteration() + 1, 0.0, true); + reportAndLogSuccess(iterationReporter, slackBusActivePowerMismatch, result); + return OuterLoopStatus.UNSTABLE; + } + case FAIL -> { + LOGGER.error("Failed to distribute slack bus active power mismatch, {} MW remains", + remainingMismatch * PerUnit.SB); + // Mismatches reported in LoadFlowResult on slack bus(es) are the mismatches of the last NR run. + // Since we will not be re-running an NR, revert distributedActivePower reporting which would otherwise be misleading. + // Said differently, we report that we didn't distribute anything, and this is indeed consistent with the network state. + contextData.addDistributedActivePower(-distributedActivePower); + return OuterLoopStatus.FAILED; + } + default -> throw new IllegalArgumentException("Unknown slackDistributionFailureBehavior"); + } + } else { + reportAndLogSuccess(iterationReporter, slackBusActivePowerMismatch, result); + return OuterLoopStatus.UNSTABLE; + } } - private static void reportAndLogSuccess(AcOuterLoopContext context, Reporter reporter, double slackBusActivePowerMismatch, ActivePowerDistribution.Result result) { - Reports.reportMismatchDistributionSuccess(reporter, context.getIteration(), slackBusActivePowerMismatch * PerUnit.SB, result.iteration()); + private static void reportAndLogSuccess(Reporter reporter, double slackBusActivePowerMismatch, ActivePowerDistribution.Result result) { + Reports.reportMismatchDistributionSuccess(reporter, slackBusActivePowerMismatch * PerUnit.SB, result.iteration()); - LOGGER.info("Slack bus active power ({} MW) distributed in {} iterations", + LOGGER.info("Slack bus active power ({} MW) distributed in {} distribution iteration(s)", slackBusActivePowerMismatch * PerUnit.SB, result.iteration()); } } diff --git a/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalShuntVoltageControlOuterLoop.java b/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalShuntVoltageControlOuterLoop.java index 50611b3d1e..7b473edc79 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalShuntVoltageControlOuterLoop.java +++ b/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalShuntVoltageControlOuterLoop.java @@ -19,6 +19,7 @@ import com.powsybl.openloadflow.lf.outerloop.IncrementalContextData; import com.powsybl.openloadflow.lf.outerloop.OuterLoopStatus; import com.powsybl.openloadflow.network.*; +import com.powsybl.openloadflow.util.Reports; import org.apache.commons.lang3.mutable.MutableObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -126,7 +127,7 @@ private static EquationTerm getCalculatedV(LfBus } private void adjustB(ShuntVoltageControl voltageControl, List sortedControllerShunts, LfBus controlledBus, IncrementalContextData contextData, - SensitivityContext sensitivityContext, double diffV, MutableObject status) { + SensitivityContext sensitivityContext, double diffV, MutableObject numAdjustedShunts) { // several shunts could control the same bus double remainingDiffV = diffV; boolean hasChanged = true; @@ -147,7 +148,7 @@ private void adjustB(ShuntVoltageControl voltageControl, List sortedCon controllerContext.updateAllowedDirection(direction); remainingDiffV -= (controller.getB() - previousB) * sensitivity; hasChanged = true; - status.setValue(OuterLoopStatus.UNSTABLE); + numAdjustedShunts.setValue(numAdjustedShunts.getValue() + 1); } } else { LOGGER.trace("Controller shunt '{}' is in its deadband: deadband {} vs voltage difference {}", controllerShunt.getId(), @@ -197,6 +198,8 @@ public OuterLoopStatus check(AcOuterLoopContext context, Reporter reporter) { return status.getValue(); } + MutableObject numAdjustedShunts = new MutableObject<>(0); + SensitivityContext sensitivityContext = new SensitivityContext(network, controllerShuntsOutOfDeadband, loadFlowContext.getEquationSystem(), loadFlowContext.getJacobianMatrix()); @@ -207,8 +210,15 @@ public OuterLoopStatus check(AcOuterLoopContext context, Reporter reporter) { .filter(shunt -> !shunt.isDisabled()) .sorted(Comparator.comparingDouble(LfShunt::getBMagnitude).reversed()) .toList(); - adjustB(voltageControl, sortedControllers, controlledBus, contextData, sensitivityContext, diffV, status); + adjustB(voltageControl, sortedControllers, controlledBus, contextData, sensitivityContext, diffV, numAdjustedShunts); }); + + if (numAdjustedShunts.getValue() != 0) { + status.setValue(OuterLoopStatus.UNSTABLE); + Reporter iterationReporter = Reports.createOuterLoopIterationReporter(reporter, context.getOuterLoopTotalIterations() + 1); + Reports.reportShuntVoltageControlChangedSection(iterationReporter, numAdjustedShunts.getValue()); + } + return status.getValue(); } diff --git a/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalTransformerReactivePowerControlOuterLoop.java b/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalTransformerReactivePowerControlOuterLoop.java index 1a5572cac0..e4fb8edd70 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalTransformerReactivePowerControlOuterLoop.java +++ b/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalTransformerReactivePowerControlOuterLoop.java @@ -21,16 +21,14 @@ import com.powsybl.openloadflow.lf.outerloop.OuterLoopStatus; import com.powsybl.openloadflow.network.*; import com.powsybl.openloadflow.util.PerUnit; +import com.powsybl.openloadflow.util.Reports; import org.apache.commons.lang3.Range; import org.apache.commons.lang3.mutable.MutableObject; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -72,7 +70,7 @@ private static boolean isOutOfDeadband(TransformerReactivePowerControl reactiveP public static List getControllerBranches(LfNetwork network) { return network.getBranches().stream() .filter(branch -> !branch.isDisabled() && branch.isTransformerReactivePowerController()) - .collect(Collectors.toList()); + .toList(); } public static List getControlledBranchesOutOfDeadband(LfNetwork network) { @@ -80,14 +78,14 @@ public static List getControlledBranchesOutOfDeadband(LfNetwork networ .filter(LfBranch::isTransformerReactivePowerControlled) .filter(branch -> isOutOfDeadband(branch.getTransformerReactivePowerControl().orElseThrow())) .filter(Predicate.not(LfBranch::isDisabled)) - .collect(Collectors.toList()); + .toList(); } public static List getControllerBranchesOutOfDeadband(List controlledBranchesOutOfDeadband) { return controlledBranchesOutOfDeadband.stream() .map(controlledBranch -> controlledBranch.getTransformerReactivePowerControl().orElseThrow().getControllerBranch()) .filter(Predicate.not(LfBranch::isDisabled)) - .collect(Collectors.toList()); + .toList(); } @Override @@ -196,23 +194,30 @@ public OuterLoopStatus check(AcOuterLoopContext context, Reporter reporter) { } }); - // Print some info - if (!controlledBranchesOutOfDeadband.isEmpty() && LOGGER.isInfoEnabled()) { - Map largestMismatches = controllerBranchesOutOfDeadband.stream() - .map(controlledBranch -> Pair.of(controlledBranch.getId(), Math.abs(getDiffQ(controlledBranch.getTransformerReactivePowerControl().get())))) - .sorted((p1, p2) -> Double.compare(p2.getRight() * PerUnit.SB, p1.getRight() * PerUnit.SB)) - .limit(3) // 3 largest - .collect(Collectors.toMap(Pair::getLeft, Pair::getRight, (key1, key2) -> key1, LinkedHashMap::new)); - LOGGER.info("{} controlled branch reactive power are outside of their target deadband, largest ones are: {}", - controllerBranchesOutOfDeadband.size(), largestMismatches); + Reporter iterationReporter = !controlledBranchesOutOfDeadband.isEmpty() || !controlledBranchesAdjusted.isEmpty() || !controlledBranchesWithAllItsControllersToLimit.isEmpty() ? + Reports.createOuterLoopIterationReporter(reporter, context.getOuterLoopTotalIterations() + 1) : null; + + if (!controlledBranchesOutOfDeadband.isEmpty()) { + if (LOGGER.isInfoEnabled()) { + Map largestMismatches = controllerBranchesOutOfDeadband.stream() + .map(controlledBranch -> Pair.of(controlledBranch.getId(), Math.abs(getDiffQ(controlledBranch.getTransformerReactivePowerControl().get())))) + .sorted((p1, p2) -> Double.compare(p2.getRight() * PerUnit.SB, p1.getRight() * PerUnit.SB)) + .limit(3) // 3 largest + .collect(Collectors.toMap(Pair::getLeft, Pair::getRight, (key1, key2) -> key1, LinkedHashMap::new)); + LOGGER.info("{} controlled branch reactive power are outside of their target deadband, largest ones are: {}", + controllerBranchesOutOfDeadband.size(), largestMismatches); + } + Reports.reportTransformerControlBranchesOutsideDeadband(Objects.requireNonNull(iterationReporter), controlledBranchesOutOfDeadband.size()); } if (!controlledBranchesAdjusted.isEmpty()) { LOGGER.info("{} controlled branch reactive power have been adjusted by changing at least one tap", controlledBranchesAdjusted.size()); + Reports.reportTransformerControlChangedTaps(Objects.requireNonNull(iterationReporter), controlledBranchesAdjusted.size()); } if (!controlledBranchesWithAllItsControllersToLimit.isEmpty()) { LOGGER.info("{} controlled branches have all its controllers to a tap limit: {}", controlledBranchesWithAllItsControllersToLimit.size(), controlledBranchesWithAllItsControllersToLimit); + Reports.reportTransformerControlTapLimit(Objects.requireNonNull(iterationReporter), controlledBranchesWithAllItsControllersToLimit.size()); } return status.getValue(); diff --git a/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalTransformerVoltageControlOuterLoop.java b/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalTransformerVoltageControlOuterLoop.java index 7822da73ec..352a80a6c6 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalTransformerVoltageControlOuterLoop.java +++ b/src/main/java/com/powsybl/openloadflow/ac/outerloop/IncrementalTransformerVoltageControlOuterLoop.java @@ -18,6 +18,7 @@ import com.powsybl.openloadflow.equations.JacobianMatrix; import com.powsybl.openloadflow.lf.outerloop.OuterLoopStatus; import com.powsybl.openloadflow.network.*; +import com.powsybl.openloadflow.util.Reports; import org.apache.commons.lang3.Range; import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.commons.lang3.mutable.MutableDouble; @@ -263,22 +264,30 @@ public OuterLoopStatus check(AcOuterLoopContext context, Reporter reporter) { } }); - if (!controlledBusesOutOfDeadband.isEmpty() && LOGGER.isInfoEnabled()) { - Map largestMismatches = controlledBusesOutOfDeadband.stream() - .map(controlledBus -> Pair.of(controlledBus.getId(), Math.abs(getDiffV(controlledBus.getTransformerVoltageControl().orElseThrow()) * controlledBus.getNominalV()))) - .sorted((p1, p2) -> Double.compare(p2.getRight(), p1.getRight())) - .limit(3) // 3 largest - .collect(Collectors.toMap(Pair::getLeft, Pair::getRight, (key1, key2) -> key1, LinkedHashMap::new)); - LOGGER.info("{} controlled bus voltages are outside of their target deadband, largest ones are: {}", - controlledBusesOutOfDeadband.size(), largestMismatches); + Reporter iterationReporter = !controlledBusesOutOfDeadband.isEmpty() || !controlledBusesAdjusted.isEmpty() || !controlledBusesWithAllItsControllersToLimit.isEmpty() ? + Reports.createOuterLoopIterationReporter(reporter, context.getOuterLoopTotalIterations() + 1) : null; + + if (!controlledBusesOutOfDeadband.isEmpty()) { + if (LOGGER.isInfoEnabled()) { + Map largestMismatches = controlledBusesOutOfDeadband.stream() + .map(controlledBus -> Pair.of(controlledBus.getId(), Math.abs(getDiffV(controlledBus.getTransformerVoltageControl().orElseThrow()) * controlledBus.getNominalV()))) + .sorted((p1, p2) -> Double.compare(p2.getRight(), p1.getRight())) + .limit(3) // 3 largest + .collect(Collectors.toMap(Pair::getLeft, Pair::getRight, (key1, key2) -> key1, LinkedHashMap::new)); + LOGGER.info("{} controlled bus voltages are outside of their target deadband, largest ones are: {}", + controlledBusesOutOfDeadband.size(), largestMismatches); + } + Reports.reportTransformerControlBusesOutsideDeadband(Objects.requireNonNull(iterationReporter), controlledBusesOutOfDeadband.size()); } if (!controlledBusesAdjusted.isEmpty()) { LOGGER.info("{} controlled bus voltages have been adjusted by changing at least one tap", controlledBusesAdjusted.size()); + Reports.reportTransformerControlChangedTaps(Objects.requireNonNull(iterationReporter), controlledBusesAdjusted.size()); } if (!controlledBusesWithAllItsControllersToLimit.isEmpty()) { LOGGER.info("{} controlled buses have all its controllers to a tap limit: {}", controlledBusesWithAllItsControllersToLimit.size(), controlledBusesWithAllItsControllersToLimit); + Reports.reportTransformerControlTapLimit(Objects.requireNonNull(iterationReporter), controlledBusesWithAllItsControllersToLimit.size()); } return status.getValue(); diff --git a/src/main/java/com/powsybl/openloadflow/ac/outerloop/ReactiveLimitsOuterLoop.java b/src/main/java/com/powsybl/openloadflow/ac/outerloop/ReactiveLimitsOuterLoop.java index d52c1022b4..5165e07b0c 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/outerloop/ReactiveLimitsOuterLoop.java +++ b/src/main/java/com/powsybl/openloadflow/ac/outerloop/ReactiveLimitsOuterLoop.java @@ -18,7 +18,6 @@ import java.util.*; import java.util.function.Predicate; -import java.util.stream.Collectors; /** * @author Geoffroy Jamgotchian {@literal } @@ -122,6 +121,7 @@ private boolean switchPvPq(List pvToPqBuses, int remaining pvToPqBuses.remove(strongestPvToPqBus); modifiedRemainingPvBusCount++; LOGGER.warn("All PV buses should switch PQ, strongest one '{}' will stay PV", strongestPvToPqBus.controllerBus.getId()); + Reports.reportBusForcedToBePv(reporter, strongestPvToPqBus.controllerBus.getId()); } if (!pvToPqBuses.isEmpty()) { @@ -290,7 +290,7 @@ public static List getReactivePowerControllerElements(LfNetwork network) .filter(LfBus::hasGeneratorReactivePowerControl) .flatMap(bus -> bus.getGeneratorReactivePowerControl().orElseThrow().getControllerBuses().stream()) .filter(Predicate.not(LfBus::isDisabled)) - .collect(Collectors.toList()); + .toList(); } @Override @@ -323,21 +323,25 @@ public OuterLoopStatus check(AcOuterLoopContext context, Reporter reporter) { var contextData = (ContextData) context.getData(); - if (!pvToPqBuses.isEmpty() && switchPvPq(pvToPqBuses, remainingPvBusCount.intValue(), contextData, reporter)) { + Reporter iterationReporter = reporter; + if (!pvToPqBuses.isEmpty() || !pqToPvBuses.isEmpty() || !busesWithUpdatedQLimits.isEmpty() || !reactiveControllerBusesToPqBuses.isEmpty()) { + iterationReporter = Reports.createOuterLoopIterationReporter(reporter, context.getOuterLoopTotalIterations() + 1); + } + + if (!pvToPqBuses.isEmpty() && switchPvPq(pvToPqBuses, remainingPvBusCount.intValue(), contextData, iterationReporter)) { status = OuterLoopStatus.UNSTABLE; } - if (!pqToPvBuses.isEmpty() && switchPqPv(pqToPvBuses, contextData, reporter, maxPqPvSwitch)) { + if (!pqToPvBuses.isEmpty() && switchPqPv(pqToPvBuses, contextData, iterationReporter, maxPqPvSwitch)) { status = OuterLoopStatus.UNSTABLE; } if (!busesWithUpdatedQLimits.isEmpty()) { - LOGGER.info("{} buses blocked to a reactive limit have been adjusted because reactive limit has changed", - busesWithUpdatedQLimits.size()); + LOGGER.info("{} buses blocked at a reactive limit have been adjusted because the reactive limit changed", busesWithUpdatedQLimits.size()); + Reports.reportBusesWithUpdatedQLimits(iterationReporter, busesWithUpdatedQLimits.size()); status = OuterLoopStatus.UNSTABLE; } - if (!reactiveControllerBusesToPqBuses.isEmpty() && switchReactiveControllerBusPq(reactiveControllerBusesToPqBuses, reporter)) { + if (!reactiveControllerBusesToPqBuses.isEmpty() && switchReactiveControllerBusPq(reactiveControllerBusesToPqBuses, iterationReporter)) { status = OuterLoopStatus.UNSTABLE; } - return status; } } diff --git a/src/main/java/com/powsybl/openloadflow/ac/solver/LineSearchStateVectorScaling.java b/src/main/java/com/powsybl/openloadflow/ac/solver/LineSearchStateVectorScaling.java index 48d836c1d8..1d262e90fe 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/solver/LineSearchStateVectorScaling.java +++ b/src/main/java/com/powsybl/openloadflow/ac/solver/LineSearchStateVectorScaling.java @@ -7,9 +7,11 @@ */ package com.powsybl.openloadflow.ac.solver; +import com.powsybl.commons.reporter.Reporter; import com.powsybl.openloadflow.ac.equations.AcEquationType; import com.powsybl.openloadflow.ac.equations.AcVariableType; import com.powsybl.openloadflow.equations.*; +import com.powsybl.openloadflow.util.Reports; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +46,7 @@ public StateVectorScalingMode getMode() { } @Override - public void apply(double[] dx, EquationSystem equationSystem) { + public void apply(double[] dx, EquationSystem equationSystem, Reporter reporter) { // just save dx vector if (lastDx == null || lastDx.length != dx.length) { lastDx = dx.clone(); @@ -58,7 +60,8 @@ public NewtonRaphsonStoppingCriteria.TestResult applyAfter(EquationSystem equationVector, TargetVector targetVector, NewtonRaphsonStoppingCriteria stoppingCriteria, - NewtonRaphsonStoppingCriteria.TestResult testResult) { + NewtonRaphsonStoppingCriteria.TestResult testResult, + Reporter reporter) { StateVector stateVector = equationSystem.getStateVector(); if (lastTestResult != null) { double stepSize = 1; @@ -90,6 +93,9 @@ public NewtonRaphsonStoppingCriteria.TestResult applyAfter(EquationSystem equationSystem) { + public void apply(double[] dx, EquationSystem equationSystem, Reporter reporter) { int vCutCount = 0; int phiCutCount = 0; double stepSize = 1.0; @@ -70,6 +72,9 @@ public void apply(double[] dx, EquationSystem eq } if (vCutCount > 0 || phiCutCount > 0) { LOGGER.debug("Step size: {} ({} dv and {} dphi changes outside thresholds)", stepSize, vCutCount, phiCutCount); + if (reporter != null) { + Reports.reportMaxVoltageChangeStateVectorScaling(reporter, stepSize, vCutCount, phiCutCount); + } Vectors.mult(dx, stepSize); } } @@ -79,7 +84,8 @@ public NewtonRaphsonStoppingCriteria.TestResult applyAfter(EquationSystem equationVector, TargetVector targetVector, NewtonRaphsonStoppingCriteria stoppingCriteria, - NewtonRaphsonStoppingCriteria.TestResult testResult) { + NewtonRaphsonStoppingCriteria.TestResult testResult, + Reporter reporter) { // nothing to do return testResult; } diff --git a/src/main/java/com/powsybl/openloadflow/ac/solver/NewtonRaphson.java b/src/main/java/com/powsybl/openloadflow/ac/solver/NewtonRaphson.java index af8ba571c5..b343844bf3 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/solver/NewtonRaphson.java +++ b/src/main/java/com/powsybl/openloadflow/ac/solver/NewtonRaphson.java @@ -15,6 +15,7 @@ import com.powsybl.openloadflow.network.LfElement; import com.powsybl.openloadflow.network.LfNetwork; import com.powsybl.openloadflow.network.util.VoltageInitializer; +import com.powsybl.openloadflow.util.PerUnit; import com.powsybl.openloadflow.util.Reports; import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.tuple.Pair; @@ -58,7 +59,7 @@ public static List, Double>> findL .filter(e -> Math.abs(e.getValue()) > Math.pow(10, -7)) .sorted(Comparator.comparingDouble((Map.Entry, Double> e) -> Math.abs(e.getValue())).reversed()) .limit(count) - .collect(Collectors.toList()); + .toList(); } public static Map, Double>> getLargestMismatchByAcEquationType(EquationSystem equationSystem, double[] mismatch) { @@ -67,12 +68,10 @@ public static Map, .collect(Collectors.toMap(e -> e.getKey().getType(), Function.identity(), BinaryOperator.maxBy(Comparator.comparingDouble(e -> Math.abs(e.getValue()))))); } - public void reportAndLogLargestMismatchByAcEquationType(Reporter reporter, EquationSystem equationSystem, double[] mismatch, double norm, int iteration) { + public void reportAndLogLargestMismatchByAcEquationType(Reporter reporter, EquationSystem equationSystem, double[] mismatch) { Map, Double>> mismatchEquations = getLargestMismatchByAcEquationType(equationSystem, mismatch); // report largest mismatches in (P, Q, V) equations - Reporter iterationMismatchReporter = detailedReport ? Reports.createNewtonRaphsonMismatchReporter(reporter, iteration) : null; - for (AcEquationType acEquationType : REPORTED_AC_EQUATION_TYPES) { Optional.ofNullable(mismatchEquations.get(acEquationType)) .ifPresent(equationPair -> { @@ -84,23 +83,30 @@ public void reportAndLogLargestMismatchByAcEquationType(Reporter reporter, Equat int busPhiRow = equationSystem.getVariable(elementNum, AcVariableType.BUS_PHI).getRow(); double busV = equationSystem.getStateVector().get(busVRow); double busPhi = equationSystem.getStateVector().get(busPhiRow); - LOGGER.trace("Mismatch `{}` for {}: {} (element={}) || Bus V /_ PHI = {} /_ {}", acEquationType, equation, equationMismatch, elementId, busV, busPhi); - if (iterationMismatchReporter != null) { - Reports.reportNewtonRaphsonMismatch(iterationMismatchReporter, getEquationTypeDescription(acEquationType), equationMismatch, elementId, busV, busPhi, iteration); + LfBus bus = network.getBus(elementNum); + double busNominalV = bus.getNominalV(); + double busSumP = bus.getP().eval() * PerUnit.SB; + double busSumQ = bus.getQ().eval() * PerUnit.SB; + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Largest mismatch on {}: {}", getEquationTypeDescription(acEquationType), equationMismatch); + LOGGER.trace(" Bus Id: {} (nominalVoltage={}", elementId, busNominalV); + LOGGER.trace(" Bus V: {} pu, {} rad", busV, busPhi); } - }); - } - if (iterationMismatchReporter != null) { - Reports.reportNewtonRaphsonNorm(iterationMismatchReporter, norm, iteration); + if (reporter != null) { + Reports.BusReport busReport = new Reports.BusReport(elementId, equationMismatch, busNominalV, busV, busPhi, busSumP, busSumQ); + Reports.reportNewtonRaphsonLargestMismatches(reporter, getEquationTypeDescription(acEquationType), busReport); + } + }); } } private String getEquationTypeDescription(AcEquationType acEquationType) { return switch (acEquationType) { - case BUS_TARGET_P -> "TargetP"; - case BUS_TARGET_Q -> "TargetQ"; - case BUS_TARGET_V -> "TargetV"; + case BUS_TARGET_P -> "P"; + case BUS_TARGET_Q -> "Q"; + case BUS_TARGET_V -> "V"; default -> null; // not implemented for other ac equation types }; } @@ -109,21 +115,26 @@ private AcSolverStatus runIteration(StateVectorScaling svScaling, MutableInt ite LOGGER.debug("Start iteration {}", iterations); try { + // create iteration reporter + // - add 1 to iteration so that it starts at 1 instead of 0 + Reporter iterationReporter = detailedReport ? Reports.createNewtonRaphsonMismatchReporter(reporter, iterations.getValue() + 1) : null; + // solve f(x) = j * dx try { j.solveTransposed(equationVector.getArray()); } catch (MatrixException e) { LOGGER.error(e.toString(), e); + Reports.reportNewtonRaphsonError(reporter, e.toString()); return AcSolverStatus.SOLVER_FAILED; } // f(x) now contains dx - svScaling.apply(equationVector.getArray(), equationSystem); + svScaling.apply(equationVector.getArray(), equationSystem, iterationReporter); // update x and f(x) will be automatically updated equationSystem.getStateVector().minus(equationVector.getArray()); - // substract targets from f(x) + // subtract targets from f(x) equationVector.minus(targetVector); // f(x) now contains equation mismatches @@ -136,18 +147,20 @@ private AcSolverStatus runIteration(StateVectorScaling svScaling, MutableInt ite }); } - // test stopping criteria and log norm(fx) + // test stopping criteria NewtonRaphsonStoppingCriteria.TestResult testResult = parameters.getStoppingCriteria().test(equationVector.getArray(), equationSystem); testResult = svScaling.applyAfter(equationSystem, equationVector, targetVector, - parameters.getStoppingCriteria(), testResult); + parameters.getStoppingCriteria(), testResult, + iterationReporter); LOGGER.debug("|f(x)|={}", testResult.getNorm()); - + if (detailedReport) { + Reports.reportNewtonRaphsonNorm(iterationReporter, testResult.getNorm()); + } if (detailedReport || LOGGER.isTraceEnabled()) { - reportAndLogLargestMismatchByAcEquationType(reporter, equationSystem, equationVector.getArray(), testResult.getNorm(), iterations.getValue()); + reportAndLogLargestMismatchByAcEquationType(iterationReporter, equationSystem, equationVector.getArray()); } - if (testResult.isStop()) { return AcSolverStatus.CONVERGED; } @@ -177,7 +190,7 @@ private boolean isStateUnrealistic(Reporter reporter) { LOGGER.error("{} buses have a voltage magnitude out of range [{}, {}]: {}", busesOutOfNormalVoltageRange.size(), parameters.getMinRealisticVoltage(), parameters.getMaxRealisticVoltage(), busesOutOfNormalVoltageRange); - Reports.reportNewtonRaphsonBusesOutOfNormalVoltageRange(reporter, busesOutOfNormalVoltageRange, parameters.getMinRealisticVoltage(), parameters.getMaxRealisticVoltage()); + Reports.reportNewtonRaphsonBusesOutOfRealisticVoltageRange(reporter, busesOutOfNormalVoltageRange, parameters.getMinRealisticVoltage(), parameters.getMaxRealisticVoltage()); } return !busesOutOfNormalVoltageRange.isEmpty(); } @@ -194,8 +207,12 @@ public AcSolverResult run(VoltageInitializer voltageInitializer, Reporter report LOGGER.debug("|f(x0)|={}", initialTestResult.getNorm()); + Reporter initialReporter = detailedReport ? Reports.createNewtonRaphsonMismatchReporter(reporter, 0) : null; + if (detailedReport) { + Reports.reportNewtonRaphsonNorm(initialReporter, initialTestResult.getNorm()); + } if (detailedReport || LOGGER.isTraceEnabled()) { - reportAndLogLargestMismatchByAcEquationType(reporter, equationSystem, equationVector.getArray(), initialTestResult.getNorm(), -1); + reportAndLogLargestMismatchByAcEquationType(initialReporter, equationSystem, equationVector.getArray()); } // start iterations diff --git a/src/main/java/com/powsybl/openloadflow/ac/solver/NoneStateVectorScaling.java b/src/main/java/com/powsybl/openloadflow/ac/solver/NoneStateVectorScaling.java index 11cddbc216..e89f40d4e4 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/solver/NoneStateVectorScaling.java +++ b/src/main/java/com/powsybl/openloadflow/ac/solver/NoneStateVectorScaling.java @@ -7,6 +7,7 @@ */ package com.powsybl.openloadflow.ac.solver; +import com.powsybl.commons.reporter.Reporter; import com.powsybl.openloadflow.ac.equations.AcEquationType; import com.powsybl.openloadflow.ac.equations.AcVariableType; import com.powsybl.openloadflow.equations.EquationSystem; @@ -24,7 +25,7 @@ public StateVectorScalingMode getMode() { } @Override - public void apply(double[] dx, EquationSystem equationSystem) { + public void apply(double[] dx, EquationSystem equationSystem, Reporter reporter) { // nothing to do } @@ -33,7 +34,8 @@ public NewtonRaphsonStoppingCriteria.TestResult applyAfter(EquationSystem equationVector, TargetVector targetVector, NewtonRaphsonStoppingCriteria stoppingCriteria, - NewtonRaphsonStoppingCriteria.TestResult testResult) { + NewtonRaphsonStoppingCriteria.TestResult testResult, + Reporter reporter) { return testResult; } } diff --git a/src/main/java/com/powsybl/openloadflow/ac/solver/StateVectorScaling.java b/src/main/java/com/powsybl/openloadflow/ac/solver/StateVectorScaling.java index 813621b353..a85a903ad1 100644 --- a/src/main/java/com/powsybl/openloadflow/ac/solver/StateVectorScaling.java +++ b/src/main/java/com/powsybl/openloadflow/ac/solver/StateVectorScaling.java @@ -7,6 +7,7 @@ */ package com.powsybl.openloadflow.ac.solver; +import com.powsybl.commons.reporter.Reporter; import com.powsybl.openloadflow.ac.equations.AcEquationType; import com.powsybl.openloadflow.ac.equations.AcVariableType; import com.powsybl.openloadflow.equations.EquationSystem; @@ -37,7 +38,7 @@ static StateVectorScaling fromMode(NewtonRaphsonParameters parameters, NewtonRap /** * Apply scaling to state vector variation before equation mismatches calculation. */ - void apply(double[] dx, EquationSystem equationSystem); + void apply(double[] dx, EquationSystem equationSystem, Reporter reporter); /** * Apply scaling to state vector after equation mismatches and norm have been calculated. @@ -46,5 +47,6 @@ NewtonRaphsonStoppingCriteria.TestResult applyAfter(EquationSystem equationVector, TargetVector targetVector, NewtonRaphsonStoppingCriteria stoppingCriteria, - NewtonRaphsonStoppingCriteria.TestResult testResult); + NewtonRaphsonStoppingCriteria.TestResult testResult, + Reporter reporter); } diff --git a/src/main/java/com/powsybl/openloadflow/dc/DcIncrementalPhaseControlOuterLoop.java b/src/main/java/com/powsybl/openloadflow/dc/DcIncrementalPhaseControlOuterLoop.java index 77b99f9ad5..9397f0bce4 100644 --- a/src/main/java/com/powsybl/openloadflow/dc/DcIncrementalPhaseControlOuterLoop.java +++ b/src/main/java/com/powsybl/openloadflow/dc/DcIncrementalPhaseControlOuterLoop.java @@ -82,7 +82,7 @@ public OuterLoopStatus check(DcOuterLoopContext context, Reporter reporter) { if (checkActivePowerControlPhaseControls(sensitivityContext, contextData, - activePowerControlPhaseControls)) { + activePowerControlPhaseControls) != 0) { status = OuterLoopStatus.UNSTABLE; } } diff --git a/src/main/java/com/powsybl/openloadflow/lf/outerloop/AbstractIncrementalPhaseControlOuterLoop.java b/src/main/java/com/powsybl/openloadflow/lf/outerloop/AbstractIncrementalPhaseControlOuterLoop.java index 6517f54f47..44521371fa 100644 --- a/src/main/java/com/powsybl/openloadflow/lf/outerloop/AbstractIncrementalPhaseControlOuterLoop.java +++ b/src/main/java/com/powsybl/openloadflow/lf/outerloop/AbstractIncrementalPhaseControlOuterLoop.java @@ -17,7 +17,7 @@ import com.powsybl.openloadflow.network.*; import com.powsybl.openloadflow.util.PerUnit; import org.apache.commons.lang3.Range; -import org.apache.commons.lang3.mutable.MutableBoolean; +import org.apache.commons.lang3.mutable.MutableInt; import org.slf4j.Logger; import java.util.List; @@ -108,9 +108,9 @@ public double calculateSensitivityFromA2P(LfBranch controllerBranch, LfBranch co } } - protected boolean checkActivePowerControlPhaseControls(AbstractSensitivityContext sensitivityContext, IncrementalContextData contextData, - List activePowerControlPhaseControls) { - MutableBoolean updated = new MutableBoolean(false); + protected int checkActivePowerControlPhaseControls(AbstractSensitivityContext sensitivityContext, IncrementalContextData contextData, + List activePowerControlPhaseControls) { + MutableInt numOfActivePowerControlPstsThatChangedTap = new MutableInt(0); for (TransformerPhaseControl phaseControl : activePowerControlPhaseControls) { LfBranch controllerBranch = phaseControl.getControllerBranch(); @@ -133,7 +133,7 @@ protected boolean checkActivePowerControlPhaseControls(AbstractSensitivityContex Range tapPositionRange = piModel.getTapPositionRange(); piModel.updateTapPositionToReachNewA1(da, MAX_TAP_SHIFT, controllerContext.getAllowedDirection()).ifPresent(direction -> { controllerContext.updateAllowedDirection(direction); - updated.setValue(true); + numOfActivePowerControlPstsThatChangedTap.add(1); }); if (piModel.getTapPosition() != oldTapPosition) { @@ -143,8 +143,7 @@ protected boolean checkActivePowerControlPhaseControls(AbstractSensitivityContex } } } - - return updated.booleanValue(); + return numOfActivePowerControlPstsThatChangedTap.getValue(); } } diff --git a/src/main/java/com/powsybl/openloadflow/network/LfNetwork.java b/src/main/java/com/powsybl/openloadflow/network/LfNetwork.java index 8c172828ef..6b316f2f1f 100644 --- a/src/main/java/com/powsybl/openloadflow/network/LfNetwork.java +++ b/src/main/java/com/powsybl/openloadflow/network/LfNetwork.java @@ -620,7 +620,7 @@ public static List load(T network, LfNetworkLoader networkLoad Objects.requireNonNull(parameters); List lfNetworks = networkLoader.load(network, topoConfig, parameters, reporter); for (LfNetwork lfNetwork : lfNetworks) { - Reporter reporterNetwork = Reports.createPostLoadingProcessingReporter(lfNetwork.getReporter()); + Reporter reporterNetwork = Reports.createNetworkInfoReporter(lfNetwork.getReporter()); lfNetwork.fix(parameters.isMinImpedance(), parameters.getLowImpedanceThreshold()); lfNetwork.validate(parameters.getLoadFlowModel(), reporterNetwork); if (lfNetwork.isValid()) { diff --git a/src/main/java/com/powsybl/openloadflow/util/Reports.java b/src/main/java/com/powsybl/openloadflow/util/Reports.java index bf12a63b46..2f79d2803a 100644 --- a/src/main/java/com/powsybl/openloadflow/util/Reports.java +++ b/src/main/java/com/powsybl/openloadflow/util/Reports.java @@ -12,6 +12,7 @@ import com.powsybl.commons.reporter.TypedValue; import com.powsybl.openloadflow.OpenLoadFlowReportConstants; +import java.util.HashMap; import java.util.Map; /** @@ -23,6 +24,11 @@ public final class Reports { private static final String NETWORK_NUM_SC = "networkNumSc"; private static final String ITERATION = "iteration"; private static final String NETWORK_ID = "networkId"; + private static final String IMPACTED_GENERATOR_COUNT = "impactedGeneratorCount"; + private static final String BUS_ID = "busId"; + + public record BusReport(String busId, double mismatch, double nominalV, double v, double phi, double p, double q) { + } private Reports() { } @@ -33,6 +39,7 @@ public static void reportNetworkSize(Reporter reporter, int busCount, int branch .withDefaultMessage("Network has ${busCount} buses and ${branchCount} branches") .withValue("busCount", busCount) .withValue("branchCount", branchCount) + .withSeverity(TypedValue.INFO_SEVERITY) .build()); } @@ -44,6 +51,7 @@ public static void reportNetworkBalance(Reporter reporter, double activeGenerati .withValue("activeLoad", activeLoad) .withValue("reactiveGeneration", reactiveGeneration) .withValue("reactiveLoad", reactiveLoad) + .withSeverity(TypedValue.INFO_SEVERITY) .build()); } @@ -51,43 +59,33 @@ public static void reportNetworkMustHaveAtLeastOneBusGeneratorVoltageControlEnab reporter.report(Report.builder() .withKey("networkMustHaveAtLeastOneBusGeneratorVoltageControlEnabled") .withDefaultMessage("Network must have at least one bus with generator voltage control enabled") + .withSeverity(TypedValue.ERROR_SEVERITY) .build()); } - public static void reportMismatchDistributionFailure(Reporter reporter, int iteration, double remainingMismatch) { + public static void reportMismatchDistributionFailure(Reporter reporter, double remainingMismatch) { reporter.report(Report.builder() .withKey("mismatchDistributionFailure") - .withDefaultMessage("Iteration ${iteration}: failed to distribute slack bus active power mismatch, ${mismatch} MW remains") - .withValue(ITERATION, iteration) + .withDefaultMessage("Failed to distribute slack bus active power mismatch, ${mismatch} MW remains") .withTypedValue("mismatch", remainingMismatch, OpenLoadFlowReportConstants.MISMATCH_TYPED_VALUE) .withSeverity(TypedValue.ERROR_SEVERITY) .build()); } - public static void reportMismatchDistributionSuccess(Reporter reporter, int iteration, double slackBusActivePowerMismatch, int iterationCount) { + public static void reportMismatchDistributionSuccess(Reporter reporter, double slackBusActivePowerMismatch, int iterationCount) { reporter.report(Report.builder() .withKey("mismatchDistributionSuccess") - .withDefaultMessage("Iteration ${iteration}: slack bus active power (${initialMismatch} MW) distributed in ${iterationCount} iterations") - .withValue(ITERATION, iteration) + .withDefaultMessage("Slack bus active power (${initialMismatch} MW) distributed in ${iterationCount} distribution iteration(s)") .withTypedValue("initialMismatch", slackBusActivePowerMismatch, OpenLoadFlowReportConstants.MISMATCH_TYPED_VALUE) .withValue("iterationCount", iterationCount) .withSeverity(TypedValue.INFO_SEVERITY) .build()); } - public static void reportNoMismatchDistribution(Reporter reporter, int iteration) { - reporter.report(Report.builder() - .withKey("NoMismatchDistribution") - .withDefaultMessage("Iteration ${iteration}: already balanced") - .withValue(ITERATION, iteration) - .withSeverity(TypedValue.INFO_SEVERITY) - .build()); - } - public static void reportPvToPqBuses(Reporter reporter, int pvToPqBusCount, int remainingPvBusCount) { reporter.report(Report.builder() .withKey("switchPvPq") - .withDefaultMessage("${pvToPqBusCount} buses switched PV -> PQ (${remainingPvBusCount} bus remains PV}") + .withDefaultMessage("${pvToPqBusCount} buses switched PV -> PQ (${remainingPvBusCount} buses remain PV)") .withValue("pvToPqBusCount", pvToPqBusCount) .withValue("remainingPvBusCount", remainingPvBusCount) .withSeverity(TypedValue.INFO_SEVERITY) @@ -97,18 +95,36 @@ public static void reportPvToPqBuses(Reporter reporter, int pvToPqBusCount, int public static void reportPqToPvBuses(Reporter reporter, int pqToPvBusCount, int blockedPqBusCount) { reporter.report(Report.builder() .withKey("switchPqPv") - .withDefaultMessage("${pqToPvBusCount} buses switched PQ -> PV (${blockedPqBusCount} buses blocked PQ because have reach max number of switch)") + .withDefaultMessage("${pqToPvBusCount} buses switched PQ -> PV (${blockedPqBusCount} buses blocked PQ due to the max number of switches)") .withValue("pqToPvBusCount", pqToPvBusCount) .withValue("blockedPqBusCount", blockedPqBusCount) .withSeverity(TypedValue.INFO_SEVERITY) .build()); } - public static void reportReactiveControllerBusesToPqBuses(Reporter reporter, int switchCount) { + public static void reportBusForcedToBePv(Reporter reporter, String busId) { + reporter.report(Report.builder() + .withKey("busForcedToBePv") + .withDefaultMessage("All PV buses should switch PQ, strongest one will stay PV: ${busId}") + .withValue(BUS_ID, busId) + .withSeverity(TypedValue.WARN_SEVERITY) + .build()); + } + + public static void reportBusesWithUpdatedQLimits(Reporter reporter, int numBusesWithUpdatedQLimits) { + reporter.report(Report.builder() + .withKey("busWithUpdatedQLimits") + .withDefaultMessage("${numBusesWithUpdatedQLimits} buses blocked at a reactive limit have been adjusted because the reactive limit changed") + .withValue("numBusesWithUpdatedQLimits", numBusesWithUpdatedQLimits) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportReactiveControllerBusesToPqBuses(Reporter reporter, int remoteReactivePowerControllerBusToPqCount) { reporter.report(Report.builder() .withKey("remoteReactiveControllerBusToPq") - .withDefaultMessage("${count} remote reactive power controller buses have switched PQ") - .withValue("count", switchCount) + .withDefaultMessage("${remoteReactivePowerControllerBusToPqCount} bus(es) with remote reactive power controller switched PQ") + .withValue("remoteReactivePowerControllerBusToPqCount", remoteReactivePowerControllerBusToPqCount) .withSeverity(TypedValue.INFO_SEVERITY) .build()); } @@ -117,12 +133,84 @@ public static void reportStandByAutomatonActivation(Reporter reporter, String bu reporter.report(Report.builder() .withKey("standByAutomatonActivation") .withDefaultMessage("Activation of voltage control of static var compensator with stand by automaton: bus ${busId} switched PQ -> PV with targetV ${newTargetV}") - .withValue("busId", busId) + .withValue(BUS_ID, busId) .withValue("newTargetV", newTargetV) .withSeverity(TypedValue.INFO_SEVERITY) .build()); } + public static void reportCurrentLimiterPstsChangedTaps(Reporter reporter, int numOfCurrentLimiterPstsThatChangedTap) { + reporter.report(Report.builder() + .withKey("currentLimiterPstsChangedTaps") + .withDefaultMessage("${numOfCurrentLimiterPstsThatChangedTap} current limiter PST(s) changed taps") + .withValue("numOfCurrentLimiterPstsThatChangedTap", numOfCurrentLimiterPstsThatChangedTap) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportActivePowerControlPstsChangedTaps(Reporter reporter, int numOfActivePowerControlPstsThatChangedTap) { + reporter.report(Report.builder() + .withKey("activePowerControlPstsChangedTaps") + .withDefaultMessage("${numOfActivePowerControlPstsThatChangedTap} active power control PST(s) changed taps") + .withValue("numOfActivePowerControlPstsThatChangedTap", numOfActivePowerControlPstsThatChangedTap) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportTransformerControlBusesOutsideDeadband(Reporter reporter, int numTransformerControlBusesOutsideDeadband) { + reporter.report(Report.builder() + .withKey("transformerControlBusesOutsideDeadband") + .withDefaultMessage("${numTransformerControlBusesOutsideDeadband} voltage-controlled buses are outside of their target deadbands") + .withValue("numTransformerControlBusesOutsideDeadband", numTransformerControlBusesOutsideDeadband) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportTransformerControlBranchesOutsideDeadband(Reporter reporter, int numTransformerControlBranchesOutsideDeadband) { + reporter.report(Report.builder() + .withKey("transformerControlBranchesOutsideDeadband") + .withDefaultMessage("${numTransformerControlBranchesOutsideDeadband} reactive power-controlled branches are outside of their target deadbands") + .withValue("numTransformerControlBranchesOutsideDeadband", numTransformerControlBranchesOutsideDeadband) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportTransformerControlChangedTaps(Reporter reporter, int numTransformerControlAdjusted) { + reporter.report(Report.builder() + .withKey("transformerControlChangedTaps") + .withDefaultMessage("${numTransformerControlAdjusted} transformers changed tap position") + .withValue("numTransformerControlAdjusted", numTransformerControlAdjusted) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportTransformerControlTapLimit(Reporter reporter, int numTransformerControlTapLimit) { + reporter.report(Report.builder() + .withKey("transformerControlTapLimit") + .withDefaultMessage("${numTransformerControlTapLimit} transformers reached their tap maximum position") + .withValue("numTransformerControlTapLimit", numTransformerControlTapLimit) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportShuntVoltageControlChangedSection(Reporter reporter, int numShuntVoltageControlAdjusted) { + reporter.report(Report.builder() + .withKey("shuntVoltageControlChangedSection") + .withDefaultMessage("${numShuntVoltageControlAdjusted} shunts changed section") + .withValue("numShuntVoltageControlAdjusted", numShuntVoltageControlAdjusted) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportUnsuccessfulOuterLoop(Reporter reporter, String outerLoopStatus) { + reporter.report(Report.builder() + .withKey("outerLoopStatus") + .withDefaultMessage("Outer loop unsuccessful with status: ${outerLoopStatus}") + .withValue("outerLoopStatus", outerLoopStatus) + .withSeverity(TypedValue.ERROR_SEVERITY) + .build()); + } + public static void reportDcLfSolverFailure(Reporter reporter, String errorMessage) { reporter.report(Report.builder() .withKey("dcLfFailure") @@ -144,8 +232,8 @@ public static void reportDcLfComplete(Reporter reporter, boolean succeeded) { public static void reportGeneratorsDiscardedFromVoltageControlBecauseNotStarted(Reporter reporter, int impactedGeneratorCount) { reporter.report(Report.builder() .withKey("generatorsDiscardedFromVoltageControlBecauseNotStarted") - .withDefaultMessage("${impactedGeneratorCount} generators have been discarded from voltage control because not started") - .withValue("impactedGeneratorCount", impactedGeneratorCount) + .withDefaultMessage("${impactedGeneratorCount} generators were discarded from voltage control because not started") + .withValue(IMPACTED_GENERATOR_COUNT, impactedGeneratorCount) .withSeverity(TypedValue.WARN_SEVERITY) .build()); } @@ -154,7 +242,7 @@ public static void reportGeneratorsDiscardedFromVoltageControlBecauseReactiveRan reporter.report(Report.builder() .withKey("generatorsDiscardedFromVoltageControlBecauseReactiveRangeIsTooSmall") .withDefaultMessage("${impactedGeneratorCount} generators have been discarded from voltage control because of a too small reactive range") - .withValue("impactedGeneratorCount", impactedGeneratorCount) + .withValue(IMPACTED_GENERATOR_COUNT, impactedGeneratorCount) .withSeverity(TypedValue.WARN_SEVERITY) .build()); } @@ -163,16 +251,20 @@ public static void reportGeneratorsDiscardedFromVoltageControlBecauseTargetPIsOu reporter.report(Report.builder() .withKey("generatorsDiscardedFromVoltageControlBecauseTargetPIsOutsideActiveLimits") .withDefaultMessage("${impactedGeneratorCount} generators have been discarded from voltage control because targetP is outside active power limits") - .withValue("impactedGeneratorCount", impactedGeneratorCount) + .withValue(IMPACTED_GENERATOR_COUNT, impactedGeneratorCount) .withSeverity(TypedValue.WARN_SEVERITY) .build()); } - public static void reportAcLfComplete(Reporter reporter, String nrStatus, TypedValue severity) { + public static void reportAcLfComplete(Reporter reporter, boolean success, String solverStatus, String outerloopStatus) { + TypedValue severity = success ? TypedValue.INFO_SEVERITY : TypedValue.ERROR_SEVERITY; + String successText = success ? "successfully" : "with error"; reporter.report(Report.builder() .withKey("acLfComplete") - .withDefaultMessage("AC load flow complete with NR status '${nrStatus}'") - .withValue("nrStatus", nrStatus) + .withDefaultMessage("AC load flow completed ${successText} (solverStatus=${solverStatus}, outerloopStatus=${outerloopStatus})") + .withValue("successText", successText) + .withValue("solverStatus", solverStatus) + .withValue("outerloopStatus", outerloopStatus) .withSeverity(severity) .build()); } @@ -188,14 +280,20 @@ public static Reporter createLfNetworkReporter(Reporter reporter, int networkNum NETWORK_NUM_SC, new TypedValue(networkNumSc, TypedValue.UNTYPED))); } - public static Reporter createPostLoadingProcessingReporter(Reporter reporter) { - return reporter.createSubReporter("postLoadingProcessing", "Post loading processing"); + public static Reporter createNetworkInfoReporter(Reporter reporter) { + return reporter.createSubReporter("networkInfo", "Network info"); } public static Reporter createOuterLoopReporter(Reporter reporter, String outerLoopType) { return reporter.createSubReporter("OuterLoop", "Outer loop ${outerLoopType}", "outerLoopType", outerLoopType); } + public static Reporter createOuterLoopIterationReporter(Reporter reporter, int outerLoopIteration) { + Map subReporterMap = new HashMap<>(); + subReporterMap.put("outerLoopIteration", new TypedValue(outerLoopIteration, TypedValue.UNTYPED)); + return reporter.createSubReporter("OuterLoopIteration", "Outer loop iteration ${outerLoopIteration}", subReporterMap); + } + public static Reporter createSensitivityAnalysis(Reporter reporter, String networkId) { return reporter.createSubReporter("sensitivityAnalysis", "Sensitivity analysis on network '${networkId}'", NETWORK_ID, networkId); @@ -221,71 +319,118 @@ public static Reporter createPostContingencySimulation(Reporter reporter, String } public static Reporter createDetailedSolverReporter(Reporter reporter, String solverName, int networkNumCc, int networkNumSc) { - return reporter.createSubReporter("solver", solverName + " on Network CC${networkNumCc} SC${networkNumSc} || No outer loops calculations", + Reporter subReporter = reporter.createSubReporter("solver", solverName + " on Network CC${networkNumCc} SC${networkNumSc}", Map.of(NETWORK_NUM_CC, new TypedValue(networkNumCc, TypedValue.UNTYPED), NETWORK_NUM_SC, new TypedValue(networkNumSc, TypedValue.UNTYPED))); + subReporter.report(Report.builder() + .withKey("solverNoOuterLoops") + .withDefaultMessage("No outer loops have been launched") + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + return subReporter; } - public static Reporter createDetailedSolverReporterOuterLoop(Reporter reporter, String solverName, int networkNumCc, int networkNumSc, int outerLoopIteration, String outerLoopType) { - return reporter.createSubReporter("solver", solverName + " on Network CC${networkNumCc} SC${networkNumSc} || Outer loop iteration ${outerLoopIteration} and type `${outerLoopType}`", + public static Reporter createDetailedSolverReporterOuterLoop(Reporter reporter, String solverName, int networkNumCc, int networkNumSc, + int outerLoopIteration, String outerLoopType) { + Reporter subReporter = reporter.createSubReporter("solver", solverName + " on Network CC${networkNumCc} SC${networkNumSc}", Map.of(NETWORK_NUM_CC, new TypedValue(networkNumCc, TypedValue.UNTYPED), - NETWORK_NUM_SC, new TypedValue(networkNumSc, TypedValue.UNTYPED), - "outerLoopIteration", new TypedValue(outerLoopIteration, TypedValue.UNTYPED), - "outerLoopType", new TypedValue(outerLoopType, TypedValue.UNTYPED))); + NETWORK_NUM_SC, new TypedValue(networkNumSc, TypedValue.UNTYPED))); + subReporter.report(Report.builder() + .withKey("solverOuterLoopCurrentType") + .withDefaultMessage("Newton-Raphson of outer loop iteration ${outerLoopIteration} of type ${outerLoopType}") + .withValue("outerLoopIteration", outerLoopIteration) + .withValue("outerLoopType", outerLoopType) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + return subReporter; } public static Reporter createNewtonRaphsonMismatchReporter(Reporter reporter, int iteration) { - if (iteration == -1) { + if (iteration == 0) { return reporter.createSubReporter("mismatchInitial", "Initial mismatch"); } else { return reporter.createSubReporter("mismatchIteration", "Iteration ${iteration} mismatch", ITERATION, iteration); } } - public static void reportNewtonRaphsonMismatch(Reporter reporter, String acEquationType, double mismatch, String busId, double busV, double busPhi, int iteration) { - - ReportBuilder reportBuilder = Report.builder(); - String mismatchDetails = " on ${equationType}: ${mismatch}, Bus Id: '${busId}', Bus V: ${busV}, Bus Phi: ${busPhi}"; - if (iteration == -1) { - reportBuilder.withKey("NRInitialMismatch") - .withDefaultMessage("Initial mismatch" + mismatchDetails); - } else { - reportBuilder.withKey("NRIterationMismatch") - .withDefaultMessage("Iteration ${iteration} mismatch" + mismatchDetails) - .withValue(ITERATION, iteration); - } + public static void reportNewtonRaphsonError(Reporter reporter, String error) { + reporter.report(Report.builder() + .withKey("NRError") + .withDefaultMessage("Newton Raphson error: ${error}") + .withValue("error", error) + .withSeverity(TypedValue.ERROR_SEVERITY) + .build()); + } - reporter.report(reportBuilder.withValue("equationType", acEquationType) - .withTypedValue("mismatch", mismatch, OpenLoadFlowReportConstants.MISMATCH_TYPED_VALUE) - .withValue("busId", busId) - .withTypedValue("busV", busV, TypedValue.VOLTAGE) - .withTypedValue("busPhi", busPhi, TypedValue.ANGLE) + public static void reportNewtonRaphsonNorm(Reporter reporter, double norm) { + reporter.report(Report.builder() + .withKey("NRNorm") + .withDefaultMessage("Newton-Raphson norm |f(x)|=${norm}") + .withValue("norm", norm) .withSeverity(TypedValue.TRACE_SEVERITY) .build()); } - public static void reportNewtonRaphsonNorm(Reporter reporter, double norm, int iteration) { - ReportBuilder reportBuilder = Report.builder(); - if (iteration == -1) { - reportBuilder.withKey("NRInitialNorm") - .withDefaultMessage("Norm |f(x0)|=${norm}"); - } else { - reportBuilder.withKey("NRIterationNorm") - .withDefaultMessage("Norm |f(x)|=${norm}"); - } - reporter.report(reportBuilder.withValue("norm", norm) - .withSeverity(TypedValue.TRACE_SEVERITY) + public static void reportNewtonRaphsonLargestMismatches(Reporter reporter, String acEquationType, BusReport busReport) { + Map subReporterMap = new HashMap<>(); + subReporterMap.put("equationType", new TypedValue(acEquationType, TypedValue.UNTYPED)); + subReporterMap.put("mismatch", new TypedValue(busReport.mismatch(), OpenLoadFlowReportConstants.MISMATCH_TYPED_VALUE)); + + ReportBuilder busIdReportBuilder = Report.builder(); + busIdReportBuilder.withKey("NRMismatchBusInfo") + .withDefaultMessage("Bus Id: ${busId} (nominalVoltage=${busNominalV}kV)") + .withValue(BUS_ID, busReport.busId()) + .withValue("busNominalV", busReport.nominalV()) + .withSeverity(TypedValue.TRACE_SEVERITY); + + ReportBuilder busVReportBuilder = Report.builder(); + busVReportBuilder.withKey("NRMismatchBusV") + .withDefaultMessage("Bus V: ${busV} pu, ${busPhi} rad") + .withValue("busV", busReport.v()) + .withValue("busPhi", busReport.phi()) + .withSeverity(TypedValue.TRACE_SEVERITY); + + ReportBuilder busInjectionReportBuilder = Report.builder(); + busInjectionReportBuilder.withKey("NRMismatchBusInjection") + .withDefaultMessage("Bus injection: ${busSumP} MW, ${busSumQ} MVar") + .withValue("busSumP", busReport.p()) + .withValue("busSumQ", busReport.q()) + .withSeverity(TypedValue.TRACE_SEVERITY); + + Reporter subReporter = reporter.createSubReporter("NRMismatch", "Largest ${equationType} mismatch: ${mismatch}", subReporterMap); + subReporter.report(busIdReportBuilder.build()); + subReporter.report(busVReportBuilder.build()); + subReporter.report(busInjectionReportBuilder.build()); + } + + public static void reportLineSearchStateVectorScaling(Reporter reporter, double stepSize) { + reporter.report(Report.builder() + .withKey("lineSearchStateVectorScaling") + .withDefaultMessage("Step size: ${stepSize} (line search)") + .withValue("stepSize", stepSize) + .withSeverity(TypedValue.INFO_SEVERITY) + .build()); + } + + public static void reportMaxVoltageChangeStateVectorScaling(Reporter reporter, double stepSize, int vCutCount, int phiCutCount) { + reporter.report(Report.builder() + .withKey("maxVoltageChangeStateVectorScaling") + .withDefaultMessage("Step size: ${stepSize} (max voltage change: ${vCutCount} Vmagnitude and ${phiCutCount} Vangle changes outside configured thresholds)") + .withValue("stepSize", stepSize) + .withValue("vCutCount", vCutCount) + .withValue("phiCutCount", phiCutCount) + .withSeverity(TypedValue.INFO_SEVERITY) .build()); } - public static void reportNewtonRaphsonBusesOutOfNormalVoltageRange(Reporter reporter, Map busesOutOfNormalVoltageRange, double minRealisticVoltage, double maxRealisticVoltage) { + public static void reportNewtonRaphsonBusesOutOfRealisticVoltageRange(Reporter reporter, Map busesOutOfRealisticVoltageRange, double minRealisticVoltage, double maxRealisticVoltage) { reporter.report(Report.builder() - .withKey("newtonRaphsonBusesOutOfNormalVoltageRange") - .withDefaultMessage("${busCountOutOfNormalVoltageRange} buses have a voltage magnitude out of range [${minRealisticVoltage}, ${maxRealisticVoltage}]: ${busesOutOfNormalVoltageRange}") - .withValue("busCountOutOfNormalVoltageRange", busesOutOfNormalVoltageRange.size()) + .withKey("newtonRaphsonBusesOutOfRealisticVoltageRange") + .withDefaultMessage("${busCountOutOfRealisticVoltageRange} buses have a voltage magnitude out of the configured realistic range [${minRealisticVoltage}, ${maxRealisticVoltage}] p.u.: ${busesOutOfRealisticVoltageRange}") + .withValue("busCountOutOfRealisticVoltageRange", busesOutOfRealisticVoltageRange.size()) .withValue("minRealisticVoltage", minRealisticVoltage) .withValue("maxRealisticVoltage", maxRealisticVoltage) - .withValue("busesOutOfNormalVoltageRange", busesOutOfNormalVoltageRange.toString()) + .withValue("busesOutOfRealisticVoltageRange", busesOutOfRealisticVoltageRange.toString()) .withSeverity(TypedValue.ERROR_SEVERITY) .build()); } diff --git a/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowEurostagTutorialExample1Test.java b/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowEurostagTutorialExample1Test.java index d63e3a2f22..3c7dab0b91 100644 --- a/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowEurostagTutorialExample1Test.java +++ b/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowEurostagTutorialExample1Test.java @@ -286,7 +286,7 @@ void noGeneratorTest() { ReporterModel createNetworkReporter = lfReporter.getSubReporters().get(0); assertEquals("lfNetwork", createNetworkReporter.getTaskKey()); ReporterModel postLoadingReporter = createNetworkReporter.getSubReporters().get(0); - assertEquals("postLoadingProcessing", postLoadingReporter.getTaskKey()); + assertEquals("networkInfo", postLoadingReporter.getTaskKey()); assertEquals(1, postLoadingReporter.getReports().size()); assertEquals("Network must have at least one bus with generator voltage control enabled", postLoadingReporter.getReports().iterator().next().getDefaultMessage()); diff --git a/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowReportTest.java b/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowReportTest.java index 6b5dfd9740..82d03d8c76 100644 --- a/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowReportTest.java +++ b/src/test/java/com/powsybl/openloadflow/ac/AcLoadFlowReportTest.java @@ -10,6 +10,7 @@ import com.powsybl.commons.reporter.ReporterModel; import com.powsybl.computation.local.LocalComputationManager; import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.RatioTapChanger; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import com.powsybl.loadflow.LoadFlow; import com.powsybl.loadflow.LoadFlowParameters; @@ -18,9 +19,10 @@ import com.powsybl.math.matrix.DenseMatrixFactory; import com.powsybl.openloadflow.OpenLoadFlowParameters; import com.powsybl.openloadflow.OpenLoadFlowProvider; +import com.powsybl.openloadflow.ac.solver.MaxVoltageChangeStateVectorScaling; +import com.powsybl.openloadflow.ac.solver.StateVectorScalingMode; import com.powsybl.openloadflow.graph.NaiveGraphConnectivityFactory; -import com.powsybl.openloadflow.network.EurostagFactory; -import com.powsybl.openloadflow.network.LfBus; +import com.powsybl.openloadflow.network.*; import com.powsybl.openloadflow.util.LoadFlowAssert; import org.junit.jupiter.api.Test; @@ -38,8 +40,14 @@ class AcLoadFlowReportTest { void testEsgTutoDetailedNrLogsLf() throws IOException { Network network = EurostagFactory.fix(EurostagTutorialExample1Factory.create()); ReporterModel reporter = new ReporterModel("testEsgTutoReport", "Test ESG tutorial report"); - var lfParameters = new LoadFlowParameters(); - OpenLoadFlowParameters.create(lfParameters).setReportedFeatures(Set.of(OpenLoadFlowParameters.ReportedFeatures.NEWTON_RAPHSON_LOAD_FLOW)); + var lfParameters = new LoadFlowParameters() + .setTransformerVoltageControlOn(true); + var olfParameters = OpenLoadFlowParameters.create(lfParameters); + olfParameters.setReportedFeatures(Set.of(OpenLoadFlowParameters.ReportedFeatures.NEWTON_RAPHSON_LOAD_FLOW)) + .setTransformerVoltageControlMode(OpenLoadFlowParameters.TransformerVoltageControlMode.INCREMENTAL_VOLTAGE_CONTROL) + .setStateVectorScalingMode(StateVectorScalingMode.MAX_VOLTAGE_CHANGE) + .setMaxVoltageChangeStateVectorScalingMaxDv(MaxVoltageChangeStateVectorScaling.DEFAULT_MAX_DV / 10) + .setMaxVoltageChangeStateVectorScalingMaxDphi(MaxVoltageChangeStateVectorScaling.DEFAULT_MAX_DPHI / 10); LoadFlowProvider provider = new OpenLoadFlowProvider(new DenseMatrixFactory(), new NaiveGraphConnectivityFactory<>(LfBus::getNum)); LoadFlow.Runner runner = new LoadFlow.Runner(provider); @@ -48,4 +56,48 @@ void testEsgTutoDetailedNrLogsLf() throws IOException { assertEquals(LoadFlowResult.ComponentResult.Status.CONVERGED, result.getComponentResults().get(0).getStatus()); LoadFlowAssert.assertReportEquals("/esgTutoReportDetailedNrReportLf.txt", reporter); } + + @Test + void testShuntVoltageControlOuterLoopReport() throws IOException { + Network network = ShuntNetworkFactory.createWithTwoShuntCompensators(); + ReporterModel reporter = new ReporterModel("testReport", "Test Report"); + var lfParameters = new LoadFlowParameters() + .setShuntCompensatorVoltageControlOn(true); + var olfParameters = OpenLoadFlowParameters.create(lfParameters); + olfParameters.setReportedFeatures(Set.of(OpenLoadFlowParameters.ReportedFeatures.NEWTON_RAPHSON_LOAD_FLOW)) + .setStateVectorScalingMode(StateVectorScalingMode.LINE_SEARCH) + .setShuntVoltageControlMode(OpenLoadFlowParameters.ShuntVoltageControlMode.INCREMENTAL_VOLTAGE_CONTROL); + + LoadFlowProvider provider = new OpenLoadFlowProvider(new DenseMatrixFactory(), new NaiveGraphConnectivityFactory<>(LfBus::getNum)); + LoadFlow.Runner runner = new LoadFlow.Runner(provider); + LoadFlowResult result = runner.run(network, network.getVariantManager().getWorkingVariantId(), LocalComputationManager.getDefault(), lfParameters, reporter); + + assertEquals(LoadFlowResult.ComponentResult.Status.CONVERGED, result.getComponentResults().get(0).getStatus()); + LoadFlowAssert.assertReportEquals("/shuntVoltageControlOuterLoopReport.txt", reporter); + } + + @Test + void testTransformerReactivePowerControlOuterLoopReport() throws IOException { + Network network = VoltageControlNetworkFactory.createNetworkWithT2wt(); + var t2wt = network.getTwoWindingsTransformer("T2wT"); + t2wt.getRatioTapChanger() + .setTargetDeadband(0) + .setRegulating(true) + .setTapPosition(0) + .setRegulationTerminal(t2wt.getTerminal1()) + .setRegulationMode(RatioTapChanger.RegulationMode.REACTIVE_POWER) + .setRegulationValue(-0.55); + ReporterModel reporter = new ReporterModel("testReport", "Test Report"); + var lfParameters = new LoadFlowParameters(); + var olfParameters = OpenLoadFlowParameters.create(lfParameters); + olfParameters.setReportedFeatures(Set.of(OpenLoadFlowParameters.ReportedFeatures.NEWTON_RAPHSON_LOAD_FLOW)) + .setTransformerReactivePowerControl(true); + + LoadFlowProvider provider = new OpenLoadFlowProvider(new DenseMatrixFactory(), new NaiveGraphConnectivityFactory<>(LfBus::getNum)); + LoadFlow.Runner runner = new LoadFlow.Runner(provider); + LoadFlowResult result = runner.run(network, network.getVariantManager().getWorkingVariantId(), LocalComputationManager.getDefault(), lfParameters, reporter); + + assertEquals(LoadFlowResult.ComponentResult.Status.CONVERGED, result.getComponentResults().get(0).getStatus()); + LoadFlowAssert.assertReportEquals("/transformerReactivePowerControlOuterLoopReport.txt", reporter); + } } diff --git a/src/test/resources/detailedNrReportSecurityAnalysis.txt b/src/test/resources/detailedNrReportSecurityAnalysis.txt index 82058e5b3b..0f5a67f829 100644 --- a/src/test/resources/detailedNrReportSecurityAnalysis.txt +++ b/src/test/resources/detailedNrReportSecurityAnalysis.txt @@ -1,76 +1,167 @@ + Test report of security analysis + AC security analysis on network 'test' + Network CC0 SC0 - + Post loading processing + + Network info Network has 2 buses and 2 branches Network balance: active generation=603.77 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar + Pre-contingency simulation - AC load flow complete with NR status 'CONVERGED' - + Newton Raphson on Network CC0 SC0 || No outer loops calculations + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + + Newton Raphson on Network CC0 SC0 + No outer loops have been launched + Initial mismatch - Initial mismatch on TargetP: 6.0, Bus Id: 'VL2_0', Bus V: 1.0, Bus Phi: 0.0 - Initial mismatch on TargetQ: 1.382400000000004, Bus Id: 'VL2_0', Bus V: 1.0, Bus Phi: 0.0 - Initial mismatch on TargetV: 0.0050000000000000044, Bus Id: 'VL1_0', Bus V: 1.0, Bus Phi: 0.0 - Norm |f(x0)|=6.157195364774453 - + Iteration 0 mismatch - Iteration 0 mismatch on TargetP: 0.198586549381778, Bus Id: 'VL2_0', Bus V: 0.9747979766262653, Bus Phi: -0.0605498160569332 - Iteration 0 mismatch on TargetQ: 0.2032848645560701, Bus Id: 'VL2_0', Bus V: 0.9747979766262653, Bus Phi: -0.0605498160569332 - Iteration 0 mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: -3.837262538969321E-18 - Norm |f(x)|=0.2841854214292864 + Newton-Raphson norm |f(x)|=6.157195364774453 + + Largest P mismatch: 6.0 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.0 MW, -61.75999999999959 MVar + + Largest Q mismatch: 1.382400000000004 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.0 MW, -61.75999999999959 MVar + + Largest V mismatch: 0.0050000000000000044 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.0 MW, -61.75999999999959 MVar + Iteration 1 mismatch - Iteration 1 mismatch on TargetP: 5.888575667736262E-4, Bus Id: 'VL2_0', Bus V: 0.9722510849126529, Bus Phi: -0.06262369456754548 - Iteration 1 mismatch on TargetQ: 7.419850491046098E-4, Bus Id: 'VL2_0', Bus V: 0.9722510849126529, Bus Phi: -0.06262369456754548 - Iteration 1 mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: 1.9067248874188215E-19 - Norm |f(x)|=9.472565898642911E-4 + Newton-Raphson norm |f(x)|=0.2841854214292864 + + Largest P mismatch: 0.198586549381778 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9747979766262653 pu, -0.0605498160569332 rad + Bus injection: -580.1413450618222 MW, -179.67151354439298 MVar + + Largest Q mismatch: 0.2032848645560701 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9747979766262653 pu, -0.0605498160569332 rad + Bus injection: -580.1413450618222 MW, -179.67151354439298 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, -3.837262538969321E-18 rad + Bus injection: 583.6063055584335 MW, 97.95586256541282 MVar + Iteration 2 mismatch - Iteration 2 mismatch on TargetP: 6.330032498169658E-9, Bus Id: 'VL2_0', Bus V: 0.9722419525004928, Bus Phi: -0.06262984207097894 - Iteration 2 mismatch on TargetQ: 8.8904832384884E-9, Bus Id: 'VL2_0', Bus V: 0.9722419525004928, Bus Phi: -0.06262984207097894 - Iteration 2 mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: 8.551939024446748E-22 - Norm |f(x)|=1.0913752958617269E-8 + Newton-Raphson norm |f(x)|=9.472565898642911E-4 + + Largest P mismatch: 5.888575667736262E-4 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9722510849126529 pu, -0.06262369456754548 rad + Bus injection: -599.9411142433227 MW, -199.92580149508953 MVar + + Largest Q mismatch: 7.419850491046098E-4 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9722510849126529 pu, -0.06262369456754548 rad + Bus injection: -599.9411142433227 MW, -199.92580149508953 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, 1.9067248874188215E-19 rad + Bus injection: 603.7095184961156 MW, 121.85429492605064 MVar + + Iteration 3 mismatch + Newton-Raphson norm |f(x)|=1.0913752958617269E-8 + + Largest P mismatch: 6.330032498169658E-9 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9722419525004928 pu, -0.06262984207097894 rad + Bus injection: -599.9999993669968 MW, -199.99999911095168 MVar + + Largest Q mismatch: 8.8904832384884E-9 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9722419525004928 pu, -0.06262984207097894 rad + Bus injection: -599.9999993669968 MW, -199.99999911095168 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, 8.551939024446748E-22 rad + Bus injection: 603.7693866643697 MW, 121.9404027609291 MVar + Outer loop DistributedSlack - Iteration 0: already balanced + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Post-contingency simulation 'L2' - AC load flow complete with NR status 'CONVERGED' - + Newton Raphson on Network CC0 SC0 || No outer loops calculations + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + + Newton Raphson on Network CC0 SC0 + No outer loops have been launched + Initial mismatch - Initial mismatch on TargetP: 3.000000003165016, Bus Id: 'VL2_0', Bus V: 0.9722419525004927, Bus Phi: -0.06262984207097894 - Initial mismatch on TargetQ: 1.0000000044452348, Bus Id: 'VL2_0', Bus V: 0.9722419525004927, Bus Phi: -0.06262984207097894 - Initial mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: 8.551939024446748E-22 - Norm |f(x0)|=3.1622776645766835 - + Iteration 0 mismatch - Iteration 0 mismatch on TargetP: 0.11845710686545807, Bus Id: 'VL2_0', Bus V: 0.9401501906483334, Bus Phi: -0.12680740376424912 - Iteration 0 mismatch on TargetQ: 0.1256912940021302, Bus Id: 'VL2_0', Bus V: 0.9401501906483334, Bus Phi: -0.12680740376424912 - Iteration 0 mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: 2.9370266603027536E-18 - Norm |f(x)|=0.17271475777959588 + Newton-Raphson norm |f(x)|=3.1622776645766835 + + Largest P mismatch: 3.000000003165016 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9722419525004927 pu, -0.06262984207097894 rad + Bus injection: -299.9999996834984 MW, -99.99999955547652 MVar + + Largest Q mismatch: 1.0000000044452348 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9722419525004927 pu, -0.06262984207097894 rad + Bus injection: -299.9999996834984 MW, -99.99999955547652 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, 8.551939024446748E-22 rad + Bus injection: 301.88469333218484 MW, 60.97020138046526 MVar + Iteration 1 mismatch - Iteration 1 mismatch on TargetP: 5.757800425625348E-4, Bus Id: 'VL2_0', Bus V: 0.9365727773021071, Bus Phi: -0.12966726750633736 - Iteration 1 mismatch on TargetQ: 6.850519413115208E-4, Bus Id: 'VL2_0', Bus V: 0.9365727773021071, Bus Phi: -0.12966726750633736 - Iteration 1 mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: 8.697058116493226E-20 - Norm |f(x)|=8.948848080663778E-4 + Newton-Raphson norm |f(x)|=0.17271475777959588 + + Largest P mismatch: 0.11845710686545807 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9401501906483334 pu, -0.12680740376424912 rad + Bus injection: -588.1542893134542 MW, -187.43087059978697 MVar + + Largest Q mismatch: 0.1256912940021302 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9401501906483334 pu, -0.12680740376424912 rad + Bus injection: -588.1542893134542 MW, -187.43087059978697 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, 2.9370266603027536E-18 rad + Bus injection: 596.0364719674914 MW, 216.26861986964926 MVar + Iteration 2 mismatch - Iteration 2 mismatch on TargetP: 1.5427132460388293E-8, Bus Id: 'VL2_0', Bus V: 0.9365534403203294, Bus Phi: -0.12968139838112844 - Iteration 2 mismatch on TargetQ: 1.9380048676964634E-8, Bus Id: 'VL2_0', Bus V: 0.9365534403203294, Bus Phi: -0.12968139838112844 - Iteration 2 mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: -2.5754427337441792E-23 - Norm |f(x)|=2.477060158074254E-8 + Newton-Raphson norm |f(x)|=8.948848080663778E-4 + + Largest P mismatch: 5.757800425625348E-4 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9365727773021071 pu, -0.12966726750633736 rad + Bus injection: -599.9424219957438 MW, -199.93149480586885 MVar + + Largest Q mismatch: 6.850519413115208E-4 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9365727773021071 pu, -0.12966726750633736 rad + Bus injection: -599.9424219957438 MW, -199.93149480586885 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, 8.697058116493226E-20 rad + Bus injection: 608.2747601785369 MW, 233.92827746196554 MVar + + Iteration 3 mismatch + Newton-Raphson norm |f(x)|=2.477060158074254E-8 + + Largest P mismatch: 1.5427132460388293E-8 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9365534403203294 pu, -0.12968139838112844 rad + Bus injection: -599.9999984572868 MW, -199.99999806199514 MVar + + Largest Q mismatch: 1.9380048676964634E-8 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9365534403203294 pu, -0.12968139838112844 rad + Bus injection: -599.9999984572868 MW, -199.99999806199514 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, -2.5754427337441792E-23 rad + Bus injection: 608.3346721675024 MW, 234.0235900120997 MVar + Outer loop DistributedSlack - Iteration 0: slack bus active power (4.564672167502337 MW) distributed in 1 iterations - Iteration 1: already balanced - + Newton Raphson on Network CC0 SC0 || Outer loop iteration 1 and type `DistributedSlack` + + Outer loop iteration 1 + Slack bus active power (4.564672167502337 MW) distributed in 1 distribution iteration(s) + + Newton Raphson on Network CC0 SC0 + Newton-Raphson of outer loop iteration 1 of type DistributedSlack + Initial mismatch - Initial mismatch on TargetP: 1.5427132460388293E-8, Bus Id: 'VL2_0', Bus V: 0.9365534403203294, Bus Phi: -0.12968139838112844 - Initial mismatch on TargetQ: 1.9380048676964634E-8, Bus Id: 'VL2_0', Bus V: 0.9365534403203294, Bus Phi: -0.12968139838112844 - Initial mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: -2.5754427337441792E-23 - Norm |f(x0)|=2.477060158074254E-8 - + Iteration 0 mismatch - Iteration 0 mismatch on TargetP: 8.881784197001252E-16, Bus Id: 'VL2_0', Bus V: 0.9365534397778421, Bus Phi: -0.12968139876104615 - Iteration 0 mismatch on TargetQ: 8.215650382226158E-15, Bus Id: 'VL2_0', Bus V: 0.9365534397778421, Bus Phi: -0.12968139876104615 - Iteration 0 mismatch on TargetV: 0.0, Bus Id: 'VL1_0', Bus V: 0.995, Bus Phi: 2.3836834369535747E-26 - Norm |f(x)|=8.263520563790825E-15 + Newton-Raphson norm |f(x)|=2.477060158074254E-8 + + Largest P mismatch: 1.5427132460388293E-8 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9365534403203294 pu, -0.12968139838112844 rad + Bus injection: -599.9999984572868 MW, -199.99999806199514 MVar + + Largest Q mismatch: 1.9380048676964634E-8 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9365534403203294 pu, -0.12968139838112844 rad + Bus injection: -599.9999984572868 MW, -199.99999806199514 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, -2.5754427337441792E-23 rad + Bus injection: 608.3346721675024 MW, 234.0235900120997 MVar + + Iteration 1 mismatch + Newton-Raphson norm |f(x)|=8.263520563790825E-15 + + Largest P mismatch: 8.881784197001252E-16 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9365534397778421 pu, -0.12968139876104615 rad + Bus injection: -599.9999999999999 MW, -199.99999999999918 MVar + + Largest Q mismatch: 8.215650382226158E-15 + Bus Id: VL2_0 (nominalVoltage=400.0kV) + Bus V: 0.9365534397778421 pu, -0.12968139876104615 rad + Bus injection: -599.9999999999999 MW, -199.99999999999918 MVar + + Largest V mismatch: 0.0 + Bus Id: VL1_0 (nominalVoltage=400.0kV) + Bus V: 0.995 pu, 2.3836834369535747E-26 rad + Bus injection: 608.3346737740034 MW, 234.0235926831469 MVar + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Outer loop DistributedSlack - Iteration 1: already balanced + Outer loop VoltageMonitoring + Outer loop ReactiveLimits diff --git a/src/test/resources/esgTutoReport.txt b/src/test/resources/esgTutoReport.txt index 6cdd4ef9a2..94a9be834c 100644 --- a/src/test/resources/esgTutoReport.txt +++ b/src/test/resources/esgTutoReport.txt @@ -1,23 +1,22 @@ + Test ESG tutorial report + Load flow on network 'sim1' + Network CC0 SC0 - AC load flow complete with NR status 'CONVERGED' - + Post loading processing + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + + Network info Network has 4 buses and 4 branches Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar + Outer loop DistributedSlack - Iteration 0: slack bus active power (-1.4404045651219555 MW) distributed in 1 iterations - Iteration 1: already balanced + + Outer loop iteration 1 + Slack bus active power (-1.4404045651219555 MW) distributed in 1 distribution iteration(s) + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Outer loop DistributedSlack - Iteration 1: already balanced + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Sensitivity analysis on network 'sim1' + Network CC0 SC0 - AC load flow complete with NR status 'CONVERGED' - + Post loading processing + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + + Network info Network has 4 buses and 4 branches Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar + Outer loop VoltageMonitoring diff --git a/src/test/resources/esgTutoReportDetailedNrReportLf.txt b/src/test/resources/esgTutoReportDetailedNrReportLf.txt index ae8d893b5a..2baa214007 100644 --- a/src/test/resources/esgTutoReportDetailedNrReportLf.txt +++ b/src/test/resources/esgTutoReportDetailedNrReportLf.txt @@ -1,48 +1,230 @@ + Test ESG tutorial report + Load flow on network 'sim1' + Network CC0 SC0 - AC load flow complete with NR status 'CONVERGED' - + Post loading processing + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + + Network info Network has 4 buses and 4 branches Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar - + Newton Raphson on Network CC0 SC0 || No outer loops calculations + + Newton Raphson on Network CC0 SC0 + No outer loops have been launched + Initial mismatch - Initial mismatch on TargetP: 5.999135514403292, Bus Id: 'VLLOAD_0', Bus V: 1.0, Bus Phi: 0.0 - Initial mismatch on TargetQ: -7.397518453004565, Bus Id: 'VLHV1_0', Bus V: 1.0, Bus Phi: 0.0 - Initial mismatch on TargetV: -0.02083333333333326, Bus Id: 'VLGEN_0', Bus V: 1.0, Bus Phi: 0.0 - Norm |f(x0)|=11.37683042330867 - + Iteration 0 mismatch - Iteration 0 mismatch on TargetP: 0.5654241868659025, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.044267798791154236 - Iteration 0 mismatch on TargetQ: 0.9076781074655959, Bus Id: 'VLHV1_0', Bus V: 1.0713810414454683, Bus Phi: -3.393522766578452E-17 - Iteration 0 mismatch on TargetV: 0.0, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.044267798791154236 - Norm |f(x)|=1.370521997338349 + Newton-Raphson norm |f(x)|=11.37683042330867 + + Largest P mismatch: 5.999135514403292 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: -0.08644855967077092 MW, -7.409372242783974 MVar + + Largest Q mismatch: -7.397518453004565 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: -16.421052631578938 MW, -739.7518453004566 MVar + + Largest V mismatch: -0.02083333333333326 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 17.28531855955677 MW, 720.0141529478491 MVar + Iteration 1 mismatch - Iteration 1 mismatch on TargetP: -0.011906013412646743, Bus Id: 'VLHV2_0', Bus V: 1.0267735150466015, Bus Phi: -0.06136319436584185 - Iteration 1 mismatch on TargetQ: 0.015807200344973626, Bus Id: 'VLHV2_0', Bus V: 1.0267735150466015, Bus Phi: -0.06136319436584185 - Iteration 1 mismatch on TargetV: 0.0, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.0407316584549734 - Norm |f(x)|=0.02735383065047368 + Step size: 0.09999453867818636 (max voltage change: 4 Vmagnitude and 3 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=10.228932702172408 + + Largest P mismatch: 5.395555353142906 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 1.0013388273049286 pu, -0.017453292519943295 rad + Bus injection: -60.44446468570944 MW, -26.366765375553303 MVar + + Largest Q mismatch: -6.649051129267704 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.007137714309708 pu, -3.3933374353793497E-18 rad + Bus injection: -15.364596536923203 MW, -664.9051129267705 MVar + + Largest V mismatch: -0.018750113777537658 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0020832195557956 pu, 0.004426538118420244 rad + Bus injection: 76.81251609891439 MW, 652.3943519407725 MVar + Iteration 2 mismatch - Iteration 2 mismatch on TargetP: -1.2624760780788336E-5, Bus Id: 'VLHV2_0', Bus V: 1.0261840057810543, Bus Phi: -0.0611984592137325 - Iteration 2 mismatch on TargetQ: 1.0873067915362356E-5, Bus Id: 'VLHV2_0', Bus V: 1.0261840057810543, Bus Phi: -0.0611984592137325 - Iteration 2 mismatch on TargetV: 0.0, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.04069359966489529 - Norm |f(x)|=2.0034253596371782E-5 + Step size: 0.11309195027587907 (max voltage change: 3 Vmagnitude and 3 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=9.062327573601486 + + Largest P mismatch: 4.782292746912071 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 1.002071446590196 pu, -0.03490658503988659 rad + Bus injection: -121.77072530879289 MW, -45.68329916719199 MVar + + Largest Q mismatch: -5.888446407090606 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0140966850631288 pu, -9.09535092570814E-18 rad + Bus injection: -14.200435290321778 MW, -588.8446407090606 MVar + + Largest V mismatch: -0.016629626842541212 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.004203706490792 pu, 0.008839266427912103 rad + Bus injection: 137.32334592437454 MW, 587.7607873023553 MVar + + Iteration 3 mismatch + Step size: 0.1294131183328685 (max voltage change: 3 Vmagnitude and 3 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=7.8803036184414585 + + Largest P mismatch: 4.161012216587405 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 1.0021700896188834 pu, -0.05235987755982989 rad + Bus injection: -183.89877834125943 MW, -65.31412433765983 MVar + + Largest Q mismatch: -5.117903120658085 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0208544578794392 pu, -7.533671555116414E-18 rad + Bus injection: -12.92855519724494 MW, -511.79031206580856 MVar + + Largest V mismatch: -0.014477534976135908 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0063557983571974 pu, 0.01322778525159191 rad + Bus injection: 198.64551155598122 MW, 526.3561799906806 MVar + + Iteration 4 mismatch + Step size: 0.15040030288563372 (max voltage change: 3 Vmagnitude and 3 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=6.686495581216461 + + Largest P mismatch: 3.533535340005823 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 1.0016059994409374 pu, -0.06981317007977318 rad + Bus injection: -246.64646599941767 MW, -85.21096792819421 MVar + + Largest Q mismatch: -4.339863096604995 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0273874172757993 pu, -3.806729596884454E-18 rad + Bus injection: -11.548773596097206 MW, -433.98630966049956 MVar + + Largest V mismatch: -0.012300109330687814 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0085332240026454 pu, 0.01758121728174107 rad + Bus injection: 260.58784669232773 MW, 468.4314270871509 MVar + + Iteration 5 mismatch + Step size: 0.1785220144723537 (max voltage change: 3 Vmagnitude and 3 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=5.484913188051187 + + Largest P mismatch: 2.9018436665407834 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 1.0003487249237308 pu, -0.08726646259971647 rad + Bus injection: -309.81563334592164 MW, -105.32286121476304 MVar + + Largest Q mismatch: -3.557038748973915 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0336704433833774 pu, -4.6172827709991395E-18 rad + Bus injection: -10.060437864099736 MW, -355.7038748973915 MVar + + Largest V mismatch: -0.010104269034743263 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.01072906429859 pu, 0.021888112773674064 rad + Bus injection: 322.938379097118 MW, 414.2496037271749 MVar + + Iteration 6 mismatch + Step size: 0.21838463529211896 (max voltage change: 3 Vmagnitude and 3 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=4.279995252280728 + + Largest P mismatch: 2.268084260407014 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 0.9983646618789228 pu, -0.10471975511965977 rad + Bus injection: -373.1915739592986 MW, -125.59753509509721 MVar + + Largest Q mismatch: -2.772464965017049 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0396762073780579 pu, -4.519103360866447E-18 rad + Bus injection: -8.461851452808045 MW, -277.24649650170494 MVar + + Largest V mismatch: -0.007897651926697336 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.012935681406636 pu, 0.026136244995432708 rad + Bus injection: 385.46070239053256 MW, 364.09448862958715 MVar + + Iteration 7 mismatch + Step size: 0.27968884360587004 (max voltage change: 1 Vmagnitude and 2 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=3.0767277812037412 + + Largest P mismatch: 1.6345831659389 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 0.9956137812133679 pu, -0.12217304763960306 rad + Bus injection: -436.54168340611 MW, -145.98436894855388 MVar + + Largest Q mismatch: -1.9896114671586909 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0453735923878082 pu, -2.9407832157867265E-18 rad + Bus injection: -6.749041818531598 MW, -198.9611467158691 MVar + + Largest V mismatch: -0.0056887667921177165 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0151445665412155 pu, 0.030312141092074293 rad + Bus injection: 447.88611248846627 MW, 318.290009250138 MVar + + Iteration 8 mismatch + Step size: 0.3869690601839303 (max voltage change: 1 Vmagnitude and 1 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=1.8809527807906872 + + Largest P mismatch: 1.0038830769960683 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 0.9920410495652902 pu, -0.13962634015954636 rad + Bus injection: -499.6116923003932 MW, -166.44185995476562 MVar + + Largest Q mismatch: -1.2126741624349 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0507235509169282 pu, -1.4303757627634975E-18 rad + Bus injection: -4.912581394454385 MW, -121.26741624349 MVar + + Largest V mismatch: -0.003487390052966388 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0173459432803669 pu, 0.034399841024383176 rad + Bus injection: 509.8931867803632 MW, 277.2516749199673 MVar + + Iteration 9 mismatch + Step size: 0.6255186833355155 (max voltage change: 0 Vmagnitude and 1 Vangle changes outside configured thresholds) + Newton-Raphson norm |f(x)|=0.700472165763143 + + Largest P mismatch: 0.3788752833871243 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 0.9875460446126871 pu, -0.15707963267948966 rad + Bus injection: -562.1124716612876 MW, -186.96386119432594 MVar + + Largest Q mismatch: -0.44759941817598314 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0556644460297175 pu, 8.105363974705174E-19 rad + Bus injection: -2.9262804230342887 MW, -44.75994181759832 MVar + + Largest V mismatch: -0.001305962418757467 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0195273709145758 pu, 0.038376503969124384 rad + Bus injection: 571.0359551888101 MW, 241.66934854723237 MVar + + Iteration 10 mismatch + Newton-Raphson norm |f(x)|=0.004701433803505629 + + Largest P mismatch: -0.0023082869445101295 + Bus Id: VLHV2_0 (nominalVoltage=380.0kV) + Bus V: 1.0262916191906715 pu, -0.0611999152300691 rad + Bus injection: -0.23082869445101295 MW, 0.20024309938646567 MVar + + Largest Q mismatch: 0.0021575796246684487 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.058316112111486 pu, -6.654037647817311E-19 rad + Bus injection: -1.5128392054086781 MW, 0.21575796246684487 MVar + + Largest V mismatch: 0.0 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.040701599763530286 rad + Bus injection: 607.1306428683112 MW, 224.67289138823915 MVar + + Iteration 11 mismatch + Newton-Raphson norm |f(x)|=1.1891697174742266E-6 + + Largest P mismatch: -7.676647113541435E-7 + Bus Id: VLHV2_0 (nominalVoltage=380.0kV) + Bus V: 1.0261835685456766 pu, -0.06119834424281167 rad + Bus injection: -7.676647113541435E-5 MW, 2.570577590788048E-5 MVar + + Largest Q mismatch: 3.9964244491486056E-7 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 0.9838493767815336 pu, -0.16780694423655637 rad + Bus injection: -599.99992364013 MW, -199.99996003575552 MVar + + Largest V mismatch: 0.0 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.040693592599170804 rad + Bus injection: 607.0000058806454 MW, 225.40632634912754 MVar + Outer loop DistributedSlack - Iteration 0: slack bus active power (-1.4404045651219555 MW) distributed in 1 iterations - Iteration 1: already balanced - + Newton Raphson on Network CC0 SC0 || Outer loop iteration 1 and type `DistributedSlack` + + Outer loop iteration 1 + Slack bus active power (-1.4414990648546677 MW) distributed in 1 distribution iteration(s) + + Newton Raphson on Network CC0 SC0 + Newton-Raphson of outer loop iteration 1 of type DistributedSlack + Initial mismatch - Initial mismatch on TargetP: 0.014405609240325745, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.04069359966489529 - Initial mismatch on TargetQ: 1.0873067915362356E-5, Bus Id: 'VLHV2_0', Bus V: 1.0261840057810543, Bus Phi: -0.0611984592137325 - Initial mismatch on TargetV: 0.0, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.04069359966489529 - Norm |f(x0)|=0.014405623086540364 - + Iteration 0 mismatch - Iteration 0 mismatch on TargetP: -1.0630223634677805E-7, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.040596030807101224 - Iteration 0 mismatch on TargetQ: 7.02222821225007E-7, Bus Id: 'VLHV1_0', Bus V: 1.058270597695305, Bus Phi: -1.0929937937293232E-22 - Iteration 0 mismatch on TargetV: 0.0, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.040596030807101224 - Norm |f(x)|=7.102239009042218E-7 + Newton-Raphson norm |f(x)|=0.014415049503930941 + + Largest P mismatch: 0.014415049455000606 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.040693592599170804 rad + Bus injection: 607.0000058806454 MW, 225.40632634912754 MVar + + Largest Q mismatch: 3.996424380314778E-7 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 0.9838493767815335 pu, -0.16780694423655637 rad + Bus injection: -599.99992364013 MW, -199.9999600357562 MVar + + Largest V mismatch: 0.0 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.040693592599170804 rad + Bus injection: 607.0000058806454 MW, 225.40632634912754 MVar + + Iteration 1 mismatch + Newton-Raphson norm |f(x)|=7.116294609013841E-7 + + Largest P mismatch: -1.0915024528657113E-7 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.04059595665621846 rad + Bus injection: 605.5584900201209 MW, 225.2825348319027 MVar + + Largest Q mismatch: 7.032079647473211E-7 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0582706031274327 pu, 9.603312518203627E-24 rad + Bus injection: -0.002950111193378291 MW, 7.03207964747321E-5 MVar + + Largest V mismatch: 0.0 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.04059595665621846 rad + Bus injection: 605.5584900201209 MW, 225.2825348319027 MVar + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + + Outer loop IncrementalTransformerVoltageControl + + Outer loop iteration 2 + 1 voltage-controlled buses are outside of their target deadbands + Outer loop DistributedSlack - Iteration 1: already balanced + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + + Outer loop IncrementalTransformerVoltageControl + + Outer loop iteration 2 + 1 voltage-controlled buses are outside of their target deadbands diff --git a/src/test/resources/esgTutoReportDetailedNrReportSensi.txt b/src/test/resources/esgTutoReportDetailedNrReportSensi.txt index 42b8e80125..d6e1624445 100644 --- a/src/test/resources/esgTutoReportDetailedNrReportSensi.txt +++ b/src/test/resources/esgTutoReportDetailedNrReportSensi.txt @@ -1,30 +1,67 @@ + Test ESG tutorial report + Sensitivity analysis on network 'sim1' + Network CC0 SC0 - AC load flow complete with NR status 'CONVERGED' - + Post loading processing + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + + Network info Network has 4 buses and 4 branches Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar - + Newton Raphson on Network CC0 SC0 || No outer loops calculations + + Newton Raphson on Network CC0 SC0 + No outer loops have been launched + Initial mismatch - Initial mismatch on TargetP: 5.999135514403292, Bus Id: 'VLLOAD_0', Bus V: 1.0, Bus Phi: 0.0 - Initial mismatch on TargetQ: -7.397518453004565, Bus Id: 'VLHV1_0', Bus V: 1.0, Bus Phi: 0.0 - Initial mismatch on TargetV: -0.02083333333333326, Bus Id: 'VLGEN_0', Bus V: 1.0, Bus Phi: 0.0 - Norm |f(x0)|=11.37683042330867 - + Iteration 0 mismatch - Iteration 0 mismatch on TargetP: 0.5654241868659025, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.044267798791154236 - Iteration 0 mismatch on TargetQ: 0.9076781074655959, Bus Id: 'VLHV1_0', Bus V: 1.0713810414454683, Bus Phi: -3.393522766578452E-17 - Iteration 0 mismatch on TargetV: 0.0, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.044267798791154236 - Norm |f(x)|=1.370521997338349 + Newton-Raphson norm |f(x)|=11.37683042330867 + + Largest P mismatch: 5.999135514403292 + Bus Id: VLLOAD_0 (nominalVoltage=150.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: -0.08644855967077092 MW, -7.409372242783974 MVar + + Largest Q mismatch: -7.397518453004565 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: -16.421052631578938 MW, -739.7518453004566 MVar + + Largest V mismatch: -0.02083333333333326 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 17.28531855955677 MW, 720.0141529478491 MVar + Iteration 1 mismatch - Iteration 1 mismatch on TargetP: -0.011906013412646743, Bus Id: 'VLHV2_0', Bus V: 1.0267735150466015, Bus Phi: -0.06136319436584185 - Iteration 1 mismatch on TargetQ: 0.015807200344973626, Bus Id: 'VLHV2_0', Bus V: 1.0267735150466015, Bus Phi: -0.06136319436584185 - Iteration 1 mismatch on TargetV: 0.0, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.0407316584549734 - Norm |f(x)|=0.02735383065047368 + Newton-Raphson norm |f(x)|=1.370521997338349 + + Largest P mismatch: 0.5654241868659025 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.044267798791154236 rad + Bus injection: 663.5424186865903 MW, 43.17685390493645 MVar + + Largest Q mismatch: 0.9076781074655959 + Bus Id: VLHV1_0 (nominalVoltage=380.0kV) + Bus V: 1.0713810414454683 pu, -3.393522766578452E-17 rad + Bus injection: 12.229716367035337 MW, 90.76781074655959 MVar + + Largest V mismatch: 0.0 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.044267798791154236 rad + Bus injection: 663.5424186865903 MW, 43.17685390493645 MVar + Iteration 2 mismatch - Iteration 2 mismatch on TargetP: -1.2624760780788336E-5, Bus Id: 'VLHV2_0', Bus V: 1.0261840057810543, Bus Phi: -0.0611984592137325 - Iteration 2 mismatch on TargetQ: 1.0873067915362356E-5, Bus Id: 'VLHV2_0', Bus V: 1.0261840057810543, Bus Phi: -0.0611984592137325 - Iteration 2 mismatch on TargetV: 0.0, Bus Id: 'VLGEN_0', Bus V: 1.0208333333333333, Bus Phi: 0.04069359966489529 - Norm |f(x)|=2.0034253596371782E-5 + Newton-Raphson norm |f(x)|=0.02735383065047368 + + Largest P mismatch: -0.011906013412646743 + Bus Id: VLHV2_0 (nominalVoltage=380.0kV) + Bus V: 1.0267735150466015 pu, -0.06136319436584185 rad + Bus injection: -1.1906013412646743 MW, 1.5807200344973626 MVar + + Largest Q mismatch: 0.015807200344973626 + Bus Id: VLHV2_0 (nominalVoltage=380.0kV) + Bus V: 1.0267735150466015 pu, -0.06136319436584185 rad + Bus injection: -1.1906013412646743 MW, 1.5807200344973626 MVar + + Largest V mismatch: 0.0 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.0407316584549734 rad + Bus injection: 607.6315237028163 MW, 221.29991685388833 MVar + + Iteration 3 mismatch + Newton-Raphson norm |f(x)|=2.0034253596371782E-5 + + Largest P mismatch: -1.2624760780788336E-5 + Bus Id: VLHV2_0 (nominalVoltage=380.0kV) + Bus V: 1.0261840057810543 pu, -0.0611984592137325 rad + Bus injection: -0.0012624760780788336 MW, 0.0010873067915362356 MVar + + Largest Q mismatch: 1.0873067915362356E-5 + Bus Id: VLHV2_0 (nominalVoltage=380.0kV) + Bus V: 1.0261840057810543 pu, -0.0611984592137325 rad + Bus injection: -0.0012624760780788336 MW, 0.0010873067915362356 MVar + + Largest V mismatch: 0.0 + Bus Id: VLGEN_0 (nominalVoltage=24.0kV) + Bus V: 1.0208333333333333 pu, 0.04069359966489529 rad + Bus injection: 607.0001563589107 MW, 225.40357009583855 MVar + Outer loop VoltageMonitoring + Outer loop ReactiveLimits diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml index 6bba63134c..97013e58bc 100644 --- a/src/test/resources/logback-test.xml +++ b/src/test/resources/logback-test.xml @@ -13,7 +13,7 @@ %-5p %d{HH:mm:ss.SSS} %-20C{1} | %m%n - + diff --git a/src/test/resources/saReport.txt b/src/test/resources/saReport.txt index 0754ca2917..89427a7a73 100644 --- a/src/test/resources/saReport.txt +++ b/src/test/resources/saReport.txt @@ -1,53 +1,49 @@ + Test security analysis report + AC security analysis on network 'sim1' + Network CC0 SC0 - + Post loading processing + + Network info Network has 4 buses and 4 branches Network balance: active generation=607.0 MW, active load=600.0 MW, reactive generation=0.0 MVar, reactive load=200.0 MVar + Pre-contingency simulation - AC load flow complete with NR status 'CONVERGED' + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + Outer loop DistributedSlack - Iteration 0: slack bus active power (-1.4404045651219555 MW) distributed in 1 iterations - Iteration 1: already balanced + + Outer loop iteration 1 + Slack bus active power (-1.4404045651219555 MW) distributed in 1 distribution iteration(s) + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Outer loop DistributedSlack - Iteration 1: already balanced + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Post-contingency simulation 'NHV1_NHV2_1' - AC load flow complete with NR status 'CONVERGED' + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + Outer loop DistributedSlack - Iteration 0: slack bus active power (5.803741102800952 MW) distributed in 1 iterations - Iteration 1: already balanced + + Outer loop iteration 1 + Slack bus active power (5.803741102800952 MW) distributed in 1 distribution iteration(s) + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Outer loop DistributedSlack - Iteration 1: already balanced + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Post-contingency simulation 'NHV1_NHV2_2' - AC load flow complete with NR status 'CONVERGED' + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + Outer loop DistributedSlack - Iteration 0: slack bus active power (5.803741102800952 MW) distributed in 1 iterations - Iteration 1: already balanced + + Outer loop iteration 1 + Slack bus active power (5.803741102800952 MW) distributed in 1 distribution iteration(s) + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Outer loop DistributedSlack - Iteration 1: already balanced + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Post-contingency simulation 'NGEN_NHV1' - 1 buses have a voltage magnitude out of range [0.5, 1.5]: {VLHV1_0=1.5105659472379578} - AC load flow complete with NR status 'UNREALISTIC_STATE' + 1 buses have a voltage magnitude out of the configured realistic range [0.5, 1.5] p.u.: {VLHV1_0=1.5105659472379578} + AC load flow completed with error (solverStatus=UNREALISTIC_STATE, outerloopStatus=STABLE) + Post-contingency simulation 'NHV2_NLOAD' - AC load flow complete with NR status 'CONVERGED' + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + Outer loop DistributedSlack - Iteration 0: slack bus active power (-5.4942194604343655 MW) distributed in 1 iterations - Iteration 1: already balanced + + Outer loop iteration 1 + Slack bus active power (-5.4942194604343655 MW) distributed in 1 distribution iteration(s) + Outer loop VoltageMonitoring + Outer loop ReactiveLimits + Outer loop DistributedSlack - Iteration 1: already balanced + Outer loop VoltageMonitoring + Outer loop ReactiveLimits diff --git a/src/test/resources/shuntVoltageControlOuterLoopReport.txt b/src/test/resources/shuntVoltageControlOuterLoopReport.txt new file mode 100644 index 0000000000..fe1b715e4d --- /dev/null +++ b/src/test/resources/shuntVoltageControlOuterLoopReport.txt @@ -0,0 +1,109 @@ ++ Test Report + + Load flow on network 'svc' + + Network CC0 SC0 + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + + Network info + Network has 3 buses and 2 branches + Network balance: active generation=101.36639999999998 MW, active load=101.0 MW, reactive generation=0.0 MVar, reactive load=150.0 MVar + + Newton Raphson on Network CC0 SC0 + No outer loops have been launched + + Initial mismatch + Newton-Raphson norm |f(x)|=1.8105633667165586 + + Largest P mismatch: -1.013664 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.0 MW, 0.0 MVar + + Largest Q mismatch: 1.5 + Bus Id: vl2_0 (nominalVoltage=400.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.0 MW, 0.0 MVar + + Largest V mismatch: 0.025000000000000022 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.0 MW, 0.0 MVar + + Iteration 1 mismatch + Step size: 1.0 (line search) + Newton-Raphson norm |f(x)|=0.05461496865497818 + + Largest P mismatch: -0.03809314566908595 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 9.63119999999999E-4 rad + Bus injection: 97.5570854330914 MW, 146.69848307367957 MVar + + Largest Q mismatch: 0.039137029195099204 + Bus Id: vl2_0 (nominalVoltage=400.0kV) + Bus V: 0.9715539599999999 pu, 0.0 rad + Bus injection: -97.35302343536962 MW, -146.08629708049008 MVar + + Largest V mismatch: 0.0 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 9.63119999999999E-4 rad + Bus injection: 97.5570854330914 MW, 146.69848307367957 MVar + + Iteration 2 mismatch + Step size: 1.0 (line search) + Newton-Raphson norm |f(x)|=5.084752243706919E-6 + + Largest P mismatch: -2.137764138820941E-6 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 0.0010125504427887688 rad + Bus injection: 101.36618622358611 MW, 150.64984395641986 MVar + + Largest Q mismatch: 4.613531171093754E-6 + Bus Id: vl2_0 (nominalVoltage=400.0kV) + Bus V: 0.9714536023666397 pu, 0.0 rad + Bus injection: -101.14941778707652 MW, -149.99953864688288 MVar + + Largest V mismatch: 0.0 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 0.0010125504427887688 rad + Bus injection: 101.36618622358611 MW, 150.64984395641986 MVar + + Outer loop DistributedSlack + + Outer loop VoltageMonitoring + + Outer loop ReactiveLimits + + Outer loop IncrementalShuntVoltageControl + + Outer loop iteration 1 + 1 shunts changed section + + Newton Raphson on Network CC0 SC0 + Newton-Raphson of outer loop iteration 1 of type IncrementalShuntVoltageControl + + Initial mismatch + Newton-Raphson norm |f(x)|=1.509955362490356 + + Largest P mismatch: -2.137764166576517E-6 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 0.0010125504427887688 rad + Bus injection: 101.36618622358333 MW, 150.64984395641432 MVar + + Largest Q mismatch: -1.5099553624817945 + Bus Id: vl3_0 (nominalVoltage=400.0kV) + Bus V: 0.9714536023666398 pu, 0.0 rad + Bus injection: 0.0 MW, -150.99553624817946 MVar + + Largest V mismatch: 0.0 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 0.0010125504427887688 rad + Bus injection: 101.36618622358333 MW, 150.64984395641432 MVar + + Iteration 1 mismatch + Step size: 1.0 (line search) + Newton-Raphson norm |f(x)|=0.010146616530480424 + + Largest P mismatch: 0.0014778992351438536 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 0.002023978884465056 rad + Bus injection: 101.51418992351438 MW, -3.118511494296854 MVar + + Largest Q mismatch: 0.009940184587354128 + Bus Id: vl3_0 (nominalVoltage=400.0kV) + Bus V: 0.9773610406575612 pu, -0.00101216205957038 rad + Bus injection: -0.13262676098725965 MW, 0.9940184587354128 MVar + + Largest V mismatch: 0.0 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 0.002023978884465056 rad + Bus injection: 101.51418992351438 MW, -3.118511494296854 MVar + + Iteration 2 mismatch + Step size: 1.0 (line search) + Newton-Raphson norm |f(x)|=4.319654056057837E-7 + + Largest P mismatch: -1.1677716833209109E-7 + Bus Id: vl3_0 (nominalVoltage=400.0kV) + Bus V: 0.9773253174437125 pu, -0.0010030091887831792 rad + Bus injection: -1.1677716833209109E-5 MW, 4.074333856962653E-5 MVar + + Largest Q mismatch: 4.074333856962653E-7 + Bus Id: vl3_0 (nominalVoltage=400.0kV) + Bus V: 0.9773253174437125 pu, -0.0010030091887831792 rad + Bus injection: -1.1677716833209109E-5 MW, 4.074333856962653E-5 MVar + + Largest V mismatch: 0.0 + Bus Id: vl1_0 (nominalVoltage=400.0kV) + Bus V: 0.975 pu, 0.002014826586019094 rad + Bus injection: 101.3664080925296 MW, -2.165165450231683 MVar + + Outer loop DistributedSlack + + Outer loop VoltageMonitoring + + Outer loop ReactiveLimits + + Outer loop IncrementalShuntVoltageControl diff --git a/src/test/resources/transformerReactivePowerControlOuterLoopReport.txt b/src/test/resources/transformerReactivePowerControlOuterLoopReport.txt new file mode 100644 index 0000000000..58e5aa08af --- /dev/null +++ b/src/test/resources/transformerReactivePowerControlOuterLoopReport.txt @@ -0,0 +1,256 @@ ++ Test Report + + Load flow on network 'two-windings-transformer-control' + + Network CC0 SC0 + AC load flow completed successfully (solverStatus=CONVERGED, outerloopStatus=STABLE) + + Network info + Network has 3 buses and 2 branches + Network balance: active generation=25.0 MW, active load=16.2 MW, reactive generation=0.0 MVar, reactive load=7.5 MVar + + Newton Raphson on Network CC0 SC0 + No outer loops have been launched + + Initial mismatch + Newton-Raphson norm |f(x)|=0.274368129345534 + + Largest P mismatch: -0.2499128799999999 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.008712000000010711 MW, 0.0 MVar + + Largest Q mismatch: 0.04477733526950797 + Bus Id: VL_2_0 (nominalVoltage=132.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.8236311414567833 MW, -3.0222664730492026 MVar + + Largest V mismatch: -0.022727272727272707 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0 pu, 0.0 rad + Bus injection: 0.008712000000010711 MW, 0.0 MVar + + Iteration 1 mismatch + Newton-Raphson norm |f(x)|=0.01825890321835207 + + Largest P mismatch: 0.013656382823924361 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.8524411166058133 pu, -0.0510207580859096 rad + Bus injection: -3.634361717607564 MW, 0.4118899094730089 MVar + + Largest Q mismatch: 0.0051248542031886585 + Bus Id: VL_2_0 (nominalVoltage=132.0kV) + Bus V: 1.017581653486485 pu, 0.0 rad + Bus injection: -16.760054876292756 MW, -6.987514579681134 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.013960637771441327 rad + Bus injection: 26.01814190831663 MW, 6.615251049390647 MVar + + Iteration 2 mismatch + Newton-Raphson norm |f(x)|=6.376469620059593E-4 + + Largest P mismatch: 5.980419180861424E-4 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.8196384440403927 pu, -0.06084240479789107 rad + Bus injection: -4.940195808191386 MW, 0.015968272423659637 MVar + + Largest Q mismatch: 1.5968272423659636E-4 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.8196384440403927 pu, -0.06084240479789107 rad + Bus injection: -4.940195808191386 MW, 0.015968272423659637 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.0133463068531993 rad + Bus injection: 25.000606658184555 MW, 7.653111009820276 MVar + + Iteration 3 mismatch + Newton-Raphson norm |f(x)|=1.4405413153401732E-6 + + Largest P mismatch: 1.35496114233441E-6 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.8180925692153216 pu, -0.061358852814659574 rad + Bus injection: -4.9998645038857665 MW, 3.2126868827626126E-5 MVar + + Largest Q mismatch: 3.688157438758166E-7 + Bus Id: VL_2_0 (nominalVoltage=132.0kV) + Bus V: 1.0170276371201856 pu, 0.0 rad + Bus injection: -14.088261054547575 MW, -7.499963118425612 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.01334390118010533 rad + Bus injection: 25.000000098028995 MW, 7.694057706313736 MVar + + Outer loop DistributedSlack + + Outer loop iteration 1 + Slack bus active power (-2.8882610545475753 MW) distributed in 1 distribution iteration(s) + + Newton Raphson on Network CC0 SC0 + Newton-Raphson of outer loop iteration 1 of type DistributedSlack + + Initial mismatch + Newton-Raphson norm |f(x)|=0.028882611561689718 + + Largest P mismatch: 0.02888261152576571 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.01334390118010533 rad + Bus injection: 25.000000098028995 MW, 7.694057706313736 MVar + + Largest Q mismatch: 3.688157438758166E-7 + Bus Id: VL_2_0 (nominalVoltage=132.0kV) + Bus V: 1.0170276371201856 pu, 0.0 rad + Bus injection: -14.088261054547575 MW, -7.499963118425612 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.01334390118010533 rad + Bus injection: 25.000000098028995 MW, 7.694057706313736 MVar + + Iteration 1 mismatch + Newton-Raphson norm |f(x)|=2.2929475337021148E-5 + + Largest P mismatch: -3.3445655875374847E-6 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.011752202697884006 rad + Bus injection: 22.111404488893672 MW, 7.616219016989096 MVar + + Largest Q mismatch: 2.268423912067663E-5 + Bus Id: VL_2_0 (nominalVoltage=132.0kV) + Bus V: 1.0172212221867718 pu, 0.0 rad + Bus injection: -11.205673029087924 MW, -7.497731576087932 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.011752202697884006 rad + Bus injection: 22.111404488893672 MW, 7.616219016989096 MVar + + Outer loop VoltageMonitoring + + Outer loop ReactiveLimits + + Outer loop IncrementalTransformerReactivePowerControl + + Outer loop iteration 2 + 1 reactive power-controlled branches are outside of their target deadbands + 1 transformers changed tap position + + Outer loop iteration 3 + 1 reactive power-controlled branches are outside of their target deadbands + 1 transformers changed tap position + 1 transformers reached their tap maximum position + + Outer loop iteration 4 + 1 reactive power-controlled branches are outside of their target deadbands + + Newton Raphson on Network CC0 SC0 + Newton-Raphson of outer loop iteration 2 of type IncrementalTransformerReactivePowerControl + + Initial mismatch + Newton-Raphson norm |f(x)|=0.08187188436879228 + + Largest P mismatch: -0.06141369269554524 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.8182877261072491 pu, -0.06133349638099293 rad + Bus injection: -11.141369269554524 MW, -3.1193176225920283 MVar + + Largest Q mismatch: 0.04425324333138297 + Bus Id: VL_2_0 (nominalVoltage=132.0kV) + Bus V: 1.0172212221867718 pu, 0.0 rad + Bus injection: -0.6163517581885852 MW, -3.074675666861703 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.011752202697884006 rad + Bus injection: 22.111404488893672 MW, 7.616219016989096 MVar + + Iteration 1 mismatch + Newton-Raphson norm |f(x)|=0.027502379804910274 + + Largest P mismatch: 0.02510689257581311 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 1.0406926342585474 pu, -0.035806780817622334 rad + Bus injection: -2.4893107424186893 MW, 1.0860173409808227 MVar + + Largest Q mismatch: 0.010860173409808226 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 1.0406926342585474 pu, -0.035806780817622334 rad + Bus injection: -2.4893107424186893 MW, 1.0860173409808227 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.011847687799124616 rad + Bus injection: 22.111915091797787 MW, 5.763482878578944 MVar + + Iteration 2 mismatch + Newton-Raphson norm |f(x)|=0.001379602762057389 + + Largest P mismatch: 0.0012723755729501796 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.9909334799649825 pu, -0.04302148688205 rad + Bus injection: -4.872762442704983 MW, 0.04986153100814065 MVar + + Largest Q mismatch: 4.986153100814065E-4 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.9909334799649825 pu, -0.04302148688205 rad + Bus injection: -4.872762442704983 MW, 0.04986153100814065 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.011771990982962145 rad + Bus injection: 22.1118499480431 MW, 7.236218692853886 MVar + + Iteration 3 mismatch + Newton-Raphson norm |f(x)|=4.276723728035947E-6 + + Largest P mismatch: 3.976869564797925E-6 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.9881816647210594 pu, -0.04351106729306108 rad + Bus injection: -4.99960231304352 MW, 1.4020988619288768E-4 MVar + + Largest Q mismatch: 1.4020988619288768E-6 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.9881816647210594 pu, -0.04351106729306108 rad + Bus injection: -4.99960231304352 MW, 1.4020988619288768E-4 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.01176769980319172 rad + Bus injection: 22.111739296938367 MW, 7.318486307745907 MVar + + Newton Raphson on Network CC0 SC0 + Newton-Raphson of outer loop iteration 3 of type IncrementalTransformerReactivePowerControl + + Initial mismatch + Newton-Raphson norm |f(x)|=0.031683064703665546 + + Largest P mismatch: -0.02449384393198288 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 0.9881816647210594 pu, -0.04351106729306108 rad + Bus injection: -7.449384393198288 MW, -1.2995827868341472 MVar + + Largest Q mismatch: 0.0153289483158092 + Bus Id: VL_2_0 (nominalVoltage=132.0kV) + Bus V: 1.0173884772580253 pu, 0.0 rad + Bus injection: -5.814404392596581 MW, -5.96710516841908 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.01176769980319172 rad + Bus injection: 22.111739296938367 MW, 7.318486307745907 MVar + + Iteration 1 mismatch + Newton-Raphson norm |f(x)|=0.0019222385007616972 + + Largest P mismatch: 0.001730988786404028 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 1.0470891975001073 pu, -0.03893295108024319 rad + Bus injection: -4.826901121359597 MW, 0.0823774720306429 MVar + + Largest Q mismatch: 8.23774720306429E-4 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 1.0470891975001073 pu, -0.03893295108024319 rad + Bus injection: -4.826901121359597 MW, 0.0823774720306429 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.01177837581093594 rad + Bus injection: 22.11174115252133 MW, 7.1108622347425845 MVar + + Iteration 2 mismatch + Newton-Raphson norm |f(x)|=7.287270108625772E-6 + + Largest P mismatch: 6.654485932837406E-6 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 1.0434483402584207 pu, -0.03932898287388065 rad + Bus injection: -4.999334551406717 MW, 2.8642824902061026E-4 MVar + + Largest Q mismatch: 2.8642824902061027E-6 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 1.0434483402584207 pu, -0.03932898287388065 rad + Bus injection: -4.999334551406717 MW, 2.8642824902061026E-4 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.011772577480572114 rad + Bus injection: 22.111739596487254 MW, 7.223626593973918 MVar + + Outer loop DistributedSlack + + Outer loop iteration 4 + Slack bus active power (2.379902997164196 MW) distributed in 1 distribution iteration(s) + + Newton Raphson on Network CC0 SC0 + Newton-Raphson of outer loop iteration 4 of type DistributedSlack + + Initial mismatch + Newton-Raphson norm |f(x)|=0.02379902457697521 + + Largest P mismatch: -0.023799023461293672 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.011772577480572114 rad + Bus injection: 22.111739596487254 MW, 7.223626593973918 MVar + + Largest Q mismatch: 2.8642824902061027E-6 + Bus Id: VL_3_0 (nominalVoltage=33.0kV) + Bus V: 1.0434483402584207 pu, -0.03932898287388065 rad + Bus injection: -4.999334551406717 MW, 2.8642824902061026E-4 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.011772577480572114 rad + Bus injection: 22.111739596487254 MW, 7.223626593973918 MVar + + Iteration 1 mismatch + Newton-Raphson norm |f(x)|=1.5553057037029686E-5 + + Largest P mismatch: -2.2166171705084725E-6 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.013083707387261096 rad + Bus injection: 24.491420280899572 MW, 7.284141028025306 MVar + + Largest Q mismatch: 1.5394290360654095E-5 + Bus Id: VL_2_0 (nominalVoltage=132.0kV) + Bus V: 1.0172841611147796 pu, 0.0 rad + Bus injection: -11.194886907913132 MW, -7.4984605709639345 MVar + + Largest V mismatch: 0.0 + Bus Id: VL_1_0 (nominalVoltage=132.0kV) + Bus V: 1.0227272727272727 pu, 0.013083707387261096 rad + Bus injection: 24.491420280899572 MW, 7.284141028025306 MVar + + Outer loop VoltageMonitoring + + Outer loop ReactiveLimits + + Outer loop IncrementalTransformerReactivePowerControl + + Outer loop iteration 5 + 1 reactive power-controlled branches are outside of their target deadbands + + Outer loop DistributedSlack + + Outer loop VoltageMonitoring + + Outer loop ReactiveLimits + + Outer loop IncrementalTransformerReactivePowerControl + + Outer loop iteration 5 + 1 reactive power-controlled branches are outside of their target deadbands