0% found this document useful (0 votes)
12 views36 pages

Made For Science Quanser Magnetic Levitation CoursewareStud LabVIEW

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views36 pages

Made For Science Quanser Magnetic Levitation CoursewareStud LabVIEW

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

STUDENT WORKBOOK

Magnetic Levitation Experiment for LabVIEW Users


Developed by:
Jacob Apkarian, Ph.D., Quanser
Hervé Lacheray, M.A.SC., Quanser
Michel Lévis, M.A.SC., Quanser

Quanser educational solutions


are powered by:

CAPTIVATE. MOTIVATE. GRADUATE.


© 2012 Quanser Inc., All rights reserved.

Quanser Inc.
119 Spy Court
Markham, Ontario
L3R 5H6
Canada
[email protected]
Phone: 1-905-940-3575
Fax: 1-905-940-3576

Printed in Markham, Ontario.

For more information on the solutions Quanser Inc. offers, please visit the web site at:
http://www.quanser.com

This document and the software described in it are provided subject to a license agreement. Neither the software nor this document may be
used or copied except as specified under the terms of that license agreement. All rights are reserved and no part 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
written permission of Quanser Inc.

ACKNOWLEDGEMENTS
Quanser, Inc. would like to thank the following contributors:

Dr. Hakan Gurocak, Washington State University Vancouver, USA, for his help to include embedded outcomes assessment, and

Dr. K. J. Åström, Lund University, Lund, Sweden for his immense contributions to the curriculum content.

MAGLEV Workbook - Student Version 2


CONTENTS
1 Introduction 4

2 Modeling 5
2.1 Background 5
2.2 Pre-Lab Questions 8

3 Coil Current Control 9


3.1 Background 9
3.2 Pre-Lab Questions 14
3.3 Lab Experiments 15
3.4 Results 19

4 Ball Position Control 20


4.1 Background 20
4.2 Pre-Lab Questions 23
4.3 Lab Experiments 24
4.4 Results 27

5 System Requirements 28
5.1 Overview of Files 29
5.2 Setup for Coil Current Control Simulation 29
5.3 Setup for Implementing Coil Current Control 29
5.4 Setup for Ball Position Control Simulation 30
5.5 Setup for Implementing Ball Position Control 30

6 Lab Report 32
6.1 Template for Coil Current Control Report 32
6.2 Template for Ball Position Control Report 33
6.3 Tips for Report Format 34

MAGLEV Workbook - Student Version v 1.1


1 INTRODUCTION
The MAGLEV plant is an electromagnetic suspension system acting on a solid one-inch steel ball. It mainly consists
of an electromagnet, located at the upper part of the apparatus, capable of lifting from its pedestal and sustaining in
free space the steel ball. Two system variables are directly measured on the MAGLEV rig and available for feedback.
They are namely: the coil current and the ball distance from the electromagnet face. A more detailed description is
provided in the Magnetic Levitation User Manual [2].

During the course of this experiment, you will become familiar with the design and pole placement tuning of both
PI current controller and PIV-plus-feed-forward ball position controller. The challenge of the present laboratory is
to levitate a one-inch solid steel ball in air from the pedestal using an electromagnet. The control system should
maintain the ball stabilized in mid-air and track the ball position to a desired trajectory.

Topics Covered

• Modeling the MAGLEV plant from first principles in order to obtain the two open-loop transfer functions char-
acterizing the system, in the Laplace domain.

• Linearize the obtained non-linear equation of motion about the quiescent point of operation.
• Design, through pole placement, a Proportional-plus-Integral (PI) controller for the MAGLEV electromagnet
current in order for it to meet the required design specifications.
• Design, through pole placement, a Proportional-plus-Integral-plus-Velocity (PIV) controller with feed-forward
action for the MAGLEV levitated ball position in order for it to meet the required design specifications.
• Implement your two controllers in real-time and evaluate their actual performances.

• Numerically determine the system's actual closed-loop poles, by considering the coil current control system's
dynamics.

Prerequisites

In order to successfully carry out this laboratory, the user should be familiar with the following:

1. See the system requirements in Section 5 for the required hardware and software.
2. Transfer function fundamentals, e.g., obtaining a transfer function from a differential equation.

3. Familiar with designing PID controllers.


4. Basics of LabVIEW™ .

MAGLEV Workbook - Student Version 4


2 MODELING
2.1 Background
A schematic of the Magnetic Levitation (MAGLEV) plant is represented in Figure 2.1. As illustrated in Figure 2.1, the
positive direction of vertical displacement is downwards, with the origin of the global Cartesian frame of coordinates
on the electromagnet core flat face. Although the ball does have six Degrees Of Freedom (DOF) in free space,
only the vertical, i.e., x-axis, is controlled. It can also be seen that the MAGLEV consists of two main systems: an
electrical and an electro-mechanical.

Figure 2.1: Schematic of the Magnetic Levitation plant.

2.1.1 Electrical Equations

As represented in Figure 2.1, the MAGLEV coil has an inductance Lc and a resistance Rc . Additionally, the actual
system is equipped with a current sense resistor, Rs , that is in series with the coil. The voltage sense, Vs , is used to
measure the current in the coil. The coil current can then be computed using the following relationship

Vs (t) = Rs is (t)

Using Kirchhoff's voltage law, we obtain the following first-order differential equation
dic (t)
vc (t) = (Rc + Rs )ic (t) + Lc (2.1)
dt
where Rc is the coil resistance, Lc is the coil inductance, Ic is the coil current, vc is the applied coil voltage, and Rs
is the current sense resistance.

