-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
53 lines (43 loc) · 1.14 KB
/
main.cpp
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
#include "mainwindow.h"
#include "svm.h"
#include "alphabeta.h"
#include "vll.h"
#include "vph.h"
#include "wplot/wplot.h"
#include <math.h>
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//MainWindow w;
WPlot dutyPlot;
WPlot vllPlot;
WPlot vphPlot;
float m = SQRT3/2.0f;
int nSect = 6;
int angleEnd = 60 * nSect;
AlphaBeta v;
for (int i = 0; i < angleEnd; i+=1) {
float th = (float)(i) * M_PI/180;
v.alpha = m * cos(th);
v.beta = m * sin(th);
Duty d = SVM::calculate(v);
dutyPlot.addPoint(i,SData(d.a, d.b, d.c));
float vdc = 100;
Vll vll(vdc, d);
vllPlot.addPoint(i, SData(vll.vab, vll.vbc, vll.vca));
Vph vph(vll);
vphPlot.addPoint(i, SData(vph.va, vph.vb, vph.vc));
}
dutyPlot.createPlot();
dutyPlot.show();
dutyPlot.setWindowTitle("Duty Cycle");
vllPlot.createPlot();
vllPlot.show();
vllPlot.setWindowTitle("Voltages line to line");
vphPlot.createPlot();
vphPlot.show();
vphPlot.setWindowTitle("Phase voltages");
//w.show();
return a.exec();
}