diff --git a/src/libs/antares/study/parts/load/series.cpp b/src/libs/antares/study/parts/load/series.cpp index 30fdbff736..283800eb94 100644 --- a/src/libs/antares/study/parts/load/series.cpp +++ b/src/libs/antares/study/parts/load/series.cpp @@ -91,6 +91,11 @@ double* DataSeriesLoad::getCoefficient(unsigned int year) const return timeSeries[getIndex(year)]; } +double DataSeriesLoad::getCoefficient(const unsigned int year, const unsigned int hour) const +{ + return timeSeries[getIndex(year)][hour]; +} + unsigned int DataSeriesLoad::getIndex(unsigned int year) const { return (timeSeries.width != 1) ? timeseriesNumbers[0][year] : 0; diff --git a/src/libs/antares/study/parts/load/series.h b/src/libs/antares/study/parts/load/series.h index 76b90d5a85..86ec8f6a8c 100644 --- a/src/libs/antares/study/parts/load/series.h +++ b/src/libs/antares/study/parts/load/series.h @@ -50,6 +50,7 @@ class DataSeriesLoad void markAsModified() const; double* getCoefficient(unsigned int year) const; + double getCoefficient(const unsigned int year, const unsigned int hour) const; unsigned int getIndex(unsigned int year) const; public: diff --git a/src/libs/antares/study/parts/solar/series.cpp b/src/libs/antares/study/parts/solar/series.cpp index f47ad8d047..64a83cd2ab 100644 --- a/src/libs/antares/study/parts/solar/series.cpp +++ b/src/libs/antares/study/parts/solar/series.cpp @@ -91,6 +91,11 @@ double* DataSeriesSolar::getCoefficient(unsigned int year) const return timeSeries[getIndex(year)]; } +double DataSeriesSolar::getCoefficient(const unsigned int year, const unsigned int hour) const +{ + return timeSeries[getIndex(year)][hour]; +} + unsigned int DataSeriesSolar::getIndex(unsigned int year) const { return (timeSeries.width != 1) ? timeseriesNumbers[0][year] : 0; diff --git a/src/libs/antares/study/parts/solar/series.h b/src/libs/antares/study/parts/solar/series.h index dd37fbc9dc..526eade30e 100644 --- a/src/libs/antares/study/parts/solar/series.h +++ b/src/libs/antares/study/parts/solar/series.h @@ -46,6 +46,7 @@ class DataSeriesSolar void markAsModified() const; double* getCoefficient(unsigned int year) const; + double getCoefficient(const unsigned int year, const unsigned int hour) const; unsigned int getIndex(unsigned int year) const; public: diff --git a/src/solver/hydro/management/management.cpp b/src/solver/hydro/management/management.cpp index f0963b52e9..365135b26c 100644 --- a/src/solver/hydro/management/management.cpp +++ b/src/solver/hydro/management/management.cpp @@ -394,9 +394,9 @@ void HydroManagement::prepareNetDemand(uint numSpace, uint year) // Aggregated renewable production: wind & solar if (parameters_.renewableGeneration.isAggregated()) { - netdemand = +scratchpad.ts.load[area.load.series->getIndex(year)][hour] + netdemand = +area.load.series->getCoefficient(year, hour) - area.wind.series->getCoefficient(year, hour) - scratchpad.miscGenSum[hour] - - scratchpad.ts.solar[area.solar.series->getIndex(year)][hour] - ror[hour] + - area.solar.series->getCoefficient(year, hour) - ((ModeT != Data::stdmAdequacy) ? scratchpad.mustrunSum[hour] : scratchpad.originalMustrunSum[hour]); } @@ -404,7 +404,7 @@ void HydroManagement::prepareNetDemand(uint numSpace, uint year) // Renewable clusters, if enabled else if (parameters_.renewableGeneration.isClusters()) { - netdemand = scratchpad.ts.load[area.load.series->getIndex(year)][hour] + netdemand = area.load.series->getCoefficient(year, hour) - scratchpad.miscGenSum[hour] - ror[hour] - ((ModeT != Data::stdmAdequacy) ? scratchpad.mustrunSum[hour] : scratchpad.originalMustrunSum[hour]); diff --git a/src/solver/simulation/sim_calcul_economique.cpp b/src/solver/simulation/sim_calcul_economique.cpp index fa3e4dc14e..e752b065c5 100644 --- a/src/solver/simulation/sim_calcul_economique.cpp +++ b/src/solver/simulation/sim_calcul_economique.cpp @@ -569,9 +569,9 @@ void SIM_RenseignementProblemeHebdo(const Study& study, auto& area = *(study.areas.byIndex[k]); auto& scratchpad = area.scratchpad[numSpace]; auto& ror = area.hydro.series->ror; - auto loadSeriesIndex = area.load.series->getIndex(problem.year); + auto loadSeries = area.load.series->getCoefficient(problem.year, hourInYear); + auto solarSeries = area.solar.series->getCoefficient(problem.year, hourInYear); auto hydroSeriesIndex = area.hydro.series->getIndex(problem.year); - auto solarSeriesIndex = area.solar.series->getIndex(problem.year); assert(&scratchpad); @@ -580,7 +580,7 @@ void SIM_RenseignementProblemeHebdo(const Study& study, if (parameters.renewableGeneration.isAggregated()) { mustRunGen = area.wind.series->getCoefficient(problem.year, hourInYear) - + scratchpad.ts.solar[solarSeriesIndex][hourInYear] + + solarSeries + scratchpad.miscGenSum[hourInYear] + ror[tsFatalIndex][hourInYear] + scratchpad.mustrunSum[hourInYear]; } @@ -602,7 +602,7 @@ void SIM_RenseignementProblemeHebdo(const Study& study, && "NaN detected for 'AllMustRunGeneration', probably from miscGenSum/mustrunSum"); problem.ConsommationsAbattues[hourInWeek].ConsommationAbattueDuPays[k] - = +scratchpad.ts.load[loadSeriesIndex][hourInYear] + = +loadSeries - problem.AllMustRunGeneration[hourInWeek].AllMustRunGenerationOfArea[k]; if (problem.CaracteristiquesHydrauliques[k].PresenceDHydrauliqueModulable > 0)