Design and Implementation of an Optimal Energy Control System for Fixed-Wing Unmanned Aerial Vehicles

Ying-Chih Lai 1,* and Wen Ong Ting 2 1 Department of Aerospace and Systems Engineering, Feng Chia University, No. 100, Wenhwa Road, Seatwen District, Taichung 407, Taiwan 2 Institute of Aeronautics and Astronautics Engineering, National Cheng-Kung University, No. 1, Daxue Road, East District, Tainan 701, Taiwan; tingwenong@gmail.com * Correspondence: yingclai@fcu.edu.tw; Tel.: +886-4-2451-7250 (ext. 3956)


Introduction
Driven by advanced computing technologies, open-source systems, investigations and applications of unmanned aerial vehicles (UAVs) have progressed at an astounding speed in the past decades.To extend the applications of UAVs in wide area or long range, the fuel efficiency of the propulsion system plays a key role in this topic.In general, a fixed-wing aircraft has higher aerodynamic efficiency than a rotorcraft, which implies that it has better endurance and range than the rotorcraft.It can provide the advantage of longer flight durations at higher speeds thus enabling larger survey areas per given flight.Both the range and endurance of an aircraft depend on rate of fuel consumption of the engine.Therefore, the flight control design plays an important role in the optimization of the fuel consumption for an aircraft or UAV.In conventional flight control design, the autopilot and the autothrottle systems are usually considered separately [1].The autothrottle unit is mainly used to adjust the engine throttle valve to achieve the desired flight speed, and the autopilot unit is designed to regulate the control surfaces for attitude and altitude maneuvers.However, since the dynamic model of an aircraft is nonlinear and uncertain, interaction between autopilot and autothrottle systems actually exists, and dynamic coupling between speed and altitude always occurs.
According to the study proposed by Denker [2], a pilot who tries to control airspeed and altitude separately winds up controlling one or the other rather poorly.Often times, the airspeed gets too low, whereupon the wing stalls and the pilot abruptly loses control.There is a coupling effect between airspeed and altitude, and controlling either one will affect another.In conventional flight control system, airspeed is controlled by throttle and altitude is controlled by elevator.This method will cause the undesirable flight path and airspeed coupling, and loss of airspeed control when thrust is limited.Therefore, by utilizing the relationship between airspeed and altitude, a control system was introduced by utilizing the energy of an aircraft.The first energy-based flight control system, named total energy control system (TECS), was developed by Lambregts [3,4].TECS is a generic control technique that integrates all longitudinal flight-path and speed control functions, which does not depend on a particular aircraft type [5].For fixed-wing aircraft, the mechanism and applications of TECS were used in guidance [6,7] and flight control [5,8,9].TECS based controllers have been successfully implemented on many aircrafts, such as the National Aeronautics and Space Administration (NASA) B737 technology demonstration plane [10], a general aviation aircraft [11], and a motor glider [12].For helicopter, the design of a flight control system using TECS and H ∞ control theory was introduced in the study [1].
Recently, studies based on TECS for UAVs have attracted more and more attention.However, compared to manned aircrafts, there are relatively few studies focused on the fuel efficiency of UAVs [13,14].To enhance the performance and usability of UAVs, there is a need for UAVs to increase endurance and/or reduce the amount of fuel carried.Many studies of UAVs focused on the problem of determining the optimal trajectory required to improve the fuel consumption [15][16][17].Therefore, the design of the flight controllers emphasized on how to keep on the desired trajectory.For example, Deittert et al. used a Linear Quadratic Regulator (LQR) to stabilize the UAV on its nominal trajectory whilst rejecting disturbances and modeling errors [16].However, for a typical flight profile of an aircraft, the level flight, climbing, and descending maneuvers are performed all the time after the aircraft leaves the ground.Therefore, the longitudinal flight control plays a significant role in fuel efficiency of an aircraft.A nonlinear description and implementation of TECS and a Lyapunov-based update law to estimate the aerodynamic drag coefficient of a UAV, assuming that the structure of the aerodynamic drag is known, were presented in [14].Moreover, a longitudinal flight control system for UAVs based on TECS using 1 adaptive control theory was proposed in [13].
The fuel efficiency of UAVs is a significant issue that will limit their applications in wide area and long range.A popular solution is to adopt new propulsion systems, such as fuel cell or solar power, but these new systems are expensive and unstable due to the weight and space constraints of UAVs.Therefore, we decided to provide an approach based on flight control theory and flight dynamics.The proposed approach has the ability of the optimization of the fuel consumption and will not increase the cost and weight of UAVs.The goal of this study is to provide an optimal flight control system based TECS for fixed-wing UAVs.We propose an optimal energy control system (OECS) by integrating TECS and LQG regulator [18] to improve the fuel efficiency of UAVs.The successful flight demonstration of a UAV, named Spoonbill, proved that the LQG regulator can be effectively used in the flight control of small UAVs [19].However, the longitudinal flight controller used previously on Spoonbill UAV for controlling the flight altitude was an altitude-hold controller.As such, it is unable to maintain a required climb/descent rate of the Spoonbill UAV.To overcome this problem, this study presents the development of an energy-based flight control system, in conjunction with optimal control technique, LQG regulator.Finally, the developed control scheme is verified in the hard-in-the-loop (HIL) simulation of Spoonbill UAV.
The design steps of the proposed OECS are as follows.First, the energy equations of the model of an aircraft are derived to obtain the total specific energy rate, driven by throttle, and the specific energy distribution rate, driven by elevator.Then, the energy distribution state-space model is obtained by using small-disturbance theory and Taylor's series expansion.Second, the system identification process is executed to identify the unknown system parameters of the discrete time state-space model by using a set of experimental input and output data.Third, the proposed OECS is designed to form the aircraft longitudinal flight control system and to control the airspeed and altitude of an aircraft.The control scheme of inner and outer loops is used.In inner loop, the energy distribution loop is designed based on LQG regulator and responsible to regulate specific energy distribution rate to zero.In the outer loop, total energy loop, a gain scheduling method is adopted and it is responsible for driving the error of total specific energy rate to zero.Gain scheduling approach is applied in this study since it has had great success in a variety of commercial as well as military applications [20].Finally, the implementation of OECS is validated in the HIL simulation of the target UAV.
The remainder of this paper is organized as follows.Section 2 derives the energy equations and state-space model for an aircraft.Section 3 presents the process of determining adequate mathematical model by using the system identification method.Section 4 presents the design and implementation of the proposed OECS.Section 5 shows the simulation results using the HIL system of Spoonbill UAV.Finally, Section 6 gives the conclusions of this study.

