air refueling autopilot, (my first book)

213

Upload: ahmed-momtaz-hosny-phd

Post on 16-Mar-2018

75 views

Category:

Design


3 download

TRANSCRIPT

Page 1: Air Refueling Autopilot, (My First Book)
Page 2: Air Refueling Autopilot, (My First Book)
Page 3: Air Refueling Autopilot, (My First Book)
Page 4: Air Refueling Autopilot, (My First Book)
Page 5: Air Refueling Autopilot, (My First Book)
Page 6: Air Refueling Autopilot, (My First Book)

Development of Fuzzy Logic LQR Control

Integration for Full Mission Multistage Aerial

Refueling Autopilot

Page 7: Air Refueling Autopilot, (My First Book)

ii

ACKNOWLEDGMENT

All gratitude is due to ALLAH. Thanks to ALLAH for everything, who blessed me

with my supervisors, and gave us the support to finish this work.

I would like to express and present my thanks and deepest gratitude to my

supervisor Dr. Han Chao for his continuous encouragement, valuable advice and

precious help to finish this work. Great indebtedness and special thanks to General

Dr. Abd Allah El Ramsisy and Col. Dr. Ahmed Abd El Aziz for the initiation of the

topic and his kind supervision, advice, reviewing and valuable guidance to produce

this work.

I would like to acknowledge my gratitude to all members of the aircraft control

department in Military Technical College for their support and help. Also I would like

to express my deep thanks to all my friends especially Maj. Mohamed Fayed and Maj.

Ayman El Saai.

I am especially indebted to my wife for her assistance and carefree, and my son

Omar. This work would not have been possible without the support of my parents and

all my great family members.

Ahmed Momtaz Hosny

Beijing, 2008

Page 8: Air Refueling Autopilot, (My First Book)

iii

ABSTRACT

This work investigates the performance on the aircraft control system during

air refuel purposes of the Linear Quadratic Regulator (LQR) control alone,

and the integration between fuzzy control and LQR. LQR is modern linear

control that is suitable for multivariable state feedback and is known to yield

good performance for linear systems or for nonlinear systems where the

nonlinear aspects are presented. The fuzzy control is known to have the ability

to deal with nonlinearities without having to use advanced mathematics. The

LQR integrated fuzzy control (LQRIFC) simultaneously makes use of the

good performance of the LQR in the region close to switching curve, and the

effectiveness of the fuzzy control in region away from switching curve. A new

analysis of the fuzzy system behavior presented helps to make possible precise

integration of LQR features into the fuzzy control. The LQRIFC is verified by

simulation to suppress the uncertain instability more effectively than the LQR

alone besides minimizing the time of the mission proposed. The aerial

refueling process has been divided into 3 basic stages (initial stability stage,

tracking stage, alignment stage) to meet all the process requirements and

constraints with minimizing the whole mission time period. GA has been used

to tune the fuzzy logic controller parameters and some PID’s. The control

strategy was applied to both aerial refueling methods. And the MATLAB

simulation results show the validity and the efficiency of using the proposed

control approach.

Page 9: Air Refueling Autopilot, (My First Book)

iv

TABLE OF CONTENTS

Acknowledgment…………………………………………………………………... i

Abstract ……………………………………………………………………………. ii

Table of contents…………………………………………………………………... iii

List of figures ……………………………………………………………………… ix

List of tables ………………………………………………………………………. xiv

List of Acronyms…………………………………………………………………... xv

List of symbols…………………………………………………………………….. xvi

Chapter (1)

Introduction to

Air Force Aerial Refueling Methods

Flying Boom versus Hose-and-Drogue

1.1 Introduction……………………………………………………………………. 1

1.2 Background……………………………………………………………………. 3

1.3 Introduction to Fuzzy Logic Controllers……………………………………. 3

1.3.1 Introduction………………………………………………………………. 3

1.3.2 A structure of fuzzy logic controller ……………………………………. 8

1.3.2.1 Preprocessing…………………………………………………….. 9

1.3.2.2 Fuzzification……………………………………………………… 10

1.3.2.3 Rule Base…………………………………………………………. 10

Page 10: Air Refueling Autopilot, (My First Book)

v

1.3.2.4 Inference Engine…………………………………………………. 15

1.3.2.5 Defuzzification……………………………………………………. 18

1.3.2.6 Postprocessing …………………………………………………… 20

1.4 Summary………………………………………………………………………. 21

Chapter (2)

Literature Survey

Traditional and Fuzzy Logic P, PD and PID controllers

2.1 The Control Problem………………………………………………………….. 23

2.2 Controller Types………………………………………………………………. 27

2.2.1 Proportional Controller………………………………………………… 27

2.2.2 PI Controller…………………………………………………………….. 28

2.2.3 PID Controller…………………………………………………………... 29

2.2.4 Proportion Fuzzy Controller…………………………………………… 29

2.2.5 Proportional and derivative controller………………………………... 31

2.2.6 Incremental Fuzzy Controller………………………………………….. 32

2.2.7 Proportional, integral and derivative fuzzy controller……………….. 35

2.2.8 Summary…………………………………………………………………. 36

2.3 Problem Formulation…………………………………………………………. 37

2.4 Main Objective of the Thesis…………………………………………………. 38

2.5 Thesis Layout………………………………………………………………….. 38

Chapter (3)

Preliminaries

Modeling, Trimming and Linearization

Page 11: Air Refueling Autopilot, (My First Book)

vi

3.1 Aircraft Modeling …………………………………………………………….. 40

3.1.1 Reference Frames ………………………………………………………. 40

3.1.2 General Equation of Motion …………………………………………… 42

3.1.3 Linearized Equations of Motion……………........................................... 46

3.2 Aircraft Trimming Using NN Algorithm…………………………………….. 46

3.2.1 Basic Architecture of Neural Network…………………………………. 46

3.2.2 Network Structure Design……………………………………………. 48

3.2.2.1 Number of Hidden Layers………………………………….. 49

3.2.2.2 Number of Hidden Units……………………………………. 49

3.2.3 Back-Propagation Technique………………………………………... 51

3.3 Optimization Algorithms Applied to F16 nonlinear model ………………... 51

3.4 Linearization Process…………………………………………………………. 54

Chapter (4)

Linear Quadratic Regulator (LQR)

4.1 Linear Quadratic Regulator with Output Feedback………………………... 57

4.2 Linear Quadratic Regulator Basis……………………………………………. 58

4.2.1 Quadratic Performance Index ………………………………………….. 58

4.2.2 Solution of the LQR problem …………………………………………… 60

4.2.3 The initial condition problem……………………………………………. 64

4.2.4 Maximum desired values of z(t) and u(t)………………………………... 70

4.3 Tracking a command………………………………………………………….. 76

4.3.1 Tracker with desired structure ………………………………………… 78

4.3.2 LQ Formulation of the Tracker Problem……………………………… 80

4.3.3 The Deviation System…………………………………………………… 82

4.3.4 Performance Index for LQ Tracker……………………………………. 83

Page 12: Air Refueling Autopilot, (My First Book)

vii

4.3.5 Solution of the LQ Tracker Problem ………………………………….. 84

4.3.6 Design Equations for Gradient-Based Solution ………………………. 85

Chapter (5)

Intelligent Learning of Fuzzy Logic Controller via Genetic Algorithm

5.1 Introduction……………………………………………………………………. 92

5.2 Applying Fuzzy Inference System for Control………………………………. 92

5.2.1 Designing membership functions (Fuzzification process)……………. 93

5.2.2 Rule Derivation…………………………………………………………. 95

5.2.2.1 Structure of fuzzy rules………………………………………... 96

5.2.3 Fuzzy rule-based inference…………………………………………….. 97

5.2.4 Response pattern of a simple generic fuzzy control system………….. 100

5.3 Genetic Algorithm Process……………………………………………………. 104

5.3.1 Application of GA Functions for Tuning Fuzzy PID Controller…….. 105

5.3.1.1 Optimizing Fuzzy Output Gains ………………………………. 106

5.3.1.2 Tuning of Fuzzy Sets…………………………………………… 108

5.3.1.3 Rule Base Weight Optimization………………………………... 113

5.4 LQR Fuzzy Logic Control (LQRIFC)……………………………………….. 113

Chapter (6)

Design of Fighter Flight Formation Autopilot for aerial Refueling

Racetrack Mission Employing KC-130J Tanker with Drogue-Hose

Configuration

Page 13: Air Refueling Autopilot, (My First Book)

viii

6.1 Introduction……………………………………………………………………. 119

6.2 Receiving aircraft modeling ………………………………………………….. 120

6.3 Control Strategy……………………………………………………………….. 121

6.3.1 Controller design…………………………………………………………. 122

6.3.1.1 Formation geometry and trajectory variables………………… 122

6.3.1.2 Level plane formation definition ………………………………. 123

6.3.1.3 Vertical plane formation definition…………………………….. 124

6.3.2 Control laws………………………………………………………………. 124

6.3.2.1 Lateral Distance Control ………………………………………. 124

6.3.2.2 Forward Distance Control……………………………………… 125

6.3.2.3Vertical Distance Control……………………………………….. 126

6.4 System Identification Process………………………………………………… 127

6.4.1 Estimation of Simple Process Model…………………………………… 127

6.4.2 Initial Parameter Values and Parameter Bounds…………………….. 127

6.4.3 Compensator design using system identification technique………….. 127

6.5 Alignment Stage-Formation Control Simulation Results ………………….. 128

Chapter (7)

Control Strategy and Implementation Methodology

7.1 Introduction……………………………………………………………………. 133

7.2 Aerial Refueling Stages……………………………………………………….. 133

7.2.1 Stability Augmentation System ………………………………………… 133

7.2.2 Tanker Tracking Using Command Augmentation system (CAS)……. 133

7.2.3 Alignment Terminal using Flight Formation Controller……………... 138

7.3 Fighter -Tanker Tracking Stage Optimal Trajectory Determination……... 141

7.3.1 Optimal trajectory equations…………………………………………… 141

Page 14: Air Refueling Autopilot, (My First Book)

ix

Chapter (8)

SUMMARY AND FINAL CONCLUSION

8.1 Stability Stage Poles Verification with Flying Qualities (1ST Stage) ……….. 144

8.2 Tracking Stage Time Using Different Guidance Technique (2nd Stage)...…. 1145

8.3 Alignment Stage during (Boeing KC 767) Tanker–Boom configuration

(3rd Stage)…………………………………………………………………………...

145

8.4 (Boeing KC 767 Tanker – Boom configuration) versus (KC-130J Tanker

with Hose – Drogue configuration)……………………………………………….

146

8.5 Final Conclusion ………………………………………………………………. 147

8.6 Recommended Future Work …………………………………………………. 148

REFERENCES…………………………………………………………………….. 149

Appendix A

Appendix B

Page 15: Air Refueling Autopilot, (My First Book)

x

List of Figures

Fig. 1.1 USAF KC-10 Refueling B-52 with Flying Boom……………………... 1

Fig. 1.2 USMC KC-130 Refueling F/A-18s with Hose-and-Drogue………….. 2

Fig. 1.3 Direct control…………………………………………………………… 5

Fig. 1.4 Feedforward control…………………………………………………… 6

Fig. 1.5 Fuzzy parameter adaptive control……………………………………. 7

Fig. 1.6 Blocks of a fuzzy controller……………………………………………. 9

Fig. 1.7 Example of nonlinear scaling of an input measurement…………….. 10

Fig. 1.8 Examples of membership functions…………………………………… 15

Fig. 1.9 Graphical construction of the control signal in a fuzzy PD controller 16

Fig. 1.10 One input, one output rule base with non-singleton output sets…… 20

Fig. 2.1 A generic model for control with feedback…………………………… 24

Fig. 2.2 A classical PID controller ……………………………………………... 25

Fig. 2.3 Fuzzy proportional controller (FP)……………………………………. 29

Fig. 2.4 Fuzzy PD controller (FPD)……………………………………………. 31

Fig. 2.5 Fuzzy incremental controller (FInc)…………………………………... 34

Fig. 2.6 Fuzzy PD+I controller (FPD+I)……………………………………….. 35

Fig. 3.1 Relationship between the body-fixed reference frame FB, flight-

path reference frame FW and stability reference frame FS

41

Fig. 3.2 Basic Neural Network Structure………………………………………. 47

