Skip to content

Commit

Permalink
remove TS number global var : we don't need timeseriesNumberYear in S…
Browse files Browse the repository at this point in the history
…tudyRuntimeInfos
  • Loading branch information
guilpier-code committed Sep 12, 2023
1 parent 88c32cc commit 400c513
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 30 deletions.
19 changes: 5 additions & 14 deletions src/libs/antares/study/runtime/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,12 @@ void StudyRuntimeInfos::initializeRangeLimits(const Study& study, StudyRangeLimi
}

StudyRuntimeInfos::StudyRuntimeInfos(uint nbYearsParallel) :
nbYears(0),
parameters(nullptr),
timeseriesNumberYear(nullptr),
thermalPlantTotalCount(0),
thermalPlantTotalCountMustRun(0),
quadraticOptimizationHasFailed(false)
nbYears(0),
parameters(nullptr),
thermalPlantTotalCount(0),
thermalPlantTotalCountMustRun(0),
quadraticOptimizationHasFailed(false)
{
// Evite les confusions de numeros de TS entre AMC
timeseriesNumberYear = new uint[nbYearsParallel];
for (uint numSpace = 0; numSpace < nbYearsParallel; numSpace++)
{
timeseriesNumberYear[numSpace] = 999999;
}
}

void StudyRuntimeInfos::checkThermalTSGeneration(Study& study)
Expand Down Expand Up @@ -447,8 +440,6 @@ void StudyRuntimeInfos::removeAllRenewableClustersFromSolverComputations(Study&
StudyRuntimeInfos::~StudyRuntimeInfos()
{
logs.debug() << "Releasing runtime data";

delete[] timeseriesNumberYear;
}

#ifndef NDEBUG
Expand Down
8 changes: 0 additions & 8 deletions src/libs/antares/study/runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ class StudyRuntimeInfos
//! Random numbers generators
MersenneTwister random[seedMax];

/*!
** \brief The index to use when retrieving the time-series numbers
**
** To allow the drop of the years with no solution, we can not fully rely
** on the current year. So we have to maintain a rotating index (0..nbYears)
*/
uint* timeseriesNumberYear;

//! Total
uint thermalPlantTotalCount;
uint thermalPlantTotalCountMustRun;
Expand Down
1 change: 1 addition & 0 deletions src/solver/aleatoire/alea_fonctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@
#include "antares/study/study.h"

void ApplyRandomTSnumbers(const Antares::Data::Study& study,
unsigned int year,
uint numSpace);
9 changes: 3 additions & 6 deletions src/solver/aleatoire/alea_tirage_au_sort_chroniques.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ using namespace Antares;
using namespace Antares::Data;

void ApplyRandomTSnumbers(const Study& study,
unsigned int year,
uint numSpace)
{
auto& runtime = *study.runtime;

uint year = runtime.timeseriesNumberYear[numSpace];

// each area
const unsigned int count = study.areas.size();
for (unsigned int areaIndex = 0; areaIndex != count; ++areaIndex)
Expand Down Expand Up @@ -126,9 +123,9 @@ void ApplyRandomTSnumbers(const Study& study,
// Transmission capacities
// ------------------------------
// each link
for (unsigned int linkIndex = 0; linkIndex < runtime.interconnectionsCount(); ++linkIndex)
for (unsigned int linkIndex = 0; linkIndex < study.runtime->interconnectionsCount(); ++linkIndex)
{
AreaLink* link = runtime.areaLink[linkIndex];
AreaLink* link = study.runtime->areaLink[linkIndex];
assert(year < link->timeseriesNumbers.height);
NUMERO_CHRONIQUES_TIREES_PAR_INTERCONNEXION& ptchro
= NumeroChroniquesTireesParInterconnexion[numSpace][linkIndex];
Expand Down
3 changes: 1 addition & 2 deletions src/solver/simulation/solver.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private:

// 2 - Preparing the Time-series numbers
// We want to draw lots of numbers for time-series
ApplyRandomTSnumbers(study, numSpace);
ApplyRandomTSnumbers(study, y, numSpace);

// 3 - Preparing data related to Clusters in 'must-run' mode
simulation_->prepareClustersInMustRunMode(numSpace);
Expand Down Expand Up @@ -980,7 +980,6 @@ void ISimulation<Impl>::loopThroughYears(uint firstYear,
{
yearPerformed = true;
numSpace = set_it->performedYearToSpace[y];
study.runtime->timeseriesNumberYear[numSpace] = y;
}

// If the year has not to be rerun, we skip the computation of the year.
Expand Down

0 comments on commit 400c513

Please sign in to comment.