Skip to content

Commit

Permalink
Move economic thermal costs input files into series directory
Browse files Browse the repository at this point in the history
  • Loading branch information
guilpier-code committed Sep 11, 2023
1 parent 57bae5b commit 976acd4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 34 deletions.
1 change: 1 addition & 0 deletions src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ static bool AreaListLoadFromFolderSingleArea(Study& study,
ret = area.thermal.list.loadPreproFromFolder(study, options, buffer) && ret;
buffer.clear() << study.folderInput << SEP << "thermal" << SEP << "series";
ret = area.thermal.list.loadDataSeriesFromFolder(study, options, buffer) && ret;
ret = area.thermal.list.loadEconomicCosts(study, buffer) && ret;

// In adequacy mode, all thermal clusters must be in 'mustrun' mode
if (study.usedByTheSolver && study.parameters.mode == stdmAdequacy)
Expand Down
30 changes: 5 additions & 25 deletions src/libs/antares/study/parts/common/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,17 @@ int ClusterList<ClusterT>::saveDataSeriesToFolder(const AnyString& folder, const
return ret;
}

template<>
int ClusterList<ThermalCluster>::loadDataSeriesFromFolder(Study& s,
const StudyLoadOptions& options,
const AnyString& folder)
template<class ClusterT>
int ClusterList<ClusterT>::loadDataSeriesFromFolder(Study& s,
const StudyLoadOptions& options,
const AnyString& folder)
{
if (empty())
return 1;

int ret = 1;

each([&ret, &options, &s, &folder](ThermalCluster& c) {
each([&](ClusterT& c) {
if (c.series)
ret = c.loadDataSeriesFromFolder(s, folder) and ret;

Expand All @@ -388,26 +388,6 @@ int ClusterList<ThermalCluster>::loadDataSeriesFromFolder(Study& s,
return ret;
}

template<>
int ClusterList<RenewableCluster>::loadDataSeriesFromFolder(Study& s,
const StudyLoadOptions& options,
const AnyString& folder)
{
if (empty())
return 1;

int ret = 1;

each([&](Cluster& cluster) {
if (cluster.series)
ret = cluster.loadDataSeriesFromFolder(s, folder) and ret;

++options.progressTicks;
options.pushProgressLogs();
});
return ret;
}

template<class ClusterT>
void ClusterList<ClusterT>::ensureDataTimeSeries()
{
Expand Down
33 changes: 24 additions & 9 deletions src/libs/antares/study/parts/thermal/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,20 +493,35 @@ bool ThermalClusterList::loadPreproFromFolder(Study& study,
ret = result and ret;
}

{
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();

ret = result && ret;
}
++options.progressTicks;
options.pushProgressLogs();
}
return ret;
}


bool ThermalClusterList::loadEconomicCosts(Study& study, const AnyString& folder)
{
if (empty())
return true;

Clob buffer;
bool ret = true;

for (auto it = begin(); it != end(); ++it)
{
auto& c = *(it->second);

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();

ret = result && ret;
}
return ret;
}

} // namespace Data
} // namespace Antares
2 changes: 2 additions & 0 deletions src/libs/antares/study/parts/thermal/cluster_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class ThermalClusterList : public ClusterList<ThermalCluster>
*/
bool loadPreproFromFolder(Study& s, const StudyLoadOptions& options, const AnyString& folder);

bool loadEconomicCosts(Study& s, const AnyString& folder);

bool savePreproToFolder(const AnyString& folder) const;

bool saveToFolder(const AnyString& folder) const override;
Expand Down

0 comments on commit 976acd4

Please sign in to comment.