Airspeed Selector: use better density source and only save scale parameter if valid (#20764)

* AirspeedSelector: use vehicle_air_data.rho for calculating groundspeed-wind CAS

Previously the vehicle_air_data.temperature and pressure was used, instead of the
density field directly.
Only makes a difference if there is an airspeed sensor connected to provide
the air temperature.

* AirspeedSelector: only safe estimated scale in param if airspeed is valid

* AirspeedSelector: remove 0.01 cliff for saving learned scale to param

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2022-12-20 15:52:54 +01:00
committed by GitHub
parent efbb2cf2e3
commit 20342216e2
3 changed files with 29 additions and 33 deletions
+2 -2
View File
@@ -228,7 +228,7 @@ float get_air_density(float static_pressure, float temperature_celsius)
return static_pressure / (CONSTANTS_AIR_GAS_CONST * (temperature_celsius - CONSTANTS_ABSOLUTE_NULL_CELSIUS));
}
float calc_CAS_from_TAS(float speed_true, float pressure_ambient, float temperature_celsius)
float calc_calibrated_from_true_airspeed(float speed_true, float air_density)
{
return speed_true * sqrtf(get_air_density(pressure_ambient, temperature_celsius) / CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C);
return speed_true * sqrtf(air_density / CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C);
}
+5 -8
View File
@@ -130,16 +130,13 @@ __EXPORT float calc_TAS(float total_pressure, float static_pressure, float tempe
__EXPORT float get_air_density(float static_pressure, float temperature_celsius);
/**
* Calculate calibrated airspeed (CAS) from true airspeed (TAS).
* It is the inverse function to calc_TAS_from_CAS()
* @brief Calculates calibrated airspeed from true airspeed and air density
*
* @param speed_true current true airspeed
* @param pressure_ambient pressure at the side of the tube/airplane
* @param temperature_celsius air temperature in degrees Celsius
* @return CAS in m/s
* @param speed_true true airspeed [m/s]
* @param air_density air density [kg/m3]
* @return calibrated airspeed [m/s]
*/
__EXPORT float calc_CAS_from_TAS(float speed_true, float pressure_ambient,
float temperature_celsius);
__EXPORT float calc_calibrated_from_true_airspeed(float speed_true, float air_density);
__END_DECLS