Extended Data
This commit is contained in:
+10971
-304
File diff suppressed because one or more lines are too long
+217
-1
File diff suppressed because one or more lines are too long
+217
-1
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.
+9
-9
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user