Skip to content

Commit

Permalink
Remove adequacy patch lmr [ANT-1933] (#2341)
Browse files Browse the repository at this point in the history
TODO: use warnings for removed parameters, only noticed used to avoid CI
errors during dev
  • Loading branch information
payetvin authored Sep 3, 2024
1 parent 420ccba commit 9accb36
Show file tree
Hide file tree
Showing 23 changed files with 76 additions and 800 deletions.
5 changes: 5 additions & 0 deletions docs/user-guide/04-migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
This is a list of all recent changes that came with new Antares Simulator features. The main goal of this document is to lower the costs of changing existing interfaces, both GUI and scripts.

## v9.2.0
### Adequacy Patch LMR
Removed following properties from **settings/generaldata.ini**.
- enable-first-step
- set-to-null-ntc-between-physical-out-for-first-step

### (TS-generator only) TS generation for link capacities
In files input/links/<link1>/properties.ini, add the following properties
- tsgen_direct_XXX,
Expand Down
20 changes: 0 additions & 20 deletions docs/user-guide/solver/04-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,16 +503,6 @@ These parameters are listed under the `[adequacy patch]` section in the `.ini` f
inside adequacy patch (area type 2). NTC is set to null (if true) only in the first step of adequacy patch local matching rule.
NTC from physical areas outside to physical areas inside adequacy patch (set to null / local values)

---
#### set-to-null-ntc-between-physical-out-for-first-step
[//]: # (TODO: usage is not clear)
- **Expected value:** `true` or `false`
- **Required:** no
- **Default value:** `true`
- **Usage:** Transmission capacities between physical areas outside adequacy patch (area type 1).
NTC is set to null (if true) only in the first step of adequacy patch local matching rule.
NTC between physical areas outside adequacy patch (set to null / local values)

---
#### price-taking-order
[//]: # (TODO: document this parameter)
Expand Down Expand Up @@ -543,16 +533,6 @@ _**This section is under construction**_
- **Default value:**
- **Usage:** Check CSR cost function value prior and after CSR (false / true)

---
#### enable-first-step
[//]: # (TODO: document this parameter)
_**This section is under construction**_

- **Expected value:**
- **Required:** **yes**
- **Default value:**
- **Usage:**

---
#### threshold-initiate-curtailment-sharing-rule
[//]: # (TODO: document this parameter)
Expand Down
5 changes: 0 additions & 5 deletions src/libs/antares/exception/LoadingError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ IncompatibleHurdleCostCSR::IncompatibleHurdleCostCSR():
{
}

AdqPatchDisabledLMR::AdqPatchDisabledLMR():
LoadingError("Incompatible options LMR disabled and priceTakingOrder equal Dens")
{
}

IncompatibleOutputOptions::IncompatibleOutputOptions(const std::string& text):
LoadingError(text)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ class IncompatibleHurdleCostCSR: public LoadingError
IncompatibleHurdleCostCSR();
};

class AdqPatchDisabledLMR: public LoadingError
{
public:
AdqPatchDisabledLMR();
};

class IncompatibleOutputOptions: public LoadingError
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,6 @@ enum class AdqPatchPTO

}; // enum AdqPatchPTO

struct LocalMatching
{
bool enabled = true;
//! Transmission capacities from physical areas outside adequacy patch (area type 1) to
//! physical areas inside adequacy patch (area type 2). NTC is set to null (if true)
//! only in the first step of adequacy patch local matching rule.
bool setToZeroOutsideInsideLinks = true;
//! Transmission capacities between physical areas outside adequacy patch (area type 1).
//! NTC is set to null (if true) only in the first step of adequacy patch local matching
//! rule.
bool setToZeroOutsideOutsideLinks = true;
/*!
** \brief Reset to default values related to local matching
*/
void reset();
bool updateFromKeyValue(const Yuni::String& key, const Yuni::String& value);
void addProperties(IniFile::Section* section) const;
};

class CurtailmentSharing
{
public:
Expand Down Expand Up @@ -127,7 +108,10 @@ class CurtailmentSharing
struct AdqPatchParams
{
bool enabled;
LocalMatching localMatching;
//! Transmission capacities from physical areas outside adequacy patch (area type 1) to
//! physical areas inside adequacy patch (area type 2). NTC is set to null (if true)
//! only in the first step of adequacy patch local matching rule.
bool setToZeroOutsideInsideLinks = true;
CurtailmentSharing curtailmentSharing;

void reset();
Expand Down
52 changes: 16 additions & 36 deletions src/libs/antares/study/parameters/adq-patch-params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,23 @@ namespace Antares::Data::AdequacyPatch
// Local matching
// -------------------

void LocalMatching::reset()
static bool legacyLocalMatchingKeys(const Yuni::String& key)
{
setToZeroOutsideInsideLinks = true;
setToZeroOutsideOutsideLinks = true;
}

bool LocalMatching::updateFromKeyValue(const Yuni::String& key, const Yuni::String& value)
{
if (key == "set-to-null-ntc-from-physical-out-to-physical-in-for-first-step")
{
return value.to<bool>(setToZeroOutsideInsideLinks);
}
if (key == "set-to-null-ntc-between-physical-out-for-first-step")
{
return value.to<bool>(setToZeroOutsideOutsideLinks);
logs.warning() << "Parameter set-to-null-ntc-between-physical-out-for-first-step not "
"supported with this solver version, use a version < 9.2";
return true;
}
if (key == "enable-first-step")
{
return value.to<bool>(enabled);
logs.warning() << "Parameter enable-first-step not supported with this solver version, use "
"a version < 9.2";
return true;
}
return false;
}

void LocalMatching::addProperties(IniFile::Section* section) const
{
section->add("set-to-null-ntc-from-physical-out-to-physical-in-for-first-step",
setToZeroOutsideInsideLinks);
section->add("set-to-null-ntc-between-physical-out-for-first-step",
setToZeroOutsideOutsideLinks);
section->add("enable-first-step", enabled);
}

// -----------------------
// Curtailment sharing
// -----------------------
Expand Down Expand Up @@ -141,7 +126,7 @@ bool CurtailmentSharing::updateFromKeyValue(const Yuni::String& key, const Yuni:
return value.to<int>(thresholdVarBoundsRelaxation);
}

return false;
return legacyLocalMatchingKeys(key);
}

const char* PriceTakingOrderToString(AdequacyPatch::AdqPatchPTO pto)
Expand Down Expand Up @@ -175,10 +160,8 @@ void CurtailmentSharing::addProperties(IniFile::Section* section) const
// ------------------------
void AdqPatchParams::reset()
{
enabled = false;

localMatching.reset();
curtailmentSharing.reset();
setToZeroOutsideInsideLinks = true;
}

void AdqPatchParams::addExcludedVariables(std::vector<std::string>& out) const
Expand All @@ -190,12 +173,6 @@ void AdqPatchParams::addExcludedVariables(std::vector<std::string>& out) const
out.emplace_back("SPIL. ENRG. CSR");
out.emplace_back("DTG MRG CSR");
}

// If the adequacy patch is enabled, but the LMR is disabled, the DENS variable shouldn't exist
if (enabled && !localMatching.enabled)
{
out.emplace_back("DENS");
}
}

bool AdqPatchParams::updateFromKeyValue(const Yuni::String& key, const Yuni::String& value)
Expand All @@ -204,17 +181,20 @@ bool AdqPatchParams::updateFromKeyValue(const Yuni::String& key, const Yuni::Str
{
return value.to<bool>(enabled);
}

return curtailmentSharing.updateFromKeyValue(key, value)
!= localMatching.updateFromKeyValue(key, value); // XOR
if (key == "set-to-null-ntc-from-physical-out-to-physical-in-for-first-step")
{
return value.to<bool>(setToZeroOutsideInsideLinks);
}
return curtailmentSharing.updateFromKeyValue(key, value);
}

void AdqPatchParams::saveToINI(IniFile& ini) const
{
auto* section = ini.addSection("adequacy patch");
section->add("include-adq-patch", enabled);
section->add("set-to-null-ntc-from-physical-out-to-physical-in-for-first-step",
setToZeroOutsideInsideLinks);

localMatching.addProperties(section);
curtailmentSharing.addProperties(section);
}

Expand Down
8 changes: 1 addition & 7 deletions src/solver/optimisation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ set(RTESOLVER_OPT
opt_nombre_min_groupes_demarres_couts_demarrage.cpp
include/antares/solver/optimisation/opt_export_structure.h
opt_export_structure.cpp
include/antares/solver/optimisation/base_weekly_optimization.h
base_weekly_optimization.cpp
include/antares/solver/optimisation/adequacy_patch_local_matching/adequacy_patch_weekly_optimization.h
adequacy_patch_local_matching/adequacy_patch_weekly_optimization.cpp
include/antares/solver/optimisation/weekly_optimization.h
weekly_optimization.cpp
include/antares/solver/optimisation/optim_post_process_list.h
Expand All @@ -51,8 +47,6 @@ set(RTESOLVER_OPT
include/antares/solver/optimisation/adequacy_patch_csr/hourly_csr_problem.h
include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.h
adequacy_patch_csr/adq_patch_post_process_list.cpp
include/antares/solver/optimisation/adequacy_patch_local_matching/adq_patch_local_matching.h
adequacy_patch_local_matching/adq_patch_local_matching.cpp
include/antares/solver/optimisation/adequacy_patch_csr/adq_patch_curtailment_sharing.h
adequacy_patch_csr/adq_patch_curtailment_sharing.cpp
adequacy_patch_csr/solve_problem.cpp
Expand Down Expand Up @@ -209,4 +203,4 @@ target_include_directories(model_antares

install(DIRECTORY include/antares
DESTINATION "include"
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void HourlyCSRProblem::calculateCsrParameters()
// calculate netPositionInit and the RHS of the AreaBalance constraints
std::tie(netPositionInit, std::ignore, std::ignore) = calculateAreaFlowBalance(
problemeHebdo_,
adqPatchParams_.localMatching.setToZeroOutsideInsideLinks,
adqPatchParams_.setToZeroOutsideInsideLinks,
Area,
hour);
double ensInit = problemeHebdo_->ResultatsHoraires[Area]
Expand Down

This file was deleted.

Loading

0 comments on commit 9accb36

Please sign in to comment.