MAGLEV Workbook - Student Version v 1.1


This can be represented by the first-order transfer function

Ic (s) Kc
Gc (s) = = (2.2)
Vc (s) τc s + 1

where Kc is the DC (or steady-state) gain and τc is the time constant.

2.1.2 Nonlinear Model

Using the notation and conventions given in Figure 2.1, the attractive force generated by the electromagnet and
acting on the steel ball can be expressed by
Km ic (t)2
Fc = (2.3)
2x2b
where xb > 0 is the air gap between the ball and the face of the electromagnet and Km is the electromagnetic force
constant. The pull of the electromagnet is proportional to the square of the current and inversely proportional to the
air gap (i.e., ball position) squared. The force due to gravity acting on the ball is given by

Fg = Mb g.

The total external force experienced by the ball using the electromagnet is given by

Km ic (t)2
Fext = −Fc + Fg = − + Mb g.
xb (t)2

Applying then Newton's second law of motion to the ball gives the following nonlinear Equation Of Motion (EOM)

Km ic (t)2
ẍb (t) = − + g. (2.4)
2Mb xb (t)2

2.1.3 Linear Model

The nominal coil current, ic0 , for the electromagnet-ball pair can be determined at the system's static equilibrium.
By definition, static equilibrium at a nominal operating point (xb0 , ic0 ) is characterized by the ball being suspended
in air at a constant position xb0 due to a constant electromagnetic force generated by ic0 .

In order to design a linear position controller for our system, the Laplace open-loop transfer function must be derived.
However, a transfer function can only represent the system's dynamics from a linear differential equation. Therefore,
the nonlinear EOM given in Equation 2.4 should be linearized around a quiescent point of operation.

In the case of the levitated ball, the operating range corresponds to small departure positions, δxb , small departure
currents, δic , from the desired equilibrium point (xb0 , ic0 ). Therefore, xb and ic can be expressed as the sum of two
quantities, as shown below:
xb = xb0 + δxb
and
ic = ic0 + δic .

Example: Linearing a Two-Variable Function


Here is an example of how to linearize a two-variable nonlinear function called f (z). Variable z is defined

z ⊤ = [z1 z2 ]

and f (z) is to be linearized about the operating point

z0 ⊤ = [a b]

MAGLEV Workbook - Student Version 6


The linearized function is
( ) ( )
∂f (z) ∂f (z)
fz = f (z0 ) + (z1 − a) + (z2 − b)
∂z1 z=z0 ∂z2 z=z0

Open-loop Transfer Function


The linear representation of the dynamics between the coil current and the ball position about the operating point
can be represented the transfer function

∆Xb (s) Kb ω 2
Gb (s) = = − 2 n2 (2.5)
∆Ic (s) s − ωb

where ∆Xb (s) = L[δxb (t)], ∆Ic (s) = L[δic (t)], Kb is the DC gain (i.e., steady-state gain), and ωb is the natural
frequency. Since we are dealing with the displacement about the operating point, the initial conditions are zero, i.e.,
δxb (0− ) = 0 and δic (0− ) = 0.

MAGLEV Workbook - Student Version v 1.1


2.2 Pre-Lab Questions
1. Find the open-loop electrical system transfer function that represents the coil voltage to coil current given in
Equation 2.2. Assume all initial conditions are zero, i.e., ic (0− ) = 0. Determine the first-order DC gain, Kc ,
and time constant, τc , model and evaluate them numerically. See the MAGLEV User Manual [2] for system
parameters.

2. Is the electrical system stable? What is its order and its type?
3. Express the static equilibrium current ic0 as a function of the system's desired equilibrium position xb0 and its
electromagnet force constant Km . Using the equilibrium position xb0 = 6 mm and the system's specifications
given in MAGLEV User Manual [2], evaluate ic0 . Also, express the electromagnet force constant Km as a
function of the system's desired equilibrium point (xb0 , ic0 ).
4. Linearize the ball's EOM found in Equation 2.4 about the quiescent operating point (xb0 , Ic0 ). This will give you
a function in the form δ ẍb = f (xb , ic ). To simplify your final equations, apply the Km expression you found in
the previous exercise.

5. From the linear equation of motion, determine the system's open-loop transfer function. Express the open-loop
transfer function in terms of the DC gain, Kb , and natural frequency, ωb . Is the system stable? What are its
order and its type?

MAGLEV Workbook - Student Version 8


3 COIL CURRENT CONTROL
3.1 Background

3.1.1 Second-Order Response

The block diagram shown in Figure 3.1 is a general unity feedback system with compensator (controller) C(s) and a
transfer function representing the plant, P (s). The measured output, Y (s), is supposed to track the reference signal
R(s) and the tracking has to match to certain desired specifications.

Figure 3.1: Unity feedback system.

The output of this system can be written as:


Y (s) = C(s) P (s) (R(s) − Y (s))

By solving for Y (s), we can find the closed-loop transfer function:


Y (s) C(s) P (s)
=
R(s) 1 + C(s) P (s)

In fact, when a second order system is placed in series with a proportional compensator in the feedback loop as in
Figure 3.1, the resulting closed-loop transfer function can be expressed as:
Y (s) ωn2
= 2 (3.1)
R(s) s + 2ζ ωn s + ωn2
where ωn is the natural frequency and ζ is the damping ratio. This is called the standard second-order transfer
function. Its response properties depend on the values of ωn and ζ.

