inverted pendnulm

advertisement
1
Outline
1.
2.
3.
4.
5.
6.
Introduction
Modeling
Simulation
Implementation
Demo
Conclusion
2
Outline
1.
2.
3.
4.
5.
6.
Introduction
Modeling
Simulation
Implementation
Demo
Conclusion
3
Introduction
ө
m2
l2
• Rotating arm and inverted
pendulum.
• Rotating arm is actuated by a
DC motor.
• The angular disturbance will be
sensed by the potentiometer.
X
X
Y
l1
length from the center of rotating arm to the pendulum.
l2
length of the inverted pendulum.
α
m1 mass of the rotating arm.
l1
m2 mass of the inverted pendulum.
α
The angular displacement of the rotating arm rotated.
θ
The angular displacement of the inverted pendulum.
v
linear velocity of the mass center of the inverted
pendulum.
r c
Y
Z
Potentiometer
m1
Motor
4
Introduction
• The system is controlled by a PID control circuit.
• Two equilibrium points existed.
• Use a cut-off device to protect the system.
Disturbance
Controller
Driver
PID
controller
Power
amplifier
Voltage
signal
Potentiometer
Plant
DC
motor
Inverted
pendulum
Angle
Sensor
5
Outline
1. Introduction
2. Modeling
Find the transfer function of input voltage and the angle of inversed
pendulum.
–
–
–
–
3.
4.
5.
6.
Equation of motion.
Linearization
Laplace transform
Transfer function
Simulationment
Implementation
Demo
Conclusion
6
Modeling -Equation of motion
• Step 1 : Find the equation of motion by
Lagrange equation
1 2 1
T  I   m2
2
2
v
r
c
2


1 .2
2
2
  I x   I y (cos   )  I z (sin   ) 
2

1
m2 gl2  cos   1
2
L  T V

1 
1
r c
v  (  l1 sin    l2 sin  cos    l2 cos  sin  )i
2
2

1 
1
1
 ( l1 cos    l2 sin  sin    l2 cos  cos  ) j  (   l2 sin  ) k
2
2
2
V
7
Modeling -Equation of motion
d  L  L
0


dt    
1 2 
1
1

1

2
2
I

l
m


l
l
m
cos


m
l

I

I
cos

sin


m2l2 g sin   0.......  a 
2
2
1 2 2
2 2
y
z 
 x

4
2
2


4

d  L  L



dt    
1
1


2
2
2
2
2
I

m
l

m
l
sin


I
cos


I
sin



l1l2 m2 cos  
21
2 2
y
z


4
2


1
1


l1l2 m2 sin  2  2  I z  m2l2 2  I y  cos  sin    .......  b 
2
4


8
Modeling -Linearization
• Step 2 : Linearization
– To do the linearization, we have to
find the equilibrium points first.
– Find the position where the extreme
value of the potential energy exist.
1
V  m2 gl2  cos   1
2
dV 1
 m2 gl2 sin   0
d 2
  0 or 180
Θ=0.0°
Θ=180.0°
9
Modeling -Linearization
• In this case, we set the equilibrium point at θ=0°
• Expand the nonlinear terms in Taylor series.
1 2 1 4
1 3
1 5
sin







...


;
cos


1



 1
•
2
24
6
120
1 2 
1
1

1

2
2
I

l
m


l
l
m
cos



m
l

I

I
cos

sin


m2l2 g sin   0......(a)
2
2
1 2 2
2 2
y
z 
 x

4
2
4
2




1 2 
1
1

I

l
m


l
l
m
1

m2l2 g  0......(a*)
2
2
1 2 2
 x
4
2
2


1
1
1


2
2
2
2
2
2
 I  m2l1  m2l2 sin   I y cos   I z sin     l1l2 m2 cos   l1l2 m2 sin 
4
2
2


1


2  I z  m2l2 2  I y  cos  sin    .......  b 
4


1
I  m2l12   I y 1   l1l2 m21   .......  b*
2


10
System modeling -Linearization
• If the angle of
disturbance is 5°,
the max. error
between linear and
nonlinear model is
0.046°, less then
1%.
11
System modeling -Laplace transform
• Step 3 : Laplace transform of the motion
equations
1 2 
1
1

 I x  l2 m2    l1l2 m2 - m2l2 g  0......(a*)