Aircraft Energy Equations and Dynamic Model
The concept of TECS design is to compute the total energy state and desired state of an aircraft as represented by flight path, speed, and associated target.The total energy error is controlled by thrust, and elevator controls the energy distribution error between flight path and airspeed.Therefore, it is important to derive the energy equations of an aircraft, especially for the total specific energy rate error and the specific energy rate distribution error.Then, the aircraft distribution energy model can be derived by postulating from the simplified equations of motion and energy equations with the addition of the jerk of aircraft.

Aircraft Energy Equations
The derivation of energy equations is based on Lambregts [4].The total energy of an aircraft can be expressed as the sum of the potential energy and kinetic energy as follows: where g is the acceleration of gravity, h is altitude, m is aircraft weight, V is the longitudinal velocity, E KE is kinetic energy, and E PE is potential energy.Assuming constant weight, Equation (2) can be rewritten as: Similar to the derivation of aircraft equations of motion, by using the small-disturbance theory, the energy of aircraft is linearized at steady flight conditions, as shown below: where V 0 is trimmed airspeed.Assume that (∆V) 2 = 0, and differentiate Equation (4) with respect to time, yielding: Dividing by the trimmed airspeed, V 0 , yielding: where γ is flight path angle.Thus, at a given airspeed, the rate of change of aircraft energy is dependent only upon the change of longitudinal acceleration, ∆ .
V, and the change of flight path angle, ∆γ.Since the total energy is determined by the thrust of engine, the thrust can be derived from aircraft longitudinal equation of motion, m∆ Assuming that ∆γ is small, therefore sin∆γ = ∆γ, then Thus, the aircraft rate of change of energy is proportional to the difference between thrust, T, and drag, D. By rearranging the equation above, the required thrust change as: . E s is total specific energy rate.Assume that during the steady flight condition, the change of drag is small and negligible.The change of thrust is proportional to the sum of change of longitudinal acceleration and change of flight path angle: Conversely, at a specific thrust level, it is possible to trade the change of flight path angle for change of longitudinal acceleration and vice versa using the elevator control only.Finally, the change of total specific energy rate error, driven by throttle, is derived as ∆ .
E s0 = 0 is the total specific energy rate of an aircraft at steady flight condition.
In addition, the change of specific energy rate distribution error, driven by elevator, is derived as where ∆ .
L s is the change of specific energy rate distribution error and a long is longitudinal acceleration along flight path.The detailed derivation of ∆ .
L s refers to the study in [14].

Energy Distribution State-Space Model
By assuming that aircraft is a rigid body with fixed mass distribution and constant mass, the aircraft equations of motion can be obtained by Newton's second law.In addition, the energy equations are obtained from law of conservation of energy.The equations of motion and energy equations are both simplified by using small-disturbance theory and Taylor's series expansion.The aircraft distribution energy model is postulated from the simplified equations of motion and energy equation with the addition of the jerk of aircraft.The energy distribution state-space model can be expressed in the following equation: The previous part shows that the linearized aircraft dynamics may be structured and expressed in the form of linear state-space equations.To implement the flight control system of the target UAV in real system, the equivalent state-space equations in discrete time domain were obtained by using system identification process.The used discrete-time mathematical model with no physical meaning, and the details of system identification process and discrete-time model are presented in Section 3.

Total Energy Model
For total energy model, assuming that the rate of work (power) done by the engine, P E , is correspond to the total specific energy rate error, .E s , with no power loss.In addition, assuming that the torque, τ, is constant, we will have .
where rpm is the revolutions per minute of engine.According to Hsieh [21], engine rotational speed is a nonlinear function of airspeed and throttle area, which implies that .
E s is a nonlinear function of airspeed and throttle: .
Assume that the change of airspeed is small, and then Equation ( 17) can be linearized.This result provides that the change of throttle is small around a trim throttle setting.
where µ is a constant.

Aircraft System Identification
Aircraft system identification is the process of determining the unknown parameters of the adequate mathematical model [22], and the parameters have to be determined indirectly from the measured data.The flow chart of system identification process is presented in Figure 1.It begins with aircraft model postulation based on a priori knowledge about aircraft dynamic, aerodynamic and energy.After that, experiments are designed to measure the necessary output variables that are postulated.The experiment consists of deciding the operating flight conditions of the aircraft and designing of aircraft optimal control input to excite the dynamic motion of the aircraft.Next, the measured data undergo data compatibility analysis to compare with the reconstructed aircraft responses based on known rigid body kinematics.With the available input-output data, the parameters of the model can be estimated.The final step will be model validation with different set of input-output data.The identified model must demonstrate that its parameters have physically reasonable values and acceptable accuracy and that the model has good prediction capability on comparable aircraft maneuvers [23].

Input Design
The objective of input design for aircraft system identification is to excite the aircraft so that the data contain sufficient information for accurate modeling, subjected to the practical constraints of the experiment [23].The common longitudinal flight maneuvers for aircraft system identification consist of short-period maneuver, phugoid maneuver, thrust variation, et cetera, which will be able to excite the longitudinal motion of aircraft, that is, short-period mode or phugoid motion.According to Jategaonkar [22], short-period motion is a fast responding longitudinal mode, provides the most information to enable the estimation of derivatives pertaining to the vertical and pitching motion.Since phugoid mode is the energy exchange, it is more suitable than short-period mode to excite the energy characteristic of the aircraft, which is the function of pitch angle, angle of attack, and longitudinal acceleration.The methods of utilizing the flight maneuvers in input design are called optimal input design, where the aircraft system identification uses the approach of a priori knowledge about the dynamic system response and the input is tailored accordingly.One of the popular optimal inputs is multistep input design where the range of aircraft natural frequencies are investigated, then followed by designing of suitable multistep input to cover the desired frequency range.
A more common multistep input is doublet input, as shown in Figure 2. The doublet input is a two-sided pulse, resulting with a symmetrical signal, which has higher energy and wider frequency bandwidth compared to pulse input.The time step of doublet input can be approximated by: where ∆ DBLT is the time step of doublet input and is the period of aircraft oscillation.

Input Design
The objective of input design for aircraft system identification is to excite the aircraft so that the data contain sufficient information for accurate modeling, subjected to the practical constraints of the experiment [23].The common longitudinal flight maneuvers for aircraft system identification consist of short-period maneuver, phugoid maneuver, thrust variation, et cetera, which will be able to excite the longitudinal motion of aircraft, that is, short-period mode or phugoid motion.According to Jategaonkar [22], short-period motion is a fast responding longitudinal mode, provides the most information to enable the estimation of derivatives pertaining to the vertical and pitching motion.Since phugoid mode is the energy exchange, it is more suitable than short-period mode to excite the energy characteristic of the aircraft, which is the function of pitch angle, angle of attack, and longitudinal acceleration.The methods of utilizing the flight maneuvers in input design are called optimal input design, where the aircraft system identification uses the approach of a priori knowledge about the dynamic system response and the input is tailored accordingly.One of the popular optimal inputs is multistep input design where the range of aircraft natural frequencies are investigated, then followed by designing of suitable multistep input to cover the desired frequency range.
A more common multistep input is doublet input, as shown in Figure 2. The doublet input is a two-sided pulse, resulting with a symmetrical signal, which has higher energy and wider frequency bandwidth compared to pulse input.The time step of doublet input can be approximated by: where ∆t DBLT is the time step of doublet input and T osc is the period of aircraft oscillation.The input design is a part of the iterative process of system identification, until an adequate model is developed and finally the model is successfully with the implementation of the controller.In this study, the energy distribution model consists of elevator input and total energy model consists of throttle input.For aircraft longitudinal motion, without significant influence from lateral dynamics, we can assume that energy distribution model is independent of total energy model.The suitable input for elevator is a doublet signal with ∆t DBLT = 1 s.The maximum amplitude is eight degree and the minimum amplitude is −10 degree, as shown in Figure 3.The maximum positive elevator deflection is smaller to prevent the aircraft from excessive pitch down.The multi-steps input in the Figure 3 was suggested by Klein [23].It is chosen due to the rich frequency spectrum covered in the input excitation which would result in better quality of dynamic response data.
A more common multistep input is doublet input, as shown in Figure 2. The doublet input is a two-sided pulse, resulting with a symmetrical signal, which has higher energy and wider frequency bandwidth compared to pulse input.The time step of doublet input can be approximated by: where ∆ DBLT is the time step of doublet input and is the period of aircraft oscillation.The input design is a part of the iterative process of system identification, until an adequate model is developed and finally the model is successfully with the implementation of the controller.In this study, the energy distribution model consists of elevator input and total energy model consists of throttle input.For aircraft longitudinal motion, without significant influence from lateral dynamics, we can assume that energy distribution model is independent of total energy model.The suitable input for elevator is a doublet signal with ∆ DBLT = 1 s.The maximum amplitude is eight degree and the minimum amplitude is −10 degree, as shown in Figure 3.The maximum positive elevator deflection is smaller to prevent the aircraft from excessive pitch down.The multi-steps input in the Figure 3 was suggested by Klein [23].It is chosen due to the rich frequency spectrum covered in the input excitation which would result in better quality of dynamic response data.
The input of throttle is a pulse signal with ∆ = 3 s, as shown in Figure 4.The determination of the duration and magnitude for this input was based on the results of flight simulations and experiments.Moreover, in throttle response, there is a lag time constant, which is typically of the order of 2 to 3 s.This is the reason why the duration of 3 s is chosen for the input design of throttle.

Prediction Error Method (PEM)
In this study, PEM was applied to perform parameter estimation.According to Ljung [24], PEMs are a broad family of parameter estimation methods that can be applied to quite arbitrary model parameterizations and these methods have a close kinship with the maximum likelihood method.The state-space form of energy distribution is then readily available to be identified by using the PEM function in MATLAB System Identification Toolbox.The objective of system identification is to identify the discrete time state-space model in the following form: where k is the number of time-step.Note that x, y, u, w, and v are the state vector, output vector, input vector, process noise vector, and measurement noise vector, respectively.The remaining A, B, C, and K are the so-called system matrices, which determine the dynamics of the aircraft motion, and they are known to be constant with respect to a particular trimmed flight condition.Equation ( 21) is the output equation, and C is output matrix which represents the rationale of a linear relation between the state variables and the output.The used state vector, output vector, and input vector are presented as follows: The input of throttle is a pulse signal with ∆t = 3 s, as shown in Figure 4.The determination of the duration and magnitude for this input was based on the results of flight simulations and experiments.Moreover, in throttle response, there is a lag time constant, which is typically of the order of 2 to 3 s.This is the reason why the duration of 3 s is chosen for the input design of throttle.The input design is a part of the iterative process of system identification, until an adequate model is developed and finally the model is successfully with the implementation of the controller.In this study, the energy distribution model consists of elevator input and total energy model consists of throttle input.For aircraft longitudinal motion, without significant influence from lateral dynamics, we can assume that energy distribution model is independent of total energy model.The suitable input for elevator is a doublet signal with ∆ DBLT = 1 s.The maximum amplitude is eight degree and the minimum amplitude is −10 degree, as shown in Figure 3.The maximum positive elevator deflection is smaller to prevent the aircraft from excessive pitch down.The multi-steps input in the Figure 3 was suggested by Klein [23].It is chosen due to the rich frequency spectrum covered in the input excitation which would result in better quality of dynamic response data.
The input of throttle is a pulse signal with ∆ = 3 s, as shown in Figure 4.The determination of the duration and magnitude for this input was based on the results of flight simulations and experiments.Moreover, in throttle response, there is a lag time constant, which is typically of the order of 2 to 3 s.This is the reason why the duration of 3 s is chosen for the input design of throttle.

Prediction Error Method (PEM)
In this study, PEM was applied to perform parameter estimation.According to Ljung [24], PEMs are a broad family of parameter estimation methods that can be applied to quite arbitrary model parameterizations and these methods have a close kinship with the maximum likelihood method.The state-space form of energy distribution is then readily available to be identified by using the PEM function in MATLAB System Identification Toolbox.The objective of system identification is to identify the discrete time state-space model in the following form: where k is the number of time-step.Note that x, y, u, w, and v are the state vector, output vector, input vector, process noise vector, and measurement noise vector, respectively.The remaining A, B, C, and K are the so-called system matrices, which determine the dynamics of the aircraft motion, and they are known to be constant with respect to a particular trimmed flight condition.Equation ( 21) is the output equation, and C is output matrix which represents the rationale of a linear relation between the state variables and the output.The used state vector, output vector, and input vector are presented as follows:

Prediction Error Method (PEM)
In this study, PEM was applied to perform parameter estimation.According to Ljung [24], PEMs are a broad family of parameter estimation methods that can be applied to quite arbitrary model parameterizations and these methods have a close kinship with the maximum likelihood method.The state-space form of energy distribution is then readily available to be identified by using the PEM function in MATLAB System Identification Toolbox.The objective of system identification is to identify the discrete time state-space model in the following form: where k is the number of time-step.Note that x, y, u, w, and v are the state vector, output vector, input vector, process noise vector, and measurement noise vector, respectively.The remaining A, B, C, and K are the so-called system matrices, which determine the dynamics of the aircraft motion, and they are known to be constant with respect to a particular trimmed flight condition.Equation ( 21) is the output equation, and C is output matrix which represents the rationale of a linear relation between the state variables and the output.The used state vector, output vector, and input vector are presented as follows: x = [∆V ∆α ∆q ∆θ ∆a x ∆a z ] T The rationale of a linear relation between the state variables and the ∆ .
L is based on that the ∆ .
L is the function of the longitudinal acceleration and the flight path angle, and the flight path angle is the function of the pitch angle and angle of attack.In Equation ( 23), ∆q was selected to be the output state instead of ∆θ since ∆q is equal to ∆ .θ and can be directly measured from the inertial sensor.The predictor used to compute the one-step-ahead prediction for an underlying system description is the Kalman filter provided that w and v are Gaussian process.The predictor form of state-space representation can be given by: where x and ŷ are the predicted states and predicted outputs, respectively, and ξ is a vector of parameters that typically correspond to unknown values of physical coefficients.The prediction error, ε, is given by: One of the approaches to qualify how small the ε is to form a scalar value norm or criterion function that measures the size of N. Consider a set of N data from an aircraft is given by: The corresponding norm: Thus, the essence of PEM is the estimation of ξ from the model parameterization and Z N so that the norm V N is minimized.

Aircraft Model Evaluation Method
In order to choose the best model among the identified models, it is required to apply a model evaluation method to evaluate the performance of the models.The used method in this study is adopted from Lee [18], which is variance accounted for (VAF) and norm.Given a set of N data, VAF is defined by the equation below: where var(.) is the variance of the variable in the bracket, y i is the measured output, and ŷi is the predicted output of the identified model.VAF is expressed in percentage where 100% means the outputs of identified model fit the measured output perfectly.However, there is a possibility to encounter with negative percentage, simply indicating that the outputs of the identified model do not fit the measured output.The norm is given by: Appl.Sci.2016, 6, 369 where a smaller value of norm will correspond to a better identified model.There are total of 55 longitudinal flight data collected, performed by using elevator doublet input, with adequate elevator deflection angles.The flight data are named on the form as shown below for the ease of data management and analysis, as an example ft05run11 referred to the fifth flight test and the eleventh run.The aircraft distribution energy models were identified by imposing the performance requirements as shown below: VAF ≥ 85% and NRM ≤ 15 The values of VAF have to be greater or equal to 85% and the norms must be smaller or equal to 15.There are total of 13 identified aircraft energy distribution models along with the trim conditions of the flight, VAF and norm.An example of an identified model ft11run10 that fulfills the performance requirements is shown in Figure 5. Identified models will be short-listed, and cross-validation is performed to further evaluate the performance of the model.Figure 6 presents the cross-validation result of model ft10run07 and data ft10run15.Cross-validation of model ft10run07 with other flight data is shown in Table 1.The discrete-time state-space of ft10run07 model, identified at trim airspeed of 27.44 m/s and altitude of 150.8 m, is given by Equations ( 20)- (24).From Figure 5, the VAF value of ∆q and .L s are 92.31% and 94.52%, respectively, in which both values satisfy the minimum requirement of VAF at 85% based on the our experience.
Appl.Sci.2016, 6, 369 9 of 24 below for the ease of data management and analysis, as an example ft05run11 referred to the fifth flight test and the eleventh run.The aircraft distribution energy models were identified by imposing the performance requirements as shown below: VAF ≥ 85% and NRM ≤ 15 The values of VAF have to be greater or equal to 85% and the norms must be smaller or equal to 15.There are total of 13 identified aircraft energy distribution models along with the trim conditions of the flight, VAF and norm.An example of an identified model ft11run10 that fulfills the performance requirements is shown in Figure 5. Identified models will be short-listed, and cross-validation is performed to further evaluate the performance of the model.Figure 6 presents the cross-validation result of model ft10run07 and data ft10run15.Cross-validation of model ft10run07 with other flight data is shown in Table 1.The discrete-time state-space of ft10run07 model, identified at trim airspeed of 27.44 m/s and altitude of 150.8 m, is given by Equations ( 20)- (24).From Figure 5, the VAF value of ∆ and are 92.31% and 94.52%, respectively, in which both values satisfy the minimum requirement of VAF at 85% based on the our experience.Since model ft10run07 has better performance than others, it was adopted to be the model for control design.The identified discrete-time system matrices of model ft10run07 are shown below:  Since model ft10run07 has better performance than others, it was adopted to be the model for control design.The identified discrete-time system matrices of model ft10run07 are shown below:

Total Energy Model
In Equation (18), the total energy is proportional to the deflection of throttle, ∆δ T .The main objective for this section is to find out the relationship between ∆ .E s and ∆δ T , described by the parameter µ.The ∆ .E s is obtained by applying the ∆δ T as input with a time step of 3 s.An example of Pulse Width Modulation (PWM) input of ∆δ T with a magnitude of 15 µs is shown in Figure 7.We assume that the width of the input is proportional to the deflection of throttle.For each input with different magnitudes, five data were collected to obtain the average value of ∆ .E s , as listed in Table 2.The average values of measured ∆ .E s are plotted against the ∆δ T , and the curve is fitted with a third degree polynomial, as shown in Figure 8.The slope of the fitted curve at zero PWM in Figure 8 is corresponding to the value of 0.0006522.

Total Energy Model
In Equation (18), the total energy is proportional to the deflection of throttle, ∆δ T .The main objective for this section is to find out the relationship between ∆ and ∆δ T , described by the parameter μ.The ∆ is obtained by applying the ∆δ T as input with a time step of 3 s.An example of Pulse Width Modulation (PWM) input of ∆δ T with a magnitude of 15 μs is shown in Figure 7.We assume that the width of the input is proportional to the deflection of throttle.For each input with different magnitudes, five data were collected to obtain the average value of ∆ , as listed in Table 2.The average values of measured ∆ are plotted against the ∆δ T , and the curve is fitted with a third degree polynomial, as shown in Figure 8.The slope of the fitted curve at zero PWM in Figure 8 is corresponding to the value of 0.0006522.

OECS Design
In this study, an OECS has been proposed to form the aircraft longitudinal flight control system and to control the airspeed and altitude of the aircraft.There are two parameters, specific energy distribution rate, , and total specific energy rate, , utilized to characterize the energy of an aircraft or UAV.The block diagram of the proposed OECS is shown in Figure 9.The block diagram of the total energy loop is used to perform the tracking of aircraft altitude.Altitude tracking begins with the commanded altitude, ℎ .The difference between the commanded altitude and the current altitude of the aircraft, h, is the altitude error, ℎ which in turn will be scheduled by gains, .The values of were decided according to the tests of flight simulations.Table 3 shows the gains used in the gain scheduling.This simple gain scheduling is necessary to guarantee the throttle response is small, and thus meet the linearized total energy model, which stated that the increment of total specific energy rate, , is proportional to ∆δ T .The result of gain scheduling is the climb rate or descent rate of an aircraft, which in turn will be divided by airspeed to obtain the flight path angle error, γ .By assuming that the airspeed is almost constant, thus the longitudinal acceleration will be neglected.

OECS Design
In this study, an OECS has been proposed to form the aircraft longitudinal flight control system and to control the airspeed and altitude of the aircraft.There are two parameters, specific energy distribution rate, .L s , and total specific energy rate, .E s , utilized to characterize the energy of an aircraft or UAV.The block diagram of the proposed OECS is shown in Figure 9.The block diagram of the total energy loop is used to perform the tracking of aircraft altitude.Altitude tracking begins with the commanded altitude, h c .The difference between the commanded altitude and the current altitude of the aircraft, h, is the altitude error, h e which in turn will be scheduled by gains, K h .The values of K h were decided according to the tests of flight simulations.Table 3 shows the gains used in the gain scheduling.This simple gain scheduling is necessary to guarantee the throttle response is small, and thus meet the linearized total energy model, which stated that the increment of total specific energy rate, .E e , is proportional to ∆δ T .The result of gain scheduling is the climb rate or descent rate of an aircraft, which in turn will be divided by airspeed to obtain the flight path angle error, γ e .By assuming that the airspeed is almost constant, thus the longitudinal acceleration will be neglected.
values of were decided according to the tests of flight simulations.Table 3 shows the gains used in the gain scheduling.This simple gain scheduling is necessary to guarantee the throttle response is small, and thus meet the linearized total energy model, which stated that the increment of total specific energy rate, , is proportional to ∆δ T .The result of gain scheduling is the climb rate or descent rate of an aircraft, which in turn will be divided by airspeed to obtain the flight path angle error, γ .By assuming that the airspeed is almost constant, thus the longitudinal acceleration will be neglected.The inner loop is energy distribution and pitch stabilization loop where the .
L s is regulated to zero.The inner loop, controlled by elevator, is responsible to distribute the energy of the aircraft between airspeed and altitude.The outer loop is total energy loop, which corresponds to the total energy of the aircraft.Total energy loop, controlled by throttle, is responsible to drive the total specific energy rate error ∆ .E s to zero.

LQG Regulator
The objective of LQG regulator is to regulate .L s and q to zero so that the aircraft's energy is distributed among airspeed and altitude and the aircraft will achieve pitch-axis stabilization.This is completed by feeding the measured .L s and q into the LQG regulator and the corresponding elevator command is computed.The design of LQG regulator is facilitated by the embedded functions in MATLAB.Eventually, a closed loop energy distribution state space model can be formed by using a series of functions in MATLAB.The process begins with the determination of optimal feedback gain of the regulator using the command dlqr.LQG regulator state-space model can be formed with the combination of Kalman estimator state-space model and LQR optimal feedback gain.For more details of LQG regulator design for a small UAV refer to studies [18,19].

Simulation Results and Discussion
In order to examine the feasibility and performance of the developed OECS, the simulations of OECS were conducted in the HIL system of Spoonbill UAV.Three flight maneuvers, level flight, descending, and climbing, were adopted to perform the simulations.Moreover, the influence of the wind effect was considered to validate the reliability of the developed system.The largest magnitude of wind was set to 8 m/s and the wind direction was set to be a headwind in the simulations.

Hardware-in-the-Loop System of Spoonbill UAV
In order to validate the proposed OECS, a HIL system of Spoonbill UAV, as shown in Figure 10, was designed by integrating the onboard computer of Spoonbill UAV, a self-developed graphic user interface (GUI) program, and the X-Plane flight simulator, developed by Laminar Research.X-Plane can communicate with other applications via User Datagram Protocol (UDP).The GUI of the program, written using C++Builder (2007, Scotts Valley, CA, USA, 2007), is used to form the communication between the onboard computer and X-Plane Simulator.In the onboard computer, a flight program was used to integrate and save the flight data, and carry out the flight control at the rate of 20 Hz. Figure 11 shows the architecture of Spoonbill HIL system, and Figure 12 presents the communication between X-Plane and onboard computer with the help of GUI program.

Airspeed and Altitude Hold
With the help of HIL system, the developed OECS is first simulated in the aircraft level flight without the presence of wind.The simulation results of level flight, as shown in Figure 13, show that the change of pitch rate, ∆q, is regulated within ±0.01 rad/s and .L s is regulated at 0.01.At the same time, the airspeed is maintained at around 20.8 m/s and the altitude shows agreement with the commanded altitude, h c , at 150 m.
With the help of HIL system, the developed OECS is first simulated in the aircraft level flight without the presence of wind.The simulation results of level flight, as shown in Figure 13, show that the change of pitch rate, ∆ , is regulated within ±0.01 rad/s and is regulated at 0.01.At the same time, the airspeed is maintained at around 20.8 m/s and the altitude shows agreement with the commanded altitude, ℎ , at 150 m.
Furthermore, aircraft level flight, as shown in Figure 14, is simulated with the presence of wind, and the largest magnitude of wind is 8 m/s.The results present that the change of pitch rate, ∆ , is regulated within ±0.10 rad/s and is regulated within 0.05.Moreover, airspeed is regulated at trim airspeed of 20.3 m/s with the variation of ±0.5 m/s.The trim airspeed is dependent on the identified aircraft energy distribution model.On the other hand, the altitude deviation is less than 2 m from the commanded altitude of 120 m.As a summary for level flight, the performance of the OECS satisfies the airspeed and altitude is successfully held.Furthermore, aircraft level flight, as shown in Figure 14, is simulated with the presence of wind, and the largest magnitude of wind is 8 m/s.The results present that the change of pitch rate, ∆q, is regulated within ±0.10 rad/s and .L s is regulated within 0.05.Moreover, the airspeed is regulated at trim airspeed of 20.3 m/s with the variation of ±0.5 m/s.The trim airspeed is dependent on the identified aircraft energy distribution model.On the other hand, the altitude deviation is less than 2 m from the commanded altitude of 120 m.As a summary for level flight, the performance of the OECS satisfies the airspeed and altitude is successfully held.

Climbing Maneuver
This section presents the climbing performance of the aircraft with and without the presence of wind.The climbing maneuver was performed at the trim airspeed of 20.8 m/s, without the presence of wind.The simulation results are shown in Figure 15.The initial altitude is 150 m and the commanded altitude is 158 m.During the aircraft climbing, the airspeed is maintained within the variation of ±0.2 m/s from trim airspeed.The settling time for the climbing maneuver is around 40 s.Moreover, the change of pitch rate, ∆ , is regulated within ±0.01 rad/s, which is the same as in level flight.On the other hand, is regulated around the neighborhood of 0.01.Note that there is a slight decrease of at 18th second, which corresponds to the increase in flight path angle of the aircraft.
Figure 16 shows the simulation results with the presence of wind and the largest magnitude of wind is 8 m/s throughout the climbing maneuver.During the aircraft climbing, the change of pitch rate, ∆ , is regulated within ± 0.15 rad/s and is regulated within the variation of ±0.1.Besides that, the airspeed is maintained at trim airspeed within the variation of ±1 m/s.The settling time of altitude tracking is around 65 s.

