-
Notifications
You must be signed in to change notification settings - Fork 0
/
LevelTwoDecWidget.h
317 lines (271 loc) · 11 KB
/
LevelTwoDecWidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
#ifndef LEVELTWODECWIDGET_H
#define LEVELTWODECWIDGET_H
#include "LevelTwoChart.h"
#include "LevelTwoMuChart.h"
#include "Generators.h"
#include <qwt_counter.h>
#include <QWidget>
#include <QAbstractTableModel>
#include <QTableView>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QToolBar>
#include <QLabel>
#include <QDoubleSpinBox>
class TableLevelTwoModel;
class TableStabilityLevelTwoModel;
struct structHTMLReportLevelTwo
{
QString header;
QString tableOne;
QString tableTwo;
QString footer;
QString tdOpen;
QString tdClose;
QString trOpen;
QString trClose;
};
class LevelTwoDec : public QWidget
{
Q_OBJECT
size_t row;
size_t col;
bool qSwitch;
QString str_date;
QString str_mu;
QString str_alpha;
QString str_forecast;
QString lower_limit;
QString upper_limit;
QString lower_limit_short;
QString upper_limit_short;
QString result_str;
QString stable_str;
QString unstable_str;
double avrg_mu_blockA;
double avrg_mu_blockB;
double avrg_mu_blockC;
double avrg_alpha_blockA;
double avrg_alpha_blockB;
double avrg_alpha_blockC;
/********** FIRST TABLE **********/
QVector<QString> vectorDateToLevelTwo;
QVector<QVector<double> > vectorBlockAToLevelTwo;
QVector<QVector<double> > vectorBlockBToLevelTwo;
QVector<QVector<double> > vectorBlockCToLevelTwo;
QVector<double> vectorMuBlockA;
QVector<double> vectorMuBlockB;
QVector<double> vectorMuBlockC;
QVector<QString> vectorAlphaBlockA;
QVector<QString> vectorAlphaBlockB;
QVector<QString> vectorAlphaBlockC;
QVector<double> vectorForecastMuBlockA;
QVector<double> vectorForecastMuBlockB;
QVector<double> vectorForecastMuBlockC;
QVector<QString> vectorForecastAlphaBlockA;
QVector<QString> vectorForecastAlphaBlockB;
QVector<QString> vectorForecastAlphaBlockC;
/********** END FIRST TABLE **********/
/********** SECOND TABLE **********/
QVector<QVector<double> > vectorBlockALow;
QVector<QVector<double> > vectorBlockAHigh;
QVector<QVector<double> > vectorBlockBLow;
QVector<QVector<double> > vectorBlockBHigh;
QVector<QVector<double> > vectorBlockCLow;
QVector<QVector<double> > vectorBlockCHigh;
QVector<double> vectorMuBlockALowerLimit;
QVector<double> vectorMuBlockAUpperLimit;
QVector<double> vectorMuBlockBLowerLimit;
QVector<double> vectorMuBlockBUpperLimit;
QVector<double> vectorMuBlockCLowerLimit;
QVector<double> vectorMuBlockCUpperLimit;
/********** END SECOND TABLE **********/
QTableView *viewTableLevelTwoModel;
TableLevelTwoModel *tableLevelTwoModel;
TableStabilityLevelTwoModel *tableStabilityLevelTwoModel;
QHBoxLayout *horizLayoutTableLevelTwo;
QVBoxLayout *vertLayoutTableLevelTwo;
QToolBar *toolBar;
QWidget *toolBarBox;
QHBoxLayout *horizToolBarLayout;
QLabel *labelCoeffEps;
QLabel *labelMeterEps;
QLabel *labelCoeffAlpha;
QLabel *labelWarning;
QLabel *blocksToolTips;
QAction *exportLevelTwoChart;
QAction *printLevelTwoChart;
QAction *exportReportLevelTwo;
QAction *switchWidgetsLevelTwo;
QAction *showHelpInBrowserAction;
QDoubleSpinBox *spbDoubleBoxAlpha;
QwtCounter *spbDoubleBoxEps;
LevelTwoChart *levelTwoChart;
LevelTwoMuChart *levelTwoMuChart;
void splitVectors(const QVector<QVector<double> > &vectorSensorReadings2D);
void setVectorsToTables();
/********** FIRST TABLE **********/
double getMu(unsigned int i,
const QVector<QVector<double> > &vectorTarget2D);
double getAvrgMu(const QVector<double> &vectorTarget);
double getAvrgForecastMu(const QVector<double> &vectorTarget);
QString getAlphaString(unsigned int i,
const QVector<QVector<double> > &vectorTarget2D);
double getAvrgAlpha(const QVector<QString> &vectorTarget);
double getAvrgForecastAlpha(const QVector<QString> &vectorTarget);
void getMuForecast(size_t i, double a, double avrg_mu,
const QVector<double> &vectorTarget,
QVector<double> &vectorOutput);
void getAlphaForecast(size_t i, double a, double avrg_alpha,
const QVector<QString> &vectorTarget,
QVector<QString> &vectorOutput);
double ArcCos(double x);
/********** END FIRST TABLE **********/
/********** SECOND TABLE **********/
void createBlocksVectorsSensReadingsLandH(bool qLow,
double eps,
const QVector<QVector<double> > &vectorTarget,
QVector<QVector<double> > &vectorOutput);
double getMuLimits(size_t i, QVector<QVector<double> > &vectorTarget);
/********** END SECOND TABLE **********/
void retranslateUi();
void createTables();
void readDataOfVectorsToChart();
void readDataOfVectorsToMuChart();
void createDoubleBoxes();
void createCharts();
void createToolBar();
void createWidgets();
void checkStability();
private slots:
void changedAlpha(double i);
void changedEps(double eps);
void setDoubleCountToLabel(double eps);
void chooseExportCharts();
void choosePrintCharts();
void hideLevelTwoWidgets();
void exportReportToHTML();
void showHelp();
public:
LevelTwoDec(const QVector<QString> &vectorDate,
const QVector<QVector<double> > &vectorSensorReadings2D,
QWidget *parent = 0);
~LevelTwoDec();
};
class TableLevelTwoModel : public QAbstractTableModel
{
int row_count;
QString str_date_table;
QString str_mu_table;
QString str_alpha_table;
QString str_forecast_table;
QString str_blockA;
QString str_blockB;
QString str_blockC;
QColor lightYellow;
QColor lightRed;
QColor lightGreen;
QColor lightBlue;
QVector<QString> tableVectorDateOfLevel;
QVector<double> muBlockAVectorOfLevel;
QVector<double> muBlockBVectorOfLevel;
QVector<double> muBlockCVectorOfLevel;
QVector<double> muBlockAForecastVectorOfLevel;
QVector<double> muBlockBForecastVectorOfLevel;
QVector<double> muBlockCForecastVectorOfLevel;
QVector<QString> alphaBlockAVectorOfLevel;
QVector<QString> alphaBlockBVectorOfLevel;
QVector<QString> alphaBlockCVectorOfLevel;
QVector<QString> alphaBlockAForecastVectorOfLevel;
QVector<QString> alphaBlockBForecastVectorOfLevel;
QVector<QString> alphaBlockCForecastVectorOfLevel;
Generators *generator;
protected:
int rowCount(const QModelIndex &) const;
int columnCount(const QModelIndex &) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
public:
TableLevelTwoModel(const QString &str_date,
const QString &str_mu,
const QString &str_alpha,
const QString &str_forecast,
QObject *parent = 0);
void setCurrencyVectors(const QVector<QString> &tableVectorDate,
const QVector<double> &vectorMuBlockA,
const QVector<double> &vectorForecastMuBlockA,
const QVector<QString> &vectorAlphaBlockA,
const QVector<QString> &vectorForecastAlphaBlockA,
const QVector<double> &vectorMuBlockB,
const QVector<double> &vectorForecastMuBlockB,
const QVector<QString> &vectorAlphaBlockB,
const QVector<QString> &vectorForecastAlphaBlockB,
const QVector<double> &vectorMuBlockC,
const QVector<double> &vectorForecastMuBlockC,
const QVector<QString> &vectorAlphaBlockC,
const QVector<QString> &vectorForecastAlphaBlockC);
~TableLevelTwoModel();
};
class TableStabilityLevelTwoModel : public QAbstractTableModel
{
size_t row_count;
QString str_date_table;
QString str_lower_limit;
QString str_upper_limit;
QString str_lower_limit_short;
QString str_upper_limit_short;
QString str_mu_table;
QString str_result;
QString str_stable;
QString str_unstable;
QString str_blockA;
QString str_blockB;
QString str_blockC;
QColor lightYellow;
QColor lightRed;
QColor lightGreen;
QColor lightBlue;
QVector<QString> tableVectorDateOfLevel;
QVector<double> muBlockALLVectorOfLevel;
QVector<double> muBlockAVectorOfLevel;
QVector<double> muBlockAULVectorOfLevel;
QVector<double> muBlockBLLVectorOfLevel;
QVector<double> muBlockBVectorOfLevel;
QVector<double> muBlockBULVectorOfLevel;
QVector<double> muBlockCLLVectorOfLevel;
QVector<double> muBlockCVectorOfLevel;
QVector<double> muBlockCULVectorOfLevel;
bool checkResult(int i,
const QVector<double> &vectorLower,
const QVector<double> &vectorMiddle,
const QVector<double> &vectorUpper) const;
protected:
int rowCount(const QModelIndex &) const;
int columnCount(const QModelIndex &) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
public:
TableStabilityLevelTwoModel(const QString &str_date,
const QString &str_mu,
const QString &lower_limit,
const QString &upper_limit,
const QString &lower_limit_short,
const QString &upper_limit_short,
const QString &result_str,
const QString &stable_str,
const QString &unstable_str,
QObject *parent = 0);
void setCurrencyVectors(const QVector<QString> &tableVectorDate,
QVector<double> &vectorMuBlockALowerLimit,
QVector<double> &vectorMuBlockA,
QVector<double> &vectorMuBlockAUpperLimit,
QVector<double> &vectorMuBlockBLowerLimit,
QVector<double> &vectorMuBlockB,
QVector<double> &vectorMuBlockBUpperLimit,
QVector<double> &vectorMuBlockCLowerLimit,
QVector<double> &vectorMuBlockC,
QVector<double> &vectorMuBlockCUpperLimit);
bool checkSystemStable() const;
~TableStabilityLevelTwoModel();
};
#endif // LEVELTWODECWIDGET_H