A Modified Total Energy Control Scheme for Unmanned Aircraft

The paper focuses on safety and simplicity of unmanned aircraft longitudinal control and proposes a new combination of total energy control (TECS) and conventional control. The introduced new modified total energy control (TECSMOD) method applies IAS priority all the time. IAS is controlled through the elevator while the total energy of the system and so the altitude is maintained with throttle. Neither engine fault or stall detection nor switching logic is required while stall is prevented keeping the solution simple and safe. To prove the viability of the new concept it is compared to a conventional multiple zone PI controller and the TECS solution in simulation and real flight tests. First, the six degrees of freedom simulation model of the Sindy test UAV (developed and built in Institute for Computer Science and Control, HUN-REN, Hungary) is verified comparing its inputs and outputs to flight results. Then a simulation campaign is done for all three controllers with special test cases which can be critical according to the literature. Finally, real flight test comparison is done considering IAS and altitude tracking and engine fault handling. The new method was the best in IAS tracking with acceptable results in altitude tracking and successful stall prevention upon engine fault (without any fault detection or switching). Future improvements can be fine tuning for improved altitude tracking with the price of decreased IAS tracking performance and the introduction of a glideslope tracking mode for landing scenarios.


Introduction
The author of the paper has long experience with unmanned aerial vehicle (UAV) control design and flight testing (see [5][6][7][8][9][10][11][12]).During the decade long practice in case of aircraft longitudinal control first, the methods published in [14,17,26] and later the total energy control concept (TECS) [13] were applied and flight tested.The coupling of altitude-IAS dynamics complicates the experimental tuning of methods [14,17,26] while tuning of the TECS method is complicated by the non-intuitive effect of the energy balance part.
The method presented in [17] applies the elevator to track altitude and the throttle to track IAS.This can lead to stall B Peter Bauer bauer.peter@sztaki.hun-ren.hu 1 Systems and Control Laboratory, Institute for Computer Science and Control, HUN-REN, Kende u. 13-17., Budapest 1111, Hungary in case of sudden ascend or in case of engine failure (pulling the aircraft to hold altitude).This was improved in [14] with multiple zone control applying IAS priority in ascend and descend through elevator-based IAS control.However, selection of the switching altitude error threshold between the modes is crucial (as will be shown later in Section 5.3) and not straightforward.The TECS methods also tend to stall the aircraft in case of sudden ascend or engine failure (see [13,22,23]).However, [26] proposed a different method controlling the altitude through the throttle and the IAS through the elevator preventing stall problems but preserving the difficulties with coupling.So the main problems detected are the lack of stall prevention without its detection and/or the difficulty of controller tuning due to the coupling between IAS and altitude dynamics.These are targeted to be solved by a new controller.
Based-on the above discussion it is straightforward to combine the total energy concept (with throttle-based total energy control) and elevator-based IAS tracking into a new TECSMOD controller.With the former the total energy con- tent of the system can be changed as only the throttle can input or remove energy to or from the system.The latter gives priority to IAS tracking through elevator preventing stall even in case of engine failure (guiding the aircraft into a controlled descend).This proposed solution is different from the control of the total and balance energy in TECS control formulated in [22] or [13].Safety and simplicity requirements are all satisfied by the proposed method as it prevents stall without fault detection and/or switching.Tuning is also easier as first, the IAS tracking can be tuned with constant throttle setup, then the total energy control to achieve satisfactory altitude tracking.
However, introducing a new combination of existing methods requires careful comparison with the already existing ones to point out the advantages and weaknesses.This was done considering the Sindy test UAV of Institute for Computer Science and Control, HUN-REN, Hungary (SZTAKI) [33] which is a twin engine, fixed wing vehicle (see Fig. 1).Its physical parameters are shown in Table 1 with m mass, I i j inertia for axes i j, b wingspan, c mean aerodynamical chord and S wing area.The table also shows the control surface deflection limits in elevator (e), aileron (a), rudder (r), body flap (bf) and wing flap (wf) order.The δ th throttle range is 0 − 1.
The method of control application and comparison was model-in-the-loop (MIL) then processor-in-the-loop (PIL) tuning and testing (according to the terminology published in [31]) considering the Matlab simulation model of the aerial vehicle (see [33]) and finally in-flight test and trial and error fine tuning.
The structure of the paper is as follows: Section 2 introduces the considered longitudinal control methods and also briefly introduces the lateral control.Section 3 shows that the Matlab simulation of Sindy aircraft gives dynamics similar to the real aircraft so it is appropriate for controller pre-tuning and comparison.Section 4 compares the controllers in Matlab MIL considering several evaluation criteria and test cases collected from literature.Section 5 presents the flight test results and comparison of the methods including the stopped engine case.Section 6 concludes the paper.

Control Methods
This section introduces the modified TECS (TECSMOD) solution proposed here, the multiple zone conventional control from [14] (called PI control in the sequel) and the TECS solution proposed in [13] for comparison.The lateral control method is also briefly introduced.

