You are on page 1of 43

33-240-LabView

I
BALL AND PLATE
Control Experiments




Ball and Plate
Control Experiments

33-240-LabView
(For use with LabVIEW 8.6 or later)

CONFIDENTIAL










Feedback Instruments Ltd., Park Road, Crowborough, East Sussex, TN6 2QR, UK
Telephone: +44 (0) 1892 653322, Fax: +44 (0) 1892 663719
E-mail: feedback@feedback-group.com, Website: www.feedback-group.com

Manual: 33-240-Labview Ed01 032011
Feedback Part No. 1160-33240-LabView

33-240-LabView
II
BALL AND PLATE
Control Experiments

33-240-LabView
III
BALL AND PLATE
Control Experiments
THE HEALTH AND SAFETY AT WORK ACT 1974


We are required under the Health and Safety at Work Act 1974, to make available to users of this
equipment certain information regarding its safe use.
The equipment, when used in normal or prescribed applications within the parameters set for its
mechanical and electrical performance, should not cause any danger or hazard to health or safety if
normal engineering practices are observed and they are used in accordance with the instructions
supplied.
If, in specific cases, circumstances exist in which a potential hazard may be brought about by careless
or improper use, these will be pointed out and the necessary precautions emphasised.
While we provide the fullest possible user information relating to the proper use of this equipment, if
there is any doubt whatsoever about any aspect, the user should contact the Product Safety Officer at
Feedback Instruments Limited, Crowborough.
This equipment should not be used by inexperienced users unless they are under supervision.
We are required by European Directives to indicate on our equipment panels certain areas and
warnings that require attention by the user. These have been indicated in the specified way by yellow
labels with black printing, the meaning of any labels that may be fixed to the instrument are shown
below:

CAUTION -
RISK OF
DANGER

CAUTION -
RISK OF
ELECTRIC SHOCK

CAUTION -
ELECTROSTATIC
SENSITIVE DEVICE
Refer to accompanying documents

PRODUCT IMPROVEMENTS
We maintain a policy of continuous product improvement by incorporating the latest developments and
components into our equipment, even up to the time of dispatch.
All major changes are incorporated into up-dated editions of our manuals and this manual was believed
to be correct at the time of printing. However, some product changes which do not affect the
instructional capability of the equipment, may not be included until it is necessary to incorporate other
significant changes.

COMPONENT REPLACEMENT
Where components are of a Safety Critical nature, i.e. all components involved with the supply or
carrying of voltages at supply potential or higher, these must be replaced with components of equal
international safety approval in order to maintain full equipment safety.
In order to maintain compliance with international directives, all replacement components should be
identical to those originally supplied.
Any component may be ordered direct from Feedback or its agents by quoting the following
information:
1. Equipment type 3. Component value
2. Component reference 4. Equipment serial number
Components can often be replaced by alternatives available locally, however we cannot therefore
guarantee continued performance either to published specification or compliance with international
standards.
PREFACE

33-240-LabView
IV
BALL AND PLATE
Control Experiments


OPERATING CONDITIONS





This equipment is designed to operate under the following conditions:
Operating Temperature 10C to 40C (50F to 104F)
Humidity 10% to 90% (non-condensing)

DECLARATION CONCERNING ELECTROMAGNETIC
COMPATIBILITY
Should this equipment be used outside the classroom, laboratory study area or similar such place for
which it is designed and sold then Feedback Instruments Ltd hereby states that conformity with the
protection requirements of the European Community Electromagnetic Compatibility Directive
(89/336/EEC) may be invalidated and could lead to prosecution.
This equipment, when operated in accordance with the supplied documentation, does not cause
electromagnetic disturbance outside its immediate electromagnetic environment.

COPYRIGHT NOTICE
Feedback Instruments Limited
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or
otherwise, without the prior permission of Feedback Instruments Limited.

ACKNOWLEDGEMENTS
Feedback Instruments Ltd acknowledge all trademarks.
LabVIEW is a registered trademark of National Instruments.
IBM, IBM - PC are registered trademarks of International Business Machines.
MICROSOFT, WINDOWS 7, WINDOWS XP, WINDOWS 2000, WINDOWS ME, WINDOWS NT, WINDOWS 98,
WINDOWS 95 and Internet Explorer are registered trademarks of Microsoft
Corporation.

PREFACE
WARNING:
This equipment must not be used in conditions of condensing humidity.

33-240-LabView
V
BALL AND PLATE
Control Experiments

Table of Contents

Manual overview ..................................................................................................... 1
Introduction ............................................................................................................. 2
Ball and Plate set description ................................................................................ 3
Ball and Plate model ............................................................................................... 5
Nonlinear Ball and Plate model ............................................................................. 5
Nonlinear model simplification ............................................................................... 8
Exercise 1 Nonlinear model testing ......................................................... 9
Model linearisation .............................................................................................. 13
Exercise 2 Linear model ...................................................................... 13
Ball and Plate model identification ...................................................................... 15
Model identification .............................................................................................. 16
Exercise 3 Plate model identification ...................................................... 16
Exercise 4 Ball on plate model identification ............................................ 19
Ball and Plate setup control ................................................................................. 22
Plant control ........................................................................................................ 22
PID controller ...................................................................................................... 23
Plate orientation control ....................................................................................... 24
Exercise 5 PID control of plate orientation ............................................... 24
Exercise 6 Real-time PID control of plate position ...................................... 26
1-D ball control .................................................................................................... 28
Exercise 7 1-D PID control of ball position ................................................ 28
Exercise 8 Real-time 1-D PID control of ball position ................................... 29
2-D ball control .................................................................................................... 31
Exercise 9 2-D PID control of ball position ................................................ 31
Exercise 10 Real-time 2-D PID control of ball position.................................. 33
Trajectory tracking ............................................................................................... 35
Exercise 11 Trajectory tracking with ball .................................................. 35
Exercise 12 Real-time trajectory tracking with ball .................................... 37

