diff --git a/src/solver/ts-generator/thermal.cpp b/src/solver/ts-generator/thermal.cpp index b62b83d596..988d631fda 100644 --- a/src/solver/ts-generator/thermal.cpp +++ b/src/solver/ts-generator/thermal.cpp @@ -75,8 +75,6 @@ class GeneratorTempData final private: uint nbThermalTimeseries_; - const uint nbHoursPerYear = HOURS_PER_YEAR; - const uint daysPerYear = DAYS_PER_YEAR; MersenneTwister& rndgenerator; @@ -96,8 +94,9 @@ class GeneratorTempData final double ap[366]; double bf[366]; double bp[366]; - double FPOW[366][102]; - double PPOW[366][102]; + + std::vector> FPOW; + std::vector> PPOW; String pTempFilename; Solver::Progression::Task& pProgression; @@ -119,6 +118,9 @@ GeneratorTempData::GeneratorTempData(Data::Study& study, nbThermalTimeseries_ = parameters.nbTimeSeriesThermal; derated = parameters.derated; + + FPOW.resize(DAYS_PER_YEAR); + PPOW.resize(DAYS_PER_YEAR); } void GeneratorTempData::writeResultsToDisk(const Data::Area& area, @@ -156,7 +158,7 @@ void GeneratorTempData::prepareIndispoFromLaw(Data::ThermalLaw law, { case Data::thermalLawUniform: { - for (uint d = 0; d < daysPerYear; ++d) + for (uint d = 0; d < DAYS_PER_YEAR; ++d) { double D = (double)duration[d]; double xtemp = volatility * (D - 1.); @@ -167,7 +169,7 @@ void GeneratorTempData::prepareIndispoFromLaw(Data::ThermalLaw law, } case Data::thermalLawGeometric: { - for (uint d = 0; d < daysPerYear; ++d) + for (uint d = 0; d < DAYS_PER_YEAR; ++d) { double D = (double)duration[d]; double xtemp = volatility * volatility * D * (D - 1.); @@ -272,8 +274,11 @@ void GeneratorTempData::operator()(Data::Area& area, Data::ThermalCluster& clust int FOD_reel = 0; int POD_reel = 0; - for (uint d = 0; d < daysPerYear; ++d) + for (uint d = 0; d < DAYS_PER_YEAR; ++d) { + FPOW[d].resize(cluster.unitCount + 1); + PPOW[d].resize(cluster.unitCount + 1); + PODOfTheDay = (int)POD[d]; FODOfTheDay = (int)FOD[d]; @@ -345,9 +350,8 @@ void GeneratorTempData::operator()(Data::Area& area, Data::ThermalCluster& clust if (tsIndex > 1) dstSeries = cluster.series.timeSeries[tsIndex - 2]; - for (uint dayInTheYear = 0; dayInTheYear < daysPerYear; ++dayInTheYear) + for (uint dayInTheYear = 0; dayInTheYear < DAYS_PER_YEAR; ++dayInTheYear) { - assert(AUN <= 100 and "Thermal Prepro: AUN is out of bounds (>=100)"); assert(dayInTheYear < 366); assert(not(lf[dayInTheYear] < 0.)); assert(not(lp[dayInTheYear] < 0.));