Skip to content

Commit

Permalink
add subclass to store and check thermal cluster ramping attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
bencamus committed Dec 18, 2023
1 parent e78c034 commit b9801fe
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 70 deletions.
90 changes: 49 additions & 41 deletions src/libs/antares/study/parts/thermal/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ Data::ThermalCluster::ThermalCluster(Area* parent) :
plannedLaw(thermalLawUniform),
PthetaInf(HOURS_PER_YEAR, 0),
costsTimeSeries(1, CostsTimeSeries()),
maxUpwardPowerRampingRate(0.),
maxDownwardPowerRampingRate(0.),
powerIncreaseCost(0.),
powerDecreaseCost(0.)
ramping()
{
// assert
assert(parent and "A parent for a thermal dispatchable cluster can not be null");
Expand Down Expand Up @@ -187,10 +184,7 @@ void Data::ThermalCluster::copyFrom(const ThermalCluster& cluster)
minDownTime = cluster.minDownTime;

// ramping
maxUpwardPowerRampingRate = cluster.maxUpwardPowerRampingRate;
maxDownwardPowerRampingRate = cluster.maxDownwardPowerRampingRate;
powerDecreaseCost = cluster.powerDecreaseCost;
powerIncreaseCost = cluster.powerIncreaseCost;
ramping = cluster.ramping;

// spinning
spinning = cluster.spinning;
Expand Down Expand Up @@ -489,11 +483,9 @@ void Data::ThermalCluster::reset()
marketBidCost = 0.;
variableomcost = 0.;
costsTimeSeries.resize(1, CostsTimeSeries());
powerIncreaseCost = 0;
powerDecreaseCost = 0;

maxUpwardPowerRampingRate = 0;
maxDownwardPowerRampingRate = 0;

// ramping
ramping.reset();

// modulation
modulation.resize(thermalModulationMax, HOURS_PER_YEAR);
Expand Down Expand Up @@ -624,34 +616,7 @@ bool Data::ThermalCluster::integrityCheck()
}*/

// ramping
if (maxUpwardPowerRampingRate <= 0)
{
logs.error() << "Thermal cluster: " << parentArea->name << '/' << pName
<< ": The maximum upward power ramping rate must greater than zero.";
maxUpwardPowerRampingRate = 1.;
ret = false;
}
if (maxDownwardPowerRampingRate <= 0)
{
logs.error() << "Thermal cluster: " << parentArea->name << '/' << pName
<< ": The maximum downward power ramping rate must greater than zero.";
maxDownwardPowerRampingRate = 1.;
ret = false;
}
if (powerIncreaseCost < 0)
{
logs.error() << "Thermal cluster: " << parentArea->name << '/' << pName
<< ": The ramping power increase cost must be positive or null.";
powerIncreaseCost = 0.;
ret = false;
}
if (powerDecreaseCost < 0)
{
logs.error() << "Thermal cluster: " << parentArea->name << '/' << pName
<< ": The ramping power decrease cost must be positive or null.";
powerDecreaseCost = 0.;
ret = false;
}
ret = ramping.checkValidity(parentArea, pName) && ret;

return ret;
}
Expand Down Expand Up @@ -867,5 +832,48 @@ bool ThermalCluster::isActive() const {
return enabled && !mustrun;
}

void ThermalCluster::Ramping::reset()
{
powerIncreaseCost = 0;
powerDecreaseCost = 0;
maxUpwardPowerRampingRate = 0;
maxDownwardPowerRampingRate = 0;
}

bool ThermalCluster::Ramping::checkValidity(Area* parentArea, Data::ClusterName clusterName)
{
bool ret = true;

if (maxUpwardPowerRampingRate <= 0)
{
logs.error() << "Thermal cluster: " << parentArea->name << '/' << clusterName
<< ": The maximum upward power ramping rate must greater than zero.";
maxUpwardPowerRampingRate = 1.;
ret = false;
}
if (maxDownwardPowerRampingRate <= 0)
{
logs.error() << "Thermal cluster: " << parentArea->name << '/' << clusterName
<< ": The maximum downward power ramping rate must greater than zero.";
maxDownwardPowerRampingRate = 1.;
ret = false;
}
if (powerIncreaseCost < 0)
{
logs.error() << "Thermal cluster: " << parentArea->name << '/' << clusterName
<< ": The ramping power increase cost must be positive or null.";
powerIncreaseCost = 0.;
ret = false;
}
if (powerDecreaseCost < 0)
{
logs.error() << "Thermal cluster: " << parentArea->name << '/' << clusterName
<< ": The ramping power decrease cost must be positive or null.";
powerDecreaseCost = 0.;
ret = false;
}
return ret;
}

} // namespace Data
} // namespace Antares
33 changes: 24 additions & 9 deletions src/libs/antares/study/parts/thermal/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,30 @@ class ThermalCluster final : public Cluster, public std::enable_shared_from_this
double marketBidCost = 0;
//! Variable O&M cost (euros/MWh)
double variableomcost = 0;
//! Cost of power increase (euros/MW)
double powerIncreaseCost = 0;
//! Cost of power decrease (euros/MW)
double powerDecreaseCost = 0;

//! Maximum hourly upward power ramping rate (MW/hour)
double maxUpwardPowerRampingRate = 0;
//! Maximum hourly downward power ramping rate (MW/hour)
double maxDownwardPowerRampingRate = 0;

