Vous êtes sur la page 1sur 73

SYSTEM IDENTIFICATION AND CONTROL DESIGN &

IMPLEMENTATION OF MAGLEV SYSTEM

A PROJECT REPORT

DEGREE

32

Submitted By
MAMOONA BIRKHEZ SHAMI
MUHAMMAD SARMAD
SALMAN AHMED
TAHA HAMID

BACHELORS
IN
ELECTRICAL ENGINEERING

Year
2014

PROJECT SUPERVISOR
DR. FAHAD MUMTAZ MALIK

NUST COLLEGE OF
ELECTRICAL AND MECHANICAL ENGINEERING

SYSTEM IDENTIFICATION AND CONTROL DESIGN &


IMPLEMENTATION OF MAGLEV SYSTEM

Submitted by:
NS MAMOONA BIRKHEZ SHAMI

2010-NUST-CEME-BE-EE
EE-052

NS MUHAMMAD SARMAD

2010-NUST-CEME-BE-EE
EE-033

NS SALMAN AHMED

2010-NUST-CEME-BE-EE
EE-040

NS TAHA HAMID

2010-NUST-CEME-BE-EE
EE-044

Project Supervisor:
Date:
Dr. Fahad Mumtaz Malik

Head of Department:
Date:
Brig. Basharat

DEPARTMENT OF ELECTRICAL ENGINEERING

COLLEGE OF
ELECTRICAL AND MECHANICAL ENGINEERING
PESHAWAR ROAD, RAWALPINDI
1|Page

DECLARATION
We hereby declare that no portion of the work referred to in this Project Thesis has been
submitted in support of an application for another degree or qualification of this or of any other
university or other institute of learning. If any act of plagiarism found, we are fully responsible
for every disciplinary action taken against us depending upon the seriousness of the proven
offense.

COPYRIGHT STATEMENT

Copyright in text of this thesis rests with the student authors, copies (by any process)
either in full, or of extracts, may be made only in accordance with the instructions given
by the authors and lodged in the Library of NUST College of E&ME. Details may be
obtained by the Librarian, this page must form part of any such copies made. Further
copies (by any process) of copies made in accordance with such instructions may not be
made without the permission (in writing) of the authors.

The ownership of any intellectual property rights which may be described in this thesis is
vested in NUST College of E&ME, subject to any prior agreement to the contrary, and
may not be made available for use by third parties without the written permission of the
College of E&ME, which will prescribe the terms and conditions of any such agreement.

Further information on the conditions under which disclosures and exploitation may take
place is available from the Library of NUST College of E&ME, Rawalpindi.

2|Page

Dedicated to our Beloved Parents and Family Members

3|Page

ACKNOWLEDGEMENTS
First of all, we would like to thank ALLAH (Subhanahuwataala) Who enlightened us with the
knowledge that we needed for our project and gave us strength to accomplish our task.
We acknowledge, with deep gratitude and appreciation, the inspiration, encouragement, valuable
and continuous guidance given to us by Dr. Fahad Mumtaz Malik, we also acknowledge the
immense support of Dr. Shakeel Ahmed (Nescom) and Sir Mukhtar (Nescom) regarding control
design and system identification respectively.
Special thanks to our family members for bearing with us through the tough routine and for
continuously encouraging us.

4|Page

Table of Contents
Abstract ........................................................................................................................................... 8
1

Introduction ........................................................................................................................... 11
1.1

Applications of Maglev .................................................................................................. 11

1.2

Objectives ....................................................................................................................... 13

1.3

Scope of Project ............................................................................................................. 13

Hardware Setup for Magnetic Levitation System ................................................................. 15


2.1

Setup Introduction and Hardware Details ...................................................................... 15

2.2

Sensor Calibration .......................................................................................................... 16

2.2.1
2.3

Actuator Calibration ....................................................................................................... 17

2.3.1
3

Procedure ................................................................................................................ 17

Mathematical Modeling ........................................................................................................ 20


3.1

Motivation ...................................................................................................................... 20

3.2

Modeling Approach........................................................................................................ 20

3.3

Simulink Models ............................................................................................................ 20

3.3.1

Block model ............................................................................................................ 21

3.3.2

S function ................................................................................................................ 21

3.4
4

Procedure ................................................................................................................ 16

Simulated model validation............................................................................................ 21

Linearization ......................................................................................................................... 24
4.1

Taylor Series Expansion................................................................................................. 24

4.2

Linearized Models at Different Points ........................................................................... 25

Black Box System Identification .......................................................................................... 27


5.1

Introduction .................................................................................................................... 27

5.2

Literature Review ........................................................................................................... 27

5.2.1

White box modeling................................................................................................ 27

5.2.2

Grey Box Modeling ................................................................................................ 27

5.2.3

Black Box Modeling ............................................................................................... 27

5.3

Procedure........................................................................................................................ 28

5.4

Model Structure .............................................................................................................. 29

5.5

Identification MATLAB Tool ........................................................................................ 29

5|Page

5.6

Working of MATLAB System Identification Tool........................................................ 30

5.7

Applying System Identification procedure to the Maglev system ................................. 32

5.7.1

Collecting Input-Output Data ................................................................................. 33

5.7.2

Identifying the model .............................................................................................. 36

5.7.3

Selecting the identified model ................................................................................ 39

5.8

Comparison of Identified Model with the Linearized Model ........................................ 42

5.9

Limitations of the Identified Model ............................................................................... 43

Control Design & Implementation........................................................................................ 44


6.1

6.1.1

Introduction ............................................................................................................. 44

6.1.2

Design Steps............................................................................................................ 45

6.1.3

Results ..................................................................................................................... 50

6.1.4

Discretization and Hardware implementation ........................................................ 51

6.2

Lead-Lag Compensator .................................................................................................. 44

H-Infinity........................................................................................................................ 54

6.2.1

Introduction ............................................................................................................. 54

6.2.2

Design Steps............................................................................................................ 55

6.2.3

Simulations ............................................................................................................. 56

6.2.4

Hardware Implementation ...................................................................................... 56

Controller Identification........................................................................................................ 60
7.1

Introduction .................................................................................................................... 60

7.2

Literature Review ........................................................................................................... 61

7.3

Applying Controller Identification Procedure to Maglev system .................................. 61

7.3.1

Finding the input ..................................................................................................... 61

7.3.2

Finding the output ................................................................................................... 62

7.3.3

Identifying the controller ........................................................................................ 63

7.4

Implementing the identified controller on hardware ...................................................... 65

7.5

Comparison of Controller Identification with conventional controllers ........................ 65

7.5.1
7.6
8

Controller Identification Vs. Lag Lead Controller and H infinity controller ......... 66

Limitations ..................................................................................................................... 66

Appendix ............................................................................................................................... 67
A.

S-Function ...................................................................................................................... 67

6|Page

B.

Sensor1.m File................................................................................................................ 68

C.

Actuat1.m File ................................................................................................................ 70


Bibliography ......................................................................................................................... 72

7|Page

Table of Figures:
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.
FIG.

1-1 ...................................................................................................................................................................... 14
2-1 HARDWARE ASSEMBLY ........................................................................................................................ 15
3-1FREE BODY DIAGRAM ............................................................................................................................ 20
3-2 SIMULINK BLOCK DIAGRAM OF PLANT ........................................................................................... 21
3-3 VALIDATION SETUP ............................................................................................................................... 22
3-4 VALIDATION GRAPHS ........................................................................................................................... 23
4-1 STEP RESPONSE AT DIFFERENT EQUILIBRIUM POINTS ................................................................ 26
5-1: DIFFERENT MODELING STRUCTURES. ............................................................................................. 29
5-2: SYSTEM ID TOOL BOX MAIN WINDOW. ........................................................................................... 30
5-3: STEP INPUT TO THE OPEN LOOP SYSTEM. ....................................................................................... 34
5-4: STEP RESPONSE OF THE OPEN LOOP SYSTEM. ............................................................................... 34
5-5: RAMP INPUT TO THE OPEN LOOP SYSTEM. ..................................................................................... 34
5-6: RAMP RESPONSE OF THE OPEN LOOP SYSTEM. ............................................................................. 34
5-7: SINE INPUT TO THE OPEN LOOP SYSTEM. ....................................................................................... 35
5-8: SINE RESPONSE OF THE OPEN LOOP SYSTEM. ............................................................................... 35
5-9: SINE SWEEP INPUT TO THE SYSTEM. ................................................................................................ 35
5-10: SINE SWEEP RESPONSE OF THE OPEN LOOP SYSTEM. ............................................................... 35
5-11: SELECTED MODEL OUTPUT GRAPHS FOR THE STEP INPUT...................................................... 36
5-12: SELECTED MODEL OUTPUT GRAPHS FOR THE RAMP INPUT.................................................... 37
5-13: SELECTED MODEL OUTPUT GRAPHS FOR THE SINE INPUT. ..................................................... 38
5-14: SELECTED MODEL OUTPUT GRAPHS FOR THE SINE SWEEP INPUT. ....................................... 39
5-15: IDENTIFIED MODEL RESPONSES TO STEP INPUT AND CORRESPONDING ERROR. .............. 40
5-16 : IDENTIFIED MODEL RESPONSES TO RAMP INPUT AND CORRESPONDING ERRORS.......... 41
5-17: IDENTIFIED MODEL RESPONSES TO SINE INPUT AND CORRESPONDING ERRORS. ............ 41
5-18: IDENTIFIED MODEL RESPONSES TO SINE SWEEP INPUT AND CORRESPONDING ERRORS.
........................................................................................................................................................................... 42
5-19: RESPONSE OF THE MODELS TO A STEP INPUT. ............................................................................ 43
5-20: ERROR PLOTS FOR LINEARIZED AND IDENTIFIED MODELS. .................................................... 43
6-1 : NEGATIVE FEEDBACK CONFIGURATION USED IN LEAD LAD COMPENSATOR DESIGN .... 44
6-2: OPEN LOOP FREQUENCY RESPONSE OF THE PLANT .................................................................... 45
6-3 : BODE PLOTS FOR OPEN LOOP PLANT AND LEAD COMPENSATOR .......................................... 47
6-4: OPEN LOOP FREQUENCY RESPONSE WITH LEAD COMPENSATOR ........................................... 48
6-5: BODE PLOTS FOR GCLAG AND LEAD COMPENSATED SYSTEM ................................................. 49
6-6 : OPEN LOOP FREQUENCY RESPONSE OF LAG LEAD COMPENSATED SYSTEM ...................... 50
6-7: COMPARISON OF BODE PLOTS THREE DIFFERENT COMPENSATED SYSTEM ........................ 50
6-8: STEP RESPONSE OF LAG LEAD COMPENSATED SYSTEM ............................................................ 51
6-9: COMPARISON OF STEP RESPONSE OF SIMULATION AND HARDWARE .................................... 52
6-10: DISPLAYING NONLINEAR BEHAVIOR AT LARGE DISPLACEMENTS ....................................... 53
6-11: INSTABILITY OCCURRING AT DISPLACEMENT OF -10 CM ........................................................ 54
6-12: POSITIVE CONFIGURATION USED IN H INFINITY LOOP SHAPING DESIGN ........................... 55
6-13: COMPARISON OF STEP RESPONSE OF LAG LEAD AND H INFINITY LS CONTROLLED
SYSTEM ............................................................................................................................................................ 56
6-14 :COMPARISON OF STEP RESPONSE OF H INFINITY LS CONTROLLED SYSTEM ..................... 58
6-15( DISPLAYING H INFINITY LS ROBUSTNESS OVER LAG LEAD COMPENSATOR ) ................... 59
7-1: A CLOSED LOOP SYSTEM ..................................................................................................................... 60

