Skip to content

Advanced TECS Tuning (Weight and Altitude)

This topic shows how you can compensate for changes to the weight 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 weight and air density are not taken into account, altitude and airspeed tracking will likely deteriorate in the case where the configuration (air density and weight) 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 weight:

  • WEIGHT_BASE — the weight of the vehicle at which the Basic TECS tuning was performed.
  • WEIGHT_GROSS — the actual weight 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 weight of the vehicle using a scale in the tuning configuration and when flying with a payload.

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.

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 weight 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 P (where ρ is the air density during tuning):

P=ρρsealevel

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 P:

P=ρρsealevel

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 X^ to specify that this value is a calibrated value of the variable X. By calibrated we mean the value of that variable measured at sea level in standard atmospheric conditions, and when vehicle weight was equal to WEIGHT_BASE.

E.g. by h˙^max we specify the maximum climb rate the vehicle can achieve at WEIGHT_BASE at sea level in standard atmospheric conditions.

Effect of Weight 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:

h˙max=V(ThrustDrag)mg

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 Weight 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:

h˙min=2mgρSf(CL,CD)

where ρ is the air density, S is the wing surface reference area and f(CL,CD) is a function of the polars, lift and drag.

From this equation we see that the minimum sink rate scales with the square root of the weight ratio.

Effect of Weight 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:

Lift=mg=12ρV2SCL

rearranging this equation for airspeed gives:

V=sqrtfrac2mgrhoSCD

From this equation we see that if we assume a constant angle of attack (which we generally desire), the vehicle weight 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 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:

h˙max=V(ThrustDrag)mg

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:

h˙max=h˙^ρsealevelρK

where ρsealevel is the air density at sea level in the standard atmosphere and K is a scaling factor which determines the slope of the function. Rather than trying to identify this constants, the usual practice in aviation is to specify a service ceiling altitude at which the vehicle is still able to achieve a minimum specified climb rate.

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:

h˙min=2mgρSf(CL,CD)

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.