Extended Data

This commit is contained in:
Kilian Hofmann 2024-11-05 02:32:07 +01:00
parent de3d16fd67
commit 7f0b2278d4
11 changed files with 11421 additions and 323 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
#define ECON_SPD
// Feet
#define MIN_FL 250
#define MIN_FL 10
#define MAX_FL 430
// Tonnes
#define MIN_WGT 140
@ -103,8 +103,12 @@ float interp(float lower, float upper, float ratio) {
/// @return Mach corresponding to CI. Returns -1 if not possible
float ci2mach(float altitude, float weight, float totalFuel, int ci) {
// Some fallback assumptions for extreme cases
// Clamp weight, for <140 we use 140
weight = std::clamp(weight, 140000.0f, 290000.0f);
altitude = std::min(altitude, 43000.0f);
// Clamp altitude, for > 43000 we use 43000, for <1000 we use 1000
altitude = std::clamp(altitude, 1000.0f, 43000.0f);
// Safety CI
ci = std::clamp(ci, 0, 999);
auto bAlt = boundAltitude(altitude);
int lowerFl = std::get<0>(bAlt);
@ -118,18 +122,14 @@ float ci2mach(float altitude, float weight, float totalFuel, int ci) {
float ratioMMO = boundMMO(totalFuel);
// Outside of data
//FIXME: Find some sort of data to bridge 11k to 25k feet
if (altitude < 25000)
return -1;
int lowerFlIndex = flightLevel2Index(lowerFl);
int upperFlIndex = flightLevel2Index(upperFl);
int lowerWgtIndex = weight2Index(lowerWgt);
int upperWgtIndex = weight2Index(upperWgt);
// Outside of the maximum indicies
if (lowerFlIndex > 9 || upperFlIndex > 9 || lowerWgtIndex > 15 || upperWgtIndex > 15) {
// Outside of the maximum indicies, safeguard us from out-of-bounds
if (lowerFlIndex > 21 || upperFlIndex > 21 || lowerWgtIndex > 15 || upperWgtIndex > 15 ||
lowerFlIndex < 0 || upperFlIndex < 0 || lowerWgtIndex < 0 || upperWgtIndex < 0) {
return -1;
}

View File

@ -1,9 +1,8 @@
"ALT"; "MACH"
23000; .506, .525, .543, .563, .581, .600, .624, .652, .674, .705, .741, .762, .777, .795, .800, .804
21000; .514, .533, .553, .571, .587, .603, .616, .630, .641, .653, .662, .672, .678, .687, .696, .704
19000; .496, .514, .533, .549, .565, .579, .594, .607, .618, .629, .638, .646, .654, .661, .669, .678
17000; .478, .495, .513, .530, .544, .559, .573, .585, .596, .606, .615, .623, .630, .638, .645, .653
15000; .461, .478, .496, .511, .525, .539, .552, .564, .575, .585, .594, .602, .608, .614, .622, .632
13000; .444, .463, .478, .494, .508, .521, .534, .545, .556, .565, .573, .580, .587, .593, .601, .608
11000; .428, .444, .461, .476, .490, .504, .515, .527, .536, .545, .553, .561, .567, .574, .581, .589
23000; .503, .523, .547, .568, .588, .611, .638, .660, .684, .707, .735, .754, .769, .785, .792, .801
21000; .481, .502, .525, .542, .563, .584, .604, .627, .647, .670, .693, .717, .739, .757, .768, .771
19000; .461, .478, .499, .523, .538, .557, .579, .597, .617, .636, .659, .678, .697, .722, .741, .745
17000; .442, .462, .478, .501, .519, .538, .556, .572, .589, .608, .627, .647, .666, .684, .703, .715
15000; .425, .443, .463, .479, .497, .514, .535, .549, .567, .585, .602, .617, .637, .655, .673, .688
13000; .411, .427, .445, .462, .476, .493, .512, .530, .547, .562, .576, .594, .608, .626, .641, .660
11000; .396, .414, .429, .446, .462, .477, .491, .510, .525, .541, .557, .573, .584, .600, .617, .632