8|Page

FIG. 7-2:INPUT OUTPUT RELATIONSHIP. .......................................................................................................... 60


FIG. 7-3: OPEN LOOP BODE PLOT OF ORIGINAL TRANSFER FUNCTION (G) AND TRANSFER
FUNCTION WITH ADDED ZEROES (G_MOD). .......................................................................................... 62
FIG. 7-4: STEP RESPONSE OF ORIGINAL TRANSFER FUNCTION (G) AND TRANSFER FUNCTION WITH
ADDED ZEROES (G_MOD). ........................................................................................................................... 63
FIG. 7-5: MAGNITUDE AND PHASE PLOTS FOR G AND GK. .......................................................................... 64
FIG. 7-6:IDEAL STEP RESPONSE AND THE RESPONSE ACHIEVED BY USING THE IDENTIFIED
CONTROLLER. ................................................................................................................................................ 64
FIG. 7-7CLOSED LOOP SYSTEM RESPONSE OF HARDWARE AND SIMULATION. .................................... 65
FIG. 7-8: COMPARISON PLOTS FOR DIFFERENT CONTROLLERS................................................................. 66

9|Page

Abstract
A linear model of a magnetic levitation module (ECP model 730) has been identified using
system identification techniques. The accuracy of the identified model has been affirmed by its
comparison with the mathematically derived linear model. Furthermore, three different linear
control schemes which include conventional lag lead compensator, H infinity loop shaping
controller and a relatively newer one which we name controller identification have been
implemented on the ECP model 730.

10 | P a g e

1. INTRODUCTION

Introduction

Maglev (derived from magnetic levitation) is a method of propulsion that uses magnetic
levitation to propel vehicles with magnets rather than with wheels, axles and bearings. With
maglev, a vehicle is levitated a short distance away from a guide way using magnets to create
both lift and thrust.
Maglev vehicles move more smoothly and somewhat more quietly than wheeled mass
transit systems. Their non-reliance on traction and friction means that acceleration and
deceleration can surpass that of wheeled transports, and they are unaffected by weather. The
power needed for levitation is typically not a large percentage of the overall energy
consumption; most of the power is used to overcome air resistance (drag), as with any other
high-speed form of transport. Although conventional wheeled transportation can travel very
quickly, a maglev system allows routine use of higher top speeds than conventional rail, and it is
this type which holds the speed record for rail transportation.
Earnshaw's theorem proves that using only paramagnetic materials (such as ferromagnetic iron)
it is impossible for a static system to stably levitate against gravity.For example, the simplest
example of lift with two simple dipole magnets repelling is highly unstable, since the top magnet
can slide sideways, or flip over, and it turns out that no configuration produced adding more
magnets can produce stability.However, controllers can be designed to control the magnetic
force which can allow stability to be achieved.

1.1 Applications of Maglev


Magnetic levitation systems can find application in wide area such as maglev passenger trains,
levitation of wind tunnel model, frictionless bearings, etc. In particular, the magnetic
levitation train reduces rolling friction between the locomotive and the railway, much higher
speeds and less energy lost to friction can be achieved.

Bullet Trains

High speed trains in Europe and Japan are perhaps the best example of magnetic levitation
technology. According to the Los Alamos National Laboratory, Germany, France and Japan have
developed bullet trains with speeds ranging between 150-180 mph. This exceeds the speed of
conventional trains which are capable of up to 110 mph. Though the magnetic suspension system
of bullet trains allows for greater speeds, the technology is currently expensive to implement and
maintain.

Magnetic Bearings

Magnetic bearings are another application of magnetic levitation technology formed by


electromagnetic suspension and electromagnets. Magnetic bearings support loads without any
11 | P a g e

1. INTRODUCTION
kind of physical contact. The benefits of this include reduced friction, reduced wear on
machinery and the highest speeds of any kind of bearing. Disadvantages of magnetic bearings
include attraction difficulties when increasing or decreasing bearing distances from levitating
objects.

Flywheels and Levitation Melting

Two additional scientific applications for magnetic levitation include flywheels and levitation
melting. Flywheels are rotating mechanisms used to store energy. Magnetic levitation can be
used to rotate flywheels thereby assisting with energy storage. With levitation melting, it is
possible to levitate small amounts of metal and eventually melt the metal through use of
magnetic forces and electricity. Levitation melting has been commercially tested and is a viable
application of the technology.
Maglev usages from view point of engineering science can be categorized and summarized as
follows:

Transportation engineering (magnetically levitated trains, flying cars, or personal rapid


transit (PRT), etc.),

Environmental engineering (small and huge wind turbines: at home, office, industry,
etc.),

Aerospace engineering (spacecraft, rocket, etc.),

Military weapons engineering (rocket, gun, etc.),

Nuclear engineering (the centrifuge of nuclear reactor),

Civil engineering including building facilities and air conditioning systems (magnetic
bearing, elevator, lift, fan, compressor, chiller, pump, gas pump, geothermal heat pumps,
etc.),

Biomedical engineering (heart pump, etc.),

Chemical engineering (analyzing foods and beverages, etc.),

Electrical engineering (magnet, etc.),

12 | P a g e

1. INTRODUCTION

Architectural engineering and interior design engineering including household and


administrative appliances (lamp, chair, sofa, bed, washing machine, room, toys (train,
levitating spacemen over the space ship, etc.), stationery (pen), etc.),

Automotive engineering (car, etc.),

Advertising engineering (levitating everything considered inside or above various frames


can be selected).

1.2 Objectives

The first objective of this project is to implement different system identification


techniques and achieve a model as close to the actual model as possible.

The second objective is to design such a linear control technique that stabilizes the
system over the range of operation and shows a linear response.

The third objective is to identify the transfer function of an ideal controller using system
identification techniques.

Various system identification models are present e.g. ARMAX, ARX etc. Based on the input and
output data, a system model can be obtained of the desired order. The response of this identified
model is then compared with the actual hardware to validate the identified model.
A lot of research has been done on control design techniques for maglev systems. Various linear
and non-linear control schemes, robust stabilization techniques and intelligent adaptive control
techniques have been implemented on maglev systems. For the purpose of this project, the
discussion has been limited to Lead-Lag compensator and H-infinity Loop Shaping controller.
H-infinity Loop Shaping controller shapes the frequency response of the plant using Lead-Lag
compensator as weights in its standard notation and robustly stabilizes the plant .
Controller identification is a relatively new field. This domain of study entails acquiring input
data and required output data (based on the performance and robustness criteria) and obtaining a
transfer function using identification techniques. This technique removes the restrictions on the
designer to use a set of equations to implement a particular kind of controller. This also waives
the tedious work involved in solving equations and designing a particular kind of controller.

1.3 Scope of Project


The scope of this project was:

To calibrate the hardware


Model the plant dynamics and acquire a mathematical non-linear model of the system
Linearize the 2nd order system at different equilibrium points and use the best model

13 | P a g e

1. INTRODUCTION

Acquire input and output data and get models of different orders using Ident Tool of
MATLAB and use the best fit model
Implement the model using Simulink and S-Function
S
Develop Lead-Lag
Lag Compensator and implement in Simulink and on hardware and
compare the results
Develop H-infinity
infinity loop shaping
shapi
controller and implement it in Simulink and on
hardware and compare the results
Using the input and required output data, identify the controller using Ident Tool

Hardware
Implementation &
Validation
Implementing LeadLag & H-Infinity
Data Acquisition
and system
Identification
Mathematical
Modelling &
Linearization

Fig. 1-1

14 | P a g e

Controller
Identification

2. HARDWARE SETUP FOR MAGNETIC LEVITATION SYSTEM

Hardware Setup for Magnetic Levitation System

2.1 Setup Introduction and Hardware Details


Seen in Fig. 2-1, each consists of an electromechanical plant and a full complement of
control hardware and software. The user interface to the system is via an easy to use,
PC based environment that supports a broad range of controller specification, trajectory
generation, data acquisition, and plotting features. The systems are designed to accompany
introductory through advanced level courses in control systems.

Fig. 2-1 Hardware Assembly

The Model 730 Magnetic Levitation (Maglev) apparatus may be quickly transformed into
a variety of single input single output (SISO) and multi-input multi-output (MIMO)
configurations. By using repulsive force from the lower coil to levitate a single magnet,
an open loop stable SISO system is created. Attractive levitation via the upper coil affects an
open loop unstable system. Two magnets may be raised by a single coil to produce a SIMO
plant. If two coils are used a MIMO one is produced. These may be locally stable or unstable
depending on the selection of the magnet polarities and the nominal magnet positions. The plant
has inherently strong nonlinearities due to the natural properties of magnetic fields. These may
be compensated for in feed forward using derived or provided algorithms so that the
control problem may be approached as that of a linear or nonlinear system depending on
the desired course of study. Thus this dynamically rich system provides a test bed for
experiments ranging from demonstration of fundamental principles to advanced research. For
the purpose of this project, we will focus on the SISO system of the lower coil.
The experimental system is comprised of the three subsystems shown in Fig. 2-1. The first of
these is the electromechanical plant, which consists of the Maglev apparatus including its
actuators and sensors. The design features two high field density rare earth magnets and high
flux drive coils to provide more than 4 cm. of controlled levitation range. Laser sensors provide
15 | P a g e

