diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index 330df8e719..a90909e352 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -2,11 +2,12 @@ name: Centos7 CI (push and/or release) on: release: - types: [created] + types: [ created ] push: branches: - develop - dependabot/* + - feature/reserve_model_lot3_scalian schedule: - cron: '21 2 * * *' workflow_call: @@ -29,135 +30,103 @@ jobs: build: name: Build - env: - ORTOOLSDIR: ${{ github.workspace }}/or-tools runs-on: ubuntu-latest - container: 'antaresrte/rte-antares:centos7-simulator-no-deps' steps: - - name: Checkout - run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b ${{ env.REF }} . - - - name: Install gcc 10 - run: | - # update mirrors, official centos7 is deprecated - sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\ - sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo &&\ - sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo &&\ - yum update -y - - # not a typo, centos-release-scl is needed to install devtoolset-10 but introduce deprecated mirror - sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\ - sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo &&\ - sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo - - yum install -y centos-release-scl - yum install -y devtoolset-11-gcc* - - - name: Install cmake 3.28 - run: pip3 install cmake==3.28.4 - - - name: Install VCPKG - # Note: we need to use environment variables instead of workflow variables - # because github messes up path variables when running in container, - # see https://github.com/actions/runner/issues/2058 - run: | - git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics - echo "VCPKG_ROOT=$GITHUB_WORKSPACE/vcpkg" >> $GITHUB_ENV - echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV - echo "VCPKG_BINARY_SOURCES=clear;files,$GITHUB_WORKSPACE/vcpkg_cache,readwrite" >> $GITHUB_ENV - - - name: Restore vcpkg binary dir from cache - id: cache-vcpkg-binary - # Note: we are stuck with v3, because v4 is not compatible with oracle8 image - uses: actions/cache/restore@v3 - with: - path: ${{ env.VCPKG_CACHE_DIR }} - key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} - # Allows to restore a cache when deps have only partially changed (like adding a dependency) - restore-keys: vcpkg-cache-centos7- - - - name: Init submodule - run: | - git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests - - - name: Config OR-Tools URL - run: | - echo "URL_ORTOOLS=https://github.com/rte-france/or-tools-rte/releases/download/$(cat ortools_tag)/ortools_cxx_centos7_static_sirius.zip" >> $GITHUB_ENV - - - name: Download OR-Tools - id: ortools - run: | - mkdir -p ${{ env.ORTOOLSDIR }} && cd ${{ env.ORTOOLSDIR }} - wget -q -O ortools.zip ${{ env.URL_ORTOOLS }} - unzip -q ortools.zip - rm ortools.zip - - - name: Install gh if needed - if: ${{ env.IS_RELEASE == 'true' }} - run: | - wget https://github.com/cli/cli/releases/download/v2.52.0/gh_2.52.0_linux_amd64.rpm - rpm -i gh_2.52.0_linux_amd64.rpm - gh --version - - - name: Configure - run: | - source /opt/rh/devtoolset-11/enable - source /opt/rh/rh-git227/enable - cmake -B _build -S src \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DVCPKG_TARGET_TRIPLET=x64-linux-release \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ - -DBUILD_TOOLS=ON \ - -DBUILD_UI=OFF \ - -DCMAKE_PREFIX_PATH=${{ env.ORTOOLSDIR }}/install \ - - - - name: Build - run: | - source /opt/rh/devtoolset-11/enable - source /opt/rh/rh-git227/enable - cmake --build _build --config Release -j$(nproc) - ccache -s - - - name: Installer .rpm creation - run: | - cd _build - cpack -G RPM - - - name: Solver archive creation - run: | - cd _build - cmake --install . --prefix install - pushd . - cd install/bin - tar czf ../../antares-solver_centos7.tar.gz antares-solver libsirius_solver.so - popd - rm -rf install - - - name: .tar.gz creation - run: | - cd _build - cpack -G TGZ - - - name: Publish assets - if: ${{ env.IS_RELEASE == 'true' }} - env: - GITHUB_TOKEN: ${{ github.token }} - tag: ${{ github.event.inputs.release_tag }} - run: | - gh release upload "$tag" _build/*.tar.gz _build/*.rpm - - - name: Cache vcpkg binary dir - if: always() - id: save-cache-vcpkg-binary - uses: actions/cache/save@v3 - with: - path: ${{ env.VCPKG_CACHE_DIR }} - key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} + + #sparse checkout -- only needed files + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + sparse-checkout: | + docker + src/vcpkg.json + ref: ${{ env.REF }} + + - name: set env variables -- DockerFiles + run: | + echo "DOCKERFILE=$(pwd)/docker/Dockerfile" >> $GITHUB_ENV + echo "DOCKERDIR=$(pwd)/docker" >> $GITHUB_ENV + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + with: + files: | + docker/AntaresDeps + - name: Docker file push + id: docker_push + + if: steps.changed-files.outputs.any_changed == 'true' + uses: elgohr/Publish-Docker-Github-Action@main + with: + name: antaresrte/antaressystemdeps + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ${{ env.DOCKERDIR }} + dockerfile: ${{ env.DOCKERDIR }}/AntaresDeps + cache: false + tags: latest + + - name: create vcpkg cache dir + run: | + echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV + mkdir -p ${{ github.workspace }}/vcpkg_cache + - name: Restore vcpkg binary dir from cache + id: cache-vcpkg-binary + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/vcpkg_cache + key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} + # Allows to restore a cache when deps have only partially changed (like adding a dependency) + restore-keys: vcpkg-cache-centos7- + + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: centos7-on-${{ runner.os }} + + + - name: Build the image and Antares + run: | + ls -latr .ccache/ && \ + docker build \ + -t antares:centos7 \ + --build-arg="BRANCH=${{ env.REF }}" \ + --build-arg="NPROC=$(nproc)" \ + --build-arg="VCPKG_CACHE_DIR=./vcpkg_cache" \ + --build-arg CCACHE_DIR=./.ccache \ + --build-arg CCACHE_KEY=centos7-on-${{ runner.os }} \ + -f ${{ env.DOCKERFILE }} . + - name: create a container without starting it && retrieve the .tgz + run: | + container_id=$(docker create antares:centos7) + docker cp $container_id:/workspace/Antares_Simulator/_build/archive archive + docker cp $container_id:/workspace/vcpkg_cache ${{ env.VCPKG_CACHE_DIR }} + docker cp $container_id:/workspace/.ccache/. .ccache + ls -la .ccache + docker rm $container_id + - name: Publish assets + if: ${{ env.IS_RELEASE == 'true' }} + env: + GITHUB_TOKEN: ${{ github.token }} + tag: ${{ github.event.inputs.release_tag }} + run: | + gh release upload "$tag" archive/*.tar.gz archive/*.rpm + + + - name: Upload .tar.gz + uses: actions/upload-artifact@v4 + with: + path: archive/*.tar.gz + name: antares-9.2.0-rc4-CentOS-7.9.2009.tar.gz + + + - name: Cache vcpkg binary dir + if: always() + id: save-cache-vcpkg-binary + uses: actions/cache/save@v4 + with: + path: ${{ github.workspace }}/vcpkg_cache + key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} \ No newline at end of file diff --git a/src/antares-deps b/src/antares-deps new file mode 160000 index 0000000000..0d6bebfb90 --- /dev/null +++ b/src/antares-deps @@ -0,0 +1 @@ +Subproject commit 0d6bebfb901e47ec6ac1c73cb61a522803c81b98 diff --git a/src/libs/antares/study/include/antares/study/area/area.h b/src/libs/antares/study/include/antares/study/area/area.h index 81cb81c006..59eaf54ecf 100644 --- a/src/libs/antares/study/include/antares/study/area/area.h +++ b/src/libs/antares/study/include/antares/study/area/area.h @@ -87,7 +87,7 @@ class BiMap } // Function to return the size of the bimap - int size() + int size() const { return key_to_value.size(); } diff --git a/src/libs/antares/study/parts/common/cluster_list.cpp b/src/libs/antares/study/parts/common/cluster_list.cpp index 801bfe11ad..3fe23f9fc9 100644 --- a/src/libs/antares/study/parts/common/cluster_list.cpp +++ b/src/libs/antares/study/parts/common/cluster_list.cpp @@ -437,12 +437,30 @@ bool ClusterList::loadReserveParticipations(Area& area, const std::fil auto cluster = area.thermal.list.getClusterByName(tmpClusterName); if (reserve && cluster) { - ThermalClusterReserveParticipation tmpReserveParticipation{reserve.value(), - tmpMaxPower, - tmpParticipationCost, - tmpMaxPowerOff, - tmpParticipationCostOff}; - cluster.value().get()->addReserveParticipation(section.name, tmpReserveParticipation); + bool isClusterMustRun = false; + for (const auto& clusterMustRun : area.thermal.list.each_mustrun_and_enabled()) + { + if (clusterMustRun->id() == cluster.value().get()->id()) + { + isClusterMustRun = true; + break; + } + } + if (!isClusterMustRun) + { + ThermalClusterReserveParticipation tmpReserveParticipation{ reserve.value(), + tmpMaxPower, + tmpParticipationCost, + tmpMaxPowerOff, + tmpParticipationCostOff }; + + + cluster.value().get()->addReserveParticipation(section.name, tmpReserveParticipation); + } + else + { + logs.warning() << area.name << " : " << tmpClusterName << " is mustrun and is participating in capacity reservation " << section.name << ", ignored."; + } } else { diff --git a/src/solver/optimisation/opt_gestion_second_membre_reserves.cpp b/src/solver/optimisation/opt_gestion_second_membre_reserves.cpp index 7d8c150cff..3906dac0e7 100644 --- a/src/solver/optimisation/opt_gestion_second_membre_reserves.cpp +++ b/src/solver/optimisation/opt_gestion_second_membre_reserves.cpp @@ -46,15 +46,12 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaireReserves(PROBLEME_HEBDO* pro for (int pdtJour = 0, pdtHebdo = PremierPdtDeLIntervalle; pdtHebdo < DernierPdtDeLIntervalle; pdtHebdo++, pdtJour++) { + int hourInTheYear = problemeHebdo->weekInTheYear * 168 + pdtHebdo; const CORRESPONDANCES_DES_CONTRAINTES& CorrespondanceCntNativesCntOptim = problemeHebdo->CorrespondanceCntNativesCntOptim[pdtJour]; for (uint32_t pays = 0; pays < problemeHebdo->NombreDePays; pays++) { - int pdtGlobal = problemeHebdo->weekInTheYear - * problemeHebdo->NombreDePasDeTempsDUneJournee - * problemeHebdo->NombreDeJours - + pdtJour; // Thermal clusters { @@ -67,7 +64,7 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaireReserves(PROBLEME_HEBDO* pro [areaReserveUp.globalReserveIndex]; if (cnt >= 0) { - SecondMembre[cnt] = areaReserveUp.need.at(pdtGlobal); + SecondMembre[cnt] = areaReserveUp.need.at(hourInTheYear); double* adresseDuResultat = &(problemeHebdo->ResultatsHoraires[pays].Reserves[pdtHebdo].CoutsMarginauxHoraires[areaReserveUp.areaReserveIndex]); AdresseOuPlacerLaValeurDesCoutsMarginaux[cnt] = adresseDuResultat; } @@ -100,7 +97,7 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaireReserves(PROBLEME_HEBDO* pro [areaReserveDown.globalReserveIndex]; if (cnt >= 0) { - SecondMembre[cnt] = areaReserveDown.need.at(pdtGlobal); + SecondMembre[cnt] = areaReserveDown.need.at(hourInTheYear); double* adresseDuResultat = &(problemeHebdo->ResultatsHoraires[pays].Reserves[pdtHebdo].CoutsMarginauxHoraires[areaReserveDown.areaReserveIndex]); AdresseOuPlacerLaValeurDesCoutsMarginaux[cnt] = adresseDuResultat; } @@ -234,7 +231,7 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaireReserves(PROBLEME_HEBDO* pro [globalClusterIdx]; if (cnt >= 0) { - SecondMembre[cnt] = cluster.series.get()->maxWithdrawalModulation[pdtJour] + SecondMembre[cnt] = cluster.series.get()->maxWithdrawalModulation[hourInTheYear] * cluster.withdrawalNominalCapacity; AdresseOuPlacerLaValeurDesCoutsMarginaux[cnt] = nullptr; } @@ -245,7 +242,7 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaireReserves(PROBLEME_HEBDO* pro [globalClusterIdx]; if (cnt >= 0) { - SecondMembre[cnt] = cluster.series.get()->lowerRuleCurve[pdtJour] + SecondMembre[cnt] = cluster.series.get()->lowerRuleCurve[hourInTheYear] * cluster.withdrawalNominalCapacity; AdresseOuPlacerLaValeurDesCoutsMarginaux[cnt] = nullptr; } @@ -256,7 +253,7 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaireReserves(PROBLEME_HEBDO* pro [globalClusterIdx]; if (cnt >= 0) { - SecondMembre[cnt] = cluster.series.get()->maxInjectionModulation[pdtJour] + SecondMembre[cnt] = cluster.series.get()->maxInjectionModulation[hourInTheYear] * cluster.injectionNominalCapacity; AdresseOuPlacerLaValeurDesCoutsMarginaux[cnt] = nullptr; } diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOffUnitsPlant.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOffUnitsPlant.h index 6e20d3afa7..8013e799a0 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOffUnitsPlant.h +++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOffUnitsPlant.h @@ -106,7 +106,7 @@ class ReserveParticipationByDispatchableOffUnitsPlant pNbYearsParallel = study->maxNbYearsInParallel; pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel]; - // Get the area + // Get the number of Onthermal reserveParticipations pSize = area->thermal.list.reserveParticipationsCount(); if (pSize) @@ -266,12 +266,20 @@ class ReserveParticipationByDispatchableOffUnitsPlant // Write the data for the current year for (uint i = 0; i < pSize; ++i) { - auto [clusterName, reserveName] - = results.data.area->reserveParticipationThermalClustersIndexMap.get(i); - results.variableCaption = clusterName + "_" + reserveName; // VCardType::Caption(); - results.variableUnit = VCardType::Unit(); - pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport( - results, fileLevel, precision); + if (results.data.area->reserveParticipationThermalClustersIndexMap.size() == 0) //Bimap is empty + { + logs.warning() << "Problem during the results export, the thermal bimap is empty for area " << results.data.area->name; + break; + } + else + { + auto [clusterName, reserveName] + = results.data.area->reserveParticipationThermalClustersIndexMap.get(i); + results.variableCaption = clusterName + "_" + reserveName; // VCardType::Caption(); + results.variableUnit = VCardType::Unit(); + pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport( + results, fileLevel, precision); + } } } } diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOnUnitsPlant.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOnUnitsPlant.h index 7fd761806f..7a7ca8e4f9 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOnUnitsPlant.h +++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchableOnUnitsPlant.h @@ -106,7 +106,7 @@ class ReserveParticipationByDispatchableOnUnitsPlant pNbYearsParallel = study->maxNbYearsInParallel; pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel]; - // Get the area + // Get the number of Onthermal reserveParticipations pSize = area->thermal.list.reserveParticipationsCount(); if (pSize) @@ -266,12 +266,20 @@ class ReserveParticipationByDispatchableOnUnitsPlant // Write the data for the current year for (uint i = 0; i < pSize; ++i) { - auto [clusterName, reserveName] - = results.data.area->reserveParticipationThermalClustersIndexMap.get(i); - results.variableCaption = clusterName + "_" + reserveName; // VCardType::Caption(); - results.variableUnit = VCardType::Unit(); - pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport( - results, fileLevel, precision); + if (results.data.area->reserveParticipationThermalClustersIndexMap.size() == 0) //Bimap is empty + { + logs.warning() << "Problem during the results export, the thermal bimap is empty for area " << results.data.area->name; + break; + } + else + { + auto [clusterName, reserveName] + = results.data.area->reserveParticipationThermalClustersIndexMap.get(i); + results.variableCaption = clusterName + "_" + reserveName; // VCardType::Caption(); + results.variableUnit = VCardType::Unit(); + pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport( + results, fileLevel, precision); + } } } } diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchablePlant.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchablePlant.h index d184239ccf..863e203898 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchablePlant.h +++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByDispatchablePlant.h @@ -106,16 +106,8 @@ class ReserveParticipationByDispatchableOnUnitsPlant pNbYearsParallel = study->maxNbYearsInParallel; pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel]; - // Get the area - pSize = 0; - for (int areaIndex = 0; areaIndex < study->areas.size(); areaIndex++) - { - if (study->areas[areaIndex]->allCapacityReservations.size() > 0) - { - pSize = area->thermal.list.reserveParticipationsCount(); - break; - } - } + // Get the number of thermal reserveParticipations + pSize = area->thermal.list.reserveParticipationsCount(); if (pSize) { AncestorType::pResults.resize(pSize); diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByLTStorage.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByLTStorage.h index bf7e14a412..3801d606f6 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByLTStorage.h +++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationByLTStorage.h @@ -67,11 +67,8 @@ class ReserveParticipationByLTStorage pNbYearsParallel = study->maxNbYearsInParallel; pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel]; - pSize = 0; - for (int areaIndex = 0; areaIndex < study->areas.size(); areaIndex++) - { - pSize += study->areas[areaIndex]->hydro.reserveParticipationsCount(); - } + // Get the number of LTStorage reserveParticipations + pSize = area->hydro.reserveParticipationsCount(); if (pSize) { AncestorType::pResults.resize(pSize); @@ -202,11 +199,19 @@ void localBuildAnnualSurveyReport(SurveyResults& results, assert(NULL != results.data.area); for (uint i = 0; i < pSize; ++i) { - auto reserveName = results.data.area->reserveParticipationLTStorageIndexMap.get(i); - results.variableCaption = "LongTermStorage_" + reserveName; // VCardType::Caption(); - results.variableUnit = VCardType::Unit(); - pValuesForTheCurrentYear[numSpace][0].template buildAnnualSurveyReport( - results, fileLevel, precision); + if (results.data.area->reserveParticipationLTStorageIndexMap.size() == 0) //Bimap in empty + { + logs.warning() << "Problem during the results export, the LTS bimap is empty for area " << results.data.area->name; + break; + } + else + { + auto reserveName = results.data.area->reserveParticipationLTStorageIndexMap.get(i); + results.variableCaption = "LongTermStorage_" + reserveName; // VCardType::Caption(); + results.variableUnit = VCardType::Unit(); + pValuesForTheCurrentYear[numSpace][0].template buildAnnualSurveyReport( + results, fileLevel, precision); + } } } } diff --git a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationBySTStorage.h b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationBySTStorage.h index 14794d4929..3950885e7c 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationBySTStorage.h +++ b/src/solver/variable/include/antares/solver/variable/economy/reserveParticipationBySTStorage.h @@ -105,16 +105,8 @@ class ReserveParticipationBySTStorage pNbYearsParallel = study->maxNbYearsInParallel; pValuesForTheCurrentYear = new VCardType::IntermediateValuesBaseType[pNbYearsParallel]; - // Get the area - pSize = 0; - for (int areaIndex = 0; areaIndex < study->areas.size(); areaIndex++) - { - if (study->areas[areaIndex]->allCapacityReservations.size() > 0) - { - pSize = area->shortTermStorage.reserveParticipationsCount(); - break; - } - } + // Get the number of STStorage reserveParticipations + pSize = area->shortTermStorage.reserveParticipationsCount(); if (pSize) { AncestorType::pResults.resize(pSize); @@ -266,13 +258,21 @@ class ReserveParticipationBySTStorage // Write the data for the current year for (uint i = 0; i < pSize; ++i) { - auto [clusterName, reserveName] - = results.data.area->reserveParticipationSTStorageClustersIndexMap.get(i); - // Write the data for the current year - results.variableCaption = clusterName + "_" + reserveName; // VCardType::Caption(); - results.variableUnit = VCardType::Unit(); - pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport( - results, fileLevel, precision); + if (results.data.area->reserveParticipationSTStorageClustersIndexMap.size() == 0) //Bimap in empty + { + logs.warning() << "Problem during the results export, the STS bimap is empty for area " << results.data.area->name; + break; + } + else + { + auto [clusterName, reserveName] + = results.data.area->reserveParticipationSTStorageClustersIndexMap.get(i); + // Write the data for the current year + results.variableCaption = clusterName + "_" + reserveName; // VCardType::Caption(); + results.variableUnit = VCardType::Unit(); + pValuesForTheCurrentYear[numSpace][i].template buildAnnualSurveyReport( + results, fileLevel, precision); + } } } } diff --git a/src/solver/variable/include/antares/solver/variable/state.hxx b/src/solver/variable/include/antares/solver/variable/state.hxx index dadb3f82d6..9c16d562fe 100644 --- a/src/solver/variable/include/antares/solver/variable/state.hxx +++ b/src/solver/variable/include/antares/solver/variable/state.hxx @@ -95,7 +95,8 @@ inline void State::initFromAreaIndex(const unsigned int areaIndex, uint numSpace for (int h=0 ; h< HOURS_PER_YEAR; h++) { reserveParticipationPerLTStorageClusterForYear[hourInTheYear].clear(); - + reserveParticipationPerSTStorageClusterForYear[hourInTheYear].clear(); + reserveParticipationPerThermalClusterForYear[hourInTheYear].clear(); } } switch (simulationMode)