Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Automation course

Inverted pendulum

June 21, 2023

Figure 1

1 System model
a. Dynamic model:
I θ̈ = mgl sin θ − cθ̇ + τ (1)
Model linearization:
∂f
f¯(θ) = f (θ0 ) + (θ − θ0 ) (2)
∂θ θ=θ0

For θ0 =0 the linearization will be:

f¯(θ) = sin(θ0 ) + cos(θ0 )(θ − θ0 ) = θ (3)

The linearized dynamic model of the pendulum is:

I θ̈ = mglθ − cθ̇ + τ (4)

Define:    
θ̇ θ
Ẋ = X= Y =θ (5)
θ̈ θ̇
The state space equations are:       
θ̇ 0 1 θ 0
Ẋ = = mgl + 1 τ (6)
θ̈ I − Ic θ̇ I
 
  θ
Y = 1 0 (7)
θ̇

1
b.

Figure 2: Closed control loop diagram

2 Designing P control system


a. We need to find the transfer function for each block.

The transfer function of the system can be obtained by this equation where I is the unit matrix:

Gsystem = C(sI − A)−1 B + D (8)

After multiply the matrices we get the G system (Notice - here I represent the inertia moment)
1
Gsystem = (9)
Is2 + cs − mgl

The transfer function of the motor and sensor (given in the question):

Gmotor = K = 1/5 (10)


Gsensor = 1 (11)

The transfer function of a P controller is:

Gcontroller = Kp (12)

b. The transfer function of the closed-loop system will be:

p K K
θ(s) Gsystem GControl Gmotor I
H= = = K K mgl
(13)
θd (s) 1 + Gsystem GControl Gmotor 2 c
s + I s + pI − I

c. System parameters:
N msec
m = 13.5 gram l = 10 cm c = 3 · 10−3 I = ml2
rad
Design requirements:

O.S. ≤ 20%

Finding ζ from system requirements (overshoot equation):

− ln (0.2)
ζ≥p = 0.45
π 2 + ln (0.2)2

Choosing ζ = 0.5

Finding ωn :
c
ωn = = 22.22 (14)
2Iζ

2
Now finding kp :
Iωn2 + mgl
Kp = = 0.4 (15)
K
rad m
[Iωn2 ] = [kg · m2 ][ ] = N mrad=N
˜ m [mgl] = [kg][ ][m] = N m
s2 s2

V
[u] = [Kp ] · [e] → [Kp ] = =V
rad
V · sec
[u] = [Kd ] · [ė] → [Kd ] = = V · sec
Z rad
V V
[u] = [Ki ] · [ edt] → [Kd ] = =
rad · sec sec

Nm
[K] =
V
Nm
[Kp ] = N m = V
V
The steady-state error is:
1 Kp K
ess,P = 1 − lim sH(s) =1− = −0.2 rad (16)
s→0 s Kp K − mgl

3 Designing PD control system


a. The transfer functions of the G system, motor, and sensor are not changed:

1
Gsystem = (17)
Is2
+ cs − mgl
Gmotor = K = 1/5 (18)
Gsensor = 1 (19)

The transfer function of a PD controller is:

Gcontroller = Kp + kd s (20)

b. The transfer function of the closed-loop system will be:

K
θ(s) Gsystem GControl Gmotor I (Kp + Kd s)
H= = = 2 1 (21)
θd (s) 1 + Gsystem GControl Gmotor s + I (c + Kd K)s + I1 (Kp K − mgl)

c. Design requirements:

O.S. ≤ 20%

Choosing ζ > 0.45 → 0.7


1
(c + Kd K) = 2ζωn (22)
I
2ζωn I − c
Kd =
K
rad N msec
[2ζωI] = kgm2 = N msec [c] = = N msec
sec rad

3
N msec
[Kd ] = Nm
= V sec
V

1
(Kp K − mgl) = ωn2 (23)
I
Iωn2 + mgl
Kp =
K
1
|ess,P D |=
|ess,P | (24)
2
1 Kp K 1
ess,P D = 1 − lim sH(s) = 1 − = |ess,P | (25)
s→0 s Kp K − mgl 2
Kp K 1
|1 − |= |−0.2|= 0.1
Kp K − mgl 2
Kp K − mgl − Kp K −mgl
| |= | |= 0.1
Kp K − mgl Kp K − mgl

Kp K > mgl (26)


mgl
= 0.1 (27)
Kp K − mgl

1.1mgl
Kp = = 0.73
0.1K
Kp K − mgl
ωn2 = → ωn = 31.3
I
2ζωn I − c
kd = = 0.0061
K

You might also like