-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thermal clusters lists : cleaning #1844
Changes from 80 commits
8d3a971
3a1202c
ff6795d
947b5ff
8dfc03f
206f45e
aacb6b1
a4cdc1c
fbf0ade
ee1e5f5
7c7b6ea
8e3ba46
eceedd3
e9cb22a
a01b803
03307c4
1cdcef0
319b1e7
b0a20b5
ef867d7
0ec83cb
e01ef86
04f939e
d6b4046
865f931
c827205
d07ee14
4236cac
7c7147e
c96ae08
fdb17bc
7b10897
bd52ad0
6c27552
e7bcae9
d5d796a
b1a6507
5a438df
e72c934
da7b89f
7801fd2
c125ada
3bbef8e
986595f
cddef42
5d30994
5e7a3fb
e13ed3b
04af0ad
39edc4e
5280481
65297d8
f816193
9c4b010
cf44e0b
77e0488
1d8a0df
7a33389
86aab4d
7c9ce23
f07c435
b170898
a8a5ea7
8472b82
cd001d4
2b8c9c0
c86f5e7
55ce3db
eed3fcd
d863698
ba18613
822083f
405483f
1ff3065
2c11018
e5a9ebb
242ba0f
119746e
9c321dd
beecabc
fcc3ee8
08b28c7
d2c6f3b
3689c46
f0d7236
00a911b
4c47d7d
f3f73c1
3790f82
973572e
8e80430
59d249f
106db37
0047102
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,16 +169,15 @@ static void checkThermalColumnNumber(const Antares::Data::AreaList& areas, | |
for (uint areaIndex = 0; areaIndex < areas.size(); ++areaIndex) | ||
{ | ||
const auto& area = *(areas.byIndex[areaIndex]); | ||
for (uint clusterIndex = 0; clusterIndex != area.thermal.clusterCount(); ++clusterIndex) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here area.thermal.clusterCount() used to count the number of elements of |
||
for (auto cluster : area.thermal.list.each_enabled()) | ||
{ | ||
const auto& cluster = *(area.thermal.clusters[clusterIndex]); | ||
if (cluster.costgeneration == Antares::Data::setManually) | ||
if (cluster->costgeneration == Antares::Data::setManually) | ||
continue; | ||
const uint otherMatrixWidth = (cluster.ecoInput.*matrix).width; | ||
uint tsWidth = cluster.series.timeSeries.width; | ||
const uint otherMatrixWidth = (cluster->ecoInput.*matrix).width; | ||
uint tsWidth = cluster->series.timeSeries.width; | ||
if (otherMatrixWidth != 1 && otherMatrixWidth != tsWidth) | ||
{ | ||
logs.warning() << "Area: " << area.name << ". Cluster name: " << cluster.name() | ||
logs.warning() << "Area: " << area.name << ". Cluster name: " << cluster->name() | ||
<< ". " << exception.what(); | ||
error = true; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -774,14 +774,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
StringT& buffer, | ||
const StudyLoadOptions& options) | ||
{ | ||
// Progression | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logs loading progression. Unnecessary and bloating the code. |
||
options.progressTicks = 0; | ||
options.progressTickCount | ||
= area.thermal.list.size() * (options.loadOnlyNeeded ? 1 : 2) // prepro+series | ||
+ 1 // links | ||
+ 4 // load,solar,wind,hydro | ||
+ 1; // DSM,misc... | ||
|
||
// Reset | ||
area.filterSynthesis = filterAll; | ||
area.filterYearByYear = filterAll; | ||
|
@@ -820,15 +812,10 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
MatrixTestForPositiveValues_LimitWidth(buffer.c_str(), &area.miscGen, fhhPSP); | ||
} | ||
|
||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
|
||
// Links | ||
{ | ||
buffer.clear() << study.folderInput << SEP << "links" << SEP << area.id; | ||
ret = AreaLinksLoadFromFolder(study, list, &area, buffer) && ret; | ||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
} | ||
|
||
// UI | ||
|
@@ -858,9 +845,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
ret = area.load.series.loadFromFile(buffer.c_str(), averageTs) | ||
&& ret; | ||
} | ||
|
||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
} | ||
|
||
// Solar | ||
|
@@ -880,9 +864,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
&& ret; | ||
|
||
} | ||
|
||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
} | ||
|
||
// Hydro | ||
|
@@ -903,9 +884,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
buffer.clear() << study.folderInput << SEP << "hydro" << SEP << "series"; | ||
ret = area.hydro.series->loadFromFolder(study, area.id, buffer) && ret; | ||
} | ||
|
||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
} | ||
|
||
// Wind | ||
|
@@ -924,9 +902,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
ret = area.wind.series.loadFromFile(buffer.c_str(), averageTs) | ||
&& ret; | ||
} | ||
|
||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
} | ||
|
||
// Thermal cluster list | ||
|
@@ -1101,7 +1076,6 @@ bool AreaList::loadFromFolder(const StudyLoadOptions& options) | |
Area& area = *(i->second); | ||
buffer.clear() << pStudy.folderInput << thermalPlant << area.id; | ||
ret = area.thermal.list.loadFromFolder(pStudy, buffer.c_str(), &area) && ret; | ||
area.thermal.prepareAreaWideIndexes(); | ||
} | ||
} | ||
|
||
|
@@ -1141,7 +1115,6 @@ bool AreaList::loadFromFolder(const StudyLoadOptions& options) | |
Area& area = *(i->second); | ||
buffer.clear() << pStudy.folderInput << renewablePlant << area.id; | ||
ret = area.renewable.list.loadFromFolder(buffer.c_str(), &area) && ret; | ||
area.renewable.prepareAreaWideIndexes(); | ||
} | ||
} | ||
|
||
|
@@ -1296,7 +1269,6 @@ void AreaListEnsureDataHydroPrepro(AreaList* l) | |
|
||
void AreaListEnsureDataThermalPrepro(AreaList* l) | ||
{ | ||
assert(l && "The area list must not be nullptr"); | ||
l->each([&](Data::Area& area) { area.thermal.list.ensureDataPrepro(); }); | ||
} | ||
|
||
|
@@ -1534,8 +1506,7 @@ ThermalCluster* AreaList::findClusterFromINIKey(const AnyString& key) | |
Area* parentArea = findFromName(parentName); | ||
if (parentArea == nullptr) | ||
return nullptr; | ||
return parentArea->thermal.list.find(id); | ||
|
||
return parentArea->thermal.list.findInAll(id); | ||
} | ||
|
||
void AreaList::updateNameIDSet() const | ||
|
@@ -1574,8 +1545,8 @@ void AreaList::removeWindTimeseries() | |
void AreaList::removeThermalTimeseries() | ||
{ | ||
each([](Data::Area& area) { | ||
area.thermal.list.each( | ||
[](Data::ThermalCluster& cluster) { cluster.series.reset(); }); | ||
for (auto c : area.thermal.list.all()) | ||
c->series.reset(); | ||
}); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,7 +274,7 @@ void BindingConstraint::copyWeights(const Study &study, | |
if (localParent) | ||
{ | ||
const ThermalCluster *localTC | ||
= localParent->thermal.list.find(thermalCluster->id()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These small changes are located in functions only called from GUI, where we used to search in the full cluster list ( |
||
= localParent->thermal.list.findInAll(thermalCluster->id()); | ||
if (localTC) | ||
pClusterWeights[localTC] = weight; | ||
} | ||
|
@@ -335,7 +335,7 @@ void BindingConstraint::copyOffsets(const Study &study, | |
if (localParent) | ||
{ | ||
const ThermalCluster *localTC | ||
= localParent->thermal.list.find(thermalCluster->id()); | ||
= localParent->thermal.list.findInAll(thermalCluster->id()); | ||
if (localTC) | ||
pClusterOffsets[localTC] = offset; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,7 @@ static void listOfFilesAnDirectoriesToKeepForArea(PathList& e, PathList& p, cons | |
buffer.clear() << "input/thermal/clusters/" << id << "/list.ini"; | ||
e.add(buffer); | ||
|
||
for (const auto& cluster : area->thermal.list) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we're in the cleaner. |
||
for (auto cluster : area->thermal.list.all()) | ||
{ | ||
buffer.clear() << "input/thermal/prepro/" << id << '/' << cluster->id(); | ||
p.add(buffer); | ||
|
@@ -164,7 +164,7 @@ static void listOfFilesAnDirectoriesToKeepForArea(PathList& e, PathList& p, cons | |
buffer.clear() << "input/renewables/clusters/" << id << "/list.ini"; | ||
e.add(buffer); | ||
|
||
for (const auto& cluster : area->renewable.list) | ||
for (const auto cluster : area->renewable.list.all()) | ||
{ | ||
buffer.clear() << "input/renewables/series/" << id << '/' << cluster->id(); | ||
p.add(buffer); | ||
|
@@ -353,7 +353,7 @@ bool listOfFilesAnDirectoriesToKeep(StudyCleaningInfos* infos) | |
// Exclude | ||
listOfFilesAnDirectoriesToKeepForArea(e, p, area, buffer); | ||
// Clear the memory used by the thermal clusters of the area | ||
area->thermal.list.clear(); | ||
area->thermal.list.clearAll(); | ||
|
||
// Interconnections | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,16 +53,6 @@ StudyLoadOptions::StudyLoadOptions() : | |
{ | ||
} | ||
|
||
void StudyLoadOptions::pushProgressLogs() const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment in associated .h file |
||
{ | ||
if (loadOnlyNeeded && progressTicks) | ||
{ | ||
uint percent = progressTicks * 100 / progressTickCount; | ||
if (percent < 100) | ||
logs.info() << logMessage << " " << percent << '%'; | ||
} | ||
} | ||
|
||
void StudyLoadOptions::checkForceSimulationMode() | ||
{ | ||
const uint number_of_enabled_force_options | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,9 +44,6 @@ class StudyLoadOptions | |
StudyLoadOptions(); | ||
//@} | ||
|
||
//! Push a new log entry according to the local progress data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All these code removals used to be about logging load progression. We found it was bloating the code unnecessarily. |
||
void pushProgressLogs() const; | ||
|
||
void checkForceSimulationMode(); | ||
|
||
public: | ||
|
@@ -95,10 +92,6 @@ class StudyLoadOptions | |
|
||
//! Temporary string for passing log message | ||
mutable Yuni::String logMessage; | ||
//! Porgression, tick count | ||
mutable uint progressTickCount; | ||
//! The current number of ticks | ||
mutable uint progressTicks; | ||
|
||
//! Display version number and exit | ||
bool displayVersion = false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,37 +24,21 @@ struct CompareClusterName final | |
class Cluster | ||
{ | ||
public: | ||
//! Map of renewable clusters | ||
using Map = std::map<ClusterName, Cluster*>; | ||
using Set = std::set<Cluster*, CompareClusterName>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
public: | ||
Cluster(Area* parent); | ||
|
||
virtual ~Cluster() = default; | ||
|
||
//! Get the cluster ID | ||
const ClusterName& id() const; | ||
|
||
//! \name Group | ||
//@{ | ||
//! Get the group of the cluster | ||
const ClusterName& group() const; | ||
|
||
//! Get the renewable cluster name | ||
const ClusterName& name() const; | ||
|
||
//! Set the name/ID | ||
void setName(const AnyString& newname); | ||
//@} | ||
|
||
//! Get the full cluster name | ||
Yuni::String getFullName() const; | ||
|
||
virtual uint groupId() const = 0; | ||
|
||
//! Set the group | ||
virtual void setGroup(Data::ClusterName newgrp) = 0; | ||
//@} | ||
|
||
/*! | ||
** \brief Check and fix all values of a renewable cluster | ||
|
@@ -64,13 +48,13 @@ class Cluster | |
virtual bool integrityCheck() = 0; | ||
|
||
/*! | ||
** \brief Get the memory consummed by the renewable cluster (in bytes) | ||
** \brief Get the memory consummed by the cluster (in bytes) | ||
*/ | ||
virtual uint64_t memoryUsage() const = 0; | ||
//@} | ||
|
||
/*! | ||
** \brief Invalidate all data associated to the renewable cluster | ||
** \brief Invalidate all data associated to the cluster | ||
*/ | ||
virtual bool forceReload(bool reload) const = 0; | ||
|
||
|
@@ -80,7 +64,7 @@ class Cluster | |
void invalidateArea(); | ||
|
||
/*! | ||
** \brief Mark the renewable cluster as modified | ||
** \brief Mark the cluster as modified | ||
*/ | ||
virtual void markAsModified() const = 0; | ||
|
||
|
@@ -97,25 +81,24 @@ class Cluster | |
*/ | ||
virtual void reset(); | ||
|
||
//! Count of unit | ||
uint unitCount; | ||
bool saveDataSeriesToFolder(const AnyString& folder) const; | ||
bool loadDataSeriesFromFolder(Study& s, const AnyString& folder); | ||
|
||
uint unitCount = 0; | ||
|
||
//! Enabled | ||
bool enabled; | ||
bool isEnabled() const { return enabled; } | ||
bool enabled = true; | ||
|
||
//! The associate area (alias) | ||
Area* parentArea; | ||
|
||
//! The index of the cluster (within a list) | ||
uint index; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. index : only used by thermal cluster. So this index was moved down to class ThermalCluster |
||
|
||
//! Capacity of reference per unit (MW) (pMax) | ||
double nominalCapacity; | ||
double nominalCapacity = 0.; | ||
|
||
//! The index of the cluster from the area's point of view | ||
//! \warning this variable is only valid when used by the solver | ||
// (initialized in the same time that the runtime data) | ||
uint areaWideIndex; | ||
uint areaWideIndex = (uint)-1; | ||
|
||
//! Series | ||
TimeSeries series; | ||
|
@@ -131,20 +114,10 @@ class Cluster | |
Matrix<> modulation; | ||
|
||
protected: | ||
//! Name | ||
Data::ClusterName pName; | ||
//! ID | ||
Data::ClusterName pID; | ||
//! Group | ||
Data::ClusterName pGroup; | ||
|
||
public: | ||
//! Set of clusters | ||
using Set = std::set<Cluster*, CompareClusterName>; | ||
|
||
bool saveDataSeriesToFolder(const AnyString& folder) const; | ||
bool loadDataSeriesFromFolder(Study& s, const AnyString& folder); | ||
|
||
private: | ||
virtual unsigned int precision() const = 0; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point if execution, old list area.thermal.list.clusters (that was used here) was containing enabled and not must-run thermal clusters.
So, by the way, it was useless to filter the enabled clusters.
Now we use mustRunAndEnabledCount(), which count only suitable cluster (please see its body)