2. HARDWARE SETUP FOR MAGNETIC LEVITATION SYSTEM


non-contacting position feedback and incorporate proprietary conditioning electronics for signal
noise reduction and ambient light rejection. An optional turntable incorporates a high-speed
conductive spin platter that interacts with the permanent magnet in such a way as to induce a
traveling current and cause the magnet to levitate. Magnet position control is accomplished
through spin speed changes in the platter.The next subsystem is the real-time controller unit
which contains the digital signal processor (DSP) based real-time controller, servo/actuator
interfaces, servo amplifiers, and auxiliary power supplies. The DSP based on the M56000
processor family - is capable of executing control laws at high sampling rates allowing the
implementation to be modeled as being in continuous or discrete time. The controller also
interprets trajectory commands and supports such functions as data acquisition, trajectory
generation, and system health and safety checks. A logic gate array performs encoder pulse
decoding (optional turntable sensing). Four 16 bit analog-to-digital (ADC) converters are used
to digitize the laser sensor signals. Two optional auxiliary digital-to analog converters (DAC's)
provide for real-time analog signal measurement. This controller is representative of modern
industrial control implementation. The third subsystem is the Executive program which runs
on a PC under the Windowsoperating system. This graphical user interface (GUI) based
program is the user's interface to the system and supports controller specification, trajectory
definition, data acquisition, plotting, system execution commands, and more. Controllers
are specified via an intuitive C-like language that supports easy generation of basic or highly
complex algorithms. A built-in auto compiler provides for efficient downloading and
implementation of the real-time code by the DSP while remaining within the Executive. The
interface supports a wide assortment of features that provide a friendly yet powerful
experimental environment.

2.2 Sensor Calibration


The approach will be to measure the specific input/output characteristics of the laser sensor and
magnet/coil actuators and the magnet/magnet interactions as they vary with relative position. The
laser position nonlinearity results from the nature of the change of light intensity on the detector
with magnet position and is associated with the particular sensor used. The strong magnetic field
nonlinearities, however, are inherent in this class of magnetic systems.
2.2.1 Procedure
1. Setup the mechanism with one magnet only resting on the lower drive coil. Make certain that
your hands are clean at all times when touching the magnet avoid touching the white surface.
Power to the Control Box should be off.
2. Enter the Setup Sensor Calibration box via the Setup menu, and verify that Use Raw Sensor
Counts and Apply Thermal Compensation are selected. Select OK to exit to the background
screen. Select Abort Control to make sure that no real-time controller is active. Turn on power to
the Control Box. You should see the laser light beam on the upper and lower magnet surfaces.
Move the magnet manually up and down to verify that the sensor counts displayed on the
Background Screen are changing.
16 | P a g e

2. HARDWARE SETUP FOR MAGNETIC LEVITATION SYSTEM


3. Sight along the top of the magnet and adjust the ruler height so that the 0 cm position precisely
matches the plane of the top of the magnet.
4. Record the raw sensor output at the 0 cm. position as read from the Sensor 1display on the
Background Screen. Refer to the notes below regarding moving the magnet to the desired
calibration positions and reading the sensor counts. Manually move the magnet to the 0.50 cm
position and read and record the raw sensor output. Continue moving and recording the sensor
data according for the magnet positions in the Table. There will be some noise in the sensor
reading; you should visually average the values displayed. You need only read the sensor to
three significant digits for the purposes here.
Magnet Position for Sensor#1 (cm) Y1raw (Sensor 1, count(s))
8324
0
5093
1
3296
2
2053
3
1243
4
650
5
224
6
Table 2-1 Sensor Calibration

Using sensor1.m file for curve fitting, the equation constants come out to be:
= 17632000
= 2166915
= 5739
= 1.9731
The values when plugged in the ECP software results in a sensor gain of 1000000 counts / meter.

2.3 Actuator Calibration


The mechanism should be in the same configuration as in the last section. Assure that the north
pole of the magnet is facing upward. The ruler should again be adjusted to measure off the upper
surface of the magnet when it is resting in its lowermost position.
2.3.1 Procedure
1. Write a simple real-time algorithm to activate actuator coil #1 (i.e. put control effort values on
the DAC) with a constant control effort of 5000 counts.
2. Implement this algorithm using the following steps:
a) Enter Setup Control Algorithm via the Setup menu and select Edit Algorithm. You are now in
the control algorithm editor. If the editor contains any text select New under File.

17 | P a g e

2. HARDWARE SETUP FOR MAGNETIC LEVITATION SYSTEM


b) Type in your algorithm. Select Save as and choose an appropriate name and directory to
save this algorithm in. Close the editor by either selecting Save Changes and Quit or simply
clicking on the upper right hand button.
c) Stay well clear of the apparatus when initially performing the next step. Select Implement
Algorithm to begin immediate execution of your algorithm. You should see the lower magnet
levitate roughly 1 cm.
3. Record the height of the magnet corresponding to 5000 counts in a table. You may wish to
spin the magnet (again touching only its edge) to reduce the effects of friction so that the true
equilibrium height is observed.
4. Reenter the algorithm editor via Edit Algorithm, reduce the control effort to4000 counts, and
select Save Changes and Quit, and Implement Algorithm. You should notice the magnet height
become lower. Record the magnet height.
5. Repeat step 4 to find the control effort value at which the magnet is lifted only a very slight
amount above the support pads (i.e. the 0+ position). Again, you may wish to spin the magnet to
reduce the effects of friction.
6. Repeat step 4 for the remaining control effort values of Table. Select Abort Control
immediately after measuring magnet height to minimize heat buildup in the coil and servo
amplifiers during exposure to the higher control effort values (those greater than 10,000 counts).
Do not exceed 22,000 counts of control effort.
Magnet Position (cm) U1raw (Uncompensated Control Effort, counts)
2000
0
2100
0.1
2300
0.3
2500
0.6
2800
0.83
3000
0.88
3500
1
4000
1.3
4500
1.6
5000
1.9
6000
2.16
7000
2.4
8000
2.8
9000
3.12
10000
3.18
18 | P a g e

2. HARDWARE SETUP FOR MAGNETIC LEVITATION SYSTEM


3.3
3.69
3.7
3.95
3.99

11000
12000
14000
18000
22000
Table 2.2 Actuator Calibration

Using actuat1.m file for curve fitting: However the values of a1 and b1 were later changed by
hit and trial using the experiment mentioned in the manual.
= 1.04
= 6.2

19 | P a g e

3. MATHEMATICAL MODELING

Mathematical Modeling

3.1 Motivation
In control systems, any control technique for implementation requires a system model on
simulation. This is required because we cannot simply move on to the hardware in first go. We
need to be sure about how our control
con
technique is going to change the system. For that, it is
important to have a mathematical model of our system through which we can anal
analyze the system
responses beforehand.

3.2 Modeling Approach


A second order differential equation is
derived using the Newton's second law of
motion using the following free body
diagram. Only the lower magnet is taken
into consideration.

( + 100 )

Fig. 3-1free
free body diagram

Where
=

=
= 1.04
= 6.2
.

1.1

3.3 Simulink Models


The nonlinear system
tem equation is implemented in Simulink
S
using two different approaches.
1. Block model
20 | P a g e

3. MATHEMATICAL MODELING
2. S - function
Two approaches are used to verify the results of each other. This is done to boost our confidence
that the differential equation is implemented correctly.
3.3.1

Block model
double

double

double

Control effort
(counts)

1/0.121

1
s

double

Product

double

double

1
s

Integrator
Limited

Integrator1
1/m

1
air gap
(m)

Product4
0.121*9.8

double
double

double

double

mg

1.1
Converting m to cm

Friction Coefficient

Product1

double

Add
1

double

Constant2

double

1.04

double

double

double

Math
Function

double

100

6.2

Constant4

Fig. 3-2 Simulink Block Diagram of Plant

3.3.2 S function
In this tool, the entire differential equation is implemented in a code. The code is imported in the
S-function block of Simulink. The code is present in the appendix.

3.4 Simulated model validation


Once the working model was obtained, its response was compared with that of the hardware.
Similar inputs are given to both the systems, hardware and simulation, and their responses were
compared.
In order to cope up with the mechanical restriction at y = 0 cm. The magnetic disk is first
levitated at y = 2cm and then different inputs were given.

21 | P a g e

3. MATHEMATICAL MODELING

Fig. 3-3 Validation Setup

The results were quite satisfactory and following were noted.


The overshoot in the simulated response is due to the selection of damping coefficient c
using hit and trial to match.
Increasing c will reduce overshoot.
Transients and steady state of both systems are significantly similar

22 | P a g e

3. MATHEMATICAL MODELING
4

Impulse Response

x 10

4.5

Response to Step Input

x 10

Real System Response


Simulated System Response

Actual Hardware
Simulated Model

Sensor Position(counts)

Sensor 1 position (counts)

3.5

2.5

0.2

0.4

0.6

0.8

1
1.2
Time (s)

1.4

1.6

1.8

0.2

0.4

0.6

(a)

1
1.2
time(sec)

1.4

1.6

1.8

(b)

4.5

0.8

Sine Sweep Response

x 10

Actual Plant
Simulated Nonlinear Model

Sensor 1 position (counts)

3.5
3
2.5
2
1.5
1
0.5
0

8
Time (s)

(c)
Fig. 3-4 Validation Graphs

23 | P a g e

10

12

14

4. LINEARIZATION

Linearization

4.1 Taylor Series Expansion


Once simulated model was validated (Increasein our Confidence ) the model was linearized
using Taylor series expansion .

