From 7bd109104906d5a513bcc6567727366315d62496 Mon Sep 17 00:00:00 2001 From: Guillaume PIERRE Date: Mon, 11 Sep 2023 18:28:32 +0200 Subject: [PATCH] Move economic thermal costs input files into series directory : oops, forgot to implement the saving --- src/libs/antares/study/area/list.cpp | 1 + .../study/parts/thermal/cluster_list.cpp | 24 +++++++++++++++---- .../study/parts/thermal/cluster_list.h | 1 + 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/libs/antares/study/area/list.cpp b/src/libs/antares/study/area/list.cpp index 85655722507..1e7d617b593 100644 --- a/src/libs/antares/study/area/list.cpp +++ b/src/libs/antares/study/area/list.cpp @@ -280,6 +280,7 @@ static bool AreaListSaveToFolderSingleArea(const Area& area, Clob& buffer, const ret = area.thermal.list.savePreproToFolder(buffer) && ret; buffer.clear() << folder << SEP << "input" << SEP << "thermal" << SEP << "series"; ret = area.thermal.list.saveDataSeriesToFolder(buffer) && ret; + ret = area.thermal.list.saveEconomicCosts(buffer) && ret; } // Renewable cluster list diff --git a/src/libs/antares/study/parts/thermal/cluster_list.cpp b/src/libs/antares/study/parts/thermal/cluster_list.cpp index 3ebc2013fa3..1e0e4f26329 100644 --- a/src/libs/antares/study/parts/thermal/cluster_list.cpp +++ b/src/libs/antares/study/parts/thermal/cluster_list.cpp @@ -452,15 +452,29 @@ bool ThermalClusterList::savePreproToFolder(const AnyString& folder) const buffer.clear() << folder << SEP << c.parentArea->id << SEP << c.id(); ret = c.prepro->saveToFolder(buffer) and ret; } - { - 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::saveEconomicCosts(const AnyString& folder) const +{ + if (empty()) + return true; + + Clob buffer; + bool ret = true; + + each([&](const Data::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, const StudyLoadOptions& options, const AnyString& folder) diff --git a/src/libs/antares/study/parts/thermal/cluster_list.h b/src/libs/antares/study/parts/thermal/cluster_list.h index 9cdfbd3bf7c..1d15b028a96 100644 --- a/src/libs/antares/study/parts/thermal/cluster_list.h +++ b/src/libs/antares/study/parts/thermal/cluster_list.h @@ -85,6 +85,7 @@ class ThermalClusterList : public ClusterList bool loadEconomicCosts(Study& s, const AnyString& folder); bool savePreproToFolder(const AnyString& folder) const; + bool saveEconomicCosts(const AnyString& folder) const; bool saveToFolder(const AnyString& folder) const override; }; // class ThermalClusterList