powsybl / powsybl-open-rao

A toolbox based on powsybl framework dedicated to power systems coordinated capacity calculation and security analysis projects
Mozilla Public License 2.0
17 stars 6 forks source link

Make RaoParameters generic #1084

Open pet-mit opened 4 months ago

pet-mit commented 4 months ago

Describe the current behavior

The RaoParameters object (same applies to its json representation) mixes business parameters (such as objective function) with serach-tree-specific parameters (such as maximum search depth).

Describe the expected behavior

Taking as an example PowSyBl's LoadFlowParameters, separate RaoParameters into:

Describe the motivation

This would help create a generic RAO API, and make the two following things possible:

Extra Information

No response

Details

RaoParameters: (B = business parameters, ST = search-tree specific parameter)

level 1 level 2 use case what to do
Objective Function Parameters
Type: MAX_MIN_MARGIN_IN_MEGAWATT, MAX_MIN_MARGIN_IN_AMPERE, MAX_MIN_RELATIVE_MARGIN_IN_MEGAWATT, MAX_MIN_RELATIVE_MARGIN_IN_AMPERE B Replace with these generic types : SECURE_FLOW / MAX_MIN_FLOW_MARGIN / MAX_MIN_RELATIVE_FLOW_MARGIN. Unit should be detected depending on LF DC flag -> obsolete, replaced by: New parameter Unit to store value MEGAWATT or AMPERE.
ForbidCostIncrease ST Remove, always set to true in OpenRAO
PreventiveStopCriterion: MIN_OBJECTIVE, SECURE B+ST Remove, compute depending on objective function
CurativeStopCriterion: MIN_OBJECTIVE, SECURE, PREVENTIVE_OBJECTIVE, PREVENTIVE_OBJECTIVE_AND_SECURE B+ST Remove, compute depending on objective function
CurativeMinObjImprovement B+ST Move to OpenRaoParameters extension
OptimizeCurativeIfPreventiveUnsecure B+ST Move to OpenRaoParameters. ObjectiveFunctionParameters. EnforceCurativeSecurity, use it also to replace "PREVENTIVE_OBJECTIVE_AND_SECURE" in cas of min margin maximization
Range Actions Optimization Parameters Move all this to OpenRaoParameters extension, except the three marked below
LinearOptimizationSolver.Solver: CBC, SCIP, XPRESS ST
LinearOptimizationSolver.RelativeMipGap ST
LinearOptimizationSolver.SolverSpecificParameters ST
MaxMipIterations ST
PstPenaltyCost B+ST Move to RaoParameters.RangeActionOptimizationParameters new param "PST RA min impact threshold"
PstSensitivityThreshold ST
HvdcPenaltyCost B+ST Move to RaoParameters.RangeActionOptimizationParameters new param "HVDC RA min impact threshold"
HvdcSensitivityThreshold ST
InjectionRaPenaltyCost B+ST Move to RaoParameters.RangeActionOptimizationParameters new param "Injection RA min impact threshold"
InjectionRaSensitivityThreshold ST
PstModel: CONTINUOUS, APPROXIMATED_INTEGERS ST
RaRangeShrinking: DISABLED, ENABLED, ENABLED_IN_FIRST_PRAO_AND_CRAO ST
Topo Optimization Parameters Split into generic (2 params) and specific (6 params)
MaxPreventiveSearchTreeDepth ST
MaxAutoSearchTreeDepth ST
MaxCurativeSearchTreeDepth ST
PredefinedCombinations ST
RelativeMinImpactThreshold B
AbsoluteMinImpactThreshold B
SkipActionsFarFromMostLimitingElement ST
MaxNumberOfBoundariesForSkippingActions ST
Multithreading Parameters Remove this section, replace with Multithreading.AvailableCpus. In OpenRAO, compute the old params (preventive leaves = contingency scenarios = cpus, the rest = 1)
ContingencyScenariosInParallel ST
PreventiveLeavesInParallel ST
AutoLeavesInParallel ST
CurativeLeavesInParallel ST
Second Preventive Rao Parameters Move to OpenRaoParameters extension
ExecutionCondition: DISABLED, POSSIBLE_CURATIVE_IMPROVEMENT, COST_INCREASE ST
ReOptimizeCurativeRangeActions ST
HintFromFirstPreventiveRao ST
Not Optimized Cnecs Parameters Keep in RaoParameters
do-not-optimize-curative-cnecs-for-tsos-without-cras B
Load Flow And Sensitivity Parameters
load-flow-provider ST Move to OpenRaoParameters extension
sensitivity-provider ST Move to OpenRaoParameters extension
sensitivity-failure-overcost ST Move to OpenRaoParameters extension
sensitivity-parameters ST Move to OpenRaoParameters extension
load-flow-parameters B -> obsolete Keep in RaoParameters. Don't forget to use it to set SensitivityParameters.LoadFlowParameters when calling sensitivity engine -> obsolete: stay inside sensitivity-parameters so it is in ST
Loop-flow extension Split into generic (2 params) and specific (3 params)
acceptable-increase B
ptdf-approximation ST
constraint-adjustment-coefficient ST
violation-cost ST
countries B
MNEC extension Split into generic (1 param) and specific (2 params)
acceptable-margin-decrease B
violation-cost ST
constraint-adjustment-coefficient ST
Relative margins extension Split into generic (1 param) and specific (2 params)
ptdf-boundaries B
ptdf-approximation ST
ptdf-sum-lower-bound ST
pet-mit commented 4 months ago

@pjeanmarie I updated the table

pjeanmarie commented 1 month ago

Remove this section, replace with Multithreading.AvailableCpus. In OpenRAO, compute the old params (preventive leaves = contingency scenarios = cpus, the rest = 1)

@phiedw Does it means I need to keep MultithreadingParameters with same parameters then now and not update it to match the json and why? Or is it only instructions for how to do the conversion where it is used (in TreeParameters and CastorOptim) ?

pjeanmarie commented 6 days ago

load-flow-parameters: Keep in RaoParameters. Don't forget to use it to set SensitivityParameters.LoadFlowParameters when calling sensitivity engine

Since SensitivityParameters is a not an open rao object and its load json is define elsewhere (on powsyble-core) then we will have duplicated object between the load-flow-parameters in rao-parameters and the one still in extension. So it was decided to not add load-flow-parameters in rao-parameters, it exist only in extension in SensitivityParameters.

Unit should be detected depending on LF DC flag.

Finally Unit is removed from type but added independently in objective function as parameter "unit". This is because we need it in rao-parameters but "dc" (isDC) of load-flow-parameters couldn't be added in rao-pramerts (see above). In addition to that, we had quite some cucumber tests failed when it was no longer possibe to have independant "unit" and "dc".

pjeanmarie commented 6 days ago

Presence or absence of previous extensions Loop-flow, MNEC, and Relative margins, change behavior, so the new objects (inside rao-parameters or inside existing extension) are Optional.