# Question about kinetic energy rate of change in TECS

Hi, everyone.

I research TECS in PX4 source code(ver 1.11.2).
I confused When i read function.
→ void TECS::_update_energy_estimates()

Specific energy rate setpoint is derived like under line.

_SKE_rate_setpoint = _tas_state * _TAS_rate_setpoint;

But, I don’t understand why _tas_state was used?
Because setpoint mean command so that it must use _TAS_setpoint_adj.

Someone know reason?

Also, is STE_to_throttle and climb_angle_to_SEB_rate used like P gain?

There is a bit of explanation here: TECS: fix calculation of _SKE_rate_setpoint by sfuhrer · Pull Request #15735 · PX4/PX4-Autopilot · GitHub

Also, is STE_to_throttle and climb_angle_to_SEB_rate used like P gain?

Yeah one could say so.

Thanks for the comment.

I can see why the code is structured that way.

But still mathematically, _TAS_setpoint_adj seems to be more correct than _tas_state.

But still mathematically, _TAS_setpoint_adj seems to be more correct than _tas_state.

If I got it correctly then the idea is to linearize the setpoint around the current airspeed (_tas_state). It has the effect that the TAS_rate_setpoint to SKE_rate_setpoint mapping changes depending on the current airspeed. The faster you fly, the larger is the change on SKE_rate_setpoint (in absolute numbers).

I don’t understand your comments that mapping changes depending on the current airspeed.

I don’t understand your comments that linearize the setpoint around the current airspeed (_tas_state).

y = _SKE_rate_setpoint, C = _TAS_setpoint_adj(constant), x = _tas_state, _TAS_rate_setpoint = _TAS_setpoint_adj - _tas_state (ignore gain).

We can derive equation like this :
_SKE_rate_setpoint = _TAS_setpoint_adj * (_TAS_setpoint_adj - _tas_state). → y = C * (C - x) = -C*x+ C^2

y = ax + b(linear equation)

It was derived like this : (if _tas_state were used)
y = x* (C - x) = -x^2 + C * x

y = ax^2 + bx + c(quadratic equation)