-
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 all 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 |
---|---|---|
|
@@ -257,39 +257,21 @@ void Area::resetToDefaultValues() | |
invalidateJIT = true; | ||
} | ||
|
||
void Area::resizeAllTimeseriesNumbers(uint n) | ||
void Area::resizeAllTimeseriesNumbers(uint nbYears) | ||
{ | ||
assert(n < 200000); // arbitrary number | ||
|
||
// asserts | ||
assert(hydro.series and "series must not be nullptr !"); | ||
|
||
if (!n) | ||
load.series.timeseriesNumbers.reset(1, nbYears); | ||
solar.series.timeseriesNumbers.reset(1, nbYears); | ||
wind.series.timeseriesNumbers.reset(1, nbYears); | ||
hydro.series->timeseriesNumbers.reset(1, nbYears); | ||
for (auto& namedLink : links) | ||
{ | ||
load.series.timeseriesNumbers.clear(); | ||
solar.series.timeseriesNumbers.clear(); | ||
wind.series.timeseriesNumbers.clear(); | ||
hydro.series->timeseriesNumbers.clear(); | ||
for (auto& namedLink : links) | ||
{ | ||
AreaLink* link = namedLink.second; | ||
link->timeseriesNumbers.clear(); | ||
} | ||
} | ||
else | ||
{ | ||
load.series.timeseriesNumbers.resize(1, n); | ||
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. Explanation : now we reset (resize + assign zeros), which makes TS number zero by default. This allows to reduce the amount of code in timeseries-numbers.cpp (see changes in GenerateDeratedMode(...) for instance) 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. Can put this as a comment in the code ? 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.
What kind of comment do you want to put exactly ? |
||
solar.series.timeseriesNumbers.resize(1, n); | ||
wind.series.timeseriesNumbers.resize(1, n); | ||
hydro.series->timeseriesNumbers.resize(1, n); | ||
for (auto& namedLink : links) | ||
{ | ||
AreaLink* link = namedLink.second; | ||
link->timeseriesNumbers.resize(1, n); | ||
} | ||
AreaLink* link = namedLink.second; | ||
link->timeseriesNumbers.reset(1, nbYears); | ||
} | ||
thermal.resizeAllTimeseriesNumbers(n); | ||
renewable.resizeAllTimeseriesNumbers(n); | ||
thermal.resizeAllTimeseriesNumbers(nbYears); | ||
renewable.resizeAllTimeseriesNumbers(nbYears); | ||
} | ||
|
||
bool Area::thermalClustersMinStablePowerValidity(std::vector<YString>& output) const | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,11 +236,30 @@ void DataSeriesHydro::reset() | |
count = 1; | ||
} | ||
|
||
void DataSeriesHydro::resizeRORandSTORAGE(unsigned int width) | ||
void DataSeriesHydro::resize_ROR_STORAGE_MINGEN_whenGeneratedTS(unsigned int newWidth) | ||
{ | ||
ror.resize(width, HOURS_PER_YEAR); | ||
storage.resize(width, DAYS_PER_YEAR); | ||
count = width; | ||
// This function is called in case hydro TS are generated. | ||
// ROR ans STORAGE are resized here, and will be overriden at some point. | ||
// MINGEN TS are different : when generating hydro TS, mingen TS are not generated, | ||
// but only resized, so that their size is the same as ROR and STORAGE TS. | ||
// When resizing MINGEN : | ||
// - If we extend mingen TS, we keep already existing TS and fill the extra ones | ||
// with a copy of the first TS | ||
// - if we reduce mingen TS, we remove some existing TS, but we must keep intact | ||
// the remaining ones. | ||
ror.resize(newWidth, HOURS_PER_YEAR); | ||
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 : in case we generate hydro TS, ror and storage are generated, but not mingen.
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. Can you include this as a comment ? 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 |
||
storage.resize(newWidth, DAYS_PER_YEAR); | ||
|
||
// Resizing mingen (mingen has necessarily at least one column, by construction) | ||
uint mingenOriginalSize = mingen.timeSeries.width; | ||
mingen.timeSeries.resizeWithoutDataLost(newWidth, mingen.timeSeries.height); | ||
if (mingenOriginalSize < newWidth) | ||
{ | ||
for (uint col = mingenOriginalSize; col < newWidth; ++col) | ||
mingen.timeSeries.pasteToColumn(col, mingen[0]); | ||
} | ||
|
||
count = newWidth; | ||
} | ||
|
||
void DataSeriesHydro::resizeGenerationTS(unsigned int w, unsigned int h) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -312,6 +312,8 @@ void ISimulation<Impl>::run() | |
|
||
ImplementationType::setNbPerformedYearsInParallel(pNbMaxPerformedYearsInParallel); | ||
|
||
TSGenerator::ResizeGeneratedTimeSeries(study.areas, study.parameters); | ||
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 : this is the place where we call the resizing for TS to be generated. |
||
|
||
if (settings.tsGeneratorsOnly) | ||
{ | ||
// Only the preprocessors can be used | ||
|
@@ -323,7 +325,7 @@ void ISimulation<Impl>::run() | |
|
||
// Destroy the TS Generators if any | ||
// It will export the time-series into the output in the same time | ||
Solver::TSGenerator::DestroyAll(study); | ||
TSGenerator::DestroyAll(study); | ||
} | ||
else | ||
{ | ||
|
@@ -370,7 +372,7 @@ void ISimulation<Impl>::run() | |
} | ||
// Destroy the TS Generators if any | ||
// It will export the time-series into the output in the same time | ||
Solver::TSGenerator::DestroyAll(study); | ||
TSGenerator::DestroyAll(study); | ||
|
||
// Post operations | ||
{ | ||
|
@@ -449,7 +451,7 @@ void ISimulation<Impl>::regenerateTimeSeries(uint year) | |
// * The option "Preprocessor" is checked in the interface _and_ year == 0 | ||
// * Both options "Preprocessor" and "Refresh" are checked in the interface | ||
// _and_ the refresh must be done for the given year (always done for the first year). | ||
using namespace Solver::TSGenerator; | ||
using namespace TSGenerator; | ||
// Load | ||
if (pData.haveToRefreshTSLoad && (year % pData.refreshIntervalLoad == 0)) | ||
{ | ||
|
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.
This PR contains console logs. Please review or remove them.