1. 2 Outline 1.Introduction 2.Modeling 3.Simulation 4.Implementation 5.Demo 6.Conclusion

Preview:

Citation preview

1

2

Outline1. Introduction2. Modeling3. Simulation4. Implementation5. Demo6. Conclusion

3

Outline1. Introduction2. Modeling3. Simulation4. Implementation5. Demo6. Conclusion

4

Introduction

• Rotating arm and inverted pendulum.• Rotating arm is actuated by a DC motor.• The angular disturbance will be sensed by the

potentiometer.

l1 length from the center of rotating arm to the pendulum.

l2 length of the inverted pendulum.

m1 mass of the rotating arm.

m2 mass of the inverted pendulum.

α The angular displacement of the rotating arm rotated.

θ The angular displacement of the inverted pendulum.

linear velocity of the mass center of the inverted pendulum.

Potentiometer

Motor

l 2

l1

m2

α

ө

X

Y

Z

m1

X

Y

r cv

5

Introduction

• The system is controlled by a PID control circuit.• Two equilibrium points existed.• Use a cut-off device to protect the system.

Sensor

Controller PlantDriver

Poweramplifier

DCmotor

PIDcontroller

Potentio-meter

Inverted pendulum

AngleVoltage signal

Disturbance

6

Outline1. Introduction2. Modeling

Find the transfer function of input voltage and the angle of inversed pendulum.

– Equation of motion.– Linearization– Laplace transform– Transfer function

3. Simulationment4. Implementation5. Demo6. Conclusion

7

Modeling -Equation of motion

2 2.2 2 22

2 2

1 1 1(cos ) (sin )

2 2 2

1cos 1

2

r cx y zT I m v I I I

V m gl

L T V

• Step 1 : Find the equation of motion by Lagrange equation

1 2 2

1 2 2 2

1 1( sin sin cos cos sin )

2 21 1 1

( cos sin sin cos cos ) ( sin )2 2 2

r cv l l l i

l l l j l k

8

Modeling -Equation of motion

2 2 22 2 1 2 2 2 2 2 2

2 2 2 2 22 1 2 2 1 2 2

1 2 2

0

1 1 1 1cos cos sin sin 0.......

4 2 4 2

1 1sin cos sin cos

4 2

1

2

x y z

y z

d L L

dt

I l m l l m m l I I m l g a

d L L

dt

I m l m l I I l l m

l l m

2 22 2

1sin 2 cos sin .......

4z yI m l I b

9

• 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.

Modeling -Linearization

2 2

2 2

1cos 1

21

sin 02

0 or 180

V m gl

dVm gl

d

Θ=180.0°

Θ=0.0°

10

• In this case, we set the equilibrium point at θ=0°• Expand the nonlinear terms in Taylor series.

Modeling -Linearization

2 4 3 51 1 1 1sin ... ; cos 1 1

2 24 6 120

2 22 2 1 2 2 2 2 2 2

22 2 1 2 2 2 2

2 22

2

2

22

21 2 2 1 2

1 1 1 10......(a)cos sin

1

cos c

4 2 4 2

1 1 1-

cos sin

sin sin

0......(a*)4 2

o1

4s

2

1

2

x y z

x

y z

I l m l l m m l I I m l g

I l m l l m m l g

I m l m l I I l l m

12

2 2

22 2

22 1 1 2 21 1

1

2

12 cos .......

4

1..

si

...

n

.. *2

sinz y

y

l l m

I m l I b

I m l I l l m b

11

System modeling -Linearization

• If the angle of disturbance is 5°, the max. error between linear and nonlinear model is 0.046°, less then 1%.

12

• Step 3 : Laplace transform of the motion equations

System modeling -Laplace transform

22 2 1 2 2 2 2

L 22 2 1 2 2 2 2

22 1 1 2 2

L 2

2 2

2 1 1 22

22

1 1 1- 0......(a*)

4 2 2

1 1 1- 0......(1)

4 2 2

1......(b

A

*)2

1......(2)

2A

x

x

y

y

I l m l l m m l g

I l m l l m m l g

I m l I l l m

I m l I

s s

s l sl m

13

System modeling -Transfer function

• Step 4 : Find the transfer function of a DC motor• According to Kirchhoff’s voltage law (KVL)

Where is the voltage of coil

is the induced voltage of the motor

is the torque generate by motorAe K

.....(3)

T A A A

A

L A

T

T

v

v e i R

s

K RK

RK

KV

Tv

AK i

Equivalent circuit of a DC motor

14

System modeling -Transfer function

22 2 1 2 2 2 2

22

2 2

12 2

1 2 2

1 1 1- 0......(1)

4 2 2

1......(2)

2

.....(3)

y

AT

xI l m l l m m l g

I m l I

s s

s s

V

l l m

RK

Ks

• Step 5 : Transfer function of the system

15

Symbol Value Unit

0.10 m

0.32 m

0.02841 Kg

0.046 Kg

9.81 m/s2

7.6707e-5 Kgm2

3.925e-4 Kgm2

3.925e-4 Kgm2

1

2

1

2

X

Y

l

l

m

m

g

I

I

I

Modeling -Transfer function

• Set the values we need

Symbol Value Unit

1 Ω

0.03 AR

K

• Assume the values we need but we don’t know

Ref. : Stephen J. Chapman “Electric Machinery Fundamentals” Chap. 9 McGraw. Hill

16

Modeling -Transfer function

