diff --git a/src/solver/hydro/include/antares/solver/hydro/management/management.h b/src/solver/hydro/include/antares/solver/hydro/management/management.h index 78f3d4e6ea..3050515ca5 100644 --- a/src/solver/hydro/include/antares/solver/hydro/management/management.h +++ b/src/solver/hydro/include/antares/solver/hydro/management/management.h @@ -107,7 +107,6 @@ class HydroManagement final HydroManagement(const Data::AreaList& areas, const Data::Parameters& params, const Date::Calendar& calendar, - unsigned int maxNbYearsInParallel, Solver::IResultWriter& resultWriter); //! Perform the hydro ventilation diff --git a/src/solver/hydro/management/management.cpp b/src/solver/hydro/management/management.cpp index fe9311280d..b20be5e375 100644 --- a/src/solver/hydro/management/management.cpp +++ b/src/solver/hydro/management/management.cpp @@ -117,12 +117,10 @@ double BetaVariable(double a, double b, MersenneTwister& random) HydroManagement::HydroManagement(const Data::AreaList& areas, const Data::Parameters& params, const Date::Calendar& calendar, - unsigned int maxNbYearsInParallel, Solver::IResultWriter& resultWriter): areas_(areas), calendar_(calendar), parameters_(params), - maxNbYearsInParallel_(maxNbYearsInParallel), resultWriter_(resultWriter) { // Ventilation results memory allocation diff --git a/src/solver/simulation/adequacy.cpp b/src/solver/simulation/adequacy.cpp index f4e7f433d7..63d8462dfc 100644 --- a/src/solver/simulation/adequacy.cpp +++ b/src/solver/simulation/adequacy.cpp @@ -68,15 +68,7 @@ bool Adequacy::simulationBegin() pProblemesHebdo.resize(pNbMaxPerformedYearsInParallel); for (uint numSpace = 0; numSpace < pNbMaxPerformedYearsInParallel; numSpace++) { - SIM_InitialisationProblemeHebdo(study, pProblemesHebdo[numSpace], 168, numSpace); - - assert((uint)nbHoursInAWeek == (uint)pProblemesHebdo[numSpace].NombreDePasDeTemps - && "inconsistency"); - if ((uint)nbHoursInAWeek != (uint)pProblemesHebdo[numSpace].NombreDePasDeTemps) - { - logs.fatal() << "internal error"; - return false; - } + SIM_InitialisationProblemeHebdo(study, pProblemesHebdo[numSpace], nbHoursInAWeek, numSpace); } } diff --git a/src/solver/simulation/economy.cpp b/src/solver/simulation/economy.cpp index 0ffdf71d7b..02fac95314 100644 --- a/src/solver/simulation/economy.cpp +++ b/src/solver/simulation/economy.cpp @@ -73,13 +73,7 @@ bool Economy::simulationBegin() for (uint numSpace = 0; numSpace < pNbMaxPerformedYearsInParallel; numSpace++) { - SIM_InitialisationProblemeHebdo(study, pProblemesHebdo[numSpace], 168, numSpace); - - if ((uint)nbHoursInAWeek != (uint)pProblemesHebdo[numSpace].NombreDePasDeTemps) - { - logs.fatal() << "internal error"; - return false; - } + SIM_InitialisationProblemeHebdo(study, pProblemesHebdo[numSpace], nbHoursInAWeek, numSpace); auto options = createOptimizationOptions(study); weeklyOptProblems_[numSpace] = Antares::Solver::Optimization::WeeklyOptimization:: diff --git a/src/solver/simulation/include/antares/solver/simulation/simulation.h b/src/solver/simulation/include/antares/solver/simulation/simulation.h index 6d814157d1..bf214beff6 100644 --- a/src/solver/simulation/include/antares/solver/simulation/simulation.h +++ b/src/solver/simulation/include/antares/solver/simulation/simulation.h @@ -45,7 +45,7 @@ void SIM_AllocationProblemeHebdo(const Antares::Data::Study& study, */ void SIM_InitialisationProblemeHebdo(Antares::Data::Study& study, PROBLEME_HEBDO& problem, - int NombreDePasDeTemps, + unsigned int NombreDePasDeTemps, uint numspace); void SIM_RenseignementProblemeHebdo(const Antares::Data::Study& study, diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index dc2a7d4e09..87f38225cc 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -55,7 +55,7 @@ public: randomNumbers& pRandomForParallelYears, bool pPerformCalculations, Data::Study& pStudy, - std::vector& pState, + Variable::State& pState, bool pYearByYear, Benchmarking::DurationCollector& durationCollector, IResultWriter& resultWriter): @@ -75,7 +75,6 @@ public: hydroManagement(study.areas, study.parameters, study.calendar, - study.maxNbYearsInParallel, resultWriter) { hydroHotStart = (study.parameters.initialReservoirLevels.iniLevels == Data::irlHotStart); @@ -96,7 +95,7 @@ private: randomNumbers& randomForParallelYears; bool performCalculations; Data::Study& study; - std::vector& state; + Variable::State& state; bool yearByYear; bool hydroHotStart; Benchmarking::DurationCollector& pDurationCollector; @@ -155,8 +154,7 @@ public: // 1 - Applying random levels for current year if (hydroHotStart && firstSetParallelWithAPerformedYearWasRun) { - randomReservoirLevel = state[numSpace] - .problemeHebdo->previousYearFinalLevels.data(); + randomReservoirLevel = state.problemeHebdo->previousYearFinalLevels.data(); } else { @@ -177,7 +175,7 @@ public: }; // Updating the state - state[numSpace].year = y; + state.year = y; // 5 - Resetting all variables for the output simulation_->variables.yearBegin(y, numSpace); @@ -189,7 +187,7 @@ public: OptimizationStatisticsWriter optWriter(pResultWriter, y); yearFailed[y] = !simulation_->year(progression, - state[numSpace], + state, numSpace, randomForCurrentYear, failedWeekList, @@ -201,7 +199,7 @@ public: // Log failing weeks logFailedWeek(y, study, failedWeekList); - simulation_->variables.yearEndBuild(state[numSpace], y, numSpace); + simulation_->variables.yearEndBuild(state, y, numSpace); // 7 - End of the year, this is the last stade where the variables can retrieve // their data for this year. @@ -1059,19 +1057,19 @@ void ISimulation::loopThroughYears(uint firstYear, // continue; auto task = std::make_shared>( - this, - y, - set_it->yearFailed, - set_it->isFirstPerformedYearOfASet, - pFirstSetParallelWithAPerformedYearWasRun, - numSpace, - randomForParallelYears, - performCalculations, - study, - state, - pYearByYear, - pDurationCollector, - pResultWriter); + this, + y, + set_it->yearFailed, + set_it->isFirstPerformedYearOfASet, + pFirstSetParallelWithAPerformedYearWasRun, + numSpace, + randomForParallelYears, + performCalculations, + study, + state[numSpace], + pYearByYear, + pDurationCollector, + pResultWriter); results.add(Concurrency::AddTask(*pQueueService, task)); } // End loop over years of the current set of parallel years diff --git a/src/solver/simulation/sim_calcul_economique.cpp b/src/solver/simulation/sim_calcul_economique.cpp index 8b921dfec3..c51d8283dc 100644 --- a/src/solver/simulation/sim_calcul_economique.cpp +++ b/src/solver/simulation/sim_calcul_economique.cpp @@ -71,7 +71,7 @@ static void importShortTermStorages( void SIM_InitialisationProblemeHebdo(Data::Study& study, PROBLEME_HEBDO& problem, - int NombreDePasDeTemps, + unsigned int NombreDePasDeTemps, uint numspace) { int NombrePaliers;