From e5bb73adc1720c1783c4db56f4c57c4324de2b84 Mon Sep 17 00:00:00 2001 From: NikolaIlic Date: Tue, 3 Oct 2023 21:23:06 +0200 Subject: [PATCH] Ternary operator check index excluded --- src/solver/simulation/sim_calcul_economique.cpp | 13 ++++++------- src/solver/variable/economy/max-mrg.cpp | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/solver/simulation/sim_calcul_economique.cpp b/src/solver/simulation/sim_calcul_economique.cpp index d17fd4950b..40bcd41846 100644 --- a/src/solver/simulation/sim_calcul_economique.cpp +++ b/src/solver/simulation/sim_calcul_economique.cpp @@ -571,15 +571,14 @@ void SIM_RenseignementProblemeHebdo(const Study& study, auto& ror = area.hydro.series->ror; auto& maxHourlyGenPowerMatrix = area.hydro.series->maxHourlyGenPower; - auto const& srcMaxHourlyGenPower - = maxHourlyGenPowerMatrix[tsIndexMaxPower < maxHourlyGenPowerMatrix.width ? tsIndexMaxPower : 0]; - auto const& ContrainteDePmaxHydrauliqueHoraire = srcMaxHourlyGenPower[PasDeTempsDebut + hourInWeek]; + auto const& maxHourlyGenPowerTS + = maxHourlyGenPowerMatrix[tsIndexMaxPower]; + auto const& ContrainteDePmaxHydrauliqueHoraire = maxHourlyGenPowerTS[PasDeTempsDebut + hourInWeek]; auto& maxHourlyPumpPowerMatrix = area.hydro.series->maxHourlyPumpPower; - auto const& srcMaxHourlyPumpPower - = maxHourlyPumpPowerMatrix[tsIndexMaxPower < maxHourlyPumpPowerMatrix.width ? tsIndexMaxPower - : 0]; - auto const& ContrainteDePmaxPompageHoraire = srcMaxHourlyPumpPower[PasDeTempsDebut + hourInWeek]; + auto const& maxHourlyPumpPowerTS + = maxHourlyPumpPowerMatrix[tsIndexMaxPower]; + auto const& ContrainteDePmaxPompageHoraire = maxHourlyPumpPowerTS[PasDeTempsDebut + hourInWeek]; assert(&scratchpad); assert((uint)hourInYear < scratchpad.ts.load.height); diff --git a/src/solver/variable/economy/max-mrg.cpp b/src/solver/variable/economy/max-mrg.cpp index a1eb79b92f..f522e52259 100644 --- a/src/solver/variable/economy/max-mrg.cpp +++ b/src/solver/variable/economy/max-mrg.cpp @@ -135,7 +135,7 @@ inline void PrepareMaxMRGFor(const State& state, double* opmrg, uint numSpace) // Pmax uint tsIndex = (NumeroChroniquesTireesParPays[numSpace][index]).HydroMaxPower; auto& maxHourlyGenPowerMatrix = area.hydro.series->maxHourlyGenPower; - const auto& P = maxHourlyGenPowerMatrix[tsIndex < maxHourlyGenPowerMatrix.width ? tsIndex : 0]; + const auto& P = maxHourlyGenPowerMatrix[tsIndex]; do {