From 472542a3d4748a872c011dcb08c2279eefa844d3 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Mon, 9 Dec 2024 17:48:54 +0100 Subject: [PATCH 01/13] v8.8.12-rc1 --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb93c068fb..bae23cde60 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # Version set(ANTARES_VERSION_HI 8) set(ANTARES_VERSION_LO 8) -set(ANTARES_VERSION_REVISION 11) +set(ANTARES_VERSION_REVISION 12) # Beta release set(ANTARES_BETA 0) -set(ANTARES_RC 0) +set(ANTARES_RC 1) set(ANTARES_VERSION_YEAR 2024) From b5ca6c69fce9456d2da28c93debba2554c04f83b Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:50:37 +0100 Subject: [PATCH 02/13] Enable tests --- .github/workflows/ubuntu.yml | 4 ++-- .github/workflows/windows-vcpkg.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index ee335104af..217a8adc75 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -25,8 +25,8 @@ on: env: GITHUB_TOKEN: ${{ github.token }} IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} - RUN_SIMPLE_TESTS: false - RUN_EXTENDED_TESTS: false + RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }} + RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg vcpkgPackages: yaml-cpp antlr4 diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index dfe0b5c3ed..5cf34f7b00 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -25,8 +25,8 @@ on: env: GITHUB_TOKEN: ${{ github.token }} IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} - RUN_SIMPLE_TESTS: false - RUN_EXTENDED_TESTS: false + RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }} + RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} From ca97f68e0d1477598071a7de942302b5aefd6bac Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:46:29 +0100 Subject: [PATCH 03/13] Add MRG PRICE CSR variable --- src/solver/variable/economy/all.h | 159 +++++++------ src/solver/variable/economy/priceCSR.h | 294 +++++++++++++++++++++++++ 2 files changed, 371 insertions(+), 82 deletions(-) create mode 100644 src/solver/variable/economy/priceCSR.h diff --git a/src/solver/variable/economy/all.h b/src/solver/variable/economy/all.h index 2abbd91a14..20b90856b8 100644 --- a/src/solver/variable/economy/all.h +++ b/src/solver/variable/economy/all.h @@ -50,6 +50,7 @@ #include "renewableGeneration.h" #include "overallCost.h" #include "overallCostCsr.h" +#include "priceCSR.h" #include "operatingCost.h" #include "nonProportionalCost.h" #include "nbOfDispatchedUnits.h" @@ -129,67 +130,61 @@ class Links; /*! ** \brief All variables for a single area (economy) */ -typedef // Prices - OverallCost // Overall Cost (Op. Cost + Unsupplied Eng.) - >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +typedef // Prices + OverallCost // Overall Cost (Op. Cost + Unsupplied Eng.) + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> VariablesPerArea; /*! @@ -253,35 +248,35 @@ typedef // Prices LMRViolations, Common::SpatialAggregate< SpilledEnergy, + Common::SpatialAggregate< + LOLD, Common::SpatialAggregate< - LOLD, + LOLP, Common::SpatialAggregate< - LOLP, + AvailableDispatchGen, Common::SpatialAggregate< - AvailableDispatchGen, + DispatchableGenMargin, Common::SpatialAggregate< - DispatchableGenMargin, + DtgMarginCsr, Common::SpatialAggregate< - DtgMarginCsr, + Marge, + + // Detail Prices Common::SpatialAggregate< - Marge, + NonProportionalCost, // MBO + // 13/05/2014 + // - + // refs: + // #21 - // Detail Prices + // Number Of Dispatched Units Common::SpatialAggregate< - NonProportionalCost, // MBO - // 13/05/2014 - // - - // refs: - // #21 - - // Number Of Dispatched Units - Common::SpatialAggregate< - NbOfDispatchedUnits // MBO - // 25/02/2016 - // - - // refs: - // #55 - >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + NbOfDispatchedUnits // MBO + // 25/02/2016 + // - + // refs: + // #55 + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> VariablesPerSetOfAreas; typedef BindingConstMarginCost< // Marginal cost for a binding constraint diff --git a/src/solver/variable/economy/priceCSR.h b/src/solver/variable/economy/priceCSR.h new file mode 100644 index 0000000000..29bd98a7b4 --- /dev/null +++ b/src/solver/variable/economy/priceCSR.h @@ -0,0 +1,294 @@ +/* +** Copyright 2007-2023 RTE +** Authors: Antares_Simulator Team +** +** This file is part of Antares_Simulator. +** +** Antares_Simulator is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** There are special exceptions to the terms and conditions of the +** license as they are applied to this software. View the full text of +** the exceptions in file COPYING.txt in the directory of this software +** distribution +** +** 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 +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with Antares_Simulator. If not, see . +** +** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions +*/ +#pragma once + +#include "yuni/yuni.h" +#include "../variable.h" + +namespace Antares +{ +namespace Solver +{ +namespace Variable +{ +namespace Economy +{ +struct VCardPriceCSR +{ + //! Caption + static std::string Caption() + { + return "MRG. PRICE CSR"; + } + //! Unit + static std::string Unit() + { + return "Euro"; + } + + //! The short description of the variable + static std::string Description() + { + return "Marginal Price CSR, throughout all MC years"; + } + + //! The expecte results + typedef Results>>>> + ResultsType; + + //! The VCard to look for for calculating spatial aggregates + typedef VCardPrice VCardForSpatialAggregate; + + enum + { + //! Data Level + categoryDataLevel = Category::area, + //! File level (provided by the type of the results) + categoryFileLevel = ResultsType::categoryFile & (Category::id | Category::va), + //! Precision (views) + precision = Category::all, + //! Indentation (GUI) + nodeDepthForGUI = +0, + //! Decimal precision + decimal = 2, + //! Number of columns used by the variable (One ResultsType per column) + columnCount = 1, + //! The Spatial aggregation + spatialAggregate = Category::spatialAggregateAverage, + spatialAggregateMode = Category::spatialAggregateEachYear, + spatialAggregatePostProcessing = Category::spatialAggregatePostProcessingPrice, + //! Intermediate values + hasIntermediateValues = 1, + //! Can this variable be non applicable (0 : no, 1 : yes) + isPossiblyNonApplicable = 0, + }; + + typedef IntermediateValues IntermediateValuesBaseType; + typedef IntermediateValues* IntermediateValuesType; + + typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg; + +}; // class VCard + +/*! +** \brief Marginal Price +*/ +template +class PriceCSR : public Variable::IVariable, NextT, VCardPriceCSR> +{ +public: + //! Type of the next static variable + typedef NextT NextType; + //! VCard + typedef VCardPriceCSR VCardType; + //! Ancestor + typedef Variable::IVariable, NextT, VCardType> AncestorType; + + //! List of expected results + typedef typename VCardType::ResultsType ResultsType; + + typedef VariableAccessor VariableAccessorType; + + enum + { + //! How many items have we got + count = 1 + NextT::count, + }; + + template + struct Statistics + { + enum + { + count + = ((VCardType::categoryDataLevel & CDataLevel && VCardType::categoryFileLevel & CFile) + ? (NextType::template Statistics::count + + VCardType::columnCount * ResultsType::count) + : NextType::template Statistics::count), + }; + }; + +public: + ~PriceCSR() + { + delete[] pValuesForTheCurrentYear; + } + + void initializeFromStudy(Data::Study& study) + { + pNbYearsParallel = study.maxNbYearsInParallel; + + // Average thoughout all years + InitializeResultsFromStudy(AncestorType::pResults, study); + + // Intermediate values + pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel]; + for (unsigned int numSpace = 0; numSpace < pNbYearsParallel; numSpace++) + pValuesForTheCurrentYear[numSpace].initializeFromStudy(study); + + // Next + NextType::initializeFromStudy(study); + } + + template + static void InitializeResultsFromStudy(R& results, Data::Study& study) + { + VariableAccessorType::InitializeAndReset(results, study); + } + + void initializeFromArea(Data::Study* study, Data::Area* area) + { + // Next + NextType::initializeFromArea(study, area); + } + + void initializeFromLink(Data::Study* study, Data::AreaLink* link) + { + // Next + NextType::initializeFromAreaLink(study, link); + } + + void simulationBegin() + { + // Next + NextType::simulationBegin(); + } + + void simulationEnd() + { + NextType::simulationEnd(); + } + + void yearBegin(uint year, unsigned int numSpace) + { + // Reset the values for the current year + pValuesForTheCurrentYear[numSpace].reset(); + // Next variable + NextType::yearBegin(year, numSpace); + } + + void yearEndBuild(State& state, unsigned int year) + { + // Next variable + NextType::yearEndBuild(state, year); + } + + void yearEnd(uint year, unsigned int numSpace) + { + // Compute all statistics for the current year (daily,weekly,monthly) + pValuesForTheCurrentYear[numSpace].computeAveragesForCurrentYearFromHourlyResults(); + + // Next variable + NextType::yearEnd(year, numSpace); + } + + void computeSummary(std::map& numSpaceToYear, + unsigned int nbYearsForCurrentSummary) + { + for (unsigned int numSpace = 0; numSpace < nbYearsForCurrentSummary; ++numSpace) + { + // Merge all those values with the global results + AncestorType::pResults.merge(numSpaceToYear[numSpace] /*year*/, + pValuesForTheCurrentYear[numSpace]); + } + + // Next variable + NextType::computeSummary(numSpaceToYear, nbYearsForCurrentSummary); + } + + void hourBegin(uint hourInTheYear) + { + // Next variable + NextType::hourBegin(hourInTheYear); + } + + void hourForEachArea(State& state, unsigned int numSpace) + { + // Marginal Price + // Note: The marginal price provided by the solver is negative + // (naming convention). + + // MRG. PRICE CSR = “Unsupplied Energy Cost” ( “Unsupplied Energy Cost’ in Antares IF + + // after adq patch and DTG MRG netting UNSP. ENR CSR =/=0 ) MRG. PRICE CSR = MRG. + // PRICE_org (== “MRG. PRICE” before any adq patch IF after adq patch AND DTG MRG + // netting UNSP. ENR CSR = 0 ) + if (Yuni::Math::Zero( + state.hourlyResults->ValeursHorairesDeDefaillancePositiveCSR[state.hourInTheWeek])) + { + pValuesForTheCurrentYear[numSpace][state.hourInTheYear] + = -state.hourlyResults->CoutsMarginauxHoraires[state.hourInTheWeek]; + } + else + { + pValuesForTheCurrentYear[numSpace][state.hourInTheYear] + = state.area->thermal.unsuppliedEnergyCost; + } + // Next variable + NextType::hourForEachArea(state, numSpace); + } + + Antares::Memory::Stored::ConstReturnType retrieveRawHourlyValuesForCurrentYear( + uint, + unsigned int numSpace) const + { + return pValuesForTheCurrentYear[numSpace].hour; + } + + void localBuildAnnualSurveyReport(SurveyResults& results, + int fileLevel, + int precision, + unsigned int numSpace) const + { + // Initializing external pointer on current variable non applicable status + results.isCurrentVarNA = AncestorType::isNonApplicable; + + if (AncestorType::isPrinted[0]) + { + // Write the data for the current year + results.variableCaption = VCardType::Caption(); + results.variableUnit = VCardType::Unit(); + pValuesForTheCurrentYear[numSpace].template buildAnnualSurveyReport( + results, fileLevel, precision); + } + } + +private: + //! Intermediate values for each year + typename VCardType::IntermediateValuesType pValuesForTheCurrentYear; + unsigned int pNbYearsParallel; + +}; // class PriceCSR + +} // namespace Economy +} // namespace Variable +} // namespace Solver +} // namespace Antares From d92689a1160ffcad863cc56bf790d0c7df464558 Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:47:52 +0100 Subject: [PATCH 04/13] Exclude MRG. PRICE CSR if CSR is disabled --- src/libs/antares/study/parameters/adq-patch-params.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/antares/study/parameters/adq-patch-params.cpp b/src/libs/antares/study/parameters/adq-patch-params.cpp index 9e0f543247..30f2339bb9 100644 --- a/src/libs/antares/study/parameters/adq-patch-params.cpp +++ b/src/libs/antares/study/parameters/adq-patch-params.cpp @@ -154,6 +154,7 @@ void AdqPatchParams::addExcludedVariables(std::vector& out) const out.emplace_back("LOLP CSR"); out.emplace_back("MAX MRG CSR"); out.emplace_back("OV. COST CSR"); + out.emplace_back("MRG. PRICE CSR"); } } From c65785a54bfd018087775415a51b6e0bbe37da09 Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:00:04 +0100 Subject: [PATCH 05/13] Fix --- src/solver/variable/economy/priceCSR.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/solver/variable/economy/priceCSR.h b/src/solver/variable/economy/priceCSR.h index 29bd98a7b4..d445d541ed 100644 --- a/src/solver/variable/economy/priceCSR.h +++ b/src/solver/variable/economy/priceCSR.h @@ -27,6 +27,7 @@ #pragma once #include "yuni/yuni.h" +#include "antares/logs/logs.h" #include "../variable.h" namespace Antares @@ -241,7 +242,9 @@ class PriceCSR : public Variable::IVariable, NextT, VCardPriceCS // after adq patch and DTG MRG netting UNSP. ENR CSR =/=0 ) MRG. PRICE CSR = MRG. // PRICE_org (== “MRG. PRICE” before any adq patch IF after adq patch AND DTG MRG // netting UNSP. ENR CSR = 0 ) - if (Yuni::Math::Zero( + auto isLow = [](double x) { return ::fabs(x) < 1; }; + + if (isLow( state.hourlyResults->ValeursHorairesDeDefaillancePositiveCSR[state.hourInTheWeek])) { pValuesForTheCurrentYear[numSpace][state.hourInTheYear] @@ -249,6 +252,9 @@ class PriceCSR : public Variable::IVariable, NextT, VCardPriceCS } else { + Antares::logs.notice() + << state.area->name << " " + << state.hourlyResults->ValeursHorairesDeDefaillancePositiveCSR[state.hourInTheWeek]; pValuesForTheCurrentYear[numSpace][state.hourInTheYear] = state.area->thermal.unsuppliedEnergyCost; } From 29ff60d6382e022cf6732f6469933c3caea1052e Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:00:19 +0100 Subject: [PATCH 06/13] Revert "Enable tests" This reverts commit b5ca6c69fce9456d2da28c93debba2554c04f83b. --- .github/workflows/ubuntu.yml | 4 ++-- .github/workflows/windows-vcpkg.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 217a8adc75..ee335104af 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -25,8 +25,8 @@ on: env: GITHUB_TOKEN: ${{ github.token }} IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} - RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }} - RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} + RUN_SIMPLE_TESTS: false + RUN_EXTENDED_TESTS: false REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg vcpkgPackages: yaml-cpp antlr4 diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 5cf34f7b00..dfe0b5c3ed 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -25,8 +25,8 @@ on: env: GITHUB_TOKEN: ${{ github.token }} IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} - RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }} - RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} + RUN_SIMPLE_TESTS: false + RUN_EXTENDED_TESTS: false REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} From 2fb0402ffea24e6236455bfc20f4de52c97868aa Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:25:35 +0100 Subject: [PATCH 07/13] logs --- src/solver/variable/economy/priceCSR.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/solver/variable/economy/priceCSR.h b/src/solver/variable/economy/priceCSR.h index d445d541ed..4d9de75614 100644 --- a/src/solver/variable/economy/priceCSR.h +++ b/src/solver/variable/economy/priceCSR.h @@ -27,7 +27,6 @@ #pragma once #include "yuni/yuni.h" -#include "antares/logs/logs.h" #include "../variable.h" namespace Antares @@ -252,9 +251,6 @@ class PriceCSR : public Variable::IVariable, NextT, VCardPriceCS } else { - Antares::logs.notice() - << state.area->name << " " - << state.hourlyResults->ValeursHorairesDeDefaillancePositiveCSR[state.hourInTheWeek]; pValuesForTheCurrentYear[numSpace][state.hourInTheYear] = state.area->thermal.unsuppliedEnergyCost; } From 62deaa91e2d0af512f30fa0133d2f161a8de930c Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Tue, 17 Dec 2024 09:37:19 +0100 Subject: [PATCH 08/13] Enable tests --- .github/workflows/ubuntu.yml | 4 ++-- .github/workflows/windows-vcpkg.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index ee335104af..217a8adc75 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -25,8 +25,8 @@ on: env: GITHUB_TOKEN: ${{ github.token }} IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} - RUN_SIMPLE_TESTS: false - RUN_EXTENDED_TESTS: false + RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }} + RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg vcpkgPackages: yaml-cpp antlr4 diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index dfe0b5c3ed..5cf34f7b00 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -25,8 +25,8 @@ on: env: GITHUB_TOKEN: ${{ github.token }} IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} - RUN_SIMPLE_TESTS: false - RUN_EXTENDED_TESTS: false + RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }} + RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} From 0d7aa3fd8f1b2032becb0611bf25e81aec945204 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Tue, 17 Dec 2024 09:57:38 +0100 Subject: [PATCH 09/13] Fix comment --- src/solver/variable/economy/priceCSR.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/solver/variable/economy/priceCSR.h b/src/solver/variable/economy/priceCSR.h index 4d9de75614..9cacb8328b 100644 --- a/src/solver/variable/economy/priceCSR.h +++ b/src/solver/variable/economy/priceCSR.h @@ -232,20 +232,16 @@ class PriceCSR : public Variable::IVariable, NextT, VCardPriceCS void hourForEachArea(State& state, unsigned int numSpace) { - // Marginal Price - // Note: The marginal price provided by the solver is negative - // (naming convention). + // IF UNSP. ENR CSR == 0, MRG. PRICE CSR = MRG. PRICE + // ELSE, MRG. PRICE CSR = “Unsupplied Energy Cost” - // MRG. PRICE CSR = “Unsupplied Energy Cost” ( “Unsupplied Energy Cost’ in Antares IF - - // after adq patch and DTG MRG netting UNSP. ENR CSR =/=0 ) MRG. PRICE CSR = MRG. - // PRICE_org (== “MRG. PRICE” before any adq patch IF after adq patch AND DTG MRG - // netting UNSP. ENR CSR = 0 ) auto isLow = [](double x) { return ::fabs(x) < 1; }; if (isLow( state.hourlyResults->ValeursHorairesDeDefaillancePositiveCSR[state.hourInTheWeek])) { + // Note: The marginal price provided by the solver is negative + // (naming convention). pValuesForTheCurrentYear[numSpace][state.hourInTheYear] = -state.hourlyResults->CoutsMarginauxHoraires[state.hourInTheWeek]; } From 5b8798e9dd174e92539aee40ec334ed408a3e89c Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Tue, 17 Dec 2024 09:58:11 +0100 Subject: [PATCH 10/13] RC=2 --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bae23cde60..cfbae33088 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,7 +7,7 @@ set(ANTARES_VERSION_REVISION 12) # Beta release set(ANTARES_BETA 0) -set(ANTARES_RC 1) +set(ANTARES_RC 2) set(ANTARES_VERSION_YEAR 2024) From 3c407a24e55072b7b791cde4558514aa3efaa5a9 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Tue, 17 Dec 2024 11:39:32 +0100 Subject: [PATCH 11/13] Fix CoutsMarginauxHorairesCSR --- .../adq_patch_post_process_list.cpp | 9 ++++---- .../optimisation/post_process_commands.cpp | 22 +++++++++++++++---- .../simulation/sim_alloc_probleme_hebdo.cpp | 2 ++ .../sim_structure_probleme_economique.h | 1 + src/solver/variable/economy/priceCSR.h | 20 ++--------------- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp b/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp index 2e6ec81ab8..5f00281cca 100644 --- a/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp +++ b/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp @@ -21,11 +21,10 @@ AdqPatchPostProcessList::AdqPatchPostProcessList(const AdqPatchParams& adqPatchP problemeHebdo_, areas, sheddingPolicy, splxOptimization, thread_number)); post_process_list.push_back(std::make_unique( adqPatchParams, problemeHebdo_, areas, thread_number_)); - post_process_list.push_back(std::make_unique(problemeHebdo_, - areas, - thread_number)); - post_process_list.push_back(std::make_unique( - problemeHebdo_, areas, thread_number)); + post_process_list.push_back( + std::make_unique(problemeHebdo_, areas, thread_number)); + post_process_list.push_back( + std::make_unique(problemeHebdo_, areas, thread_number)); post_process_list.push_back( std::make_unique(problemeHebdo_, areas, true, false)); post_process_list.push_back( diff --git a/src/solver/optimisation/post_process_commands.cpp b/src/solver/optimisation/post_process_commands.cpp index 397015b46f..6eec7acca5 100644 --- a/src/solver/optimisation/post_process_commands.cpp +++ b/src/solver/optimisation/post_process_commands.cpp @@ -134,13 +134,27 @@ void UpdateMrgPriceAfterCSRcmd::execute(const optRuntimeData&) auto& hourlyResults = problemeHebdo_->ResultatsHoraires[Area]; const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_]; const double unsuppliedEnergyCost = area_list_[Area]->thermal.unsuppliedEnergyCost; - const bool areaInside = problemeHebdo_->adequacyPatchRuntimeData->areaMode[Area] == physicalAreaInsideAdqPatch; + const bool areaInside + = problemeHebdo_->adequacyPatchRuntimeData->areaMode[Area] == physicalAreaInsideAdqPatch; for (uint hour = 0; hour < nbHoursInWeek; hour++) { - const bool isHourTriggeredByCsr = problemeHebdo_->adequacyPatchRuntimeData - ->wasCSRTriggeredAtAreaHour(Area, hour); + const bool isHourTriggeredByCsr + = problemeHebdo_->adequacyPatchRuntimeData->wasCSRTriggeredAtAreaHour(Area, hour); - if (isHourTriggeredByCsr && hourlyResults.ValeursHorairesDeDefaillancePositive[hour] > 0.5 && areaInside) + // IF UNSP. ENR CSR == 0, MRG. PRICE CSR = MRG. PRICE + // ELSE, MRG. PRICE CSR = “Unsupplied Energy Cost” + if (hourlyResults.ValeursHorairesDeDefaillancePositiveCSR[hour] > 0.5 && areaInside) + { + hourlyResults.CoutsMarginauxHorairesCSR[hour] = -unsuppliedEnergyCost; + } + else + { + hourlyResults.CoutsMarginauxHorairesCSR[hour] + = hourlyResults.CoutsMarginauxHorairesCSR[hour]; + } + + if (isHourTriggeredByCsr + && hourlyResults.ValeursHorairesDeDefaillancePositive[hour] > 0.5 && areaInside) { hourlyResults.CoutsMarginauxHoraires[hour] = -unsuppliedEnergyCost; } diff --git a/src/solver/simulation/sim_alloc_probleme_hebdo.cpp b/src/solver/simulation/sim_alloc_probleme_hebdo.cpp index 5ee3b74e92..aaee139cbd 100644 --- a/src/solver/simulation/sim_alloc_probleme_hebdo.cpp +++ b/src/solver/simulation/sim_alloc_probleme_hebdo.cpp @@ -449,6 +449,8 @@ void SIM_AllocateAreas(PROBLEME_HEBDO& problem, .assign(NombreDePasDeTemps, 0.); problem.ResultatsHoraires[k].CoutsMarginauxHoraires .assign(NombreDePasDeTemps, 0.); + problem.ResultatsHoraires[k].CoutsMarginauxHorairesCSR + .assign(NombreDePasDeTemps, 0.); problem.ResultatsHoraires[k].niveauxHoraires .assign(NombreDePasDeTemps, 0.); problem.ResultatsHoraires[k].valeurH2oHoraire diff --git a/src/solver/simulation/sim_structure_probleme_economique.h b/src/solver/simulation/sim_structure_probleme_economique.h index e4326862ed..c49ae546ca 100644 --- a/src/solver/simulation/sim_structure_probleme_economique.h +++ b/src/solver/simulation/sim_structure_probleme_economique.h @@ -454,6 +454,7 @@ struct RESULTATS_HORAIRES std::vector debordementsHoraires; std::vector CoutsMarginauxHoraires; + std::vector CoutsMarginauxHorairesCSR; std::vector ProductionThermique; // index is pdtHebdo std::vector<::ShortTermStorage::RESULTS> ShortTermStorage; diff --git a/src/solver/variable/economy/priceCSR.h b/src/solver/variable/economy/priceCSR.h index 9cacb8328b..93876a5003 100644 --- a/src/solver/variable/economy/priceCSR.h +++ b/src/solver/variable/economy/priceCSR.h @@ -232,24 +232,8 @@ class PriceCSR : public Variable::IVariable, NextT, VCardPriceCS void hourForEachArea(State& state, unsigned int numSpace) { - // IF UNSP. ENR CSR == 0, MRG. PRICE CSR = MRG. PRICE - // ELSE, MRG. PRICE CSR = “Unsupplied Energy Cost” - - auto isLow = [](double x) { return ::fabs(x) < 1; }; - - if (isLow( - state.hourlyResults->ValeursHorairesDeDefaillancePositiveCSR[state.hourInTheWeek])) - { - // Note: The marginal price provided by the solver is negative - // (naming convention). - pValuesForTheCurrentYear[numSpace][state.hourInTheYear] - = -state.hourlyResults->CoutsMarginauxHoraires[state.hourInTheWeek]; - } - else - { - pValuesForTheCurrentYear[numSpace][state.hourInTheYear] - = state.area->thermal.unsuppliedEnergyCost; - } + pValuesForTheCurrentYear[numSpace][state.hourInTheYear] + = -state.hourlyResults->CoutsMarginauxHorairesCSR[state.hourInTheWeek]; // Next variable NextType::hourForEachArea(state, numSpace); } From 33da8a3fa1c14ccd04304a62ef970c870d76b89e Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Tue, 17 Dec 2024 11:54:31 +0100 Subject: [PATCH 12/13] Fix --- src/solver/optimisation/post_process_commands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solver/optimisation/post_process_commands.cpp b/src/solver/optimisation/post_process_commands.cpp index 6eec7acca5..0f177e8d9e 100644 --- a/src/solver/optimisation/post_process_commands.cpp +++ b/src/solver/optimisation/post_process_commands.cpp @@ -150,7 +150,7 @@ void UpdateMrgPriceAfterCSRcmd::execute(const optRuntimeData&) else { hourlyResults.CoutsMarginauxHorairesCSR[hour] - = hourlyResults.CoutsMarginauxHorairesCSR[hour]; + = hourlyResults.CoutsMarginauxHoraires[hour]; } if (isHourTriggeredByCsr From 5a7252ddba49ff3ff9a81a8a09ff0cf8e1e80fd4 Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Tue, 17 Dec 2024 11:54:59 +0100 Subject: [PATCH 13/13] RC=3 --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cfbae33088..4efb35468d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,7 +7,7 @@ set(ANTARES_VERSION_REVISION 12) # Beta release set(ANTARES_BETA 0) -set(ANTARES_RC 2) +set(ANTARES_RC 3) set(ANTARES_VERSION_YEAR 2024)