Skip to content

Commit

Permalink
Move economic thermal costs input files into series directory : small…
Browse files Browse the repository at this point in the history
… simplifications
  • Loading branch information
guilpier-code committed Sep 12, 2023
1 parent f0843fd commit b1719c6
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions src/libs/antares/study/parts/thermal/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ bool ThermalClusterList::savePreproToFolder(const AnyString& folder) const
Clob buffer;
bool ret = true;

each([&](const Data::ThermalCluster& c) {
each([&](const ThermalCluster& c) {
if (c.prepro)
{
assert(c.parentArea and "cluster: invalid parent area");
Expand All @@ -489,15 +489,12 @@ bool ThermalClusterList::saveEconomicCosts(const AnyString& folder) const
Clob buffer;
bool ret = true;

each([&](const Data::ThermalCluster& c) {
each([&](const ThermalCluster& c) {
assert(c.parentArea and "cluster: invalid parent area");
buffer.clear() << folder << SEP << c.parentArea->id << SEP << c.id();
ret = c.ecoInput.saveToFolder(buffer) && ret;
});
return ret;



}

bool ThermalClusterList::loadPreproFromFolder(Study& study,
Expand All @@ -513,20 +510,19 @@ bool ThermalClusterList::loadPreproFromFolder(Study& study,
Clob buffer;
bool ret = true;

for (auto it = begin(); it != end(); ++it)
for (auto& [name, c] : cluster)
{
auto& c = *(it->second);
if (c.prepro)
if (c->prepro)
{
assert(c.parentArea and "cluster: invalid parent area");
buffer.clear() << folder << SEP << c.parentArea->id << SEP << c.id();
assert(c->parentArea and "cluster: invalid parent area");
buffer.clear() << folder << SEP << c->parentArea->id << SEP << c->id();

bool result = c.prepro->loadFromFolder(study, buffer);
bool result = c->prepro->loadFromFolder(study, buffer);

if (result && study.usedByTheSolver && c.doWeGenerateTS(globalThermalTSgeneration))
if (result && study.usedByTheSolver && c->doWeGenerateTS(globalThermalTSgeneration))
{
// checking NPO max
result = c.prepro->normalizeAndCheckNPO();
result = c->prepro->normalizeAndCheckNPO();
}

ret = result and ret;
Expand All @@ -547,15 +543,13 @@ bool ThermalClusterList::loadEconomicCosts(Study& study, const AnyString& folder
Clob buffer;
bool ret = true;

for (auto it = begin(); it != end(); ++it)
for (auto& [name, c] : cluster)
{
auto& c = *(it->second);

assert(c.parentArea and "cluster: invalid parent area");
buffer.clear() << folder << SEP << c.parentArea->id << SEP << c.id();
assert(c->parentArea and "cluster: invalid parent area");
buffer.clear() << folder << SEP << c->parentArea->id << SEP << c->id();

bool result = c.ecoInput.loadFromFolder(study, buffer);
c.ComputeCostTimeSeries();
bool result = c->ecoInput.loadFromFolder(study, buffer);
c->ComputeCostTimeSeries();

ret = result && ret;
}
Expand Down

0 comments on commit b1719c6

Please sign in to comment.