-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvironment.cpp
More file actions
44 lines (36 loc) · 909 Bytes
/
environment.cpp
File metadata and controls
44 lines (36 loc) · 909 Bytes
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
#include "environment.h"
#include <math.h>
Environment::Environment()
{
}
double Environment::calculateG(double mR, double D) {
double calculatedD = 6371000 + D;
GStrength = (GmE*(mR/(calculatedD*calculatedD)));
return GStrength;
}
double Environment::calculateAirTemp(double D) {
if (D > 100000) {
AirTemp = -50 + 273.15;
}
else {
AirTemp = 15 - (D * 6.5) + 273.15;
if (AirTemp < 0) {
AirTemp = -50 + 273.15;
}
}
return AirTemp;
}
double Environment::calculateAirDensity() {
AirDensity = AirPressure/(SGasConstant*AirTemp);
return AirDensity;
}
double Environment::calculateAirPressure(double D) {
AirPressure = 101 * std::exp(-StandardG * MMAir * D / (UGS * AirTemp));
return AirPressure;
}
double Environment::getG() {
return GStrength;
}
double Environment::getAirDensity() {
return AirDensity;
}