Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
surveyresults.h
1/*
2** Copyright 2007-2024, RTE (https://www.rte-france.com)
3** See AUTHORS.txt
4** SPDX-License-Identifier: MPL-2.0
5** This file is part of Antares-Simulator,
6** Adequacy and Performance assessment for interconnected energy networks.
7**
8** Antares_Simulator is free software: you can redistribute it and/or modify
9** it under the terms of the Mozilla Public Licence 2.0 as published by
10** the Mozilla Foundation, either version 2 of the License, or
11** (at your option) any later version.
12**
13** Antares_Simulator is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16** Mozilla Public Licence 2.0 for more details.
17**
18** You should have received a copy of the Mozilla Public Licence 2.0
19** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20*/
21#ifndef __SOLVER_VARIABLE_SURVEY_RESULTS_SURVEY_RESULTS_H__
22#define __SOLVER_VARIABLE_SURVEY_RESULTS_SURVEY_RESULTS_H__
23
24#include <yuni/yuni.h>
25#include <yuni/core/string.h>
26
27#include <antares/study/study.h>
28#include <antares/study/variable-print-info.h>
29#include <antares/writer/i_writer.h>
30#include "antares/antares/constants.h"
31
32#include "../categories.h"
33#include "data.h"
34
35namespace Antares::Solver::Variable
36{
41{
42public:
44 typedef Yuni::CString<10, false> PrecisionType;
46 typedef Yuni::CString<128, false> CaptionType;
47
48public:
50
51
60 SurveyResults(const Data::Study& s, const Yuni::String& o, IResultWriter& writer);
66
70 void saveToFile(int dataLevel, int fileLevel, int precisionLevel);
71
78 void exportGridInfos();
79
80 // Reset a line of values to zero.
81 void resetValuesAtLine(uint);
82
86 void exportDigestAllYears(std::string& buffer);
87
88 void exportDigestMatrix(const char* title, std::string& buffer);
89
90public:
93
96 std::string variableUnit;
97
99 double** values;
100
101 enum
102 {
103 captionCount = 3,
104 };
105
107 CaptionType* captions[captionCount];
108
111
114 // Digest file non applicable status ( dim : nb vars x max(nb areas, nb sets of areas) )
115 uint digestSize; // Useful dimension for digest file non applicable statut management.
116 bool** digestNonApplicableStatus;
117
120
123
135 // File writer
136 IResultWriter& pResultWriter;
137
138private:
139 template<class StringT, class ConvertT, class PrecisionT>
140 void AppendDoubleValue(uint& error,
141 const double v,
142 StringT& buffer,
143 ConvertT& conversionBuffer,
144 const PrecisionT& precision,
145 const bool isNotApplicable);
146
147 void writeDateToFileDescriptor(uint row, int precisionLevel);
148
149}; // class SurveyResults
150
151} // namespace Antares::Solver::Variable
152
153#endif // __SOLVER_VARIABLE_SURVEY_RESULTS_SURVEY_RESULTS_H__
Definition study.h:61
Definition i_writer.h:34
Class utility for building CSV results files.
Definition surveyresults.h:41
bool * nonApplicableStatus
Non applicable status for each column (in the printf format)
Definition surveyresults.h:113
uint maxVariables
The total number of variables.
Definition surveyresults.h:119
Yuni::CString< 10, false > PrecisionType
Precision.
Definition surveyresults.h:44
double ** values
Matrix where to store all results.
Definition surveyresults.h:99
bool * isPrinted
Same thing for print status (do we print the current output variable ?)
Definition surveyresults.h:134
PrecisionType * precision
Precision to for each column (in the printf format)
Definition surveyresults.h:110
Yuni::CString< 128, false > CaptionType
Caption.
Definition surveyresults.h:46
CaptionType * captions[captionCount]
Array to store all variable names.
Definition surveyresults.h:107
CaptionType variableCaption
Caption for the current variable.
Definition surveyresults.h:95
~SurveyResults()
Destructor.
Definition surveyresults.cpp:569
void exportGridInfos()
Export informations about the current study.
Definition surveyresults.cpp:814
SurveyResults(const Data::Study &s, const Yuni::String &o, IResultWriter &writer)
Default constructor.
Definition surveyresults.cpp:512
Solver::Variable::Private::SurveyResultsData data
Data (not related to the template parameter)
Definition surveyresults.h:92
bool * isCurrentVarNA
Definition surveyresults.h:132
bool yearByYearResults
Flag to known if we are in the year-by-year mode.
Definition surveyresults.h:122
void exportDigestAllYears(std::string &buffer)
Export the digest file.
Definition surveyresults.cpp:601
void saveToFile(int dataLevel, int fileLevel, int precisionLevel)
Write the data into a file.
Definition surveyresults.cpp:693