Skip to content

Commit

Permalink
Simplify TS numbers draws : resize mingen TS when hydro TS are generated
Browse files Browse the repository at this point in the history
Behavior before this commit :
   When hydro TS are generated, mingen are not generated : it is sized with 1 column.
   So (given an area and a year) a TS number for ror and storage does not apply to mingen in this case.
   It causes extra complexity in class TimeSeries to handle this.
   Note that, still in this case (hydro TS are generated), the only mingen TS is filled with zeros.

Behavior after this commit :
   We remove the complexity in class TimeSeries by doing the following :
   If hydro TS are generated, mingen TS matrix is resized to the number of TS to be generated and filled with zeros.
   So we still have a mingen of zeros.
  • Loading branch information
guilpier-code committed Dec 4, 2023
1 parent 95c631c commit 19df9ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/libs/antares/study/parts/hydro/series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,11 @@ void DataSeriesHydro::reset()
count = 1;
}

void DataSeriesHydro::resizeRORandSTORAGE(unsigned int width)
void DataSeriesHydro::resetGenerationTS(unsigned int width)
{
ror.resize(width, HOURS_PER_YEAR);
storage.resize(width, DAYS_PER_YEAR);
ror.reset(width, HOURS_PER_YEAR);
storage.reset(width, DAYS_PER_YEAR);
mingen.reset(width, HOURS_PER_YEAR);
count = width;
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/parts/hydro/series.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class DataSeriesHydro
*/
void reset();

void resizeRORandSTORAGE(unsigned int width);
void resetGenerationTS(unsigned int width);
void resizeGenerationTS(unsigned int w, unsigned int h);

/*!
Expand Down
2 changes: 1 addition & 1 deletion src/solver/ts-generator/generator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ inline void ResizeGeneratedTimeSeries(Data::AreaList& areas, Data::Parameters& p
// Hydro
if (params.timeSeriesToRefresh & Data::timeSeriesHydro)
{
area.hydro.series->resizeRORandSTORAGE(params.nbTimeSeriesHydro);
area.hydro.series->resetGenerationTS(params.nbTimeSeriesHydro);
}

// Thermal
Expand Down

0 comments on commit 19df9ac

Please sign in to comment.