magnetic levitation system - mechatronics2020.net · magnetic levitation system k. craig 5 •...
TRANSCRIPT
Magnetic Levitation System K. Craig 1
Magnetic Levitation System
Electromagnet
Infrared LED
Phototransistor
Levitated Ball
Magnetic Levitation System K. Craig 2
Electromagnet
Infrared LED
Phototransistor
Vsensor ≈ 2.5 V
At Equilibrium
Levitated Ball
m = 0.008 kg
r = 0.0062 m
Equilibrium Conditions
gap0 = 0.0053 m
i0 = 0.31 A
gap
i
Magnetic Levitation System
Emitter
Detector
Magnetic Levitation System K. Craig 3
Emitter Circuit
Detector
Circuit
Power Supply
Capacitors
to Ground
Buffer Op-Amp
Buffer Op-Amp
Power MOSFET
with Diode
To Electromagnet
Analog Sensor PWM Gnd
Magnetic Levitation System K. Craig 4
Microcontroller Board
Analog Sensor
Gnd PWM
Magnetic Levitation System K. Craig 5
• Electromagnet Actuator
– Current flowing through the coil windings of the
electromagnet generates a magnetic field.
– The ferromagnetic core of the electromagnet provides
a low-reluctance path in the which the magnetic field
is concentrated.
– The magnetic field induces an attractive force on the
ferromagnetic ball.
Electromagnetic ForceProportional to the square
of the currentand
inversely proportional to the square of the gap
distance
Magnetic Levitation System K. Craig 6
– The electromagnet uses a ¼ - inch steel bolt as the
core with approximately 3000 turns of 26-gauge
magnet wire wound around it.
– The electromagnet at room temperature has a
resistance R = 34 Ω and an inductance L = 154 mH.
Magnetic Levitation System K. Craig 7
• Ball-Position Sensor
– The sensor consists of an infrared diode (emitter) and
a phototransistor (detector) which are placed facing
each other across the gap where the ball is levitated.
– Infrared light is emitted from the diode and sensed at
the base of the phototransistor which then allows a
proportional amount of current to flow from the
transistor collector to the transistor emitter.
– When the path between the emitter and detector is
completely blocked, no current flows.
– When no object is placed between the emitter and
detector, a maximum amount of current flows.
– The current flowing through the transistor is converted
to a voltage potential across a resistor.
Magnetic Levitation System K. Craig 8
– The voltage across the resistor, Vsensor, is sent through
a unity-gain, follower op-amp to buffer the signal and
avoid any circuit loading effects.
– Vsensor is proportional to the vertical position of the ball
with respect to its operating point; this is compared to
the voltage corresponding to the desired ball position.
– The emitter potentiometer allows for changes in the
current flowing through the infrared LED which affects
the light intensity, beam width, and sensor gain.
– The transistor potentiometer adjusts the phototransistor
current-to-voltage conversion sensitivity and allows
adjustment of the sensor’s voltage range; a 0 - 5 volt
range is required as an analog input to the
microcontroller.
Magnetic Levitation System K. Craig 9
Ball-Position SensorLED Blocked: esensor = 0 V
LED Unblocked: esensor = 5 V
Equilibrium Position: esensor ≈ 2.5 V
Ksensor ≈ 1.6 V/mm Range ± 1mm
Emitter Current = 10 mADetector Voltage = 0-5 V
Magnetic Levitation System K. Craig 10
Magnetic Levitation System
Block DiagramFeedback Control System
to Levitate Steel Ball
about an Equilibrium Position
Corresponding to Equilibrium Gap
gap0 and Equilibrium Current i0
From Equilibrium:
As i ↑, gap ↓, & Vsensor ↓
As i ↓, gap ↑, & Vsensor ↑
Magnetic Levitation System K. Craig 11
Magnetic Levitation System Derivation
2
2
if gap,i C
gap
gap
m m
m
2
m m m core gap object return path
m
core object return path
22 2gap 0 gap
mgap0 gap m 0 gap gap
0 gap
0 gap2
field
NiNeglect
N iN N L i
Define: constant
x A NN NL
xA A x
A
A1 1W L x i
2 2
2
2
0 gap gap
2 2
2 2 2
e 0 gap 1
0 gap gap 2 gap
Ni
A x
1 dL(x) 1 1 if i A N i K
2 dx 2 A x K x
Magnetic Levitation System K. Craig 12
At Static Equilibrium:
Equation of Motion:
2
2
img C
x
Linearization:
Magnetic Levitation SystemControl System Design
Measure the gap from theelectromagnet with
x positive ↓
2
3 2
2 i 2 i ˆˆ ˆmx C x C ix x
2 2
2 3 2
i 2 i 2 i ˆˆ ˆmx mg C C x C ix x x
2 2 2
2 2 3 2
i i 2 i 2 i ˆˆC C C x C ix x x x
2
2
imx mg C
x
Magnetic Levitation System K. Craig 13
Use of Experimental Testing in Multivariable Linearization
0 00 0
m
m 0 0 0 0
i ,yi ,y
f f (i, y)
f ff f i , y y y i i
y i
Magnetic Levitation System K. Craig 14
2
2
img C
x
m 0.008
g 9.81
x 0.0053
i 0.31
C 2.29E 5
ˆx 3695x 63iˆ ˆ 2
x 63ˆ
ˆ s 3695i
2
3 2
2 i 2 i ˆˆ ˆmx C x C ix x
SI Units
Magnetic Levitation System K. Craig 15
Basic Component
Equations
(Constitutive Equations)
Lin out
out R
die e L
dt
e i R
KVLL
in out
L R out R
die L e 0
dt
i i i i 0
outout in
out out in
out in
out
in in
deLe e
R dt
LDe e e
R
LD 1 e e
R
1e 1 i R
L Le eD 1 D 1
R R
Reineout
iL
Iout = 0L
iR
KCL
outin out
ede L e 0
dt R
Electromagnet Model L = 154 mH R = 34 Ω
Magnetic Levitation System K. Craig 16
Magnetic Levitation System Control Design
Design a Feedback Controllerto Stabilize the Magnetic Levitation Plant
with Adequate Stability Margins
2
0.029 63
0.0045s 1 s 3695
voltage position
Note: Controller gain will need to be negative
Magnetic Levitation System K. Craig 17
101
102
103
104
-270
-225
-180
P.M.: Inf
Freq: NaN
Frequency (rad/s)
Phase (
deg)
-200
-180
-160
-140
-120
-100
-80
-60
G.M.: 66.1 dB
Freq: 0 rad/s
Unstable loop
Open-Loop Bode Editor for Open Loop 1 (OL1)
Magnitu
de (
dB
)
-800 -600 -400 -200 0 200 400-600
-400
-200
0
200
400
600
Root Locus Editor for Open Loop 1 (OL1)
Real Axis
Imag A
xis
Uncompensated Electromagnet + Ball System
2
in
x 0.029 63ˆ
e 0.0045s 1 s 3695
Note: Negative Controller
Gain Is Required
Magnetic Levitation System K. Craig 18
z = -50
p = -800
K = 52664
c
s 50G (s) 52664
s 800
Sample Control Design
Magnetic Levitation System K. Craig 19
• Nyquist Stability Criterion
– Key Fact: The Bode magnitude response corresponding to neutral
stability passes through 1 (0 dB) at the same frequency at which the
phase passes through180°.
– The Nyquist Stability Criterion uses the open-loop transfer function,
i.e., (B/E)(s), to determine the number, not the numerical values, of
the unstable roots of the closed-loop system characteristic equation.
– If some components are modeled experimentally using frequency
response measurements, these measurements can be used directly
in the Nyquist criterion.
– The Nyquist Stability Criterion handles dead times without
approximation.
– In addition to answering the question of absolute stability, Nyquist
also gives useful results on relative stability, i.e., gain margin and
phase margin.
– The Nyquist Stability Criterion handles stability analysis of complex
systems with one or more resonances, with multiple magnitude-
curve crossings of 1.0, and with multiple phase-curve crossings of
180°.
Magnetic Levitation System K. Craig 20
• Procedure for Plotting the Nyquist Plot
1. Make a polar plot of (B/E)(i) for - < . The magnitude
will be small at high frequencies for any physical system.
The Nyquist plot will always be symmetrical with respect to
the real axis.
2. If (B/E)(i) has no terms (i)k, i.e., integrators, as multiplying
factors in its denominator, the plot of (B/E)(i) for - < <
results in a closed curve. If (B/E)(i) has (i)k as a
multiplying factor in its denominator, the plots for + and -
will go off the paper as 0 and we will not get a single
closed curve. The rule for closing such plots says to connect
the "tail" of the curve at 0- to the tail at 0+ by
drawing k clockwise semicircles of "infinite" radius.
Application of this rule will always result in a single closed
curve so that one can start at the = - point and trace
completely around the curve toward = 0- and = 0+ and
finally to = +, which will always be the same point (the
origin) at which we started with = -.
Magnetic Levitation System K. Craig 21
3. We must next find the number Np of poles of B/E(s) that are
in the right half of the complex plane. This will almost
always be zero since these poles are the roots of the
characteristic equation of the open-loop system and open-
loop systems are rarely unstable.
4. We now return to our plot (B/E)(i), which has already been
reflected and closed in earlier steps. Draw a vector whose
tail is bound to the -1 point and whose head lies at the origin,
where = -. Now let the head of this vector trace
completely around the closed curve in the direction from =
- to 0- to 0+ to +, returning to the starting point. Keep
careful track of the total number of net rotations of this test
vector about the -1 point, calling this Np-z and making it
positive for counter-clockwise rotations and negative for
clockwise rotations.
5. In this final step we subtract Np-z from Np. This number will
always be zero or a positive integer and will be equal to the
number of unstable roots for the closed-loop.
Magnetic Levitation System K. Craig 22
• A system must have adequate
stability margins.
• Both a good gain margin and a
good phase margin are needed.
• Useful lower bounds: GM > 2.5,
PM > 30
Vector Margin is the distance to the -1
point from the closest approach of the
Nyquist plot. This is a single-margin
parameter and it removes all
ambiguities in assessing stability that
come from using GM and PM in
combination.
Magnetic Levitation System K. Craig 23
ω = ±∞
Np =1Np-z = 1
Np – Np-z = 0
Magnetic Levitation System K. Craig 24
ω = 0 rad/sGM = -4.23 dB
= 0.615
ω = 356 rad/sGM = 15.9 dB
= 6.237
ω = 86 rad/sPM = 32.5°
Magnetic Levitation System K. Craig 25
closed-loopBode plot
Magnetic Levitation System K. Craig 26
z = -50
p = -800
K = 3.2792E5
Magnetic Levitation System K. Craig 27
Neutral Stability
Magnetic Levitation System K. Craig 28
z = -50
p = -800
K = 1.0443E6
Magnetic Levitation System K. Craig 29
Np =1Np-z = -1
Np – Np-z = 2
ω = ±∞
Magnetic Levitation System K. Craig 30
z = -50
p = -800
K = 32323
Magnetic Levitation System K. Craig 31
Neutral Stability
Magnetic Levitation System K. Craig 32
z = -50
p = -800
K = 20095
Magnetic Levitation System K. Craig 33
Np =1Np-z = 0
Np – Np-z = 1
ω = ±∞
Magnetic Levitation System K. Craig 34
101
102
103
104
-270
-225
-180
P.M.: Inf
Freq: NaN
Frequency (rad/s)
Phase (
deg)
-200
-180
-160
-140
-120
-100
-80
-60
G.M.: 66.1 dB
Freq: 0 rad/s
Unstable loop
Open-Loop Bode Editor for Open Loop 1 (OL1)
Magnitu
de (
dB
)
-800 -600 -400 -200 0 200 400-600
-400
-200
0
200
400
600
Root Locus Editor for Open Loop 1 (OL1)
Real Axis
Imag A
xis
Uncompensated Electromagnet + Ball System
2
in
x 0.029 63ˆ
e 0.0045s 1 s 3695
Note: Negative Controller
Gain Is Required
Magnetic Levitation System K. Craig 35
100
101
102
103
104
105
-270
-225
-180
-135
P.M.: 25.3 deg
Freq: 201 rad/s
Frequency (rad/s)
Phase (
deg)
-140
-120
-100
-80
-60
-40
-20
0
20
G.M.: -7.78 dB
Freq: 0 rad/s
Stable loop
Open-Loop Bode Editor for Open Loop 1 (OL1)
Magnitu
de (
dB
)
-300 -250 -200 -150 -100 -50 0 50 100
-500
-400
-300
-200
-100
0
100
200
300
400
500
Root Locus Editor for Open Loop 1 (OL1)
Real Axis
Imag A
xis
c P D
s 30 NG (s) 132020 K K s
s 800 s N
Closed-Loop Poles: -888, -20.4, -56.9 ± 222i
KP = 4951 KD = 159 N = 800
Control
Design
PD
Magnetic Levitation System K. Craig 36
100
101
102
103
104
105
-270
-225
-180
-135P.M.: 30.1 deg
Freq: 163 rad/s
Frequency (rad/s)
Phase (
deg)
-150
-100
-50
0
50
G.M.: -6.55 dB
Freq: 21.7 rad/s
Stable loop
Open-Loop Bode Editor for Open Loop 1 (OL1)
Magnitu
de (
dB
)
-250 -200 -150 -100 -50 0 50
-200
-150
-100
-50
0
50
100
150
200
Root Locus Editor for Open Loop 1 (OL1)
Real Axis
Imag A
xis
Closed-Loop Poles: -959, -67 ± 185i, -12.8 ± 17.2i
2
Ic P D
s 38.28s 370.42 K NG (s) 113200 K K s
s s 896 s s N
KP = 4784 KI = 46798 KD = 121 N = 896
Control
Design
PID
Magnetic Levitation System K. Craig 37
C = 2.29E-5m = 0.008g = 9.81R = 34.1
L = 154.2E-3x0 = 0.0053
i0 = 0.31e0 = 10.57
Nonlinear System
e0
V Bias
StepSaturation
0 to 15 volts
Product
u2
MathFunction2
1
u
MathFunction1
u2
MathFunction
1/s
Integrator2
1/s
Integrator1
1/s
Integrator1/R
Gain2
R/L
Gain1 C/m
Gain
i
Current
-113200
ControllerGain
M
Control Effort
s +38.28s+370.422
s +896s2
Control
g
Constantx
Ball Position
Linear System
StepSaturation
-10.57 to 4.43 volts
x_hat
PerturbationPosition
-63
s +-36952
Magnet + Ball
0.0045s+1
0.029
LR Circuit
-113200
ControllerGain
s +38.28s+370.422
s +896s2
Control
i_hat
PerturbationCurrent
M_hat
PerturbationControl Effort
Comparison: Linear Plant vs. Nonlinear Plant
Magnetic Levitation System K. Craig 38
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
5.4
5.6
5.8
6
6.2
6.4
6.6
6.8
7
7.2x 10
-3
time (sec)
Positio
n x
(m
)
Nonlinear & Linear Plant Response Comparison: 1 mm Step Command
Nonlinear Pant
Linear Plant
PD Control
Magnetic Levitation System K. Craig 39
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.40.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
time (sec)
Curr
ent
i (A
)
Nonlinear & Linear Plant Response Comparison: 1 mm Step Command
Nonlinear Plant
Linear Plant
PD Control
Magnetic Levitation System K. Craig 40
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.40
5
10
15
time (sec)
Contr
ol E
ffort
M (
volts)
Nonlinear & Linear Plant Response Comparison: 1 mm Step Command
Nonlinear Plant
Linear Plant
PD Control
Magnetic Levitation System K. Craig 41
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
5.4
5.6
5.8
6
6.2
6.4
6.6
6.8
7
7.2x 10
-3
time (sec)
Positio
n x
(m
)
Nonlinear & Linear Plant Response Comparison: 1 mm Step Command
Nonlinear Plant
Linear Plant
PID Control
Magnetic Levitation System K. Craig 42
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.40.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
time (sec)
Curr
ent
i (A
)
Nonlinear & Linear Plant Response Comparison: 1 mm Step Command
Nonlinear Plant
Linear Plant
PID Control
Magnetic Levitation System K. Craig 43
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.40
5
10
15
time (sec)
Contr
ol E
ffort
M (
volts)
Nonlinear & Linear Plant Response Comparison: 1 mm Step Command
Nonlinear Plant
Linear Plant
PID Control
Magnetic Levitation System K. Craig 44
Complete System: Electromagnet + Ball + PWM Voltage ControlC = 2.29E-5m = 0.008g = 9.81R = 34.1
L = 154.2E-3x0 = 0.0053
i0 = 0.31e0 = 10.57
Identical Controller - PID Format
e0
V BiasPWM
>=
SwitchTransistorMOSFET
0
Supply VoltageSwitch Off
15
Supply VoltageSwitch ON
Step1 mmstep
command
5
Set amplitude
to 5V
Saturation0 to 15 volts
Saturation0 to 1 amp
>
RelationalOperatorReference
Signal 4000Hz
Product
PID(s)
PID Controller
u2
MathFunction2
1
u
MathFunction1
u2
MathFunction
1/s
Integrator2
1/s
Integrator1
1/s
Integrator1/R
Gain2
R/L
Gain1 C/m
Gain
i
Current
1
Convert Boolean
into Double
-113200
ControllerGain2
1/3
-1
ControllerGain
s +38.3s+370.42
s +896s2
Controller
M
ControlEffort
g
Constantx
Ball Position
Magnetic Levitation System K. Craig 45
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
5.4
5.6
5.8
6
6.2
6.4
6.6
6.8
7
7.2x 10
-3
time (sec)
Positio
n x
(m
)
Nonlinear Plant & PWM Voltage Control: 1 mm Step Command
PD Control
Magnetic Levitation System K. Craig 46
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.40.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
time (sec)
Curr
ent
i (A
)
Nonlinear Plant & PWM Voltage Control: 1 mm Step Command
PD Control
Magnetic Levitation System K. Craig 47
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.40
5
10
15
time (sec)
Contr
ol E
ffort
M (
volts)
Nonlinear Plant & PWM Voltage Control: 1 mm Step Command
PD Control
Magnetic Levitation System K. Craig 48
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
5.4
5.6
5.8
6
6.2
6.4
6.6
6.8
7
7.2x 10
-3
time (sec)
Positio
n x
(m
)
Nonlinear Plant & PWM Voltage Control 1 mm Step Command
PID Control
Magnetic Levitation System K. Craig 49
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.40.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
time (sec)
Curr
ent
i (A
)
Nonlinear Plant & PWM Voltage Control 1 mm Step Command
PID Control
Magnetic Levitation System K. Craig 50
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.40
5
10
15
time (sec)
Contr
ol E
ffort
M (
volts)
Nonlinear Plant & PWM Voltage Control 1 mm Step Command
PID Control
Magnetic Levitation System K. Craig 51
Emitter Circuit
Detector
Circuit
Power Supply
Capacitors
to Ground
Buffer Op-Amp
Buffer Op-Amp
Power MOSFET
with Diode
To Electromagnet
Analog Sensor PWM Gnd
Magnetic Levitation System K. Craig 52
Microcontroller Board
Analog Sensor
Gnd PWM
Magnetic Levitation System K. Craig 53
Arduino Microcontroller Implementation
With Simulink Autocode Generator
Arduino Discrete PiD ControlMagnetic Levitation System
PWMTs = sample period = 0.001
Operating point is 0.0053 m gap and corresponds to sensor reading of 2.5 VSensor gain is 1.6V/mm around operating point + or - 1 mm
volts = 1600*m - 5.98m = (volts + 5.98)/1600
0.0053 m gap
Saturation0 to 15 volts
PID(s)
PID Controller
1/1600
Gain1
1/1600
Gain
Pin 10
Digital Output
-1
ControllerGain2
1/3
5.98
Constant
2.5
CommandedPosition
Volts
10.57
Bias Voltage
Pin 0
Analog Input
255/5
8-Bit D/A
5/1023
10-Bit A/D
Magnetic Levitation System K. Craig 54
Closed-Loop System
Block Diagram
LM 258
Low-Power
Dual Op-Amp
Unity-Gain Buffer Op-Amp
ein = eout and in phase
Magnetic Levitation System K. Craig 55
Power MOSFET TO-220
N-Channel, 60 V, 0.07 Ω, 16 A
Magnetic Levitation System K. Craig 56
eoutein
R2
R1 +V
-V-
+
RS
RMLM
Electromagnet
Voltage-to-Current Converter
2M in
1 2 S
R 1i e
R R R
OPA544High-Voltage, High Current
Op Amp
Assume Ideal Op-Amp
Behavior
e e R1 = 49KΩ, R2 = 1KΩ, RS = 0.1Ω
Alternative: Analog Power Stage
Magnetic Levitation System K. Craig 57
Non-Ideal
Op-Amp Behavior
o
Ae e e
s 1
e1
out 1 M M
1 S
1out 1 M M
S
M M Sout 1
S
e e L s R i
e R i
ee e L s R
R
L s R Re e
R
eoutein
R2
R1 +V
-V-
+
RS
RMLM
Electromagnet
+
-
Saturation
Σ
2in
1 2
Re
R R
e1
i
S
1
R
A
s 1
S
M M S
R
L s R R
eout e1