Fig. 4.1 Lateral output performance when 1)0( �� ………………………….. 74

Fig. 4.2 Lateral output performance when 1)0( �� ………………………….. 75

Fig. 4.3 Effect of PI weighting parameters � = .1, .2, .4 respectively………… 76

Fig. 4.4 plant with compensator of desired structure…………………………. 77

Fig. 4.5 Plant/ feedback structure……………………………………………… 81

Fig. 4.6 Normal acceleration controller………………………………………… 87

Fig. 4.7 Normal acceleration step response for different PI (3.2 green), (8.36

blue)

87

Page 16: Air Refueling Autopilot, (My First Book)

xi

Fig. 4.8 Pitch rate controller……………………………………………………. 88

Fig. 4.9 Pitch-rate step response using regular LQ tracker for different PI

(4.2 blue), (3.98 green)

88

Fig. 4.10 Lateral –Directional controller ……………………………………… 90

Fig. 4.11 Closed loop response to command of 1��r , 0�rr . Bank angle �

(rad), and washout yaw rate (rad/sec)

91

Fig. 5.1 The structure of a Fuzzy Logic Control System……………………… 93

Fig. 5.2 Triangular membership function……………………………………… 94

Fig. 5.3 Membership function for error input (e)……………………………... 94

Fig. 5.4 Membership function for error rate input (ce)……………………….. 95

Fig. 5.5 Membership function for control signal output (u)…………………... 95

Fig. 5.6 Fuzzy matching process………………………………………………... 97

Fig. 5.7 Fuzzy inference process………………………………………………... 98

Fig. 5.8 Fuzzy combination process……………………………………………. 98

Fig. 5.9 Defuzzification process………………………………………………… 99

Fig. 5.10 Fuzzy logic inference system…………………………………………. 100

Fig. 5.11 Architecture of the generic fuzzy control system…………………… 101

Fig. 5.12 Step response of a simple generic fuzzy controller………………….. 102

Fig. 5.13 Nonlinear fuzzy PID controller………………………………………. 104

Fig. 5.14 Fuzzy inference system control action (PID fuzzy logic controller

output gains)

104

Fig. 5.15 The flow of GA functions and process………………………………. 105

Fig. 5.16. Nonlinear fuzzy PID controller……………………………………… 105

Fig. 5.17 Objective function J and Fitness function F ………………………… 107

Fig. 5.18 Triangular and trapezoidal membership functions………………… 108

Fig. 5.19 Bell-shaped membership functions………………………………….. 109

Fig. 5.20 Example for one-point crossover of fuzzy partitions……………….. 111

Fig. 5.21 Mutating a fuzzy partitions…………………………………………... 111

Fig. 5.22a Input variable “error”………………………………………………. 112

Page 17: Air Refueling Autopilot, (My First Book)

xii

Fig. 5.22b Input variable “error change”……………………………………… 112

Fig. 5.22c Output variable “Kp”………………………………………………... 112

Fig. 5.22d Output variable “Ki”……………………………………………....... 113

Fig. 5.22e Output variable “Kd”……………………………………………….. 113

Fig. 5.23a LQR integrated fuzzy control (LQRIFC) for pitch controller……. 114

Fig. 5.23b LQR integrated fuzzy control (LQRIFC) for lateral-directional

controller

114

Fig. 5.24 Integrated system step response in both cases with optimized fuzzy

controller and without fuzzy controller

116

Fig. 5.25 Integrated system step response in both cases with optimized fuzzy

controller and without fuzzy controller for lateral motion

116

Fig. 6.1 KC-130J tanker and F-16 receiver configuration …………………… 119

Fig. 6.2 F-16 nonlinear modeling……………………………………………….. 120

Fig. 6.3 Level plane formation geometry………………………………………. 123

Fig. 6.4 Lateral –Directional control law ……………………………………… 125

Fig. 6.5 Forward control law……………………………………………………. 126

Fig. 6.6 Vertical control law ……………………………………………………. 126

Fig. 6.7 Control strategy implementation using SIMULINK ………………... 130

Fig. 6.8 Nonlinear model output performance with compensation ………….. 131

Fig. 6.9 Root locus for lateral –directional control with and without phase

lead compensator respectively

132

Fig. 6.10 Trajectory in x-y plane for both wingman and leader……………… 132

Fig. 7.1 Tanker position transformation to aircraft wing axes…………......... 136

Fig. 7.2 Actual trajectories for tanker and receiving aircraft………………… 136

Fig. 7.3 F-16 nonlinear model performance…………………………………... 137

Fig. 7.4 Nonlinear model output performance with compensation………….. 139

Fig. 7.5 Fighter-Tanker tracking stage optimal trajectory …………………… 141

Fig. 7.6 Relative distance in X direction (ft)…………………………………… 143

Fig. 7.7 Relative distance in Y direction (ft)…………………………………… 143

Fig. 7.8 Relative distance in Z direction (ft)…………………………………… 143

Page 18: Air Refueling Autopilot, (My First Book)

xiii

Fig. 8.1 (Boeing KC 767 Tanker – Boom configuration) versus (KC-130J

Tanker with Hose – Drogue configuration)

147

Page 19: Air Refueling Autopilot, (My First Book)

xiv

List of tables

Table 2.1 Quick reference to fuzzy controllers………………………………. 37

Table 2.2 Relation between fuzzy and PID gains …………………………… 37

Table 3.1 Wing level trimmed values at Mach 0.75…………………………. 54

Table 4.1 LQR with output feedback………………………………………… 64

Table 4.2 Optimal output feedback solution algorithm (LQ Tracker)…….. 67

Table 4.3 LQ Tracker with Output Feedback..……………………………… 86

Table 5.1 Control rules for a simple generic fuzzy controller………………. 102

Table 5.2 Gain Limits………………………………………………………….. 106

Table 5.3 Decoding Equation ………………………………………………… 107

Table 5.4 Linearized Matrices………………………………………………... 115

Table 5.5 Gain values…………………………………………………………. 116

Table 6.1 F-16 aircraft states ………………………………………………… 120

Table 6.2 Control channels …………………………………………………… 121

Table 6.3 Flight formation controller parameters…………………………... 128

Table 8.1 The listed values satisfy a level 1 flying quality with a category B

flight phase thus validating the design parameters for the proposed

controller

144

Table 8.2 Tracking phase time versus guidance technique (second phase) 145

Table 8.3 Relative distances in 3 directions (X, Y, Z) with upper and lower

limits according to the design constrains of the Tanker-Boom

configuration (last phase)

146

Page 20: Air Refueling Autopilot, (My First Book)

xv

List of Acronyms

ANN Artificial Neural Network

CA Control Allocation

DEA Direct Eigenstructure Assignment

DMC Dynamic Matrix Control

EA Eigenstructure Assignment

FCS Flight Control System

FTC Fault Tolerant Control

FDI Fault Detection and Isolation

FMEA Failure Modes and Effects Analysis

GWEA Gain Weighted Eigenspace Assignment

GPC Generalized Predictive Control

ICE Innovative Control Effector

ICEM Integrated Control Effector Management

IMM Interacting Multiple Model

MIMO Multiple Input Multiple Output

MPC Model Predictive Control

PID Proportional Integral Derivative Controller

QP Quadratic Program

SISO Single Input Single Output

LQR Linear quadratic regulator

LQRIFC Linear quadratic regulator integrated fuzzy control

PI Performance index

GA Genetic Algorithms

Page 21: Air Refueling Autopilot, (My First Book)

xvi

List of Symbols

BF

Body-fixed frame of reference

SF Stability reference frame

WF Wind reference frame

EF Earth fixed reference frame

CG Center of gravity

BV Velocity with respect to body reference frame

EV Velocity with respect to earth fixed frame of reference

Er Position of CG with respect to EF

B� Angular velocity with respect to body reference frame

p Roll rate

q Pitch rate

r Yaw rate

BI Inertia matrix

EW Wind velocity with respect to EF

� Angle of attack

� Angle of side slip

� Azimuth angle with respect to EF

Pitch angle with respect to EF

� Bank angle with respect to EF

L Rolling moment

M Pitch moment

N Yaw moment

X Axial force component

Page 22: Air Refueling Autopilot, (My First Book)

xvii

Y Side force component

Z Normal force component

t Control thrust

e Elevator deflection angle

al Aileron deflection angle

r Rudder deflection angle

Page 23: Air Refueling Autopilot, (My First Book)

1

Chapter (1)

Introduction to

Air Force Aerial Refueling Methods

Flying Boom versus Hose-and-Drogue

1.1 Introduction

Air Force aerial refueling received considerable attention in the 108th and

109thCongresses. Much attention has focused on recapitalizing the KC-135 fleet, and a

proposed and ultimately rejected lease of 100 Boeing KC-767 aircraft. This report

examines the Department of Defense’s (DOD) mix of aerial refueling methods. Currently,

Air Force fixed-wing aircraft refuel with the “flying boom.” The boom is a rigid,

telescoping tube that an operator on the tanker aircraft extends and inserts into a receptacle

on the aircraft being refueled Fig 1.1. Air Force helicopters, and all Navy and Marine Corps

aircraft refuel using the “hose-and-drogue.” NATO countries and other allies also refuel

with the hose-and drogue. As its name implies, this refueling method employs a flexible

hose that trails from the tanker aircraft. A drogue (a small windsock) at the end of the hose

stabilizes it in flight, and provides a funnel for the aircraft being refueled, which inserts a

probe into the hose Fig. 1.2. All boom-equipped tankers (i.e., KC-135, KC-10), have a

single boom and can refuel one aircraft at a time with this mechanism. Many tanker aircraft

that employ

Fig. 1.1 USAF KC-10 Refueling B-52 with Flying Boom

Page 24: Air Refueling Autopilot, (My First Book)

2

hose-and-drogue system, can simultaneously employ two such mechanisms and, refuel two

aircraft simultaneously. The boom, however, can dispense fuel faster than a hose-and-

drogue.

Fig. 1.2 USMC KC-130 Refueling F/A-18s with Hose-and-Drogue

A single flying boom can transfer fuel at approximately 6,000 lbs per minute. A single

hose-and-drogue can transfer between 1,500 and 2,000 lbs of fuel per minute. Unlike

bombers and other large aircraft, however, fighter aircraft cannot accept fuel at the boom’s

maximum rate. (Today’s fighter aircraft can accept fuel at 1,000 to 3,000 lbs per minute

whether from the boom or from the hose-and-drogue.)2 Thus, the flying boom’s primary

advantage over the hose-and-drogue system is lost when refueling fighter aircraft. As

decisions are made regarding the Air Force tanker fleet, an issue that may arise for

Congress is whether to examine the mix of boom or and hose-and-drogue refuelable aircraft

in the Air Force. What might be the benefits and costs of any changes? Would DOD benefit

in terms of increased combat power? If so, would this benefit justify the cost?

Page 25: Air Refueling Autopilot, (My First Book)

3

1.2 Background

Air Force aircraft have not always used the flying boom. All U.S. combat aircraft used the

hose-and-drogue system until the late 1950s. The Air Force’s decision to field boom-

equipped tankers was based on the refueling needs of long-range bombers, which required

large amounts of fuel. The Air Force’s fighter community resisted eliminating the hose-

and-drogue, but was overruled by the Strategic Air Command, which operated the tanker

fleet, and during the Cold War, placed a higher value on refueling bombers. The perceived

shortcomings of using a single boom to refuel fighter aircraft is reflected in a 1990 Air

Force initiative to standardize DOD fighter aircraft refueling on the hose-and-drogue

method. As initially conceived, the initiative consisted of three elements: (1) placing probes

on all F-15 and F-16 fighters; (2) incorporating a probe in the design of the F-22A; and (3)

adding two drogue pods to at least 150 KC-135s. To provide redundancy and flexibility,

Air Force fighters would retain their boom receptacles. The 1991 war with Iraq (Operation

Desert Storm) heightened DOD concerns over a lack of uniformity in aerial refueling

methods. Navy leaders expressed frustration and dissatisfaction with the number of Air

Force aerial refueling aircraft capable of employing the hose-and-drogue. Post-conflict

analyses recommended that the Navy purchase its own fleet of land-based KC-10-sized

tankers to increase the number of hose-and-drogue aircraft and reduce its reliance on Air

Force aerial refueling.

1.3 Introduction to Fuzzy Logic Controllers

1.3.1 Introduction

While it is relatively easy to design a PID controller, the inclusion of fuzzy rules creates

many extra design problems, and although many introductory textbooks explain fuzzy

control, there are few general guidelines for setting the parameters of a simple fuzzy

controller. The approach here is based on a three step design procedure which builds on

PID control.

Page 26: Air Refueling Autopilot, (My First Book)

4

1. Start with a PID controller.

2. Insert an equivalent, linear fuzzy controller.

3. Make it gradually nonlinear.

Guidelines related to the different components of the fuzzy controller will be introduced

shortly. In the next three sections three simple realizations of fuzzy controllers are

described: a table-based controller, an input-output mapping and a Takagi-Sugeno type

controller. A short section summarizes the main design choices in a simple fuzzy controller

by introducing a check list. The terminology is based on an international standard which is

underway (IEC, 1996). Fuzzy controllers are used to control consumer products, such as

washing machines, video cameras, and rice cookers, as well as industrial processes, such as

cement kilns, underground trains, and robots. Fuzzy control is a control method based on

fuzzy logic. Just as fuzzy logic can be described simply as ’’computing with words rather

than numbers’’ fuzzy control can be described simply as ’’control with sentences rather

than equations’’. A fuzzy controller can include empirical rules, and that is especially

useful in operator controlled plants. Take for instance a typical fuzzy controller

1. If error is Neg and change in error is Neg then output is NB

2. If error is Neg and change in error is Zero then output is NM (1)

The collection of rules is called a rule base. The rules are in the familiar if-then format, and

formally the if-side is called the condition and the then-side is called the conclusion (more

often, perhaps, the pair is called (antecedent - consequent- conclusion ). The input value

’’Neg’’ is a linguistic term short for the word negative the output value ’’NB’’ stands for

negative BIG and ’’NM’’ for negative medium . The computer is able to execute the rules

and compute a control signal depending on the measured inputs error and change in error.

The objective here is to identify and explain the various design choices for engineers. In a

rule based controller the control strategy is stored in amore or less natural language. The

control strategy is isolated in a rule base opposed to an equation based description. A rule

based controller is easy to understand and easy to maintain for a non-specialist end-user.

Page 27: Air Refueling Autopilot, (My First Book)

5

An equivalent controller could be implemented using conventional techniques in fact, any

rule based controller could be emulated in, say fortran it is just that it is convenient.

Fig. 1.3 Direct control

To isolate the control strategy in a rule base for operator controlled systems. Fuzzy

controllers are being used in various control schemes (IEC, 1996). The most obvious one is

direct control, where the fuzzy controller is in the forward path in a feedback control

system Fig. 1.3. The process output is compared with a reference, and if there is a

deviation, the controller takes action according to the control strategy. In the figure, the

arrows may be understood as hyper-arrows containing several signals at a time for

multiloop control. The sub-components in the figure will be explained shortly. The

controller is here a fuzzy controller, and it replaces a conventional controller, say, a PID

(proportional integral-derivative) controller. In feedforward control Fig. 1.4 a measurable

disturbance is being compensated. It requires a good model, but if a mathematical model is

difficult or expensive to obtain, a fuzzy model may be useful. Fig 1.4 shows a controller

and the fuzzy compensator, the process and the feedback loop are omitted for clarity. The

scheme, disregarding the disturbance input, can be viewed as a collaboration of linear and

nonlinear control actions; the controller C may be a linear PID controller, while the fuzzy

controller F is a supplementary nonlinear Controller. Fuzzy rules are also used to correct

tuning parameters in parameter adaptive control schemes Fig. 1.5. If a nonlinear plant

changes operating point, it may be possible to change the parameters of the controller

according to each operating point. This is called gain scheduling since it was originally

used to change process gains. A gain scheduling controller contains a linear controller

Page 28: Air Refueling Autopilot, (My First Book)

6

whose parameters are changed as a function of the operating point in a preprogrammed

way. It requires thorough knowledge of the plant, but it is often a good way to compensate

for nonlinearities and parameter variations. Sensor measurements are used as scheduling

variables that govern the change of the controller parameters, often by means of a table

look-up. Whether a fuzzy control design will be stable is a somewhat open question.

Stability concerns the system’s ability to converge or stay close to an equilibrium point. A

stable linear system will converge to the equilibrium asymptotically no matter where the

system state variables start from. It is relatively straight forward to check for stability in

linear systems,

Fig. 1.4 Feedforward control

for example by checking that all eigenvalues are in the left half of the complex plane. For

nonlinear systems, and fuzzy systems are most often nonlinear, the stability concept is more

complex. A nonlinear system is said to be asymptotically stable if, when it starts close to an

equilibrium, it will converge to it. Even if it just stays close to the equilibrium, without

converging to it, it is said to be stable (in the sense of Lyapunov). To check conditions for

stability is much more difficult with nonlinear systems, partly because the system behavior

is also influenced by the signal amplitudes apart from the frequencies. The literature is

some what theoretical and interested readers are referred to Driankov, Hellendoorn &

Reinfrank (1993) or Passino & Yurkovich (1998). They report on four methods (Lyapunov

functions, Popov, circle, and conicity), and they give several references to scientific papers.

It is characteristic, however, that the methods give rather conservative results, which

Page 29: Air Refueling Autopilot, (My First Book)

7

translate into unrealistically small magnitudes of the gain factors in order to guarantee

stability. Another possibility is to approximate the fuzzy controller with a linear controller,

and then apply the conventional linear analysis and design procedures on the

approximation. It seems likely that the stability margins of the nonlinear system would be

close in some sense to the stability margins of the linear approximation depending on how

close the approximation is. This paper shows how to build such a linear approximation, but

the theoretical background is still unexplored. There are at least four main sources for

finding control rules (Takagi & Sugeno in Lee, 1990).

Expert experience and control engineering knowledge:. One classical example is the

operator’s handbook for a cement kiln (Holmblad & Ostergaard, 1982). The most common

approach to establishing such a collection of rules of thumb, is to question experts or

operators using a carefully organized questionnaire. _ based on the operator’s control

action: Fuzzy IF_THEN rules can be deduced from observations of an operator’s control

actions or a log book. The rules express input-output relationships. Based on a fuzzy model

of the process. A linguistic rule base may be viewed as an inverse model of the controlled

process.

Fig. 1.5 Fuzzy parameter adaptive control

Thus the fuzzy control rules might be obtained by inverting a fuzzy model of the process.

This method is restricted to relatively low order systems, but it provides an explicit solution

assuming that fuzzy models of the open and closed loop systems are available

(Braae&Rutherford in Lee, 1990). Another approach is fuzzy identification (Tong; Takagi

Page 30: Air Refueling Autopilot, (My First Book)

8

& Sugeno; Sugeno – all in Lee, 1990; Pedrycz, 1993) or fuzzy model-based control [1], [2],

[3].

Based on learning the self-organizing controller is an example of a controller that finds the

rules itself. Neural network is another possibility. There is no design procedure in fuzzy

control such as root-locus design, frequency response design, pole placement design, or

stability margins, because the rules are often nonlinear. Therefore we will settle for

describing the basic components and functions of fuzzy controllers, in order to recognize

and understand the various options in commercial software packages for fuzzy controller

design.

There is much literature on fuzzy control and many commercial software tools (MIT,

1995), but there is no agreement on the terminology, which is confusing. There are efforts,

however, to standardize the terminology, and the following makes use of a draft of a

standard from the International Electro technical Committee (IEC, 1996). Throughout,

letters denoting matrices are in bold upper case, for example A; vectors are in bold lower

case, for example x; scalars are in italics, for example n; and operations are in bold, for

example min.

1.3.2 A structure of fuzzy logic controller

There are specific components characteristic of a fuzzy controller to support a design

procedure. In the block diagram in Fig. 1.6, the controller is between a preprocessing block

and a post-processing block. The following explains the diagram block by block.

Page 31: Air Refueling Autopilot, (My First Book)

9

Fig. 1.6 Blocks of a fuzzy controller

1.3.2.1 Preprocessing

The inputs are most often hard or crisp measurements from some measuring equipment,

rather than linguistic. A preprocessor, the first block in Fig. 1.6, conditions the

measurements before they enter the controller. Examples of preprocessing are:

_ Quantization in connection with sampling or rounding to integers;

_ Normalization or scaling onto a particular, standard range;

_ Filtering in order to remove noise;

_ Averaging to obtain long term or short term tendencies;

_ A combination of several measurements to obtain key indicators; and

_ Differentiation and integration or their discrete equivalences

A quantizer is necessary to convert the incoming values in order to find the best level in a

discrete uninverse. Assume, for instance, that the variable error has the value 4.5, but the

universe is (u=(-5,-4,-3……..3,4,5)). The quantiser rounds to 5 to fit it to the nearest level.

Quantization is a means to reduce data, but if the quantization is too coarse the controller

may oscillate around the reference or even become unstable.

Page 32: Air Refueling Autopilot, (My First Book)

10

Nonlinear scaling is an option Fig. 1.7. In the FL SMIDTH controller the operator is asked

to enter three typical numbers for a small, medium and large measurement respectively

(Holmblad & Østergaard, 1982). They become break-points on a curve that scales the

incoming measurements (circled in the figure). The overall effect can be interpreted as a

distortion of the primary fuzzy sets. It can be confusing with both scaling and gain factors

in a controller, and it makes tuning difficult. When the input to the controller is error, the

control strategy is a static mapping between input and control signal. A dynamic controller

would have additional inputs, for example derivatives, integrals, or previous values of

measurements backwards in time. These are created in the preprocessor thus making the

controller multi-dimensional, which requires many rules and makes it more difficult to

design. The preprocessor then passes the data on to the controller.

Fig. 1.7 Example of nonlinear scaling of an input measurement

1.3.2.2 Fuzzification

The first block inside the controller is fuzzification, which converts each piece of input data

to degrees of membership by a lookup in one or several membership functions.

The fuzzification block thus matches the input data with the conditions of the rules to

determine how well the condition of each rulematches that particular input instance. There

is a degree of membership for each linguistic term that applies to that input variable.

1.3.2.3 Rule Base

The rules may use several variables both in the condition and the conclusion of the rules.

The controllers can therefore be applied to both multi-input-multi-output (MIMO) problems

Page 33: Air Refueling Autopilot, (My First Book)

11

and single-input-single-output (SISO) problems. The typical SISO problem is to regulate a

control signal based on an error signal. The controller may actually need both the error, the

change in error, and the accumulated error as inputs, but we will call it single-loop control,

because in principle all three are formed from the error measurement. To simplify, this

section assumes that the control objective is to regulate some process output around a

prescribed set point or reference. The presentation is thus limited to single-loop control.

Rule Format: Basically a linguistic controller contains rules in the if -then format, but

they can be presented in different formats. In many systems, the rules are presented to the

end-user in a format similar to the one below,

1. If error is Neg and change in error is Neg then output is NB

2. If error is Neg and change in error is Zero then output is NM

3. If error is Neg and change in error is Pos then output is Zero

4. If error is Zero and change in error is Neg then output is NM

5. If error is Zero and change in error is Zero then output is Zero

6. If error is Zero and change in error is Pos then output is PM

7. If error is Pos and change in error is Neg then output is Zero

8. If error is Pos and change in error is Zero then output is PM

9. If error is Pos and change in error is Pos then output is PB

The names =zeros, pos, neg are labels of fuzzy sets as well as NB, NM, PB, PM

(negative big, negative medium, positive big, and positive medium respectively). The same

set of rules could be presented in a relational format, a more compact representation.

Page 34: Air Refueling Autopilot, (My First Book)

12

The top row is the heading, with the names of the variables. It is understood that the two

leftmost columns are inputs, the rightmost is the output, and each row represents a rule.

This format is perhaps better suited for an experienced user who wants to get an overview

of the rule base quickly. The relational format is certainly suited for storing in a relational

database. It should be emphasized, though, that the relational format implicitly assumes that

the connective between the inputs is always logical and_ or logical or for that matter as

long as it is the same operation for all rules_and not a mixture of connectives. Incidentally,

a fuzzy rule with an or_combination of terms can be converted into an equivalent and

combination of terms using laws of logic (DeMorgan’s laws among others). A third format

is the tabular linguistic format.

This is even more compact. The input variables are laid out along the axes, and the output

variable is inside the table. In case the table has an empty cell, it is an indication of a

missing rule, and this format is useful for checking completeness. When the input variables

are error and change in error, as they are here, that format is also called a linguistic phase

plane. In case there are n > 2 input variables involved, the table grows to an n-dimensional

array; rather user-un friendly. To accommodate several outputs, a nested arrangement is

conceivable. A rule with several outputs could also be broken down into several rules with

one output. Lastly, a graphical format which shows the fuzzy membership curves is also

possible Fig. 1.8. This graphical user-interface can display the inference process better than

the other formats, but takes more space on a monitor.

Page 35: Air Refueling Autopilot, (My First Book)

13

Connectives In mathematics, sentences are connected with the words and, or, if_then (or

(implies), and if and (only if)), or modifications with the word not. These five are called

connectives. It also makes a difference how the connectives are implemented. The most

prominent is probably multiplication for fuzzy and instead of minimum. So far most of the

examples have only contained and operations, but a rule like ‘‘If error is very neg and not

zero or change in error is zero then ...’’ is also possible. The connectives and or are always

defined in pairs, for example,

There are other examples (e.g., Zimmermann, 1991) but they are more complex. Modifiers:

A linguistic modifiers, is an operation that modifies the meaning of a term. For example, in

the sentence ‘‘very close to 0’’, the word very modifies close to 0 which is a fuzzy set. A

modifier is thus an operation on a fuzzy set. The modifier very can be defined as squaring

the subsequent membership function, that is

A whole family of modifiers is generated by pa where p is any power between zero and

infinity. With ��p the modifier could be named exactly because it would suppress all

memberships lower than 1.0.

Universes: Elements of a fuzzy set are taken from a universe of discourse or just universe.

The universe contains all elements that can come into consideration. Before designing the

membership functions it is necessary to consider the universes for the inputs and outputs.

Take for example the rule:

If error is Neg and change in error is Pos then output is 0

Page 36: Air Refueling Autopilot, (My First Book)

14

Naturally, the membership functions for Neg and Pos must be defined for all possible

values of error and change in error and a standard universe may be convenient.

Another consideration is whether the input membership functions should be continuous or

discrete. A continuous membership function is defined on a continuous universe by means

of parameters. A discrete membership function is defined in terms of a vector with a finite

number of elements. In the latter case it is necessary to specify the range of the universe

and the value at each point. The choice between fine and coarse resolution is a trade off

between accuracy, speed and space demands. The quantiser takes time to execute, and if

this time is too precious, continuous membership functions will make the quantiser

obsolete.

Membership Functions: Every element in the universe of discourse is a member of a fuzzy

set to some grade, maybe even zero. The grade of membership for all its members describes

a fuzzy set, such as |Neg. In fuzzy sets elements are assigned a grade membership, such

that the transition from membership to non-membership is gradual rather than abrupt. The

set of elements that have a non-zero membership is called the support of the fuzzy set. The

function that ties a number to each element x of the universe is called the membership

function )(x� . The designer is inevitably faced with the question of how to build the term

sets. There are two specific questions to consider: (i) How does one determine the shape of

the sets? and (ii) How many sets are necessary and sufficient? For example, the error in the

position controller uses the family of terms Neg, Zero and pos. According to fuzzy set

theory the choice of the shape and width is subjective, but a few rules of thumb apply.

_ A term set should be sufficiently wide to allow for noise in the measurement.

_ A certain amount of overlap is desirable; otherwise the controller may run into poorly

defined states, where it does not return a well defined output

A preliminary answer to questions (i) and (ii) is that the necessary and sufficient number of

sets in a family depends on the width of the sets, and vice versa. A solution could be to ask

the process operators to enter their personal preferences for the membership curves; but

operators also find it difficult to settle on particular curves. The manual for the TILShell

product recommends the following (Hill, Horstkotte & Teichrow, 1990).

Page 37: Air Refueling Autopilot, (My First Book)

15

_Start with triangle set: All membership functions for a particular input or output should be

symmetrical triangles of the same width. The leftmost and the rightmost should be

shouldered ramps.

The overlap should be at least 50 %: The widths should initially be chosen so that each

value of the universe is a member of at least two sets, except possibly for elements at the

extreme ends. If, on the other hand, there is a gap between two sets no rules fire for values

in the gap. Consequently the controller function is not defined.

Membership functions can be flat on the top, piece-wise linear and triangle shaped,

rectangular, or ramps with horizontal shoulders. Fig. 1.8 shows some typical shapes of

membership functions. Strictly speaking, a fuzzy set A is a collection of ordered pairs:

1.3.2.4 Inference Engine

Fig. 1.9 and Fig. 1.10 are both a graphical construction of the algorithm in the core of the

controller. In Fig. 1.9, each of the nine rows refers to one rule. For example, the first row

says that if the error is negative (row 1, column 1) and the change in error is negative

Page 38: Air Refueling Autopilot, (My First Book)

16

(row1, column 2) then the output should be negative big (row 1, column 3). The picture

corresponds to the rule base in (2). The rules reflect the strategy that the control signal

should be a combination of the reference error and the change in error, a fuzzy

proportional-derivative controller. We shall refer to that figure in the following. The

instances of the error and the change in error are indicated by the vertical lines on the first

and second columns of the chart. For each rule, the inference engine looks up the

membership values in the condition of the rule.

Fig. 1.9 Graphical construction of the control signal in a fuzzy PD controller

Aggregation: The aggregation operation is used when calculating the degree of fulfillment

or firing strength of the condition of a rule k. A rule, say rule 1, will generate a fuzzy

membership value 1e� coming from the error and a membership value 1ce� coming from

the change in error measurement. The aggregation is their combination,

Page 39: Air Refueling Autopilot, (My First Book)

17

similarly for the other rules. Aggregation is equivalent to fuzzification, when there is only

one input to the controller. Aggregation is sometimes also called fulfillment of the rule or

firing strength.

Activation: the activation of a rule is the deduction of the conclusion, possibly reduced by

its firing strength. Thickened lines in the third column indicate the firing strength of each

rule. Only the thickened part of the singletons are activated, and min or product (*) is used

as the activation operator. It makes no difference in this case, since the output membership

functions are singletons, but in the general case of andzs ,,� functions in the third

column, the multiplication scales the membership curves, thus preserving the initial shape,

rather than clipping them as the min operation does. Both methods work well in general,

although the multiplication results in a slightly smoother control signal. In Fig. 1.9, only

rules four and five are active.

A rule k can be weighted a priori by a weighting factor � �1,0�kw , which is its degree of

confidence. In that case the firing strength is modified to

The degree of confidence is determined by the designer, or a learning program trying to

adapt the rules to some input-output relationship.

Accumulation: All activated conclusions are accumulated, using the max operation, to the

final graph on the bottom right Fig. 1.9. Alternatively, sum accumulation counts

overlapping areas more than once Fig. 1.10. Singleton output Fig. 1.9 and sum

accumulation results in the simple output

The alpha’s are the firing strengths from the n rules and s1,s2,…..sn are the output

singletons. Since this can be computed as a vector product, this type of inference is

relatively fast in a matrix oriented language.

Page 40: Air Refueling Autopilot, (My First Book)

18

There could actually have been several conclusion sets. An example of a one-input two-

outputs rule is ‘‘If ae is a then o1 is x and o2 is y”. The inference engine can treat two (or

several) columns on the conclusion side in parallel by applying the firing strength to both

conclusion sets. In practice, one would often implement this situation as two rules rather

than one, that is, ‘‘If ae is a then o1 is x, ‘‘If ae is a then o2 is y”.

1.3.2.5 Defuzzification

The resulting fuzzy set Fig. 1.9, bottom right; Fig. 1.10, extreme right must be converted to

a number that can be sent to the process as a control signal. This operation is called

defuzzification, and in Fig. 1.9 the x coordinate marked by a white, vertical dividing line

becomes the control signal. The resulting fuzzy set is thus defuzzified into a crisp control

signal. There are several defuzzification methods.

Centre of gravity (COG) The crisp output value x (black line in Fig. 1.9) is the abscissa

under the centre of gravity of the fuzzy set,

(1.1)

Here ix is a running point in a discrete universe, and )( ix� , is its membership value in the

membership function. The expression can be interpreted as the weighted average of the

elements in the support set. For the continuous case, replace the summations by integrals. It

is a much used method although its computational complexity is relatively high. This

method is also called centroid of area.

Centre of gravity method of singletons: If the membership functions of the conclusions are

singletons Fig. 1.9, the output value is

Page 41: Air Refueling Autopilot, (My First Book)

19

(1.2)

Here is is the position of singleton l in the universe, and )( is� , is equal to the firing

strength i� of rule i . This method has a relatively good computational complexity, and u is

differentiable with respect to the singletons is , which is useful in neurofuzzy systems.

Bisector of area (BOA): This method picks the abscissa of the vertical line that divides the

area under the curve in two equal halves. In the continuous case,

(1.3)

Here x is the running point in the universe, )(x� is its membership, min is the leftmost

value of the universe, and max is the rightmost value. Its computational complexity is

relatively high, and it can be ambiguous. For example, if the fuzzy set consists of two

singletons any point between the two would divide the area in two halves; consequently it

is safer to say that in the discrete case, BOA is not defined.

Mean of maxima (MOM) An intuitive approach is to choose the point with the strongest

possibility, i.e. maximal membership. It may happen, though, that several such points exist,

and a common practice is to take the mean of maxima (MOM). This method disregards the

shape of the fuzzy set, but the computational complexity is relatively good.

Page 42: Air Refueling Autopilot, (My First Book)

20

Leftmost maximum (LM), and rightmost maxima (RM): Another possibility is to choose

the leftmost maximum (LM), or the rightmost maximum (RM). In the case of a robot, for

instance, it must choose between left or right to avoid an obstacle in front of it. The

defuzzifier must then choose one or the other, not something in between. These methods

are indifferent to the shape of the fuzzy set, but the computational complexity is relatively

small.

1.3.2.6 Postprocessing

Output scaling is also relevant. In case the output is defined on a standard universe this

must be scaled to engineering units for instance, volts, meters, or tons per hour. An

example is the scaling from the standard universe [-1, 1] to the physical units [-100, 100]

volts. The postprocessing block often contains an output gain that can be tuned, and

sometimes also an integrator.

Fig. 1.10 One input, one output rule base with non-singleton output sets

Page 43: Air Refueling Autopilot, (My First Book)

21

1.4 Summary

In a fuzzy controller the data passes through a preprocessing block, a controller, and a

postprocessing block. Preprocessing consists of a linear or non-linear scaling as well as a

quantisation in case the membership functions are discretised (vectors); if not, the

membership of the input can just be looked up in an appropriate function. When designing

the rule base, the designer needs to consider the number of term sets, their shape, and their

overlap. The rules themselves must be determined by the designer, unless more advanced

means like self-organization or neural networks are available. There is a choice between

multiplication and minimum in the activation. There is also a choice regarding

defuzzification; center of gravity is probably most widely used. The postprocessing

consists in a scaling of the output. In case the controller is incremental, postprocessing also

includes an integration. The following is a checklist of design choices that have to be made.

_Rule base related choice. Number of inputs and outputs, rules, universes, continuous /

discrete, the number of membership functions, their overlap and width, singleton output;

_Inference engine related choices. Connectives, modifiers, activation operation,

aggregation

operation, and accumulation operation

_ Defuzzification method. COG, COGS, BOA, MOM, LM, and RM

_ Pre-and post processing. Scaling, gain factors, quantization, and sampling time

Some of these items must always be considered, others may not play a role in the particular

design. The input-output mappings provide an intuitive insight which may not be relevant

from a theoretical viewpoint, but in practice they are well worth using. The analysis

represented by plots is limited, though, to three dimensions. Various input-output mappings

can be obtained by changing the fuzzy membership functions, and the chapter shows how

to obtain a linear mapping with only a few adjustments. The linear fuzzy controller may be

used in a design procedure based on PID control as following:

1. Tune a PID controller.

Page 44: Air Refueling Autopilot, (My First Book)

22

2. Replace it with a linear fuzzy controller.

3. Transfer gains.

4. Make the fuzzy controller nonlinear.

5. Fine-tune it.

It seems sensible to start the controller design with a crisp PID controller, maybe even just

a P controller, and get the system stabilized. From there it is easier to go to fuzzy control.

Page 45: Air Refueling Autopilot, (My First Book)

23

Chapter (2)

Literature Survey

Traditional and Fuzzy Logic P, PD and PID controllers

2.1 The Control Problem

Given a system or process whose behavior can be controlled with one or more input

signals, the problem arises of inducing a desired state or response in an optimal way.

“Optimal” could refer here to obtaining the desired system’s response in minimal time, or

with a minimum number of oscillations, or without overshooting, etc.

In this chapter we discuss the control problem from the point of view of a system with

feedback. Many feedback controlled systems were built before control theory developed in

the 19th and 20th centuries. Control theory is now a fairly mathematical subject, in which

processes are described in the time or frequency domain using special transformations,

most notably the Laplace Transformation. Here we will deal with a special case of a

controller, the PID controller, which is simple but nevertheless the most popular choice for

system control. If we had an analytical model of a process valid for a broad range of

environmental conditions, we could compute the optimal input in advance, or even the

optimal sequence of input signals needed to obtain a desired behavior. Let us assume that

the response of the system to an input x is provided by the functional model f(x). Then, the

required input for the response y is just f(y). Having an “inverse model” of the system

allows us to input the control variable to the system directly and even without a feedback

signal. More frequently, however, although we can have detailed knowledge of the system,

it is very difficult to compute in advance the optimal input due to environmental

disturbances and noise. We then proceed using a kind of “trial and error” approach, testing

with one input signal, and adjusting its value according to the measured error. The

corrections are not made blindly, but based in the detected past behavior of the system, as

we show below.

When a system is controlled without looking to the actual behavior or output, we have an

open-loop system (open loop because the possible feedback loop has not been established).

Page 46: Air Refueling Autopilot, (My First Book)

24

Open loop systems are simpler and can be adequate in some cases. A closed-loop system is

one in which a measurement of the system’s state is compared to the desired goal, and the

difference can then be used to make corrections. Fig. 2.1 shows a diagram of a system

prepared for closed-loop control. The controller, nowadays almost always a

microprocessor, receives the desired output value as well as the measured error of the

system’s response (initialized to zero at the beginning). The controller produces a control

signal which drives the robot’s actuators. This, together with environmental disturbances,

produces the actual system’s output. The output can be monitored using sensors possibly

affected by noise. The measurement is then compared inside the controller with the desired

response, and the controller produces a corrected control signal. The controller is activated

many times and very rapidly in comparison with the process’ inertia.

Fig. 2.1 A generic model for control with feedback

The main question is therefore, what should be the structure of the controller box. A very

popular strategy for driving such closed-loop systems are PID controllers. The letter P

stands here for proportional, I for integral, and D for differential.1 The letters P, I, and D

refer also to the three gain constants used in PID controllers.

In what follows we take a very simple example, a DC motor, and discuss what happens

when a desired rotational speed is needed. We assume that the controller does not contain

any analytical model of the motor which could allow it to set the input voltage a priori

Page 47: Air Refueling Autopilot, (My First Book)

25

according to the desired speed. We only assume that we can make the voltage lower or

higher (between −1 and 1 Volts) in fractional steps, and that we can monitor the

instantaneous rotational speed of the motor. A mass with moment of inertia I is fixed to the

motor’s rotor.

In a DC motor the relationship between the torque and the voltage is linear. In the examples

below we use the following relationship between torque D, voltage V, and angular velocity

� :

where a and b are constants specific to the motor. The term b! is the braking voltage

produced by the DC motor, which also behaves as a generator, when it is running at angular

velocity � . When the DC motor reaches its maximum speed, the braking voltage is equal

to the maximum voltage and the torque is zero. The constant ‘a’ converts from units of

voltage to units of torque.

Fig. 2.2 A classical PID controller

When the mass m attached to the rotor is small (i.e. I is small) the motor responds to high

voltages with a “jump-start”. When I is large, it takes much more time to accelerate the DC

motor. The PID controller should take charge of minimizing the acceleration time, while at

the same time avoiding control oscillations, which are very common in robots or any

process in which we try to reach the steady state in minimal time. In what follows we first

take a look at a purely proportional controller, then a PI controller, and finally a PID

controller.

Fig. 2.2 shows a schematics of a discrete bare bones PID controller. We denote time by t.

Time advances in discrete steps. The controller receives as input not the reference signal

r(t) but the difference between the current state of the system given by s(t), and the

reference signal r(t). This we call the error e(t). The controller generates from the input e(t)

Page 48: Air Refueling Autopilot, (My First Book)

26

a corrected control signal c(t + 1) which drives the system, produces a new output s(t + 1),

a new error, which is fed back to the controller box. It is very important to notice that in

this simple feedback loop the original value of the reference signal r(t) is not directly

visible to the controller. In some variations of PID this assumption is eliminated. The

classical textbook version of the control signal generated by a PID controller reads as

follows:

(2.1)

where Kp, Kp/Ti and KpTd are the proportional, integral, and differential control gains, as

we discuss below. Sometimes the equation is written in a simpler manner

(2.2)

where Kp, Ki and Kd are the proportional, integral and differential gains. Equation (2.1)

has a form which allows us to associate an intuitive meaning with the constants Ti and Td,

as explained below.

The formulas describe a continuous PID controller in which the process is running

continuously and the feedback loop is so fast as to seem continuous (for example, using an

analog circuit). The integral of the current instantaneous error e(t) divided by Ti is a

measure of how far off the system has been from the desired response in the past, and the

derivative of the error is a measure of how fast the error is changing. The derivative of the

error, multiplied by a time step Td, can be used as a predictor of the future error. A PID

controller, therefore, adjusts the control signal according to the current error, a measure of

the error in the past, and the predicted error in the near future.

(2.3)

Page 49: Air Refueling Autopilot, (My First Book)

27

If we take Ti = t and Td = 1, then the current error is e(t), the I-term is the average error in

the past, and the D-term is the predicted error in the next time step. They all enter in the

computation. Their sum is multiplied by the constant Kp and is used as the control signal.

Variations in the values of Ti and Td provide different weighted averages of past, current,

and future error. According to surveys of the kind of control methods most popular in

industry, PID controllers account for the bulk of all devices used in process control [3].

They are popular because they are simple, analyzable, and because there is already a rich

literature which deals with them.

2.2 Controller Types

2.2.1 Proportional Controller

A P-controller (proportional controller) runs in a closed-loop, which in the case of robots

can be monitored up to several thousand times per second. During the control loop there is

a difference at time t between the desired system state r(t) (the reference signal), and the

current system state s(t). Therefore, the error computed in the controller at time t is e(t) =

r(t) − s(t). Let us denote by c(t) the control signal applied at time t. In the discrete case, the

control signal for the next control iteration can be computed as

(2.4)

where Kp is a proportionality constant which transforms from state to control units, and

which determines how large the control signal should be. In the case of the DC motor

described above, we can experiment with several control signals. Starting from c(0) = 0,

for a desired fixed angular velocity r(·) = 0.5, for given motor parameters and a fixed mass

with moment of inertia I, we obtain the results shown in Fig. 2.2. The graphic shows how

the rotational velocity increases until the system comes close to the desired rotational

Page 50: Air Refueling Autopilot, (My First Book)

28

speed. The motor does not reach the desired velocity of 0.5 because should the error (e(t)

fall to zero, then the control variable c(t + 1) (in this case the voltage) would also fall to

zero. The system reaches the steady state when a certain error e(t) is such that the computed

control variable c(t + 1) produces the error e(t + 1) = e(t). The error stabilizes at a non-zero

level which produces a constant control signal. In the example shown in Fig. 2.2 the

controller produces at the beginning voltages higher than 1 Volt. In such case the control

signal has become saturated and we clip it at 1 Volt. This introduces a further complication

in the control process, a nonlinearity which in this case is not so important, but which can

afflict the control of other kind of systems. Since the motor does not reach 0.5 as angular

velocity, we can try to force it to reach that speed, but only at the expense of increasing

excessively the proportional gain. The rotational speed would oscillate then around an

equilibrium value which is still different from 0.5.

2.2.2 PI Controller

The solution to the problem of the system settling on a steady state s(t) which is different

from the desired state r(t) is to add another term to the computation of the control signal.

An integral controller adds up the error during the successive control cycles (as shown in

Equation 1). This integrated error can then be used to adjust the control variable c(t). If, for

example, the error has been positive for many past cycles, the correction to the control

variable should be increased more drastically. The control expression used in a PI controller

is of the form

(2.5)

where Ti is the integration time constant, and �t

t

ie )( is the discrete integral of the past

errors until time t. Adjusting Ti and for a given Kp, we obtain different weights for the

integral of the past error. The factors Ti/(1+Ti) and 1/(1+Ti) are the relative weights of the

P-term and the I-term before the are multiplied by the constant Kp.

Page 51: Air Refueling Autopilot, (My First Book)

29

2.2.3 PID Controller

The effect of the integral term is to eliminate the systematic offset from the desired

response r(t). However, the introduction of the integral term can lead to undesirable

oscillations and makes the controller act “harder”. This problem can be ameliorated using a

differential term in the computation of the control signal. For the differential term we use

the discrete derivative of the error signal, that is, the difference e(t) − e(t − 1). If the

derivative is large, that is, if the error is changing rapidly, we can decide to make the

control signal change smaller by an amount KpTd(e(t) − e(t − 1)). The control signal

at (t + 1) becomes then

(2.6)

2.2.4 Proportion Fuzzy Controller

Input to a fuzzy proportional (FP) controller is error, and the output is the control signal,

cf. the block diagram in Fig. 2.3. This is the simplest fuzzy controller there is. It is relevant

for state- or output-feedback in a state space controller.Compared to crisp proportional

control the fuzzy P controller has two gains GE and GU in stead of just one. instead of just

one. As a convention, signals are written in lower case before gains and upper case after

gains, for instance eGEE *� . The gains are mainly for tuning the response, but since

there are two gains, they can also be used for scaling the input signal onto the input

universe to exploit it better.

Fig. 2.3 Fuzzy proportional controller (FP)

Page 52: Air Refueling Autopilot, (My First Book)

30

The controller output is the control signal nU a nonlinear function of ne ,

(2.7)

The function f is the fuzzy input-output map of the fuzzy controller. Using the linear

approximation nn eGEeGEf *)*( � then

(2.8)

Compared with the conventional proportion gain, the product of the gain factors is

equivalent to the proportional gain,i.e.,

(2.9)

The accuracy of the approximation depends mostly on the membership functions and the

rules. The approximation is best, however, if we choose the same universe on both input

and output side, for example [-100, 100]. The rule base

1. If H is Pos then x is 100

2. If H is Neg then x is -100

with Pos and Neg triangular as defined previously, is equivalent to a P-controller. Given a

target Ns, for example from the Ziegler-Nichols rules, equation (2.9) helps to choose the

gains. The equation has one degree of freedom, since the fuzzy P controller has one more

gain factor than the crisp P controller. This is used to exploit the full range of the input

universe. If for example the maximal reference step is 1, whereby the maximal error hq is

1, and the universe for E is [-100, 100], then fix GE at 100. Since GE is now fixed, GU is

determined by equation (2.9). Because of the process dynamics it will take some time

before a change in the control signal is noticeable in the process output, and the

proportional controller will be more or less late in correcting for an error.

2.2.5 Proportional and derivative fuzzy controller

Page 53: Air Refueling Autopilot, (My First Book)

31

Derivative action helps to predict the error and the proportional-derivative controller uses

the derivative action to improve closed-loop stability. The basic structure of a PD controller

is

(2.10)

The control signal is thus proportional to an estimate of the error dT seconds ahead, where

the estimate is obtained by linear extrapolation. For 0�dT the control is purely

proportional, and when dT is gradually increased, it will dampen oscillations. If dT

becomes too large the system becomes overdamped and it will start to oscillate again. Input

to the fuzzy proportional-derivative (FPD) controller is the error and the derivative of the

error Fig. 2.4. In fuzzy control the latter term is usually called change in error.

(2.11)

Fig. 2.4 Fuzzy PD controller (FPD)

This is a discrete approximation to the differential quotient using a backward difference.

Other approximations are possible, as in crisp PD controllers. Notice that this definition

deviates from the straight difference 1 � nnn eece used in the early fuzzy controllers. The

controller output is a nonlinear function of error and change in error.

(2.12)

Page 54: Air Refueling Autopilot, (My First Book)

32

Again the function i is the input-output map of the fuzzy controller, only this time it is a

surface. Using the linear approximation nn ceGCEeGE ** � , then

(2.13)

By comparison, the gains in (2.10) and (2.13) are related in the following way,

(2.14)

(2.15)

The approximation corresponds to replacing the fuzzy input-output surface with a plane.

The approximation is best if we choose the output universe to be the sum of the input

universes. Assume, for example, that the input universes are both [-100, 100] and we

choose output singletons on [-200, 200], then the input-output map will be the plane

CEEu �� . Therefore, by that choice, we can exploit (2.14) and (2.15). The fuzzy PD

controller may be applied when proportional control is inadequate. The derivative term

reduces overshoot, but it may be sensitive to noise as well as an abrupt change of the

reference causing a derivative kick The usual counter-measures may overcome these

problems: in the former case insert a filter, and in the latter use the derivative of the process

output ny instead of the error.

2.2.6 Incremental Fuzzy Controller

If there is a sustained error in steady state, integral action is necessary. The integral action

will increase the control signal if there is a small positive error, no matter how small the

error is; the integral action will decrease it if the error is negative. A controller with integral

action will always return to zero in steady state. It is possible to obtain a fuzzy PI controller

using error and change in error as inputs to the rule base. Experience shows, however, that

it is rather difficult to write rules for the integral action. Problems with integrator wind up

also have to be dealt with. Windup occurs when the actuator has limits, such as maximum

Page 55: Air Refueling Autopilot, (My First Book)

33

speed for a motor or maximum opening of a valve. When the actuator saturates, the control

action stays constant, but the error will continue to be integrated, the integrator winds up.

The integral term may become very large and it will then take a long time to wind it down

when the error changes sign. Large overshoots may be the consequence. There are methods

to avoid it (Åström & Hägglund, 1995). It is often a better solution to configure the

controller as an incremental controller. An incremental controller adds a change in control

signal u� to the current control signal

(2.16)

using (2.2) with 0�dT . It is natural to use an incremental controller when for example a

stepper motor is the actuator. The controller output is an increment to the control signal,

and the motor itself performs an integration. It is an advantage that the controller output is

driven directly from an integrator, then it is easy to deal with windup and noise. A

disadvantage is that it cannot include D-action well. The fuzzy incremental (FInc) controller

in Fig. 2.5 is almost the same configuration as the FPD controller except for the integrator

on the output The output from the rule base is therefore called change in output and the

gain in the output has changed name accordingly to GCU. The control signal nU is the sum

of all previous increments,

(2.17)

Notice again that this definition deviates from the early fuzzy controllers, where nU =

Page 56: Air Refueling Autopilot, (My First Book)

34

Fig. 2.5 Fuzzy incremental controller (FInc)

� )*( icuGCU the difference is the sampling period sT . The linear approximation to this

controller is

(2.18)

By comparing (2.16) and (2.18) it is clear that the gains are related in the following way,

(2.19)

Notice that the proportional gain now depends on GCE. The gain on the integral action is

determined by the ratio between the two input gains, and it is the inverse of the derivative

gain in FPD control. It is as if GE and GCE have changed roles. The controller is really a PI

Page 57: Air Refueling Autopilot, (My First Book)

35

controller, compare (2.2) and (2.18). The usual problem of Integrator windup can be

overcome by simply limiting the integrator.

2.2.7 Proportional, integral and derivative fuzzy controller

It is straight forward to envision a fuzzy PID controller, with three input terms: error,

integral error and derivative error. A rule base with three inputs, however, easily becomes

rather big and, as mentioned earlier, rules concerning the integral action are troublesome.

Therefore it is common to separate the integral action as in the fuzzy PD+I (FPD+I)

controller in Fig. 2.6. The integral error is computed as,

(2.20)

Fig. 2.6 Fuzzy PD+I controller (FPD+I)

The controller is thus a function of the three inputs

(2.21)

Its linear approximation is

Page 58: Air Refueling Autopilot, (My First Book)

36

(2.22)

In the last line we have assumed a nonzero GE. Comparing (2.2) and (2.22) the gains are

related in the following way,

(2.23)

This controller provides all the benefits of PID control, but also the disadvantages regarding

derivative kick and integrator windup

2.2.8 Summary

Advantages and disadvantages of all four fuzzy controllers are listed in Table 2.1. The

fuzzy P controller may be used in state space models or for practicing. To improve the

settling time and reduce overshoot, the fuzzy PD is the choice. If there is a problem with a

steady state error, a fuzzy incremental controller or a fuzzy PD+I is the choice. The

relationships between the PID gains and the fuzzy gains are summarized in Table 2.2. To

emphasize, the controllers with i replaced by a summation are linear approximations to the

corresponding fuzzy configurations; the relations hold for the approximations only. They

are valid when FH and FX are true difference quotients instead of just differences. If these

are implemented as differences anyway, ( 1 ��� nnnn eeece and 1 ��� nnnn uuucu )

the sample period must be taken into account in the equations, and the table modified

accordingly. Also, for fixed universe controllers, the output universe must be the sum of the

input universes. With input universes [-100, 100], for instance, the output universe of an

FPD controller should be [-200, 200].

Page 59: Air Refueling Autopilot, (My First Book)

37

Table 2.1 Quick reference to fuzzy controllers

Table 2.2 Relation between fuzzy and PID gains

2.3 Problem Formulation

In order to design air refueling autopilot that containing multiple stages, there are some

basic features that should be satisfied such that the fighter-tanker configuration constrains,

flying qualities standard and the minimum possible mission time that allow the tanker to

refuel multiple aircrafts within small time. On the other hand it is required to design a

suitable controller that meets the mentioned criteria together with a safety margin.

consequently the aerial refueling process should be divided into three basic stages that

minimize the total time period with a control discipline to switch between controllers in

such a way without losing system stability. These three basic stages can be defined (initial

stability stage, tracking stage and alignment stage). Each one of these stages has an

important role during the predefined mission. Initial stability stage is to recover the aircraft

from any past maneuvers, tracking stage has a significant impact to minimize the whole

Page 60: Air Refueling Autopilot, (My First Book)

38

mission time and the alignment stage is to secure the aircraft docking under the tanker

satisfying the safety constrains of the tanker.

2.4 Main Objective of the Thesis

The main objective of this thesis is to design and implement an integrated control

system that combines both advantages of an optimal controller and fuzzy logic controller.

Genetic algorithms will be used to optimize the fuzzy logic parameters such that the output

gains, the membership functions locations and rule base firing strength. In mean while it is

required to apply the three stages control strategy to construct the overall aircraft autopilot.

Providing a complete mission simulation describing the three basic stages.

2.5 Thesis Layout

In the beginning of this thesis in chapter 1 some brief introductory is presented to

explain the aerial refueling aspects and the main concept of the fuzzy logic controller.

Chapter 2 illustrates many types of traditional and smart (fuzzy logic) controllers. Chapter 3

presents the basic preliminaries needed to construct aircraft model and the basic principles

to compute the linearized state space from the F16 nonlinear model. An optimal controller

type (LQR) will be discussed in Chapter 4 with an iterative algorithm to compute the output

gain matrix for both longitude and lateral motions. Chapter 5 will discuss the intelligent

learning of fuzzy logic controller integrated with LQR controller. In this part GA will be

used to optimize the fuzzy logic parameters that results in the minimum output performance

index. GA code will be provided with different number of samples and different number of

generations with different initializations to cope with the different types fuzzy logic

parameters. After testing the integrated LQR Fuzzy logic controller via SIMULINK /

MATLAB for longitudinal and lateral motions separately, the complete integrated control

system will be applied and simulated for fighter-tanker configuration. Applying the whole

control strategy for the mission proposed with multiple stages, consequently evaluating the

system performance and verifying with the required constrains as mentioned before in

Page 61: Air Refueling Autopilot, (My First Book)

39

problem formulation in the previous section. Chapter 6 will discuss the last stage of the

aerial refueling controller (Alignment stage) and all design constrains that should be

verified for safe and secured docking. Chapter 7 illustrates the complete methodology for

designing an aerial refueling autopilot. Chapter 8 introduces the final conclusion of the

thesis with the future work expected.

Page 62: Air Refueling Autopilot, (My First Book)

40

Chapter 3

Preliminaries

Modeling, Trimming and Linearization

3.1 Aircraft Modeling

The first successful study of control and dynamics of an aircraft is credited to Bryan and

Lanchester (1908). The equations of motion have changed little in the last century, and the

original formulations are still used. The following sections give an overview of the various

reference frames used to describe an aircraft’s state, provide an overview of the general

nonlinear and linear equations of motion for an aircraft and review the various ways that

failures can be modeled.

3.1.1 Reference Frames

There are a variety of reference frames used to describe aircraft movement and orientation.

Some are suited to navigation (FE) and some to control (FB, FS, FW). The relevant frames

are described in the following list.

Body-fixed reference frame FB: this is a right-hand orthogonal reference system which has

its origin, OB, at the centre of gravity of the aircraft. The XBOBZB plane coincides with the

aircraft’s plane of symmetry if it is symmetric, or it is located in a plane, approximating

what would be the plane of symmetry if it is not. The XB axis is directed towards the nose

of the aircraft, the YB axis points to the right wing, and the ZB axis points towards the

bottom of the aircraft.

Stability reference frame FS: this is a special body-fixed reference frame, used in the study

of small deviations from the nominal flight condition. The reference frames FB and FS

differ in the orientation of their respective X axis. The XS axis is chosen parallel to the

projection of the true airspeed vector V on the OBXBZB plane (if the aircraft is symmetric

Page 63: Air Refueling Autopilot, (My First Book)

41

this is the plane of symmetry), or parallel to V itself in case of a symmetrical nominal flight

condition. The YS axis coincides with the YB axis.

Flight path or wind reference frame FW: this reference frame, also called the wind reference

frame, has its origin in the C.G. of the aircraft. The Xw axis is aligned with the velocity

vector of the aircraft and ZW axis coincides with the ZS axis.

Earth fixed reference frame FE : this reference frame, also called the topodetic reference

frame, is a right-handed orthogonal system which is considered to be fixed in space. Its

origin can be placed at an arbitrary position, but will be chosen to coincide with the

aircraft’s centre of gravity at the start of a flight test maneuver. The ZE axis points

downwards, parallel to the local direction of gravity. The XE axis is directed to the north,

the YE axis to the east.

The relationships between the various frames of reference are shown in Fig. 3.1.

Fig. 3.1 Relationship between the body-fixed reference frame FB, flight- path

reference frame FW and stability reference frame FS

Page 64: Air Refueling Autopilot, (My First Book)

42

3.1.2 General Equation of Motion

Our goal in this section is to describe the position and orientation of the aircraft in

appropriate reference frames, as well as the dynamics and relationships between the various

frames.

The velocity of the aircraft is defined as follows:

� �TB wvuV � : Velocity with respect to FB

� �TEEEE wvuV � : Velocity with respect to FE

� �zyxE WWWW � : Velocity with respect to FW

The velocity VB does not include the effects of wind. If wind is to be explicitly included a

superscript W will be used. EBEB

W

B WLVV �� , where 1 � EBBE LL is the coordinate

transform from FE to FB. LEB is defined as:

���

���

��������������������

coscoscossinsin

cossinsinsincoscoscossinsinsinsincos

sinsincossincossincoscossinsincoscos

EBL (3.1)

Where �� ,, describes the orientation of the aircraft as defined below.

Two important relationships between the various reference frames can now be defined. As

shown in Fig. 3.1 the angle of attack,� , is the angle between the body-fixed axis and the

stability axis. The sideslip angle � is the angle between the wind axis and the stability

axis. These values can be computed as follows:

u

w1tan �� (3.2)

Page 65: Air Refueling Autopilot, (My First Book)

43

222

1sinwvu

vB

��� (3.3)

The position of the aircraft is most often used for navigation, and hence its dynamics are

given in the earth-frame as follows:

W

BEB

W

E

E

E

E

E VLV

z

y

x

r �����

���

��

� (3.4)

Note that ZE points into the ground and is therefore negative for positive height. As a result,

the altitude or height is often used instead of ZE: EZh �

The orientation of the airplane is defined relative to the earth axes and is given by the Euler

angles ),,( �� . The Euler angles define the rotations from the earth-fixed reference to the

body-fixed axis. The ordering of the rotations is important and is done as follows:

1. Rotate � about OEZE

2. Rotate about OEYE

3. Rotate � about OEZE

Euler angles are not unique, and so in order to avoid ambiguities, the following ranges are

defined:

��� �� or �� 20 ��

22

���

��� �� or �� 20 ��

The angular rotation rates are defined relative to the body-fixed inertial frame FB as

� �TB rqp�� , where p is the roll rate, q is the pitch rate, and r is the yaw rate. The

Page 66: Air Refueling Autopilot, (My First Book)

44

angular rates are related to the rate of change of the Euler angles by the following

coordinates transforms:

���

���

���

���

���

���

��

����

coscossin0

cossincos0

001

r

q

p

(3.5)

���

���

���

���

� �

���

���

r

q

p

������

��

seccossecsin0

sincos0

tancostansin1

(3.6)

Note that when perturbations are small, such that ),,( �� may be treated as small angles,

equations 3.5 and 3.6 may be approximated by:

���

���

���

���

��

r

q

p

(3.7)

It is ready now to compute the dynamics equations of the aircraft. The dynamics are built

from basic Newtonian dynamics of a rigid body, as given by the general force and moment

equations:

)( Vt

VmF ���

��

� (3.8)

)()(

�������

� It

IM (3.9)

Where V is linear velocity, � is angular velocity and I is the moment of inertia. Equation

(3.8) and (3.9) written in terms of the variables defined in this section is:

)(sin WWW rvqwummgX �� �

(3.10)

)(sincos WWW pwruvmmgY ����

� (3.11)

)(coscos WWW qupvwmmgZ ����

� (3.12)

Page 67: Air Refueling Autopilot, (My First Book)

45

qrIIrpqIpqrLrqIpIL zyxyzxyzx )()()()( 22 � � ��� (3.13)

rpIIpqrIqrpIprIqIM xzyzxyzxy )()()()( 22 � � ��� (3.14)

pqIIqrpIrpqIqpIrIN yxzxyzxyz )()()()( 22 � � ��� (3.15)

Where

���

���

zzyzx

yzYyx

xzxyx

B

III

III

III

I is the inertia, � �ZYX and � �NML are the forces

and moments acting on the aircraft respectively. These forces and moments are functions of

the control surfaces, thrust and drag. They can be written as functions of the six linear and

angular velocities ),,,,,( rqpwvu and the actuator positions, which is usually given by the

aileron, elevator, rudder and throttle positions. In some cases it is easier to use the true

velocity BVV � , sideslip angle � and angle of attack � rather than the body-fixed

velocities ),,( wvu .equations 3.10 to 3.12 can be replaced by:

)sinsinsincoscos(1

����� ZYXm

V ���� (3.16)

������

� tan)sincos()cossin(1

cos

1rpqZX

mV� ���

���

� � �� (3.17)

�������� cossin)sinsincossincos(11

rpZYXmV

���

���

� � �� (3.18)

Equations 3.10 to 3.18 can be combined together to form the full nonlinear dynamic of the

airplane. Other commonly used variables, which can be computed directly from the

aircraft’s state, are the azimuth or heading angle, , and the flight path angle, ! , these are

defined as:

�� �� (3.19)

�! ���

)(sin 1

V

h (3.20)

Page 68: Air Refueling Autopilot, (My First Book)

46

3.1.3 Linearized Equations of Motion

The equations of motion developed in the previous section are nonlinear. If it is assumed

that the motion of the airplane consists of small deviations from a reference condition of

steady state flight, then a linearized model around the trim condition can be obtained.

Steady flight can be defined, for example, as one of the following:

Steady wings-level flight: 0,,, ���� ���

Steady turning flight: 0, ��� � , �� =turn rate

Steady pull-up: 0,, ��� ��� , � =pull-up rate

Steady roll: 0, ��� � , �� =roll rate

Where 0,,,,, ������� ��Vrqp and all control surface inputs are zero.

3.2 Aircraft Trimming Using NN Algorithm

3.2.1 Basic Architecture of Neural Network

A layered feed-forward network consists of a certain number of layers, and each layer

contains a certain number of units. There is an input layer, an output layer, and one or more

hidden layers between the input and the output layer. Each unit receives its inputs directly

from the previous layer (except for input units) and sends its output directly to units in the

next layer (except for output units). Unlike the Recurrent network, which contains feedback

information, there are no connections from any of the units to the inputs of the previous

layers nor to other units in the same layer, nor to units more than one layer ahead. Every

unit only acts as an input to the immediate next layer. Obviously, this class of networks is

easier to analyze theoretically than other general topologies because their outputs can be

represented with explicit functions of the inputs and the weights[6], [7], [8], [9].

Page 69: Air Refueling Autopilot, (My First Book)

47

Fig. 3.2 Basic Neural Network Structure

An example of a layered network with one hidden layer is shown in Error! Reference

source not found. In this network there are l inputs, m hidden units, and n output units. The

output of the jth hidden unit is obtained by first forming a weighted linear combination of

the l input values, then adding a bias,

(3.14)

where is the weight from input i to hidden unit j in the first layer and is the bias

for hidden unit j. If we are considering the bias term as being weights from an extra input

eqn (3.14) can be rewritten to the form of,

(3.15)

The activation of hidden unit j then can be obtained by transforming the linear sum using an

activation function

(3.16)

Page 70: Air Refueling Autopilot, (My First Book)

48

The outputs of the network can be obtained by transforming the activation of the hidden

units using a second layer of processing units. For each output unit k, first we get the linear

combination of the output of the hidden units,

(3.17)

Again we can absorb the bias and rewrite the above equation to,

(3.18)

Then applying the activation function to (3.18) we can get the kth output

(3.19)

Combining eqn (3.16), (3.17), (3.18) and (3.19) we get the complete representation of the

network as

(3.20)

The simple network is a network with one hidden layer. We can extend it to have two or

more hidden layers easily as long as we make the above transformation further. One thing

we need to note is that the input units are very special units. They are hypothetical units that

produce outputs equal to their supposed inputs. No processing is done by these input units.

3.2.2 Network Structure Design

Though theoretically there exists a network that can simulate a problem to any accuracy,

there is no easy way to find it. To define an exact network architecture such as how many

hidden layers should be used, how many units should there be within a hidden layer for a

certain problem is always a painful job. Here we will give a brief discussion about the

issues to be considered when we design a network.

Page 71: Air Refueling Autopilot, (My First Book)

49

3.2.2.1 Number of Hidden Layers

Because networks with two hidden layers can represent functions with any kind of shapes,

there is no theoretical reason to use networks with more than two hidden layers. It has also

been determined that for the vast majority of practical problems, there is no reason to use

more than one hidden layer. Problems that require two hidden layers are only rarely

encountered in practice. Even for problems requiring more than one hidden layer

theoretically, most of the time, using one hidden layer performs much better than using two

hidden layers in practice. Training often slows dramatically when more hidden layers are

used. There are several reasons why we should use as few layers as possible in practice:

1) Most training algorithms for feed-forward network are gradient-based. The

additional layer through which errors must be back propagated makes the gradient very

unstable. The success of any gradient-directed optimization algorithm is dependent on the

degree to which the gradient remains unchanged as the parameters vary.

2) The number of local minima increases dramatically with more hidden layers. Most

of the gradient-based optimization algorithms can only find local minima, thus they miss

the global minima. Even though the training algorithm can find the global minima, there is

a higher probability that after many time-consuming iterations, we will find ourselves stuck

in a local minimum and have to escape or start over.

Of course, it is possible that for a certain problem, using more hidden layers of just a few

units is better than using fewer hidden layers requiring too many units, especially for

networks that need to learn a function with discontinuities. In general, it is strongly

recommended that one hidden layer be the first choice for any practical feed-forward

network design. If using a single hidden layer with a large number of hidden units does not

perform well, then it may be worth trying a second hidden layer with fewer processing

units.

3.2.2.2 Number of Hidden Units

Another important issue in designing a network is how many units to place in each layer.

Using too few units can fail to detect the signals fully in a complicated data set, leading to

Page 72: Air Refueling Autopilot, (My First Book)

50

underfitting. Using too many units will increase the training time, perhaps so much that it

becomes impossible to train it adequately in a reasonable period of time. A large number of

hidden units might cause overfitting, in which case the network has so much information

processing capacity, that the limited amount of information contained in the training set is

not enough to train the network.

The best number of hidden units depends on many factors – the numbers of input and

output units, the number of training cases, the amount of noise in the targets, the

complexity of the error function, the network architecture, and the training algorithm.

There are lots of “rules of thumb” for selecting the number of units in the hidden layers

[10]-[15]:

� � - between the input layer size and output layer size

� � - two third of the input layer size plus the output layer size

� � - less than twice the input layer size

� � - squared input layer size multiplied by output layer size

Those rules can only be taken as a rough reference when selecting a hidden layer size. They

do not reflect the facts well because they only consider the factor of the input layer size and

output layer size but ignore other important factors that we previously mentioned.

In most situations, there is no easy way to determine the optimal number of hidden units

without training using different numbers of hidden units and estimating the generalization

error of each. The best approach to find the optimal number of hidden units is trial and

error. In practice, we can use either the forward selection or backward selection to

determine the hidden layer size. Forward selection starts with choosing an appropriate

criterion for evaluating the performance of the network. Then we select a small number of

hidden units, like two if it is difficult to guess how small it is; train and test the network;

record its performance. Next we slightly increase the number of hidden units; train and test

until the error is acceptably small, or no significant improvement is noted, whichever

Page 73: Air Refueling Autopilot, (My First Book)

51

comes first. Backward selection, which is in contrast with forward selection, starts with a

large number of hidden units, and then decreases the number gradually. This process is

time-consuming, but it works well.

3.2.3 Back-Propagation Technique

Back-propagation is the most commonly used method for training multi-layer feed-forward

networks. It can be applied to any feed-forward network with differentiable activation

functions. This technique was popularized by Rumelhart, Hinton and Williams.

For most networks, the learning process is based on a suitable error function which is then

minimized with respect to the weights and bias. If a network has differential activation

functions, then the activations of the output units become differentiable functions of input

variables, the weights and bias. If we also define a differentiable error function of the

network outputs such as the sum-of-square error function, then the error function itself is a

differentiable function of the weights. Therefore, we can evaluate the derivative of the error

with respect to weights, and these derivatives can then be used to find the weights that

minimize the error function, by either using the popular gradient descent or other

optimization methods. The algorithm for evaluating the derivative of the error function is

known as back-propagation, because it propagates the errors backward through the

network.

3.3 Optimization Algorithms Applied to F16 nonlinear model

Though the gradient descent optimization method used in the standard back-propagation

learning algorithm is widely used and proven very successful in many applications such as

aircraft trimming process. The following algorithm flowchart was done using MATLAB

code to calculate the trimming values of the aircraft F-16 at 0.75 mach. Table 3.1 shows

the trimming values at different altitudes after using 101 random samples through the NN

algorithm.

Page 74: Air Refueling Autopilot, (My First Book)

52

The algorithm procedure in brief:

1- Initializing random number generator to produces bounded elevator angle and throttle

positions values required for neural network model.

2- Applying all these values directly to the F16 nonlinear model.

3- Computing the integral square error in the model simulation for both altitude and

mach number.

4- Checking the ISE (integral square error) for convergence therefore selecting the

suitable values of elevator angle and throttle position for trimming.

5- Collecting the previous selected values to apply to the neural network model in shape

of epochs.

6- Applying the back propagation algorithm for a feed forward neural network model

thus producing the trimming values for the required conditions.

7- Comparing the output index with the reference index for verification.

Page 75: Air Refueling Autopilot, (My First Book)

53

Random Number Initialization

Random No. Generator (mean-variance)

Nonlinear Aircraft model

ISE (Alt) ISE ( M)

ISE Converge

Yes No

Input Pool (M, H, ele, thr)

Simulation Results

Elevator Throttle

Trimmed Conditions

Modify

Repeat

200 counts

Multilayer Feed Forward NN (Inverse Model ) B/P Training Algorithm

Generating Trimming data for several operating conditions

Model Verification for evaluating NN fitness according to reference index

Not verified

Increasing NN training epochs

Optimized trimming data for steady level flight at operating conditions

M Alt

Page 76: Air Refueling Autopilot, (My First Book)

54

Table 3.1 Wing level trimmed values at Mach 0.75

3.4 Linearization Process

Often have a nonlinear set of dynamics given by:

),( uxfx �� (3.21)

Where x is once gain of the state vector, u is the vector of inputs, and ),( ��f is a nonlinear

vector function that describes the dynamics. Typically assume that the system is operating

about some nominal state solution )(0 tx (possibly requires a nominal input )(0 tu ).

- Then write the actual state as )(tx = )()(0 txtx � and the actual inputs as

)()()( 0 tututu ��

- The is included to denote the fact that we expect the variations about the nominal to be “small”

- Then develop the linearized equations by using Taylor series expansion of

),( ��f about )(0 tx and )(0 tu

- Recalling the vector equation ),(0 uxfx � , each equation of which ),(0 uxfx ii �

can be expanded as ),()( 000 uuxxfxxdt

diii ����

uu

fx

x

fuxf ii

i 00

00 ),(��

���

�"

(3.22)

Where ��

���

��

n

iii

x

f

x

f

x

f.......

1

And 0

� means that we should evaluate the function at the nominal values of 0x and 0u .

Page 77: Air Refueling Autopilot, (My First Book)

55

The meaning of “small” deviations now clear the variations in x and u must be small enough that we can ignore the higher order terms in the Tayolr expansion of ),( uxf . Since

),( 000

uxfdt

dxi

i � we thus have that

uu

fx

x

fx

dt

d iii

00

)(�

��

�" (2.23)

Combining for all n state equations, gives (note that we also set "#� ) that

u

u

f

u

f

u

f

x

x

f

x

f

x

f

xdt

d

nn

����������

����������

�$

$�

��

����������

����������

�$

$�

��

0

0

2

0

1

0

0

2

0

1

(2.24)

utBxtA )()( ��

Where

021

2

2

22

1

2

1

1

1

....

1)(

���������

���������

�$

$�

�$$$$

��

�$$$$

%

n

nnn

n

n

x

f

x

f

x

f

x

f

x

f

x

f

x

f

x

f

x

f

tA

And

021

2

2

2

1

2

1

2

1

1

1

....

)(

���������

���������

�$

$�

�$$$$

��

�$$$$

%

m

nnn

m

m

u

f

u

f

u

f

u

f

u

f

u

f

u

f

u

f

u

f

tB

Similarly, if the nonlinear measurement equation is ),( uxgy � , can show that, if

Page 78: Air Refueling Autopilot, (My First Book)

56

u

u

g

u

g

u

g

x

x

g

x

g

x

g

y

pp

����������

����������

�$

$�

��

����������

����������

�$

$�

��

0

0

2

0

1

0

0

2

0

1

(2.25)

utDxtC )()( ��

Typically think of these nominal conditions 0x and 0u as “set points” or “operating points”

for nonlinear system. The equations

utBxtAxdt

d )()( ��

utDxtCy )()( ��

Then give us a linearized model of the system dynamic behavior about these operating / set

points.

Note that if 0x and 0u then the partial fractions in the expressions of A-D are all constants

# LTI linearized model.

One particularly important set of operating points are the equilibrium points of the system.

Defined as the states & control input combinations for which

0),( 00 %�� uxfx (2.26)

Provides n algebraic equations to find the equilibrium points.

Usually in practice we drop the as they are rather than cumbersome, and (abusing

notation) we write the state equations as:

)()()()()( tutBtxtAtx ��� (2.27)

)()()()()( tutDtxtCty �� (2.28)

Which is of the same form as the previous linear models.

Consequently, by applying the previous procedure through MATLAB code at desired

operating (Trimmed) point results in F-16 State space matrices for both longitudinal and

lateral motions as shown in Appendix B.

Page 79: Air Refueling Autopilot, (My First Book)

57

Chapter (4)

Linear Quadratic Regulator (LQR)

4.1 Linear Quadratic Regulator with Output Feedback

In this section it will be shown how to use modern techniques to design stability

augmentation systems (SAS) and autopilots. This is accomplished by regulating certain

states of the aircraft to zero while obtaining desirable closed-loop response characteristics.

It involves the problem by placing the closed-loop poles at desirable locations.

Using classical control theory, it was forced to take a one-loop-at-a-time approach to

designing multivariable SAS and autopilots. In this section a performance criteria will be

selected to reflect the concern with closed- loop stability and good time responses and then

derive matrix equations that may be solved for all the control gains simultaneously. These

matrix equations are solved using digital computer programs. This approach thus closes all

the loops simultaneously and results in a simplified design strategy for MIMO systems or

SISO systems with multiple feedback loops.

Once the performance criterion has been selected, the control gains are explicitly computed

by matrix design equations, and closed-loop stability will generally be guaranteed. This

means that the engineering judgment in modern control enters in the selection of the

performance criterion. Different criteria will result in different closed-loop time responses

and robustness properties.

Assuming that the plant is given by linear time-invariant state-variable model it is possible

to describe the aircraft model as shown in the following equations.

Cxy

BuAxx

���

(4- 1, 2)

Page 80: Air Refueling Autopilot, (My First Book)

58

With nRtx �)( the state, mRtx �)( the control input, and pRty �)( the measured output.

The controls will be output feedbacks of the form

Kyu � , (4- 3)

Where K is an pm� matrix of constant feedback coefficients to be determined by the

design procedure. Since the regulator problem only involves stabilizing the aircraft and

inducing good closed-loop time responses, )(tu will be taken as a pure feedback with no

auxiliary input, as it will be shown in next section output feedback permits to design

aircraft controllers of any desired structure. This is the main advantage and the reason for

preferring it over full state feedback.

In the regulator problem, the main goal is obtaining good time responses as well as in the

stability of the closed-loop system. Therefore, the performance criterion will be selected in

the time domain as shown in next section.

4.1 Linear Quadratic Regulator Basis

4.2.1 Quadratic Performance Index

The objective of state regulation for the aircraft is to drive any initial condition error to

zero, thus guaranteeing stability. This maybe achieved by selecting the control input )(tu to

minimize a quadratic cost or performance index (PI) of the type

dtRuuQxxJ TT )(2

1

0

�� &�

(4- 4)

Where Q and R are symmetric positive semi-definite weighting matrices. Positive semi-

definiteness of a square matrix M (denoted )0'M is equivalent to all its eigen values

being nonnegative, and also to the requirement that the quadratic form MxxT be

nonnegative for all vectors x. Therefore, the definiteness assumptions on Q and R guarantee

that J is nonnegative and lead to a sensible minimization problem. This quadratic PI is a

Page 81: Air Refueling Autopilot, (My First Book)

59

vector version of the integral-squared PI of the sort used in classical control [D’Azzo and

Houpis, 1988].

To understand the motivation for the choice eqn. 4, consider the following. If the square-

root M of a positive semi definite matrix M is defined by

MMMT

� , (4- 5)

Then, it can be written as

dtuRxQJ )(2

1

0

22

&�

�� , (4- 6)

With w the Euclidean norm of a vector w (i.e., www T�2

). If we are able to select the

control input u(t) so that J takes on a minimum finite value, certainly the integrand must

become zero for large time. This means that both the linear combination )(txQ of the

states and the linear combination )(tuR of the controls must go to zero. In different

designs we may select Q and R for different performance requirements, corresponding to

specified functions of the state and input. In particular, if Q and R are chosen nonsingular,

the entire state vector )(tx and all the controls )(tu will go to zero with time if J has a finite

value.

Since a bounded value for J will guarantee that )(txQ and )(tuR go to zero with time,

this formulation for the PI is appropriate for the regulator problem, as any initial condition

errors will be driven to zero.

If the state vector )(tx consists of a capacitor voltages )(tv and inductor currents )(ti , then

2x will contain terms like )(2 tv and )(2 ti . Similarly, if velocity )(ts is a state component,

2x will contain terms like )(2 ts . Therefore, the minimization of the PI is a generalized

Page 82: Air Refueling Autopilot, (My First Book)

60

minimum energy problem. We are concerned with minimizing the energy in the states

without using too much control energy.

The relative magnitudes of Q and R may be selected to trade of requirements on the

smallness of the state against requirements on the smallness of the input. For instance, a

larger control weighting matrix R will make it necessary for )(tu to be smaller to ensure

that )(tuR is near zero. We say that a larger R penalizes the control more, so that they

will be smaller in norm relative to state vector. On the other hand, to make )(tx go to zero

more quickly with time we may select a larger Q .

As a final remark on the PI, we shall see that the position of the closed loop poles depend

on the choices for the weighting matrices Q and R . That is,Q and R may be chosen to

yield good time responses in the closed loop system.

Let us now derive matrix design equations that maybe used to solve for the control gain K

that minimizes the PI.

4.2.2 Solution of the LQR problem

The LQR problem with output feedback is the following. Given the linear system equations

eqn. 1,2, find the feedback coefficient matrix K in the control input eqn. 3 that minimizes

the value of the quadratic PI eqn. 4.

By substituting eqn. 3 intro eqn. 1 the closed loop system equations are found to be:

xAxBKCAx c� �� )( (4-7)

The PI may be expressed in terms of K as

&�

��0

)(2

1xdtRKCKCQxJ TTT (4- 8)

The design problem is now to select the gain K so that J is minimized. This dynamical

optimization problem may be converted into an equivalent static one that is easier to solve

Page 83: Air Refueling Autopilot, (My First Book)

61

as follows. Suppose that we can find a constant, symmetric, positive semi-definite matrix

P so that

xRKCKCQxPxxdt

d TTTT )()( � � (4- 9)

Then J may be written as

)()(2

1)0()0(

2

1lim tPxtxPxxJ T

t

T

�#

� (4- 10)

Assuming that the closed loop system is asymptotically stable so that )(tx vanishes with

time, this becomes

)0()0(2

1PxxJ T� (4- 11)

If P satisfies eqn. 9, we may use eqn. 7 to see that

�� ���� PxxPxxPxxdt

dxRKCKCQx TTTTTT )()( (4- 12)

xPAPAx C

T

c

T )( ��

Since this must hold for all initial conditions, and hence for all state trajectories )(tx , we

may write

0����% QRKCKCPAPAg TT

c

T

c (4- 13)

If K and Q are given and P is to be solved for, this is called a Lyapunov equation.

In summery for any fixed feedback matrix K if there exists a constant symmetric, positive

semi-definite matrix P that satisfies eqn. 13, and if the closed loop system is stable, the cost

J is given in terms if P by eqn. 11. This is an important result in that the nn� auxiliary

matrix P is independent of the state. Given a feedback matrix K , P may be computed from

the Lyapunov equation eqn. 13. Then only the initial condition )0(x is required to compute

the closed loop cost under the influence of the feedback control Kyu � .

Page 84: Air Refueling Autopilot, (My First Book)

62

It is now necessary to use this result to compute the gain K that minimizes the PI. By using

the trace identity

)()( BAtrABtr � (4- 14)

For any compatibly dimensioned matrices A and B (with the trace of a matrix the sum of its

diagonal elements), we may write eqn. 11 as

)(2

1PXtrJ � (4- 15)

Where the nn� symmetric matrix X is defined by

)0()0( TxxX % (4-16)

It is now clear that the problem of selecting K to minimize eqn. 8 subject to the dynamical

constraint eqn. 7 on the states is equivalent to the algebraic problem of selecting K to

minimize eqn. 15 subject to the constraint eqn. 13 on the auxiliary matrix P .

To solve this modified problem, we use the Lagrange multiplier approach [Lewis. 1986] to

modify the problem yet again. Thus adjoin the constraint to the PI by defining the

Hamiltonian

)()( gStrPXtr ��� (4-17)

With S a symmetric nn� matrix of Lagrange multipliers which still needs to be

determined. Then our constraint optimization problem is equivalent to the simpler problem

of minimizing eqn. 17 without constraints. To accomplish this we need only set the partial

derivatives of � with respect to all the independent variables P , S and K equal to zero.

Using the facts that for any compatibly dimensioned matrices A, B and C and any scalar y,

TT CAB

ABCtr�

�� )(

(4-18)

Page 85: Air Refueling Autopilot, (My First Book)

63

And

T

T B

y

B

y��

���

���

���

(4-19)

The necessary conditions for the solution of the LQR problem with output feedback are

given by:

QRKCKCPAPAgS

TT

c

T

c �������

��

0 (4-20)

XSASAP

T

cc �����

��

0 (4-21)

TTT PSCBRKCSCK

���

��

2

10 (4-22)

The first two of these are Lyapunov equations and the third equation for the gain K . If R is

positive definite (i.e., all eigenvalues greater than zero, which implies nonsingularity;

denoted R>0) and TCSC is nonsingular, then eqn. 22 may be solved for K to obtain

11 )( � TTT CSCPSCBRK (4-23)

To obtain the output feedback gain K minimizing the PI eqn. 4, we need to solve the three

coupled equations eqn. 20, 21, 23. This situation is quite strange, for to find K we must

determine along the way the values of two auxiliary and apparently unnecessary

nn� matrices, P and S . These auxiliary quantities may, however, not be as unnecessary as

it appears, for note that the optimal cost may be determined directly from P and the initial

state by using eqn. 11.

Page 86: Air Refueling Autopilot, (My First Book)

64

4.2.3 The initial condition problem

Unfortunately, the dependence of X in eqn. 16 on the initial state )0(x is undesirable, since

it makes the optimal gain dependent on the initial state through eqn. 21. in many

applications )0(x may not be known. This dependence is typical of output feedback design.

Meanwhile, it is usual [Levine and Athans, 1970] to sidestep this problem by minimizing

not the PI but its expected value, that is, )(JE . Then eqn. 11 and 16 are replaced by

),(2

1))0()0((

2

1)( PXtrPxxEJE T �� (4-24)

Where the symmetric nn� matrix

))0()0(( TxxEX % (4-25)

is the initial autocorrelation of the state. It is usual to assume that nothing is known of

)0(x except that it is uniformly distributed on the surface described by X . That is, we

assume that the actual initial state is unknown, but that it is nonzero with a certain expected

Euclidean norm. For instance, if the initial are assumed to be uniformly distributed on the

unit sphere, then IX � , the identity. This is a sensible assumption for the regulator

problem, where we are trying to drive arbitrary nonzero initial states to zero. The design

equations for the LQR with output feedback are collected in Table 4.1 for convenient

reference. We shall now discuss their solution for K .

Table 4.1 LQR with output feedback

System Model

Cxy

BuAxx

���

Page 87: Air Refueling Autopilot, (My First Book)

65

Control

Kyu �

Performance Index

dtRuuQxxJ TT )(2

1

0

�� &�

With 0'Q , 0'R

Optimal gain design equations

QRKCKCPAPA TT

c

T

c ����0 (4-26)

XSASA T

cc ���0 (4-27)

11 )( � TTT CSCPSCBRK (4-29)

Where

BKCAAc � , ))0()0(( TxxEX �

Optimal cost

)(2

1PXtrJ �

Determining the optimal feedback gain

The impotence of this modern LQ approach to controls design is that the matrix equations

in Table 1 are used to solve for all the pm� elements of K at once. This corresponds to

closing all the feedback loops simultaneously. Moreover, as long as certain reasonable

conditions on the plant and PI weighting matrices hold, the closed loop is generally

guaranteed to be stable. In view of the trial and error successive loop closure approach used

in stabilizing multivariable systems using classical approaches, this is quite important. The

Page 88: Air Refueling Autopilot, (My First Book)

66

equations for P , S and K are coupled nonlinear matrix equations in three unknowns. It is

important to discuss some aspects of their solution for the optimal feedback gain matrix K .

Conditions for convergence of the LQ solution algorithm

1. There exists a gain K such that cA is stable. If this is true, we call the system

output stabilizable.

2. The output matrix C has full row rank p .

3. Control weighing matrix R is positive definite matrix. This means that all the

control inputs should be weighted in the PI.

4. Q is positive semi definite and ),( AQ is detectable. That is, the observability

matrix polynomial

��

���

%

Q

AsIsO )( (4-30)

Has full rank n for all values of the complex variable s not contained in the left half plane.

If these conditions hold, the algorithm finds an output-feedback gain that stabilizes the

plant and minimizes the PI. The delectability condition means that any unstable system

modes must be observable in the PI. Then if the PI is bounded, which it is if the

optimization algorithm is successful, signals associated with the unstable modes must go to

zero as t becomes large; that is, they are stabilized in the closed-loop system.

Initial stabilizing gain since all three algorithms for solving the matrix equations in

Table 4.2 for K are iterative in nature, a basic issue for all of them is the selection of an

initial stabilizing output-feedback gain K0, that is to start the algorithms, it is necessary to

provide a K0 such that (A-B K0C) is stable.

Page 89: Air Refueling Autopilot, (My First Book)

67

Table 4.2 Optimal output feedback solution algorithm (LQR)

1. Initialize:

Set k=0

Determine a gain K0 so that A-B K0C is asymptotically stable

2. kth iteration:

Set CBkAAk 0 �

Solve for kP and kS in

QCRKKCAPPA k

T

k

T

kkk

T

k ����0

XASSA T

kkkk ���0

Set )(2

1XPtrJ kk �

Evaluate the gain update direction

k

TTT kCSCPSCBRK �� 11 )(

Update the gain by

kkk kk ���� �1

Where � is chosen so that

CBkAA kk 1� � is asymptotically stable

kkk JXPtrJ �� �� )(2

111

If 1�kJ and kJ are close enough to each other, go to step 3, otherwise set 1�� kk and

go to step 2.

3. Terminate:

Set 1,1 �� �� kk JJkk

Stop

Page 90: Air Refueling Autopilot, (My First Book)

68

Iterative design: Software that solves for the optimal output-feedback gain K is

described in appendix A. Given good software, design using LQ approach is

straightforward. A design procedure would involve selecting the design parameters Q and

R, determining the optimal gain K, and simulating the closed loop response and frequency-

domain characteristics. If the results are not suitable, different matrices Q and R are chosen

and the design is repeated. The designed software makes a design iteration take only few

minutes. This approach introduces the notion of tuning the design parameters Q and R for

good performance.

Selection of the PI weighting matrices

Once the PI weighting matrices Q and R have been selected, the determination of the

optimal feedback gain K is a formal procedure relying on the solution of the nonlinear

coupled matrix equations. Therefore, the engineering judgment in the modern LQ design

appears in the selection of Q and R. there are some guidelines for this which we shall now

discuss.

Observability in the choice of Q

For stabilizing solutions to the output-feedback problem, it is necessary for ),( AQ to be

detectable. The detestability condition basically means that Q should be chosen so that all

unstable states are weighted in the PI. Then, if J is bounded so that )(txQ vanishes for

large t, the open-loop unstable states will be forced to zero through the action of the control.

This means exactly that the unstable poles must have been stabilized by the feedback

control gain.

A stronger condition than detectability is observability, which amounts to the full rank of

O(s) for all values of s. observability is easier to check than detectability since it is

equivalent to the full rank n of the observability matrix :

Page 91: Air Refueling Autopilot, (My First Book)

69

�����

�����

1

.nAQ

AQ

Q

(4-31)

Which is a constant matrix and so easier to deal with than O(s). in fact, O has full rank n if

and only if the observability gramian OOT is nonsingular. Since the gramian is an

nn� matrix, its determinant is easily examined using available software (singular value

decomposition /condition number ). The observability of ),( AQ means basically that all

states are weighted in the PI.

From a numerical point of view, if ),( AQ is observable, a positive definite solution P to

equation 26 results; otherwise, P may be singular. Since P helps determine K through

equation 28, it is found that if P is singular, it may result in some zero-gain elements in K.

that is, if ),( AQ is not observable, the LQ algorithm can refuse to close some feedback

loops.

This observability condition amounts to a restriction on the selection of Q, and is a

drawback of modern control.

The structure of Q

The choice of Q can be confronted more easily by considering the performance objectives

of the LQR. Suppose that a performance output

Hxz � (4-32)

Is required to be small in the closed-loop system. For instance, in F-16 aircraft lateral

regulator it is desired for the sideslip angle, yaw rate roll angle, and roll rate to be small.

See output responses Fig. 4.1. Therefore, we might select � �Tprz ��� . Once

)(tz has been chosen, the performance output matrix H may be formally written down. The

signal )(tz may be made small by LQR design by selecting the PI

Page 92: Air Refueling Autopilot, (My First Book)

70

&�

��0

)(2

1dtRuuzzJ TT (4-33)

Which amounts to using the PI in Table 1 with HHQ T� , so that Q may be computed

from H. that is, by weighting performance outputs in the PI, Q is directly given.

4.2.4 Maximum desired values of z(t) and u(t)

A convenient guideline for selecting Q and R is given in [Bryson and Ho, 1975]. Suppose

that the performance output in equation 32 has been defined so that H is given. Consider

the PI

&�

��0

~

)(2

1dtRuuzQzJ TT (4-34)

Then, in Table 4.1 we have HQHQ T~

� . To select ~

Q and R , one must proceed as

follows, using the maximum allowable deviations in )(tz and )(tu . Define maximum

allowable deviation in component )(tzi of )(tz as iMz and the maximum allowable

deviation in component )(tui of the control input )(tu as iMu . Then ~

Q and R may be

selected as ~

Q =diag{qi}, R =diag{ri}, with

2

1

iM

iz

q � , 2

1

iM

ir

r � (4- 35)

The rationale for this choice is easy to understand. For instance, as the allowed limits iMz

on )(tzi decrease, the weighting in PI placed on )(tzi increase, which requires smaller

excursions in )(tzi in the closed-loop system.

In our approach we shall select the design parameters Q and R in the table and then use the

design equations there to close all the feedback loops simultaneously by computing. The

Page 93: Air Refueling Autopilot, (My First Book)

71

objective is to design a closed-loop controller to provide for the function of SAS as well as

the closure of the roll-attitude loop. This objective involves the design of two feedback

channels with multiple loops, but it is straightforward to deal with using modern control

techniques. The simplicity of MIMO design using LQR will be evident.

We used the F-16 linearized lateral dynamics at the nominal flight condition ( 502�TV ft/s,

300 psf dynamic pressure, CG at 0.35 c ) retaining the lateral states sideslip � , bank angle

� , roll rate p , and yaw rate r ,. Additional states a and r are introduced by the aileron

and rudder actuators.

aa us 2.20

2.20

�� , rr u

s 2.20

2.20

�� (4- 36)

A washout filter

rs

srw

1�� (4-37)

is used, with r the yaw rate and wr the wash-out yaw rate. The washout filter state is

denoted wx . Thus the entire state vector is:

� �Twra xrpx ��� (4-38)

The full-state-variable model of the aircraft plus actuators, washout filter, and control dynamics is of the form

BuAxx ��� (4-39)

Page 94: Air Refueling Autopilot, (My First Book)

72

���������

���������

102958.570000

02.2000000

002.200000

0

0

0

0

ra

ra

ra

ra

rrrrrprr

ppprpppp

rp

rp

BBAAAA

BBAAAA

BBAAAA

BBAAAA

A ��

��

��������

��������

���������

���������

00

2.200

02.20

00

00

00

00

B, �

���

��

r

a

u

uu ,

����

����

��p

r

y

w

thus Cxy � where

����

����

000002958.570

0000002958.57

00002958.5700

1002958.57000

C

For the computation of the feedback gain K, it is necessary to select PI weighting matrices

Q and R in Table 4.1. Then the code described in appendix A is used to compute the

optimal gain K. Our philosophy for selecting Q and R as follows.

Page 95: Air Refueling Autopilot, (My First Book)

73

First, let us discuss the choice of Q. It is desired to obtain good stability of the dutch roll

mode, so that 2� and 2r should be weighted in the PI by factors of drq . To obtain

stability of the roll mode, which in closed-loop will consist primarily of p and � , we may

weight 2p and 2� in the PI by factors of rq . We don’t care about a and

r , so it is not

necessary to weight them in the PI; the control weighting matrix R will prevent

unreasonably large control inputs. Thus so far we have

}0,0,0,,,,{ drrrdr qqqqdiagQ � (4-40)

We don’t care directly about wx ; however, it is necessary to weight it in the PI. This is

because omitting it would cause problems with observability condition. A square root of Q

in 40 is

]0,0,0,,,,[ drrrdr qqqqQ � (4-41)

Consequently, the observability matrix in equation 31 has a right-hand column of zero;

hence the system is unobservable. This may be noted in simpler fashion by examining the

A matrix , where the seventh state wx is seen to have no influence on the states that are

weighted in equation 40. to correct this potential problem, we choose

}1,0,0,,,,{ drrrdr qqqqdiagQ � (4-42)

As far as the R matrix goes, it is generally satisfactory to select it as

IR �� (4-43)

With I the identity matrix and � a scalar design parameter.

Page 96: Air Refueling Autopilot, (My First Book)

74

After few trials, we obtained a good result using 1.0�� , drq =50, 100�rq for this

selection the optimal feedback gain was

��

���

26.044.021.019.1

35.011.044.056.0K (4-44)

The resulting closed loop poles were as

83.013.3 j( - Dutch roll mode ),( �r

11.082.0 j( Roll mode ),( �p

18.1747.11 j(

-15.02

To verify the design a simulation was performed. The initial state was selected

as � �Tx 0000001)0( � ; that is, we choose 1)0( �� . The following figures show

the output performance of the states

Page 97: Air Refueling Autopilot, (My First Book)

75

Fig. 4.1 Lateral output performance when 1)0( ��

To verify the design a simulation was performed. The initial state was selected as

� �Tx 0000010)0( � ; that is, we choose 1)0( �� . The following figures show

the output performance of the output states

Fig. 4.2 Lateral output performance when 1)0( ��

Page 98: Air Refueling Autopilot, (My First Book)

76

Effect of PI weighting parameters � = .1, .2, .4 respectively

Fig. 4.3 Effect of PI weighting parameters � = .1, .2, .4 respectively

4.3 Tracking a command

In an aircraft control we are often interested not in regulating the state near zero, which

discussed in the preceding section, but in the following a nonzero reference command

signal. In this part we are interested in designing a control system for optimal step-response

shaping. This reference-input tracking or servo design problem is important in the design of

command augmentation systems (CAS), where the reference command may be, for

instance, desired pitch rate or normal acceleration. It should be mentioned that the optimal

linear quadratic (LQ) tracker of modern control is not a causal system [Lewis, 1986]. It

depends on solving an “adjoint” system of differential equations backward in time, and so

is impossible to implement. A suboptimal “steady-state” tracker using full state-variable

feedback is available, but it offers no convenient structure for the control system in terms of

desired dynamics such as PI control, washout filters, and so on. Thus there have been

problems with using it in aircraft control. Modified versions of LQ tracker have been

presented in [Davison and Ferguson, 1981] and [Gangsaas et al., 1986]. There, controllers

Page 99: Air Refueling Autopilot, (My First Book)

77

of desired structure can be designed since the approaches are output-feedback based. The

optimal gains are determined numerically to minimize a PI with, possibly, some

constraints. It is possible to design a tracker by the first designing a regulator using, for

instance Table 4.1. Then some feedforward terms are added to guarantee perfect tracking

[Kwakernaak and Sivan, 1972]. The problem with this technique is that the resulting

tracker has no convenient structure and often requires derivatives of the reference command

input. Moreover, servosystems designed using this approach depends on knowing the dc

gain exactly. If the dc gain is not known exactly, the performance deteriorates.

Here we discuss an approach to the design of tracking control systems which is more useful

in aircraft control applications [Stevens et al., 1991]. This approach will allow us to design

a servo control system that has any structure desired. This approach will include a unitary –

gain outer loop that feeds the performance output back and subtracts it from the reference

command, thus defining a tracking error ) *te which should be kept small see Fig. 4.4.

Fig. 4.4 plant with compensator of desired structure

Page 100: Air Refueling Autopilot, (My First Book)

78

It can also include compensator dynamics such as a washout filter and an integral

controller. The control gains are chosen to minimize a quadratic performance index (PI).

We are able to give explicit design equations for the control gains see Table 4.3, solved

using the software described in appendix A.

A problem with the tracker developed in this section is the need to select the design

parameters Q and R in the PI in Table 4.3. There are some intuitive techniques available

for choosing these parameters, however, in the preceding section we shall show how

modified PIs may be used to make the selection of Q and R almost transparent, yielding

tracker design techniques that are very convenient for use in aircraft control systems design.

We shall show, in fact, that the key to achieving required performance using modern design

strategies is in selecting an appropriate PI.

4.3.1 Tracker with desired structure

In aircraft controls design there is a wealth of experience and knowledge that dictates in

many situations what sort of compensator dynamics yield good performance from the point

of view of both the controls engineer and the pilot. For instance, a washout circuit maybe

required, or it may be necessary to augment some feedforward channels with integrators to

obtain a steady state error of exactly zero.

The control system structures used in classical aircraft design also give good robustness

properties. That is, they perform well even if there are disturbances or uncertainties in the

system. Thus the multivariable approach developed here usually affords this robustness.

Our approach to tracker design allows controller dynamics of any desired structure and then

determines the control gains that minimize a quadratic PI over that structure. Before

discussing the tracker design, we shall derive the compensator state equations first as

follows.

Consider the situation in Fig. 4.4 where the plant is described by.

Cxy

BuAxx

���

(4-45)

Page 101: Air Refueling Autopilot, (My First Book)

79

With state )(tx , control input )(tu , and )(ty the measured output available for feedback

purposes. In addition,

Hxz � (4-46)

Is a performance output, which must track the given reference input )(tr . The performance

output )(tz is not generally equal to )(ty .

It is important to realize that for perfect tracking it is necessary to have as many control

inputs in vector )(tu as there are command signals to track in )(tr .

The dynamic compensator has the form

GeFww ��� (4-47)

JeDwv �� (4-48)

With state )(tw , output )(tv , and input equal to the tracking error

)()()( tztrte � (4-49)

F, G, D, and J are known matrices chosen to include the desired structure in the

compensator. The allowed form for the plant control input is

LvKyu � (4-50)

Where the constant gain matrices K and L are to be chosen in the controls design step to

result in satisfactory tracking of )(tr . This formulation allows for both feedback and

feedforward compensator dynamics.

These dynamics maybe written in augmented form as

rG

uB

w

x

FGH

A

w

x

dt

d��

���

���

���

���

���

���

���

���

���

� 0

0

0 (4-51)

rJw

x

DJH

C

v

y��

���

���

���

���

���

���

���

� 00 (4-52)

Page 102: Air Refueling Autopilot, (My First Book)

80

� � ��

���

��

w

xHz 0 (4-53)

� � ��

���

� �

v

yLKu (4-54)

Note that in terms of the augmented plant/ compensator state description, the admissible

controls are represented as a constant output feedback [K L]. in the augmented description,

all matrices are known except the gains K and L, which need to be selected to yield

acceptable closed-loop performance.

4.3.2 LQ Formulation of the Tracker Problem

By redefining the state, the output, and the matrix variables to streamline the notation, we

see that the augmented equations as follows contain the dynamics of both the aircraft and

the compensator.

GrBuAxx ���� (4-55)

FrCxy �� (4-56)

Hxz � (4-57)

In this description, let us take the state nRtx �)( , control input mRtu �)( , reference input

qRtr �)( ,

Performance output qRtz �)( , and measured output pRty �)( . The admissible controls are

then proportional output feedbacks of the form

KFrKCxKyu � � (4-58)

With constant gain K to be determined. This situation corresponds to the block diagram in

Fig. 4.5.

Page 103: Air Refueling Autopilot, (My First Book)

81

Fig. 4.5 Plant/ feedback structure

Since K is an pm� matrix, we intend to close all the feedback loops simultaneously by

computing K.

Using these equations the closed-loop system is found to be

rBKFGxBKCAx )()( � �� (4-59)

rBxAx cc �%� (4-60)

Our formulation differs sharply from the traditional formulations of the optimal tracker

problem. Note that the previous equations include both feedback and feedforward terms, so

that both the closed-loop poles and compensator zeros maybe affected by varying the gain

K. thus we should expect better success in shaping the step response than by placing only

the poles.

Let us now formulate an optimal control problem for selecting the control gain K to

guarantee tracking of )(tr . Then we shall derive the design equations in Table 4.3, which

are used to determine the optimal K. these equations are solved using a code in appendix A.

4.3.3 The Deviation System

Page 104: Air Refueling Autopilot, (My First Book)

82

Denote steady-state values by overbars and deviations from the steady-state values by

tildes. Then the state, output, and control deviations are given by

xtxtx � )()(~

(4-61)

(4-62)

xHztztz ~)()(~ � �

(4-63)

)(~)()()(~00 txKCKFrxKCKFrKCxututu � � � (4-64)

Or

yKu ~~ � (4-65)

The tracking error )()()( tztrte � is given by

etete � )()(~ (4-66)

With the error deviation given by

xHxHrHxretete ~)()()()(~00 � � � (4-67)

Or

ze ~~ �

Since in any acceptable design the closed-loop plant will be asymptotically stable, cA is

nonsingular. According to equation 60, at steady state

00 rBxA cc �� (4-68)

So that the steady-state state response is

01 rBAx cc

� (4-69)

And the steady the steady-state error is

01

0 )( rBHAIxHre cc

�� � (4-70)

To understand this expression, note that the closed-loop transfer function from 0r to z is

The steady-state behavior may be investigated by considering the dc value of )(sH (i.e.,

s=0); this is just cc BHA 1 , the term appearing in equation 70.

xCytyty ~)()(~ � �

Page 105: Air Refueling Autopilot, (My First Book)

83

Using above equations the closed loop dynamics of the state deviation are seen to be

xAx c~~ �� (4-71)

xCy ~~ � (4-72)

exHz ~~~ �� (4-73)

And the control input to the deviation system equation 71 is now equation 65. Thus the

step-response shaping problem has been converted to a regulator problem for the deviation

system.

uBxAx ~~~ ��� (4-74)

4.3.4 Performance Index for LQ Tracker

To make the tracking error )(te small, we propose to attack two equivalent problems: the

problem of regulating the error deviation )(~)(~ tzte � to zero, and the problem of making

small steady-state error e .

To make small both the error deviation and the steady-state error, we propose selecting K to

minimize the performance index (PI)

&�

���0 2

1)~~~~(

2

1eVedtuRueeJ TTT

(4-75)

With R>0, V>0, design parameters.

We can generally select rIR � and vIV � , with r and v scalars. This simplifies the design

since now only a few parameters must be tuned during the interactive design process.

According equation 67, xHHxee TTT ~~~~ � according to Table 4.1, therefore, it follows that

the matrix Q there is equal to HH T , where H is known. That is weighting the error

deviation in the PI has already shown us how to select the design parameter Q.

Page 106: Air Refueling Autopilot, (My First Book)

84

4.3.5 Solution of the LQ Tracker Problem

It is now necessary to solve for optimal feedback gain K that minimizes the PI. The design

equations needed are now derived. They appear in Table 4.3.

By using equation 71 and the same procedure used in previous section in designing LQR.

The optimal cost is found to satisfy

eVexPxJ T

2

1)0(~)0(~

2

1�� (4-76)

With P > 0 the solution to

RKCKCQPAPAg TT

c

T

c ���%�0 (4-77)

With HHQ T� and e given by equation 70

In our discussion of the linear quadratic regulator we assumed that the initial conditions

were uniformly distributed on a surface with known characteristics. While this is

satisfactory for the regulator problem, it is an unsatisfactory assumption for the tracker

problem. In the latter situation the system the system starts at rest and must achieve a given

final state that is dependent on the reference input. To find the correct value of )0(~x , we

note that since the plant starts at rest [i.e., 0)0( �x ], according to equation 61

xx �)0(~ , (4-78)

So that the optimal cost becomes

eVePXtreVexPxJ TTT

2

1)(

2

1

2

1

2

1���� (4-79)

With P given by equation 77, e given by equation 70, and

T

c

T

c

T

cc

T ABrrBAxxX �� 001 (4-80)

Page 107: Air Refueling Autopilot, (My First Book)

85

With T

c

T

c AA )( 1 � .

The optimal solution to the unit-step tracking problem with initially at rest, maybe may

now be determined by minimizing J over the gains K, subject to constraint according to

equation 77, equation 70 and equation 80. This algebraic optimization problem can be

solved by the code presented in appendix A.

4.3.6 Design Equations for Gradient-Based Solution

As an alternative solution procedure, one may use gradient-based techniques which is

faster than non-gradient-based approaches.

To find the gradient of the PI with respect to the gains, define the Hamiltonian

eVegStrPXtr T

2

1)()( ���� (4-81)

With S a lagrange multiplier. Now, using the basic matrix calculus identities,

111

��

���

Yx

YY

x

Y(4-82)

x

VUV

x

U

x

UV

��

���

���

(4-83)

��

���

��

��

���

x

z

z

ytr

x

y T

. (4-84)

To find K by a gradient minimization algorithm, it is necessary to provide the algorithm

with values of J and K

J�

� for a given K. the value of J is given by the expression in Table

4.3 for the optimal cost. To find K

J�

� given K, solve the following algorithm.

Table 4.3 LQ Tracker with Output Feedback

System Model

Page 108: Air Refueling Autopilot, (My First Book)

86

Hxz

FrCxy

GrBuAxx

��

����

Control

Kyu �

Performance index

eVedtuRuxQxJ TTT

2

1)~~~~(

2

1

0

��� &�

, with HHQ T�

Optimal Output Feedback Gain

TTT

c

TTTT

c

TTTT

T

cc

TT

c

T

c

yVrHAByxVHHPABPSCBRKCSCK

XSASAP

RKCKCQPAPAS

0)(2

10

0

0

�� ���

�����

������

With r a unit step of magnitude 0r and

01 rBAx cc

0FrxCy ��

T

c

T

c

T

cc

T ABrrBAxxX �� 001

vIVrIR �� ,

Where

BKFGB

BKCAA

c

c

� ,

Optimal cost

eVePXtrJ2

1)(

2

1��

Fig. 4.6 shows the block diagram representation for the normal acceleration controller. Fig.

4.7 shows the step response of the normal acceleration. In the same manner pitch rate

controller can be represented in Fig. 4.8 with pitch rate performance as in Fig. 4.9,

appendix B2.

Page 109: Air Refueling Autopilot, (My First Book)

87

Fig. 4.6 Normal acceleration controller

Fig. 4.7 Normal acceleration step response for different PI (3.2 green), (8.36 blue)

� �TFepitch qx +��� , � �TFpitch qy +��

GrBuAxx ����

FrCxy ��

HxZ �

Kyu �

Page 110: Air Refueling Autopilot, (My First Book)

88

������

������

0002958.570

010000.10

002.2000

00~~~

00~~~

eqqqq

eq

BAA

BAA

A�

����

,

������

������

0

0

2.20

0

0

B ,

������

������

1

0

0

0

0

G ,

���

���

��

0

0

0

F

���

���

��

10000

0002958.570

02958.57000

C , � �0002958.570�H , � �yKKKKyu lq� � �

Fig. 4.8 Pitch rate controller

Fig. 4.9 Pitch-rate step response using regular LQ tracker for different PI (4.2 blue),

(3.98 green)

Page 111: Air Refueling Autopilot, (My First Book)

89

� �Twralateral xrpx +,�� , � �Trlateral epey ,+�

GrBuAxx ����

FrCxy ��

HxZ �

Kyu �

�����������

�����������

00000010

01002958.57000

002.2000000

0002.200000

00~~~~~~

00~~~~~~

00~~~~~~

00~~~~~~

rrarrrprrr

rpaprppppp

rarp

rarp

BBAAAA

BBAAAA

BBAAAA

BBAAAA

A ��

��

��������

��������

,

�����������

�����������

00

00

2.200

02.20

00

00

00

00

B

,

�����������

�����������

01

00

00

00

00

00

00

00

G

Hxxr

zw

���

���

���

���

��

01002958.57000

00000010�

c

rFrCx

e

p

ey ��

�����

�����

��

����

����

00000010

00000100

00002958.57000

10000000

C

����

����

01

00

10

00

F

The control input � �Tra uuu � may be expressed as Kyu �

Constrained Feedback Gain Matrix

Page 112: Air Refueling Autopilot, (My First Book)

90

In order to get certain elements ijk of K very small or equal to zero, gain-element

weight ijg is chosen large to make the ijk of the feedback matrix K very small or

equal to zero as shown in equation 85.

����i j

ijijkgPXtrJ 2)(2

1(4-85)

with ��

���

��

000

0

2

431

k

kkkK

Fig. 4.10 shows Lateral-Directional controller implying two inputs, Figure 11 shows output

performance according to bank step input.

Fig. 4.10 Lateral –Directional controller

Page 113: Air Refueling Autopilot, (My First Book)

91

Fig. 4.11 Closed loop response to command of 1��r , 0�rr . Bank angle � (rad), and

washout yaw rate (rad/sec)

Page 114: Air Refueling Autopilot, (My First Book)

92

Chapter (5)

Intelligent Learning of Fuzzy Logic Controller Via

Genetic Algorithm

5.1 Introduction

The term fuzzy logic has been used in two different senses. It is thus important to

clarify the distinctions between these two different usages of the term. In a narrow sense,

fuzzy logic refers to a logical system that generalizes classical two-valued logic for

reasoning under uncertainty. In a broad sense, fuzzy logic refers to all of the theories and

technologies that employ fuzzy sets, which are classes with unsharp boundaries.

For instance, the concept of “warm room temperature” may be expressed as an interval

(e.g., [70 C78 C] in classical set theory. However, the concept does not have a well-

defined natural boundary. A representation of the concept closer to human interpretation is

to allow a gradual transition from “not warm” to “warm”. In order to achieve this, the

notion of membership in a set needs to become a matter of degree. This is the essence of

fuzzy sets.

The power of the fuzzy logic appears when there is a need to control a nonlinear model,

also the fuzzy logic enables control engineers to easily implement control strategies used by

human operators.

In this work a real application of missile guidance used a fuzzy logic controller to deal

with the nonlinearity in the system and any other uncertainty such as cross coupling effect

between lateral and longitudinal motions and the gust effect.

5.2 Applying Fuzzy Inference System for Control

The fuzzy inference technique can be very useful in control engineering. A standard

control system would utilize a numerical input and produce numerical output and so should

Page 115: Air Refueling Autopilot, (My First Book)

93

a fuzzy controller. The knowledge base contains the set of inference rules chosen to achieve

the control objectives and the parameters of the fuzzy systems used to define the data

manipulation in the fuzzification, inference engine, and defuzzification processes as shown

in Fig. 5.1. The input to the fuzzification process is the measured or estimated variable that

appears in the antecedent part of the if_then rule. This input variable has associated

linguistic values to describe it. Each linguistic value is defined by a membership function,

parameterized by data from the knowledge base .In the inference engine the decision –

making logic is conducted, inferring control laws from the input variables through fuzzy

implication. The final step is the defuzzification process where a crisp control command is

determined based on the inferred fuzzy control law [18, 19].

Fig. 5.1 The structure of a Fuzzy Logic Control System

5.2.1 Designing membership functions (Fuzzification process)

Designing membership functions for a fuzzy set is a very important step in the

fuzzification process. Type number of membership function is affected by many factors

such as the type of the dynamic model, the nonlinearity of the model and the degree of the

affecting disturbance (uncertainty of the system). A membership function can be designed

in three ways:

(a) Interview those who are familiar with the underlying concept and later adjust it

based on a tuning strategy.

(b) Construct it automatically from data.

(c) Learn it based on feedback from the system performance.

Page 116: Air Refueling Autopilot, (My First Book)

94

The first approach was the main approach used by fuzzy logic researchers until 1980. Due

to lack of systematic tuning strategies in those days, most fuzzy systems were tuned

through a trial and error process. Fig. 5.2 shows one of the simplest type of membership

functions which is a triangular type membership function. There are many other types such

as Guassian and trapezoid.

Fig. 5.2 Triangular membership function

In this work the triangular membership function was chosen for all the used fuzzy sets

(error, change in error, control signal). Fig. 5.3, 5.4 and 5.5 show the membership

functions for the error signal, the change in error signal, and the control signal respectively.

Fig. 5.3 Membership function for error input (e)

Page 117: Air Refueling Autopilot, (My First Book)

95

Fig. 5.4 Membership function for error rate input (ce)

Fig. 5.5 Membership function for control signal output (u)

5.2.2 Rule Derivation

The knowledge of the relationship between inputs and outputs of fuzzy controllers are

expressed as a collection of if-then rules to form what so called the rule-base of the fuzzy

controller. Four methods, possibly used in combination, are mainly used to generate the

rule-base of a fuzzy controller.

1-Expert experience and control engineering judgment [19, 20, 21].

In this approach the knowledge and experience of the designer are used to manually

construct the rule-base of the controller according to observation of the system.

2-Observation of an operator’s control action [22, 23, 24].

Page 118: Air Refueling Autopilot, (My First Book)

96

Many practical control tasks are difficult to describe by an explicit mathematical model.

However, they are successfully performed by skilled human operators. The input/output

data can be used to construct fuzzy control rules to mimic the behavior off human operator.

3-Fuzzy model of the plant [25, 26].

A fuzzy model of the plant can be thought of as a linguistic description of the dynamic

characteristics of plant using fuzzy logic and inference. A set of subsequent fuzzy control

rules can be designed based on the fuzzy model of the plant to be controlled.

4-Learning approaches [27, 28].

Motivated by the need of a systematic method to generate and modify fuzzy rule-bases,

much research is being conducted on developing learning approaches. This technique

begins with the self-organizing controllers which consist of two levels of fuzzy rule bases.

The first rule base is the standard control fuzzy rule base. The second level contains a fuzzy

rule base consisting of meta-rules, which attempt to assess the performance of the close

loop control system and subsequently used to modify the standard rule base. Learning

approaches based on evaluation theory, such as genetic algorithms, may have a promising

potential towards the derivation of fuzzy rule bases. Also, neural network can be used to

form a hybrid neurofuzzy control system that is capable of self-tuning.

5.2.2.1 Structure of fuzzy rules

A fuzzy rule is the basic unit for capturing knowledge in many fuzzy systems. A fuzzy rule

has two components: an if-part (also referred to as the antecedent) and a then-rule (also

referred to as the consequent):

IF <antecedent> THEN <consequent>

The antecedent describes a condition, and the consequent describes a conclusion that can be

drawn when the condition holds.

The structure of a fuzzy rule is identical to that of a conventional rule in artificial

intelligence. The main difference lies in the content of the rule antecedent-the antecedent of

the fuzzy describes an elastic condition (a condition that can be satisfied to a degree) while

Page 119: Air Refueling Autopilot, (My First Book)

97

the antecedent of a conventional rule describes a rigid condition (a condition that is either

satisfied or dissatisfied). For instance, consider the two rules below:

R1: IF the annual income of a person is greater than 120K, THEN the person is rich.

R2: IF the annual income of a person is high, THEN the person is rich.

Where high is a fuzzy set defined be membership function. The rule R1 is a conventional

one, because its condition is rigid. In contrast R2 is a fuzzy rule because its condition can

be satisfied to a degree for those people whose income lies in the boundary of the fuzzy set

High representing high annual income. The consequent of fuzzy rules can be classified into

two categories:

(a) Crisp consequent: IF….THEN y=a

Where (a) is nonfuzzy numeric value or symbolic value.

(b) Fuzzy consequent: IF….THEN y is A

Where A is a fuzzy set.

5.2.3 Fuzzy rule-based inference

The algorithm of fuzzy rule-based inference consists of three basic steps and an additional

optional step.

(1) Fuzzy matching: Calculate the degree to which the input data match the condition of

the fuzzy rules. Fig. 5.6 shows the degree of matching for two rules using two

different inputs through conjunctive conditions.

Fig. 5.6 Fuzzy matching process

Page 120: Air Refueling Autopilot, (My First Book)

98

(2) Inference: Calculate the rule’s conclusion based on its matching degree. Fig. 5.7

shows the clipping method for fuzzy inference for the first rule at matching degree

=0.3.

Fig. 5.7 Fuzzy inference process

(3) Combination: Combine the conclusion inferred by all fuzzy rules into a final

conclusion. Fig. 5.8 shows the combining fuzzy conclusions inferred by the

clipping method.

Fig. 5.8 Fuzzy combination process

Page 121: Air Refueling Autopilot, (My First Book)

99

(4) (Optional) Defuzzification: for applications that need a crisp output (e.g., in control

system), an additional step is used to convert a fuzzy conclusion into a crisp one.

Many ways can be used for such purpose such as MOA (Maximum of area) and

COA (Center of area). The centroid (or COA) defuzzification method calculates he

weighted average of a fuzzy set as shown in Fig. 5.9. The result of applying COA

defuzzification to a fuzzy conclusion can be expressed by the formula:

A i i

i

A ii

( )y yy

( )y

���

� (5.1)

where A� is the membership of area A.

Fig. 5.9 Defuzzification process

In this work these steps were applied to the inputs of the fuzzy logic controller (system

error, change in error) the control action is then generated at the defuzzification process.

Fig. 5.10 represents 49 rule-based inference of Mamdani type fuzzy logic controller and

final defuzzification step.

Page 122: Air Refueling Autopilot, (My First Book)

100

Fig. 5.10 Fuzzy logic inference system

5.2.4 Response pattern of a simple generic fuzzy control system

The simple control strategy of the fuzzy control system can be developed as shown in

Fig. 5.11, maps the error, e=yd –y into the control action u. At the heart of this scheme is a

fuzzy logic control algorithm that operates in discrete time steps of period T and maps the

normalized values of error, en (t), and the change in error, cen (t), defined respectively as

en (t)=ne e(t) (5.2)

cen (t)=nce (e(t)-e(t-T))

(5.3)

where ne and nce are the corresponding normalization factors, into changes in the control

action un (t) via rules of the form

Page 123: Air Refueling Autopilot, (My First Book)

101

If en (t) is P and cen (t) is N then un (t) is Z.

Where P, N and Z are short for positive, negative and zero, defined as fuzzy sets over the

normalized domains and definition of the relevant variables as shown in Fig. 5.12 and

Table 5.1

Fig. 5.11 Architecture of the generic fuzzy control system

In reference to Fig. 5.11 the computed value of ( u) is subsequently denormalized and

integrated (added to the past value of (u) to form the present value of (u)) as follows:

u nu(t) u(t T) (t)de u � � (5.4)

where ued is the corresponding denormalization factor.

Page 124: Air Refueling Autopilot, (My First Book)

102

Fig. 5.12 Step response of a simple generic fuzzy controller

Table 5.1 Control rules for a simple generic fuzzy controller

Region 1 2 3 4

IF error is P N N P

AND error rate is N N P P

THEN control signal (δu) is Z N Z P

In the same way the 49 rule-based Mamdani type fuzzy PID controller Fig. 5.13 was

established and simulated through MATLAB according to the following rule base table

then generating the final control action as shown in Fig. 5.14. The main effort was done in

tuning the fuzzy logic controller normalized and denormalized factors to get the best output

performance of the whole system as it will be discussed later on.

Page 125: Air Refueling Autopilot, (My First Book)

103

Rule error error rate p i d Firing Strength

1 NB NB PB NB PS 0.89736

2 NB NM PB NB NS 0.89736

3 NB NS PM NM NB 0.89736

4 NB Z PM NM NB 0.89736

5 NB PS PS NS NB 0.89736

6 NB PM Z Z NM 0.89736

7 NB PB Z Z PS 0.89736

8 NM NB PB NB PS 0.85494

9 NM NM PB NB NS 0.85494

10 NM NS PM NM NB 0.85494

11 NM Z PS NS NM 0.85494

12 NM PS PS NS NM 0.85494

13 NM PM Z Z NS 0.85494

14 NM PB NS Z Z 0.85494

15 NS NB PM NB Z 0.65068

16 NS NM PM NM NS 0.65068

17 NS NS PM NS NM 0.65068

18 NS Z PS NS NM 0.65068

19 NS PS Z Z NS 0.65068

20 NS PM NS PS NS 0.65068

21 NS PB NS PS Z 0.65068

22 Z NB PM NM Z 0.67087

23 Z NM PM NM NS 0.67087

24 Z NS PS NS NS 0.67087

25 Z Z Z Z NS 0.67087

26 Z PS NS PS NS 0.67087

27 Z PM NM PM NS 0.67087

28 Z PB NM PM Z 0.67087

29 PS NB PS NM Z 0.98392

30 PS NM PS NS Z 0.98392

31 PS NS Z Z Z 0.98392

32 PS Z NS PS Z 0.98392

33 PS PS NS PS Z 0.98392

34 PS PM NM PM Z 0.98392

35 PS PB NM PB Z 0.98392

36 PM NB PS Z PB 0.66334

37 PM NM Z Z PS 0.66334

38 PM NS NS PS PS 0.66334

39 PM Z NM PS PS 0.66334

40 PM PS NM PM PS 0.66334

41 PM PM NM PB PS 0.66334

42 PM PB NB PB PB 0.66334

43 PB NB Z Z PB 0.95689

44 PB NM Z Z PM 0.95689

45 PB NS NM PS PM 0.95689

46 PB Z NM PM PM 0.95689

47 PB PS NM PM PS 0.95689

48 PB PM NB PB PS 0.95689

49 PB PB NB PB PB 0.95689

Page 126: Air Refueling Autopilot, (My First Book)

104

Fig. 5.13 Nonlinear fuzzy PID controller

Fig. 5.14 Fuzzy inference system control action (PID fuzzy logic controller output

gains)

5.3 Genetic Algorithm Process

GA uses a direct analogy of natural behavior Fig. 5.15, They work with a population of

individuals, each reprinting a possible solution to a given problem. Each individual is

assigned a fitness score according to how good its solution to the problem is. The highly fit

individuals are given opportunities to reproduce, by cross breeding with other individuals in

the population. This produces new individuals as offspring, who share some features taken

from each parent. The least fit members of the population are less likely to get selected for

reproduction, and will eventually die out. Adaptive GA’s whose parameters, such as the

population, size, cross over probability and mutation probability are varied during the GA

is running thus converging to the optimum solution faster.

Page 127: Air Refueling Autopilot, (My First Book)

105

Fig. 5.15 The flow of GA functions and process

5.3.1 Application of GA Functions for Tuning Fuzzy PID Controller

Parameters

As shown in the following figure Fig. 5.16, the fuzzy PID controller consists of output

denormalized gains, input-output membership functions and rule bases, [40], [41]. The

main objective of the pre-explained GA procedure is to optimize (minimize) the output

performance index (maximize fitness function) of the whole integrated control system used

in the pitch control motion of F-16 aircraft. Application of GA MATLAB code combined

with SIMULINK control model is implemented to minimize the performance index as

explained later [43].

Page 128: Air Refueling Autopilot, (My First Book)

106

Fig. 5.16 Nonlinear fuzzy PID controller with membership functions

Using GA to minimize the value of the output performance index:

&�

�0

2)_( dtsimpitcheJ (5.5)

Where e(pitch_sim) is the pitch angle error to workspace

The previous index can be obtained from the nonlinear simulation of the pitch control

model consequently GA can use it as the fitness function.

5.3.1.1 Optimizing Fuzzy Output Gains

1- Using binary system coding

Coding�using 10-bit binary genes to express DIP KKK ,, . Table 5.2 shows the upper and

lower gain limits. For example (KP) from bit 1 (0)0000000000 , to bit 10 is

(1023)1111111111 . Then string DIP KKK ,, to 30-bit binary cluster.

0000100010 1 110111000 0000110111:x express a gene�the former 10-bit express KP, the

second portion express KI and the third one express the KD .

Decoding�Cut one string of 30-bit binary string to three 10-bit binary string�then

converts them to decimal system values: y1, y2 and y3. Table 5.3 shows the decoding

equations.

Table 5.2 Gain Limits

Denormalized

Gain

Minimum

limit

Maximum

limit

KP 1 10

KD -3 3

KI -3 3

Page 129: Air Refueling Autopilot, (My First Book)

107

Table 5.3 Decoding Equation

Denormalized gains Decoding equation

KP 1

10239 1 ��

y

KD 3

10236 2 �

y

KI 3

10236 3 �

y

2- Evaluation of fitness function

Fitness function is the main criterion of the GA algorithm, as it represents how much the

system is optimum and stable. The following equation describes the relation between the

fitness function and the performance index.

1))_((),,( � simpitchJKKKf DIP (5.6)

3- Design operators

Proportion selection operator�single point crossover operator�basic bit mutation

operator.

4- Parameters of GA

Population size is 02�M , generation 03�G , crossover probability 0.60c �P �mutation

probability 0.10m �P �

Adopting the above steps, after 100 steps iteration, we get the best individuals When

KP=7.190, KD =2.958 and KI= -2.870 the output performance index has the minimum value

that is 1.023 shown in Fig. 5.17.

Fig. 5.17 Objective function J and Fitness function F

Page 130: Air Refueling Autopilot, (My First Book)

108

5.3.1.2 Tuning of Fuzzy Sets

It is presented a universal algorithm for solving a very general class of optimization

problems applied to fuzzy sets. From studying how such a GA can be applied to the

optimization of fuzzy sets. An appropriate coding, genetic operators (in case that the

standard variants are not sufficient), and a fitness measure is presented [43], [44].

1- Coding fuzzy subsets of an interval

A reasonable resolution for encoding the membership degrees is n = 8. Such an 8-bit

coding is used in several software systems, too. For most problems, however, simpler

representations of fuzzy sets are sufficient. Many real-world applications use triangular and

trapezoidal membership functions Fig. 5.18.

Not really surprising, a triangular fuzzy set can be encoded as

Fig. 5.18 Triangular and trapezoidal membership functions

where is an upper boundary for the size of the offsets, for example = (b − a)/2. The

same can be done analogously for trapezoidal fuzzy sets:

In specific control applications, where the smoothness of the control surface plays an

important role, fuzzy sets of higher differentiability must be used. The most prominent

Page 131: Air Refueling Autopilot, (My First Book)

109

representative is the bell-shaped fuzzy set whose membership function is given by a

Gaussian bell function:

2

2

2

)(

)( u

rx

ex

�� (5.7)

The “bell-shaped analogue” to trapezoidal fuzzy sets are so-called radial basis functions:

q

q

rx

rx

if

ifex u

qrx

'

-.

-/

0�

1

)(2

2

2

)(

� (5.8)

Fig. 5.19 shows a typical bell-shaped membership function. Again the coding method is

straightforward, i.e.

Fig. 5.19 Bell-shaped membership functions

where + is a lower limit for the spread u. Analogously for radial basis functions:

The final step is simple and obvious, In order to define a coding of the whole configuration,

i.e. of all fuzzy sets involved, it is sufficient to put coding of all relevant fuzzy sets into one

large string. This type of membership functions were used in describing the fuzzy PID

Page 132: Air Refueling Autopilot, (My First Book)

110

controller denormalized gains ( DIP KKK ,, ) as it has better representation of system

uncertainty.

2- Coding whole fuzzy partitions

In this work a simple example of an increasing sequence of trapezoidal-triangular fuzzy

sets has been presented. Such a “fuzzy partition” is uniquely determined by an increasing

sequence of 2N points, where N is the number of linguistic values we consider. The

mathematical formulation is the following:

],[

],[

0

1

)( 21

10

12

21 xx

xx

x

x

otherwise

if

if

xx

xxx �

--.

--/

0

�� (5.9)

12

],[

],[

],[

0

1)(122

1222

2232

122

2

3222

32

���

---

.

---

/

0

Niforxxx

xxx

xxx

otherwise

if

if

if

xx

xx

xx

xx

xii

ii

ii

ii

i

ii

i

i�

(5.10) 22

22323222

32

],[

0

1)(

'

--

.

--

/

0

� N

NNNN

N

N x

xx

x

x

otherwise

if

ifxx

xx

x�

(5.12)

Fig. 5.20 shows a typical example of cross over process with N = 3 that was used to

represent (error, error change) in the proposed fuzzy PID controller. It is not wise to

encode the values xi as they are, since this requires constraints for ensuring that xi are

non-decreasing. A good alternative is to encode the offsets:

Page 133: Air Refueling Autopilot, (My First Book)

111

Fig. 5.20 Example for one-point crossover of fuzzy partitions

3- Genetic operators

Since this GA can only deal with binary representations of fuzzy sets and partitions, all the

GA operators that mentioned before are also applicable here. However, that the offset

encoding of fuzzy partitions is highly epistemic. More specifically, if the first bit encoding

x1 is changed, the whole partition is shifted. If this results in bad convergence, the crossover

operator should be modified. A suggestion can be found in [43]. Fig. 5.20 shows an

example what happens if two fuzzy partitions are crossed with normal one-point crossover.

Fig. 5.21 shows the same for bitwise mutation.

Fig. 5.21 Mutating a fuzzy partitions

4- Rescaling process (Decoding of all fuzzy partitions)

Using the following simple equation to normalize the membership variables (error, error

change) by:

Page 134: Air Refueling Autopilot, (My First Book)

112

1020/)10202( �� yx

Therefore the optimum (normalized) membership functions can be obtained for both (error,

error change). The following figures (Fig. 5.22a, Fig. 5.22b, Fig. 5.22c, Fig. 5.22d, Fig.

5.22e) illustrate the optimum input-output membership functions that obtained from the

adaptive genetic algorithm for 40 samples and 20 generations at some operating point of

(250 ft/s speed and 1000 ft altitude).

Fig. 5.22a Input variable “error”

Fig. 5.22b Input variable “error change”

Fig. 5.22c Output variable “Kp”

Page 135: Air Refueling Autopilot, (My First Book)

113

Fig. 5.22d Output variable “Ki”

Fig. 5.22e Output variable “Kd”

5.3.1.3 Rule Base Weight Optimization

The genetic algorithm has been applied to 100 samples of input-output simulation data

obtained from fuzzy PID controller. The rules obtained by the algorithm are shown below.

The values in parentheses after each rule represent the firing strength of the corresponding

rule.

1.if (e is NB) and (ec is NB) then (kp is PB)(Ki is NB)(Kd is PS)(.5811)

: : : : : : : : : :

49. if (e is PB) and (ec is PB) then (kp is NB)(Ki is PB)(Kd is PB)(.3121

5.4 LQR Fuzzy Logic Control (LQRIFC)

The LQR integrated fuzzy control utilizes both advantages from the LQR controller and

fuzzy logic controller as LQR controller can easily satisfies the flying qualities and pilot

rating requirements and fuzzy control can cope with the nonlinearity of the system

introducing a smart way to modify the output gains according to the actual performance

Page 136: Air Refueling Autopilot, (My First Book)

114

blending the dynamic response that generating better performance than using LQR alone.

Fig. 5.23a and Fig. 5.23b describes the LQR integrated fuzzy control (LQRIFC) for pitch

controller.

Fig. 5.23a LQR integrated fuzzy control (LQRIFC) for pitch controller

Fig. 5.23b LQR integrated fuzzy control (LQRIFC) for lateral-directional controller

System dynamics is described by the following state space through LQR design algorithm

at several trimmed points for pitch control; Table 5.4 shows the linearized matrices of F-16

model at different operating points (different altitudes). The LQR closed loop system poles

satisfy the flying qualities specifications [47] such as the damping ratio and the natural

Page 137: Air Refueling Autopilot, (My First Book)

115

frequencies. The tuned fuzzy logic controller copes with the LQR output error thus

enhancing the net output system performance. Membership functions could be sliding back

and forth so that it suppress low frequencies disturbance on the other hand the low pass

filter introduced will cope with high frequencies noise that produce a robust and optimal

control system, as the integrated control system utilizes both advantages of the LQR and

FLC techniques (optimal and robust design). Fig. 5.24 and Fig 5.25 show the difference

between both cases with the optimized fuzzy controller and without fuzzy controller for

longitudinal and lateral motions as the additional FLC enhances the performance index (PI)

more than 8.5%. Table 5.5 shows the different optimized LQRIFC gains at different

altitude. The following linear equations describe the dynamics of the longitudinal and

lateral motions of the aircraft at velocity 500 (ft/s) appendix B5.

Table 5.4 Linearized Matrices for longitudinal and lateral motion

Alt

(ft) ��A

~qA�

~ eB�

~�qA

~qqA

~eqB

~

4000 -0.8972 0.9502 -0.0019 -3.6241 -1.2147 -0.2650

4500 -0.8325 0.9533 -0.0017 -3.3307 -1.1265 -0.2438

5000 -0.7716 0.9562 -0.0017 -3.0570 -1.0433 -0.2235

Alt

(ft) ��A

~��A

~pA�

~rA�

~aB�

~rB�

~

4000 -0.3220 0.0640 0.0364 -0.9917 0.0003 0.0008

4500 -0.3221 0.0642 0.0364 -0.9920 0.0003 0.0008

5000 -0.3221 0.0642 0.0364 -0.9925 0.0003 0.0008

Alt

(ft) ��A

~��A

~pA�

~rA�

~aB�

~rB�

~

4000 0 0 1 0.0037 0 0

4500 0 0 1 0.0039 0 0

5000 0 0 1 0.0040 0 0

Alt

(ft) �pA

~�pA

~ppA

~prA

~apB

~rpB

~

4000 -30.6492 0 -3.6784 0.6646 -0.7333 0.1315

4500 -29.5264 0 -3.6555 0.6621 -0.7192 0.1301

5000 -27.0021 0 -3.6321 0.6511

Alt

(ft) �rA

~�rA

~rpA

~rrA

~arB

~rrB

~

4000 8.5395 0 -0.0254 -0.4764 -0.0319 -0.0620

4500 8.9422 0 -0.0254 -0.4722 -0.0307 -0.0520

5000 9.3323 0 -0.0254 -0.4612 -0.0303 -0.0488

Page 138: Air Refueling Autopilot, (My First Book)

116

Table 5.5 Gain values for longitudinal and lateral controllers

Fig. 5.24 Integrated system step response in both cases with optimized fuzzy controller

and without fuzzy controller for longitudinal motion

Fig. 5.25 Integrated system step response in both cases with optimized fuzzy controller

and without fuzzy controller for lateral motion

Alt

(ft) 4000 4500 5000

�K 0.2086 0.2104 0.2127

qK -0.7971 -0.8157 -0.9091

iK 4.6106 4.6518 5.0274

1K 15.0421 16.4435 17.2216

2K 0.1822 0.1936 0.2111

3K -5.3483 -5.4541 -5.6172

4K 22.5222 24.5569 26.3897

pK 7.190 8.8725 8.1053

DK 2.958 2.754 2.333

IK -2.870 -2.650 -2.230

Page 139: Air Refueling Autopilot, (My First Book)

117

The states and output of the plant plus the compensator for both pitch and lateral motions

are

� �TFepitch qx +��� , � �TFpitch qy +��

� �Twralateral xrpx +,�� , � �Trlateral epey ,+�

GrBuAxx ����

FrCxy ��

HxZ �

Kyu �

������

������

0002958.570

010000.10

002.2000

00~~~

00~~~

eqqqq

eq

BAA

BAA

A�

����

,

������

������

0

0

2.20

0

0

B ,

������

������

1

0

0

0

0

G ,

���

���

��

0

0

0

F

���

���

��

10000

0002958.570

02958.57000

C , � �0002958.570�H , � �lq KKKKyu � � �

�����������

�����������

00000010

01002958.57000

002.2000000

0002.200000

00~~~~~~

00~~~~~~

00~~~~~~

00~~~~~~

rrarrrprrr

rpaprppppp

rarp

rarp

BBAAAA

BBAAAA

BBAAAA

BBAAAA

A ��

��

��������

��������

,

�����������

�����������

00

00

2.200

02.20

00

00

00

00

B

,

�����������

�����������

01

00

00

00

00

00

00

00

G

Page 140: Air Refueling Autopilot, (My First Book)

118

Hxxr

zw

���

���

���

���

��

01002958.57000

00000010�

c

rFrCx

e

p

ey ��

�����

�����

��

����

����

00000010

00000100

00002958.57000

10000000

C

����

����

01

00

10

00

F

The control input � �Tra uuu � may be expressed as Kyu �

With ��

���

��

000

0

2

431

k

kkkK

Page 141: Air Refueling Autopilot, (My First Book)

119

Chapter (6)

Design of Fighter Flight Formation Autopilot for aerial

Refueling Racetrack Mission Employing KC-130J Tanker with

Drogue-Hose Configuration

6.1 Introduction

Autonomous formation flight is currently an important research area in the aerospace

community. The aerodynamic benefits of formation and, in particular, close formation

flight, have been well documented (Ref. [48], [49]). In earlier efforts [50], a leader-

wingman formation flight control problem was investigated and a PID-type of formation

controller was developed. Ref. [51] describes the application of an “extreme seeking”

algorithm to the formation control problem. In Ref. [52] a formation flight control scheme

was proposed based on the concept of Formation Geometry Center, also known as

Formation Virtual Leader. Some of the initial experimental results of formation flight were

reported in Ref [53]. However, in all the previous efforts, the formation control problem is

considered with the aircraft flying at straight level flight conditions and/or under mild

maneuvering. In this work the formation control strategy will be implemented in the case

study of aerial refueling racetrack mission. KC-130J tanker and F-16 receiver configuration

Fig. 6.1 was used as a case study in this paper.

Page 142: Air Refueling Autopilot, (My First Book)

120

Fig. 6.1 KC-130J tanker and F-16 receiver configuration

6.2 Receiving aircraft modeling

The F-16 nonlinear model [45], [46] as shown in Fig. 6.2 has been constructed using

SIMULINK/ MATLAB. The plant requires four controls, eighteen states, leading edge flap

deflection and a model flag as inputs as shown in Table 6.1 and Table 6.2. Starting with

calculating the trimming points then performing the linearization algorithms, therefore the

aircraft state space will be available to calculate the optimal gain matrix that is required for

the formation controller design.

Fig. 6.2 F-16 nonlinear modeling

Table 6.1 F-16 aircraft states

Page 143: Air Refueling Autopilot, (My First Book)

121

Table 6.2 Control channels

6.3 Control Strategy

The formation control problem can be basically classified as a Dynamic 3-D Target-

Tracking problem, where the objective is to track a certain point (desired position)

dynamically specified by the leader. The main difference between conventional ‘trajectory-

following’ flight and formation flight is that in the first case the trajectory is typically pre-

defined and stored within the on-board computer while in the second case the trajectory to

be followed is ‘produced’ on-line by the leader aircraft flown under specific trajectory;

thus, the trajectory information has to be obtained in real time from some of the relevant

states of the leader aircraft (position, velocity, etc.). Ideally, to achieve desirable trajectory

tracking performance, the formation flight control strategy should be based on full state

tracking strategy. This concept can be concisely expressed as:

Page 144: Air Refueling Autopilot, (My First Book)

122

Wingman’s control inputs = Leader’s control inputs + State error feedback

where the control inputs include deflections for the throttle, elevator, aileron and rudder,

while state error feedback consists of internal state variable errors and trajectory state

variable errors between leader and wingman. Particularly, internal state variable errors are

angular rate errors and Euler angle errors (pitch and bank angles); trajectory state variable

error are instead given by projected 3-D position and velocity errors (i.e., forward distance,

lateral distance and vertical distance, and their time derivatives, as defined in next

section).This approach is based on the fact that, if the wingman flies at the same position of

the leader, a perfect position tracking could be achieved under any reasonable maneuvering

the leader aircraft might execute, since the leader and wingman aircraft are sharing very

similar dynamics (assuming same type of aircraft). In reality, extra compensation might be

needed to account for the trajectory variable difference between the leader and the ideal

wingman. This is because the desired wingman position is shifted with respect to the

leader’s position. Since both the leader’s state and input vectors are needed to calculate the

wingman input, a high communication bandwidth between the leader and wingman is

required. Among conventional formation control schemes, the simplest scheme in terms of

the minimum amount of information from leader is based upon an existing autopilot

(functioning as an “inner loop” controller) with an additional “formation-autopilot” added

on to an “outer loop” controller. This outer loop controller uses only trajectory

measurements from the leader available from GPS. Unfortunately, this simple formation

control scheme has shown desirable performance only if the leader is flying at level straight

and/or performing mild maneuvers. A reasonable tradeoff between the simplest and the

most complete schemes introduced above is given by the use of Euler angles error feedback

along with trajectory error feedback by the wingman. The control strategy discussed in this

paper is based on this approach.

6.3.1 Controller design

Since formation control is a 3-D tracking problem, the control task can be decomposed into

three sub-tasks: vertical distance (height) control, lateral distance control, and forward

distance control. On the other hand, since the dynamics of the aircraft attitude (angular

Page 145: Air Refueling Autopilot, (My First Book)

123

movement) is much faster than the trajectory dynamics (translational movement), the whole

dynamics exhibit a typical two-time-scale feature. Therefore, the design of the control

system can be decomposed into two separate phases, that is, the inner loop and the outer

loop design. The function of the inner loop controller is to maintain and/or track the desired

pitch/bank angle command; the outer loop controller – which is based on the designed inner

loop controller and uses the desired pitch/bank angle command as its output – tries to

maintain and/or track the desired formation flight.

6.3.1.1 Formation geometry and trajectory variables

As described above, formation flight control problem can be decomposed as a level plane

and a vertical plane dynamic trajectory-tracking problem.

6.3.1.2 Level plane formation definition

Fig. 6.3 shows the level plane formation geometry. All the trajectory measurements, i.e.,

leader/ wingman position and velocity, are defined with respect to a pre-defined Earth-

Fixed Reference x-o-y plane and are measured by the on-board GPS’s. The pre-defined

formation geometric parameters are the forward clearance, fc, and the lateral clearance, lc.

The formation trajectory variables in level plane – the forward distance, f, and lateral

distance, l, can be calculated from the trajectory measurements and formation geometric

parameters as:

Fig. 6.3 Level plane formation geometry

Page 146: Air Refueling Autopilot, (My First Book)

124

) * ) *c

Lxy

FLLxFLLyl

V

yyVxxVl

� (6.1)

) *c

Lxy

FLLxFLLyf

V

xxVyyVf

� �

)( (6.2)

Where 22LyLxLxy VVV �� is the projection of the leader’s velocity onto X-Y plane.

Accordingly, the relative forward speed and relative lateral speed of the wingman are

defined as the time derivatives of the forward distance and lateral distance respectively and

are needed for formation control purposes which can be calculated as:

�� ���

� Lc

Lxy

FxLyFyLxff

V

VVVVl )( (6.3)

�� �� �

� Lc

Lxy

FyLyFxLx

Lxy llV

VVVVVf )( (6.4)

There are basically two methods to obtain the angular velocity (around the vertical

axis) �� L . One method is to first calculate & L� from the GPS measurement ),( LyLx VV , then

apply conventional numerical derivative techniques to estimate the time derivatives of L� ;

within this approach particular caution should be exercised due to the sensitivity of the

numerical derivative with respect to measurement noise. A second approach consists in

using additional measurements from the leader aircraft, that is using the following

kinematical relation (assuming 0��L� ).

LLLLLLL rq 1��23� �� cos/)cossin( ,,

This second approach requires not only the vertical gyro (to measure bank angle L, and

pitch angle L1 ) but also the angular rate gyros (to measure pitch rate q and yaw rate)) on

the leader aircraft. In this study the first approach was used with the definitions provided

above. The level plane formation control problem can be sub-divided into a lateral distance

control problem and a forward distance control problem.

6.3.1.3 Vertical plane formation definition

At nominal conditions, the leader and the wingman aircraft are separated by a vertical

clearance h. the vertical distance, z , can then be calculated by:

Page 147: Air Refueling Autopilot, (My First Book)

125

hzzz wL � (6.5)

While its time derivative is given by:

wzLz VVz �� (6.6)

6.3.2 Control laws

6.3.2.1 Lateral Distance Control

The objective of the lateral distance control is to minimize the lateral distance l. the basic

physical principle of the lateral distance control can be expressed by the following action-

consequence logic:

cedisLateralspeedlateralbankanglerollrateaileron tan__ ####

In addition, the function of the rudder is to augment the lateral-directional stability (by

increasing the Dutch Roll damping ). Therefore the lateral formation control law consists of

an inner loop controller – controlling the bank angle and augmenting the lateral-directional

stability and an outer loop controller maintaining the predefined flight formation with

respect to the leader. The control law, represented in Fig. 6.4, can be expressed by:

Inner loop control law:

Fig. 6.4 Lateral –Directional control law

)( gWWpAW KpK ,, , �� (6.7)

WrRW rK� (6.8)

Page 148: Air Refueling Autopilot, (My First Book)

126

Outer loop control law:

lKlK lldotLg ��� �,, (6.9)

6.3.2.2 Forward Distance Control

The objective of the forward distance control is to minimize the forward distance f . This

task can only be accomplished through the involvement of the throttle control channel. In

fact, by increasing/decreasing the throttle, the thrust of the engine and there for the speed of

the aircraft is increased/decreased; this, in turn, allows to control the forward distance

between leader and wingman. The forward distance control law, represented in Fig. 6.5, is

given by:

Fig. 6.5 Forward control law

fKfK ffdotTT ��� �0 (6.10)

6.3.2.3Vertical Distance Control

The objective of the vertical distance control is to minimize the vertical distance. This task

is accomplished through the use of the elevator control channel. The vertical distance

control law is similar to the conventional altitude-hold autopilot with the only difference

being that the altitude reference may vary according to the leader’s altitude. Similar to the

lateral distance controller, the vertical distance control scheme can be designed using an

inner loop control scheme - which is basically a pitch angle controller - and an outer loop

controller which provide an altitude control-capabilities. This control law is presented in

Fig. 6.6.

Page 149: Air Refueling Autopilot, (My First Book)

127

Fig. 6.6 Vertical control law

Inner loop control law:

)(0 gWWqEE KqK ��� (6.11)

Outer loop control law:

zKzK zzdotLg ��� � (6.12)

6.4 System Identification Process

In order to evaluate each branch in the complete control system introducing reasonable

damping ratio, system identification process is needed to evaluate the final response

considering the coupling between the different SISO branches and the kinematics

nonlinearities.

6.4.1 Estimation of Simple Process Model

The System Identification allows to estimate simple continuous-time process models

characterizing the static gain, dominating time constants, and possible time delays (dead

time). They are variants of the transfer function model structure.

6.4.2 Initial Parameter Values and Parameter Bounds

Page 150: Air Refueling Autopilot, (My First Book)

128

If no prior knowledge is available about the parameters, a startup routine is invoked to

come up with initial parameter estimates. These are further iterated upon to give the best

possible model fit to the data. Actually in our process there is no initial guess is provided

and an automatic process is invoked to estimate the initial values. If no qualified guess is

available, this is usually a better alternative than entering an unstable value. However, if the

estimation process gives parameter values that seem unreasonable, it might be worthwhile

to try out various initial guesses and upper and/or lower limits of the parameters.

6.4.3 Compensator design using system identification technique

In this work it is introduced some structure forward control model as shown in Fig. 6.5

that was used to generate the linear model in order to choose the optimum PID controller

gains and the compensator time constant so that achieving the desired damping ratio

through root locus tool. Additional pole compensator structure will be as following:

cc Kps

G ��

�1

1(6.13)

The final design parameters are given by Table 6.3.

Table 6.3 Flight formation controller parameters

Kp KΦ Kr Ki Kl KL KV Kq KӨ Kzdot Kz P1

.431 .29 .5 .425 .331 6.9 .98 .333 .123 .5 .8 1.18

6.5 Alignment Stage-Formation Control Simulation Results

The formation control law developed in the previous section was based on a linear aircraft

model. Such a controller, if properly designed, can be guaranteed to perform nominally

only when the system is operating around the design point where the linear model was

derived from. However, non-linear dynamic effects, particularly those associated with the

kinematics, cannot be ignored when the aircraft is undergoing a significant trajectory

maneuver, i.e., flying at a large bank angle. Thus, it is necessary that the designed

controller be validated through simulation using a nonlinear model so that any major non-

linearities in terms of trajectory dynamics, such as non-linear reference transformation and

Page 151: Air Refueling Autopilot, (My First Book)

129

kinematical non-linearity, can be accounted for. The non-linear aircraft model of dynamics

can be described by the following 6 DOF equations plus kinematical equations. By

applying the scenario of the system identification technique it is possible to reach the

desired performance with a reasonable damping ratio. Fig. 6.7 shows the control system

implementation using SIMULINK model appendix B8. Fig. 6.8 shows the nonlinear

output response and the relative distances in all directions that satisfy the predefined

boundaries according to the KC-130J specifications. Fig. 6.9 shows the effect of adding

compensation on the damping ratio explained by root locus (SISO) tool for lateral control

branch through MATLAB tool box. It is clear that the damping ratio has reached a

reasonable value (ζ=.35) .Fig. 6.10 shows the predefined trajectory of the tanker and the

receiving aircraft describing the plane relative distance for the whole mission. It is clear

from the Fig. 6.5 that the maximum peak in the relative distances between the receiver and

the tanker usually become larger in the transient points of switching the racetrack from and

to steady state flight after and before the steady horizontal turn. Fig. 6.8 shows also that the

maximum relative distances between the tanker and the receiving aircraft may reach over

50 (ft) in some places of the racetrack trajectory, therefore it is recommended to increase

the radius of the tanker horizontal turn over 25000 (ft) with bank angle limit of 30 (deg) in

case of performing racetrack mission as in Fig. 6.10.

Page 152: Air Refueling Autopilot, (My First Book)

130

Fig. 6.7 Flight formation controller using SIMULINK

Page 153: Air Refueling Autopilot, (My First Book)

131

Fig. 6.8 Nonlinear model output performance with compensation

Page 154: Air Refueling Autopilot, (My First Book)

132

Fig. 6.9 Root locus for lateral –directional control with and without phase lead

compensator respectively

Fig. 6.10 Trajectory in x-y plane for both wingman and leader

Page 155: Air Refueling Autopilot, (My First Book)

133

Chapter (7)

Control Strategy and Implementation Methodology

7.1 Introduction

In order to design a proper and efficient aerial refueling autopilot, it should verify the basic

flying quality requirements, moreover minimizing the total mission time and verifying the

Tanker-Fighter configuration design and safety constraints such as the upper and lower

limits of relative distances and Euler angles error between the tanker and the fighter. To

satisfy all the basic requirements mentioned above a 3-stage controller has been proposed

in this work starting from the wing-level steady state flight until the final alignment in the

terminal stage appendix B9. The 3-stage autopilot will be classified as following:

1- Stability Augmentation System (SAS)

2- Tanker Tracking using Command Augmentation system (CAS)

3- Alignment Terminal using Flight Formation Controller

7.2 Aerial Refueling Stages

7.2.1 Stability Augmentation System

In this stage a Linear Quadratic Regulator (LQR) will be introduced in this stage, the

regulator was mentioned in chapter 4 as an optimal stabilizer for both the longitudinal and

lateral motions. In this stage this stabilizer will recover the fighter aircraft from any past

maneuvers and stabilizing all the flight parameters before applying the next stage

controller. In other words it is a transition stage before the pilot commanded stage to pilot

un-commanded stage.

7.2.2 Tanker Tracking Using Command Augmentation system (CAS)

The second phase is the tracking phase controlling the receiving aircraft (fighter aircraft)

from the end of the first stage to the 1000 (ft) behind the tanker at the desired lower point

which is straight and lower from the tanker with 25 (ft) at this phase it is clear that the

Page 156: Air Refueling Autopilot, (My First Book)

134

receiving aircraft speed profile maintained at almost constant and high speed as long as the

receiving aircraft is away from the tanker then decelerating with different acceleration rates

till starting the next phase which allow to minimize the total mission time appendix B6,

B7.

The following equations explain the transformation procedure starting from the tanker

position with respect to fixed frame of reference to wing coordinate of the receiving aircraft

with initializing small perturbed step (0.0001) to avoid the singularities during simulation

calculation.

X = Tanker X component relative to the fixed frame of reference

Y = Tanker Y component relative to the fixed frame of reference

Z = Tanker Z component relative to the fixed frame of reference

XF = Fighter X component relative to the fixed frame of reference

YF = Fighter Y component relative to the fixed frame of reference

ZF = Fighter Z component relative to the fixed frame of reference

XBO = Tanker X component relative to aircraft body axes at the fixed frame of reference

YBO = Tanker Y component relative to aircraft body axes at the fixed frame of reference

ZBO = Tanker Z component relative to aircraft body axes at the fixed frame of reference

XB = Tanker X component relative to aircraft body axes

YB = Tanker Y component relative to aircraft body axes

ZB = Tanker Z component relative to aircraft body axes

, Ф, ψ = Rotation around X,Y, Z axes

A = cos cos ψ

B = (sin Ф sin cos ψ – cos Ф sin ψ)

C = (cos Ф sin cos ψ+ sin Ф sin ψ)

D = cos sin ψ

E = (sin Ф sin sin ψ + cos Ф cos ψ)

F = (cos Ф sin sin ψ – sin Ф cos ψ)

G = – sin

Page 157: Air Refueling Autopilot, (My First Book)

135

M = sin Ф cos

N = cos Ф cos

)])(())([(

)])(())([(

BDEANACGMABGCDFA

BDEAZAXGMABGXDYAZBO

� (7.1)

)(

)]()[(

BDEA

CDFAZXDYAY BO

BO

� (7.2)

A

CZBYXX BOBO

BO

)( � (7.3)

)])(())([(

)])(())([(

BDEANACGMABGCDFA

BDEAAZGXMABGDXAYZ FFFF

SHIFT

� (7.4)

)(

)]()[(

BDEA

CDFAZDXAYY SHIFTFF

SHIFT

� (7.5)

A

CZBYXX SHIFTSHIFTF

SHIFT

)( � (7.6)

XB = XBO – X shift (7.7)

YB = YBO – Y shift (7.8)

ZB = ZBO – Z shift (7.9)

Fig. 7.3 shows all the control efforts of the control surfaces and the aircraft engine power

during the whole mission starting from the start point as in Fig. 7.2 appendix B3. until to

the point of contact to the tanker which is the most essential interval in the mission. The

alignment terminal control secures the position of the receiving aircraft beneath the tanker

of about 30 (ft) and the steady flight speed is equal the same as the tanker flight speed. The

Page 158: Air Refueling Autopilot, (My First Book)

136

figures show also the relative speed and distances between the receiving aircraft and the

tanker.

Fig. 7.1 Tanker position transformation to aircraft wing axes

Fig. 7.2 Actual trajectories for tanker and receiving aircraft

Page 159: Air Refueling Autopilot, (My First Book)

137

Fig. 7.3 F-16 nonlinear model performance (Tracking stage)

Page 160: Air Refueling Autopilot, (My First Book)

138

7.2.3 Alignment Terminal using Flight Formation Controller

The formation control law developed in the previous chapter was based on a linear aircraft

model. Such a controller, if properly designed, can be guaranteed to perform nominally

only when the system is operating around the design point where the linear model was

derived from. However, non-linear dynamic effects, particularly those associated with the

kinematics, cannot be ignored when the aircraft is undergoing a significant trajectory

maneuver, i.e., flying at a large bank angle. Thus, it is necessary that the designed

controller be validated through simulation using a nonlinear model so that any major non-

linearities in terms of trajectory dynamics, such as non-linear reference transformation and

kinematical non-linearity, can be accounted for. The non-linear aircraft model of dynamics

can be described by the following 6 DOF equations plus kinematical equations. By

applying the scenario of the system identification technique it is possible to reach the

desired performance with a reasonable damping ratio. Fig. 7.4 shows the nonlinear output

response and the relative distances in all directions that satisfy the predefined boundaries

according to the KC-130J specifications. It is clear from the Fig. 7.4 that the maximum

peak in the relative distances between the receiver and the tanker usually become larger in

the transient points of switching the racetrack from and to steady state flight after and

before the steady horizontal turn. Fig. 7.4 shows also that the maximum relative distances

between the tanker and the receiving aircraft may reach over 50 (ft) in some places of the

racetrack trajectory, therefore it is recommended to increase the radius of the tanker

horizontal turn over 25000 (ft) with bank angle limit of 30 (deg) in case of performing

racetrack mission.

Page 161: Air Refueling Autopilot, (My First Book)

139

Fig. 7.4 Nonlinear model output performance with compensation

Finally the overall implementation methodology and control strategy for the three basic

mentioned stages (phases) can by described clearly through the following flowchart.

Page 162: Air Refueling Autopilot, (My First Book)

140

Operating point

Alt. Mach

Trimming Algorithm

Linearization Algorithm

State Space Models

LQR Algorithm (SAS)

Gain Matrix Flying Qualities Verification

Integration with (FLC type PID)

Lateral-Directional motion

GA using different types of PI For both

longitudinal and lateral motions step response

PID parameters Membership Functions

Rule Base Strength

Tracking Controller during Tanker tracking

phase (second stage)

Design 3 stage transformation to map the tanker position to the

receiving A/C wind axes

Optimal Guidance Law algorithm

Alignment stage controller to align the

receiving A/C with the tanker C/L

Total mission time and the final relative errors

Verification 1-Design constrains 2-Flying qualities 3-Time minimization compared with diff. x

Longitudinal motion

Final states

Initial states

State Space Models plus

desired compensator structure

LQ Algorithm (CAS)

Gain Matrix

Zero states Initial states

Aerial refueling

Procedure

Page 163: Air Refueling Autopilot, (My First Book)

141

7.3 Fighter -Tanker Tracking Stage Optimal Trajectory Determination

Fig. 7.5 Fighter-Tanker tracking stage optimal trajectory

7.3.1 Optimal trajectory equations

Ryyxxtv RTfRTffR � �$ 2/12)0(

2)0( ])()[( (7.10)

)]/()[(tan 1RfTfRfTff xxyy � � (7.11)

RRR vx �cos$��(7.12)

RRR vy �sin$��(7.13)

Since fR �� �

Page 164: Air Refueling Autopilot, (My First Book)

142

fRfRf vtx �cos$� (7.14)

fRfRf vty �sin$� (7.15)

Where ))),((( Rvvfavgv TRR � =Constant

Since the tanker’s motion could be detected easily

&��tf

TTTTF dtvxx0

0 cos� (7.16)

&��tf

TTTTF dtvyy0

0 sin� (7.17)

Where tf = time at the end of tracking stage

By using numerical method such as quadratic convergent Newton raphson method, the

optimal trajectory equation can be resolved, therefore values tf and f� could be evaluated.

}//])(){[( 2/12)0(

2)0( RRRTfRTff vRvyyxxt � � (7.18)

Therefore the value of tf and f� can be obtained,

Then the acceleration command equation will be as following:

�� RROPG Vu � (7.19)

The following Figures Fig. 7.6, Fig. 7.7, and Fig. 7.8 show the relative distances in X, Y

and Z directions after applying the previous optimal guidance law. 4� 9.1required� ,

4� 5.0required with more than 35 % reduction in mission time

Page 165: Air Refueling Autopilot, (My First Book)

143

Fig. 7.6 Relative distance in X direction (ft)

Fig. 7.7 Relative distance in Y direction (ft)

Fig. 7.8 Relative distance in Z direction (ft)

Page 166: Air Refueling Autopilot, (My First Book)

144

Chapter (8)

SUMMARY AND FINAL CONCLUSION

8.1 Stability Stage Poles Verification with Flying Qualities (1ST Stage)

The first stage (stability phase) is need to recover the fighter aircraft from any past

maneuvers using the stability system augmentation to stabilize the aircraft to perform the

next stages such as (tracking and alignment stages). It is required in this transition phase to

satisfy all the closed loop poles with standard flying qualities for securing better and

acceptable performance of the aircraft. The following table shows the short period poles in

different altitudes which satisfy the required flying qualities as mentioned. In the same

manner it is possible to satisfy the other poles with the associated standard values as

described in Table 8.1.

Table 8.1 The listed values satisfy a level 1 flying quality with a category B flight phase

thus validating the design parameters for the proposed controller

Altitude Eigen values sp� sp5 )//(2 �� nsp

20000 -6.23 ((611.3i 12.8621 0.4841 2.7572

22000 -6.15 ((610.6i 12.2414 0.5026 2.4975

24000 -6.20 ((610.7i 12.4004 0.5000 2.5628

26000 -6.19 ((610.5i 12.2004 0.5073 2.4808

28000 -6.18 ((610.3i 11.9991 0.5149 2.3996

30000 -6.17 ((610.1i 11.8036 0.5226 2.3220

32000 -6.16 ((69.85i 11.6181 0.5303 2.2496

34000 -6.15 ((69.65i 11.4424 0.5378 2.1821

Page 167: Air Refueling Autopilot, (My First Book)

145

8.2 Tracking Stage Time Using Different Guidance Technique (2nd Stage)

The second stage is very important stage in designing aerial refueling autopilot as it affects

the total time consumed for the whole mission. There are different types of guidance laws

could be used in this phase such as (Line Of Sight (LOS), and Optimal Guidance Law

(OGL)) both guidance laws were designed and implemented in this work. Consequently it

is easy to compare between both of them as shown in Table 8.2 that results in using the

second guidance law (Optimal Guidance Law) is much better more than the first one as it

has less time and lower energy consumed compared with the first guidance law.

Table 8.2 Tracking phase time versus guidance technique (second phase)

Tracking phase guidance

technique

Phase time Total energy consumed

Line Of Sight (LOS) 495 (sec) High

Optimal Guidance Law 365 (sec) Low

8.3 Alignment Stage during (Boeing KC 767) Tanker–Boom configuration

(3rd Stage)

The last stage is also very important stage as it should satisfy some important constrains to

secure safety and security during last approaching to perform the boom contact with the

receiving aircraft. Table 8.3 shows the minimum and maximum errors during alignment

stage with the design constrains that calculated according to the Tanker-Boom details. It is

easy to figure out that the Simulation errors satisfy the permitted errors with acceptable

tolerances. Note that the actual engagement starts after about 50 seconds from starting the

alignment phase.

Page 168: Air Refueling Autopilot, (My First Book)

146

Table 8.3 Relative distances in 3 directions (X, Y, Z) with upper and lower limits

according to the design constrains of the Tanker-Boom configuration (last phase)

Relative Distances Min ASE Max

Forward distance (ft) 87 88-97 100

Lateral distance(ft) 0 .5-3 6

Vertical distance(ft) 11 22 25

8.4 (Boeing KC 767 Tanker – Boom configuration) versus (KC-130J

Tanker with Hose – Drogue configuration)

The following figures illustrate some of the simulation output results such that the relative

error in the three basic directions for both mentioned configurations that show the

difference in relative error especially in the forward and lateral directions at the turn points.

On the other hand it is possible to use the second configuration during performing both

racetrack and alignment stage missions while it is recommended only to use the first

configuration in normal alignment stage only. As the first configuration requires some tight

constrains to be satisfied as shown in Fig. 8.1 while the second configuration has larger

constrains that fit with the Hose-Drogue configuration.

Page 169: Air Refueling Autopilot, (My First Book)

147

Fig. 8.1 (Boeing KC 767 Tanker – Boom configuration) versus (KC-130J Tanker with

Hose – Drogue configuration)

8.5 Final Conclusion

It is clear from the present work that there is some basic requirements should be

satisfied in order to establish efficient aerial refueling autopilots such as (1- flying qualities

requirements, 2- safety and secured approaching in the final docking, 3- minimization the

whole mission time period) which implies that a multistage autopilot is needed for this

purpose. Therefore LQR technique was used to satisfy the flying qualities, providing

control integration with fuzzy logic controller that enhance the output performance index.

Page 170: Air Refueling Autopilot, (My First Book)

148

Applying an optimal trajectory during the tracking stage had a great effect in minimizing

the total mission time. Using flight formation principle in last stage (alignment stage) had

satisfied the required tanker geometrical constrains mentioned before. Thus a multistage

autopilot could be realized in such described sequence verifying the safety and security

with minimizing the mission time interval that permit several aircrafts to be refueled in

such an optimum time period. In this way it is possible to avoid the any mishaps from the

pilots during manual process.

8.6 Recommended Future Work

It is recommended to apply the final multistage autopilot for a several aircrafts or a

complete squadron to optimize the air refueling process time for a number of aircrafts so

that decrease the time required for the tanker aircraft to fly especially in the operations

time. Consequently reducing the time needed for the fighter aircrafts to be refueled thus

decreasing the time to be exposed to any aggressors. This will require also different

guidance laws according to the aircraft position with central controller installed in the

tanker aircraft.

Page 171: Air Refueling Autopilot, (My First Book)

149

REFERENCES

[1] Song, J.M. and Zhang, T.Q. “Passive homing missile’s variable structure proportional

navigation with terminal angular constraint” Aeronaut vol.14, pp.83-87, 2001

[2] Chio, J.Y. and Chaw, D.K. “Nonlinear adaptive guidance considering target

uncertainties and control loop dynamics” IEEE Trans.,vol. 1 pp.506-511, 2001

[3] Innocenti, M. “nonlinear guidance technique for agile missiles” Control Eng.,vol 9, pp.

1131-1144, 2001

[4] Anderson, M.B. and Burkhalter, J.E. “Design of a guided missile interceptor using a

genetic algorithm” Spacecr Rockets ,vol 38, pp.28-35, 2001

[5] Zhou, Di and Mu. Chundi “Motion tracking sliding mode guidance of a homing

missile with bearings-only measurements” Trans Jpn Soc Aeronaut Space Sci, vol. 43,pp.

130-136, 2000

[6] Narendra K. S. and Parthasarathy K., ”Identification and control of dynamical

systems using neural networks,”IEEE Trans. Neural Networks,vol. 1,pp.4-27, 1990.

[7] Park Y. M., Choi M. S., and Lee K. Y., ”An optimal tracking neuro-controller for

nonlinear dynamic systems,” IEEE Trans. Neural Networks,vol. 7,pp. 1099-1110, 1996.

[8] Hamdy A., and El Desoky S., ” Development of the preliminary design of the missile

command guidance and testing “ Thesis, 1997

[9] Ku C. C. and Lee K. Y.,”Diagonal recurrent neural networks for dynamic systems

control, ” IEEE Trans. Neural Networks,vol. 6,pp.144-156, 1995.

[10] Brdys M. A. and Kulawski G. J., ”Dynamic neural controllers for induction motor,”

IEEE Trans. Neural Networks, vol. 10,pp. 340-355, 1999.

[11] Widrow B., Hoff M.E., ”Adaptive switching circuits,”1960 IRE WESCON convention

Record, New York: IRE Part 4, pp. 96-104, 1960.

[12] Rosenblatt F., ”The perceptron: A probabilistic model for information storage and

organization in the brain,” Psychological Review, vol. 65, pp. 386-408, 1958.

[13] Minsky M. and Papert S., Perceptrons, Cambridge, MA: MIT Press, 1969.

[14] Kohonen T., ”Correlation matrix memories,” IEEE Transactions on Computers, vol.

21, pp. 353-359, 1972.

Page 172: Air Refueling Autopilot, (My First Book)

150

[15] Hopfield J. J., ”Neural networks and physical systems with emergent collective

computational properties, ” Proceedings of the National Academy of Science, vol. 79, pp.

2554-2558,1982.

[16] Rumelhart D. E., Hinton G. E. and Williams R. J., ”Learning representations by

back- propagating errors,” Nature, vol. 323, pp. 533-536,1986.

[17] Chow T. W. S. and Fang Y.,”A recurrent neural-network-based real-time learning

control strategy applying to nonlinear systems with unknown dynamics,” IEEE Trans.

Indust. Electron., vol. 45,pp. 151-161,1998.

[18] Takagi T. and Sugeno M., “Fuzzy identification of systems and its applications to

modeling and control,” IEEE Tans, Syst., Man, Cybern., vol. 15, pp. 116-132, 1985.

[19] Sugeno M. and Yasukawa T.,”A fuzzy-logic-based approach to qualitative

modeling,” IEEE Trans. Fuzzy Syst., vol. 1, pp. 7-31, 1993.

[20] Wang L. X., Adaptive Fuzzy System and control: Design and Stability Analysis.

Englewood Cliffs, NJ: Prentice-Hall, 1994.

[21] Dickerson J. A. and Kosko B., ”Fuzzy function approximation with ellipsoidal rules,”

IEEE Trans. Syst., Man, Cybern., vol. 24, pp. 542-560, 1996.

[22] Cherkassky V., Gehring D., and Mulier F., “Comparison of adaptive methods for

function estimation from samples,” IEEE Trans. Neural Networks, Vol. 7, pp. 969-984,

1996.

[23] Chen S. and billings S. A., “Neural networks for nonlinear dynamic system modeling

and identification,” Int. J. Control, vol.56, pp. 319-346, 1992.

[24] Choi J., VanLandingham H. F., and Bingulac S., “ A constructive approach for

nonlinear system identification using multilayer perceptrons,” IEEE Trans. Syst., Man,

Cybern. B, vol. 26, pp. 307-312, Apr 1996.

[25] Mendel J. M. and Mouzouris G. C.,”Designing fuzzy logic systems,” IEEE Trans.

Circuits Syst., vol. 44, pp. 885-895, Nov. 1997.

[26] Sugeno M., “Theory of Fuzzy Integrals and Its Applications,” Doctoral Thesis,

Tokyo Institute of Technology, 1974.

[27] Adlassnig K. P., “Fuzzy set theory in medical diagnosis, “IEEE Trans. Syst., Man,

Cybern., vol. 16, pp, pp. 260-265, 1986.

Page 173: Air Refueling Autopilot, (My First Book)

151

[28] Menon P. K. and Iragavarapu V. R., “Blended Homing Guidance Law Using Fuzzy

Logic,” Optimal Synthesis Inc., 1998

[29] Lu-Ping Tsao and Ching-Shaow Lin, “A new optimal guidance law for short-range

homing missiles,” Department of system engineering, Taiwan, R.O.C., 2000

[30] Narendra K. S. and Parthasarathy K., ”Identification and control of dynamical

systems using neural networks, ”IEEE Trans. Neural Networks, vol. 1, pp.4-27, 1990.

[31] Ku C. C. and Lee K. Y., ”Diagonal recurrent neural networks for dynamic systems

control, ” IEEE Trans. Neural Networks, vol. 6, pp.44-156, 1995.

[32] Takagi T. and Sugeno M., “Fuzzy identification of systems and its applications to

modeling and control,” IEEE Tans, Syst., Man, Cybern., vol. 15, pp. 116-132, 1985.

[33] Menon P. K. and Iragavarapu V. R., “Blended Homing Guidance Law Using Fuzzy

Logic,” Optimal Synthesis Inc., 1998

[34] Lu-Ping Tsao and Ching-Shaow Lin, “A new optimal guidance law for short-range

homing missiles, ” Department of system engineering, Taiwan, R.O.C., 2000

[35] Stevens, B. L., Lewis, F.L., & Al-Sunni, F. (1991). Aircraft flight controls

design using output feedback. Journal of Guidance, Control, and Dynamics.

[36] Sugeno M. and Yasukawa T.,”A fuzzy-logic-based approach to qualitative

modeling,” IEEE Trans. Fuzzy Syst., vol. 1, pp. 7-31, 1993.

[37] Mendel J. M. and Mouzouris G. C.,”Designing fuzzy logic systems,” IEEE

Trans.Circuits Syst., vol. 44, pp. 885-895, Nov. 1997.

[38] Flying Qualities of Piloted Airplanes, MIL-F-8785C, 5 Nov. 1980.

[39] M.L. Fravolini, A. Ficola, M. R. Napolitano, G. Campa, M. G.

Perhinschi ”Development of Modeling and Control Tools for Aerial Refueling for

UAVs” Perugia University, 06100 Perugia, Ital,2000

[40] Zadeh, L. A, “Fuzzy Sets”, Information and Control, Vol. 8, 1965, pp. 338-353.

[41] Takagi, T. and Sugeno, M., “Fuzzy Identification of Systems and its Application to

Modeling and Control”, IEEE Transactions on Systems, Man and Cybernetics, Vol. 15,

1985.

[42] Goldberg, D., Genetic Algorithms in Search, Optimization & Machine Learning,

Addison Wesley Longman, Inc.,1989.

Page 174: Air Refueling Autopilot, (My First Book)

152

[43] Teo, L.S., Bin Khalid, M., and Yusof, R., “Tuning of a Neuro-Fuzzy Controller by

Genetic Algorithm”, IEEE Transactions on Systems, Man and Cybernetics, Part B, Vol. 29,

Issue 2, 1999, pp. 226 -236

[44] Mamdani, E.H. and Assilian, A., “An Experiment in Linguistic Synthesis with a

Fuzzy Logic Controller”, International Journal of Man Machine Studies, Vol. 7, No. 1,

1975, pp. 1-13.

[45] Stevens, B. L., Lewis, F.L., & Al-Sunni, F. (1991). Aircraft flight controls design

using output feedback. Journal of Guidance, Control, and Dynamics

[46] Stevens, B. L., Lewis, F.L. (1992). Aircraft Control And Simulation. New York: John

Wiley & Sons, Inc.

[47] Flying Qualities of Piloted Airplanes, MIL-F-8785C, 5 Nov. 1980.

[48] Meir Pachter, John J. D’Azzo, and Andrew W. Proud, “Tight Formation Flight

Control,” Journal of Guidance, Control, and Dynamics, Vol. 24, No. 2, March-April 2001,

pp. 246-254.

[49] Fabrizio Giulietti, Lorenzo Pollini, and Mario Innocenti, “Autonomous Formation

Flight,” IEEE Control Systems Magazine, Vol. 20, No. 6, pp. 34-44, Dec. 2000.

[50] Meir Pachter, John J. D’Azzo, and J. L. Dargan, “Automatic Formation Flight

Control,” Journal of Guidance, Control, and Dynamics, Vol. 17, No. 6, 1994, pp. 1380-

1383.

[51] Paolo Binetti, Kartik B. Ariyur, Miroslav Krstic and Franco Bernelli, “Control of

Formation Flight via Extremum Seeking,” Proceedings of the America Control

Conference, Anchorage, 2002.

[52] Fabrizio Giulietti, Lorenzo Pollini, and Mario Innocenti, “Formation Flight control:

A Behavioral Approach,” AIAA Paper 2001-4239, Proceedings of the AIAA Guidance,

Navigation, and Control Conference and Exhibit, August 2001, Montreal.

[53] Eugene Lavretsky, “F/A-18 Autonomous Formation Flight Control System Design,”

AIAA Paper 2002-4757, Proceedings of the AIAA Guidance, Navigation, and Control

Conference and Exhibit, August 2002, Monterey, California.

[54] Blake, William and Dieter Multhopp, "Design,Performance, and Modeling

Considerations for Close Formation Flight," Proceedings of the 1999 AIAA Guidance,

Page 175: Air Refueling Autopilot, (My First Book)

153

Navigation and Control Conference, Portland, OR, August 9-11, 1999, AIAA paper No

99-4343.

[55] Pachter, M., J.Dargan, J. J. D’Azzo, "Automatic Formation Flight Control," AIAA

Journal of Guidance, Control and Dynamics, Vol 17, No 6, Nov-Dec 1994, pp 1380-1383.

[56] Pachter, Meir, Andrew W. Proud, and J. J. D’Azzo "Close Formation Flight

Control," Proceedings of the 1999 AIAA Guidance, Navigation and Control Conference,

Portland, OR, August 9-11, 1999, AIAA paper No 99-4112

Page 176: Air Refueling Autopilot, (My First Book)

154

Appendix A

Matlab Codes

A1. Lateral Stability Regulator LQR

A2. LQ Tracker for Normal Acceleration (G) Control

A3. LQ Tracker for Pitch Motion Control

A4. Normal Acceleration CAS Tracker Weighted Time

A5. Genetic Algorithms For (f1, f2, f3) Optimization (Membership Function

Optimization)

A6. Fuzzy Logic Controller (called by A5)

A7. Genetic Algorithms For (PK , iK , dK ) Optimization (Fuzzy Logic Controller

Output Gain Optimization)

A8. Newton Raphson Method for Calculating the time required for the second stage

(using Optimal Guidance Law) (XY Direction)

A9. Newton Raphson Method for Calculating the time required for the second stage

(using Optimal Guidance Law) (XZ Direction)

A10. Fuzzy Logic Controller rules with optimum firing strength

Page 177: Air Refueling Autopilot, (My First Book)

155

%A1. Lateral stability Regulator A=[-.3220 .0640 .0364 -.9917 .0003 .0008 0;0 0 1 .0037 0 0 0;-30.6492 0 -3.6784 .6646 -.7333 0.1315 0;8.5396 0 -.0254 -.4764 -0.0319 -0.0620 0;0 0 0 0 -20.2 0 0;0 0 0 0 0 -20.2 0;0 0 0 57.2958 0 0 -1] B=[0 0; 0 0;0 0;0 0;20.2 0;0 20.2;0 0] C=[0 0 0 57.2958 0 0 -1; 0 0 57.2958 0 0 0 0;57.2958 0 0 0 0 0 0;0 57.2958 0 0 0 0 0] Q=[50 0 0 0 0 0 0;0 100 0 0 0 0 0;0 0 100 0 0 0 0;0 0 0 50 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 1] R=.1*eye(2) K0=[0 0 0.11 -.35;-1 -.21 -.44 .26] X=eye(7) t1=K0*C t2=B*t1 A0=A-t2 t3=C'*K0'*R*K0*C+Q P0=lyap(A0',t3) S0=lyap(A0,X) t4=(C*S0*C') t5= inv(t4) K1=inv(R)*B'*P0*S0*C'*t5 dK=K1-K0 K2=K1+1*dK A1=A-B*K2*C t3=C'*K2'*R*K2*C+Q P1=lyap(A1',t3) S1=lyap(A1,X) t4=(C*S1*C') t5= inv(t4) K2=inv(R)*B'*P1*S1*C'*t5 e1=eig(A1) dK=K2-K1 K3=K2-.1*dK A2=A-B*K3*C t3=C'*K3'*R*K3*C+Q P2=lyap(A2',t3) S2=lyap(A2,X) t4=(C*S2*C') t5= inv(t4) K3=inv(R)*B'*P2*S2*C'*t5 e2=eig(A2) dK=K3-K2 K4=K3-.5*dK A3=A-B*K4*C t3=C'*K4'*R*K4*C+Q P3=lyap(A3',t3) S3=lyap(A3,X)

Page 178: Air Refueling Autopilot, (My First Book)

156

t4=(C*S3*C') t5= inv(t4) K4=inv(R)*B'*P3*S3*C'*t5

e3=eig(A3)

dK=K4-K3 K5=K4-.2*dK A4=A-B*K5*C t3=C'*K5'*R*K5*C+Q P4=lyap(A4',t3) S4=lyap(A4,X) t4=(C*S4*C') t5= inv(t4) K5=inv(R)*B'*P4*S4*C'*t5

e4=eig(A4)

dK=K5-K4 K6=K5-.5*dK A5=A-B*K6*C t3=C'*K6'*R*K6*C+Q P5=lyap(A5',t3) S5=lyap(A5,X) t4=(C*S5*C') t5= inv(t4) K6=inv(R)*B'*P5*S5*C'*t5

e5=eig(A5)

dK=K6-K5 K7=K6-1*dK A6=A-B*K7*C t3=C'*K7'*R*K7*C+Q P6=lyap(A6',t3) S6=lyap(A6,X) t4=(C*S6*C') t5= inv(t4) K7=inv(R)*B'*P6*S6*C'*t5

e6=eig(A6)

dK=K7-K6 K8=K7-1*dK A7=A-B*K8*C t3=C'*K8'*R*K8*C+Q P7=lyap(A7',t3) S7=lyap(A7,X) t4=(C*S7*C') t5= inv(t4) K8=inv(R)*B'*P7*S7*C'*t5

e7=eig(A7)

Page 179: Air Refueling Autopilot, (My First Book)

157

dK=K8-K7 K9=K8-1.2*dK A8=A-B*K9*C t3=C'*K9'*R*K9*C+Q P8=lyap(A8',t3) S8=lyap(A8,X) t4=(C*S8*C') t5= inv(t4) K9=inv(R)*B'*P8*S8*C'*t5 e8=eig(A8) dK=K9-K8 K10=K9-2*dK A9=A-B*K10*C t3=C'*K10'*R*K10*C+Q P9=lyap(A9',t3) S9=lyap(A9,X) t4=(C*S9*C') t5= inv(t4) K10=inv(R)*B'*P9*S9*C'*t5 e9=eig(A9) [v,d]=eig(A9) e=eig(A0) J1=.5*trace(P1*X) J2=.5*trace(P2*X) J3=.5*trace(P3*X) J4=.5*trace(P4*X) J5=.5*trace(P5*X) J6=.5*trace(P6*X) J7=.5*trace(P7*X) J8=.5*trace(P8*X) J9=.5*trace(P9*X) B1=[0 0;0 0;0 0;0 0;0 0;0 0;0 0] C1=[0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0] D=[0 0;0 0;0 0;0 0] sys0=ss(A1,B1,C,D) sys1=ss(A5,B1,C,D) sys2=ss(A4,B1,C,D) damp(sys) initial(sys2,sys1,sys0,[1 0 0 0 0 0 0]);

Page 180: Air Refueling Autopilot, (My First Book)

158

%A2. LQ Tracker for Normal G control A=[-1.01887 .90506 -.00215 0 0;-2.4977 -1.3859 -.17555 0 0;0 0 -20.0 0 0;10 0 0 -10 0;-16.26 -.9788 .04852 0 0] B=[0; 0; 20.2; 0; 0] G=[0; 0; 0; 0; 1] C=[0 0 0 57.2958 0;0 57.2958 0 0 0;-16.26 -.9788 .04852 0 0;0 0 0 0 1] F=[0; 0; 1; 0] H=[16.26 .9788 -.04852 0 0] Q=[264 16 1 0 0;16 60 0 0 0;1 0 0 0 0;0 0 0 0 0;0 0 0 0 100] R=.01*eye(1) V=502*eye(1)

K=[0 -.53 10 5]

Ac0=A-B*K*C Bc0=G-B*K*F X=eye(5) t1=Q+C'*K'*R*K*C P0=lyap(Ac0',t1) S0=lyap(Ac0,X) r0=1 x=-inv(Ac0)*Bc0*r0 y=C*x+F*r0 X=inv(Ac0)*Bc0*r0*r0'*Bc0'*(inv(Ac0))' t2=B'*P0*S0*C'-B'*(inv(Ac0))'*(P0+H'*V*H)*x*y'+B'*(inv(Ac0))'*H'*V*r0*y' t3=inv(C*S0*C') K1=inv(R)*t2*t3 ei0=eig(Ac0) e0=(eye(1)+H*inv(Ac0)*Bc0)*r0 dK=K1-K

K1=K1-1*dK Ac1=A-B*K1*C Bc1=G-B*K1*F X=eye(5) t1=Q+C'*K1'*R*K1*C P1=lyap(Ac1',t1) S1=lyap(Ac1,X) r0=1 x=-inv(Ac1)*Bc1*r0 y=C*x+F*r0 X=inv(Ac1)*Bc1*r0*r0'*Bc1'*(inv(Ac1))' t2=B'*P1*S1*C'-B'*(inv(Ac1))'*(P1+H'*V*H)*x*y'+B'*(inv(Ac1))'*H'*V*r0*y'

Page 181: Air Refueling Autopilot, (My First Book)

159

t3=inv(C*S1*C') K2=inv(R)*t2*t3 dK=K2-K1 ei1=eig(Ac1) e1=(eye(1)+H*inv(Ac1)*Bc1)*r0 K2=K2-.5*dK Ac2=A-B*K2*C Bc2=G-B*K2*F X=eye(5) t1=Q+C'*K2'*R*K2*C P2=lyap(Ac2',t1) S2=lyap(Ac2,X) r0=1 x=-inv(Ac2)*Bc2*r0 y=C*x+F*r0 X=inv(Ac2)*Bc2*r0*r0'*Bc2'*(inv(Ac2))' t2=B'*P2*S2*C'-B'*(inv(Ac2))'*(P2+H'*V*H)*x*y'+B'*(inv(Ac2))'*H'*V*r0*y' t3=inv(C*S2*C') K3=inv(R)*t2*t3 dK=K3-K2 ei2=eig(Ac2) e2=(eye(1)+H*inv(Ac2)*Bc2)*r0 K3=K3-.1*dK Ac3=A-B*K3*C Bc3=G-B*K3*F X=eye(5) t1=Q+C'*K3'*R*K3*C P3=lyap(Ac3',t1) S3=lyap(Ac3,X) r0=1 x=-inv(Ac3)*Bc3*r0 y=C*x+F*r0 X=inv(Ac3)*Bc3*r0*r0'*Bc3'*(inv(Ac3))' t2=B'*P3*S3*C'-B'*(inv(Ac3))'*(P3+H'*V*H)*x*y'+B'*(inv(Ac3))'*H'*V*r0*y' t3=inv(C*S3*C') K4=inv(R)*t2*t3 dK=K4-K3 ei3=eig(Ac3) e3=(eye(1)+H*inv(Ac3)*Bc3)*r0 j0=.5*trace(P0*X)+.5*e0'*V*e0 j1=.5*trace(P1*X)+.5*e1'*V*e1 j2=.5*trace(P2*X)+.5*e2'*V*e2 j3=.5*trace(P3*X)+.5*e3'*V*e3 D=[0] sys=ss(Ac0,Bc0,H,D) sys0=ss(Ac3,Bc3,H,D) sys1=ss(Ac2,Bc2,H,D) figure (1)

Page 182: Air Refueling Autopilot, (My First Book)

160

step(sys) figure (2) step(sys0,sys)

%A3. LQ Tracker for Pich Motion Control A=[-1.01887 .90506 -.00215 0 0;.82225 -1.07741 -.17555 0 0;0 0 -20.0 0 0;10 0 0 -10 0;0 -57.2958 0 0 0] B=[0; 0; 20.2; 0; 0] G=[0; 0; 0; 0; 1] C=[0 0 0 57.2958 0;0 57.2958 0 0 0;0 0 0 0 1] F=[0; 0; 0] H=[0 57.2958 0 0 0] Q=[264 16 1 0 0;16 60 0 0 0;1 0 0 0 0;0 0 0 0 0;0 0 0 0 100] R=1.5*eye(1) V=502*eye(1) K=[0 -.5 2] Ac0=A-B*K*C Bc0=G-B*K*F X=eye(5) t1=Q+C'*K'*R*K*C P0=lyap(Ac0',t1) S0=lyap(Ac0,X) r0=1 x=-inv(Ac0)*Bc0*r0 y=C*x+F*r0 X=inv(Ac0)*Bc0*r0*r0'*Bc0'*(inv(Ac0))' t2=B'*P0*S0*C'-B'*(inv(Ac0))'*(P0+H'*V*H)*x*y'+B'*(inv(Ac0))'*H'*V*r0*y' t3=inv(C*S0*C') K1=inv(R)*t2*t3 ei0=eig(Ac0) e0=(eye(1)+H*inv(Ac0)*Bc0)*r0 dK=K1-K K1=K1-1*dK Ac1=A-B*K1*C Bc1=G-B*K1*F X=eye(5) t1=Q+C'*K1'*R*K1*C P1=lyap(Ac1',t1) S1=lyap(Ac1,X) r0=1 x=-inv(Ac1)*Bc1*r0

Page 183: Air Refueling Autopilot, (My First Book)

161

y=C*x+F*r0 X=inv(Ac1)*Bc1*r0*r0'*Bc1'*(inv(Ac1))' t2=B'*P1*S1*C'-B'*(inv(Ac1))'*(P1+H'*V*H)*x*y'+B'*(inv(Ac1))'*H'*V*r0*y' t3=inv(C*S1*C') K2=inv(R)*t2*t3 dK=K2-K1 ei1=eig(Ac1) e1=(eye(1)+H*inv(Ac1)*Bc1)*r0 K2=K2-.5*dK Ac2=A-B*K2*C Bc2=G-B*K2*F X=eye(5) t1=Q+C'*K2'*R*K2*C P2=lyap(Ac2',t1) S2=lyap(Ac2,X) r0=1 x=-inv(Ac2)*Bc2*r0 y=C*x+F*r0 X=inv(Ac2)*Bc2*r0*r0'*Bc2'*(inv(Ac2))' t2=B'*P2*S2*C'-B'*(inv(Ac2))'*(P2+H'*V*H)*x*y'+B'*(inv(Ac2))'*H'*V*r0*y' t3=inv(C*S2*C') K3=inv(R)*t2*t3 dK=K3-K2 ei2=eig(Ac2) e2=(eye(1)+H*inv(Ac2)*Bc2)*r0 K3=K3-.1*dK Ac3=A-B*K3*C Bc3=G-B*K3*F X=eye(5) t1=Q+C'*K3'*R*K3*C P3=lyap(Ac3',t1) S3=lyap(Ac3,X) r0=1 x=-inv(Ac3)*Bc3*r0 y=C*x+F*r0 X=inv(Ac3)*Bc3*r0*r0'*Bc3'*(inv(Ac3))' t2=B'*P3*S3*C'-B'*(inv(Ac3))'*(P3+H'*V*H)*x*y'+B'*(inv(Ac3))'*H'*V*r0*y' t3=inv(C*S3*C') K4=inv(R)*t2*t3 dK=K4-K3 ei3=eig(Ac3) e3=(eye(1)+H*inv(Ac3)*Bc3)*r0 j0=.5*trace(P0*X)+.5*e0'*V*e0 j1=.5*trace(P1*X)+.5*e1'*V*e1 j2=.5*trace(P2*X)+.5*e2'*V*e2 j3=.5*trace(P3*X)+.5*e3'*V*e3 D=[0] sys=ss(Ac0,Bc0,H,D)

Page 184: Air Refueling Autopilot, (My First Book)

162

sys0=ss(Ac3,Bc3,H,D) sys1=ss(Ac2,Bc2,H,D) figure (1) step(sys) figure (2) step(sys0,sys1)

%A4. Normal Acceleration CAS TRacker Weighted time close all clear all %in this file the matrices A B C D are from the book Page 387 global Ao;global Bo;global Co;global Do;global Fo;global Go;global Ho; Ao=[-1.01887 0.90506 -0.00215 0 0;0.82225 -1.07741 -0.17555 0 0; 0 0 -20.2 0 0;10 0 0 -10 0; -16.26 -0.9788 0.04852 0 0 ]; Bo=[0 ; 0;20.2 ;0 ; 0]; Co=[0 0 0 57.2958 0; 0 57.2958 0 0 0;-16.26 -0.9788 0.04852 0 0 ; 0 0 0 0 1]; Fo=[0;0;1;0]; Do=Fo; Go=[0;0;0;0;1]; Ho=[16.26 0.9788 -0.04852 0 0 ]; %initial gain matrix K0=Init_Gain(Ao,Bo,Co,-2,2); %K0=[-0.847 -0.452 1.647 8.602]; %assumed Q used for output feedback design %Q=[264 16 1 0 0;16 60 0 0 0; 1 0 0 0 0;0 0 0 0 0;0 0 0 0 100]; %Uk(1,:)=[0.006 -0.152 1.17 0.996]; %0.03651433971552 from the book %Uk(2,:)=[-1.629 -1.316 18.56 77.6]; %0.03651433971552 from the book %Uk(1,:)=[-0.847 -0.452 1.647 8.602]; %0.03651433971552 from the book Uk(1,:)=[0 0 1 0]; % open loop response, when a unity gain is applied in the proportional feedforward path options = optimset('MaxFunEvals',10000000,'TolFun',1e-8,'Display','final','MaxIter',100000,'GradObj','on'); [Uk(2,:),Jmin]=fminunc(@lqrytracktime,K0,options);

Page 185: Air Refueling Autopilot, (My First Book)

163

Uk Ukn=size(Uk,1); %creating closed loop state space for tracker for(i=1:1:Ukn) Ac=Ao-Bo*Uk(i,:)*Co; Bc=Go-Bo*Uk(i,:)*Fo; Cc=Ho; %so that the output from the new closed loop tracker is the performance output z = Hx Dc=0; sys=ss(Ac,Bc,Cc,Dc,'statename',{'Alpha' 'q' 'de' 'AlphaF' 'epsilon' },'inputname',{'reference I/P' },'outputname',{'Perf. O/P z (norm acc)'}); ro=1; t=[0:0.01:10]'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% x0=[0 0 0 0 0]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% u=[0*t+ro]; [z(:,i),tout,x]=lsim(sys,u,t,x0); end figure('Name','perf. O/P (Norm Acc nz)') plot(tout,z(:,:));grid on; % color order: blue,green,red,cyan

function [Ko]=Init_Gain(A,B,C,a,b) Sflag=0; while(Sflag<size(A,1)) Sflag=0; Kv= a + (b-a) * rand(size(B,2),size(C,1)); %size= #ofinputs*#of outputs Ac=A-B*Kv*C; Ev=eig(Ac); for(i=1:1:length(Ev)) if (Ev(i,1)<0) Sflag=Sflag+1;end end end Ko= Kv ; function [f,g]=lqrytracktime(K) %Ao,Bo,Co,Do are the state space matrices for the open loop system, %Q is weighting matrices, r and v are multipliers for the R and V matrices

Page 186: Air Refueling Autopilot, (My First Book)

164

%rho used in PI for weighting steady state error, r0 required reference input %K initial gain matrix, H performance output matrix z=Hx

global Ao;global Bo;global Co;global Do;global Fo;global Go;global Ho;

r=.005; kn=2; %t^kn as kn increases the response is relaxed more(slower response) ro=1; R=eye(1)*r;%assumed R used for output feedback LQR design Q=0;

%'Optimizing, Please wait...'

Ac=Ao-Bo*K*Co; Bc=Go-Bo*K*Do; xbar=-1*inv(Ac)*Bc*ro; ybar=Co*xbar + Do*ro; X=xbar*xbar';

Pki=Ho'*Ho; Pk(:,:,1)=lyap(Ac',Pki); for(i=2:1:kn)

Pk(:,:,i)=lyap(Ac',Pk(:,:,i-1)); end Q=0; Pk(:,:,kn+1)=lyap(Ac',(Co'*K'*R*K*Co + Q +

Pk(:,:,kn)*factorial(kn)));

Sk(:,:,kn+1)=lyap(Ac,X); Sk(:,:,kn)=lyap(Ac,Sk(:,:,kn+1)*factorial(kn)); for(i=kn-1:-1:1)

Sk(:,:,i)=lyap(Ac,Sk(:,:,i+1)); end

%Sk*Pk PkSk=0; for(i=1:1:kn+1)

PkSk=PkSk+Pk(:,:,i)*Sk(:,:,i); end

%Performance Index

f=0.5*trace(Pk(:,:,kn+1)*X);

%Gradient dJ/dK g=R*K*Co*Sk(:,:,kn+1)*Co' - Bo'*PkSk*Co' + Bo'*((inv(Ac))')*Pk(:,:,kn+1)*xbar*ybar';

Page 187: Air Refueling Autopilot, (My First Book)

165

%A5. Genetic Algorithm for function f(f1,f2,f3) optimization (membership function optimization) %Genetic Algorithm for function f(x1,x2,x3) optimization %Parameters Size=5 G=2 CodeL=10; umax1=1.2; umin1=.9; umax2=1.2; umin2=.9; umax3=1.7; umin3=1.3; E=round(rand(Size,3*CodeL)); %Initial Code %Main Program for k=1:1:G time(k)=k; for s=1:1:Size m=E(s,:); y1=0;y2=0;y3=0; %Uncoding m1=m(1:1:CodeL); for i=1:1:CodeL y1=y1+m1(i)*2^(i-1); end x1=(umax1-umin1)*y1/1023+umin1; m2=m(CodeL+1:1:2*CodeL); for i=1:1:CodeL y2=y2+m2(i)*2^(i-1); end x2=(umax2-umin2)*y2/1023+umin2; m3=m(2*CodeL+1:1:3*CodeL); for i=1:1:CodeL y3=y3+m3(i)*2^(i-1); end x3=(umax3-umin3)*y3/1023+umin3; f1=x1; f2=x2; f3=x3; fuzzy_controller_genetic

Page 188: Air Refueling Autopilot, (My First Book)

166

sim ('F16block_pitch_contr_fuzzyPD' , [0 5]); h(s)=PI(5001) F(s)=1/h(s)

end

Ji=1./(F+1e-10); %****** Step 1 : Evaluate BestJ ****** BestJ(k)=min(Ji);

fi=F; %Fitness Function [Oderfi,Indexfi]=sort(fi); %Arranging fi small to bigger Bestfi=Oderfi(Size); %Let Bestfi=max(fi) BestS=E(Indexfi(Size),:); %Let BestS=E(m), m is the Indexfi belong to max(fi) bfi(k)=Bestfi;

%****** Step 2 : Select and Reproduct Operation****** fi_sum=sum(fi); fi_Size=(Oderfi/fi_sum)*Size;

fi_S=floor(fi_Size); %Selecting Bigger fi value

kk=1; for i=1:1:Size

for j=1:1:fi_S(i) %Select and Reproduce TempE(kk,:)=E(Indexfi(i),:); kk=kk+1; %kk is used to reproduce

end end

%************ Step 3 : Crossover Operation ************ pc=0.60; n=ceil(30*rand); for i=1:2:(Size-1)

temp=rand; if pc>temp %Crossover Condition for j=n:1:30

TempE(i,j)=E(i+1,j); TempE(i+1,j)=E(i,j);

end end

end TempE(Size,:)=BestS; E=TempE;

%************ Step 4: Mutation Operation ************** %pm=0.001; %pm=0.001-[1:1:Size]*(0.001)/Size; %Bigger fi, smaller Pm %pm=0.0; %No mutation pm=0.1; %Big mutation

for i=1:1:Size for j=1:1:3*CodeL

Page 189: Air Refueling Autopilot, (My First Book)

167

temp=rand; if pm>temp %Mutation Condition if TempE(i,j)==0 TempE(i,j)=1; else TempE(i,j)=0; end end end end %Guarantee TempPop(30,:) is the code belong to the best individual(max(fi)) TempE(Size,:)=BestS; E=TempE; end Max_Value=Bestfi BestS x1 x2 x3 figure(1); plot(time,BestJ); xlabel('Times');ylabel('Best J'); figure(2); plot(time,bfi); xlabel('times');ylabel('Best F');

Page 190: Air Refueling Autopilot, (My First Book)

168

%A6. Fuzzy Controller Design

a=newfis('fuzzf');

a=addvar(a,'input','e',[-3*f1,3*f1]); %Parameter e a=addmf(a,'input',1,'NB','zmf',[-3*f1,-1*f1]); a=addmf(a,'input',1,'NM','trimf',[-3*f1,-2*f1,0]); a=addmf(a,'input',1,'NS','trimf',[-3*f1,-1*f1,1*f1]); a=addmf(a,'input',1,'Z','trimf',[-2*f1,0,2*f1]); a=addmf(a,'input',1,'PS','trimf',[-1*f1,1*f1,3*f1]); a=addmf(a,'input',1,'PM','trimf',[0,2*f1,3*f1]); a=addmf(a,'input',1,'PB','smf',[1*f1,3*f1]);

a=addvar(a,'input','ec',[-3*f2,3*f2]); %Parameter ec a=addmf(a,'input',2,'NB','zmf',[-3*f2,-1*f2]); a=addmf(a,'input',2,'NM','trimf',[-3*f2,-2*f2,0]); a=addmf(a,'input',2,'NS','trimf',[-3*f2,-1*f2,1*f2]); a=addmf(a,'input',2,'Z','trimf',[-2*f2,0,2*f2]); a=addmf(a,'input',2,'PS','trimf',[-1*f2,1*f2,3*f2]); a=addmf(a,'input',2,'PM','trimf',[0,2*f2,3*f2]); a=addmf(a,'input',2,'PB','smf',[1*f2,3*f2]);

a=addvar(a,'output','u',[-3*f3,3*f3]); %Parameter u a=addmf(a,'output',1,'NB','zmf',[-3*f3,-1*f3]); a=addmf(a,'output',1,'NM','trimf',[-3*f3,-2*f3,0]); a=addmf(a,'output',1,'NS','trimf',[-3*f3,-1*f3,1*f3]); a=addmf(a,'output',1,'Z','trimf',[-2*f3,0,2*f3]); a=addmf(a,'output',1,'PS','trimf',[-1*f3,1*f3,3*f3]); a=addmf(a,'output',1,'PM','trimf',[0,2*f3,3*f3]); a=addmf(a,'output',1,'PB','smf',[1*f3,3*f3]);

rulelist=[1 1 1 1 1; %Edit rule base 1 2 1 1 1; 1 3 2 1 1; 1 4 2 1 1; 1 5 3 1 1; 1 6 3 1 1; 1 7 4 1 1;

2 1 1 1 1; 2 2 2 1 1; 2 3 2 1 1; 2 4 3 1 1; 2 5 3 1 1; 2 6 4 1 1; 2 7 5 1 1;

3 1 2 1 1; 3 2 2 1 1; 3 3 3 1 1; 3 4 3 1 1;

Page 191: Air Refueling Autopilot, (My First Book)

169

3 5 4 1 1; 3 6 5 1 1; 3 7 5 1 1; 4 1 2 1 1; 4 2 3 1 1; 4 3 3 1 1; 4 4 4 1 1; 4 5 5 1 1; 4 6 5 1 1; 4 7 6 1 1; 5 1 3 1 1; 5 2 3 1 1; 5 3 4 1 1; 5 4 5 1 1; 5 5 5 1 1; 5 6 6 1 1; 5 7 6 1 1; 6 1 3 1 1; 6 2 4 1 1; 6 3 5 1 1; 6 4 5 1 1; 6 5 6 1 1; 6 6 6 1 1; 6 7 7 1 1; 7 1 4 1 1; 7 2 5 1 1; 7 3 5 1 1; 7 4 6 1 1; 7 5 6 1 1; 7 6 7 1 1; 7 7 7 1 1]; a=addrule(a,rulelist); %showrule(a) % Show fuzzy rule base a1=setfis(a,'DefuzzMethod','mom'); % Defuzzy writefis(a1,'fuzzf'); % save to fuzzy file "fuzz.fis" which can be % simulated with fuzzy tool a2=readfis('fuzzf'); disp('-------------------------------------------------------'); disp(' fuzzy controller table:e=[-3,+3],ec=[-3,+3] '); disp('-------------------------------------------------------'); Ulist=zeros(7,7); for i=1:7 for j=1:7 e(i)=-4+i; ec(j)=-4+j;

Page 192: Air Refueling Autopilot, (My First Book)

170

Ulist(i,j)=evalfis([e(i),ec(j)],a2); end end

Ulist=ceil(Ulist)

figure(1); plotfis(a2); figure(2); plotmf(a,'input',1); figure(3); plotmf(a,'input',2); figure(4); plotmf(a,'output',1);

Page 193: Air Refueling Autopilot, (My First Book)

171

%A7. Genetic Algorithms For f(PK , iK , dK ) Optimization (Fuzzy Logic

Controller Output Gain Optimization) %Genetic Algorithm for function f(x1,x2,x3) optimization %Parameters Size=20 G=10 CodeL=10; umax1=8; umin1=2; umax2=3; umin2=-3; umax3=3; umin3=-3; E=round(rand(Size,3*CodeL)); %Initial Code %Main Program for k=1:1:G time(k)=k; for s=1:1:Size m=E(s,:); y1=0;y2=0;y3=0; %Uncoding m1=m(1:1:CodeL); for i=1:1:CodeL y1=y1+m1(i)*2^(i-1); end x1=(umax1-umin1)*y1/1023+umin1; m2=m(CodeL+1:1:2*CodeL); for i=1:1:CodeL y2=y2+m2(i)*2^(i-1); end x2=(umax2-umin2)*y2/1023+umin2; m3=m(2*CodeL+1:1:3*CodeL); for i=1:1:CodeL y3=y3+m3(i)*2^(i-1); end x3=(umax3-umin3)*y3/1023+umin3; kp=x1; ki=x2; kd=x3; sim ('F16block_pitch_contr_fuzzynewPID' , [0 5]); h(s)=PI(5001) F(s)=1/h(s) end

Page 194: Air Refueling Autopilot, (My First Book)

172

Ji=1./(F+1e-10); %****** Step 1 : Evaluate BestJ ****** BestJ(k)=min(Ji); fi=F; %Fitness Function [Oderfi,Indexfi]=sort(fi); %Arranging fi small to bigger Bestfi=Oderfi(Size); %Let Bestfi=max(fi) BestS=E(Indexfi(Size),:); %Let BestS=E(m), m is the Indexfi belong to max(fi) bfi(k)=Bestfi; %****** Step 2 : Select and Reproduct Operation****** fi_sum=sum(fi); fi_Size=(Oderfi/fi_sum)*Size; fi_S=floor(fi_Size); %Selecting Bigger fi value kk=1; for i=1:1:Size for j=1:1:fi_S(i) %Select and Reproduce TempE(kk,:)=E(Indexfi(i),:); kk=kk+1; %kk is used to reproduce end end %************ Step 3 : Crossover Operation ************ pc=0.60; n=ceil(30*rand); for i=1:2:(Size-1) temp=rand; if pc>temp %Crossover Condition for j=n:1:30 TempE(i,j)=E(i+1,j); TempE(i+1,j)=E(i,j); end end end TempE(Size,:)=BestS; E=TempE; %************ Step 4: Mutation Operation ************** %pm=0.001; %pm=0.001-[1:1:Size]*(0.001)/Size; %Bigger fi, smaller Pm %pm=0.0; %No mutation pm=0.1; %Big mutation for i=1:1:Size for j=1:1:3*CodeL temp=rand; if pm>temp %Mutation Condition if TempE(i,j)==0 TempE(i,j)=1; else TempE(i,j)=0;

Page 195: Air Refueling Autopilot, (My First Book)

173

end end end end %Guarantee TempPop(30,:) is the code belong to the best individual(max(fi)) TempE(Size,:)=BestS; E=TempE; end Max_Value=Bestfi BestS x1 x2 x3 figure(1); plot(time,BestJ); xlabel('Times');ylabel('Best J'); figure(2); plot(time,bfi); xlabel('times');ylabel('Best F');

Page 196: Air Refueling Autopilot, (My First Book)

174

%A8. Newton Raphson Method for Calculating the time required for the second stage (using Optimal Guidance Law) (XY Direction)

%Newton Raphson Method (Optimal Trajectory XY)

x0 = input(' Input the initial guess value (time required) x0 '); epsilon = input(' Input the tolerance epsilon ');

k=0 x(1)=x0 e=1

while abs(e) > epsilon

k=k+1 f=(((20000+450*x(k))^2+6000*6000)^(0.5))/502-1000/502-x(k) f1=((((20000+450*x(k))^2+6000*6000)^(-0.5))*(20000+450*x(k))*450/502)

-1 x(k+1)=x(k)-f/f1 e=x(k+1)-x(k)

end

fprintf(' The approximating value of the root (tf) is %8.5f\n',x(k+1)); fprintf(' The number of iteration is %d \n',k);

Page 197: Air Refueling Autopilot, (My First Book)

175

%A9. Newton Raphson Method for Calculating the time required for the second stage (using Optimal Guidance Law) (XZ Direction) %Newton Raphson Method (Optimal Trajectory XZ) x0 = input(' Input the initial guess value (time required) x0 '); epsilon = input(' Input the tolerance epsilon '); k=0 x(1)=x0 e=1 while abs(e) > epsilon k=k+1 f=(((20000+450*x(k))^2+6000*6000)^(0.5))/502-1000/502-x(k) f1=((((20000+450*x(k))^2+6000*6000)^(-0.5))*(20000+450*x(k))*450/502) -1 x(k+1)=x(k)-f/f1 e=x(k+1)-x(k) end fprintf(' The approximating value of the root (tf) is %8.5f\n',x(k+1)); fprintf(' The number of iteration is %d \n',k);

Page 198: Air Refueling Autopilot, (My First Book)

176

Appendix B

B1. The overall implementation methodology (Flow chart)

B2. LQ pitch and lateral-directional controller integration (Simulink model)

B3. Proposed transformation for mapping the tanker position to fighter aircraft body

axes (Simulink model)

B4. Proposed transformation subsystem (stage1, stage2) tanker to fighter aircraft

body axes at NED (Simulink model)

B5. LQR Fuzzy logic control integration for pitch motion control (Simulink model)

called by GA A5 and A7

B6. Integrated system for the tracking stage controller utilizing LQR Fuzzy logic

controller integration and proposed transformation with fuzzy logic speed controller

B7. LQRIFL controllers for pitch and lateral aircraft motions

B8. Alignment stage controller (terminal phase) using the principle of the flight

formation control

B9. Complete system description for the aerial refueling autopilot (3 phases design)

Page 199: Air Refueling Autopilot, (My First Book)

177

Publications

1-Ahmed Momtaz, Galal Hassan “Development of a neurofuzzy control

system for the guidance of air to air missiles”, 5th Cairo university

conference in mechanical design and production, Cairo, 2004.

2-Ahmed Momtaz, Han Chao “ LQR integrated with fuzzy logic control

for aerial refueling autopilot” CADDM Journal, Beijing, 2007.

3-Ahmed Momtaz, Han Chao “Design of fighter flight formation for

aerial refueling racetrack mission with drogue-hose configuration”

CADDM Journal, Beijing, 2007.

4-Ahmed Momtaz, Han Chao “Intelligent learning of fuzzy logic

controller via adaptive genetic algorithm applied to aircraft longitudinal

motion” ASAT-12, Military Technical College, Cairo, 2007

5-Ahmed Momtaz, Han Chao “Development of fuzzy logic LQR control

integration for aerial refueling autopilot” ASAT-12, Military Technical

college, Cairo, 2007

Page 200: Air Refueling Autopilot, (My First Book)

Operating point

Alt. Mach

Trimming Algorithm

Linearization Algorithm

State Space Models

LQR Algorithm (SAS)

Gain Matrix Flying Qualities

Verification

Integration with (FLC type PID)

Lateral-Directional motion

GA using different types of PI For both

longitudinal and lateral motions step response

PID parameters Membership Functions

Rule Base Strength

Tracking Controller during Tanker tracking

phase (second stage)

Design 3 stage transformation to map the tanker position to the

receiving A/C wind axes

Optimal Guidance Law algorithm

Alignment stage controller to align the

receiving A/C with the tanker C/L

Total mission time and the final relative errors

Verification 1-Design constrains 2-Flying qualities 3-Time minimization compared with diff. x

Longitudinal motion

Final states

Initial states

State Space Models plus

desired compensator structure

LQ Algorithm (CAS)

Gain Matrix

Zero states Initial states

Aerial refueling

Procedure

Page 201: Air Refueling Autopilot, (My First Book)

Rule error error rate p i d Firing Strength

1 NB NB PB NB PS 0.89736

2 NB NM PB NB NS 0.89736

3 NB NS PM NM NB 0.89736

4 NB Z PM NM NB 0.89736

5 NB PS PS NS NB 0.89736

6 NB PM Z Z NM 0.89736

7 NB PB Z Z PS 0.89736

8 NM NB PB NB PS 0.85494

9 NM NM PB NB NS 0.85494

10 NM NS PM NM NB 0.85494

11 NM Z PS NS NM 0.85494

12 NM PS PS NS NM 0.85494

13 NM PM Z Z NS 0.85494

14 NM PB NS Z Z 0.85494

15 NS NB PM NB Z 0.65068

16 NS NM PM NM NS 0.65068

17 NS NS PM NS NM 0.65068

18 NS Z PS NS NM 0.65068

19 NS PS Z Z NS 0.65068

20 NS PM NS PS NS 0.65068

21 NS PB NS PS Z 0.65068

22 Z NB PM NM Z 0.67087

23 Z NM PM NM NS 0.67087

24 Z NS PS NS NS 0.67087

25 Z Z Z Z NS 0.67087

26 Z PS NS PS NS 0.67087

27 Z PM NM PM NS 0.67087

28 Z PB NM PM Z 0.67087

29 PS NB PS NM Z 0.98392

30 PS NM PS NS Z 0.98392

31 PS NS Z Z Z 0.98392

32 PS Z NS PS Z 0.98392

33 PS PS NS PS Z 0.98392

34 PS PM NM PM Z 0.98392

35 PS PB NM PB Z 0.98392

36 PM NB PS Z PB 0.66334

37 PM NM Z Z PS 0.66334

38 PM NS NS PS PS 0.66334

39 PM Z NM PS PS 0.66334

40 PM PS NM PM PS 0.66334

41 PM PM NM PB PS 0.66334

42 PM PB NB PB PB 0.66334

43 PB NB Z Z PB 0.95689

44 PB NM Z Z PM 0.95689

45 PB NS NM PS PM 0.95689

46 PB Z NM PM PM 0.95689

47 PB PS NM PM PS 0.95689

48 PB PM NB PB PS 0.95689

49 PB PB NB PB PB 0.95689

Page 202: Air Refueling Autopilot, (My First Book)
Page 203: Air Refueling Autopilot, (My First Book)
Page 204: Air Refueling Autopilot, (My First Book)
Page 205: Air Refueling Autopilot, (My First Book)
Page 206: Air Refueling Autopilot, (My First Book)
Page 207: Air Refueling Autopilot, (My First Book)
Page 208: Air Refueling Autopilot, (My First Book)
Page 209: Air Refueling Autopilot, (My First Book)

Tan

ker

posi

tion

to

rece

ivin

g ai

rcra

ft

Win

d ax

es T

rans

. T

rack

ing

stag

e

KC

-135

Ta

nk

er

Rel

ativ

e di

stan

ces

calc

ulat

ions

A

lign

men

t st

age

F-1

6

Rec

eivin

g

Air

craft

Con

trol

lers

sw

itch

Pit

ch c

ontr

olle

r A

lign

men

t st

age

Lat

. con

trol

ler

Ali

gnm

ent

stag

e

Spe

ed c

ontr

olle

r A

lign

men

t st

age

Pit

ch c

ontr

olle

r T

rack

ing

stag

e

Lat

. con

trol

ler

Tra

ckin

g st

age

Spe

ed c

ontr

olle

r T

rack

ing

stag

e

SA

S l

ong.

m

otio

n

SA

S L

at.

mot

ion

SA

S s

peed

co

ntro

ller

Opt

imal

T

raje

ctor

y

Des

ign

Con

stra

int

Ref

eren

ce

Com

man

d =

0

1

2

3

Vel

ocit

y ve

ctor

and

G

PS

P

osit

ions

GP

S

Pos

itio

ns

Eul

er a

ngle

s

Rel

ativ

e ro

tati

ons

wit

h re

spec

t to

fig

hter

w

ind

axes

Rel

ativ

e di

stan

ces

wit

h re

spec

t to

T

anke

r bo

dy a

xes

Out

put

stat

es f

eedb

ack

GP

S

Pos

itio

ns

B9

Page 210: Air Refueling Autopilot, (My First Book)
Page 211: Air Refueling Autopilot, (My First Book)
Page 212: Air Refueling Autopilot, (My First Book)
Page 213: Air Refueling Autopilot, (My First Book)