Upload
others
View
10
Download
2
Embed Size (px)
Citation preview
DESIGN, DEVELOPMENT AND CONTROL OF ATWIN ROTOR SYSTEM
A Thesis Submitted tothe Graduate School of Engineering and Sciences of
Izmir Institute of Technologyin Partial Fulfillment of the Requirements for the Degree of
MASTER OF SCIENCE
in Electronics and Communication Engineering
byFırat DOGAN
July 2014IZMIR
We approve the thesis of Fırat DOGAN
Examining Committee Members:
Prof. Dr. Serhan OZDEMIRDepartment of Mechanical EngineeringIzmir Institute of Technology
Assist. Prof. Dr. Barbaros OZDEMIRELDepartment of Electrical and Electronics EngineeringIzmir Institute of Technology
Assoc. Prof. Dr. Enver TATLICIOGLUDepartment of Electrical and Electronics EngineeringIzmir Institute of Technology
10 July 2014
Assoc. Prof. Dr. Enver TATLICIOGLUSupervisor, Department of Electrical and Electronics EngineeringIzmir Institute of Technology
Prof. Dr. M. Salih DINLEYICI Prof. Dr. R. Tugrul SENGERHead of the Department of Dean of the Graduate School ofElectrical and Electronics Engineering Engineering and Sciences
ACKNOWLEDGMENTS
I would like to express my sincere gratitude to my thesis advisor Assoc. Prof.
Dr. Enver Tatlıcıoglu for his support, encouragement and enthusiasm throughout this
thesis. His constructive criticism, constant motivation and guidance led me to give my
best. He has been supportive since I began to study in his laboratory as an undergraduate.
I consider it an honor to be his student.
I gratefully acknowledge the contributions of Assist. Prof. Dr. Alper Bayrak.
I admire his enthusiasm and knowledge on both software and hardware issues. I see
him as an expert in giving suggestions and guiding to solutions for any kind of problem
throughout this thesis.
I would like to thank Assist. Prof. Dr. Barbaros Ozdemirel. His undergraduate
lessons and valuable tips helped me during the thesis.
I would like to thank Assist. Prof. Dr. M. I. Can Dede. He inspired me on robotics
and control by giving me the opportunity to work on a hexapod project in undergraduate
program. This inspiration continued throughout this thesis.
I would like to thank my family for their unconditional support and endless love
during my whole life. They always gave me support during my studies.
I would like to thank Aylin Bayram for her moral support and motivation. Her
encouragement helped me to have continuous inspiration throughout this thesis.
ABSTRACT
DESIGN, DEVELOPMENT AND CONTROL OF A TWIN ROTORSYSTEM
Twin rotor multi-input multi-output system (TRMS) is a laboratory setup resem-
bling the dynamics of a helicopter. It is a complicated nonlinear system with high cou-
pling effects between the propellers. In the literature, there is no commonly agreed dy-
namic model for these systems mainly due to the difficulties in modelling aerodynamic
effects. As a result, numerical simulations of controllers performed on currently available
dynamic models do not agree with experimental results obtained from a real system. The
main motivations behind this thesis are to develop a TRMS in our laboratory and then
apply different control algorithms on it.
Firstly, the mechanical system is described briefly. The mechanical components
are explained and the computer aided design model is given. The electronic system is then
presented in detail. In the electronic system, hardware parts of the TRMS (mainboard,
encoder reader circuits, and motor controller circuits) and the embedded algorithms are
developed. The development of the user interface that is used both to observe the TRMS
and to communicate with it, is then explained. Development of a mathematical model
of the TRMS is described where its physical parameters are given. Finally, the perfor-
mance of the TRMS is verified by conducting experiments for proportional, integral and
derivative type controllers. The analysis of the experiments are discussed and compared
in average maximum steady-state error, average root-mean-square error, error standard
deviation, average root-mean-square control input and control input standard deviation.
iv
OZET
CIFT ROTORLU SISTEMIN TASARIMI, GELISTIRILMESI VEDENETLENMESI
Cift rotorlu coklu girisli coklu cıkıslı sistem, bir helikopterin dinamiklerini temsil
eden bir laboratuvar duzenegidir. Pervaneleri arasında baglantılı etki olan ve dogrusal
olmayan karmasık bir sistemdir. Aerodinamik etkilerin modellenmesindeki zorluklar
sebebiyle, bu tur sistemlerin literaturde ortak kabul edilen bir dinamik modeli bulun-
mamaktadır. Bunun sonucu olarak, denetleyicilerin su an var olan dinamik modeller
uzerindeki sayısal benzetimleri gercek bir sistem uzerinden elde edilen deneysel sonuclar
ile ortusmemektedir. Bu tezin arkasındaki ana motivasyon, kendi cift rotorlu sistemimizin
gelistirilmesi ve uzerinde farklı denetleyici algoritmalarının uygulanmasıdır.
Mekanik sistem kısaca acıklandı. Mekanik bilesenler acıklandı ve bilgisayar destekli
tasarım modeli verildi. Elektronik sistem detayları ile sunuldu. Sistemin donanımsal
kısımları (ana devre, kodlayıcı okuyucu devreleri ve motor denetleyici devreleri) ve gomulu
algoritmaları gelistirildi. Daha sonra hem cift rotorlu sistemi gozlemlemek hem de onunla
haberlesmek icin gelistirilen kullanıcı ara yuzu acıklandı. Cift rotorlu sistemin matematik
modelinin gelistirilmesi acıklandı ve fiziksel parametreleri verildi. Son olarak, cift rotorlu
sistemin performansı oransal, integral ve turev iceren cesitli denetleyicilerin uygulandıgı
deneyler ile dogrulandı. Deneylerin analizleri tartısıldı ve ortalama maksimum sabit du-
rum hatası, hatanın karekok ortalaması, hatanın standart sapması, denetleyici girisinin
karekok ortalaması ve denetleyici girisinin standart sapması karsılastırıldı.
v
TABLE OF CONTENTS
LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
LIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
LIST OF SYMBOLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
LIST OF ABBREVIATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
CHAPTER 1. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
CHAPTER 2. TRMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1. Mechanical System Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2. Electronic System Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.1. Mainboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1.1. Main Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.1.2. RS232 to/from UART Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.2. Encoder Reader and Position & Velocity Transmitter Circuit . . 13
2.2.2.1. Optical Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.2.2. Encoder Reader Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.2.3. Position & Velocity Transmitter Circuit . . . . . . . . . . . . . . . . . . . 18
2.2.3. Motor Controller Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.3.1. MCU Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.3.2. Motor Driver Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.2.3.3. Isolation Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
CHAPTER 3. COMPUTER SOFTWARE DESIGN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.1. LabVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2. User Interface Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
CHAPTER 4. MATHEMATICAL MODELLING OF TRMS . . . . . . . . . . . . . . . . . . . . . . . . 33
vi
CHAPTER 5. CONTROL OF TRMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.1. Proportional (P) Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.2. Proportional - Integral (PI) Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.3. Proportional - Derivative (PD) Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.4. Proportional - Integral - Derivative (PID) Control . . . . . . . . . . . . . . . . . . . 43
5.5. Analysis of the Experimental Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
CHAPTER 6. CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
vii
LIST OF FIGURES
Figure Page
Figure 1.1. TRMS by Feedback Instruments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Figure 1.2. 2 DOF helicopter by Quanser. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 1.3. 3 DOF helicopter by Quanser. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 1.4. The TRMS built in Universita Politecnica Delle Marche, Ancona, Italy. 5
Figure 1.5. The CAD model of the TRMS developed in our laboratory. . . . . . . . . . . . . . 6
Figure 1.6. The TRMS developed in our laboratory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 2.1. Inside of the base box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 2.2. The block diagram of the TRMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 2.3. Mainboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 2.4. Port configurations of the MCU on Mainboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 2.5. The flow diagram of the algorithm embedded in the MCU on Main-
board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 2.6. Encoder reader and position & velocity transmitter circuit. . . . . . . . . . . . . . . 14
Figure 2.7. The optical encoder on the pitch axis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 2.8. The optical encoder on the yaw axis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 2.9. Clockwise and counterclockwise rotations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 2.10. XOR values of the channels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 2.11. Port configurations of the MCU labelled as IC2 in Figure 2.6. . . . . . . . . . . . 20
Figure 2.12. The flow diagram of the algorithm embedded in IC2 in Figure 2.6. . . . . . 21
Figure 2.13. Port configurations of the MCU labelled as IC1 in Figure 2.6. . . . . . . . . . . . 22
Figure 2.14. The flow diagram of the algorithm embedded in IC1 in Figure 2.6. . . . . . 23
Figure 2.15. Port configurations of the MCU on motor driver circuit. . . . . . . . . . . . . . . . . . 24
Figure 2.16. The flow diagram of the algorithm of the motor driver circuit. . . . . . . . . . . . 25
Figure 2.17. PWM signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 2.18. Motor controller circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Figure 3.1. View of the user interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Figure 3.2. User interface of adjusting serial port parameters, termination character
and the timeout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Figure 3.3. User interface of setting controller gains and desired angular position
values, and observing tracking errors and quantized input voltage val-
ues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Figure 3.4. User interface of configuration of data bytes received from the TRMS. . 32viii
Figure 3.5. Graphic view of pitch and yaw tracking errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Figure 5.1. [P control] angular position on pitch and yaw axes, respectively. . . . . . . . . 38
Figure 5.2. [P control] tracking error on pitch and yaw axes, respectively. . . . . . . . . . . . 39
Figure 5.3. [P control] control input on pitch and yaw axes, respectively. . . . . . . . . . . . . 40
Figure 5.4. [PI control] angular position on pitch and yaw axes, respectively. . . . . . . . 41
Figure 5.5. [PI control] tracking error on pitch and yaw axes, respectively. . . . . . . . . . . 42
Figure 5.6. [PI control] control input on pitch and yaw axes, respectively. . . . . . . . . . . . 43
Figure 5.7. [PD control] angular position on pitch and yaw axes, respectively. . . . . . . 44
Figure 5.8. [PD control] tracking error on pitch and yaw axes, respectively. . . . . . . . . . 45
Figure 5.9. [PD control] control input on pitch and yaw axes, respectively. . . . . . . . . . . 46
Figure 5.10. [PID control] angular position on pitch and yaw axes, respectively. . . . . . 47
Figure 5.11. [PID control] tracking error on pitch and yaw axes, respectively. . . . . . . . . 47
Figure 5.12. [PID control] control input on pitch and yaw axes, respectively. . . . . . . . . . 48
ix
LIST OF TABLES
Table Page
Table 2.1. Mechanical parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Table 2.2. Specifications of the encoder WDG 58C 1024-ABN-R30-K3-F29-070 . 15
Table 2.3. Optical encoder output table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Table 2.4. Maximum angular velocities for pitch and tail rotor in both directions . . 19
Table 2.5. Received data packet for the main motor controller . . . . . . . . . . . . . . . . . . . . . . 23
Table 2.6. Received data packet for the tail motor controller . . . . . . . . . . . . . . . . . . . . . . . . 24
Table 4.1. System parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Table 4.2. Calculated parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Table 5.1. Independent effects of the gains of PID control . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Table 5.2. Analysis of the errors for different controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Table 5.3. Analysis of the control inputs for different controllers . . . . . . . . . . . . . . . . . . . . 48
x
LIST OF SYMBOLS
φresolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The resolution of the optical encoder
ω(t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The angular velocity
T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The sampling interval
N . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The number of pulse count per rotation
n . . . . . . . . . . . . . . . . . . . . . . . . . .The number of the pulses counted in one sampling interval
PR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Register which keeps the period
Tosc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Oscillator period
Fosc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Oscillator frequency
FPWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PWM frequency
CCPR1L . . . . . . . . . . . . . . . . . . . . . . . . Register which keeps the low byte of the duty cycle
CCP1CON . . . . . . . . . . . . . . .Register which keeps the 9th and 10th bits of the duty cycle
VS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The maximum supply voltage
IP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The peak load current
dV/dt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The limited rise time of the output voltage
θv (t) . . . . . . . . . . . . . . . . . . . . . . . . . . . The angular position of the beam in the vertical plane
θv (t) . . . . . . . . . . . . . . . . . . . . . . . . . . . The angular velocity of the beam in the vertical plane
θv (t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The acceleration of the beam in the vertical plane
θh (t) . . . . . . . . . . . . . . . . . . . . . . . . The angular position of the beam in the horizontal plane
θh (t) . . . . . . . . . . . . . . . . . . . . . . . . The angular velocity of the beam in the horizontal plane
θh (t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . The acceleration of the beam in the horizontal plane
J . The sum of the moment of inertia of the counter balance beam and the free-free beam
τh (t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The controller input for horizontal plane
τv (t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The controller input for vertical plane
θ (t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The angular position vector
M (θ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The inertia matrix
N(θ, θ)
. . . . . . . . . . . . . The other dynamic effects such as coriolis and centrifugal forces
τ (t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The control input vector
J1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The moment of inertia of the free-free beam
J2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The moment of inertia of the counter balance beam
J3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The moment of inertia of the pivoted beam
g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The gravitational acceleration
h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The length of the pivoted beam
m1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The total mass of the free-free beamxi
m2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The total mass of the counter balance beam
l1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The center of gravity of the free-free beam
l2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The center of gravity of the counter balance beam
mt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The mass of the tail beam
mtr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The mass of the tail rotor
mts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The mass of the tail shield
mm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The mass of the main beam
mmr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The mass of the main rotor
mms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The mass of the main shield
lm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The length of main part of the free-free beam
rms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The radius of the main shield
rts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The radius of the tail shield
mb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The mass of the counter balance beam
lb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The length of the counter-weight beam
mcb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The mass of the counter-weight
lcb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The length between the counter-weight and the joint
mh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The mass of the pivoted beam
θ(t0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The initial angular position
θd(t) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The desired angular position
KP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The constant diagonal proportional gain matrix
KI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The constant diagonal integral gain matrix
KD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The constant diagonal derivative gain matrix
Ti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The integral time constant
Td . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The derivative time constant
xii
LIST OF ABBREVIATIONS
SISO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Input Single Output
MIMO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multi Input Multi Output
TRMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Twin Rotor MIMO System
CAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Computer Aided Design
DOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Degree of Freedom
FPGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Field Programmable Gate Array
VHSIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Very High Speed Integrated Circuit
VHDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VHSIC Hardware Description Language
GA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Genetic Algorithm
DC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Direct Current
P . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Proportional
I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Integral
D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Derivative
UART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Universal Asynchronous Receiver/Transmitter
MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Microcontroller Unit
PIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Peripheral Interface Controller
IC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Integrated Circuit
PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Printed Circuit Board
CW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Clockwise
CCW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Counterclockwise
ISR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Interrupt Service Routine
LSbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Least Significant Bits
PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pulse Width Modulation
MSbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The Most Significant Bits
VI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Virtual Instrument
SSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Steady-State Error
SD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Standard Deviation
RMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Root-Mean-Square
xiii
CHAPTER 1
INTRODUCTION
Twin rotor multi input multi output system (TRMS) is a laboratory set up resem-
bling a helicopter which is designed for conducting control experiments. In a typical
TRMS, there are two rotors, two optical encoders and a controller circuit. Two rotors
have rotation axes orthogonal to each other. The system moves on yaw and pitch axes
with the thrust produced by the propellers mounted on the rotors. The pitch movement
is up or down movement of the nose of a helicopter relative to the tail. The yaw move-
ment is side to side movement of the nose of a helicopter. The position of the TRMS is
adjusted by the main rotor and the tail rotor with the help of the feedback provided by
the optical encoders. The overall system is nonlinear and complex with a high coupling
effect between the propellers.
There are some commercial products developed by companies. The company
Feedback Instruments Limited1 has produced a TRMS for educational purposes and mostly
for control experiments. Figure 1.1 shows TRMS by Feedback Instruments. Quanser
Inc.2, which manufactures robotic and mechatronic systems, has also developed heli-
copter systems. Figure 1.2 shows the 2 degree of freedom (DOF) helicopter and Figure
1.3 shows the 3 DOF helicopter by Quanser.
There is some past research on modification of commercially available TRMS.
Juang and Liu (2008) employed Xilinx Spartan II SP200 Field Programmable Gate Array
(FPGA) for real time control to construct a hardware-in-the-loop system through coding
VHSIC hardware description language (VHDL). While Yu et al. (2010) utilized Altera
Cyclone II FPGA for real time control to construct a hardware-in-the-loop system through
embedding C and VHDL codes on this FPGA.
Design and development of TRMS have been studied in the university laboratories
as well Verzilli (2007). Corradini et al. (2011) used NI-PCI6024e, produced by National
Instruments which allows data exchange between a PC and the TRMS, and they setup the
TRMS by building an interface board to filter and to adapt sensor signals, and building
1Feedback Instruments Limited, Crowborough, UK. http://www.feedback-instruments.com/
2Quanser Inc., Ontario, Canada. http://www.quanser.com/
1
Figure 1.1. TRMS by Feedback Instruments.
a power board to drive the motors with suitable voltages. Their TRMS can be seen in
Figure 1.4.
There has been some previous research in dynamic modelling of TRMSs. La-
grangian and Newtonian approaches were utilized in the physics-based methods. Shih
et al. (2008) utilized Lagrangian approach to derive a mathematical model for the TRMS
and analyzed some of the characteristics of the proposed model such as equilibrium po-
sition, propeller thrust and gravity compensation. Rahideh and Shaheed (2007) presented
two dynamic models for the TRMS by utilizing Newtonian and Lagrangian approaches
and modelled the interface circuit, DC motors, and propulsive forces due to these motors.
Artificial intelligence-based empirical approaches such as genetic algorithms (GA) and
neural networks were also utilized to develop dynamic models for the TRMS. These ap-
proaches are usually utilized by adding a term to the analytical model to reflect the effects
that were not considered when obtaining the analytical model. In Rahideh and Shaheed
(2008), the Newtonian method was used to develop the dynamic equations of the 2 DOF
system. Some of the parameters of the system were obtained and other parameters were
estimated by using physical properties of the system. After that, GA optimization ap-
proach was utilized to improve the accuracy of the estimated parameters. In Rahideh
et al. (2008), analytical approaches in conjunction with neural networks based empiri-2
Figure 1.2. 2 DOF helicopter by Quanser.
cal approaches were used to derive dynamic models for a one DOF TRMS. A black-box
system identification technique is utilized to derive dynamic model of two DOF TRMS
Ahmad et al. (2000).
The focus of the other past research is on designing control algorithms for TRMSs.
Classical control techniques such as combinations of proportional (P), integral (I), deriva-
tive (D) controllers were commonly used to control TRMSs. Liu et al. (2006) proposed
to improve the performance of classical controllers by using a fuzzy controller. Shih et al.
(2008) proposed a PD controller and a fuzzy PID controller for set-point stabilization
control. In addition, robust controllers were studied to deal with modelling uncertain-
ties, unmeasured disturbances and unmodelled effects in the system. Karimi and Motlagh
(2006) proposed a robust controller based on a feedback linearization scheme to overcome
model uncertainties and disturbances. Lu and Wen (2007) presented a robust controller
by decoupling the MIMO system into two independent single input single output (SISO)
systems and cross-coupling effects were treated as disturbance and/or parametric uncer-
tainty. Bayrak et al. (2010) developed a robust controller, based on the restriction that
the TRMS dynamic model is unknown, by fusing a continuous nonlinear feedback com-
ponent with a nonlinear neural network feedforward term. Su et al. (2002) developed a
3
Figure 1.3. 3 DOF helicopter by Quanser.
robust control scheme for a class of cascade connected uncertain nonlinear systems which
was applied to TRMSs.
In this thesis, design, development and control of a TRMS in an academic set-
ting were studied. In Figures 1.5 and 1.6, the computer aided design (CAD) model and
the developed twin rotor system in our laboratory are presented, respectively. As a me-
chanical system, a TRMS setup which was previously developed in our laboratory was
used. Hardware parts, mainboard, encoder reader circuits and motor controller circuits
were designed. Embedded software parts were developed as well. Afterwards, a dy-
namical model was derived for the TRMS. Several measurements were done to obtain
the physical parameters and the limitations (i.e., maximum and minimum operating con-
ditions) of the TRMS. A computer software was developed on LabVIEW Development
Environment in order to monitor the TRMS and to communicate with it online. Pro-
portional (P), proportional-integral (PI), proportional-derivative (PD) and proportional-
integral-derivative (PID) controllers were applied and their performances were observed
on the developed TRMS.
The organization of the rest of this thesis is as follows. Chapter 2 explains the me-
chanical and electronic systems of the TRMS. Chapter 3 gives information about the com-
puter program written on LabVIEW Development Environment to monitor the TRMS and4
Figure 1.4. The TRMS built in Universita Politecnica Delle Marche, Ancona, Italy.
to communicate with it. Chapter 4 presents the Lagrangian based dynamic model. Chap-
ter 5 presents the P, PI, PD and PID controllers with their experimental results. Chapter
6 presents the conclusion of this thesis and highlights some possible future research av-
enues.
5
Figure 1.5. The CAD model of the TRMS developed in our laboratory.
Figure 1.6. The TRMS developed in our laboratory.
6
CHAPTER 2
TRMS
In this chapter, the mechanical system design and the electronic system design are
presented. The electronic system design are explained in three subsections as mainboard,
encoder reader and motor controller circuit.
2.1. Mechanical System Design
The mechanical part of the system includes two rotors on a beam with a counter
balance as shown in Figure 1.6. The main rotor produces vertical thrust and rotates the
beam around the pitch axis. The other rotor, called as the tail rotor, is mounted on the
opposite side of the beam, perpendicular to the main rotor, to obtain movement on the
yaw axis. This beam is placed on the top of a shaft which is seated on two co–axial
bearings. Aluminum is preferred in construction of the beam, counter balance and shaft
due to its high strength to weight ratio. The system is then placed on top of an steel base
box for mechanical stability. The electronic units are placed inside the base box as can be
seen in Figure 2.1. The parameters of the system are given in Table 2.1.
Table 2.1. Mechanical parameters
Parameter Valuelength of beam 655 mmlength of counter balance beam 306 mmdistance between pivot and main rotor 327.5 mmdistance between pivot and tail rotor 327.5 mmmass of the counter balance beam 65 grmass of the beam 400 grmass of main rotor 450 grmass of tail rotor 435 grraidus of the main rotor propeller 156 mmradius of the tail rotor propeller 77 mm
7
Figure 2.1. Inside of the base box.
2.2. Electronic System Design
The electronic system consists of: i) a mainboard, ii) two encoder readers, and iii)
two motor driver modules that are described in detail in the following sections.
Mainly, encoder readers acquire the square wave signals coming from the optical
encoders. They calculate the quantized number of the angular position and transmits them
via parallel data lines. Position and velocity transmitter circuits calculate the angular
velocity and send the angular position and angular velocity data to the main circuit via
Universal Asynchronous Receiver/Transmitter (UART). Main circuit collects the angular
positions and the angular velocities of the system, and sends the data to the computer via
RS232. The computer calculates the control inputs which are the required voltage values
for the two motors, and sends the data to the motor controller circuits. Motor controller
circuit drives the motors according to the required voltage values.
As can be seen in the block diagram in Figure 2.2, all modules use the same serial
bus to communicate with each other and with the computer. The communication is at
57600 baud rate. The motor driver circuits are accessible to the mainboard processor
through the shared serial bus structure. This design allows execution of the controller
algorithm on the mainboard processor instead of the external computer. In that case, the
experimental setup may become a standalone control system where the computer is used
only for monitoring the system behavior.8
ENCODER READER
OPTICAL ENCODER
SPEED AND POSITION TRANSMITTER
MAIN CIRCUIT
ENCODER READER
OPTICAL ENCODER
SPEED AND POSITION TRANSMITTER
MOTOR CONTROLLER
MOTOR CONTROLLER
TAIL ROTOR
MAIN ROTOR
UART
UART
PWM
PWM
PARALLEL
PARALLEL
UART
UART
RS232
Figure 2.2. The block diagram of the TRMS.
2.2.1. Mainboard
Mainboard consists of a microcontroller unit (MCU), a 5V regulator and a serial
line driver-receiver (MAX232) as shown in Figure 2.3. The mainboard is connected to
all the other circuits (i.e., encoder reader circuits, motor controller circuits) through the
shared serial bus. The primary duty of the mainboard is to supervise the whole system,
and it is responsible for arrangement of when to request angular position and angular
velocity values of the TRMS from the encoder reader circuit, and when to take required
voltage values from the computer.
The mainboard has two jumpers for selection. JP1 jumper is for programming
purposes and gives option to connect motor data line to receiver port of the mainboard
processor labelled as IC1. In this way, mainboard processor can listen the communication
between the computer and the motor driver circuit. During the course of the development
of the TRMS, different algorithms were tried, and in order to handle a reliable commu-
nication, we decided to use the jumper as closed, which means IC1 listens the data line
between the computer and the motor driver circuit. In this way, the mainboard processor
knows whether the computer completed its process or not.
9
Figu
re2.
3.M
ainb
oard
.
10
The controller algorithm runs on the computer but it can also be embedded into
the mainboard processor. The second jumper, labelled as JP2, is for design changes that
require an option to connect the motor driver circuit to the mainboard processor instead
of the computer. If JP2 is connecting pin 3 to pin 2, the computer drives the motors. If it
is connecting pin 1 to pin 2, the mainboard processor drives the motors. In this way, the
whole system will turn into a standalone system independent from the computer.
2.2.1.1. Main Processor
PIC16F877 MCU manufactured by Microchip1 is used as the main processor. The
port configurations of the MCU are given in Figure 2.4. MCU reads angular position and
PIC16F877
USART
PORTC
RC4-REQUEST2
RC5-REQUEST1
RA6-TX
RA7-RX
PORTD
RD0-LED
Figure 2.4. Port configurations of the MCU on Mainboard.
angular velocity data from the two encoder readers and sends these data to the computer.
To read the data from encoder readers successively, the MCU uses encoder reader request
pins, namely REQUEST1 and REQUEST2 pins in Figure 2.3. When an encoder request
pin is activated, the related encoder reader begins to send latest angular position and
angular velocity values to the mainboard via the serial bus. When the reading process from
1Microchip Technology Inc, Chandler, Arizona, USA. https://www.microchip.com/
11
both encoder readers are completed, MCU sends these data to the computer as a combined
data packet. The flow diagram of the above algorithm embedded in the mainboard MCU
is summarized in Figure 2.5.
Activate encoder reader 1 request line
BEGIN
Is transmition from encoder reader 1
complete?
Activate encoder reader 2 request line
Send encoder readings to the computer
Is transmition from encoder reader 2
complete?
Is data transmission from computer
complete?
YES
YES
YES
NO
NO
NO
Figure 2.5. The flow diagram of the algorithm embedded in the MCU on Mainboard.
12
2.2.1.2. RS232 to/from UART Circuit
RS232 to/from UART circuit is designed with MAX232 manufactured by Maxim2.
MAX232 has two drivers and two receivers inside. Each receiver converts TIA/EIA-232-
F inputs to 5V TTL/CMOS levels, and each driver converts TTL/CMOS input levels into
TIA/EIA-232-F levels.
MAX232 has a maximum data rate of 120kbps. First, the communication between
the circuit and the computer were setup to operate at 115200 baud rate. However, in the
experiments, it was observed that some of the data can be corrupted while the communi-
cation continues. The communication speed was close to the maximum data rate of the
MAX232 IC. Also, the maximum data rate is expected to be reduced due to the tolerances
of the capacitors. Thus, the communication rate is adjusted to 57600 baud rate.
2.2.2. Encoder Reader and Position & Velocity Transmitter Circuit
Encoder reader and position & velocity transmitter circuits are designed in one
printed circuit board (PCB). The circuit is designed as in Figure 2.6 consisting of two
MCUs and an XOR gate. The overall system has two of these circuits for the two axes as
can be seen in Figure 2.2. In the following subsections, the design will be described in
three parts; optical encoder, encoder reader circuit and velocity calculator circuit.
2.2.2.1. Optical Encoder
An optical rotary encoder is a device which converts angular position into a se-
quence of digital pulses. Optical encoders basically have a circular disk which contains a
set of radial lines between the photo-emitter and the photo-detector pairs. As the disk ro-
tates, the light between the photo-emitter and the photo-detector pair is interrupted by the
radial lines. As a result of this, it produces digital pulses. There are two different types;
absolute encoders and incremental encoders. Absolute encoders give data byte or word as
output which corresponds to an absolute angular position. Incremental encoders produce
digital pulses as the shaft rotates, and allow measurement of relative angular position only.
2Maxim Integrated, San Jose, California, USA. http://www.maximintegrated.com/13
Figu
re2.
6.E
ncod
erre
ader
and
posi
tion
&ve
loci
tytr
ansm
itter
circ
uit.
14
The TRMS has two optical encoders to detect the angular position on yaw and
pitch axes. The pitch axis encoder is directly coupled to the pivot of the horizontal beam
as shown in Figure 2.7. The yaw axis encoder is mounted next to the main vertical shaft.
The coupling between the encoder and the shaft is obtained through a belt as shown in
Figure 2.8.
Figure 2.7. The optical encoder on the pitch axis.
In this work, an incremental encoder WDG 58C from Wachendorff Automation3
company is used with the specifications given in Table 2.2.
Table 2.2. Specifications of the encoder WDG 58C 1024-ABN-R30-K3-F29-070
Power Supply 5VDC-30VDCLight Source IR LEDResolution 1024 pprOutput Current max 40mAOutput Circuit TTLOutput Frequency max 200KHz at 5V and 7m cable length
3Wachendorff Automation GmbH & Co KG, Geisenheim, Germany. http://www.wachendorff-automation.com/
15
Figure 2.8. The optical encoder on the yaw axis.
The incremental optical encoder consists of two photo-emitter and photo-detector
pairs. It has two output signal lines named A and B, which corresponds to the two photo-
detectors. By reading the logical voltage states of these lines, angular position, rotation
direction and angular velocity can be measured. As the pulse trains of the channels are out
of phase with each other, the rotation direction is determined with this timing difference
between the signals. The angular velocity is determined by measuring the frequency of
the signals while the angular position is determined by the number of pulses. The graphs
in Figure 2.9 explain the working principle of the optical encoder.
The resolution of the optical encoder is calculated as
φresolution =2π
N. (2.1)
Considering that the optical encoder is capable of producing 1024 pulses per rotation
(ppr), each pulse corresponds to 360/1024 = 0.352. The angular velocity ω(t) in
radian/sec can be calculated as
ω(t) =2πn
NT(radian/sec) (2.2)
where T is the sampling interval, N is the number of pulse count per rotation, and n is
the number of the pulses counted in one sampling interval.
The individual outputs of the encoders used in this system generate 1024 square
wave cycles per revolution. The number of quadrature steps is 4096 per revolution as de-
scribed in Figure 2.10. When the two outputs are combined, a precision of 0.088 degrees16
0 1 2 3 4 5 6 70
2
4
6
8
Time
Vol
tage
Clockwise Rotation − A leads B
Channel A
0 1 2 3 4 5 6 70
2
4
6
8
Time
Vol
tage
Channel B
0 1 2 3 4 5 6 70
2
4
6
8
Time
Vol
tage
Counterclockwise Rotation − B leads A
Channel A
0 1 2 3 4 5 6 70
2
4
6
8
Time
Vol
tage
Channel B
Figure 2.9. Clockwise and counterclockwise rotations.
per step is obtained. Thus, an XOR IC is added to the design and the MCU can count
4096 steps for 360 with the help of the XOR data. In this method, considering that both
the current state and the previous state are used to determine the rotation direction, the
optical encoder output table can be written as in Table 2.3.
2.2.2.2. Encoder Reader Circuit
The MCU labelled as IC2 is responsible for reading the square wave signals com-
ing from the optical encoder. Its main duty is to read the signals, calculate the quantized
angular position values of the axis and write them to output ports as parallel data lines.
The port configurations of IC2 are given in Figure 2.11. The flow diagram of the algorithm
embedded in IC2 is given in Figure 2.12.
As an MCU, PIC16F883 manufactured by Microchip company is used. It is a 28
pin flash-based, 8 bit CMOS MCU. PIC is set up with an external oscillator running at
20MHz with PortB change interrupts enabled. The processor reads the optical encoder
outputs and increases or decreases the angular position count after every encoder inter-
rupt. The interrupt service routine (ISR) compares the current encoder outputs with the
values before the interrupt that were recorded in the previous ISR call. A two-byte counter
is used to count the encoder pulses. The angular position counts are stored as 16–bit inte-
gers where the 12 least significant bits (LSbs) vary between 0 and 4095 in each encoder17
0 1 2 3 4 5 6 70
5
Time
Vol
tage
Clockwise Rotation − A leads B
Channel A
0 1 2 3 4 5 6 70
5
Time
Vol
tage
Channel B
0 1 2 3 4 5 6 70
5
Time
Vol
tage
XOR(A,B)
Figure 2.10. XOR values of the channels.
rotation. The counter is started at 32768 to avoid the zero crossing of the counter register.
The main routine is responsible for writing the quantized angular position data to output
ports.
The MCU should handle the encoder interrupts at the maximum possible transition
rate. In the TRMS, maximum angular velocity that can be achieved is measured as shown
in Table 2.4.
Since the maximum velocity is 1.7498 rad/sec at the maximum possible transition
rate, considering that the encoder resolution is 4096 counts/rev, the required interrupt ser-
vice time is calculated as 876.65 µ sec. The MCU is capable of serving encoder interrupts
once every 20 µ sec. In this case, the processor is always capable of serving the encoder
interrupts on–time. Main routine of the IC2 MCU sends the angular position value to the
IC1. The whole main routine takes 20.8 µ sec. Considering one total cycle, it takes 40.8
µ sec, which means that the processor is capable of processing every step of the optical
encoder.
18
Table 2.3. Optical encoder output table
State A B XOR DirectionCurrent : 1 0 1 CWPrevious: 1 1 0Current : 0 1 1 CCWPrevious: 1 1 0Current : 0 1 1 CWPrevious: 0 0 0Current : 1 0 1 CCWPrevious: 0 0 0Current : 1 1 0 CWPrevious: 0 1 1Current : 0 0 0 CCWPrevious: 0 1 1Current : 0 0 0 CWPrevious: 1 0 1Current : 1 1 0 CCWPrevious: 1 0 1
Table 2.4. Maximum angular velocities for pitch and tail rotor in both directions
Pitch Up 1.7498 rad/secPitch Down -1.6500 rad/sec
Tail CW 1.0365 rad/secTail CCW -0.9987 rad/sec
2.2.2.3. Position & Velocity Transmitter Circuit
The MCU labelled as IC1 is responsible for calculating angular velocity and for
sending angular position and angular velocity values when the main circuit requests them.
The port configurations of ICI are given in Figure 2.13. The flow diagram of the algorithm
embedded in IC1 is given in Figures 2.14.
As an MCU PIC16F883 is used. PIC is setup with an external oscillator running
at 20 MHz, a UART at 57600 baudrate, an 8-bit timer configured with 1:256 prescaler for
maximum period. The MCU always reads the parallel data lines and updates the angular
position registers. When the timer0 interrupt occurs, which is once every 13.1 ms, it
calculates the angular velocity.
19
PIC16F876
TIMER1
PORTA
RA0-COUNTER,0
RA1-COUNTER,1
RA2-COUNTER,2
RA3-COUNTER,3
PORTC
RA4-COUNTER,4
RA5-COUNTER,5
RC0-COUNTER,6
RC1-COUNTER,7
RC2-COUNTER,8
RC3-COUNTER,9
RC4-COUNTER,10
RC5-COUNTER,11
RC6-COUNTER,12
RC7-COUNTER,13
PORTB
RB1-SIGNAL A
RB7-SIGNAL XOR
RB6-COUNTER,14
RB7-COUNTER,15
Figure 2.11. Port configurations of the MCU labelled as IC2 in Figure 2.6.
The MCU keeps the angular position and angular velocity values ready for trans-
mission. When the request line connected to the mainboard is set low, it sends the angular
position and angular velocity data packet via UART. Request line is pulled high with a
10KΩ pull–up resistor in order to work as active low.
The software was written in C language. In order to speed up the execution of
data transmission, some functions related to data reading algorithm were replaced with
assembly codes. In this way, the reading process which takes 87.8 µ sec was decreased to
27.8 µ sec.
2.2.3. Motor Controller Circuit
Motor controller circuit is designed as in Figure 2.18 consisting of an MCU, an
H-Bridge and an optocoupler. The TRMS has two of these circuits for the two motors as
can be seen in the Figure 2.2.
In the following subsections, the motor controller design will be described in three
parts; MCU circuit, motor driver circuit and circuit isolation.20
Increase ordecrease the counter
according to the signal
BEGIN
Does interrupt occur?
YES
NO
Write counter value to the output ports
Figure 2.12. The flow diagram of the algorithm embedded in IC2 in Figure 2.6.
2.2.3.1. MCU Circuit
The MCU labelled as IC1 in Figure 2.18 is responsible for communicating with
the computer or the mainboard. Both computer and main circuit can send commands to
the MCU. In this study, the control algorithms are developed on the computer, and thus
the computer sends the commands. The port configurations of IC1 are given in Figure
2.15, and the flow diagram of the algorithm embedded in IC1 is given in Figure 2.16.
Motor driver modules produce PWM signals according to the duty cycle settings
sent from the computer to drive the DC motors. As shown in Figure 2.17, in PWM
technique, the average value of the signal is adjusted by changing the on–off times of the
signal. The ratio of “on” duration and period of the signal is named as duty cycle and is
expressed in percentage.
As an MCU, PIC16F628 is used. PIC is setup as UART at 57600 baud rate,
Capture/Compare/PWM (CCP) module with adjusted in PWM mode, timer2 with 1:1
prescale value. CCP module uses timer2 when setup in PWM mode, differently from the
capture and compare mode which uses timer1. In PWM mode, the CCP1 pin produces a
PWM output up to 10-bit resolution. There are 3 registers which determine the period and
21
PIC16F876
TIMER1
PORTA
RA0-COUNTER,7
RA1-COUNTER,6
RA2-COUNTER,5
RA3-COUNTER,4
PORTB
RA4-COUNTER,3
RA5-COUNTER,2
RB0-COUNTER,15
RB1-COUNTER,14
RB2-COUNTER,13
RB3-COUNTER,12
RB4-COUNTER,11
RB5-COUNTER,10
RB6-COUNTER,9
RB7-COUNTER,8
PORTC
RC0-COUNTER,1
RC1-COUNTER,0
RC6-TX
RC7-REQUEST
USART
Figure 2.13. Port configurations of the MCU labelled as IC1 in Figure 2.6.
the duty cycle of the PWM signal. Specifically, PR2 register keeps the period, CCPR1L
register keeps the low byte of the duty cycle, and CCP1CON register keeps the 9th and
10th bits of the duty cycle. It should be recalled that the duty cycle is 10 bits of data.
The period of the PWM signal is calculated as
PWM period = [(PR2) + 1]× 4× Tosc × (TMR2 prescale) (2.3)
where PR2 is the value of the timer2 period register PR2, Tosc is the oscillator pe-
riod of the external clock as the MCU was setup with external crystal oscillator, and
TMR2 prescale is the value of the timer2 prescale register. Considering the MCU work-
ing at 20MHz, in order to achieve 20KHz PWM signal, PR2 register is calculated as
0xF9.
The duty cycle of the PWM signal is calculated as
Duty cycle = (CCPR1L : CCP1CON < 5 : 4 >)× Tosc × (TMR2Prescale) (2.4)
where CCPR1L : CCP1CON < 5 : 4 > is the value of the 10 bits as a combination
of the eight most significant bits (MSbs) in CCPR1L register and the two least significant
bits as the forth and the fifth bits of the CCP1CON register.22
Send position and velocity valuesto mainboard.
BEGIN
Is request line activated?
Read ports
YES
NO
Figure 2.14. The flow diagram of the algorithm embedded in IC1 in Figure 2.6.
As can be seen from Equation 2.4, the duty cycle is determined by writing the
registers CCPR1L and CCP1CON < 5 : 4 >. The value to be written is determined
by the computer, and is received via UART. The communication line of the two motor
controller circuits is a shared serial bus. Both of the two MCUs for the two axes read
the same data packets. However, the data packets differ with the prefix bytes and the end
byte. The data packet for the main and tail motor controllers are defined as in Tables 2.5
and 2.6, respectively.
Table 2.5. Received data packet for the main motor controller
Prefix Prefix Duty Cycle High Byte Duty Cycle Low Byte End Byte0xF1 0x01 0x.. 0x.. 0xF1
Maximum PWM resolution in bits for a given PWM frequency is determined by
the oscillator frequency, PWM frequency and the prescaler of the timer2 module. It is
23
PIC16F628
USART
RB1-RX
PORTB
RB3-PWM Signal
PWM
Figure 2.15. Port configurations of the MCU on motor driver circuit.
Table 2.6. Received data packet for the tail motor controller
Prefix Prefix Duty Cycle High Byte Duty Cycle Low Byte End Byte0xF2 0x02 0x.. 0x.. 0xF2
calculated as
PWM Resolution =log(
FOSC
FPWM×TMR2 Prescaler
)log2
bits (2.5)
where FOSC is the oscillator frequency, and TMR Prescaler is the value of the timer2
prescale register.
Considering that the PWM frequency is 20KHz, FOSC is 20MHz and TMR2
Prescaler is 1, the maximum PWM resolution is calculated as 9.966 bits. 9.966 bits of
resolution is equal to 29.966 = 1000.15 steps for PWM duty cycle adjustment. Thus, the
duty cycle value is sent as 0 to 1000 in decimal.
2.2.3.2. Motor Driver Circuit
The motor driver circuits utilize PWM to obtain high power efficiency, and conse-
quently, to minimize the cooling requirement of the driver components. Thus, the driver
MCU generates the PWM waveform for the H–bridge operation. The H–bridge used in
the motor driver circuits is L6203 manufactured by STMicroelectronics4. The transistors
4STMicroelectronics, Geneva, Switzerland. http://www.st.com/24
Write new values to PWM registers
BEGIN
Do new PWM values receive?
YES
NO
Figure 2.16. The flow diagram of the algorithm of the motor driver circuit.
in L6203 have an intrinsic diode between their source and drain that can operate as a fast
freewheeling diode. They protect the H–bridge during the on–off switching of the H–
bridge transistors. The H–bridge L6203 has a 24V supply voltage and drives the motors
with PWM control signal transferred via the optocoupler. A snubber network made by
the series of a resistor labelled R13 and a capacitor labelled C2 is mounted at the motor
terminals to filter the noise generated as the collector of the DC motor switches through
the armature windings. BYW98 diodes, D1 and D2, are connected between power output
pins and ground. The following formulas are used to calculate the snubber values SGS
Thomson Microelectronics (1997)
R ∼= VS/IP (2.6)
C = IP/(dV/dt) (2.7)
where VS is the maximum supply voltage, IP is the peak load current, and dV/dt is the
limited rise time of the output voltage. Considering that the supply voltage is 24V and the
maximum motor current is 21.5A, R13 is calculated as 1.12Ω. When dV/dt is 200V/µ sec
with reference to the L6203 datasheet, C2 is calculated as 108nF. Two bypass capacitors
(C5 and C10) are used on the motor driver circuit to stabilize the DC power supply voltage
at the H-bridge input. The bypass capacitor C10 is an electrolytic capacitor, and C5 is a25
0 1 2 3 4 5 6
x 104
−2
−1
0
1
2
3
4
5
Time ( µs )
Am
plitu
de (
V )
PWM signal
τ
T
Figure 2.17. PWM signal.
ceramic capacitor. The electrolytic capacitor can respond to H-bridge current demands up
to 100kHz, and the ceramic capacitor can be effective up to several MHz.
The heat caused by L6203 was dissipated with an additional heatsink which was
also supported with a fan.
2.2.3.3. Isolation Circuit
The switching transistors in the motor driver IC and the motor itself cause noise
and spikes that affect the rest of the circuit. Also, high current drain on the motor lines
causes ground supply voltage fluctuations. The MCUs must be isolated from these ef-
fects. Thus, the power and the signal lines are isolated from each other in order to isolate
the noise caused by the motor from the MCUs. In the design, the power lines are iso-
lated by using different power supplies. The signal lines are isolated by transferring the
PWM signal via an optocoupler. As an optocoupler, a one channel optocoupler PC817
manufactured by Sharp company5 is used.
5Sharp Corporation, Osaka, Japan. http://www.sharp-world.com/26
Figu
re2.
18.M
otor
cont
rolle
rcir
cuit.
27
CHAPTER 3
COMPUTER SOFTWARE DESIGN
The computer software is written on LabVIEW Development Environment1. The
interface program developed on LabVIEW enables us to monitor the TRMS and to com-
municate with it online.
In the following subsections, a brief information about LabVIEW development
environment will be given and the developed user interface program will be explained.
3.1. LabVIEW
LabVIEW programming language is a dataflow programming language which
means that activation of operations or processes depends on the availability of the in-
put data. The programmer wires connections between variables and operators that carry
data from outputs to inputs.
A LabVIEW program consists of subroutines which are called virtual instruments
(VI). Each VI has a front panel and a block diagram. The front panel is a graphical user
interface with a combination of controls and indicators. Controls allow user to supply
inputs to the VI and indicators display the results. The block diagram contains the source
code. The objects in the front panel appear as terminals in the block diagram and the user
wires these terminals to predefined functions or other VIs. The user also adds structures
and functions to perform operations on controls and supply data to indicators.
3.2. User Interface Program
The interface program runs on the computer and communicates with the electronic
modules via the serial bus. The user interface of the program is shown in Figure 3.1.
1www.ni.com/labview28
Figu
re3.
1.V
iew
ofth
eus
erin
terf
ace.
29
The computer software can be explained in four parts. The first part seen in Figure
3.2 is designed to adjust the serial port parameters, termination character and the timeout.
Figure 3.2. User interface of adjusting serial port parameters, termination characterand the timeout.
The user interface in Figure 3.3 is designed to set the control parameters which
are the proportional gain constant, integral gain constant, and derivative gain constant for
pitch and yaw axes. Two reference inputs are added to set the desired angular position
values for pitch and yaw axes. Additionally, the quantized input voltage values and the
tracking error values are added for online observation.
In Figure 3.4, the size of the data packet coming from the TRMS is adjusted
and the bytes waiting in the buffer are observed online to see if there is an unexpected
congestion in the data traffic.
The graphic outputs are added, as shown in Figure 3.5, to observe the tracking
errors for pitch and yaw axes online. The errors are drawn continuously while the TRMS
is operating.
Controller algorithm is applied by combining Matlab scripts with available Lab-
VIEW modules like derivative block, integral block etc. The error and torque logs are
stored in user–defined plain text files. These files are used to draw graphs with Matlab for30
Figure 3.3. User interface of setting controller gains and desired angular position val-ues, and observing tracking errors and quantized input voltage values.
further analysis and reporting.
When the program is started, an initialization sequence is sent to the system hard-
ware. This lets the electronic modules send angular position and angular velocity data to
the computer. The software then calculates the controller inputs according to the control
algorithm and the desired angular position settings. The controller inputs are converted to
duty cycle values with 10 bits resolution and then sent to the motor driver circuits. The
control procedure is repeated until it is terminated by the user.
31
Figure 3.4. User interface of configuration of data bytes received from the TRMS.
Figure 3.5. Graphic view of pitch and yaw tracking errors.
32
CHAPTER 4
MATHEMATICAL MODELLING OF TRMS
In this chapter, development of a mathematical model of the TRMS is described.
The TRMS is designed as shown in Figure 1.6. The two rotors in the TRMS correspond
to the main and tail rotor of a real helicopter. The control of the TRMS is applied by
adjusting the angular velocities of these two rotors, whereas in a real helicopter, the angu-
lar velocities of the rotors vary slowly and the control is mainly applied by adjusting the
rotor blade angles. The angular velocity of the rotors are adjusted by changing the supply
voltage of the DC motors. Thus, the control inputs of the TRMS are the supply voltages
of the motors. The outputs of the TRMS are the vertical and horizontal angular positions
that are measured by the optical sensors located on it.
In the literature, a significant amount of research was devoted to derive a mathe-
matical dynamic model for the twin rotor systems. However, mostly due to the difficulties
in modelling aerodynamic effects, there is no commonly agreed dynamic model for these
systems.
The dynamic model developed by Rahideh and Shaheed (2007) is one of the
highly acknowledged models in the literature and is presented as
f θh + f1θv + f2 + f3 = τh (4.1)
Jθv + f1θh + f4 + f5 = τv (4.2)
where θv (t), θv (t), θv (t) ∈ R are the angular position, angular velocity and acceleration
of the beam in the vertical plane, respectively, θh (t), θh (t), θh (t) ∈ R are the angular po-
sition, angular velocity and acceleration of the beam in the horizontal plane, respectively.
J ∈ R is equal to the sum of the moment of inertia of the counter balance beam and
the free-free beam, f (θv), f1 (θv), f2(θv, θv
), f3
(θv, θv, θh
), f4
(θv, θh
), f5 (θv) ∈ R
are nonlinear functions, and τh (t), τv (t) ∈ R are the controller inputs for horizontal and
vertical planes, respectively.
In order to express the dynamic model in Equations 4.1 and 4.2 in a compact form,
the dynamic model can be combined as
Mθ +N = τ (4.3)
where θ (t) ∈ R2 represents the angular position vector, M (θ) ∈ R2×2 represents the33
inertia matrix, N(θ, θ)∈ R2 represents other dynamic effects such as coriolis and cen-
trifugal forces, and τ (t) ∈ R2 represents the control input vector. These terms are defined
as
θ ,
[θh
θv
]M ,
[f f1
f1 J
](4.4)
N ,
[f2 + f3
f4 + f5
]τ ,
[τh
τv
]. (4.5)
The nonlinear functions of the system model in Equations 4.1 and 4.2 are given below
Rahideh and Shaheed (2007), Rahideh et al. (2008)
J , J1 + J2 (4.6)
f , J1 cos2(θv) + J2 sin2(θv) + h2(m1 +m2) + J3 (4.7)
f1 , h[m1l1 sin(θv)−m2l2 cos(θv)] (4.8)
f2 , h[m1l1 cos(θv) +m2l2 cos(θv)]θ2v (4.9)
f3 , 2(J2 − J1) sin(θv) cos(θv)θvθh (4.10)
f4 , (J1 − J2) sin(θv) cos(θv)θ2h (4.11)
f5 , g[m1l1 cos(θv) +m2l2 sin(θv)] (4.12)
where J1 is the moment of inertia of the free-free beam, J2 is the moment of inertia
of the counter balance beam, J3 is the moment of inertia of the pivoted beam, g is the
gravitational acceleration, h is the length of the pivoted beam, m1 is the total mass of
the free-free beam, m2 is the total mass of the counter balance beam, l1 is the center of
gravity of the free-free beam, and l2 is the center of gravity of the counter balance beam.
The moment of inertia terms are expressed as
J1 ,(mt
3+mtr +mts
)l2t +
(mm
3+mmr +mms
)l2m
+mms
2r2ms +mtsr
2ts (4.13)
J2 ,mb
3l2b +mcbl
2cb (4.14)
J3 ,mh
3h2 (4.15)
where mt is the mass of the tail beam, mtr is the mass of the tail rotor, mts is the mass
of the tail shield, lt is the length of tail part of the free-free beam, mm is the mass of the
main beam, mmr is the mass of the main rotor, mms is the mass of the main shield, lm is
the length of main part of the free-free beam, rms is the radius of the main shield, rts is
the radius of the tail shield, mb is the mass of the counter balance beam, lb is the length of34
the counter-weight beam, mcb is the mass of the counter-weight, lcb is the length between
the counter-weight and the joint, and mh is the mass of the pivoted beam. In our system,
no weight was added as the counter-weight, and main and tail shields are not plugged to
the rotors, and weights due to these are chosen as zero in the calculation. The terms m1,
m2, l1 and l2 are expressed as
m1 , mt +mtr +mts +mm +mmr +mms (4.16)
m2 , mb +mcb (4.17)
l1 ,(mm/2 +mmr +mms)lm − (mt/2 +mtr +mts)lt
m1
(4.18)
l2 ,mblb/2 +mcblcb
m2
. (4.19)
The parameters of the developed TRMS are listed in Table 4.1.
Table 4.1. System parameters
Parameter Definition Valuemm Mass of main beam 0.200 kgmmr Mass of the main rotor 0.450 kgmms Mass of main shield 0 kgmt Mass of the tail beam 0.200 kgmtr Mass of the tail rotor 0.435 kgmts Mass of tail shield 0 kgmb Mass of counter balance beam 0.065 kgmcb Mass of counter balance beam 0 kglm Length of main beam 0.3275 mlt Length of tail beam 0.3275 mlb Length of counter-weight beam 0.306 mlcb Length between the counter-weight and the joint 0.306 mrms Radius of the main shield 0 mrts Radius of the tail shield 0 m
The calculated parameters for the presented model, in Equations 4.13, 4.14, 4.16,
4.17, 4.18 and 4.19 are given in Table 4.2.
35
Table 4.2. Calculated parameters
Parameter Definition Valuem1 Total mass of the free-free beam 1.2850 kgm2 Total mass of the counter-weight beam 0.0650 kgl1 Center of gravity of the free-free beam 0.0038 ml2 Center of gravity of the counter-weight beam 0.1530 mJ1 Moment of inertia of the free-free beam 0.1092 kg m2
J2 Moment of inertia of the counter balance beam 0.0020 kg m2
36
CHAPTER 5
CONTROL OF TRMS
In this chapter, the control algorithms applied to the TRMS will be explained. The
experiments were conducted based on the restriction that the TRMS dynamic model is
unknown, thus, the dynamic model of the TRMS presented in Chapter 4 was not used in
the controller design.
The performance of proportional (P), proportional–integral (PI), proportional–
derivative (PD) and proportional–integral-derivative (PID) control algorithms were an-
alyzed. The experimental results will be presented.
In all the experiments, the initial value of the angular positions was chosen as
θ(t0) = [0, 0]T where t0 is the initial time. The desired angular position was taken as
θd(t) = [30, 20]T in degrees. The controller gains were selected via a trial-error method.
Several experiments for each controller were conducted, however the ones that we ob-
tained the best performance in average maximum steady-state error (SSE) are presented.
5.1. Proportional (P) Control
In proportional control, the control input is produced as proportional to the error
value. In analog systems, the error signal is amplified to obtain the control input. In digital
systems, the error value is multiplied by a constant which is the proportional control gain.
The P controller is defined as
u(t) = KP e(t) (5.1)
where KP is the constant diagonal proportional gain matrix with appropriate dimension.
Proportional control increases the speed of response, but as a disadvantage it
causes larger transient overshoot. Thus, the gain constant KP should be adjusted to an
optimum value. Lower proportional gain results in a smaller control input and makes the
system less sensitive to disturbances. When the error is small, the control input can be
a very small value which results the system not to respond. Additionally, proportional
control may have steady-state error and may not be able to completely reject a constant
disturbance Astrom and Murray (2008).
37
To experimentally verify the performance of the proportional control, we applied
the control input in Equation 5.1 to the TRMS. Several experiments were conducted for
different control gains and the best results are presented. The best performance was ob-
tained when KP is chosen as
KP =
[20 0
0 2000
]. (5.2)
In Figure 5.1, angular position on pitch and yaw axes are given, respectively. Both axes
show the characteristics of proportional control. High overshoot is observed on both axes.
In Figure 5.2, the tracking error on pitch and yaw axes are given, respectively. The track-
ing error on pitch axis shows that the controller is less sensitive to the disturbances in the
TRMS. As an example of this, a peak is observed at the 47th second due to an external
disturbance most probably as a result of aerodynamic effects, and the proportional con-
troller can not handle it. The tracking error on yaw axis shows that the controller has
steady-state error and the controller can not handle it. In Figure 5.3, control input on
pitch and yaw axes are given, respectively. The torques are amplified form of the tracking
errors simply due to nature of the proportional control.
0 5 10 15 20 25 30 35 40 45 500
10
20
30
40
50
60
70
Time(s)
Deg
ree
Angular Position on Pitch Axis
Position
0 5 10 15 20 25 30 35 40 45 500
5
10
15
20
25
30
35
Time(s)
Deg
ree
Angular Position on Yaw Axis
Position
Figure 5.1. [P control] angular position on pitch and yaw axes, respectively.
38
0 5 10 15 20 25 30 35 40 45 50−40
−30
−20
−10
0
10
20
30
Time(s)
Deg
ree
Pitch Error
Error
0 5 10 15 20 25 30 35 40 45 50−15
−10
−5
0
5
10
15
20
Time(s)
Deg
ree
Yaw Error
Error
Figure 5.2. [P control] tracking error on pitch and yaw axes, respectively.
5.2. Proportional - Integral (PI) Control
In proportional-integral control, the control input is produced by adding an integral
term to the proportional control. Integral term is evaluated by integration of the error and
multiplying the result with a constant integral gain. PI controller is defined as
u(t) = KP e(t) +
t∫0
KIe(σ)dσ (5.3)
where KP is the constant diagonal proportional gain matrix and KI is the constant diag-
onal integral gain matrix. The PI controller can alternatively be presented as
u(t) = KP
e(t) +1
Ti
t∫0
e(σ)dσ
(5.4)
where KP is the constant proportional gain and Ti is the integral time constant.
Integral term in PI control is the sum of instantaneous error from the initial time
to the current time. After adding the integral term, PI control is expected to eliminate
the steady-state error that P control could not eliminate. As the integral term consists of
the accumulated error values from the past, it accelerates the movement of the system
to the desired set point. On the other hand, it may cause larger overshoot. Although39
0 5 10 15 20 25 30 35 40 45 5015.3
15.4
15.5
15.6
15.7
15.8
15.9
Time(s)
Vol
tage
(V)
Pitch Control Input
Input
0 5 10 15 20 25 30 35 40 45 505
10
15
20
25
Time(s)
Vol
tage
(V)
Yaw Control Input
Input
Figure 5.3. [P control] control input on pitch and yaw axes, respectively.
the integrator accelerates the movement, it has a tendency to make the system slower
by reducing the response of the system. Additionally, integral feedback can give nonzero
control even if the error is zero because of memory, and it can be very oscillatory. Another
problem is integrator wind up. There are limitations in the actuators. It may happen that
the control variable reaches the actuator limits. If the actuator remains saturated, the
error will continue to be integrated and the integral term may become very large. After
that, the integral term will cause overshoot and continue to increase the error until this
accumulated error is unwound. It may take a long time before the integrator and the
controller input comes inside the saturation range. Considering these effects, the integral
gain constantKI should be adjusted according to the design requirements in order to have
an acceptable trade-off. With high KI , the system can have a zero steady-state error, but
with an unacceptable overshoot and slower response in the system.
To experimentally verify the performance of the PI control, we applied the control
input in Equation 5.3 to the TRMS where KP and KI are chosen as
KP =
[20 0
0 2000
], KI =
[0.5 0
0 20
]. (5.5)
In Figure 5.4, angular position on pitch and yaw axes are given, respectively. Both axes
show the characteristics of PI control. Higher overshoot is observed on both axes com-
pared to the P control. In Figure 5.5, tracking error on pitch and yaw axes are given,40
respectively. The tracking error on yaw axis clearly shows that the controller has ability
to remove the steady-state error (that the P control could not eliminate) and pitch axis
shows the tendency to reduce the steady-state error. Higher oscillation is observed on the
tracking error on pitch axis as a trade-off. In Figure 5.6, control input on pitch and yaw
axes are given, respectively. Although the tracking error on yaw axis goes to zero, the
control input on yaw axis goes to a constant value due to the memory of the integrator.
0 5 10 15 20 25 30 35 40 45 500
10
20
30
40
50
60
70
80
Time(s)
Deg
ree
Angular Position on Pitch Axis
Position
0 5 10 15 20 25 30 35 40 45 500
5
10
15
20
25
30
35
40
Time(s)
Deg
ree
Angular Position on Yaw Axis
Position
Figure 5.4. [PI control] angular position on pitch and yaw axes, respectively.
5.3. Proportional - Derivative (PD) Control
In proportional-derivative control, the control input is produced by adding a deriva-
tive term to the proportional control. The derivative term is obtained by the slope of the
error over the time multiplied with a constant derivative gain. PD controller is defined as
u(t) = KP e(t) +KDde(t)
dt(5.6)
where KP is the constant diagonal proportional gain matrix and KD is the constant diag-
onal derivative gain matrix. The PD controller can alternatively be presented as
u(t) = KP
(e(t) + Td
de(t)
dt
)(5.7)
where KP is the constant proportional gain, and Td is the derivative time constant.
41
0 5 10 15 20 25 30 35 40 45 50−50
−40
−30
−20
−10
0
10
20
30
Time(s)
Deg
ree
Pitch Error
Error
0 5 10 15 20 25 30 35 40 45 50−20
−15
−10
−5
0
5
10
15
20
Time(s)
Deg
ree
Yaw Error
Error
Figure 5.5. [PI control] tracking error on pitch and yaw axes, respectively.
Derivative term is proportional to the rate of change on error and has a role to
speed up the system response. Derivative predicts the system behaviour from the slope
and improves the stability of the system. It usually reduces the settling time and improves
the response of the system to sudden changes. However, it may amplify the system noise
at high frequencies. If the error signal is noisy or if the closed-loop system has a slow loop
rate, the derivative response can make the system unstable. Additionally, it does nothing
to reduce constant error, since the derivative of the error will be zero if there is no change
on error.
To experimentally verify the performance of the PD control, we applied the control
input in Equation 5.6 to the TRMS where KP and KD are chosen as
KP =
[250 0
0 2000
], KD =
[4500 0
0 4500
]. (5.8)
In Figure 5.7, angular position on pitch and yaw axes are given, respectively. It is seen
that derivative term reduces the overshoot in both axes. It is also observed that derivative
term can handle the oscillation occured in P controller. In Figure 5.8, tracking error
on pitch and yaw axes are given, respectively. The steady-state error on yaw axis stays
the same as in P control, since the derivative of the error goes to zero for constant or
slowly varying error values. There is a considerable improvement on tracking error on
pitch axis as the response of the system to sudden changes was improved by the addition42
0 5 10 15 20 25 30 35 40 45 5015
15.2
15.4
15.6
15.8
16
Time(s)
Vol
tage
(V)
Pitch Control Input
Input
0 5 10 15 20 25 30 35 40 45 500
5
10
15
20
25
Time(s)
Vol
tage
(V)
Yaw Control Input
Input
Figure 5.6. [PI control] control input on pitch and yaw axes, respectively.
of the derivative term. In Figure 5.9, control input on pitch and yaw axes are given,
respectively. The sudden changes on the control inputs are observed due to the derivative
term. Additionally, since the yaw error becomes constant or slowly varying after some
time, the derivative term has a small effect in the control input and thus it practically
becomes a P controller and thus could not eliminate the steady-state error as seen in
Figure 5.8.
5.4. Proportional - Integral - Derivative (PID) Control
In proportional-integral-derivative control, the proportional term, the integral term,
and the derivative term are added together. PID controller is defined as
u(t) = KP e(t) +
t∫0
KIe(σ)dσ +KDde(t)
dt(5.9)
where KP is the constant diagonal proportional gain matrix, KI is the constant diagonal
integral gain matrix and KD is the constant diagonal derivative gain matrix. The PID
controller can alternatively be presented as
u(t) = KP
e(t) +1
Ti
t∫0
e(σ)dσ + Tdde(t)
dt
(5.10)
43
0 5 10 15 20 25 30 35 40 45 500
5
10
15
20
25
30
35
40
Time(s)
Deg
ree
Angular Position on Pitch Axis
Position
0 5 10 15 20 25 30 35 40 45 500
5
10
15
20
25
30
Time(s)
Deg
ree
Angular Position on Yaw Axis
Position
Figure 5.7. [PD control] angular position on pitch and yaw axes, respectively.
where KP is the constant proportional gain, Ti is the integral time constant and Td is the
derivative time constant.
PID control has control actions based on the past, the present and the future, which
are due to integral, proportional and derivative terms, respectively. Pure proportional
control will have a steady-state error. The steady-state error can be reduced with a higher
gain but this will result in increasing the oscillation. Adding an integral term helps to
eliminate the steady-state error but it will also increase the tendency for oscillation and
will slow down the response of the system. Thus, a damping effect is required and an
increase in system response is needed. This is provided by adding a derivative term.
All three terms are dependent each other. Their seperate effects on the system can be
summarized as in Table 5.1.
Table 5.1. Independent effects of the gains of PID control
Control effect Rise Time Overshoot Steady-State Error Settling TimeIncreasing KP Decrease Increase Decrease Minor effectIncreasing KI Decrease Increase Eliminate IncreaseIncreasing KD Minor effect Decrease No change Decrease
To experimentally verify the performance of the PID control, we applied the con-
44
0 5 10 15 20 25 30 35 40 45 50−5
0
5
10
15
20
25
30
Time(s)
Deg
ree
Pitch Error
Error
0 5 10 15 20 25 30 35 40 45 50−5
0
5
10
15
20
Time(s)
Deg
ree
Yaw Error
Error
Figure 5.8. [PD control] tracking error on pitch and yaw axes, respectively.
trol input in Equation 5.9 to the TRMS where KP , KI and KD are chosen as
KP =
[450 0
0 2000
], KI =
[20 0
0 60
], KD =
[6000 0
0 4500
]. (5.11)
In Figure 5.10, angular position on pitch and yaw axes are given, respectively. As ex-
pected, PID control gives the best tracking performance. In Figure 5.11, tracking error
on pitch and yaw axes are given, respectively. In this experiment, integral gain is chosen
high enough in order to improve the settling time and to reduce the steady-state error. As
a trade-off, higher overshoot is observed when compared with the PD controller. Since
the PID controller is flexible, the characteristics of the system may be adjusted to achieve
different design requirements as well. In Figure 5.12, control input on pitch and yaw axes
are given, respectively.
5.5. Analysis of the Experimental Results
In the analysis of the experiments, average maximum steady-state errors are cal-
culated Dupree et al. (2011). It is defined as the last 15 seconds of the errors in the
experiments where the total duration was 50 seconds. Average root-mean-square (RMS)
errors and standard deviation (SD) of the errors are calculated. Average RMS control in-45
0 5 10 15 20 25 30 35 40 45 5010
15
20
25
Time(s)
Vol
tage
(V)
Pitch Control Input
Input
0 5 10 15 20 25 30 35 40 45 5010
15
20
25
Time(s)
Vol
tage
(V)
Yaw Control Input
Input
Figure 5.9. [PD control] control input on pitch and yaw axes, respectively.
puts and standard deviation of control inputs are also calculated. The results are shown in
Tables 5.2 and 5.3. The best average maximum SSE are obtained with the PID controller,
as expected. Considering average RMS errors, the worst controller is PI controller due to
higher overshoot. The controllers that contain derivative, which are PD and PID, reduce
overshoot significantly on pitch axis. This results in a lower SD of errors with PD and
PID controller on pitch axis. SD of errors is higher in PI controller due to the oscillatory
characteristic of integral controller.
Table 5.2. Analysis of the errors for different controllers
P control PI control PD control PID controlAvg. Max SSE Pitch 10.2540 7.4826 1.5455 1.0196Avg. Max SSE Yaw 1.9143 0.338 1.4895 0.1856Avg. RMS Error Pitch 14.6281 15.3851 5.1686 5.9592Avg. RMS Error Yaw 3.4801 3.6254 3.0696 3.5022Error SD Pitch 11.5225 15.2474 5.137 6.0039Error SD Yaw 2.9079 3.6482 2.8176 3.4294
46
0 5 10 15 20 25 30 35 40 45 500
10
20
30
40
50
60
Time(s)
Deg
ree
Angular Position on Pitch Axis
Position
0 5 10 15 20 25 30 35 40 45 500
5
10
15
20
25
30
35
40
Time(s)
Deg
ree
Angular Position on Yaw Axis
Position
Figure 5.10. [PID control] angular position on pitch and yaw axes, respectively.
0 5 10 15 20 25 30 35 40 45 50−30
−20
−10
0
10
20
30
40
Time(s)
Deg
ree
Pitch Error
Error
0 5 10 15 20 25 30 35 40 45 50−15
−10
−5
0
5
10
15
20
Time(s)
Deg
ree
Yaw Error
Error
Figure 5.11. [PID control] tracking error on pitch and yaw axes, respectively.
47
0 5 10 15 20 25 30 35 40 45 505
10
15
20
25
Time(s)
Vol
tage
(V)
Pitch Control Input
Input
0 5 10 15 20 25 30 35 40 45 505
10
15
20
25
Time(s)
Vol
tage
(V)
Yaw Control Input
Input
Figure 5.12. [PID control] control input on pitch and yaw axes, respectively.
Table 5.3. Analysis of the control inputs for different controllers
P control PI control PD control PID controlAvg. RMS Control Input Pitch 15.5442 15.3420 15.5367 15.3090Avg. RMS Control Input Yaw 14.0465 13.1041 14.4498 14.7675Control Input SD Pitch 0.0975 0.1654 0.7223 1.5703Control Input SD Yaw 1.7641 2.3914 1.3296 1.8638
48
CHAPTER 6
CONCLUSION
In this thesis, design, development and control of a TRMS were studied. The
design and development can be categorized as
• mechanical system design
• electronic system design
• user interface.
In the mechanical system design, the mechanical components were explained and
the CAD model was shared. In the electronic system design, hardware parts of the TRMS,
mainboard, encoder reader circuits, and motor controller circuits, and the embedded al-
gorithms were presented.
A computer software was developed on LabVIEW Development Environment in
order to monitor the TRMS and to communicate with it online. The computer software
provided the ability to try different control algorithms easily by modifying Matlab script
blocks on LabVIEW.
Nextly, a mathematical model for the TRMS was derived. The Lagrangian-based
general dynamic model in Rahideh and Shaheed (2007) was explained to present the
methodology of developing the dynamic model of a TRMS. The mechanical differences
between the TRMS in Rahideh and Shaheed (2007) and the one we developed were high-
lighted. The parameters of our TRMS were given. It is noted that the dynamic model
of the TRMS was derived for the sake of completeness and was not utilized for control
design purposes.
Finally, P, PI, PD and PID control algorithms were applied and their performances
were observed on the developed TRMS. Several experiments for each controller were
conducted, and the ones that we obtained the best performance in average maximum SSE
were presented. The analysis of the experiments were shared. The experiment results
were compared in :
• Average Maximum SSE
• Average RMS Error
49
• Error SD
• Average RMS Control Input
• Control Input SD.
Review of relevant literature highlighted the fact there is not much past studies
on development of a TRMS in an academic setting. The only past work, according to
our best knowledge, is Verzilli (2007). There were no relevant past work conducted in
Turkish universities. Thus this thesis is one of the few works that focused on design and
development of a TRMS.
There is much to be considered as future work. During the design and develop-
ment phases, the electronic subsystems (i.e. feedback, driver and sensor circuits) of a
control laboratory setup were investigated closely. This knowledge can later be utilized in
design and development of different laboratory setups such as 3 or 4 DOF rotor systems
or inverted pendulum. Removing the computer from the loop and performing control al-
gorithms on the mainboard processor may also be considered as a future work. In this
case, we will not deal with operating system related issues. In this thesis, standard linear
controllers were applied without conducting any stability analysis. Thus possible future
research may focus on investigating the stability of both open-loop and closed-loop sys-
tem. Furthermore, effects of known disturbances on the system may be analyzed. Other
future research may focus on designing nonlinear controllers for TRMSs. Comparing the
performances of the controllers applied on the TRMS and on a laboratory helicopter could
be an interesting future research as well.
50
51
REFERENCES
Ahmad, S. M., A. J. Chipperfield, and M. O. Tokhi (2000). Dynamic modelling and
control of a 2 DOF twin rotor multi-input multi-output system. In Proc. of Conf. of
IEEE Industrial Electronics Society, Nagoya, Japan, pp. 1451–1456.
Bayrak, A., M. H. Salah, N. Nath, and E. Tatlicioglu (2010). Neural network-based
nonlinear control design for twin rotor MIMO systems. In Proc. of Int. Symposium
on Mechanism and Machine Science, Izmir, Turkey, pp. 172–178.
Corradini, M., A. Cristofaro, and G. Orlando (2011). Stabilization of discrete-time
linear systems with saturating actuators using sliding modes: Application to a twin-
rotor system. In Proc. of IEEE Conf. on Decision and Control, Orlando, FL, USA,
pp. 8237–8242.
Dupree, K., P. M. Patre, Z. Wilcox, and W. E. Dixon (2011). Asymptotic optimal
control of uncertain nonlinear systems. Automatica 47(1), 99–107.
Juang, J.-G. and W.-K. Liu (2008). Hardware implementation of a hybrid intelligent
controller for a twin rotor MIMO. In Proc. of Int. Conf. on Innovative Computing
Information and Control, Keelung, Taiwan, pp. 185–185.
Karimi, H. R. and M. R. J. Motlagh (2006). Robust feedback linearization control for a
non-linearizable MIMO nonlinear system in the presence of model uncertainties. In
Proc. of IEEE Int. Conf. on Service Operations, Logistics and Informatics,
Shanghai, China, pp. 965–970.
Liu, C. S., L. R. Chen, B. Z. Li, S. K. Chen, and Z. S. Zeng (2006). Improvement of the
twin rotor MIMO system tracking and transient response using fuzzy control
technology. In Proc. of IEEE Conf. on Industrial Electronics and Applications,
Singapore, pp. 1411–1416.
Lu, T. W. and P. Wen (2007). Time optimal and robust control of twin rotor system. In
Proc. of Int. Conf. on Control and Automation, Guangzhou, China, pp. 1435–1439.
SGS Thomson Microelectronics (1997, July). DMOS Full Bridge Driver L6203
Datasheet.
Rahideh, A. and M. H. Shaheed (2007). Mathematical dynamic modelling of a twin-
rotor multiple input multiple output system. Proc. of Ins. of Mechanical Engineers
Part I: J. Systems and Control Engineering 221,89–101.
52
Rahideh, A. and M. H. Shaheed (2008). Dynamic modelling of a twin rotor MIMO
system using grey box. In Proc. of Int. Symposium on Mechatronics and its
Applications, Amman, Jordan, pp. 237–242.
Rahideh, A., M. H. Shaheed, and H. J. C. Huijberts (2008). Dynamic modelling of a
TRMS using analytical and empirical approaches. Control Engineering Practice
16, 241–259.
Shih, C. L., M. L. Chen, and J. Y. Wang (2008). Mathematical model and set-point
stabilizing controller design of a twin rotor MIMO system. Asian J. Control 10,
107–114.
Åström, K. J. and R. M. Murray (2008). Feedback Systems: An Introduction for
Scientists and Engineers. Princeton, NJ, USA: Princeton University Press.
Su, J. P., C. Y. Liang, and H. M. Chen (2002). Robust control of a class of nonlinear
systems and its application to a twin rotor MIMO system. In Proc. of IEEE Int.
Conf. on Industrial Technology, Bangkok, Thailand, pp. 1272–1277.
Verzilli, L. (2007). Progetto e sviluppo di un controllore a struttura variabile per un twin
rotor, B.S. thesis, Universitá Politecnica delle Marche, Ancona, Italy.
Yu, Z.-R., T.-C. Yang, and J.-G. Juang (2010). Application of CMAC and FPGA to a
twin rotor MIMO system. In Proc. of IEEE Conf. on Industrial Electronics and
Applications, pp. 264–269.