-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify TS numbers drawings, fix bug related to refresh & local thermal generation #1752
Changes from 8 commits
7239dc1
8fa5257
106df5e
f2ebc1a
60cefd6
4416e6b
cdbde28
e45e560
561c156
868cd1c
57d65e0
123056b
0f00962
5a9b61e
80d5335
c607d9c
c8d6bac
610a7b6
80aba94
935bcc5
5568862
2433c84
9355df0
95c631c
19df9ac
ceb8a73
3580fe0
d707e59
47c0871
4a5b20c
d1edf1d
6d14a07
f42bde3
bcd83c3
08b3609
45486ce
416a9bf
3ef29e8
a733e0b
f900c39
009f3d7
470524f
d446816
b990b4c
3104805
6fff86c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -34,12 +34,11 @@ | |||||
#include <antares/writer/i_writer.h> | ||||||
#include "xcast/xcast.h" | ||||||
|
||||||
namespace Antares | ||||||
{ | ||||||
namespace Solver | ||||||
{ | ||||||
namespace TSGenerator | ||||||
namespace Antares::Solver::TSGenerator | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You suggest that namespace TSGenerator should not be contained in namespace Solver. |
||||||
{ | ||||||
|
||||||
void ResizeGeneratedTimeSeries(Data::AreaList& areas, Data::Parameters& params); | ||||||
|
||||||
/*! | ||||||
** \brief Regenerate the time-series | ||||||
*/ | ||||||
|
@@ -63,9 +62,7 @@ void DestroyAll(Data::Study& study); | |||||
template<enum Data::TimeSeriesType T> | ||||||
void Destroy(Data::Study& study, uint year); | ||||||
|
||||||
} // namespace TSGenerator | ||||||
} // namespace Solver | ||||||
} // namespace Antares | ||||||
} // namespace Antares::Solver::TSGenerator | ||||||
|
||||||
#include "generator.hxx" | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,12 +29,52 @@ | |
|
||
#include <antares/logs/logs.h> | ||
|
||
namespace Antares | ||
namespace Antares::Solver::TSGenerator | ||
{ | ||
namespace Solver | ||
{ | ||
namespace TSGenerator | ||
|
||
inline void ResizeGeneratedTimeSeries(Data::AreaList& areas, Data::Parameters& params) | ||
flomnes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
for (auto i = areas.begin(); i != areas.end(); ++i) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should use range-based for loop, no need for iterator. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done : for this, I used each() |
||
{ | ||
auto& area = *(i->second); | ||
|
||
// Load | ||
if (params.timeSeriesToGenerate & Data::timeSeriesLoad) | ||
{ | ||
area.load.series.timeSeries.reset(params.nbTimeSeriesLoad, HOURS_PER_YEAR); | ||
} | ||
|
||
// Wind | ||
if (params.timeSeriesToGenerate & Data::timeSeriesWind) | ||
{ | ||
area.wind.series.timeSeries.reset(params.nbTimeSeriesWind, HOURS_PER_YEAR); | ||
} | ||
|
||
// Solar | ||
if (params.timeSeriesToGenerate & Data::timeSeriesSolar) | ||
{ | ||
area.solar.series.timeSeries.reset(params.nbTimeSeriesSolar, HOURS_PER_YEAR); | ||
} | ||
|
||
// Hydro | ||
if (params.timeSeriesToGenerate & Data::timeSeriesHydro) | ||
{ | ||
area.hydro.series->resizeRORandSTORAGE(params.nbTimeSeriesHydro); | ||
} | ||
|
||
// Thermal | ||
auto end = area.thermal.list.mapping.end(); | ||
for (auto it = area.thermal.list.mapping.begin(); it != end; ++it) | ||
flomnes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
auto& cluster = *(it->second); | ||
bool globalThermalTSgeneration = params.timeSeriesToGenerate & Data::timeSeriesThermal; | ||
flomnes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (cluster.doWeGenerateTS(globalThermalTSgeneration)) | ||
cluster.series.timeSeries.resize(params.nbTimeSeriesThermal, HOURS_PER_YEAR); | ||
} | ||
} | ||
} | ||
|
||
|
||
// forward declaration | ||
// Hydro - see hydro.cpp | ||
bool GenerateHydroTimeSeries(Data::Study& study, uint year, IResultWriter& writer); | ||
|
@@ -157,8 +197,6 @@ inline void DestroyAll(Data::Study& study) | |
Solver::TSGenerator::Destroy<Data::timeSeriesThermal>(study, (uint)-1); | ||
} | ||
|
||
} // namespace TSGenerator | ||
} // namespace Solver | ||
} // namespace Antares | ||
} // namespace Antares::Solver::TSGenerator | ||
|
||
#endif // __ANTARES_SOLVER_timeSeries_GENERATOR_HXX__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,12 +46,6 @@ namespace Solver | |
{ | ||
namespace TSGenerator | ||
{ | ||
static void PreproHydroInitMatrices(Data::Study& study, uint tsCount) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explanations : we separated resizing from generation, so we moved this code to another place (see generator.cpp) |
||
{ | ||
study.areas.each([&](Data::Area& area) { | ||
area.hydro.series->resizeRORandSTORAGE(tsCount); | ||
}); | ||
} | ||
|
||
static void PreproRoundAllEntriesPlusDerated(Data::Study& study) | ||
{ | ||
|
@@ -155,8 +149,6 @@ bool GenerateHydroTimeSeries(Data::Study& study, uint currentYear, IResultWriter | |
|
||
uint nbTimeseries = study.parameters.nbTimeSeriesHydro; | ||
|
||
PreproHydroInitMatrices(study, nbTimeseries); | ||
|
||
long cumul = 0; | ||
|
||
for (uint l = 0; l != nbTimeseries; ++l) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,8 +72,6 @@ class GeneratorTempData final | |
|
||
uint currentYear; | ||
|
||
uint nbThermalTimeseries; | ||
|
||
bool derated; | ||
|
||
private: | ||
|
@@ -89,6 +87,7 @@ class GeneratorTempData final | |
const T& duration); | ||
|
||
private: | ||
uint nbThermalTimeseries_; | ||
const uint nbHoursPerYear = HOURS_PER_YEAR; | ||
const uint daysPerYear = DAYS_PER_YEAR; | ||
|
||
|
@@ -130,7 +129,7 @@ GeneratorTempData::GeneratorTempData(Data::Study& study, | |
|
||
archive = (0 != (parameters.timeSeriesToArchive & Data::timeSeriesThermal)); | ||
|
||
nbThermalTimeseries = parameters.nbTimeSeriesThermal; | ||
nbThermalTimeseries_ = parameters.nbTimeSeriesThermal; | ||
|
||
derated = parameters.derated; | ||
} | ||
|
@@ -251,15 +250,11 @@ void GeneratorTempData::operator()(Data::Area& area, Data::ThermalCluster& clust | |
|
||
if (0 == cluster.unitCount or 0 == cluster.nominalCapacity) | ||
{ | ||
cluster.series.timeSeries.reset(1, nbHoursPerYear); | ||
|
||
Comment on lines
-254
to
-255
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explanations : due to separation between TS resizing and generation, this code (resize) was moved elsewhere |
||
if (archive) | ||
writeResultsToDisk(area, cluster); | ||
return; | ||
} | ||
|
||
cluster.series.timeSeries.resize(nbThermalTimeseries, nbHoursPerYear); | ||
|
||
const auto& preproData = *(cluster.prepro); | ||
|
||
int AUN = (int)cluster.unitCount; | ||
|
@@ -355,7 +350,7 @@ void GeneratorTempData::operator()(Data::Area& area, Data::ThermalCluster& clust | |
|
||
double* dstSeries = nullptr; | ||
|
||
const uint tsCount = nbThermalTimeseries + 2; | ||
const uint tsCount = nbThermalTimeseries_ + 2; | ||
for (uint tsIndex = 0; tsIndex != tsCount; ++tsIndex) | ||
{ | ||
uint hour = 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,11 +57,6 @@ void StudyData::loadFromStudy(Data::Study& study, | |
logs.info() << " Added the area '" << area.name << "'"; | ||
localareas.push_back(&area); | ||
} | ||
else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explanations : code moved elsewhere due to separation between TS resizing and generation |
||
{ | ||
// resize and set the values for the matrix | ||
predicate.matrix(area).reset(1, HOURS_PER_YEAR); | ||
} | ||
} | ||
reloadDataFromAreaList(correlation); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanations : this is the place where we call the resizing for TS to be generated.