-
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 all 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 |
---|---|---|
|
@@ -6,7 +6,8 @@ on: | |
- main | ||
- develop | ||
- release/* | ||
pull_request: | ||
- fix/* | ||
- feature/* | ||
|
||
jobs: | ||
sonarcloud: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ Makefile | |
src/.vs | ||
|
||
src/config.h | ||
src/config/include | ||
|
||
# Yuni | ||
src/ext/yuni/src/ProfileBuild.cmake | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,7 @@ void checkMinStablePower(bool tsGenThermal, const Antares::Data::AreaList& areas | |
} | ||
else | ||
{ | ||
areas.each([](Antares::Data::Area& area) { area.thermal.checkAndCorrectAvailability(); }); | ||
areas.each([](const auto& area) { area.thermal.checkAndCorrectAvailability(); }); | ||
} | ||
} | ||
|
||
|
@@ -158,16 +158,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 |
---|---|---|
|
@@ -769,14 +769,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; | ||
|
@@ -815,15 +807,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 | ||
|
@@ -853,9 +840,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
ret = area.load.series.loadFromFile(buffer.c_str(), averageTs) | ||
&& ret; | ||
} | ||
|
||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
} | ||
|
||
// Solar | ||
|
@@ -875,9 +859,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
&& ret; | ||
|
||
} | ||
|
||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
} | ||
|
||
// Hydro | ||
|
@@ -898,9 +879,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 | ||
|
@@ -919,17 +897,14 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
ret = area.wind.series.loadFromFile(buffer.c_str(), averageTs) | ||
&& ret; | ||
} | ||
|
||
++options.progressTicks; | ||
options.pushProgressLogs(); | ||
} | ||
|
||
// Thermal cluster list | ||
{ | ||
buffer.clear() << study.folderInput << SEP << "thermal" << SEP << "prepro"; | ||
ret = area.thermal.list.loadPreproFromFolder(study, options, buffer) && ret; | ||
ret = area.thermal.list.loadPreproFromFolder(study, buffer) && ret; | ||
buffer.clear() << study.folderInput << SEP << "thermal" << SEP << "series"; | ||
ret = area.thermal.list.loadDataSeriesFromFolder(study, options, buffer) && ret; | ||
ret = area.thermal.list.loadDataSeriesFromFolder(study, buffer) && ret; | ||
ret = area.thermal.list.loadEconomicCosts(study, buffer) && ret; | ||
|
||
// In adequacy mode, all thermal clusters must be in 'mustrun' mode | ||
|
@@ -951,7 +926,7 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, | |
if (study.header.version >= StudyVersion(8, 1)) | ||
{ | ||
buffer.clear() << study.folderInput << SEP << "renewables" << SEP << "series"; | ||
ret = area.renewable.list.loadDataSeriesFromFolder(study, options, buffer) && ret; | ||
ret = area.renewable.list.loadDataSeriesFromFolder(study, buffer) && ret; | ||
} | ||
|
||
// Adequacy patch | ||
|
@@ -1096,7 +1071,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(); | ||
} | ||
} | ||
|
||
|
@@ -1136,7 +1110,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(); | ||
} | ||
} | ||
|
||
|
@@ -1291,7 +1264,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(); }); | ||
} | ||
|
||
|
@@ -1529,8 +1501,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 | ||
|
@@ -1569,8 +1540,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 |
---|---|---|
|
@@ -268,7 +268,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; | ||
} | ||
|
@@ -329,7 +329,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 |
---|---|---|
|
@@ -127,7 +127,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); | ||
|
@@ -156,7 +156,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); | ||
|
@@ -345,7 +345,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 | ||
{ | ||
|
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)