Skip to content
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

Merged
merged 94 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
8d3a971
[DEV] remove cluster in renewable container
payetvin Dec 4, 2023
3a1202c
[DEV] use vector for byIndex
payetvin Dec 5, 2023
ff6795d
[DEV] remove uselss renewlist constructor
payetvin Dec 5, 2023
947b5ff
[FIX] segfault
payetvin Dec 5, 2023
8dfc03f
[DEV] Code smells
payetvin Dec 5, 2023
206f45e
[CHERRY-PICK] enable cpp 20
JasonMarechal25 Dec 12, 2023
aacb6b1
Merge remote-tracking branch 'github/develop' into HEAD
flomnes Dec 18, 2023
a4cdc1c
Revert faulty YML files
flomnes Dec 18, 2023
fbf0ade
Refactor common ClusterList class (#1813)
payetvin Dec 20, 2023
ee1e5f5
Clean thermal lists : simplifying added(...) function (common list cl…
guilpier-code Dec 22, 2023
7c7b6ea
Clean thermal lists : removing use of mapping in a unit test
guilpier-code Dec 22, 2023
8e3ba46
Clean thermal lists : update PartThermal::clusters from GUI is useles…
guilpier-code Dec 27, 2023
eceedd3
Merge remote-tracking branch 'remotes/origin/develop' into fix/clean_…
guilpier-code Dec 28, 2023
e9cb22a
Clean thermal lists : adding a new vector containing all thermal clus…
guilpier-code Dec 28, 2023
a01b803
Clean thermal lists : using new cluster list for thermal noises gener…
guilpier-code Dec 28, 2023
03307c4
Clean thermal lists : replace use of mapping with the new vector
guilpier-code Dec 28, 2023
1cdcef0
Clean thermal lists : remove mapping completely
guilpier-code Dec 28, 2023
319b1e7
Clean thermal lists (goal : keeping only one list) : defining and usi…
guilpier-code Dec 29, 2023
b0a20b5
Clean thermal lists (goal : remove area.thermal.clusters) : mainly bu…
guilpier-code Dec 29, 2023
ef867d7
Clean thermal lists (goal : remove area.thermal.clusters) : fix unit …
guilpier-code Jan 2, 2024
0ec83cb
Clean thermal lists (goal : remove area.thermal.clusters) : keeping o…
guilpier-code Jan 2, 2024
e01ef86
Clean thermal lists (goal : remove area.thermal.clusters) : keeping o…
guilpier-code Jan 2, 2024
04f939e
Clean thermal lists : keeping on removing area.thermal.clusters usages
guilpier-code Jan 2, 2024
d6b4046
Clean thermal lists (goal : remove area.thermal.clusters) : keeping o…
guilpier-code Jan 2, 2024
865f931
Clean thermal lists (goal : remove area.thermal.clusters) : fix a bug
guilpier-code Jan 2, 2024
c827205
Clean thermal lists : keeping on removing area.thermal.clusters usages
guilpier-code Jan 3, 2024
d07ee14
Clean thermal lists : keeping on removing area.thermal.clusters usage…
guilpier-code Jan 3, 2024
4236cac
Clean thermal lists : keeping on removing area.thermal.clusters usages
guilpier-code Jan 3, 2024
7c7147e
Clean thermal lists (goal : remove area.thermal.clusters) : removing …
guilpier-code Jan 3, 2024
c96ae08
Clean thermal lists : final removal of area.thermal.clusters
guilpier-code Jan 3, 2024
fdb17bc
Merge remote-tracking branch 'remotes/origin/develop' into fix/clean_…
guilpier-code Jan 3, 2024
7b10897
Clean thermal lists : fix an overlook (in clear()) + change on cluste…
guilpier-code Jan 4, 2024
bd52ad0
[TEST] Try short tests on CI
payetvin Jan 4, 2024
6c27552
Merge branch 'fix/clean_thermal_lists' of https://github.com/AntaresS…
payetvin Jan 4, 2024
e7bcae9
[TEST] Revert CI test order
payetvin Jan 4, 2024
d5d796a
Clean thermal lists : removal of useless features / comments
guilpier-code Jan 5, 2024
b1a6507
Merge remote-tracking branch 'remotes/origin/fix/clean_thermal_lists'…
guilpier-code Jan 5, 2024
5a438df
Clean thermal lists : making all thermal cluster list a private data …
guilpier-code Jan 5, 2024
e72c934
Clean thermal lists : move cluster list containing all clusters to co…
guilpier-code Jan 5, 2024
da7b89f
Clean thermal lists : trial to fix a bug on CI only + move enabled fi…
guilpier-code Jan 5, 2024
7801fd2
Clean thermal lists : remove must-run list - part 1
guilpier-code Jan 5, 2024
c125ada
Clean thermal lists : remove must-run list - part 2
guilpier-code Jan 5, 2024
3bbef8e
Clean thermal lists : remove must-run list - part 3
guilpier-code Jan 5, 2024
986595f
Clean thermal lists : removing thermal/container.hxx (and moving its …
guilpier-code Jan 8, 2024
cddef42
Clean thermal lists : fix a bug in a unit test
guilpier-code Jan 8, 2024
5d30994
Clean thermal lists : remove must-run list - part 4 : we don't fill t…
guilpier-code Jan 8, 2024
5e7a3fb
Clean thermal lists : fix a bug in a unit test + remove unused must-r…
guilpier-code Jan 8, 2024
e13ed3b
Clean thermal lists : finally, removing must-run list
guilpier-code Jan 8, 2024
04af0ad
Clean thermal lists : move up functions to parent class
guilpier-code Jan 8, 2024
39edc4e
Clean thermal lists : call addToCompleteList(...) where add(...)
guilpier-code Jan 9, 2024
5280481
Clean thermal lists : correct a small coding error
guilpier-code Jan 9, 2024
65297d8
Clean thermal lists : replace a use of list.clusters with a use of fi…
guilpier-code Jan 9, 2024
f816193
Clean thermal lists : overlooks + small simplifications (see commit m…
guilpier-code Jan 10, 2024
9c4b010
Clean thermal lists : specializing or generalizing methods (from chil…
guilpier-code Jan 10, 2024
cf44e0b
Clean thermal lists : remove uses of area.thermal.list.clusters
guilpier-code Jan 10, 2024
77e0488
Clean thermal lists : small changes before a bigger commit (about fin…
guilpier-code Jan 11, 2024
1d8a0df
Clean thermal lists : fix compilation error
guilpier-code Jan 11, 2024
7a33389
Clean thermal lists (towards removal of thermal.list.clusters) : chan…
guilpier-code Jan 11, 2024
86aab4d
Clean thermal lists (towards removal of thermal.list.clusters) : remo…
guilpier-code Jan 11, 2024
7c9ce23
Clean thermal lists (towards removal of thermal.list.clusters) : some…
guilpier-code Jan 11, 2024
f07c435
Clean thermal lists (towards removal of thermal.list.clusters) : some…
guilpier-code Jan 11, 2024
b170898
Clean thermal lists (towards removal of thermal.list.clusters) : repl…
guilpier-code Jan 12, 2024
a8a5ea7
Clean thermal lists : fix a bug introduced in the very previous commit
guilpier-code Jan 12, 2024
8472b82
Clean thermal lists (towards removal of thermal.list.clusters) : remo…
guilpier-code Jan 12, 2024
cd001d4
Clean thermal lists (towards removal of thermal.list.clusters) : remo…
guilpier-code Jan 12, 2024
2b8c9c0
Clean thermal lists (towards removal of thermal.list.clusters) : remo…
guilpier-code Jan 12, 2024
c86f5e7
Clean thermal lists (towards removal of thermal.list.clusters) : make…
guilpier-code Jan 12, 2024
55ce3db
Clean thermal lists : call algorithms instead of our own code
guilpier-code Jan 13, 2024
eed3fcd
Clean thermal lists (towards removal of thermal.list.clusters) : rena…
guilpier-code Jan 14, 2024
d863698
Clean thermal lists (towards removal of thermal.list.clusters) : remo…
guilpier-code Jan 14, 2024
ba18613
Clean thermal lists (towards removal of thermal.list.clusters) : move…
guilpier-code Jan 15, 2024
822083f
Clean thermal lists (towards removal of thermal.list.clusters) : repl…
guilpier-code Jan 15, 2024
405483f
Clean thermal lists : correct a mistake + cleaning
guilpier-code Jan 15, 2024
1ff3065
Clean thermal lists (towards removal of thermal.list.clusters) : remo…
guilpier-code Jan 15, 2024
2c11018
Clean thermal lists (towards removal of thermal.list.clusters) : remo…
guilpier-code Jan 15, 2024
e5a9ebb
Clean thermal lists : completely remove list.clusters_
guilpier-code Jan 15, 2024
242ba0f
Clean thermal lists : fix a compilation error
guilpier-code Jan 15, 2024
119746e
Clean cluster lists : make giveIndicesToClusters() a protected member…
guilpier-code Jan 15, 2024
9c321dd
Clean thermal lists : correction of an error
guilpier-code Jan 18, 2024
beecabc
Clean thermal lists : correcting an error
guilpier-code Jan 19, 2024
fcc3ee8
renamed giveIndicesToClusters
payetvin Feb 15, 2024
08b28c7
remove isNotMustRun, remove assert not compiling, remove unused args …
payetvin Feb 15, 2024
d2c6f3b
rename enabledAndMustRunCount
payetvin Feb 16, 2024
3689c46
activate sonarcloud
payetvin Feb 16, 2024
f0d7236
merge develop, conflicts
payetvin Feb 16, 2024
00a911b
fix compile
payetvin Feb 16, 2024
4c47d7d
use all() to reset TS
payetvin Feb 19, 2024
f3f73c1
code smells 1
payetvin Feb 19, 2024
3790f82
code smells 2
payetvin Feb 19, 2024
973572e
update test_study to account for new enabled behavior
payetvin Feb 19, 2024
8e80430
fix compile
payetvin Feb 19, 2024
59d249f
code smells 3
payetvin Feb 19, 2024
106db37
code smells 4
payetvin Feb 19, 2024
0047102
remove double sonar job
payetvin Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/libs/antares/InfoCollection/StudyInfoCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ void StudyInfoCollector::enabledThermalClustersCountToFileContent(FileContent& f
for (auto i = study_.areas.begin(); i != end; ++i)
{
Area& area = *(i->second);
nbEnabledThermalClusters +=
Copy link
Contributor Author

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)

std::ranges::count_if(area.thermal.list, [](const auto& c) { return c->enabled; });
nbEnabledThermalClusters += area.thermal.list.enabledAndNotMustRunCount();
}

// Adding an item related to number of enabled thermal clusters to the file content
Expand Down
11 changes: 5 additions & 6 deletions src/libs/antares/checks/checkLoadedInputData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here area.thermal.clusterCount() used to count the number of elements of area.thermal.clusters, which contained enabled clusters only.
That's why we now call area.thermal.list.each_enabled()

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;
}
Expand Down
1 change: 0 additions & 1 deletion src/libs/antares/study/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ source_group("study\\part\\common" FILES ${SRC_STUDY_PART_COMMON})

set(SRC_STUDY_PART_THERMAL
parts/thermal/container.h
parts/thermal/container.hxx
parts/thermal/container.cpp
parts/thermal/prepro.h
parts/thermal/prepro.hxx
Expand Down
3 changes: 1 addition & 2 deletions src/libs/antares/study/area/area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,8 @@ void Area::resizeAllTimeseriesNumbers(uint n)
bool Area::thermalClustersMinStablePowerValidity(std::vector<YString>& output) const
{
bool noErrorMinStabPow = true;
for (uint l = 0; l != thermal.clusterCount(); ++l)
for (auto cluster : thermal.list.each_enabled())
{
auto& cluster = thermal.clusters[l];
logs.debug() << "cluster : " << cluster->name();
if ((not cluster->checkMinStablePower())
|| (cluster->minStablePower
Expand Down
35 changes: 3 additions & 32 deletions src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,14 +774,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study,
StringT& buffer,
const StudyLoadOptions& options)
{
// Progression
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -858,9 +845,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study,
ret = area.load.series.loadFromFile(buffer.c_str(), averageTs)
&& ret;
}

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

// Solar
Expand All @@ -880,9 +864,6 @@ static bool AreaListLoadFromFolderSingleArea(Study& study,
&& ret;

}

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

// Hydro
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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(); });
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
});
}

Expand Down
1 change: 0 additions & 1 deletion src/libs/antares/study/area/store-timeseries-numbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ void storeTimeseriesNumbersForWind(Solver::IResultWriter& writer, const Area& ar
void storeTimeseriesNumbersForThermal(Solver::IResultWriter& writer, const Area& area)
{
area.thermal.list.storeTimeseriesNumbers(writer);
area.thermal.mustrunList.storeTimeseriesNumbers(writer);
}

void storeTimeseriesNumbersForRenewable(Solver::IResultWriter& writer, const Area& area)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void BindingConstraint::copyWeights(const Study &study,
if (localParent)
{
const ThermalCluster *localTC
= localParent->thermal.list.find(thermalCluster->id());
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 (area.thermal.list.clusters).
That's why we use new findInAll

= localParent->thermal.list.findInAll(thermalCluster->id());
if (localTC)
pClusterWeights[localTC] = weight;
}
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/libs/antares/study/cleaner/cleaner-v20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we're in the cleaner.
The list : area->thermal.list.clusters used to be traversed.
In the cleaner, this list used to contain all clusters (special clusters are not removed as in the solver).
That's why we now traverse area->thermal.list.all()

for (auto cluster : area->thermal.list.all())
{
buffer.clear() << "input/thermal/prepro/" << id << '/' << cluster->id();
p.add(buffer);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down
10 changes: 0 additions & 10 deletions src/libs/antares/study/load-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ StudyLoadOptions::StudyLoadOptions() :
{
}

void StudyLoadOptions::pushProgressLogs() const
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
Expand Down
7 changes: 0 additions & 7 deletions src/libs/antares/study/load-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ class StudyLoadOptions
StudyLoadOptions();
//@}

//! Push a new log entry according to the local progress data
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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:
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 2 additions & 7 deletions src/libs/antares/study/parts/common/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@
namespace Antares::Data
{
Cluster::Cluster(Area* parent) :
unitCount(0),
enabled(true),
parentArea(parent),
index(0),
nominalCapacity(0.),
areaWideIndex((uint)-1),
series(tsNumbers)
parentArea(parent),
series(tsNumbers)
{
}

Expand Down
51 changes: 12 additions & 39 deletions src/libs/antares/study/parts/common/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using Set = std::set<Cluster*, CompareClusterName>; : only moved from the bottom to the top of the class


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
Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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;
Expand All @@ -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;
};
Expand Down
Loading