4
2
2


1
1
1


L

  I x  l2 2 m2  s 2   l1l2 m2 s 2 A - m2l2 g   0......(1)
4
2
2




1
I  m l  I y   l1l2 m2   ......(b*)
2
1
L

 I  m2l12  I y s 2 A  l1l2 m2 s 2   ......(2)
2
2
21


12
System modeling -Transfer function
• Step 4 : Find the transfer function of a DC
motor
• According to Kirchhoff’s voltage law (KVL)
vT  eA  iA RA

vT  K 
RA
K
RA

VT  K s 
.....(3)
Equivalent circuit of a DC motor
K
Where vT is the voltage of coil
eA  K is the induced voltage of the motor
  KiA is the torque generate by motor
L
13
System modeling -Transfer function
• Step 5 : Transfer function of the system
1 2  2
1
1

2
 I x  l2 m2  s   l1l2 m2 s  - m2l2 g   0......(1)
4
2
2


1
2
2
2
I

m
l

I
s


l
l
m
s
 21 y
1 2 2   ......(2)
2
RA
VT  K s  
.....(3)
K
14
Modeling -Transfer function
• Set the values we need
Symbol Value
l1
0.10
l2
0.32
Unit
• Assume the values we
need but we don’t know
Symbol Value
m
RA
1
m
K
0.03
m1
0.02841
Kg
m2
0.046
Kg
g
I
IX
9.81
m/s2
7.6707e-5
Kgm2
3.925e-4
Kgm2
IY
3.925e-4
Kgm2
Unit
Ω
Ref. : Stephen J. Chapman “Electric Machinery Fundamentals” Chap. 9
McGraw. Hill
15
Modeling -Transfer function
• Transfer function.

4.71s -216.6

4
3
2
V 0.0918s  0.1413s  6.7088s  6.49s
2

-2.208s

