Advanced TECS Tuning (Weight and Altitude)
This topic shows how you can compensate for changes to the mass of the vehicle and the air density, along with information about the algorithms that are used.
WARNING
This topic requires that you have already performed basic TECS tuning.
Basic TECS tuning established the key performance limitations of the vehicle that are required for the altitude and airspeed controller to function properly.
While those limitations are specified using constant parameters, in reality vehicle performance is not constant and is affected by various factors. If changes in vehicle mass and air density are not taken into account, altitude and airspeed tracking will likely deteriorate in the case where the configuration (air density and mass) deviate significantly from the configuration at which the vehicle was tuned.
Vehicle Weight Compensation
Set (both) the following parameters to scale the maximum climb rate, minimum sink rate, and adjust airspeed limits for the vehicle mass:
- WEIGHT_BASE — the mass of the vehicle at which the Basic TECS tuning was performed.
- WEIGHT_GROSS — the actual mass of the vehicle at any given time, for example when using a larger battery, or with a payload that was not present during tuning.
You can determine the values by measuring the mass of the vehicle using a scale in the tuning configuration and when flying with a payload.
INFO
The WEIGHT_* parameters are masses in kilograms; the parameter names and the derived weight ratio (the ratio of the current vehicle mass to WEIGHT_BASE) use "weight" following common aviation usage.
Scaling is performed when both WEIGHT_BASE and WEIGHT_GROSS are greater than 0, and will have no effect if the values are the same. See the algorithms section below for more information.
Fuel Burn Compensation
On combustion-engine vehicles a significant proportion of the takeoff mass is fuel, so the vehicle mass decreases considerably over the course of a flight. If a fuel tank sensor is present (publishing to the FuelTankStatus message, for example from a DroneCAN engine ECU), PX4 can continuously estimate the current vehicle mass from the amount of burned fuel.
To enable this, additionally set:
- WEIGHT_FUEL — the mass of a full fuel load (tank capacity multiplied by fuel density).
When WEIGHT_FUEL is greater than 0, WEIGHT_GROSS must be set to the takeoff mass with a full tank. The current mass is then computed from the measured fraction of fuel remaining, so no parameter update is needed when taking off with a partially filled tank. The measured fuel level is low-pass filtered to reject fuel slosh.
If no fuel data is available (no sensor, or the sensor fails before boot), any mass-based scaling makes the conservative assumption that the vehicle is at the full gross mass (including fuel). If fuel data is lost mid-flight, the last known fuel state is kept.
Fuel-consumption compensation is only applied to the fuel tank with id 0 (the default id for single-tank systems). Multi-tank vehicles should publish the aggregated total fuel state as tank 0. A warning is shown if fuel data is not received from id 0 but is received for other tank ids.
Air Density Compensation
Specify a Service Ceiling
In PX4 the service ceiling FW_SERVICE_CEIL specifies the altitude in standard atmospheric conditions at which the vehicle is still able to achieve a maximum climb rate of 0.5 m/s at maximum throttle and a vehicle mass equal to WEIGHT_BASE. By default this parameter is disabled and no compensation will take place.
This parameter needs to be determined experimentally. It is always better to set a conservative value (lower value) than an optimistic value.
Apply Density Correction to Minimum Sink Rate
The minimum sink rate is set in FW_T_SINK_MIN.
If the Basic TECS tuning was not done in standard sea level conditions then the FW_T_SINK_MIN parameter must be modified by multiplying with correction factor
For more information see Effect of Density on minimum sink rate.
Apply Density Correction to Trim Throttle
The trim throttle is set using FW_THR_TRIM.
If basic tuning was not done in standard sealevel conditions then the value for FW_THR_TRIM must be modified by multiplying with correction factor
For more information see Effect of Density on Trim Throttle
Weight and Density Compensation Algorithms
This section contains information about the scaling operations performed by PX4. This is provided for interest only, and may be of interest to developers who want to modify the scaling code.
Notation
In the following sections we will use the notation
E.g. by
Effect of Mass on Maximum Climb Rate
The maximum climb rate (FW_T_CLMB_MAX) is scaled as a function of the weight ratio.
From the steady state equations of motions of an airplane we find that the maximum climb rate can be written as:
where V is the true airspeed and m is the vehicle mass. From this equation we see that the maximum climb rates scales with vehicle mass.
Effect of Mass on Minimum Sink Rate
The minimum sink rate (FW_T_SINK_MIN) is scaled as a function of weight ratio
The minimum sink rate can be written as:
where
From this equation we see that the minimum sink rate scales with the square root of the weight ratio.
Effect of Mass on Airspeed Limits
The minimum airspeed (FW_AIRSPD_MIN), the stall airspeed (FW_AIRSPD_STALL) and trim airspeed (FW_AIRSPD_TRIM) are adjusted based on the weight ratio specified by WEIGHT_BASE and WEIGHT_GROSS.
In steady state flight we can demand that lift should equal weight of the vehicle:
rearranging this equation for airspeed gives:
From this equation we see that if we assume a constant angle of attack (which we generally desire), the vehicle mass affects airspeed with a square root relation. Therefore, the airspeed limits mentioned above are all scaled using the square root of the weight ratio.
Effect of Bank Angle on Airspeed Limits
Flying a coordinated, level turn at bank angle
The maximum airspeed (FW_AIRSPD_MAX) is not compensated in this way, as it can represent structural limits of the airframe.
It can be that at maximum bank angle FW_R_LIM, the maximum airspeed is lower than the minimum airspeed (compensated for weight ratio and bank angle). This means the allowed airspeed range is empty at that bank angle. If a system is configured like this, a warning on the ground station is shown.
Effect of Density on Maximum Climb Rate
The maximum climb rate is set using FW_T_CLMB_MAX.
As we have seen previously, the maximum climb rate can be formulated as:
The air density affects the airspeed, the thrust and the drag and modelling this effects is not straight forward. However, we can refer to literature and experience, which suggest that for a propeller airplane the maximum climb rate reduces approximately linear with the air density. Therefore, we can write the maximum climb rate as:
where
Effect of Density on Minimum Sink Rate
The minimum sink rate is set using FW_T_SINK_MIN.
In previous sections we have seen the formula for the minimum sink rate:
This shows that the minimum sink rate scales with the square root of the inverse air density.
Effect of Density on Trim Throttle
TODO: Add derivation here.