Peak Time and Overshoot

Consider a second-order system as shown in Equation 3.1 subjected to a step input given by
R0
R(s) = (3.2)
s
with a step amplitude of R0 = 1.5. The system response to this input is shown in Figure 3.2, where the red trace is
the response (output), y(t), and the blue trace is the step input r(t).

The maximum value of the response is denoted by the variable ymax and it occurs at a time tmax . For a response
similar to Figure 3.2, the percent overshoot is found using
100 (ymax − R0 )
PO = (3.3)
R0

From the initial step time, t0 , the time it takes for the response to reach its maximum value is
tp = tmax − t0 (3.4)

MAGLEV Workbook - Student Version v 1.1


Figure 3.2: Standard second-order step response.

This is called the peak time of the system.

In a second-order system, the amount of overshoot depends solely on the damping ratio parameter and it can be
calculated using the equation ( )
− √π ζ
1−ζ 2
P O = 100 e (3.5)

The peak time depends on both the damping ratio and natural frequency of the system and it can be derived as
π
tp = √ (3.6)
ωn 1 − ζ 2

Generally speaking, the damping ratio affects the shape of the response while the natural frequency affects the
speed of the response.

3.1.2 Specifications

The first closed-loop system is to control the electromagnet coil current via the commanded coil voltage. It is based
on a Proportional-plus-Integral (PI) scheme. In response to a 0-to-1 A square wave coil current setpoint, tune the
PI current controller in order to satisfy the following design performance requirements:

1. Maximum percent overshoot of 1.5 %, i.e., P Oc ≤ 1.5 %.

2. No steady-state error, i.e., ess,c = 0.


3. Maximum peak time of 0.05 seconds, i.e., tp,c ≤ 0.05 s.

In order to obtain these requirements, you need a second-order system with the following parameters:

1. Natural frequency, ωn,c = 104.9 rad/s.


2. Damping ratio, ζ = 0.802.

MAGLEV Workbook - Student Version 10


3.1.3 Coil Current Control Design

Prior to control the steel ball position, the current flowing through the electromagnet needs to be controlled. The
electromagnet current control loop consists of a Proportional-plus-Integral (PI) closed-loop scheme, as illustrated in
Figure 3.3.

Figure 3.3: Block diagram of PI current control

The PI control has the following structure


( )
ki,c
Vc (s) = kp,c + (Ic,d (s) − Ic (s)) (3.7)
s
where kp,c is the proportional control gain, ki,c is the integral control gain, Ic,d is the desired coil current (i.e., reference
or setpoint current), Ic is the measured coil current, and Vc is the applied coil voltage.

Substituting the PI control in 3.7 into the plant transfer function Gc (s), given in Equation 2.2, and solving for Ic,d (s)/Ic (s)
gives the MAGLEV closed-loop current control transfer function:
Ic (s) Kc (kp,c s + ki,c )
Tc (s) = = 2
(3.8)
Ic,d (s) τc s + (Kc kp,c + 1)s + Kc ki,c

3.1.4 Set-Point Weighting