Climbing Maneuver
This section presents the climbing performance of the aircraft with and without the presence of wind.The climbing maneuver was performed at the trim airspeed of 20.8 m/s, without the presence of wind.The simulation results are shown in Figure 15.The initial altitude is 150 m and the commanded altitude is 158 m.During the aircraft climbing, the airspeed is maintained within the variation of ±0.2 m/s from trim airspeed.The settling time for the climbing maneuver is around 40 s.Moreover, the change of pitch rate, ∆q, is regulated within ±0.01 rad/s, which is the same as in level flight.On the other hand, .
L s is regulated around the neighborhood of 0.01.Note that there is a slight decrease of .L s at 18th second, which corresponds to the increase in flight path angle of the aircraft.
Appl.Sci.2016, 6,369 Figure 16 shows the simulation results with the presence of wind and the largest magnitude of wind is 8 m/s throughout the climbing maneuver.During the aircraft climbing, the change of pitch rate, ∆q, is regulated within ± 0.15 rad/s and .L s is regulated within the variation of ±0.1.Besides that, the airspeed is maintained at trim airspeed within the variation of ±1 m/s.The settling time of altitude tracking is around 65 s.

Descent Maneuver
For the descent maneuver, the simulation result without the presence of the wind is shown in Figure 17.Both the change of pitch rate, ∆q, and .L s are regulated within ±0.01 rad/s and ±0.02, respectively.The aircraft descended from 158 to 150 m in around 40 s, while maintaining the airspeed within ±0.2 m/s from trim airspeed.For the simulation results of aircraft descend with the presence of wind, as shown in Figure 18, the errors of ∆q, .L s , airspeed, altitude, and altitude tracking settling time are almost the same as the aircraft climb maneuver.
For the descent maneuver, the simulation result without the presence of the wind is shown in Figure 17.Both the change of pitch rate, ∆ , and are regulated within ±0.01 rad/s and ±0.02, respectively.The aircraft descended from 158 to 150 m in around 40 s, while maintaining the airspeed within ±0.2 m/s from trim airspeed.For the simulation results of aircraft descend with the presence of wind, as shown in Figure 18, the errors of ∆ , , airspeed, altitude, and altitude tracking settling time are almost the same as the aircraft climb maneuver.

Result Comparison of OECS with Fuzzy Logic Control
To compare the performance and fuel efficacy of the proposed OECS with other controller, a flight controller based on Fuzzy logic control was used in this study.The developed OECS is a model-based method, which means that it requires the system identification process and identified model to design the control system.In contrast to the model-based method, Fuzzy logic control (FLC) is a knowledge-based method, which means that no model is constructed, and the design of the FLC requires some understanding of the plant's behavior and expert's experience.The details of the adopted FLC autopilot refer to the study in [25].
Both of the climbing and descending performance of the target UAV without the presence of wind was evaluated.Since there is no autothrottle system in the used FLC, the throttle of the FLC was set to be constant and its value was 1300 PWM.The simulation results of climbing maneuver are shown in Figure 19.The initial altitude is 150 m and the commanded altitude is 158 m.During the aircraft climbing, the airspeed decreases dramatically about 0.8 m/s from initial airspeed.The settling time for the climbing maneuver is around 30 s, and the maximum change of pitch rate, ∆q, is about 1.5 rad/s.When the climbing maneuver is performed, the energy rates change dramatically.The simulation results of descending maneuver are shown in Figure 20.The results are similar to that of the climbing maneuver.In contrast to the OECS, the climbing and descending performance and fuel efficiency of the proposed OECS are better than that of FLC.The aircraft is maintained approximately at trim airspeed, and the required throttle is lower than that in FLC.Moreover, the

Result Comparison of OECS with Fuzzy Logic Control
To compare the performance and fuel efficacy of the proposed OECS with other controller, a flight controller based on Fuzzy logic control was used in this study.The developed OECS is a model-based method, which means that it requires the system identification process and identified model to design the control system.In contrast to the model-based method, Fuzzy logic control (FLC) is a knowledge-based method, which means that no model is constructed, and the design of the FLC requires some understanding of the plant's behavior and expert's experience.The details of the adopted FLC autopilot refer to the study in [25].
Both of the climbing and descending performance of the target UAV without the presence of wind was evaluated.Since there is no autothrottle system in the used FLC, the throttle of the FLC was set to be constant and its value was 1300 PWM.The simulation results of climbing maneuver are shown in Figure 19.The initial altitude is 150 m and the commanded altitude is 158 m.During the aircraft climbing, the airspeed decreases dramatically about 0.8 m/s from initial airspeed.The settling time for the climbing maneuver is around 30 s, and the maximum change of pitch rate, ∆q, is about 1.5 rad/s.When the climbing maneuver is performed, the energy rates change dramatically.The simulation results of descending maneuver are shown in Figure 20.The results are similar to that of the climbing maneuver.In contrast to the OECS, the climbing and descending performance and fuel efficiency of the proposed OECS are better than that of FLC.The aircraft is maintained approximately at trim airspeed, and the required throttle is lower than that in FLC.Moreover, the energy rates are more stable and within small values.The results show that the proposed OECS can achieve the goal of the optimization of the fuel consumption.

Summary of OECS Performance
Table 4 presents a summary of OECS performance for different flight maneuvers and flight conditions.The simulation results for aircraft level flight, descending, and climbing maneuvers show that the errors of airspeed and altitude are very small in windless condition.Besides that, the ∆ and are successfully regulated to a value close to zero.The errors with the presence of wind are acceptable for aircraft level flight, descending, and climbing maneuvers.Moreover, the settling time for climbing and descending maneuvers is the same for tracking a similar altitude difference.This shows that the linearity of the total energy model is satisfied.Furthermore, by comparing the simulation results of OECS and FLC, it shows that the proposed OECS has better performance and fuel efficiency than that of FLC.

Conclusions
The design and implementation of the proposed OECS, which is based on the total energy of an aircraft, has been presented in this study.OECS is an aircraft longitudinal flight control system which is based on pilot-like control strategy to control the airspeed and altitude of the aircraft.The controller design process begins with the postulation of the aircraft model, from aircraft equations of motion and energy equations.After that, the postulated model was identified using the system identification method.The identified models were used to design the developed OECS.Finally, OECS was verified in HIL system of Spoonbill UAV.Three flight maneuvers, level flight, descending, and climbing, were adopted to perform the simulations.In addition, the influence of the wind effect was considered to validate the reliability of the developed system.The largest magnitude of wind was set to 8 m/s.The simulation results show that the implementation of the proposed OECS for different flight maneuvers and flight conditions was successfully validated in the HIL simulation system of the used UAV.When comparing the performance and fuel efficiency