Longitudinal Controls
The proposed new TECSMOD control is shown in Fig. 2. It controls the total energy error E = K e + U e as the sum of kinetic energy error K e = 1 2 m(V 2 re f − V 2 ) and potential energy error U e = mg(h re f − h) with the throttle command δ th re f through a PI controller.Here, IAS is V with reference V re f , altitude is h with reference h re f , m is aircraft mass and g is the gravitational constant.Instead the energy balance error (in [13,19,24,25]) only the IAS is tracked through a θ re f pitch angle reference with PI controller.To see the difference compare the bottom parts of TECSMOD and TECS controllers in Fig. 2.
The original TECS control for comparison is the one from [13] (see Fig. 2) controlling the total energy error E with δ th re f and the energy balance error B = K e − U e with θ re f both with PI controllers.This method was selected to avoid  the utilization of acceleration measurements and the need for flight path angle calculation required for energy rate-based TECS solutions ([4, 19, 21-25, 32, 36]).According to [13] this method has also better turbulence tolerance (see results in Section 4.2).
From the conventional control methods the multiple zone solution proposed in [14] was selected (see Fig. 3).If the altitude h is inside a given range ( h > 0) from the commanded value h re f then it is tracked through the pitch angle command θ re f while IAS (V ) is tracked with throttle command δ th re f again with PI controllers.Outside the h range δ th re f = 1 is applied for ascend and δ th re f = 0 (or idle) for descend while the IAS is tracked through θ re f similarly to the TEC-SMOD method.For IAS tracking an integral controller (with limitation of maximum pitch and anti-windup) is applied to generate θ re f to utilize the maximum climbing capability of the aircraft.Stall prevention is applied pushing θ re f = −10 • if IAS decreases below 14m/s (the stall speed of Sindy is about 11-12m/s).This is a difference from TECSMOD and TECS controls where the θ re f reference is generated with a simple PI controller.
The reference pitch angle θ re f is tracked through a PD controller with the elevator δ e re f as suggested in [14] in all cases.This is shown in Fig. 4. Note that instead of differentiating the pitch angle θ the measured pitch rate q is applied in the D term.The drawback of this pitch control approach will be shown later (see Sections 4.3 and 4.4).

Lateral Controls
The lateral control of Sindy (see Fig. 4) is again based-on [14] applying a PID controller for the roll angle φ utilizing the measured roll rate p in the D term.The output of the controller is aileron deflection command δ a re f .Anti-windup (AW) compensation is applied because of the integral term stopping the integration when the commanded aileron deflection reached its lower or upper limit.As the Sindy UAV has the special property of having more roll motion for the rudder δ r and more yaw motion for the aileron δ a (caused by the winglets) constant aileron to rudder crossfeed A R is applied based-on the analysis of manually commanded coordinated turns.
Lateral-longitudinal control coupling is present in the system, but the longitudinal controller handles it well.This can be observed in real flight data presented in Figs. 5, 6, and 7 showing a test flight with multiple 180 • turns, altitude hold and IAS tracking.The TECSMOD controller was applied in this flight.Figure 6 shows that the high bank turn starts at about 278s before which the IAS and altitude values are settled and close to the references.The sudden turn causes a descend and an increase in IAS which are compensated by the longitudinal controller until about 285s where the bank (roll) angle is still about 25 • .So there is coupling between roll and longitudinal dynamics due to the change in the direc-Fig.5 Test flight trajectory with multiple turns tion of lift force but this is compensated by the longitudinal controller.

Controller Tuning
The controllers were implemented in discrete time with 50Hz sampling and simple Euler integration scheme (for the hardware structure see Section 5).Controller tuning was first done in the MIL simulation, then in PIL and finally fine tuning was applied in flight.The tuning goal for the low-level controllers was to achieve the possible fastest tracking without excessive control inputs or overshoots.The low-level roll and pitch tracking gains resulted as presented in Table 2.
The high-level tuning goal was to achieve a balanced performance between IAS and altitude tracking.Due to the limited possible flight time and different weather conditions between the flight tests in June and November 2022 neither of the methods was perfected but a good overall average performance was achieved every case.In case of the TECSMOD control balancing was not easy as the IAS is controlled Fig. 6 Roll angle tracking in high bank turn Fig. 7 IAS and altitude tracking during high bank turn through the fast pitch dynamics while the altitude through the slower throttle.This imbalance could only be compensated resulting in worse IAS tracking however, as IAS is more important in cruise than altitude, finally the imbalance was preserved.The tracking gains for PI (normal tracking mode), TECS and TECSMOD controllers resulted as presented in Table 3.

Simulation Model Validity
A high fidelity simulation model of Sindy aircraft was created in Matlab Simulink (see [33]) by SZTAKI applying linearized aerodynamics but nonlinear six degrees of freedom dynamics and engine characteristics.To test the validity of the model a real test flight in calm air should be considered to avoid the necessity of wind estimation.Several real flight tests were executed by SZTAKI with the different controllers and such test flight was found in the daily flight test data from 11th November 2022 as Fig. 8 shows.Constant bank coordinated turn was applied as lateral control so if the resulting circles do not drift that means calm air verified by the figure.The mission flown was altitude hold and IAS doublet tracking with the TECS controller thus circle diameter changes with the IAS.The Model-in-the-loop (MIL) version of the simulation model was applied for comparison running both Sindy aircraft simulation and the controllers in Matlab Simulink.To compare the simulation model with the real dynamics it had to be trimmed near the real flight state.This was done with Matlab trim function based on the flight data forcing the initial roll angle and IAS to be the same as in flight.Running the same autopilot with the same references and control gains should produce very similar dynamic behavior.This can be seen in Figs. 9, 10, 11, 12, 13, 14, 15, and 16 focusing on the longitudinal dynamics.
Figure 9 shows altitude hold having transients when the IAS reference changes (compare to Fig. 12).The small changes in altitude are different in simulation and real flight but the large peaks are very similar.In the real flight there are also large peaks in the opposite direction caused by higher overshoot of pitch rate and pitch angle (see Figs. 10 and 11).
Pitch dynamics was carefully tuned in the simulation model and the peaks in pitch rate and angle could be increased by decreasing the pitch damping in the aerodynamics.Figure 11 shows that the first peaks of the pitch rate tran-  difference between the reference and output signals.For a zoomed view of pitch angle and pitch rate peaks see Fig. 13.
Figure 12 shows IAS tracking and the two dynamics are very close to each other except for small oscillations and a larger downward overshoot in the real flight.Small oscillations can be observed in every real flight data and are caused by turbulence which is not included in the simulation.The overshoot is related to larger pitch angle and pitch rate overshoots of the real aircraft as discussed above.
Figure 13 shows the most active part of pitch angle tracking and pitch rate where the IAS reference changes from positive to negative (see Fig. 12).The first peaks of the angle references and angles are pretty close for flight and simulation while the second peaks are farther.The cause of this behavior was explained before.Figure 15 shows that the trend of the simulated throttle commands is similar to the real ones but the real throttle dynamics are faster especially at the large IAS reference change at 55s.This is caused by the faster overshoot of IAS and altitude which is caused by the larger pitch angle peak.Figure 16 shows that the roll angle dynamics are similar having a bit faster increase in the simulation but reaching the reference value about the same time.