TABLE OF CONTENTS

33-240-LabView
VI
BALL AND PLATE
Control Experiments



33-240-LabView
1
BALL AND PLATE
Control Experiments
Manual overview

The following manual refers to the Feedback Instruments Ball and Plate Control
application. It serves as a guide for the control tasks and provides useful information
about the physical behaviour of the system. A nonlinear model is proposed and
identification algorithms are introduced. The models obtained are compared with the
phenomenological model and the Ball and Plate setup. Control algorithms are
developed, tested on the models and then implemented in a real-time application.

Throughout the manual various exercises are proposed to bring the user closer to the
Ball and Plate control problem. Depending on the knowledge level of the user some
of the sections and exercises can be skipped. The more advanced users can try to
model, identify and control the Ball and Plate on their own from the beginning.

The relative difficulty of each exercise is indicated using the following icons:


entry level,



medium level,



expert level.


If any of the identification or controller design exercises appear to be too difficult or
the results are not satisfactory you may go straight to the examples that are supplied
and test them by changing the parameters of the controllers.

MANUAL OVERVIEW

33-240-LabView
2
BALL AND PLATE
Control Experiments
Introduction

The Ball and Plate setup is not a trivial plant to control. It is not stable, and thus
control and identification is challenging. Feedback Instruments has made the Ball
and Plate experiment even more interesting, by introducing electromagnetic table
actuation.
Furthermore, to obtain ball position measurement a vision system has been
implemented. These features make the Ball and Plate plant very interesting from the
control point of view.

The digital camera can be used aside from the Ball and Plate system for image
processing exercises.

The Ball and Plate setup allows designing of different controllers and testing in real -
time using LabVIEW environment.


INTRODUCTION

33-240-LabView
3
BALL AND PLATE
Control Experiments
Ball and Plate set description
The description of the Ball and Plate setup in this section refers to the mechanical-
electrical part and the control aspect. For details on how the signals are measured
and transferred to the PC, refer to the Installation & Commissioning manual.

As shown in Figure 1, the Ball and Plate unit consists of a base plate, 4 inductors, 2
potentiometers, very light table with aluminium rings and digital camera suspended
on an arm.

Figure 1 Ball and Plate mechanical unit
BALL AND PLATE SET DESCRIPTION

33-240-LabView
4
BALL AND PLATE
Control Experiments
Apart from the mechanical parts the Ball and Plate system is equipped with Power
Supply Unit and Power Amplifier, Cable Connector Box and a CMOS camera (Figure
2). The PSUPA unit amplifies the potentiometers signals and passes them as
analogue signals to the PCI6251/6221 card. The inductors control signals can be
sent from the PC through the PCI6251/6221 card and PSUPA unit. The inductors are
driven by ac current signal.


Figure 2 Ball and Plate control system

In order to design any control algorithms one must first understand the physical
background behind the process and carry out identification experiments. The next
section explains the modelling process of the Ball and Plate setup.

BALL AND PLATE SET DESCRIPTION

33-240-LabView
5
BALL AND PLATE
Control Experiments
Ball and Plate model
Every control project starts with plant modelling for simulation purposes. Firstly, a
model of the plate and the ball is considered. In the end, the models of the inductors
and the rest of the electrical circuit are introduced. The nonlinear model simplification
is presented, when insignificant dynamics coupling is removed.

Nonlinear Ball and Plate model

Figure 3 presents the ball and plate system with its description.


Figure 3 Ball and plate phenomenological model

Usually, phenomenological models are nonlinear, that means at least one of the
states (i inductors current, , table angles) is an argument of a nonlinear
function. In order to present such a model as a transfer function (a form of linear
plant dynamics representation used in control engineering), it has to be linearised.

According to the electrical-mechanical diagram presented in Figure 3 the nonlinear
model equations can be derived.

BALL AND PLATE MODEL

33-240-LabView
6
BALL AND PLATE
Control Experiments
Considering the kinetic, T, and potential energy, W, balance, we obtain the following
equations:

