diff --git a/src/analyzer/atsp/load.cpp b/src/analyzer/atsp/load.cpp index 0f8b92311f..b23f86f551 100644 --- a/src/analyzer/atsp/load.cpp +++ b/src/analyzer/atsp/load.cpp @@ -59,7 +59,7 @@ bool ATSP::loadFromINIFile(const String& filename) if (section->name == ".general") { IniFile::Property* p = section->firstProperty; - for (; p ; p = p->next) + for (; p; p = p->next) { key = p->key; key.toLower(); diff --git a/src/format-code.sh b/src/format-code.sh index 30b51bd2e2..abac85a423 100755 --- a/src/format-code.sh +++ b/src/format-code.sh @@ -4,7 +4,7 @@ if [ $# -eq 0 ] then # No arguments: format all SOURCE_DIRS="analyzer/ libs/ solver/ tools/ config/ tests/ packaging/" - SOURCE_FILES=$(find $SOURCE_DIRS -regextype egrep -regex ".*/*\.(c|cxx|cpp|cc|h|hxx|hpp)$") + SOURCE_FILES=$(find $SOURCE_DIRS -regextype egrep -regex ".*/*\.(c|cxx|cpp|cc|h|hxx|hpp)$" ! -path '*/antlr-interface/*') else # Format files provided as arguments SOURCE_FILES="$@" diff --git a/src/libs/antares/args/args_to_utf8.cpp b/src/libs/antares/args/args_to_utf8.cpp index 15b7db618b..55a09f00ff 100644 --- a/src/libs/antares/args/args_to_utf8.cpp +++ b/src/libs/antares/args/args_to_utf8.cpp @@ -53,7 +53,14 @@ std::pair IntoUTF8ArgsTranslator::convert() for (int i = 0; i != argc_; ++i) { const uint len = (uint)wcslen(wargv[i]); - const uint newLen = WideCharToMultiByte(CP_UTF8, 0, wargv[i], len, nullptr, 0, nullptr, nullptr); + const uint newLen = WideCharToMultiByte(CP_UTF8, + 0, + wargv[i], + len, + nullptr, + 0, + nullptr, + nullptr); argv_[i] = (char*)malloc((newLen + 1) * sizeof(char)); memset(argv_[i], 0, (newLen + 1) * sizeof(char)); WideCharToMultiByte(CP_UTF8, 0, wargv[i], len, argv_[i], newLen, nullptr, nullptr); diff --git a/src/libs/antares/array/include/antares/array/matrix.hxx b/src/libs/antares/array/include/antares/array/matrix.hxx index 78fef9186a..c95db1bd93 100644 --- a/src/libs/antares/array/include/antares/array/matrix.hxx +++ b/src/libs/antares/array/include/antares/array/matrix.hxx @@ -1044,8 +1044,6 @@ bool Matrix::internalLoadCSVFile(const AnyString& filename, uint options, BufferType* buffer) { - using namespace Yuni; - // Status bool result = false; @@ -1057,7 +1055,7 @@ bool Matrix::internalLoadCSVFile(const AnyString& filename, switch (loadFromFileToBuffer(*buffer, filename)) { - case IO::errNone: + case Yuni::IO::errNone: { // Empty files if (buffer->empty()) @@ -1098,7 +1096,7 @@ bool Matrix::internalLoadCSVFile(const AnyString& filename, } break; } - case IO::errNotFound: + case Yuni::IO::errNotFound: { if (not(options & optQuiet)) { @@ -1106,7 +1104,7 @@ bool Matrix::internalLoadCSVFile(const AnyString& filename, } break; } - case IO::errMemoryLimit: + case Yuni::IO::errMemoryLimit: { if (not(options & optQuiet)) { diff --git a/src/libs/antares/checks/include/antares/checks/checkLoadedInputData.h b/src/libs/antares/checks/include/antares/checks/checkLoadedInputData.h index 113451410f..62352390bc 100644 --- a/src/libs/antares/checks/include/antares/checks/checkLoadedInputData.h +++ b/src/libs/antares/checks/include/antares/checks/checkLoadedInputData.h @@ -28,7 +28,6 @@ void checkOrtoolsUsage(Antares::Data::UnitCommitmentMode ucMode, bool ortoolsUsed, const std::string& solverName); - void checkStudyVersion(const AnyString& optStudyFolder); void checkSimplexRangeHydroPricing(Antares::Data::SimplexOptimization optRange, diff --git a/src/libs/antares/exception/include/antares/exception/LoadingError.hpp b/src/libs/antares/exception/include/antares/exception/LoadingError.hpp index ab1ae664d8..c79b1a791e 100644 --- a/src/libs/antares/exception/include/antares/exception/LoadingError.hpp +++ b/src/libs/antares/exception/include/antares/exception/LoadingError.hpp @@ -130,13 +130,14 @@ class InvalidSolver: public LoadingError explicit InvalidSolver(const std::string& solver, const std::string& availableSolverList); }; -class InvalidSolverSpecificParameters : public LoadingError +class InvalidSolverSpecificParameters: public LoadingError { public: - explicit InvalidSolverSpecificParameters(const std::string& solver, const std::string& specificParameters); + explicit InvalidSolverSpecificParameters(const std::string& solver, + const std::string& specificParameters); }; -class InvalidStudy : public LoadingError +class InvalidStudy: public LoadingError { public: explicit InvalidStudy(const Yuni::String& study); diff --git a/src/libs/antares/file-tree-study-loader/include/antares/file-tree-study-loader/FileTreeStudyLoader.h b/src/libs/antares/file-tree-study-loader/include/antares/file-tree-study-loader/FileTreeStudyLoader.h index 687afa12ae..7b46a95c3a 100644 --- a/src/libs/antares/file-tree-study-loader/include/antares/file-tree-study-loader/FileTreeStudyLoader.h +++ b/src/libs/antares/file-tree-study-loader/include/antares/file-tree-study-loader/FileTreeStudyLoader.h @@ -31,6 +31,7 @@ namespace Data { class Study; } + /** * @class FileTreeStudyLoader * @brief A class to load studies from the file tree. diff --git a/src/libs/antares/inifile/include/antares/inifile/inifile.hxx b/src/libs/antares/inifile/include/antares/inifile/inifile.hxx index 64785d1ece..20498c3ee2 100644 --- a/src/libs/antares/inifile/include/antares/inifile/inifile.hxx +++ b/src/libs/antares/inifile/include/antares/inifile/inifile.hxx @@ -32,7 +32,8 @@ inline bool IniFile::empty() const return not firstSection; } -inline IniFile::Section::Section(const AnyString& name): name(name) +inline IniFile::Section::Section(const AnyString& name): + name(name) { } diff --git a/src/libs/antares/inifile/inifile.cpp b/src/libs/antares/inifile/inifile.cpp index 67190a0654..8cfa6b9607 100644 --- a/src/libs/antares/inifile/inifile.cpp +++ b/src/libs/antares/inifile/inifile.cpp @@ -65,9 +65,8 @@ void IniFile::Section::saveToStream(std::ostream& stream_out, uint64_t& written) stream_out << '[' << name << "]\n"; written += 4 /* []\n\n */ + name.size(); - each([&stream_out, &written](const IniFile::Property& p) { - p.saveToStream(stream_out, written); - }); + each([&stream_out, &written](const IniFile::Property& p) + { p.saveToStream(stream_out, written); }); stream_out << '\n'; } @@ -249,7 +248,7 @@ bool IniFile::open(const fs::path& filename, bool warnings) if (std::ifstream file(filename); file.is_open()) { - if (! readStream(file)) + if (!readStream(file)) { logs.error() << "Invalid INI file : " << filename; return false; @@ -266,9 +265,8 @@ bool IniFile::open(const fs::path& filename, bool warnings) void IniFile::saveToStream(std::ostream& stream_out, uint64_t& written) const { - each([&stream_out, &written](const IniFile::Section& s) { - s.saveToStream(stream_out, written); - }); + each([&stream_out, &written](const IniFile::Section& s) + { s.saveToStream(stream_out, written); }); if (written != 0) { diff --git a/src/libs/antares/io/file.cpp b/src/libs/antares/io/file.cpp index 10bf5b30b9..8ef66b3a3d 100644 --- a/src/libs/antares/io/file.cpp +++ b/src/libs/antares/io/file.cpp @@ -27,13 +27,13 @@ #ifdef YUNI_OS_WINDOWS #include + #include #else #include #include #endif #include - #include #include diff --git a/src/libs/antares/io/include/antares/io/file.h b/src/libs/antares/io/include/antares/io/file.h index e9fd0e91dc..b401b1cece 100644 --- a/src/libs/antares/io/include/antares/io/file.h +++ b/src/libs/antares/io/include/antares/io/file.h @@ -21,10 +21,10 @@ #ifndef __LIBS_ANTARES_IO_FILE_H__ #define __LIBS_ANTARES_IO_FILE_H__ -#include - #include +#include + namespace Antares::IO { /*! diff --git a/src/libs/antares/locale/locale.cpp b/src/libs/antares/locale/locale.cpp index fd74ea2af4..238331274a 100644 --- a/src/libs/antares/locale/locale.cpp +++ b/src/libs/antares/locale/locale.cpp @@ -37,7 +37,7 @@ void InitializeDefaultLocale() } #else - if (! std::setlocale(LC_ALL, "en_US.utf8")) + if (!std::setlocale(LC_ALL, "en_US.utf8")) { std::cerr << "impossible to set locale to en_US.utf8" << std::endl; } diff --git a/src/libs/antares/study-loader/include/antares/study-loader/IStudyLoader.h b/src/libs/antares/study-loader/include/antares/study-loader/IStudyLoader.h index 9b4c710ed4..7d6f25373b 100644 --- a/src/libs/antares/study-loader/include/antares/study-loader/IStudyLoader.h +++ b/src/libs/antares/study-loader/include/antares/study-loader/IStudyLoader.h @@ -29,6 +29,7 @@ namespace Data { class Study; } + /** * @class IStudyLoader * @brief The IStudyLoader class is an interface for loading studies. diff --git a/src/libs/antares/study/area/area.cpp b/src/libs/antares/study/area/area.cpp index 929e8653c2..130c56a0d6 100644 --- a/src/libs/antares/study/area/area.cpp +++ b/src/libs/antares/study/area/area.cpp @@ -51,19 +51,20 @@ Area::Area(): internalInitialize(); } -Area::Area(const AnyString& name) : Area() +Area::Area(const AnyString& name): + Area() { internalInitialize(); this->name = name; this->id = Antares::transformNameIntoID(this->name); } -Area::Area(const AnyString& name, const AnyString& id) : Area() +Area::Area(const AnyString& name, const AnyString& id): + Area() { internalInitialize(); this->name = name; this->id = Antares::transformNameIntoID(id); - } Area::~Area() diff --git a/src/libs/antares/study/area/links.cpp b/src/libs/antares/study/area/links.cpp index 96a304d28e..f7b722da49 100644 --- a/src/libs/antares/study/area/links.cpp +++ b/src/libs/antares/study/area/links.cpp @@ -21,9 +21,9 @@ #include "antares/study/area/links.h" +#include #include #include -#include #include #include @@ -308,9 +308,13 @@ namespace // anonymous bool isPropertyUsedForLinkTSgeneration(const std::string& key) { - std::array listKeys - = {"unitcount", "nominalcapacity", "law.planned", "law.forced", - "volatility.planned", "volatility.forced", "force-no-generation"}; + std::array listKeys = {"unitcount", + "nominalcapacity", + "law.planned", + "law.forced", + "volatility.planned", + "volatility.forced", + "force-no-generation"}; return std::find(listKeys.begin(), listKeys.end(), key) != listKeys.end(); } diff --git a/src/libs/antares/study/area/list.cpp b/src/libs/antares/study/area/list.cpp index fd2b3bb5b7..de3c2e9b1f 100644 --- a/src/libs/antares/study/area/list.cpp +++ b/src/libs/antares/study/area/list.cpp @@ -968,8 +968,9 @@ static bool AreaListLoadFromFolderSingleArea(Study& study, ret = hydroSeries->LoadMaxPower(area.id, buffer) && ret; } - hydroSeries->resizeTSinDeratedMode( - study.parameters.derated, studyVersion, study.usedByTheSolver); + hydroSeries->resizeTSinDeratedMode(study.parameters.derated, + studyVersion, + study.usedByTheSolver); } // Wind @@ -1278,7 +1279,7 @@ Area* AreaList::findFromPosition(const int x, const int y) const { auto lastArea = i->second; if (lastArea->ui && std::abs(lastArea->ui->x - x) < nearestDistance - && std::abs(lastArea->ui->y - y) < nearestDistance) + && std::abs(lastArea->ui->y - y) < nearestDistance) { nearestItem = lastArea; } @@ -1326,12 +1327,14 @@ void AreaListEnsureDataLoadPrepro(AreaList* l) /* Asserts */ assert(l); - l->each([](Data::Area& area) { - if (!area.load.prepro) - { - area.load.prepro = new Antares::Data::Load::Prepro(); - } - }); + l->each( + [](Data::Area& area) + { + if (!area.load.prepro) + { + area.load.prepro = new Antares::Data::Load::Prepro(); + } + }); } void AreaListEnsureDataSolarPrepro(AreaList* l) diff --git a/src/libs/antares/study/binding_constraint/BindingConstraintGroupRepository.cpp b/src/libs/antares/study/binding_constraint/BindingConstraintGroupRepository.cpp index ff181e7ed8..b29ad4fba2 100644 --- a/src/libs/antares/study/binding_constraint/BindingConstraintGroupRepository.cpp +++ b/src/libs/antares/study/binding_constraint/BindingConstraintGroupRepository.cpp @@ -60,7 +60,9 @@ bool BindingConstraintGroupRepository::buildFrom(const BindingConstraintsReposit bool BindingConstraintGroupRepository::timeSeriesWidthConsistentInGroups() const { - bool allConsistent = !std::ranges::any_of(groups_, [](const auto& group) + bool allConsistent = !std::ranges::any_of( + groups_, + [](const auto& group) { const auto& constraints = group->constraints(); if (constraints.empty()) @@ -68,7 +70,8 @@ bool BindingConstraintGroupRepository::timeSeriesWidthConsistentInGroups() const return false; } auto width = (*constraints.begin())->RHSTimeSeries().width; - bool isConsistent = std::ranges::all_of(constraints, + bool isConsistent = std::ranges::all_of( + constraints, [&width](const std::shared_ptr& bc) { bool sameWidth = bc->RHSTimeSeries().width == width; @@ -89,15 +92,16 @@ bool BindingConstraintGroupRepository::timeSeriesWidthConsistentInGroups() const void BindingConstraintGroupRepository::resizeAllTimeseriesNumbers(unsigned int nb_years) { - std::ranges::for_each(groups_, [&nb_years](auto& group) - { group->timeseriesNumbers.reset(nb_years); }); + std::ranges::for_each(groups_, + [&nb_years](auto& group) { group->timeseriesNumbers.reset(nb_years); }); } BindingConstraintGroup* BindingConstraintGroupRepository::operator[](const std::string& name) const { - if (auto group = std::ranges::find_if(groups_, [&name](auto& group_of_constraint) - { return group_of_constraint->name() == name; }); - group != groups_.end()) + if (auto group = std::ranges::find_if(groups_, + [&name](auto& group_of_constraint) + { return group_of_constraint->name() == name; }); + group != groups_.end()) { return group->get(); } diff --git a/src/libs/antares/study/cleaner/cleaner-v20.cpp b/src/libs/antares/study/cleaner/cleaner-v20.cpp index 3c8f183be4..f2fa71b17d 100644 --- a/src/libs/antares/study/cleaner/cleaner-v20.cpp +++ b/src/libs/antares/study/cleaner/cleaner-v20.cpp @@ -391,7 +391,6 @@ bool listOfFilesAnDirectoriesToKeep(StudyCleaningInfos* infos) buffer.clear() << infos->folder << "/input/bindingconstraints/bindingconstraints.ini"; if (ini.open(buffer)) { - ini.each( [&e](const IniFile::Section& section) { diff --git a/src/libs/antares/study/include/antares/study/parameters.h b/src/libs/antares/study/include/antares/study/parameters.h index 204afcdd0d..1b2ce027d9 100644 --- a/src/libs/antares/study/include/antares/study/parameters.h +++ b/src/libs/antares/study/include/antares/study/parameters.h @@ -75,8 +75,7 @@ class Parameters final ** \param version Current study version ** \return True if the settings have been loaded, false if at least one error has occured */ - bool loadFromFile(const AnyString& filename, - const StudyVersion& version); + bool loadFromFile(const AnyString& filename, const StudyVersion& version); /*! ** \brief Prepare all settings for a simulation @@ -501,8 +500,7 @@ class Parameters final private: //! Load data from an INI file - bool loadFromINI(const IniFile& ini, - const StudyVersion& version); + bool loadFromINI(const IniFile& ini, const StudyVersion& version); void resetPlayedYears(uint nbOfYears); diff --git a/src/libs/antares/study/include/antares/study/parts/hydro/container.h b/src/libs/antares/study/include/antares/study/parts/hydro/container.h index 9bece26ff3..01c219b46b 100644 --- a/src/libs/antares/study/include/antares/study/parts/hydro/container.h +++ b/src/libs/antares/study/include/antares/study/parts/hydro/container.h @@ -22,6 +22,7 @@ #define __ANTARES_LIBS_STUDY_PARTS_HYDRO_CONTAINER_H__ #include + #include "../../fwd.h" #include "allocation.h" #include "prepro.h" @@ -30,7 +31,7 @@ namespace Antares::Data { - //! The maximum number of days in a year +//! The maximum number of days in a year constexpr size_t dayYearCount = 366; struct DailyDemand @@ -233,9 +234,7 @@ class PartHydro // As this function can be called a lot of times, we pass working variables and returned variables // as arguments, so that we don't have to create them locally (as in a classical function) each // time. -double getWaterValue(const double& level, - const Matrix& waterValues, - const uint day); +double getWaterValue(const double& level, const Matrix& waterValues, const uint day); // Interpolates a rate from the credit modulation table according to a level double getWeeklyModulation(const double& level /* format : in % of reservoir capacity */, diff --git a/src/libs/antares/study/include/antares/study/scenario-builder/hydroLevelsData.h b/src/libs/antares/study/include/antares/study/scenario-builder/hydroLevelsData.h index 42aff6336a..b5cb21073d 100644 --- a/src/libs/antares/study/include/antares/study/scenario-builder/hydroLevelsData.h +++ b/src/libs/antares/study/include/antares/study/scenario-builder/hydroLevelsData.h @@ -21,9 +21,10 @@ #ifndef __LIBS_STUDY_SCENARIO_BUILDER_DATA_HYDRO_LEVELS_H__ #define __LIBS_STUDY_SCENARIO_BUILDER_DATA_HYDRO_LEVELS_H__ -#include "scBuilderDataInterface.h" #include +#include "scBuilderDataInterface.h" + namespace Antares { namespace Data diff --git a/src/libs/antares/study/include/antares/study/sets.hxx b/src/libs/antares/study/include/antares/study/sets.hxx index d2976252cc..931e044ba0 100644 --- a/src/libs/antares/study/include/antares/study/sets.hxx +++ b/src/libs/antares/study/include/antares/study/sets.hxx @@ -176,8 +176,8 @@ bool Sets::saveToFile(const StringT& filename) const using namespace Yuni; using namespace Antares; - IO::File::Stream file; - if (!file.open(filename, IO::OpenMode::write | IO::OpenMode::truncate)) + Yuni::IO::File::Stream file; + if (!file.open(filename, Yuni::IO::OpenMode::write | Yuni::IO::OpenMode::truncate)) { logs.error() << "I/O Error: " << filename << ": impossible to write the file"; return false; @@ -288,8 +288,8 @@ bool Sets::loadFromFile(const std::filesystem::path& filename) continue; } - logs.warning() << "sets: `" << filename << "`: Invalid property `" - << p->key << '\''; + logs.warning() << "sets: `" << filename << "`: Invalid property `" << p->key + << '\''; } // Add the new group diff --git a/src/libs/antares/study/parameters.cpp b/src/libs/antares/study/parameters.cpp index af0aedc14b..628237bbef 100644 --- a/src/libs/antares/study/parameters.cpp +++ b/src/libs/antares/study/parameters.cpp @@ -1111,10 +1111,16 @@ static bool SGDIntLoadFamily_Legacy(Parameters& d, if (key == "initial-reservoir-levels") // ignored since 9.2 { - if (version >= StudyVersion(9,2)) - logs.warning() << "Option initial-reservoir-levels is deprecated, please remove it from the study"; + if (version >= StudyVersion(9, 2)) + { + logs.warning() + << "Option initial-reservoir-levels is deprecated, please remove it from the study"; + } else if (value == "hot start") - logs.warning() << "Hydro hot start not supported with this solver, please use a version < 9.2"; + { + logs.warning() + << "Hydro hot start not supported with this solver, please use a version < 9.2"; + } return true; } @@ -1127,8 +1133,7 @@ bool firstKeyLetterIsValid(const String& name) return (firstLetter >= 'a' && firstLetter <= 'z'); } -bool Parameters::loadFromINI(const IniFile& ini, - const StudyVersion& version) +bool Parameters::loadFromINI(const IniFile& ini, const StudyVersion& version) { // Reset inner data reset(); @@ -1294,7 +1299,9 @@ void Parameters::fixBadValues() } if (simulationDays.first == 0) + { simulationDays.first = 1; + } else { simulationDays.first = std::clamp(simulationDays.first, 1u, 365u); @@ -1958,8 +1965,7 @@ void Parameters::saveToINI(IniFile& ini) const } } -bool Parameters::loadFromFile(const AnyString& filename, - const StudyVersion& version) +bool Parameters::loadFromFile(const AnyString& filename, const StudyVersion& version) { // Loading the INI file IniFile ini; diff --git a/src/libs/antares/study/parts/common/cluster_list.cpp b/src/libs/antares/study/parts/common/cluster_list.cpp index 9be5c2ca57..9c39ca7c8b 100644 --- a/src/libs/antares/study/parts/common/cluster_list.cpp +++ b/src/libs/antares/study/parts/common/cluster_list.cpp @@ -263,8 +263,9 @@ bool ClusterList::saveDataSeriesToFolder(const AnyString& folder) cons template bool ClusterList::loadDataSeriesFromFolder(Study& s, const AnyString& folder) { - return std::ranges::all_of(allClusters_, [&s, &folder](auto c) - { return c->loadDataSeriesFromFolder(s, folder); }); + return std::ranges::all_of(allClusters_, + [&s, &folder](auto c) + { return c->loadDataSeriesFromFolder(s, folder); }); } template diff --git a/src/libs/antares/study/parts/hydro/allocation.cpp b/src/libs/antares/study/parts/hydro/allocation.cpp index 597264cf20..052bc3411d 100644 --- a/src/libs/antares/study/parts/hydro/allocation.cpp +++ b/src/libs/antares/study/parts/hydro/allocation.cpp @@ -164,8 +164,7 @@ void HydroAllocation::clear() #endif } -bool HydroAllocation::loadFromFile(const AreaName& referencearea, - const fs::path& filename) +bool HydroAllocation::loadFromFile(const AreaName& referencearea, const fs::path& filename) { clear(); @@ -177,21 +176,24 @@ bool HydroAllocation::loadFromFile(const AreaName& referencearea, } if (ini.empty()) + { return true; + } - ini.each([this](const IniFile::Section& section) - { - for (auto* p = section.firstProperty; p; p = p->next) - { - double coeff = p->value.to(); - if (!Utils::isZero(coeff)) - { - AreaName areaname = p->key; - areaname.toLower(); - pValues[areaname] = coeff; - } - } - }); + ini.each( + [this](const IniFile::Section& section) + { + for (auto* p = section.firstProperty; p; p = p->next) + { + double coeff = p->value.to(); + if (!Utils::isZero(coeff)) + { + AreaName areaname = p->key; + areaname.toLower(); + pValues[areaname] = coeff; + } + } + }); return true; } diff --git a/src/libs/antares/study/parts/hydro/container.cpp b/src/libs/antares/study/parts/hydro/container.cpp index e09ae5a8fb..92d13a586e 100644 --- a/src/libs/antares/study/parts/hydro/container.cpp +++ b/src/libs/antares/study/parts/hydro/container.cpp @@ -32,7 +32,7 @@ using namespace Yuni; namespace Antares::Data { -PartHydro::PartHydro() : +PartHydro::PartHydro(): interDailyBreakdown(0.), intraDailyModulation(2.), intermonthlyBreakdown(0), @@ -113,7 +113,9 @@ static bool loadProperties(Study& study, T PartHydro::*ptr) { if (!property) + { return false; + } bool ret = true; @@ -242,52 +244,74 @@ bool PartHydro::LoadFromFolder(Study& study, const AnyString& folder) if (IniFile::Section* section = ini.find("inter-daily-breakdown")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::interDailyBreakdown) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::interDailyBreakdown) + && ret; } if (IniFile::Section* section = ini.find("intra-daily-modulation")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::intraDailyModulation) && ret; + ret = loadProperties(study, + section->firstProperty, + buffer, + &PartHydro::intraDailyModulation) + && ret; } if (IniFile::Section* section = ini.find("reservoir")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::reservoirManagement) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::reservoirManagement) + && ret; } if (IniFile::Section* section = ini.find("reservoir capacity")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::reservoirCapacity) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::reservoirCapacity) + && ret; } if (IniFile::Section* section = ini.find("follow load")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::followLoadModulations) && ret; + ret = loadProperties(study, + section->firstProperty, + buffer, + &PartHydro::followLoadModulations) + && ret; } if (IniFile::Section* section = ini.find("use water")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::useWaterValue) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::useWaterValue) + && ret; } if (IniFile::Section* section = ini.find("hard bounds")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::hardBoundsOnRuleCurves) && ret; + ret = loadProperties(study, + section->firstProperty, + buffer, + &PartHydro::hardBoundsOnRuleCurves) + && ret; } if (IniFile::Section* section = ini.find("use heuristic")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::useHeuristicTarget) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::useHeuristicTarget) + && ret; } if (IniFile::Section* section = ini.find("power to level")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::powerToLevel) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::powerToLevel) + && ret; } if (IniFile::Section* section = ini.find("initialize reservoir date")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::initializeReservoirLevelDate) && ret; + ret = loadProperties(study, + section->firstProperty, + buffer, + &PartHydro::initializeReservoirLevelDate) + && ret; } if (IniFile::Section* section = ini.find("use leeway")) @@ -297,17 +321,20 @@ bool PartHydro::LoadFromFolder(Study& study, const AnyString& folder) if (IniFile::Section* section = ini.find("leeway low")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::leewayLowerBound) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::leewayLowerBound) + && ret; } if (IniFile::Section* section = ini.find("leeway up")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::leewayUpperBound) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::leewayUpperBound) + && ret; } if (IniFile::Section* section = ini.find("pumping efficiency")) { - ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::pumpingEfficiency) && ret; + ret = loadProperties(study, section->firstProperty, buffer, &PartHydro::pumpingEfficiency) + && ret; } return ret; @@ -317,10 +344,12 @@ bool PartHydro::checkReservoirLevels(const Study& study) { bool ret = true; - for (const auto& [areaName, area] : study.areas) + for (const auto& [areaName, area]: study.areas) { if (!study.usedByTheSolver) + { return true; + } auto& col = area->hydro.inflowPattern[0]; bool errorInflow = false; @@ -340,8 +369,8 @@ bool PartHydro::checkReservoirLevels(const Study& study) for (unsigned int day = 0; day < DAYS_PER_YEAR; day++) { if (!errorLevels - && (colMin[day] < 0 || colAvg[day] < 0 || colMin[day] > colMax[day] - || colAvg[day] > 100 || colMax[day] > 100)) + && (colMin[day] < 0 || colAvg[day] < 0 || colMin[day] > colMax[day] + || colAvg[day] > 100 || colMax[day] > 100)) { logs.error() << areaName << ": invalid reservoir level value"; errorLevels = true; @@ -352,7 +381,7 @@ bool PartHydro::checkReservoirLevels(const Study& study) for (int i = 0; i < 101; i++) { if ((area->hydro.creditModulation[i][0] < 0) - || (area->hydro.creditModulation[i][1] < 0)) + || (area->hydro.creditModulation[i][1] < 0)) { logs.error() << areaName << ": invalid credit modulation value"; ret = false; @@ -372,75 +401,73 @@ bool PartHydro::checkProperties(Study& study) // the study, because they are too small (< 1e-6). We cannot have reservoir management = yes and // capacity = 0 because of further division by capacity. reservoir management = no and capacity // = 0 is possible (no use of capacity further) - study.areas.each([&ret](Data::Area& area) - { - if (area.hydro.reservoirCapacity < 1e-3 && area.hydro.reservoirManagement) - { - logs.error() << area.name - << ": reservoir capacity not defined. Impossible to manage."; - ret = false; - } + study.areas.each( + [&ret](Data::Area& area) + { + if (area.hydro.reservoirCapacity < 1e-3 && area.hydro.reservoirManagement) + { + logs.error() << area.name + << ": reservoir capacity not defined. Impossible to manage."; + ret = false; + } - if (!area.hydro.useHeuristicTarget && !area.hydro.useWaterValue) - { - logs.error() << area.name - << " : use water value = no conflicts with use heuristic target = no"; - ret = false; - } + if (!area.hydro.useHeuristicTarget && !area.hydro.useWaterValue) + { + logs.error() << area.name + << " : use water value = no conflicts with use heuristic target = no"; + ret = false; + } - if (area.hydro.intraDailyModulation < 1.) - { - logs.error() - << area.id << ": Invalid intra-daily modulation. It must be >= 1.0, Got " - << area.hydro.intraDailyModulation << " (truncated to 1)"; - area.hydro.intraDailyModulation = 1.; - } + if (area.hydro.intraDailyModulation < 1.) + { + logs.error() << area.id << ": Invalid intra-daily modulation. It must be >= 1.0, Got " + << area.hydro.intraDailyModulation << " (truncated to 1)"; + area.hydro.intraDailyModulation = 1.; + } - if (area.hydro.reservoirCapacity < 0) - { - logs.error() << area.id << ": Invalid reservoir capacity."; - area.hydro.reservoirCapacity = 0.; - } + if (area.hydro.reservoirCapacity < 0) + { + logs.error() << area.id << ": Invalid reservoir capacity."; + area.hydro.reservoirCapacity = 0.; + } - if (area.hydro.intermonthlyBreakdown < 0) - { - logs.error() << area.id << ": Invalid intermonthly breakdown"; - area.hydro.intermonthlyBreakdown = 0.; - } + if (area.hydro.intermonthlyBreakdown < 0) + { + logs.error() << area.id << ": Invalid intermonthly breakdown"; + area.hydro.intermonthlyBreakdown = 0.; + } - if (area.hydro.initializeReservoirLevelDate < 0) - { - logs.error() << area.id << ": Invalid initialize reservoir date"; - area.hydro.initializeReservoirLevelDate = 0; - } + if (area.hydro.initializeReservoirLevelDate < 0) + { + logs.error() << area.id << ": Invalid initialize reservoir date"; + area.hydro.initializeReservoirLevelDate = 0; + } - if (area.hydro.leewayLowerBound < 0.) - { - logs.error() - << area.id << ": Invalid leeway lower bound. It must be >= 0.0, Got " - << area.hydro.leewayLowerBound; - area.hydro.leewayLowerBound = 0.; - } + if (area.hydro.leewayLowerBound < 0.) + { + logs.error() << area.id << ": Invalid leeway lower bound. It must be >= 0.0, Got " + << area.hydro.leewayLowerBound; + area.hydro.leewayLowerBound = 0.; + } - if (area.hydro.leewayUpperBound < 0.) - { - logs.error() - << area.id << ": Invalid leeway upper bound. It must be >= 0.0, Got " - << area.hydro.leewayUpperBound; - area.hydro.leewayUpperBound = 0.; - } + if (area.hydro.leewayUpperBound < 0.) + { + logs.error() << area.id << ": Invalid leeway upper bound. It must be >= 0.0, Got " + << area.hydro.leewayUpperBound; + area.hydro.leewayUpperBound = 0.; + } - if (area.hydro.leewayLowerBound > area.hydro.leewayUpperBound) - { + if (area.hydro.leewayLowerBound > area.hydro.leewayUpperBound) + { logs.error() << area.id << ": Leeway lower bound greater than leeway upper bound."; - } + } - if (area.hydro.pumpingEfficiency < 0) - { - logs.error() << area.id << ": Invalid pumping efficiency"; - area.hydro.pumpingEfficiency = 0.; - } - }); + if (area.hydro.pumpingEfficiency < 0) + { + logs.error() << area.id << ": Invalid pumping efficiency"; + area.hydro.pumpingEfficiency = 0.; + } + }); return ret; } @@ -465,40 +492,40 @@ bool PartHydro::SaveToFolder(const AreaList& areas, const AnyString& folder) struct AllSections { - IniFile::Section* s; - IniFile::Section* smod; - IniFile::Section* sIMB; - IniFile::Section* sreservoir; - IniFile::Section* sreservoirCapacity; - IniFile::Section* sFollowLoad; - IniFile::Section* sUseWater; - IniFile::Section* sHardBounds; - IniFile::Section* sInitializeReservoirDate; - IniFile::Section* sUseHeuristic; - IniFile::Section* sUseLeeway; - IniFile::Section* sPowerToLevel; - IniFile::Section* sLeewayLow; - IniFile::Section* sLeewayUp; - IniFile::Section* spumpingEfficiency; - - AllSections(IniFile& ini) : - s(ini.addSection("inter-daily-breakdown")), - smod(ini.addSection("intra-daily-modulation")), - sIMB(ini.addSection("inter-monthly-breakdown")), - sreservoir(ini.addSection("reservoir")), - sreservoirCapacity(ini.addSection("reservoir capacity")), - sFollowLoad(ini.addSection("follow load")), - sUseWater(ini.addSection("use water")), - sHardBounds(ini.addSection("hard bounds")), - sInitializeReservoirDate(ini.addSection("initialize reservoir date")), - sUseHeuristic(ini.addSection("use heuristic")), - sUseLeeway(ini.addSection("use leeway")), - sPowerToLevel(ini.addSection("power to level")), - sLeewayLow(ini.addSection("leeway low")), - sLeewayUp(ini.addSection("leeway up")), - spumpingEfficiency(ini.addSection("pumping efficiency")) + IniFile::Section* s; + IniFile::Section* smod; + IniFile::Section* sIMB; + IniFile::Section* sreservoir; + IniFile::Section* sreservoirCapacity; + IniFile::Section* sFollowLoad; + IniFile::Section* sUseWater; + IniFile::Section* sHardBounds; + IniFile::Section* sInitializeReservoirDate; + IniFile::Section* sUseHeuristic; + IniFile::Section* sUseLeeway; + IniFile::Section* sPowerToLevel; + IniFile::Section* sLeewayLow; + IniFile::Section* sLeewayUp; + IniFile::Section* spumpingEfficiency; + + AllSections(IniFile& ini): + s(ini.addSection("inter-daily-breakdown")), + smod(ini.addSection("intra-daily-modulation")), + sIMB(ini.addSection("inter-monthly-breakdown")), + sreservoir(ini.addSection("reservoir")), + sreservoirCapacity(ini.addSection("reservoir capacity")), + sFollowLoad(ini.addSection("follow load")), + sUseWater(ini.addSection("use water")), + sHardBounds(ini.addSection("hard bounds")), + sInitializeReservoirDate(ini.addSection("initialize reservoir date")), + sUseHeuristic(ini.addSection("use heuristic")), + sUseLeeway(ini.addSection("use leeway")), + sPowerToLevel(ini.addSection("power to level")), + sLeewayLow(ini.addSection("leeway low")), + sLeewayUp(ini.addSection("leeway up")), + spumpingEfficiency(ini.addSection("pumping efficiency")) { - } + } }; // Init @@ -515,7 +542,8 @@ bool PartHydro::SaveToFolder(const AreaList& areas, const AnyString& folder) allSections.s->add(area.id, area.hydro.interDailyBreakdown); allSections.smod->add(area.id, area.hydro.intraDailyModulation); allSections.sIMB->add(area.id, area.hydro.intermonthlyBreakdown); - allSections.sInitializeReservoirDate->add(area.id, area.hydro.initializeReservoirLevelDate); + allSections.sInitializeReservoirDate->add(area.id, + area.hydro.initializeReservoirLevelDate); allSections.sLeewayLow->add(area.id, area.hydro.leewayLowerBound); allSections.sLeewayUp->add(area.id, area.hydro.leewayUpperBound); allSections.spumpingEfficiency->add(area.id, area.hydro.pumpingEfficiency); @@ -740,8 +768,8 @@ bool PartHydro::CheckDailyMaxEnergy(const AnyString& areaName) } double getWaterValue(const double& level /* format : in % of reservoir capacity */, - const Matrix& waterValues, - const uint day) + const Matrix& waterValues, + const uint day) { assert((level >= 0. && level <= 100.) && "getWaterValue function : invalid level"); double levelUp = ceil(level); @@ -752,7 +780,7 @@ double getWaterValue(const double& level /* format : in % of reservoir capacity return waterValues[(int)(levelUp)][day]; } return waterValues[(int)(levelUp)][day] * (level - levelDown) - + waterValues[(int)(levelDown)][day] * (levelUp - level); + + waterValues[(int)(levelDown)][day] * (levelUp - level); } double getWeeklyModulation(const double& level /* format : in % of reservoir capacity */, diff --git a/src/libs/antares/study/parts/hydro/finalLevelValidator.cpp b/src/libs/antares/study/parts/hydro/finalLevelValidator.cpp index c3ea96ca08..c0834441a1 100644 --- a/src/libs/antares/study/parts/hydro/finalLevelValidator.cpp +++ b/src/libs/antares/study/parts/hydro/finalLevelValidator.cpp @@ -37,7 +37,7 @@ FinalLevelValidator::FinalLevelValidator(PartHydro& hydro, double finalLevel, const unsigned int year, const unsigned int lastSimulationDay, - const unsigned int firstMonthOfSimulation) : + const unsigned int firstMonthOfSimulation): year_(year), lastSimulationDay_(lastSimulationDay), firstMonthOfSimulation_(firstMonthOfSimulation), @@ -52,36 +52,46 @@ FinalLevelValidator::FinalLevelValidator(PartHydro& hydro, bool FinalLevelValidator::check() { if (skippingFinalLevelUse()) + { return true; - if (! checkForInfeasibility()) + } + if (!checkForInfeasibility()) + { return false; + } finalLevelFineForUse_ = true; return true; } bool FinalLevelValidator::skippingFinalLevelUse() { - if(! wasSetInScenarioBuilder()) + if (!wasSetInScenarioBuilder()) + { return true; - if (! compatibleWithReservoirProperties()) + } + if (!compatibleWithReservoirProperties()) + { return true; + } return false; } bool FinalLevelValidator::wasSetInScenarioBuilder() { - return ! isnan(finalLevel_); + return !isnan(finalLevel_); } bool FinalLevelValidator::compatibleWithReservoirProperties() { if (hydro_.reservoirManagement && !hydro_.useWaterValue) + { return true; + } - logs.warning() << "Final reservoir level not applicable! Year:" << year_ + 1 - << ", Area:" << areaName_ - << ". Check: Reservoir management = Yes, Use water values = No and proper initial " - "reservoir level is provided "; + logs.warning() + << "Final reservoir level not applicable! Year:" << year_ + 1 << ", Area:" << areaName_ + << ". Check: Reservoir management = Yes, Use water values = No and proper initial " + "reservoir level is provided "; return false; } @@ -98,10 +108,12 @@ bool FinalLevelValidator::hydroAllocationStartMatchesSimulation() const { unsigned initReservoirLvlMonth = hydro_.initializeReservoirLevelDate; // month [0-11] if (lastSimulationDay_ == DAYS_PER_YEAR && initReservoirLvlMonth == firstMonthOfSimulation_) + { return true; + } - logs.error() << "Year " << year_ + 1 << ", area '" << areaName_ << "' : " - << "Hydro allocation must start on the 1st simulation month and " + logs.error() << "Year " << year_ + 1 << ", area '" << areaName_ + << "' : " << "Hydro allocation must start on the 1st simulation month and " << "simulation last a whole year"; return false; } @@ -115,8 +127,8 @@ bool FinalLevelValidator::isFinalLevelReachable() const { logs.error() << "Year: " << year_ + 1 << ". Area: " << areaName_ << ". Incompatible total inflows: " << totalYearInflows - << " with initial: " << initialLevel_ - << " and final: " << finalLevel_ << " reservoir levels."; + << " with initial: " << initialLevel_ << " and final: " << finalLevel_ + << " reservoir levels."; return false; } return true; @@ -125,17 +137,19 @@ bool FinalLevelValidator::isFinalLevelReachable() const double FinalLevelValidator::calculateTotalInflows() const { // calculate yearly inflows - auto const& srcinflows = hydro_.series->storage.getColumn(year_); + const auto& srcinflows = hydro_.series->storage.getColumn(year_); double totalYearInflows = 0.0; for (unsigned int day = 0; day < DAYS_PER_YEAR; ++day) + { totalYearInflows += srcinflows[day]; + } return totalYearInflows; } bool FinalLevelValidator::isBetweenRuleCurves() const { - double lowLevelLastDay = hydro_.reservoirLevel[Data::PartHydro::minimum][DAYS_PER_YEAR - 1]; + double lowLevelLastDay = hydro_.reservoirLevel[Data::PartHydro::minimum][DAYS_PER_YEAR - 1]; double highLevelLastDay = hydro_.reservoirLevel[Data::PartHydro::maximum][DAYS_PER_YEAR - 1]; if (finalLevel_ < lowLevelLastDay || finalLevel_ > highLevelLastDay) diff --git a/src/libs/antares/study/parts/hydro/prepro.cpp b/src/libs/antares/study/parts/hydro/prepro.cpp index 9370c562fa..13711759f4 100644 --- a/src/libs/antares/study/parts/hydro/prepro.cpp +++ b/src/libs/antares/study/parts/hydro/prepro.cpp @@ -151,6 +151,7 @@ bool PreproHydro::loadFromFolder(Study& s, const AreaName& areaID, const std::st { mtrxOption = Matrix<>::optFixedSize | Matrix<>::optImmediate, }; + constexpr int maxNbOfLineToLoad = 12; data.resize(hydroPreproMax, 12, true); @@ -160,7 +161,8 @@ bool PreproHydro::loadFromFolder(Study& s, const AreaName& areaID, const std::st bool ret = PreproHydroLoadSettings(this, buffer); buffer.clear() << folder << SEP << areaID << SEP << "energy.txt"; - ret = data.loadFromCSVFile(buffer, hydroPreproMax, maxNbOfLineToLoad, mtrxOption, &s.dataBuffer) && ret; + ret = data.loadFromCSVFile(buffer, hydroPreproMax, maxNbOfLineToLoad, mtrxOption, &s.dataBuffer) + && ret; return ret; } @@ -203,8 +205,8 @@ bool PreproHydro::validate(const std::string& areaID) { ret = false; logs.error() << "Hydro: Prepro: `" << areaID - << "`: minimum energy: At least one value is negative (line: " - << (i + 1) << ')'; + << "`: minimum energy: At least one value is negative (line: " << (i + 1) + << ')'; continue; } if (colMin[i] > colMax[i]) diff --git a/src/libs/antares/study/parts/hydro/series.cpp b/src/libs/antares/study/parts/hydro/series.cpp index 3eda6d5fc3..8c73772565 100644 --- a/src/libs/antares/study/parts/hydro/series.cpp +++ b/src/libs/antares/study/parts/hydro/series.cpp @@ -54,7 +54,7 @@ static void ConvertDailyTSintoHourlyTS(const Matrix::ColumnType& dailyCo { uint hour = 0; uint day = 0; - + while (hour < HOURS_PER_YEAR && day < DAYS_PER_YEAR) { for (uint i = 0; i < HOURS_PER_DAY; ++i) diff --git a/src/libs/antares/study/parts/renewable/cluster_list.cpp b/src/libs/antares/study/parts/renewable/cluster_list.cpp index 62db61a900..aa1c915a75 100644 --- a/src/libs/antares/study/parts/renewable/cluster_list.cpp +++ b/src/libs/antares/study/parts/renewable/cluster_list.cpp @@ -223,7 +223,7 @@ bool RenewableClusterList::loadFromFolder(const AnyString& folder, Area* area) bool RenewableClusterList::validateClusters() const { bool ret = true; - for (const auto& cluster : allClusters_) + for (const auto& cluster: allClusters_) { ret = cluster->integrityCheck() && ret; } diff --git a/src/libs/antares/study/parts/short-term-storage/container.cpp b/src/libs/antares/study/parts/short-term-storage/container.cpp index 749613a14b..9a27233064 100644 --- a/src/libs/antares/study/parts/short-term-storage/container.cpp +++ b/src/libs/antares/study/parts/short-term-storage/container.cpp @@ -37,8 +37,7 @@ namespace Antares::Data::ShortTermStorage { bool STStorageInput::validate() const { - return std::ranges::all_of(storagesByIndex, [](auto& cluster) - { return cluster.validate(); }); + return std::ranges::all_of(storagesByIndex, [](auto& cluster) { return cluster.validate(); }); } bool STStorageInput::createSTStorageClustersFromIniFile(const fs::path& path) @@ -68,8 +67,9 @@ bool STStorageInput::createSTStorageClustersFromIniFile(const fs::path& path) storagesByIndex.push_back(cluster); } - std::ranges::sort(storagesByIndex, [](const auto& a, const auto& b) - { return a.properties.name < b.properties.name; }); + std::ranges::sort(storagesByIndex, + [](const auto& a, const auto& b) + { return a.properties.name < b.properties.name; }); return true; } @@ -100,8 +100,8 @@ bool STStorageInput::saveToFolder(const std::string& folder) const IniFile ini; logs.debug() << "saving file " << pathIni; - std::ranges::for_each(storagesByIndex, [&ini](auto& storage) - { return storage.saveProperties(ini); }); + std::ranges::for_each(storagesByIndex, + [&ini](auto& storage) { return storage.saveProperties(ini); }); return ini.save(pathIni); } @@ -109,20 +109,20 @@ bool STStorageInput::saveToFolder(const std::string& folder) const bool STStorageInput::saveDataSeriesToFolder(const std::string& folder) const { Yuni::IO::Directory::Create(folder); - return std::ranges::all_of(storagesByIndex, [&folder](auto& storage) - { return storage.saveSeries(folder + SEP + storage.id); }); + return std::ranges::all_of(storagesByIndex, + [&folder](auto& storage) + { return storage.saveSeries(folder + SEP + storage.id); }); } std::size_t STStorageInput::count() const { - return std::ranges::count_if(storagesByIndex, [](const STStorageCluster& st) - { return st.properties.enabled; }); + return std::ranges::count_if(storagesByIndex, + [](const STStorageCluster& st) { return st.properties.enabled; }); } uint STStorageInput::removeDisabledClusters() { - return std::erase_if(storagesByIndex, [](const auto& c) - { return !c.enabled(); }); + return std::erase_if(storagesByIndex, [](const auto& c) { return !c.enabled(); }); } } // namespace Antares::Data::ShortTermStorage diff --git a/src/libs/antares/study/parts/thermal/cluster_list.cpp b/src/libs/antares/study/parts/thermal/cluster_list.cpp index 4bf2e042c2..8435870d0a 100644 --- a/src/libs/antares/study/parts/thermal/cluster_list.cpp +++ b/src/libs/antares/study/parts/thermal/cluster_list.cpp @@ -162,7 +162,8 @@ bool ThermalClusterList::loadFromFolder(Study& study, const AnyString& folder, A ret = cluster->modulation.loadFromCSVFile(modulationFile, thermalModulationMax, HOURS_PER_YEAR, - options) && ret; + options) + && ret; // Check the data integrity of the cluster addToCompleteList(cluster); @@ -174,12 +175,11 @@ bool ThermalClusterList::loadFromFolder(Study& study, const AnyString& folder, A return ret; } - bool ThermalClusterList::validateClusters(const Parameters& parameters) const { bool ret = true; - for (const auto& cluster : allClusters_) + for (const auto& cluster: allClusters_) { cluster->minUpTime = std::clamp(cluster->minUpTime, 1u, 168u); cluster->minDownTime = std::clamp(cluster->minDownTime, 1u, 168u); @@ -206,7 +206,6 @@ bool ThermalClusterList::validateClusters(const Parameters& parameters) const cluster->nominalCapacityWithSpinning = cluster->nominalCapacity; ret = cluster->integrityCheck() && ret; - } return ret; @@ -377,7 +376,7 @@ void ThermalClusterList::reverseCalculationOfSpinning() void ThermalClusterList::enableMustrunForEveryone() { - for (const auto& c : allClusters_) + for (const auto& c: allClusters_) { c->mustrun = true; } @@ -541,7 +540,6 @@ bool ThermalClusterList::saveToFolder(const AnyString& folder) const { ret = false; } - } // Write the ini file @@ -598,27 +596,32 @@ bool ThermalClusterList::loadPreproFromFolder(Study& study, const AnyString& fol return std::ranges::all_of(allClusters_ | std::views::filter(hasPrepro), loadPrepro); } -bool ThermalClusterList::validatePrepro(const Study& study) { +bool ThermalClusterList::validatePrepro(const Study& study) +{ auto hasPrepro = [](auto c) { return (bool)c->prepro; }; - const bool globalThermalTSgeneration = - study.parameters.timeSeriesToGenerate & timeSeriesThermal; + const bool globalThermalTSgeneration = study.parameters.timeSeriesToGenerate + & timeSeriesThermal; if (!study.usedByTheSolver) + { return true; + } - return std::ranges::all_of( - allClusters_ | std::views::filter(hasPrepro), - [&globalThermalTSgeneration](auto& c) { - if (globalThermalTSgeneration && !c->prepro->validate()) { - return false; - } - - if (c->doWeGenerateTS(globalThermalTSgeneration)) { - return c->prepro->normalizeAndCheckNPO(); - } - return true; - }); + return std::ranges::all_of(allClusters_ | std::views::filter(hasPrepro), + [&globalThermalTSgeneration](auto& c) + { + if (globalThermalTSgeneration && !c->prepro->validate()) + { + return false; + } + + if (c->doWeGenerateTS(globalThermalTSgeneration)) + { + return c->prepro->normalizeAndCheckNPO(); + } + return true; + }); } bool ThermalClusterList::loadEconomicCosts(Study& study, const AnyString& folder) diff --git a/src/libs/antares/study/runtime/runtime.cpp b/src/libs/antares/study/runtime/runtime.cpp index 1b093f4d2a..1bb7e46386 100644 --- a/src/libs/antares/study/runtime/runtime.cpp +++ b/src/libs/antares/study/runtime/runtime.cpp @@ -214,8 +214,7 @@ void StudyRuntimeInfos::initializeRangeLimits(const Study& study, StudyRangeLimi } else { - simulationDaysPerMonth[ca.month] = study.calendar.months[ca.month].days - - ca.dayMonth; + simulationDaysPerMonth[ca.month] = study.calendar.months[ca.month].days - ca.dayMonth; simulationDaysPerMonth[cb.month] = cb.dayMonth + 1; for (uint i = ca.month + 1; i < cb.month; ++i) { @@ -442,7 +441,8 @@ void StudyRangeLimits::checkIntegrity() const void StudyRuntimeInfos::disableAllFilters(Study& study) { - study.areas.each([](Data::Area& area) + study.areas.each( + [](Data::Area& area) { area.filterSynthesis = filterAll; area.filterYearByYear = filterAll; diff --git a/src/libs/antares/study/scenario-builder/BindingConstraintsTSNumbersData.cpp b/src/libs/antares/study/scenario-builder/BindingConstraintsTSNumbersData.cpp index 46a0694a58..5ffef13e98 100644 --- a/src/libs/antares/study/scenario-builder/BindingConstraintsTSNumbersData.cpp +++ b/src/libs/antares/study/scenario-builder/BindingConstraintsTSNumbersData.cpp @@ -81,11 +81,11 @@ bool BindingConstraintsTSNumberData::reset(const Study& study) { const uint nbYears = study.parameters.nbYears; std::ranges::for_each(study.bindingConstraintsGroups, - [this, &nbYears](const auto& group) - { - auto& ts_numbers = rules_[group->name()]; - ts_numbers.reset(1, nbYears); - }); + [this, &nbYears](const auto& group) + { + auto& ts_numbers = rules_[group->name()]; + ts_numbers.reset(1, nbYears); + }); return true; } diff --git a/src/libs/antares/study/scenario-builder/hydroLevelsData.cpp b/src/libs/antares/study/scenario-builder/hydroLevelsData.cpp index 3295df4503..8d0575b96a 100644 --- a/src/libs/antares/study/scenario-builder/hydroLevelsData.cpp +++ b/src/libs/antares/study/scenario-builder/hydroLevelsData.cpp @@ -29,9 +29,9 @@ namespace Antares::Data::ScenarioBuilder { hydroLevelsData::hydroLevelsData(const std::string& iniFilePrefix, - std::function applyToTarget) : - addToPrefix_(iniFilePrefix), - applyToTarget_(applyToTarget) + std::function applyToTarget): + addToPrefix_(iniFilePrefix), + applyToTarget_(applyToTarget) { } diff --git a/src/libs/antares/study/scenario-builder/rules.cpp b/src/libs/antares/study/scenario-builder/rules.cpp index fd79f07f7c..2037eede6b 100644 --- a/src/libs/antares/study/scenario-builder/rules.cpp +++ b/src/libs/antares/study/scenario-builder/rules.cpp @@ -288,7 +288,9 @@ bool Rules::readFinalHydroLevels(const AreaName::Vector& splitKey, String value, const Data::Area* area = getArea(areaname, updaterMode); if (!area) + { return false; + } double finalLevel = fromStringToHydroLevel(value, 1.); hydroFinalLevels.setTSnumber(area->index, year, finalLevel); @@ -450,8 +452,7 @@ bool Rules::apply() void Rules::sendWarningsForDisabledClusters() { - for (auto it = disabledClustersOnRuleActive.begin(); - it != disabledClustersOnRuleActive.end(); + for (auto it = disabledClustersOnRuleActive.begin(); it != disabledClustersOnRuleActive.end(); it++) { std::vector& scenariiForCurrentCluster = it->second; diff --git a/src/libs/antares/study/study.cpp b/src/libs/antares/study/study.cpp index 511e61a592..5b1dde8c5f 100644 --- a/src/libs/antares/study/study.cpp +++ b/src/libs/antares/study/study.cpp @@ -856,7 +856,8 @@ void Study::areaDelete(Area::Vector& arealist) << area.name; // Updating all hydro allocation - areas.each([&area](Data::Area& areait) { areait.hydro.allocation.remove(area.id); }); + areas.each([&area](Data::Area& areait) + { areait.hydro.allocation.remove(area.id); }); // Remove all binding constraints attached to the area bindingConstraints.remove(*i); @@ -956,7 +957,7 @@ bool Study::areaRename(Area* area, AreaName newName) // Updating all hydro allocation areas.each([&oldid, &newid](Data::Area& areait) - { areait.hydro.allocation.rename(oldid, newid); }); + { areait.hydro.allocation.rename(oldid, newid); }); ScenarioBuilderUpdater updaterSB(*this); bool ret = true; @@ -1109,13 +1110,14 @@ void Study::destroyAllWindTSGeneratorData() void Study::destroyAllThermalTSGeneratorData() { - areas.each([](const Data::Area& area) - { - for (const auto& cluster: area.thermal.list.each_enabled_and_not_mustrun()) - { - FreeAndNil(cluster->prepro); - } - }); + areas.each( + [](const Data::Area& area) + { + for (const auto& cluster: area.thermal.list.each_enabled_and_not_mustrun()) + { + FreeAndNil(cluster->prepro); + } + }); } void Study::ensureDataAreLoadedForAllBindingConstraints() @@ -1358,7 +1360,6 @@ bool Study::checkForFilenameLimits(bool output, const String& chfolder) const areas.each( [&output, &linkname, &areaname](const Area& area) { - if (areaname.size() < area.id.size()) { areaname = area.id; diff --git a/src/libs/antares/study/study.importprepro.cpp b/src/libs/antares/study/study.importprepro.cpp index 3b8263eadf..f7c8082050 100644 --- a/src/libs/antares/study/study.importprepro.cpp +++ b/src/libs/antares/study/study.importprepro.cpp @@ -50,7 +50,7 @@ bool Study::importTimeseriesIntoInput() if (parameters.haveToImport(timeSeriesLoad)) { logs.info() << "Importing load timeseries..."; - for (const auto& [areaName, area] : areas) + for (const auto& [areaName, area]: areas) { logs.info() << "Importing load timeseries : " << areaName; buffer.clear() << folderInput << SEP << "load" << SEP << "series"; @@ -63,7 +63,7 @@ bool Study::importTimeseriesIntoInput() if (parameters.haveToImport(timeSeriesSolar)) { logs.info() << "Importing solar timeseries..."; - for (const auto& [areaName, area] : areas) + for (const auto& [areaName, area]: areas) { logs.info() << "Importing solar timeseries : " << areaName; buffer.clear() << folderInput << SEP << "solar" << SEP << "series"; @@ -76,7 +76,7 @@ bool Study::importTimeseriesIntoInput() if (parameters.haveToImport(timeSeriesHydro)) { logs.info() << "Importing hydro timeseries..."; - for (const auto& [areaName, area] : areas) + for (const auto& [areaName, area]: areas) { logs.info() << "Importing hydro timeseries : " << areaName; buffer.clear() << folderInput << SEP << "hydro" << SEP << "series"; @@ -89,7 +89,7 @@ bool Study::importTimeseriesIntoInput() if (parameters.haveToImport(timeSeriesWind)) { logs.info() << "Importing wind timeseries..."; - for (const auto& [areaName, area] : areas) + for (const auto& [areaName, area]: areas) { logs.info() << "Importing wind timeseries : " << areaName; buffer.clear() << folderInput << SEP << "wind" << SEP << "series"; @@ -104,7 +104,7 @@ bool Study::importTimeseriesIntoInput() logs.info() << "Importing thermal timeseries..."; String msg; - for (const auto& [areaName, area] : areas) + for (const auto& [areaName, area]: areas) { msg.clear() << "Importing thermal timeseries : " << areaName; diff --git a/src/libs/antares/study/xcast/xcast.cpp b/src/libs/antares/study/xcast/xcast.cpp index 51ed1624b0..0f2e05956b 100644 --- a/src/libs/antares/study/xcast/xcast.cpp +++ b/src/libs/antares/study/xcast/xcast.cpp @@ -207,7 +207,8 @@ bool XCast::loadFromFolder(const AnyString& folder) // For each property if (section.name == "general") { - for (const IniFile::Property* p = section.firstProperty; p != nullptr; p = p->next) + for (const IniFile::Property* p = section.firstProperty; p != nullptr; + p = p->next) { CString<30, false> key = p->key; key.toLower(); diff --git a/src/libs/antares/utils/utils.cpp b/src/libs/antares/utils/utils.cpp index 5f5efc9e9e..31992d6020 100644 --- a/src/libs/antares/utils/utils.cpp +++ b/src/libs/antares/utils/utils.cpp @@ -117,7 +117,7 @@ std::vector> splitStringIntoPairs(const std: { logs.warning() << "Error while parsing: " << token; logs.warning() << "Correct format is: \"object1" << delimiter2 << "object2" - << delimiter1 << "object3" << delimiter2 << "object4\""; + << delimiter1 << "object3" << delimiter2 << "object4\""; } } diff --git a/src/libs/antares/writer/in_memory_writer.cpp b/src/libs/antares/writer/in_memory_writer.cpp index e3e643a74f..182fee1927 100644 --- a/src/libs/antares/writer/in_memory_writer.cpp +++ b/src/libs/antares/writer/in_memory_writer.cpp @@ -24,9 +24,9 @@ #include #include +#include #include #include -#include namespace fs = std::filesystem; diff --git a/src/libs/antares/writer/zip_writer.cpp b/src/libs/antares/writer/zip_writer.cpp index 362d0e730e..6359460f8a 100644 --- a/src/libs/antares/writer/zip_writer.cpp +++ b/src/libs/antares/writer/zip_writer.cpp @@ -51,7 +51,6 @@ static void logErrorAndThrow [[noreturn]] (const std::string& errorMessage) throw std::runtime_error(errorMessage); } - // Class ZipWriteJob template ZipWriteJob::ZipWriteJob(ZipWriter& writer, diff --git a/src/libs/fswalker/fswalker.cpp b/src/libs/fswalker/fswalker.cpp index f1022fe1bd..403572bb3e 100644 --- a/src/libs/fswalker/fswalker.cpp +++ b/src/libs/fswalker/fswalker.cpp @@ -320,7 +320,7 @@ void WalkerThread::walk(const String& path) do { - assert(pContext.top() ); + assert(pContext.top()); auto& context = *(pContext.top()); if (pShouldStop) diff --git a/src/solver/application/ScenarioBuilderOwner.cpp b/src/solver/application/ScenarioBuilderOwner.cpp index ef6084fed5..69f9d11799 100644 --- a/src/solver/application/ScenarioBuilderOwner.cpp +++ b/src/solver/application/ScenarioBuilderOwner.cpp @@ -31,7 +31,8 @@ Antares::Solver::ScenarioBuilderOwner::ScenarioBuilderOwner(Data::Study& study): { } -void Antares::Solver::ScenarioBuilderOwner::callScenarioBuilder() { +void Antares::Solver::ScenarioBuilderOwner::callScenarioBuilder() +{ TSGenerator::ResizeGeneratedTimeSeries(study_.areas, study_.parameters); // Sampled time-series Numbers @@ -54,4 +55,3 @@ void Antares::Solver::ScenarioBuilderOwner::callScenarioBuilder() { ApplyCustomScenario(study_); } } - diff --git a/src/solver/application/application.cpp b/src/solver/application/application.cpp index 4a47abd1ff..a55873ea09 100644 --- a/src/solver/application/application.cpp +++ b/src/solver/application/application.cpp @@ -338,10 +338,14 @@ void Application::prepare(int argc, char* argv[]) // don't de-allocate these. if (!parseCommandLine(options)) // --help + { return; + } if (!handleOptions(options)) // --version, --list-solvers - return; + { + return; + } // Perform some checks checkAndCorrectSettingsAndOptions(pSettings, options); diff --git a/src/solver/constraints-builder/cbuilder.cpp b/src/solver/constraints-builder/cbuilder.cpp index d713aa7307..2a1e1b8dce 100644 --- a/src/solver/constraints-builder/cbuilder.cpp +++ b/src/solver/constraints-builder/cbuilder.cpp @@ -364,8 +364,7 @@ bool CBuilder::saveCBuilderToFile(const String& filename) const if (filename == "") { - fs::path path = fs::path(pStudy.folder.c_str()) / "settings" - / "constraintbuilder.ini"; + fs::path path = fs::path(pStudy.folder.c_str()) / "settings" / "constraintbuilder.ini"; return ini.save(path.string()); } @@ -399,12 +398,12 @@ bool CBuilder::completeCBuilderFromFile(const std::string& filename) CString<50, false> key; CString<50, false> value; - for (section = ini.firstSection; section ; section = section->next) + for (section = ini.firstSection; section; section = section->next) { if (section->name == ".general") { IniFile::Property* p = section->firstProperty; - for (; p ; p = p->next) + for (; p; p = p->next) { key = p->key; key.toLower(); diff --git a/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h b/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h index f45f1712ca..0308779170 100644 --- a/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h +++ b/src/solver/hydro/include/antares/solver/hydro/management/HydroInputsChecker.h @@ -24,6 +24,7 @@ #include "antares/solver/hydro/management/MinGenerationScaling.h" #include "antares/solver/hydro/management/PrepareInflows.h" #include "antares/study/study.h" + namespace Antares { diff --git a/src/solver/hydro/include/antares/solver/hydro/management/management.h b/src/solver/hydro/include/antares/solver/hydro/management/management.h index 7d8f5360c5..a8576248b4 100644 --- a/src/solver/hydro/include/antares/solver/hydro/management/management.h +++ b/src/solver/hydro/include/antares/solver/hydro/management/management.h @@ -80,20 +80,16 @@ class HydroManagement final private: //! Prepare the net demand for each area - void prepareNetDemand( - uint year, - Data::SimulationMode mode, - const Antares::Data::Area::ScratchMap& scratchmap, - HydroSpecificMap& hydro_specific_map); + void prepareNetDemand(uint year, + Data::SimulationMode mode, + const Antares::Data::Area::ScratchMap& scratchmap, + HydroSpecificMap& hydro_specific_map); //! Prepare the effective demand for each area - void prepareEffectiveDemand( - uint year, - HydroSpecificMap& hydro_specific_map); + void prepareEffectiveDemand(uint year, HydroSpecificMap& hydro_specific_map); //! Monthly Optimal generations - void prepareMonthlyOptimalGenerations( - double* random_reservoir_level, - uint y, - HydroSpecificMap& hydro_specific_map); + void prepareMonthlyOptimalGenerations(double* random_reservoir_level, + uint y, + HydroSpecificMap& hydro_specific_map); //! Monthly target generations // note: inflows may have two different types, if in swap mode or not @@ -103,10 +99,9 @@ class HydroManagement final Antares::Data::AreaDependantHydroManagementData& data, Antares::Data::TimeDependantHydroManagementData& hydro_specific); - void prepareDailyOptimalGenerations( - uint y, - Antares::Data::Area::ScratchMap& scratchmap, - HydroSpecificMap& hydro_specific_map); + void prepareDailyOptimalGenerations(uint y, + Antares::Data::Area::ScratchMap& scratchmap, + HydroSpecificMap& hydro_specific_map); void prepareDailyOptimalGenerations( Data::Area& area, diff --git a/src/solver/hydro/management/HydroInputsChecker.cpp b/src/solver/hydro/management/HydroInputsChecker.cpp index 613e760f74..c249cdabe3 100644 --- a/src/solver/hydro/management/HydroInputsChecker.cpp +++ b/src/solver/hydro/management/HydroInputsChecker.cpp @@ -53,11 +53,15 @@ void HydroInputsChecker::Execute(uint year) if (!checksOnGenerationPowerBounds(year)) { - throw FatalError("hydro inputs checks: invalid minimum generation"); + throw FatalError("hydro inputs checks: invalid minimum generation"); } if (parameters_.useCustomScenario) { - CheckFinalReservoirLevelsConfiguration(areas_, parameters_, scenarioInitialHydroLevels_, scenarioFinalHydroLevels_, year); + CheckFinalReservoirLevelsConfiguration(areas_, + parameters_, + scenarioInitialHydroLevels_, + scenarioFinalHydroLevels_, + year); } } diff --git a/src/solver/hydro/management/PrepareInflows.cpp b/src/solver/hydro/management/PrepareInflows.cpp index f1a43e71fd..c13d11a64b 100644 --- a/src/solver/hydro/management/PrepareInflows.cpp +++ b/src/solver/hydro/management/PrepareInflows.cpp @@ -10,10 +10,12 @@ PrepareInflows::PrepareInflows(Data::AreaList& areas, const Date::Calendar& cale { } -void PrepareInflows::Run(uint year){ +void PrepareInflows::Run(uint year) +{ LoadInflows(year); ChangeInflowsToAccommodateFinalLevels(year); } + void PrepareInflows::LoadInflows(uint year) { areas_.each( @@ -66,21 +68,27 @@ void PrepareInflows::LoadInflows(uint year) void PrepareInflows::ChangeInflowsToAccommodateFinalLevels(uint year) { - areas_.each([this, &year](Data::Area& area) - { - auto& data = area.hydro.managementData[year]; - - if (!area.hydro.deltaBetweenFinalAndInitialLevels[year].has_value()) - return; - - // Must be done before prepareMonthlyTargetGenerations - double delta = area.hydro.deltaBetweenFinalAndInitialLevels[year].value(); - if (delta < 0) - data.inflows[0] -= delta; - else if (delta > 0) - data.inflows[11] -= delta; - }); -} + areas_.each( + [this, &year](Data::Area& area) + { + auto& data = area.hydro.managementData[year]; + if (!area.hydro.deltaBetweenFinalAndInitialLevels[year].has_value()) + { + return; + } + + // Must be done before prepareMonthlyTargetGenerations + double delta = area.hydro.deltaBetweenFinalAndInitialLevels[year].value(); + if (delta < 0) + { + data.inflows[0] -= delta; + } + else if (delta > 0) + { + data.inflows[11] -= delta; + } + }); +} } // namespace Antares diff --git a/src/solver/hydro/management/daily.cpp b/src/solver/hydro/management/daily.cpp index d1947d6d52..64072a5097 100644 --- a/src/solver/hydro/management/daily.cpp +++ b/src/solver/hydro/management/daily.cpp @@ -557,10 +557,9 @@ inline void HydroManagement::prepareDailyOptimalGenerations( } } -void HydroManagement::prepareDailyOptimalGenerations( - uint y, - Antares::Data::Area::ScratchMap& scratchmap, - HydroSpecificMap& hydro_specific_map) +void HydroManagement::prepareDailyOptimalGenerations(uint y, + Antares::Data::Area::ScratchMap& scratchmap, + HydroSpecificMap& hydro_specific_map) { areas_.each( [this, &scratchmap, &y, &hydro_specific_map](Data::Area& area) diff --git a/src/solver/hydro/management/hydro-final-reservoir-level-functions.cpp b/src/solver/hydro/management/hydro-final-reservoir-level-functions.cpp index 3aa1d7e426..6e9a53ce95 100644 --- a/src/solver/hydro/management/hydro-final-reservoir-level-functions.cpp +++ b/src/solver/hydro/management/hydro-final-reservoir-level-functions.cpp @@ -40,30 +40,34 @@ void CheckFinalReservoirLevelsConfiguration(Data::AreaList& areas, uint year) { if (!parameters.yearsFilter.at(year)) + { return; + } - areas.each([&areas, ¶meters, &scenarioInitialHydroLevels, &scenarioFinalHydroLevels, year](Data::Area &area) - { - double initialLevel = scenarioInitialHydroLevels.entry[area.index][year]; - double finalLevel = scenarioFinalHydroLevels.entry[area.index][year]; + areas.each( + [&areas, ¶meters, &scenarioInitialHydroLevels, &scenarioFinalHydroLevels, year]( + Data::Area& area) + { + double initialLevel = scenarioInitialHydroLevels.entry[area.index][year]; + double finalLevel = scenarioFinalHydroLevels.entry[area.index][year]; - Data::FinalLevelValidator validator(area.hydro, - area.index, - area.name, - initialLevel, - finalLevel, - year, - parameters.simulationDays.end, - parameters.firstMonthInYear); - if (!validator.check()) - { - throw FatalError("hydro final level : infeasibility"); - } - if (validator.finalLevelFineForUse()) - { - area.hydro.deltaBetweenFinalAndInitialLevels[year] = finalLevel - initialLevel; - } - }); + Data::FinalLevelValidator validator(area.hydro, + area.index, + area.name, + initialLevel, + finalLevel, + year, + parameters.simulationDays.end, + parameters.firstMonthInYear); + if (!validator.check()) + { + throw FatalError("hydro final level : infeasibility"); + } + if (validator.finalLevelFineForUse()) + { + area.hydro.deltaBetweenFinalAndInitialLevels[year] = finalLevel - initialLevel; + } + }); } // End function CheckFinalReservoirLevelsConfiguration } // namespace Antares::Solver diff --git a/src/solver/hydro/management/management.cpp b/src/solver/hydro/management/management.cpp index 98b3b0b562..e4aeecde1e 100644 --- a/src/solver/hydro/management/management.cpp +++ b/src/solver/hydro/management/management.cpp @@ -140,11 +140,10 @@ HydroManagement::HydroManagement(const Data::AreaList& areas, } } -void HydroManagement::prepareNetDemand( - uint year, - Data::SimulationMode mode, - const Antares::Data::Area::ScratchMap& scratchmap, - HydroSpecificMap& hydro_specific_map) +void HydroManagement::prepareNetDemand(uint year, + Data::SimulationMode mode, + const Antares::Data::Area::ScratchMap& scratchmap, + HydroSpecificMap& hydro_specific_map) { areas_.each( [this, &year, &scratchmap, &mode, &hydro_specific_map](Data::Area& area) @@ -197,9 +196,7 @@ void HydroManagement::prepareNetDemand( }); } -void HydroManagement::prepareEffectiveDemand( - uint year, - HydroSpecificMap& hydro_specific_map) +void HydroManagement::prepareEffectiveDemand(uint year, HydroSpecificMap& hydro_specific_map) { areas_.each( [this, &year, &hydro_specific_map](Data::Area& area) @@ -216,7 +213,8 @@ void HydroManagement::prepareEffectiveDemand( double effectiveDemand = 0; // area.hydro.allocation is indexed by area index area.hydro.allocation.eachNonNull( - [this, &effectiveDemand, &day, &hydro_specific_map](unsigned areaIndex, double value) + [this, &effectiveDemand, &day, &hydro_specific_map](unsigned areaIndex, + double value) { const auto* area = areas_.byIndex[areaIndex]; effectiveDemand += hydro_specific_map[area].daily[day].DLN * value; diff --git a/src/solver/hydro/management/monthly.cpp b/src/solver/hydro/management/monthly.cpp index 5804782531..684ac4db16 100644 --- a/src/solver/hydro/management/monthly.cpp +++ b/src/solver/hydro/management/monthly.cpp @@ -151,10 +151,9 @@ double HydroManagement::prepareMonthlyTargetGenerations( return total; } -void HydroManagement::prepareMonthlyOptimalGenerations( - double* random_reservoir_level, - uint y, - HydroSpecificMap& hydro_specific_map) +void HydroManagement::prepareMonthlyOptimalGenerations(double* random_reservoir_level, + uint y, + HydroSpecificMap& hydro_specific_map) { uint indexArea = 0; areas_.each( @@ -291,9 +290,8 @@ void HydroManagement::prepareMonthlyOptimalGenerations( writeSolutionCost("Solution cost (noised) : ", solutionCostNoised); buffer << "\n\n"; - buffer << '\t' << "\tInflows" << '\t' << "\tTarget Gen." - << "\tTurbined" - << "\tLevels" << '\t' << "\tLvl min" << '\t' << "\tLvl max\n"; + buffer << '\t' << "\tInflows" << '\t' << "\tTarget Gen." << "\tTurbined" << "\tLevels" + << '\t' << "\tLvl min" << '\t' << "\tLvl max\n"; for (uint month = 0; month != 12; ++month) { uint realmonth = (initReservoirLvlMonth + month) % 12; diff --git a/src/solver/misc/include/antares/solver/misc/options.h b/src/solver/misc/include/antares/solver/misc/options.h index 2560a74d1c..00daf5aec7 100644 --- a/src/solver/misc/include/antares/solver/misc/options.h +++ b/src/solver/misc/include/antares/solver/misc/options.h @@ -27,8 +27,8 @@ #include #include -#include #include +#include /*! ** \brief Command line settings for launching the simulation diff --git a/src/solver/misc/options.cpp b/src/solver/misc/options.cpp index a09b83e17d..960b0dda6c 100644 --- a/src/solver/misc/options.cpp +++ b/src/solver/misc/options.cpp @@ -22,8 +22,8 @@ #include "antares/solver/misc/options.h" #include -#include #include +#include #include #include diff --git a/src/solver/optimisation/adequacy_patch_local_matching/adequacy_patch_weekly_optimization.cpp b/src/solver/optimisation/adequacy_patch_local_matching/adequacy_patch_weekly_optimization.cpp index 174d32564d..8129d10845 100644 --- a/src/solver/optimisation/adequacy_patch_local_matching/adequacy_patch_weekly_optimization.cpp +++ b/src/solver/optimisation/adequacy_patch_local_matching/adequacy_patch_weekly_optimization.cpp @@ -22,8 +22,8 @@ #include "antares/solver/optimisation/adequacy_patch_local_matching/adequacy_patch_weekly_optimization.h" #include "antares/solver/optimisation/opt_fonctions.h" -#include "antares/solver/simulation/adequacy_patch_runtime_data.h" #include "antares/solver/simulation/ISimulationObserver.h" +#include "antares/solver/simulation/adequacy_patch_runtime_data.h" #include "antares/study/fwd.h" using namespace Antares::Data::AdequacyPatch; @@ -47,7 +47,11 @@ void AdequacyPatchOptimization::solve() { Simulation::NullSimulationObserver nullSimulationObserver; problemeHebdo_->adequacyPatchRuntimeData->AdequacyFirstStep = true; - OPT_OptimisationHebdomadaire(options_, problemeHebdo_, adqPatchParams_, writer_, nullSimulationObserver); + OPT_OptimisationHebdomadaire(options_, + problemeHebdo_, + adqPatchParams_, + writer_, + nullSimulationObserver); problemeHebdo_->adequacyPatchRuntimeData->AdequacyFirstStep = false; for (uint32_t pays = 0; pays < problemeHebdo_->NombreDePays; ++pays) @@ -64,7 +68,11 @@ void AdequacyPatchOptimization::solve() } } - OPT_OptimisationHebdomadaire(options_, problemeHebdo_, adqPatchParams_, writer_, nullSimulationObserver); + OPT_OptimisationHebdomadaire(options_, + problemeHebdo_, + adqPatchParams_, + writer_, + nullSimulationObserver); } } // namespace Antares::Solver::Optimization diff --git a/src/solver/optimisation/base_weekly_optimization.cpp b/src/solver/optimisation/base_weekly_optimization.cpp index 80efece4b9..623331485e 100644 --- a/src/solver/optimisation/base_weekly_optimization.cpp +++ b/src/solver/optimisation/base_weekly_optimization.cpp @@ -35,8 +35,7 @@ WeeklyOptimization::WeeklyOptimization(const OptimizationOptions& options, AdqPatchParams& adqPatchParams, uint thread_number, IResultWriter& writer, - Simulation::ISimulationObserver& simulationObserver - ) : + Simulation::ISimulationObserver& simulationObserver): options_(options), problemeHebdo_(problemesHebdo), adqPatchParams_(adqPatchParams), @@ -46,14 +45,14 @@ WeeklyOptimization::WeeklyOptimization(const OptimizationOptions& options, { } -std::unique_ptr WeeklyOptimization::create(const Antares::Data::Study& study, - const OptimizationOptions& options, - AdqPatchParams& adqPatchParams, - PROBLEME_HEBDO* problemeHebdo, - uint thread_number, - IResultWriter& writer, - Simulation::ISimulationObserver& simulationObserver - ) +std::unique_ptr WeeklyOptimization::create( + const Antares::Data::Study& study, + const OptimizationOptions& options, + AdqPatchParams& adqPatchParams, + PROBLEME_HEBDO* problemeHebdo, + uint thread_number, + IResultWriter& writer, + Simulation::ISimulationObserver& simulationObserver) { if (adqPatchParams.enabled && adqPatchParams.localMatching.enabled) { diff --git a/src/solver/optimisation/include/antares/solver/optimisation/base_weekly_optimization.h b/src/solver/optimisation/include/antares/solver/optimisation/base_weekly_optimization.h index e25ffca086..acae5d8aed 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/base_weekly_optimization.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/base_weekly_optimization.h @@ -41,9 +41,8 @@ class WeeklyOptimization Antares::Data::AdequacyPatch::AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemesHebdo, uint numSpace, - IResultWriter& writer, - Simulation::ISimulationObserver& simulationObserver - ); + IResultWriter& writer, + Simulation::ISimulationObserver& simulationObserver); protected: explicit WeeklyOptimization(const OptimizationOptions& options, @@ -51,8 +50,7 @@ class WeeklyOptimization Antares::Data::AdequacyPatch::AdqPatchParams&, uint numSpace, IResultWriter& writer, - Simulation::ISimulationObserver& simulationObserver - ); + Simulation::ISimulationObserver& simulationObserver); Antares::Solver::Optimization::OptimizationOptions options_; PROBLEME_HEBDO* const problemeHebdo_ = nullptr; Antares::Data::AdequacyPatch::AdqPatchParams& adqPatchParams_; diff --git a/src/solver/optimisation/include/antares/solver/optimisation/opt_fonctions.h b/src/solver/optimisation/include/antares/solver/optimisation/opt_fonctions.h index 2150ea991a..4be6b8e1d7 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/opt_fonctions.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/opt_fonctions.h @@ -70,8 +70,7 @@ bool OPT_PilotageOptimisationLineaire(const OptimizationOptions& options, PROBLEME_HEBDO* problemeHebdo, const AdqPatchParams& adqPatchParams, Solver::IResultWriter& writer, - Solver::Simulation::ISimulationObserver& simulationObserver - ); + Solver::Simulation::ISimulationObserver& simulationObserver); void OPT_VerifierPresenceReserveJmoins1(PROBLEME_HEBDO*); bool OPT_PilotageOptimisationQuadratique(PROBLEME_HEBDO*); @@ -92,8 +91,7 @@ bool OPT_OptimisationLineaire(const OptimizationOptions& options, PROBLEME_HEBDO* problemeHebdo, const AdqPatchParams& adqPatchParams, Solver::IResultWriter& writer, - Solver::Simulation::ISimulationObserver& simulationObserver - ); + Solver::Simulation::ISimulationObserver& simulationObserver); void OPT_RestaurerLesDonnees(PROBLEME_HEBDO*); /*------------------------------*/ diff --git a/src/solver/optimisation/include/antares/solver/optimisation/weekly_optimization.h b/src/solver/optimisation/include/antares/solver/optimisation/weekly_optimization.h index d0f33adb39..2206d35a25 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/weekly_optimization.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/weekly_optimization.h @@ -21,9 +21,8 @@ #pragma once -#include "antares/solver/simulation/sim_structure_probleme_economique.h" #include "antares/solver/simulation/ISimulationObserver.h" - +#include "antares/solver/simulation/sim_structure_probleme_economique.h" #include "base_weekly_optimization.h" @@ -36,9 +35,8 @@ class DefaultWeeklyOptimization: public WeeklyOptimization PROBLEME_HEBDO* problemeHebdo, Antares::Data::AdequacyPatch::AdqPatchParams&, uint numSpace, - IResultWriter& writer, - Simulation::ISimulationObserver& simulationObserver - ); + IResultWriter& writer, + Simulation::ISimulationObserver& simulationObserver); ~DefaultWeeklyOptimization() override = default; void solve() override; }; diff --git a/src/solver/optimisation/opt_construction_variables_optimisees_quadratique.cpp b/src/solver/optimisation/opt_construction_variables_optimisees_quadratique.cpp index e21039e14f..10018bf29d 100644 --- a/src/solver/optimisation/opt_construction_variables_optimisees_quadratique.cpp +++ b/src/solver/optimisation/opt_construction_variables_optimisees_quadratique.cpp @@ -31,7 +31,7 @@ void OPT_ConstruireLaListeDesVariablesOptimiseesDuProblemeQuadratique(PROBLEME_HEBDO* problemeHebdo) { const auto& ProblemeAResoudre = problemeHebdo->ProblemeAResoudre; - assert(ProblemeAResoudre ); + assert(ProblemeAResoudre); int nombreDeVariables = 0; auto variableManager = VariableManagerFromProblemHebdo(problemeHebdo); diff --git a/src/solver/optimisation/opt_optimisation_hebdo.cpp b/src/solver/optimisation/opt_optimisation_hebdo.cpp index 6883089378..0abed9ff13 100644 --- a/src/solver/optimisation/opt_optimisation_hebdo.cpp +++ b/src/solver/optimisation/opt_optimisation_hebdo.cpp @@ -45,8 +45,11 @@ void OPT_OptimisationHebdomadaire(const OptimizationOptions& options, { if (pProblemeHebdo->TypeDOptimisation == OPTIMISATION_LINEAIRE) { - if (!OPT_PilotageOptimisationLineaire( - options, pProblemeHebdo, adqPatchParams, writer, simulationObserver)) + if (!OPT_PilotageOptimisationLineaire(options, + pProblemeHebdo, + adqPatchParams, + writer, + simulationObserver)) { logs.error() << "Linear optimization failed"; throw UnfeasibleProblemError("Linear optimization failed"); diff --git a/src/solver/optimisation/opt_pilotage_optimisation_lineaire.cpp b/src/solver/optimisation/opt_pilotage_optimisation_lineaire.cpp index 2ca9c71d56..7d6bff0d80 100644 --- a/src/solver/optimisation/opt_pilotage_optimisation_lineaire.cpp +++ b/src/solver/optimisation/opt_pilotage_optimisation_lineaire.cpp @@ -77,5 +77,9 @@ bool OPT_PilotageOptimisationLineaire(const OptimizationOptions& options, OPT_InitialiserNombreMinEtMaxDeGroupesCoutsDeDemarrage(problemeHebdo); } - return OPT_OptimisationLineaire(options, problemeHebdo, adqPatchParams, writer, simulationObserver); + return OPT_OptimisationLineaire(options, + problemeHebdo, + adqPatchParams, + writer, + simulationObserver); } diff --git a/src/solver/optimisation/weekly_optimization.cpp b/src/solver/optimisation/weekly_optimization.cpp index cf943b2125..8f36d762d2 100644 --- a/src/solver/optimisation/weekly_optimization.cpp +++ b/src/solver/optimisation/weekly_optimization.cpp @@ -17,7 +17,7 @@ * * You should have received a copy of the Mozilla Public Licence 2.0 * along with Antares_Simulator. If not, see . -*/ + */ #include "antares/solver/optimisation/weekly_optimization.h" @@ -25,19 +25,29 @@ namespace Antares::Solver::Optimization { -DefaultWeeklyOptimization::DefaultWeeklyOptimization(const OptimizationOptions& options, - PROBLEME_HEBDO* problemeHebdo, - AdqPatchParams& adqPatchParams, - uint thread_number, - IResultWriter& writer, - Simulation::ISimulationObserver& simulationObserver) : - WeeklyOptimization(options, problemeHebdo, adqPatchParams, thread_number, writer, simulationObserver) +DefaultWeeklyOptimization::DefaultWeeklyOptimization( + const OptimizationOptions& options, + PROBLEME_HEBDO* problemeHebdo, + AdqPatchParams& adqPatchParams, + uint thread_number, + IResultWriter& writer, + Simulation::ISimulationObserver& simulationObserver): + WeeklyOptimization(options, + problemeHebdo, + adqPatchParams, + thread_number, + writer, + simulationObserver) { } void DefaultWeeklyOptimization::solve() { - OPT_OptimisationHebdomadaire(options_, problemeHebdo_, adqPatchParams_, writer_, simulationObserver_.get()); + OPT_OptimisationHebdomadaire(options_, + problemeHebdo_, + adqPatchParams_, + writer_, + simulationObserver_.get()); } } // namespace Antares::Solver::Optimization diff --git a/src/solver/simulation/adequacy.cpp b/src/solver/simulation/adequacy.cpp index 8ba97fde33..f4759a0ab1 100644 --- a/src/solver/simulation/adequacy.cpp +++ b/src/solver/simulation/adequacy.cpp @@ -31,8 +31,10 @@ namespace Antares::Solver::Simulation { Adequacy::Adequacy(Data::Study& study, IResultWriter& resultWriter, - Simulation::ISimulationObserver& simulationObserver) : - study(study), resultWriter(resultWriter), simulationObserver_(simulationObserver) + Simulation::ISimulationObserver& simulationObserver): + study(study), + resultWriter(resultWriter), + simulationObserver_(simulationObserver) { } @@ -68,7 +70,10 @@ bool Adequacy::simulationBegin() pProblemesHebdo.resize(pNbMaxPerformedYearsInParallel); for (uint numSpace = 0; numSpace < pNbMaxPerformedYearsInParallel; numSpace++) { - SIM_InitialisationProblemeHebdo(study, pProblemesHebdo[numSpace], nbHoursInAWeek, numSpace); + SIM_InitialisationProblemeHebdo(study, + pProblemesHebdo[numSpace], + nbHoursInAWeek, + numSpace); } } @@ -405,8 +410,8 @@ void Adequacy::prepareClustersInMustRunMode(Data::Area::ScratchMap& scratchmap, { for (uint i = 0; i < study.areas.size(); ++i) { - auto &area = *study.areas[i]; - auto &scratchpad = scratchmap.at(&area); + auto& area = *study.areas[i]; + auto& scratchpad = scratchmap.at(&area); std::ranges::fill(scratchpad.mustrunSum, 0); std::ranges::fill(scratchpad.originalMustrunSum, 0); @@ -414,9 +419,9 @@ void Adequacy::prepareClustersInMustRunMode(Data::Area::ScratchMap& scratchmap, auto& mrs = scratchpad.mustrunSum; auto& adq = scratchpad.originalMustrunSum; - for (const auto &cluster: area.thermal.list.each_mustrun_and_enabled()) + for (const auto& cluster: area.thermal.list.each_mustrun_and_enabled()) { - const auto &availableProduction = cluster->series.getColumn(year); + const auto& availableProduction = cluster->series.getColumn(year); for (uint h = 0; h != cluster->series.timeSeries.height; ++h) { mrs[h] += availableProduction[h]; @@ -426,7 +431,8 @@ void Adequacy::prepareClustersInMustRunMode(Data::Area::ScratchMap& scratchmap, { for (uint h = 0; h != cluster->series.timeSeries.height; ++h) { - adq[h] += 2 * availableProduction[h]; // Why do we add the available production twice ? + adq[h] += 2 * availableProduction[h]; // Why do we add the available production + // twice ? } } } diff --git a/src/solver/simulation/adequacy_mode.cpp b/src/solver/simulation/adequacy_mode.cpp index 86435743ce..c0dd81b176 100644 --- a/src/solver/simulation/adequacy_mode.cpp +++ b/src/solver/simulation/adequacy_mode.cpp @@ -1,23 +1,23 @@ /* -* Copyright 2007-2024, RTE (https://www.rte-france.com) -* See AUTHORS.txt -* SPDX-License-Identifier: MPL-2.0 -* This file is part of Antares-Simulator, -* Adequacy and Performance assessment for interconnected energy networks. -* -* Antares_Simulator is free software: you can redistribute it and/or modify -* it under the terms of the Mozilla Public Licence 2.0 as published by -* the Mozilla Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* Antares_Simulator is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* Mozilla Public Licence 2.0 for more details. -* -* You should have received a copy of the Mozilla Public Licence 2.0 -* along with Antares_Simulator. If not, see . -*/ + * Copyright 2007-2024, RTE (https://www.rte-france.com) + * See AUTHORS.txt + * SPDX-License-Identifier: MPL-2.0 + * This file is part of Antares-Simulator, + * Adequacy and Performance assessment for interconnected energy networks. + * + * Antares_Simulator is free software: you can redistribute it and/or modify + * it under the terms of the Mozilla Public Licence 2.0 as published by + * the Mozilla Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Antares_Simulator is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Mozilla Public Licence 2.0 for more details. + * + * You should have received a copy of the Mozilla Public Licence 2.0 + * along with Antares_Simulator. If not, see . + */ #include "antares/solver/simulation/adequacy_mode.h" @@ -27,24 +27,24 @@ namespace Antares::Solver { void runSimulationInAdequacyMode(Antares::Data::Study& study, - const Settings& settings, + const Settings& settings, Benchmarking::DurationCollector& durationCollector, - IResultWriter& resultWriter, - Benchmarking::OptimizationInfo& info, - Simulation::ISimulationObserver& simulationObserver) + IResultWriter& resultWriter, + Benchmarking::OptimizationInfo& info, + Simulation::ISimulationObserver& simulationObserver) { - // Type of the simulation - typedef Solver::Simulation::ISimulation SimulationType; - SimulationType simulation(study, settings, durationCollector, resultWriter, simulationObserver); - simulation.checkWriter(); - simulation.run(); + // Type of the simulation + typedef Solver::Simulation::ISimulation SimulationType; + SimulationType simulation(study, settings, durationCollector, resultWriter, simulationObserver); + simulation.checkWriter(); + simulation.run(); - if (!(settings.noOutput || settings.tsGeneratorsOnly)) - { + if (!(settings.noOutput || settings.tsGeneratorsOnly)) + { durationCollector("synthesis_export") << [&simulation] { simulation.writeResults(/*synthesis:*/ true); }; - info = simulation.getOptimizationInfo(); - } + info = simulation.getOptimizationInfo(); + } } } // namespace Antares::Solver diff --git a/src/solver/simulation/common-eco-adq.cpp b/src/solver/simulation/common-eco-adq.cpp index 4917e76f09..27d2cdae6c 100644 --- a/src/solver/simulation/common-eco-adq.cpp +++ b/src/solver/simulation/common-eco-adq.cpp @@ -338,21 +338,23 @@ void PrepareRandomNumbers(Data::Study& study, }); } - void SetInitialHydroLevel(Data::Study& study, PROBLEME_HEBDO& problem, const HYDRO_VENTILATION_RESULTS& hydroVentilationResults) { uint firstDaySimu = study.parameters.simulationDays.first; - study.areas.each([&problem, &firstDaySimu, &hydroVentilationResults](const Data::Area& area) - { - if (area.hydro.reservoirManagement) - { - double capacity = area.hydro.reservoirCapacity; - problem.previousSimulationFinalLevel[area.index] = - hydroVentilationResults[area.index].NiveauxReservoirsDebutJours[firstDaySimu] * capacity; - } - }); + study.areas.each( + [&problem, &firstDaySimu, &hydroVentilationResults](const Data::Area& area) + { + if (area.hydro.reservoirManagement) + { + double capacity = area.hydro.reservoirCapacity; + problem.previousSimulationFinalLevel[area.index] = hydroVentilationResults[area.index] + .NiveauxReservoirsDebutJours + [firstDaySimu] + * capacity; + } + }); } void BuildThermalPartOfWeeklyProblem(Data::Study& study, diff --git a/src/solver/simulation/common-hydro-levels.cpp b/src/solver/simulation/common-hydro-levels.cpp index 81602073a1..b0ba258b0e 100644 --- a/src/solver/simulation/common-hydro-levels.cpp +++ b/src/solver/simulation/common-hydro-levels.cpp @@ -33,7 +33,7 @@ void computingHydroLevels(const Data::AreaList& areas, bool remixWasRun, bool computeAnyway) { - for (const auto& [_, area] : areas) + for (const auto& [_, area]: areas) { if (!area->hydro.reservoirManagement) { @@ -50,7 +50,7 @@ void computingHydroLevels(const Data::AreaList& areas, double reservoirCapacity = area->hydro.reservoirCapacity; std::vector& inflows = problem.CaracteristiquesHydrauliques[index] - .ApportNaturelHoraire; + .ApportNaturelHoraire; RESULTATS_HORAIRES& weeklyResults = problem.ResultatsHoraires[index]; @@ -65,7 +65,7 @@ void computingHydroLevels(const Data::AreaList& areas, std::vector& ovf = weeklyResults.debordementsHoraires; computeTimeStepLevel - computeLvlObj(nivInit, inflows, ovf, turb, pumpingRatio, pump, reservoirCapacity); + computeLvlObj(nivInit, inflows, ovf, turb, pumpingRatio, pump, reservoirCapacity); for (uint h = 0; h < nbHoursInAWeek - 1; h++) { @@ -94,7 +94,7 @@ void interpolateWaterValue(const Data::AreaList& areas, daysOfWeek[d] = weekFirstDay + d; } - for (const auto& [_, area] : areas) + for (const auto& [_, area]: areas) { uint index = area->index; @@ -118,22 +118,22 @@ void interpolateWaterValue(const Data::AreaList& areas, std::vector& niv = weeklyResults.niveauxHoraires; waterVal[0] = Data::getWaterValue(problem.previousSimulationFinalLevel[index] * 100 - / reservoirCapacity, - area->hydro.waterValues, - weekFirstDay); + / reservoirCapacity, + area->hydro.waterValues, + weekFirstDay); for (uint h = 1; h < nbHoursInAWeek; h++) { waterVal[h] = Data::getWaterValue(niv[h - 1], - area->hydro.waterValues, - daysOfWeek[h / 24]); + area->hydro.waterValues, + daysOfWeek[h / 24]); } } } void updatingWeeklyFinalHydroLevel(const Data::AreaList& areas, PROBLEME_HEBDO& problem) { - for (const auto& [_, area] : areas) + for (const auto& [_, area]: areas) { if (!area->hydro.reservoirManagement) { @@ -149,7 +149,7 @@ void updatingWeeklyFinalHydroLevel(const Data::AreaList& areas, PROBLEME_HEBDO& std::vector& niv = weeklyResults.niveauxHoraires; problem.previousSimulationFinalLevel[index] = niv[nbHoursInAWeek - 1] * reservoirCapacity - / 100; + / 100; } } diff --git a/src/solver/simulation/common-hydro-remix.cpp b/src/solver/simulation/common-hydro-remix.cpp index dcf39052ce..de8e3f5328 100644 --- a/src/solver/simulation/common-hydro-remix.cpp +++ b/src/solver/simulation/common-hydro-remix.cpp @@ -51,8 +51,7 @@ static bool Remix(const Data::AreaList& areas, bool status = true; areas.each( - [&HE, &DE, &remix, &G, &status, &problem, &numSpace, &hourInYear] - (const Data::Area& area) + [&HE, &DE, &remix, &G, &status, &problem, &numSpace, &hourInYear](const Data::Area& area) { auto index = area.index; diff --git a/src/solver/simulation/economy.cpp b/src/solver/simulation/economy.cpp index 1fa0b63625..f14d4cabf0 100644 --- a/src/solver/simulation/economy.cpp +++ b/src/solver/simulation/economy.cpp @@ -35,7 +35,7 @@ namespace Antares::Solver::Simulation { Economy::Economy(Data::Study& study, IResultWriter& resultWriter, - Simulation::ISimulationObserver& simulationObserver) : + Simulation::ISimulationObserver& simulationObserver): study(study), preproOnly(false), resultWriter(resultWriter), @@ -76,7 +76,10 @@ bool Economy::simulationBegin() for (uint numSpace = 0; numSpace < pNbMaxPerformedYearsInParallel; numSpace++) { - SIM_InitialisationProblemeHebdo(study, pProblemesHebdo[numSpace], nbHoursInAWeek, numSpace); + SIM_InitialisationProblemeHebdo(study, + pProblemesHebdo[numSpace], + nbHoursInAWeek, + numSpace); auto options = createOptimizationOptions(study); weeklyOptProblems_[numSpace] = Antares::Solver::Optimization::WeeklyOptimization:: diff --git a/src/solver/simulation/economy_mode.cpp b/src/solver/simulation/economy_mode.cpp index 816eb1a212..12a1b24297 100644 --- a/src/solver/simulation/economy_mode.cpp +++ b/src/solver/simulation/economy_mode.cpp @@ -1,23 +1,23 @@ /* -* Copyright 2007-2024, RTE (https://www.rte-france.com) -* See AUTHORS.txt -* SPDX-License-Identifier: MPL-2.0 -* This file is part of Antares-Simulator, -* Adequacy and Performance assessment for interconnected energy networks. -* -* Antares_Simulator is free software: you can redistribute it and/or modify -* it under the terms of the Mozilla Public Licence 2.0 as published by -* the Mozilla Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* Antares_Simulator is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* Mozilla Public Licence 2.0 for more details. -* -* You should have received a copy of the Mozilla Public Licence 2.0 -* along with Antares_Simulator. If not, see . -*/ + * Copyright 2007-2024, RTE (https://www.rte-france.com) + * See AUTHORS.txt + * SPDX-License-Identifier: MPL-2.0 + * This file is part of Antares-Simulator, + * Adequacy and Performance assessment for interconnected energy networks. + * + * Antares_Simulator is free software: you can redistribute it and/or modify + * it under the terms of the Mozilla Public Licence 2.0 as published by + * the Mozilla Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Antares_Simulator is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Mozilla Public Licence 2.0 for more details. + * + * You should have received a copy of the Mozilla Public Licence 2.0 + * along with Antares_Simulator. If not, see . + */ #include "antares/solver/simulation/economy_mode.h" @@ -27,25 +27,24 @@ namespace Antares::Solver { void runSimulationInEconomicMode(Antares::Data::Study& study, - const Settings& settings, + const Settings& settings, Benchmarking::DurationCollector& durationCollector, - IResultWriter& resultWriter, - Benchmarking::OptimizationInfo& info, - Simulation::ISimulationObserver& simulationObserver -) + IResultWriter& resultWriter, + Benchmarking::OptimizationInfo& info, + Simulation::ISimulationObserver& simulationObserver) { - // Type of the simulation - typedef Solver::Simulation::ISimulation SimulationType; - SimulationType simulation(study, settings, durationCollector, resultWriter, simulationObserver); - simulation.checkWriter(); - simulation.run(); + // Type of the simulation + typedef Solver::Simulation::ISimulation SimulationType; + SimulationType simulation(study, settings, durationCollector, resultWriter, simulationObserver); + simulation.checkWriter(); + simulation.run(); - if (!(settings.noOutput || settings.tsGeneratorsOnly)) - { + if (!(settings.noOutput || settings.tsGeneratorsOnly)) + { durationCollector("synthesis_export") << [&simulation] { simulation.writeResults(/*synthesis:*/ true); }; - info = simulation.getOptimizationInfo(); - } + info = simulation.getOptimizationInfo(); + } } } // namespace Antares::Solver diff --git a/src/solver/simulation/include/antares/solver/simulation/ISimulationObserver.h b/src/solver/simulation/include/antares/solver/simulation/ISimulationObserver.h index 414695a580..fe6145dd0f 100644 --- a/src/solver/simulation/include/antares/solver/simulation/ISimulationObserver.h +++ b/src/solver/simulation/include/antares/solver/simulation/ISimulationObserver.h @@ -53,13 +53,14 @@ class ISimulationObserver * @brief The NullSimulationObserver class is a null object for the ISimulationObserver interface. * @details It overrides the notifyHebdoProblem method with an empty implementation. */ -class NullSimulationObserver : public ISimulationObserver +class NullSimulationObserver: public ISimulationObserver { public: ~NullSimulationObserver() override = default; + void notifyHebdoProblem(const PROBLEME_HEBDO&, int, std::string_view) override { - //null object pattern + // null object pattern } }; -} // namespace Antares::Solver::Simulation \ No newline at end of file +} // namespace Antares::Solver::Simulation diff --git a/src/solver/simulation/include/antares/solver/simulation/adequacy.h b/src/solver/simulation/include/antares/solver/simulation/adequacy.h index 130f3c18f5..4e04acdcbe 100644 --- a/src/solver/simulation/include/antares/solver/simulation/adequacy.h +++ b/src/solver/simulation/include/antares/solver/simulation/adequacy.h @@ -48,7 +48,8 @@ class Adequacy ** ** \param study The current study */ - Adequacy(Data::Study& study, IResultWriter& resultWriter, + Adequacy(Data::Study& study, + IResultWriter& resultWriter, Simulation::ISimulationObserver& simulationObserver); //! Destructor ~Adequacy() = default; diff --git a/src/solver/simulation/include/antares/solver/simulation/economy_mode.h b/src/solver/simulation/include/antares/solver/simulation/economy_mode.h index 7437d39cf1..e26ebbb7e0 100644 --- a/src/solver/simulation/include/antares/solver/simulation/economy_mode.h +++ b/src/solver/simulation/include/antares/solver/simulation/economy_mode.h @@ -34,6 +34,5 @@ void runSimulationInEconomicMode(Antares::Data::Study& study, Benchmarking::DurationCollector& durationCollector, IResultWriter& resultWriter, Benchmarking::OptimizationInfo& info, - Simulation::ISimulationObserver& simulationObserver -); + Simulation::ISimulationObserver& simulationObserver); } diff --git a/src/solver/simulation/include/antares/solver/simulation/solver.hxx b/src/solver/simulation/include/antares/solver/simulation/solver.hxx index 093cb1e350..cd4ddfc0a9 100644 --- a/src/solver/simulation/include/antares/solver/simulation/solver.hxx +++ b/src/solver/simulation/include/antares/solver/simulation/solver.hxx @@ -31,15 +31,13 @@ #include #include #include "antares/concurrency/concurrency.h" -#include "antares/solver/variable/constants.h" -#include "antares/solver/variable/print.h" #include "antares/solver/hydro/management/HydroInputsChecker.h" #include "antares/solver/hydro/management/management.h" #include "antares/solver/simulation/opt_time_writer.h" #include "antares/solver/simulation/timeseries-numbers.h" #include "antares/solver/ts-generator/generator.h" - - +#include "antares/solver/variable/constants.h" +#include "antares/solver/variable/print.h" namespace Antares::Solver::Simulation { @@ -76,10 +74,7 @@ public: pDurationCollector(durationCollector), pResultWriter(resultWriter), simulationObserver_(simulationObserver), - hydroManagement(study.areas, - study.parameters, - study.calendar, - resultWriter) + hydroManagement(study.areas, study.parameters, study.calendar, resultWriter) { scratchmap = study.areas.buildScratchMap(numSpace); } @@ -164,11 +159,8 @@ public: simulation_->prepareClustersInMustRunMode(scratchmap, y); // 4 - Hydraulic ventilation - pDurationCollector("hydro_ventilation") << [this, &randomReservoirLevel] { - hydroManagement.makeVentilation(randomReservoirLevel, - y, - scratchmap); - }; + pDurationCollector("hydro_ventilation") << [this, &randomReservoirLevel] + { hydroManagement.makeVentilation(randomReservoirLevel, y, scratchmap); }; // Updating the state state.year = y; @@ -723,15 +715,15 @@ void ISimulation::computeRandomNumbers( max[firstDayOfMonth], randomHydroGenerator); - // Possibly update the intial level from scenario builder - if (study.parameters.useCustomScenario) - { - double levelFromScenarioBuilder = study.scenarioInitialHydroLevels[areaIndex][y]; - if (levelFromScenarioBuilder >= 0.) - { - randomLevel = levelFromScenarioBuilder; - } - } + // Possibly update the intial level from scenario builder + if (study.parameters.useCustomScenario) + { + double levelFromScenarioBuilder = study.scenarioInitialHydroLevels[areaIndex][y]; + if (levelFromScenarioBuilder >= 0.) + { + randomLevel = levelFromScenarioBuilder; + } + } // Current area's hydro starting (or initial) level computation // (no matter if the year is performed or not, we always draw a random initial @@ -755,7 +747,12 @@ void ISimulation::computeRandomNumbers( bool SpilledEnergySeedIsDefault = (currentSpilledEnergySeed == defaultSpilledEnergySeed); areaIndex = 0; study.areas.each( - [&isPerformed, &areaIndex, &randomUnsupplied, &randomSpilled, &randomForYears, &indexYear, + [&isPerformed, + &areaIndex, + &randomUnsupplied, + &randomSpilled, + &randomForYears, + &indexYear, &SpilledEnergySeedIsDefault](Data::Area& area) { (void)area; // Avoiding warnings at compilation (unused variable) on linux diff --git a/src/solver/simulation/sim_calcul_economique.cpp b/src/solver/simulation/sim_calcul_economique.cpp index ed13d54fe1..7fb3336599 100644 --- a/src/solver/simulation/sim_calcul_economique.cpp +++ b/src/solver/simulation/sim_calcul_economique.cpp @@ -513,11 +513,11 @@ void SIM_RenseignementProblemeHebdo(const Study& study, if (area.hydro.useWaterValue) { - problem.CaracteristiquesHydrauliques[k].WeeklyWaterValueStateRegular = - getWaterValue( - problem.previousSimulationFinalLevel[k] * 100 / area.hydro.reservoirCapacity, - area.hydro.waterValues, - weekFirstDay); + problem.CaracteristiquesHydrauliques[k].WeeklyWaterValueStateRegular + = getWaterValue(problem.previousSimulationFinalLevel[k] * 100 + / area.hydro.reservoirCapacity, + area.hydro.waterValues, + weekFirstDay); } if (problem.CaracteristiquesHydrauliques[k].PresenceDHydrauliqueModulable > 0) diff --git a/src/solver/simulation/timeseries-numbers.cpp b/src/solver/simulation/timeseries-numbers.cpp index 52b1213ada..446a0efa08 100644 --- a/src/solver/simulation/timeseries-numbers.cpp +++ b/src/solver/simulation/timeseries-numbers.cpp @@ -329,8 +329,7 @@ bool checkInterModalConsistencyForArea(const Area& area, { logs.error() << "Inter-modal correlation: time-series numbers of inter-modal modes in area '" - << area.name << "'" - << " are not identical"; + << area.name << "'" << " are not identical"; return false; } diff --git a/src/solver/ts-generator/availability.cpp b/src/solver/ts-generator/availability.cpp index 696725f846..0702c9e7b9 100644 --- a/src/solver/ts-generator/availability.cpp +++ b/src/solver/ts-generator/availability.cpp @@ -23,12 +23,12 @@ #include #include +#include // For Antares::IO::fileSetContent #include #include #include #include #include -#include // For Antares::IO::fileSetContent #include "antares/study/simulation.h" #define SEP Yuni::IO::Separator @@ -101,14 +101,18 @@ class GeneratorTempData final const T& duration) const; }; -GeneratorTempData::GeneratorTempData(Data::Study& study, unsigned nbOfSeriesToGen, MersenneTwister& rndGenerator): +GeneratorTempData::GeneratorTempData(Data::Study& study, + unsigned nbOfSeriesToGen, + MersenneTwister& rndGenerator): derated(study.parameters.derated), nbOfSeriesToGen_(nbOfSeriesToGen), rndgenerator(rndGenerator) { } -GeneratorTempData::GeneratorTempData(bool derated, unsigned int nbOfSeriesToGen, MersenneTwister& rndGenerator): +GeneratorTempData::GeneratorTempData(bool derated, + unsigned int nbOfSeriesToGen, + MersenneTwister& rndGenerator): derated(derated), nbOfSeriesToGen_(nbOfSeriesToGen), rndgenerator(rndGenerator) @@ -623,14 +627,13 @@ void writeResultsToDisk(const Data::Study& study, writer.addEntryFromBuffer(savePath, buffer); } -void writeResultsToDisk(const Matrix<>& series, - const std::filesystem::path savePath) +void writeResultsToDisk(const Matrix<>& series, const std::filesystem::path savePath) { std::string buffer; series.saveToBuffer(buffer, 0); std::filesystem::path parentDir = savePath.parent_path(); - if (! std::filesystem::exists(parentDir)) + if (!std::filesystem::exists(parentDir)) { std::filesystem::create_directories(parentDir); } @@ -680,21 +683,27 @@ bool generateLinkTimeSeries(std::vector& links, generalParams.random); for (auto& link: links) { - if (! link.hasValidData) + if (!link.hasValidData) { - logs.error() << "Missing data for link " << link.namesPair.first << "/" << link.namesPair.second; + logs.error() << "Missing data for link " << link.namesPair.first << "/" + << link.namesPair.second; return false; } if (link.forceNoGeneration) + { continue; // Skipping the link + } Data::TimeSeriesNumbers fakeTSnumbers; // gp : to quickly get rid of Data::TimeSeries ts(fakeTSnumbers); ts.resize(generalParams.nbLinkTStoGenerate, HOURS_PER_YEAR); // DIRECT - AvailabilityTSGeneratorData tsConfigDataDirect(link, ts, link.modulationCapacityDirect, link.namesPair.second); + AvailabilityTSGeneratorData tsConfigDataDirect(link, + ts, + link.modulationCapacityDirect, + link.namesPair.second); generator.generateTS(tsConfigDataDirect); @@ -703,12 +712,15 @@ bool generateLinkTimeSeries(std::vector& links, writeResultsToDisk(ts.timeSeries, filePath); // INDIRECT - AvailabilityTSGeneratorData tsConfigDataIndirect(link, ts, link.modulationCapacityIndirect, link.namesPair.second); + AvailabilityTSGeneratorData tsConfigDataIndirect(link, + ts, + link.modulationCapacityIndirect, + link.namesPair.second); generator.generateTS(tsConfigDataIndirect); filePath = savePath + SEP + link.namesPair.first + SEP + link.namesPair.second - + "_indirect.txt"; + + "_indirect.txt"; writeResultsToDisk(ts.timeSeries, filePath); } diff --git a/src/solver/ts-generator/include/antares/solver/ts-generator/generator.h b/src/solver/ts-generator/include/antares/solver/ts-generator/generator.h index 8cddc50679..bfb2901bfa 100644 --- a/src/solver/ts-generator/include/antares/solver/ts-generator/generator.h +++ b/src/solver/ts-generator/include/antares/solver/ts-generator/generator.h @@ -70,7 +70,6 @@ struct LinkTSgenerationParams bool hasValidData = true; }; - class AvailabilityTSGeneratorData { public: @@ -121,7 +120,6 @@ bool generateLinkTimeSeries(std::vector& links, std::vector getAllClustersToGen(const Data::AreaList& areas, bool globalThermalTSgeneration); - /*! ** \brief Destroy all TS Generators */ diff --git a/src/solver/ts-generator/xcast/xcast.cpp b/src/solver/ts-generator/xcast/xcast.cpp index ca0c96087a..56f7234119 100644 --- a/src/solver/ts-generator/xcast/xcast.cpp +++ b/src/solver/ts-generator/xcast/xcast.cpp @@ -593,7 +593,8 @@ bool XCast::runWithPredicate(PredicateT& predicate, Progression::Task& progressi if (study.parameters.derated) { - study.areas.each([&predicate](Data::Area& area) { predicate.matrix(area).averageTimeseries(); }); + study.areas.each([&predicate](Data::Area& area) + { predicate.matrix(area).averageTimeseries(); }); } if (study.parameters.timeSeriesToArchive & timeSeriesType) diff --git a/src/solver/utils/ortools_utils.cpp b/src/solver/utils/ortools_utils.cpp index 1f2f5e4169..2cc81b80fa 100644 --- a/src/solver/utils/ortools_utils.cpp +++ b/src/solver/utils/ortools_utils.cpp @@ -56,10 +56,9 @@ static void checkSetSolverSpecificParameters(bool status, } } -static void TuneSolverSpecificOptions( - MPSolver* solver, - const std::string& solverName, - const std::string& solverParameters) +static void TuneSolverSpecificOptions(MPSolver* solver, + const std::string& solverName, + const std::string& solverParameters) { if (!solver) { @@ -135,7 +134,6 @@ MPSolver* ProblemSimplexeNommeConverter::Convert() return solver; } - void ProblemSimplexeNommeConverter::CopyMatrix(const MPSolver* solver) const { auto variables = solver->variables(); diff --git a/src/solver/variable/include/antares/solver/variable/economy/all.h b/src/solver/variable/include/antares/solver/variable/economy/all.h index a3c637c43f..b7a62eb6bf 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/all.h +++ b/src/solver/variable/include/antares/solver/variable/economy/all.h @@ -248,8 +248,8 @@ typedef Variable::Join< Variable::Areas, // Variables for each set of areas Variable::Join, - // Variables for each binding constraint - Variable::BindingConstraints>> + // Variables for each binding constraint + Variable::BindingConstraints>> ItemList; /*! diff --git a/src/solver/variable/include/antares/solver/variable/economy/bindingConstraints/bindingConstraintsMarginalCost.h b/src/solver/variable/include/antares/solver/variable/economy/bindingConstraints/bindingConstraintsMarginalCost.h index 6d7e02fa3e..8a1f97676f 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/bindingConstraints/bindingConstraintsMarginalCost.h +++ b/src/solver/variable/include/antares/solver/variable/economy/bindingConstraints/bindingConstraintsMarginalCost.h @@ -147,7 +147,6 @@ class BindingConstMarginCost NextType::simulationEnd(); } - void initializeFromStudy(Data::Study& study) { pNbYearsParallel = study.maxNbYearsInParallel; @@ -257,8 +256,8 @@ class BindingConstMarginCost for (int dayInTheWeek = 0; dayInTheWeek < 7; dayInTheWeek++) { pValuesForTheCurrentYear[numSpace].day[dayInTheYear] - -= state.problemeHebdo - ->ResultatsContraintesCouplantes[associatedBC_][dayInTheWeek]; + -= state.problemeHebdo + ->ResultatsContraintesCouplantes[associatedBC_][dayInTheWeek]; dayInTheYear++; } @@ -270,7 +269,7 @@ class BindingConstMarginCost { uint weekInTheYear = state.weekInTheYear; double weeklyValue = -state.problemeHebdo - ->ResultatsContraintesCouplantes[associatedBC_][0]; + ->ResultatsContraintesCouplantes[associatedBC_][0]; pValuesForTheCurrentYear[numSpace].week[weekInTheYear] = weeklyValue; diff --git a/src/solver/variable/include/antares/solver/variable/storage/minmax.h b/src/solver/variable/include/antares/solver/variable/storage/minmax.h index 8e9603fa16..7866d1a271 100644 --- a/src/solver/variable/include/antares/solver/variable/storage/minmax.h +++ b/src/solver/variable/include/antares/solver/variable/storage/minmax.h @@ -84,14 +84,19 @@ struct MinMaxBase: public NextT { case Category::hourly: InternalExportIndices(report, - Memory::RawPointer(minmax.hourly.data()), + Memory::RawPointer( + minmax.hourly.data()), fileLevel); break; case Category::daily: - InternalExportIndices(report, minmax.daily.data(), fileLevel); + InternalExportIndices(report, + minmax.daily.data(), + fileLevel); break; case Category::weekly: - InternalExportIndices(report, minmax.weekly.data(), fileLevel); + InternalExportIndices(report, + minmax.weekly.data(), + fileLevel); break; case Category::monthly: InternalExportIndices(report, minmax.monthly.data(), fileLevel); @@ -107,7 +112,8 @@ struct MinMaxBase: public NextT { case Category::hourly: InternalExportValues(report, - Memory::RawPointer(minmax.hourly.data())); + Memory::RawPointer( + minmax.hourly.data())); break; case Category::daily: InternalExportValues(report, minmax.daily.data()); diff --git a/src/solver/variable/storage/minmax-data.cpp b/src/solver/variable/storage/minmax-data.cpp index 6d25480806..ea59610820 100644 --- a/src/solver/variable/storage/minmax-data.cpp +++ b/src/solver/variable/storage/minmax-data.cpp @@ -29,10 +29,10 @@ constexpr double eps = 1.e-7; static void initArray(bool opInferior, std::vector& array) { - for (auto& data : array) + for (auto& data: array) { data.value = opInferior ? DBL_MAX : -DBL_MAX; // +inf or -inf - data.indice = (uint32_t)(-1); // invalid indice + data.indice = (uint32_t)(-1); // invalid indice } } diff --git a/src/tests/end-to-end/simple_study/simple-study.cpp b/src/tests/end-to-end/simple_study/simple-study.cpp index 1def8eded6..7005057209 100644 --- a/src/tests/end-to-end/simple_study/simple-study.cpp +++ b/src/tests/end-to-end/simple_study/simple-study.cpp @@ -82,7 +82,7 @@ HydroMaxPowerStudy::HydroMaxPowerStudy() area = addAreaToStudy("Area"); area->thermal.unsuppliedEnergyCost = 1; - setNumberMCyears(1); + setNumberMCyears(1); TimeSeriesConfigurer loadTSconfig(area->load.series.timeSeries); loadTSconfig.setColumnCount(1).fillColumnWith(0, loadInArea); diff --git a/src/tests/inmemory-study/in-memory-study.cpp b/src/tests/inmemory-study/in-memory-study.cpp index 4b4e65c100..30efd246bf 100644 --- a/src/tests/inmemory-study/in-memory-study.cpp +++ b/src/tests/inmemory-study/in-memory-study.cpp @@ -20,9 +20,10 @@ */ #define WIN32_LEAN_AND_MEAN -#include "antares/application/ScenarioBuilderOwner.h" #include "in-memory-study.h" +#include "antares/application/ScenarioBuilderOwner.h" + void initializeStudy(Study* study) { study->parameters.reset(); @@ -223,7 +224,8 @@ void StudyBuilder::setNumberMCyears(unsigned int nbYears) { study->parameters.resetPlaylist(nbYears); study->areas.resizeAllTimeseriesNumbers(nbYears); - study->areas.each([&](Data::Area& area) { area.hydro.deltaBetweenFinalAndInitialLevels.resize(nbYears); }); + study->areas.each([&](Data::Area& area) + { area.hydro.deltaBetweenFinalAndInitialLevels.resize(nbYears); }); } void StudyBuilder::playOnlyYear(unsigned int year) diff --git a/src/tests/inmemory-study/include/in-memory-study.h b/src/tests/inmemory-study/include/in-memory-study.h index 101b6b47ab..920d28f261 100644 --- a/src/tests/inmemory-study/include/in-memory-study.h +++ b/src/tests/inmemory-study/include/in-memory-study.h @@ -164,14 +164,17 @@ class ScenarioBuilderRule { return rules_->load; } + BindingConstraintsTSNumberData& bcGroup() { return rules_->binding_constraints; } + hydroTSNumberData& hydro() { return rules_->hydro; } + private: Rules::Ptr rules_; }; diff --git a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp index e97f4e3524..04d1c7be9f 100644 --- a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp +++ b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp @@ -19,15 +19,17 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE antlr_interface tests -#include -#include -#include "antlr4-runtime.h" #include +#include +#include + #include "ExprLexer.h" #include "ExprParser.h" +#include "antlr4-runtime.h" using namespace antlr4; + BOOST_AUTO_TEST_CASE(test_antlr_interface) { const std::string my_input = "y = b + a*x"; diff --git a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp index 7879559fb0..de09d007d1 100644 --- a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp +++ b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp @@ -355,10 +355,12 @@ BOOST_FIXTURE_TEST_CASE(on_area1_and_on_year_17__hydro_level_0_123_is_chosen__re AreaName::Vector splitKey = {"hl", "area 1", yearNumber}; my_rule.readLine(splitKey, level); - BOOST_CHECK_EQUAL(my_rule.hydroInitialLevels.get_value(yearNumber.to(), area_1->index), level.to()); + BOOST_CHECK_EQUAL(my_rule.hydroInitialLevels.get_value(yearNumber.to(), area_1->index), + level.to()); - BOOST_CHECK(my_rule.apply()); - BOOST_CHECK_EQUAL(study->scenarioInitialHydroLevels[area_1->index][yearNumber.to()], level.to()); + BOOST_CHECK(my_rule.apply()); + BOOST_CHECK_EQUAL(study->scenarioInitialHydroLevels[area_1->index][yearNumber.to()], + level.to()); } BOOST_FIXTURE_TEST_CASE( @@ -370,10 +372,11 @@ BOOST_FIXTURE_TEST_CASE( AreaName::Vector splitKey = {"hl", "area 2", yearNumber}; BOOST_CHECK(my_rule.readLine(splitKey, level)); - BOOST_CHECK_EQUAL(my_rule.hydroInitialLevels.get_value(yearNumber.to(), area_2->index), 1.); + BOOST_CHECK_EQUAL(my_rule.hydroInitialLevels.get_value(yearNumber.to(), area_2->index), + 1.); - BOOST_CHECK(my_rule.apply()); - BOOST_CHECK_EQUAL(study->scenarioInitialHydroLevels[area_2->index][yearNumber.to()], 1.); + BOOST_CHECK(my_rule.apply()); + BOOST_CHECK_EQUAL(study->scenarioInitialHydroLevels[area_2->index][yearNumber.to()], 1.); } BOOST_FIXTURE_TEST_CASE( @@ -385,10 +388,11 @@ BOOST_FIXTURE_TEST_CASE( AreaName::Vector splitKey = {"hl", "area 3", yearNumber}; BOOST_CHECK(my_rule.readLine(splitKey, level)); - BOOST_CHECK_EQUAL(my_rule.hydroInitialLevels.get_value(yearNumber.to(), area_3->index), 0.); + BOOST_CHECK_EQUAL(my_rule.hydroInitialLevels.get_value(yearNumber.to(), area_3->index), + 0.); - BOOST_CHECK(my_rule.apply()); - BOOST_CHECK_EQUAL(study->scenarioInitialHydroLevels[area_3->index][yearNumber.to()], 0.); + BOOST_CHECK(my_rule.apply()); + BOOST_CHECK_EQUAL(study->scenarioInitialHydroLevels[area_3->index][yearNumber.to()], 0.); } // ======================== @@ -396,47 +400,47 @@ BOOST_FIXTURE_TEST_CASE( // ======================== BOOST_FIXTURE_TEST_CASE(on_area1_and_on_year_8__hydro_level_0_342_is_chosen__reading_OK, Fixture) { - AreaName yearNumber = "8"; - String level = "0.342"; - AreaName::Vector splitKey = {"hfl", "area 1", yearNumber}; - my_rule.readLine(splitKey, level, false); + AreaName yearNumber = "8"; + String level = "0.342"; + AreaName::Vector splitKey = {"hfl", "area 1", yearNumber}; + my_rule.readLine(splitKey, level, false); - BOOST_CHECK_EQUAL(my_rule.hydroFinalLevels.get_value(yearNumber.to(), area_1->index), - level.to()); + BOOST_CHECK_EQUAL(my_rule.hydroFinalLevels.get_value(yearNumber.to(), area_1->index), + level.to()); - BOOST_CHECK(my_rule.apply()); - BOOST_CHECK_EQUAL(study->scenarioFinalHydroLevels[area_1->index][yearNumber.to()], - level.to()); + BOOST_CHECK(my_rule.apply()); + BOOST_CHECK_EQUAL(study->scenarioFinalHydroLevels[area_1->index][yearNumber.to()], + level.to()); } -BOOST_FIXTURE_TEST_CASE(on_area2_and_on_year_1__hydro_level_2_4_is_chosen_level_lowered_to_1__reading_OK, Fixture) +BOOST_FIXTURE_TEST_CASE( + on_area2_and_on_year_1__hydro_level_2_4_is_chosen_level_lowered_to_1__reading_OK, + Fixture) { - AreaName yearNumber = "1"; - String level = "2.4"; - AreaName::Vector splitKey = {"hfl", "area 2", yearNumber}; - BOOST_CHECK(my_rule.readLine(splitKey, level, false)); + AreaName yearNumber = "1"; + String level = "2.4"; + AreaName::Vector splitKey = {"hfl", "area 2", yearNumber}; + BOOST_CHECK(my_rule.readLine(splitKey, level, false)); - BOOST_CHECK_EQUAL(my_rule.hydroFinalLevels.get_value(yearNumber.to(), area_2->index), - 1.); + BOOST_CHECK_EQUAL(my_rule.hydroFinalLevels.get_value(yearNumber.to(), area_2->index), 1.); - BOOST_CHECK(my_rule.apply()); - BOOST_CHECK_EQUAL(study->scenarioFinalHydroLevels[area_2->index][yearNumber.to()], - 1.); + BOOST_CHECK(my_rule.apply()); + BOOST_CHECK_EQUAL(study->scenarioFinalHydroLevels[area_2->index][yearNumber.to()], 1.); } -BOOST_FIXTURE_TEST_CASE(on_area3_and_on_year_3__hydro_level_neg_5_2_is_chosen__level_raised_to_0__reading_OK, Fixture) +BOOST_FIXTURE_TEST_CASE( + on_area3_and_on_year_3__hydro_level_neg_5_2_is_chosen__level_raised_to_0__reading_OK, + Fixture) { - AreaName yearNumber = "3"; - String level = "-5.2"; - AreaName::Vector splitKey = {"hfl", "area 3", yearNumber}; - BOOST_CHECK(my_rule.readLine(splitKey, level, false)); + AreaName yearNumber = "3"; + String level = "-5.2"; + AreaName::Vector splitKey = {"hfl", "area 3", yearNumber}; + BOOST_CHECK(my_rule.readLine(splitKey, level, false)); - BOOST_CHECK_EQUAL(my_rule.hydroFinalLevels.get_value(yearNumber.to(), area_3->index), - 0.); + BOOST_CHECK_EQUAL(my_rule.hydroFinalLevels.get_value(yearNumber.to(), area_3->index), 0.); - BOOST_CHECK(my_rule.apply()); - BOOST_CHECK_EQUAL(study->scenarioFinalHydroLevels[area_3->index][yearNumber.to()], - 0.); + BOOST_CHECK(my_rule.apply()); + BOOST_CHECK_EQUAL(study->scenarioFinalHydroLevels[area_3->index][yearNumber.to()], 0.); } // ====================== diff --git a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-save.cpp b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-save.cpp index 13d5a38b48..64813637fc 100644 --- a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-save.cpp +++ b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-save.cpp @@ -436,7 +436,9 @@ BOOST_FIXTURE_TEST_CASE( // ======================== // Tests on Hydro final levels // ======================== -BOOST_FIXTURE_TEST_CASE(HYDRO_FINAL_LEVEL__TS_number_for_many_areas_and_years__generated_and_ref_sc_buider_files_are_identical, saveFixture) +BOOST_FIXTURE_TEST_CASE( + HYDRO_FINAL_LEVEL__TS_number_for_many_areas_and_years__generated_and_ref_sc_buider_files_are_identical, + saveFixture) { my_rule->hydroFinalLevels.setTSnumber(area_1->index, 4, 8); my_rule->hydroFinalLevels.setTSnumber(area_2->index, 11, 3); diff --git a/src/tests/src/libs/antares/test_utils.cpp b/src/tests/src/libs/antares/test_utils.cpp index ad7e97d833..5cb05e27c4 100644 --- a/src/tests/src/libs/antares/test_utils.cpp +++ b/src/tests/src/libs/antares/test_utils.cpp @@ -19,14 +19,14 @@ * along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test utils +#include #include #include -#include - #include -#include + +#include namespace fs = std::filesystem; @@ -99,7 +99,8 @@ BOOST_AUTO_TEST_CASE(yuni_normalize_vs_std_lexically_normal) { Yuni::String yuniNorm; Yuni::IO::Normalize(yuniNorm, path.string()); - BOOST_CHECK_MESSAGE(path.lexically_normal().string() == yuniNorm, std::string("Check failed for ") + path.string()); + BOOST_CHECK_MESSAGE(path.lexically_normal().string() == yuniNorm, + std::string("Check failed for ") + path.string()); }; helper(fs::path("a/./b/..")); helper(fs::path("a/.///b/../")); diff --git a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp index ebfbc4bba8..87978fbcaa 100644 --- a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp +++ b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp @@ -19,19 +19,22 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE yamlcpp tests -#include -#include -#include "yaml-cpp/yaml.h" -#include #include +#include #include #include +#include +#include + +#include "yaml-cpp/yaml.h" + // our data types struct Vec3 { float x, y, z; }; + struct Power { std::string name; @@ -44,6 +47,7 @@ struct Monster Vec3 position; std::vector powers; }; + namespace YAML { template<> @@ -71,6 +75,7 @@ struct convert return true; } }; + template<> struct convert { @@ -89,6 +94,7 @@ struct convert return true; } }; + template<> struct convert { @@ -108,7 +114,7 @@ struct convert rhs.name = node["name"].as(); rhs.position = node["position"].as(); const YAML::Node& powers = node["powers"]; - for (const auto power : powers) + for (const auto power: powers) { rhs.powers.push_back(power.as()); } diff --git a/src/tests/src/solver/infeasible-problem-analysis/test-unfeasible-problem-analyzer.cpp b/src/tests/src/solver/infeasible-problem-analysis/test-unfeasible-problem-analyzer.cpp index 5f10a75879..321bd4b3e7 100644 --- a/src/tests/src/solver/infeasible-problem-analysis/test-unfeasible-problem-analyzer.cpp +++ b/src/tests/src/solver/infeasible-problem-analysis/test-unfeasible-problem-analyzer.cpp @@ -21,10 +21,11 @@ #define WIN32_LEAN_AND_MEAN #define BOOST_TEST_MODULE unfeasible_problem_analyzer +#include + #include #include #include -#include #include "antares/solver/infeasible-problem-analysis/constraint-slack-analysis.h" #include "antares/solver/infeasible-problem-analysis/unfeasible-pb-analyzer.h" diff --git a/src/tests/src/solver/simulation/test-hydro-final-reservoir-level-functions.cpp b/src/tests/src/solver/simulation/test-hydro-final-reservoir-level-functions.cpp index 70e4b62357..e426d99da4 100644 --- a/src/tests/src/solver/simulation/test-hydro-final-reservoir-level-functions.cpp +++ b/src/tests/src/solver/simulation/test-hydro-final-reservoir-level-functions.cpp @@ -14,16 +14,16 @@ using namespace Antares::Solver; using namespace Antares::Data; - struct Fixture { Fixture(const Fixture& f) = delete; Fixture(const Fixture&& f) = delete; Fixture& operator=(const Fixture& f) = delete; Fixture& operator=(const Fixture&& f) = delete; + Fixture() { - // Simulation last day must be 365 so that final level checks succeeds + // Simulation last day must be 365 so that final level checks succeeds study->parameters.simulationDays.end = 365; study->parameters.firstMonthInYear = january; uint nbYears = study->parameters.nbYears = 2; @@ -57,7 +57,6 @@ struct Fixture area_1->hydro.deltaBetweenFinalAndInitialLevels.resize(nbYears); area_2->hydro.deltaBetweenFinalAndInitialLevels.resize(nbYears); - // Scenario builder for initial and final reservoir levels // ------------------------------------------------------- uint areasCount = study->areas.size(); @@ -97,7 +96,7 @@ struct Fixture // ... Area 2 : Inflows time series area_2->hydro.series->storage.resize(nbInflowTS, 365); area_2->hydro.series->storage.timeSeries.fill(300.); - area_2->hydro.series->storage[0][0] = 300. + 1.; //DAYS_PER_YEAR + area_2->hydro.series->storage[0][0] = 300. + 1.; // DAYS_PER_YEAR area_2->hydro.series->storage[0][DAYS_PER_YEAR - 1] = 300. + 2.; } @@ -179,7 +178,8 @@ BOOST_AUTO_TEST_CASE(final_level_not_set_by_user____check_succeeds_but_final_lev BOOST_CHECK_EQUAL(validator.finalLevelFineForUse(), false); } -BOOST_AUTO_TEST_CASE(initial_level_month_and_simulation_first_month_different___check_fails_and_final_level_not_usable) +BOOST_AUTO_TEST_CASE( + initial_level_month_and_simulation_first_month_different___check_fails_and_final_level_not_usable) { uint year = 0; area_1->hydro.initializeReservoirLevelDate = 3; // initialize reservoir level != January @@ -234,7 +234,8 @@ BOOST_AUTO_TEST_CASE(final_level_out_of_rule_curves___check_fails_and_final_leve BOOST_CHECK_EQUAL(validator.finalLevelFineForUse(), false); } -BOOST_AUTO_TEST_CASE(final_level_unreachable_because_of_too_few_inflows___check_fails_and_final_level_not_usable) +BOOST_AUTO_TEST_CASE( + final_level_unreachable_because_of_too_few_inflows___check_fails_and_final_level_not_usable) { area_1->hydro.reservoirCapacity = 185000; uint year = 0; @@ -258,7 +259,7 @@ BOOST_AUTO_TEST_CASE(final_level_unreachable_because_of_too_few_inflows___check_ BOOST_AUTO_TEST_CASE(check_all_areas_final_levels_when_config_is_ok___all_checks_succeed) { - for (uint year : {0, 1}) + for (uint year: {0, 1}) { CheckFinalReservoirLevelsConfiguration(study->areas, study->parameters, diff --git a/src/tools/ts-generator/main.cpp b/src/tools/ts-generator/main.cpp index 60ad9dd720..b1fabf2ff7 100644 --- a/src/tools/ts-generator/main.cpp +++ b/src/tools/ts-generator/main.cpp @@ -133,13 +133,13 @@ LinkPairs extractLinkNamesFromStudy(fs::path studyDir) { LinkPairs to_return; fs::path linksDir = studyDir / "input" / "links"; - for (auto const& item : fs::directory_iterator{linksDir}) + for (const auto& item: fs::directory_iterator{linksDir}) { if (item.is_directory()) { std::string sourceAreaName = item.path().filename().generic_string(); auto targetAreas = extractTargetAreas(item); - for (auto& targetAreaName : targetAreas) + for (auto& targetAreaName: targetAreas) { auto linkPair = std::make_pair(sourceAreaName, targetAreaName); to_return.push_back(linkPair); @@ -152,25 +152,26 @@ LinkPairs extractLinkNamesFromStudy(fs::path studyDir) bool pairs_match(const LinkPair& p1, const LinkPair& p2) { return (p1.first == p2.first && p1.second == p2.second) - || (p1.first == p2.second && p1.second == p2.first); + || (p1.first == p2.second && p1.second == p2.first); } const LinkPair* getMatchingPairInCollection(const LinkPair& pair, const LinkPairs& collection) { - for(const auto& p : collection) + for (const auto& p: collection) { if (pairs_match(pair, p)) + { return &p; + } } return nullptr; } -LinkPairs extractLinkNamesFromCmdLine(const LinkPairs& allLinks, - const std::string linksFromCmdLine) +LinkPairs extractLinkNamesFromCmdLine(const LinkPairs& allLinks, const std::string linksFromCmdLine) { LinkPairs to_return; LinkPairs pairsFromCmdLine = splitStringIntoPairs(linksFromCmdLine, ';', '.'); - for (auto& p : pairsFromCmdLine) + for (auto& p: pairsFromCmdLine) { if (const auto* found_pair = getMatchingPairInCollection(p, allLinks); found_pair) { @@ -198,9 +199,11 @@ bool readLinkGeneralProperty(StudyParamsForLinkTS& params, } if (key == "seed-tsgen-links") { - unsigned int seed {0}; - if (! value.to(seed)) + unsigned int seed{0}; + if (!value.to(seed)) + { return false; + } params.random.reset(seed); return true; } @@ -218,14 +221,16 @@ StudyParamsForLinkTS readGeneralParamsForLinksTS(fs::path studyDir) // Skipping sections useless in the current context Yuni::String sectionName = section->name; if (sectionName != "general" && sectionName != "seeds - Mersenne Twister") + { continue; + } for (const IniFile::Property* p = section->firstProperty; p; p = p->next) { - if (! readLinkGeneralProperty(to_return, p->key, p->value)) + if (!readLinkGeneralProperty(to_return, p->key, p->value)) { - logs.warning() << ini.filename() << ": reading value of '" - << p->key << "' went wrong"; + logs.warning() << ini.filename() << ": reading value of '" << p->key + << "' went wrong"; } } } @@ -236,7 +241,7 @@ std::vector CreateLinkList(const LinkPairs& linksFromCmd { std::vector to_return; to_return.reserve(linksFromCmdLine.size()); - for (const auto& link_pair : linksFromCmdLine) + for (const auto& link_pair: linksFromCmdLine) { LinkTSgenerationParams params; params.namesPair = link_pair; @@ -248,10 +253,12 @@ std::vector CreateLinkList(const LinkPairs& linksFromCmd LinkTSgenerationParams* findLinkInList(const LinkPair& link_to_find, std::vector& linkList) { - for(auto& link : linkList) + for (auto& link: linkList) { if (link.namesPair == link_to_find) + { return &link; + } } return nullptr; } @@ -297,16 +304,15 @@ bool readLinkIniProperty(LinkTSgenerationParams* link, return true; } -void readLinkIniProperties(LinkTSgenerationParams* link, - IniFile::Section* section) +void readLinkIniProperties(LinkTSgenerationParams* link, IniFile::Section* section) { for (const IniFile::Property* p = section->firstProperty; p; p = p->next) { - if (! readLinkIniProperty(link, p->key, p->value)) + if (!readLinkIniProperty(link, p->key, p->value)) { std::string linkName = link->namesPair.first + "." + link->namesPair.second; - logs.warning() << "Link '" << linkName << "' : reading value of '" - << p->key << "' went wrong"; + logs.warning() << "Link '" << linkName << "' : reading value of '" << p->key + << "' went wrong"; link->hasValidData = false; } } @@ -331,7 +337,7 @@ void readSourceAreaIniFile(fs::path pathToIni, void readIniProperties(std::vector& linkList, fs::path toLinksDir) { - for(auto& link : linkList) + for (auto& link: linkList) { std::string sourceAreaName = link.namesPair.first; fs::path pathToIni = toLinksDir / sourceAreaName / "properties.ini"; @@ -339,8 +345,7 @@ void readIniProperties(std::vector& linkList, fs::path t } } -bool readLinkPreproTimeSeries(LinkTSgenerationParams& link, - fs::path sourceAreaDir) +bool readLinkPreproTimeSeries(LinkTSgenerationParams& link, fs::path sourceAreaDir) { bool to_return = true; const auto preproId = link.namesPair.first + "/" + link.namesPair.second; @@ -353,21 +358,19 @@ bool readLinkPreproTimeSeries(LinkTSgenerationParams& link, if (fs::exists(preproFile)) { to_return = link.prepro->data.loadFromCSVFile( - preproFile.string(), - Data::PreproAvailability::preproAvailabilityMax, - DAYS_PER_YEAR) - && link.prepro->validate() - && to_return; + preproFile.string(), + Data::PreproAvailability::preproAvailabilityMax, + DAYS_PER_YEAR) + && link.prepro->validate() && to_return; } auto modulationFileDirect = preproFileRoot; modulationFileDirect += "_mod_direct.txt"; if (fs::exists(modulationFileDirect)) { - to_return = link.modulationCapacityDirect.loadFromCSVFile( - modulationFileDirect.string(), - 1, - HOURS_PER_YEAR) + to_return = link.modulationCapacityDirect.loadFromCSVFile(modulationFileDirect.string(), + 1, + HOURS_PER_YEAR) && to_return; } @@ -375,10 +378,9 @@ bool readLinkPreproTimeSeries(LinkTSgenerationParams& link, modulationFileIndirect += "_mod_indirect.txt"; if (fs::exists(modulationFileIndirect)) { - to_return = link.modulationCapacityIndirect.loadFromCSVFile( - modulationFileIndirect.string(), - 1, - HOURS_PER_YEAR) + to_return = link.modulationCapacityIndirect.loadFromCSVFile(modulationFileIndirect.string(), + 1, + HOURS_PER_YEAR) && to_return; } // Makes possible a skip of TS generation when time comes @@ -386,17 +388,16 @@ bool readLinkPreproTimeSeries(LinkTSgenerationParams& link, return to_return; } -void readPreproTimeSeries(std::vector& linkList, - fs::path toLinksDir) +void readPreproTimeSeries(std::vector& linkList, fs::path toLinksDir) { - for(auto& link : linkList) + for (auto& link: linkList) { std::string sourceAreaName = link.namesPair.first; fs::path sourceAreaDir = toLinksDir / sourceAreaName; - if (! readLinkPreproTimeSeries(link, sourceAreaDir)) + if (!readLinkPreproTimeSeries(link, sourceAreaDir)) { - logs.warning() << "Could not load all prepro data for link '" - << link.namesPair.first << "." << link.namesPair.second << "'"; + logs.warning() << "Could not load all prepro data for link '" << link.namesPair.first + << "." << link.namesPair.second << "'"; } } } @@ -416,6 +417,7 @@ std::string DateAndTime() Yuni::DateTime::TimestampToString(to_return, "%Y%m%d-%H%M", now); return to_return.to(); } + // ============================================================================ int main(int argc, char* argv[]) @@ -500,10 +502,11 @@ int main(int argc, char* argv[]) // ============ LINKS : Getting data for generating LINKS time-series ===== auto allLinksPairs = extractLinkNamesFromStudy(settings.studyFolder); - auto linksFromCmdLine = extractLinkNamesFromCmdLine(allLinksPairs, - settings.linksListToGen); + auto linksFromCmdLine = extractLinkNamesFromCmdLine(allLinksPairs, settings.linksListToGen); if (settings.allLinks) + { linksFromCmdLine = allLinksPairs; + } StudyParamsForLinkTS generalParams = readGeneralParamsForLinksTS(settings.studyFolder); @@ -525,4 +528,4 @@ int main(int argc, char* argv[]) && ret; return !ret; // return 0 for success -} \ No newline at end of file +}