Skip to content

Commit

Permalink
[DEV] Use getCoefficient instead of scratchpad for wind
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Oct 3, 2023
1 parent 3448fad commit 206781b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/libs/antares/study/parts/wind/series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ double* DataSeriesWind::getCoefficient(unsigned int year) const
return timeSeries[getIndex(year)];
}

double DataSeriesWind::getCoefficient(const unsigned int year, const unsigned int hour) const
{
return timeSeries[getIndex(year)][hour];
}

unsigned int DataSeriesWind::getIndex(unsigned int year) const
{
return (timeSeries.width != 1) ? timeseriesNumbers[0][year] : 0;
Expand Down
1 change: 1 addition & 0 deletions src/libs/antares/study/parts/wind/series.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class DataSeriesWind
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:
Expand Down
2 changes: 1 addition & 1 deletion src/solver/hydro/management/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void HydroManagement::prepareNetDemand(uint numSpace, uint year)
if (parameters_.renewableGeneration.isAggregated())
{
netdemand = +scratchpad.ts.load[area.load.series->getIndex(year)][hour]
- scratchpad.ts.wind[area.wind.series->getIndex(year)][hour] - scratchpad.miscGenSum[hour]
- area.wind.series->getCoefficient(year, hour) - scratchpad.miscGenSum[hour]
- scratchpad.ts.solar[area.solar.series->getIndex(year)][hour] - ror[hour]
- ((ModeT != Data::stdmAdequacy) ? scratchpad.mustrunSum[hour]
: scratchpad.originalMustrunSum[hour]);
Expand Down
3 changes: 1 addition & 2 deletions src/solver/simulation/sim_calcul_economique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@ void SIM_RenseignementProblemeHebdo(const Study& study,
auto& area = *(study.areas.byIndex[k]);
auto& scratchpad = area.scratchpad[numSpace];
auto& ror = area.hydro.series->ror;
auto windSeriesIndex = area.wind.series->getIndex(problem.year);
auto loadSeriesIndex = area.load.series->getIndex(problem.year);
auto hydroSeriesIndex = area.hydro.series->getIndex(problem.year);
auto solarSeriesIndex = area.solar.series->getIndex(problem.year);
Expand All @@ -580,7 +579,7 @@ void SIM_RenseignementProblemeHebdo(const Study& study,
double& mustRunGen = problem.AllMustRunGeneration[hourInWeek].AllMustRunGenerationOfArea[k];
if (parameters.renewableGeneration.isAggregated())
{
mustRunGen = scratchpad.ts.wind[windSeriesIndex][hourInYear]
mustRunGen = area.wind.series->getCoefficient(problem.year, hourInYear)
+ scratchpad.ts.solar[solarSeriesIndex][hourInYear]
+ scratchpad.miscGenSum[hourInYear] + ror[tsFatalIndex][hourInYear]
+ scratchpad.mustrunSum[hourInYear];
Expand Down

0 comments on commit 206781b

Please sign in to comment.