struct Ramping
{
//! Cost of power increase (euros/MW)
double powerIncreaseCost;
//! Cost of power decrease (euros/MW)
double powerDecreaseCost;
//! Maximum hourly upward power ramping rate (MW/hour)
double maxUpwardPowerRampingRate;
//! Maximum hourly downward power ramping rate (MW/hour)
double maxDownwardPowerRampingRate;

Ramping() :
powerIncreaseCost(0.),
powerDecreaseCost(0.),
maxUpwardPowerRampingRate(0.),
maxDownwardPowerRampingRate(0.)
{
}

void reset();
bool checkValidity(Area* area, Data::ClusterName clusterName);
};
Ramping ramping;

//@}

Expand Down
26 changes: 14 additions & 12 deletions src/libs/antares/study/parts/thermal/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,13 @@ static bool ThermalClusterLoadFromProperty(ThermalCluster& cluster, const IniFil
return p->value.to<double>(cluster.startupCost);

if (p->key == "power-increase-cost")
return p->value.to<double>(cluster.powerIncreaseCost);
return p->value.to<double>(cluster.ramping.powerIncreaseCost);
if (p->key == "power-decrease-cost")
return p->value.to<double>(cluster.powerDecreaseCost);
return p->value.to<double>(cluster.ramping.powerDecreaseCost);
if (p->key == "max-upward-power-ramping-rate")
return p->value.to<double>(cluster.maxUpwardPowerRampingRate);
return p->value.to<double>(cluster.ramping.maxUpwardPowerRampingRate);
if (p->key == "max-downward-power-ramping-rate")
return p->value.to<double>(cluster.maxDownwardPowerRampingRate);
return p->value.to<double>(cluster.ramping.maxDownwardPowerRampingRate);

if (p->key == "unitcount")
return p->value.to<uint>(cluster.unitCount);
Expand Down Expand Up @@ -415,14 +415,16 @@ bool ThermalClusterList::saveToFolder(const AnyString& folder) const
s->add("variableomcost", Math::Round(c.variableomcost,3));

// ramping
if (c.powerIncreaseCost != 0)
s->add("power-increase-cost", Math::Round(c.powerIncreaseCost, 3));
if (c.powerDecreaseCost != 0)
s->add("power-decrease-cost", Math::Round(c.powerDecreaseCost, 3));
if (c.maxUpwardPowerRampingRate != 0)
s->add("max-upward-power-ramping-rate", Math::Round(c.maxUpwardPowerRampingRate, 3));
if (c.maxDownwardPowerRampingRate != 0)
s->add("max-downward-power-ramping-rate", Math::Round(c.maxDownwardPowerRampingRate, 3));
if (c.ramping.powerIncreaseCost != 0)
s->add("power-increase-cost", Math::Round(c.ramping.powerIncreaseCost, 3));
if (c.ramping.powerDecreaseCost != 0)
s->add("power-decrease-cost", Math::Round(c.ramping.powerDecreaseCost, 3));
if (c.ramping.maxUpwardPowerRampingRate != 0)
s->add("max-upward-power-ramping-rate",
Math::Round(c.ramping.maxUpwardPowerRampingRate, 3));
if (c.ramping.maxDownwardPowerRampingRate != 0)
s->add("max-downward-power-ramping-rate",
Math::Round(c.ramping.maxDownwardPowerRampingRate, 3));

//pollutant factor
for (auto const& [key, val] : Pollutant::namesToEnum)
Expand Down
8 changes: 4 additions & 4 deletions src/solver/simulation/sim_calcul_economique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ void SIM_InitialisationProblemeHebdo(Data::Study& study,
= cluster.minDownTime;

pbPalier.upwardRampingCost[clusterIndex]
= cluster.powerIncreaseCost;
pbPalier.downwardRampingCost[clusterIndex] = cluster.powerDecreaseCost;
pbPalier.maxDownwardPowerRampingRate[clusterIndex] = cluster.maxDownwardPowerRampingRate;
pbPalier.maxUpwardPowerRampingRate[clusterIndex] = cluster.maxUpwardPowerRampingRate;
= cluster.ramping.powerIncreaseCost;
pbPalier.downwardRampingCost[clusterIndex] = cluster.ramping.powerDecreaseCost;
pbPalier.maxDownwardPowerRampingRate[clusterIndex] = cluster.ramping.maxDownwardPowerRampingRate;
pbPalier.maxUpwardPowerRampingRate[clusterIndex] = cluster.ramping.maxUpwardPowerRampingRate;



Expand Down
8 changes: 4 additions & 4 deletions src/solver/variable/surveyresults/surveyresults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ static void ExportGridInfosAreas(const Data::Study& study,
outThermal << cluster.startupCost << '\t';
outThermal << cluster.marketBidCost << '\t';
outThermal << cluster.spreadCost << '\n';
outThermal << cluster.powerIncreaseCost << '\n';
outThermal << cluster.powerDecreaseCost << '\n';
outThermal << cluster.maxUpwardPowerRampingRate << '\n';
outThermal << cluster.maxDownwardPowerRampingRate << '\n';
outThermal << cluster.ramping.powerIncreaseCost << '\n';
outThermal << cluster.ramping.powerDecreaseCost << '\n';
outThermal << cluster.ramping.maxUpwardPowerRampingRate << '\n';
outThermal << cluster.ramping.maxDownwardPowerRampingRate << '\n';

} // each thermal cluster
}); // each area
Expand Down

0 comments on commit b9801fe

Please sign in to comment.