-
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
[ANT-992] Add ramping for thermal clusters #1817
base: develop
Are you sure you want to change the base?
[ANT-992] Add ramping for thermal clusters #1817
Conversation
Watermelon AI SummaryAI Summary deactivated by bencamus GitHub PRs
Antares_Simulator is an open repo and Watermelon will serve it for free. |
{ | ||
logs.error() << "Thermal cluster: " << parentArea->name << '/' << pName | ||
<< ": The maximum upward power ramping rate must greater than zero."; | ||
maxUpwardPowerRampingRate = 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.
i would be helpful to print the fallback value;
also it seems that the return value is never used
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.
Now, with commit 8133150, the ramping is disabled in this case, and this information is printed.
@@ -58,6 +58,25 @@ ConstraintBuilder& ConstraintBuilder::DispatchableProduction(unsigned int index, | |||
int delta) | |||
{ | |||
AddVariable(GetVariableManager(offset, delta).DispatchableProduction(index), coeff); | |||
// logs.info() << "dispatchable production idx " << GetVariableManager(offset, delta).DispatchableProduction(index); | |||
return *this; |
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.
remove debug comments
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.
fixed in commit 624f2ce
s->add("max-upward-power-ramping-rate", Math::Round(c.maxUpwardPowerRampingRate, 3)); | ||
if (not Math::Zero(c.maxDownwardPowerRampingRate)) |
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.
Math
is part of Yuni
, which is deprecated. Please use STL functions instead.
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.
fixed by commit 915e0c7
int add = (pdt == 0) ? 4 : 5; | ||
problemeHebdo->NbTermesContraintesPourLesRampes += add; | ||
problemeHebdo->ProblemeAResoudre->NombreDeContraintes++; | ||
} |
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.
To be checked carefully
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.
with commit 624f2ce, the ramping constraints become cyclical (the evolution of the production for the first hour is constrained the production of the last hour). Then, we don't need to use a constraint for the first time step that is different from the other time steps anymore. This code is now removed.
if (pdt > 0) | ||
{ | ||
builder.updateHourWithinWeek(pdt) | ||
.DispatchableProduction(cluster, 1.0) | ||
.DispatchableProduction(cluster, -1.0, -1, problemeHebdo->NombreDePasDeTempsPourUneOptimisation) | ||
.NumberOfDispatchableUnits(cluster, maxDownwardPowerRampingRate) | ||
.NumberStoppingDispatchableUnits(cluster, pmaxDUnGroupeDuPalierThermique) | ||
.NumberBreakingDownDispatchableUnits(cluster, pmaxDUnGroupeDuPalierThermique) | ||
.greaterThan(); | ||
} |
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 shouldn't need this if..else
since DispatchableProduction
has arguments to take this into account.
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.
Indeed, commit 624f2ce fixed this.
@@ -0,0 +1,47 @@ | |||
#include "RampingIncreaseRate.h" | |||
|
|||
void RampingIncreaseRate::add(int pays, int cluster, int clusterIndex, int pdt, bool Simulation) |
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 may define a class both for RampingIncreaseRate
and RampingDecreaseRate
. With a pure virtual method for behaviors that differ, e.g
-.NumberOfDispatchableUnits(cluster, -maxUpwardPowerRampingRate)
-.NumberStartingDispatchableUnits(cluster, -pminDUnGroupeDuPalierThermique)
+.NumberStoppingDispatchableUnits(cluster, pmaxDUnGroupeDuPalierThermique)
+.NumberBreakingDownDispatchableUnits(cluster, pmaxDUnGroupeDuPalierThermique)
See https://refactoring.guru/design-patterns/template-method
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.
Pending until the constraint equations are validated
src/solver/optimisation/opt_gestion_des_bornes_rampes_thermiques.cpp
Outdated
Show resolved
Hide resolved
src/solver/optimisation/opt_construction_variables_rampes_thermiques.h
Outdated
Show resolved
Hide resolved
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 0 is not a suitable value for maxDownwardPowerRampingRate
, consider choosing a different default value.
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.
Suggestion : add ON/OFF (bool, default = OFF) for ramping in every cluster
Please add test(s) for the newly constraints at least in "named-mps" tests, let me know if i can be of any help |
…ion for the first hour is constrained the production of the last hour + remove commented ramping debug logs
…rs in the header file
c4cd709
to
09a2ca9
Compare
@@ -137,7 +137,8 @@ Data::ThermalCluster::ThermalCluster(Area* parent) : | |||
forcedLaw(thermalLawUniform), | |||
plannedLaw(thermalLawUniform), | |||
PthetaInf(HOURS_PER_YEAR, 0), | |||
costsTimeSeries(1, CostsTimeSeries()) | |||
costsTimeSeries(1, CostsTimeSeries()), | |||
ramping() |
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 constructor is called by default, there is no need to call it explicitly here
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.
removed in commit 77daa36
bool checkValidity(Area* area, Data::ClusterName clusterName); | ||
friend std::ostream& operator<<(std::ostream&, const Ramping& ramping); | ||
}; | ||
Ramping ramping; |
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.
Ramping ramping; | |
std::optional<Ramping> ramping; |
By default, the ramping constraints are not enabled for a given cluster. They are enabled only if an object exists within this std::optional
.
Possible justification : there is no good default value for maxUpwardPowerRampingRate
and maxDownwardPowerRampingRate
, ie we can't keep the existing behavior by default, which is very important.
This induces a small difficulty in the variable/constraint counting process, in the sense that we must only take into account cluster for which ramping is enabled.
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.
Commit 8133150 implements now is feature
bool rampingEnabled = false; | ||
bool attributeOK = rampingEnabledProperty->value.to<bool>(rampingEnabled); | ||
if (rampingEnabled && attributeOK) | ||
cluster.ramping = ThermalCluster::Ramping(); |
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.
cluster.ramping = ThermalCluster::Ramping(); | |
cluster.ramping.emplace(); |
Otherwise the temporary object is constructed and destructed immediately. In-place construction saves one Construction/Destruction, see https://en.cppreference.com/w/cpp/utility/optional/emplace
ProblemeAResoudre->NombreDeVariables | ||
+= problemeHebdo->PaliersThermiquesDuPays[pays].NombreDePaliersThermiques; | ||
|
||
ProblemeAResoudre->NombreDeVariables += problemeHebdo->PaliersThermiquesDuPays[pays].NombreDePaliersThermiques; |
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.
Formatting, see .clang-format
pbPalier.upwardRampingCost[nRampingCluster] | ||
= cluster.ramping.value().powerIncreaseCost; | ||
pbPalier.downwardRampingCost[nRampingCluster] | ||
= cluster.ramping.value().powerDecreaseCost; | ||
pbPalier.maxDownwardPowerRampingRate[nRampingCluster] | ||
= cluster.ramping.value().maxDownwardPowerRampingRate; | ||
pbPalier.maxUpwardPowerRampingRate[nRampingCluster] | ||
= cluster.ramping.value().maxUpwardPowerRampingRate; | ||
pbPalier.clusterRampingVariablesIndex[clusterIndex] = nRampingCluster; | ||
nRampingCluster++; |
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.
pbPalier.upwardRampingCost[nRampingCluster] | |
= cluster.ramping.value().powerIncreaseCost; | |
pbPalier.downwardRampingCost[nRampingCluster] | |
= cluster.ramping.value().powerDecreaseCost; | |
pbPalier.maxDownwardPowerRampingRate[nRampingCluster] | |
= cluster.ramping.value().maxDownwardPowerRampingRate; | |
pbPalier.maxUpwardPowerRampingRate[nRampingCluster] | |
= cluster.ramping.value().maxUpwardPowerRampingRate; | |
pbPalier.clusterRampingVariablesIndex[clusterIndex] = nRampingCluster; | |
nRampingCluster++; | |
const auto& ramping = cluster.ramping.value(); | |
pbPalier.upwardRampingCost[nRampingCluster] | |
= ramping.powerIncreaseCost; | |
pbPalier.downwardRampingCost[nRampingCluster] | |
= ramping.powerDecreaseCost; | |
pbPalier.maxDownwardPowerRampingRate[nRampingCluster] | |
= ramping.maxDownwardPowerRampingRate; | |
pbPalier.maxUpwardPowerRampingRate[nRampingCluster] | |
= ramping.maxUpwardPowerRampingRate; | |
pbPalier.clusterRampingVariablesIndex[clusterIndex] = nRampingCluster; | |
nRampingCluster++; |
variablesMapping.powerRampingIncreaseIndex | ||
.assign(study.runtime->thermalPlantTotalCount, 0); | ||
variablesMapping.powerRampingDecreaseIndex | ||
.assign(study.runtime->thermalPlantTotalCount, 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.
By default, the variable doesn't exist
variablesMapping.powerRampingIncreaseIndex | |
.assign(study.runtime->thermalPlantTotalCount, 0); | |
variablesMapping.powerRampingDecreaseIndex | |
.assign(study.runtime->thermalPlantTotalCount, 0); | |
variablesMapping.powerRampingIncreaseIndex | |
.assign(study.runtime->thermalPlantTotalCount, -1); | |
variablesMapping.powerRampingDecreaseIndex | |
.assign(study.runtime->thermalPlantTotalCount, -1); |
…zing the NODU variables during the second optimization step for the cluster with ramping
… problemhebdo constrainst vectors length
… ramping model to fix issue with ramping behavior + update of the output ramping cost to be aligned with the constraints
…nits as it is already included in the starting thermal units term
…nto feature/ramping_model_scalian
This code implement the thermal ramping model in Antares.
The remaining works are: