-
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
Remove RenouvelableParPalier from global variable #1659
Conversation
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.
I think the precise naming for "timeStep" is hourInYear
So the caller know that it's an hour between 0 (included) and 8760 (excluded).
@@ -200,14 +200,15 @@ YString Data::RenewableCluster::getTimeSeriesModeAsString() const | |||
return "unknown"; | |||
} | |||
|
|||
double RenewableCluster::valueAtTimeStep(uint timeSeriesIndex, uint timeStepIndex) const | |||
double RenewableCluster::valueAtTimeStep(uint hourInYear, uint year) const |
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.
One could expect that arguments are switched (as it was before) : first year, then hourInYear. Another way to see this, is : you cannot have an hour in the year if you don't have a year first, right ?
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.
@guilpier-code to be done in the next (factorization) work
Rename getAvailablePower into something else |
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.
Nice:
I think we could improve again the design by returning more often column objects (double* in practice) instead of getting the year index then only retrieving the column using that index.
However, maybe that's for a future work on series classes?
|
||
uint tsFatalIndex = (uint)tsIndex.Hydraulique < ror.width ? tsIndex.Hydraulique : 0; | ||
uint tsFatalIndex = hydroSeriesIndex < ror.width ? hydroSeriesIndex : 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.
It seems that the hydroSeriesIndex
is used only to get this ROR index:
we could probably have a more direct getRorIndex
in the series class ?
@@ -200,7 +200,7 @@ class TimeSeriesValuesHydro | |||
// The current time-series | |||
auto& ror = pArea->hydro.series->ror; | |||
const unsigned int nbchro | |||
= NumeroChroniquesTireesParPays[numSpace][pArea->index].Hydraulique; | |||
= pArea->hydro.series->getIndex(year); | |||
pFatalValues[numSpace] = &(ror.entry[(nbchro < ror.width ? nbchro : 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.
Could be simplified too with a getRorIndex
auto& area = *(study.areas.byIndex[k]); | ||
auto& scratchpad = area.scratchpad[numSpace]; | ||
auto& ror = area.hydro.series->ror; | ||
auto loadSeries = area.load.series->getCoefficient(year, hourInYear); |
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.
As pointed by @flomnes , we can retrieve the full columns only once et the start and use them (it avoids to repeat the small logic on the index)
auto const& srcinflows = inflowsmatrix[tsIndex < inflowsmatrix.width ? tsIndex : 0]; | ||
auto& mingenmatrix = area.hydro.series->mingen; | ||
auto& mingenmatrix = hydroSeries->mingen; | ||
auto const& srcmingen = mingenmatrix[tsIndex < mingenmatrix.width ? tsIndex : 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.
We could have a getter for this column in the HydroSeries class, instead of going through 1. retrieve the index then 2. retrieve the column.
auto& hydroSeries = area.hydro.series; | ||
uint tsIndex = hydroSeries->getIndex(year); | ||
|
||
auto& inflowsmatrix = hydroSeries->storage; | ||
auto const& srcinflows = inflowsmatrix[tsIndex < inflowsmatrix.width ? tsIndex : 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.
Same here, we could have a getter for the column itself instead of the index
Kudos, SonarCloud Quality Gate passed! |
The comments will be adressed in a future work
#1615
#1644 (comment)
#1644 (comment)