Quality Measures
Besides plotting the tracking results and control inputs certain quality measures can help to compare simulation with flight test and later the three methods.The applied quality measures presented in Eq. ( 1) are basically the well known mean squared error (MSE) measures but with some differ- Differences and additional considerations are listed as follows: • In case of M SE h the commanded and actual potential energies are subtracted from each other so the MSE of the potential energy error is calculated.• Similarly for M SE I AS the actual and reference kinetic energies are subtracted so the MSE of kinetic energy error is calculated.• In case of the pitch angle θ the MSE of the tracking error is calculated but as the reference is time-varying the mean reference value θ re f is also calculated as a good measure of setpoint changes with the different models (flight or simulation) or controllers.• As the nominal pitch rate q is zero here MSE is only the mean of the squared values.
• As the roll reference φ re f is constant there is no need to present its mean.• In case of the elevator δ e the MSE is calculated relative to the mean value which characterizes the setpoint of the system.The calculated MSE is proportional to the energy changes relative to the setpoint.• In case of throttle the measure is simply the integral of throttle commands with t(i) sampling times.This integral is proportional to the energy input through the engines.
The calculated quality measures for model verification are shown in Table 4 together with the percentage of the simulation (SIM) measure relative to the flight measure.
The altitude energy error measures are almost the same as the simulation does not cover every peak of the flight data but has larger differences elsewhere (see Fig. 9).The IAS energy error is almost 13%, the pitch rate and roll angle error measures are about 27% and 17% while elevator activity is about 24% smaller in the simulation thanks to the asymptotic settling without overshoot and oscillations due to the lack of turbulence or windgust disturbances (see Fig. 12).The pitch tracking error measure is significantly smaller while the mean pitch command is only 10.7% smaller in the simulation.The elevator (absolute) mean value is 14% larger in the simulation due to the slightly different pitch setpoint.The throttle activities are almost exactly the same despite the different characteristics shown in Fig. 15.
Covering well the initial transients, providing very similar setpoints and showing only the effect of turbulence and windgusts in the real flight as the main difference between the results the Matlab model of the Sindy aircraft is appropriate for evaluation and tuning of new control algorithms.
So after the validation of the Matlab model trial and error tuning of the three longitudinal control methods was done in MIL simulation to achieve balanced altitude and IAS tracking performance.After PIL validation the pre-tuned controllers were all flight tested and refined as Section 5 shows.As

