Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
64f2578
prohibit the MW+AC combo
RoxaneChen02 Jul 2, 2025
f322124
move check for combo ac+mw
RoxaneChen02 Jul 3, 2025
be05fe1
move check for combo ac+mw
RoxaneChen02 Jul 3, 2025
c4542e3
check threshold unit
RoxaneChen02 Jul 3, 2025
1a58c19
add UT
RoxaneChen02 Jul 3, 2025
0f9cb3d
fix raoParameters UT
RoxaneChen02 Jul 3, 2025
a70b7c4
fix US10_1
RoxaneChen02 Jul 4, 2025
74ed9d4
fix US20_6
RoxaneChen02 Jul 4, 2025
2c70662
MW -> A
RoxaneChen02 Jul 4, 2025
187f71d
première passe
RoxaneChen02 Jul 4, 2025
b1b0f56
deuxième passe
RoxaneChen02 Jul 4, 2025
cf7f658
convert in mnecEvaluator
RoxaneChen02 Jul 7, 2025
1669abc
fix 4.2.6
RoxaneChen02 Jul 4, 2025
17772d6
fix 13.6.11
RoxaneChen02 Jul 7, 2025
c44368a
"fix" 13.1.1
RoxaneChen02 Jul 7, 2025
c413f64
fix 5.1.4b
RoxaneChen02 Jul 4, 2025
6f1636f
Revert "convert in mnecEvaluator"
RoxaneChen02 Jul 8, 2025
f3f8478
add sensi on intensity support in SensitivityResult
RoxaneChen02 Jul 9, 2025
72ceb82
remove postTreatIntensities
RoxaneChen02 Jul 10, 2025
f29bc9a
MIP Filler in objective function unit
RoxaneChen02 Jul 10, 2025
bb45abe
change unit in doc pt1
RoxaneChen02 Jul 10, 2025
d175b62
change unit used during sensi computation to obj func unit
RoxaneChen02 Jul 10, 2025
5d6ec63
fix 11_3
RoxaneChen02 Jul 10, 2025
a25cd57
loop flow evaluator in obj func unit
RoxaneChen02 Jul 10, 2025
2f94bd1
rename RaoParameters_maxMargin_ampere_ac_mnecDimin180.json to RaoPara…
RoxaneChen02 Jul 10, 2025
e62d7d4
fix 11_4
RoxaneChen02 Jul 10, 2025
de6515b
add unit for loopflow evaluator
RoxaneChen02 Jul 10, 2025
dbd03e4
fix 11_4 pt2
RoxaneChen02 Jul 10, 2025
b960016
fix 11_4 pt2
RoxaneChen02 Jul 10, 2025
17cf2d6
Revert "remove postTreatIntensities"
RoxaneChen02 Jul 15, 2025
eaddc36
fix 13_6_3 & 13_6_4
RoxaneChen02 Jul 16, 2025
3fcbe27
fix 12_1_2
RoxaneChen02 Jul 17, 2025
1c3c27c
fix 12_9_1
RoxaneChen02 Jul 17, 2025
89b09d2
fix 11_4
RoxaneChen02 Jul 17, 2025
19445f0
fix 11_3
RoxaneChen02 Jul 17, 2025
cf7bb37
flow in A and MW in AC and in MW in DC
RoxaneChen02 Jul 17, 2025
32700a5
Merge branch 'main' into mip_ampere/prohibit_ac_mw
RoxaneChen02 Jul 23, 2025
857b24c
typo
RoxaneChen02 Jul 23, 2025
7fb4912
fix 19_7 : A/AC + MW/DC
RoxaneChen02 Aug 5, 2025
5d3b16f
update tag
RoxaneChen02 Aug 7, 2025
384ba35
best tap finder use unit instead of megawatt
RoxaneChen02 Aug 11, 2025
a794dcf
ptdf ampere v1
RoxaneChen02 Aug 11, 2025
f19dfdf
Revert "ptdf ampere v1"
RoxaneChen02 Aug 12, 2025
88705a4
move getobjecitve function unit logit in parameter
RoxaneChen02 Aug 12, 2025
b87ad2e
megawatt -> unit in automaton
RoxaneChen02 Aug 12, 2025
27ef023
Merge branch 'main' into mip_ampere/prohibit_ac_mw
RoxaneChen02 Aug 12, 2025
e07be23
prohibit relative/ampere and loopflow/ampere
RoxaneChen02 Aug 13, 2025
48695f7
force loopflow with dc/mw optim in cucumber
RoxaneChen02 Aug 13, 2025
fed89be
force relative margin optim with MW/DC
RoxaneChen02 Aug 13, 2025
8eaeafb
rename file
RoxaneChen02 Aug 13, 2025
7785508
small fix 15.3.2 - approx
RoxaneChen02 Aug 13, 2025
f609dbc
use snapshot version of olf
RoxaneChen02 Aug 13, 2025
90b5af1
Merge branch 'main' into mip_ampere/prohibit_ac_mw
RoxaneChen02 Aug 13, 2025
03c4e84
clean
RoxaneChen02 Aug 21, 2025
ffd10b1
Merge branch 'main' into mip_ampere/prohibit_ac_mw
RoxaneChen02 Aug 21, 2025
39769ec
fix ut
RoxaneChen02 Aug 21, 2025
48b3e99
fix ut
RoxaneChen02 Aug 21, 2025
d247679
Merge branch 'main' into mip_ampere/prohibit_ac_mw
RoxaneChen02 Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class ObjectiveFunctionParameters {
// Default values
private static final ObjectiveFunctionType DEFAULT_OBJECTIVE_FUNCTION = ObjectiveFunctionType.SECURE_FLOW;
private static final Unit DEFAULT_UNIT = Unit.MEGAWATT;
private static final Unit DEFAULT_UNIT = Unit.AMPERE;
private static final boolean DEFAULT_ENFORCE_CURATIVE_SECURITY = false;
// Attributes
private ObjectiveFunctionType type = DEFAULT_OBJECTIVE_FUNCTION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
import com.powsybl.commons.extensions.Extension;
import com.powsybl.commons.extensions.ExtensionConfigLoader;
import com.powsybl.commons.extensions.ExtensionProviders;
import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters;
import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoLoopFlowParameters;
import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoMnecParameters;
import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters;
import com.powsybl.openrao.raoapi.parameters.extensions.*;

import java.util.Objects;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import com.powsybl.commons.config.PlatformConfig;
import com.powsybl.loadflow.LoadFlowParameters;
import com.powsybl.openrao.commons.Unit;
import com.powsybl.openrao.raoapi.parameters.RaoParameters;
import com.powsybl.sensitivity.SensitivityAnalysisParameters;

Expand Down Expand Up @@ -111,6 +112,15 @@ public static SensitivityAnalysisParameters getSensitivityWithLoadFlowParameters
return cleanLoadFlowParameters(new SensitivityAnalysisParameters());
}