The controllers described so far are called controllers with error feedback because the control action is based on the
error, which is the difference between the reference r and the process output y. There are significant advantages to
have the control action depend on the reference and the process output and not just on the difference between this
signals. A simple way to do this is to replace the ideal PID controller with
∫t
dy(t)
u(t) = k(bsp r(t) − y(t)) + ki (r(τ ) − y(τ )dτ − kd (3.9)
dt
0

where the parameter bsp is called set-point weight or the reference weight. In this controller the proportional action
only acts on a fraction bsp of the reference and there is no derivative action on the set-point. Integral action continues
to act on the full error to ensure the error goes to zero in steady state.

Figure 3.4 illustrates the effects of set-point weighting on the step response of the process,
1
P (s) =
s
with the controller gains kp = 1.5 and ki = 1. As shown in Figure 3.4, the overshoot for reference changes is
smallest for bsp = 0, which is the case where the reference is only introduced in the integral term, and increases
with increasing bsp . The set-point weights in Figure 3.4 are: bsp = 0 on the bottom dashed plot trajectory, bsp = 0.2
and bsp = 0.5 on the two solid lines, and bsp = 1 on the top dash-dot response. The set-point parameter is typically
in the range of 0 to 1.

MAGLEV Workbook - Student Version v 1.1


Figure 3.4: Set-point weighting effect on step response.

3.1.5 Integral Windup

The windup effect is illustrated in Figure 3.5 by the dashed red line. The initial reference signal is so large that the
actuator saturates at the high limit. The integral term increases initially because the error is positive. The output
reaches the reference at around time t = 4. However, the integrator has built-up so much energy that the actuator
remains saturated. This causes the process output to keep increasing past the reference. The large integrator
output that is causing the saturation will only decrease when the error has been negative for a sufficiently long time.
When the time reaches t = 6, the control signal finally begins to decrease while the process output reaches its
largest value. The controller saturates the actuator at the lower level and the phenomena is repeated. Eventually
the output comes close to the reference and the actuator does not saturate. The system then behaves linearly and
settles quickly. The windup effect on the process output is therefore a large overshoot and a damped oscillation
where the control signal flips from one extreme to the other as in relay oscillations.

Figure 3.5: Illustration of integrator windup.

There are many ways to avoid windup, one method is illustrated in Figure 3.6 The system has an extra feedback

MAGLEV Workbook - Student Version 12


path that that sets the integrator to a value so that the controller output is always close to the saturation limit. This
is accomplished by measuring the difference es between the actual actuator output and feeding this signal to the
integrator through gain 1/Tr .

Figure 3.6: PID controller with anti-windup

The signal es is zero when there is no saturation and the extra feedback loop has no effect on the system. When
the actuator saturates, the signal es is different from zero. The normal feedback path around the process is broken
because the process input remains constant. The feedback around the integrator will act to drive es to zero. This
implies that controller output is kept close to the saturation limit and integral windup is avoided.

The solid curves in Figure 3.5 illustrates the effect of anti-windup. The output of the integrator is quickly reset to
a value such that the controller output is at the saturation limit, and the integral has a negative value during the
initial phase when the actuator is saturated. Observe the dramatic improvement of using windup protection over the
ordinary PI controller that is represented by the dashed lines in Figure 3.5.

MAGLEV Workbook - Student Version v 1.1


3.2 Pre-Lab Questions
1. Find the PI gains for the coil current control, kp,c and ki,c , in terms of ωn and ζ. Hint: Remember the standard
second order system equation.

2. Based on the MAGLEV model parameters, Kc and τc found in Section 2.2, calculate the control gains needed
to satisfy the time-domain response requirements given in Section 3.1.2.

MAGLEV Workbook - Student Version 14


3.3 Lab Experiments

3.3.1 Current Control Simulation

In this section you will simulate the magnet coil current control of the MAGLEV system. The coil is modeled using
the first-order transfer function presented in Section 2.1 and controlled using the PI controller described in Section
3.1.3. Our goals are to confirm that the desired response specifications are satisfied and to verify that the amplifier
is not saturated.

Experimental Setup

The MAGLEV Current Control Simulation VI shown in Figure 3.7 will be used to simulate the closed-loop current
control response with the PI controller. The current commands are positive and limited by the rated maximum magnet
coil current of 3 A.

Figure 3.7: VI used to simulate coil current control response.

IMPORTANT: Before you can conduct these experiments, you need to make sure that the lab files are configured.
If they have not been configured already, then you need to go to Section 5 to configure the lab files first.

1. In MAGLEV.lvproj, open MAGLEV Current Control Simulation.vi.


2. To generate a square wave that goes between 0 an 1 A for the current reference, go to the Current Setpoint
section and set the controls to the following:
• Amplitude = 1 A
• Frequency = 0.2 Hz
3. Enter the proportional and integral control gains found in Section 3.2 in the kp_c and ki_c controls on the front
panel.
4. Set the set-point weight parameter, i.e., bsp, to 0.
5. By default, there should be no anti-windup on the Integrator block (i.e., just use the default Integrator block).

MAGLEV Workbook - Student Version v 1.1


6. Run the VI. By default, the simulation runs for 10 seconds. The scopes should be displaying responses similar
to Figure 3.8. Note that in the Coil Current (A) scope, the blue trace is the setpoint position while the red trace
is the simulated current (generated by the Transfer Function block in the VI block diagram).

Figure 3.8: Simulated closed-loop current control response.

7. Attach a plot showing the Simulated Coil Current response and the input voltage.
Hint: Use the Export | Export Simplified Image command by right-clicking on the scope after the VI is finished
running.
8. Measure the steady-state error, the percent overshoot and the peak time of the simulated response. Does the
response satisfy the specifications given in Section 3.1.2? Hint: Use the cursors in the graphs found in the
Measure tab to take your measurements.
9. When doing levitation control, more than 1 A is required to initially lift the metal ball from the pedestal on
the MAGLEV device. To mimic the current required, simulate the system with a current setpoint step of 2 A.
Examine the current and voltage responses as well as the output of the Integral in the Integral Control (V)
scope. What is happening to the control signal and the corresponding response? How can the control be
modified to address this?
10. Based on your observations in the step above and the background given in Section 3.1, modify the controller
to improve the simulated closed-loop current response. Explain the control modifications you make. Hint: You
may want to use the amplifier voltage limits (e.g., VoltPAQ is ±24 V).
11. Attach a plot of the closed-loop current response using your modified PI controller.
12. Measure the steady-state error, the percent overshoot and the peak time of the simulated response. Does the
response satisfy the specifications given in Section 3.1.2?

3.3.2 Current Control Implementation

The MAGLEV Current Control VI shown in Figure 3.9 is used to perform the current control exercises in this labora-
tory. This VI interfaces with the electromagnet and sensors of the MAGLEV system.

Experimental Setup

The MAGLEV Current Control VI shown in Figure 3.9 will be used to run the PI current control on the actual MAGLEV
system.

IMPORTANT: Before you can conduct these experiments, you need to make sure that the lab files are configured
according to your setup. If they have not been configured already, then you need to go to Section 5 to configure the
lab files first.

Follow this procedure:

MAGLEV Workbook - Student Version 16


Figure 3.9: VI used to run PI current control on MAGLEV system.

1. In MAGLEV.lvproj, open MAGLEV Current Control.vi.


2. To generate a square wave that goes between 0 an 1.5 A for the current reference, go to the Current Setpoint
section and set the controls to the following:
• Amplitude = 1.5 A
• Frequency = 0.2 Hz

3. Enter the proportional and integral control gains found in Section 3.2 in the kp_c and ki_c controls on the front
panel.

4. Run the VI. Because we are not commanding a high current for a long period of time, the ball should not be
levitating. The scopes should be displaying responses similar to Figure 3.10.

Figure 3.10: Measured closed-loop current control response.

5. Attach plots showing the Implemented Current Control response and the input voltage.

MAGLEV Workbook - Student Version v 1.1


6. Measure the steady-state error, the percent overshoot and the peak time of the response. Does the response
satisfy the specifications given in Section 3.1.2? Hint: Use the graph cursors in the Measure tab to take
measurements.

7. To improve the performance of the current control, re-design the PI control gains for a shorter peak time of
0.015 seconds (instead of 0.05 seconds as in Section 3.1.2), i.e., tp = 0.015. Therefore find PI control gains
for the following new specifications:
(a) Natural frequency, ωn,c = 350 rad/s
(b) Damping ratio, ζ = 0.80

8. Attach a plot showing the current control response and the input voltage with the newly designed PI control
gains.

9. Measure the steady-state error, the percent overshoot and the peak time of the response. Does the response
satisfy the specifications given in Section 3.1.2?

MAGLEV Workbook - Student Version 18


3.4 Results
Fill out Table 3.1 with your answers from your control lab results - both simulation and implementation.

Description Symbol Value Units


Pre Lab Questions
Coil Current Control Gains
Proportional Control Gain kp,c V/A
Integral Control Gain ki,c V/(A-s)
Current Control Simulation
1 A Step
Steady-state error ess deg
Peak time tp s
Percent overshoot PO %
2 A Step
Steady-state error ess deg
Peak time tp s
Percent overshoot PO %
Current Control Implementation
Using PI Gains from Pre-Lab
Steady-state error ess deg
Peak time tp s
Percent overshoot PO %
Re-designed PI Control
Proportional Control Gain kp,c V/A
Integral Control Gain ki,c V/(A-s)
Steady-state error ess deg
Peak time tp s
Percent overshoot PO %

Table 3.1: Results

MAGLEV Workbook - Student Version v 1.1


4 BALL POSITION CONTROL
4.1 Background

4.1.1 Specifications

The second and last control strategy is to regulate and track in mid-air the ball position. The closed-loop scheme
employed consists of a Proportional-plus-Integral-plus-Velocity (PIV) controller with a feed-forward component.

The first specification is to design the ball position controller for the following operating position (i.e., equilibrium
position):
xb0 = 6 mm

In response to a desired ±1 mm square wave position setpoint from the ball equilibrium position in mid-air, the ball
position behavior should satisfy the following design performance requirements:

1. Percent Overshoot, less than 5 %, i.e., P O ≤ 5 %.

2. No static steady-state error, ess = 0.


3. Maximum settling time less than 0.3 second, i.e., ts,b ≤ 0.3 s.

4. Minimize the control effort produced, which is proportional to the coil input voltage Vc . The power amplifier
should not go into saturation in any case.

Consider the characteristic equation of a third order transfer function

(s + p0 )(s2 + 2ζωn s + ωn2 ) = s3 + (p0 + 2ζωn )s2 + (2p0 ζωn + ωn2 )s + p0 ωn2 . (4.1)

In order to achieve the time-domain specifications above, a third-order system with the following parameters is
needed:

1. Natural frequency, ωn,c = 19.3 rad/s.

2. Damping ratio, ζ = 0.69.


3. Pole location, p0 = 40 rad/s.

Settling Time
The settling time of the system is the time it takes for the response to settle within a certain threshold of its final
value. Given
ts = tf − t0 ,
the parameter tf is the time it takes for the response to settle within 1%, 2%, or whatever percentage of its final
value.

The 2% settling time for a second-order system, i.e., the time required to reach 2% of its final value, can be approx-
imated by
4
ts = . (4.2)
ζωn

MAGLEV Workbook - Student Version 20


Figure 4.1: Block diagram of PIV+FF ball position control

4.1.2 Ball Position Control Design

The steel ball position is controlled using the Proportional-plus-Integral-plus-Velocity (PIV) control and feed-forward
action illustrated in Figure 4.1.

As depicted in Figure 4.1, the PIV+FF control is given by


( )
ki,b
Ic (s) = kp,b + (Xb,d (s) − Xb (s)) − kv,b sXb (s) + Kf f,b Xb,d (s). (4.3)
s

As it can be seen in Figure 4.1, the feed-forward action is necessary since the PIV control system is designed
to compensate for small variations (i.e., disturbances) from the linearized operating point (xb0 , Ic0 ). In other words,
while the feed-forward action compensates for the ball gravitational bias, the PIV controller compensates for dynamic
disturbances.

The open-loop transfer function Gm (s) takes into account the dynamics of the electromagnet current loop, as char-
acterized in Section 2.1, and is defined
Xb (s)
Gm (s) = = Tc (s)Gb (s)
Ic,d (s)

where
Xb (s)
Gb (s) = .
Ic (s)

However to simplify the model, we can neglect the dynamics of the electromagnet current loop. In this analysis of the
ball position PIV-plus-feedforward control loop, as presented hereafter, it is therefore assumed that Ic (s) = Ic,d (s)
and so Tc (s) = 1. Given that Gm (s) = Gb (s) and the Gb (s) transfer function found in Section 2.2, we can define the
MAGLEV current-to-position model as

Xb (s) −2gxb0
Gm (s) = = ( ).
Ic (s) Ic0 xb0 s2 − 2g
xb0

Substitute the PIV+FF control in Equation 4.3 into this and solve for Xb (s)/Xb,d (s) to obtain the closed-loop ball

MAGLEV Workbook - Student Version v 1.1


position transfer function

Xb (s) 2gxb0 (Kf f,b + kp,c )s + ki,b


Tb (s) = = . (4.4)
Xb,d (s) −Ic0 xb0 s3 + 2xb0 gkv,b s2 + (2xb0 gkp + 2Ic0 g)s + 2xb0 gki

MAGLEV Workbook - Student Version 22


4.2 Pre-Lab Questions
1. Analyze the ball position closed-loop system at the static equilibrium point (xb0 , ic0 ) and determine the current
feed-forward gain, Kf f,b . Make sure you evaluate the gain numerically.
2. Find the PIV gains for the ball position control, kp,b , ki,b , and kv,b , in terms of third order system parameters
ωn , ζ, and p0 .
3. Based on the MAGLEV operating point parameters, ic0 and xb0 , calculate the control gains needed to satisfy
the time-domain response requirements given in Section 4.1.1. iven in Section 4.1.1.

MAGLEV Workbook - Student Version v 1.1


4.3 Lab Experiments

4.3.1 Ball Position Control Simulation

In this section you will simulate the ball position control of the MAGLEV system. The ball motion and magnet coil
dynamics are modeled using Transer Function block in the VI and controlled using the PIV+FF controller described
in Section 4.1.2. Our goals are to confirm that the desired response specifications are satisfied and to verify that the
amplifier is not saturated.

Experimental Setup

The MAGLEV Ball Position Control Simulation VI shown in Figure 4.2 will be used to simulate the closed-loop ball
position control response with the PIV+FF ball position controller and PI coil current control used earlier in Section
3.1.3. On the actual device, the ball starts when its on the pedestal at a distance Tb . Similarly, in the simulation the
ball begins at Tb. To prevent a sudden jump, the position setpoint initially starts at Tb and gradually commands a
step about the operating air gap. The speed of the step is slowed down by a Rate Limiter block.

Figure 4.2: VI used to simulate ball position control response.

IMPORTANT: Before you can conduct these experiments, you need to make sure that the lab files are configured.
If they have not been configured already, then you need to go to Section 5 to configure the lab files first.

1. In MAGLEV.lvproj, open MAGLEV Ball Position Control Simulation.vi.


2. Enter the finalized current control PI gains in VI front panel used in Section 5.2 as kp_c and ki_c in the VI front
panel.
3. Enter the proportional, integral, velocity, and feed-forward control gains found in Section 4.2 in the kp_b, ki_b,
kv_b, and Kff_b control on the VI front panel.
4. To generate a step reference, go to the Ball Position Setpoint section and set the Signal Generator block
controls to the following:
• Amplitude = 1 mm

MAGLEV Workbook - Student Version 24


• Frequency = 0.2 Hz
Remark: After 2 seconds, an offset of -5 mm is applied to the initial 14 mm air gap reference. Thus at 2
seconds, the desired ball air gap position begins to go from 14 mm down to 9 mm (i.e., ball approaches
magnet face as air gap decreases). With the above amplitude and frequency settings, eventually we have a
square wave setpoint that goes between 8 and 10 mm at 0.25 Hz.
5. Run the VI. By default, the simulation runs for 10 seconds. The scopes should be displaying responses similar
to Figure 4.3. Note that in the Ball Position (m) and Coil Current (A) scopes, the blue trace is the setpoint (or
command) while the red trace is the simulation.

Figure 4.3: Simulated closed-loop ball position control response.

6. Attach a plot showing the Simulated Ball Position response, the current, and the input voltage.
7. Measure the steady-state error, the percent overshoot and the peak time of the simulated response. Does the
response satisfy the specifications given in Section 4.1.1? Keep in mind, due to the Rate Limiter the setpoint
is delayed 0.4 seconds. Take that into account. Hint: Use the graph cursors in the Measure tab to take
measurements.
8. If the simulated response did not satisfy the specifications, explain how you could modify the control system
in order for the response to be improved.

4.3.2 Ball Position Control Implementation

The MAGLEV Ball Position Control VI shown in Figure 4.4 is used to run the ball position control presented in Section
4.1.2 on the MAGLEV system. It contains the PI current control used previously in Section 3.3.2 and interfaces with
the electromagnet and sensors of the MAGLEV system.

Experimental Setup

The MAGLEV Ball Position Control VI shown in Figure 4.4 will be used to run the feed-forward and PIV ball position
control on the actual MAGLEV system.

IMPORTANT: Before you can conduct these experiments, you need to make sure that the lab files are configured
according to your setup. If they have not been configured already, then you need to go to Section 5 to configure the
lab files first.

MAGLEV Workbook - Student Version v 1.1


Figure 4.4: VI used to run FF+PIV ball position control on MAGLEV system.

Follow this procedure:

1. In MAGLEV.lvproj, open MAGLEV Ball Position Control.vi.


2. To generate a step reference, go to the Ball Position Setpoint section and set the Signal Generator block
controls to the following:
• Amplitude = 1 mm
• Frequency = 0.2 Hz

3. Enter the proportional, integral, velocity, and feed-forward control gains found in Section 4.2 in the kp_b, ki_b,
kv_b, and Kff_b control on the VI front panel.
4. Set the feed-forward gain adjustment control, FF Gain Adjustment, to 0.8.

5. Enter the finalized current control PI gains in VI front panel used in Section 5.2 as kp_c and ki_c in the VI front
panel.

6. Run the VI. As the air gap command goes from 14 mm to 9 mm, the ball should eventually rise from its pedestal
and stabilize to 9 mm. The scopes should be displaying responses similar to Figure 4.5.

7. Once the ball is stabilized, set the Amplitude (m) control to 1 mm. This will command a ± 1 mm square at 0.2
Hz about 9 mm.

8. Attach a plot showing the Implemented Ball Position response, the current, and the input voltage.
9. Measure the steady-state error, the percent overshoot and the peak time of the response. Does the response
satisfy the specifications given in Section 4.1.1? Take into account that the Rate Limiter delays the setpoint
by 0.4 seconds.

MAGLEV Workbook - Student Version 26


Figure 4.5: Ball position response when stabilizing to 9 mm air gap.

4.4 Results
Fill out Table 4.1 with your answers from your control lab results - both simulation and implementation.

Description Symbol Value Units


Pre Lab Questions
Ball Position Control Gains
Feed Forward Control Gain Kf f,b A/m
Proportional Control Gain kp,b A/m
Velocity Control Gain kv,b A-s/m
Integral Control Gain ki,b A/(m-s)
Ball Position Control Simulation
Steady-state error ess deg
Settling time ts s
Percent overshoot PO %
Ball Position Control Implementation
Steady-state error ess deg
Settling time ts s
Percent overshoot PO %

Table 4.1: Results

MAGLEV Workbook - Student Version v 1.1


5 SYSTEM REQUIREMENTS
Required Software

Make sure LabVIEW™ is installed with the following required add-ons:

1. LabVIEW™

2. NI-DAQmx
3. NI LabVIEW™ Control Design and Simulation Module

4. Quanser Rapid Control Prototyping Toolkitr

Note: Make sure the Quanser Rapid Control Prototyping (RCP) Toolkit is installed after LabVIEW. See the RCP
Toolkit Quick Start Guide for more information.

Required Hardware

• Data acquisition (DAQ) device that is compatible with Quanser Rapid Control Prototyping Toolkitr . This in-
cludes Quanser DAQ boards such as Q2-USB, Q8-USB, QPID, and QPIDe and some National Instruments
DAQ devices.

• Quanser Magnetic Levitation.


• Quanser VoltPAQ-X1 power amplifier, or equivalent.

Before Starting Lab

Before you begin this laboratory make sure:

• LabVIEW™ is installed on your PC.


• DAQ device has been successfully tested (e.g., using the test software in the Quick Start Guide).

• Magnetic Levitation and amplifier are connected to your DAQ board as described Reference [2].

MAGLEV Workbook - Student Version 28


5.1 Overview of Files

File Name Description


MAGLEV User Manual.pdf This manual describes the hardware of the MAGLEV sys-
tem and explains how to setup and wire the system for the
experiments.
MAGLEV Workbook (Student).pdf This laboratory guide contains pre-lab questions and lab
experiments demonstrating how to design and implement
controllers for on the MAGLEV plant using QUARCr .
MAGLEV.lvproj LabVIEW project that contains all the LabVIEW™ Virtual
Instrument (VI) files required for running the Quanser Mag-
netic Levitation labs.
MAGLEV Current Control Simulation.vi VI that simulates magnet coil current controller for the MA-
GLEV system.
MAGLEV Ball Position Control Simula- VI that simulates ball position controller for the MAGLEV
tion.vi system.
MAGLEV Current Control.vi VI that implements the PI current controller on the MA-
GLEV system using LabVIEW™ .
MAGLEV Ball Position Control.vi VI that implements the PIV ball position controller on the
MAGLEV system using LabVIEW™ .

Table 5.1: Files supplied with the MAGLEV

5.2 Setup for Coil Current Control Simulation


Follow these steps:

1. Load the LabVIEW™ software.


2. Open the LabVIEW Project MAGLEV.lvproj.

3. Open the LabVIEW VI called MAGLEV Current Control Simulation, shown in Figure 3.7.
4. Ensure the PI current control gains kp_c and ki_c on the VI front panel are set to the value found in the Pre-Lab
Questions in Section 3.2.

5.3 Setup for Implementing Coil Current Control


Before performing the in-lab exercises in Section 3.3.2, the MAGLEV Current Control VI and must be configured.

Follow these steps to get the system ready for this lab:

1. Setup the MAGLEV as detailed in the MAGLEV User Manual ([2]).

2. If using the VoltPAQ-X1, make sure the Gain switch is set to 3.


3. Place the metal ball on the MAGLEV pedestal.

4. Open MAGLEV.lvproj project as outlined in Section 5.2.


5. Open MAGLEV Current Control.vi shown in Figure 3.9.

6. As discussed in Section 5.2, set the PI gains according to the Pre-Lab Exercise values.

MAGLEV Workbook - Student Version v 1.1


7. Configure DAQ: Ensure the HIL Initialize block is configured for the DAQ device that is installed in your system.
To do this, go to the block diagram (CTRL-E) and double click on the HIL Initialize Express VI shown in Figure
5.1.

Figure 5.1: HIL Initialize Express VI

8. Under the Main tab, select the data acquisition device that is installed on your system in the Board type section.
For example, in Figure 5.2 the Q2-USB is chosen.

Figure 5.2: Select DAQ board that will be used to control system

5.4 Setup for Ball Position Control Simulation


Follow these steps:

1. Load LabVIEW™ and open MAGLEV.lvproj.


2. Open the MAGLEV Ball Position Simulation VI, shown in Figure 4.2.
3. Make sure the control gains for the Ball Position Control are set the values found in Section 4.2.
4. Set the PI current control gains, kp_c and ki_c on the VI front panel, to the re-tuned established in Section
3.3.2.

5.5 Setup for Implementing Ball Position Control


Follow these steps to get the system ready for this lab:

1. Go through step 1-4 in Section 5.3 to setup the MAGLEV system and open MAGLEV.lvproj.
2. Open MAGLEV Ball Position Control.vi shown in Figure 4.4.
3. Make sure the PIV+FF ball position control parameters and the PI current control gains are set as dictated in
Section 5.4.

MAGLEV Workbook - Student Version 30


4. Configure DAQ: Ensure the HIL Initialize Express VI is configured as explained in Section 5.3.

MAGLEV Workbook - Student Version v 1.1


6 LAB REPORT
This laboratory contains two groups of experiments, namely,

1. Coil current control, and


2. Ball position control.

For each experiment, follow the outline corresponding to that experiment to build the content of your report. Also,
in Section 6.3 you can find some basic tips for the format of your report.

6.1 Template for Coil Current Control Report


I. PROCEDURE

1. Simulation

• Briefly describe the main goal of the simulation.


• Briefly describe the simulation procedure in Step 7 in Section 3.3.1.
• Briefly describe your proposed solution in Step 9 in Section 3.3.1.
• Briefly describe the changes to the control in Step 10 in Section 3.3.1.
2. Implementation

• Briefly describe the main goal of this experiment.


• Briefly describe the experimental procedure in Step 5 in Section 3.3.2.

II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.

1. Response plot from step 7 in Section 3.3.1, Current control simulation.


2. Controller modifications in step 10 in Section 3.3.1.

3. Response plot from step 11 in Section 3.3.1 using the modified PI control.
4. Response plot from step 5 in Section 3.3.2, Current control implementation.

5. Response plot from step 8 in Section 3.3.2, Tuned current control implementation.
6. Provide applicable data collected in this laboratory (from Table 3.1).

III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:

1. Peak time, percent overshoot, steady-state error, and input voltage in Step 8 in Section 3.3.1.
2. Effect of increasing current setpoint step to 2 A in Step 9 in Section 3.3.1.

3. Peak time, percent overshoot, steady-state error, and input voltage in Step 12 in Section 3.3.1.
4. Peak time, percent overshoot, steady-state error, and input voltage in Step 6 in Section 3.3.2.

MAGLEV Workbook - Student Version 32


IV. CONCLUSIONS
Interpret your results to arrive at logical conclusions for the following:

1. Whether the controller meets the specifications in Step 8 in Section 3.3.1, Current controller simulation.
2. Whether the controller meets the specifications in Step 12 in Section 3.3.1, Re-designed current controller
simulation.
3. Whether the controller meets the specifications in Step 6 in Section 3.3.2, Current controller implementation.

4. Whether the controller meets the specifications in Step 9 in Section 3.3.2, Tuned current controller implemen-
tation.

6.2 Template for Ball Position Control Report


I. PROCEDURE

1. Simulation
• Briefly describe the main goal of the simulation.
• Briefly describe the simulation procedure in Step 6 in Section 4.3.1.
• Briefly describe the control modification procedure in Step 8 in Section 4.3.1.

2. Implementation
• Briefly describe the main goal of this experiment.
• Briefly describe the experimental procedure in Step 8 in Section 4.3.2.

II. RESULTS
Do not interpret or analyze the data in this section. Just provide the results.

1. Response plot from step 6 in Section 4.3.1, Ball position control simulation.

2. Response plot from step 8 in Section 4.3.2, Ball position control implementation.

3. Provide applicable data collected in this laboratory (from Table 4.1).

III. ANALYSIS
Provide details of your calculations (methods used) for analysis for each of the following:

1. Peak time, percent overshoot, steady-state error, and input voltage in Step 7 in Section 4.3.1.
2. Peak time, percent overshoot, steady-state error, and input voltage in Step 9 in Section 4.3.2.

IV. CONCLUSIONS
Interpret your results to arrive at logical conclusions for the following:

1. Whether the controller meets the specifications in Step 9 in Section 4.3.2, Ball position controller implementa-
tion.

MAGLEV Workbook - Student Version v 1.1


6.3 Tips for Report Format
PROFESSIONAL APPEARANCE

• Has cover page with all necessary details (title, course, student name(s), etc.)

• Each of the required sections is completed (Procedure, Results, Analysis and Conclusions).
• Typed.

• All grammar/spelling correct.


• Report layout is neat.

• Does not exceed specified maximum page limit, if any.


• Pages are numbered.

• Equations are consecutively numbered.


• Figures are numbered, axes have labels, each figure has a descriptive caption.

• Tables are numbered, they include labels, each table has a descriptive caption.

• Data are presented in a useful format (graphs, numerical, table, charts, diagrams).
• No hand drawn sketches/diagrams.

• References are cited using correct format.

MAGLEV Workbook - Student Version 34


REFERENCES
[1] Quanser Inc. Magnetic Levitation User Manual, 2012.

MAGLEV Workbook - Student Version v 1.1


Process control plants for teaching and research

Magnetic Levitation Coupled Tanks

These plants are ideal for intermediate level teaching. They are also suitable for research
relating to traditional or modern control applications of process control. For more
information please contact [email protected]
©2012 Quanser Inc. All rights reserved.

[email protected] +1-905-940-3575 QUANSER.COM


Solutions for teaching and research. Made in Canada.

You might also like