4
3
2
V 0.0918s  0.1413s  6.7088s  6.49s
2
16
Modeling -Transfer function
• Unit step command test
Command
Controller
actuator
PID
controller
Power
amplifier
Voltage
signal
Potentiometer
Plant
DC
motor
Inverted
pendulum
Angle
Sensor
17
Modeling -Transfer function
• Command unit step and disturbance is zero to
check transfer function.
18
Modeling –Routh-Hurwitz Stability
• Using Routh-Hurwitz stability to find the stable
range of the gain of PID or PD controller.
( s)  0.0718s 3  (0.1413  20208 D) s 2  (2.208 P  6.7088) s  (2.208 I  6.49)
s 3 0.0918
2.208 P  6.7088
s 2 0.1413  20208D
2.208I  6.49
1
s
(0.1413  2.208D)  (2.208P  6.7088)  0.0918  (2.208I  6.49)
0.0918
s 0 2.208I  6.49
P  3.038
I  2.93
D  0.06
0.3119 P  4.875PD  14.813D  2.026 I  0.482
19
Modeling -Reference
• S. Awtar, N. king, T. Allen, I. Bang, M, Hagan, D.Skidmore, K. Craig,
“Inverted pendulum systems: rotary and arm-driven- a mechatronic
system design case study.” Mechatronic 12 (2002)
• Y. Yavin, “Control of a Rotary Inverted Pendulum.” Applied Mathematics
Letters 12 (1999)
20
Outline
1. Introduction
2. Modeling
3. Simulation
–
–
–
–
Open loop
PD controller
PI controller
PID controller
4. Implementation
5. Demo
6. Conclusion
21
Simulation
• Use SimMechanics to
build a nonlinear
system model
22
Simulation
• Use Simulink to build
a nonlinear system
model
23
Simulation
• Use Simulink to build
a linear system model
24
。Simulation
–open loop (angular V)
25
Simulation -PD controller
P controller ×6
10K
Inverter
I controller ×0
×20
10K
10K
Signal input
D controller ×22
P  6  20  120
I 0
D  22  20  440
26
Simulation -PD controller
27
Simulation
-PD controller
• Response simulation.
(PD controller)
• Absolute error
between the
simulation of
SimMechanics and
Simulink.
28
Simulation -PI controller
P controller ×6
10K
Inverter
I controller ×2.5
×20
10K
10K
Signal input
D controller ×0
P  6  20  120
I  2.5  20  50
D0
29
Simulation
-PI controller
30
Simulation -PI controller
• Response simulation.
(PI controller)
• Absolute error
between the
simulation of
SimMechanics and
Simulink.
31
Simulation
-PID controller
P controller ×10
10K
Inverter
I controller ×1.5
×15
10K
10K
Signal input
D controller ×11
P  10  15  150
I  1.5 15  22.5
D  1115  165
32
Simulation
-PID controller
33
Simulation
-PID controller
• Response simulation.
(PID controller)
• Absolute error
between the
simulation of
SimMechanics and
Simulink.
34
Outline
•
•
•
•
System introduction
System modeling
Simulation
Implementation
– Inversed pendulum
– Control circuit
• Demo
• Conclusion
35
Implementation
• System block diagram
Disturbance
Controller
actuator
PID
controller
Power
amplifier
Voltage
signal
Potentiometer
Plant
DC
motor
Inverted
pendulum
Angle
Sensor
36
Implementation -Inversed pendulum
• The length and mass
of pendulum:
32 cm and 28.41g
• The length and mass
of rotating arm:
10 cm and 46 g
• Gear ratio: 5
37
Implementation -Control circuit
• Circuit block diagram
Power supply
NO. 1
Common
COM
Angle
Cut-off
Circuit
Potentiometer
PID
Controller
Power supply
NO. 2
Power
Amplifier
DC
motor
38
Implementation -Control circuit
• Circuit board
Power
supply I
Cut-off
circuit
Limit
switch
Signal light
On/Off
Motor
Power
amplifier
Power
supply II
PID
controller
Sensor
39
Implementation -Potentiometer
• Use a variable resistor as a potentiometer.
+15V
Inverted
pendulum
Output
voltage
Potentiometer
-15V
40
Implementation - Potentiometer
• How does it work?
+15V
+15V
+15V
Output
voltage
0V
Output
voltage
15k ohm
15k ohm
Output
voltage
1V
14k ohm
16k ohm
-15V
-15V
-15V
41
Implementation -PID controller
• Use 17741 operational amplifier
• Modes switch
• Elements
shiftable
PID
controller
42
Implementation -PID controller
3.2kΩ
10ηF
500Ω
500Ω
I
Input
500Ω
Inverter
500Ω
500Ω
500Ω
500Ω
P
10ηF
Output
200kΩ
500Ω
500Ω
D
43
Implementation -Cut-off circuit, signal light
500 ohm
resistances
7404 NOT
Resistance
with signal
light
7408 AND
NPN
transistor
Relay
5V
2 Form C Contact
7408
7404
44
Implementation
-Cut-off circuit, signal light
500Ω
Circuit for LED
500Ω
Switch
500Ω
Limit
switch I
500Ω
Limit
switch II
5V
Output to
relay
45
Implementation -Power amplifier
+15V
NPN TIP41
C
B
NPN TIP41
E
Input
Motor
E
Diode
B
PNP TIP107
C
NPN TIP107
-15V
46
Implementation
• Why we use two power supply?
• The DC motor turns on, the voltage of
power supply drops.
Output:
DC power
supply
normal
+15V port
Input:
triangular
±200mV;2Hz
The DC motor
use the power
from +15V port
47
Outline
1.
2.
3.
4.
5.
6.
Introduction
Modeling
Simulation
Implementation
Demo
Conclusion
48
Demo -PD controller
• Steady state error exist
49
Demo -PID controller
• Steady state error is zero
50
Outline
1.
2.
3.
4.
5.
6.
Introduction
Modeling
Simulation
Accomplishment
Demo
Conclusion
51
Conclusion
• We use different ways to model the system by
MATLAB.
• For a small disturbance, linearized model is
reliable.
• The rotary inverted pendulum can be
controlled by a PID controller.
• I controller can eliminate the steady state error.
52
Download