21 #ifndef __SOLVER_VARIABLE_STORAGE_AVERAGE_H__
22 #define __SOLVER_VARIABLE_STORAGE_AVERAGE_H__
26 #include "averagedata.h"
28 namespace Antares::Solver::Variable::R::AllYears
30 template<
class NextT = Empty,
int FileFilter = Variable::Category::FileLevel::allFile>
42 categoryFile = NextT::categoryFile | Variable::Category::FileLevel::allFile,
65 avgdata.initializeFromStudy(study);
67 NextType::initializeFromStudy(study);
78 void merge(uint year,
const IntermediateValues& rhs)
80 avgdata.merge(year, rhs);
82 NextType::merge(year, rhs);
85 template<
class S,
class VCardT>
86 void buildSurveyReport(SurveyResults& report,
92 if (!(fileLevel & Category::FileLevel::id))
96 case Category::hourly:
97 InternalExportValues<HOURS_PER_YEAR, VCardT, Category::hourly>(report,
100 case Category::daily:
101 InternalExportValues<DAYS_PER_YEAR, VCardT, Category::daily>(report, avgdata.daily);
103 case Category::weekly:
104 InternalExportValues<WEEKS_PER_YEAR, VCardT, Category::weekly>(report,
107 case Category::monthly:
108 InternalExportValues<MONTHS_PER_YEAR, VCardT, Category::monthly>(report,
111 case Category::annual:
112 InternalExportValues<1, VCardT, Category::annual>(report, avgdata.year);
117 NextType::template buildSurveyReport<S, VCardT>(report,
124 template<
class VCardT>
125 void buildDigest(SurveyResults& report,
int digestLevel,
int dataLevel)
const
127 const bool isCluster = (VCardT::categoryFileLevel & Category::FileLevel::de)
128 || (VCardT::categoryFileLevel & Category::FileLevel::de_res);
129 const bool isBindingConstraint = VCardT::categoryFileLevel & Category::FileLevel::bc;
130 const bool isDigest = digestLevel & Category::digestAllYears;
131 if ((dataLevel & Category::DataLevel::area || dataLevel & Category::DataLevel::setOfAreas)
132 && isDigest && !isCluster && !isBindingConstraint)
134 assert(report.data.columnIndex < report.maxVariables &&
"Column index out of bounds");
136 report.captions[0][report.data.columnIndex] = report.variableCaption;
137 report.captions[1][report.data.columnIndex] = report.variableUnit;
138 report.captions[2][report.data.columnIndex] = (report.variableCaption ==
"LOLP")
143 report.precision[report.data.columnIndex] = PrecisionToPrintfFormat<
144 VCardT::decimal>::Value();
146 report.values[report.data.columnIndex][report.data.rowIndex] = avgdata.allYears;
148 report.digestNonApplicableStatus[report.data.rowIndex][report.data.columnIndex]
149 = *report.isCurrentVarNA;
151 ++(report.data.columnIndex);
154 NextType::template buildDigest<VCardT>(report, digestLevel, dataLevel);
161 template<u
int Size,
class VCardT,
int PrecisionT>
162 void InternalExportValues(SurveyResults& report,
const std::vector<HighPrecision>& array)
const
164 assert(report.data.columnIndex < report.maxVariables &&
"Column index out of bounds");
167 report.captions[0][report.data.columnIndex] = report.variableCaption;
168 report.captions[1][report.data.columnIndex] = report.variableUnit;
169 report.captions[2][report.data.columnIndex] = (report.variableCaption ==
"LOLP") ?
"values"
172 report.precision[report.data.columnIndex] = PrecisionToPrintfFormat<
173 VCardT::decimal>::Value();
175 report.nonApplicableStatus[report.data.columnIndex] = *report.isCurrentVarNA;
180 case Category::hourly:
182 for (uint h = 0; h < HOURS_PER_YEAR; ++h)
184 report.values[report.data.columnIndex][h] = array[h];
188 case Category::daily:
190 for (uint d = 0; d < DAYS_PER_YEAR; ++d)
192 report.values[report.data.columnIndex][d] = array[d];
197 case Category::weekly:
199 for (uint w = 0; w < WEEKS_PER_YEAR; ++w)
201 report.values[report.data.columnIndex][w] = array[w];
206 case Category::monthly:
208 for (uint m = 0; m < MONTHS_PER_YEAR; ++m)
210 report.values[report.data.columnIndex][m] = array[m];
214 case Category::annual:
216 double& target = *(report.values[report.data.columnIndex]);
218 for (uint i = 0; i != avgdata.nbYearsCapacity; ++i)
222 avgdata.allYears = target;
227 logs.warning() <<
"Category not found for variable: " << report.variableCaption;
232 ++report.data.columnIndex;
@ count
The count if item in the list.
Definition: average.h:40
NextT NextType
Type of the net item in the list.
Definition: average.h:35
static const char * Name()
Name of the filter.
Definition: average.h:52