From 2764122b8c5fcd2e433eda9da65f0a7e9df8f113 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 10:02:03 +0200 Subject: [PATCH 01/11] do all checks before parallel batches --- .../hydro/management/HydroInputsChecker.h | 5 ++--- .../hydro/management/HydroInputsChecker.cpp | 22 +++++++++---------- .../antares/solver/simulation/solver.hxx | 10 ++++++++- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h b/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h index eca3ea89bf..061a17b33b 100644 --- a/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h +++ b/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h @@ -30,8 +30,8 @@ namespace Antares class HydroInputsChecker { public: - HydroInputsChecker(Antares::Data::Study& study, Solver::IResultWriter& resultWriter); - void Execute(); + HydroInputsChecker(Antares::Data::Study& study); + void Execute(uint year); private: Data::AreaList& areas_; @@ -42,7 +42,6 @@ class HydroInputsChecker const uint endYear_; PrepareInflows prepareInflows_; MinGenerationScaling minGenerationScaling_; - Solver::IResultWriter& resultWriter_; //! return false if checkGenerationPowerConsistency or checkMinGeneration returns false bool checkMonthlyMinGeneration(uint year, const Data::Area& area) const; diff --git a/src/solver/hydro/management/HydroInputsChecker.cpp b/src/solver/hydro/management/HydroInputsChecker.cpp index 48cc7f2229..54dbefd3a1 100644 --- a/src/solver/hydro/management/HydroInputsChecker.cpp +++ b/src/solver/hydro/management/HydroInputsChecker.cpp @@ -40,25 +40,25 @@ HydroInputsChecker::HydroInputsChecker(Antares::Data::Study& study, firstYear_(0), endYear_(1 + study.runtime->rangeLimits.year[Data::rangeEnd]), prepareInflows_(study.areas, study.calendar), - minGenerationScaling_(study.areas, study.calendar), - resultWriter_(resultWriter) + minGenerationScaling_(study.areas, study.calendar) { } -void HydroInputsChecker::Execute() +void HydroInputsChecker::Execute(uint year) { - for (auto year = firstYear_; year < endYear_; ++year) + // for (auto year = firstYear_; year < endYear_; ++year) + // { + // unecessary, done by the caller ? + if (parameters_.yearsFilter[year]) { - if (parameters_.yearsFilter[year]) + prepareInflows_.Run(year); + minGenerationScaling_.Run(year); + if (!checksOnGenerationPowerBounds(year)) { - prepareInflows_.Run(year); - minGenerationScaling_.Run(year); - if (!checksOnGenerationPowerBounds(year)) - { - throw FatalError("hydro inputs checks: invalid minimum generation"); - } + throw FatalError("hydro inputs checks: invalid minimum generation"); } } + // } } bool HydroInputsChecker::checksOnGenerationPowerBounds(uint year) const diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index a541ebab4b..3e228fc3d2 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -1011,8 +1011,16 @@ void ISimulation::loopThroughYears(uint firstYear, set_it->yearsIndices, set_it->isYearPerformed, randomHydroGenerator); - HydroInputsChecker(study, pResultWriter).Execute(); + HydroInputsChecker hydroInputsChecker(study); + for (year_it = set_it->yearsIndices.begin(); year_it != set_it->yearsIndices.end(); + ++year_it) + { + hydroInputsChecker.Execute(*year_it); + } + } + for (set_it = setsOfParallelYears.begin(); set_it != setsOfParallelYears.end(); ++set_it) + { std::vector::iterator year_it; bool yearPerformed = false; From 624ea3867b8710d6ab0782a32060a919b5604e0d Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 10:06:49 +0200 Subject: [PATCH 02/11] add iterator type --- .../simulation/include/antares/solver/simulation/solver.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index 3e228fc3d2..a563d57226 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -1012,7 +1012,7 @@ void ISimulation::loopThroughYears(uint firstYear, set_it->isYearPerformed, randomHydroGenerator); HydroInputsChecker hydroInputsChecker(study); - for (year_it = set_it->yearsIndices.begin(); year_it != set_it->yearsIndices.end(); + for (auto year_it = set_it->yearsIndices.begin(); year_it != set_it->yearsIndices.end(); ++year_it) { hydroInputsChecker.Execute(*year_it); From 025dec2ae7550a6a1e712e866861525a3a014663 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 10:11:06 +0200 Subject: [PATCH 03/11] fix --- src/solver/hydro/management/HydroInputsChecker.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/solver/hydro/management/HydroInputsChecker.cpp b/src/solver/hydro/management/HydroInputsChecker.cpp index 54dbefd3a1..30cb9c7372 100644 --- a/src/solver/hydro/management/HydroInputsChecker.cpp +++ b/src/solver/hydro/management/HydroInputsChecker.cpp @@ -31,8 +31,7 @@ namespace Antares { -HydroInputsChecker::HydroInputsChecker(Antares::Data::Study& study, - Solver::IResultWriter& resultWriter): +HydroInputsChecker::HydroInputsChecker(Antares::Data::Study& study): areas_(study.areas), parameters_(study.parameters), calendar_(study.calendar), From e788f5aa93518ca12ecb1edd969bc4ce129ed59d Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 11:07:35 +0200 Subject: [PATCH 04/11] update --- .../antares/solver/simulation/solver.h | 2 +- .../antares/solver/simulation/solver.hxx | 83 +++++++++---------- 2 files changed, 38 insertions(+), 47 deletions(-) diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.h b/src/solver/simulation/include/antares/solver/simulation/solver.h index 29c087759f..eb7700e33a 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.h +++ b/src/solver/simulation/include/antares/solver/simulation/solver.h @@ -126,7 +126,7 @@ class ISimulation: public Impl ** Storing these costs to compute std deviation later. */ void computeAnnualCostsStatistics(std::vector& state, - std::vector::iterator& set_it); + setOfParallelYears& batch); /*! ** \brief Iterate through all MC years diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index a563d57226..03aa48bce8 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -915,23 +915,20 @@ void ISimulation::computeRandomNumbers( } } // End loop over years -} // End function +} // End function template void ISimulation::computeAnnualCostsStatistics( std::vector& state, - std::vector::iterator& set_it) + setOfParallelYears& batch) { // Loop over years contained in the set - std::vector::iterator year_it; - for (year_it = set_it->yearsIndices.begin(); year_it != set_it->yearsIndices.end(); ++year_it) + for (auto y: batch.yearsIndices) { - // Get the index of the year - unsigned int y = *year_it; - if (set_it->isYearPerformed[y]) + if (batch.isYearPerformed[y]) { // Get space number associated to the performed year - uint numSpace = set_it->performedYearToSpace[y]; + uint numSpace = batch.performedYearToSpace[y]; const Variable::State& s = state[numSpace]; pAnnualStatistics.systemCost.addCost(s.annualSystemCost); pAnnualStatistics.criterionCost1.addCost(s.optimalSolutionCost1); @@ -985,73 +982,67 @@ void ISimulation::loopThroughYears(uint firstYear, // Related to annual costs statistics (printed in output into separate files) pAnnualStatistics.setNbPerformedYears(pNbYearsReallyPerformed); - // Container for random numbers of parallel years (to be executed or not) - randomNumbers randomForParallelYears(maxNbYearsPerformedInAset, - study.parameters.power.fluctuations); - - // Allocating memory to store random numbers of all parallel years - allocateMemoryForRandomNumbers(randomForParallelYears); - // Number of threads to perform the jobs waiting in the queue pQueueService->maximumThreadCount(pNbMaxPerformedYearsInParallel); + std::map randomNumbersMap; // Loop over sets of parallel years - std::vector::iterator set_it; - for (set_it = setsOfParallelYears.begin(); set_it != setsOfParallelYears.end(); ++set_it) + for (auto batch: setsOfParallelYears) { + // Container for random numbers of parallel years (to be executed or not) + randomNumbers randomForParallelYears(maxNbYearsPerformedInAset, + study.parameters.power.fluctuations); + + // Allocating memory to store random numbers of all parallel years + allocateMemoryForRandomNumbers(randomForParallelYears); + // 1 - We may want to regenerate the time-series this year. // This is the case when the preprocessors are enabled from the // interface and/or the refresh is enabled. - if (set_it->regenerateTS) + if (batch.regenerateTS) { - regenerateTimeSeries(set_it->yearForTSgeneration); + regenerateTimeSeries(batch.yearForTSgeneration); } computeRandomNumbers(randomForParallelYears, - set_it->yearsIndices, - set_it->isYearPerformed, + batch.yearsIndices, + batch.isYearPerformed, randomHydroGenerator); + randomNumbersMap.emplace(&batch, randomForParallelYears); HydroInputsChecker hydroInputsChecker(study); - for (auto year_it = set_it->yearsIndices.begin(); year_it != set_it->yearsIndices.end(); - ++year_it) + for (auto year: batch.yearsIndices) { - hydroInputsChecker.Execute(*year_it); + hydroInputsChecker.Execute(year); } } - for (set_it = setsOfParallelYears.begin(); set_it != setsOfParallelYears.end(); ++set_it) + for (auto batch: setsOfParallelYears) { - std::vector::iterator year_it; - bool yearPerformed = false; Concurrency::FutureSet results; - for (year_it = set_it->yearsIndices.begin(); year_it != set_it->yearsIndices.end(); - ++year_it) + for (auto y: batch.yearsIndices) { - // Get the index of the year - unsigned int y = *year_it; - - bool performCalculations = set_it->isYearPerformed[y]; + bool performCalculations = batch.isYearPerformed[y]; unsigned int numSpace = 999999; if (performCalculations) { yearPerformed = true; - numSpace = set_it->performedYearToSpace[y]; + numSpace = batch.performedYearToSpace[y]; } // If the year has not to be rerun, we skip the computation of the year. // Note that, when we enter for the first time in the "for" loop, all years of the set - // have to be rerun (meaning : they must be run once). if(!set_it->yearFailed[y]) + // have to be rerun (meaning : they must be run once). if(!batch.yearFailed[y]) // continue; auto task = std::make_shared>( this, y, - set_it->yearFailed, - set_it->isFirstPerformedYearOfASet, + batch.yearFailed, + batch.isFirstPerformedYearOfASet, pFirstSetParallelWithAPerformedYearWasRun, numSpace, - randomForParallelYears, + randomNumbersMap.at(&batch), performCalculations, study, state, @@ -1061,7 +1052,7 @@ void ISimulation::loopThroughYears(uint firstYear, results.add(Concurrency::AddTask(*pQueueService, task)); } // End loop over years of the current set of parallel years - logPerformedYearsInAset(*set_it); + logPerformedYearsInAset(batch); pQueueService->start(); @@ -1077,7 +1068,7 @@ void ISimulation::loopThroughYears(uint firstYear, } // On regarde si au moins une année du lot n'a pas trouvé de solution - for (auto& [year, failed]: set_it->yearFailed) + for (auto& [year, failed]: batch.yearFailed) { // Si une année du lot d'années n'a pas trouvé de solution, on arrête tout if (failed) @@ -1089,20 +1080,20 @@ void ISimulation::loopThroughYears(uint firstYear, } // Computing the summary : adding the contribution of MC years // previously computed in parallel - ImplementationType::variables.computeSummary(set_it->spaceToPerformedYear, - set_it->nbPerformedYears); + ImplementationType::variables.computeSummary(batch.spaceToPerformedYear, + batch.nbPerformedYears); // Computing summary of spatial aggregations ImplementationType::variables.computeSpatialAggregatesSummary(ImplementationType::variables, - set_it->spaceToPerformedYear, - set_it->nbPerformedYears); + batch.spaceToPerformedYear, + batch.nbPerformedYears); // Computes statistics on annual (system and solution) costs, to be printed in output into // separate files - computeAnnualCostsStatistics(state, set_it); + computeAnnualCostsStatistics(state, batch); // Set to zero the random numbers of all parallel years - randomForParallelYears.reset(); + // randomForParallelYears.reset(); } // End loop over sets of parallel years From d8ac68ef3124170b336f8725a0173af5d352f7ac Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 11:29:58 +0200 Subject: [PATCH 05/11] move years randomization --- .../antares/solver/simulation/solver.hxx | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index 03aa48bce8..e55b430841 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -982,20 +982,19 @@ void ISimulation::loopThroughYears(uint firstYear, // Related to annual costs statistics (printed in output into separate files) pAnnualStatistics.setNbPerformedYears(pNbYearsReallyPerformed); + // Container for random numbers of parallel years (to be executed or not) + randomNumbers randomForParallelYears(maxNbYearsPerformedInAset, + study.parameters.power.fluctuations); + + // Allocating memory to store random numbers of all parallel years + allocateMemoryForRandomNumbers(randomForParallelYears); + // Number of threads to perform the jobs waiting in the queue pQueueService->maximumThreadCount(pNbMaxPerformedYearsInParallel); - std::map randomNumbersMap; // Loop over sets of parallel years for (auto batch: setsOfParallelYears) { - // Container for random numbers of parallel years (to be executed or not) - randomNumbers randomForParallelYears(maxNbYearsPerformedInAset, - study.parameters.power.fluctuations); - - // Allocating memory to store random numbers of all parallel years - allocateMemoryForRandomNumbers(randomForParallelYears); - // 1 - We may want to regenerate the time-series this year. // This is the case when the preprocessors are enabled from the // interface and/or the refresh is enabled. @@ -1004,11 +1003,6 @@ void ISimulation::loopThroughYears(uint firstYear, regenerateTimeSeries(batch.yearForTSgeneration); } - computeRandomNumbers(randomForParallelYears, - batch.yearsIndices, - batch.isYearPerformed, - randomHydroGenerator); - randomNumbersMap.emplace(&batch, randomForParallelYears); HydroInputsChecker hydroInputsChecker(study); for (auto year: batch.yearsIndices) { @@ -1018,6 +1012,11 @@ void ISimulation::loopThroughYears(uint firstYear, for (auto batch: setsOfParallelYears) { + computeRandomNumbers(randomForParallelYears, + batch.yearsIndices, + batch.isYearPerformed, + randomHydroGenerator); + bool yearPerformed = false; Concurrency::FutureSet results; for (auto y: batch.yearsIndices) @@ -1042,7 +1041,7 @@ void ISimulation::loopThroughYears(uint firstYear, batch.isFirstPerformedYearOfASet, pFirstSetParallelWithAPerformedYearWasRun, numSpace, - randomNumbersMap.at(&batch), + randomForParallelYears, performCalculations, study, state, @@ -1093,7 +1092,7 @@ void ISimulation::loopThroughYears(uint firstYear, computeAnnualCostsStatistics(state, batch); // Set to zero the random numbers of all parallel years - // randomForParallelYears.reset(); + randomForParallelYears.reset(); } // End loop over sets of parallel years From 4dc25d9866516798d5d3542f3879c44584832497 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 13:41:04 +0200 Subject: [PATCH 06/11] fix: ref instead of copy --- .../simulation/include/antares/solver/simulation/solver.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index e55b430841..362464fa88 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -993,7 +993,7 @@ void ISimulation::loopThroughYears(uint firstYear, pQueueService->maximumThreadCount(pNbMaxPerformedYearsInParallel); // Loop over sets of parallel years - for (auto batch: setsOfParallelYears) + for (const auto& batch: setsOfParallelYears) { // 1 - We may want to regenerate the time-series this year. // This is the case when the preprocessors are enabled from the @@ -1010,7 +1010,7 @@ void ISimulation::loopThroughYears(uint firstYear, } } - for (auto batch: setsOfParallelYears) + for (auto& batch: setsOfParallelYears) { computeRandomNumbers(randomForParallelYears, batch.yearsIndices, From d844b6c08abefea64fc09c7712a9853cf013c14d Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 14:26:59 +0200 Subject: [PATCH 07/11] make optionnal hydro Ts refresh --- .gitignore | 2 +- .../antares/solver/simulation/solver.h | 3 +- .../antares/solver/simulation/solver.hxx | 33 ++++++++++++++----- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 1a35b988bf..f17c3637a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ - +_install/* antares-[0-9].[0-9]-* .*.sw[a-z] diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.h b/src/solver/simulation/include/antares/solver/simulation/solver.h index eb7700e33a..0c0b339a2a 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.h +++ b/src/solver/simulation/include/antares/solver/simulation/solver.h @@ -86,8 +86,9 @@ class ISimulation: public Impl /*! ** \brief Regenerate time-series if required for a given year */ - void regenerateTimeSeries(uint year); + void regenerateTimeSeries(uint year, bool include_hydro = true); + void regenerateHydroTimeSeries(uint year); /*! ** \brief Builds sets of parallel years ** diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index 362464fa88..634c2e5b7d 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -434,7 +434,17 @@ void ISimulation::writeResults(bool synthesis, uint year, ui } template -void ISimulation::regenerateTimeSeries(uint year) +void ISimulation::regenerateHydroTimeSeries(uint year) +{ + if (pData.haveToRefreshTSHydro && (year % pData.refreshIntervalHydro == 0)) + { + pDurationCollector("tsgen_hydro") << [year, this] + { GenerateTimeSeries(study, year, pResultWriter); }; + } +} + +template +void ISimulation::regenerateTimeSeries(uint year, bool include_hydro) { // A preprocessor can be launched for several reasons: // * The option "Preprocessor" is checked in the interface _and_ year == 0 @@ -460,10 +470,9 @@ void ISimulation::regenerateTimeSeries(uint year) << [year, this] { GenerateTimeSeries(study, year, pResultWriter); }; } // Hydro - if (pData.haveToRefreshTSHydro && (year % pData.refreshIntervalHydro == 0)) + if (include_hydro) { - pDurationCollector("tsgen_hydro") << [year, this] - { GenerateTimeSeries(study, year, pResultWriter); }; + regenerateHydroTimeSeries(year); } // Thermal @@ -992,15 +1001,15 @@ void ISimulation::loopThroughYears(uint firstYear, // Number of threads to perform the jobs waiting in the queue pQueueService->maximumThreadCount(pNbMaxPerformedYearsInParallel); - // Loop over sets of parallel years - for (const auto& batch: setsOfParallelYears) + // Loop over sets of parallel years to check hydro inputs + for (auto batch: setsOfParallelYears) { // 1 - We may want to regenerate the time-series this year. // This is the case when the preprocessors are enabled from the // interface and/or the refresh is enabled. if (batch.regenerateTS) { - regenerateTimeSeries(batch.yearForTSgeneration); + regenerateHydroTimeSeries(batch.yearForTSgeneration); } HydroInputsChecker hydroInputsChecker(study); @@ -1010,8 +1019,16 @@ void ISimulation::loopThroughYears(uint firstYear, } } - for (auto& batch: setsOfParallelYears) + // Loop over sets of parallel years to run the simulation + for (auto batch: setsOfParallelYears) { + // 1 - We may want to regenerate the time-series this year. + // This is the case when the preprocessors are enabled from the + // interface and/or the refresh is enabled. + if (batch.regenerateTS) + { + regenerateTimeSeries(batch.yearForTSgeneration, false); + } computeRandomNumbers(randomForParallelYears, batch.yearsIndices, batch.isYearPerformed, From f43693598e0055194b0cfbb251fa52e2fad1b5fe Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 14:39:02 +0200 Subject: [PATCH 08/11] fix namespace --- .../simulation/include/antares/solver/simulation/solver.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index 634c2e5b7d..65f078f2e7 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -436,6 +436,7 @@ void ISimulation::writeResults(bool synthesis, uint year, ui template void ISimulation::regenerateHydroTimeSeries(uint year) { + using namespace TSGenerator; if (pData.haveToRefreshTSHydro && (year % pData.refreshIntervalHydro == 0)) { pDurationCollector("tsgen_hydro") << [year, this] From 167114bcd56f85559eaf1cdd336f5260ad18474f Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 15:13:37 +0200 Subject: [PATCH 09/11] [skip ci] restore .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f17c3637a2..1a35b988bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -_install/* + antares-[0-9].[0-9]-* .*.sw[a-z] From c6fd093fd05796ee4fb416ad99ffff00feb1b598 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 15:15:47 +0200 Subject: [PATCH 10/11] re-use object --- .../simulation/include/antares/solver/simulation/solver.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index 65f078f2e7..1fc676edb2 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -1001,6 +1001,7 @@ void ISimulation::loopThroughYears(uint firstYear, // Number of threads to perform the jobs waiting in the queue pQueueService->maximumThreadCount(pNbMaxPerformedYearsInParallel); + HydroInputsChecker hydroInputsChecker(study); // Loop over sets of parallel years to check hydro inputs for (auto batch: setsOfParallelYears) @@ -1013,7 +1014,6 @@ void ISimulation::loopThroughYears(uint firstYear, regenerateHydroTimeSeries(batch.yearForTSgeneration); } - HydroInputsChecker hydroInputsChecker(study); for (auto year: batch.yearsIndices) { hydroInputsChecker.Execute(year); From 22aaba74650f1f4d8449df96ccd862b27180dfa2 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 13 Jun 2024 15:23:09 +0200 Subject: [PATCH 11/11] [skip ci] comment and add explicit keyword --- .../antares/solver/hydro/management/HydroInputsChecker.h | 2 +- src/solver/hydro/management/HydroInputsChecker.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h b/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h index 061a17b33b..d7e3818ee4 100644 --- a/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h +++ b/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h @@ -30,7 +30,7 @@ namespace Antares class HydroInputsChecker { public: - HydroInputsChecker(Antares::Data::Study& study); + explicit HydroInputsChecker(Antares::Data::Study& study); void Execute(uint year); private: diff --git a/src/solver/hydro/management/HydroInputsChecker.cpp b/src/solver/hydro/management/HydroInputsChecker.cpp index 30cb9c7372..5d3dc294eb 100644 --- a/src/solver/hydro/management/HydroInputsChecker.cpp +++ b/src/solver/hydro/management/HydroInputsChecker.cpp @@ -45,9 +45,6 @@ HydroInputsChecker::HydroInputsChecker(Antares::Data::Study& study): void HydroInputsChecker::Execute(uint year) { - // for (auto year = firstYear_; year < endYear_; ++year) - // { - // unecessary, done by the caller ? if (parameters_.yearsFilter[year]) { prepareInflows_.Run(year); @@ -57,7 +54,6 @@ void HydroInputsChecker::Execute(uint year) throw FatalError("hydro inputs checks: invalid minimum generation"); } } - // } } bool HydroInputsChecker::checksOnGenerationPowerBounds(uint year) const