Skip to content

Commit

Permalink
thermal cluster prepro
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Jul 19, 2024
1 parent b9bf04a commit 7b6310c
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class ThermalCluster final: public Cluster, public std::enable_shared_from_this<
explicit ThermalCluster(Data::Area* parent);

ThermalCluster() = delete;
~ThermalCluster();
~ThermalCluster() = default;

/*!
** \brief Invalidate all data associated to the thermal cluster
Expand Down Expand Up @@ -353,7 +353,7 @@ class ThermalCluster final: public Cluster, public std::enable_shared_from_this<
std::vector<double> PthetaInf;

//! Data for the preprocessor
PreproAvailability* prepro = nullptr;
std::shared_ptr<PreproAvailability> prepro;

/*!
** \brief Production Cost, Market Bid Cost and Marginal Cost Matrixes - Per Hour and per Time
Expand Down
2 changes: 0 additions & 2 deletions src/libs/antares/study/include/antares/study/study.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,6 @@ class Study: public Yuni::NonCopyable<Study>, public LayerData
void destroyAllWindTSGeneratorData();
//! Destroy all data of the hydro TS generator
void destroyAllHydroTSGeneratorData();
//! Destroy all data of the thermal TS generator
void destroyAllThermalTSGeneratorData();

/*!
** \brief Import all time-series into the input folder
Expand Down
3 changes: 0 additions & 3 deletions src/libs/antares/study/include/antares/study/study.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ inline void Study::destroyTSGeneratorData()
case TimeSeriesType::timeSeriesHydro:
destroyAllHydroTSGeneratorData();
break;
case TimeSeriesType::timeSeriesThermal:
destroyAllThermalTSGeneratorData();
break;
default:
break;
}
Expand Down
9 changes: 2 additions & 7 deletions src/libs/antares/study/parts/thermal/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ Data::ThermalCluster::ThermalCluster(Area* parent):
assert(parent && "A parent for a thermal dispatchable cluster can not be null");
}

Data::ThermalCluster::~ThermalCluster()
{
delete prepro;
}

uint ThermalCluster::groupId() const
{
return groupID;
Expand Down Expand Up @@ -202,7 +197,7 @@ void Data::ThermalCluster::copyFrom(const ThermalCluster& cluster)
// prepro
if (!prepro)
{
prepro = new PreproAvailability(id(), unitCount);
prepro = std::make_shared<PreproAvailability>(id(), unitCount);
}

prepro->copyFrom(*cluster.prepro);
Expand Down Expand Up @@ -477,7 +472,7 @@ void Data::ThermalCluster::reset()
// we must simply reset their content.
if (!prepro)
{
prepro = new PreproAvailability(id(), unitCount);
prepro = std::make_shared<PreproAvailability>(id(), unitCount);
}

prepro->reset();
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/parts/thermal/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void ThermalClusterList::ensureDataPrepro()
{
if (!c->prepro)
{
c->prepro = new PreproAvailability(c->id(), c->unitCount);
c->prepro = std::make_shared<PreproAvailability>(c->id(), c->unitCount);
}
}
}
Expand Down
12 changes: 0 additions & 12 deletions src/libs/antares/study/study.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,18 +1104,6 @@ void Study::destroyAllWindTSGeneratorData()
areas.each([](Data::Area& area) { FreeAndNil(area.wind.prepro); });
}

void Study::destroyAllThermalTSGeneratorData()
{
areas.each(
[](const Data::Area& area)
{
for (const auto& cluster: area.thermal.list.each_enabled_and_not_mustrun())
{
FreeAndNil(cluster->prepro);
}
});
}

void Study::ensureDataAreLoadedForAllBindingConstraints()
{
for (const auto& constraint: bindingConstraints)
Expand Down
2 changes: 1 addition & 1 deletion src/solver/ts-generator/availability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ AvailabilityTSGeneratorData::AvailabilityTSGeneratorData(Data::ThermalCluster* c
plannedVolatility(cluster->plannedVolatility),
forcedLaw(cluster->forcedLaw),
plannedLaw(cluster->plannedLaw),
prepro(cluster->prepro),
prepro(cluster->prepro.get()),
modulationCapacity(cluster->modulation[Data::thermalModulationCapacity]),
name(cluster->name())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ bool ThermalClusterPrepro::cellValue(int x, int y, const String& value)
void ThermalClusterPrepro::internalThermalClusterChanged(Antares::Data::ThermalCluster* cluster)
{
pCluster = cluster;
pPreproAvailability = (cluster) ? cluster->prepro : nullptr;
pPreproAvailability = (cluster) ? cluster->prepro.get() : nullptr;
MatrixAncestorType::matrix((pPreproAvailability) ? &pPreproAvailability->data : nullptr);
onRefresh();
}
Expand Down

0 comments on commit 7b6310c

Please sign in to comment.