( ) ( ) ( ) ( ) ,
2
1 2
2 2
2
2 2
2 2 2 2
(

+ + + +
|
|

\
| +
+ + + + =
&
&
&
&
& &
&
& & & y x m I
r
y x
I I y x m T
b b p

sin sin mgy mgx W + = ,

Furthermore, one has to include the external torques
1
and
2,
generated by the
inductors, expressed as functions of i and or

.
( ) ( )
( ) ( )
17 . 0 ,
17 . 0
2 . 2
2 . 0
17 . 0
2 . 2
2 . 0
17 . 0 ,
17 . 0
2 . 2
2 . 0
17 . 0
2 . 2
2 . 0
2
2
2
2
2
2
1
2
1
1
<
+

+
=
<
+

+
=

i
k
i
k
i
k
i
k
C C
C C


The parameters description and values are presented in Table 1.
Table 1. Ball and Plate parameters

BALL AND PLATE MODEL
(1)
(2)
(3)
(4)

33-240-LabView
7
BALL AND PLATE
Control Experiments


With kinetic and potential energy defined, we can define a Lagrangian, L, and
balance it according to the following equations:

,
,
F
q
L
q
L
dt
d
W T L
=

=
&


where q=[x, y, , ] and F denotes all external forces and torques. The following
derivatives have to be calculated:

, sin ) (
, sin ) (


mg y x m
y
L
mg y x m
x
L
+ =

+ =

& &
&
&
&
&

, cos
, cos

mgy
L
mgx
L
=


,
,
2 2
2 2
|

\
|
+ = |

\
|
+ =

\
|
+ = |

\
|
+ =

r
I
m y
r
y I
y m
dt
d
y
L
dt
d
r
I
m x
r
x I
x m
dt
d
x
L
dt
d
b b
b b
& &
&
&
&
& &
&
&
&

( ) ( )
( ) ( ), ) ( ) ( ) (
, ) ( ) ( ) (
2
2
y x y x xy y m I I y x my I I
dt
d L
dt
d
y x y x xy x m I I y x mx I I
dt
d L
dt
d
b p b p
b p b p
& & & & &
& & & & &
&
&
&
&
&
&
& & &
& & & &
&
& &
&

+ + + + + = + + + =

+ + + + + = + + + =


(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
BALL AND PLATE MODEL

33-240-LabView
8
BALL AND PLATE
Control Experiments
From (6) and (7) to (14) it follows:

0 ) ( sin
2
= + |

\
|
+ + &
&
& & & y x m
r
I
m x mg
b
,
0 ) ( sin
2
= + |

\
|
+ +
& &
& & & y x m
r
I
m y mg
b
,
( )
1
2
) ( cos = + + + + + + y x y x xy x m I I mgx
b p
&
&
&
& & &
& & & & ,
( )
2
2
) ( cos = + + + + + + y x y x xy y m I I mgy
b p
& & & & &
& & & &
.

Equations (15) to (18) and (3) and (4) constitute a nonlinear model of the ball and
plate system.
The model described by the above equations can be presented as shown in Figure 4.


Figure 4 Ball and Plate model

Nonlinear model simplification

As ball mass is very small comparing to table dynamics and acceleration achieved by
the ball is very small, the cross-coupling between two perpendicular directions can be
neglected. Equations (15) to (18) simplify in the following way:

0 sin
2
= |

\
|
+ +
r
I
m x mg
b
& & ,
0 sin
2
= |

\
|
+ +
r
I
m y mg
b
& & ,
1
) ( cos = + +
b p
I I mgx & & ,
2
) ( cos = + +
b p
I I mgy
& &
.

Equations (3) and (4) need to be linearised with respect to its two variables i and or
. Notice that
i
= 0 when both i = 0 and =0 or =0. Thus, it is an equilibrium point.
BALL AND PLATE MODEL
(15)
(16)
(17)
(18)
(19)
(20)
(21)
(22)

33-240-LabView
9
BALL AND PLATE
Control Experiments
( )
( )
( )
( )
( )
( )
( )
( )

+
+
+

+
=

+
+
+

+
=
2
0
2
20
2
0
2
20
2
0
20
2
0
20
2
0
2
10
2
0
2
10
1
0
10
1
0
10
17 . 0
2 . 2
17 . 0
2 . 2
17 . 0
2 . 2
2
17 . 0
2 . 2
2
,
17 . 0
2 . 2
17 . 0
2 . 2
17 . 0
2 . 2
2
17 . 0
2 . 2
2
i
k
i
k i
i
k i
i
k m
i
k
i
k i
i
k i
i
k m
C C C C
C C C C
& &
& &


Considering the equilibrium points the equations (23) and (24) can be rewritten in the
following form (already in Laplace domain):

) (
17 . 0
2 . 2
4 ) (
), (
17 . 0
2 . 2
4 ) (
2
2
1
2
s i k s s
s i k s s
=
=



Without the couplings the model can be presented as 2 uncoupled SISO systems
(Figure 5).


Figure 5 Simplified nonlinear Ball and Plate model

Exercise 1 Nonlinear model testing

Introduction
For the initial exercise the user has been provided with a nonlinear Ball and
Plate model described by equations (19) and (22), (3) and (4). The model can
be opened in LabVIEW - BP_model.vi. It is possible that the assembled
phenomenological model responds differently from the Ball and Plate plant.
This might be caused by differences in the model structure itself as well as the
value of the chosen parameters. However, these differences can be included in
a model during identification experiments. One can also modify the
phenomenological model by adding gain or by certain parameter tuning.

(23)
BALL AND PLATE MODEL
(24)
(25)
(26)

33-240-LabView
10
BALL AND PLATE
Control Experiments
Load LabVIEW and the menu system using the Windows Start menu (Figure
6).

Figure 6 Start menu
LabVIEW will run and the model front panel will open (Figure 7). This contains
links to the simulation-only models (the left column), the real-time models (the
right column) and the manual documents.


Figure 7 LabVIEW model menu
BALL AND PLATE MODEL

33-240-LabView
11
BALL AND PLATE
Control Experiments


On the Simulation Models block click on the BP_model. A VI to simulate the
nonlinear model will open (Figure 8).


Figure 8 Simulation models menu
Task
To begin with the user is advised to check the responses of the Ball and Plate
model (BP_model.vil). Without any control applied and initial table angles equal
0 the ball will not move. Run the test with different values of the control signal

33-240-LabView
12
BALL AND PLATE
Control Experiments
by changing the step value. Observe the reaction of the under different control
signal values.

Example results and comments
Figure 10 presents the response of the Ball and Plate model when an impulse
control voltage is applied (Figure 9). The model is not stable, thus without a
controller the ball will continue on rolling on the plate.


Figure 9 Control voltage impulse


Figure 10 Ball response to a control voltage impulse
BALL AND PLATE MODEL

33-240-LabView
13
BALL AND PLATE
Control Experiments
Model linearisation

To carry out analysis of the model dynamics for open loop
1
systems using techniques
such as Bode plots, poles and zeros maps, Nyquist plots, root locus (for closed loop
2

systems only), the model has to be linearised. The linearisation is done in the
equilibrium point of u
1
, u
2
, , = 0. For small angle deviations from equilibrium the
functions cos and sin can be approximated according to the following:

. 1 cos
, sin




From (19) to (22) and (25), (26) the simplified linear model of Ball and Plate holds:

0
2
= |

\
|
+ +
r
I
m x mg
b
& & ,
0
2
= |

\
|
+ +
r
I
m y mg
b
& & ,
1
17 . 0
2 . 2
4 ) ( i k I I x mg
b p
= + + & & ,
2
17 . 0
2 . 2
4 ) ( i k I I y mg
b p
= + +
& &
.

Exercise 2 Linear model

Introduction
According to the equations (29) to (32), (25) and (26) a linear model has been
assembled in Simulink. You can run similar experiments on it as for the
nonlinear model in Exercise 1.

Task
Run the linear model (BP_model_lin) and compare the responses with the
nonlinear model. Use LabVIEW Signal Processing and Control toolbox to plot
Bode plots, zeros and poles maps to carry out initial dynamic response
analysis of the Ball and Plate system.


1
Open loop system the plant without a controller
2
Closed loop system the plant and controller with a negative feedback loop, see Control
section for more information.
BALL AND PLATE MODEL
(27)

(28)
(29)
(30)
(31)
(32)

33-240-LabView
14
BALL AND PLATE
Control Experiments
Example results and comments
Figure 11 presents the response of the linear Ball and Plate model when an
impulse of control voltage is applied.


Figure 11 Linear model response




BALL AND PLATE MODEL

33-240-LabView
15
BALL AND PLATE
Control Experiments
Ball and Plate model identification
In the previous section a phenomenological model was derived and then linearised.
A model can be identified through an identification experiment, upon which
controllers will be designed, which is described in the Ball and Plate Control
section. This section however explains how the discrete, linear Ball and Plate model
identification is carried out.

There are a few important things that the control system designer has to keep in
mind when carrying out an identification experiment:

Stability problem if the plant that is identified is unstable, the
identification has to be carried out with a working controller, which
introduces additional problems that will be discussed further on. If the
plant is stable and does not have to work with a controller the
identification is much simpler.
Structure choice a very important aspect of the identification. For
linear models it comes down to choice of the numerator and
denominator order of the transfer function. It applies both for continuous
and discrete systems.
As far as the discrete models are concerned the structures are also
divided in terms of the error term description: ARX, ARMAX, OE, BJ
3
.
Sampling time the sampling time choice is important both for
identification and control. It cannot be too short nor can it be too long.
Too short sampling time might influence the identification quality
because of the quantisation effect introduced by the AD. Furthermore
the shorter the sampling time the faster the software and hardware has
to be and more memory is needed. However short sampling time will
allow for elimination of aliasing effects and thus anti aliasing filters
4
will
not have to be introduced. Long sampling times will not allow for
including all of the dynamics.
Excitation signal for the linear models the excitation choice is simple.
Very often designers use white noise however in industrial applications
it is often disallowed. It is attractive however because of the fact that it
holds very broad frequency content thus the whole dynamics of the
plant can be identified. If the dynamics are not too complex several

3
More information about these structures can be obtained during the System Identification
courses.
4
These are the basics of the Digital Signal Processing course. For more insight the user is
asked to study more on signal processing and digital control.
BALL AND PLATE IDENTIFICATION

33-240-LabView
16
BALL AND PLATE
Control Experiments
sinusoids with different frequencies can be summed to produce a
satisfactory excitation signal.
Identification method usually two methods are used, the Least Square
(LS) method and the Instrumental Variable method. The LS method is
the most popular and is implemented in LabVIEW. This method
minimizes the error between the model and the plant output. The
optimal model parameters, for which the square of the error is minimal
is the result of the identification.

Model identification

The following exercises include all of the above facts and provide identification
experiments, which result in a discrete and continuous model of the Ball and Plate
unit. The first model to be identified describes the relation between the control
voltage u and the table angle . The second model relates ball position on a plate in
one direction x, with table angle . Two transfer functions are obtained, which are
added together to constitute the whole system model.
It is assumed that the ball and plate system can be treated as two orthogonal ball
and beam systems (x and y direction).

Both of these models are identified with a stabilising controller
5
i.e. closed loop
identification
6
. The table model requires a proportional controller to remove trends
present in table angle when working in open-loop.
The ball on plate model needs to be identified in closed-loop with a PD controller,
because of instability. The ball has to be kept by the controller within the borders of
the table.
In both situations the controllers presence can lead to model corruption. Thus
special methodology is used to identify both of the models.

Exercise 3 Plate model identification

Introduction
The plate model is identified with a working controller to limit the table
movement. The controller introduces correlation between output noise and the
control signal, which might lead to model corruption. This correlation can be
broken by introducing an additional excitation signal r, which is added to the
control signal u (Figure 12).

5
The Ball and Plate control aspect is explained in the Ball and Plate Control section.
6
Closed loop system identification is a broad topic and more advanced users are advised to
refer to identification literature to get more insight.
BALL AND PLATE IDENTIFICATION

33-240-LabView
17
BALL AND PLATE
Control Experiments

Figure 12 Unstable system identification

If the power of the signal r is substantial compared to the noise power n, the
proper model of the closed-loop system should be identified.
A closed-loop system transfer function T(
1
z ), describing the relation between
signal r and is expressed as:

) ( ) ( 1
) (
) (
) (
) (
1 1
1
1
1
1

+
= =
z G z C
z G
z r
z
z T

,

where C(
1
z ) is the discrete controller transfer function and G(
1
z ) is the plant
model discrete transfer function. The relation (33) can be transformed to yield
the plate model:

) ( ) ( 1
) (
) (
) (
) (
1 1
1
1
1
1


= =
z T z C
z T
z u
z
z G

.

Such approach is presented in this exercise to yield a plate model.


Task
Open the BP_PlateIdentification model. Turn on the power of the Ball and
Plate system. To carry out the identification experiment, press the Enable Write
Data. The experiment is performed with a sampling interval Ts = 0.001 [s] and
should last more than 10 seconds. Next disable the data transfer and press the
Identify the Model button.

The Write To Measurement File Express VI in the program create a text-based
file on the computer including the input and output assigned to it. So when the
experiment finishes, input/output data will be available on the local drive.

BALL AND PLATE MODEL IDENTIFICATION
(33)

(34)


33-240-LabView
18
BALL AND PLATE
Control Experiments
The measured data is imported to LabVIEW using The Read From
Measurement File VI and with the use of the LabVIEW identification VIs, a
discrete model of plate is estimated. The ARX 2 2 1 structure has been
selected for the model. You can check the quality of the response of the
identified model by the step response analysis, transient response, pole and
zeros map, frequency response and model residuals.

Equation (34) can be used to calculate G(
1
z ). The discrete model can be
transformed to a continuous form using SI Convert Continuous to Discrete
Model VI. Box G on the front panel (Figure 13) represents the discrete transfer
function of the plate. The calculated transfer function has been used to simulate
the plate model.

Figure 13 Plate model Identification
Example results and comments
Run the BP_PlateIdentification model. Figure 14 presents the comparison of
the obtained model and plate responses from simulation.



Figure 14 Table model and setup response

BALL AND PLATE MODEL IDENTIFICATION

33-240-LabView
19
BALL AND PLATE
Control Experiments

Exercise 4 Ball on plate model identification

Introduction
Ball on plate model identification is a difficult task mainly for one aspect
instability. The ball on a platform is an unstable system and has to be identified
with a running, stabilising controller
7
i.e. closed loop identification
8
. The
controller introduces output noise and control signal correlation, which leads to
model corruption. This correlation can be broken by introducing an additional
excitation signal r, which is added to the control signal u (Figure 15). Ball
control is carried out in cascade, which complicates the identification task
further.


Figure 15 Unstable system identification

If power of signal r is substantial compared to noise n power, proper model
should be identified.
As in plate model identification the discrete model of the ball on a plate is
extracted from the closed-loop transfer function, which relates signals r and y:

) ( ) ( ) ( ) ( ) ( ) ( 1
) ( ) (
) (
) (
) (
1 1
1
1 1
2
1 1
2
1 1
1
1
1

+ +
= =
z G z C z G z C z G z C
z G z G
z r
z y
z T
b
b
,

where C
1
(
1
z ) is the discrete ball position controller transfer function, C
2
(
1
z ) is
the discrete table orientation controller transfer function, G
b
(
1
z ) is the ball on
plate model discrete transfer function, G(
1
z ) is the table discrete model
transfer function.



7
The Ball and Plate control aspect is explained in the Ball and Plate Control section.
8
Closed loop system identification is a broad topic and more advanced users are advised to
refer to identification literature to get more insight.
BALL AND PLATE MODEL IDENTIFICATION
(35)


33-240-LabView
20
BALL AND PLATE
Control Experiments

Relation (35) can be transformed to yield:
) ( ) ( 1
) ( ) (
1
) (
) (
) (
) (
) (
1 1
1
1 1
2
1
2
1
1
1
1

+ +
= =
z G z C
z G z C
z C
z G
z r
z y
z T
b
b
.

As C
2
(z
-1
) has significantly large gain, it can be assumed that:
. 0
) ( ) (
1
1 1
2


z G z C

Thus, (36) simplifies to:
) ( ) ( 1
) (
) (
) (
1 1
1
1
2
1
1

z G z C
z C
z G
z T
b
b
.

The relation (38) can be transformed to yield the ball on a plate model:
) ( ) ( ) ( 1
) ( ) (
) (
1
1
1 1
2
1
2
1
1

z C z T z C
z C z T
z G
b
.
Although (39) is an approximation of the model of the ball on a plate, it reduces
the amount of transfer function multiplications, necessary to yield the final
model. Such operations on discrete transfer functions are very sensitive to
numerical errors.

The above approach is presented in this exercise to yield a Ball and Plate
model.

Open the BP_BallIdentification model. Turn on the power of the Ball and Plate
system. Carry out the identification experiment according to the instructions
given below. The experiment requires provided rails to be mounted on the
plate. The experiment is performed with a sampling interval Ts = 0.001 [s] and
should last more than 10 seconds.

Task
Run the BP_BallIdentification model. Press the Enable Write data switch
enables writing the data to output. After 10 seconds or more disable the data
transfer. The input/output data will be available on the local drive.


BALL AND PLATE MODEL IDENTIFICATION
(36)

(37)

(38)

(39)


33-240-LabView
21
BALL AND PLATE
Control Experiments
By pressing the Identify the Model button, the model of the ball on the plate is
estimated. The structure of the model is chosen to be ARX 4 4 1. The discrete
transfer function of the ball on the plate, and coefficient of ARX model are
available on the front panel. You can check the quality of the response of the
identified model by the step response analysis, transient response, pole and
zeros map, frequency response and model residuals.

Example results and comments
Figure 16 presents the comparison of the obtained model and ball on plate
responses.



Figure 16 Ball model and apparatus response


BALL AND PLATE MODEL IDENTIFICATION

33-240-LabView
22
BALL AND PLATE
Control Experiments
Ball and Plate setup control

The Ball and Plate control aspect covers 1-D and 2-D control. For the beginning
simple 1-D control is considered. LabVIEW provides various analysis methods for
linear systems as far as dynamics are concerned (root locus, frequency analysis
tools Bode diagrams, Nyquist plots, pole and zero maps etc.). With the information
that LabVIEW provides about the dynamics of the system, controllers can be
designed. The following sections explain how the PID controller works, and how it
can be tuned.

Plant control

There are numerous control algorithms however the PID control is the most popular
because of its simplicity. A general schematic of a simple control closed loop system
is presented in Figure 17.






Figure 17 Simple control system closed loop

Assuming that the plant is represented by its linear model its transfer function can be
described as:
) (
) (
) (
s A
s B
s G =
where s is the Laplace operator. The idea of control algorithms is to find such a
controller (transfer function, discrete transfer function, any nonlinear), which will fulfil
our requirements (certain dynamic response, certain frequency damping, good
response to the dynamic changes of the desired value etc.). Every controllers input
is the e(t) error signal. Sometimes disturbance signals are also measured.
Depending on the present and past values of the error signal, the controller performs
such an action (changes the u(t) control signal) that the y(t) is as close to the y
desired
(t)
value as possible at all times.

There are a lot of controller design and tuning methods. All of them consider the
behaviour of the closed loop system (plant with a controller Figure 17) and provide

(40)
BALL AND PLATE SETUP CONTROL
C(s) G(s)

33-240-LabView
23
BALL AND PLATE
Control Experiments
controller parameters according to the assumed system characteristics. With the
known plant transfer function G(s) it is possible to find satisfactory parameters of the
C(s) controller such that the closed loop system will have the desired characteristics
described by the transfer function T
c
(s):

) ( ) ( 1
) ( ) (
) (
s G s C
s G s C
s T
c
+

=

PID controller

A PID controller consists of 3 blocks: Proportional, Integral and Derivative. The
equation governing the PID controller can be represented in parallel form (42) or
ideal form (42.a). Equation (42.b) relates the two forms:
) ( ) ( ) (
) (
) ( ) ( ) (
t y t y t e
dt
t de
D dt t e I t e P t u
desired
=
+ + =




P
D
T
I
P
T P k
dt
t de
T dt t e
T
t e k t u
D i c
d
i
c
= = =
+ + =

, ,
]
) (
) (
1
) ( .[ ) (


With the means of the Laplace transform such a structure can be represented as a
transfer function:
s
I Ps Ds
s D
s
I
P
s E
s U
s C
s E s D
s
I
P s U
+ +
= + + = =
+ + =
2
) (
) (
) (
) (
) ( ) ( ) (


Each of the PID controller blocks (P, I and D) plays an important role. However for
some applications, the Integral or Derivative part has to be excluded to give
satisfactory results. The Proportional block is mostly responsible for the speed of the
system reaction. However for oscillatory plants it might increase the oscillations if the
value of P is set to be too large.
The Integral part is very important and assures zero error value in the steady state,
which means that the output will be exactly what we want it to be. Nevertheless the
Integral action of the controller causes the system to respond slower to the desired
BALL AND PLATE SETUP CONTROL
(41)
(42)
(43)
(44)
(45)
(42.a)


(42.b)



33-240-LabView
24
BALL AND PLATE
Control Experiments
value changes and for systems were very fast reaction is very important it has to be
omitted. Certain nonlinearities will also cause problems for the integration action.

The Derivative part has been introduced to make the response faster. However it is
very sensitive to noise and may cause the system to react very nervously. Thus very
often it is omitted in the controller design. Derivative part output filtering may reduce
the nervous reaction but also slows the response of the controller down and
sometimes undermines the sense of using the Derivative part at all. Proper filtering
can help to reduce the high frequency noise without degrading the control system
performance in the lower frequency band.

There are several PID tuning techniques. Most often Ziegler-Nichols rules are used
or a relay experiment is undertaken. Very often the closed loop system roots are
analysed and set in the desired position by proper choice of P, I and D values.
LabVIEW delivers a root locus tool, which helps in such designs.

Plate orientation control

As a first control task, PID plate orientation control is chosen. The following exercises
will guide you through the controller design, testing on the model and on real time
application. The plate is controlled as 1-D application.

Exercise 5 PID control of plate orientation

Introduction
To design a PID controller a model of the plant is needed. For this purpose we
can use a discrete model and design a discrete PID controller, or use a
continuous model and design a continuous PID controller. However, when a
controller is implemented on some kind of a control unit it has to be used in a
discrete form. Thus, you might want to operate in the discrete domain.

Task
Design a PID controller using the transfer function obtained in the identification
experiment or the phenomenological model. Input the discrete or continuous
transfer function in LabVIEW using the Control design VIs. The discrete
model obtained in Ball and Plate Model Identification section can be
transformed into a continuous model before the controller design.

For instructions on controller tuning refer to the LabVIEW Guide manual.

BALL AND PLATE SETUP CONTROL

33-240-LabView
25
BALL AND PLATE
Control Experiments
Example results and comments
The root locus of the identified table model with the P control with P = 0.4 and
D =0.055 is presented in Figure 18.


Figure 18 Root locus with PID controller
You can use the control design VIs to move the poles, zeros and the gain to
obtain for example faster step response of the closed loop system. The model
can be calculated using the tools provided and tested on the model of the Ball
and Plate, BP_PID_plate.vi.

Use a sinusoidal or test signal for the desired value of plate orientation
desired
(t).
Change the frequency and see how the output follows the desired value.
Decrease and increase the values of the proportional, integral and derivative
parameters in the PID controller. See how that influences the tracking of the
desired value.

The controller that has been obtained in the above exercise can be tested on the Ball
and Plate setup (see Exercise 6). The results of P control on the model are
presented in Figure 19.
BALL AND PLATE SETUP CONTROL

33-240-LabView
26
BALL AND PLATE
Control Experiments

Figure 19 P control on the model

Exercise 6 Real-time PID control of plate position

Introduction

Just as in exercise 5 the plate orientation will be controlled. This time it is tested
in real-time. For this exercise use the BP_PID_plate.vi presented in Figure 20.

The PID controller has been already designed, however you can change its
parameters according to the results obtained in exercise 5.

Before you run the real-time simulation make sure the Ball and Plate setup is
properly connected. Refer to the Installation & Commissioning manual for
more instructions on real time simulations.

For this control exercise the ball does not have to be placed on the plate. Only
the table orientation is controlled. Table orientation is measured via
potentiometers.

BALL AND PLATE SETUP CONTROL

33-240-LabView
27
BALL AND PLATE
Control Experiments

Figure 20 Real time plate orientation control

Task
The task is to change the sinusoidal
desired
(t). signal frequency and see how the
system reacts to it. The frequency of the test signals can be changed from the
block diagram. The angle of the table can be controlled manually, by sliding the
designated switch on the front panel to Setpoint. The angle can be changed by
dragging the virtual table, or by increment/decrement button.

Change the controller P,I and D values to see how the signal
desired
(t) is
tracked by the system output.

You should already gain some experience in exercise 5 on how the values of
these gains can be changed.

Example results and comments
Figure 21 and presents real-time simulation results of PD control of table
orientation.

BALL AND PLATE SETUP CONTROL

33-240-LabView
28
BALL AND PLATE
Control Experiments

Figure 21 Real-time table orientation PD control

1-D ball control

Ball and Plate can be treated as 2 independent ball and beam systems. As
interaction between the two axes is insignificant, in 1-D control the second dimension
can be ignored. Real-time 1-D ball control on the plate requires provided rails to be
mounted on the plate. Such modification allows for easy visual interpretation of ball
reaction.
The following exercises will guide you through 1-D ball control in simulation and real-
time.

Exercise 7 1-D PID control of ball position

Introduction
For this exercise use the BP_model_PID_1D.vi. A phenomenological model is
prepared for 1-D ball position control.

Task
Run the BP_model_PID_1D.vi from simulation section. Modify the PID
controller parameters to see how the control action is influenced by the
changes. Select different desired position signals (sinusoidal and pulse) and
compare system reactions.

Example results and comments
Figure 22 and Figure 23 present model responses to sinusoidal and pulse-like
desired position signals.
BALL AND PLATE SETUP CONTROL BALL AND PLATE SETUP CONTROL

33-240-LabView
29
BALL AND PLATE
Control Experiments


Figure 22 1-D PID ball position control sinusoidal desired value


Figure 23 1-D PID ball position control pulse-like desired value
Exercise 8 Real-time 1-D PID control of ball position

Introduction
For this exercise use the BP_PID_1D.vi. This time 1-D ball position control is
carried out in real-time on the Ball and Plate setup.

Task
Make sure the unit is connected properly to the PC. Run the BP_PID_1D.vi.
The experiment provides the functionality to drag the ball in the real-time.
BALL AND PLATE SETUP CONTROL

33-240-LabView
30
BALL AND PLATE
Control Experiments
Modify the PID controller parameters to see how the control action is influenced
by the changes. Select different desired position signals (sinusoidal and
square) and compare system reactions. Modify desired signal frequency to test
system bandwidth.

Example results and comments
Figure 24 and Figure 25 present ball and plate responses to sinusoidal and
pulse-like desired position signals.


Figure 24 1-D PID ball position control sinusoidal desired value


Figure 25 1-D PID ball position control pulse-like desired value
BALL AND PLATE SETUP CONTROL

33-240-LabView
31
BALL AND PLATE
Control Experiments
2-D ball control

Although the interaction between two axes is moderate, 2-D ball control is much
more exciting than 1-D ball control. The second dimension allows for almost arbitrary
trajectory tracking. A special interface has been designed to support ball trajectory
planning.

The following exercises will guide you through 2-D ball control in simulation and real-
time.

Exercise 9 2-D PID control of ball position

Introduction
For this exercise use the BP_model_PID_2D.vi. A phenomenological model is
prepared for 2-D ball position control. You may also use the
BP_model_PID_Tracking.vi if you want to plan a specific trajectory. See
Exercise 11 for details.

Task
Run the BP_model_PID_2D.vi. Modify the PID controller parameters to see
how the control action is influenced by the changes. Select different desired
position signals and compare system reactions.

Example results and comments
Figure 26, Figure 27 and Figure 28 present model responses to sinusoidal
desired x and y position signals.
BALL AND PLATE SETUP CONTROL

33-240-LabView
32
BALL AND PLATE
Control Experiments


Figure 26 2-D PID ball position control position on x axis


Figure 27 2-D PID ball position control position on y axis

Figure 28 2-D PID ball position control x versus y

BALL AND PLATE SETUP CONTROL

33-240-LabView
33
BALL AND PLATE
Control Experiments

Exercise 10 Real-time 2-D PID control of ball position

Introduction
For this exercise use the BP_PID_2D.vi. This time 2-D ball position control is
carried out in real-time on the Ball and Plate setup.

Task
Make sure the unit is connected properly to the PC. Run the BP_PID_2D.vi.
Modify the PID controller parameters to see how the control action is influenced
by the changes. Select different desired position signals and compare system
reactions. Modify desired signal frequency to test system bandwidth.

Example results and comments
Figure 29, Figure 30 and Figure 31 present ball and plate responses to
sinusoidal desired position signals.
BALL AND PLATE SETUP CONTROL

33-240-LabView
34
BALL AND PLATE
Control Experiments

Figure 29 2-D PID ball position control position on x axis


Figure 30 2-D PID ball position control position on y axis

BALL AND PLATE SETUP CONTROL

33-240-LabView
35
BALL AND PLATE
Control Experiments

Figure 31 2-D PID ball position control x versus y

Trajectory tracking

The trajectory tracking exercises are similar to 2-D ball control. This time a Build XY
Graph VI is used to plan the desired trajectory for the ball to track to, which is
translated into 2 orthogonal desired position signals.

Exercise 11 Trajectory tracking with ball

Introduction
For this exercise use the BP_model_PID_Trajectory.vi. Draw an arbitrary
trajectory for the ball to follow.

Task
To generate a trajectory use the cursor in XY graph and draw an arbitrary path.
It should be mentioned that the speed of the drawing represents the speed of
ball. After you finish the path, press the Model Response button. The interface
presented in Figure 32 illustrates the front panel of
BP_model_PID_Trajectory.vi.

Modify the PID controller parameters to see how the control action is influenced
by the changes. If you want the trajectory to be updated faster, draw the
specified trajectory faster.
BALL AND PLATE SETUP CONTROL

33-240-LabView
36
BALL AND PLATE
Control Experiments


Figure 32 Trajectory Planning Interface
Example results and comments
Figure 33 presents ball trajectory tracking experiment results.


BALL AND PLATE SETUP CONTROL

33-240-LabView
37
BALL AND PLATE
Control Experiments
Figure 33 Trajectory tracking with ball

Exercise 12 Real-time trajectory tracking with ball

Introduction
First design an arbitrary trajectory for the ball to follow using Trajectory
Planning.vi. Then for this exercise use the BP_PID_Trajectory.vi. The
experiment starts with a delay. If the ball and plate goes to an unstable
situation, stop the experiment and run it again.

Task

Run the program and modify the PID controller parameters to see how the
control action is influenced by the changes.

Example results and comments
Figure 34 presents ball trajectory tracking experiment results.


Figure 34 Trajectory tracking with ball real-time experiment

BALL AND PLATE SETUP CONTROL

You might also like