Simulation Comparison of the Longitudinal Controllers Through Special Test Cases
This section presents the simulation (MIL) test results and comparison of the three methods (PI, TECS and TECSMOD) for the following special cases: • Test for jumps in control inputs when there are jumps in the reference signals ( [13,22]) • Test for excessive throttle activity caused by air turbulence (as [22] points out that with energy rate-based control high throttle activity can be observed in case of turbulence, while [2] shows that with energy-based control the oscillations can be decreased.So the considered

Behavior in Case of Reference Signal Jumps
To test the methods for the jumps of inputs upon jumps of references an IAS and then an altitude doublet reference is applied in MIL.The amplitude of the IAS reference is 2m/s with 18 m/s initial value, 40s period time and 10s start time (see Fig. 17).The amplitude of the altitude reference is 10m with 157m initial value, 60s period time and 70s start time (see Fig. 18).Table 5 shows the same quality measures as applied in the verification of the simulation model.Figure 17 shows that at the first IAS reference change the PI and TECS methods do not have overshoot while the  TECSMOD method has about 0.7 m/s overshoot.At the second and third jumps the TECSMOD method has over-(about 0.8 m/s and 0.2 m/s) and undershoots while the others have overshoots later.Regarding settling the rise time of TECS and TECSMOD are about the same while the PI control is slower because it tracks IAS with the slow throttle.At the altitude reference changes (70, 100, 130s) the PI method has the largest IAS transients reaching 3.5 and 6.5 m/s peak differences.The TECS method has lower differences but they are still large (2.5 and 4.3 m/s).The TECSMOD method is definitely the best holding the IAS error in the ±0.5m/s range most of the time.The IAS measures show the superiority of the TECSMOD method and underline the slow settling and large transients of the PI.
Figure 18 shows that the PI method holds the altitude very well (in about ±0.3m range) when the IAS reference changes.This is not surprising as it tracks the altitude through the elevator and pitch angle which is a fast dynamics.The TECS and TECSMOD methods have very similar transients.Upon altitude reference changes the PI method is the fastest, the TECS is the second fastest while the TECSMOD method is the slowest but it has similar overshoots than the others.The altitude measures show that the performance of the PI and TECS methods is similar while the TECSMOD method is the worst.This slowest altitude tracking of TECSMOD is the price of holding and tracking the IAS really well.Figure 19 shows that the throttle input jumps for any change of the IAS reference (10-50s) with all three methods.This is as expected as throttle controls the IAS in the conventional method and the total energy in the TECS methods so should react to the change.Regarding the changes of the altitude reference (70-130s) the PI method has a gradual increase instead of jumping contrary to the TECS methods.This is reasonable as it only compensates the IAS changes caused by altitude changes with gradual throttle motion.Considering the throttle transients after the first large throttle changes the PI method works practically without overshoots, the TEC-SMOD is the second best and TECS is the worst.The throttle measures show that the overall throttle energy is very similar for the three methods.
Figure 20 shows that the elevator input jumps are about the same for the TECS methods when the IAS reference changes (10-50s) while the PI method has no jumps as IAS is controlled with throttle.Regarding the altitude reference changes (70-130s) the jumps of the TECS and PI methods are about the same while the TECSMOD method has no jumps.The jump values are acceptable having maximum 12.5 • elevator deflection (compare to the maximum allowed value in Table 1).The elevator measures underline these statements having the largest for the TECS method and the smallest for the TECSMOD one with similar mean values.Note that any sudden input change is smoothed by the system dynamics so there is no problem with system behavior.This is shown by Fig. 21 which also shows that when the IAS reference changes the PI method has minimum change in the pitch angle (as IAS is tracked through the throttle) while the TECS and TECSMOD methods have about the same transients with similar peak values.Upon changes of the altitude reference the TECSMOD method has moderate changes in the pitch angle despite holding the IAS value through this angle with high precision.The other two methods have similar large transients which is expected from the PI method as it tracks altitude with the pitch angle.Regarding the TECS method the results show that it has high pitch activity both for IAS or altitude reference changes.The pitch angle measures of PI and TECS are similar and larger than TECSMOD measure.As a summary it can be stated that there are no unfavorable jumps in the controls.For IAS reference changes the PI method reacts mainly with throttle, the TECS method both with throttle and elevator and the TECSMOD method with elevator.For altitude reference changes the PI method reacts mainly with elevator, the TECS method both with throttle and elevator and the TECSMOD method with throttle.The newly proposed TECSMOD method is the best in IAS tracking and hold sacrificing speed and precision of altitude tracking.This can be changed with further fine tuning but the current performance is acceptable for cruise flight missions.

Behavior in Case of Turbulence
The same IAS and altitude references were applied as in the previous test in Section 4.1 (Figs. 17  Comparing Fig. 23 to Fig. 17 shows that the tracking of the IAS reference and transients when the altitude changes are similar with turbulence, but the overshoots and peaks can be either larger or smaller for all methods.The TECSMOD method shows some oscillation on the constant IAS and altitude section (50-70s) but its below ±1m/s.It is caused by higher turbulence in that time range shown in Fig. 22.
Regarding altitude tracking (Fig. 24) and pitch angle behavior (Fig. 25) the observations are the same as for the previous case there is no significant change in the tracking but TECSMOD again shows some oscillation.
Figure 26 shows that there is no excessive throttle usage with any of the methods but the throttle saturates more compared to the previous turbulence free case (Fig. 19).This underlines the observation of [2] stating that the application of energy based TECS control instead of energy rate-based decreases throttle sensitivity to turbulence.
Figure 27 with elevator deflections again shows similar behavior than in the previous case and there is no oscillation even for the TECSMOD control.Impulse-like deflections are at the same time as in Fig. 20 and their height is about the same.They are caused by the step changes in IAS or altitude Figs.28 and 29 show the zoomed throttle and elevator deflections for the turbulence free (from Section 4.1) and turbulence cases when the altitude reference changes from its maximum to the minimum.The figures show that in the throttle there are jumps and saturation for the TECS and TECSMOD controllers unaffected by the turbulence.The PI controller has a gradual throttle increase which becomes more aggressive with turbulence.In case of the elevator the TECS and TECSMOD deflections are similar with/out turbulence while the PI again becomes more aggressive with an impulse-like input.Table 6 shows the quality measures together with their percentage ratio to the turbulence free measures shown in Table 5. Usually the errors and control activities are higher in this case as expected.Only the PI method gives significantly lower IAS measure with the price of significantly higher altitude MSE but similar elevator and throttle activities.This shows that turbulence changed the ratio of energy utilization between IAS and altitude tracking.The TECS method gives similar (a bit worse) IAS and altitude measures with also sim-ilar control activities.The TECSMOD method gives worse IAS and similar altitude performance with higher elevator activity.This is as expected as elevator and IAS are the fast dynamics sensitive to the turbulence.
As a summary it can be stated that none of the methods produces excessive throttle or elevator usage with turbulence, but the tracking balance is changed in case of the PI and the TECSMOD method.This is reasonable as the TECS method  should be balanced through the energy balance term which is missing from both of the other methods.

IAS Doublet Tracking During Ascend
The next simulation test case was IAS doublet tracking during ascend.It is selected as it is more critical due to the possibility to stall the aircraft.A 100m climb was commanded and after the initial transients the same IAS doublet was applied as before (18m/s changed with ±2m/s) from 25s. Figure 30 shows that the PI and TECSMOD controllers produce about the same ascending characteristics by decreasing glideslope at larger and increasing at smaller IAS values.This is because the PI control changes to IAS tracking (through pitch angle) due to the multiple zone control concept.This is similar to speed priority in the TECSMOD controller.The change of the PI controller upon reaching the altitude tracking zone (20m below the reference) can be clearly seen in the figure.
Figure 31 shows a large difference in PI and TECSMOD IAS tracking as the former has only integral control while the latter has PI control from IAS error to pitch angle reference.This shows that PI generation of the reference pitch angle leads to better results.Table 7 shows the quality measures for this case.
In case of the original TECS controller the throttle saturates at 1 (similar to the other controllers) and the pitch angle reference saturates at its maximum 30 • (see Fig. 32).As PD control is applied in pitch tracking (suggested by [14]) the real pitch angle sets to about 12 • (see again Fig. 32) leading to the highest glideslope (and so fastest ascend see Fig. 30) but the lowest IAS at about 13m/s (see Fig. 31).So the very low IAS in Fig. 31 is caused by the saturation of the pitch angle due to the very high (also saturated) pitch reference caused by the large altitude difference in the energy balance term.This underlines the observations of [22,23] about the fact that saturation of the throttle can cause airspeed tracking problems in TECS control.As the stall limit is 11-12m/s this possibly can not lead to stall but significantly slows down the aircraft.The solution can be the limitation of the altitude error term as suggested by [13] or the application of  PID tracking for the pitch angle providing smaller difference between the reference and real value and so possibly avoiding pitch reference saturation.Figure 32 also shows that the PI and TECSMOD methods apply only 5 − 9 • steady pitch angles to maintain velocity during climb contrary to the 12 • value of the TECS method.This is underlined by the pitch measures in Table 7.The altitude measures are extremely high because of the 100m commanded ascend and so large errors for a long time.The PI and TECSMOD measures are similar while TECS measure is lower underlined by the tracking quality in Fig. 30.The IAS measures show the superiority of TECSMOD and the unacceptable performance of TECS.
Figure 33 shows that the throttle saturates at 1 at the same time with all methods but it leaves the saturation at different times.The earliest is the TECS control as it approaches the reference altitude at about 108s.The second is TECSMOD control at about 118s.The third is PI control at about 122s.
Figure 34 shows that the elevator deflection of the PI control has peaks when the altitude reference changes and the method changes from ascend to altitude track modes.During the ascend mode the elevator changes are slow following the slow changes of the reference pitch angle to track the IAS.In altitude tracking mode the deflections are more agile.The TECS method has a quick transient when the altitude reference changes then it sets to the equilibrium value to maintain constant (saturated reference) pitch and IAS and finally slowly changes to the horizontal flight value.The TECSMOD control has agile elevator changes when the IAS reference jumps otherwise it is set to the equilibrium value to maintain IAS.TECS has the highest average deflection and measure while TECSMOD has the lowest ones.
Summarizing the results during ascend only the PI and TECSMOD methods could follow the reference IAS values the latter giving better results because of the PI generation of pitch reference instead of the simple I term in the PI method.The PI method was only capable for tracking because of the mode switching to IAS priority with which the TECS method could also be improved.However, the TECS method with IAS priority leads to the TECSMOD method where the mode switching is avoided applying IAS priority all the time.

Attempted Ascending Glideslope Tracking
Glideslope tracking was evaluated for all controllers without dedicated glideslope mode.Thus the reference altitude is gradually changed considering the flown horizontal dis- tance (from the switching of the autopilot) and the tangent of the given glideslope angle +5 • .Again ascending mode is considered as it can lead to stall.Table 8 shows the quality measures of this case.
Figure 35 shows that neither of the methods can track the reference altitude with the given glideslope.Note that data is plotted against time not against distance thus the slope of the curves is different depending on the horizontal velocity of the aircraft.The PI and TECS methods are relatively close to their references while the TECSMOD method is far from it as also shown by the altitude measures in Table 8.This is because the previous methods decrease the IAS to about 13.3m/s (again with saturated pitch reference) while TEC-SMOD control holds the 18m/s reference (see Fig. 36).The IAS measures in Table 8 clearly show this having the largest for the PI control and the smallest for TECSMOD.TECS is better than PI as it decreases the IAS slower and increases earlier.Now, as the altitude error is continuously small the PI method stays in altitude tracking mode.The results show that +5 • glideslope is too high for every method and the TECSMOD method requires a glideslope mode enabling the decrease of reference IAS to a safe smaller value.However, all the methods tend to track the reference and finally achieve the final altitude.The other measures in Table 8 show that similarly to the ascending case again about the same throttle activity is applied as the altitude (energy) difference was the same for all controllers.The pitch activity is largest for the PI (resulting in the best altitude tracking) and the smallest for TECSMOD method.The elevator activity of PI and TECS are similar while again the smallest for TECSMOD.
As a summary it can be stated that neither of the methods could track the given glideslope in this form of the control solution.The PI and TECS methods slowed down to 13.3m/s while the TECSMOD method held the 18m/s reference.All of them ascended on a lower glideslope.The solution can be first, the PID control of the pitch angle to remove the large difference between the reference and real value.Second, the introduction of a separate glideslope mode with decreasing (in ascend) and increasing (in descend) the airspeed between safe limits.

Tracking of Coordinated References
Coordinated references mean that the IAS and altitude references are changed to preserve the total energy of the system.An ascend and slow down maneuver is considered having IAS decrease from 18m/s to 15m/s.The reference total  energy is K re f = mgh re f + 1 2 mV 2 re f .Considering a relative altitude (positive) and IAS (negative) reference change the reference total energy becomes: From this the expression for the coordination of reference values is . Considering the given values for V = 3m/s this results in h = 5.05m which can be seen in Fig. 37.In the simulations the altitude reference was changed following the +5 • glideslope until reaching the limit of the coordinated IAS reference at 15m/s.At first, 50s time was left for the initial transients of the system, the references were changed only after.The quality measures are shown in Table 9.
Figure 37 shows that altitude tracking of the TECS and TECSMOD methods is about the same only the PI method has some longer transient before reaching the reference value.Note that now again +5 • glideslope was applied but coordinating the IAS reference (see Fig. 38) with the altitude the methods were able to track it.The error measures show that the overall altitude and IAS errors are the largest for the PI method, they are balanced for the TECS method and about balanced for the TECSMOD method but with higher values.Overall the TECS performs the best as expected from the energy and energy balance-based method.
Figures 39, 40, and 41 show that despite the energy coordinated references there is a set point change in pitch angle, throttle and elevator due to the change in air drag and aircraft pitching moment with the change of the IAS.The measures show that these changes are similar for every method.
As a summary it can be stated that the methods followed the coordinated references similarly the TECS methods being a bit better in IAS while the PI method being a bit better in altitude tracking.The results show that due to the changes of air drag and pitching moment with IAS it is only approximately true that coordinated references do not change the total energy of the system.

Summary of MIL Test Results
As an overall summary of MIL tests it can be stated that the TECSMOD control is not worse than the other two methods.It is the best in IAS tracking irrespective of the altitude dynamics but as a consequence it is slower and more inaccurate in altitude tracking and it has larger overshoots in the IAS upon reference jumps.This is a result of tuning which focused on IAS precision sacrificing the altitude performance.With different tuning the results can be different.Compared to the conventional TECS and PI solutions the main difference is the application of the control inputs.TECS reacts both with pitch angle (elevator) and throttle for either IAS or altitude reference changes showing a coupling between the two control loops.PI reacts with the throttle for IAS and pitch angle for altitude reference changes while TECSMOD reacts with pitch for IAS and throttle for altitude reference changes.Thus PI controller is the best in altitude tracking but it is slow in IAS tracking.Neither of the methods is sensitive to turbulence After evaluating the different methods in simulation real flight test results with the Sindy aircraft are presented in the next section.Besides the tracking performance handling of sudden engine failure is also evaluated.

Real Flight Test Results
The three high-level and the low-level controllers were compiled to C and applied on the onboard FCC (Flight Control Computer) system of the Sindy test aircraft (Fig. 1).This FCC system was developed in SZTAKI in frame of the FLEXOP EU H2020 research project [34] and further improved in frame of the FliPASED EU H2020 project [35].It consists of a Raspberry PI microcontroller and custom FlightHat (interface board) and RxMux devices (see Fig. 42).Besides this module the Pixfalcon PX4 autopilot [28] is applied as the onboard sensory system together with the compatible Prandtl tube [27].Only its sensor measurement and state estimation functions are utilized, none of the autopilot functionalities are applied.Pixfalcon sensory information is gathered and the autopilot is run at 50Hz.The overall hardware setup is shown in Fig. 43.The Pixfalcon sensor is not in the center of gravity it is forward of it.But considering the noise levels of low cost sensory systems a few 10cm difference does not cause any significant error in state estimates.
All of the controllers were first tuned in the MIL setup, then tested in PIL where the code runs on the onboard system of Sindy but controls its Matlab simulation model (the same model as in MIL).After code verification in PIL real flight tests and trial and error fine tuning were conducted.In the real flights switching between manual and autopilot modes can be done through a dedicated switch of the RC transmitter.This way manual control can be taken any time (see the engine fault scenarios).
The low level (roll and pitch tracking) controllers were tuned and tested separately then two flight test days were held to test and fine tune the longitudinal controls on 21st June and 11th November 2022.All tests were done commanding   The altitude set point was always the switching altitude that is why the altitude trajectories are shifted to zero initial value in the figures (see e. g.Fig. 45).
Tables 10 and 11 summarize the measures in IAS and altitude tracking considering mainly the June (06) results.Only the TECSMOD altitude tracking results are from also the November (11) test.This is because there was increasing wind and turbulence during the June test day giving unacceptable altitude tracking results for the TECSMOD method in the afternoon and so preventing its fine tuning.Fine tuning of the TECSMOD method was done on the 11th November test day in calm weather.Detailed analysis of the measures is done in the following subsections.

Tracking of IAS Doublet
Figure 44 shows that the TECSMOD method has the best IAS tracking performance underlined by the error measure in Table 10 the second best is TECS while the third is the PI method.At the same time the overshoot at the sign change of the reference is largest with the TECSMOD method while the TECS is smaller and the PI method does not have overshoot.
In altitude hold (see Fig. 45) the TECSMOD method is the worst, the TECS method has faster dynamics with smaller peaks while the PI method a slower change with larger peaks.The measures are about the same for PI and TECS and the largest for the TECSMOD.The worst altitude tracking performance is the price of the best IAS tracking with the TECSMOD method (resulting also from tuning not only from system properties).
Figures 46 and 47 show the throttle positions and elevator deflections.Considering sudden changes and peaks the TECS method is the most aggressive then comes the TECSMOD and finally the PI method.Accordingly the measures show that TECS has the highest elevator usage TECSMOD the second highest and the PI method has the lowest.This is reasonable as the PI method uses the elevator to hold the altitude requiring less effort than the TECSMOD method continuously tracking the IAS with the elevator.TECS method controls the energy balance with the elevator so reacts both for altitude and IAS errors causing the largest activity.The throttle activity is also the largest for the TECS method.
The pitch activity is not plotted but the measures show highest activity for TECS and smallest for the PI in good agreement with the elevator measures.
Figure 48 shows the zoomed parts of IAS tracking and elevator deflections in the most critical range when the IAS changes from maximum to minimum value.The figure shows that the IAS overshoot of TECSMOD is larger than with TECS and at the same time the TECS elevator deflection is larger than with TECSMOD.
Figure 49 shows the load factors being the largest for the TECS method (-1 to +3.2), the second largest for the TEC-SMOD (+0.3 to +2.1) and the smallest for the PI method (+0.3 to +1.6).This is again in good agreement with elevator use intensity.
As a summary it can be stated that TECSMOD is the best in IAS tracking while the worst in altitude hold similarly to the MIL simulations.The throttle use is about the same by the three methods as they execute the same maneuvers with the same aircraft so reach approximately the same energy states.The elevator use is the most intensive by TECSMOD tracking the IAS doublet and least intensive by PI holding only the altitude.The TECS method is in between reacting to IAS and altitude errors also.

Tracking of Altitude Doublet
In this case the 11th November test of the TECSMOD method is plotted together with the 21st June tests of the PI and TECS methods.Thus the comparison is not completely correct having different weather conditions but the limited resources prevented repetition of all flights.
Figure 50 shows that IAS hold is best with TECSMOD and worst with TECS method this is underlined by the measures in Table 11.Note that for the June TECSMOD flight the IAS error measure is the worst but there was high wind disturbance and a controller without fine tuning.Also note that PI and TECS results would be better on 11th November  In Fig. 51 at first, the TECSMOD method seems to give the best results but checking the error measures in the table shows that it is slightly worse than the TECS method (while PI is the best).This is because it converges slower after the large reference change.However, after the transient its peak differences are smaller than with the other methods.It should be noted that in the November test the weather was calm contrary to the high wind and gusts in June so this difference between the methods should be smaller (underlined by the TECSMOD altitude measure for the June (06) test).
The throttle use of the methods (see Fig. 52) is about the same underlined by the measures.Regarding the elevator deflections the TECSMOD method gives the smallest measures verified by Fig. 53.This is partially because it holds the constant IAS with the elevator (while PI applies it to track the altitude and TECS to balance energy) but partially because the different weather conditions.The PI and TECS measures are similar.
The pitch activity is not plotted but the measures show similar activity for PI and TECS and lower for TECSMOD as expected from elevator activities.
Figure 54 shows the zoomed throttle and elevator deflections when the relative altitude reference changes from its Figure 55 shows that now the load factor is smallest for the TECSMOD method (refer to the lowest use of elevator) second smallest for the PI method and largest for the TECS method.This together with the previous Section 5.1 shows that always the TECS method generates the highest load factors while PI and TECSMOD load factors depend on IAS (TECSMOD larger) or altitude (PI larger) tracking.As summary it can be stated that the comparison here is not completely conclusive due to the different weather conditions but all three methods performed acceptable without having excessive errors either in IAS or altitude.Considering the details in IAS tracking and hold the TECSMOD method is the best while PI and TECS methods have similar performance.In altitude tracking and hold the best is PI and the worst is TECSMOD this is the price of excellent IAS tracking with TECSMOD.Regarding throttle activity all three methods are similar.Elevator activity depends on the actual references in IAS tracking TECSMOD is more active while in altitude tracking PI.TECS is always the most active in elevator as it reacts both for IAS and altitude changes.After evaluating the normal behavior of the controllers the handling of engine failure was tested.

Behavior with Engine Failure
The goal of this test was to check if the controllers stall the aircraft when altitude and IAS hold is commanded while the engines are stopped.The results show that PI and TECS methods stalled it, while the TECSMOD method started a well controlled descent holding the commanded 20m/s IAS (see Fig. 56).The IAS tracking figure also shows that the PI and TECS methods stall despite the fact that the IAS is not in the theoretically critical range (11-12m/s).This difference can occur because of the commanded −30 • coordinated turn.
Figure 57 shows that the PI method tries to hold the altitude (see the pulled elevator in Fig. 58) but then tends to descend.Stall and so switching into manual mode occurs just before the PI control reaches the 20m altitude zone limit and changes  to IAS tracking through the pitch angle.So by tuning the altitude zone limit the stall could be prevented.
In Fig. 58 when the saturated elevator position starts to move back with PI and TECS control that means switching to manual mode after stall.In case of TECS control the elevator saturates later and also the stall occurs later but the IAS even does not start to approach the reference value (see Fig. 56).The TECSMOD control uses minimum elevator deflections around the −3 • trim value similarly to the IAS tracking test in Section 5.1.
Figures 59 and 60 show the pitch and roll angles respectively.It can be seen that in stall both angles increase suddenly (there is no angle of attack sensor on Sindy) while the TEC- SMOD method is able to hold the pitch around a steady value and track the −30 • roll angle.With PI control the roll angle continuously decreases until reaching stall (moving into a gradually tighter turn).The TECS method holds the roll angle between −35 • and −40 • before stall together with the pitch angle around the steady value of the TECSMOD control which could be a stable flight mode.But finally it also stalls the aircraft.Of course, introduction of an IAS priority mode can solve this, but it requires the detection of the engine fault and switching according to [22].The IAS priority is a basic property of the TECSMOD control removing the need both for engine fault detection and mode switching.As a summary it can be stated that in the presented form only the TECSMOD method prevented stall when the engines stopped.The PI method would require tuning of the altitude zone limit while the TECS method would require IAS priority mode switching after engine fault detection.

Conclusion
This paper deals with altitude and IAS tracking control of small unmanned aircraft (UAV).Based-on the flight test experience of the author and literature review a new contribution is introduced called modified total energy control (TECSMOD).This introduced new method considers a precaution proposed in literature by controlling the IAS through pitch angle and the total (kinetic + potential) energy of the system with the throttle.This inherently prevents stall upon engine failure or throttle saturation without fault detection or mode switching.Upon introducing a new method it is mandatory to compare it to existing ones.Conventional proportional-integral (PI) and total energy (TECS) control methods were selected as the reference controllers.The selected PI method controls the IAS through the throttle and the altitude through the pitch angle if the altitude is close to the reference value.Outside a given zone from the reference altitude it switches to IAS track mode (through elevator) having full throttle in ascend and idle in descend.The TECS method is based-on system energy differences and controls the total (kinetic + potential) energy of the system with the throttle and the energy balance (kinetic -potential) through pitch angle.The introduced new TECSMOD method is the same construction as applying TECS control with IAS priority all the time.It also makes tuning easier first tuning the IAS tracking part with fixed throttle and then the total energy part for satisfactory altitude tracking.This is easier than tuning the energy balance controller where the physical insight is more complicated.
To check the applicability of the introduced new controller it should be tuned and tested together with the other two controllers on the same aircraft.The selected aircraft is the Sindy test UAV of Institute for Computer Science and Control, HUN-REN, Hungary (SZTAKI) for which a Matlab simulation model was also developed.This provides the opportunity to conduct part of the tests in simulation and pre-tune the algorithms before real flight testing.
After introducing the control methods the article dealt with the verification of Sindy simulation model based-on real flight results collected in calm weather.Then special longitudinal test cases proposed by the literature were checked in simulation to compare the controllers.Finally, real flight test results with IAS and altitude doublet tracking and engine fault handling were published.
As a summary of simulation and real flight results it can be stated that the newly proposed TECSMOD method has the best performance in IAS tracking while the worst in altitude tracking but this worst performance is also acceptable.The other two methods (PI and TECS) track the altitude better than the IAS having similar performance compared to each other.It is important to note that re-tuning the controllers can give different performance, fine tuning was finished upon reaching acceptable performance perfection of the controls was not a goal.The throttle activities of the three controllers are about the same while the PI and TECSMOD methods use less elevator actuation than the TECS method (which reacts with elevator both for IAS and altitude changes because of the energy balance term).Considering engine failure (by commanding zero throttle for all two engines) only the TEC-SMOD method could prevent stall.For the PI method the altitude tolerance for the switch to IAS priority was too high and the aircraft stalled earlier.This shows the danger of applying a conditional switching in the controllers as the switching conditions should also be tuned.In case of TECS control also an IAS priority switch can be implemented again giving a need for switching condition tuning (and also for the detection of engine fault).The TECSMOD method applies IAS priority all the time so there is no need for fault (or stall) detection, switching and its tuning.
Finally, the introduced new method proved to have similar performance than the others only being less precise in altitude tracking.This is only a problem at landing scenarios where precise glideslope tracking is required so in the future this extra mode should be introduced.Besides this disadvantage a great advantage is engine fault tolerance and stall preven-tion in case of throttle saturation without any conditional switching.So a simple, safe and well performing longitudinal control alternative is introduced which to the best of the author's knowledge is unpublished until now.

Fig. 1
Fig. 1 Sindy test UAV of Institute for Computer Science and Control, HUN-REN, Hungary

Fig. 8 Fig. 9
Fig. 8 Ground relative trajectories in test flight (the dashed part is the autopilot mode)

Fig. 10 Fig. 11
Fig. 10 Pitch angle tracking in real flight and simulation (SIM)

Fig. 14
Fig. 14 Elevator deflections in real flight and simulation (SIM)

Fig. 22
Fig. 22 Windgust outputs of the Dryden turbulence model

Fig. 30
Fig. 30 Altitude during climb with IAS doublet change in simulation (PI conventional, TECS and TECSMOD autopilots)

Fig. 31
Fig. 31 IAS during climb with IAS doublet change in simulation (PI conventional, TECS and TECSMOD autopilots)

Fig. 32
Fig. 32 Pitch angle during climb with IAS doublet change in simulation (PI conventional, TECS and TECSMOD autopilots)

Fig. 35
Fig. 35 Altitude references and altitude during glide tracking attempt in simulation (PI conventional, TECS and TECSMOD autopilots)

Fig.
Fig. Altitude hold during IAS doublet tracking in flight (PI conventional, TECS and TECSMOD autopilots)

Fig. 54
Fig. 54 Zoomed throttle and elevator deflections during altitude doublet tracking in flight (PI conventional, TECS and TECSMOD autopilots)

Fig. 61
Fig. 61 Load factors with stopped engines in flight (PI conventional, TECS and TECSMOD autopilots)

Table 1
Physical parameters of

Table 3
High-level controller parameters