Library for basic air data calculations  0.5b
AirDC.h
Go to the documentation of this file.
1 
16 #ifndef AirDC_h
17 #define AirDC_h
18 #include <Arduino.h>
19 #include <TimeLib.h>
20 #define DEFAULT_LOG_FILE "DATALOG.CSV"
21 
22 #define AIRDC_DATA_TIME 0 // Timestamp
23 #define AIRDC_DATA_QCRAW 1 // Differential pressure [count]
24 #define AIRDC_DATA_PRAW 2 // Absolute pressure [count]
25 #define AIRDC_DATA_TRAW 3 // External Temperature sensor [count]
26 #define AIRDC_DATA_TDELTAPRAW 4 // Temperature differential pressure sensor [count]
27 #define AIRDC_DATA_TABSPRAW 5 // Temperature absolute pressure sensor [count]
28 #define AIRDC_DATA_QC 6 // Differential pressure [Pa]
29 #define AIRDC_DATA_P 7 // Static pressure [Pa]
30 #define AIRDC_DATA_TAT 8 // TAT External Temperature [K]
31 #define AIRDC_DATA_TDELTAP 9 // Temperature differential pressure sensor [K]
32 #define AIRDC_DATA_TABSP 10 // Temperature absolute pressure sensor [K]
33 #define AIRDC_DATA_IAS 11 // Indicated Air Speed [m/s]
34 #define AIRDC_DATA_TAS 12 // True Air Speed [m/s]
35 #define AIRDC_DATA_H 13 // Barometric altitude [m]
36 #define AIRDC_DATA_T 14 // OAT [K]
37 #define AIRDC_DATA_MILLIS 15 // Internal time Milliseconds
38 #define AIRDC_DATA_UIAS 16 // Uncertainty IAS [m/s]
39 #define AIRDC_DATA_UTAS 17 // Uncertainty TAS [m/s]
40 #define AIRDC_DATA_UH 18 // Uncertainty Altitude [m]
41 #define AIRDC_DATA_UT 19 // Uncertainty OAT [K]
42 #define AIRDC_DATA_RHO 20 // Air Density [kg/m^3]
43 #define AIRDC_DATA_MU 21 // Dynamic Air Viscosity [Pa*s]]
44 #define AIRDC_DATA_RE 22 // Reynolds number
45 #define AIRDC_DATA_C 23 // c factor
46 
47 #define AIRDC_DATA_VECTOR_SIZE 24 // The size of this data vector
48 
49 
50 #define AIRDC_STATUS_SD 0 // SD Card
51 #define AIRDC_STATUS_DELTAP 1 // Differential pressure sensor
52 #define AIRDC_STATUS_P 2 // Absolute pressure sensor
53 #define AIRDC_STATUS_TAT 3 // External Temperature sensor
54 #define AIRDC_STATUS_TDELTAP 4 // Temperature differential pressure sensor
55 #define AIRDC_STATUS_TABSP 5 // Temperature absolute pressure sensor
56 #define AIRDC_STATUS_RTCBATT 6 // Real time clock battery
57 #define AIRDC_STATUS_ERRWARN 7 // Error/Warning
58 #define AIRDC_STATUS_BLUETOOTH 8 // Bluetooth
59 
60 #define AIRDC_STATUS_VECTOR_SIZE 9 // The size of this status vector
61 
62 
63 class AirDC
64 {
65 public:
66  AirDC(int pid);
67  void RhoAir(int mode);
68  void IAS(int mode);
69  void CAS(int mode);
70  void TAS(int mode);
71  void Mach(int mode);
72  void OAT(int mode);
73  void ISAAltitude(int mode);
74  double CorrectDp(int SensorID, double DpMeas);
75  String OutputSerial(int mode);
76 //Correction and Auxiliary
77  void PitotCorrection(int mode);
78  void Viscosity(int mode);
79  void Red(int mode);
80 //Calibration factor
81  void CalibrationFactor(int mode);
82 //Prepare data for output
83  void PrepareData(void);
84 //General use
85  int _pid;
86 //Hardware configuration
87  char _status[11];
88 //Active log file
90 //Message handling configuration
91  char _datasel[25]={'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','\0'};
92  double _dataout[25]; //Double array that contains data ready to be send out
93 //Geometric
94  double _d;
95  double _PitotXcog;
96  double _PitotYcog;
97  double _PitotZcog;
98 //Measurements
99  double _p;
100  double _pRaw;
101  double _T;
102  double _TRaw;
103  double _RH;
104  double _qc;
105  double _qcRaw;
106  double _AOA;
107  double _AOS;
108  double _pSeaLevel;
109  double _Tdeltap;
110  double _Tabsp;
111  double _TdeltapRaw;
112  double _TabspRaw;
113 //AirData
114  double _Rho;
115  double _IAS;
116  double _CAS;
117  double _TAS;
119  double _M;
120  double _TAT;
121  double _h;
122  double _mu;
123  double _Re;
124  double _AOAdot;
125  double _AOSdot;
126 //Measurements Uncertainty
127  double _up;
128  double _uT;
129  double _uRH;
130  double _uqc;
131 //AirData Uncertainty
132  double _uRho;
133  double _uIAS;
134  double _uCAS;
135  double _uTAS;
136  double _uTAT;
137  double _uh;
138 //Inertial Unit
139  double _Ip;
140  double _Iq;
141  double _Ir;
142  double _c;
143 //Differential pressure sensor specific
144  double _DpZeroMeas;
145  double _GainDp;
146 };
147 #endif
148 
double _pSeaLevel
Definition: AirDC.h:108
double _Re
Definition: AirDC.h:123
double _IAS
Definition: AirDC.h:115
double _DpZeroMeas
Definition: AirDC.h:144
double _up
Definition: AirDC.h:127
double _PitotYcog
Definition: AirDC.h:96
double _AOSdot
Definition: AirDC.h:125
void OAT(int mode)
Definition: AirDC.cpp:231
double _TASPCorrected
Definition: AirDC.h:118
void CalibrationFactor(int mode)
Definition: AirDC.cpp:381
double _TabspRaw
Definition: AirDC.h:112
double _AOS
Definition: AirDC.h:107
#define DEFAULT_LOG_FILE
Definition: AirDC.h:20
double _TRaw
Definition: AirDC.h:102
double _Tabsp
Definition: AirDC.h:110
AirDC(int pid)
Definition: AirDC.cpp:23
double _CAS
Definition: AirDC.h:116
double _mu
Definition: AirDC.h:122
double _uCAS
Definition: AirDC.h:134
double _Iq
Definition: AirDC.h:140
double _AOAdot
Definition: AirDC.h:124
double _pRaw
Definition: AirDC.h:100
double _p
Definition: AirDC.h:99
void CAS(int mode)
Definition: AirDC.cpp:185
void Viscosity(int mode)
Definition: AirDC.cpp:347
double _Tdeltap
Definition: AirDC.h:109
char _status[11]
Definition: AirDC.h:87
double _Ip
Definition: AirDC.h:139
double _d
Definition: AirDC.h:94
void PitotCorrection(int mode)
Definition: AirDC.cpp:294
double _RH
Definition: AirDC.h:103
void ISAAltitude(int mode)
Definition: AirDC.cpp:250
Definition: AirDC.h:63
void TAS(int mode)
Definition: AirDC.cpp:199
String OutputSerial(int mode)
double _Ir
Definition: AirDC.h:141
void Red(int mode)
Definition: AirDC.cpp:366
double _uqc
Definition: AirDC.h:130
char _datasel[25]
Definition: AirDC.h:91
double _AOA
Definition: AirDC.h:106
double _uRho
Definition: AirDC.h:132
char _logfile[15]
Definition: AirDC.h:89
double _c
Definition: AirDC.h:142
double _uh
Definition: AirDC.h:137
double _PitotXcog
Definition: AirDC.h:95
void Mach(int mode)
Definition: AirDC.cpp:207
void RhoAir(int mode)
Definition: AirDC.cpp:69
double _dataout[25]
Definition: AirDC.h:92
double _uIAS
Definition: AirDC.h:133
double _TdeltapRaw
Definition: AirDC.h:111
double _uT
Definition: AirDC.h:128
double _qc
Definition: AirDC.h:104
double _qcRaw
Definition: AirDC.h:105
double _Rho
Definition: AirDC.h:114
void PrepareData(void)
Definition: AirDC.cpp:413
double _M
Definition: AirDC.h:119
double _GainDp
Definition: AirDC.h:145
double _uRH
Definition: AirDC.h:129
double _TAT
Definition: AirDC.h:120
int _pid
Definition: AirDC.h:85
double _TAS
Definition: AirDC.h:117
double _uTAT
Definition: AirDC.h:136
double _uTAS
Definition: AirDC.h:135
double _T
Definition: AirDC.h:101
double CorrectDp(int SensorID, double DpMeas)
Definition: AirDC.cpp:402
double _PitotZcog
Definition: AirDC.h:97
void IAS(int mode)
Definition: AirDC.cpp:171
double _h
Definition: AirDC.h:121