Using Taylor series expansion about equilibrium point (u


( 0, y0)

Plugging it in first equation and with some manipulations, thee linear model obtained is:

Where m = 0.121 kg
c = 1.1
a = 1.04
b = 6.2
u0 = 5575 counts
y0 = 0.02 m

24 | P a g e

4. LINEARIZATION

4.2 Linearized Models at Different Points


Once linearization was done, linear models were obtained at different equilibrium points to see
how the system response varies if operating conditions are changed. Following table shows the
linearized models of Simulated Nonlinear model at different operating points. These were
developed using Linear analysis tool of Matlab.

height (cm)

Control
Effort
(Counts)

3314.16

( )=

0.002957
+ 9.091 + 544.4

1.5

4335.1855

( )=

0.002261
+ 9.091 + 509.1

5575

( )=

0.001757
+ 9.091 + 477.98

2.5

7065.15

( )=

0.001387
+ 9.091 + 450.6

8834.78

( )=

0.001109
+ 9.091 + 426.1

3.5

10917.7

( )=

0.0008976
+ 9.091 + 404.1

13348.89

( )=

0.0007341
+ 9.091 + 384.3

Transfer Function

Table 4-1

Different step inputs were given to each model to compare the output displacement. It is evident
from the graphs that there is a significant difference in displacement in (m) between all models.
25 | P a g e

4. LINEARIZATION
The model at 1cm has the maximum displacement whereas the model linearized at 4cm has the
least displacement for equal control effort (counts). This suggests that controllers designed for
one linear model will not give us the same performance at other operating points.

-3

4.5

-3

Step Response (Control Effort (500 counts)

x 10

1cm
1,5 cm
2 cm
2.5 cm
3 cm
3.5 cm
4 cm

4
3.5

2.5
2

5
4

1.5

0.5

0.2

0.4

0.6

0.8

1
time(sec)

1.2

1.4

1.6

1.8

1cm
1.5cm
2cm
2.5cm
3cm
3.5cm
4cm

Height ( m )

Height ( m )

Step Response (Control Effort (1000 counts)

x 10

0.2

0.4

0.6

0.8

(a)

1
time(sec)

(b)

Step Response (Control Effort (2000 counts)


0.018
1cm
1.5cm
2cm
2.5cm
3cm
3.5cm
4cm

0.016

0.014

Height ( m )

0.012

0.01

0.008

0.006

0.004

0.002

0.2

0.4

0.6

0.8

1
time(sec)

1.2

1.4

1.6

(c)

Fig. 4-1 Step Response at different equilibrium points

26 | P a g e

1.8

1.2

1.4

1.6

1.8

5. BLACK BOX SYSTEM IDENTIFICATION

Black Box System Identification

5.1 Introduction
In many practical scenarios in daily life in order to apply control on a specific plant the transfer
function is not easily determinable or is not known at all. In such situation a hit and trial
approach is used to apply a control scheme on the particular plant. But system identification not
only helps in finding a transfer function but also helps in applying a control scheme on the plant
by using that transfer function.
Therefore system identification is very important especially in case of plants where a hit and trial
approach is not feasible.
In this section the procedure to identify the model of the ECP 730 Maglev system and then
compare the identified transfer function with the actual model and linearized model to determine
the level of accuracy of the identified data is presented.
This identified model is also used as the basis to design different controllers for the plant.

5.2 Literature Review


System identification is a procedure whereby a mathematical model for a dynamical systemis
developed usingmeasured data. The three main kinds of system identification are given below:
1) White box modeling
2) Grey box modeling
3) Black box modeling
5.2.1 White box modeling
It is the creation of a model for the system using first principlese.g. a model for a physical
process can be made using Newtons equations. However in many cases this becomes complex
or impossible and therefore this type of modeling is limited.
5.2.2 Grey Box Modeling
In this model complete information about the inner working of the system is not available but
due to a little insight into the system as well as using measured experimental data a model is
constructed which is a representation of the system.
5.2.3 Black Box Modeling
In this type of modeling the system is a black box i-e nothing is known about the dynamics of the
system and the entire model is formed using input output experimental data. It is not possible to
identify such a model which exactly represents the system. The acceptance of the model depends
on usefulness rather than truth. [1] [2]

27 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION

5.3 Procedure
1. The data record. The input-output data are sometimes recorded during a specifically designed
identification experiment, where the user may determine which signals to measure and when to
measure them and may also choose the input signals. The object with experiment design is thus
to make these choices so that the data become maximally informative, subject to constraints that
may be at hand. In other cases the user may not have the possibility to affect the experiment, but
must use data from the normal operation of the system.
2. The set of models. A set of candidate models is obtained by specifying within which collection
of models we are going to look for a suitable one. This is no doubt the most important and, at the
same time, the most difficult choice of the system identification procedure. It is here that a priori
knowledge and engineering intuition and insight have to be combined with formal properties of
models. Sometimes the model set is obtained after careful modeling. Then a model with some
unknown physical parameters is constructed from basic physical laws and other well-established
relationships. In other cases standardlinear models may be employed, without reference to the
physical background. Such a model set, whose parameters are basically viewed as vehicles for
adjusting the fit to the data and do not reflect physical considerations in the system, is called a
black box. Model sets with adjustable parameters with physical interpretation may, accordingly,
be called gray boxes.
3. Determining the "best" model in the set, guided by the data. This is the identification method.
The assessment of model quality is typically based on how the models perform when they
attempt to reproduce the measured data.

28 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION

5.4 Model Structure


There is a wide variety of model structures which can be identified some of them are as follows:

Fig. 5-1: Different modeling structures.

For this model there is a need to find the parameters that are associated with that particular
model. For the purpose of this project least squares algorithm has been used. [1]

5.5 Identification MATLAB Tool


MATLAB provides a comprehensive identification tool made by Lennart Ljung. This tool gives
the user all the options to identify a systems model of a particular type with a particular order.
Various type of models structures can be identified given the input and output data and the tool
box in turn provides a transfer function which is a representation of that system [2]. A layout of
the tool box is shown below:

29 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION

Fig. 5-2: System ID tool box main window.

5.6 Working ofMATLABSystem Identification Tool


In order to understand the working of the MATLAB tool the algorithm running behind the
System ID tool is used to find the parameters of the ARX model using the least squares
algorithm. The algorithm and procedure to apply least square algorithm for parameter estimation
of the most basic ARX model structure is summed up below:
Polynomial order: na=2, nb=1, nk =1;
nk is the order of the delay i-e we will use u[k-1] as the input term as shown below.
[ ]=

[ 1]

[ 2] +

[ 1] + [ ]

The above equation is the equation for the ARX model under consideration. Noise has been
treated as direct input. Using MATLAB tool box the parameters estimates yield the following
numerical values for the parameters
a1= -1.8894

a2= 0.9289

b= 0.1068

Plugging these parameters in the above equation will define the complete ARX model. Up till
now MATLABs system identification tool has done all the work.

30 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION


In order to derive the ARX model parameters least squares algorithm can be used and the results
can be compared with the above found parameters which have been found using the MATLAB
System Id tool. To find parameters a1, a2, b without getting any help from System Id tool the
following procedure can be used
Linear model is
[ ]=

+ [ ]

e[n] is the white noise which will obviously not be a part of the linear predictor ,thus linear
[ ]=
predictor is
Then error between predictor and linear model at any given k is
[ ]= [ ] [ ]
The residual for all values of k can be expressed in vector form as follows

[1]

[ ]

[1]
[1]

[ ]
[ ]

Then the loss function can be written as


( )=

=
The optimal estimate
= (

) (

[ ]

) (

can be found by solving,

( ) = 0 which gives the following result.

)..equation # 1

For simplest ARX model which is used above the optimal estimate is equal to
1
= 2
So putting values in the equation #1 and after solving the following particular equation for the
ARX model parameters can be obtained. In this case:

can be given as follows

31 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION

[0]
[1]
[0]

[ 1]
[ 2]
[ 1]

[ 1]

[ 1] [ 2]

[ 2] [ 1]

[ 2]

[ 1] [ 1]

[ 1] [ 2]

[0]

[ 1]

[1]

[ 2]

[ 1] [ 1]

[ 2] [ 1]

[ 1]

[0]

[ 1]

[ 1] [ ]

[ 2] [ ]

[ 1] [ ]

After finding the above equation the same input output data was used that was given to the
system identification tool box for finding the ARX model. And a code in MATLAB can be
written to solve the above given matrix equation for that particular input output data and thus
can be found out which comes out to be:
1.8894
= 0.8915
0.1005
Hence the parameters become
a1=-1.8894,

a2=0.8915,

b=0.1005

These values are very near to the values which were found by the system identification tool.
ARX model parameters can be derived while being independent of the system identification tool.
And after finding out those parameters, they can be compared with the parameters of the system
identification tool. The comparison for the values obtained from manual derivation and those
from System Id tool is given below:

Identification Tool
Manual Derivation

a1
-1.8894
-1.8894

a2
0.9289
0.8915

b
0.1068
0.1005

Table 5-1 Comparison of computer calculated values with manually calculated values.

5.7 Applying System Identification procedure to the Maglev system


A step by step method of applying the system identification procedure to the maglev
system is explained in this section.

32 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION


5.7.1

Collecting Input-Output Data

The first step towards system identification is to apply suitable input to the actual system
and collect the output and input data. A rich input should be selected which excites all the states
of the system. The ECP module attached with the system provides a range of inputs that can be
applied to it. To achieve a better identified model and to maintain generality, four different
inputs were considered.
Input 1 was a step input with an amplitude of 4000 counts, dwell time of 1 s and 2
repetitions. Input 2 was a ramp input with distance of 4000 counts, velocity of 4000 counts,
dwell time of 2 s and 2 repetitions. Input 3 was a sine input with amplitude of 4000 counts,
frequency of 1 Hz and 2 repetitions. Input 4 was a sine sweep input with an amplitude of 2000
counts, frequency range from 1 to 30 Hz and sweep time of 20 s.
Note: The given specifications of the inputs are in accordance with the ECP software. To get
more information regarding the terminology please refer to the manual of the ECP system.[3]
Since the equilibrium point of 2 cm was chosen, first the disc had to be levitated to this
height before application of the input. Therefore this identification procedure returns a linear
identified system with an equilibrium point of 2 cm. The plots of the input output data collected
are provided below. The y-axis represents y in counts and x-axis represents time in seconds.

33 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION

Hardware Input

2.5

4000
3500

Hardware Output

x 10

Height (counts)

Input (counts)

3000
2500
2000
1500

1.5

0.5

1000

500
0

-0.5

Time (s)

Time (s)

Fig. 5-3: Step Input to the open loop system.

Fig. 5-4: Step Response of the open loop system.

Hardware Input

Hardware Output

4000

12000

3500
10000

8000

2500

Height (counts)

Input (counts)

3000

2000
1500

6000

4000

1000
2000

500
0

6
Time (s)

Fig. 5-5: Ramp Input to the open loop system.

34 | P a g e

10

Time (s)

Fig. 5-6: Ramp response of the open loop system.

10

5. BLACK BOX SYSTEM IDENTIFICATION

Hardware Input

4000

1.5

3000

1
0.5

1000

Height (counts)

Input (counts)

2000

0
-1000
-2000

0
-0.5
-1
-1.5

-3000
-4000

-2

0.5

1.5

2
2.5
Time (s)

3.5

Fig. 5-7: Sine input to the open loop system.

-2.5

1500

1000

500

Height (counts)

0
-500

-1500

-2

10

15
Time (s)

Fig. 5-9: Sine sweep input to the system.

35 | P a g e

1.5

20

2
2.5
Time (s)

3.5

25

30

Hardware Output

x 10

0
-1

-1000

0.5

2000

-2000

Fig. 5-8: Sine Response of the open loop system.

Hardware Input

Input (counts)

Hardware Output

x 10

-3

10

15
Time (s)

20

25

Fig. 5-10: Sine sweep response of the open loop system.

30

5. BLACK BOX SYSTEM IDENTIFICATION


The sampling time for all these plots is 0.001768 s which is equal to 1 servo cycle of the ECP
module.
5.7.2

Identifying the model

The input output data was exported to the System Identification toolbox in MATLAB. The data
was preprocessed before applying the estimation procedure. Preprocessing removes any trends in
the data and divides the data into two parts: one for identification and the other for validation of
the identified model. For the purpose of this experiment ARX and ARMAX models were
considered. It was decided to minimize the complexity of the system by choosing a lower order
model such as a 2nd order model. The estimation focus was on Prediction and minimum least
squares method was used to estimate the parameters.
For each input a number of models were estimated and their output performance compared using
the Model Output plots of the System Identification toolbox. It was observed that for a second
order model best fit percentage varied from 40 to 75 % and to achieve a best fit percentage of
around 80% a much higher order was required. ARMAX models showed better estimation than
ARX models in most cases.
The model output graphs for selected step data are provided below:
4

1.5

Measured and simulated model output

x 10

arx221 (42.83)
arx931 (81.77)
amx2111 (79.06)
Validation Data

0.5

-0.5

-1

-1.5
2.5

3.5

4.5

Time

Fig. 5-11: Selected Model output graphs for the step input.

36 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION


It can be seen that ARX model with the order [9 3 1] gives the highest best fit percentage
(81.77%) however a much lower order ARMAX model with order [2 1 1 1] provides an equally
good best fit percentage (79.06%). This model preserves the system dynamics and manages to
give a small error. Therefore ARMAX [2 1 1 1] was selected as the step model.
The model output graphs for selected ramp data are provided below:
Measured and simulated model output
6000
amx21221 (81.41)
amx2211 (80.97)
amx2211 (80.97)
arx211 (81.86)
Validation Data

4000

2000

-2000

-4000

-6000

5.5

6.5

7.5
Time

8.5

9.5

10

Fig. 5-12: Selected Model output graphs for the ramp input.

It can be seen all these models give approximately same best fit percentage so the ARX model
with order [2 1 1] and best fit percentage of 81.86% is selected.

37 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION


The model output graphs for selected sine data are provided below:
4

Measured and simulated model output

x 10

amx2221 (73.23)
arx331 (66.49)
amx2111 (73.23)
arx221 (66.76)
Validation Data

1.5

0.5

-0.5

-1

-1.5

-2

-2.5

-3

0.5

1.5

2
Time

2.5

3.5

Fig. 5-13: Selected Model Output graphs for the sine input.

Again the performance of all the estimated models is similar so the model with the highest best
fit percentage is selected. In this case ARMAX model with order [2 1 1 1] gives the maximum
best fit percentage of 73.23% and has the lowest order. Therefore it is selected.

38 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION


The model output graphs for selected sine sweep data are provided below:
4

Measured and simulated model output

x 10

arx311 (-1.073)
amx2111 (43.19)
arx211 (-3.932)
Validation Data

-1

-2

-3

10

11
Time

12

13

14

15

16

Fig. 5-14: Selected Model output graphs for the sine sweep input.

It can be seen that all models show poor performance especially the ARX models. This can be
attributed to the fact that the input is changing very quickly and so it becomes difficult for basic
techniques such as ARX or ARMAX to estimate a proper model. Either more advanced
modeling techniques such as Box Jenkins techniques can be applied or input improved to give
less variations. Considering that fact that such high variations do not occur normally ARMAX
model with order [2 1 1 1] is selected because it gives the highest best fit percentage (43.19%)
and has an acceptable order.
5.7.3

Selecting the identified model

Having estimated four different models they were now compared to arrive at a general model
which gave minimum error for all considered inputs. This was done by applying the same
hardware inputs to all models and comparing their responses to each input. Then the percentage
error of each model was calculated for every input. The model which gave minimum error for all
inputs was selected as the identified model. This was achieved by making a model file in
Simulink with the appropriate blocks.
39 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION


Step response of the models together with the error percentages are provided below.
4

2.5

Comparison of Identified Models

x 10

Hardware
Step Model
Ramp Model
Sine Model
Sinesweep Model

Height (counts)

1.5

0.5

-0.5

-1

0.5

1.5

2.5

3.5

Time (s)

Fig. 5-15: Identified Model responses to step input and corresponding error.

40 | P a g e

4.5

5. BLACK BOX SYSTEM IDENTIFICATION


Ramp response of the models together with the error percentages are provided below.
Comparison of Identified Models
20000
Hardware
Step Model
Ramp Model
Sine Model
Sinesweep Model

Height (counts)

15000

10000

5000

-5000

Time (s)

Fig. 5-16 : Identified model responses to ramp input and corresponding errors.

Sine response of the models together with the error percentages are provided below.
4

Comparison of Identified Models

x 10

Hardware
Step Model
Ramp Model
Sine Model
Sinesweep Model

1.5

Height (counts)

0.5

-0.5

-1

-1.5

-2

-2.5

0.5

1.5

2
Time (s)

2.5

3.5

Fig. 5-17: Identified model responses to sine input and corresponding errors.

41 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION


Sine sweep response of the models together with the error percentages are provided below.
4

Comparison of Identified Models

x 10

Hardware
Step Model
Ramp Model
Sine Model
Sinesweep Model

Height (counts)

-1

-2

-3

10

15
Time (s)

20

25

30

Fig. 5-18: Identified model responses to sine sweep input and corresponding errors.

It can be observed that in all cases the model estimated using the sine sweep data gives the least
error and in all cases except for the sine sweep input case the error is not more than 30% which is
quite acceptable. Therefore this model can serve as the general identified model at the
equilibrium point of 2 cm.
The discrete time and continuous time transfer function of the estimated model are as follows:
( )=

0.004231
1.986 + 0.9873

( )=

1.202 + 1362
+ 7.253 + 402.2

The conversion was done using MATLAB with zero order hold and sample time of 0.001768 s.

5.8 Comparison of Identified Model with the Linearized Model


In order to check the performance of the identified model and to see if there was any advantage
in using the identification procedure it was compared with the linearized model obtained
previously in chapter 4, from linearization of the non-linear equations provided in the manual of
the maglev system. Both linear models were compared with the non-linear model of the system
developed earlier.

42 | P a g e

5. BLACK BOX SYSTEM IDENTIFICATION


The comparison was achieved by making a model file in Simulink. Common input was provided
to all the models and the difference between the output of linearized model and identified model
from the non-linear model was observed. All the models used were in continuous domain.
The result for a step input is provided below.
4

x 10

Comparison of Non linear Vs Linear Vs Identified

Comparison of Non linear Vs Linear Vs Identified


6000

Non Linear Model


Linear Model
Identified Model

2.5

5000
4000
Error (counts)

Height (counts)

2
1.5
1

3000
2000

0.5

1000

-0.5

Linear - Non Linear


Identified - Non Linear

-1000

Time (s)

Fig. 5-19: Response of the models to a step input.

Time (s)

Fig. 5-20: Error plots for linearized and identified models.

The graphs show that both linear models are quite close to each other with the identified model
being a little more accurate than the linearized model. Therefore it is preferable to use input
output data of the system to derive a model through MATLAB easily instead of taking on the
laborious task of linearizing the system equations manually.

5.9 Limitations of the Identified Model


Though the system identification procedure has given us a reasonable estimate of the transfer
function of our system it should be kept in mind that this model is only accurate under certain
conditions. The most important among them are:
1. The model is linear so higher order dynamics of the system are ignored.
2. It is meant for an equilibrium point of 2 cm.
3. It assumes that the noise affecting the system is white in nature.

43 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION

Control Design & Implementation

6.1 Lead-Lag
Lag Compensator
6.1.1 Introduction
Control design begins by using a simple unity-feedback
unity feedback system (the uncompensated system) in
which the gain is adjusted in an effort to provide good steady performance and good stability. If
the uncompensated system is unable to meet the design goals, a compensator must be added.
Compensators improve the frequency response according to the performance requirements in a
feedback and control system. They are fundamental building blocks in classical control theory.
Many different types of compensators are available e.g. PID, lag-lead
lag lead etc. PID is an ideal
controller. Ideal integral compensation requires an active integrator
integrator with its pole on the origin. If
we use passive networks such as lag compensation instead of ideal integrator, the pole and zero
are moved to the left close to the origin. Even though this placement of the pole does not
increase the type number of the system, it yields an improvement in the static error constant over
an uncompensated system. Just as an ideal integrator can be realized by a lag compensator, ideal
derivative compensator can be approximated by lead compensator.
The advantages of passive networks over active networks are:
1. No additional power supplies are required
2. Noise due to differentiation is reduced
The disadvantage is that where an integrator increases the system type number, lag does not.
Also, the additional pole of lead does not reduce
reduce the number of branches of the root locus that
cross the imaginary axis into the right-half
right half plane while ideal derivative reduces the branches.
A negative feedback configuration is used in this section as shown below. The saturation block
limits the control
rol effort output in between -30000 to 30000. The dotted lines have digital data on
them and continuous lines have continuous data.

Fig. 6-1 : Negative feedback configuration used in Lead Lad Compensator Design

44 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION


6.1.2 Design Steps
Compensator has been designed using frequency response of open loop system. The design
procedure followed is from [4]
In the following section, the linear model used for designing has operating point (5575
counts,0.02m) which is

( )=

0.001757
+ 9.091 + 477.98

The sensor acts as a constant gain of 1000000 counts per meter. So the overall plant is

( )=

1757
+ 9.091 + 477.98

Bode Diagram
Gm = Inf dB (at Inf rad/s) , Pm = 14 deg (at 46.7 rad/s)

Magnitude (dB)

20
0
-20
-40

Phase (deg)

-60
0
-45
-90
-135
-180
0

10

10

10

10

Frequency (rad/s)

Fig. 6-2: Open loop frequency response of the plant

This Bode plot shows the frequency response of the uncompensated system. The phase margin is
very less at 14.
Lead compensator is used to shift the phase margin of the open loop system to the required phase
margin while not affecting low frequencies in any way.

45 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION


Lag compensator is used to provide high gain at low frequencies while not changing the phase
margin in any way and not affecting high frequency response either.
High DC gain is required to reduce steady state error.
Design Procedure:
First we find the value of total gain K required to meet the steady state error requirement.
= 100
Next we calculate the additional gain we need to provide by the lag compensator.
=( )

= 28.69
Next we design the lead compensator to increase the phase margin of the open loop compensated
plant. The Phase margin (P.M) is calculated using equation as follows.
P. M

= tan

where = 0.5

2 + 1 + 4
P. M

= 51.83

As can be seen from the above diagram P.Mcurrent=14 . So the compensator has to add a phase of
P.Mcomp.
.

= 51.83 14 + 10 = 47.84

3. For this additional phase, the lead compensators poles and zeros are found using
( )=

Where,

( .

( .

Using the above formulas first

+1
+1
=

= 0.1486 is calculated. Then


= 2.5943

The frequency on the uncompensated system's magnitude plot where the magnitude is -2.5943
dB is selected as the new phase margin frequency. By doing this, the magnitude bode plot of the
compensated system becomes 0db at this new frequency.
46 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION


= 70.6448

= 0.0367
Lastly, poles of compensator are calculated using the above equations and we get
( ) = 6.729

+ 27.23
+ 183.3

Bode Diagram
20

Magnitude (dB)

0
-20
-40
-60

gcLead

-80

gp

-100
45

Phase (deg)

0
-45
-90
-135
-180
0

10

10

10

10

10

Frequency (rad/s)

Fig. 6-3 : bode plots for open loop plant and lead compensator

This figure compares the frequency responses of the uncompensated system and the Lead
compensator. The magnitude curve of the compensator shows that it has no effect on the lower
frequencies. The cross over frequency is increased, the phase margin is increased.

47 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION


Bode Diagram
Gm = Inf dB (at Inf rad/s) , Pm = 55.9 deg (at 70.6 rad/s)

Magnitude (dB)

40
20
0
-20
-40
-60

Phase (deg)

-80
45
0
-45
-90
-135
-180
0

10

10

10

10

10

Frequency (rad/s)

Fig. 6-4: Open loop frequency response with Lead compensator

This bode plot shows that the required phase margin has been achieved but the dc gain is very
less. So we design Lag compensator such that its magnitude is 0 at higher frequencies but high at
lower frequencies to achieve the required gain.
To design Lag compensator:
We draw two asymptotes between 0 dB and the required gain i.e. 28.7 dB + 11.3 dB = 40dB.
Using equation of line:
= 20

( )+

The slope of line is -20 dB/decade. The upper frequency for lag compensator is chosen as 0.1
times less than the crossover frequency of lead compensator. This is done so that the pole and
zero of lag compensator do not interfere with the effect of lead compensator.
= 70.6448

Zero of Lag compensator is 0.1w


Pole of Lag compensator is found by the equation of line at 40dB point.
( )=

48 | P a g e

+ 7.064
+ 0.2597

6. CONTROL DESIGN & IMPLEMENTATION

Bode Diagram
40

Magnitude (dB)

20
0
-20
-40
Lead Compensated

-60

gcLag

-80
45

Phase (deg)

0
-45
-90
-135
-180
-2

10

-1

10

10

10

10

10

10

Frequency (rad/s)

Fig. 6-5: Bode plots for GcLag and Lead Compensated system

This figure compares the frequency response of the Lead compensated system and the Lag
compensator. The magnitude curve of the Lag compensator shows that it adds the desired dc gain
in the system but does not affect the already achieved phase margin and crossover frequency of
the system.
Combining Lead and Lag gives the desired response.
( ) = 6.7303

( + 7.064)( + 27.23)
( + 183.3)( + 0.2597)

The closed loop bandwidth of the system is 112.8103 rad/s.

49 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION


6.1.3

Results
Bode Diagram
Gm = Inf dB (at Inf rad/s) , Pm = 50.4 deg (at 70.9 rad/s)
40

Magnitude (dB)

20
0
-20
-40
-60
-80
0

Phase (deg)

-45
-90
-135
-180
-2

-1

10

10

10

10

10

10

10

Frequency (rad/s)

Fig. 6-6 : Open loop frequency response of Lag Lead compensated system

The phase margin of open loop compensated system has increased from 11.3 to the 50.4 which
is the design requirement.

Bode Diagram

Magnitude (dB)

50

-50

Lead Compensated system


Lag Compensated system
Lag-Lead

-100
45

Phase (deg)

0
-45
-90
-135
-180
-2

10

-1

10

10

10

10

10

Frequency (rad/s)

Fig. 6-7: Comparison of bode plots three different compensated system

50 | P a g e

10

6. CONTROL DESIGN & IMPLEMENTATION


It can be clearly seen from bode plot that Lead compensator only changes the high frequency
response while the response at lower frequencies remains same as the uncompensated system.
Similarly, Lag compensator changes response at lower frequencies while response at higher
frequencies remains same as uncompensated system.

Step response Closed loop


1.4

1.2

System: TfCL
Time (seconds): 0.464
Amplitude: 0.973

Amplitude

0.8

0.6

0.4

0.2

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

Time (seconds)

Fig. 6-8: Step Response Of Lag Lead compensated system

The time restrictions have been well met. Overshoot is less than 20%. Settling time is around 0.4
sec. Steady state error is also within the required bounds.
6.1.4 Discretization and Hardware implementation
To implement the compensator on hardware, we discretized the compensator block using
Simulink Model Discretizer with zero order hold [5].
The discretized model is as follows:
( )=

(
(

)(
)(

= 0.001768

In order to code this compensator in the ECP software, we made use of the following
methodology.

51 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION

( )=
( )

( )
=
( )

(1
1(

( )+

+
=

+
+

( ( )

+
+(

)
)
( )

( )+

( )

Taking inverse z-transform


[ ]=

[ 1] (

[ 1]

[ 2])

= 0.9868

Putting

) [ 2] + ( [ ]

=1

= 0.9611

= 0.7232

[ ] = 1.7232 [ 1] 0.7232 [ 2] + 6.73 [ ] 13.11 [ 1] + 6.383 [ 2]


This equation can be easily coded. We can see that the present sample of output depends upon
the previous values of output and inputs.
This equation was implemented in ECP software. The system was given different inputs and the
results were compared with those obtained from Simulink.
Step Response (Input 2500 counts)
3000

Input Ref
Hardware
Simulation

Delta y (counts)

2500
2000
1500
1000
500
0

0.5

1
time (sec)

1.5

Fig. 6-9: Comparison of step response of simulation and hardware

52 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION


The responses of both Simulink and the hardware are very similar. The difference in the
hardware is very small, about the order of 0.01mm which is not visible to the naked eye. So for
small inputs the compensator works fine.
Step Response (Input 5000 counts)
8000
Input Ref
Hardware
simulation

6000

Delta y (counts)

4000
2000
0
-2000
-4000
-6000
-8000

3
time (sec)

Fig. 6-10: Displaying nonlinear behavior at large displacements

If we increase the input step to 0.5cm, the response of hardware is still somewhat similar to the
simulated response but some deviations can be observed when the reference goes below 0. This
is because the gain of the linearized plant at lower positions is high. Compensator gain combined
with the gain of plant results in our system to move towards instability. This is observed once the
step input is large as shown below.

53 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION


4

1.5

Step Response (Input 10000 counts)

x 10

Input Ref
Hardware
Simulation

Delta y (counts)

0.5
0
-0.5
-1
-1.5
-2

3
time (sec)

Fig. 6-11: Instability occurring at displacement of -10 cm

For large input, such as 1cm (10000 counts), the hardware response does not match the simulated
response. The hardware response is faster and becomes unstable at lower positions.

6.2 H-Infinity
6.2.1 Introduction
In order to overcome the instability caused by the unknown model of the plant, as seen in the lag
lead compensator design section, an H-infinity loop shaping controller is designed. This
controller involves robust stabilization of combined with classical loop-shaping procedure as
mentioned in[6]. Its a two stage process in which first appropriate weights are chosen to shape
bode plot of the open loop plant as desired and then the shaped plant is robustly stabilized using
optimization . In our case, we have selected the weights to be that of lag-lead compensator
designed in the previous section.
A positive feedback configuration is used

54 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION

Fig. 6-12:: positive configuration used


us in H infinity loop shaping design

and
are pre and post compensators respectively .
and
are used to shape the open loop
plant to the desired shape . Once that is done, is synthesized using robust stabilization
technique mentioned in [6].. The complete controller implemented is =
.

6.2.2 Design Steps


1. First of all a simple lag lead is designed (or any other conventional controllers
controllers). The designed
controller is taken as pre- compensator
to the plant which shapes the open loop bode plot as
desired.
=

6.7303( + 27.23)( + 7.064)

( + 183.3)( + 0.002597)
=1

2. Next, the maximum stability margin


is calculated. If
>0.25 then the design is
usually successful. It means that at least 25% of coprime uncertainty is allowed[66]. This also
doesn't change the shape of the open loop plant considerably. In our case

3. Synthesize the controller


The final controller

the Matlab robust analysis tool. [7]

2 thus

55 | P a g e

using

= 0.556

obtained is

183.3 0.476716.1 11.87 438.5


0
0
0
0
1
0
0 150.7 6.068 130.6
0
0
5.95 0.0533813.25
0
0 127.8 13.23 174

6. CONTROL DESIGN & IMPLEMENTATION


93.05
0
= 11.45
0.186
6.86

. = [15.67 20.18
.

75.3 1.248 46.11]

= 9.785

6.2.3 Simulations
The step response of lag lead and
controllers is shown in Fig 7-13. The rise time and settling
time of both controllers is also equal. This shows that the performance specifications by using
weights as conventional controller approximately remain same and we can use the
robust
stabilization to cater for uncertainties.

Linear Simulation Results


3000
Lag Lead
H infinity
2500

Amplitude

2000

1500

1000

500

Scale :
1000 counts = 1mm
0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Time (seconds)

.
Fig. 6-13: Comparison of step response of lag lead and H infinity LS controlled system

6.2.4 Hardware Implementation


The controller discretized using zero order hold for three different sampling times and is also
converted into diagonal form for convenience. The state space form of only one of the three
controllers is shown below.

56 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION

0.9995 0
0
0
0
0 0.7232 0
0
0
0
0 0.5499 0
0
0
0
0 0.9629 0
0
0
0
0 0.9865

. = [0.004662

0.684 1.078

0.0002286 0.00003098]

1.7
0.1143
= 3.38
3.538
2.81

= 8.961

A comparison of step plot for


with its hardware implementation is shown in Fig 7-14 (a) , (b) and (c).
For TS = 0.001768, the response is very accurate whereas for higher sampling times, the hardware
responses are different from simulations. The H infinity controller also shows a stable response even at
larger displacements (0.5cm) as compared to lag lead compensator which is shown in Fig 7-15 (a) and (b)
.With increase in sampling times, we also notice decrease in stability. A comparison of
loop shaping
controller using lag lead as weights and lag lead controller proves that we can stabilize such traditional
controllers by H infinity optimization.

57 | P a g e

6. CONTROL DESIGN & IMPLEMENTATION


Step Response (2500 counts)
3000

3000
input
hardware
simulation

2500

simulation
hardware
2500

2000
height(counts)

height(counts)

2000

1500

1500

1000

1000

500

500
Scale:
1000 counts = 1mm
0

0
0

0.5

1.5

0.5

(b) Ts = 0.003536

(a) Ts = 0.001768
3000
simulation
hardware
2500

height(counts)

2000

1500

1000

500

0.5

1.5

time(seconds)

(c) Ts = 0.005304

Fig. 6-14 :Comparison of step response of H infinity LS controlled system

58 | P a g e

1
time(seconds)

Time (sec)

1.5

6. CONTROL DESIGN & IMPLEMENTATION

1000

1000
hinf
Lag lead

hinf
Lag lead

-1000

-1000

-2000
height(counts)

height(counts)

-2000
-3000
-4000
-5000

-3000
-4000
-5000

-6000
-7000

-6000

-8000

-7000

-9000

0.5

1.5

-8000

0.5

time(seconds)

(a) Ts = 0.001768

(b) Ts = 0.003536

2000
hinf
Lag lead
0

height(counts)

-2000

-4000

-6000

-8000

-10000

0.5

1.5

time(seconds)

(c) Ts = 0.005304

Fig. 6-15( Displaying H infinity LS robustness over Lag lead compensator )

59 | P a g e

1
time(seconds)

1.5

7. CONTROLLER IDENTIFICATION

Controller Identification

7.1 Introduction
In chapter 5 it was stated that the transfer function of a system could be determined by collecting
the input-output data of the system and then applying the system identification procedure on it.
This method was illustrated by applying it on the maglev system. Similar procedure can be
applied to identify the transfer function of a controller. Essentially a controller is also a system
with a certain transfer function. Therefore provided that we can collect the input-output data for
the controller, we can identify it by applying the same system identification procedure.

Fig. 7-1: A closed loop system

The question that now arises is how to find the input and output data of the controller. The input
to a controller is the error signal, e(t), which is the difference between the required output and the
actual output. By setting the required parameters we can determine the system closed loop
response that we desire. For example, in the case of a second order system by setting the values
of wn and and by using the generalized second order system equation:
T.F =

,we can approximate closed loop system response which includes the

controller together with the plant. Now apply a test input to this system and observe the output.
The difference between the input provided and the output observed will be the error signal.
The output of the controller is a control effort or the plant input, u(t). Having knowledge of the
plant transfer function and the output response that we require, we can construct the input signal
to the plant. Since Y(s) = G(s) R(s) R(s) =

Y(s)
G(s)

or R(s) = G-1(s) Y(s). G-1(s) simply corresponds

to replacing the zeroes of the G(s) with its poles and vice versa.

=>

Fig. 7-2:Input Output relationship.

60 | P a g e

G-1(s)

7. CONTROLLER IDENTIFICATION
For a proper transfer function it creates a problem since now number of zeroes is greater than
number of poles and the inverse transfer function becomes unrealizable. Therefore extra zeroes
have to be added far from the original zeros so that they do not have a considerable effect on the
transfer function. Like this the input of the plant or the output of the controller can be
determined.
Having both input and output data it is now a simple problem of system identification. This
method is considerably easier to apply than designing of controllers and ideally gives an
optimized controller for the system.

7.2 Literature Review


Much work has been done previously but different terminologies have been used instead of
controller identification. Those techniques are different to some degree and the technique
presented here has a certain degree of uniqueness. Using spline fitting to Virtual reference
feedback tuning method to design a controller has been shown in Comparison of VRFT, NCbT
and VRFT with Spline Fitting.[8] These techniques are different because they assume that the
plant is unknown and the experimental data collected is that of the closed loop system. On the
other hand, the technique presented in this section uses open loop data to first identify the plant.
Having the plant model and desired output of plant, the input of the plant is found. Using the
desired error trajectory as input data to the controller and the previously found data of plant input
as the output of the controller, a controller is identified using system identification techniques. It
should be noted that term controller identification used in this sectionimplies designing a
controller using system identification technique. It is not simply the process of finding out which
unknown controller is used in a closed loop system. The latter has been done in controller
identification[9].

7.3 Applying Controller Identification Procedure to Maglev system


The initial step required to identify the transfer function of a controller is to collect the input and
output data for it. In order to collect this data, information about the transfer function of the plant
is required as well as the specifications of the desired closed loop response such as and.
7.3.1

Finding the input

Input to the controller is the error signal, e(t), which is the difference between the required output
and the actual output.In order to find this signal we need to first specify the performance
parameters and develop an ideal closed loop response desired. For a second order system the
general equation T.F =

can be used with the desired value of

ideal closed loop response. For the purpose of this experiment

and to get the

= 120 rad/s and = 0.8.

Apply a step to this ideal transfer function and record the output. The error signal is the
difference between the input and the output. Like this the input to the controller is found.
61 | P a g e

7. CONTROLLER IDENTIFICATION
7.3.2

Finding the output

The output of the controller is the control effort which is fed to the plant. This means that
controllers output is the input of the plant. Therefore using the fact that Y(z) = G(z) U(z) which
means that U(z) = G-1(z) Y(z), the input of the plant can be calculated. In order to find it
information about the plants transfer function, G(z) is required. For this experiment the model of
the plant identified in chapter 5 will be used as plants transfer function. Inverse of this transfer
function is found simply by replacing zeroes with poles and vice versa.
For proper transfer functions calculating the inverse in this way can cause a problem because
now number of zeroes exceeds the number of poles which makes the transfer function
unrealizable. In order to make it realizable extra zeroes need to be added until the transfer
function becomes proper. Theses zeroes are added at such far locations that they have negligible
effect on the transfer function. In this experiment the extra zeroes were added at a frequency 50
times the natural frequency in the original transfer function before calculating its inverse. The
resulting bode plots and step responses of the original system (G) and modified system (G_mod)
show that there is negligible effect due to the extra zeroes.
Note that using this technique to find the inverse presents the limitation that the original system
must be minimum phase otherwise it will give rise to an unstable inverse.
Bode Diagram
20
G

Magnitude (dB)

G_mod

-20
-40
-60
-80
0

Phase (deg)

G
-45

G_mod

-90
-135
-180
-2

10

10

10

10

Frequency (rad/s)

Fig. 7-3: Open loop bode plot of original transfer function (G) and transfer function with added zeroes (G_mod).

62 | P a g e

7. CONTROLLER IDENTIFICATION

Step Response
6
G
G_mod

Amplitude

0.5

1.5

2.5

Time (seconds)

Fig. 7-4: Step response of original transfer function (G) and transfer function with added zeroes (G_mod).

Now the step response produced in section 7.3.1, which is the ideal step response required, is fed
to the calculated inverse and the output is recorded. This gives the input of the plant required to
generate the ideal response. This corresponds to the control effort that needs to be generated by
the controller which means that this is the output of the controller.
7.3.3

Identifying the controller

Now that the input-output data set of the controller is complete, system identification techniques
can be used to find the transfer function of the controller. For this experiment a third order ARX
model was found out using the system identification procedure similar to the one described in the
chapter 5. The resulting discrete time transfer function identified is:
.

.
.

.
.

The open loop bode plots for the plant alone and with the controller are shown below.

63 | P a g e

7. CONTROLLER IDENTIFICATION

Bode Diagram
100

Magnitude (dB)

G
50

GK

0
-50
-100
0
G

Phase (deg)

-45

GK
-90
-135
-180
-225
-3

-2

10

-1

10

10

10

10

10

10

Frequency (rad/s)

Fig. 7-5: Magnitude and Phase plots for G and GK.

The step response obtained by using the controller is now compared with the ideal response
required to evaluate the identified controller model.
Step Response w ith K
1.4
Ideal
Using Controller

1.2

Height (counts)

0.8

0.6

0.4

0.2

0.5

1.5

2.5

3.5

4.5

time (seconds)

Fig. 7-6:Ideal step response and the response achieved by using the identified controller.

64 | P a g e

7. CONTROLLER IDENTIFICATION
The graphs show that the performance of the system using the identified controller is quite
similar to the ideal response desired. The only difference is the oscillatory behavior shown by the
system with identified controller for the first 0.5 s which is not a serious issue.
The closed loop system with the identified controller has a gain margin = 21.1 dB at 323 rad/s
and a phase margin of 41.1o at 43.4 rad/s. Therefore the system meets acceptable stability
requirements and the identified controller is accepted as a suitable controller for this system.

7.4 Implementing the identified controller on hardware


After identifying the controller in simulations it was coded for the actual hardware using the
language supported by the ECP software. An input of 2500 counts was given to the hardware and
the response was recorded and compared with the simulation response. The comparison graph is
given below:
Closed loop step response
4000
Input
Hardware Output
Simulated Output

Height (counts)

3000

2000

1000

-1000

-2000

0.5

1.5
Time (s)

2.5

Fig. 7-7Closed loop system response of hardware and simulation.

The graphs for actual hardware output and simulated output are quite similar and also in line
with applied input. Therefore this shows that using identification procedure a very suitable
controller was developed for the maglev system.

7.5 Comparison of Controller Identification with conventional controllers


After designing the controller using identification technique it was then compared with the
conventional controllers to gauge its performance.

65 | P a g e

7. CONTROLLER IDENTIFICATION
7.5.1

Controller Identification Vs. Lag Lead Controller and H infinity controller

This section gives the comparison plots of conventional lag-lead and H infinity controllers with
the controller designed using identification technique. A step input of 5000 counts is applied and
the performance of all three controllers is measured. The result is shown below:
Comparison of H infinity controller, Laglead Controller and Controller using Identification
2000
hinf
laglead
controller ID

height(counts)

-2000

-4000
-6000

-8000

-10000

0.5

1.5

time(seconds)
Fig. 7-8: Comparison plots for different controllers.

The graph shows that the controller obtained through identification technique gives enhanced
stability performance similar to the h infinity controller. Therefore this controller is better than
lag lead controller. On the other hand this controller gives a high initial overshoot which quickly
reduces to zero. In this regard H infinity controller shows better performance because it does not
give an overshoot. Furthermore it gives a zero steady state error. This means that the controller
obtained through identification technique is an acceptable controller which can be used in
practical situations.

7.6 Limitations
Though the controller obtained through identification process gives acceptable performance it
has certain limitations. The major among them are:
1. This process uses an ideal closed loop response which for the purpose of this experiment
is the ideal second order model. For controllers higher than second order generalized
models are scarcely available which makes this method difficult to apply for higher
models.
2. This method is applicable only to minimum phase systems. For non-minimum phase
systems pole zero cancellation is required which is not feasible in practical systems.
3. The accuracy of this method relies on the accuracy of the identified plant model.
66 | P a g e

8. APPENDIX

Appendix
A. S-Function

function [sys,x0,str,ts] = Maglev_nonlinear(t,x,u,flag,x0)


switch flag,
% Initialization %
case 0,
[sys,x0,str,ts]=mdlInitializeSizes();

% Derivatives %
case 1,
sys=mdlDerivatives(t,x,u);
% Outputs %
case 3,
sys=mdlOutputs(t,x,u);
% Unhandled flags %
case { 2, 4, 9 },
sys = [];
% Unexpected flags %
otherwise
DAStudio.error('Simulink:blocks:unhandledFlag', num2str(flag));

end
% mdlInitializeSizes
% Return the sizes, initial conditions, and sample times for the S-function.
function [sys,x0,str,ts]=mdlInitializeSizes()

sizes = simsizes;
sizes.NumContStates = 2;
sizes.NumDiscStates = 0;

67 | P a g e

8. APPENDIX
sizes.NumOutputs
sizes.NumInputs

= 1;
= 1;

sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1;

sys = simsizes(sizes);
x0 = [2/100 0]; %zeros(2,1);
str = [];
ts = [0 0];
end mdlInitializeSizes
% mdlDerivatives
% Return the derivatives for the continuous states.
function sys=mdlDerivatives(t,x,u)
a=1.04;
b=6.2;
m=.121;
c=1.1;
g=9.81;
sys(1) = x(2);
sys(2) = (u./(a*m*(100*x(1)+b).^4)-g-((c/m)*x(2)));
end mdlDerivatives
% mdlOutputs
% Return the block outputs.
function sys=mdlOutputs(t,x,u)
sys = x(1);
end mdlOutputs

B. Sensor1.m File
% This script finds the coefficients for the sensor linearization / calibration
% using the assumed form of the correction which is linear in the parameters{e,f,g,h}
%INPUTS

68 | P a g e

8. APPENDIX
% Sensor Location (1=lower, 2=upper)
sensloc=2
% Actual magnet distance from mechanical stop (cm),
Yactual=[ 1 2 3 4 5 6 7]';
% Raw data from laser sensor at each height
Y1raw=[7540 4480 2590 1560 793 309 ]';
Y2raw=[ 20 210 493 870 1470 2190 3150]';
% Construct the correction function array
% Solve for the coefficient vector efgh via regression using the backslash operator
if sensloc==1
% Construct the correction function array
X=[1./Y1raw sqrt(1./Y1raw) ones(size(Y1raw)) Y1raw];
efgh=X\Yactual
% Create vector of evaluation points for correction function
Yraw_eval=(2000:100:30000)';
% Evaluate function at points
Ycal=[1./Yraw_eval sqrt(1./Yraw_eval) ones(size(Yraw_eval)) Yraw_eval]*efgh;
e1=efgh(1),f1=efgh(2),g1=efgh(3),h1=efgh(4)
% Plot
plot(Y1raw,Yactual,'o',Yraw_eval,Ycal,'-'),grid,%axis([0 30000 -7 0])
xlabel('Raw Sensor Output (counts)')
ylabel('Magnet Position (cm)')
title('y1 Sensor Calibration / Linearization')
end
if sensloc==2
% Construct the correction function array
X=[1./Y2raw sqrt(1./Y2raw) ones(size(Y2raw)) Y2raw];
efgh=X\(-Yactual);
e2=efgh(1),f2=efgh(2),g2=efgh(3),h2=efgh(4)
% Create vector of evaluation points for correction function

69 | P a g e

8. APPENDIX
Yraw_eval=(2000:100:30000)';
% Evaluate function at points
Ycal=[1./Yraw_eval sqrt(1./Yraw_eval) ones(size(Yraw_eval)) Yraw_eval]*efgh;
% Plot
plot(Y2raw,-Yactual,'o',Yraw_eval,Ycal,'-'),grid,axis([0 30000 -7 0])
xlabel('Raw Sensor Output (counts)')
ylabel('Magnet Position (cm)')
title('y2 Sensor Calibration / Linearization')
end

C. Actuat1.m File
% This script finds the coefficients for the magnetic actuator linearization / calibration
% using the assumed form of the correction which is linear in the parameter a
% For Model 730 Apparatus, The upper magnetic field characteristic may be considered to
% the mirror image of the lower ==> The UPPER field coefficent a is the same as for the
% LOWER, and b is the negative of that of the lower
n=4;
% Measured magnet height, CHANGE TO NEGATIVE VALUES FOR ACTUATOR #2
Ymeasured=[3.99 3.95 3.7 3.69 3.3 3.18 3.12 2.8 2.4 2.16 1.9 1.6 1.3 1 0.88 0.83 0.6 0.3 0.1 0]';
% Uncompensated Control Effort input
Utest=[22000 18000 14000 12000 11000 10000 9000 8000 7000 6000 5000 4500 4000 3500 3000 2800 2500 2300
2100 2000]';
% Specify offset parameter, b
b=6.2;
% Input Magnet mass in Kg
m=0.121
W=m*9.81 % magnet weight
% Construct the correction function array
X=[(Ymeasured+b).^n];
% Solve for the coefficient vector abcd via regression using the backslash operator
% Divide by W to normalize force to N
a=X\(Utest/W);

70 | P a g e

8. APPENDIX
% Create vector of evaluation points for correction function
Y_eval=(0:0.1:4.5)';
% Evaluate function at points. Multiply by W to show as-tested case
Ueval=[(Y_eval+b).^n]*a*W;
% Plot
plot(Ymeasured,Utest,'o',Y_eval,Ueval,'-'),grid,%axis([0 4.5 0 25000])
ylabel('Conrol Effort Required to Produce Force Equal to Magnet Weight (counts)')
xlabel('Magnet Position (cm)')
title('u1 Actuator Characteristic / Pre-correction')
a1=a
b1=b
a2=a
b2=-b

71 | P a g e

9. BIBLIOGRAPHY

Bibliography

[1] Lennart Ljung, System Identification: Theory for the User.


[2] Lennart Ljung, System Identification Toolbox: For use with MATLAB.
[3] Educational Controls Products, The Model 730 Magnetic Levitation Apparatus.
[4] Norman S. Nise, Control Systems Engineering, 6th ed.
[5] Katsuhiko Ogata, Discrete Time Control Systems, 2nd ed.
[6] Ian Postlethwaite Sigurd Skogestad, Multivariable feedback control - Analysis and Design.
[7] D. ,BHP Res., Clayton, Vic., Australia ,Glover, Keith McFarlane, "A loop-shaping design
procedure using H synthesis," Automatic Control, IEEE Transactions on (Volume:37 ,
Issue: 6 ).
[8] Nobuhiko Koyama, Ichiro Kitamuki, Masuhiro Nitta, Kiyotaka Kato Keisuke Kubota,
"Comparison of VRFT, NCbT and VRFT with Spline Fitting ," in 12th International
Conference on Control, Automation and Systems, 2012.
[9] Michael G. Safonov Thomas F. Brozenec, "Controller Identification," in American Control
Conference, 1997.
[10] Philip & Geim, Andre Gibbs, "Is Magnetic Levitation Possible?," 2009.

72 | P a g e

Vous aimerez peut-être aussi