From 1157ea56ccd92b4870a72bc2d3b7f6957c5be522 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Thu, 21 Sep 2023 14:47:53 +0200 Subject: [PATCH] [DEV] Removed file surtubines --- src/solver/hydro/CMakeLists.txt | 1 - src/solver/hydro/daily/h2o_j_fonctions.h | 1 - .../daily/h2o_j_lisser_les_sur_turbines.cpp | 123 ------------------ .../hydro/daily/h2o_j_optimiser_un_mois.cpp | 1 - .../simulation/sim_alloc_probleme_hebdo.cpp | 11 +- 5 files changed, 4 insertions(+), 133 deletions(-) delete mode 100644 src/solver/hydro/daily/h2o_j_lisser_les_sur_turbines.cpp diff --git a/src/solver/hydro/CMakeLists.txt b/src/solver/hydro/CMakeLists.txt index d9ca51acd2e..a2354490984 100644 --- a/src/solver/hydro/CMakeLists.txt +++ b/src/solver/hydro/CMakeLists.txt @@ -12,7 +12,6 @@ set(SRC_EXT_SOLVER_H2O_DAILY daily/h2o_j_instanciation.cpp daily/h2o_j_optimiser_un_mois.cpp daily/h2o_j_resoudre_le_probleme_lineaire.cpp - daily/h2o_j_lisser_les_sur_turbines.cpp daily/h2o_j_sys.h daily/h2o_j_ajouter_bruit_au_cout.cpp ) diff --git a/src/solver/hydro/daily/h2o_j_fonctions.h b/src/solver/hydro/daily/h2o_j_fonctions.h index 5614e98d12c..ea802e544e6 100644 --- a/src/solver/hydro/daily/h2o_j_fonctions.h +++ b/src/solver/hydro/daily/h2o_j_fonctions.h @@ -52,7 +52,6 @@ void H2O_j_ConstruireLesVariables(int, void H2O_J_InitialiserLesBornesdesVariables(DONNEES_MENSUELLES*, int); void H2O_J_InitialiserLeSecondMembre(DONNEES_MENSUELLES*, int); void H2O_J_ResoudreLeProblemeLineaire(DONNEES_MENSUELLES*, int); -void H2O_J_LisserLesSurTurbines(DONNEES_MENSUELLES*, int); void H2O_J_AjouterBruitAuCout(DONNEES_MENSUELLES&); #endif /* __SOLVER_H2O_J_FONCTIONS__ */ diff --git a/src/solver/hydro/daily/h2o_j_lisser_les_sur_turbines.cpp b/src/solver/hydro/daily/h2o_j_lisser_les_sur_turbines.cpp deleted file mode 100644 index bfde29ddc11..00000000000 --- a/src/solver/hydro/daily/h2o_j_lisser_les_sur_turbines.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* -** 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 -*/ - -#include "h2o_j_donnees_mensuelles.h" -#include "h2o_j_fonctions.h" - -#define ZERO 1.e-9 - -void H2O_J_LisserLesSurTurbines(DONNEES_MENSUELLES* DonneesMensuelles, int NumeroDeProbleme) -{ - PROBLEME_HYDRAULIQUE& ProblemeHydraulique = DonneesMensuelles->ProblemeHydraulique; - - std::vector& TurbineMax = DonneesMensuelles->TurbineMax; - std::vector& Turbine = DonneesMensuelles->Turbine; - std::vector& TurbineCible = DonneesMensuelles->TurbineCible; - - char* Flag = (char*) ProblemeHydraulique.ProblemeLineairePartieVariable[NumeroDeProbleme].Xmax.data(); - - const int NbPdt = ProblemeHydraulique.NbJoursDUnProbleme[NumeroDeProbleme]; - - double SurTurbineARepartir = 0.0; - for (int Pdt = 0; Pdt < NbPdt; Pdt++) - { - Flag[Pdt] = 0; - if (Turbine[Pdt] - TurbineCible[Pdt] > ZERO) - Flag[Pdt] = 1; - } - - for (int Pdt = 0; Pdt < NbPdt; Pdt++) - { - if (Flag[Pdt] == 1) - SurTurbineARepartir += Turbine[Pdt] - TurbineCible[Pdt]; - } - - for (int Pdt = 0; Pdt < NbPdt; Pdt++) - Flag[Pdt] = 0; - for (int Pdt = 0; Pdt < NbPdt; Pdt++) - { - if (TurbineMax[Pdt] - TurbineCible[Pdt] > ZERO) - Flag[Pdt] = 1; - } - - int NbCycles = 0; -BoucleDeRepartition: - - int Np = 0; - for (int Pdt = 0; Pdt < NbPdt; Pdt++) - { - if (Flag[Pdt] == 1) - Np++; - } - if (Np <= 0) - { - return; - } - - double MargeMin = 0.; - for (int Pdt = 0; Pdt < NbPdt; Pdt++) - MargeMin += TurbineMax[Pdt]; - for (int Pdt = 0; Pdt < NbPdt; Pdt++) - { - if (Flag[Pdt] == 1) - { - if (TurbineMax[Pdt] - TurbineCible[Pdt] < MargeMin) - MargeMin = TurbineMax[Pdt] - TurbineCible[Pdt]; - } - } - - double Xmoy = SurTurbineARepartir / Np; - double SurTurbine; - if (Xmoy <= MargeMin) - SurTurbine = Xmoy; - else - SurTurbine = MargeMin; - - char LimiteAtteinte = 0; - for (int Pdt = 0; Pdt < NbPdt; Pdt++) - { - if (Flag[Pdt] == 0) - continue; - - Turbine[Pdt] = TurbineCible[Pdt] + SurTurbine; - if (TurbineMax[Pdt] - Turbine[Pdt] <= ZERO) - { - SurTurbineARepartir -= SurTurbine; - LimiteAtteinte = 1; - Flag[Pdt] = 0; - } - } - - if (LimiteAtteinte == 1 && SurTurbineARepartir > 0.0) - { - NbCycles++; - if (NbCycles <= NbPdt) - goto BoucleDeRepartition; - } - - return; -} diff --git a/src/solver/hydro/daily/h2o_j_optimiser_un_mois.cpp b/src/solver/hydro/daily/h2o_j_optimiser_un_mois.cpp index 73caf5b7cfe..e7fe85c2bc4 100644 --- a/src/solver/hydro/daily/h2o_j_optimiser_un_mois.cpp +++ b/src/solver/hydro/daily/h2o_j_optimiser_un_mois.cpp @@ -52,7 +52,6 @@ void H2O_J_OptimiserUnMois(DONNEES_MENSUELLES* DonneesMensuelles) H2O_J_InitialiserLeSecondMembre(DonneesMensuelles, NumeroDeProbleme); H2O_J_InitialiserLesBornesdesVariables(DonneesMensuelles, NumeroDeProbleme); H2O_J_ResoudreLeProblemeLineaire(DonneesMensuelles, NumeroDeProbleme); - H2O_J_LisserLesSurTurbines(DonneesMensuelles, NumeroDeProbleme); return; } diff --git a/src/solver/simulation/sim_alloc_probleme_hebdo.cpp b/src/solver/simulation/sim_alloc_probleme_hebdo.cpp index 9ab9a81b1d5..1ee6368a56a 100644 --- a/src/solver/simulation/sim_alloc_probleme_hebdo.cpp +++ b/src/solver/simulation/sim_alloc_probleme_hebdo.cpp @@ -128,15 +128,12 @@ void SIM_AllocationProblemeDonneesGenerales(PROBLEME_HEBDO& problem, problem.previousYearFinalLevels.resize(0); if (problem.hydroHotStart) { - for (uint i = 0; i <= nbPays; i++) + if (std::any_of(study.areas.cbegin(), study.areas.cend(), [](const auto& pair) + { return pair.second->hydro.reservoirManagement; })) { - auto& area = *(study.areas[i]); - if (area.hydro.reservoirManagement) - { - problem.previousYearFinalLevels.assign(nbPays, 0.); - break; - } + problem.previousYearFinalLevels.assign(nbPays, 0.); } + } problem.ReserveJMoins1.resize(nbPays);