forked from whhxp/getPF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
powerfactor.h
59 lines (46 loc) · 1.29 KB
/
powerfactor.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
#ifndef POWERFACTOR_H
#define POWERFACTOR_H
#include <math.h>
#include <string>
#include "fftw3.h"
#include <complex>
#include <valarray>
#define PI 3.1415926535897932384626433832
#define DEBUG 0
#define ANGLE 1
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
class powerFactor
{
public:
powerFactor(int argc, std::string FileName1, std::string FileName2);
powerFactor(int argc,std::string FileName1);
float getPF() const;
void setPF();
void calc();
int getMax() const;
std::string getFileName() const;
void setFileName(const std::string &value);
std::string getFile1() const;
void setFile1(const std::string &value);
std::string getFile2() const;
void setFile2(const std::string &value);
void readCSV(std::string PFfile);
void readCSV();
void printArray(std::string name, CArray &n);
void printArray(std::string name, Complex* complexArray);
CArray fft(CArray a);
private:
int argC;
std::string file1;
std::string file2;
Complex voltageC[10000];
Complex currentC[10000];
double PF;
int Max;
const int size = 1000;
int lineCount;
Complex voltage[1000];
Complex current[1000];
};
#endif // POWERFACTOR_H