Skip to content

Commit

Permalink
[DEV] Remove numspace from struct HYDRO_VENTILATION_RESULTS
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Nov 2, 2023
1 parent 1b12eae commit 6f881fc
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/solver/hydro/management/daily.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ inline void HydroManagement::prepareDailyOptimalGenerations(Solver::Variable::St
auto const& maxP = maxPower[Data::PartHydro::genMaxP];
auto const& maxE = maxPower[Data::PartHydro::genMaxE];

auto& ventilationResults = ventilationResults_[numSpace][z];
auto& ventilationResults = ventilationResults_[z];

std::shared_ptr<DebugData> debugData(nullptr);

Expand Down
22 changes: 9 additions & 13 deletions src/solver/hydro/management/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,18 @@ HydroManagement::HydroManagement(const Data::AreaList& areas,
{
// Ventilation results memory allocation
uint nbDaysPerYear = 365;
ventilationResults_.resize(maxNbYearsInParallel_);
for (uint threadNumber = 0; threadNumber < maxNbYearsInParallel_; threadNumber++)
ventilationResults_.resize(areas_.size());
for (uint areaIndex = 0; areaIndex < areas_.size(); ++areaIndex)
{
ventilationResults_[threadNumber].resize(areas_.size());
for (uint areaIndex = 0; areaIndex < areas_.size(); ++areaIndex)
{
auto& area = *areas_.byIndex[areaIndex];
size_t clusterCount = area.thermal.clusterCount();
auto& area = *areas_.byIndex[areaIndex];
size_t clusterCount = area.thermal.clusterCount();

ventilationResults_[threadNumber][areaIndex].HydrauliqueModulableQuotidien.assign(nbDaysPerYear, 0);
ventilationResults_[areaIndex].HydrauliqueModulableQuotidien.assign(nbDaysPerYear, 0);

if (area.hydro.reservoirManagement)
{
ventilationResults_[threadNumber][areaIndex].NiveauxReservoirsDebutJours.assign(nbDaysPerYear, 0.);
ventilationResults_[threadNumber][areaIndex].NiveauxReservoirsFinJours.assign(nbDaysPerYear, 0.);
}
if (area.hydro.reservoirManagement)
{
ventilationResults_[areaIndex].NiveauxReservoirsDebutJours.assign(nbDaysPerYear, 0.);
ventilationResults_[areaIndex].NiveauxReservoirsFinJours.assign(nbDaysPerYear, 0.);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/solver/hydro/management/management.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ typedef struct
} VENTILATION_HYDRO_RESULTS_BY_AREA;

// vector of [numSpace][area]
using ALL_HYDRO_VENTILATION_RESULTS = std::vector<std::vector<VENTILATION_HYDRO_RESULTS_BY_AREA>>;
using HYDRO_VENTILATION_RESULTS = std::vector<VENTILATION_HYDRO_RESULTS_BY_AREA>;


class HydroManagement final
Expand All @@ -115,7 +115,7 @@ class HydroManagement final
uint y,
uint numSpace);

ALL_HYDRO_VENTILATION_RESULTS& ventilationResults() { return ventilationResults_; }
HYDRO_VENTILATION_RESULTS& ventilationResults() { return ventilationResults_; }

private:
//! Prepare inflows scaling for each area
Expand Down Expand Up @@ -170,7 +170,7 @@ class HydroManagement final
unsigned int maxNbYearsInParallel_ = 0;
Solver::IResultWriter& resultWriter_;

ALL_HYDRO_VENTILATION_RESULTS ventilationResults_;
HYDRO_VENTILATION_RESULTS ventilationResults_;
}; // class HydroManagement
} // namespace Antares

Expand Down
8 changes: 4 additions & 4 deletions src/solver/simulation/adequacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bool Adequacy::simulationBegin()

bool Adequacy::simplexIsRequired(uint hourInTheYear,
uint numSpace,
const ALL_HYDRO_VENTILATION_RESULTS& hydroVentilationResults) const
const HYDRO_VENTILATION_RESULTS& hydroVentilationResults) const
{
uint areaCount = study.areas.size();
uint indx = hourInTheYear;
Expand All @@ -106,7 +106,7 @@ bool Adequacy::simplexIsRequired(uint hourInTheYear,

for (uint areaIdx = 0; areaIdx != areaCount; ++areaIdx)
{
auto& hydroVentilation = hydroVentilationResults[numSpace][areaIdx];
auto& hydroVentilation = hydroVentilationResults[areaIdx];

double quantity
= pProblemesHebdo[numSpace].ConsommationsAbattues[j].ConsommationAbattueDuPays[areaIdx]
Expand All @@ -126,7 +126,7 @@ bool Adequacy::year(Progression::Task& progression,
yearRandomNumbers& randomForYear,
std::list<uint>& failedWeekList,
bool isFirstPerformedYearOfSimulation,
const ALL_HYDRO_VENTILATION_RESULTS& hydroVentilationResults,
const HYDRO_VENTILATION_RESULTS& hydroVentilationResults,
OptimizationStatisticsWriter& optWriter)
{
// No failed week at year start
Expand Down Expand Up @@ -293,7 +293,7 @@ bool Adequacy::year(Progression::Task& progression,
{
assert(k < state.resSpilled.width);
assert(j < state.resSpilled.height);
auto& hydroVentilation = hydroVentilationResults[numSpace][k];
auto& hydroVentilation = hydroVentilationResults[k];
auto& hourlyResults = pProblemesHebdo[numSpace].ResultatsHoraires[k];

hourlyResults.TurbinageHoraire[j]
Expand Down
4 changes: 2 additions & 2 deletions src/solver/simulation/adequacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Adequacy
yearRandomNumbers& randomForYear,
std::list<uint>& failedWeekList,
bool isFirstPerformedYearOfSimulation,
const ALL_HYDRO_VENTILATION_RESULTS&,
const HYDRO_VENTILATION_RESULTS&,
OptimizationStatisticsWriter& optWriter);

void incrementProgression(Progression::Task& progression);
Expand All @@ -99,7 +99,7 @@ class Adequacy
private:
bool simplexIsRequired(uint hourInTheYear,
uint numSpace,
const ALL_HYDRO_VENTILATION_RESULTS&) const;
const HYDRO_VENTILATION_RESULTS&) const;

uint pNbWeeks;
uint pStartTime;
Expand Down
2 changes: 1 addition & 1 deletion src/solver/simulation/economy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ bool Economy::year(Progression::Task& progression,
yearRandomNumbers& randomForYear,
std::list<uint>& failedWeekList,
bool isFirstPerformedYearOfSimulation,
const ALL_HYDRO_VENTILATION_RESULTS& hydroVentilationResults,
const HYDRO_VENTILATION_RESULTS& hydroVentilationResults,
OptimizationStatisticsWriter& optWriter)
{
// No failed week at year start
Expand Down
2 changes: 1 addition & 1 deletion src/solver/simulation/economy.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Economy
yearRandomNumbers& randomForYear,
std::list<uint>& failedWeekList,
bool isFirstPerformedYearOfSimulation,
const ALL_HYDRO_VENTILATION_RESULTS&,
const HYDRO_VENTILATION_RESULTS&,
OptimizationStatisticsWriter& optWriter);

void incrementProgression(Progression::Task& progression);
Expand Down
8 changes: 4 additions & 4 deletions src/solver/simulation/sim_calcul_economique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ void SIM_RenseignementProblemeHebdo(const Study& study,
uint weekInTheYear,
uint numSpace,
const int PasDeTempsDebut,
const ALL_HYDRO_VENTILATION_RESULTS& hydroVentilationResults)
const HYDRO_VENTILATION_RESULTS& hydroVentilationResults)
{
const auto& parameters = study.parameters;
auto& studyruntime = *study.runtime;
Expand Down Expand Up @@ -688,7 +688,7 @@ void SIM_RenseignementProblemeHebdo(const Study& study,
.MinEnergieHydrauParIntervalleOptimise;

const std::vector<double>& DNT
= hydroVentilationResults[numSpace][k].HydrauliqueModulableQuotidien;
= hydroVentilationResults[k].HydrauliqueModulableQuotidien;

double WSL
= problem.CaracteristiquesHydrauliques[k].NiveauInitialReservoir;
Expand Down Expand Up @@ -777,7 +777,7 @@ void SIM_RenseignementProblemeHebdo(const Study& study,
for (uint j = 0; j < 7; ++j)
{
uint day = study.calendar.hours[PasDeTempsDebut + j * 24].dayYear;
weekTarget_tmp += hydroVentilationResults[numSpace][k]
weekTarget_tmp += hydroVentilationResults[k]
.HydrauliqueModulableQuotidien[day];
}

Expand All @@ -798,7 +798,7 @@ void SIM_RenseignementProblemeHebdo(const Study& study,
uint day = study.calendar.hours[PasDeTempsDebut + j * 24].dayYear;
problem.CaracteristiquesHydrauliques[k]
.CntEnergieH2OParIntervalleOptimise[j]
= hydroVentilationResults[numSpace][k].HydrauliqueModulableQuotidien[day]
= hydroVentilationResults[k].HydrauliqueModulableQuotidien[day]
* problem.CaracteristiquesHydrauliques[k].WeeklyGeneratingModulation
* marginGen / weekGenerationTarget;
}
Expand Down
2 changes: 1 addition & 1 deletion src/solver/simulation/simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void SIM_RenseignementProblemeHebdo(const Antares::Data::Study& study,
uint weekInTheYear,
uint numSpace,
const int,
const ALL_HYDRO_VENTILATION_RESULTS&);
const HYDRO_VENTILATION_RESULTS&);

void SIM_RenseignementProblemeHoraireAdequation(uint);

Expand Down

0 comments on commit 6f881fc

Please sign in to comment.