Skip to content

Commit

Permalink
CR 25 (hydro final level) : correction after merge/update from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
guilpier-code committed Jun 17, 2024
1 parent b4a41d8 commit 1b7039a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 46 deletions.
96 changes: 51 additions & 45 deletions src/libs/antares/study/scenario-builder/rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,11 @@ bool Rules::readLine(const AreaName::Vector& splitKey, String value, bool update
return readSolar(splitKey, value, updaterMode);
}
else if (kind_of_scenario == "hl")
{
return readInitialHydroLevels(splitKey, value, updaterMode);
}
else if (kind_of_scenario == "hfl")
{
return readFinalHydroLevels(splitKey, value, updaterMode);
}
else if (kind_of_scenario == "ntc")
Expand All @@ -419,61 +422,64 @@ bool Rules::readLine(const AreaName::Vector& splitKey, String value, bool update
return false;
}

bool Rules::apply()
bool Rules::apply()
{
bool returned_status = true;
if (pAreaCount)
{
bool returned_status = true;
if (pAreaCount)
returned_status = load.apply(study_) && returned_status;
returned_status = solar.apply(study_) && returned_status;
returned_status = hydro.apply(study_) && returned_status;
returned_status = wind.apply(study_) && returned_status;
for (uint i = 0; i != pAreaCount; ++i)
{
returned_status = load.apply(study_) && returned_status;
returned_status = solar.apply(study_) && returned_status;
returned_status = hydro.apply(study_) && returned_status;
returned_status = wind.apply(study_) && returned_status;
for (uint i = 0; i != pAreaCount; ++i)
{
returned_status = thermal[i].apply(study_) && returned_status;
returned_status = renewable[i].apply(study_) && returned_status;
returned_status = linksNTC[i].apply(study_) && returned_status;
}
returned_status = hydroLevels.apply(study_) && returned_status;
returned_status = binding_constraints.apply(study_) && returned_status;
returned_status = thermal[i].apply(study_) && returned_status;
returned_status = renewable[i].apply(study_) && returned_status;
returned_status = linksNTC[i].apply(study_) && returned_status;
}
returned_status = hydroInitialLevels.apply(study_) && returned_status;
returned_status = hydroFinalLevels.apply(study_) && returned_status;
returned_status = binding_constraints.apply(study_) && returned_status;
}

void Rules::sendWarningsForDisabledClusters()
else
{
for (auto it = disabledClustersOnRuleActive.begin();
it != disabledClustersOnRuleActive.end();
it++)
returned_status = false;
}
return returned_status;
}

void Rules::sendWarningsForDisabledClusters()
{
for (auto it = disabledClustersOnRuleActive.begin();
it != disabledClustersOnRuleActive.end();
it++)
{
std::vector<uint>& scenariiForCurrentCluster = it->second;
int nbScenariiForCluster = (int)scenariiForCurrentCluster.size();
std::vector<uint>::iterator itv = scenariiForCurrentCluster.begin();

// Listing the 10 first years for which the current cluster was given a specific TS
// number in the scenario builder. Note that this list of years size could be less then
// 10, but are at least 1.
std::string listYears = std::to_string(*itv);
itv++;
for (int year_count = 1; itv != scenariiForCurrentCluster.end() && year_count < 10;
itv++, year_count++)
{
listYears += ", " + std::to_string(*itv);
}

// Adding last scenario to the list
if (nbScenariiForCluster > 10)
{
std::vector<uint>& scenariiForCurrentCluster = it->second;
int nbScenariiForCluster = (int)scenariiForCurrentCluster.size();
std::vector<uint>::iterator itv = scenariiForCurrentCluster.begin();

// Listing the 10 first years for which the current cluster was given a specific TS
// number in the scenario builder. Note that this list of years size could be less then
// 10, but are at least 1.
std::string listYears = std::to_string(*itv);
itv++;
for (int year_count = 1; itv != scenariiForCurrentCluster.end() && year_count < 10;
itv++, year_count++)
{
listYears += ", " + std::to_string(*itv);
}

// Adding last scenario to the list
if (nbScenariiForCluster > 10)
{
listYears += ", ..., " + std::to_string(scenariiForCurrentCluster.back());
}

logs.warning() << "Cluster " << it->first
<< " not found: it may be disabled, though given TS numbers in sc "
"builder for year(s) :";
logs.warning() << listYears;
listYears += ", ..., " + std::to_string(scenariiForCurrentCluster.back());
}

logs.warning() << "Cluster " << it->first
<< " not found: it may be disabled, though given TS numbers in sc "
"builder for year(s) :";
logs.warning() << listYears;
}
}

} // namespace Antares::Data::ScenarioBuilder
7 changes: 6 additions & 1 deletion src/solver/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ set(SRC_SIMULATION
include/antares/solver/simulation/hydro-final-reservoir-level-functions.h
hydro-final-reservoir-level-functions.cpp
TimeSeriesNumbersWriter.cpp
include/antares/solver/simulation/BindingConstraintsTimeSeriesNumbersWriter.h)
include/antares/solver/simulation/BindingConstraintsTimeSeriesNumbersWriter.h
economy_mode.cpp
adequacy_mode.cpp
include/antares/solver/simulation/economy_mode.h
include/antares/solver/simulation/adequacy_mode.h
)
source_group("simulation" FILES ${SRC_SIMULATION})

#
Expand Down

0 comments on commit 1b7039a

Please sign in to comment.