// In AC, the objective function is in Ampere and in DC in MW
public static Unit getObjectiveFunctionUnit(RaoParameters raoParameters) {
if (getSensitivityWithLoadFlowParameters(raoParameters).getLoadFlowParameters().isDc()) {
return Unit.MEGAWATT;
} else {
return Unit.AMPERE;
}
}

private static SensitivityAnalysisParameters cleanLoadFlowParameters(SensitivityAnalysisParameters sensitivityAnalysisParameters) {
LoadFlowParameters loadFlowParameters = sensitivityAnalysisParameters.getLoadFlowParameters();
// we have to clean load flow parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void testConfigWithPartialExtensions() throws IOException {

ObjectiveFunctionParameters objectiveFunctionParameters = parameters.getObjectiveFunctionParameters();
assertEquals(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_MARGIN, objectiveFunctionParameters.getType());
assertEquals(Unit.MEGAWATT, objectiveFunctionParameters.getUnit());
assertEquals(Unit.AMPERE, objectiveFunctionParameters.getUnit());
assertEquals(3, searchTreeParameters.getObjectiveFunctionParameters().getCurativeMinObjImprovement(), DOUBLE_TOLERANCE);
assertFalse(objectiveFunctionParameters.getEnforceCurativeSecurity());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version" : "3.2.1",
"objective-function" : {
"type" : "SECURE_FLOW",
"unit" : "MW",
"unit" : "A",
"enforce-curative-security" : false
},
"range-actions-optimization" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version" : "3.2.1",
"objective-function" : {
"type" : "SECURE_FLOW",
"unit" : "MW",
"unit" : "A",
"enforce-curative-security" : false
},
"range-actions-optimization" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version" : "3.2.1",
"objective-function" : {
"type" : "MAX_MIN_MARGIN",
"unit" : "MW",
"unit" : "A",
"enforce-curative-security" : false
},
"range-actions-optimization" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version" : "3.2.1",
"objective-function" : {
"type" : "SECURE_FLOW",
"unit" : "MW",
"unit" : "A",
"enforce-curative-security" : false
},
"range-actions-optimization" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import java.util.Set;
import java.util.stream.Collectors;

import static com.powsybl.openrao.commons.Unit.MEGAWATT;
import static com.powsybl.openrao.commons.logs.OpenRaoLoggerProvider.BUSINESS_LOGS;
import static com.powsybl.openrao.commons.logs.OpenRaoLoggerProvider.BUSINESS_WARNS;
import static com.powsybl.openrao.commons.logs.OpenRaoLoggerProvider.TECHNICAL_LOGS;
Expand Down Expand Up @@ -582,11 +581,10 @@ RangeAutomatonSimulationResult shiftRangeActionsUntilFlowCnecsSecure(List<RangeA
}

// Aligned range actions have the same set-point :
double currentSetpoint = alignedRangeActions.getFirst().getCurrentSetpoint(network);
double conversionToMegawatt = RaoUtil.getFlowUnitMultiplier(toBeShiftedCnec, side, flowUnit, MEGAWATT);
double cnecFlow = conversionToMegawatt * automatonRangeActionOptimizationSensitivityAnalysisOutput.getFlow(toBeShiftedCnec, side, flowUnit);
double cnecMargin = conversionToMegawatt * automatonRangeActionOptimizationSensitivityAnalysisOutput.getMargin(toBeShiftedCnec, side, flowUnit);
double optimalSetpoint = computeOptimalSetpoint(currentSetpoint, cnecFlow, cnecMargin, sensitivityValue, alignedRangeActions.getFirst(), minSetpoint, maxSetpoint);
double currentSetpoint = alignedRangeActions.get(0).getCurrentSetpoint(network);
double cnecFlow = automatonRangeActionOptimizationSensitivityAnalysisOutput.getFlow(toBeShiftedCnec, side, flowUnit);
double cnecMargin = automatonRangeActionOptimizationSensitivityAnalysisOutput.getMargin(toBeShiftedCnec, side, flowUnit);
double optimalSetpoint = computeOptimalSetpoint(currentSetpoint, cnecFlow, cnecMargin, sensitivityValue, alignedRangeActions.get(0), minSetpoint, maxSetpoint);

// On first iteration, define direction
if (iteration == 0) {
Expand Down Expand Up @@ -632,7 +630,7 @@ private double computeTotalSensitivityValue(List<RangeAction<?>> alignedRangeAct
// Under-estimate range action sensitivity if convergence to margin = 0 is slow (ie if multiple passes
// through this loop have been needed to secure the same CNEC)
for (RangeAction<?> rangeAction : alignedRangeActions) {
sensitivityValue += sensitivityUnderestimator * automatonRangeActionOptimizationSensitivityAnalysisOutput.getSensitivityValue(toBeShiftedCnec, side, rangeAction, MEGAWATT);
sensitivityValue += sensitivityUnderestimator * automatonRangeActionOptimizationSensitivityAnalysisOutput.getSensitivityValue(toBeShiftedCnec, side, rangeAction, flowUnit);
}
return sensitivityValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import java.util.*;
import java.util.stream.Collectors;

import static com.powsybl.openrao.raoapi.parameters.extensions.LoadFlowAndSensitivityParameters.getLoadFlowProvider;
import static com.powsybl.openrao.raoapi.parameters.extensions.LoadFlowAndSensitivityParameters.getSensitivityWithLoadFlowParameters;
import static com.powsybl.openrao.commons.logs.OpenRaoLoggerProvider.BUSINESS_LOGS;
import static com.powsybl.openrao.raoapi.parameters.extensions.LoadFlowAndSensitivityParameters.*;
import static com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters.getPstModel;
import static com.powsybl.openrao.searchtreerao.commons.HvdcUtils.addNetworkActionAssociatedWithHvdcRangeAction;
import static com.powsybl.openrao.searchtreerao.commons.HvdcUtils.updateHvdcRangeActionInitialSetpoint;
Expand Down Expand Up @@ -73,6 +73,21 @@ public static void checkParameters(RaoParameters raoParameters, RaoInput raoInpu
throw new OpenRaoException(msg);
}
}
if (raoParameters.getObjectiveFunctionParameters().getUnit().equals(Unit.MEGAWATT)
&& !getSensitivityWithLoadFlowParameters(raoParameters).getLoadFlowParameters().isDc()) {
String msg = "Objective function unit MEGAWATT cannot be calculated with a AC default sensitivity engine";
BUSINESS_LOGS.error(msg);
throw new OpenRaoException(msg);
}

if (raoParameters.getObjectiveFunctionParameters().getType().relativePositiveMargins()) {
if (raoInput.getGlskProvider() == null) {
throw new OpenRaoException(format("Objective function %s requires glsks", raoParameters.getObjectiveFunctionParameters().getType()));
}
if (raoParameters.getRelativeMarginsParameters().map(relativeMarginsParameters -> relativeMarginsParameters.getPtdfBoundaries().isEmpty()).orElse(true)) {
throw new OpenRaoException(format("Objective function %s requires a config with a non empty boundary set", raoParameters.getObjectiveFunctionParameters().getType()));
}
}

private static void checkLoopFlowParameters(RaoParameters raoParameters, RaoInput raoInput) {
if ((raoParameters.getLoopFlowParameters().isPresent()
Expand Down Expand Up @@ -111,6 +126,20 @@ && getSensitivityWithLoadFlowParameters(raoParameters).getLoadFlowParameters().i
raoParameters.hasExtension(OpenRaoSearchTreeParameters.class) && raoParameters.getExtension(OpenRaoSearchTreeParameters.class).getMinMarginsParameters().isEmpty())) {
throw new OpenRaoException(format("Objective function type %s requires a config with costly min margin parameters", raoParameters.getObjectiveFunctionParameters().getType()));
}

if (raoParameters.getObjectiveFunctionParameters().getType().relativePositiveMargins()
&& getObjectiveFunctionUnit(raoParameters).equals(Unit.AMPERE)) {
String msg = "The objective function unit must be MEGAWATT to use relative positive margins";
OpenRaoLoggerProvider.BUSINESS_LOGS.error(msg);
throw new OpenRaoException(msg);
}

if (raoParameters.getLoopFlowParameters().isPresent()
&& getObjectiveFunctionUnit(raoParameters).equals(Unit.AMPERE)) {
String msg = "The objective function unit must be MEGAWATT to use loopflow computation";
OpenRaoLoggerProvider.BUSINESS_LOGS.error(msg);
throw new OpenRaoException(msg);
}
}

public static void checkCnecsThresholdsUnit(RaoParameters raoParameters, RaoInput raoInput) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
import java.util.*;
import java.util.stream.Collectors;

import static com.powsybl.openrao.raoapi.parameters.extensions.LoadFlowAndSensitivityParameters.getSensitivityProvider;
import static com.powsybl.openrao.raoapi.parameters.extensions.LoadFlowAndSensitivityParameters.getSensitivityWithLoadFlowParameters;
import static com.powsybl.openrao.raoapi.parameters.extensions.LoadFlowAndSensitivityParameters.*;

/**
* @author Joris Mancini {@literal <joris.mancini at rte-france.com>}
Expand Down Expand Up @@ -92,27 +91,30 @@ public SystematicSensitivityInterface getSystematicSensitivityInterface(Set<Flow
boolean computeLoopFlows,
AppliedRemedialActions appliedRemedialActions,
Instant outageInstant) {
Unit objectiveFunctionUnit = getObjectiveFunctionUnit(raoParameters);

SystematicSensitivityInterface.SystematicSensitivityInterfaceBuilder builder = SystematicSensitivityInterface.builder()
.withSensitivityProviderName(getSensitivityProvider(raoParameters))
.withParameters(getSensitivityWithLoadFlowParameters(raoParameters))
.withRangeActionSensitivities(rangeActions, cnecs, Collections.singleton(Unit.MEGAWATT))
.withAppliedRemedialActions(appliedRemedialActions)
.withRangeActionSensitivities(rangeActions, cnecs, Collections.singleton(objectiveFunctionUnit))
.withOutageInstant(outageInstant);

if (!getSensitivityWithLoadFlowParameters(raoParameters).getLoadFlowParameters().isDc()) {
builder.withLoadflow(cnecs, Collections.singleton(Unit.AMPERE));
if (getSensitivityWithLoadFlowParameters(raoParameters).getLoadFlowParameters().isDc()) {
builder.withLoadflow(cnecs, Collections.singleton(objectiveFunctionUnit));
} else {
builder.withLoadflow(cnecs, Set.of(Unit.AMPERE, Unit.MEGAWATT));
}

if (computePtdfs && computeLoopFlows) {
Set<String> eic = getEicForObjectiveFunction();
eic.addAll(getEicForLoopFlows());
builder.withPtdfSensitivities(getGlskForEic(eic), cnecs, Collections.singleton(Unit.MEGAWATT));
builder.withPtdfSensitivities(getGlskForEic(eic), cnecs, Collections.singleton(objectiveFunctionUnit));
} else if (computeLoopFlows) {
Set<FlowCnec> loopflowCnecs = getLoopFlowCnecs(cnecs);
builder.withPtdfSensitivities(getGlskForEic(getEicForLoopFlows()), loopflowCnecs, Collections.singleton(Unit.MEGAWATT));
builder.withPtdfSensitivities(getGlskForEic(getEicForLoopFlows()), loopflowCnecs, Collections.singleton(objectiveFunctionUnit));
} else if (computePtdfs) {
builder.withPtdfSensitivities(getGlskForEic(getEicForObjectiveFunction()), cnecs, Collections.singleton(Unit.MEGAWATT));
builder.withPtdfSensitivities(getGlskForEic(getEicForObjectiveFunction()), cnecs, Collections.singleton(objectiveFunctionUnit));
}

return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ protected List<CostEvaluator> getVirtualCostEvaluators(MarginEvaluator marginEva
loopFlowCnecs,
initialFlowResult,
loopFlowParametersOptional.get().getAcceptableIncrease(),
loopFlowParametersExtensionOptional.get().getViolationCost()
loopFlowParametersExtensionOptional.get().getViolationCost(),
raoParameters.getObjectiveFunctionParameters().getUnit()
));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ public class LoopFlowViolationCostEvaluator implements CostEvaluator {
private final FlowResult initialLoopFlowResult;
private final double loopFlowViolationCost;
private final double loopFlowAcceptableAugmentation;
private final Unit unit;

public LoopFlowViolationCostEvaluator(Set<FlowCnec> loopflowCnecs,
FlowResult initialLoopFlowResult,
double loopFlowAcceptableAugmentation, double loopFlowViolationCost) {
double loopFlowAcceptableAugmentation,
double loopFlowViolationCost,
Unit unit) {
this.loopflowCnecs = loopflowCnecs;
this.initialLoopFlowResult = initialLoopFlowResult;
this.loopFlowViolationCost = loopFlowViolationCost;
this.loopFlowAcceptableAugmentation = loopFlowAcceptableAugmentation;
this.unit = unit;
}

@Override
Expand Down Expand Up @@ -67,13 +71,13 @@ public CostEvaluatorResult evaluate(FlowResult flowResult, RemedialActionActivat

double getLoopFlowExcess(FlowResult flowResult, FlowCnec cnec) {
return cnec.getMonitoredSides()
.stream().map(side -> Math.max(0, Math.abs(flowResult.getLoopFlow(cnec, side, Unit.MEGAWATT)) - getLoopFlowUpperBound(cnec, side)))
.stream().map(side -> Math.max(0, Math.abs(flowResult.getLoopFlow(cnec, side, unit)) - getLoopFlowUpperBound(cnec, side)))
.max(Double::compareTo).orElse(0.0);
}

private double getLoopFlowUpperBound(FlowCnec cnec, TwoSides side) {
double loopFlowThreshold = cnec.getExtension(LoopFlowThreshold.class).getThresholdWithReliabilityMargin(Unit.MEGAWATT);
double initialLoopFlow = initialLoopFlowResult.getLoopFlow(cnec, side, Unit.MEGAWATT);
double loopFlowThreshold = cnec.getExtension(LoopFlowThreshold.class).getThresholdWithReliabilityMargin(unit);
double initialLoopFlow = initialLoopFlowResult.getLoopFlow(cnec, side, unit);
return Math.max(0.0, Math.max(loopFlowThreshold, Math.abs(initialLoopFlow) + loopFlowAcceptableAugmentation));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.powsybl.openrao.data.crac.api.rangeaction.PstRangeAction;
import com.powsybl.openrao.data.crac.api.rangeaction.RangeAction;
import com.powsybl.iidm.network.TwoSides;
import com.powsybl.openrao.searchtreerao.commons.RaoUtil;
import com.powsybl.openrao.searchtreerao.commons.optimizationperimeters.OptimizationPerimeter;
import com.powsybl.openrao.searchtreerao.result.api.*;
import com.powsybl.openrao.searchtreerao.result.impl.RangeActionActivationResultImpl;
Expand All @@ -26,8 +25,6 @@
import java.util.*;
import java.util.stream.Collectors;

import static com.powsybl.openrao.commons.Unit.MEGAWATT;

/**
* @author Joris Mancini {@literal <joris.mancini at rte-france.com>}
*/
Expand Down Expand Up @@ -231,15 +228,15 @@ static Pair<Double, Double> computeMinMargins(Network network,
double minMargin2 = Double.MAX_VALUE;
for (FlowCnec flowCnec : linearOptimizationResult.getMostLimitingElements(10)) {
for (TwoSides side : flowCnec.getMonitoredSides()) {
double sensitivity = linearOptimizationResult.getSensitivityValue(flowCnec, side, pstRangeAction, MEGAWATT);
double sensitivity = linearOptimizationResult.getSensitivityValue(flowCnec, side, pstRangeAction, unit);
double currentSetPoint = pstRangeAction.getCurrentSetpoint(network);
double referenceFlow = linearOptimizationResult.getFlow(flowCnec, side, unit) * RaoUtil.getFlowUnitMultiplier(flowCnec, side, unit, MEGAWATT);
double referenceFlow = linearOptimizationResult.getFlow(flowCnec, side, unit);

double flow1 = sensitivity * (angle1 - currentSetPoint) + referenceFlow;
double flow2 = sensitivity * (angle2 - currentSetPoint) + referenceFlow;

minMargin1 = Math.min(minMargin1, flowCnec.computeMargin(flow1, side, MEGAWATT));
minMargin2 = Math.min(minMargin2, flowCnec.computeMargin(flow2, side, MEGAWATT));
minMargin1 = Math.min(minMargin1, flowCnec.computeMargin(flow1, side, unit));
minMargin2 = Math.min(minMargin2, flowCnec.computeMargin(flow2, side, unit));
}
}
return Pair.of(minMargin1, minMargin2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public static List<ProblemFiller> getProblemFillers(IteratingLinearOptimizerInpu
input.initialFlowResult(),
parameters.getLoopFlowParameters(),
parameters.getLoopFlowParametersExtension(),
parameters.getObjectiveFunctionUnit(),
timestamp
);
problemFillers.add(maxLoopFlowFiller);
Expand All @@ -135,6 +136,7 @@ public static List<ProblemFiller> getProblemFillers(IteratingLinearOptimizerInpu
input.optimizationPerimeter().getFlowCnecs(),
input.prePerimeterFlowResult(),
parameters.getUnoptimizedCnecParameters(),
parameters.getObjectiveFunctionUnit(),
timestamp
);
problemFillers.add(unoptimizedCnecFiller);
Expand Down
Loading
Loading