Skip to content

Commit

Permalink
cherry pick PR #1960
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Mar 18, 2024
1 parent bc8a318 commit 2f820ab
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/solver/ts-generator/thermal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class GeneratorTempData final
private:
uint nbHoursPerYear;

const uint daysPerYear;

MersenneTwister& rndgenerator;

Expand Down Expand Up @@ -125,9 +124,8 @@ class GeneratorTempData final

double bp[366];

double FPOW[366][102];

double PPOW[366][102];
std::vector<std::vector<double>> FPOW;
std::vector<std::vector<double>> PPOW;

String pTempFilename;

Expand All @@ -141,7 +139,6 @@ GeneratorTempData::GeneratorTempData(Data::Study& study,
IResultWriter::Ptr writer) :
study(study),
nbHoursPerYear(study.runtime->nbHoursPerYear),
daysPerYear(study.runtime->nbDaysPerYear),
rndgenerator(study.runtime->random[Data::seedTsGenThermal]),
pProgression(progr),
pWriter(writer)
Expand All @@ -153,6 +150,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,
Expand Down Expand Up @@ -191,7 +191,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.);
Expand All @@ -202,7 +202,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.);
Expand Down Expand Up @@ -312,8 +312,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];

Expand Down Expand Up @@ -385,9 +388,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.));
Expand Down

0 comments on commit 2f820ab

Please sign in to comment.