Summary of OECS Performance
Table 4 presents a summary of OECS performance for different flight maneuvers and flight conditions.The simulation results for aircraft level flight, descending, and climbing maneuvers show that the errors of airspeed and altitude are very small in windless condition.Besides that, the ∆q and .L s are successfully regulated to a value close to zero.The errors with the presence of wind are acceptable for aircraft level flight, descending, and climbing maneuvers.Moreover, the settling time for climbing and descending maneuvers is the same for tracking a similar altitude difference.This shows that the linearity of the total energy model is satisfied.Furthermore, by comparing the simulation results of OECS and FLC, it shows that the proposed OECS has better performance and fuel efficiency than that of FLC.

Conclusions
The design and implementation of the proposed OECS, which is based on the total energy of an aircraft, has been presented in this study.OECS is an aircraft longitudinal flight control system which is based on pilot-like control strategy to control the airspeed and altitude of the aircraft.The controller design process begins with the postulation of the aircraft model, from aircraft equations of motion and energy equations.After that, the postulated model was identified using the system identification method.The identified models were used to design the developed OECS.Finally, OECS was verified in HIL system of Spoonbill UAV.Three flight maneuvers, level flight, descending, and climbing, were adopted to perform the simulations.In addition, the influence of the wind effect was considered to validate the reliability of the developed system.The largest magnitude of wind was set to 8 m/s.The simulation results show that the implementation of the proposed OECS for different flight maneuvers and flight conditions was successfully validated in the HIL simulation system of the used UAV.When comparing the performance and fuel efficiency of the proposed OECS with another flight control system based on Fuzzy logic control, the results show that the proposed OECS has better performance and fuel efficiency than that of FLC.

Figure 1 .
Figure 1.Flow chart of system identification process.

Figure 1 .
Figure 1.Flow chart of system identification process.

Figure 3 .
Figure 3. Elevator doublet with time step of 1 s as input.

Figure 4 .
Figure 4. Thrust pulse with time step of 3 s as input.

Figure 3 .
Figure 3. Elevator doublet with time step of 1 s as input.

Figure 3 .
Figure 3. Elevator doublet with time step of 1 s as input.

Figure 4 .
Figure 4. Thrust pulse with time step of 3 s as input.

Figure 4 .
Figure 4. Thrust pulse with time step of 3 s as input.

Figure 5 .
Figure 5.An example of identified model ft11run10.

Figure 5 .
Figure 5.An example of identified model ft11run10.

Figure 7 .
Figure 7.The response of the ∆ with an increment of throttle input.

Figure 7 .
Figure 7.The response of the ∆ .E s with an increment of throttle input.

Figure 12 .
Figure 12.Communication between X-Plane and onboard computer with the help of GUI program.GUI, graphic user interface.

Figure 12 .
Figure 12.Communication between X-Plane and onboard computer with the help of GUI program.GUI, graphic user interface.

Figure 12 .
Figure 12.Communication between X-Plane and onboard computer with the help of GUI program.GUI, graphic user interface.

Figure 12 .
Figure 12.Communication between X-Plane and onboard computer with the help of GUI program.GUI, graphic user interface.

Figure 13 .
Figure 13.Simulation results of level flight without the presence of wind.

Figure 13 .
Figure 13.Simulation results of level flight without the presence of wind.

Figure 14 .
Figure 14.Simulation results of level flight with the presence of wind.

Figure 14 .
Figure 14.Simulation results of level flight with the presence of wind.

Figure 15 .Figure 15 .
Figure 15.Simulation results of climbing without the presence of wind.

Figure 16 .
Figure 16.Simulation results of climbing with the presence of wind.

Figure 16 .
Figure 16.Simulation results of climbing with the presence of wind.

Figure 17 .
Figure 17.Simulation results of descending without the presence of wind.

Figure 17 .
Figure 17.Simulation results of descending without the presence of wind.

Figure 18 .
Figure 18.Simulation results of descending with the presence of wind.

Figure 18 .
Figure 18.Simulation results of descending with the presence of wind.

Figure 20 .
Figure 20.FLC simulation results of descending without the presence of wind.

Figure 20 .
Figure 20.FLC simulation results of descending without the presence of wind.

Table 1 .
Cross-validation of model ft10run07 with other flight data.VAF, variance accounted for; NRM, norm.

Table 1 .
Cross-validation of model ft10run07 with other flight data.VAF, variance accounted for; NRM, norm.

Table 2 .
The average value of ∆ from positive throttle input.PWM, Pulse Width Modulation.

Table 2 .
The average value of ∆ . E s from positive throttle input.PWM, Pulse Width Modulation.

Table 3 .
The gains used in the gain scheduling.
Appl.Sci.2016, 6, 369 21 of 24 energy rates are more stable and within small values.The results show that the proposed OECS can achieve the goal of the optimization of the fuel consumption.Fuzzy logic control (FLC) simulation results of climbing without the presence of wind.rates are more stable and within small values.The results show that the proposed OECS can achieve the goal of the optimization of the fuel consumption.
Figure 19.Fuzzy logic control (FLC) simulation results of climbing without the presence of wind.energy Figure 19.Fuzzy logic control (FLC) simulation results of climbing without the presence of wind.

Table 4 .
A summary of OECS performance for different flight maneuvers and flight conditions.

Table 4 .
A summary of OECS performance for different flight maneuvers and flight conditions.