diff --git a/docs/parameters.md b/docs/parameters.md index 73db38c2bd..e2b0652110 100644 --- a/docs/parameters.md +++ b/docs/parameters.md @@ -1,549 +1,34 @@ # Parameters +```{toctree} +:hidden: +parameters/business-parameters.md +parameters/implementation-specific-parameters.md +``` + ## Introduction -The RAO parameters allow tuning the RAO: -- to choose the **business objective function** of the RAO (maximize min margin, get a positive margin, ...) -- to activate/deactivate optional business **features** -With its extensions, in particular the open rao search tree extension, its parameters allows: -- to choose implementation specific parameters -- to fine-tune the search algorithm, improve **performance** and/or **quality** of results +The RAO parameters allow tuning the RAO. + +It contains **business parameters** (see [business-parameters](/parameters/business_parameters)) which allow +to choose the business objective function of the RAO (maximize min margin, get a positive margin, ...), +to activate/deactivate optional business features, etc. + +It also contains **extensions** which are **implementation specific parameters** +(see [implementation-specific-parameters](/parameters/implementation-specific-parameters)), in particular the open +rao search tree extension. These extensions allow to fine-tune the search algorithm, improve performance and/or +quality of results. RAO parameters can be constructed using: - The Java API (see [source code](https://github.com/powsybl/powsybl-open-rao/blob/main/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/RaoParameters.java)) - A JSON file (see [example](#examples)) - A PowSyBl configuration file (see [example](#examples)) -## Global parameters - -These parameters should be always set in the RAO parameters file or object. - -### Objective function parameters - -These parameters (objective-function) configure the remedial action optimisation's objective function. - -#### type -- **Expected value**: one of the following: - - "SECURE_FLOW" - - "MAX_MIN_MARGIN" - - "MAX_MIN_RELATIVE_MARGIN" -- **Default value**: "SECURE_FLOW" -- **Usage**: this parameter sets the objective function of the RAO. For now, the existing objective function are: - - **SECURE_FLOW**: The search-tree will stop as soon as it finds a solution where the minimum margin is positive. - - **MAX_MIN_MARGIN**: the search-tree will maximize the minimum margin until it converges to a - maximum value, or until another stop criterion has been reached (e.g. [max-preventive-search-tree-depth](#max-preventive-search-tree-depth)). - - **MAX_MIN_RELATIVE_MARGIN**: same as MAX_MIN_MARGIN, but the margins will be relative - (divided by the absolute sum of PTDFs) when they are positive. - -#### unit -- **Expected value**: one of the following: - - "MEGAWATT" - - "AMPERE" -- **Default value**: "MEGAWATT" -- **Usage**: this parameter sets the objective function unit of the RAO. For now, the existing objective function units are: - - **MEGAWATT**: the margins to maximize are considered in MW. - - **AMPERE**: the margins to maximize are considered in A. - Note that CNECs from different voltage levels will not have the same weight in the objective function depending on the unit - considered (MW or A). Ampere unit only works in AC-load-flow mode (see [sensitivity-parameters](#sensitivity-parameters)). - -#### enforce-curative-security -- **Expected value**: true/false -- **Default value**: false -- **Usage**: if this parameter is set to true, OpenRAO will continue optimizing curative states even if preventive state - is unsecure. - If this parameter is set to false, OpenRAO will stop after preventive if preventive state is unsecure and won't try to - improve curative states. - - *Note: Only applied when ["type"](#type) is set to SECURE_FLOW. In this case, if preventive was unsecure, -second preventive won't be run, even if curative cost is higher, in order to save computation time* - -### Range actions optimisation parameters -These parameters (range-actions-optimization) tune the [linear optimiser](/castor/linear-problem.md) used to optimise range actions. -(See [Modelling CNECs and range actions](/castor/linear-problem/core-problem-filler.md)) - -#### pst-ra-min-impact-threshold -- **Expected value**: numeric value, unit: unit of the objective function / ° (per degree) -- **Default value**: 0.01 -- **Usage**: the pst-ra-min-impact-threshold represents the cost of changing the PST set-points, it is used within the linear - optimisation problem of the RAO, where, for each PST, the following term is added to the objective function: - $pst\text{-}ra\text{-}min\text{-}impact\text{-}threshold \times |\alpha - \alpha_{0}|$, where $\alpha$ is the optimized angle of the PST, and - $\alpha_{0}$ the angle in its initial position. - If several solutions are equivalent (e.g. with the same min margin), a strictly positive pst-ra-min-impact-threshold will favour - the ones with the PST taps the closest to the initial situation. - -#### hvdc-ra-min-impact-threshold -- **Expected value**: numeric value, unit: unit of the objective function / MW -- **Default value**: 0.001 -- **Usage**: the hvdc-ra-min-impact-threshold represents the cost of changing the HVDC set-points, it is used within the linear - optimisation problem of the RAO, where, for each HVDC, the following term is added to the objective function: - $hvdc\text{-}ra\text{-}min\text{-}impact\text{-}threshold \times |P - P_{0}|$, where $P$ is the optimized target power of the HVDC, and $P_{0}$ the initial target - power. - If several solutions are equivalent (e.g. with the same min margin), a strictly positive hvdc-ra-min-impact-threshold will favour - the ones with the HVDC set-points the closest to the initial situation. - -#### injection-ra-min-impact-threshold -- **Expected value**: numeric value, unit: unit of the objective function / MW -- **Default value**: 0.001 -- **Usage**: the injection-ra-min-impact-threshold represents the cost of changing the injection set-points, it is used within the linear - optimisation problem of the RAO, in the same way as the two types of RangeAction above. - -### Network actions optimisation parameters -These parameters (topological-actions-optimization) tune the [search-tree algorithm](/castor.md#algorithm) -when searching for the best network actions. - -#### absolute-minimum-impact-threshold -- **Expected value**: numeric value, where the unit is that of the objective function -- **Default value**: 0.0 -- **Usage**: if a topological action improves the objective function by x, and x is smaller than this parameter, the - effectiveness of this topological action will be considered inconsequential, and it will not be retained by the - search-tree. - The absolute-minimum-impact-threshold can therefore fill two purposes: - - do not retain in the optimal solution of the RAO remedial actions with a negligible impact - - speed up the computation by avoiding the few final depths which only slightly improve the solution. - -#### relative-minimum-impact-threshold -- **Expected value**: numeric value, percentage defined between 0 and 1 (1 = 100%) -- **Default value**: 0.0 -- **Usage**: behaves like [absolute-minimum-impact-threshold](#absolute-minimum-impact-threshold), but the - threshold here is defined as a coefficient of the objective function value of the previous depth. In depth (n+1), if a - topological action improves the objective function by $x$, with $x < solution(depth(n)) \times relative\text{-}minimum\text{-}impact\text{-}threshold$, - it will not be retained by the search-tree. - -### CNECs that should not be optimised -These parameters (not-optimized-cnecs) allow the activation of region-specific features, that de-activate the -optimisation of specific CNECs in specific conditions. - -#### do-not-optimize-curative-cnecs-for-tsos-without-cras -- **Expected value**: true/false -- **Default value**: false -- **Usage**: if this parameter is set to true, the RAO will detect TSOs not sharing any curative remedial actions (in - the CRAC). During the curative RAO, these TSOs' CNECs will not be taken into account in the minimum margin objective - function, unless the applied curative remedial actions decrease their margins (compared to their margins before - applying any curative action). - If it is set to false, all CNECs are treated equally in the curative RAO. - This parameter has no effect on the preventive RAO. - This parameter should be set to true for CORE CC. - -## Extensions -The following extensions can be added to RaoParameters: -- to configure implementation specific parameters -- when needed, in order to activate specific RAO features - -### Open Rao Search Tree Parameters extension - -This extension is used to configure implementation specific parameters - -#### Objective function parameters - -These parameters (objective-function) configure the remedial action optimisation's objective function. - -##### curative-min-obj-improvement -- **Expected value**: numeric value, where the unit is that of the objective function -- **Default value**: 0 -- **Usage**: used as a minimum improvement of the preventive RAO objective value for the curative RAO objective value, - when [type](#type) is set to MAX_MIN_MARGIN or MAX_MIN_RELATIVE_MARGIN. - -#### Range actions optimisation parameters -These parameters (range-actions-optimization) tune the [linear optimiser](/castor/linear-problem.md) used to optimise range actions. -(See [Modelling CNECs and range actions](/castor/linear-problem/core-problem-filler.md)) - -##### max-mip-iterations -- **Expected value**: integer -- **Default value**: 10 -- **Usage**: defines the maximum number of iterations to be executed by the iterating linear optimiser of the RAO. - One iteration of the iterating linear optimiser includes: the resolution of one linear problem (MIP), an update of the - network with the optimal PST taps found in the linear problem, a security analysis of the updated network and an - assessment of the objective function based on the results of the security analysis. - The linear problem relies on sensitivity coefficients to estimate the flows on each CNEC, and those estimations might - not be perfect when several PSTs taps are significantly changed. When the linear optimisation problem makes a (n+1)th - iteration, it refines its solution with new sensitivity coefficients, which better describe the neighbourhood of the - solution found in iteration (n). - Note that the linear optimisation problems usually "converge" with very few iterations (1 to 4 iterations). - -##### pst-model -- **Expected value**: one of the following: - - "CONTINUOUS" - - "APPROXIMATED_INTEGERS" -- **Default value**: "CONTINUOUS" -- **Usage**: the method to model PSTs in the linear problem: - - **CONTINUOUS**: PSTs are represented by their angle set-points; the set-points are continuous optimisation variables - and OpenRAO rounds the result to the best tap (around the optimal set-point) after optimisation. This approach is not - very precise but does not create integer optimisation variables; thus it is quicker to solve, especially with - open-source solvers. - - **APPROXIMATED_INTEGERS**: a PST is represented by its tap positions, and these tap positions are considered - proportional to the PST's angle set-point (hence the "approximated" adjective). Thus, these tap positions can be - used as a multiplier of the sensitivity values when representing the impact of the PST on CNECs. This approach is - more precise and thus has the advantage of better respecting Loop-Flow and MNEC constraints. But it introduces - integer variables (tap positions) and can be harder to solve. - See [Using integer variables for PST taps](/castor/linear-problem/discrete-pst-tap-filler.md). - -##### pst-sensitivity-threshold -- **Expected value**: numeric value, unit: MW / ° (per degree) -- **Default value**: 0.0 -- **Usage**: the pst sensitivity coefficients which are below the pst-sensitivity-threshold will be considered equal to - zero by the linear optimisation problem. Filtering some small sensitivity coefficients have the two following perks - for the RAO: - - it decreases the complexity of the optimisation problem by reducing significantly the number of non-zero elements - - it can avoid changes of PST set-points when they only allow to earn a few MW on the margins of some CNECs. - -##### hvdc-sensitivity-threshold -- **Expected value**: numeric value, unit: MW / MW -- **Default value**: 0.0 -- **Usage**: the hvdc sensitivity coefficients which are below the hvdc-sensitivity-threshold will be considered equal - to zero by the linear optimisation problem. Filtering some of the small sensitivity coefficients have the two - following perks regarding the RAO: - - it decreases the complexity of the optimisation problem by reducing significantly the number of non-null elements - - it can avoid changes of HVDC set-points when they only allow to earn a few MW on the margins of some CNECs. - -##### injection-ra-sensitivity-threshold -- **Expected value**: numeric value, unit: MW / MW -- **Default value**: 0.0 -- **Usage**: the injection sensitivity coefficients which are below the injection-ra-sensitivity-threshold will be - considered equal to zero by the linear optimisation problem. - The perks are the same as the two parameters above. - -##### ra-range-shrinking -- **Expected value**: one of the following: - - "DISABLED" - - "ENABLED" - - "ENABLED_IN_FIRST_PRAO_AND_CRAO" -- **Default value**: "DISABLED" -- **Usage**: CASTOR makes the approximation that range action sensitivities on CNECs are linear. However, in - active+reactive computations, this approximation may be incorrect. The linear problem can thus find a worse solution - than in its previous iteration. - - **DISABLED**: if this situation occurs, the linear problem stops and returns the previous solution, - see this schema : [Linear Remedial Actions Optimisation](/castor/linear-problem.md#algorithm). - - **ENABLED**: this introduces two new behaviors to the iterating linear optimiser: - 1. If the linear problem finds a solution worse than in its previous iteration, it continues iterating. - When stop condition is met ([max-mip-iterations](#max-mip-iterations) reached, or two successive iterations have - the same optimal RA set-points), then the problem returns the best solution it has found. - 2. At each new iteration, the range action's allowed range shrinks according to equations [described here](/castor/linear-problem/core-problem-filler.md#shrinking-the-allowed-range). - These equations have been chosen to force the linear problem convergence while allowing the RA to go - back to its initial solution if needed. - - **ENABLED_IN_FIRST_PRAO_AND_CRAO**: - same as **ENABLED** but only for first preventive and curative RAO. This parameter value has been introduced because - sensitivity computations in the second preventive RAO can be slow (due to the larger optimization perimeter), thus - computation time loss may outweigh the gains of RA range shrinking. - -##### linear-optimization-solver -These are parameters that tune the solver used to solve the MIP problem. - -###### solver -- **Expected value**: one of the following: - - "CBC" - - "SCIP" - - "XPRESS" -- **Default value**: "CBC" -- **Usage**: the solver called for optimising the linear problem. - Note that theoretically all solvers supported by OR-Tools can be called, but the OpenRAO interface only allows CBC - (open-source), SCIP (commercial) and XPRESS (commercial) for the moment. - If needed, other solvers can be easily added. - -###### relative-mip-gap -- **Expected value**: double -- **Default value**: 0.0001 -- **Usage**: the relative MILP (Mixed-Integer-Linear-Programming) target gap. - During branch-and-bound algorithm (only in MILP case), the solver will stop branching when this relative gap is - reached between the best found objective function and the estimated objective function best bound. - -###### solver-specific-parameters -- **Expected value**: String, space-separated parameters (keys and values) understandable by OR-Tools (for example "key1 - value1 key2 value2") -- **Default value**: empty -- **Usage**: this can be used to set solver-specific parameters, when the OR-Tools API and its generic parameters are - not enough. - -#### Network actions optimisation parameters -These parameters (topological-actions-optimization) tune the [search-tree algorithm](/castor.md#algorithm) -when searching for the best network actions. - -##### max-preventive-search-tree-depth -- **Expected value**: integer -- **Default value**: 2^32 -1 (max integer value) -- **Usage**: maximum search-tree depth for preventive optimization. - Applies to the preventive RAO. - -##### max-auto-search-tree-depth -- **Expected value**: integer -- **Default value**: 2^32 -1 (max integer value) -- **Usage**: maximum search-tree depth for the optimization of available auto network actions. - -##### max-curative-search-tree-depth -- **Expected value**: integer -- **Default value**: 2^32 -1 (max integer value) -- **Usage**: maximum search-tree depth for curative optimization. - Applies separately to each perimeter-specific curative RAO. - -##### predefined-combinations -- **Expected value**: an array containing sets of network action IDs -- **Default value**: empty -- **Usage**: this parameter contains hints for the search-tree RAO, consisting of combinations of multiple network - actions that the user considers interesting to test together during the RAO. - These combinations will be tested in the first search depth of the search-tree - -![Search-tree-with-combinations](/_static/img/Search-tree-with-combinations.png){.forced-white-background} - -##### skip-actions-far-from-most-limiting-element -- **Expected value**: true/false -- **Default value**: false -- **Usage**: whether the RAO should skip evaluating topological actions that are geographically far from the most - limiting element at the time of the evaluation. Proximity is defined by the number of country boundaries separating - the element from the topological action (see [max-number-of-boundaries-for-skipping-actions](#max-number-of-boundaries-for-skipping-actions)). - Setting this to true allows you to speed up the search tree RAO, while keeping a good precision, since topological - actions that are far from the most limiting element have almost no impact on the minimum margin. - -##### max-number-of-boundaries-for-skipping-actions -- **Expected value**: integer (>= 0) -- **Default value**: 2 -- **Usage**: the maximum number of country boundaries between the most limiting element and the topological actions that - shall be evaluated. The most limiting element is defined as the element with the minimum margin at **the time of this - evaluation**. - If the most limiting element has nodes in two countries, the smallest distance is considered. - If the value is set to zero, only topological actions in the same country as the most limiting element will be - evaluated in the search-tree. - If the value is set to 1, topological actions from direct neighbors will also be considered, etc. - *Note that the topology of the network is automatically deduced from the network file: countries sharing tie lines are - considered direct neighbors; dangling lines are not considered linked (ie BE and DE are not considered neighbors, even - though they share the Alegro line)* - -#### Second preventive RAO parameters -These parameters (second-preventive-rao) tune the behaviour of the [second preventive RAO](/castor/rao-steps.md#second-preventive-rao). - -##### execution-condition -- **Expected value**: one of the following: - - "DISABLED" - - "COST_INCREASE" - - "POSSIBLE_CURATIVE_IMPROVEMENT" -- **Default value**: "DISABLED" -- **Usage**: configures whether a 2nd preventive RAO should be run after the curative RAO. - *Note: if there are automatons, and if a 2nd preventive RAO is run, then a 2nd automaton RAO is also run* - - **DISABLED**: 2nd preventive RAO is not run - - **COST_INCREASE**: a 2nd preventive RAO is run if the RAO's overall cost has increased after optimisation compared to - before optimisation; for example due to a curative CNEC margin decreased in 1st preventive RAO and not reverted - during curative RAO - - **POSSIBLE_CURATIVE_IMPROVEMENT**: a 2nd preventive RAO is run only if it is possible to improve a curative perimeter, - i.e. if the curative RAO stop criterion on at least one contingency is not reached. - This depends on the value of parameter [type](#type): - - **SECURE_FLOW**: 2nd preventive RAO is run if one curative perimeter is not secure after optimisation - - **MAX_MIN_MARGIN** or **MAX_MIN_RELATIVE_MARGIN**: 2nd preventive RAO is run if one curative perimeter reached an objective function value - after optimisation that is worse than the preventive perimeter's (decreased by [curative-min-obj-improvement](#curative-min-obj-improvement)) - -##### re-optimize-curative-range-actions -- **Expected value**: true/false -- **Default value**: false -- **Usage**: - - **false**: the 2nd preventive RAO will optimize only the preventive remedial actions, keeping **all** optimal - curative remedial actions selected during the curative RAO. - - **true**: the 2nd preventive RAO will optimize preventive remedial actions **and** curative range actions, keeping - only the optimal curative **topological** actions computed in the curative RAO. - -##### hint-from-first-preventive-rao -- **Expected value**: true/false -- **Default value**: false -- **Usage**: if set to true, the RAO will use the optimal combination of network actions found in the first preventive - RAO, as a predefined combination ("hint") to test at the first search depth of the second preventive RAO. This way, - if this combination is optimal in the 2nd preventive RAO as well, getting to the optimal solution will be much faster. - -#### CNECs that should not be optimised -These parameters (not-optimized-cnecs) allow the activation of region-specific features, that de-activate the -optimisation of specific CNECs in specific conditions. - -##### do-not-optimize-curative-cnecs-for-tsos-without-cras -- **Expected value**: true/false -- **Default value**: false -- **Usage**: if this parameter is set to true, the RAO will detect TSOs not sharing any curative remedial actions (in - the CRAC). During the curative RAO, these TSOs' CNECs will not be taken into account in the minimum margin objective - function, unless the applied curative remedial actions decrease their margins (compared to their margins before - applying any curative action). - If it is set to false, all CNECs are treated equally in the curative RAO. - This parameter has no effect on the preventive RAO. - This parameter should be set to true for CORE CC. - -#### Load-flow and sensitivity computation parameters -These parameters (load-flow-and-sensitivity-computation) configure the load-flow and sensitivity computations providers -from inside the RAO. - -##### load-flow-provider -- **Expected value**: String, should refer to a [PowSyBl load flow provider implementation](inv:powsyblcore:std:doc#simulation/loadflow/index) -- **Default value**: "OpenLoadFlow" (see [OpenLoadFlow](inv:powsyblopenloadflow:std:doc#index)) -- **Usage**: the name of the load flow provider to use when a load flow is needed - -##### sensitivity-provider -- **Expected value**: String, should refer to a [PowSyBl sensitivity provider implementation](inv:powsyblcore:std:doc#simulation/sensitivity/index) -- **Default value**: "OpenLoadFlow" (see [OpenLoadFlow](inv:powsyblopenloadflow:std:doc#index)) -- **Usage**: the name of the sensitivity provider to use in the RAO - -##### sensitivity-failure-over-cost -- **Expected value**: numeric value, where the unit is that of the objective function -- **Default value**: 10000.0 -- **Usage**: if the systematic sensitivity analysis fails (= diverged) due to a combination of remedial actions, its - objective function assessment will be penalized by this value. In other words, the criterion for this combination of RA - will be (e.g.) : minMargin - sensitivity-failure-over-cost. - If this parameter is strictly positive, the RAO will discriminate the combinations of RA for which the systematic - analysis didn't converge. The RAO might therefore put aside the solution with the best objective-function if it has - lead to a sensitivity failure, and instead propose a solution whose objective-function is worse, but whose associated - network is converging for all contingency scenarios. - -##### sensitivity-parameters -- **Expected value**: SensitivityComputationParameters ([PowSyBl](inv:powsyblcore:std:doc#simulation/sensitivity/configuration) configuration) -- **Default value**: PowSyBl's default value (it is generally a bad idea to keep the default value for this parameter) -- **Usage**: sensitivity-parameters is the configuration of the PowSyBl sensitivity engine, which is used within OpenRAO. - The underlying "load-flow-parameters" is also used whenever an explicit pure load-flow computation is needed. - -#### Multi-threading parameters -These parameters (multi-threading) allow you to run a RAO making the most out of your computation resources. - -##### available-cpus -- **Expected value**: integer -- **Default value**: 1 -- **Usage**: It should not exceed the number of cores of the computer on which the computation is made. - Then it is used for: - - number of contingency scenarios (auto + curative instants) to optimise in parallel. - - number of combination of remedial actions that the search-tree will investigate in - parallel during the preventive RAO and automaton RAO. - *Note that the more available cpus is configured, the more RAM is required by the RAO, and that the performance - of the RAO might significantly decrease on a machine with limited memory resources.* - -### Loop-flow extension -Adding a LoopFlowParameters extension to RaoParameters will activate [loop-flow constraints](/castor/special-features/loop-flows.md). -(The RAO will monitor the loop-flows on CNECs that have a LoopFlowThreshold extension.) -The following parameters tune these constraints. -See also: [Modelling loop-flows and their virtual cost](/castor/linear-problem/max-loop-flow-filler.md) - -#### acceptable-increase -- **Expected value**: numeric values, in MEGAWATT unit -- **Default value**: 0.0 MW -- **Usage**: the increase of the initial loop-flow that is allowed by the optimisation. That is to say, the optimisation - bounds the loop-flow on CNECs by: - *LFcnec ≤ max(MaxLFcnec , InitLFcnec + acceptableAugmentation)* - With *LFcnec* the loop-flow on the CNEC after optimisation, *MaxLFcnec* is the CNEC loop-flow threshold, *InitLFcnec* - the initial loop-flow on the cnec, and *acceptableAugmentation* the so-called "loop-flow-acceptable-augmentation" - coefficient. - If this constraint cannot be respected and the loop-flow exceeds the aforementioned threshold, the objective function - associated to this situation will be penalized (see also [violation-cost](#violation-cost)) - -#### ptdf-approximation -- **Expected value**: one of the following: - - "FIXED_PTDF" - - "UPDATE_PTDF_WITH_TOPO" - - "UPDATE_PTDF_WITH_TOPO_AND_PST" -- **Default value**: "FIXED_PTDF" -- **Usage**: defines the frequency at which the PTDFs will be updated for the loop-flow computation. - This parameter enables to set the desired trade-off between the accuracy of the loop-flow computation, and the - computation time of the RAO. - - **FIXED_PTDF**: the PTDFs are computed only once at the beginning of the RAO. - - **UPDATE_PTDF_WITH_TOPO**: the PTDFs are re-computed for each new combination of topological actions (i.e. - for each new node of the search-tree). - - **UPDATE_PTDF_WITH_TOPO_AND_PST**: the PTDFs are re-computed for each new combination of topological action and for - each new combination of PST taps (i.e. for each iteration of the linear optimisation). - *Note that this option is only relevant in AC-loadflow mode, as the UPDATE_PTDF_WITH_TOPO already maximizes accuracy in DC.* - -#### constraint-adjustment-coefficient -- **Expected value**: numeric values, in MEGAWATT unit -- **Default value**: 0.0 MW -- **Usage**: this parameter acts as a margin which tightens, in the linear optimisation problem of RAO, the bounds of the - loop-flow constraints. It conceptually behaves as the coefficient *cAdjustment* from the constraint below: - *abs(LoopFlow(cnec)) <= LoopFlowThreshold - cAdjustment* - This parameter is a safety margin that can absorb some approximations made in the linear - optimisation problem of the RAO (non-integer PSTs taps, flows approximated by sensitivity coefficients, etc.), and - therefore increase the probability that the loop-flow constraints which are respected in the linear optimisation - problem, remain respected once the loop-flows are re-computed without the linear approximations. - -#### violation-cost -- **Expected value**: numeric values, unit = unit of the objective function per MEGAWATT -- **Default value**: 10.0 -- **Usage**: this parameter is the cost of each excess of loop-flow. That is to say, if the loop-flows on one or several - CNECs exceed the loop-flow threshold, a penalty will be added in the objective function of the RAO equal to: - *violation-cost x sum{cnec} excess-loop-flow(cnec)* - -#### countries -- **Expected value**: array of country codes "XX" -- **Default value**: all countries encountered -- **Usage**: list of countries for which loop-flows should be limited accordingly to the specified constraints. If not - present, all countries encountered in the input files will be considered. Note that a cross-border line will have its - loop-flows monitored if at least one of its two sides is in a country from this list. - Example of this parameter : [ "BE", "NL" ] if you want to monitor loop-flows in and out of Belgium and the - Netherlands. - -### MNEC extension -Adding a MnecParameters extension to RaoParameters will activate [MNEC constraints](/castor/linear-problem/mnec-filler.md). -(The RAO will only monitor CNECs that are only ["monitored"](/input-data/crac/json.md#cnecs)). -The following parameters tune these constraints. -See also: [Modelling MNECs and their virtual cost](/castor/linear-problem/mnec-filler.md) - -#### acceptable-margin-decrease -- **Expected value**: numeric values, in MEGAWATT unit -- **Default value**: 50 MW (required by CORE CC methodology) -- **Usage**: the decrease of the initial margin that is allowed by the optimisation on MNECs. - In other words, it defines the bounds for the margins on the MNECs by - *Mcnec ≥ max(0, m0cnec − acceptableDiminution)* - With *Mcnec* the margin on the cnec after optimisation, *m0cnec* the initial margin on the cnec, and - *acceptableDiminution* the so-called "acceptable-margin-decrease" coefficient. - For the CORE CC calculation, the ACER methodology fixes this coefficient at 50 MW. - For CSE CC calculation, setting this parameter to -99999 allows the MNEC constraints to consider - the thresholds in the CRAC only. - -#### violation-cost -- **Expected value**: numeric values, no unit (it applies as a multiplier for the constraint violation inside the - objective function) -- **Default value**: 10.0 (same as [loop-flow violation cost](#violation-cost)) -- **Usage**: the penalty cost associated to the violation of a MNEC constraint. - In order to avoid optimisation infeasibility, the MNEC constraints are soft: they can be violated. These violations - are penalized by a significant cost, in order to guide the optimiser towards a solution where - if possible - all - MNECs' constraints are respected. The penalty injected in the objective function is equal to the violation (difference - between actual margin and least acceptable margin) multiplied by this parameter. - -#### constraint-adjustment-coefficient -- **Expected value**: numeric values, in MEGAWATT unit -- **Default value**: 0.0 -- **Usage**: this coefficient is here to mitigate the approximation made by the linear optimisation (approximation = use - of sensitivities to linearize the flows, rounding of the PST taps). - *Mcnec ≥ max(0 , m0cnec - acceptableDiminution) + constraintAdjustment* - With *constraintAdjustment* the so-called "constraint-adjustment-coefficient". - It tightens the MNEC constraint, in order to take some margin for that constraint to stay respected once the - approximations are removed (i.e. taps have been rounded and real flow calculated) - -### Relative margins extension -Adding a RelativeMarginsParameters extension is mandatory when [objective function is relative](#type). -See also: [Modelling the maximum minimum relative margin objective function](/castor/linear-problem/max-min-relative-margin-filler.md) - -#### ptdf-boundaries -- **Expected value**: array of zone-to-zone PTDF computation definition, expressed as an equation. -Zones are defined by their 2-character code or their 16-character EICode, inside **{ }** characters. -Zones are seperated by + or -. - All combinations are allowed: country codes, EIC, a mix. -- **Default value**: empty array -- **Usage**: contains the boundaries on which the PTDF absolute sums should be computed (and added to the denominator of - the relative RAM). - For example, in the SWE case, it should be equal to [ "{FR}-{ES}", "{ES}-{PT}" ]. - For CORE, we should use all the CORE region boundaries (all countries seperated by a - sign) plus Alegro's special - equation: "{BE}-{22Y201903144---9}-{DE}+{22Y201903145---4}" - -#### ptdf-approximation -- **Expected value**: one of the following: - - "FIXED_PTDF" - - "UPDATE_PTDF_WITH_TOPO" - - "UPDATE_PTDF_WITH_TOPO_AND_PST" -- **Default value**: "FIXED_PTDF" -- **Usage**: defines the frequency at which the PTDFs will be updated for the relative margins computation. - This parameter enables to set the desired trade-off between the accuracy of the relative margins computation, and the - computation time of the RAO. - - **FIXED_PTDF**: the PTDFs are computed only once at the beginning of the RAO. - - **UPDATE_PTDF_WITH_TOPO**: the PTDFs are re-computed for each new combination of topological actions (i.e. - for each new node of the search-tree). - - **UPDATE_PTDF_WITH_TOPO_AND_PST**: the PTDFs are re-computed for each new combination of topological action and for - each new combination of PST taps (i.e. for each iteration of the linear optimisation). - *Note that this option is only relevant in AC-loadflow mode, as the UPDATE_PTDF_WITH_TOPO already maximizes accuracy in DC.* +## Examples -#### ptdf-sum-lower-bound -- **Expected value**: numeric value, no unit (homogeneous to PTDFs) -- **Default value**: 0.01 -- **Usage**: PTDF absolute sums are used as a denominator in the objective function. In order to prevent the objective - function from diverging to infinity (resulting in unbounded problems), the denominator should be prevented from - getting close to zero. This parameter acts as a lower bound to the denominator. +Examples of rao parameters with business and implementation specific parameters -## Examples > ⚠️ **NOTE** > The following examples in json and yaml are not equivalent diff --git a/docs/parameters/business-parameters.md b/docs/parameters/business-parameters.md new file mode 100644 index 0000000000..add12755a9 --- /dev/null +++ b/docs/parameters/business-parameters.md @@ -0,0 +1,230 @@ +# Business parameters + +## Rao parameters + +RAO parameters to tune the RAO (not implementation specific). + +### Objective function parameters + +These parameters (objective-function) configure the remedial action optimisation's objective function. + +#### type +- **Expected value**: one of the following: + - "SECURE_FLOW" + - "MAX_MIN_MARGIN" + - "MAX_MIN_RELATIVE_MARGIN" +- **Default value**: "SECURE_FLOW" +- **Usage**: this parameter sets the objective function of the RAO. For now, the existing objective function are: + - **SECURE_FLOW**: The search-tree will stop as soon as it finds a solution where the minimum margin is positive. + - **MAX_MIN_MARGIN**: the search-tree will maximize the minimum margin until it converges to a + maximum value, or until another stop criterion has been reached (e.g. [max-preventive-search-tree-depth](#max-preventive-search-tree-depth)). + - **MAX_MIN_RELATIVE_MARGIN**: same as MAX_MIN_MARGIN, but the margins will be relative + (divided by the absolute sum of PTDFs) when they are positive. + +#### unit +- **Expected value**: one of the following: + - "MEGAWATT" + - "AMPERE" +- **Default value**: "MEGAWATT" +- **Usage**: this parameter sets the objective function unit of the RAO. For now, the existing objective function units are: + - **MEGAWATT**: the margins to maximize are considered in MW. + - **AMPERE**: the margins to maximize are considered in A. + Note that CNECs from different voltage levels will not have the same weight in the objective function depending on the unit + considered (MW or A). Ampere unit only works in AC-load-flow mode (see [sensitivity-parameters](#sensitivity-parameters)). + +#### enforce-curative-security +- **Expected value**: true/false +- **Default value**: false +- **Usage**: if this parameter is set to true, OpenRAO will continue optimizing curative states even if preventive state + is unsecure. + If this parameter is set to false, OpenRAO will stop after preventive if preventive state is unsecure and won't try to + improve curative states. + + *Note: Only applied when ["type"](#type) is set to SECURE_FLOW. In this case, if preventive was unsecure, +second preventive won't be run, even if curative cost is higher, in order to save computation time* + +### Range actions optimisation parameters +These parameters (range-actions-optimization) tune the [linear optimiser](/castor/linear-problem.md) used to optimise range actions. +(See [Modelling CNECs and range actions](/castor/linear-problem/core-problem-filler.md)) + +#### pst-ra-min-impact-threshold +- **Expected value**: numeric value, unit: unit of the objective function / ° (per degree) +- **Default value**: 0.01 +- **Usage**: the pst-ra-min-impact-threshold represents the cost of changing the PST set-points, it is used within the linear + optimisation problem of the RAO, where, for each PST, the following term is added to the objective function: + $pst\text{-}ra\text{-}min\text{-}impact\text{-}threshold \times |\alpha - \alpha_{0}|$, where $\alpha$ is the optimized angle of the PST, and + $\alpha_{0}$ the angle in its initial position. + If several solutions are equivalent (e.g. with the same min margin), a strictly positive pst-ra-min-impact-threshold will favour + the ones with the PST taps the closest to the initial situation. + +#### hvdc-ra-min-impact-threshold +- **Expected value**: numeric value, unit: unit of the objective function / MW +- **Default value**: 0.001 +- **Usage**: the hvdc-ra-min-impact-threshold represents the cost of changing the HVDC set-points, it is used within the linear + optimisation problem of the RAO, where, for each HVDC, the following term is added to the objective function: + $hvdc\text{-}ra\text{-}min\text{-}impact\text{-}threshold \times |P - P_{0}|$, where $P$ is the optimized target power of the HVDC, and $P_{0}$ the initial target + power. + If several solutions are equivalent (e.g. with the same min margin), a strictly positive hvdc-ra-min-impact-threshold will favour + the ones with the HVDC set-points the closest to the initial situation. + +#### injection-ra-min-impact-threshold +- **Expected value**: numeric value, unit: unit of the objective function / MW +- **Default value**: 0.001 +- **Usage**: the injection-ra-min-impact-threshold represents the cost of changing the injection set-points, it is used within the linear + optimisation problem of the RAO, in the same way as the two types of RangeAction above. + +### Network actions optimisation parameters +These parameters (topological-actions-optimization) tune the [search-tree algorithm](/castor.md#algorithm) +when searching for the best network actions. + +#### absolute-minimum-impact-threshold +- **Expected value**: numeric value, where the unit is that of the objective function +- **Default value**: 0.0 +- **Usage**: if a topological action improves the objective function by x, and x is smaller than this parameter, the + effectiveness of this topological action will be considered inconsequential, and it will not be retained by the + search-tree. + The absolute-minimum-impact-threshold can therefore fill two purposes: + - do not retain in the optimal solution of the RAO remedial actions with a negligible impact + - speed up the computation by avoiding the few final depths which only slightly improve the solution. + +#### relative-minimum-impact-threshold +- **Expected value**: numeric value, percentage defined between 0 and 1 (1 = 100%) +- **Default value**: 0.0 +- **Usage**: behaves like [absolute-minimum-impact-threshold](#absolute-minimum-impact-threshold), but the + threshold here is defined as a coefficient of the objective function value of the previous depth. In depth (n+1), if a + topological action improves the objective function by $x$, with $x < solution(depth(n)) \times relative\text{-}minimum\text{-}impact\text{-}threshold$, + it will not be retained by the search-tree. + +### CNECs that should not be optimised +These parameters (not-optimized-cnecs) allow the activation of region-specific features, that de-activate the +optimisation of specific CNECs in specific conditions. + +#### do-not-optimize-curative-cnecs-for-tsos-without-cras +- **Expected value**: true/false +- **Default value**: false +- **Usage**: if this parameter is set to true, the RAO will detect TSOs not sharing any curative remedial actions (in + the CRAC). During the curative RAO, these TSOs' CNECs will not be taken into account in the minimum margin objective + function, unless the applied curative remedial actions decrease their margins (compared to their margins before + applying any curative action). + If it is set to false, all CNECs are treated equally in the curative RAO. + This parameter has no effect on the preventive RAO. + This parameter should be set to true for CORE CC. + +### Loop-flow optional parameter +Adding a LoopFlowParameters to RaoParameters will activate [loop-flow constraints](/castor/special-features/loop-flows.md). +(The RAO will monitor the loop-flows on CNECs that have a LoopFlowThreshold extension.) +The following parameters tune some of these constraints, the one which are not implementation specific. +See also: [Modelling loop-flows and their virtual cost](/castor/linear-problem/max-loop-flow-filler.md) + +#### acceptable-increase +- **Expected value**: numeric values, in MEGAWATT unit +- **Default value**: 0.0 MW +- **Usage**: the increase of the initial loop-flow that is allowed by the optimisation. That is to say, the optimisation + bounds the loop-flow on CNECs by: + *LFcnec ≤ max(MaxLFcnec , InitLFcnec + acceptableAugmentation)* + With *LFcnec* the loop-flow on the CNEC after optimisation, *MaxLFcnec* is the CNEC loop-flow threshold, *InitLFcnec* + the initial loop-flow on the cnec, and *acceptableAugmentation* the so-called "loop-flow-acceptable-augmentation" + coefficient. + If this constraint cannot be respected and the loop-flow exceeds the aforementioned threshold, the objective function + associated to this situation will be penalized (see also [violation-cost](#violation-cost)) + +#### countries +- **Expected value**: array of country codes "XX" +- **Default value**: all countries encountered +- **Usage**: list of countries for which loop-flows should be limited accordingly to the specified constraints. If not + present, all countries encountered in the input files will be considered. Note that a cross-border line will have its + loop-flows monitored if at least one of its two sides is in a country from this list. + Example of this parameter : [ "BE", "NL" ] if you want to monitor loop-flows in and out of Belgium and the + Netherlands. + +### MNEC optional parameter +Adding a MnecParameters to RaoParameters will activate [MNEC constraints](/castor/linear-problem/mnec-filler.md). +(The RAO will only monitor CNECs that are only ["monitored"](/input-data/crac/json.md#cnecs)). +The following parameters tune some of these constraints, the one which are not implementation specific. +See also: [Modelling MNECs and their virtual cost](/castor/linear-problem/mnec-filler.md) + +#### acceptable-margin-decrease +- **Expected value**: numeric values, in MEGAWATT unit +- **Default value**: 50 MW (required by CORE CC methodology) +- **Usage**: the decrease of the initial margin that is allowed by the optimisation on MNECs. + In other words, it defines the bounds for the margins on the MNECs by + *Mcnec ≥ max(0, m0cnec − acceptableDiminution)* + With *Mcnec* the margin on the cnec after optimisation, *m0cnec* the initial margin on the cnec, and + *acceptableDiminution* the so-called "acceptable-margin-decrease" coefficient. + For the CORE CC calculation, the ACER methodology fixes this coefficient at 50 MW. + For CSE CC calculation, setting this parameter to -99999 allows the MNEC constraints to consider + the thresholds in the CRAC only. + +### Relative margins optional parameter +Adding a RelativeMarginsParameters is mandatory when [objective function is relative](#type). +The following parameters tune some constraints, the one which are not implementation specific. +See also: [Modelling the maximum minimum relative margin objective function](/castor/linear-problem/max-min-relative-margin-filler.md) + +#### ptdf-boundaries +- **Expected value**: array of zone-to-zone PTDF computation definition, expressed as an equation. + Zones are defined by their 2-character code or their 16-character EICode, inside **{ }** characters. + Zones are seperated by + or -. + All combinations are allowed: country codes, EIC, a mix. +- **Default value**: empty array +- **Usage**: contains the boundaries on which the PTDF absolute sums should be computed (and added to the denominator of + the relative RAM). + For example, in the SWE case, it should be equal to [ "{FR}-{ES}", "{ES}-{PT}" ]. + For CORE, we should use all the CORE region boundaries (all countries seperated by a - sign) plus Alegro's special + equation: "{BE}-{22Y201903144---9}-{DE}+{22Y201903145---4}" + +## Examples +> ⚠️ **NOTE** +> The following examples in json and yaml are not equivalent + +::::{tabs} +:::{group-tab} JSON +~~~json +{ + "version" : "3.0", + "objective-function" : { + "type" : "SECURE_FLOW", + "unit" : "A", + "enforce-curative-security" : true + }, + "range-actions-optimization" : { + "pst-ra-min-impact-threshold" : 0.01, + "hvdc-ra-min-impact-threshold" : 0.001, + "injection-ra-min-impact-threshold" : 0.001 + }, + "topological-actions-optimization" : { + "relative-minimum-impact-threshold" : 0.0, + "absolute-minimum-impact-threshold" : 1.0 + }, + "not-optimized-cnecs" : { + "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false + } +} +~~~ +::: +:::{group-tab} iTools +Based on PowSyBl's [configuration mechanism](inv:powsyblcore:std:doc#user/configuration/index). +~~~yaml +rao-objective-function: + type: SECURE_FLOW + unit: AMPERE + +rao-range-actions-optimization: + pst-ra-min-impact-threshold: 0.01 + +rao-topological-actions-optimization: + relative-minimum-impact-threshold: 0.0 + absolute-minimum-impact-threshold: 2.0 + +search-tree-multi-threading: + available-cpus: 4 + +search-tree-second-preventive-rao: + execution-condition: POSSIBLE_CURATIVE_IMPROVEMENT + re-optimize-curative-range-actions: true + hint-from-first-preventive-rao: true + +rao-not-optimized-cnecs: + do-not-optimize-curative-cnecs-for-tsos-without-cras: false +~~~ +::: +:::: diff --git a/docs/parameters/implementation-specific-parameters.md b/docs/parameters/implementation-specific-parameters.md new file mode 100644 index 0000000000..7b7bd738c8 --- /dev/null +++ b/docs/parameters/implementation-specific-parameters.md @@ -0,0 +1,532 @@ +# Implementation specific parameters + +## Rao parameters Extensions + +Used to configure RAO implementation specific parameters + +### Open Rao Search Tree Parameters extension + +This extension is used to configure Open RAO specific parameters for search tree algorithms + +#### Objective function parameters + +##### curative-min-obj-improvement +- **Expected value**: numeric value, where the unit is that of the objective function +- **Default value**: 0 +- **Usage**: used as a minimum improvement of the preventive RAO objective value for the curative RAO objective value, + when [type](#type) is set to MAX_MIN_MARGIN or MAX_MIN_RELATIVE_MARGIN. + +#### Range actions optimisation parameters +These parameters (range-actions-optimization) tune the [linear optimiser](/castor/linear-problem.md) used to optimise range actions. +(See [Modelling CNECs and range actions](/castor/linear-problem/core-problem-filler.md)) + +##### max-mip-iterations +- **Expected value**: integer +- **Default value**: 10 +- **Usage**: defines the maximum number of iterations to be executed by the iterating linear optimiser of the RAO. + One iteration of the iterating linear optimiser includes: the resolution of one linear problem (MIP), an update of the + network with the optimal PST taps found in the linear problem, a security analysis of the updated network and an + assessment of the objective function based on the results of the security analysis. + The linear problem relies on sensitivity coefficients to estimate the flows on each CNEC, and those estimations might + not be perfect when several PSTs taps are significantly changed. When the linear optimisation problem makes a (n+1)th + iteration, it refines its solution with new sensitivity coefficients, which better describe the neighbourhood of the + solution found in iteration (n). + Note that the linear optimisation problems usually "converge" with very few iterations (1 to 4 iterations). + +##### pst-model +- **Expected value**: one of the following: + - "CONTINUOUS" + - "APPROXIMATED_INTEGERS" +- **Default value**: "CONTINUOUS" +- **Usage**: the method to model PSTs in the linear problem: + - **CONTINUOUS**: PSTs are represented by their angle set-points; the set-points are continuous optimisation variables + and OpenRAO rounds the result to the best tap (around the optimal set-point) after optimisation. This approach is not + very precise but does not create integer optimisation variables; thus it is quicker to solve, especially with + open-source solvers. + - **APPROXIMATED_INTEGERS**: a PST is represented by its tap positions, and these tap positions are considered + proportional to the PST's angle set-point (hence the "approximated" adjective). Thus, these tap positions can be + used as a multiplier of the sensitivity values when representing the impact of the PST on CNECs. This approach is + more precise and thus has the advantage of better respecting Loop-Flow and MNEC constraints. But it introduces + integer variables (tap positions) and can be harder to solve. + See [Using integer variables for PST taps](/castor/linear-problem/discrete-pst-tap-filler.md). + +##### pst-sensitivity-threshold +- **Expected value**: numeric value, unit: MW / ° (per degree) +- **Default value**: 0.0 +- **Usage**: the pst sensitivity coefficients which are below the pst-sensitivity-threshold will be considered equal to + zero by the linear optimisation problem. Filtering some small sensitivity coefficients have the two following perks + for the RAO: + - it decreases the complexity of the optimisation problem by reducing significantly the number of non-zero elements + - it can avoid changes of PST set-points when they only allow to earn a few MW on the margins of some CNECs. + +##### hvdc-sensitivity-threshold +- **Expected value**: numeric value, unit: MW / MW +- **Default value**: 0.0 +- **Usage**: the hvdc sensitivity coefficients which are below the hvdc-sensitivity-threshold will be considered equal + to zero by the linear optimisation problem. Filtering some of the small sensitivity coefficients have the two + following perks regarding the RAO: + - it decreases the complexity of the optimisation problem by reducing significantly the number of non-null elements + - it can avoid changes of HVDC set-points when they only allow to earn a few MW on the margins of some CNECs. + +##### injection-ra-sensitivity-threshold +- **Expected value**: numeric value, unit: MW / MW +- **Default value**: 0.0 +- **Usage**: the injection sensitivity coefficients which are below the injection-ra-sensitivity-threshold will be + considered equal to zero by the linear optimisation problem. + The perks are the same as the two parameters above. + +##### ra-range-shrinking +- **Expected value**: one of the following: + - "DISABLED" + - "ENABLED" + - "ENABLED_IN_FIRST_PRAO_AND_CRAO" +- **Default value**: "DISABLED" +- **Usage**: CASTOR makes the approximation that range action sensitivities on CNECs are linear. However, in + active+reactive computations, this approximation may be incorrect. The linear problem can thus find a worse solution + than in its previous iteration. + - **DISABLED**: if this situation occurs, the linear problem stops and returns the previous solution, + see this schema : [Linear Remedial Actions Optimisation](/castor/linear-problem.md#algorithm). + - **ENABLED**: this introduces two new behaviors to the iterating linear optimiser: + 1. If the linear problem finds a solution worse than in its previous iteration, it continues iterating. + When stop condition is met ([max-mip-iterations](#max-mip-iterations) reached, or two successive iterations have + the same optimal RA set-points), then the problem returns the best solution it has found. + 2. At each new iteration, the range action's allowed range shrinks according to equations [described here](/castor/linear-problem/core-problem-filler.md#shrinking-the-allowed-range). + These equations have been chosen to force the linear problem convergence while allowing the RA to go + back to its initial solution if needed. + - **ENABLED_IN_FIRST_PRAO_AND_CRAO**: + same as **ENABLED** but only for first preventive and curative RAO. This parameter value has been introduced because + sensitivity computations in the second preventive RAO can be slow (due to the larger optimization perimeter), thus + computation time loss may outweigh the gains of RA range shrinking. + +##### linear-optimization-solver +These are parameters that tune the solver used to solve the MIP problem. + +###### solver +- **Expected value**: one of the following: + - "CBC" + - "SCIP" + - "XPRESS" +- **Default value**: "CBC" +- **Usage**: the solver called for optimising the linear problem. + Note that theoretically all solvers supported by OR-Tools can be called, but the OpenRAO interface only allows CBC + (open-source), SCIP (commercial) and XPRESS (commercial) for the moment. + If needed, other solvers can be easily added. + +###### relative-mip-gap +- **Expected value**: double +- **Default value**: 0.0001 +- **Usage**: the relative MILP (Mixed-Integer-Linear-Programming) target gap. + During branch-and-bound algorithm (only in MILP case), the solver will stop branching when this relative gap is + reached between the best found objective function and the estimated objective function best bound. + +###### solver-specific-parameters + +- **Expected value**: String, space-separated parameters (keys and values) understandable by OR-Tools (for example "key1 + value1 key2 value2") +- **Default value**: empty +- **Usage**: this can be used to set solver-specific parameters, when the OR-Tools API and its generic parameters are + not enough. + +#### Network actions optimisation parameters +These parameters (topological-actions-optimization) tune the [search-tree algorithm](/castor.md#algorithm) +when searching for the best network actions. + +##### max-preventive-search-tree-depth +- **Expected value**: integer +- **Default value**: 2^32 -1 (max integer value) +- **Usage**: maximum search-tree depth for preventive optimization. + Applies to the preventive RAO. + +##### max-auto-search-tree-depth +- **Expected value**: integer +- **Default value**: 2^32 -1 (max integer value) +- **Usage**: maximum search-tree depth for the optimization of available auto network actions. + +##### max-curative-search-tree-depth +- **Expected value**: integer +- **Default value**: 2^32 -1 (max integer value) +- **Usage**: maximum search-tree depth for curative optimization. + Applies separately to each perimeter-specific curative RAO. + +##### predefined-combinations +- **Expected value**: an array containing sets of network action IDs +- **Default value**: empty +- **Usage**: this parameter contains hints for the search-tree RAO, consisting of combinations of multiple network + actions that the user considers interesting to test together during the RAO. + These combinations will be tested in the first search depth of the search-tree + +![Search-tree-with-combinations](/_static/img/Search-tree-with-combinations.png){.forced-white-background} + +##### skip-actions-far-from-most-limiting-element +- **Expected value**: true/false +- **Default value**: false +- **Usage**: whether the RAO should skip evaluating topological actions that are geographically far from the most + limiting element at the time of the evaluation. Proximity is defined by the number of country boundaries separating + the element from the topological action (see [max-number-of-boundaries-for-skipping-actions](#max-number-of-boundaries-for-skipping-actions)). + Setting this to true allows you to speed up the search tree RAO, while keeping a good precision, since topological + actions that are far from the most limiting element have almost no impact on the minimum margin. + +##### max-number-of-boundaries-for-skipping-actions +- **Expected value**: integer (>= 0) +- **Default value**: 2 +- **Usage**: the maximum number of country boundaries between the most limiting element and the topological actions that + shall be evaluated. The most limiting element is defined as the element with the minimum margin at **the time of this + evaluation**. + If the most limiting element has nodes in two countries, the smallest distance is considered. + If the value is set to zero, only topological actions in the same country as the most limiting element will be + evaluated in the search-tree. + If the value is set to 1, topological actions from direct neighbors will also be considered, etc. + *Note that the topology of the network is automatically deduced from the network file: countries sharing tie lines are + considered direct neighbors; dangling lines are not considered linked (ie BE and DE are not considered neighbors, even + though they share the Alegro line)* + +#### Second preventive RAO parameters +These parameters (second-preventive-rao) tune the behaviour of the [second preventive RAO](/castor/rao-steps.md#second-preventive-rao). + +##### execution-condition +- **Expected value**: one of the following: + - "DISABLED" + - "COST_INCREASE" + - "POSSIBLE_CURATIVE_IMPROVEMENT" +- **Default value**: "DISABLED" +- **Usage**: configures whether a 2nd preventive RAO should be run after the curative RAO. + *Note: if there are automatons, and if a 2nd preventive RAO is run, then a 2nd automaton RAO is also run* + - **DISABLED**: 2nd preventive RAO is not run + - **COST_INCREASE**: a 2nd preventive RAO is run if the RAO's overall cost has increased after optimisation compared to + before optimisation; for example due to a curative CNEC margin decreased in 1st preventive RAO and not reverted + during curative RAO + - **POSSIBLE_CURATIVE_IMPROVEMENT**: a 2nd preventive RAO is run only if it is possible to improve a curative perimeter, + i.e. if the curative RAO stop criterion on at least one contingency is not reached. + This depends on the value of parameter [type](#type): + - **SECURE_FLOW**: 2nd preventive RAO is run if one curative perimeter is not secure after optimisation + - **MAX_MIN_MARGIN** or **MAX_MIN_RELATIVE_MARGIN**: 2nd preventive RAO is run if one curative perimeter reached an objective function value + after optimisation that is worse than the preventive perimeter's (decreased by [curative-min-obj-improvement](#curative-min-obj-improvement)) + +##### re-optimize-curative-range-actions +- **Expected value**: true/false +- **Default value**: false +- **Usage**: + - **false**: the 2nd preventive RAO will optimize only the preventive remedial actions, keeping **all** optimal + curative remedial actions selected during the curative RAO. + - **true**: the 2nd preventive RAO will optimize preventive remedial actions **and** curative range actions, keeping + only the optimal curative **topological** actions computed in the curative RAO. + +##### hint-from-first-preventive-rao +- **Expected value**: true/false +- **Default value**: false +- **Usage**: if set to true, the RAO will use the optimal combination of network actions found in the first preventive + RAO, as a predefined combination ("hint") to test at the first search depth of the second preventive RAO. This way, + if this combination is optimal in the 2nd preventive RAO as well, getting to the optimal solution will be much faster. + +#### CNECs that should not be optimised +These parameters (not-optimized-cnecs) allow the activation of region-specific features, that de-activate the +optimisation of specific CNECs in specific conditions. + +##### do-not-optimize-curative-cnecs-for-tsos-without-cras +- **Expected value**: true/false +- **Default value**: false +- **Usage**: if this parameter is set to true, the RAO will detect TSOs not sharing any curative remedial actions (in + the CRAC). During the curative RAO, these TSOs' CNECs will not be taken into account in the minimum margin objective + function, unless the applied curative remedial actions decrease their margins (compared to their margins before + applying any curative action). + If it is set to false, all CNECs are treated equally in the curative RAO. + This parameter has no effect on the preventive RAO. + This parameter should be set to true for CORE CC. + +#### Load-flow and sensitivity computation parameters +These parameters (load-flow-and-sensitivity-computation) configure the load-flow and sensitivity computations providers +from inside the RAO. + +##### load-flow-provider +- **Expected value**: String, should refer to a [PowSyBl load flow provider implementation](inv:powsyblcore:std:doc#simulation/loadflow/index) +- **Default value**: "OpenLoadFlow" (see [OpenLoadFlow](inv:powsyblopenloadflow:std:doc#index)) +- **Usage**: the name of the load flow provider to use when a load flow is needed + +##### sensitivity-provider +- **Expected value**: String, should refer to a [PowSyBl sensitivity provider implementation](inv:powsyblcore:std:doc#simulation/sensitivity/index) +- **Default value**: "OpenLoadFlow" (see [OpenLoadFlow](inv:powsyblopenloadflow:std:doc#index)) +- **Usage**: the name of the sensitivity provider to use in the RAO + +##### sensitivity-failure-over-cost +- **Expected value**: numeric value, where the unit is that of the objective function +- **Default value**: 10000.0 +- **Usage**: if the systematic sensitivity analysis fails (= diverged) due to a combination of remedial actions, its + objective function assessment will be penalized by this value. In other words, the criterion for this combination of RA + will be (e.g.) : minMargin - sensitivity-failure-over-cost. + If this parameter is strictly positive, the RAO will discriminate the combinations of RA for which the systematic + analysis didn't converge. The RAO might therefore put aside the solution with the best objective-function if it has + lead to a sensitivity failure, and instead propose a solution whose objective-function is worse, but whose associated + network is converging for all contingency scenarios. + +##### sensitivity-parameters +- **Expected value**: SensitivityComputationParameters ([PowSyBl](inv:powsyblcore:std:doc#simulation/sensitivity/configuration) configuration) +- **Default value**: PowSyBl's default value (it is generally a bad idea to keep the default value for this parameter) +- **Usage**: sensitivity-parameters is the configuration of the PowSyBl sensitivity engine, which is used within OpenRAO. + The underlying "load-flow-parameters" is also used whenever an explicit pure load-flow computation is needed. + +#### Multi-threading parameters +These parameters (multi-threading) allow you to run a RAO making the most out of your computation resources. + +##### available-cpus +- **Expected value**: integer +- **Default value**: 1 +- **Usage**: It should not exceed the number of cores of the computer on which the computation is made. + Then it is used for: + - number of contingency scenarios (auto + curative instants) to optimise in parallel. + - number of combination of remedial actions that the search-tree will investigate in + parallel during the preventive RAO and automaton RAO. + *Note that the more available cpus is configured, the more RAM is required by the RAO, and that the performance + of the RAO might significantly decrease on a machine with limited memory resources.* + +#### Loop-flow optional parameter +Adding a LoopFlowParameters to OpenRaoSearchTreeParameters will activate [loop-flow constraints](/castor/special-features/loop-flows.md). +(The RAO will monitor the loop-flows on CNECs that have a LoopFlowThreshold extension.) +The following parameters tune some of these constraints, the one which are implementation specific. +See also: [Modelling loop-flows and their virtual cost](/castor/linear-problem/max-loop-flow-filler.md) + +##### ptdf-approximation +- **Expected value**: one of the following: + - "FIXED_PTDF" + - "UPDATE_PTDF_WITH_TOPO" + - "UPDATE_PTDF_WITH_TOPO_AND_PST" +- **Default value**: "FIXED_PTDF" +- **Usage**: defines the frequency at which the PTDFs will be updated for the loop-flow computation. + This parameter enables to set the desired trade-off between the accuracy of the loop-flow computation, and the + computation time of the RAO. + - **FIXED_PTDF**: the PTDFs are computed only once at the beginning of the RAO. + - **UPDATE_PTDF_WITH_TOPO**: the PTDFs are re-computed for each new combination of topological actions (i.e. + for each new node of the search-tree). + - **UPDATE_PTDF_WITH_TOPO_AND_PST**: the PTDFs are re-computed for each new combination of topological action and for + each new combination of PST taps (i.e. for each iteration of the linear optimisation). + *Note that this option is only relevant in AC-loadflow mode, as the UPDATE_PTDF_WITH_TOPO already maximizes accuracy in DC.* + +##### constraint-adjustment-coefficient +- **Expected value**: numeric values, in MEGAWATT unit +- **Default value**: 0.0 MW +- **Usage**: this parameter acts as a margin which tightens, in the linear optimisation problem of RAO, the bounds of the + loop-flow constraints. It conceptually behaves as the coefficient *cAdjustment* from the constraint below: + *abs(LoopFlow(cnec)) <= LoopFlowThreshold - cAdjustment* + This parameter is a safety margin that can absorb some approximations made in the linear + optimisation problem of the RAO (non-integer PSTs taps, flows approximated by sensitivity coefficients, etc.), and + therefore increase the probability that the loop-flow constraints which are respected in the linear optimisation + problem, remain respected once the loop-flows are re-computed without the linear approximations. + +##### violation-cost +- **Expected value**: numeric values, unit = unit of the objective function per MEGAWATT +- **Default value**: 10.0 +- **Usage**: this parameter is the cost of each excess of loop-flow. That is to say, if the loop-flows on one or several + CNECs exceed the loop-flow threshold, a penalty will be added in the objective function of the RAO equal to: + *violation-cost x sum{cnec} excess-loop-flow(cnec)* + +#### MNEC optional parameter +Adding a MnecParameters to OpenRaoSearchTreeParameters will activate [MNEC constraints](/castor/linear-problem/mnec-filler.md). +(The RAO will only monitor CNECs that are only ["monitored"](/input-data/crac/json.md#cnecs)). +The following parameters tune some of these constraints, the one which are implementation specific. +See also: [Modelling MNECs and their virtual cost](/castor/linear-problem/mnec-filler.md) + +##### violation-cost +- **Expected value**: numeric values, no unit (it applies as a multiplier for the constraint violation inside the + objective function) +- **Default value**: 10.0 (same as [loop-flow violation cost](#violation-cost)) +- **Usage**: the penalty cost associated to the violation of a MNEC constraint. + In order to avoid optimisation infeasibility, the MNEC constraints are soft: they can be violated. These violations + are penalized by a significant cost, in order to guide the optimiser towards a solution where - if possible - all + MNECs' constraints are respected. The penalty injected in the objective function is equal to the violation (difference + between actual margin and least acceptable margin) multiplied by this parameter. + +##### constraint-adjustment-coefficient +- **Expected value**: numeric values, in MEGAWATT unit +- **Default value**: 0.0 +- **Usage**: this coefficient is here to mitigate the approximation made by the linear optimisation (approximation = use + of sensitivities to linearize the flows, rounding of the PST taps). + *Mcnec ≥ max(0 , m0cnec - acceptableDiminution) + constraintAdjustment* + With *constraintAdjustment* the so-called "constraint-adjustment-coefficient". + It tightens the MNEC constraint, in order to take some margin for that constraint to stay respected once the + approximations are removed (i.e. taps have been rounded and real flow calculated) + +#### Relative margins optional parameter +Adding a RelativeMarginsParameters is mandatory when [objective function is relative](#type). +The following parameters tune the constraints which are implementation specific. +See also: [Modelling the maximum minimum relative margin objective function](/castor/linear-problem/max-min-relative-margin-filler.md) + +##### ptdf-approximation +- **Expected value**: one of the following: + - "FIXED_PTDF" + - "UPDATE_PTDF_WITH_TOPO" + - "UPDATE_PTDF_WITH_TOPO_AND_PST" +- **Default value**: "FIXED_PTDF" +- **Usage**: defines the frequency at which the PTDFs will be updated for the relative margins computation. + This parameter enables to set the desired trade-off between the accuracy of the relative margins computation, and the + computation time of the RAO. + - **FIXED_PTDF**: the PTDFs are computed only once at the beginning of the RAO. + - **UPDATE_PTDF_WITH_TOPO**: the PTDFs are re-computed for each new combination of topological actions (i.e. + for each new node of the search-tree). + - **UPDATE_PTDF_WITH_TOPO_AND_PST**: the PTDFs are re-computed for each new combination of topological action and for + each new combination of PST taps (i.e. for each iteration of the linear optimisation). + *Note that this option is only relevant in AC-loadflow mode, as the UPDATE_PTDF_WITH_TOPO already maximizes accuracy in DC.* + +##### ptdf-sum-lower-bound +- **Expected value**: numeric value, no unit (homogeneous to PTDFs) +- **Default value**: 0.01 +- **Usage**: PTDF absolute sums are used as a denominator in the objective function. In order to prevent the objective + function from diverging to infinity (resulting in unbounded problems), the denominator should be prevented from + getting close to zero. This parameter acts as a lower bound to the denominator. + +## Examples +> ⚠️ **NOTE** +> The following examples in json and yaml are not equivalent + +::::{tabs} +:::{group-tab} JSON +~~~json +{ + "version" : "3.0", + "extensions" : { + "open-rao-search-tree-parameters": { + "objective-function" : { + "curative-min-obj-improvement" : 0.0 + }, + "range-actions-optimization" : { + "max-mip-iterations" : 5, + "pst-sensitivity-threshold" : 0.0, + "pst-model" : "APPROXIMATED_INTEGERS", + "hvdc-sensitivity-threshold" : 0.0, + "injection-ra-sensitivity-threshold" : 0.0, + "linear-optimization-solver" : { + "solver" : "CBC", + "relative-mip-gap" : 0.001, + "solver-specific-parameters" : "THREADS 10 MAXTIME 3000" + } + }, + "topological-actions-optimization" : { + "max-preventive-search-tree-depth" : 2, + "max-auto-search-tree-depth" : 1, + "max-curative-search-tree-depth" : 2, + "predefined-combinations" : [ "na1 + na2", "na4 + na5 + na6"], + "skip-actions-far-from-most-limiting-element" : false, + "max-number-of-boundaries-for-skipping-actions" : 2 + }, + "multi-threading" : { + "available-cpus" : 4 + }, + "second-preventive-rao" : { + "execution-condition" : "POSSIBLE_CURATIVE_IMPROVEMENT", + "re-optimize-curative-range-actions" : false, + "hint-from-first-preventive-rao" : true + }, + "load-flow-and-sensitivity-computation" : { + "load-flow-provider" : "OpenLoadFlow", + "sensitivity-provider" : "OpenLoadFlow", + "sensitivity-failure-over-cost" : 0.0, + "sensitivity-parameters" : { + "version" : "1.0", + "load-flow-parameters" : { + "version" : "1.9", + "voltageInitMode" : "DC_VALUES", + "transformerVoltageControlOn" : false, + "phaseShifterRegulationOn" : true, + "noGeneratorReactiveLimits" : false, + "twtSplitShuntAdmittance" : false, + "shuntCompensatorVoltageControlOn" : false, + "readSlackBus" : true, + "writeSlackBus" : false, + "dc" : false, + "distributedSlack" : true, + "balanceType" : "PROPORTIONAL_TO_GENERATION_P", + "dcUseTransformerRatio" : true, + "countriesToBalance" : [ "TR", "BE", "SI", "CH", "AL", "ES", "SK", "BA", "RO", "PT", "DE", "AT", "FR", "CZ", "ME", "NL", "PL", "GR", "IT", "UA", "HU", "BG", "MK", "HR", "RS" ], + "connectedComponentMode" : "MAIN", + "hvdcAcEmulation" : true, + "dcPowerFactor" : 1.0, + "extensions" : { + "open-load-flow-parameters" : { + "plausibleActivePowerLimit" : 10000.0, + "minPlausibleTargetVoltage" : 0.5, + "maxPlausibleTargetVoltage" : 1.5, + "maxNewtonRaphsonIterations" : 100, + "newtonRaphsonConvEpsPerEq" : 1.0E-3, + "slackBusSelectionMode" : "MOST_MESHED", + "slackBusesIds" : [ ], + "throwsExceptionInCaseOfSlackDistributionFailure" : false, + "lowImpedanceBranchMode" : "REPLACE_BY_ZERO_IMPEDANCE_LINE", + "loadPowerFactorConstant" : false, + "addRatioToLinesWithDifferentNominalVoltageAtBothEnds" : true, + "slackBusPMaxMismatch" : 1.0, + "voltagePerReactivePowerControl" : false, + "voltageInitModeOverride" : "NONE", + "transformerVoltageControlMode" : "WITH_GENERATOR_VOLTAGE_CONTROL", + "minRealisticVoltage" : 0.5, + "maxRealisticVoltage" : 1.5, + "reactiveRangeCheckMode" : "MAX" + } + } + } + } + } + }, + "loop-flow-parameters" : { + "acceptable-increase" : 10.0, + "ptdf-approximation" : "FIXED_PTDF", + "constraint-adjustment-coefficient" : 10.0, + "violation-cost" : 10.0, + "countries" : [ "FR", "ES", "PT" ] + }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0, + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 1.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{BE}", "{FR}-{DE}", "{BE}-{NL}", "{NL}-{DE}", "{DE}-{PL}", "{DE}-{CZ}", "{DE}-{AT}", "{PL}-{CZ}", "{PL}-{SK}", "{CZ}-{SK}", "{CZ}-{AT}", "{AT}-{HU}", "{AT}-{SI}", "{SI}-{HR}", "{SK}-{HU}", "{HU}-{RO}", "{HU}-{HR}", "{BE}-{22Y201903144---9}-{DE}+{22Y201903145---4}" ], + "ptdf-approximation" : "FIXED_PTDF", + "ptdf-sum-lower-bound" : 0.01 + } + } +} +~~~ +::: +:::{group-tab} iTools +Based on PowSyBl's [configuration mechanism](inv:powsyblcore:std:doc#user/configuration/index). +~~~yaml +search-tree-range-actions-optimization: + max-mip-iterations: 5 + pst-sensitivity-threshold: 0.01 + pst-model: APPROXIMATED_INTEGERS + +search-tree-linear-optimization-solver: + solver: CBC + +search-tree-topological-actions-optimization: + max-preventive-search-tree-depth: 3 + max-auto-search-tree-depth: 2 + max-curative-search-tree-depth: 3 + predefined-combinations: [ "{na1}+{na2}", "{na3}+{na4}+{na5}" ] + relative-minimum-impact-threshold: 0.0 + absolute-minimum-impact-threshold: 2.0 + +search-tree-multi-threading: + available-cpus: 4 + +search-tree-second-preventive-rao: + execution-condition: POSSIBLE_CURATIVE_IMPROVEMENT + re-optimize-curative-range-actions: true + hint-from-first-preventive-rao: true + +search-tree-load-flow-and-sensitivity-computation: + load-flow-provider: OpenLoadFlow + sensitivity-provider: OpenLoadFlow + +load-flow-default-parameters: + voltageInitMode: DC_VALUES + balanceType: PROPORTIONAL_TO_GENERATION_P + countriesToBalance: AL,AT,BA,BE,BG,CH,CZ,DE,ES,FR,GR,HR,HU,IT,ME,MK,NL,PL,PT,RO,RS,SI,SK,UA + update parameters to version 2.0 phaseShifterRegulationOn: true + +open-loadflow-default-parameters: + minPlausibleTargetVoltage: 0.5 + maxPlausibleTargetVoltage: 1.5 + plausibleActivePowerLimit: 10000 + newtonRaphsonConvEpsPerEq : 1.0E-2 +~~~ +::: +:::: diff --git a/python-util/rao_parameter_modification.py b/python-util/rao_parameter_modification.py index 9d153d3292..9eff76e20c 100644 --- a/python-util/rao_parameter_modification.py +++ b/python-util/rao_parameter_modification.py @@ -88,27 +88,10 @@ def iterencode(self, o, **kwargs): def new_rao_param(data: dict, file_path: str) -> dict: try: - move_to_extension(data, "objective-function", ["curative-min-obj-improvement"]) - move_to_extension(data, "range-actions-optimization", - ["max-mip-iterations", "pst-sensitivity-threshold", "pst-model", - "hvdc-sensitivity-threshold", "injection-ra-sensitivity-threshold", - "ra-range-shrinking", "linear-optimization-solver"]) - move_to_extension(data, "topological-actions-optimization", - ["max-preventive-search-tree-depth", "max-auto-search-tree-depth", - "max-curative-search-tree-depth", "predefined-combinations", - "skip-actions-far-from-most-limiting-element", - "max-number-of-boundaries-for-skipping-actions"]) - move_to_extension(data, "second-preventive-rao") - move_to_extension(data, "load-flow-and-sensitivity-computation") - if "range-actions-optimization" in data: - new_names = {"pst-penalty-cost": "pst-ra-min-impact-threshold", - "hvdc-penalty-cost": "hvdc-ra-min-impact-threshold", - "injection-ra-penalty-cost": "injection-ra-min-impact-threshold"} - data["range-actions-optimization"] = {new_names[k] if k in new_names else k: v for k, v in - data["range-actions-optimization"].items()} - if "multi-threading" in data and any(data["multi-threading"]): - data["multi-threading"] = {"available-cpus": max(v for k, v in data["multi-threading"].items() if k in ("contingency-scenarios-in-parallel", "preventive-leaves-in-parallel"))} - move_to_extension(data, "multi-threading") + if "extensions" in data: + move_back_to_rao_param(data, "mnec-parameters", ["acceptable-margin-decrease"]) + move_back_to_rao_param(data, "relative-margins-parameters", ["ptdf-boundaries"]) + move_back_to_rao_param(data, "loop-flow-parameters", ["acceptable-increase", "countries"]) if "extensions" in data: extensions = data["extensions"] # put extensions at the end: @@ -119,29 +102,27 @@ def new_rao_param(data: dict, file_path: str) -> dict: return data -def move_to_extension(data: dict, name_level1: str, names_level2: list | None = None): - if name_level1 in data: - param_level_1: dict = data[name_level1] - if names_level2 is None: - st_params = get_or_create_st_params(data) - st_params[name_level1] = param_level_1 - del data[name_level1] - else: - if any(set(names_level2).intersection(param_level_1.keys())): +def move_back_to_rao_param(data: dict, name_level1: str, names_level2_for_rao: list | None = None): + if name_level1 in data["extensions"]: + param_level_1: dict = data["extensions"][name_level1] + for name_level2 in param_level_1.keys(): + if name_level2 in names_level2_for_rao: + rao_name_level1 = get_or_create_params(data, name_level1) + rao_name_level1[name_level2] = param_level_1[name_level2] + else: st_params = get_or_create_st_params(data) - if name_level1 not in st_params: - st_params[name_level1] = {} - for name_level_2 in names_level2: - if name_level_2 in param_level_1: - st_params[name_level1][name_level_2] = param_level_1[name_level_2] - del param_level_1[name_level_2] - if not any(param_level_1): - del data[name_level1] + ext_name_level1 = get_or_create_params(st_params, name_level1) + ext_name_level1[name_level2] = param_level_1[name_level2] + del data["extensions"][name_level1] + + +def get_or_create_params(data: dict, name_level1: str) -> dict: + if name_level1 not in data: + data[name_level1] = {} + return data[name_level1] def get_or_create_st_params(data: dict) -> dict: - if "extensions" not in data: - data["extensions"] = {} if "open-rao-search-tree-parameters" not in data["extensions"]: data["extensions"]["open-rao-search-tree-parameters"] = {} return data["extensions"]["open-rao-search-tree-parameters"] diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/RaoParametersCommons.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/RaoParametersCommons.java index 8a6b10e6cc..ea173439a4 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/RaoParametersCommons.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/RaoParametersCommons.java @@ -97,6 +97,7 @@ private RaoParametersCommons() { // -- LoopFlow parameters public static final String LOOP_FLOW_PARAMETERS = "loop-flow-parameters"; public static final String LOOP_FLOW_PARAMETERS_SECTION = "rao-loop-flow-parameters"; + public static final String ST_LOOP_FLOW_PARAMETERS_SECTION = "search-tree-loop-flow-parameters"; public static final String ACCEPTABLE_INCREASE = "acceptable-increase"; public static final String COUNTRIES = "countries"; @@ -104,12 +105,15 @@ private RaoParametersCommons() { // -- Mnec parameters public static final String MNEC_PARAMETERS = "mnec-parameters"; public static final String MNEC_PARAMETERS_SECTION = "rao-mnec-parameters"; + public static final String ST_MNEC_PARAMETERS_SECTION = "search-tree-mnec-parameters"; public static final String ACCEPTABLE_MARGIN_DECREASE = "acceptable-margin-decrease"; // -- Relative margins parameters public static final String RELATIVE_MARGINS = "relative-margins-parameters"; public static final String RELATIVE_MARGINS_SECTION = "rao-relative-margins-parameters"; + public static final String ST_RELATIVE_MARGINS_SECTION = "search-tree-relative-margins-parameters"; + public static final String PTDF_BOUNDARIES = "ptdf-boundaries"; public static final String PTDF_SUM_LOWER_BOUND = "ptdf-sum-lower-bound"; public static final String SEARCH_TREE_PARAMETERS = "open-rao-search-tree-parameters"; diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonLoopFlowParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonLoopFlowParameters.java new file mode 100644 index 0000000000..ee83eac7d2 --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonLoopFlowParameters.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openrao.raoapi.json; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.powsybl.openrao.commons.OpenRaoException; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.RaoParameters; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; + +/** + * @author Godelaine de Montmorillon {@literal } + */ +public final class JsonLoopFlowParameters { + + private JsonLoopFlowParameters() { + } + + static void serialize(RaoParameters parameters, JsonGenerator jsonGenerator) throws IOException { + Optional optionalLoopFlowParameters = parameters.getLoopFlowParameters(); + if (optionalLoopFlowParameters.isPresent()) { + jsonGenerator.writeObjectFieldStart(LOOP_FLOW_PARAMETERS); + jsonGenerator.writeNumberField(ACCEPTABLE_INCREASE, optionalLoopFlowParameters.get().getAcceptableIncrease()); + jsonGenerator.writeFieldName(COUNTRIES); + jsonGenerator.writeStartArray(); + optionalLoopFlowParameters.get().getCountries().stream().map(Enum::toString).sorted().forEach(s -> { + try { + jsonGenerator.writeString(s); + } catch (IOException e) { + throw new OpenRaoException("error while serializing loopflow countries", e); + } + }); + jsonGenerator.writeEndArray(); + jsonGenerator.writeEndObject(); + } + } + + static void deserialize(JsonParser jsonParser, RaoParameters raoParameters) throws IOException { + LoopFlowParameters loopFlowParameters = new LoopFlowParameters(); + while (!jsonParser.nextToken().isStructEnd()) { + switch (jsonParser.getCurrentName()) { + case ACCEPTABLE_INCREASE: + jsonParser.nextToken(); + loopFlowParameters.setAcceptableIncrease(jsonParser.getDoubleValue()); + break; + case COUNTRIES: + jsonParser.nextToken(); + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode arrayNode = objectMapper.readTree(jsonParser); + List countryStrings = objectMapper.readValue(arrayNode.traverse(), new TypeReference>() { }); + loopFlowParameters.setCountries(countryStrings); + break; + default: + throw new OpenRaoException(String.format("Cannot deserialize loop flow parameters: unexpected field in %s (%s)", LOOP_FLOW_PARAMETERS, jsonParser.getCurrentName())); + } + } + raoParameters.setLoopFlowParameters(loopFlowParameters); + } +} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonMnecParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonMnecParameters.java new file mode 100644 index 0000000000..32d1e1322d --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonMnecParameters.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openrao.raoapi.json; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.powsybl.openrao.commons.OpenRaoException; +import com.powsybl.openrao.raoapi.parameters.MnecParameters; +import com.powsybl.openrao.raoapi.parameters.RaoParameters; + +import java.io.IOException; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; + +/** + * @author Godelaine de Montmorillon {@literal } + */ +public final class JsonMnecParameters { + + private JsonMnecParameters() { + } + + static void serialize(RaoParameters parameters, JsonGenerator jsonGenerator) throws IOException { + Optional optionalMnecParameters = parameters.getMnecParameters(); + if (optionalMnecParameters.isPresent()) { + jsonGenerator.writeObjectFieldStart(MNEC_PARAMETERS); + jsonGenerator.writeNumberField(ACCEPTABLE_MARGIN_DECREASE, optionalMnecParameters.get().getAcceptableMarginDecrease()); + jsonGenerator.writeEndObject(); + } + } + + static void deserialize(JsonParser jsonParser, RaoParameters raoParameters) throws IOException { + MnecParameters mnecParameters = new MnecParameters(); + while (!jsonParser.nextToken().isStructEnd()) { + if (jsonParser.getCurrentName().equals(ACCEPTABLE_MARGIN_DECREASE)) { + jsonParser.nextToken(); + mnecParameters.setAcceptableMarginDecrease(jsonParser.getDoubleValue()); + } else { + throw new OpenRaoException(String.format("Cannot deserialize mnec parameters: unexpected field in %s (%s)", MNEC_PARAMETERS, jsonParser.getCurrentName())); + } + } + raoParameters.setMnecParameters(mnecParameters); + } + +} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonRelativeMarginsParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonRelativeMarginsParameters.java new file mode 100644 index 0000000000..cc5307af93 --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/JsonRelativeMarginsParameters.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openrao.raoapi.json; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.powsybl.openrao.commons.OpenRaoException; +import com.powsybl.openrao.raoapi.parameters.RaoParameters; +import com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; + +/** + * @author Godelaine de Montmorillon {@literal } + */ +public final class JsonRelativeMarginsParameters { + + private JsonRelativeMarginsParameters() { + } + + static void serialize(RaoParameters parameters, JsonGenerator jsonGenerator) throws IOException { + Optional optionalRelativeMarginsParameters = parameters.getRelativeMarginsParameters(); + if (optionalRelativeMarginsParameters.isPresent()) { + jsonGenerator.writeObjectFieldStart(RELATIVE_MARGINS); + jsonGenerator.writeArrayFieldStart(PTDF_BOUNDARIES); + for (String ptdfBoundary : optionalRelativeMarginsParameters.get().getPtdfBoundariesAsString()) { + jsonGenerator.writeString(ptdfBoundary); + } + jsonGenerator.writeEndArray(); + jsonGenerator.writeEndObject(); + } + } + + static void deserialize(JsonParser jsonParser, RaoParameters raoParameters) throws IOException { + RelativeMarginsParameters relativeMarginsParameters = new RelativeMarginsParameters(); + while (!jsonParser.nextToken().isStructEnd()) { + if (jsonParser.getCurrentName().equals(PTDF_BOUNDARIES)) { + if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) { + List boundaries = new ArrayList<>(); + while (jsonParser.nextToken() != JsonToken.END_ARRAY) { + boundaries.add(jsonParser.getValueAsString()); + } + relativeMarginsParameters.setPtdfBoundariesFromString(boundaries); + } + } else { + throw new OpenRaoException(String.format("Cannot deserialize relative margins parameters: unexpected field in %s (%s)", RELATIVE_MARGINS, jsonParser.getCurrentName())); + } + } + raoParameters.setRelativeMarginsParameters(relativeMarginsParameters); + } + +} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/RaoParametersDeserializer.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/RaoParametersDeserializer.java index 3d88a19ff7..b942bd20cb 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/RaoParametersDeserializer.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/RaoParametersDeserializer.java @@ -20,6 +20,7 @@ import java.util.List; import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; +import static com.powsybl.openrao.raoapi.parameters.RaoParameters.addOptionalExtensionsDefaultValuesIfExist; /** * @author Baptiste Seguinot {@literal } @@ -63,6 +64,18 @@ public RaoParameters deserialize(JsonParser parser, DeserializationContext deser parser.nextToken(); JsonNotOptimizedCnecsParameters.deserialize(parser, parameters); break; + case MNEC_PARAMETERS: + parser.nextToken(); + JsonMnecParameters.deserialize(parser, parameters); + break; + case RELATIVE_MARGINS: + parser.nextToken(); + JsonRelativeMarginsParameters.deserialize(parser, parameters); + break; + case LOOP_FLOW_PARAMETERS: + parser.nextToken(); + JsonLoopFlowParameters.deserialize(parser, parameters); + break; case "extensions": parser.nextToken(); extensions = JsonUtil.updateExtensions(parser, deserializationContext, JsonRaoParameters.getExtensionSerializers(), parameters); @@ -72,6 +85,7 @@ public RaoParameters deserialize(JsonParser parser, DeserializationContext deser } } extensions.forEach(extension -> parameters.addExtension((Class) extension.getClass(), extension)); + addOptionalExtensionsDefaultValuesIfExist(parameters); return parameters; } } diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/RaoParametersSerializer.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/RaoParametersSerializer.java index d475bd65fc..bba41e3c47 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/RaoParametersSerializer.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/RaoParametersSerializer.java @@ -33,6 +33,9 @@ public void serialize(RaoParameters parameters, JsonGenerator jsonGenerator, Ser JsonRangeActionsOptimizationParameters.serialize(parameters, jsonGenerator); JsonTopoOptimizationParameters.serialize(parameters, jsonGenerator); JsonNotOptimizedCnecsParameters.serialize(parameters, jsonGenerator); + JsonMnecParameters.serialize(parameters, jsonGenerator); + JsonRelativeMarginsParameters.serialize(parameters, jsonGenerator); + JsonLoopFlowParameters.serialize(parameters, jsonGenerator); JsonUtil.writeExtensions(parameters, jsonGenerator, serializerProvider, JsonRaoParameters.getExtensionSerializers()); jsonGenerator.writeEndObject(); } diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonLoopFlowParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonLoopFlowParameters.java new file mode 100644 index 0000000000..b43b2474b4 --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonLoopFlowParameters.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openrao.raoapi.json.extensions; + +import com.powsybl.openrao.commons.OpenRaoException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoLoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; + +import java.io.IOException; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; + +/** + * @author Godelaine de Montmorillon {@literal } + */ +public final class JsonLoopFlowParameters { + + private JsonLoopFlowParameters() { + } + + static void serialize(OpenRaoSearchTreeParameters parameters, JsonGenerator jsonGenerator) throws IOException { + Optional optionalLoopFlowParameters = parameters.getLoopFlowParameters(); + if (optionalLoopFlowParameters.isPresent()) { + jsonGenerator.writeObjectFieldStart(LOOP_FLOW_PARAMETERS); + jsonGenerator.writeObjectField(PTDF_APPROXIMATION, optionalLoopFlowParameters.get().getPtdfApproximation()); + jsonGenerator.writeNumberField(CONSTRAINT_ADJUSTMENT_COEFFICIENT, optionalLoopFlowParameters.get().getConstraintAdjustmentCoefficient()); + jsonGenerator.writeNumberField(VIOLATION_COST, optionalLoopFlowParameters.get().getViolationCost()); + jsonGenerator.writeEndObject(); + } + } + + static void deserialize(JsonParser jsonParser, OpenRaoSearchTreeParameters searchTreeParameters) throws IOException { + SearchTreeRaoLoopFlowParameters loopFlowParameters = new SearchTreeRaoLoopFlowParameters(); + while (!jsonParser.nextToken().isStructEnd()) { + switch (jsonParser.getCurrentName()) { + case PTDF_APPROXIMATION: + loopFlowParameters.setPtdfApproximation(stringToPtdfApproximation(jsonParser.nextTextValue())); + break; + case CONSTRAINT_ADJUSTMENT_COEFFICIENT: + jsonParser.nextToken(); + loopFlowParameters.setConstraintAdjustmentCoefficient(jsonParser.getDoubleValue()); + break; + case VIOLATION_COST: + jsonParser.nextToken(); + loopFlowParameters.setViolationCost(jsonParser.getDoubleValue()); + break; + default: + throw new OpenRaoException(String.format("Cannot deserialize loop flow parameters: unexpected field in %s (%s)", LOOP_FLOW_PARAMETERS, jsonParser.getCurrentName())); + } + } + searchTreeParameters.setLoopFlowParameters(loopFlowParameters); + } +} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonLoopFlowParametersExtension.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonLoopFlowParametersExtension.java deleted file mode 100644 index 4c1f843409..0000000000 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonLoopFlowParametersExtension.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.openrao.raoapi.json.extensions; - -import com.powsybl.openrao.commons.OpenRaoException; -import com.powsybl.openrao.raoapi.json.JsonRaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.google.auto.service.AutoService; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; - -/** - * @author Godelaine de Montmorillon {@literal } - */ -@AutoService(JsonRaoParameters.ExtensionSerializer.class) -public class JsonLoopFlowParametersExtension implements JsonRaoParameters.ExtensionSerializer { - - @Override - public void serialize(LoopFlowParametersExtension loopFlowParameters, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { - jsonGenerator.writeStartObject(); - jsonGenerator.writeNumberField(ACCEPTABLE_INCREASE, loopFlowParameters.getAcceptableIncrease()); - jsonGenerator.writeObjectField(PTDF_APPROXIMATION, loopFlowParameters.getPtdfApproximation()); - jsonGenerator.writeNumberField(CONSTRAINT_ADJUSTMENT_COEFFICIENT, loopFlowParameters.getConstraintAdjustmentCoefficient()); - jsonGenerator.writeNumberField(VIOLATION_COST, loopFlowParameters.getViolationCost()); - jsonGenerator.writeFieldName(COUNTRIES); - jsonGenerator.writeStartArray(); - loopFlowParameters.getCountries().stream().map(Enum::toString).sorted().forEach(s -> { - try { - jsonGenerator.writeString(s); - } catch (IOException e) { - throw new OpenRaoException("error while serializing loopflow countries", e); - } - }); - jsonGenerator.writeEndArray(); - jsonGenerator.writeEndObject(); - } - - @Override - public LoopFlowParametersExtension deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { - return deserializeAndUpdate(jsonParser, deserializationContext, new LoopFlowParametersExtension()); - } - - @Override - public LoopFlowParametersExtension deserializeAndUpdate(JsonParser jsonParser, DeserializationContext deserializationContext, LoopFlowParametersExtension parameters) throws IOException { - while (!jsonParser.nextToken().isStructEnd()) { - switch (jsonParser.getCurrentName()) { - case ACCEPTABLE_INCREASE: - jsonParser.nextToken(); - parameters.setAcceptableIncrease(jsonParser.getDoubleValue()); - break; - case PTDF_APPROXIMATION: - parameters.setPtdfApproximation(stringToPtdfApproximation(jsonParser.nextTextValue())); - break; - case CONSTRAINT_ADJUSTMENT_COEFFICIENT: - jsonParser.nextToken(); - parameters.setConstraintAdjustmentCoefficient(jsonParser.getDoubleValue()); - break; - case VIOLATION_COST: - jsonParser.nextToken(); - parameters.setViolationCost(jsonParser.getDoubleValue()); - break; - case COUNTRIES: - jsonParser.nextToken(); - ObjectMapper objectMapper = new ObjectMapper(); - JsonNode arrayNode = objectMapper.readTree(jsonParser); - List countryStrings = objectMapper.readValue(arrayNode.traverse(), new TypeReference>() { }); - parameters.setCountries(countryStrings); - break; - default: - throw new OpenRaoException(String.format("Cannot deserialize loop flow parameters: unexpected field in %s (%s)", LOOP_FLOW_PARAMETERS, jsonParser.getCurrentName())); - } - } - return parameters; - } - - @Override - public String getExtensionName() { - return LOOP_FLOW_PARAMETERS; - } - - @Override - public String getCategoryName() { - return "rao-parameters"; - } - - @Override - public Class getExtensionClass() { - return LoopFlowParametersExtension.class; - } -} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonMnecParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonMnecParameters.java new file mode 100644 index 0000000000..d17f1ca27b --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonMnecParameters.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openrao.raoapi.json.extensions; + +import com.powsybl.openrao.commons.OpenRaoException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoMnecParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; + +import java.io.IOException; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; + +/** + * @author Godelaine de Montmorillon {@literal } + */ +public final class JsonMnecParameters { + + private JsonMnecParameters() { + } + + static void serialize(OpenRaoSearchTreeParameters parameters, JsonGenerator jsonGenerator) throws IOException { + Optional optionalMnecParameters = parameters.getMnecParameters(); + if (optionalMnecParameters.isPresent()) { + jsonGenerator.writeObjectFieldStart(MNEC_PARAMETERS); + jsonGenerator.writeNumberField(VIOLATION_COST, optionalMnecParameters.get().getViolationCost()); + jsonGenerator.writeNumberField(CONSTRAINT_ADJUSTMENT_COEFFICIENT, optionalMnecParameters.get().getConstraintAdjustmentCoefficient()); + jsonGenerator.writeEndObject(); + } + } + + static void deserialize(JsonParser jsonParser, OpenRaoSearchTreeParameters searchTreeParameters) throws IOException { + SearchTreeRaoMnecParameters mnecParameters = new SearchTreeRaoMnecParameters(); + while (!jsonParser.nextToken().isStructEnd()) { + switch (jsonParser.getCurrentName()) { + case VIOLATION_COST: + jsonParser.nextToken(); + mnecParameters.setViolationCost(jsonParser.getDoubleValue()); + break; + case CONSTRAINT_ADJUSTMENT_COEFFICIENT: + jsonParser.nextToken(); + mnecParameters.setConstraintAdjustmentCoefficient(jsonParser.getDoubleValue()); + break; + default: + throw new OpenRaoException(String.format("Cannot deserialize mnec parameters: unexpected field in %s (%s)", MNEC_PARAMETERS, jsonParser.getCurrentName())); + } + } + searchTreeParameters.setMnecParameters(mnecParameters); + } + +} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonMnecParametersExtension.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonMnecParametersExtension.java deleted file mode 100644 index 3ba75570fa..0000000000 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonMnecParametersExtension.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.openrao.raoapi.json.extensions; - -import com.powsybl.openrao.commons.OpenRaoException; -import com.powsybl.openrao.raoapi.json.JsonRaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.google.auto.service.AutoService; - -import java.io.IOException; - -import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; - -/** - * @author Godelaine de Montmorillon {@literal } - */ -@AutoService(JsonRaoParameters.ExtensionSerializer.class) -public class JsonMnecParametersExtension implements JsonRaoParameters.ExtensionSerializer { - - @Override - public void serialize(MnecParametersExtension mnecParameters, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { - jsonGenerator.writeStartObject(); - jsonGenerator.writeNumberField(ACCEPTABLE_MARGIN_DECREASE, mnecParameters.getAcceptableMarginDecrease()); - jsonGenerator.writeNumberField(VIOLATION_COST, mnecParameters.getViolationCost()); - jsonGenerator.writeNumberField(CONSTRAINT_ADJUSTMENT_COEFFICIENT, mnecParameters.getConstraintAdjustmentCoefficient()); - jsonGenerator.writeEndObject(); - } - - @Override - public MnecParametersExtension deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { - return deserializeAndUpdate(jsonParser, deserializationContext, new MnecParametersExtension()); - } - - @Override - public MnecParametersExtension deserializeAndUpdate(JsonParser jsonParser, DeserializationContext deserializationContext, MnecParametersExtension parameters) throws IOException { - while (!jsonParser.nextToken().isStructEnd()) { - switch (jsonParser.getCurrentName()) { - case ACCEPTABLE_MARGIN_DECREASE: - jsonParser.nextToken(); - parameters.setAcceptableMarginDecrease(jsonParser.getDoubleValue()); - break; - case VIOLATION_COST: - jsonParser.nextToken(); - parameters.setViolationCost(jsonParser.getDoubleValue()); - break; - case CONSTRAINT_ADJUSTMENT_COEFFICIENT: - jsonParser.nextToken(); - parameters.setConstraintAdjustmentCoefficient(jsonParser.getDoubleValue()); - break; - default: - throw new OpenRaoException(String.format("Cannot deserialize mnec parameters: unexpected field in %s (%s)", MNEC_PARAMETERS, jsonParser.getCurrentName())); - } - } - return parameters; - } - - @Override - public String getExtensionName() { - return MNEC_PARAMETERS; - } - - @Override - public String getCategoryName() { - return "rao-parameters"; - } - - @Override - public Class getExtensionClass() { - return MnecParametersExtension.class; - } - -} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonOpenRaoSearchTreeParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonOpenRaoSearchTreeParameters.java index e25c573f83..dfc7416b34 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonOpenRaoSearchTreeParameters.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonOpenRaoSearchTreeParameters.java @@ -36,6 +36,9 @@ public void serialize(OpenRaoSearchTreeParameters parameters, JsonGenerator json JsonSecondPreventiveRaoParameters.serialize(parameters, jsonGenerator); JsonLoadFlowAndSensitivityComputationParameters.serialize(parameters, jsonGenerator, serializerProvider); JsonMultiThreadingParameters.serialize(parameters, jsonGenerator); + JsonMnecParameters.serialize(parameters, jsonGenerator); + JsonRelativeMarginsParameters.serialize(parameters, jsonGenerator); + JsonLoopFlowParameters.serialize(parameters, jsonGenerator); jsonGenerator.writeEndObject(); } @@ -72,6 +75,18 @@ public OpenRaoSearchTreeParameters deserializeAndUpdate(JsonParser parser, Deser parser.nextToken(); JsonLoadFlowAndSensitivityComputationParameters.deserialize(parser, parameters); break; + case MNEC_PARAMETERS: + parser.nextToken(); + JsonMnecParameters.deserialize(parser, parameters); + break; + case RELATIVE_MARGINS: + parser.nextToken(); + JsonRelativeMarginsParameters.deserialize(parser, parameters); + break; + case LOOP_FLOW_PARAMETERS: + parser.nextToken(); + JsonLoopFlowParameters.deserialize(parser, parameters); + break; default: throw new OpenRaoException("Unexpected field in open rao search tree parameters: " + parser.getCurrentName()); } diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonRelativeMarginsParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonRelativeMarginsParameters.java new file mode 100644 index 0000000000..193ecf87b8 --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonRelativeMarginsParameters.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openrao.raoapi.json.extensions; + +import com.powsybl.openrao.commons.OpenRaoException; +import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; + +import java.io.IOException; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; + +/** + * @author Godelaine de Montmorillon {@literal } + */ +public final class JsonRelativeMarginsParameters { + + private JsonRelativeMarginsParameters() { + } + + static void serialize(OpenRaoSearchTreeParameters parameters, JsonGenerator jsonGenerator) throws IOException { + Optional optionalRelativeMarginsParameters = parameters.getRelativeMarginsParameters(); + if (optionalRelativeMarginsParameters.isPresent()) { + jsonGenerator.writeObjectFieldStart(RELATIVE_MARGINS); + jsonGenerator.writeObjectField(PTDF_APPROXIMATION, optionalRelativeMarginsParameters.get().getPtdfApproximation()); + jsonGenerator.writeNumberField(PTDF_SUM_LOWER_BOUND, optionalRelativeMarginsParameters.get().getPtdfSumLowerBound()); + jsonGenerator.writeEndObject(); + } + } + + static void deserialize(JsonParser jsonParser, OpenRaoSearchTreeParameters searchTreeParameters) throws IOException { + SearchTreeRaoRelativeMarginsParameters relativeMarginsParameters = new SearchTreeRaoRelativeMarginsParameters(); + while (!jsonParser.nextToken().isStructEnd()) { + switch (jsonParser.getCurrentName()) { + case PTDF_APPROXIMATION: + relativeMarginsParameters.setPtdfApproximation(stringToPtdfApproximation(jsonParser.nextTextValue())); + break; + case PTDF_SUM_LOWER_BOUND: + jsonParser.nextToken(); + relativeMarginsParameters.setPtdfSumLowerBound(jsonParser.getDoubleValue()); + break; + default: + throw new OpenRaoException(String.format("Cannot deserialize relative margins parameters: unexpected field in %s (%s)", RELATIVE_MARGINS, jsonParser.getCurrentName())); + } + searchTreeParameters.setRelativeMarginsParameters(relativeMarginsParameters); + } + } +} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonRelativeMarginsParametersExtension.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonRelativeMarginsParametersExtension.java deleted file mode 100644 index 07a3fa7453..0000000000 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/json/extensions/JsonRelativeMarginsParametersExtension.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.openrao.raoapi.json.extensions; - -import com.powsybl.openrao.commons.OpenRaoException; -import com.powsybl.openrao.raoapi.json.JsonRaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.google.auto.service.AutoService; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; - -/** - * @author Godelaine de Montmorillon {@literal } - */ -@AutoService(JsonRaoParameters.ExtensionSerializer.class) -public class JsonRelativeMarginsParametersExtension implements JsonRaoParameters.ExtensionSerializer { - - @Override - public void serialize(RelativeMarginsParametersExtension relativeMarginParameters, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { - jsonGenerator.writeStartObject(); - jsonGenerator.writeArrayFieldStart(PTDF_BOUNDARIES); - for (String ptdfBoundary : relativeMarginParameters.getPtdfBoundariesAsString()) { - jsonGenerator.writeString(ptdfBoundary); - } - jsonGenerator.writeEndArray(); - jsonGenerator.writeObjectField(PTDF_APPROXIMATION, relativeMarginParameters.getPtdfApproximation()); - jsonGenerator.writeNumberField(PTDF_SUM_LOWER_BOUND, relativeMarginParameters.getPtdfSumLowerBound()); - jsonGenerator.writeEndObject(); - } - - @Override - public RelativeMarginsParametersExtension deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { - return deserializeAndUpdate(jsonParser, deserializationContext, new RelativeMarginsParametersExtension()); - } - - @Override - public RelativeMarginsParametersExtension deserializeAndUpdate(JsonParser jsonParser, DeserializationContext deserializationContext, RelativeMarginsParametersExtension parameters) throws IOException { - while (!jsonParser.nextToken().isStructEnd()) { - switch (jsonParser.getCurrentName()) { - case PTDF_BOUNDARIES: - readPtdfBoundaries(jsonParser, parameters); - break; - case PTDF_APPROXIMATION: - parameters.setPtdfApproximation(stringToPtdfApproximation(jsonParser.nextTextValue())); - break; - case PTDF_SUM_LOWER_BOUND: - jsonParser.nextToken(); - parameters.setPtdfSumLowerBound(jsonParser.getDoubleValue()); - break; - default: - throw new OpenRaoException(String.format("Cannot deserialize relative margins parameters: unexpected field in %s (%s)", RELATIVE_MARGINS, jsonParser.getCurrentName())); - } - } - return parameters; - } - - @Override - public String getExtensionName() { - return RELATIVE_MARGINS; - } - - @Override - public String getCategoryName() { - return "rao-parameters"; - } - - @Override - public Class getExtensionClass() { - return RelativeMarginsParametersExtension.class; - } - - private void readPtdfBoundaries(JsonParser parser, RelativeMarginsParametersExtension parameters) throws IOException { - if (parser.getCurrentToken() == JsonToken.START_ARRAY) { - List boundaries = new ArrayList<>(); - while (parser.nextToken() != JsonToken.END_ARRAY) { - boundaries.add(parser.getValueAsString()); - } - parameters.setPtdfBoundariesFromString(boundaries); - } - } - -} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/LoopFlowParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/LoopFlowParameters.java new file mode 100644 index 0000000000..e4deba8582 --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/LoopFlowParameters.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package com.powsybl.openrao.raoapi.parameters; + +import com.powsybl.commons.config.PlatformConfig; +import com.powsybl.iidm.network.Country; + +import java.util.*; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; +import static com.powsybl.openrao.raoapi.RaoParametersCommons.COUNTRIES; + +/** + * Extension : loopFlow parameters for RAO + * + * @author Godelaine de Montmorillon {@literal } + */ +public class LoopFlowParameters { + static final double DEFAULT_ACCEPTABLE_INCREASE = 0.0; + static final Set DEFAULT_COUNTRIES = new HashSet<>(); //Empty by default + private double acceptableIncrease = DEFAULT_ACCEPTABLE_INCREASE; + private Set countries = DEFAULT_COUNTRIES; + + // Getters and setters + public double getAcceptableIncrease() { + return acceptableIncrease; + } + + public void setAcceptableIncrease(double acceptableIncrease) { + this.acceptableIncrease = acceptableIncrease; + } + + public Set getCountries() { + return countries; + } + + public void setCountries(Set countries) { + this.countries = countries; + } + + public void setCountries(List countryStrings) { + this.countries = ParametersUtil.convertToCountrySet(countryStrings); + } + + public static Optional load(PlatformConfig platformConfig) { + Objects.requireNonNull(platformConfig); + return platformConfig.getOptionalModuleConfig(LOOP_FLOW_PARAMETERS_SECTION) + .map(config -> { + LoopFlowParameters parameters = new LoopFlowParameters(); + parameters.setAcceptableIncrease(config.getDoubleProperty(ACCEPTABLE_INCREASE, LoopFlowParameters.DEFAULT_ACCEPTABLE_INCREASE)); + parameters.setCountries(ParametersUtil.convertToCountrySet(config.getStringListProperty(COUNTRIES, new ArrayList<>()))); + return parameters; + }); + } +} + diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/MnecParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/MnecParameters.java new file mode 100644 index 0000000000..645ffd7fca --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/MnecParameters.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package com.powsybl.openrao.raoapi.parameters; + +import com.powsybl.commons.config.PlatformConfig; + +import java.util.Objects; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; + +/** + * Extension : MNEC parameters for RAO + * + * @author Godelaine de Montmorillon {@literal } + */ +public class MnecParameters { + static final double DEFAULT_ACCEPTABLE_MARGIN_DECREASE = 50.0; + private double acceptableMarginDecrease = DEFAULT_ACCEPTABLE_MARGIN_DECREASE; + // "A equivalent cost per A violation" or "MW per MW", depending on the objective function + + public double getAcceptableMarginDecrease() { + return acceptableMarginDecrease; + } + + public void setAcceptableMarginDecrease(double acceptableMarginDecrease) { + this.acceptableMarginDecrease = acceptableMarginDecrease; + } + + public static Optional load(PlatformConfig platformConfig) { + Objects.requireNonNull(platformConfig); + return platformConfig.getOptionalModuleConfig(MNEC_PARAMETERS_SECTION) + .map(config -> { + MnecParameters parameters = new MnecParameters(); + parameters.setAcceptableMarginDecrease(config.getDoubleProperty(ACCEPTABLE_MARGIN_DECREASE, MnecParameters.DEFAULT_ACCEPTABLE_MARGIN_DECREASE)); + return parameters; + }); + } +} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/RaoParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/RaoParameters.java index fc7b7cb2af..2550b4ebb6 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/RaoParameters.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/RaoParameters.java @@ -14,11 +14,15 @@ 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 java.util.Objects; +import java.util.Optional; /** - * * @author Godelaine de Montmorillon {@literal } */ public class RaoParameters extends AbstractExtendable { @@ -26,6 +30,9 @@ public class RaoParameters extends AbstractExtendable { private RangeActionsOptimizationParameters rangeActionsOptimizationParameters = new RangeActionsOptimizationParameters(); private TopoOptimizationParameters topoOptimizationParameters = new TopoOptimizationParameters(); private NotOptimizedCnecsParameters notOptimizedCnecsParameters = new NotOptimizedCnecsParameters(); + private Optional mnecParameters = Optional.empty(); + private Optional relativeMarginsParameters = Optional.empty(); + private Optional loopFlowParameters = Optional.empty(); // Getters and setters public void setObjectiveFunctionParameters(ObjectiveFunctionParameters objectiveFunctionParameters) { @@ -44,6 +51,18 @@ public void setNotOptimizedCnecsParameters(NotOptimizedCnecsParameters notOptimi this.notOptimizedCnecsParameters = notOptimizedCnecsParameters; } + public void setMnecParameters(MnecParameters mnecParameters) { + this.mnecParameters = Optional.of(mnecParameters); + } + + public void setRelativeMarginsParameters(RelativeMarginsParameters relativeMarginsParameters) { + this.relativeMarginsParameters = Optional.of(relativeMarginsParameters); + } + + public void setLoopFlowParameters(LoopFlowParameters loopFlowParameters) { + this.loopFlowParameters = Optional.of(loopFlowParameters); + } + public ObjectiveFunctionParameters getObjectiveFunctionParameters() { return objectiveFunctionParameters; } @@ -60,20 +79,34 @@ public NotOptimizedCnecsParameters getNotOptimizedCnecsParameters() { return notOptimizedCnecsParameters; } + public Optional getMnecParameters() { + return mnecParameters; + } + + public Optional getRelativeMarginsParameters() { + return relativeMarginsParameters; + } + + public Optional getLoopFlowParameters() { + return loopFlowParameters; + } + public boolean hasExtension(Class classType) { return Objects.nonNull(this.getExtension(classType)); } // ConfigLoader + /** * A configuration loader interface for the RaoParameters extensions loaded from the platform configuration + * * @param The extension class */ public interface ConfigLoader> extends ExtensionConfigLoader { } private static final Supplier> PARAMETERS_EXTENSIONS_SUPPLIER = - Suppliers.memoize(() -> ExtensionProviders.createProvider(RaoParameters.ConfigLoader.class, "rao-parameters")); + Suppliers.memoize(() -> ExtensionProviders.createProvider(RaoParameters.ConfigLoader.class, "rao-parameters")); /** * @return RaoParameters from platform default config. @@ -91,6 +124,7 @@ public static RaoParameters load(PlatformConfig platformConfig) { RaoParameters parameters = new RaoParameters(); load(parameters, platformConfig); parameters.loadExtensions(platformConfig); + addOptionalExtensionsDefaultValuesIfExist(parameters); return parameters; } @@ -101,6 +135,9 @@ public static void load(RaoParameters parameters, PlatformConfig platformConfig) parameters.setRangeActionsOptimizationParameters(RangeActionsOptimizationParameters.load(platformConfig)); parameters.setTopoOptimizationParameters(TopoOptimizationParameters.load(platformConfig)); parameters.setNotOptimizedCnecsParameters(NotOptimizedCnecsParameters.load(platformConfig)); + MnecParameters.load(platformConfig).ifPresent(parameters::setMnecParameters); + RelativeMarginsParameters.load(platformConfig).ifPresent(parameters::setRelativeMarginsParameters); + LoopFlowParameters.load(platformConfig).ifPresent(parameters::setLoopFlowParameters); } private void loadExtensions(PlatformConfig platformConfig) { @@ -111,4 +148,47 @@ private void loadExtensions(PlatformConfig platformConfig) { } } } + + public static void addOptionalExtensionsDefaultValuesIfExist(RaoParameters parameters) { + OpenRaoSearchTreeParameters extension = parameters.getExtension(OpenRaoSearchTreeParameters.class); + if (parameters.getMnecParameters().isPresent()) { + if (Objects.isNull(extension)) { + parameters.addExtension(OpenRaoSearchTreeParameters.class, new OpenRaoSearchTreeParameters()); + } + extension = parameters.getExtension(OpenRaoSearchTreeParameters.class); + if (extension.getMnecParameters().isEmpty()) { + extension.setMnecParameters(new SearchTreeRaoMnecParameters()); + } + } else { + if (!Objects.isNull(extension) && extension.getMnecParameters().isPresent()) { + parameters.setMnecParameters(new com.powsybl.openrao.raoapi.parameters.MnecParameters()); + } + } + if (parameters.getRelativeMarginsParameters().isPresent()) { + if (Objects.isNull(extension)) { + parameters.addExtension(OpenRaoSearchTreeParameters.class, new OpenRaoSearchTreeParameters()); + } + extension = parameters.getExtension(OpenRaoSearchTreeParameters.class); + if (extension.getRelativeMarginsParameters().isEmpty()) { + extension.setRelativeMarginsParameters(new SearchTreeRaoRelativeMarginsParameters()); + } + } else { + if (!Objects.isNull(extension) && extension.getRelativeMarginsParameters().isPresent()) { + parameters.setRelativeMarginsParameters(new com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters()); + } + } + if (parameters.getLoopFlowParameters().isPresent()) { + if (Objects.isNull(extension)) { + parameters.addExtension(OpenRaoSearchTreeParameters.class, new OpenRaoSearchTreeParameters()); + } + extension = parameters.getExtension(OpenRaoSearchTreeParameters.class); + if (extension.getLoopFlowParameters().isEmpty()) { + extension.setLoopFlowParameters(new SearchTreeRaoLoopFlowParameters()); + } + } else { + if (!Objects.isNull(extension) && extension.getLoopFlowParameters().isPresent()) { + parameters.setLoopFlowParameters(new com.powsybl.openrao.raoapi.parameters.LoopFlowParameters()); + } + } + } } diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/RelativeMarginsParametersExtension.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/RelativeMarginsParameters.java similarity index 55% rename from ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/RelativeMarginsParametersExtension.java rename to ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/RelativeMarginsParameters.java index e67d07d490..eba9ad68c6 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/RelativeMarginsParametersExtension.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/RelativeMarginsParameters.java @@ -5,29 +5,28 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package com.powsybl.openrao.raoapi.parameters.extensions; +package com.powsybl.openrao.raoapi.parameters; +import com.powsybl.commons.config.PlatformConfig; import com.powsybl.openrao.raoapi.ZoneToZonePtdfDefinition; -import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.commons.extensions.AbstractExtension; import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.Optional; + import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; + /** * Extension : relative margin parameters for RAO * * @author Godelaine de Montmorillon {@literal } */ -public class RelativeMarginsParametersExtension extends AbstractExtension { +public class RelativeMarginsParameters { - static final double DEFAULT_PTDF_SUM_LOWER_BOUND = 0.01; - static final PtdfApproximation DEFAULT_PTDF_APPROXIMATION = PtdfApproximation.FIXED_PTDF; static final List DEFAULT_RELATIVE_MARGIN_PTDF_BOUNDARIES = new ArrayList<>(); private List ptdfBoundaries = DEFAULT_RELATIVE_MARGIN_PTDF_BOUNDARIES; // prevents relative margins from diverging to +infinity - private double ptdfSumLowerBound = DEFAULT_PTDF_SUM_LOWER_BOUND; - private PtdfApproximation ptdfApproximation = DEFAULT_PTDF_APPROXIMATION; public List getPtdfBoundaries() { return ptdfBoundaries; @@ -45,25 +44,14 @@ public void setPtdfBoundariesFromString(List boundaries) { .toList(); } - public double getPtdfSumLowerBound() { - return ptdfSumLowerBound; - } - - public PtdfApproximation getPtdfApproximation() { - return ptdfApproximation; - } - - public void setPtdfApproximation(PtdfApproximation ptdfApproximation) { - this.ptdfApproximation = ptdfApproximation; - } - - public void setPtdfSumLowerBound(double ptdfSumLowerBound) { - this.ptdfSumLowerBound = ptdfSumLowerBound; - } - - @Override - public String getName() { - return RELATIVE_MARGINS; + public static Optional load(PlatformConfig platformConfig) { + Objects.requireNonNull(platformConfig); + return platformConfig.getOptionalModuleConfig(RELATIVE_MARGINS_SECTION) + .map(config -> { + RelativeMarginsParameters parameters = new RelativeMarginsParameters(); + parameters.setPtdfBoundariesFromString(config.getStringListProperty(PTDF_BOUNDARIES, new ArrayList<>())); + return parameters; + }); } } diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/LoopFlowParametersConfigLoader.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/LoopFlowParametersConfigLoader.java deleted file mode 100644 index 04d658900c..0000000000 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/LoopFlowParametersConfigLoader.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.openrao.raoapi.parameters.extensions; - -import com.powsybl.openrao.raoapi.parameters.ParametersUtil; -import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.google.auto.service.AutoService; -import com.powsybl.commons.config.PlatformConfig; - -import java.util.ArrayList; -import java.util.Objects; - -import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; -/** - * @author Godelaine de Montmorillon {@literal } - */ -@AutoService(RaoParameters.ConfigLoader.class) -public class LoopFlowParametersConfigLoader implements RaoParameters.ConfigLoader { - - @Override - public LoopFlowParametersExtension load(PlatformConfig platformConfig) { - Objects.requireNonNull(platformConfig); - return platformConfig.getOptionalModuleConfig(LOOP_FLOW_PARAMETERS_SECTION) - .map(config -> { - LoopFlowParametersExtension parameters = new LoopFlowParametersExtension(); - parameters.setAcceptableIncrease(config.getDoubleProperty(ACCEPTABLE_INCREASE, LoopFlowParametersExtension.DEFAULT_ACCEPTABLE_INCREASE)); - parameters.setPtdfApproximation(config.getEnumProperty(PTDF_APPROXIMATION, PtdfApproximation.class, LoopFlowParametersExtension.DEFAULT_PTDF_APPROXIMATION)); - parameters.setConstraintAdjustmentCoefficient(config.getDoubleProperty(CONSTRAINT_ADJUSTMENT_COEFFICIENT, LoopFlowParametersExtension.DEFAULT_CONSTRAINT_ADJUSTMENT_COEFFICIENT)); - parameters.setViolationCost(config.getDoubleProperty(VIOLATION_COST, LoopFlowParametersExtension.DEFAULT_VIOLATION_COST)); - parameters.setCountries(ParametersUtil.convertToCountrySet(config.getStringListProperty(COUNTRIES, new ArrayList<>()))); - return parameters; - }) - .orElse(null); - } - - @Override - public String getExtensionName() { - return LOOP_FLOW_PARAMETERS_SECTION; - } - - @Override - public String getCategoryName() { - return "rao-parameters"; - } - - @Override - public Class getExtensionClass() { - return LoopFlowParametersExtension.class; - } -} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/MnecParametersConfigLoader.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/MnecParametersConfigLoader.java deleted file mode 100644 index f5e47afaaa..0000000000 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/MnecParametersConfigLoader.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.openrao.raoapi.parameters.extensions; - -import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.google.auto.service.AutoService; -import com.powsybl.commons.config.PlatformConfig; - -import java.util.Objects; - -import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; -/** - * @author Godelaine de Montmorillon {@literal } - */ -@AutoService(RaoParameters.ConfigLoader.class) -public class MnecParametersConfigLoader implements RaoParameters.ConfigLoader { - - @Override - public MnecParametersExtension load(PlatformConfig platformConfig) { - Objects.requireNonNull(platformConfig); - return platformConfig.getOptionalModuleConfig(MNEC_PARAMETERS_SECTION) - .map(config -> { - MnecParametersExtension parameters = new MnecParametersExtension(); - parameters.setAcceptableMarginDecrease(config.getDoubleProperty(ACCEPTABLE_MARGIN_DECREASE, MnecParametersExtension.DEFAULT_ACCEPTABLE_MARGIN_DECREASE)); - parameters.setViolationCost(config.getDoubleProperty(VIOLATION_COST, MnecParametersExtension.DEFAULT_VIOLATION_COST)); - parameters.setConstraintAdjustmentCoefficient(config.getDoubleProperty(CONSTRAINT_ADJUSTMENT_COEFFICIENT, MnecParametersExtension.DEFAULT_CONSTRAINT_ADJUSTMENT_COEFFICIENT)); - return parameters; - }) - .orElse(null); - } - - @Override - public String getExtensionName() { - return MNEC_PARAMETERS_SECTION; - } - - @Override - public String getCategoryName() { - return "rao-parameters"; - } - - @Override - public Class getExtensionClass() { - return MnecParametersExtension.class; - } -} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/OpenRaoSearchTreeParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/OpenRaoSearchTreeParameters.java index 28e87a80f4..eac0006109 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/OpenRaoSearchTreeParameters.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/OpenRaoSearchTreeParameters.java @@ -11,7 +11,9 @@ import com.powsybl.commons.extensions.AbstractExtension; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.SEARCH_TREE_PARAMETERS; /** * @author Pauline JEAN-MARIE {@literal } @@ -23,6 +25,9 @@ public class OpenRaoSearchTreeParameters extends AbstractExtension mnecParameters = Optional.empty(); + private Optional relativeMarginsParameters = Optional.empty(); + private Optional loopFlowParameters = Optional.empty(); // Getters and setters public void setObjectiveFunctionParameters(SearchTreeRaoObjectiveFunctionParameters objectiveFunctionParameters) { @@ -49,6 +54,18 @@ public void setLoadFlowAndSensitivityParameters(LoadFlowAndSensitivityParameters this.loadFlowAndSensitivityParameters = loadFlowAndSensitivityParameters; } + public void setMnecParameters(SearchTreeRaoMnecParameters mnecParameters) { + this.mnecParameters = Optional.of(mnecParameters); + } + + public void setRelativeMarginsParameters(SearchTreeRaoRelativeMarginsParameters relativeMarginsParameters) { + this.relativeMarginsParameters = Optional.of(relativeMarginsParameters); + } + + public void setLoopFlowParameters(SearchTreeRaoLoopFlowParameters loopFlowParameters) { + this.loopFlowParameters = Optional.of(loopFlowParameters); + } + public SearchTreeRaoObjectiveFunctionParameters getObjectiveFunctionParameters() { return objectiveFunctionParameters; } @@ -73,6 +90,18 @@ public LoadFlowAndSensitivityParameters getLoadFlowAndSensitivityParameters() { return loadFlowAndSensitivityParameters; } + public Optional getMnecParameters() { + return mnecParameters; + } + + public Optional getRelativeMarginsParameters() { + return relativeMarginsParameters; + } + + public Optional getLoopFlowParameters() { + return loopFlowParameters; + } + @Override public String getName() { return SEARCH_TREE_PARAMETERS; diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/OpenRaoSearchTreeParametersConfigLoader.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/OpenRaoSearchTreeParametersConfigLoader.java index b59a70792a..75d03fd66d 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/OpenRaoSearchTreeParametersConfigLoader.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/OpenRaoSearchTreeParametersConfigLoader.java @@ -28,7 +28,7 @@ public class OpenRaoSearchTreeParametersConfigLoader implements RaoParameters.Co @Override public OpenRaoSearchTreeParameters load(PlatformConfig platformConfig) { Objects.requireNonNull(platformConfig); - List searchTreeParams = Arrays.asList(ST_OBJECTIVE_FUNCTION_SECTION, ST_RANGE_ACTIONS_OPTIMIZATION_SECTION, ST_TOPOLOGICAL_ACTIONS_OPTIMIZATION_SECTION, MULTI_THREADING_SECTION, SECOND_PREVENTIVE_RAO_SECTION, LOAD_FLOW_AND_SENSITIVITY_COMPUTATION_SECTION); + List searchTreeParams = Arrays.asList(ST_OBJECTIVE_FUNCTION_SECTION, ST_RANGE_ACTIONS_OPTIMIZATION_SECTION, ST_TOPOLOGICAL_ACTIONS_OPTIMIZATION_SECTION, MULTI_THREADING_SECTION, SECOND_PREVENTIVE_RAO_SECTION, LOAD_FLOW_AND_SENSITIVITY_COMPUTATION_SECTION, ST_MNEC_PARAMETERS_SECTION, ST_RELATIVE_MARGINS_SECTION, ST_LOOP_FLOW_PARAMETERS_SECTION); boolean anySearchTreeParams = searchTreeParams.stream().map(platformConfig::getOptionalModuleConfig).anyMatch(Optional::isPresent); if (!anySearchTreeParams) { return null; @@ -40,6 +40,9 @@ public OpenRaoSearchTreeParameters load(PlatformConfig platformConfig) { parameters.setMultithreadingParameters(MultithreadingParameters.load(platformConfig)); parameters.setSecondPreventiveRaoParameters(SecondPreventiveRaoParameters.load(platformConfig)); parameters.setLoadFlowAndSensitivityParameters(LoadFlowAndSensitivityParameters.load(platformConfig)); + SearchTreeRaoMnecParameters.load(platformConfig).ifPresent(parameters::setMnecParameters); + SearchTreeRaoRelativeMarginsParameters.load(platformConfig).ifPresent(parameters::setRelativeMarginsParameters); + SearchTreeRaoLoopFlowParameters.load(platformConfig).ifPresent(parameters::setLoopFlowParameters); return parameters; } diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/RelativeMarginsParametersConfigLoader.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/RelativeMarginsParametersConfigLoader.java deleted file mode 100644 index b9f3059f45..0000000000 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/RelativeMarginsParametersConfigLoader.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2023, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.openrao.raoapi.parameters.extensions; - -import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.google.auto.service.AutoService; -import com.powsybl.commons.config.PlatformConfig; - -import java.util.ArrayList; -import java.util.Objects; - -import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; -/** - * @author Godelaine de Montmorillon {@literal } - */ -@AutoService(RaoParameters.ConfigLoader.class) -public class RelativeMarginsParametersConfigLoader implements RaoParameters.ConfigLoader { - - @Override - public RelativeMarginsParametersExtension load(PlatformConfig platformConfig) { - Objects.requireNonNull(platformConfig); - return platformConfig.getOptionalModuleConfig(RELATIVE_MARGINS_SECTION) - .map(config -> { - RelativeMarginsParametersExtension parameters = new RelativeMarginsParametersExtension(); - parameters.setPtdfBoundariesFromString(config.getStringListProperty(PTDF_BOUNDARIES, new ArrayList<>())); - parameters.setPtdfApproximation(config.getEnumProperty(PTDF_APPROXIMATION, PtdfApproximation.class, RelativeMarginsParametersExtension.DEFAULT_PTDF_APPROXIMATION)); - parameters.setPtdfSumLowerBound(config.getDoubleProperty(PTDF_SUM_LOWER_BOUND, RelativeMarginsParametersExtension.DEFAULT_PTDF_SUM_LOWER_BOUND)); - return parameters; - }) - .orElse(null); - } - - @Override - public String getExtensionName() { - return RELATIVE_MARGINS_SECTION; - } - - @Override - public String getCategoryName() { - return "rao-parameters"; - } - - @Override - public Class getExtensionClass() { - return RelativeMarginsParametersExtension.class; - } -} diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/LoopFlowParametersExtension.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoLoopFlowParameters.java similarity index 59% rename from ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/LoopFlowParametersExtension.java rename to ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoLoopFlowParameters.java index b1396a4ce6..716ce094ff 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/LoopFlowParametersExtension.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoLoopFlowParameters.java @@ -6,12 +6,10 @@ */ package com.powsybl.openrao.raoapi.parameters.extensions; -import com.powsybl.openrao.raoapi.parameters.ParametersUtil; -import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.commons.extensions.AbstractExtension; -import com.powsybl.iidm.network.Country; +import com.powsybl.commons.config.PlatformConfig; -import java.util.*; +import java.util.Objects; +import java.util.Optional; import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; @@ -20,27 +18,16 @@ * * @author Godelaine de Montmorillon {@literal } */ -public class LoopFlowParametersExtension extends AbstractExtension { - static final double DEFAULT_ACCEPTABLE_INCREASE = 0.0; +public class SearchTreeRaoLoopFlowParameters { static final PtdfApproximation DEFAULT_PTDF_APPROXIMATION = PtdfApproximation.FIXED_PTDF; static final double DEFAULT_CONSTRAINT_ADJUSTMENT_COEFFICIENT = 0.0; static final double DEFAULT_VIOLATION_COST = 0.0; - static final Set DEFAULT_COUNTRIES = new HashSet<>(); //Empty by default - private double acceptableIncrease = DEFAULT_ACCEPTABLE_INCREASE; private PtdfApproximation ptdfApproximation = DEFAULT_PTDF_APPROXIMATION; private double constraintAdjustmentCoefficient = DEFAULT_CONSTRAINT_ADJUSTMENT_COEFFICIENT; private double violationCost = DEFAULT_VIOLATION_COST; - private Set countries = DEFAULT_COUNTRIES; // Getters and setters - public double getAcceptableIncrease() { - return acceptableIncrease; - } - - public void setAcceptableIncrease(double acceptableIncrease) { - this.acceptableIncrease = acceptableIncrease; - } public PtdfApproximation getPtdfApproximation() { return ptdfApproximation; @@ -66,21 +53,16 @@ public void setViolationCost(double violationCost) { this.violationCost = violationCost; } - public Set getCountries() { - return countries; - } - - public void setCountries(Set countries) { - this.countries = countries; - } - - public void setCountries(List countryStrings) { - this.countries = ParametersUtil.convertToCountrySet(countryStrings); - } - - @Override - public String getName() { - return LOOP_FLOW_PARAMETERS; + public static Optional load(PlatformConfig platformConfig) { + Objects.requireNonNull(platformConfig); + return platformConfig.getOptionalModuleConfig(ST_LOOP_FLOW_PARAMETERS_SECTION) + .map(config -> { + SearchTreeRaoLoopFlowParameters parameters = new SearchTreeRaoLoopFlowParameters(); + parameters.setPtdfApproximation(config.getEnumProperty(PTDF_APPROXIMATION, PtdfApproximation.class, SearchTreeRaoLoopFlowParameters.DEFAULT_PTDF_APPROXIMATION)); + parameters.setConstraintAdjustmentCoefficient(config.getDoubleProperty(CONSTRAINT_ADJUSTMENT_COEFFICIENT, SearchTreeRaoLoopFlowParameters.DEFAULT_CONSTRAINT_ADJUSTMENT_COEFFICIENT)); + parameters.setViolationCost(config.getDoubleProperty(VIOLATION_COST, SearchTreeRaoLoopFlowParameters.DEFAULT_VIOLATION_COST)); + return parameters; + }); } } diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/MnecParametersExtension.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoMnecParameters.java similarity index 56% rename from ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/MnecParametersExtension.java rename to ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoMnecParameters.java index 4489df24a6..b00241cf4e 100644 --- a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/MnecParametersExtension.java +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoMnecParameters.java @@ -7,37 +7,26 @@ package com.powsybl.openrao.raoapi.parameters.extensions; -import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.commons.extensions.AbstractExtension; +import com.powsybl.commons.config.PlatformConfig; + +import java.util.Objects; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; +import static com.powsybl.openrao.raoapi.RaoParametersCommons.CONSTRAINT_ADJUSTMENT_COEFFICIENT; -import static com.powsybl.openrao.raoapi.RaoParametersCommons.MNEC_PARAMETERS; /** * Extension : MNEC parameters for RAO * * @author Godelaine de Montmorillon {@literal } */ -public class MnecParametersExtension extends AbstractExtension { - static final double DEFAULT_ACCEPTABLE_MARGIN_DECREASE = 50.0; +public class SearchTreeRaoMnecParameters { static final double DEFAULT_VIOLATION_COST = 10.0; static final double DEFAULT_CONSTRAINT_ADJUSTMENT_COEFFICIENT = 0.0; - private double acceptableMarginDecrease = DEFAULT_ACCEPTABLE_MARGIN_DECREASE; // "A equivalent cost per A violation" or "MW per MW", depending on the objective function private double violationCost = DEFAULT_VIOLATION_COST; private double constraintAdjustmentCoefficient = DEFAULT_CONSTRAINT_ADJUSTMENT_COEFFICIENT; - @Override - public String getName() { - return MNEC_PARAMETERS; - } - - public double getAcceptableMarginDecrease() { - return acceptableMarginDecrease; - } - - public void setAcceptableMarginDecrease(double acceptableMarginDecrease) { - this.acceptableMarginDecrease = acceptableMarginDecrease; - } - public double getViolationCost() { return violationCost; } @@ -53,4 +42,15 @@ public double getConstraintAdjustmentCoefficient() { public void setConstraintAdjustmentCoefficient(double constraintAdjustmentCoefficient) { this.constraintAdjustmentCoefficient = constraintAdjustmentCoefficient; } + + public static Optional load(PlatformConfig platformConfig) { + Objects.requireNonNull(platformConfig); + return platformConfig.getOptionalModuleConfig(ST_MNEC_PARAMETERS_SECTION) + .map(config -> { + SearchTreeRaoMnecParameters parameters = new SearchTreeRaoMnecParameters(); + parameters.setViolationCost(config.getDoubleProperty(VIOLATION_COST, SearchTreeRaoMnecParameters.DEFAULT_VIOLATION_COST)); + parameters.setConstraintAdjustmentCoefficient(config.getDoubleProperty(CONSTRAINT_ADJUSTMENT_COEFFICIENT, SearchTreeRaoMnecParameters.DEFAULT_CONSTRAINT_ADJUSTMENT_COEFFICIENT)); + return parameters; + }); + } } diff --git a/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoRelativeMarginsParameters.java b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoRelativeMarginsParameters.java new file mode 100644 index 0000000000..32c6551b2d --- /dev/null +++ b/ra-optimisation/rao-api/src/main/java/com/powsybl/openrao/raoapi/parameters/extensions/SearchTreeRaoRelativeMarginsParameters.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package com.powsybl.openrao.raoapi.parameters.extensions; + +import com.powsybl.commons.config.PlatformConfig; + +import java.util.Objects; +import java.util.Optional; + +import static com.powsybl.openrao.raoapi.RaoParametersCommons.*; +import static com.powsybl.openrao.raoapi.RaoParametersCommons.PTDF_SUM_LOWER_BOUND; + +/** + * Extension : relative margin parameters for RAO + * + * @author Godelaine de Montmorillon {@literal } + */ +public class SearchTreeRaoRelativeMarginsParameters { + + static final double DEFAULT_PTDF_SUM_LOWER_BOUND = 0.01; + static final PtdfApproximation DEFAULT_PTDF_APPROXIMATION = PtdfApproximation.FIXED_PTDF; + // prevents relative margins from diverging to +infinity + private double ptdfSumLowerBound = DEFAULT_PTDF_SUM_LOWER_BOUND; + private PtdfApproximation ptdfApproximation = DEFAULT_PTDF_APPROXIMATION; + + public double getPtdfSumLowerBound() { + return ptdfSumLowerBound; + } + + public PtdfApproximation getPtdfApproximation() { + return ptdfApproximation; + } + + public void setPtdfApproximation(PtdfApproximation ptdfApproximation) { + this.ptdfApproximation = ptdfApproximation; + } + + public void setPtdfSumLowerBound(double ptdfSumLowerBound) { + this.ptdfSumLowerBound = ptdfSumLowerBound; + } + + public static Optional load(PlatformConfig platformConfig) { + Objects.requireNonNull(platformConfig); + return platformConfig.getOptionalModuleConfig(ST_RELATIVE_MARGINS_SECTION) + .map(config -> { + SearchTreeRaoRelativeMarginsParameters parameters = new SearchTreeRaoRelativeMarginsParameters(); + parameters.setPtdfApproximation(config.getEnumProperty(PTDF_APPROXIMATION, PtdfApproximation.class, SearchTreeRaoRelativeMarginsParameters.DEFAULT_PTDF_APPROXIMATION)); + parameters.setPtdfSumLowerBound(config.getDoubleProperty(PTDF_SUM_LOWER_BOUND, SearchTreeRaoRelativeMarginsParameters.DEFAULT_PTDF_SUM_LOWER_BOUND)); + return parameters; + }); + } +} + diff --git a/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/json/JsonRaoParametersTest.java b/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/json/JsonRaoParametersTest.java index b67173905c..6197434817 100644 --- a/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/json/JsonRaoParametersTest.java +++ b/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/json/JsonRaoParametersTest.java @@ -89,25 +89,34 @@ void roundTrip() throws IOException { searchTreeParameters.getLoadFlowAndSensitivityParameters().setSensitivityProvider("OpenSensitivityAnalysis"); // Extensions // -- LoopFlow parameters - parameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); - parameters.getExtension(LoopFlowParametersExtension.class).setAcceptableIncrease(20.); - parameters.getExtension(LoopFlowParametersExtension.class).setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO_AND_PST); - parameters.getExtension(LoopFlowParametersExtension.class).setConstraintAdjustmentCoefficient(0.5); + com.powsybl.openrao.raoapi.parameters.LoopFlowParameters loopFlowParameters = new com.powsybl.openrao.raoapi.parameters.LoopFlowParameters(); + SearchTreeRaoLoopFlowParameters loopFlowParametersExtension = new SearchTreeRaoLoopFlowParameters(); + loopFlowParameters.setAcceptableIncrease(20.); + loopFlowParametersExtension.setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO_AND_PST); + loopFlowParametersExtension.setConstraintAdjustmentCoefficient(0.5); List countries = new ArrayList<>(); countries.add("BE"); countries.add("FR"); - parameters.getExtension(LoopFlowParametersExtension.class).setCountries(countries); + loopFlowParameters.setCountries(countries); + parameters.setLoopFlowParameters(loopFlowParameters); + searchTreeParameters.setLoopFlowParameters(loopFlowParametersExtension); // -- Mnec parameters - parameters.addExtension(MnecParametersExtension.class, new MnecParametersExtension()); - parameters.getExtension(MnecParametersExtension.class).setViolationCost(20); - parameters.getExtension(MnecParametersExtension.class).setAcceptableMarginDecrease(30); - parameters.getExtension(MnecParametersExtension.class).setConstraintAdjustmentCoefficient(3); + com.powsybl.openrao.raoapi.parameters.MnecParameters mnecParameters = new com.powsybl.openrao.raoapi.parameters.MnecParameters(); + SearchTreeRaoMnecParameters mnecParametersExtension = new SearchTreeRaoMnecParameters(); + mnecParametersExtension.setViolationCost(20); + mnecParameters.setAcceptableMarginDecrease(30); + mnecParametersExtension.setConstraintAdjustmentCoefficient(3); + parameters.setMnecParameters(mnecParameters); + searchTreeParameters.setMnecParameters(mnecParametersExtension); // -- Relative Margins parameters - parameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); + com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters relativeMarginsParameters = new com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters(); + SearchTreeRaoRelativeMarginsParameters relativeMarginsParametersExtension = new SearchTreeRaoRelativeMarginsParameters(); List stringBoundaries = new ArrayList<>(Arrays.asList("{FR}-{ES}", "{ES}-{PT}", "{BE}-{22Y201903144---9}-{DE}-{22Y201903145---4}")); - parameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfBoundariesFromString(stringBoundaries); - parameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO); - parameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfSumLowerBound(0.05); + relativeMarginsParameters.setPtdfBoundariesFromString(stringBoundaries); + relativeMarginsParametersExtension.setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO); + relativeMarginsParametersExtension.setPtdfSumLowerBound(0.05); + parameters.setRelativeMarginsParameters(relativeMarginsParameters); + searchTreeParameters.setRelativeMarginsParameters(relativeMarginsParametersExtension); roundTripTest(parameters, JsonRaoParameters::write, JsonRaoParameters::read, "/RaoParametersSet_v2.json"); } @@ -115,9 +124,9 @@ void roundTrip() throws IOException { @Test void update() { RaoParameters parameters = JsonRaoParameters.read(getClass().getResourceAsStream("/RaoParameters_default_v2.json")); - assertEquals(2, parameters.getExtensions().size()); + assertEquals(1, parameters.getExtensions().size()); JsonRaoParameters.update(parameters, getClass().getResourceAsStream("/RaoParameters_update_v2.json")); - assertEquals(3, parameters.getExtensions().size()); + assertEquals(1, parameters.getExtensions().size()); assertEquals(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_MARGIN, parameters.getObjectiveFunctionParameters().getType()); OpenRaoSearchTreeParameters searchTreeParameters = parameters.getExtension(OpenRaoSearchTreeParameters.class); assertEquals(5, searchTreeParameters.getTopoOptimizationParameters().getMaxPreventiveSearchTreeDepth(), DOUBLE_TOLERANCE); @@ -132,13 +141,11 @@ void update() { assertEquals(SecondPreventiveRaoParameters.ExecutionCondition.COST_INCREASE, searchTreeParameters.getSecondPreventiveRaoParameters().getExecutionCondition()); assertTrue(searchTreeParameters.getSecondPreventiveRaoParameters().getHintFromFirstPreventiveRao()); // Extensions - MnecParametersExtension mnecParameters = parameters.getExtension(MnecParametersExtension.class); - assertEquals(888, mnecParameters.getAcceptableMarginDecrease(), DOUBLE_TOLERANCE); - assertEquals(23, mnecParameters.getViolationCost(), DOUBLE_TOLERANCE); - assertEquals(4, mnecParameters.getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); - RelativeMarginsParametersExtension relativeMarginsParameters = parameters.getExtension(RelativeMarginsParametersExtension.class); - assertEquals(0.06, relativeMarginsParameters.getPtdfSumLowerBound(), DOUBLE_TOLERANCE); - assertEquals(List.of("{FR}-{ES}"), relativeMarginsParameters.getPtdfBoundariesAsString()); + assertEquals(888, parameters.getMnecParameters().get().getAcceptableMarginDecrease(), DOUBLE_TOLERANCE); + assertEquals(23, searchTreeParameters.getMnecParameters().get().getViolationCost(), DOUBLE_TOLERANCE); + assertEquals(4, searchTreeParameters.getMnecParameters().get().getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); + assertEquals(0.06, searchTreeParameters.getRelativeMarginsParameters().get().getPtdfSumLowerBound(), DOUBLE_TOLERANCE); + assertEquals(List.of("{FR}-{ES}"), parameters.getRelativeMarginsParameters().get().getPtdfBoundariesAsString()); } @Test diff --git a/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersConfigTest.java b/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersConfigTest.java index 2b493167e3..7d5a2454cf 100644 --- a/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersConfigTest.java +++ b/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersConfigTest.java @@ -162,31 +162,46 @@ void checkLoadFlowParametersConfig() { void checkLoopFlowParametersConfig() { ModuleConfig loopFlowModuleConfig = Mockito.mock(ModuleConfig.class); Mockito.when(loopFlowModuleConfig.getDoubleProperty(eq("acceptable-increase"), anyDouble())).thenReturn(32.); - Mockito.when(loopFlowModuleConfig.getEnumProperty(eq("ptdf-approximation"), eq(PtdfApproximation.class), any())).thenReturn(PtdfApproximation.UPDATE_PTDF_WITH_TOPO); - Mockito.when(loopFlowModuleConfig.getDoubleProperty(eq("violation-cost"), anyDouble())).thenReturn(43.); - Mockito.when(loopFlowModuleConfig.getDoubleProperty(eq("constraint-adjustment-coefficient"), anyDouble())).thenReturn(45.); Mockito.when(loopFlowModuleConfig.getStringListProperty(eq("countries"), anyList())).thenReturn(List.of("FR", "ES", "PT")); Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("rao-loop-flow-parameters")).thenReturn(Optional.of(loopFlowModuleConfig)); - LoopFlowParametersConfigLoader configLoader = new LoopFlowParametersConfigLoader(); - LoopFlowParametersExtension parameters = configLoader.load(mockedPlatformConfig); + LoopFlowParameters parameters = RaoParameters.load(mockedPlatformConfig).getLoopFlowParameters().get(); assertEquals(32, parameters.getAcceptableIncrease(), DOUBLE_TOLERANCE); + Set expectedCountries = Set.of(Country.FR, Country.ES, Country.PT); + assertEquals(expectedCountries, parameters.getCountries()); + } + + @Test + void checkLoopFlowParametersConfigExtension() { + ModuleConfig loopFlowModuleConfig = Mockito.mock(ModuleConfig.class); + Mockito.when(loopFlowModuleConfig.getEnumProperty(eq("ptdf-approximation"), eq(PtdfApproximation.class), any())).thenReturn(PtdfApproximation.UPDATE_PTDF_WITH_TOPO); + Mockito.when(loopFlowModuleConfig.getDoubleProperty(eq("violation-cost"), anyDouble())).thenReturn(43.); + Mockito.when(loopFlowModuleConfig.getDoubleProperty(eq("constraint-adjustment-coefficient"), anyDouble())).thenReturn(45.); + Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("search-tree-loop-flow-parameters")).thenReturn(Optional.of(loopFlowModuleConfig)); + OpenRaoSearchTreeParametersConfigLoader configLoader = new OpenRaoSearchTreeParametersConfigLoader(); + SearchTreeRaoLoopFlowParameters parameters = configLoader.load(mockedPlatformConfig).getLoopFlowParameters().get(); assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO, parameters.getPtdfApproximation()); assertEquals(45, parameters.getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); assertEquals(43, parameters.getViolationCost(), DOUBLE_TOLERANCE); Set expectedCountries = Set.of(Country.FR, Country.ES, Country.PT); - assertEquals(expectedCountries, parameters.getCountries()); } @Test void checkMnecParametersConfig() { ModuleConfig mnecModuleConfig = Mockito.mock(ModuleConfig.class); Mockito.when(mnecModuleConfig.getDoubleProperty(eq("acceptable-margin-decrease"), anyDouble())).thenReturn(32.); - Mockito.when(mnecModuleConfig.getDoubleProperty(eq("violation-cost"), anyDouble())).thenReturn(43.); - Mockito.when(mnecModuleConfig.getDoubleProperty(eq("constraint-adjustment-coefficient"), anyDouble())).thenReturn(45.); Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("rao-mnec-parameters")).thenReturn(Optional.of(mnecModuleConfig)); - MnecParametersConfigLoader configLoader = new MnecParametersConfigLoader(); - MnecParametersExtension parameters = configLoader.load(mockedPlatformConfig); + MnecParameters parameters = RaoParameters.load(mockedPlatformConfig).getMnecParameters().get(); assertEquals(32, parameters.getAcceptableMarginDecrease(), DOUBLE_TOLERANCE); + } + + @Test + void checkMnecParametersConfigExtension() { + ModuleConfig mnecModuleConfig = Mockito.mock(ModuleConfig.class); + Mockito.when(mnecModuleConfig.getDoubleProperty(eq("violation-cost"), anyDouble())).thenReturn(43.); + Mockito.when(mnecModuleConfig.getDoubleProperty(eq("constraint-adjustment-coefficient"), anyDouble())).thenReturn(45.); + Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("search-tree-mnec-parameters")).thenReturn(Optional.of(mnecModuleConfig)); + OpenRaoSearchTreeParametersConfigLoader configLoader = new OpenRaoSearchTreeParametersConfigLoader(); + SearchTreeRaoMnecParameters parameters = configLoader.load(mockedPlatformConfig).getMnecParameters().get(); assertEquals(43, parameters.getViolationCost(), DOUBLE_TOLERANCE); assertEquals(45, parameters.getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); } @@ -194,16 +209,23 @@ void checkMnecParametersConfig() { @Test void checkRelativeMarginsConfig() { ModuleConfig relativeMarginsModuleConfig = Mockito.mock(ModuleConfig.class); - Mockito.when(relativeMarginsModuleConfig.getDoubleProperty(eq("ptdf-sum-lower-bound"), anyDouble())).thenReturn(32.); Mockito.when(relativeMarginsModuleConfig.getStringListProperty(eq("ptdf-boundaries"), anyList())).thenReturn(List.of("{FR}-{BE}", "{FR}-{DE}", "{BE}-{22Y201903144---9}-{DE}+{22Y201903145---4}")); Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("rao-relative-margins-parameters")).thenReturn(Optional.of(relativeMarginsModuleConfig)); - RelativeMarginsParametersConfigLoader configLoader = new RelativeMarginsParametersConfigLoader(); - RelativeMarginsParametersExtension parameters = configLoader.load(mockedPlatformConfig); + RelativeMarginsParameters parameters = RaoParameters.load(mockedPlatformConfig).getRelativeMarginsParameters().get(); List expectedBoundaries = List.of("{FR}-{BE}", "{FR}-{DE}", "{BE}-{22Y201903144---9}-{DE}+{22Y201903145---4}"); - assertEquals(32, parameters.getPtdfSumLowerBound(), DOUBLE_TOLERANCE); assertEquals(expectedBoundaries, parameters.getPtdfBoundariesAsString()); } + @Test + void checkRelativeMarginsConfigExtension() { + ModuleConfig relativeMarginsModuleConfig = Mockito.mock(ModuleConfig.class); + Mockito.when(relativeMarginsModuleConfig.getDoubleProperty(eq("ptdf-sum-lower-bound"), anyDouble())).thenReturn(32.); + Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("search-tree-relative-margins-parameters")).thenReturn(Optional.of(relativeMarginsModuleConfig)); + OpenRaoSearchTreeParametersConfigLoader configLoader = new OpenRaoSearchTreeParametersConfigLoader(); + SearchTreeRaoRelativeMarginsParameters parameters = configLoader.load(mockedPlatformConfig).getRelativeMarginsParameters().get(); + assertEquals(32, parameters.getPtdfSumLowerBound(), DOUBLE_TOLERANCE); + } + @Test void checkMultipleConfigs() { MapModuleConfig objectiveFunctionModuleConfig = platformCfg.createModuleConfig("rao-objective-function"); @@ -216,11 +238,15 @@ void checkMultipleConfigs() { RaoParameters parameters = RaoParameters.load(platformCfg); assertEquals(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN, parameters.getObjectiveFunctionParameters().getType()); assertEquals(Unit.AMPERE, parameters.getObjectiveFunctionParameters().getUnit()); - assertEquals(123, parameters.getExtension(OpenRaoSearchTreeParameters.class).getObjectiveFunctionParameters().getCurativeMinObjImprovement(), 1e-6); - assertEquals(32, parameters.getExtension(OpenRaoSearchTreeParameters.class).getRangeActionsOptimizationParameters().getMaxMipIterations(), 1e-6); - assertTrue(Objects.isNull(parameters.getExtension(LoopFlowParametersExtension.class))); - assertTrue(Objects.isNull(parameters.getExtension(MnecParametersExtension.class))); - assertTrue(Objects.isNull(parameters.getExtension(RelativeMarginsParametersExtension.class))); + OpenRaoSearchTreeParameters searchTreeParameters = parameters.getExtension(OpenRaoSearchTreeParameters.class); + assertEquals(123, searchTreeParameters.getObjectiveFunctionParameters().getCurativeMinObjImprovement(), 1e-6); + assertEquals(32, searchTreeParameters.getRangeActionsOptimizationParameters().getMaxMipIterations(), 1e-6); + assertTrue(parameters.getLoopFlowParameters().isEmpty()); + assertTrue(parameters.getMnecParameters().isEmpty()); + assertTrue(parameters.getRelativeMarginsParameters().isEmpty()); + assertTrue(searchTreeParameters.getLoopFlowParameters().isEmpty()); + assertTrue(searchTreeParameters.getMnecParameters().isEmpty()); + assertTrue(searchTreeParameters.getRelativeMarginsParameters().isEmpty()); } @Test @@ -242,8 +268,7 @@ void inconsistentLoopFlowCountries() { ModuleConfig loopFlowModuleConfig = Mockito.mock(ModuleConfig.class); Mockito.when(loopFlowModuleConfig.getStringListProperty(eq("countries"), anyList())).thenReturn(List.of("France", "ES", "PT")); Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("rao-loop-flow-parameters")).thenReturn(Optional.of(loopFlowModuleConfig)); - LoopFlowParametersConfigLoader configLoader = new LoopFlowParametersConfigLoader(); - assertThrows(OpenRaoException.class, () -> configLoader.load(mockedPlatformConfig)); + assertThrows(OpenRaoException.class, () -> RaoParameters.load(mockedPlatformConfig)); } @Test @@ -251,8 +276,7 @@ void inconsistentRelativeMarginsBoundaries1() { ModuleConfig relativeMarginsModuleConfig = Mockito.mock(ModuleConfig.class); Mockito.when(relativeMarginsModuleConfig.getStringListProperty(eq("ptdf-boundaries"), anyList())).thenReturn(List.of("{FR}{BE}")); Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("rao-relative-margins-parameters")).thenReturn(Optional.of(relativeMarginsModuleConfig)); - RelativeMarginsParametersConfigLoader configLoader = new RelativeMarginsParametersConfigLoader(); - assertThrows(OpenRaoException.class, () -> configLoader.load(mockedPlatformConfig)); + assertThrows(OpenRaoException.class, () -> RaoParameters.load(mockedPlatformConfig)); } @Test @@ -260,7 +284,6 @@ void inconsistentRelativeMarginsBoundaries2() { ModuleConfig relativeMarginsModuleConfig = Mockito.mock(ModuleConfig.class); Mockito.when(relativeMarginsModuleConfig.getStringListProperty(eq("ptdf-boundaries"), anyList())).thenReturn(List.of("{FR-{BE}")); Mockito.when(mockedPlatformConfig.getOptionalModuleConfig("rao-relative-margins-parameters")).thenReturn(Optional.of(relativeMarginsModuleConfig)); - RelativeMarginsParametersConfigLoader configLoader = new RelativeMarginsParametersConfigLoader(); - assertThrows(OpenRaoException.class, () -> configLoader.load(mockedPlatformConfig)); + assertThrows(OpenRaoException.class, () -> RaoParameters.load(mockedPlatformConfig)); } } diff --git a/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersConsistencyTest.java b/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersConsistencyTest.java index 177d3b5972..7f665ae56a 100644 --- a/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersConsistencyTest.java +++ b/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersConsistencyTest.java @@ -9,7 +9,6 @@ import com.powsybl.openrao.commons.EICode; import com.powsybl.openrao.commons.OpenRaoException; import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; import com.powsybl.iidm.network.Country; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -34,38 +33,41 @@ public void generalSetUp() { @Test void testSetBoundariesFromCountryCodes() { List stringBoundaries = new ArrayList<>(Arrays.asList("{FR}-{ES}", "{ES}-{PT}")); - parameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); - parameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfBoundariesFromString(stringBoundaries); - assertEquals(2, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().size()); - assertEquals(1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(0).getWeight(new EICode(Country.FR)), 1e-6); - assertEquals(-1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(0).getWeight(new EICode(Country.ES)), 1e-6); - assertEquals(1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(1).getWeight(new EICode(Country.ES)), 1e-6); - assertEquals(-1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(1).getWeight(new EICode(Country.PT)), 1e-6); + com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters relativeMarginsParameters = new com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters(); + relativeMarginsParameters.setPtdfBoundariesFromString(stringBoundaries); + parameters.setRelativeMarginsParameters(relativeMarginsParameters); + assertEquals(2, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().size()); + assertEquals(1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(0).getWeight(new EICode(Country.FR)), 1e-6); + assertEquals(-1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(0).getWeight(new EICode(Country.ES)), 1e-6); + assertEquals(1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(1).getWeight(new EICode(Country.ES)), 1e-6); + assertEquals(-1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(1).getWeight(new EICode(Country.PT)), 1e-6); } @Test void testSetBoundariesFromEiCodes() { - parameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); List stringBoundaries = new ArrayList<>(Arrays.asList("{10YBE----------2}-{10YFR-RTE------C}", "{10YBE----------2}-{22Y201903144---9}")); - parameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfBoundariesFromString(stringBoundaries); - assertEquals(2, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().size()); - assertEquals(2, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().size()); - assertEquals(1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(0).getWeight(new EICode("10YBE----------2")), 1e-6); - assertEquals(-1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(0).getWeight(new EICode("10YFR-RTE------C")), 1e-6); - assertEquals(1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(1).getWeight(new EICode("10YBE----------2")), 1e-6); - assertEquals(-1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(1).getWeight(new EICode("22Y201903144---9")), 1e-6); + com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters relativeMarginsParameters = new com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters(); + relativeMarginsParameters.setPtdfBoundariesFromString(stringBoundaries); + parameters.setRelativeMarginsParameters(relativeMarginsParameters); + assertEquals(2, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().size()); + assertEquals(2, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().size()); + assertEquals(1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(0).getWeight(new EICode("10YBE----------2")), 1e-6); + assertEquals(-1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(0).getWeight(new EICode("10YFR-RTE------C")), 1e-6); + assertEquals(1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(1).getWeight(new EICode("10YBE----------2")), 1e-6); + assertEquals(-1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(1).getWeight(new EICode("22Y201903144---9")), 1e-6); } @Test void testSetBoundariesFromMixOfCodes() { - parameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); List stringBoundaries = new ArrayList<>(Collections.singletonList("{BE}-{22Y201903144---9}+{22Y201903145---4}-{DE}")); - parameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfBoundariesFromString(stringBoundaries); - assertEquals(1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().size()); - assertEquals(1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(0).getWeight(new EICode(Country.BE)), 1e-6); - assertEquals(-1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(0).getWeight(new EICode(Country.DE)), 1e-6); - assertEquals(1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(0).getWeight(new EICode("22Y201903145---4")), 1e-6); - assertEquals(-1, parameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().get(0).getWeight(new EICode("22Y201903144---9")), 1e-6); + com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters relativeMarginsParameters = new com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters(); + relativeMarginsParameters.setPtdfBoundariesFromString(stringBoundaries); + parameters.setRelativeMarginsParameters(relativeMarginsParameters); + assertEquals(1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().size()); + assertEquals(1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(0).getWeight(new EICode(Country.BE)), 1e-6); + assertEquals(-1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(0).getWeight(new EICode(Country.DE)), 1e-6); + assertEquals(1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(0).getWeight(new EICode("22Y201903145---4")), 1e-6); + assertEquals(-1, parameters.getRelativeMarginsParameters().get().getPtdfBoundaries().get(0).getWeight(new EICode("22Y201903144---9")), 1e-6); } @Test diff --git a/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersYamlConfigTest.java b/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersYamlConfigTest.java index 558585b834..bbf513f890 100644 --- a/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersYamlConfigTest.java +++ b/ra-optimisation/rao-api/src/test/java/com/powsybl/openrao/raoapi/parameters/RaoParametersYamlConfigTest.java @@ -91,29 +91,29 @@ void testConfigWithExtensions() throws IOException { assertEquals(2, loadFlowAndSensitivityParameters.getSensitivityFailureOvercost(), DOUBLE_TOLERANCE); // EXTENSIONS - assertEquals(4, parameters.getExtensions().size()); - - LoopFlowParametersExtension loopFlowParameters = parameters.getExtension(LoopFlowParametersExtension.class); - assertNotNull(loopFlowParameters); - assertEquals(11, loopFlowParameters.getAcceptableIncrease(), DOUBLE_TOLERANCE); - assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO, loopFlowParameters.getPtdfApproximation()); - assertEquals(12, loopFlowParameters.getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); - assertEquals(13, loopFlowParameters.getViolationCost(), DOUBLE_TOLERANCE); + assertEquals(1, parameters.getExtensions().size()); + + assertTrue(parameters.getLoopFlowParameters().isPresent()); + assertTrue(searchTreeParameters.getLoopFlowParameters().isPresent()); + assertEquals(11, parameters.getLoopFlowParameters().get().getAcceptableIncrease(), DOUBLE_TOLERANCE); + assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO, searchTreeParameters.getLoopFlowParameters().get().getPtdfApproximation()); + assertEquals(12, searchTreeParameters.getLoopFlowParameters().get().getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); + assertEquals(13, searchTreeParameters.getLoopFlowParameters().get().getViolationCost(), DOUBLE_TOLERANCE); Set expectedCountries = Set.of(Country.FR, Country.ES, Country.PT); - assertEquals(expectedCountries, loopFlowParameters.getCountries()); + assertEquals(expectedCountries, parameters.getLoopFlowParameters().get().getCountries()); - MnecParametersExtension mnecParametersExtension = parameters.getExtension(MnecParametersExtension.class); - assertNotNull(mnecParametersExtension); - assertEquals(55, mnecParametersExtension.getAcceptableMarginDecrease(), DOUBLE_TOLERANCE); - assertEquals(11, mnecParametersExtension.getViolationCost(), DOUBLE_TOLERANCE); - assertEquals(12, mnecParametersExtension.getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); + assertTrue(parameters.getMnecParameters().isPresent()); + assertTrue(searchTreeParameters.getMnecParameters().isPresent()); + assertEquals(55, parameters.getMnecParameters().get().getAcceptableMarginDecrease(), DOUBLE_TOLERANCE); + assertEquals(11, searchTreeParameters.getMnecParameters().get().getViolationCost(), DOUBLE_TOLERANCE); + assertEquals(12, searchTreeParameters.getMnecParameters().get().getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); - RelativeMarginsParametersExtension relativeMarginsParametersExtension = parameters.getExtension(RelativeMarginsParametersExtension.class); - assertNotNull(relativeMarginsParametersExtension); + assertTrue(parameters.getRelativeMarginsParameters().isPresent()); + assertTrue(searchTreeParameters.getRelativeMarginsParameters().isPresent()); List expectedBoundaries = List.of("{FR}-{BE}", "{FR}-{DE}"); - assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO_AND_PST, relativeMarginsParametersExtension.getPtdfApproximation()); - assertEquals(0.02, relativeMarginsParametersExtension.getPtdfSumLowerBound(), DOUBLE_TOLERANCE); - assertEquals(expectedBoundaries, relativeMarginsParametersExtension.getPtdfBoundariesAsString()); + assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO_AND_PST, searchTreeParameters.getRelativeMarginsParameters().get().getPtdfApproximation()); + assertEquals(0.02, searchTreeParameters.getRelativeMarginsParameters().get().getPtdfSumLowerBound(), DOUBLE_TOLERANCE); + assertEquals(expectedBoundaries, parameters.getRelativeMarginsParameters().get().getPtdfBoundariesAsString()); // Compare to json roundTripTest(parameters, JsonRaoParameters::write, JsonRaoParameters::read, "/RaoParameters_config_withExtensions.json"); @@ -143,14 +143,8 @@ void testConfigWithoutExtensions() throws IOException { // EXTENSIONS assertEquals(0, parameters.getExtensions().size()); - LoopFlowParametersExtension loopFlowParameters = parameters.getExtension(LoopFlowParametersExtension.class); - assertNull(loopFlowParameters); - - MnecParametersExtension mnecParametersExtension = parameters.getExtension(MnecParametersExtension.class); - assertNull(mnecParametersExtension); - - RelativeMarginsParametersExtension relativeMarginsParametersExtension = parameters.getExtension(RelativeMarginsParametersExtension.class); - assertNull(relativeMarginsParametersExtension); + OpenRaoSearchTreeParameters searchTreeParameters = parameters.getExtension(OpenRaoSearchTreeParameters.class); + assertNull(searchTreeParameters); // Compare to json roundTripTest(parameters, JsonRaoParameters::write, JsonRaoParameters::read, "/RaoParameters_config_withoutExtensions.json"); @@ -208,26 +202,28 @@ void testConfigWithPartialExtensions() throws IOException { assertEquals(2, loadFlowAndSensitivityParametersExt.getSensitivityFailureOvercost(), DOUBLE_TOLERANCE); // EXTENSIONS - assertEquals(3, parameters.getExtensions().size()); - - LoopFlowParametersExtension loopFlowParameters = parameters.getExtension(LoopFlowParametersExtension.class); - assertNotNull(loopFlowParameters); - assertEquals(0, loopFlowParameters.getAcceptableIncrease(), DOUBLE_TOLERANCE); - assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO, loopFlowParameters.getPtdfApproximation()); - assertEquals(12, loopFlowParameters.getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); - assertEquals(13, loopFlowParameters.getViolationCost(), DOUBLE_TOLERANCE); + assertEquals(1, parameters.getExtensions().size()); + + assertTrue(parameters.getLoopFlowParameters().isPresent()); + assertTrue(searchTreeParameters.getLoopFlowParameters().isPresent()); + assertEquals(0, parameters.getLoopFlowParameters().get().getAcceptableIncrease(), DOUBLE_TOLERANCE); + assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO, searchTreeParameters.getLoopFlowParameters().get().getPtdfApproximation()); + assertEquals(12, searchTreeParameters.getLoopFlowParameters().get().getConstraintAdjustmentCoefficient(), DOUBLE_TOLERANCE); + assertEquals(13, searchTreeParameters.getLoopFlowParameters().get().getViolationCost(), DOUBLE_TOLERANCE); Set expectedCountries = Set.of(Country.FR, Country.ES, Country.PT); - assertEquals(expectedCountries, loopFlowParameters.getCountries()); + assertEquals(expectedCountries, parameters.getLoopFlowParameters().get().getCountries()); + + assertTrue(parameters.getMnecParameters().isEmpty()); + assertTrue(searchTreeParameters.getMnecParameters().isEmpty()); - MnecParametersExtension mnecParametersExtension = parameters.getExtension(MnecParametersExtension.class); - assertNull(mnecParametersExtension); + assertTrue(searchTreeParameters.getRelativeMarginsParameters().isPresent()); + assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO_AND_PST, searchTreeParameters.getRelativeMarginsParameters().get().getPtdfApproximation()); + assertEquals(0.02, searchTreeParameters.getRelativeMarginsParameters().get().getPtdfSumLowerBound(), DOUBLE_TOLERANCE); - RelativeMarginsParametersExtension relativeMarginsParametersExtension = parameters.getExtension(RelativeMarginsParametersExtension.class); - assertNotNull(relativeMarginsParametersExtension); - List expectedBoundaries = Collections.emptyList(); - assertEquals(PtdfApproximation.UPDATE_PTDF_WITH_TOPO_AND_PST, relativeMarginsParametersExtension.getPtdfApproximation()); - assertEquals(0.02, relativeMarginsParametersExtension.getPtdfSumLowerBound(), DOUBLE_TOLERANCE); - assertEquals(expectedBoundaries, relativeMarginsParametersExtension.getPtdfBoundariesAsString()); + // If SearchTreeRaoRelativeMarginsParameters is present on extension it should be created on rao-parameters, + // if it exists on rao-parameters it should be created on extension. + // The same rule exist for SearchTreeRaoMnecParameters and SearchTreeRaoLoopFlowParameters + assertTrue(parameters.getRelativeMarginsParameters().isPresent()); // Compare to json roundTripTest(parameters, JsonRaoParameters::write, JsonRaoParameters::read, "/RaoParameters_config_withPartialExtensions.json"); diff --git a/ra-optimisation/rao-api/src/test/resources/RaoParametersSet_v2.json b/ra-optimisation/rao-api/src/test/resources/RaoParametersSet_v2.json index 479a3f1acb..bc60987dc8 100644 --- a/ra-optimisation/rao-api/src/test/resources/RaoParametersSet_v2.json +++ b/ra-optimisation/rao-api/src/test/resources/RaoParametersSet_v2.json @@ -17,24 +17,17 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 30.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{ES}", "{ES}-{PT}", "{BE}-{22Y201903144---9}-{DE}-{22Y201903145---4}" ] + }, + "loop-flow-parameters" : { + "acceptable-increase" : 20.0, + "countries" : [ "BE", "FR" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 30.0, - "violation-cost" : 20.0, - "constraint-adjustment-coefficient" : 3.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{ES}", "{ES}-{PT}", "{BE}-{22Y201903144---9}-{DE}-{22Y201903145---4}" ], - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", - "ptdf-sum-lower-bound" : 0.05 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 20.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 0.5, - "violation-cost" : 0.0, - "countries" : [ "BE", "FR" ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 983.0 @@ -98,6 +91,19 @@ }, "multi-threading" : { "available-cpus" : 21 + }, + "mnec-parameters" : { + "violation-cost" : 20.0, + "constraint-adjustment-coefficient" : 3.0 + }, + "relative-margins-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", + "ptdf-sum-lower-bound" : 0.05 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 0.5, + "violation-cost" : 0.0 } } } diff --git a/ra-optimisation/rao-api/src/test/resources/RaoParametersWithLoopFlowError_v2.json b/ra-optimisation/rao-api/src/test/resources/RaoParametersWithLoopFlowError_v2.json index d89bfa1951..90bb871239 100644 --- a/ra-optimisation/rao-api/src/test/resources/RaoParametersWithLoopFlowError_v2.json +++ b/ra-optimisation/rao-api/src/test/resources/RaoParametersWithLoopFlowError_v2.json @@ -16,14 +16,11 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "FIXED_PTDF_WRONG", - "constraint-adjustment-coefficient" : 0.0, - "violation-cost" : 0.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -81,6 +78,11 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "FIXED_PTDF_WRONG", + "constraint-adjustment-coefficient" : 0.0, + "violation-cost" : 0.0 } } } diff --git a/ra-optimisation/rao-api/src/test/resources/RaoParametersWithObjFuncTypeError_v2.json b/ra-optimisation/rao-api/src/test/resources/RaoParametersWithObjFuncTypeError_v2.json index c9273be38e..0b6aca1ac7 100644 --- a/ra-optimisation/rao-api/src/test/resources/RaoParametersWithObjFuncTypeError_v2.json +++ b/ra-optimisation/rao-api/src/test/resources/RaoParametersWithObjFuncTypeError_v2.json @@ -15,14 +15,11 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "FIXED_PTDF", - "constraint-adjustment-coefficient" : 0.0, - "violation-cost" : 0.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -80,6 +77,11 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "FIXED_PTDF", + "constraint-adjustment-coefficient" : 0.0, + "violation-cost" : 0.0 } } } diff --git a/ra-optimisation/rao-api/src/test/resources/RaoParametersWithPrevStopCriterionError_v2.json b/ra-optimisation/rao-api/src/test/resources/RaoParametersWithPrevStopCriterionError_v2.json index 751edb8b6c..7455b17aec 100644 --- a/ra-optimisation/rao-api/src/test/resources/RaoParametersWithPrevStopCriterionError_v2.json +++ b/ra-optimisation/rao-api/src/test/resources/RaoParametersWithPrevStopCriterionError_v2.json @@ -16,14 +16,11 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "FIXED_PTDF", - "constraint-adjustment-coefficient" : 0.0, - "violation-cost" : 0.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -81,6 +78,11 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "FIXED_PTDF", + "constraint-adjustment-coefficient" : 0.0, + "violation-cost" : 0.0 } } } diff --git a/ra-optimisation/rao-api/src/test/resources/RaoParameters_config_withExtensions.json b/ra-optimisation/rao-api/src/test/resources/RaoParameters_config_withExtensions.json index f691f800b7..2327020e63 100644 --- a/ra-optimisation/rao-api/src/test/resources/RaoParameters_config_withExtensions.json +++ b/ra-optimisation/rao-api/src/test/resources/RaoParameters_config_withExtensions.json @@ -17,24 +17,17 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 55.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{BE}", "{FR}-{DE}" ] + }, + "loop-flow-parameters" : { + "acceptable-increase" : 11.0, + "countries" : [ "ES", "FR", "PT" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 55.0, - "violation-cost" : 11.0, - "constraint-adjustment-coefficient" : 12.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{BE}", "{FR}-{DE}" ], - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "ptdf-sum-lower-bound" : 0.02 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 11.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", - "constraint-adjustment-coefficient" : 12.0, - "violation-cost" : 13.0, - "countries" : [ "ES", "FR", "PT" ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 3.0 @@ -178,6 +171,19 @@ }, "multi-threading" : { "available-cpus" : 5 + }, + "mnec-parameters" : { + "violation-cost" : 11.0, + "constraint-adjustment-coefficient" : 12.0 + }, + "relative-margins-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "ptdf-sum-lower-bound" : 0.02 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", + "constraint-adjustment-coefficient" : 12.0, + "violation-cost" : 13.0 } } } diff --git a/ra-optimisation/rao-api/src/test/resources/RaoParameters_config_withPartialExtensions.json b/ra-optimisation/rao-api/src/test/resources/RaoParameters_config_withPartialExtensions.json index aeae1e42a7..8790e724a9 100644 --- a/ra-optimisation/rao-api/src/test/resources/RaoParameters_config_withPartialExtensions.json +++ b/ra-optimisation/rao-api/src/test/resources/RaoParameters_config_withPartialExtensions.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ ] + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ "ES", "FR", "PT" ] + }, "extensions" : { - "relative-margins-parameters" : { - "ptdf-boundaries" : [ ], - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "ptdf-sum-lower-bound" : 0.02 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", - "constraint-adjustment-coefficient" : 12.0, - "violation-cost" : 13.0, - "countries" : [ "ES", "FR", "PT" ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 3.0 @@ -173,6 +168,15 @@ }, "multi-threading" : { "available-cpus" : 5 + }, + "relative-margins-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "ptdf-sum-lower-bound" : 0.02 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", + "constraint-adjustment-coefficient" : 12.0, + "violation-cost" : 13.0 } } } diff --git a/ra-optimisation/rao-api/src/test/resources/RaoParameters_default_v2.json b/ra-optimisation/rao-api/src/test/resources/RaoParameters_default_v2.json index 52996adc56..8d19f8ca5e 100644 --- a/ra-optimisation/rao-api/src/test/resources/RaoParameters_default_v2.json +++ b/ra-optimisation/rao-api/src/test/resources/RaoParameters_default_v2.json @@ -14,12 +14,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : true }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 33.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 33.0, - "violation-cost" : 23.0, - "constraint-adjustment-coefficient" : 4.0 - }, "open-rao-search-tree-parameters" : { "range-actions-optimization" : { "max-mip-iterations" : 5, @@ -34,6 +32,10 @@ }, "multi-threading" : { "available-cpus" : 8 + }, + "mnec-parameters" : { + "violation-cost" : 23.0, + "constraint-adjustment-coefficient" : 4.0 } } } diff --git a/ra-optimisation/rao-api/src/test/resources/RaoParameters_update_v2.json b/ra-optimisation/rao-api/src/test/resources/RaoParameters_update_v2.json index a41386c477..5b844e4282 100644 --- a/ra-optimisation/rao-api/src/test/resources/RaoParameters_update_v2.json +++ b/ra-optimisation/rao-api/src/test/resources/RaoParameters_update_v2.json @@ -14,14 +14,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : true }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 888.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{ES}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 888.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{ES}" ], - "ptdf-sum-lower-bound" : 0.06 - }, "open-rao-search-tree-parameters" : { "range-actions-optimization" : { "max-mip-iterations" : 5, @@ -33,6 +32,9 @@ "second-preventive-rao" : { "execution-condition" : "COST_INCREASE", "hint-from-first-preventive-rao" : true + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.06 } } } diff --git a/ra-optimisation/rao-api/src/test/resources/config_withExtensions.yml b/ra-optimisation/rao-api/src/test/resources/config_withExtensions.yml index edc047922c..30ccedc277 100644 --- a/ra-optimisation/rao-api/src/test/resources/config_withExtensions.yml +++ b/ra-optimisation/rao-api/src/test/resources/config_withExtensions.yml @@ -17,18 +17,24 @@ rao-not-optimized-cnecs: rao-loop-flow-parameters: acceptable-increase: 11.0 + countries: [ "FR", "ES", "PT" ] + +search-tree-loop-flow-parameters: ptdf-approximation: UPDATE_PTDF_WITH_TOPO constraint-adjustment-coefficient: 12.0 violation-cost: 13.0 - countries: [ "FR", "ES", "PT" ] rao-mnec-parameters: acceptable-margin-decrease: 55.0 + +search-tree-mnec-parameters: violation-cost: 11.0 constraint-adjustment-coefficient: 12.0 rao-relative-margins-parameters: ptdf-boundaries: [ "{FR}-{BE}", "{FR}-{DE}" ] + +search-tree-relative-margins-parameters: ptdf-approximation: UPDATE_PTDF_WITH_TOPO_AND_PST ptdf-sum-lower-bound: 0.02 diff --git a/ra-optimisation/rao-api/src/test/resources/config_withPartialExtensions.yml b/ra-optimisation/rao-api/src/test/resources/config_withPartialExtensions.yml index 165da81e4b..99629395bf 100644 --- a/ra-optimisation/rao-api/src/test/resources/config_withPartialExtensions.yml +++ b/ra-optimisation/rao-api/src/test/resources/config_withPartialExtensions.yml @@ -11,12 +11,14 @@ rao-topological-actions-optimization: absolute-minimum-impact-threshold: 2.0 rao-loop-flow-parameters: + countries: [ "FR", "ES", "PT" ] + +search-tree-loop-flow-parameters: ptdf-approximation: UPDATE_PTDF_WITH_TOPO constraint-adjustment-coefficient: 12.0 violation-cost: 13.0 - countries: [ "FR", "ES", "PT" ] -rao-relative-margins-parameters: +search-tree-relative-margins-parameters: ptdf-approximation: UPDATE_PTDF_WITH_TOPO_AND_PST ptdf-sum-lower-bound: 0.02 diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/castor/algorithm/PrePerimeterSensitivityAnalysis.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/castor/algorithm/PrePerimeterSensitivityAnalysis.java index 51396186ba..5343529ae2 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/castor/algorithm/PrePerimeterSensitivityAnalysis.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/castor/algorithm/PrePerimeterSensitivityAnalysis.java @@ -6,13 +6,13 @@ */ package com.powsybl.openrao.searchtreerao.castor.algorithm; +import com.powsybl.openrao.commons.OpenRaoException; import com.powsybl.openrao.data.crac.api.Crac; import com.powsybl.openrao.data.crac.api.State; import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; import com.powsybl.openrao.data.crac.api.rangeaction.RangeAction; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; import com.powsybl.openrao.searchtreerao.result.api.*; import com.powsybl.openrao.searchtreerao.result.impl.PrePerimeterSensitivityResultImpl; import com.powsybl.openrao.searchtreerao.commons.SensitivityComputer; @@ -23,8 +23,11 @@ import com.powsybl.openrao.sensitivityanalysis.AppliedRemedialActions; import com.powsybl.iidm.network.Network; +import java.util.Objects; import java.util.Set; +import static java.lang.String.format; + /** * This class aims at performing the sensitivity analysis before the optimization of a perimeter. At these specific * instants we actually want to compute all the results on the network. They will be useful either for the optimization @@ -61,7 +64,7 @@ public PrePerimeterResult runInitialSensitivityAnalysis(Network network, Crac cr public PrePerimeterResult runInitialSensitivityAnalysis(Network network, Crac crac, Set optimizedStates) { SensitivityComputer.SensitivityComputerBuilder sensitivityComputerBuilder = buildSensiBuilder() .withOutageInstant(crac.getOutageInstant()); - if (raoParameters.hasExtension(LoopFlowParametersExtension.class)) { + if (raoParameters.getLoopFlowParameters().isPresent()) { sensitivityComputerBuilder.withCommercialFlowsResults(toolProvider.getLoopFlowComputation(), toolProvider.getLoopFlowCnecs(flowCnecs)); } if (raoParameters.getObjectiveFunctionParameters().getType().relativePositiveMargins()) { @@ -82,15 +85,21 @@ public PrePerimeterResult runBasedOnInitialResults(Network network, SensitivityComputer.SensitivityComputerBuilder sensitivityComputerBuilder = buildSensiBuilder() .withOutageInstant(crac.getOutageInstant()); - if (raoParameters.hasExtension(LoopFlowParametersExtension.class)) { - if (raoParameters.getExtension(LoopFlowParametersExtension.class).getPtdfApproximation().shouldUpdatePtdfWithTopologicalChange()) { - sensitivityComputerBuilder.withCommercialFlowsResults(toolProvider.getLoopFlowComputation(), toolProvider.getLoopFlowCnecs(flowCnecs)); - } else { - sensitivityComputerBuilder.withCommercialFlowsResults(initialFlowResult); - } + OpenRaoSearchTreeParameters searchTreeParameters = raoParameters.getExtension(OpenRaoSearchTreeParameters.class); + if (!Objects.isNull(searchTreeParameters)) { + searchTreeParameters.getLoopFlowParameters().ifPresent(loopFlowParameters -> { + if (loopFlowParameters.getPtdfApproximation().shouldUpdatePtdfWithTopologicalChange()) { + sensitivityComputerBuilder.withCommercialFlowsResults(toolProvider.getLoopFlowComputation(), toolProvider.getLoopFlowCnecs(flowCnecs)); + } else { + sensitivityComputerBuilder.withCommercialFlowsResults(initialFlowResult); + } + }); } if (raoParameters.getObjectiveFunctionParameters().getType().relativePositiveMargins()) { - if (raoParameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfApproximation().shouldUpdatePtdfWithTopologicalChange()) { + if (Objects.isNull(searchTreeParameters)) { + throw new OpenRaoException(format("Objective function %s requires an extension with relative margins parameters", raoParameters.getObjectiveFunctionParameters().getType())); + } + if (searchTreeParameters.getRelativeMarginsParameters().orElseThrow().getPtdfApproximation().shouldUpdatePtdfWithTopologicalChange()) { sensitivityComputerBuilder.withPtdfsResults(toolProvider.getAbsolutePtdfSumsComputation(), flowCnecs); } else { sensitivityComputerBuilder.withPtdfsResults(initialFlowResult); diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/RaoUtil.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/RaoUtil.java index a8e1fa1005..1305c9c265 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/RaoUtil.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/RaoUtil.java @@ -26,9 +26,7 @@ import com.powsybl.openrao.data.refprog.referenceprogram.ReferenceProgramBuilder; import com.powsybl.openrao.raoapi.RaoInput; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters.PstModel; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; import com.powsybl.openrao.searchtreerao.commons.optimizationperimeters.OptimizationPerimeter; import com.powsybl.openrao.searchtreerao.result.api.FlowResult; import com.powsybl.openrao.searchtreerao.result.api.OptimizationResult; @@ -70,19 +68,19 @@ && getSensitivityWithLoadFlowParameters(raoParameters).getLoadFlowParameters().i if (raoInput.getGlskProvider() == null) { throw new OpenRaoException(format("Objective function %s requires glsks", raoParameters.getObjectiveFunctionParameters().getType())); } - if (!raoParameters.hasExtension(RelativeMarginsParametersExtension.class) || raoParameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().isEmpty()) { + 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())); } } - if ((raoParameters.hasExtension(LoopFlowParametersExtension.class) + if ((raoParameters.getLoopFlowParameters().isPresent() || raoParameters.getObjectiveFunctionParameters().getType().relativePositiveMargins()) && (Objects.isNull(raoInput.getReferenceProgram()))) { OpenRaoLoggerProvider.BUSINESS_WARNS.warn("No ReferenceProgram provided. A ReferenceProgram will be generated using information in the network file."); raoInput.setReferenceProgram(ReferenceProgramBuilder.buildReferenceProgram(raoInput.getNetwork(), getLoadFlowProvider(raoParameters), getSensitivityWithLoadFlowParameters(raoParameters).getLoadFlowParameters())); } - if (raoParameters.hasExtension(LoopFlowParametersExtension.class) && (Objects.isNull(raoInput.getReferenceProgram()) || Objects.isNull(raoInput.getGlskProvider()))) { + if (raoParameters.getLoopFlowParameters().isPresent() && (Objects.isNull(raoInput.getReferenceProgram()) || Objects.isNull(raoInput.getGlskProvider()))) { String msg = format( "Loopflow computation cannot be performed on CRAC %s because it lacks a ReferenceProgram or a GlskProvider", raoInput.getCrac().getId()); diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/ToolProvider.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/ToolProvider.java index 9839cb8dba..2acda4cfb5 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/ToolProvider.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/ToolProvider.java @@ -19,8 +19,8 @@ import com.powsybl.openrao.loopflowcomputation.LoopFlowComputationImpl; import com.powsybl.openrao.raoapi.RaoInput; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters; import com.powsybl.openrao.sensitivityanalysis.AppliedRemedialActions; import com.powsybl.openrao.sensitivityanalysis.SystematicSensitivityInterface; import com.powsybl.glsk.commons.ZonalData; @@ -63,10 +63,10 @@ private boolean hasLoopFlowExtension(FlowCnec cnec) { } public Set getLoopFlowCnecs(Set allCnecs) { - LoopFlowParametersExtension loopFlowParameters = raoParameters.getExtension(LoopFlowParametersExtension.class); - if (raoParameters.hasExtension(LoopFlowParametersExtension.class) && !loopFlowParameters.getCountries().isEmpty()) { + Optional loopFlowParametersOptional = raoParameters.getLoopFlowParameters(); + if (loopFlowParametersOptional.isPresent() && !loopFlowParametersOptional.get().getCountries().isEmpty()) { return allCnecs.stream() - .filter(cnec -> hasLoopFlowExtension(cnec) && cnecIsInCountryList(cnec, network, loopFlowParameters.getCountries())) + .filter(cnec -> hasLoopFlowExtension(cnec) && cnecIsInCountryList(cnec, network, loopFlowParametersOptional.get().getCountries())) .collect(Collectors.toSet()); } else { return allCnecs.stream() @@ -119,10 +119,11 @@ public SystematicSensitivityInterface getSystematicSensitivityInterface(Set getEicForObjectiveFunction() { - if (!raoParameters.hasExtension(RelativeMarginsParametersExtension.class)) { + Optional optionalRelativeMarginsParameters = raoParameters.getRelativeMarginsParameters(); + if (optionalRelativeMarginsParameters.isEmpty()) { throw new OpenRaoException("No relative margins parameters were defined"); } - return raoParameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries().stream(). + return optionalRelativeMarginsParameters.get().getPtdfBoundaries().stream(). flatMap(boundary -> boundary.getEiCodes().stream()). map(EICode::getAreaCode). collect(Collectors.toSet()); @@ -214,14 +215,15 @@ public static ToolProvider buildFromRaoInputAndParameters(RaoInput raoInput, Rao ); } if (raoParameters.getObjectiveFunctionParameters().getType().relativePositiveMargins()) { - if (!raoParameters.hasExtension(RelativeMarginsParametersExtension.class)) { + Optional optionalRelativeMarginsParameters = raoParameters.getRelativeMarginsParameters(); + if (optionalRelativeMarginsParameters.isEmpty()) { throw new OpenRaoException("No relative margins parameters were defined with objective function " + raoParameters.getObjectiveFunctionParameters().getType()); } toolProviderBuilder.withAbsolutePtdfSumsComputation( raoInput.getGlskProvider(), new AbsolutePtdfSumsComputation( raoInput.getGlskProvider(), - raoParameters.getExtension(RelativeMarginsParametersExtension.class).getPtdfBoundaries() + optionalRelativeMarginsParameters.get().getPtdfBoundaries() ) ); } diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunction/ObjectiveFunctionCreator.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunction/ObjectiveFunctionCreator.java index 3b8beae3ad..5a97a3e284 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunction/ObjectiveFunctionCreator.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunction/ObjectiveFunctionCreator.java @@ -10,21 +10,21 @@ import com.powsybl.openrao.data.crac.api.State; import com.powsybl.openrao.data.crac.api.cnec.Cnec; import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.MnecParameters; import com.powsybl.openrao.raoapi.parameters.RaoParameters; import com.powsybl.openrao.raoapi.parameters.extensions.LoadFlowAndSensitivityParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; +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.searchtreerao.commons.marginevaluator.MarginEvaluator; import com.powsybl.openrao.searchtreerao.commons.marginevaluator.MarginEvaluatorWithMarginDecreaseUnoptimizedCnecs; -import com.powsybl.openrao.searchtreerao.commons.objectivefunctionevaluator.CostEvaluator; -import com.powsybl.openrao.searchtreerao.commons.objectivefunctionevaluator.LoopFlowViolationCostEvaluator; -import com.powsybl.openrao.searchtreerao.commons.objectivefunctionevaluator.MinMarginViolationEvaluator; -import com.powsybl.openrao.searchtreerao.commons.objectivefunctionevaluator.MnecViolationCostEvaluator; -import com.powsybl.openrao.searchtreerao.commons.objectivefunctionevaluator.SensitivityFailureOvercostEvaluator; +import com.powsybl.openrao.searchtreerao.commons.objectivefunctionevaluator.*; import com.powsybl.openrao.searchtreerao.result.api.FlowResult; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -59,23 +59,35 @@ protected List getVirtualCostEvaluators(MarginEvaluator marginEva virtualCostEvaluators.add(new MinMarginViolationEvaluator(flowCnecs, unit, marginEvaluator)); } + OpenRaoSearchTreeParameters openRaoSearchTreeParameters = raoParameters.getExtension(OpenRaoSearchTreeParameters.class); + // mnec virtual cost evaluator - if (raoParameters.hasExtension(MnecParametersExtension.class)) { - virtualCostEvaluators.add(new MnecViolationCostEvaluator( - flowCnecs.stream().filter(Cnec::isMonitored).collect(Collectors.toSet()), - raoParameters.getObjectiveFunctionParameters().getUnit(), - initialFlowResult, - raoParameters.getExtension(MnecParametersExtension.class) - )); + if (raoParameters.hasExtension(OpenRaoSearchTreeParameters.class)) { + Optional mnecParametersOptional = raoParameters.getMnecParameters(); + Optional mnecParametersExtensionOptional = raoParameters.getExtension(OpenRaoSearchTreeParameters.class).getMnecParameters(); + if (mnecParametersOptional.isPresent() && mnecParametersExtensionOptional.isPresent()) { + virtualCostEvaluators.add(new MnecViolationCostEvaluator( + flowCnecs.stream().filter(Cnec::isMonitored).collect(Collectors.toSet()), + raoParameters.getObjectiveFunctionParameters().getUnit(), + initialFlowResult, + mnecParametersOptional.get().getAcceptableMarginDecrease(), + mnecParametersExtensionOptional.get().getViolationCost() + )); + } } // loop-flow virtual cost evaluator - if (raoParameters.hasExtension(LoopFlowParametersExtension.class)) { - virtualCostEvaluators.add(new LoopFlowViolationCostEvaluator( - loopFlowCnecs, - initialFlowResult, - raoParameters.getExtension(LoopFlowParametersExtension.class) - )); + if (raoParameters.hasExtension(OpenRaoSearchTreeParameters.class)) { + Optional loopFlowParametersOptional = raoParameters.getLoopFlowParameters(); + Optional loopFlowParametersExtensionOptional = raoParameters.getExtension(OpenRaoSearchTreeParameters.class).getLoopFlowParameters(); + if (loopFlowParametersOptional.isPresent() && loopFlowParametersExtensionOptional.isPresent()) { + virtualCostEvaluators.add(new LoopFlowViolationCostEvaluator( + loopFlowCnecs, + initialFlowResult, + loopFlowParametersOptional.get().getAcceptableIncrease(), + loopFlowParametersExtensionOptional.get().getViolationCost() + )); + } } // If sensi failed, create a high virtual cost via SensitivityFailureOvercostEvaluator diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/LoopFlowViolationCostEvaluator.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/LoopFlowViolationCostEvaluator.java index 86020a19a4..2739e79d40 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/LoopFlowViolationCostEvaluator.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/LoopFlowViolationCostEvaluator.java @@ -12,7 +12,6 @@ import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; import com.powsybl.iidm.network.TwoSides; import com.powsybl.openrao.data.crac.loopflowextension.LoopFlowThreshold; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; import com.powsybl.openrao.searchtreerao.commons.costevaluatorresult.CostEvaluatorResult; import com.powsybl.openrao.searchtreerao.commons.costevaluatorresult.SumCostEvaluatorResult; import com.powsybl.openrao.searchtreerao.result.api.FlowResult; @@ -37,11 +36,11 @@ public class LoopFlowViolationCostEvaluator implements CostEvaluator { public LoopFlowViolationCostEvaluator(Set loopflowCnecs, FlowResult initialLoopFlowResult, - LoopFlowParametersExtension loopFlowParameters) { + double loopFlowAcceptableAugmentation, double loopFlowViolationCost) { this.loopflowCnecs = loopflowCnecs; this.initialLoopFlowResult = initialLoopFlowResult; - this.loopFlowViolationCost = loopFlowParameters.getViolationCost(); - this.loopFlowAcceptableAugmentation = loopFlowParameters.getAcceptableIncrease(); + this.loopFlowViolationCost = loopFlowViolationCost; + this.loopFlowAcceptableAugmentation = loopFlowAcceptableAugmentation; } @Override diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/MnecViolationCostEvaluator.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/MnecViolationCostEvaluator.java index 84cd311e39..210043a4cc 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/MnecViolationCostEvaluator.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/MnecViolationCostEvaluator.java @@ -11,7 +11,6 @@ import com.powsybl.openrao.data.crac.api.State; import com.powsybl.openrao.data.crac.api.cnec.Cnec; import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; import com.powsybl.openrao.searchtreerao.commons.costevaluatorresult.CostEvaluatorResult; import com.powsybl.openrao.searchtreerao.commons.costevaluatorresult.SumCostEvaluatorResult; import com.powsybl.openrao.searchtreerao.result.api.FlowResult; @@ -38,12 +37,12 @@ public class MnecViolationCostEvaluator implements CostEvaluator { private final double mnecAcceptableMarginDecrease; private final double mnecViolationCost; - public MnecViolationCostEvaluator(Set flowCnecs, Unit unit, FlowResult initialFlowResult, MnecParametersExtension mnecParametersExtension) { + public MnecViolationCostEvaluator(Set flowCnecs, Unit unit, FlowResult initialFlowResult, double mnecAcceptableMarginDecrease, double mnecViolationCost) { this.flowCnecs = flowCnecs; this.unit = unit; this.initialFlowResult = initialFlowResult; - this.mnecAcceptableMarginDecrease = mnecParametersExtension.getAcceptableMarginDecrease(); - this.mnecViolationCost = mnecParametersExtension.getViolationCost(); + this.mnecAcceptableMarginDecrease = mnecAcceptableMarginDecrease; + this.mnecViolationCost = mnecViolationCost; } @Override diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/AbstractOptimizationPerimeter.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/AbstractOptimizationPerimeter.java index d9769298ee..fa333d0c1a 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/AbstractOptimizationPerimeter.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/AbstractOptimizationPerimeter.java @@ -14,7 +14,6 @@ import com.powsybl.openrao.data.crac.api.rangeaction.RangeAction; import com.powsybl.openrao.data.crac.loopflowextension.LoopFlowThreshold; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; import com.powsybl.openrao.searchtreerao.result.api.RangeActionSetpointResult; import com.powsybl.iidm.network.Network; @@ -120,21 +119,21 @@ public Set> getRangeActions() { } public static Set getLoopFlowCnecs(Set flowCnecs, RaoParameters raoParameters, Network network) { - if (raoParameters.hasExtension(LoopFlowParametersExtension.class) - && !raoParameters.getExtension(LoopFlowParametersExtension.class).getCountries().isEmpty()) { - // loopFlow limited, and set of country for which loop-flow are monitored is defined - return flowCnecs.stream() - .filter(cnec -> !Objects.isNull(cnec.getExtension(LoopFlowThreshold.class)) && - cnec.getLocation(network).stream().anyMatch(country -> country.isPresent() && raoParameters.getExtension(LoopFlowParametersExtension.class).getCountries().contains(country.get()))) - .collect(Collectors.toSet()); - } else if (raoParameters.hasExtension(LoopFlowParametersExtension.class)) { - - // loopFlow limited, but no set of country defined - return flowCnecs.stream() - .filter(cnec -> !Objects.isNull(cnec.getExtension(LoopFlowThreshold.class))) - .collect(Collectors.toSet()); + Optional loopFlowParametersOptional = raoParameters.getLoopFlowParameters(); + if (loopFlowParametersOptional.isPresent()) { + if (!loopFlowParametersOptional.get().getCountries().isEmpty()) { + // loopFlow limited, and set of country for which loop-flow are monitored is defined + return flowCnecs.stream() + .filter(cnec -> !Objects.isNull(cnec.getExtension(LoopFlowThreshold.class)) && + cnec.getLocation(network).stream().anyMatch(country -> country.isPresent() && loopFlowParametersOptional.get().getCountries().contains(country.get()))) + .collect(Collectors.toSet()); + } else { + // loopFlow limited, but no set of country defined + return flowCnecs.stream() + .filter(cnec -> !Objects.isNull(cnec.getExtension(LoopFlowThreshold.class))) + .collect(Collectors.toSet()); + } } else { - //no loopFLow limitation return Collections.emptySet(); } diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/IteratingLinearOptimizer.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/IteratingLinearOptimizer.java index e3dbd850e7..2fa5fc04e3 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/IteratingLinearOptimizer.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/IteratingLinearOptimizer.java @@ -191,7 +191,7 @@ private static SensitivityComputer createSensitivityComputer(AppliedRemedialActi .withToolProvider(input.toolProvider()) .withOutageInstant(input.outageInstant()); - if (parameters.isRaoWithLoopFlowLimitation() && parameters.getLoopFlowParameters().getPtdfApproximation().shouldUpdatePtdfWithPstChange()) { + if (parameters.isRaoWithLoopFlowLimitation() && parameters.getLoopFlowParametersExtension().getPtdfApproximation().shouldUpdatePtdfWithPstChange()) { builder.withCommercialFlowsResults(input.toolProvider().getLoopFlowComputation(), input.optimizationPerimeter().getLoopFlowCnecs()); } else if (parameters.isRaoWithLoopFlowLimitation()) { builder.withCommercialFlowsResults(input.preOptimizationFlowResult()); diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxLoopFlowFiller.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxLoopFlowFiller.java index 07ca4c2555..218b151e61 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxLoopFlowFiller.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxLoopFlowFiller.java @@ -11,8 +11,9 @@ import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; import com.powsybl.iidm.network.TwoSides; import com.powsybl.openrao.data.crac.loopflowextension.LoopFlowThreshold; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; import com.powsybl.openrao.raoapi.parameters.extensions.PtdfApproximation; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoLoopFlowParameters; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPConstraint; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPVariable; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.LinearProblem; @@ -36,14 +37,14 @@ public class MaxLoopFlowFiller implements ProblemFiller { private final double loopFlowConstraintAdjustmentCoefficient; private FlowResult preOptimFlowResult; // = flow result used in the first "fill" iteration - public MaxLoopFlowFiller(Set loopFlowCnecs, FlowResult initialFlowResult, LoopFlowParametersExtension loopFlowParameters) { + public MaxLoopFlowFiller(Set loopFlowCnecs, FlowResult initialFlowResult, LoopFlowParameters loopFlowParameters, SearchTreeRaoLoopFlowParameters loopFlowParametersExtension) { this.loopFlowCnecs = new TreeSet<>(Comparator.comparing(Identifiable::getId)); this.loopFlowCnecs.addAll(FillersUtil.getFlowCnecsNotNaNFlow(loopFlowCnecs, initialFlowResult)); this.initialFlowResult = initialFlowResult; - this.loopFlowPtdfApproximationLevel = loopFlowParameters.getPtdfApproximation(); + this.loopFlowPtdfApproximationLevel = loopFlowParametersExtension.getPtdfApproximation(); this.loopFlowAcceptableAugmentation = loopFlowParameters.getAcceptableIncrease(); - this.loopFlowViolationCost = loopFlowParameters.getViolationCost(); - this.loopFlowConstraintAdjustmentCoefficient = loopFlowParameters.getConstraintAdjustmentCoefficient(); + this.loopFlowViolationCost = loopFlowParametersExtension.getViolationCost(); + this.loopFlowConstraintAdjustmentCoefficient = loopFlowParametersExtension.getConstraintAdjustmentCoefficient(); } private Set getValidLoopFlowCnecs(SensitivityResult sensitivityResult) { diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxMinRelativeMarginFiller.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxMinRelativeMarginFiller.java index f3fb1218f7..23281465d8 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxMinRelativeMarginFiller.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxMinRelativeMarginFiller.java @@ -11,7 +11,7 @@ import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; import com.powsybl.iidm.network.TwoSides; import com.powsybl.openrao.raoapi.parameters.extensions.PtdfApproximation; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; import com.powsybl.openrao.searchtreerao.commons.RaoUtil; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPConstraint; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPVariable; @@ -40,7 +40,7 @@ public class MaxMinRelativeMarginFiller extends MaxMinMarginFiller { public MaxMinRelativeMarginFiller(Set optimizedCnecs, FlowResult preOptimFlowResult, Unit unit, - RelativeMarginsParametersExtension maxMinRelativeMarginParameters) { + SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters) { super(optimizedCnecs, unit); this.preOptimFlowResult = preOptimFlowResult; this.ptdfApproximationLevel = maxMinRelativeMarginParameters.getPtdfApproximation(); diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MnecFiller.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MnecFiller.java index 65ea97a20e..d61204c07b 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MnecFiller.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MnecFiller.java @@ -9,7 +9,6 @@ import com.powsybl.openrao.commons.Unit; import com.powsybl.openrao.data.crac.api.Identifiable; import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; import com.powsybl.openrao.searchtreerao.commons.RaoUtil; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPConstraint; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPVariable; @@ -36,14 +35,14 @@ public class MnecFiller implements ProblemFiller { private final double mnecAcceptableMarginDecrease; private final double mnecConstraintAdjustmentCoefficient; - public MnecFiller(FlowResult initialFlowResult, Set monitoredCnecs, Unit unit, MnecParametersExtension mnecParameters) { + public MnecFiller(FlowResult initialFlowResult, Set monitoredCnecs, Unit unit, double mnecViolationCost, double mnecAcceptableMarginDecrease, double mnecConstraintAdjustmentCoefficient) { this.initialFlowResult = initialFlowResult; this.monitoredCnecs = new TreeSet<>(Comparator.comparing(Identifiable::getId)); this.monitoredCnecs.addAll(FillersUtil.getFlowCnecsNotNaNFlow(monitoredCnecs, initialFlowResult)); this.unit = unit; - this.mnecViolationCost = mnecParameters.getViolationCost(); - this.mnecAcceptableMarginDecrease = mnecParameters.getAcceptableMarginDecrease(); - this.mnecConstraintAdjustmentCoefficient = mnecParameters.getConstraintAdjustmentCoefficient(); + this.mnecViolationCost = mnecViolationCost; + this.mnecAcceptableMarginDecrease = mnecAcceptableMarginDecrease; + this.mnecConstraintAdjustmentCoefficient = mnecConstraintAdjustmentCoefficient; } @Override diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/linearproblem/LinearProblemBuilder.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/linearproblem/LinearProblemBuilder.java index bc1135a6ae..dbe33766f8 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/linearproblem/LinearProblemBuilder.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/linearproblem/LinearProblemBuilder.java @@ -152,7 +152,9 @@ private ProblemFiller buildMnecFiller() { inputs.initialFlowResult(), inputs.optimizationPerimeter().getMonitoredFlowCnecs(), parameters.getObjectiveFunctionUnit(), - parameters.getMnecParameters() + parameters.getMnecParametersExtension().getViolationCost(), + parameters.getMnecParameters().getAcceptableMarginDecrease(), + parameters.getMnecParametersExtension().getConstraintAdjustmentCoefficient() ); } @@ -160,7 +162,8 @@ private ProblemFiller buildLoopFlowFiller() { return new MaxLoopFlowFiller( inputs.optimizationPerimeter().getLoopFlowCnecs(), inputs.initialFlowResult(), - parameters.getLoopFlowParameters() + parameters.getLoopFlowParameters(), + parameters.getLoopFlowParametersExtension() ); } diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/parameters/IteratingLinearOptimizerParameters.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/parameters/IteratingLinearOptimizerParameters.java index b63e6a98f5..f899365407 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/parameters/IteratingLinearOptimizerParameters.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/linearoptimisation/parameters/IteratingLinearOptimizerParameters.java @@ -11,11 +11,13 @@ import com.powsybl.openrao.commons.Unit; import com.powsybl.openrao.raoapi.parameters.ObjectiveFunctionParameters; import com.powsybl.openrao.raoapi.parameters.RangeActionsOptimizationParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoLoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoMnecParameters; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters.LinearOptimizationSolver; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.MnecParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; import com.powsybl.openrao.searchtreerao.commons.parameters.*; /** @@ -28,9 +30,11 @@ public final class IteratingLinearOptimizerParameters { private final RangeActionsOptimizationParameters rangeActionParameters; private final SearchTreeRaoRangeActionsOptimizationParameters rangeActionParametersExtension; - private final MnecParametersExtension mnecParameters; - private final RelativeMarginsParametersExtension maxMinRelativeMarginParameters; - private final LoopFlowParametersExtension loopFlowParameters; + private final MnecParameters mnecParameters; + private final SearchTreeRaoMnecParameters mnecParametersExtension; + private final SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters; + private final LoopFlowParameters loopFlowParameters; + private final SearchTreeRaoLoopFlowParameters loopFlowParametersExtension; private final UnoptimizedCnecParameters unoptimizedCnecParameters; private final RangeActionLimitationParameters raLimitationParameters; private final LinearOptimizationSolver solverParameters; @@ -42,9 +46,11 @@ private IteratingLinearOptimizerParameters(ObjectiveFunctionParameters.Objective Unit objectiveFunctionUnit, RangeActionsOptimizationParameters rangeActionParameters, SearchTreeRaoRangeActionsOptimizationParameters rangeActionParametersExtension, - MnecParametersExtension mnecParameters, - RelativeMarginsParametersExtension maxMinRelativeMarginParameters, - LoopFlowParametersExtension loopFlowParameters, + MnecParameters mnecParameters, + SearchTreeRaoMnecParameters mnecParametersExtension, + SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters, + LoopFlowParameters loopFlowParameters, + SearchTreeRaoLoopFlowParameters loopFlowParametersExtension, UnoptimizedCnecParameters unoptimizedCnecParameters, RangeActionLimitationParameters raLimitationParameters, LinearOptimizationSolver solverParameters, @@ -55,8 +61,10 @@ private IteratingLinearOptimizerParameters(ObjectiveFunctionParameters.Objective this.rangeActionParameters = rangeActionParameters; this.rangeActionParametersExtension = rangeActionParametersExtension; this.mnecParameters = mnecParameters; + this.mnecParametersExtension = mnecParametersExtension; this.maxMinRelativeMarginParameters = maxMinRelativeMarginParameters; this.loopFlowParameters = loopFlowParameters; + this.loopFlowParametersExtension = loopFlowParametersExtension; this.unoptimizedCnecParameters = unoptimizedCnecParameters; this.raLimitationParameters = raLimitationParameters; this.solverParameters = solverParameters; @@ -82,11 +90,11 @@ public boolean hasOperatorsNotToOptimize() { } public boolean isRaoWithLoopFlowLimitation() { - return loopFlowParameters != null; + return loopFlowParameters != null && loopFlowParametersExtension != null; } public boolean isRaoWithMnecLimitation() { - return mnecParameters != null; + return mnecParameters != null && mnecParametersExtension != null; } public RangeActionsOptimizationParameters getRangeActionParameters() { @@ -97,18 +105,26 @@ public SearchTreeRaoRangeActionsOptimizationParameters getRangeActionParametersE return rangeActionParametersExtension; } - public MnecParametersExtension getMnecParameters() { + public MnecParameters getMnecParameters() { return mnecParameters; } - public RelativeMarginsParametersExtension getMaxMinRelativeMarginParameters() { + public SearchTreeRaoMnecParameters getMnecParametersExtension() { + return mnecParametersExtension; + } + + public SearchTreeRaoRelativeMarginsParameters getMaxMinRelativeMarginParameters() { return maxMinRelativeMarginParameters; } - public LoopFlowParametersExtension getLoopFlowParameters() { + public LoopFlowParameters getLoopFlowParameters() { return loopFlowParameters; } + public SearchTreeRaoLoopFlowParameters getLoopFlowParametersExtension() { + return loopFlowParametersExtension; + } + public UnoptimizedCnecParameters getUnoptimizedCnecParameters() { return unoptimizedCnecParameters; } @@ -140,9 +156,11 @@ public static class LinearOptimizerParametersBuilder { private RangeActionsOptimizationParameters rangeActionParameters; private SearchTreeRaoRangeActionsOptimizationParameters rangeActionParametersExtension; - private MnecParametersExtension mnecParameters; - private RelativeMarginsParametersExtension maxMinRelativeMarginParameters; - private LoopFlowParametersExtension loopFlowParameters; + private MnecParameters mnecParameters; + private SearchTreeRaoMnecParameters mnecParametersExtension; + private SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters; + private LoopFlowParameters loopFlowParameters; + private SearchTreeRaoLoopFlowParameters loopFlowParametersExtension; private UnoptimizedCnecParameters unoptimizedCnecParameters; private RangeActionLimitationParameters raLimitationParameters; private LinearOptimizationSolver solverParameters; @@ -169,21 +187,31 @@ public LinearOptimizerParametersBuilder withRangeActionParametersExtension(Searc return this; } - public LinearOptimizerParametersBuilder withMnecParameters(MnecParametersExtension mnecParameters) { + public LinearOptimizerParametersBuilder withMnecParameters(MnecParameters mnecParameters) { this.mnecParameters = mnecParameters; return this; } - public LinearOptimizerParametersBuilder withMaxMinRelativeMarginParameters(RelativeMarginsParametersExtension maxMinRelativeMarginParameters) { + public LinearOptimizerParametersBuilder withMnecParametersExtension(SearchTreeRaoMnecParameters mnecParametersExtension) { + this.mnecParametersExtension = mnecParametersExtension; + return this; + } + + public LinearOptimizerParametersBuilder withMaxMinRelativeMarginParameters(SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters) { this.maxMinRelativeMarginParameters = maxMinRelativeMarginParameters; return this; } - public LinearOptimizerParametersBuilder withLoopFlowParameters(LoopFlowParametersExtension loopFlowParameters) { + public LinearOptimizerParametersBuilder withLoopFlowParameters(LoopFlowParameters loopFlowParameters) { this.loopFlowParameters = loopFlowParameters; return this; } + public LinearOptimizerParametersBuilder withLoopFlowParametersExtension(SearchTreeRaoLoopFlowParameters loopFlowParametersExtension) { + this.loopFlowParametersExtension = loopFlowParametersExtension; + return this; + } + public LinearOptimizerParametersBuilder withUnoptimizedCnecParameters(UnoptimizedCnecParameters unoptimizedCnecParameters) { this.unoptimizedCnecParameters = unoptimizedCnecParameters; return this; @@ -220,8 +248,10 @@ public IteratingLinearOptimizerParameters build() { rangeActionParameters, rangeActionParametersExtension, mnecParameters, + mnecParametersExtension, maxMinRelativeMarginParameters, loopFlowParameters, + loopFlowParametersExtension, unoptimizedCnecParameters, raLimitationParameters, solverParameters, diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/Leaf.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/Leaf.java index b195b33004..2df78c5c2d 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/Leaf.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/Leaf.java @@ -217,8 +217,10 @@ void optimize(SearchTreeInput searchTreeInput, SearchTreeParameters parameters) .withRangeActionParameters(parameters.getRangeActionParameters()) .withRangeActionParametersExtension(parameters.getRangeActionParametersExtension()) .withMnecParameters(parameters.getMnecParameters()) + .withMnecParametersExtension(parameters.getMnecParametersExtension()) .withMaxMinRelativeMarginParameters(parameters.getMaxMinRelativeMarginParameters()) .withLoopFlowParameters(parameters.getLoopFlowParameters()) + .withLoopFlowParametersExtension(parameters.getLoopFlowParametersExtension()) .withUnoptimizedCnecParameters(parameters.getUnoptimizedCnecParameters()) .withRaLimitationParameters(getRaLimitationParameters(searchTreeInput.getOptimizationPerimeter(), parameters)) .withSolverParameters(parameters.getSolverParameters()) diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/SearchTree.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/SearchTree.java index ccb0912226..a7af7fc5ad 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/SearchTree.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/algorithms/SearchTree.java @@ -385,10 +385,12 @@ private SensitivityComputer getSensitivityComputerForEvaluation(boolean isRootLe } } - if (parameters.getLoopFlowParameters() != null && parameters.getLoopFlowParameters().getPtdfApproximation().shouldUpdatePtdfWithTopologicalChange()) { - sensitivityComputerBuilder.withCommercialFlowsResults(input.getToolProvider().getLoopFlowComputation(), input.getOptimizationPerimeter().getLoopFlowCnecs()); - } else if (parameters.getLoopFlowParameters() != null) { - sensitivityComputerBuilder.withCommercialFlowsResults(input.getInitialFlowResult()); + if (parameters.getLoopFlowParametersExtension() != null) { + if (parameters.getLoopFlowParametersExtension().getPtdfApproximation().shouldUpdatePtdfWithTopologicalChange()) { + sensitivityComputerBuilder.withCommercialFlowsResults(input.getToolProvider().getLoopFlowComputation(), input.getOptimizationPerimeter().getLoopFlowCnecs()); + } else { + sensitivityComputerBuilder.withCommercialFlowsResults(input.getInitialFlowResult()); + } } return sensitivityComputerBuilder.build(); diff --git a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/parameters/SearchTreeParameters.java b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/parameters/SearchTreeParameters.java index 5b8e11ee73..2b215acd22 100644 --- a/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/parameters/SearchTreeParameters.java +++ b/ra-optimisation/search-tree-rao/src/main/java/com/powsybl/openrao/searchtreerao/searchtree/parameters/SearchTreeParameters.java @@ -18,6 +18,9 @@ import com.powsybl.openrao.raoapi.parameters.extensions.*; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters.LinearOptimizationSolver; import com.powsybl.openrao.raoapi.parameters.RaoParameters; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.MnecParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; import com.powsybl.openrao.searchtreerao.commons.parameters.*; import com.powsybl.openrao.searchtreerao.result.api.OptimizationResult; import com.powsybl.openrao.searchtreerao.result.api.PrePerimeterResult; @@ -47,9 +50,13 @@ public class SearchTreeParameters { private final RangeActionsOptimizationParameters rangeActionParameters; private final SearchTreeRaoRangeActionsOptimizationParameters rangeActionParametersExtension; - private final MnecParametersExtension mnecParameters; - private final RelativeMarginsParametersExtension maxMinRelativeMarginParameters; - private final LoopFlowParametersExtension loopFlowParameters; + private final MnecParameters mnecParameters; + private final SearchTreeRaoMnecParameters mnecParametersExtension; + + private final SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters; + private final LoopFlowParameters loopFlowParameters; + private final SearchTreeRaoLoopFlowParameters loopFlowParametersExtension; + private final UnoptimizedCnecParameters unoptimizedCnecParameters; private final LinearOptimizationSolver solverParameters; private final int maxNumberOfIterations; @@ -60,9 +67,11 @@ public SearchTreeParameters(ObjectiveFunctionParameters.ObjectiveFunctionType ob Map raLimitationParameters, RangeActionsOptimizationParameters rangeActionParameters, SearchTreeRaoRangeActionsOptimizationParameters rangeActionParametersExtension, - MnecParametersExtension mnecParameters, - RelativeMarginsParametersExtension maxMinRelativeMarginParameters, - LoopFlowParametersExtension loopFlowParameters, + MnecParameters mnecParameters, + SearchTreeRaoMnecParameters mnecParametersExtension, + SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters, + LoopFlowParameters loopFlowParameters, + SearchTreeRaoLoopFlowParameters loopFlowParametersExtension, UnoptimizedCnecParameters unoptimizedCnecParameters, LinearOptimizationSolver solverParameters, int maxNumberOfIterations) { @@ -74,8 +83,10 @@ public SearchTreeParameters(ObjectiveFunctionParameters.ObjectiveFunctionType ob this.rangeActionParameters = rangeActionParameters; this.rangeActionParametersExtension = rangeActionParametersExtension; this.mnecParameters = mnecParameters; + this.mnecParametersExtension = mnecParametersExtension; this.maxMinRelativeMarginParameters = maxMinRelativeMarginParameters; this.loopFlowParameters = loopFlowParameters; + this.loopFlowParametersExtension = loopFlowParametersExtension; this.unoptimizedCnecParameters = unoptimizedCnecParameters; this.solverParameters = solverParameters; this.maxNumberOfIterations = maxNumberOfIterations; @@ -109,18 +120,26 @@ public SearchTreeRaoRangeActionsOptimizationParameters getRangeActionParametersE return rangeActionParametersExtension; } - public MnecParametersExtension getMnecParameters() { + public MnecParameters getMnecParameters() { return mnecParameters; } - public RelativeMarginsParametersExtension getMaxMinRelativeMarginParameters() { + public SearchTreeRaoMnecParameters getMnecParametersExtension() { + return mnecParametersExtension; + } + + public SearchTreeRaoRelativeMarginsParameters getMaxMinRelativeMarginParameters() { return maxMinRelativeMarginParameters; } - public LoopFlowParametersExtension getLoopFlowParameters() { + public LoopFlowParameters getLoopFlowParameters() { return loopFlowParameters; } + public SearchTreeRaoLoopFlowParameters getLoopFlowParametersExtension() { + return loopFlowParametersExtension; + } + public UnoptimizedCnecParameters getUnoptimizedCnecParameters() { return unoptimizedCnecParameters; } @@ -259,9 +278,12 @@ public static class SearchTreeParametersBuilder { private Map raLimitationParameters; private RangeActionsOptimizationParameters rangeActionParameters; private SearchTreeRaoRangeActionsOptimizationParameters rangeActionParametersExtension; - private MnecParametersExtension mnecParameters; - private RelativeMarginsParametersExtension maxMinRelativeMarginParameters; - private LoopFlowParametersExtension loopFlowParameters; + private MnecParameters mnecParameters; + private SearchTreeRaoMnecParameters mnecParametersExtension; + + private SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters; + private LoopFlowParameters loopFlowParameters; + private SearchTreeRaoLoopFlowParameters loopFlowParametersExtension; private UnoptimizedCnecParameters unoptimizedCnecParameters; private LinearOptimizationSolver solverParameters; private int maxNumberOfIterations; @@ -275,9 +297,17 @@ public SearchTreeParametersBuilder withConstantParametersOverAllRao(RaoParameter if (raoParameters.hasExtension(OpenRaoSearchTreeParameters.class)) { this.rangeActionParametersExtension = raoParameters.getExtension(OpenRaoSearchTreeParameters.class).getRangeActionsOptimizationParameters(); } - this.mnecParameters = raoParameters.getExtension(MnecParametersExtension.class); - this.maxMinRelativeMarginParameters = raoParameters.getExtension(RelativeMarginsParametersExtension.class); - this.loopFlowParameters = raoParameters.getExtension(LoopFlowParametersExtension.class); + this.mnecParameters = raoParameters.getMnecParameters().orElse(null); + if (raoParameters.hasExtension(OpenRaoSearchTreeParameters.class)) { + this.mnecParametersExtension = raoParameters.getExtension(OpenRaoSearchTreeParameters.class).getMnecParameters().orElse(null); + } + if (raoParameters.hasExtension(OpenRaoSearchTreeParameters.class)) { + this.maxMinRelativeMarginParameters = raoParameters.getExtension(OpenRaoSearchTreeParameters.class).getRelativeMarginsParameters().orElse(null); + } + this.loopFlowParameters = raoParameters.getLoopFlowParameters().orElse(null); + if (raoParameters.hasExtension(OpenRaoSearchTreeParameters.class)) { + this.loopFlowParametersExtension = raoParameters.getExtension(OpenRaoSearchTreeParameters.class).getLoopFlowParameters().orElse(null); + } this.solverParameters = getLinearOptimizationSolver(raoParameters); this.maxNumberOfIterations = getMaxMipIterations(raoParameters); return this; @@ -318,17 +348,17 @@ public SearchTreeParametersBuilder withRangeActionParametersExtension(SearchTree return this; } - public SearchTreeParametersBuilder withMnecParameters(MnecParametersExtension mnecParameters) { + public SearchTreeParametersBuilder withMnecParameters(MnecParameters mnecParameters) { this.mnecParameters = mnecParameters; return this; } - public SearchTreeParametersBuilder withMaxMinRelativeMarginParameters(RelativeMarginsParametersExtension maxMinRelativeMarginParameters) { + public SearchTreeParametersBuilder withMaxMinRelativeMarginParameters(SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters) { this.maxMinRelativeMarginParameters = maxMinRelativeMarginParameters; return this; } - public SearchTreeParametersBuilder withLoopFlowParameters(LoopFlowParametersExtension loopFlowParameters) { + public SearchTreeParametersBuilder withLoopFlowParameters(LoopFlowParameters loopFlowParameters) { this.loopFlowParameters = loopFlowParameters; return this; } @@ -358,8 +388,10 @@ public SearchTreeParameters build() { rangeActionParameters, rangeActionParametersExtension, mnecParameters, + mnecParametersExtension, maxMinRelativeMarginParameters, loopFlowParameters, + loopFlowParametersExtension, unoptimizedCnecParameters, solverParameters, maxNumberOfIterations); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/castor/algorithm/PrePerimeterSensitivityAnalysisTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/castor/algorithm/PrePerimeterSensitivityAnalysisTest.java index c4ec3bc7c1..32a2745588 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/castor/algorithm/PrePerimeterSensitivityAnalysisTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/castor/algorithm/PrePerimeterSensitivityAnalysisTest.java @@ -17,9 +17,11 @@ import com.powsybl.openrao.loopflowcomputation.LoopFlowResult; import com.powsybl.openrao.raoapi.parameters.ObjectiveFunctionParameters; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; import com.powsybl.openrao.raoapi.parameters.extensions.PtdfApproximation; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoLoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; import com.powsybl.openrao.searchtreerao.commons.AbsolutePtdfSumsComputation; import com.powsybl.openrao.searchtreerao.commons.ToolProvider; import com.powsybl.openrao.searchtreerao.result.api.OptimizationResult; @@ -118,10 +120,7 @@ void testRunWithPtdf() { @Test void testRunWithLf() { - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); - raoParameters.getExtension(LoopFlowParametersExtension.class).setPtdfApproximation(PtdfApproximation.FIXED_PTDF); - raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_MARGIN); - raoParameters.getObjectiveFunctionParameters().setUnit(Unit.AMPERE); + raoParameters.setLoopFlowParameters(new LoopFlowParameters()); mockSystematicSensitivityInterface(false, true); PrePerimeterResult result = prePerimeterSensitivityAnalysis.runInitialSensitivityAnalysis(network, crac); @@ -130,10 +129,8 @@ void testRunWithLf() { @Test void testRunWithPtdfAndLf() { - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); - raoParameters.getExtension(LoopFlowParametersExtension.class).setPtdfApproximation(PtdfApproximation.FIXED_PTDF); + raoParameters.setLoopFlowParameters(new LoopFlowParameters()); raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN); - raoParameters.getObjectiveFunctionParameters().setUnit(Unit.AMPERE); mockSystematicSensitivityInterface(true, true); PrePerimeterResult result = prePerimeterSensitivityAnalysis.runInitialSensitivityAnalysis(network, crac); @@ -142,10 +139,14 @@ void testRunWithPtdfAndLf() { @Test void testRunWithFixedPtdfAndLf() { - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); - raoParameters.getExtension(LoopFlowParametersExtension.class).setPtdfApproximation(PtdfApproximation.FIXED_PTDF); - raoParameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); - raoParameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfApproximation(PtdfApproximation.FIXED_PTDF); + OpenRaoSearchTreeParameters searchTreeParameters = new OpenRaoSearchTreeParameters(); + raoParameters.addExtension(OpenRaoSearchTreeParameters.class, searchTreeParameters); + SearchTreeRaoLoopFlowParameters loopFlowParameters = new SearchTreeRaoLoopFlowParameters(); + searchTreeParameters.setLoopFlowParameters(loopFlowParameters); + loopFlowParameters.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); + SearchTreeRaoRelativeMarginsParameters relativeMarginsParameters = new SearchTreeRaoRelativeMarginsParameters(); + searchTreeParameters.setRelativeMarginsParameters(relativeMarginsParameters); + relativeMarginsParameters.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN); raoParameters.getObjectiveFunctionParameters().setUnit(Unit.AMPERE); mockSystematicSensitivityInterface(false, false); @@ -158,10 +159,14 @@ void testRunWithFixedPtdfAndLf() { @Test void testRunAndRecomputePtdf() { - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); - raoParameters.getExtension(LoopFlowParametersExtension.class).setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO); - raoParameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); - raoParameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO); + OpenRaoSearchTreeParameters searchTreeParameters = new OpenRaoSearchTreeParameters(); + raoParameters.addExtension(OpenRaoSearchTreeParameters.class, searchTreeParameters); + SearchTreeRaoLoopFlowParameters loopFlowParameters = new SearchTreeRaoLoopFlowParameters(); + searchTreeParameters.setLoopFlowParameters(loopFlowParameters); + loopFlowParameters.setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO); + SearchTreeRaoRelativeMarginsParameters relativeMarginsParameters = new SearchTreeRaoRelativeMarginsParameters(); + searchTreeParameters.setRelativeMarginsParameters(relativeMarginsParameters); + relativeMarginsParameters.setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO); raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN); raoParameters.getObjectiveFunctionParameters().setUnit(Unit.AMPERE); mockSystematicSensitivityInterface(true, true); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/RaoUtilTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/RaoUtilTest.java index 72970fa064..20d48a9a68 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/RaoUtilTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/RaoUtilTest.java @@ -27,7 +27,7 @@ import com.powsybl.openrao.raoapi.parameters.RaoParameters; import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters; import com.powsybl.openrao.searchtreerao.result.api.FlowResult; import com.powsybl.openrao.searchtreerao.result.api.PrePerimeterResult; import com.powsybl.glsk.commons.ZonalData; @@ -85,8 +85,9 @@ private void addGlskProvider() { @Test void testExceptionForGlskOnRelativeMargin() { - raoParameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); - raoParameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfBoundariesFromString(new ArrayList<>(Arrays.asList("{FR}-{ES}", "{ES}-{PT}"))); + RelativeMarginsParameters relativeMarginsParameters = new RelativeMarginsParameters(); + raoParameters.setRelativeMarginsParameters(relativeMarginsParameters); + relativeMarginsParameters.setPtdfBoundariesFromString(new ArrayList<>(Arrays.asList("{FR}-{ES}", "{ES}-{PT}"))); raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN); OpenRaoException exception = assertThrows(OpenRaoException.class, () -> RaoUtil.checkParameters(raoParameters, raoInput)); assertEquals("Objective function MAX_MIN_RELATIVE_MARGIN requires glsks", exception.getMessage()); @@ -103,7 +104,6 @@ void testExceptionForNoRelativeMarginParametersOnRelativeMargin() { @Test void testExceptionForNullBoundariesOnRelativeMargin() { addGlskProvider(); - raoParameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN); OpenRaoException exception = assertThrows(OpenRaoException.class, () -> RaoUtil.checkParameters(raoParameters, raoInput)); assertEquals("Objective function MAX_MIN_RELATIVE_MARGIN requires a config with a non empty boundary set", exception.getMessage()); @@ -112,8 +112,9 @@ void testExceptionForNullBoundariesOnRelativeMargin() { @Test void testExceptionForEmptyBoundariesOnRelativeMargin() { addGlskProvider(); - raoParameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); - raoParameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfBoundariesFromString(new ArrayList<>()); + RelativeMarginsParameters relativeMarginsParameters = new RelativeMarginsParameters(); + raoParameters.setRelativeMarginsParameters(relativeMarginsParameters); + relativeMarginsParameters.setPtdfBoundariesFromString(new ArrayList<>()); raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN); OpenRaoException exception = assertThrows(OpenRaoException.class, () -> RaoUtil.checkParameters(raoParameters, raoInput)); assertEquals("Objective function MAX_MIN_RELATIVE_MARGIN requires a config with a non empty boundary set", exception.getMessage()); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/ToolProviderTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/ToolProviderTest.java index 89d15ec516..16bf5f9991 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/ToolProviderTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/ToolProviderTest.java @@ -10,8 +10,8 @@ import com.powsybl.openrao.commons.EICode; import com.powsybl.openrao.data.crac.api.Instant; import com.powsybl.openrao.data.crac.api.State; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.RelativeMarginsParameters; import com.powsybl.glsk.commons.ZonalData; import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; import com.powsybl.openrao.data.crac.api.rangeaction.RangeAction; @@ -88,8 +88,9 @@ void testCnecInCountry() { @Test void testGetEicForObjectiveFunction() { - raoParameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); - raoParameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfBoundariesFromString( + RelativeMarginsParameters relativeMarginsParameters = new RelativeMarginsParameters(); + raoParameters.setRelativeMarginsParameters(relativeMarginsParameters); + relativeMarginsParameters.setPtdfBoundariesFromString( List.of("{FR}-{BE}", "{ES}-{FR}") ); ToolProvider toolProvider = ToolProvider.create() @@ -152,8 +153,9 @@ void testGetLoopFlowCnecs() { assertEquals(Set.of(cnec1), toolProvider.getLoopFlowCnecs(Set.of(cnec1))); assertEquals(Set.of(cnec2), toolProvider.getLoopFlowCnecs(Set.of(cnec2))); - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); - raoParameters.getExtension(LoopFlowParametersExtension.class).setCountries(List.of("FR")); + LoopFlowParameters loopFlowParameters = new LoopFlowParameters(); + raoParameters.setLoopFlowParameters(loopFlowParameters); + loopFlowParameters.setCountries(List.of("FR")); assertEquals(Set.of(cnec1), toolProvider.getLoopFlowCnecs(Set.of(cnec1, cnec2))); } diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunction/ObjectiveFunctionTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunction/ObjectiveFunctionTest.java index 6d9448c50c..97ec3a8268 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunction/ObjectiveFunctionTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunction/ObjectiveFunctionTest.java @@ -12,11 +12,13 @@ import com.powsybl.openrao.data.crac.api.State; import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; import com.powsybl.openrao.data.crac.loopflowextension.LoopFlowThreshold; +import com.powsybl.openrao.raoapi.parameters.MnecParameters; import com.powsybl.openrao.raoapi.parameters.ObjectiveFunctionParameters; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; 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.searchtreerao.result.api.*; import com.powsybl.openrao.searchtreerao.result.impl.RangeActionSetpointResultImpl; import com.powsybl.openrao.searchtreerao.result.impl.RemedialActionActivationResultImpl; @@ -85,10 +87,14 @@ void testWithFunctionalAndVirtualCost() { OpenRaoSearchTreeParameters openRaoSearchTreeParameters = new OpenRaoSearchTreeParameters(); openRaoSearchTreeParameters.getLoadFlowAndSensitivityParameters().setSensitivityFailureOvercost(0.0); raoParameters.addExtension(OpenRaoSearchTreeParameters.class, openRaoSearchTreeParameters); - raoParameters.addExtension(MnecParametersExtension.class, new MnecParametersExtension()); - raoParameters.getExtension(MnecParametersExtension.class).setAcceptableMarginDecrease(200.0); - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); - raoParameters.getExtension(LoopFlowParametersExtension.class).setViolationCost(10.0); + MnecParameters mnecParameters = new MnecParameters(); + mnecParameters.setAcceptableMarginDecrease(200.0); + raoParameters.setMnecParameters(mnecParameters); + openRaoSearchTreeParameters.setMnecParameters(new SearchTreeRaoMnecParameters()); + raoParameters.setLoopFlowParameters(new LoopFlowParameters()); + SearchTreeRaoLoopFlowParameters loopFlowParameters = new SearchTreeRaoLoopFlowParameters(); + loopFlowParameters.setViolationCost(10.); + openRaoSearchTreeParameters.setLoopFlowParameters(loopFlowParameters); FlowResult initialFlowResult = Mockito.mock(FlowResult.class); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/LoopFlowViolationCostEvaluatorTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/LoopFlowViolationCostEvaluatorTest.java index 07425a0daa..bea8678608 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/LoopFlowViolationCostEvaluatorTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/LoopFlowViolationCostEvaluatorTest.java @@ -11,7 +11,8 @@ import com.powsybl.openrao.data.crac.api.State; import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; import com.powsybl.openrao.data.crac.loopflowextension.LoopFlowThreshold; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoLoopFlowParameters; import com.powsybl.openrao.searchtreerao.result.api.FlowResult; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -35,7 +36,9 @@ class LoopFlowViolationCostEvaluatorTest { private FlowCnec cnec2; private FlowResult initialLoopFlows; private FlowResult currentLoopFlows; - private LoopFlowParametersExtension parameters; + private LoopFlowParameters parameters; + private SearchTreeRaoLoopFlowParameters parametersExtension; + private LoopFlowViolationCostEvaluator evaluator; @BeforeEach @@ -56,7 +59,8 @@ public void setUp() { initialLoopFlows = Mockito.mock(FlowResult.class); currentLoopFlows = Mockito.mock(FlowResult.class); - parameters = Mockito.mock(LoopFlowParametersExtension.class); + parameters = Mockito.mock(LoopFlowParameters.class); + parametersExtension = Mockito.mock(SearchTreeRaoLoopFlowParameters.class); } private void setInputThresholdWithReliabilityMargin(FlowCnec branchCnec, double inputThresholdWIthReliabilityMargin) { @@ -77,11 +81,11 @@ private void setAcceptableAugmentationInMW(double acceptableAugmentationInMW) { } private void setViolationCost(double violationCost) { - when(parameters.getViolationCost()).thenReturn(violationCost); + when(parametersExtension.getViolationCost()).thenReturn(violationCost); } private void buildLoopFlowViolationCostEvaluator() { - evaluator = new LoopFlowViolationCostEvaluator(Set.of(cnec1, cnec2), initialLoopFlows, parameters); + evaluator = new LoopFlowViolationCostEvaluator(Set.of(cnec1, cnec2), initialLoopFlows, parameters.getAcceptableIncrease(), parametersExtension.getViolationCost()); } @Test diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/MnecViolationCostEvaluatorTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/MnecViolationCostEvaluatorTest.java index 105218b749..ca3817db8a 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/MnecViolationCostEvaluatorTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/objectivefunctionevaluator/MnecViolationCostEvaluatorTest.java @@ -9,7 +9,6 @@ import com.powsybl.openrao.commons.Unit; import com.powsybl.openrao.data.crac.api.State; import com.powsybl.openrao.data.crac.api.cnec.FlowCnec; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; import com.powsybl.openrao.searchtreerao.result.api.FlowResult; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -57,27 +56,17 @@ public void setUp() { initialFlowResult = Mockito.mock(FlowResult.class); currentFlowResult = Mockito.mock(FlowResult.class); - MnecParametersExtension mnecExtension1 = new MnecParametersExtension(); - mnecExtension1.setAcceptableMarginDecrease(50); - mnecExtension1.setViolationCost(10); - mnecExtension1.setConstraintAdjustmentCoefficient(1); - - MnecParametersExtension mnecExtension2 = new MnecParametersExtension(); - mnecExtension2.setAcceptableMarginDecrease(20); - mnecExtension2.setViolationCost(2); - mnecExtension2.setConstraintAdjustmentCoefficient(1); - evaluator1 = new MnecViolationCostEvaluator( Set.of(mnec1, pureCnec), Unit.MEGAWATT, initialFlowResult, - mnecExtension1 + 50, 10 ); evaluator2 = new MnecViolationCostEvaluator( Set.of(mnec1, pureCnec), Unit.MEGAWATT, initialFlowResult, - mnecExtension2 + 20, 2 ); } @@ -87,16 +76,11 @@ private MnecViolationCostEvaluator createEvaluatorWithCosts(double violationCost when(initialFlowResult.getMargin(mnec2, unit)).thenReturn(-200.); when(currentFlowResult.getMargin(mnec2, unit)).thenReturn(-400.); - MnecParametersExtension mnec = new MnecParametersExtension(); - mnec.setAcceptableMarginDecrease(50); - mnec.setViolationCost(violationCost); - mnec.setConstraintAdjustmentCoefficient(1); - return new MnecViolationCostEvaluator( Set.of(mnec1, mnec2, pureCnec), unit, initialFlowResult, - mnec + 50, violationCost ); } diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/CurativeOptimizationPerimeterTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/CurativeOptimizationPerimeterTest.java index e742033b05..8432cce54c 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/CurativeOptimizationPerimeterTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/CurativeOptimizationPerimeterTest.java @@ -7,7 +7,6 @@ package com.powsybl.openrao.searchtreerao.commons.optimizationperimeters; import com.powsybl.openrao.commons.OpenRaoException; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -29,7 +28,6 @@ public void setUp() { @Test void curativePerimeterTest() { - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); Mockito.when(prePerimeterResult.getSetpoint(cRA)).thenReturn(500.); OptimizationPerimeter optPerimeter = CurativeOptimizationPerimeter.build(cState1, crac, network, raoParameters, prePerimeterResult); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/GlobalOptimizationPerimeterTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/GlobalOptimizationPerimeterTest.java index c5afea4a14..76938ece4e 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/GlobalOptimizationPerimeterTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/GlobalOptimizationPerimeterTest.java @@ -6,7 +6,7 @@ */ package com.powsybl.openrao.searchtreerao.commons.optimizationperimeters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -29,7 +29,7 @@ public void setUp() { @Test void globalOptimizationPerimeterTest() { - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); + raoParameters.setLoopFlowParameters(new LoopFlowParameters()); Mockito.when(prePerimeterResult.getSetpoint(pRA)).thenReturn(-500.); Mockito.when(prePerimeterResult.getSetpoint(cRA)).thenReturn(-500.); GlobalOptimizationPerimeter optPerimeter = GlobalOptimizationPerimeter.build(crac, network, raoParameters, prePerimeterResult); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/PreventiveOptimizationPerimeterTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/PreventiveOptimizationPerimeterTest.java index 75f1c6ff71..ba1f54dd50 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/PreventiveOptimizationPerimeterTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/commons/optimizationperimeters/PreventiveOptimizationPerimeterTest.java @@ -7,7 +7,7 @@ package com.powsybl.openrao.searchtreerao.commons.optimizationperimeters; import com.powsybl.openrao.data.raoresult.api.ComputationStatus; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; import com.powsybl.openrao.searchtreerao.castor.algorithm.Perimeter; import com.powsybl.iidm.network.Country; import org.junit.jupiter.api.BeforeEach; @@ -56,7 +56,7 @@ void fullPreventivePerimeter1Test() { @Test void fullPreventivePerimeter2Test() { - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); + raoParameters.setLoopFlowParameters(new LoopFlowParameters()); Mockito.when(prePerimeterResult.getSetpoint(pRA)).thenReturn(10000.); Mockito.when(prePerimeterResult.getSensitivityStatus(Mockito.any())).thenReturn(ComputationStatus.DEFAULT); Perimeter preventivePerimeter = new Perimeter(pState, Set.of(oState1, oState2, cState2)); @@ -69,8 +69,9 @@ void fullPreventivePerimeter2Test() { @Test void fullPreventivePerimeter3Test() { - raoParameters.addExtension(LoopFlowParametersExtension.class, new LoopFlowParametersExtension()); - raoParameters.getExtension(LoopFlowParametersExtension.class).setCountries(Set.of(Country.BE)); + LoopFlowParameters loopFlowParameters = new LoopFlowParameters(); + loopFlowParameters.setCountries(Set.of(Country.BE)); + raoParameters.setLoopFlowParameters(loopFlowParameters); Mockito.when(prePerimeterResult.getSensitivityStatus(Mockito.any())).thenReturn(ComputationStatus.DEFAULT); Perimeter preventivePerimeter = new Perimeter(pState, Set.of(oState1, oState2, cState2)); OptimizationPerimeter optPerimeter = PreventiveOptimizationPerimeter.buildFromBasecaseScenario(preventivePerimeter, crac, network, raoParameters, prePerimeterResult); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/LinearProblemBuilderTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/LinearProblemBuilderTest.java index 694ace9f0a..1320bb0521 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/LinearProblemBuilderTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/LinearProblemBuilderTest.java @@ -10,10 +10,12 @@ import com.powsybl.openrao.commons.Unit; import com.powsybl.openrao.data.crac.api.State; import com.powsybl.openrao.raoapi.parameters.ObjectiveFunctionParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoLoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoMnecParameters; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.MnecParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; import com.powsybl.openrao.searchtreerao.commons.optimizationperimeters.CurativeOptimizationPerimeter; import com.powsybl.openrao.searchtreerao.commons.optimizationperimeters.OptimizationPerimeter; import com.powsybl.openrao.searchtreerao.commons.parameters.RangeActionLimitationParameters; @@ -58,12 +60,16 @@ public void setup() { when(parameters.getRangeActionParameters()).thenReturn(rangeActionParameters); rangeActionParametersExtension = Mockito.mock(SearchTreeRaoRangeActionsOptimizationParameters.class); when(parameters.getRangeActionParametersExtension()).thenReturn(rangeActionParametersExtension); - RelativeMarginsParametersExtension relativeMarginParameters = Mockito.mock(RelativeMarginsParametersExtension.class); + SearchTreeRaoRelativeMarginsParameters relativeMarginParameters = Mockito.mock(SearchTreeRaoRelativeMarginsParameters.class); when(parameters.getMaxMinRelativeMarginParameters()).thenReturn(relativeMarginParameters); - MnecParametersExtension mnecParameters = Mockito.mock(MnecParametersExtension.class); + MnecParameters mnecParameters = Mockito.mock(MnecParameters.class); when(parameters.getMnecParameters()).thenReturn(mnecParameters); - LoopFlowParametersExtension loopFlowParameters = Mockito.mock(LoopFlowParametersExtension.class); + SearchTreeRaoMnecParameters mnecParametersExtension = Mockito.mock(SearchTreeRaoMnecParameters.class); + when(parameters.getMnecParametersExtension()).thenReturn(mnecParametersExtension); + LoopFlowParameters loopFlowParameters = Mockito.mock(LoopFlowParameters.class); when(parameters.getLoopFlowParameters()).thenReturn(loopFlowParameters); + SearchTreeRaoLoopFlowParameters loopFlowParametersExtension = Mockito.mock(SearchTreeRaoLoopFlowParameters.class); + when(parameters.getLoopFlowParametersExtension()).thenReturn(loopFlowParametersExtension); optimizationPerimeter = Mockito.mock(CurativeOptimizationPerimeter.class); when(inputs.optimizationPerimeter()).thenReturn(optimizationPerimeter); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxLoopFlowFillerTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxLoopFlowFillerTest.java index 4e3c450fc6..340a99fd9c 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxLoopFlowFillerTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxLoopFlowFillerTest.java @@ -15,8 +15,9 @@ import com.powsybl.openrao.data.crac.api.rangeaction.RangeAction; import com.powsybl.openrao.data.crac.loopflowextension.LoopFlowThresholdAdder; import com.powsybl.openrao.raoapi.parameters.RaoParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoLoopFlowParameters; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; import com.powsybl.openrao.raoapi.parameters.extensions.PtdfApproximation; import com.powsybl.openrao.searchtreerao.commons.optimizationperimeters.OptimizationPerimeter; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPConstraint; @@ -47,7 +48,8 @@ class MaxLoopFlowFillerTest extends AbstractFillerTest { private LinearProblem linearProblem; private CoreProblemFiller coreProblemFiller; private MaxLoopFlowFiller maxLoopFlowFiller; - private LoopFlowParametersExtension loopFlowParameters; + private LoopFlowParameters loopFlowParameters; + private SearchTreeRaoLoopFlowParameters loopFlowParametersExtension; private FlowCnec cnecOn2sides; @BeforeEach @@ -90,7 +92,8 @@ private void createMaxLoopFlowFiller(double initialLoopFlowValue) { maxLoopFlowFiller = new MaxLoopFlowFiller( Set.of(cnec1), initialFlowResult, - loopFlowParameters + loopFlowParameters, + loopFlowParametersExtension ); } @@ -114,11 +117,12 @@ private void updateLinearProblem() { @Test void testFill1() { - loopFlowParameters = new LoopFlowParametersExtension(); - loopFlowParameters.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); + loopFlowParameters = new LoopFlowParameters(); + loopFlowParametersExtension = new SearchTreeRaoLoopFlowParameters(); + loopFlowParametersExtension.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); loopFlowParameters.setAcceptableIncrease(13); - loopFlowParameters.setViolationCost(10); - loopFlowParameters.setConstraintAdjustmentCoefficient(5); + loopFlowParametersExtension.setViolationCost(10); + loopFlowParametersExtension.setConstraintAdjustmentCoefficient(5); createMaxLoopFlowFiller(0); setCommercialFlowValue(49); @@ -144,11 +148,12 @@ void testFill1() { @Test void testFill2() { - loopFlowParameters = new LoopFlowParametersExtension(); - loopFlowParameters.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); + loopFlowParameters = new LoopFlowParameters(); + loopFlowParametersExtension = new SearchTreeRaoLoopFlowParameters(); + loopFlowParametersExtension.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); loopFlowParameters.setAcceptableIncrease(30); - loopFlowParameters.setViolationCost(10); - loopFlowParameters.setConstraintAdjustmentCoefficient(5); + loopFlowParametersExtension.setViolationCost(10); + loopFlowParametersExtension.setConstraintAdjustmentCoefficient(5); createMaxLoopFlowFiller(80); setCommercialFlowValue(49); @@ -171,11 +176,12 @@ void testFill2() { @Test void testShouldUpdate() { - loopFlowParameters = new LoopFlowParametersExtension(); - loopFlowParameters.setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO_AND_PST); + loopFlowParameters = new LoopFlowParameters(); + loopFlowParametersExtension = new SearchTreeRaoLoopFlowParameters(); + loopFlowParametersExtension.setPtdfApproximation(PtdfApproximation.UPDATE_PTDF_WITH_TOPO_AND_PST); loopFlowParameters.setAcceptableIncrease(0); - loopFlowParameters.setViolationCost(10); - loopFlowParameters.setConstraintAdjustmentCoefficient(5); + loopFlowParametersExtension.setViolationCost(10); + loopFlowParametersExtension.setConstraintAdjustmentCoefficient(5); createMaxLoopFlowFiller(0); setCommercialFlowValue(49); @@ -199,11 +205,12 @@ void testShouldUpdate() { @Test void testFill2Sides() { - loopFlowParameters = new LoopFlowParametersExtension(); - loopFlowParameters.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); + loopFlowParameters = new LoopFlowParameters(); + loopFlowParametersExtension = new SearchTreeRaoLoopFlowParameters(); + loopFlowParametersExtension.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); loopFlowParameters.setAcceptableIncrease(13); - loopFlowParameters.setViolationCost(10); - loopFlowParameters.setConstraintAdjustmentCoefficient(5); + loopFlowParametersExtension.setViolationCost(10); + loopFlowParametersExtension.setConstraintAdjustmentCoefficient(5); FlowResult initialFlowResult = Mockito.mock(FlowResult.class); when(initialFlowResult.getLoopFlow(cnecOn2sides, TwoSides.ONE, Unit.MEGAWATT)).thenReturn(0.); @@ -211,7 +218,8 @@ void testFill2Sides() { maxLoopFlowFiller = new MaxLoopFlowFiller( Set.of(cnecOn2sides), initialFlowResult, - loopFlowParameters + loopFlowParameters, + loopFlowParametersExtension ); when(flowResult.getCommercialFlow(cnecOn2sides, TwoSides.ONE, Unit.MEGAWATT)).thenReturn(49.); @@ -254,11 +262,12 @@ void testFill2Sides() { @Test void testFilterCnecWithNoInitialFlow() { - loopFlowParameters = new LoopFlowParametersExtension(); - loopFlowParameters.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); + loopFlowParameters = new LoopFlowParameters(); + loopFlowParametersExtension = new SearchTreeRaoLoopFlowParameters(); + loopFlowParametersExtension.setPtdfApproximation(PtdfApproximation.FIXED_PTDF); loopFlowParameters.setAcceptableIncrease(13); - loopFlowParameters.setViolationCost(10); - loopFlowParameters.setConstraintAdjustmentCoefficient(5); + loopFlowParametersExtension.setViolationCost(10); + loopFlowParametersExtension.setConstraintAdjustmentCoefficient(5); FlowResult initialFlowResult = Mockito.mock(FlowResult.class); when(initialFlowResult.getLoopFlow(cnec1, TwoSides.ONE, Unit.MEGAWATT)).thenReturn(90.); @@ -266,7 +275,8 @@ void testFilterCnecWithNoInitialFlow() { maxLoopFlowFiller = new MaxLoopFlowFiller( Set.of(cnec1), initialFlowResult, - loopFlowParameters + loopFlowParameters, + loopFlowParametersExtension ); setCommercialFlowValue(49); buildLinearProblem(); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxMinRelativeMarginFillerTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxMinRelativeMarginFillerTest.java index 2cb2fc3ab0..7a4a91c8bc 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxMinRelativeMarginFillerTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MaxMinRelativeMarginFillerTest.java @@ -12,10 +12,11 @@ import com.powsybl.iidm.network.TwoSides; import com.powsybl.openrao.data.crac.api.rangeaction.RangeAction; import com.powsybl.openrao.raoapi.parameters.ObjectiveFunctionParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters; import com.powsybl.openrao.raoapi.parameters.RaoParameters; import com.powsybl.openrao.raoapi.parameters.extensions.PtdfApproximation; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; import com.powsybl.openrao.searchtreerao.commons.optimizationperimeters.OptimizationPerimeter; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPConstraint; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPVariable; @@ -50,7 +51,7 @@ class MaxMinRelativeMarginFillerTest extends AbstractFillerTest { private LinearProblem linearProblem; private CoreProblemFiller coreProblemFiller; private MaxMinRelativeMarginFiller maxMinRelativeMarginFiller; - private RelativeMarginsParametersExtension parameters; + private SearchTreeRaoRelativeMarginsParameters parameters; private RangeActionSetpointResult initialRangeActionSetpointResult; @BeforeEach @@ -71,11 +72,13 @@ public void setUp() throws IOException { raoParameters.getRangeActionsOptimizationParameters().setPstRAMinImpactThreshold(0.01); raoParameters.getRangeActionsOptimizationParameters().setHvdcRAMinImpactThreshold(0.01); raoParameters.getRangeActionsOptimizationParameters().setInjectionRAMinImpactThreshold(0.01); - raoParameters.addExtension(RelativeMarginsParametersExtension.class, new RelativeMarginsParametersExtension()); - raoParameters.getExtension(RelativeMarginsParametersExtension.class).setPtdfSumLowerBound(0.01); + OpenRaoSearchTreeParameters searchTreeParameters = new OpenRaoSearchTreeParameters(); + raoParameters.addExtension(OpenRaoSearchTreeParameters.class, searchTreeParameters); + parameters = new SearchTreeRaoRelativeMarginsParameters(); + searchTreeParameters.setRelativeMarginsParameters(parameters); + parameters.setPtdfSumLowerBound(0.01); raoParameters.getObjectiveFunctionParameters().setType(ObjectiveFunctionParameters.ObjectiveFunctionType.MAX_MIN_RELATIVE_MARGIN); raoParameters.getObjectiveFunctionParameters().setUnit(MEGAWATT); - parameters = raoParameters.getExtension(RelativeMarginsParametersExtension.class); coreProblemFiller = new CoreProblemFiller( optimizationPerimeter, diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MnecFillerTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MnecFillerTest.java index d1ae21e79a..1e5c882f76 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MnecFillerTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/MnecFillerTest.java @@ -16,10 +16,11 @@ import com.powsybl.iidm.network.TwoSides; import com.powsybl.openrao.data.crac.api.rangeaction.RangeAction; import com.powsybl.openrao.data.raoresult.api.ComputationStatus; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoMnecParameters; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters.PstModel; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters.Solver; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; +import com.powsybl.openrao.raoapi.parameters.MnecParameters; import com.powsybl.openrao.searchtreerao.commons.optimizationperimeters.OptimizationPerimeter; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.*; import com.powsybl.openrao.searchtreerao.result.api.FlowResult; @@ -114,10 +115,11 @@ public void setUp() throws IOException { } private void fillProblemWithFiller(Unit unit) { - MnecParametersExtension parameters = new MnecParametersExtension(); + MnecParameters parameters = new MnecParameters(); + SearchTreeRaoMnecParameters parametersExtension = new SearchTreeRaoMnecParameters(); parameters.setAcceptableMarginDecrease(50); - parameters.setViolationCost(10); - parameters.setConstraintAdjustmentCoefficient(3.5); + parametersExtension.setViolationCost(10); + parametersExtension.setConstraintAdjustmentCoefficient(3.5); FlowResult flowResult = Mockito.mock(FlowResult.class); when(flowResult.getFlow(mnec1, TwoSides.TWO, Unit.MEGAWATT)).thenReturn(900.); when(flowResult.getFlow(mnec2, TwoSides.ONE, Unit.MEGAWATT)).thenReturn(-200.); @@ -127,7 +129,9 @@ private void fillProblemWithFiller(Unit unit) { flowResult, Set.of(mnec1, mnec2, mnec3), unit, - parameters); + parametersExtension.getViolationCost(), + parameters.getAcceptableMarginDecrease(), + parametersExtension.getConstraintAdjustmentCoefficient()); linearProblem = new LinearProblemBuilder() .withProblemFiller(coreProblemFiller) .withProblemFiller(mnecFiller) @@ -214,10 +218,11 @@ void testAddMnecPenaltyCostA() { @Test void testFilterCnecWithNoInitialFlow() { - MnecParametersExtension parameters = new MnecParametersExtension(); + MnecParameters parameters = new MnecParameters(); + SearchTreeRaoMnecParameters parametersExtension = new SearchTreeRaoMnecParameters(); parameters.setAcceptableMarginDecrease(50); - parameters.setViolationCost(10); - parameters.setConstraintAdjustmentCoefficient(3.5); + parametersExtension.setViolationCost(10); + parametersExtension.setConstraintAdjustmentCoefficient(3.5); FlowResult flowResult = Mockito.mock(FlowResult.class); when(flowResult.getFlow(mnec1, TwoSides.TWO, Unit.MEGAWATT)).thenReturn(900.); when(flowResult.getFlow(mnec2, TwoSides.ONE, Unit.MEGAWATT)).thenReturn(-200.); @@ -228,7 +233,9 @@ void testFilterCnecWithNoInitialFlow() { flowResult, Set.of(mnec1, mnec2, mnec3), Unit.MEGAWATT, - parameters); + parametersExtension.getViolationCost(), + parameters.getAcceptableMarginDecrease(), + parametersExtension.getConstraintAdjustmentCoefficient()); linearProblem = new LinearProblemBuilder() .withProblemFiller(coreProblemFiller) .withProblemFiller(mnecFiller) diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/UnoptimizedCnecFillerMarginDecreaseRuleTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/UnoptimizedCnecFillerMarginDecreaseRuleTest.java index 7ea56883e4..d76e342bd8 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/UnoptimizedCnecFillerMarginDecreaseRuleTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/linearoptimisation/algorithms/fillers/UnoptimizedCnecFillerMarginDecreaseRuleTest.java @@ -15,7 +15,7 @@ import com.powsybl.openrao.data.crac.api.rangeaction.RangeAction; import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.RelativeMarginsParametersExtension; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; import com.powsybl.openrao.searchtreerao.commons.optimizationperimeters.OptimizationPerimeter; import com.powsybl.openrao.searchtreerao.commons.parameters.UnoptimizedCnecParameters; import com.powsybl.openrao.searchtreerao.linearoptimisation.algorithms.linearproblem.OpenRaoMPConstraint; @@ -119,7 +119,7 @@ private void buildLinearProblemWithMaxMinMargin(boolean initialFlowsAreNan) { } private void buildLinearProblemWithMaxMinRelativeMargin() { - RelativeMarginsParametersExtension maxMinRelativeMarginParameters = new RelativeMarginsParametersExtension(); + SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters = new SearchTreeRaoRelativeMarginsParameters(); UnoptimizedCnecParameters unoptimizedCnecParameters = new UnoptimizedCnecParameters(Set.of("NL")); FlowResult initialFlowResult = Mockito.mock(FlowResult.class); diff --git a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/searchtree/parameters/SearchTreeParametersTest.java b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/searchtree/parameters/SearchTreeParametersTest.java index 95021dcc68..5e41bd27ba 100644 --- a/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/searchtree/parameters/SearchTreeParametersTest.java +++ b/ra-optimisation/search-tree-rao/src/test/java/com/powsybl/openrao/searchtreerao/searchtree/parameters/SearchTreeParametersTest.java @@ -15,8 +15,11 @@ import com.powsybl.openrao.raoapi.parameters.ObjectiveFunctionParameters; import com.powsybl.openrao.raoapi.parameters.RangeActionsOptimizationParameters; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.*; -import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters.LinearOptimizationSolver; +import com.powsybl.openrao.raoapi.parameters.LoopFlowParameters; +import com.powsybl.openrao.raoapi.parameters.MnecParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.OpenRaoSearchTreeParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRelativeMarginsParameters; +import com.powsybl.openrao.raoapi.parameters.extensions.SearchTreeRaoRangeActionsOptimizationParameters; import com.powsybl.openrao.searchtreerao.commons.parameters.*; import com.powsybl.openrao.searchtreerao.result.api.OptimizationResult; import com.powsybl.openrao.searchtreerao.result.api.PrePerimeterResult; @@ -60,9 +63,11 @@ void testWithConstantParametersOverAllRao() { assertEquals(NetworkActionParameters.buildFromRaoParameters(raoParameters, crac), searchTreeParameters.getNetworkActionParameters()); assertEquals(crac.getRaUsageLimitsPerInstant(), searchTreeParameters.getRaLimitationParameters()); assertEquals(raoParameters.getRangeActionsOptimizationParameters(), searchTreeParameters.getRangeActionParameters()); - assertEquals(raoParameters.getExtension(MnecParametersExtension.class), searchTreeParameters.getMnecParameters()); - assertEquals(raoParameters.getExtension(RelativeMarginsParametersExtension.class), searchTreeParameters.getMaxMinRelativeMarginParameters()); - assertEquals(raoParameters.getExtension(LoopFlowParametersExtension.class), searchTreeParameters.getLoopFlowParameters()); + assertEquals(raoParameters.getMnecParameters().orElse(null), searchTreeParameters.getMnecParameters()); + assertEquals(raoParameters.getLoopFlowParameters().orElse(null), searchTreeParameters.getLoopFlowParameters()); + assertEquals(raoParametersExtension.getMnecParameters().orElse(null), searchTreeParameters.getMnecParametersExtension()); + assertEquals(raoParametersExtension.getRelativeMarginsParameters().orElse(null), searchTreeParameters.getMaxMinRelativeMarginParameters()); + assertEquals(raoParametersExtension.getLoopFlowParameters().orElse(null), searchTreeParameters.getLoopFlowParametersExtension()); assertEquals(raoParametersExtension.getRangeActionsOptimizationParameters().getLinearOptimizationSolver(), searchTreeParameters.getSolverParameters()); assertEquals(raoParametersExtension.getRangeActionsOptimizationParameters().getMaxMipIterations(), searchTreeParameters.getMaxNumberOfIterations()); } @@ -76,11 +81,11 @@ void testIndividualSetters() { Map raLimitationParameters = new HashMap<>(); RangeActionsOptimizationParameters rangeActionParameters = Mockito.mock(RangeActionsOptimizationParameters.class); SearchTreeRaoRangeActionsOptimizationParameters rangeActionParametersExtension = Mockito.mock(SearchTreeRaoRangeActionsOptimizationParameters.class); - MnecParametersExtension mnecParameters = Mockito.mock(MnecParametersExtension.class); - RelativeMarginsParametersExtension maxMinRelativeMarginParameters = Mockito.mock(RelativeMarginsParametersExtension.class); - LoopFlowParametersExtension loopFlowParameters = Mockito.mock(LoopFlowParametersExtension.class); + MnecParameters mnecParameters = Mockito.mock(MnecParameters.class); + SearchTreeRaoRelativeMarginsParameters maxMinRelativeMarginParameters = Mockito.mock(SearchTreeRaoRelativeMarginsParameters.class); + LoopFlowParameters loopFlowParameters = Mockito.mock(LoopFlowParameters.class); UnoptimizedCnecParameters unoptimizedCnecParameters = Mockito.mock(UnoptimizedCnecParameters.class); - LinearOptimizationSolver solverParameters = Mockito.mock(LinearOptimizationSolver.class); + SearchTreeRaoRangeActionsOptimizationParameters.LinearOptimizationSolver solverParameters = Mockito.mock(SearchTreeRaoRangeActionsOptimizationParameters.LinearOptimizationSolver.class); int maxNumberOfIterations = 3; SearchTreeParameters searchTreeParameters = builder diff --git a/tests/src/test/java/com/powsybl/openrao/tests/utils/CneHelper.java b/tests/src/test/java/com/powsybl/openrao/tests/utils/CneHelper.java index f4f26480bb..8e2c54e291 100644 --- a/tests/src/test/java/com/powsybl/openrao/tests/utils/CneHelper.java +++ b/tests/src/test/java/com/powsybl/openrao/tests/utils/CneHelper.java @@ -14,8 +14,6 @@ import com.powsybl.openrao.data.raoresult.api.RaoResult; import com.powsybl.openrao.data.raoresult.io.cne.swe.SweCneExporter; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; -import com.powsybl.openrao.raoapi.parameters.extensions.MnecParametersExtension; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -79,11 +77,11 @@ private static void fillPropertiesWithRaoParameters(Properties properties, RaoPa case MAX_MIN_RELATIVE_MARGIN -> properties.setProperty("rao-result.export.core-cne.relative-positive-margins", "true"); case MAX_MIN_MARGIN -> properties.setProperty("rao-result.export.core-cne.relative-positive-margins", "false"); } - if (raoParameters.hasExtension(LoopFlowParametersExtension.class)) { + if (raoParameters.getLoopFlowParameters().isPresent()) { properties.setProperty("rao-result.export.core-cne.with-loop-flows", "true"); } - if (raoParameters.hasExtension(MnecParametersExtension.class)) { - properties.setProperty("rao-result.export.core-cne.mnec-acceptable-margin-diminution", String.valueOf(raoParameters.getExtension(MnecParametersExtension.class).getAcceptableMarginDecrease())); + if (raoParameters.getMnecParameters().isPresent()) { + properties.setProperty("rao-result.export.core-cne.mnec-acceptable-margin-diminution", String.valueOf(raoParameters.getMnecParameters().get().getAcceptableMarginDecrease())); } } diff --git a/tests/src/test/java/com/powsybl/openrao/tests/utils/RaoUtils.java b/tests/src/test/java/com/powsybl/openrao/tests/utils/RaoUtils.java index b88d6c89b2..1c08f31fbb 100644 --- a/tests/src/test/java/com/powsybl/openrao/tests/utils/RaoUtils.java +++ b/tests/src/test/java/com/powsybl/openrao/tests/utils/RaoUtils.java @@ -18,14 +18,12 @@ import com.powsybl.openrao.raoapi.Rao; import com.powsybl.openrao.raoapi.RaoInput; import com.powsybl.openrao.raoapi.parameters.RaoParameters; -import com.powsybl.openrao.raoapi.parameters.extensions.LoopFlowParametersExtension; import com.powsybl.sensitivity.SensitivityVariableSet; import com.powsybl.openrao.tests.steps.CommonTestData; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.Objects; import java.util.Optional; import java.util.Properties; @@ -65,7 +63,7 @@ public static RaoResult runRao(String contingencyId, InstantKind instantKind, St RaoParameters raoParameters = CommonTestData.getRaoParameters(); ZonalData glsks = CommonTestData.getLoopflowGlsks(); // Rao with loop-flows - if (Objects.nonNull(raoParameters.getExtension(LoopFlowParametersExtension.class)) && glsks != null) { + if (raoParameters.getLoopFlowParameters().isPresent() && glsks != null) { double effectiveLfPercentage = loopflowAsPmaxPercentage == null ? 0.0 : loopflowAsPmaxPercentage; buildLoopFlowExtensions(CommonTestData.getCrac(), CommonTestData.getNetwork(), effectiveLfPercentage); } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere.json b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere.json index e3de9abc07..ffe7ea7750 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere_mip.json b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere_mip.json index 546bc5d150..0f150a4963 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere_mip.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere_mip.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere_withFallback.json b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere_withFallback.json index 2e21c11994..6da3974080 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere_withFallback.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_ampere_withFallback.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_ac.json b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_ac.json index ec101d07c4..9116be80d4 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_ac.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_ac.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_dc.json b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_dc.json index 53e866dc64..4be2f98df8 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_dc.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_dc.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_dc_withLoopFlows.json b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_dc_withLoopFlows.json index 95a2b1b2eb..bd197415ee 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_dc_withLoopFlows.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_maxMargin_megawatt_dc_withLoopFlows.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", - "constraint-adjustment-coefficient" : 0.5, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", + "constraint-adjustment-coefficient" : 0.5, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_ampere.json b/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_ampere.json index ce0ea42854..f600553aee 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_ampere.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_ampere.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -84,6 +82,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_ampere_withFallback.json b/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_ampere_withFallback.json index f0ac339952..86d49fc17d 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_ampere_withFallback.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_ampere_withFallback.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_megawatt_ac.json b/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_megawatt_ac.json index 65e62a26aa..4764f122d1 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_megawatt_ac.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_megawatt_ac.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_megawatt_dc.json b/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_megawatt_dc.json index 885c393a81..d454a109ab 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_megawatt_dc.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_posMargin_megawatt_dc.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_securityAnalysis.json b/tests/src/test/resources/files/configurations/common/RaoParameters_securityAnalysis.json index 323f649f90..a039bce6c3 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_securityAnalysis.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_securityAnalysis.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -111,6 +109,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/common/RaoParameters_simple_AC_loopflow.json b/tests/src/test/resources/files/configurations/common/RaoParameters_simple_AC_loopflow.json index f320cfe8f2..92111b3ac1 100644 --- a/tests/src/test/resources/files/configurations/common/RaoParameters_simple_AC_loopflow.json +++ b/tests/src/test/resources/files/configurations/common/RaoParameters_simple_AC_loopflow.json @@ -16,19 +16,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "FIXED_PTDF", - "constraint-adjustment-coefficient" : 0.0, - "violation-cost" : 0.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -86,6 +81,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "FIXED_PTDF", + "constraint-adjustment-coefficient" : 0.0, + "violation-cost" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic10/RaoParameters_relMargin_megawatt.json b/tests/src/test/resources/files/configurations/epic10/RaoParameters_relMargin_megawatt.json index 572c15c4d7..293c55e11a 100644 --- a/tests/src/test/resources/files/configurations/epic10/RaoParameters_relMargin_megawatt.json +++ b/tests/src/test/resources/files/configurations/epic10/RaoParameters_relMargin_megawatt.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{BE}", "{FR}-{DE}", "{BE}-{NL}", "{NL}-{DE}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{BE}", "{FR}-{DE}", "{BE}-{NL}", "{NL}-{DE}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic10/conf_ep10us2case1.json b/tests/src/test/resources/files/configurations/epic10/conf_ep10us2case1.json index b7b1b07c82..f6019bea79 100644 --- a/tests/src/test/resources/files/configurations/epic10/conf_ep10us2case1.json +++ b/tests/src/test/resources/files/configurations/epic10/conf_ep10us2case1.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{10YFR-RTE------C}-{10YBE----------2}", "{10YFR-RTE------C}-{10YCB-GERMANY--8}", "{10YBE----------2}-{10YNL----------L}", "{10YNL----------L}-{10YCB-GERMANY--8}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{10YFR-RTE------C}-{10YBE----------2}", "{10YFR-RTE------C}-{10YCB-GERMANY--8}", "{10YBE----------2}-{10YNL----------L}", "{10YNL----------L}-{10YCB-GERMANY--8}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic10/conf_ep10us2case2.json b/tests/src/test/resources/files/configurations/epic10/conf_ep10us2case2.json index c4b3ec21a2..3874e1f232 100644 --- a/tests/src/test/resources/files/configurations/epic10/conf_ep10us2case2.json +++ b/tests/src/test/resources/files/configurations/epic10/conf_ep10us2case2.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{HOMEMADE_EI_CODE}-{10YBE----------2}", "{HOMEMADE_EI_CODE}-{10YCB-GERMANY--8}", "{10YBE----------2}-{10YNL----------L}", "{10YNL----------L}-{10YCB-GERMANY--8}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{HOMEMADE_EI_CODE}-{10YBE----------2}", "{HOMEMADE_EI_CODE}-{10YCB-GERMANY--8}", "{10YBE----------2}-{10YNL----------L}", "{10YNL----------L}-{10YCB-GERMANY--8}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic10/conf_ep10us3case1.json b/tests/src/test/resources/files/configurations/epic10/conf_ep10us3case1.json index 9fdd12f2bf..077a3e0cfa 100644 --- a/tests/src/test/resources/files/configurations/epic10/conf_ep10us3case1.json +++ b/tests/src/test/resources/files/configurations/epic10/conf_ep10us3case1.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{22Y201903144---9}-{22Y201903145---4}", "{22Y201903144---9}-{BE}", "{22Y201903145---4}-{DE}", "{BE}-{NL}", "{DE}-{NL}", "{BE}-{FR}", "{DE}-{FR}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{22Y201903144---9}-{22Y201903145---4}", "{22Y201903144---9}-{BE}", "{22Y201903145---4}-{DE}", "{BE}-{NL}", "{DE}-{NL}", "{BE}-{FR}", "{DE}-{FR}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic10/conf_ep10us4case1.json b/tests/src/test/resources/files/configurations/epic10/conf_ep10us4case1.json index 342e3e133a..77978a958c 100644 --- a/tests/src/test/resources/files/configurations/epic10/conf_ep10us4case1.json +++ b/tests/src/test/resources/files/configurations/epic10/conf_ep10us4case1.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{BE}-{22Y201903144---9}-{DE}+{22Y201903145---4}", "{BE}-{NL}", "{DE}-{NL}", "{BE}-{FR}", "{DE}-{FR}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{BE}-{22Y201903144---9}-{DE}+{22Y201903145---4}", "{BE}-{NL}", "{DE}-{NL}", "{BE}-{FR}", "{DE}-{FR}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic11/RaoParameters_maxMargin_megawatt_ac_mnecDimin180.json b/tests/src/test/resources/files/configurations/epic11/RaoParameters_maxMargin_megawatt_ac_mnecDimin180.json index d8a6bac2e4..ba264268ed 100644 --- a/tests/src/test/resources/files/configurations/epic11/RaoParameters_maxMargin_megawatt_ac_mnecDimin180.json +++ b/tests/src/test/resources/files/configurations/epic11/RaoParameters_maxMargin_megawatt_ac_mnecDimin180.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 180.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 180.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic11/RaoParameters_maxMargin_megawatt_ac_mnecDimin20.json b/tests/src/test/resources/files/configurations/epic11/RaoParameters_maxMargin_megawatt_ac_mnecDimin20.json index 6d6d27be17..ade2bf53b9 100644 --- a/tests/src/test/resources/files/configurations/epic11/RaoParameters_maxMargin_megawatt_ac_mnecDimin20.json +++ b/tests/src/test/resources/files/configurations/epic11/RaoParameters_maxMargin_megawatt_ac_mnecDimin20.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 20.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 20.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic11/RaoParameters_posMargin_ampere_mnecDiminMinusInf.json b/tests/src/test/resources/files/configurations/epic11/RaoParameters_posMargin_ampere_mnecDiminMinusInf.json index 2885e6015e..c3226aef7e 100644 --- a/tests/src/test/resources/files/configurations/epic11/RaoParameters_posMargin_ampere_mnecDiminMinusInf.json +++ b/tests/src/test/resources/files/configurations/epic11/RaoParameters_posMargin_ampere_mnecDiminMinusInf.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : -99999.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : -99999.0, - "violation-cost" : 100.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 100.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_13_6_11.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_13_6_11.json index 4a40787b9c..e13b39dd50 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_13_6_11.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_13_6_11.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 0.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 0.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 5.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 5.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_13_6_2.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_13_6_2.json index f2dd558c01..58ef24d8ce 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_13_6_2.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_13_6_2.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 0.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 0.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 5.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 5.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_300_secure.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_300_secure.json index bde6df527d..31decfd58f 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_300_secure.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_300_secure.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 300.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_500.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_500.json index ec2a49b86e..7b7b3fb13f 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_500.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_500.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 500.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_628.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_628.json index c4afc1d0bc..9185d90e55 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_628.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_best_preventive_by_628.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 628.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_ep13us6case8.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_ep13us6case8.json index f437732568..885cf7fde5 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_ep13us6case8.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_ep13us6case8.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 10.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 10.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 5.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 5.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_ep13us7case6.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_ep13us7case6.json index bfccd8c470..041f585612 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_ep13us7case6.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_ep13us7case6.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "FIXED_PTDF", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "FIXED_PTDF", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_2p_global.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_2p_global.json index 75b8c14204..38587722d7 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_2p_global.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_2p_global.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_absolute_threshold.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_absolute_threshold.json index ae04e4472c..794493bf71 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_absolute_threshold.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_absolute_threshold.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_absolute_threshold_12.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_absolute_threshold_12.json index 4f8d17f6c1..3b3c2720d6 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_absolute_threshold_12.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_maxMargin_ampere_absolute_threshold_12.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_relMargin_ampere.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_relMargin_ampere.json index 5ea60580b0..2b1893d75a 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_relMargin_ampere.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_relMargin_ampere.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic13/RaoParameters_stop_curative_at_preventive.json b/tests/src/test/resources/files/configurations/epic13/RaoParameters_stop_curative_at_preventive.json index 0753793218..7d6b79bd1c 100644 --- a/tests/src/test/resources/files/configurations/epic13/RaoParameters_stop_curative_at_preventive.json +++ b/tests/src/test/resources/files/configurations/epic13/RaoParameters_stop_curative_at_preventive.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us11-2.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us11-2.json index 0e96a3cee8..a9f687dcca 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us11-2.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us11-2.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us11-4.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us11-4.json index 5410dd5787..3e63d3a846 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us11-4.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us11-4.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 0.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 0.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 5.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 5.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case1.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case1.json index 8bcf003f68..bbfb6e68fc 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case1.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case1.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case10.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case10.json index 8e77d306d9..f3c8620171 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case10.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case10.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case2.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case2.json index de69c3c422..a5efb01ce8 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case2.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case2.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case5.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case5.json index bd8b3dfcd0..c6fd1ab07c 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case5.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case5.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case6.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case6.json index 8c23c5a228..77188430f6 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case6.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case6.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case7.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case7.json index 8a49485099..87b107b185 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case7.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case7.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case8.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case8.json index c632b04582..2987a7864f 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case8.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us13case8.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case10.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case10.json index 00b6c1cd9f..41a5eaaf29 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case10.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case10.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case11.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case11.json index 00b6c1cd9f..41a5eaaf29 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case11.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case11.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case12.json b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case12.json index 4cd4b14263..647b1c1fae 100644 --- a/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case12.json +++ b/tests/src/test/resources/files/configurations/epic15/RaoParameters_ep15us17case12.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic19/RaoParameters_19_10_10&11.json b/tests/src/test/resources/files/configurations/epic19/RaoParameters_19_10_10&11.json index a6fb1a3a1f..6c3aa28425 100644 --- a/tests/src/test/resources/files/configurations/epic19/RaoParameters_19_10_10&11.json +++ b/tests/src/test/resources/files/configurations/epic19/RaoParameters_19_10_10&11.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxMargin_ampere_shareCra.json b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxMargin_ampere_shareCra.json index 912849a989..5c620f6c4d 100644 --- a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxMargin_ampere_shareCra.json +++ b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxMargin_ampere_shareCra.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : true }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxMargin_megawatt_shareCra.json b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxMargin_megawatt_shareCra.json index ff34d2dd54..07b57c4536 100644 --- a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxMargin_megawatt_shareCra.json +++ b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxMargin_megawatt_shareCra.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : true }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_ampere_shareCra.json b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_ampere_shareCra.json index 4195b906b9..6556776e63 100644 --- a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_ampere_shareCra.json +++ b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_ampere_shareCra.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : true }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_ampere_shareCra_mip.json b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_ampere_shareCra_mip.json index 357d0b8e0e..566f58ff0e 100644 --- a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_ampere_shareCra_mip.json +++ b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_ampere_shareCra_mip.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : true }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_megawatt_shareCra.json b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_megawatt_shareCra.json index 0ea90e2e5b..b12099f189 100644 --- a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_megawatt_shareCra.json +++ b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_megawatt_shareCra.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : true }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_megawatt_shareCra_mip.json b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_megawatt_shareCra_mip.json index d4fbffb068..0d264450f9 100644 --- a/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_megawatt_shareCra_mip.json +++ b/tests/src/test/resources/files/configurations/epic19/RaoParameters_maxRelMargin_megawatt_shareCra_mip.json @@ -17,16 +17,13 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : true }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "relative-margins-parameters" : { + "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "relative-margins-parameters" : { - "ptdf-boundaries" : [ "{FR}-{DE}", "{FR}-{BE}", "{BE}-{NL}", "{BE}-{DE}", "{DE}-{NL}" ], - "ptdf-sum-lower-bound" : 0.01 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -84,6 +81,13 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "relative-margins-parameters" : { + "ptdf-sum-lower-bound" : 0.01 } } } diff --git a/tests/src/test/resources/files/configurations/epic20/RaoParameters_20_4.json b/tests/src/test/resources/files/configurations/epic20/RaoParameters_20_4.json index 7a91bdf0a6..4a9368033d 100644 --- a/tests/src/test/resources/files/configurations/epic20/RaoParameters_20_4.json +++ b/tests/src/test/resources/files/configurations/epic20/RaoParameters_20_4.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 0.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 0.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 5.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 5.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_MW_DC_withLF_with2P.json b/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_MW_DC_withLF_with2P.json index 2da8b7dee3..53bde154f5 100644 --- a/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_MW_DC_withLF_with2P.json +++ b/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_MW_DC_withLF_with2P.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 50.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_2p_if_cost_increase.json b/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_2p_if_cost_increase.json index 53d1b496d5..6d846058fd 100644 --- a/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_2p_if_cost_increase.json +++ b/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_2p_if_cost_increase.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_forbid_cost_increase.json b/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_forbid_cost_increase.json index e3de9abc07..ffe7ea7750 100644 --- a/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_forbid_cost_increase.json +++ b/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_forbid_cost_increase.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_second_preventive.json b/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_second_preventive.json index bbf1182577..3d1ca9f33d 100644 --- a/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_second_preventive.json +++ b/tests/src/test/resources/files/configurations/epic20/RaoParameters_maxMargin_ampere_second_preventive.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_ac_divergence.json b/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_ac_divergence.json index 823264d01a..4caa165f54 100644 --- a/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_ac_divergence.json +++ b/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_ac_divergence.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -111,6 +109,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_withFallback_ac_divergence.json b/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_withFallback_ac_divergence.json index 4d99685be3..bf910be872 100644 --- a/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_withFallback_ac_divergence.json +++ b/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_withFallback_ac_divergence.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -112,6 +110,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_withFallback_differentFallbackCost.json b/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_withFallback_differentFallbackCost.json index 4b55716ef7..d2f3829937 100644 --- a/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_withFallback_differentFallbackCost.json +++ b/tests/src/test/resources/files/configurations/epic4/RaoParameters_posMargin_ampere_withFallback_differentFallbackCost.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -111,6 +109,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_absoluteMinImpact190.json b/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_absoluteMinImpact190.json index 2a22566be3..d4261b8f0f 100644 --- a/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_absoluteMinImpact190.json +++ b/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_absoluteMinImpact190.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_absoluteMinImpact195.json b/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_absoluteMinImpact195.json index f913be1952..a67b335fc0 100644 --- a/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_absoluteMinImpact195.json +++ b/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_absoluteMinImpact195.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_maxDepth.json b/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_maxDepth.json index 713f990d81..18d4f02a0f 100644 --- a/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_maxDepth.json +++ b/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_maxDepth.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_relativeMinImpact.json b/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_relativeMinImpact.json index 3ef6e5669e..78629eb24b 100644 --- a/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_relativeMinImpact.json +++ b/tests/src/test/resources/files/configurations/epic5/RaoParameters_maxMargin_relativeMinImpact.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_10_100.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_10_100.json index 8464f02e29..6c1753373b 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_10_100.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_10_100.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 10.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 10.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100.json index 9b1ee9c7d2..87c768221e 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 0.5, - "violation-cost" : 1000.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 0.5, + "violation-cost" : 1000.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_BE_NL.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_BE_NL.json index f951ebb17d..291db4ed71 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_BE_NL.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_BE_NL.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ "BE", "NL" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ "BE", "NL" ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_NL.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_NL.json index 5e6b3682b5..6f2c6c4006 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_NL.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_NL.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ "NL" ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ "NL" ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_lfAugmentation.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_lfAugmentation.json index cec026927e..a192dd1e63 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_lfAugmentation.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_false_5_100_lfAugmentation.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 40.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 40.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_true_5_100.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_true_5_100.json index e1d04419ef..ed6087c82e 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_true_5_100.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_ac_lf_true_5_100.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "FIXED_PTDF", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "FIXED_PTDF", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_accurate_5_100.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_accurate_5_100.json index f306d1e230..6381240cd6 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_accurate_5_100.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_accurate_5_100.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_false_10_100.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_false_10_100.json index ba505c48f9..8b42238912 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_false_10_100.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_false_10_100.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 10.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 10.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_false_5_100.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_false_5_100.json index 68e08ef5f2..e82247ec70 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_false_5_100.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_false_5_100.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "FIXED_PTDF", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "FIXED_PTDF", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_inBetween_5_100.json b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_inBetween_5_100.json index 918000e7ac..4bc24c32ff 100644 --- a/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_inBetween_5_100.json +++ b/tests/src/test/resources/files/configurations/epic7/RaoParameters_maxMargin_mw_dc_lf_inBetween_5_100.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", - "constraint-adjustment-coefficient" : 5.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO", + "constraint-adjustment-coefficient" : 5.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_search_tree.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_search_tree.json index 0acdf5fd1d..5c4a43b49a 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_search_tree.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_search_tree.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_secure.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_secure.json index c6a325aaa6..93ebc2fa87 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_secure.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_secure.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_secure_2PRAO.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_secure_2PRAO.json index b3823ed519..70dbb3a943 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_secure_2PRAO.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_12_secure_2PRAO.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_13_1.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_13_1.json index 15f96de867..e7d29e7823 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_13_1.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_13_1.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_1.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_1.json index 2dd1e27ff9..0b919714f6 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_1.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_1.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_12.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_12.json index 2db8b5256c..bb245dfa22 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_12.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_12.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_3.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_3.json index 30eaf589d1..f28c45fc2c 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_3.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_3.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_6.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_6.json index 3c659828c0..1a2e059305 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_6.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_6.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_7.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_7.json index 914da7db67..d50d45f694 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_7.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_case_91_1_7.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_interrupt_search_tree.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_interrupt_search_tree.json index 6371439e6d..b46e169362 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_interrupt_search_tree.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_interrupt_search_tree.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_interrupt_search_tree_2_threads.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_interrupt_search_tree_2_threads.json index 969e36b821..9c7b7ceee2 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_interrupt_search_tree_2_threads.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_interrupt_search_tree_2_threads.json @@ -16,12 +16,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 0.0 @@ -79,6 +77,10 @@ }, "multi-threading" : { "available-cpus" : 2 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_maxMargin_mw_ac_lf_false_3_100.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_maxMargin_mw_ac_lf_false_3_100.json index 96023a2354..aa558380a9 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_maxMargin_mw_ac_lf_false_3_100.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_maxMargin_mw_ac_lf_false_3_100.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 3.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 3.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/epic91/RaoParameters_maxMargin_mw_ac_lf_false_3_100_mip.json b/tests/src/test/resources/files/configurations/epic91/RaoParameters_maxMargin_mw_ac_lf_false_3_100_mip.json index 4b0fb6d696..bbb7a51adb 100644 --- a/tests/src/test/resources/files/configurations/epic91/RaoParameters_maxMargin_mw_ac_lf_false_3_100_mip.json +++ b/tests/src/test/resources/files/configurations/epic91/RaoParameters_maxMargin_mw_ac_lf_false_3_100_mip.json @@ -17,19 +17,14 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, + "loop-flow-parameters" : { + "acceptable-increase" : 0.0, + "countries" : [ ] + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, - "loop-flow-parameters" : { - "acceptable-increase" : 0.0, - "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", - "constraint-adjustment-coefficient" : 3.0, - "violation-cost" : 100.0, - "countries" : [ ] - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -87,6 +82,15 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 + }, + "loop-flow-parameters" : { + "ptdf-approximation" : "UPDATE_PTDF_WITH_TOPO_AND_PST", + "constraint-adjustment-coefficient" : 3.0, + "violation-cost" : 100.0 } } } diff --git a/tests/src/test/resources/files/configurations/rao1/RaoParameters_maxMargin_ampere_highPSTcost.json b/tests/src/test/resources/files/configurations/rao1/RaoParameters_maxMargin_ampere_highPSTcost.json index 73ac449949..fafce790ca 100644 --- a/tests/src/test/resources/files/configurations/rao1/RaoParameters_maxMargin_ampere_highPSTcost.json +++ b/tests/src/test/resources/files/configurations/rao1/RaoParameters_maxMargin_ampere_highPSTcost.json @@ -17,12 +17,10 @@ "not-optimized-cnecs" : { "do-not-optimize-curative-cnecs-for-tsos-without-cras" : false }, + "mnec-parameters" : { + "acceptable-margin-decrease" : 50.0 + }, "extensions" : { - "mnec-parameters" : { - "acceptable-margin-decrease" : 50.0, - "violation-cost" : 10.0, - "constraint-adjustment-coefficient" : 0.0 - }, "open-rao-search-tree-parameters" : { "objective-function" : { "curative-min-obj-improvement" : 10000.0 @@ -80,6 +78,10 @@ }, "multi-threading" : { "available-cpus" : 1 + }, + "mnec-parameters" : { + "violation-cost" : 10.0, + "constraint-adjustment-coefficient" : 0.0 } } }