diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index 2c73097adb..226e8a01b0 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -171,6 +171,7 @@ jobs:
cd _build
ctest -C Release --output-on-failure -L "unit|end-to-end"
+
- name: Upload logs for failed tests
if: ${{ failure() }}
uses: actions/upload-artifact@v4
@@ -195,6 +196,23 @@ jobs:
variant: "milp-cbc"
os: ${{ env.os }}
+ - name: Run tests on adequacy patch (CSR)
+ if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
+ uses: ./.github/workflows/run-tests
+ with:
+ simtest-tag: ${{ env.SIMTEST }}
+ batch-name: adequacy-patch-CSR
+ os: ${{ env.os }}
+
+ - name: Run parallel tests
+ if: ${{ env.RUN_EXTENDED_TESTS == 'true' }}
+ uses: ./.github/workflows/run-tests
+ with:
+ simtest-tag: ${{ env.SIMTEST }}
+ batch-name: valid-parallel
+ os: ${{ env.os }}
+ variant: "parallel"
+
- name: Run tests introduced in 8.6.0
if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
@@ -248,14 +266,6 @@ jobs:
batch-name: valid-mps
os: ${{ env.os }}
- - name: Run tests for adequacy patch (CSR)
- if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }}
- uses: ./.github/workflows/run-tests
- with:
- simtest-tag: ${{ env.SIMTEST }}
- batch-name: adequacy-patch-CSR
- os: ${{ env.os }}
-
- name: Run parallel tests
if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }}
uses: ./.github/workflows/run-tests
diff --git a/simtest.json b/simtest.json
index 11b8cee038..4f6f12a31e 100644
--- a/simtest.json
+++ b/simtest.json
@@ -1,3 +1,3 @@
{
- "version": "v9.2.0g"
+ "version": "v9.2.0h"
}
diff --git a/sonar-project.properties b/sonar-project.properties
index 0c74bd252a..d4ba8cce37 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -1,3 +1,24 @@
+#
+# 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 .
+#
+
sonar.projectName=Antares_Simulator
sonar.projectKey=AntaresSimulatorTeam_Antares_Simulator
sonar.organization=antaressimulatorteam
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 56dc5e2bf8..1f0a6712b2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,10 +5,9 @@ set(ANTARES_VERSION_HI 9)
set(ANTARES_VERSION_LO 2)
set(ANTARES_VERSION_REVISION 0)
-
# Beta release
set(ANTARES_BETA 0)
-set(ANTARES_RC 7)
+set(ANTARES_RC 8)
set(ANTARES_VERSION_YEAR 2024)
@@ -192,6 +191,7 @@ endif()
find_package(Boost REQUIRED)
find_package(antlr4-runtime REQUIRED)
+find_package(yaml-cpp REQUIRED)
#Sirius solver
if(POLICY CMP0074)
diff --git a/src/api/API.cpp b/src/api/API.cpp
index 7bcda34502..63b4a9fda8 100644
--- a/src/api/API.cpp
+++ b/src/api/API.cpp
@@ -34,6 +34,7 @@ namespace Antares::API
{
SimulationResults APIInternal::run(
const IStudyLoader& study_loader,
+ const std::filesystem::path& output,
const Antares::Solver::Optimization::OptimizationOptions& optOptions)
{
try
@@ -43,9 +44,9 @@ SimulationResults APIInternal::run(
catch (const ::Antares::Error::StudyFolderDoesNotExist& e)
{
Antares::API::Error err{.reason = e.what()};
- return {.simulationPath = "", .antares_problems = {}, .error = err};
+ return {.antares_problems = {}, .error = err};
}
- return execute(optOptions);
+ return execute(output, optOptions);
}
/**
@@ -56,6 +57,7 @@ SimulationResults APIInternal::run(
* dupllication
*/
SimulationResults APIInternal::execute(
+ const std::filesystem::path& output,
const Antares::Solver::Optimization::OptimizationOptions& optOptions) const
{
// study_ == nullptr e.g when the -h flag is given
@@ -63,7 +65,7 @@ SimulationResults APIInternal::execute(
{
using namespace std::string_literals;
Antares::API::Error err{.reason = "Couldn't create study"s};
- return {.simulationPath{}, .antares_problems{}, .error = err};
+ return {.antares_problems{}, .error = err};
}
Settings settings;
@@ -75,10 +77,19 @@ SimulationResults APIInternal::execute(
auto ioQueueService = std::make_shared();
ioQueueService->maximumThreadCount(1);
ioQueueService->start();
+
+ study_->folderOutput = output;
auto resultWriter = Solver::resultWriterFactory(parameters.resultFormat,
study_->folderOutput,
ioQueueService,
durationCollector);
+
+ // In some cases (e.g tests) we don't want to write anything
+ if (!output.empty())
+ {
+ study_->saveAboutTheStudy(*resultWriter);
+ }
+
SimulationObserver simulationObserver;
optimizationInfo = simulationRun(*study_,
@@ -90,8 +101,6 @@ SimulationResults APIInternal::execute(
// Importing Time-Series if asked
study_->importTimeseriesIntoInput();
- return {.simulationPath = study_->folderOutput,
- .antares_problems = simulationObserver.acquireLps(),
- .error{}};
+ return {.antares_problems = simulationObserver.acquireLps(), .error{}};
}
} // namespace Antares::API
diff --git a/src/api/include/antares/api/SimulationResults.h b/src/api/include/antares/api/SimulationResults.h
index 5a5e93982a..31f0e9aec0 100644
--- a/src/api/include/antares/api/SimulationResults.h
+++ b/src/api/include/antares/api/SimulationResults.h
@@ -23,6 +23,7 @@
#include
#include
#include
+
#include "antares/solver/lps/LpsFromAntares.h"
namespace Antares::API
@@ -31,7 +32,8 @@ namespace Antares::API
* @struct Error
* @brief The Error structure is used to represent an error that occurred during the simulation.
*/
-struct Error {
+struct Error
+{
/**
* @brief The reason for the error.
*/
@@ -45,10 +47,6 @@ struct Error {
*/
struct [[nodiscard("Contains results and potential error")]] SimulationResults
{
- /**
- * @brief The path to the simulation (output).
- */
- std::filesystem::path simulationPath;
/**
* @brief weekly problems
*/
@@ -59,4 +57,4 @@ struct [[nodiscard("Contains results and potential error")]] SimulationResults
std::optional error;
};
-}
\ No newline at end of file
+} // namespace Antares::API
diff --git a/src/api/include/antares/api/solver.h b/src/api/include/antares/api/solver.h
index a8279c00c8..64fa13ac55 100644
--- a/src/api/include/antares/api/solver.h
+++ b/src/api/include/antares/api/solver.h
@@ -36,5 +36,6 @@ namespace Antares::API
*/
SimulationResults PerformSimulation(
const std::filesystem::path& study_path,
+ const std::filesystem::path& output,
const Antares::Solver::Optimization::OptimizationOptions& optOptions) noexcept;
} // namespace Antares::API
diff --git a/src/api/private/API.h b/src/api/private/API.h
index 3561f6d21b..c52c3304bf 100644
--- a/src/api/private/API.h
+++ b/src/api/private/API.h
@@ -48,11 +48,13 @@ class APIInternal
* @return SimulationResults object which contains the results of the simulation.
*/
SimulationResults run(const IStudyLoader& study_loader,
+ const std::filesystem::path& output,
const Antares::Solver::Optimization::OptimizationOptions& optOptions);
private:
std::shared_ptr study_;
SimulationResults execute(
+ const std::filesystem::path& output,
const Antares::Solver::Optimization::OptimizationOptions& optOptions) const;
};
diff --git a/src/api/solver.cpp b/src/api/solver.cpp
index 4e65696f8a..ac6810e7f1 100644
--- a/src/api/solver.cpp
+++ b/src/api/solver.cpp
@@ -30,18 +30,19 @@ namespace Antares::API
SimulationResults PerformSimulation(
const std::filesystem::path& study_path,
+ const std::filesystem::path& output,
const Antares::Solver::Optimization::OptimizationOptions& optOptions) noexcept
{
try
{
APIInternal api;
FileTreeStudyLoader study_loader(study_path);
- return api.run(study_loader, optOptions);
+ return api.run(study_loader, output, optOptions);
}
catch (const std::exception& e)
{
Antares::API::Error err{.reason = e.what()};
- return SimulationResults{.simulationPath = study_path, .antares_problems{}, .error = err};
+ return SimulationResults{.antares_problems{}, .error = err};
}
}
diff --git a/src/api_client_example/src/API_client.cpp b/src/api_client_example/src/API_client.cpp
index 9cb19d8e59..8ebba07042 100644
--- a/src/api_client_example/src/API_client.cpp
+++ b/src/api_client_example/src/API_client.cpp
@@ -23,7 +23,8 @@
#include
-Antares::API::SimulationResults solve(std::filesystem::path study_path)
+Antares::API::SimulationResults solve(std::filesystem::path study_path,
+ std::filesystem::path output)
{
- return Antares::API::PerformSimulation(std::move(study_path), {});
+ return Antares::API::PerformSimulation(std::move(study_path), std::move(output), {});
}
diff --git a/src/api_client_example/src/API_client.h b/src/api_client_example/src/API_client.h
index 5d8500649e..7f77a26e7f 100644
--- a/src/api_client_example/src/API_client.h
+++ b/src/api_client_example/src/API_client.h
@@ -22,7 +22,8 @@
#pragma once
-#include
#include
+#include
-Antares::API::SimulationResults solve(std::filesystem::path study_path);
+Antares::API::SimulationResults solve(std::filesystem::path study_path,
+ std::filesystem::path output);
diff --git a/src/api_client_example/tests/test.cpp b/src/api_client_example/tests/test.cpp
index 4adee7bfd6..bd5b3d86a8 100644
--- a/src/api_client_example/tests/test.cpp
+++ b/src/api_client_example/tests/test.cpp
@@ -22,10 +22,12 @@
#define BOOST_TEST_MODULE test_client_api
#include
+
#include "API_client.h"
-BOOST_AUTO_TEST_CASE(test_run) {
- auto results = solve("dummy_study_test_client_api");
+BOOST_AUTO_TEST_CASE(test_run)
+{
+ auto results = solve("dummy_study_test_client_api", {});
BOOST_CHECK(results.error);
BOOST_CHECK(!results.error->reason.empty());
auto c = results.error->reason;
@@ -34,4 +36,4 @@ BOOST_AUTO_TEST_CASE(test_run) {
BOOST_CHECK(results.error->reason.find("folder") != std::string::npos);
BOOST_CHECK(results.error->reason.find("not") != std::string::npos);
BOOST_CHECK(results.error->reason.find("exist") != std::string::npos);
-}
\ No newline at end of file
+}
diff --git a/src/ext/yuni/src/yuni/core/nonmovable.h b/src/ext/yuni/src/yuni/core/nonmovable.h
index e9214e709f..c866e916ec 100644
--- a/src/ext/yuni/src/yuni/core/nonmovable.h
+++ b/src/ext/yuni/src/yuni/core/nonmovable.h
@@ -49,11 +49,12 @@ class YUNI_DECL NonMovable
{
protected:
//! Default constructor
- NonCopyable()
+ NonMovable()
{
}
+
//! Protected non-virtual destructor
- ~NonCopyable()
+ ~NonMovable()
{
}
};
diff --git a/src/format-code.sh b/src/format-code.sh
index abac85a423..752080ca58 100755
--- a/src/format-code.sh
+++ b/src/format-code.sh
@@ -3,7 +3,7 @@
if [ $# -eq 0 ]
then
# No arguments: format all
- SOURCE_DIRS="analyzer/ libs/ solver/ tools/ config/ tests/ packaging/"
+ SOURCE_DIRS="analyzer/ libs/ solver/ tools/ config/ tests/ packaging/ api/"
SOURCE_FILES=$(find $SOURCE_DIRS -regextype egrep -regex ".*/*\.(c|cxx|cpp|cc|h|hxx|hpp)$" ! -path '*/antlr-interface/*')
else
# Format files provided as arguments
diff --git a/src/libs/antares/exception/LoadingError.cpp b/src/libs/antares/exception/LoadingError.cpp
index cea447153e..32f4b3b1c1 100644
--- a/src/libs/antares/exception/LoadingError.cpp
+++ b/src/libs/antares/exception/LoadingError.cpp
@@ -96,9 +96,8 @@ InvalidSolverSpecificParameters::InvalidSolverSpecificParameters(const std::stri
{
}
-InvalidStudy::InvalidStudy(const Yuni::String& study):
- LoadingError(std::string("The folder `") + study.c_str()
- + "` does not seem to be a valid study")
+InvalidStudy::InvalidStudy(const std::string& study):
+ LoadingError(std::string("The folder `") + study + "` does not seem to be a valid study")
{
}
diff --git a/src/libs/antares/exception/include/antares/exception/LoadingError.hpp b/src/libs/antares/exception/include/antares/exception/LoadingError.hpp
index d70820e5e9..9a5ff14002 100644
--- a/src/libs/antares/exception/include/antares/exception/LoadingError.hpp
+++ b/src/libs/antares/exception/include/antares/exception/LoadingError.hpp
@@ -140,7 +140,7 @@ class InvalidSolverSpecificParameters: public LoadingError
class InvalidStudy: public LoadingError
{
public:
- explicit InvalidStudy(const Yuni::String& study);
+ explicit InvalidStudy(const std::string& study);
};
class NoStudyProvided: public LoadingError
diff --git a/src/libs/antares/io/CMakeLists.txt b/src/libs/antares/io/CMakeLists.txt
index 9e3211e14b..dc62a95aea 100644
--- a/src/libs/antares/io/CMakeLists.txt
+++ b/src/libs/antares/io/CMakeLists.txt
@@ -12,6 +12,7 @@ source_group("io" FILES ${SRC_IO})
add_library(io
${SRC_IO}
)
+add_library(Antares::io ALIAS io)
target_link_libraries(io
PRIVATE
@@ -26,4 +27,4 @@ target_include_directories(io
install(DIRECTORY include/antares
DESTINATION "include"
-)
\ No newline at end of file
+)
diff --git a/src/libs/antares/io/include/antares/io/file.h b/src/libs/antares/io/include/antares/io/file.h
index b401b1cece..a9aed8c850 100644
--- a/src/libs/antares/io/include/antares/io/file.h
+++ b/src/libs/antares/io/include/antares/io/file.h
@@ -22,8 +22,7 @@
#define __LIBS_ANTARES_IO_FILE_H__
#include
-
-#include
+#include
namespace Antares::IO
{
diff --git a/src/libs/antares/study/CMakeLists.txt b/src/libs/antares/study/CMakeLists.txt
index 29a89fc631..e7336d020c 100644
--- a/src/libs/antares/study/CMakeLists.txt
+++ b/src/libs/antares/study/CMakeLists.txt
@@ -74,8 +74,8 @@ set(SRC_STUDY_PART_THERMAL
include/antares/study/parts/thermal/cost_provider.h
include/antares/study/parts/thermal/cluster.hxx
parts/thermal/cluster.cpp
- parts/thermal/scenarized_cost_provider.cpp
- parts/thermal/constant_cost_provider.cpp
+ parts/thermal/scenarized_cost_provider.cpp
+ parts/thermal/constant_cost_provider.cpp
include/antares/study/parts/thermal/cluster_list.h
parts/thermal/cluster_list.cpp
include/antares/study/parts/thermal/pollutant.h
@@ -102,7 +102,9 @@ set(SRC_STUDY_PART_SHORT_TERM_STORAGE
parts/short-term-storage/series.cpp
include/antares/study/parts/short-term-storage/series.h
include/antares/study/parts/short-term-storage/cluster.h
+ include/antares/study/parts/short-term-storage/AdditionalConstraint.h
parts/short-term-storage/cluster.cpp
+ parts/short-term-storage/AdditionalConstraint.cpp
)
source_group("study\\part\\short-term-storage" FILES ${SRC_STUDY_PART_SHORT_TERM_SOTRAGE})
@@ -306,12 +308,12 @@ target_link_libraries(study
)
target_include_directories(study
- PUBLIC
+ PUBLIC
$
# Make more than just study visible but it's the lesser evil for now
)
-install(DIRECTORY include/antares
+install(DIRECTORY include/antares
DESTINATION "include"
)
diff --git a/src/libs/antares/study/area/list.cpp b/src/libs/antares/study/area/list.cpp
index cf2624515f..7af3a6a5a7 100644
--- a/src/libs/antares/study/area/list.cpp
+++ b/src/libs/antares/study/area/list.cpp
@@ -1199,6 +1199,7 @@ bool AreaList::loadFromFolder(const StudyLoadOptions& options)
fs::path folder = stsFolder / "clusters" / area->id.c_str();
ret = area->shortTermStorage.createSTStorageClustersFromIniFile(folder) && ret;
+ ret = area->shortTermStorage.LoadConstraintsFromIniFile(folder) && ret;
}
}
else
diff --git a/src/libs/antares/study/include/antares/study/parts/short-term-storage/AdditionalConstraint.h b/src/libs/antares/study/include/antares/study/parts/short-term-storage/AdditionalConstraint.h
new file mode 100644
index 0000000000..e16b991a05
--- /dev/null
+++ b/src/libs/antares/study/include/antares/study/parts/short-term-storage/AdditionalConstraint.h
@@ -0,0 +1,53 @@
+/*
+ * 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 .
+ */
+
+#pragma once
+#include
+#include
+
+namespace Antares::Data::ShortTermStorage
+{
+
+struct AdditionalConstraint
+{
+ std::string name;
+ std::string cluster_id;
+ std::string variable;
+ std::string operatorType;
+ std::set hours;
+ double rhs;
+
+ unsigned int globalIndex = 0;
+
+ struct ValidateResult
+ {
+ bool ok;
+ std::string error_msg;
+ };
+
+ ValidateResult validate() const;
+
+private:
+ bool isValidVariable() const;
+ bool isValidOperatorType() const;
+ bool isValidHoursRange() const;
+};
+} // namespace Antares::Data::ShortTermStorage
diff --git a/src/libs/antares/study/include/antares/study/parts/short-term-storage/cluster.h b/src/libs/antares/study/include/antares/study/parts/short-term-storage/cluster.h
index b4074a28c8..df74a350b0 100644
--- a/src/libs/antares/study/include/antares/study/parts/short-term-storage/cluster.h
+++ b/src/libs/antares/study/include/antares/study/parts/short-term-storage/cluster.h
@@ -26,6 +26,7 @@
#include
+#include "AdditionalConstraint.h"
#include "properties.h"
#include "series.h"
@@ -35,17 +36,21 @@ class STStorageCluster
{
public:
bool enabled() const;
+
bool validate() const;
bool loadFromSection(const IniFile::Section& section);
+
bool loadSeries(const std::filesystem::path& folder) const;
void saveProperties(IniFile& ini) const;
+
bool saveSeries(const std::string& path) const;
std::string id;
std::shared_ptr series = std::make_shared();
mutable Properties properties;
+ std::vector additional_constraints;
};
} // namespace Antares::Data::ShortTermStorage
diff --git a/src/libs/antares/study/include/antares/study/parts/short-term-storage/container.h b/src/libs/antares/study/include/antares/study/parts/short-term-storage/container.h
index 90f8fafbce..d4e0233b5c 100644
--- a/src/libs/antares/study/include/antares/study/parts/short-term-storage/container.h
+++ b/src/libs/antares/study/include/antares/study/parts/short-term-storage/container.h
@@ -21,9 +21,9 @@
#pragma once
#include
-#include