MRAS
Multi Rocket Avionics System
Loading...
Searching...
No Matches
Atmosphere.h
1/*
2 Written by Nikilesh Ramesh
3*/
4
5
6
7#include <iostream>
8#include <cmath>
9#include <map>
10#include <vector>
11#include "eigen.h"
12
13// ----------- Constants ------- //
14#define GAS_CONST 8.31446261815324 // Universal Gas Constant [J/(K*mol)]
15#define SPECIFIC_GAS_CONST 287.05287 // Gas Constant for air
16#define GRAVITY_ACCEL 9.80665 // Gravitational acceleration [m/s^2]
17#define SEALEVEL_PRESSURE 101325 // P0, sea level pressure [Pa]
18#define SEALEVEL_TEMP 288.15 // sea level temperature [K]
19#define AVAGADRO_CONST 6.02214076e23 // Avagadro's Constant
20#define SEALEVEL_MOLARMASS 28.964420e-03 // (NOT PRIMARY, DERIVED) Molar mass of air at sea level [kg/mol]
21#define SPECIFIC_GAS_CONST 287.05287 // specific gas constant (Assumed constant)
22#define RADIUS_OF_EARTH 6356766 //See references for this number
23
24// --- Other Definitions ---- //
25
26#define BASE_PRESSURE layer_const(0)
27// to be completed, to tidy up the code....
28
29
30
44public:
49 explicit Atmosphere(float pressure);
50
55 float get_altitude();
56
62 Eigen::Vector4f get_layer_constants(float p);
63
64 float to_geopotential(float alt); // additional feture to be added, right now everything is in geometric
65
66
67private:
68
69 // Modifiable values
70 int geometric_alt;
71 int geopotential_alt;
72 Eigen::Vector4f layer_const;
73
74 float altitude(float pressure);
75
76 // matrix of layer constants
77 // each Layer = {Geopotential [m], Temperature [K], Temp Gradient[K/m]}
78 Eigen::Matrix<float, 9, 4> layers;
79
80
81};
Definition: Atmosphere.h:43
float get_altitude()
Definition: Atmosphere.cpp:44
Eigen::Vector4f get_layer_constants(float p)
Definition: Atmosphere.cpp:68