-
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
Fix mingen issues with several modifications #2395
base: develop
Are you sure you want to change the base?
Conversation
flomnes
commented
Sep 12, 2024
•
edited
Loading
edited
- Remove truncation from weekly turbine credits (was done previously)
- Always enable monitoring of stock levels (including overflow)
- Take overflow into account in the "HydroPower" constraint (was done in 9.1.0)
- Remove recomputation of reservoir levels & overflow
- Correct infeasibility in hydro heuristic problem, related to mingen > 0
@@ -152,6 +152,9 @@ void SIM_InitialisationProblemeHebdo(Data::Study& study, | |||
|
|||
problem.CoutDeDefaillanceNegative[i] = area.thermal.spilledEnergyCost; | |||
|
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 removing the weekly truncation involves removing the whole block :
double weekGenerationTarget = 1.;
double marginGen = 1.;
if (area.hydro.reservoirManagement && area.hydro.useHeuristicTarget
&& not area.hydro.useLeeway)
{
double weekTarget_tmp = 0.;
for (uint j = 0; j < 7; ++j)
{
uint day = study.calendar.hours[PasDeTempsDebut + j * 24].dayYear;
weekTarget_tmp += hydroVentilationResults[k]
HydrauliqueModulableQuotidien[day];
}
if (weekTarget_tmp != 0.)
{
weekGenerationTarget = weekTarget_tmp;
}
marginGen = weekGenerationTarget;
}
As well as the truncation coefficient marginGen / weekGenerationTarget
.
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.
You mean that since marginGen = weekGenerationTarget
, marginGen / weekGenerationTarget
is always 1 ?
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.
Exactly.
When we removed the troncation, we did not remove all what should have been.
RUN_SIMPLE_TESTS: 'false' | ||
RUN_EXTENDED_TESTS: 'false' |
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.
Whatever the purpose of this change is (it could be so that CI completes and generates artefacts), we'll have not to forget reverting it.
Quality Gate passedIssues Measures |
@@ -53,7 +53,7 @@ void H2O_J_InitialiserLesBornesdesVariables(DONNEES_MENSUELLES* DonneesMensuelle | |||
int Var = CorrespondanceDesVariables.NumeroDeVariableTurbine[Pdt]; | |||
Xmax[Var] = TurbineMax[Pdt]; | |||
|
|||
Xmin[Var] = std::min(TurbineMax[Pdt], std::max(TurbineCible[Pdt], TurbineMin[Pdt])); | |||
Xmin[Var] = std::min(TurbineMax[Pdt], TurbineMin[Pdt]); |
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.
So we no longer need to use TurbineCible
in this function H2O_J_InitialiserLesBornesdesVariables(...).
Hence we should remove line :
const std::vector<double>& TurbineCible = DonneesMensuelles->TurbineCible;
@@ -53,7 +53,7 @@ void H2O_J_InitialiserLesBornesdesVariables(DONNEES_MENSUELLES* DonneesMensuelle | |||
int Var = CorrespondanceDesVariables.NumeroDeVariableTurbine[Pdt]; | |||
Xmax[Var] = TurbineMax[Pdt]; | |||
|
|||
Xmin[Var] = std::min(TurbineMax[Pdt], std::max(TurbineCible[Pdt], TurbineMin[Pdt])); | |||
Xmin[Var] = std::min(TurbineMax[Pdt], TurbineMin[Pdt]); |
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.
About :
Xmax[Var] = TurbineMax[Pdt];
Xmin[Var] = std::min(TurbineMax[Pdt], TurbineMin[Pdt]);
It's strange that we give the lower bound of variable Turbine like this.
Reader could expect instead :
Xmin[Var] = TurbineMin[Pdt];
Xmax[Var] = TurbineMax[Pdt];
It seems that TurbineMax is not necessarily greater than TurbineMin for every day, which is strange.
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 agree, since there is a precheck for each hour in checkGenerationPowerConsistency
function, I don't see how TurbineMax in any situation can be lower than TurbineMin, but maybe I am wrong.
@@ -51,8 +51,6 @@ AdqPatchPostProcessList::AdqPatchPostProcessList(const AdqPatchParams& adqPatchP | |||
// Here a post process particular to adq patch | |||
post_process_list.push_back( | |||
std::make_unique<DTGmarginForAdqPatchPostProcessCmd>(problemeHebdo_, areas, thread_number)); | |||
post_process_list.push_back( |
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.
In the current PR presentation, it's said that the re-computation of hydro levels after weekly optimization should be removed.
And indeed, the post process class HydroLevelsUpdatePostProcessCmd was largely simplified : it now only converts levels from their adimensionnel version into MWh.
In that context, we can also see that this post-process is still called twice for modes adequacy & economy, which leads to wrong hydro levels values.
What we should do :
- This class should therefore be renamed into HydroLevelsConversionIntoMWhCmd for more clarity.
- Its method execute(...) should be called once (for a given simulation mode).
- We should take advantage of this to remove boolean remixWasRun, no longer useful.
- If it turns out the other boolean computeAnyway is not really needed, then remove it.
= area.hydro.reservoirManagement && (problem.OptimisationAuPasHebdomadaire) | ||
&& (!area.hydro.useHeuristicTarget | ||
|| problem.CaracteristiquesHydrauliques[i].PresenceDePompageModulable); | ||
problem.CaracteristiquesHydrauliques[i].SuiviNiveauHoraire = area.hydro.reservoirManagement; |
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.
About SuiviNiveauHoraire : if this boolean equals reservoirManagement, let's call it reservoirManagement and avoid a parameter to be named in two different ways.
It would lower complexity.
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 agree, if we go on with this change, we'll simply remove SuiviNiveauHoraire
.
&& problemeHebdo->CaracteristiquesHydrauliques[pays].PresenceDHydrauliqueModulable) | ||
{ | ||
ProblemeAResoudre->NombreDeContraintes++; | ||
} | ||
|
||
if (Pump && !TurbEntreBornes && !MonitorHourlyLev) | ||
ProblemeAResoudre->NombreDeContraintes += nombreDePasDeTempsPourUneOptimisation; |
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.
About :
ProblemeAResoudre->NombreDeContraintes += nombreDePasDeTempsPourUneOptimisation;
This instruction suddenly appears.
Why ? Was the previous code incorrect ?
Or is it about overflows back in the game ?
We should add a comment.
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.
No the estimation of variables & constraints is incorrect. There was an underestimation, which lead to segfaults.
&& problemeHebdo->CaracteristiquesHydrauliques[pays].PresenceDHydrauliqueModulable) | ||
{ | ||
ProblemeAResoudre->NombreDeContraintes++; | ||
} | ||
|
||
if (Pump && !TurbEntreBornes && !MonitorHourlyLev) | ||
ProblemeAResoudre->NombreDeContraintes += nombreDePasDeTempsPourUneOptimisation; |
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 file contains no comment that relates a count increment to a set of constraints.
It's unclear : which increment correspond to which set of constraints ?
Besides, this way of counting constraints apart from the constraints themselves is very much error prone : it's very easy to add / remove constraints and not update the constraints count.
Adding / removing a constraint should automatically update the constraint count.
But this will be for another PR.
@@ -275,26 +275,19 @@ void OPT_InitialiserLesCoutsLineaire(PROBLEME_HEBDO* problemeHebdo, | |||
|
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 should update the comment that explains the cost we give to the hydro overflow