Professional Documents
Culture Documents
entitled
by
Xiaoru Wang
_______________________________________
Dr. Mohsin M. Jamali, Committee Chair
_______________________________________
Dr. Mohammed Y. Niamat, Committee Member
_______________________________________
Dr. Hong Wang, Committee Member
_______________________________________
Dr. Patricia R. Komuniecki, Dean
College of Graduate Studies
May 2011
An Abstract of
by
Xiaoru Wang
This thesis first of all simulates previously developed F-16 flight surface control system
using direct Model Reference Adaptive Control (MRAC). It simulates all three rotation
motion controls such as pitch, roll and yaw. It then incorporates numerical solution of
differential equation using 4th order Runge-Kutta algorithm in the simulation. A Multiple
Model Reference Adaptive Control (MMRAC) with Genetic Algorithm (GA) based model
selection scheme has been proposed. The second part of this thesis is focused on
sequential code was first written in C++ on .NET Framework 4. Parallel processing
approaches were exploited for parallelization of the GA based MMRAC algorithm. Several
iii
Acknowledgements
I sincerely thank my advisor Dr. Mohsin Jamali for giving me the opportunity to pursue
my research under his guidance. It has been a great learning experience working with him. I
would like to express my deepest gratitude towards him for offering instructive advice at all
times, treating me with endurance, and constantly pushing me to do better every time. I
would also like to thank my thesis committee members Dr. Mohammed Y. Niamat and Dr.
Last, but not the least, I thank my family, fiancé, and friends who have been a constant
source of encouragement and support for me throughout my journey in the Masters Degree
program.
v
Contents
Abstract…………………………………………………………………………………..iii
Acknowledgements………………………………………………………………………v
Contents………………………………………………………………………………….vi
List of Tables…………………………………………………………………………….ix
List of Figures……………………………………………………………………….…...xi
1. Introduction…………………………………………………………………………….1
1.3 Organization................................................................................................... 4
2.4.1 Model-following.............................................................................................. 10
vi
3.1 F-16 Flight Model ........................................................................................ 16
3.2.2 Structure of F-16 Aircraft Body and MRAC Control system .................. 24
vii
4.2.2 Why Genetic Algorithm ................................................................................ 46
References……………………………………………………………………………….78
viii
List of Tables
3-1 Relationship between Roll, Yaw, Pitch and Aileron, Elevator and Rudder ........................19
3-6 Initial State and Command Signals for pitch position tracking control ..............................29
3-7 Initial State and Command Signals for roll position tracking control .................................30
3-8 Initial State and Command Signals for yaw position tracking control ................................30
5-3 Execution Time of Parallelized single model MRAC C++ Simulation ..............................64
5-4 Execution Time of Optimized Parallel single model MRAC C++ Simulation .................71
ix
5-5 Execution Time of Optimized Parallel GA based MMRAC C++ Simulation ..................72
5-6 Comparison of execution time for different serial and parallel programs ..........................73
x
List of Figures
3-5 Simulation flow chart of MRAC based F-16 surface control system ..................................27
3-7 Comparison of pitch control with the function „ODE45‟ and the custom code ..............33
3-8 Magnitude between the pitch control tracking and the command signal ...........................33
3-9 Rate control result in comparison with the command pattern .............................................34
3-10 Error magnitude between the roll control tracking and the command signal..................35
3-11 Yaw rate control result in comparison with the command pattern ...................................36
xi
4-5 The crossover step ......................................................................................................................44
4-9 Comparison between square-errors from normal MRAC and GA embedded MRAC for
4-11 Comparison between square-errors from normal MRAC and GA embedded MRAC for
4-12 MMRAC embedded roll control result in comparison with command signal .................52
4-13 Comparison between square-errors from normal MRAC and GA based MRAC for roll
control .........................................................................................................................................53
xii
Chapter 1
Introduction
1.1 Background
A good system controller is known for its accurate response trajectory and fast
responding speed [1]. For highly non-linear time-variant systems, the desire for such a well-
performed controller grows even greater. Due to the complexity of systems such as flight
control, adaptive control first appeared in the early 1950s and proved its overwhelming
success in the 1980s [2]. The idea of adaptive control came from the researches of aircraft
systems [1].
The accuracy of the system response relies largely on the design of adaptive controllers
[3]. Among various adaptive control schemes, Model Reference Adaptive Control (MRAC)
is known for its accurate tracking of model and stable response process [1]. Therefore the
system controller will use MRAC based algorithm. A structure of such a system is given in
Figure 1.1. A model is pre-designed as a learning example. The controller and parameter
adjustment block modify the system parameters according to the model. As a result, the
1
Pre-selected Parameter
Model Adjustment
U Controlled
Controller System
c
Sometimes a single model is not able to fully represent all the conditions under which the
system will be working [1]. Therefore number of models has to be designed along with a
switching system which keeps the system learning from different models according to
different conditions. Later in this thesis, a Multiple Model MRAC (MMRAC) controller and
The response time of the system on one hand depends on the converging speed of the
controller based on the of system designs; on the other hand, it will also depend on the
execution time of the program based on the real time performance of the control system.
The second part and the key section of this thesis are to speedup of the control system
Modern processors cannot offer higher frequency or faster computer time according to
Moore‟s law. Processor manufactures have reached a road block and the way around this
road block is via multi-cores. Parallel computing has been revived and every processor
manufacturer is offering some kind of multi-core and parallel processing capability [5].
Parallel computing is a special form of execution in which many instructions are carried
out simultaneously. Large scale of computation can often be divided into smaller ones, as
processes, which are then solved concurrently. There are several different forms of parallel
2
processing: data-level, instruction level, loop level and functional level parallelism [4]. The
power consumption and consequently heat generation of the modern processors has
become an issue in recent years. Figure 1.2 shows a basic idea of 4-CPU architecture. As
Figure 1.2 shows, the program is saved in the main memory which is placed at the center of
the figure. There are four processors that are able to work together concurrently sharing the
main memory. The program is able to gain extra speedup if it is properly partitioned and ran
CPU
CPU
Developments in the gaming industry are also leading revolution of Graphic Processing
Units (GPUs) [4]. Today, these GPUs can also be exploited for other math intensive
problems such as control, signal, image and other computational intensive processing. One
of the successful GPU example is Nvidia‟s Compute Unified Device Architecture (CUDA)
enabled GPU [4]. Nvidia has invented the CUDA parallel computing architecture that is
now being shipped in GeForce, ION, Quadro, and Tesla GPUs. Most CUDA enabled
GPUs nowadays have more than 400 cores that can be utilized to run mathematically
3
IBM has introduced a multi-core processor called the Cell Broadband Engine (Cell BE)
processor [5]. The Cell BE processor is a nine-core processor which includes one Power
Processing Element (PPE), eight Synergistic Processing Elements (SPEs), and a Memory
Transfer Engine (MTE). This processor is embedded into Sony Playstation 3 [5].
This thesis uses Intel® i5 core as the computing platform and exploits multi-core
capability under .NET Framework 4 [4]. The i5 core has been specially designed as a parallel
computing platform for PC market. Parallel processing schemes, program partitioning and
This thesis proposes a Genetic Algorithm (GA) based Multiple Model Reference
Adaptive Control (MMRAC) algorithm for F-16 flight surface control system. The system is
first simulated using built-in function free or numerical methods approach in MATLAB.
The developed control system is transformed into C++ under .Net Framework 4 based
system for embedded processing. Parallel processing techniques are applied to the control
system. Different designs are developed and compared with each other in order to optimize
the execution time of the control system. Different parallel processing techniques are
applied to the C++ control system program in order to maximize its overall speedup. The
optimal goal is to design the most accurate and a fast control system.
1.3 Organization
In Chapter 2, adaptive control algorithm and MRAC algorithm will be introduced and
the specific controller for flight surface control will be developed along with the stability
4
analysis. Chapter 3 will focus on the flight model design and MATLAB simulation results.
The aircraft model will be divided into different building blocks for the ease of
understanding and simulation. The focus is to get an accurate control for pitch, roll and yaw
position tracking. Chapter 4 will develop a Genetic Algorithm (GA) based Multiple Model
MRAC control (MMRAC) algorithm. The simulation results will be provided and will be
compared with those obtained from the previous control scheme. In Chapter 5, parallel
processing techniques will be applied onto the C++ program. Several optimization
approaches will be used to improve its computational performance. The execution times will
be optimized and will be used to assess performance of the proposed control system.
5
Chapter 2
The adaptive control was first introduced from the extensive researches of aircrafts‟ auto
piloting issues in the early 1950s [1]. It was found that systems such as aircrafts operate over
various altitudes, speeds, aerodynamics, gravity and other conditions. Therefore, command
feedback control algorithms which only work for one operating condition would no longer
fit the new situation. While, the word “adapt” in adaptive control means “to conform one to
new or different conditions”. Accordingly, an adaptive controller is able to modify its control
scheme in accordance to the new circumstances, not simply one operating condition [2].
On the other hand, with the development of system identification, stability theory,
coefficient estimation and stochastic control theory in 1960s, adaptive control algorithms
became implementable theoretically. In the early 1980s, extensive research was conducted in
this area and adaptive control became a field of study. Adaptive control can be used for
practical applications. Adaptive control algorithm based control systems can be implemented
6
2.2 Definitions and Concepts
Most adaptive controllers perform the control process in two ways. One of them is to
make changes to the controller itself (gains); the other is to change the system parameters
viewed as just another kind of control-law, only in a non-linear and complex way [7].
The common definition assumes that controller parameters are selected by the
adaptation process. The adaptation is associated with the information „learned‟ by the
adaptive controller. Following are mathematical definitions that are used in this work [8].
2. An Adaptive System is one that measures its performance relative to a given index
7
Without defining adaptive directly, Tsypkin (1971) described some characteristic features
of adaptation [7].
the current information to eliminate the uncertainty due to insufficient a priori information
2. It will lead the output to change in a manner that will allow some of the unknown
Generally speaking, adaptive control theory offers a balance of many aspects of control
theory including stability, parameter estimation and control law design. There are lots of
different adaptive control schemes available in the literature [9] [10]. A few adaptive
Gain Scheduling is a possibility when one group of system parameters is not enough
for the whole operating conditions. It is literally open-loop and actually one step removed
from having gains selected from tables by human operators. Data is sensed to determine an
operating region from a lookup table and operating region is defined as a part of the entire
control process and during each loop, system and controller parameters are determined
8
Model Reference Adaptive Control (MRAC) is characterized mainly by the pre-
defined system model. The controller parameters are adjusted towards the model so that the
system would finally behave as the model. There are also many variants of Model Reference
Adaptive Control such as direct MRAC and indirect MRAC etc. One commonly used variant
of direct MRAC is to introduce several models at the same time in accordance with complex
In this thesis, the focus is to control an F-16 flight surface system. The system is highly
non-linear in nature and the operating conditions are changing from time to time. Due to the
nature of flight system, a Multiple-Model MRAC controller is designed and embedded into
the flight system to control the aircraft surface. In the next section, MRAC theory will be
Model Reference Adaptive Control introduces a reference model which describes the
desired performance of the controlled plant. The basic structure of a direct MRAC
Without the reference model, the entire system would be nothing but an ordinary
feedback control system. Error e is the difference between the plant output and the model
output. The adjust mechanism has all parameters that are going to be changed according to
the error e. Thus, two loops, the ordinary feedback loop and the adjust mechanism loop
9
Adjustment
Model
Mechanism
Uc
Controller Plant
There are basically three approaches of designing a Model Reference Adaptive system,
the gradient approach, the Lyapunov functions and the Passivity theory [2]. The gradient
approach assumes that parameters change more slowly than other coefficients in the system.
This is important for the computation of the sensitivity derivatives which is an essential part
of the adaptation mechanism. Both the Lyapunov‟s stability theory and passivity theory have
been used to change the adaptation mechanism. This work will focus on using gradient
2.4.1 Model-following
The model reference adaptive method provides a general method for adjusting the
parameters so that the close-loop transfer function will be close to a pre-defined model. This
Model-following is an efficient way of solving servo control problems as the basic idea is
simple and useful. A specified or predefined model, linear or non-linear, would be given to
achieve the desired response. The parameters in the system would be adjusted in order to get
output of the plant as close as possible to output of the model for given input
signals. Although perfect model-following could be obtained only in ideal situations, analysis
Consider a Single Input Single Output (SISO) system as shown in Figure 2.2.
10
Regulator Process
u y
T Sy
(2.1)
In which u is the control signal and y is the output signal. A and B represent polynomials
If a regulator needs to be identified then the relation between the command signal
(2.2)
(2.3)
where R, S and T are polynomials. Equation 2.3 represents a negative feedback with the
in Equations 2.1 and 2.3 results in the following equation for the closed-loop system:
(2.4)
11
2.4.2 MIT rule
The basic idea in adjusting controller parameters in MRAC is commonly known as the
gradient approach. The gradient approach was first developed at the MIT‟s Instrumentation
Laboratory. Thus, the gradient method of MRAC is often called the MIT rule [1].
Controller parameters of the regulator are changed in the direction that brings the
difference between the process output and the model output to zero. A cost function is used
as description of the controller parameter in terms of the error e. The cost function of the
controller parameter is changed in such a way as to reduce the error. Controller parameters
(2.5)
(2.6)
The derivative is the sensitivity derivative of the system. The adjustment rule of
Equation 2.6 also applies to the case of a vector of adjustable parameters. In that case,
should be a vector and the sensitivity derivative should be the gradient of the error
The MIT rule performs well when the adaptation gain is small. The size of is
dependent on the value of the reference signal and the gain of the system. Moreover, the
convergence rate depends critically on Therefore there is no fixed limits that the control
process would be stable. This is why we also have the normalized MIT rule.
12
2.4.3 Normalized MIT rule
As MIT rule does not guarantee stability, it is imperative for people to modify it. As
mentioned above, MIT rule let the users decide the critical parameter , which determines
the rate of decrease of the cost function [7]. Thus it is possible to obtain a modified rule in
which the rate of decrease would not depend on , nor the value of the command signal.
One successful way is to normalize and replace the MIT rule with
parameter is introduced to avoid any calculation error and to keep the adjustment rate below
in which,
(2.9)
Equation 2.8 is called the normalized MIT rule which makes the adjustment rate
not totally dependent on . With the introduction of the parameter , a predefined limit is
set to avoid the rate of decrease from becoming too large. Thus the stability of MRAC
13
2.4.4 A MRAC Example
In order to make a clear view of the Model Reference Adaptive Control, a system with a
forward gain (k) will be given as an example. Figure 2.3 shows the block diagram of a
(2.10)
In which k is an unknown parameter, but a could be introduced in the model and let
the system keep moving closer towards the model through the adaptation process. Therefore,
the model is defined by the transfer function of the plant with multiplication by a new
constant .
(2.11)
A similar cost function is selected as given in Equation 2.5, which gives the adaptation
result as specified by Equation 2.6. In terms of the transfer function of this particular system,
(2.12)
14
where θ is the controller parameter that needs to be adjusted as it is affecting error e. In
(2.13)
At the last step, MIT rule is applied and the mechanism to adjust θ is determined.
(2.14)
Equation 2.14 is used to tune the system towards the model and it will result in getting
closer to [10].
Adaptive control is useful for complex and highly non-linear systems. MRAC system is
one of the most common algorithms in the area of adaptive control. Due to the nature of F-
16 flight surface control system, MRAC is selected to adjust the system parameters according
to a preset model or a series of models. In the next chapter, the F-16 aircraft model will be
illustrated and the specific MRAC control law will be developed in regards to the flight
model.
15
Chapter 3
Model Reference Adaptive Control (MRAC) algorithm has been proven to be accurate in
response, fast in convergence and stable during control process. It is also very appropriate
for use in a highly non-linear system. Flight control models generally are highly complex in
nature and the deviation of flight surface changes the aerodynamic forces and moments
which are also highly non-linear [12]. In addition, the rapidly changing temperature and air
Stevens and Lewis [14] have described F-16 aircraft flight model in their book “Aircraft
Control and Simulation”. The F-16 aircraft flight model is provided in great details and
various associated program codes with various look up tables are also available. Kamalasadan
and Ghandakly have provided a neural network and fuzzy logic based MRAC system for this
F-16 aircraft model [13]. Therefore choice of MRAC in this work is very appropriate to
An aircraft has three axis namely longitudinal, vertical and lateral. There are also three
parameters roll, yaw and pitch that affect the rotation of a flight in the air. These three
rotations are controlled by surfaces including ailerons, rudders and elevators. Three rotations
16
of an aircraft are shown in Figure 3.1 (Figure obtained from NASA). A detailed diagram of
an aircraft with its various surface control system is shown in Figure 3.2 (Figure obtained
from NASA).
There are three motions along three axes (longitudinal, lateral and vertical) of an aircraft:
front and back along the longitudinal axis; side to side along the lateral axis; up and down
along the vertical axis. Besides, there are three rotations around these axes: pitch (movement
around lateral axis), roll (movement around longitudinal axis) and yaw (movement around
vertical axis). Pitch rotations make an aircraft move upward or downward; roll rotations
make an aircraft roll along longitudinal axis (roll around its body); yaw rotations make an
aircraft turn right or left. Since the aircraft has three rotations and three motions, therefore
17
Figure 3.2: Surfaces on an airplane (NASA) [16].
As Figure 3.2 shows, the ailerons are located on the trailing edge of wings, near the wing
tip of an airplane. They can be used to generate roll rotations. Ailerons are used in opposite
directions which means that when left ailerons deflect upward, the ones on the right have to
move downward. For example, when the left ailerons tilt up and right ailerons tilt down,
more lift is created on the left side and less on the right side. This would result in the aircraft
Elevators are located at the trailing edge of the horizontal stabilizer. They control the
pitch motion, which means that the plane lifts its nose up and down. When elevators are
deflected downward, more lift will be accumulated at the horizontal stabilizers and the
aircraft will move downward. In order that the planes fly horizontally, the total sum of pitch
moments must be zero [16]. Thus altitude changing requires the elevators‟ momentary going
down after going up in order to keep the flight parallel to the ground. On the other hand, as
these elevators are parallel to ailerons, they also have effects on roll controls [17].
Rudders are located at the trailing edge of the vertical stabilizer which control yaw
motions [18]. Rudders are extended so that they obstruct the airflow [19]. In turn, the airflow
18
will push hard on the rudders. Unbalance will be created between the side where the rudders
are obstructing the airflow and the side where they are not. Aircrafts will finally move away
from the side where rudders are extended. Therefore, when rudders tilt to the right, more lift
is created on the right, which will push the vertical stabilizer to the left. This will cause the
Table 3.1 lists the relation between three rotation motions and surfaces.
Table 3.1: Relationship between Roll, Yaw, Pitch and Aileron, Elevator and Rudder
Rotation
Surfaces that affect
motions
Deflection of conventional wing-mounted ailerons and differential
Roll
deflection of the horizontal stabilizers
Pitch Elevators deflection
Yaw Rudder deflection
The specifications and control of all three rotations systems will be presented later in this
thesis.
A mathematical model for the six degree of freedom for the F-16 aircraft has been
developed by NASA-Langley and is also given by Steven and Lewis [14]. A mathematical F-
16 flight model is provided in terms of body dynamics, aerodynamics and force equations
[21]. The steady state trim [22] conditions will be developed thereafter.
The mathematical model developed from the data obtained from NASA-Langley wind
tunnel test applies to a speed range up to Mach number=0.6 [14]. The Mach number
describes the speed of the aircraft. The model confines limits to various actuators including
leading edge flap deflection, horizontal stabilizer, differential tail, aileron and rudder. These
19
Table 3.2: Degree limits of various deflections and actuators
The aircraft model is based on force, kinematics, moment and navigation equations.
(3.1)
(3.2)
(3.3)
(3.4)
(3.5)
(3.6)
(3.7)
(3.8)
(3.9)
20
(3.10)
(3.11)
(3.12)
(3.13)
Equations from 3.1 to 3.13 are system equations which provide the back bone of the
entire surface control. Various parameters used in this model are shown in Table 3.3.
21
Mathematical equations of the F-16 aircraft model are supported by look up tables. They
provide basis of the aircraft flight surface control. These look up tables provide coefficients
for equations of motions according to different flying conditions. They are obtained from
the steady state flight trim conditions and corresponding dynamic conditions [13].
This thesis is focused on surface control of the F-16 aircraft. This work is concerned
with the pitch, roll and yaw control. These controls can be described as:
(3.14)
(3.15)
(3.16)
Where is the desired pitch rate value and is the current pitch rate value
whose unit is .
Similar to pitch control process, yaw rotation is influenced only by rudder. Yaw control
(3.17)
Where is the gain on rudder and has been shown in Equation 3.15. The only
22
(3.18)
where is the desired yaw rate value and is the current yaw rate value.
Roll rate control process is slightly different from the previous two rotations (pitch and
yaw) and is determined by both ailerons and horizontal stabilizers. Therefore, roll control
(3.19)
At the same time, elevators need to change its value in the following way:
(3.20)
which is the same as pitch and yaw rotations. The difference lies in that and is stated as:
(3.21)
The MRAC controller parameters in Equations 3.14 to 3.21 are summarized in Table 3.4.
23
3.2.2 Structure of F-16 Aircraft Body and MRAC Control system
Figure 3.3 describes computational model of the F-16 Aircraft flight surface control
system. It shows main computational blocks inside the object body and it is surrounded by
other computational sub-blocks. Figure 3.3 also shows various inputs going to different
computational sub-blocks.
Computation of Computation of
Mach number aerodynamic forces
and dynamic and moments
pressure coefficients
Altitude Surface
Velocity angles
Object Body
1 Values of Ailerons, Rudders,
Elevators and Flaps.
2 Description of engine model.
3 Calculation of atmosphere density,
dynamic pressure and navigation
equations.
4 MRAC Controller.
Computation of the entire model is encapsulated in Figure 3.4. It is divided into three
major blocks of input parameters, computational block and output values. Figure 3.3 serves
24
Input Block
Velocity (U,V,W), Altitude,
Mach number, Moment rates
(P,Q,R), Kinematics ( )
Computational Plant
Force Equations: Equations 3.1 to 3.3
Kinematic Equations: Equations 3.4 to 3.6
Moment Equations: Equations 3.7 to 3.9
Navigation Equations: Equations 3.10 to 3.12
Computational Controller
Rotation Control Process (Controller)
Pitch Rotation Control (3.14 to 3.16)
Yaw Rotation Control: (3.15, 3.17 and 3.18)
Roll Rotation Control: (3.19 to 3.21)
Output Block
Pitch, Yaw or Roll Rates
( )
Model Reference Adaptive Controller (MRAC) based surface flight control model has
been presented in previous sections. In order to validate correctness of the model and the
control system, it should be simulated first. Kamalsadan in his Ph. D. dissertation provides
MATLAB code for pitch control using MRAC approach. This thesis takes his work one step
further and first simulates three rotation controls (pitch, roll and yaw) for flight surface
control system. One of the stated goals of this thesis is to develop an embedded flight
control system exploiting parallel processing and utilize available modern Multi-Core system
25
3.3.1 Simulation Model Building Blocks
The F-16 6-DOF aircraft model and its associate MRAC based surface flight control
system consist of two main computational blocks of plant and controller as shown in Figure
3.4. The computational blocks also rely upon computation of sub-blocks such as engine
thrust and power command, aerodynamics, atmosphere block, Mach number, dynamic
pressure and damping derivatives. Main computational blocks and sub-computational blocks
heavily rely on the concept of look up tables for various coefficients. It should also be noted
that all control systems involve computation of partial differential equation in the form of
(3.22)
This equation tunes towards zero and requires minimization of J by varying the parameter
The MRAC system is adjusting parameter θ and error e between system output and
model output. The surface flight control system involves control of three rotations and
The computational flow of aircraft surface control system has been developed in Figure
3.4. The aircraft surface system and MRAC controller blocks have been designed as shown
in Figure 3.5. Since MATLAB focuses only on digital systems, the continuous models have
During discretization, the entire process is distributed on a time line. The time parameter
is represented by T and is used as 180. A step size or sampling rate h is used. The total
26
Start
Input Block
Command Signal
(RCOM,QCOM,PCOM)
Surface angles (Elevator,
Aileron, Rudder)
Velocity (U,V,W)
Moment rates (P,Q,R)
kinematics ( )
Aerodynamics (F1-F3)
Aerodynamics (F4-F10)
Computational Block
18689
iteration Force Equations: , ,
s Kinematic Equations:
Moment Equations:
Navigation Equations:
Engine (F11-F13)
Damping (F14)
MRAC Controller
Pitch Rotation Control
Yaw Rotation Control
Roll Rotation Control
Discretization
Process
Output
Figure 3.5: Simulation flow chart of MRAC based F-16 surface control system
27
Functions from F1 to F14 in „Input Block‟ and „Computational Block‟ are computational
functions that calculate various parameters. Physical meanings of these functions are shown
in Table 3.5.
It can be seen that flight surface control system utilizes input signals to compute
movement parameters such as forces, kinematics, moments and navigation values of aircrafts
and these parameters are transferred to the MRAC controller as inputs. Controller block
calculates how much surface angles (Elevators, Ailerons and Rudders) need to be adjusted
and return the adjustments back to the input block as a completion of one discretization
step.
this thesis, the final surface tracking results will be graphically displayed. Figures will have the
x-axis as the time line T and y-axis will be the rotation changing rates ( ).
The MRAC system adjusts the degree of deflection of elevators. Besides elevators, other
surfaces also play important roles in pitch rotations since they are able to balance the other
28
two axes of the aircraft system. The pitch angle is mainly determined by elevators. In
rotation control systems, all surfaces need to have initial values and these values keep the
aircraft fly smoothly if no external command were given. The initial state of the aircraft is
given in Table 3.6. These data are given by Stevens and Lewis [14].
Table 3.6: Initial State and Command Signals for pitch position tracking control
-0.7588
Aileron (Degree)
Rudder (Degree)
Roll position control is similar to the pitch control. The MRAC updates the angles of
both ailerons and horizontal stabilizers. The initial state and command pattern of roll control
are listed in Table 3.7. It shows that the initial values of surfaces and throttle angles remain
the same as pitch control but it will have different command signal. Command values for
29
Table 3.7: Initial State and Command Signals for roll position tracking control
-0.7588
Pitch Rate(Degree/sec) 0 2 5 3 1
Aileron(Degree)
Rudder(Degree)
The MRAC system adjusts rudder angle for the yaw rotation. Its initial state and control
pattern is given in Table 3.8. The yaw rotation will have different command signal as
previously suggested.
30
Table 3.8: Initial State and Command Signals for yaw position tracking control
-0.7588
Yaw Rate(Degree/sec) 0 1 2 1
Aileron(Degree)
Rudder(Degree)
The MATLAB simulation for pitch rate control similar to Kamalasadan [13] is shown in
Figure 3.6.
31
Figure 3.6: Pitch Rate control result using „ODE45‟
One of the advantages of MATLAB is that it provides built-in functions for many
modern computational needs with the availability of its various tool boxes. One can quickly
simulate a fairly complex system using MATLAB and its associated tool boxes. If special
purpose hardware needs to be designed for real time applications which will require either
C/C++ code or low level implementation then one of the task would be to replace all
existing built-in functions in the MATLAB code. The existing code has similar situation and
utilizes built-in Runge-Kutta function „ODE45‟. Efforts were directed to replace „ODE45‟
with custom code and duplicate existing results. This effort of replacing „ODE45‟ which is a
Runge-Kutta function for the solution of partial differential equation is described in the next
section.
German mathematicians C. Runge and M. W. Kutta around 1900. Among the family of
32
Runge-Kutta, the 4th order method is the most commonly used in solving differential
(3.23)
(3.24)
(3.25)
(3.26)
(3.27)
(3.28)
Basically, Runge-Kutta changes the process of solving differential equations into iterative
Original MATLAB code was modified and the „ODE45‟ function was replaced with the
Runge-Kutta 4th order code. As expected, the output is almost similar to one with the
In Figure 3.7, the result from „ODE45‟ is represented with red dot line and the result
from the new code is represented with blue solid line. The slight difference between the two
can only be seen on the up-edges when t=10 and t=40 and the down-edge when t=20. For
the rest of the position tracking process, these two different pieces of code performs exactly
the same. This is due to the fact that MATLAB‟s ODE45 function also uses Runge-Kutta
algorithm.
33
Figure 3.7: Comparison of pitch control with the function „ODE45‟ and the custom
code
The MRAC system performs pitch control and the error between the command pattern
Figure 3.8: Error magnitude between the pitch control tracking and the command signal
It can be seen that the error is high only at the transition points and it quickly subsided
later on. Therefore it can be concluded that the MRAC system is achieving its goal.
34
3.4.3 Roll Control
The MRAC system was simulated using the custom Runge-Kutta code for the roll
Figure 3.9: Roll rate control result in comparison with the command pattern
The roll position tracking performs as well as the pitch rate control although the system
converges a little bit slow when „Roll Rate=2‟. The rest of the process gives quick response
and provides accurate results. The error was also plotted and is shown in Figure 3.10. It can
again be seen that there is large error only at the transition points.
35
Figure 3.10: Error magnitude between the roll control tracking and the command signal
The yaw control tracking with the MRAC is shown in Figure 3.11. In Figure 3.11, the
solid blue line represents the tracking result of yaw control and the red dot line represents
the command signal. The yaw control track from the MRAC system deviates from the
command signal. It can be seen that the control system is converging slowly due to the MIT
based MRAC. The reason is that the deflection of rudder is not enough for yaw control and
36
Figure 3.11: Yaw rate control result in comparison with the command pattern
yaw rotation, a roll rotation is always accompanied. This failure of convergence could be
diminished by enhancing roll rotation control. Another option would be to utilize multiple-
37
Chapter 4
The MRAC system is considered as a single-model system that may have some
disadvantages. The system relies only on one single model and tries to perform as best as it
can. It was observed that both the pitch and roll control system response quickly and
accurately under a predefined model over the entire control process. Unfortunately, yaw
control process results in a non-stable system. Its system response fails to converge on the
command signal. To overcome this issue, on one hand a new control scheme could be
designed which holds better stability; on the other hand, a better model or multiple models
within the framework of MRAC [12] can be employed. In this thesis, the idea of number of
controller and series of models which represent different flight conditions will be generated.
Genetic Algorithm (GA) technique as an intelligent mechanism will be used to generate and
select models to make safe switching decisions. For every control command value, a best
38
4.1 Multiple-Model MRAC (MMRAC)
A single predefined model was used in the previous chapter for the MRAC for the flight
surface control system. The simulation result shows that both pitch and roll control result
satisfy tracking trajectories in reasonable time. The problem arises from yaw control which
results in slow convergence rate. That is to say, given the same processing time as pitch and
A test command signal for the demonstration of yaw control is designed and is provided
in Table 4.1.
Yaw Rate(Deg) 0 1 1 1 1
39
Figure 4.1 shows that the single-model MRAC controller designed for yaw motion
The yaw control command only changes once and gives the system long tracking time
(from t=10 to t=180) and allows monitoring of its stabilization time. Figure 4.1 shows that
the system converges at t=35, which proves that the controller is stable for the yaw control
system but just taking long time to converge. The reason why it takes long response time to
converge is that the predefined model for the system is not able to provide desired result.
Therefore, the initial error between the model and system is too much to be offset in a short
response time.
A Multiple-Model MRAC [24] may solve this problem since the initial difference
between system output and model output can be minimized by selecting the best model
from a pre-generated model pool [27]. Next two sections will introduce MMRAC structure
It is assumed that for multiple-model reference adaptive control, the unknown system is
represented by series of nominal plants or at least one member of them. Each nominal plant
corresponds to a presumed stable controller which gives the unknown system a satisfactory
performance. The overall objective of MMRAC is to converge to the best controller for the
For some of the cases, the determination of the best controller is definite. But for others,
this determination falls into an uncertainty zone. For example, given the nominal system ,
there is a hypothesis that makes the unknown system falls into the uncertainty zone
around . It is the supervisor‟s job to determine the best and select the best
40
corresponding controller. Figure 4.2 shows the structure of a MMRAC system without any
Model
Selection
System
U System
Estimation
There are m nominal systems from to . Each of the nominal systems corresponds
corresponds to the output of the unknown system. The difference between the outputs of
the unknown system S and m system model is . The model selection block computes
various performance parameters and selects an appropriate model which is closest to the
The model selection system in Figure 4.2 relies on a concept of monitoring signals which
(4.1)
This monitoring signal gives a measurement of the closeness between the unknown
system and possible models [27]. It should also be emphasized that the choice of
41
The model selection system does not wait for the monitoring signal to converge to zero.
That is to say, if the unknown system S is time-varying, the controller may never settle down
system as number of time invariant systems. Only in this way, at a specific time t, a nominal
model could be selected and a corresponding controller will in fact control the system.
performance than a single model based approach [28]. Therefore a MMRAC has two basic
building blocks. One of them contains multiple models of the system. The second one
appropriate model for certain conditions and based on certain performance parameters. It is
easy to provide multiple models but development of model selection system can be a
challenging task [31]. There are number of intelligent techniques that can be used to develop
and adopt a model selection system. These intelligent techniques can be based on fuzzy
logic, neural network, or genetic algorithm and others [33]. Researchers have used fuzzy
logic and neural network based approaches extensively in the past. More recently there is lot
of interest in use of genetic algorithms [35]. Obviously there are tradeoffs in the use of all
these approaches. Selecting one can be challenging as it would require extensive simulation
and performance evaluation. In this thesis, genetic algorithm based model selection system
4.2.1 Basics of GA
Genetic Algorithm (GA) is a computational model that came from the natural evolution
keep the population better evolving are assigned with greater possibility of reproduction and
those who fail in the natural selection would finally be ruled out [36]. The evaluation scheme
In Figure 4.3, both solid and diagonally hatched block represent genes. GA presumes
parameters. These parameters are in turn the genes of the chromosomes and represented by
an array of binary digits [37]. The initial genes of a chromosome are usually randomly picked.
With the evaluation of the fitness function, better genes are retained and losers from the
The size of the initial population varies from problem to problem [35]. In every
reproduction step, the next generation is created from the current generation. The genes of
the parent generation will be mixed and combined into the ones of their offspring as shown
in Figure 4.3. For a well-designed GA process, better genes should take larger number of
places in the offspring [38]. A commonly used technique for selecting the best individual
chromosome is called roulette wheel selection. It is described by following three steps [39]:
1. Calculate the sum of the fitness of every individuals of the parent generation, as S;
3. Return the first individual whose fitness value added to S is greater or equal to n.
43
There are two techniques for terminating GA process. The first one is that the designer
presets a cycle number and the reproduction process stop when this number is reached. The
best individual is returned according to the fitness value. The other method is that the
designer presets a termination fitness value. When there is an individual who reaches the
There are two fundamental operators that facilitate the evolution cycles, crossover and
mutation [35]. Figure 4.3 could be viewed as a one-time crossover. After each crossover,
every individual is applied with mutation from which genes could be altered. They could be
changed to other genes in the population or new genes that never exist could be introduced
into the pool. The mutation is applied under a relatively small possibility in order to keep the
evolution towards a fixed direction. For example, one of the solid blue genes on the parent
side of Figure 4.3 has the possibility of 0.01 that could be altered to a black-dot one as
A desired fitness value of 30 and 100 cycles of reproduction have been selected to
illustrate operation of GA algorithm. The chromosomes are represented by binary digits and
the fitness values are listed following the chromosomes as shown in Table 4.2. There are
four individuals in the first generation and their fitness values are provided in Table 4.2.
44
Table 4.2: Parent selection
1100110110101000 3.481746
0101010110110101 3.668023
1000010100110110 6.261380
1101011111001100 12.864222
During the parent selection, the lower two individuals are selected as they hold the
greater fitness value than the first two individuals [35]. It should also be noted that the
fitness value can be selected either greater or lower and it determines the direction of
reproduction. The crossover point is selected to be after the fifth digit of every
These two chromosomes interchange with each other their first 5 digits and last 11
digits. Mutation process changes binary digits with a predefined probability. Mutation offers
45
1101011111001100 1000010100110110
1111010100100110 1010011011001100
Next, these two new individuals will be inserted into the population and a new
1111010100100110 8.044649
1010011011001100 3.668023
1000010100110110 6.261380
1101011111001100 12.864222
At last, after 100 cycles of reproduction, the best chromosome which holds the fitness
value 29.000320 is returned. The binary number then is decoded back into a decimal one as
The mathematical representation of the trim condition F-16 aircraft model is given as:
(4.2)
It is a simple calculation in which and are two coefficients that both have their
own value domains; and are two parameters of MRAC adjuster. For every iteration
previously computed values of and are used. Two coefficients of and are
46
first selected randomly and then they are generated by the GA algorithm. Error is computed
(4.3)
(4.4)
where is the angle of rudder, which is the parameter that needs to be adjusted and is
also fixed within every iteration. The best model is the one that produces the least error from
the system output and that particular model is selected for control purposes.
The simple approach of randomly picking coefficients first and obvious fitness law
makes genetic algorithm the best choice to select the best model for every command value.
It is possible to design an F-16 flight surface control system with a genetic algorithm
acting as a model selection system. For the first step, a basic architecture should be designed
in order to have a clear view of the control process. A genetic algorithm based MMRAC
47
Adaptive
Adjustment
Models
GA model
generator
The MMRAC system contains arrow-crossed block labeled as Models and this model
block will store multiple models. The other arrow-crossed block labeled as Control Law
computes values of changes needed in the system parameters. GA model generator will
evaluate these models according to a predefined fitness function. It will select an appropriate
A general monitoring signal is previously defined by Equation 4.1. This equation can be
(4.5)
The surface flight control system needs to be viewed as a combination of set of time
invariant subsystems and the GA model generator acting as model selector. The command
signal is subdivided into sections which will have constant command values.
In this thesis, the system is separated into the same number of subsystems as the number
of different command values. For example, for the roll control system, if there are six
command values then a subsystem will be identified for each command value. A model will
be selected that will satisfy performance parameter for that particular command value. This
model will remain the same for the duration of specific command value.
48
4.3.2 GA mapping onto flight surface control system
The fitness function for the F-16 flight surface control system is defined by Equation
4.5. The candidate model output is used as and the system output is . In the
mathematical error model given in Section 4.3, the model output is determined by the
two parameters and . Both of these two parameters are limited to particular predefined
(4.6)
These values are obtained from the MATLAB simulation experiments. Results show that
the system remains stable if these two parameters are within above limits.
Therefore, both and are converted into binary numbers and taken as two genes.
These two genes together form a complete chromosome. Every time the decimal value of a
particular chromosome exceeds the limit domain as given by Equation 4.6, it is deleted from
the population. The Table 4.4 describes the specific design of the GA model generator and
Initial Population 20
Chromosome Length 32
Fitness function
Mutation Possibility 2%
49
The next step is to apply the genetic algorithm to the MMRAC and embed the control
scheme into the flight surface control system. The entire process is simulated in MATLAB
Single model MRAC system was described and simulated in Chapter 3. It was noted that
only the yaw rotation control failed to perform within specified limits. Figure 4.8 shows
tracking of the yaw control command with the GA based MMRAC system.
The error is plotted in Figure 4.9 based on single model MRAC and GA based MMRAC.
It can be seen that MMRAC was able to perform better than the single model MRAC.
50
Figure 4.9: Comparison between square-errors from normal MRAC and GA embedded
Figure 4.8 shows the command track in solid blue for GA based MMRAC and green
dash-dot line track belongs to the one with single model MRAC. It can be seen that the
MMRAC system converges very well from t=20 to t=80 and from t=150 to t=180. For the
region between (10 & 20) and (80 & 140), the system requires more convergence time in
The Mean Square Errors (MSE) of tracking results generated by GA based MMRAC and
It can be seen that yaw rotation control system response generated by GA based
51
Pitch rotation control is plotted in Figure 4.10. It shows tracks from the command line
in red dash, single MRAC in green dash-dot and GA based MMRAC in solid blue. It can be
seen that MMRAC is still performing better than the one with single model MRAC.
The square error with respect to command, the single model MRAC and the GA based
Figure 4.11: Comparison between square-errors from single model MRAC and GA
52
It can be seen from Figure 4.11 that from t=40 to t=42, the trajectory generated by GA
based MMRAC which is represented by solid line drops much faster than the trajectory
generated by single model MRAC which is the dotted line. The MSEs of GA based
MMRAC and single model MRAC control systems are shown in Table 4.6.
It can be seen that system response generated by GA based MMRAC has much smaller
The simulation result for MMRAC for roll motion control system is shown in Figure
4.12.
Figure 4.12: MMRAC embedded roll control result in comparison with command signal
The square error with respect to command, the single model MRAC and the GA based
53
Figure 4.13: Comparison between square-errors from normal MRAC and GA based
Figure 4.13 provides the comparison of square errors generated by GA based MMRAC
which is represented by solid line and single model MRAC which is represented by dotted
line. It can be seen that solid line drops much faster than the dotted line. Therefore system
response from GA based MMRAC has less error than the single model MRAC. The mean
It can be seen that GA based MMRAC results in slightly smaller MSE than single model
MRAC.
The MSEs generated by GA based MMRAC and single model MRAC for all three
rotation control systems namely yaw, pitch and roll are shown in Table 4.8.
54
Table 4.8: MSE comparison for three rotation control systems (rads/seconds)
For all three rotation control systems, GA based MMRAC controller controls the
position tracking more accurately and is more stable than the single model MRAC controller.
55
Chapter 5
MMRAC for embedded F-16 flight surface control system takes from 300 to 330 seconds. It
means that for any change in command signal, the system has to wait around several seconds
for the system to stabilize. This time may be too large for a comfortable ride in the plane.
With the development of multi-thread computing technology and the availability of multi-
core CPUs and GPUs, improvement in terms of execution time is possible if these control
C/C++ and other languages are necessary. The availability of multi-core processors from
Intel [42] in desktop or laptop computers and .NET Framework 4 from the Microsoft [43]
make an attractive alternative for parallel processing and high speed computation. It was
decided to port simulation to .NET framework. Another reason was to exploit parallel
processing for high speed computation that will bring this work one step close to its real
time implementation. The simulation program uses C++ and is appropriate for its
conversion into parallel program. A Parallel Patterns Library (PPL) of .NET Framework 4 is
available for users to parallelize computation processes in C++. Within .NET Framework 4,
56
In this chapter, multi-core architecture will be introduced and several available
C++ simulation results and MATLAB simulation results will be performed. The C++
program will be analyzed, partitioned, parallelized and optimized for parallel execution. The
speedups gained by several program optimization methods will be shown and compared.
Before multi-core technology, speedup has been achieved by increasing clock speed.
Over the past decades, clock speeds have been increasing exponentially. When CPU clock
speed rose into the range of 3-4 GHz, the amount of electrical power generated prohibits it
from going faster [45]. Issues such as power consumption, heat dissipation and leakage
current make it impossible to rely only on the increasing clock speed. The new trend is to
multi-cores and producing multi-core processors, many core processors, multi-core Digital
Signal Processors (DSPs), Graphic Processors Units (GPUs), and General Purpose Graphic
Processors Units (GPGPUs) etc. These multi-core processors will also require use of parallel
processing.
For single-core processors, only a single instruction can be executed at a time. This
computing pattern is called serial computation. In serial computation, the execution time of
a specific program highly depends on the CPU‟s clock speed. Faster the clock speed is
57
computation, multi-core architecture provides users an opportunity to perform
CPU1
Program CPU2
CPU3
It can be seen that a program can be partitioned into number of processes and each
minimizing the program execution time. Generally speaking, there are two ways of parallel
processing a program as it will depend on the structure of the program. A user can identify
parts of the program that can be executed in parallel or compiler can identify any inherent
parallelism hidden in the program. A user can exploit parallelism at data, loop and function
level. A user needs to identify part of the code that is independent of the data and
instructions. The user can then exploit data level parallelism by executing independent
instructions in parallel. Some applications may have loops and if they have independent data
then loop level parallelism can be exploited. A loop should not be dependent on results
from previous loops. In other cases, computations may be heavily dependent on each other.
Therefore in order to execute the next loop, the previous loop has to complete first. But
parallelism can still be applied because within a specific loop, there may be independent
functions or processes that could be executed in a parallel fashion giving a function level
parallelism. Functional level parallelism can also be characterized by commonly known term
58
An entire program needs to be partitioned into number of independent processes which
can be executed independently. A process can be further partitioned into number of threads
Processes are assigned to different CPUs and threads are in the waiting queue for the
next execution cycle. The job of assignment is performed by a scheme called process
scheduler. Each process executes as a part of a program. These processes are independent
with each other; therefore they can be executed concurrently. The partitioning process is
Process Scheduler
program is partitioned into different tasks or processes, data pieces have to be transferred
into local memories of different CPUs from global memory or vice versa. Therefore the
overhead.
59
The amount of computation of a process has to be large as compared to the overhead
generated by partitioning. The larger a process gets, the less overhead becomes relatively.
based MMRAC F-16 flight surface control system. Some of the important specifications of
Number of Cores 2
Number of Threads 4
Chapter 3. For the ease of illustration, only pitch position tracking results will be shown in
this chapter. The new C++ program shows pitch position tracking trajectories similar to the
one previously obtained using MATLAB simulation. One of the limitations of .NET
Framework 4, is that figures could not be plotted by the environment itself. In order to show
60
the final tracking trajectory, tracking data is saved in a „.dat‟ file and MATLAB is used again
to call the „.dat‟ file and to show data graphically. The pitch position tracking of GA based
as possible. Therefore, the execution time of this C++ simulation program has to be
recorded as a base line for future coding optimization. The simulation program was executed
ten times and its execution time of each run was recorded. The average time is saved as the
final execution time. The execution time of future parallelized programs will also be
computed in similar fashion. For the serial C++ program, the execution time is shown in
Table 5.2.
61
Table 5.2: Execution Time of Serial C++ Simulation
1 11.625
2 11.001
3 9.488
4 10.237
5 12.062
6 11.984
7 11.603
8 10.580
9 10.925
10 12.156
The flight surface control system contains main „object body‟ as the major loop as was
shown in Figure 3.3. The „object body‟ contains code for Runge-Kutta to solve partial
differential equations iteratively in numerical fashion. The „object body‟ needs to iterate
18689 times. The program was explored to uncover opportunities for exploitation of the
parallel processing. It was discovered that every execution of „objects body‟ required
computation of fourteen independent functions. It should also be noted that it was repeated
18689 times. Therefore the program provided an opportunity to exploit function level
parallelism. Fourteen independent functions were coded to exploit function level parallelism.
62
.NET Framework 4 provides Parallel Pattern Library (PPL) which enables exploitation
of parallel processing. This library contains several keywords including „parallel_for‟ and
„parallel_invoke‟. „parallel_for‟ is perfect for SIMD which runs a single instruction a number
of times over multiple data. „parallel_invoke‟ invokes several processes at the same time and
all of them can be executed in parallel. Therefore, „parallel_invoke‟ feature is used and
program was restructured accordingly. The computation time of the new structured parallel
program reduced from 11.226 to 4.622. Figure 5.4 shows percentage of CPU utilization for
execution of serial program. Similarly Figure 5.5 shows percentage of CPU utilization for
execution of parallel program. It can be seen from both figures that the CPU utilization
jumps from 19% to almost 100% in case of parallel program. Table 5.3 shows execution
times of newly structured parallel program. It can be seen that the average execution time is
4.622 seconds.
63
Figure 5.5: CPU Usage of Parallel Program
Without changing the structure of the program, the function level parallelized C++ code
64
Table 5.3: Execution Time of Parallelized single model MRAC C++ Simulation
1 4.688
2 4.567
3 4.958
4 4.214
5 4.597
6 4.855
7 4.721
8 4.221
9 4.889
10 4.513
Speedup 2.429
Next, new parallel program is further explored for reducing execution time via
Cache is a kind of memory that transparently stores data so that future requests for that
piece of data can be accessed in reduced time. Cache provides access time faster than the
memory and slower than on-chip registers. The data storage can be structured in a pyramid
65
form as shown in Figure 5.6. Higher the storage option is in the pyramid; faster the data can
be accessed. Data can be saved into cache right after its computation and it remains in cache
until it is replaced by other data. This replacement is performed when either no more
requests for this data occurs in a certain time or space is needed by some other processes.
CPU
Cache
Memory
Generally modern processors are organized in three levels of caches namely L1, L2 and
L3. A piece of data in L1 which gets no more requests is downgraded into L2 and then to L3
if it is not accessed by the processor on regular basis. It could be sent to the main memory if
it is not used for certain duration. One way to increase its execution speed is to increase data
fetching from the cache. This will require a rearrangement of the entire program.
1 parameterA= processA( );
2 parameterB= processB( );
3 parameterC=processC( );
4 processD( ); // independent of A,B or C
5 processE( );//independent of A,B or C
… …
n parameterF=function (parameterA, parameterB, parameterC);
66
In this code „parameterA‟, „parameterB‟ and „parameterC‟ are calculated at the beginning
of this code and then they are fetched again after some time as calling data to execute four
functions. In this case these parameters are not used for some time and might have moved
back to the main memory. They were called again and then they need to be moved to L1
cache for further processing of functions. This data fetching after long time will contribute
1 parameterA= processA( );
2 parameterB= processB( );
3 parameterC=processC( ) ;
4 parameterF=function (parameterA, parameterB, parameterC);
5 processD( ); // independent of A,B or C
6 processE( );//independent of A,B or C
… …
Similar to cache hits, memory allocation is another important issue in data transfer
process especially for large amount of data or large number of repeated operations. This is
true due to availability of multiple memories such as global, local or on-chip memories.
Every single modification saves a bit of time on data fetching and writing back. If this saving
is achieved on every of the 18689 iterations then it can lead to lot of savings in the
computation time. The primary idea is to allocate memory space for data in such a memory
space that can reduce data communication time. There are fourteen functions that are
executed in parallel. Ten of the fourteen functions have approximately 108 pieces of data
that are stored in the form of look up tables inside the function itself. Data for the pointer
67
1 functionA( ) {
2 double coefficient matrix [9][12]; //initiate a 9*12 matrix
3 parameterB= processB( ); // a number from matrix is needed
4 parameterC=processC( ) ; //a number from matrix is needed
… …
5 parameterD=processD;// a number from matrix is needed
6 Return value; };
Therefore this data will be moved first from one memory storage area to another. It will
also require rebuilding of this data structure in every function call. If there are 18689 calls
then there will be lot of execution time allocated to the data initialization. In C++, data
claimed within “{ }” needs to be initialized every time the function gets called. In another
word, any data initialization within a function is defined in local memory. As an alternative,
data could also be initialized outside a function as global data. This kind of data only needs
to be defined once and would be available until the entire program is terminated. One idea is
to move data access from a local memory to a global memory so it can be accessed without
any kind of initialization process. This movement and initialization at one time only will save
enormous amount of time especially if it is called 18689 times. A modified version of this
9×12 data matrix used as a look up table will have the following form:
With this change in look up table, the compiler will simply fetch the matrix from the
global memory for this function „functionA‟ only once. This function runs 18689 times
68
contributing towards enormous time saving. This flight surface control program has ten such
functions and this allocation of data at another location results in computational time
savings.
Line 1
Parameters Return Values
Line 2
Line 3
……
Line N
The main idea is to detect whether there are other series of instructions that conform the
pattern in Figure 5.7 and are a candidate to become a function. Further analysis of the flight
surface controller revealed following code inside the main code of „object body‟ and was
being executed 18689 times. This code was formed into a function and was moved out of
the „object body‟. This movement of data resulted in avoiding execution of this code 18689
times. As an example, the following codes computes one value („parameterX‟) based on two
69
1 parameterA=processA(a, b) ;
3 parameterB= processB(a, b);
4 parameterC=processC(a, b) ;
… …//every instruction depends on a and b
5 parameterN=processN(a,b);
6 parameterX=processX(parameterA,….);
It could be transformed into one function as a new calling function that can be executed
in parallel.
One of the goals of the parallel processing is to keep every core busy all the time. The
other aspect is to partition code uniformly so all cores are busy. Therefore, it will be
necessary to keep equal amount of code and reduce any unnecessary data transfer.
Another objective is to reduce unnecessary assignment of constant values inside the loop
especially if the loop is being executed thousands of time. The main idea behind this is to
make sure constant values or values that are not changing inside the loop needs to be moved
out of the loop. Any parameter that is shared with several (ten in this example) functions
needs to stay in the main function. It will avoid unnecessary loading of the sharable
parameters. For example, within fourteen functions, ten of them need to calculate indexes to
fetch data from look up tables. These indexes are the same for all functions. Therefore this
index calculation process should be executed in the main function and just transfer the
indexes to the calling functions. With this modification, the process only needs to be
70
5.4.3 Other Possible Code Optimization Methods
There are other possible code modifications and optimization techniques and four of
1. Parameters calculated by internal built-in functions such as „cos‟, „sin‟ and „abs‟ etc.
This scheme has been exploited in this flight surface control system.
2. Reduce „if‟, „else‟ statements as these conditional branch processes can slow the
program execution. This is due to the use of pipeline execution of instructions by the
4. Reduce parameter numbers that needs to be transferred from one calling functions
communication overhead. For a specific piece of program, some methods work much more
experiments should be planned out and execution time should be recorded in order to select
After repeated experiments and comparisons, the entire program is restructured and
optimized to a level that is parallelized to the most extent as possible. The screen shot of the
71
execution result of pitch rotation control system with single model MRAC is shown in
Figure 5.8.
The execution time of the pitch control program with single MRAC controller was
72
Table 5.4: Execution Time of Optimized Parallel single model MRAC C++ Simulation
1 3.870
2 3. 958
3 3.540
4 3.931
5 3.597
6 3.558
7 3.712
8 3.690
9 3.665
10 3.814
Speedup 3.005
The total speedup before optimization was 2.426 and after optimization and code
The execution time of GA based MMRAC controlled pitch control system is similar to
the single model MRAC system since the genetic algorithm only performed five times during
the entire control process. The execution time for GA based MMRAC controlled C++
73
Table 5.5: Execution Time of Optimized Parallel GA based MMRAC C++ Simulation
1 3.783
2 3. 690
3 3.441
4 4.069
5 3.673
6 3.882
7 3.406
8 3.557
9 3.601
10 3.788
Speedup 3.043
MMRAC program and single model MRAC program before optimization is given by Table
5.6.
74
Table 5.6: Comparison of execution time for different serial and parallel programs
The pitch rotation control tracking of the parallelized C++ program is shown in Figure
5.9.
It can be seen from Figure 5.9 that pitch rotation tracking generated by optimized
parallel program shows almost the same result as the serial program for GA based MMRAC
controlled pitch rotation control system. It is because that during parallelization and
optimization of the program, the computation has not been changed. Only the structure of
the program has been modified and optimized for better performance.
75
Chapter 6
The work in this thesis aims at the improvement of the computational performance of
the Model Reference Adaptive Controller specifically for F-16 surface control system. MIT
rule was selected to adjust parameters. Three rotation motions, pitch, roll and yaw are
analyzed. It was discovered that the yaw control takes longer time to stabilize.
The idea of Multiple Model Reference Adaptive Control was explored and Genetic
Algorithm based approach is proposed for model selection. GA based MMRAC was
developed and was also compared with the single model MRAC. GA based MMRAC
improve the performance of computationally intensive applications. The final goal of this
thesis is to partition the flight surface control C++ code and run it with a combination of
parallel and serial pattern. The key issue is to find the balance point between parallel and
serial processing so that the overall performance could be improved to its fullest extent.
MATLAB simulation was converted into C++ under .NET framework in order to
exploit parallel processing. The parallel library of .NET framework is used to modify the
program and the execution time of the parallel code was optimized using several
76
optimization approaches. The optimized program performs much better and the execution
time reaches 3.75 seconds with a speed up of 3.006. The final execution time of the GA
based MMRAC flight surface control system is around is around 3.75 seconds giving a
conditions. The condition used in the simulation process is steady trim condition. It involves
no disturbance on the vertical axis of the aircraft. On the other hand, yaw rotation motion
results in not only change in yaw angle but also change in roll angle. It is a combination of
two control processes. Therefore, beside the introduction of MMRAC, a new control
The CPU used in the thesis is Intel® i5 which has only 4 cores. At the same time, only
four functions could be executed in parallel while other ten functions wait for their
execution. It is possible to use other processors with more than four cores. For example,
IBM cell has nine cores that may provide better results. Moreover Nvidia‟s GPU can also be
experimented and exploited. Another possible future work would be to map this design onto
FPGAs as this control algorithm uses look up table based approach and has fixed number of
iterations. One final future work would be to reduce single precision that may give better
computation time.
77
References
1. K.J. Astrom and B. Wittenmark, Adaptive Control, 2nd, Mineola, N.Y.: Dover
Publications, 2008.
2. Petros A. Ioannou, Jing Sun, Robust Adaptive Control, Upper Saddle River, N.J.: PTR
Prentice-Hall, 1996.
3. Naira Hovakimyan, Chengyu Cao, “L1 Adaptive Control Theory: guaranteed robustness
with fast adaptation”, Philadelphia: Society for Industrial and Applied Mathematics,
2010.
http://www.nvidia.com/content/cudazone/download/Getting_Started_w_CUDA_Trai
ning_NVISION08.pdf, 2008.
01.ibm.com/chips/techlib/techlib.nsf/pages/main, 2007.
7. Alessandro Astolfi, Nonlinear and Adaptive Control: Tools and Algorithms for the User,
8. H.C. Cho, M.S. Fadali, K.S. Lee, N.H. Kim, “Adaptive Position and Trajectory Control
of Autonomous Mobile Robot Systems with Random Friction”, IET Control Theory &
9. Suresh M. Joshi, Gang Tao, Parag Patre, “Direct Adaptive Control using an Adaptive
78
10. Daniel E. Miller, Naghmeh Mansouri, “Model Reference Adaptive Control Using
11. J. X. Xue, “Stability and Robustness analysis of MIMO MRAC Using Kp=L2 D2 S2
12. Kumpati S Narendra et al,. “Adaptive Control Using Multiple Models”, IEEE Trans. on
13. Kamalasadan S., Ghandakly Adel A., “A Neural Network Parallel Adaptive Controller
14. Brian L. Stevens, Frank L. Lewis, Aircraft Control and Simulation, 2 nd, Hoboken, N.J.:
/tutorial/motion.html.
control-surfaces.html, 2010.
v=KEx_DYxjlqU, 2008.
18. Michael Sanibel, “Quest to Build a Better Fighter”, Aviation History, Vol. 21 Issue 3, p48-
53, 2011.
19. A.A. El-Mahallawy, H.A. Yousef, M.I. El-Singaby, A.A. Madkour, A.M. Youssef,
“Robust Flight Control System Design using Loop-Shaping and Recessive Trait
Crossover Genetic Algorithm”, Expert Systems with Applications, Vol. 38 Issue 1, p169-174,
2011.
79
20. Chao Wang, Yifan Kang, Tiantong Tang, “Probe-type Time-of-Flight Momentum and
Energy Mapping System”, Optik-International Journal for Light & Electron Optics, Vol. 122
21. Y. Lee, S. Kim, H. Koo, J. Kim, J. Suk, “System Identification and Stability Evaluation
22. Wolfgang Schuster, Washington Ochieng, “Airport Surface Movement –Critical Analysis
p281-294, 2011.
24. Michael Schiebe, Saskia Pferrer, Real-Time Systems Engineering and Application,
25. John A. Wise, V. David Hopkin, Daniel J. Garland, Handbook of Aviation Human
26. Christopher Fielding, Advanced Techniques for Clearance of Flight Control Laws,
“Multiple Model Adaptive Control with Safe Switching”, International Journal of Adaptive
28. K.S. Narendra, J. Balakrishnan, “Adaptive Control using Multiple Models”, Automatic
80
29. P.S. Maybeck, R.D. Stevens, “Reconfigurable Flight Control Via Multiple Model
Adaptive Control Methods”, Aerospace and Electronic Systems, Vol. 27 Issue 3, p470-480,
1991.
30. G.C. Goodwin, D.Q. Mayne, “A Parameter Estimation Perceptive of Continuous Time
31. R. Murray- Smith, T.A. Johansen, Multiple Model Approaches to Modeling and Control,
32. B. Jung, Y. Kim, C. Ha, “Fault Tolerant Flight Control System Design using a Multiple
Model Adaptive Controller”, Journal of Aerospace Engineering, Vol. 223 Issue 1, p39-50,
2009.
33. Boris Mirkin, Per-Olof Gutman, “Robus Output-Feedback Model Reference Adaptive
Control of SISO Plants With Multiple”, IEEE Transactions on Automatic Control, Vol. 53
34. M.K. Ciliz, A. Cezayirli, “Increased Transient Performance for the Adaptive Control of
Feedback Linearizable System using Multiple Models”, International Journal of Control, Vol.
36. D. B. Varley, E. K. Burke, “A Genetic Algorithms tutorial tool for Numerical Function
37. Andrew Hunter, “Crossing Over Genetic Algorithms: The Sugal Generalized GA”,
38. M.M. Arafa, F.A. Omara, “Genetic Algorithms for Task Scheduling Problem”, Journal of
81
39. Wilson Rivera, “Scalable Parallel Genetic Algorithms”, Artificial Intelligence Review, Vol. 16
41. Stephen W. Kechler, Kunle Olukotun, H. Peter Hofstee, Multicore Processors and
42. Max Domeika, Software Development For Embedded Multi-core Systems-A Practical
Guide for Using Embedded Intel® Architecture, Burlington, MA: British Library
43. S.H. Hung, C.H. Tu, W.L. Yang, “A Portable, Efficient Inter-core Communication
Scheme for Embedded Multicore Platforms”, Journal of Systems Architecture, Vol.57 Issue
2, p193-205, 2011.
44. Nir Shavit, “Data Structure in the Multicore Age”, Communications of the ACM, Vol. 54
45. Hongyang Sun, Yangjie Cao, Wen-jing Hsu, “Efficient Adaptive Scheduling of
82