2

4 3 2

2

4 3 2

4.71s -216.6

0.0918s 0.1413 6.7088 6.49

-2.208s

0.0918s 0.1413 6.7088 6.49

V s s s

V s s s

• Transfer function.

17

Modeling -Transfer function

• Unit step command test

Sensor

Controller Plantactuator

Poweramplifier

DCmotor

PIDcontroller

Potentio-meter

Inverted pendulum

AngleVoltage signal

Command

18

Modeling -Transfer function

• Command unit step and disturbance is zero to check transfer function.

19

Modeling –Routh-Hurwitz Stability

3 2

3

2

( ) 0.0718 (0.1413 20208 ) (2.208 6.7088) (2.208 6.49)

0.0918 2.208 6.7088

0.1413 20208 2.208 6.49

1 (0.1413 2.

0.0918

s s D s P s I

s P

s D I

s

0

3.038

2.93

0.06

0.3119 4.875 14.813 2.

208 ) (2.208 6.7088) 0.0918 (2.208 6.49)

026 0

2.208 6.

. 8

9

4 2

4

P

I

D

P PD D I

D P I

s I

• Using Routh-Hurwitz stability to find the stable range of the gain of PID or PD controller.

20

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)

21

Outline1. Introduction2. Modeling3. Simulation

– Open loop– PD controller– PI controller– PID controller

4. Implementation5. Demo6. Conclusion

22

Simulation

• Use SimMechanics to build a nonlinear system model

23

Simulation

• Use Simulink to build a nonlinear system model

24

Simulation

• Use Simulink to build a linear system model

25

。 Simulation –open loop (angular V)

26

Simulation -PD controller

I controller ×0

P controller ×6

D controller ×22

10K

10KInverter ×20 Signal input

10K

6 20 120

0

22 20 440

P

I

D

27

Simulation -PD controller

28

Simulation -PD controller

• Response simulation.(PD controller)

• Absolute error between the simulation of SimMechanics and Simulink.

29

Simulation -PI controller

I controller ×2.5

P controller ×6

D controller ×0

10K

10KInverter ×20 Signal input

10K

6 20 120

2.5 20 50

0

P

I

D

30

Simulation -PI controller

31

Simulation -PI controller

• Response simulation.(PI controller)

• Absolute error between the simulation of SimMechanics and Simulink.

32

Simulation -PID controller

I controller ×1.5

P controller ×10

D controller ×11

10K

10KInverter ×15 Signal input

10K

10 15 150

1.5 15 22.5

11 15 165

P

I

D

33

Simulation -PID controller

34

Simulation -PID controller

• Response simulation.(PID controller)

• Absolute error between the simulation of SimMechanics and Simulink.

35

Outline• System introduction• System modeling• Simulation• Implementation

– Inversed pendulum– Control circuit

• Demo• Conclusion

36

Implementation

• System block diagram

Sensor

Controller Plantactuator

Poweramplifier

DCmotor

PIDcontroller

Potentio-meter

Inverted pendulum

AngleVoltage signal

Disturbance

37

• 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

Implementation -Inversed pendulum

38

Implementation -Control circuit

CommonCOM

PowerAmplifier

DCmotor

PIDController

Potentio-meter

Power supplyNO. 1

Power supplyNO. 2

AngleCut-offCircuit

• Circuit block diagram

39

Implementation -Control circuit

PID controller

Power amplifier

Cut-off circuit

Powersupply II

On/Off

Sensor

Signal light

Limit switch

Motor

• Circuit board

Powersupply I

40

Implementation -Potentiometer

• Use a variable resistor as a potentiometer.

-15V

+15V

Output voltage

Inverted pendulum

Potentiometer

41

Implementation - Potentiometer

-15V

+15V

Output voltage

-15V

+15V

Output voltage

0V

15k ohm

15k ohm

-15V

+15V

Output voltage

1V

14k ohm

16k ohm

• How does it work?

42

Implementation -PID controller

• Use 17741 operational amplifier

• Modes switch

• Elements shiftable

PID controller

43

Implementation -PID controller

P

Inverter

I

D

3.2kΩ 10ηF

500Ω 500Ω

200kΩ10ηF

500Ω

500Ω

500Ω500Ω

Input

Output

500Ω

500Ω

500Ω

44

Implementation -Cut-off circuit, signal light

NPN transistor

Relay5V 2 Form C Contact

500 ohm resistances

Resistance with signal

light

7404 NOT

7408 AND

74047408

45

Limit switch II

Limit switch I

Switch

Circuit for LED

500Ω

5V

500Ω

500Ω

500Ω

Output to relay

Implementation -Cut-off circuit, signal light

46

Implementation -Power amplifier

PNP TIP107

NPN TIP41

+15V

-15V

Input

B

C

E

B

C

EMotor

NPN TIP41

NPN TIP107

Diode

47

Implementation

• Why we use two power supply?

• The DC motor turns on, the voltage of power supply drops.

Input:

triangular

±200mV;2Hz

Output:

DC power supply

+15V port

The DC motor use the power from +15V port

normal

48

Outline1. Introduction2. Modeling3. Simulation4. Implementation5. Demo6. Conclusion

49

Demo -PD controller

• Steady state error exist

50

• Steady state error is zero

Demo -PID controller

51

Outline1. Introduction2. Modeling3. Simulation4. Accomplishment5. Demo6. Conclusion

52

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.

Recommended