Nothing Special   »   [go: up one dir, main page]

DC Motor Controller

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

Cairo university

Faculty of engineering
Electrical power engineering
Dec 2022

Automatic control assignment

Prepared by

Name Sec. Bench


Omar Gamal Abdelhamid Zahran 3 1
Omar Mohamed Gamal Taher 3 8
Mohamed Tarek Abdulsalam Amin 3 48

Under supervision of

Prof. Mahmoud El-Naggar


Eng. Mohamed Khaled
Table of contents

a) Open loop transfer function: ................................................................................................................ 3


b) Root locus of the system:...................................................................................................................... 4
c) Range of gain to ensure system’s stability:........................................................................................... 5
d) Controller gain to satisfy: ...................................................................................................................... 6
i. Damping ratio equals to 0.7: K = 4.3632 ........................................................................................... 6
ii. Settling time less than 0.75 sec, 2 sec ( by using sisotool(sys) ) ....................................................... 6
iii. Natural frequency equals to 5 rad/sec: K = 4.0671 .......................................................................... 8
e) Get the controller gain to achieve critically damped response, ........................................................... 8
f) Calculate the sse for unit step and unit ramp input using this gain controller in (e) ....................... 9
g) the system is cascaded by a controller C(s) = 7∗ 𝑠 + 15𝑠 + 25 ......................................................... 10
h) Design a compensator to achieve maximum percent overshoot less than 5 % and settling time less
than 0.4 sec. ................................................................................................................................................ 11
i) Plot the closed loop output and control action using the controller in (h) ........................................ 12
j) State space representation: ................................................................................................................ 13
k) Check controllability and observability: .............................................................................................. 15
i. Check controllability: ...................................................................................................................... 15
l) Design a state feedback controller in order to stabilize the system and achieve settling time less
than 0.4 sec ................................................................................................................................................. 18
m) Without measuring the states, design a full state observer to estimate the states. ..................... 21
n) Using the observer in (m), implement the state feedback in (k) without measuring the real states. 23

1
Table of figures

Fig.1 Schematic diagram of dc motor .......................................................................................................... 3


Fig.2 Block diagram of the system ............................................................................................................... 4
Fig.3 Unity feedback and gain controller ‘K ................................................................................................. 4
Fig.4 Gain and poles at marginal stability ..................................................................................................... 5
Fig.5 Gain which satisfy damping ratio = 0.7 ................................................................................................ 6
Fig.6 Gain which satisfy minimum settling time at 0.785 sec ....................................................................... 6
Fig.7 Minimum gain to satisfy settling time less than 2 sec ........................................................................ 7
Fig.8 Maximum gain to satisfy settling time less than 2 sec ........................................................................ 7
Fig.9 Gain which satisfy natural frequency = 5 rad/sec ............................................................................... 8
Fig.10 Step response at critically damped condition ................................................................................... 8
Fig.1 Control action at critically damping condition .................................................................................... 9
Fig.2 Control action after adding C(S) ........................................................................................................ 10
Fig.3 Settling time / O.S / final value ......................................................................................................... 10
Fig.4 Settling time / O.S .............................................................................................................................. 12
Fig.15 Control action for closed loop .......................................................................................................... 13
Fig.16 MATLAB code for state space representation ................................................................................. 14
Fig.17 State space result ............................................................................................................................ 15
Fig 18 MATLAB code to check controllability and observability ................................................................ 16
Fig.19 Results of controllability and observability tests ............................................................................ 17
Fig 20 State feedback controller code and result ...................................................................................... 18
Fig 21 The output of the system ................................................................................................................ 19
Fig.22 The speed curve .............................................................................................................................. 20
Fig.23 Armature current curve ................................................................................................................... 20
Fig.24 Circuit observer ............................................................................................................................... 21
Fig.25 The speed curve .............................................................................................................................. 21
Fig.26 The position curve ........................................................................................................................... 22
Fig.27 Armature current curve ................................................................................................................... 22
Fig.28 Circuit implementation .................................................................................................................... 23
Fig.29 Real position .................................................................................................................................... 24
Fig.30 Real and estimate position .............................................................................................................. 24
Fig.31 Real and estimate speed ................................................................................................................. 25
Fig.32 Real and estimate current ............................................................................................................... 25
Fig.33 Error in speed .................................................................................................................................. 26
Fig.34 Error in position ............................................................................................................................... 26
Fig.35 Error in current ................................................................................................................................ 27

2
a) Open loop transfer function:

Given that:

R armature = 1.17 Ω Larmature = 24 mH b = 0.0737 N.m.s


V
J = 0.01 Kg. m2 K v = 0.072 rad/sec

Fig.5 Schematic diagram of dc motor


di
Using Kirchhoff’s voltage law: V − e = R a ∗ i + La ,
dt
di
where e = K v ∗ θ̇ , ‫ ؞‬V − K v ∗ θ̇ = R a ∗ i + La dt ,

‫ ؞‬Using Laplace transform: V(S) − K v ∗ Sθ(S) = R a ∗ I(S) + La ∗ SI(S) eq.1

Using Newton’s second law: T = J ∗ θ̈ + b ∗ θ̇


where T = K v ∗ i , ‫ ؞‬K v ∗ i = J ∗ θ̈ + b ∗ θ̇ ,

‫ ؞‬Using Laplace transform: K v ∗ I(S) = J ∗ S 2 θ(S) + b ∗ Sθ(S) eq.2

From eq.1 & eq.2:


θ(S) [ J∗S2 +b∗S]
∗ [La ∗ S + R a ] + K v ∗ Sθ(S) = V(S) ,
Kv
𝛉(𝐒) 𝑲𝒗 𝑟𝑎𝑑
= 𝟐
𝐕(𝐒) 𝐒∗[(𝐉∗𝐒+𝐛)∗(𝐋𝐚 ∗𝐒+𝐑 𝐚 )+𝐊 𝐯 ] 𝑣𝑜𝑙𝑡

𝟑𝟎𝟎
‫= )𝐒(𝐆 ؞‬ 𝐒𝟑 +𝟓𝟔.𝟏𝟐∗𝐒𝟐 +𝟑𝟖𝟎.𝟖𝟖𝟕𝟓∗𝐒

3
b) Root locus of the system:

Fig.6 Block diagram of the system

By using the MATLAB built-in function rlocus(sys) in the following script:

We get the following:

Fig.7 Unity feedback and gain controller ‘K’

4
c) Range of gain to ensure system’s stability:

𝟑𝟎𝟎
The system : 𝐆(𝐒)𝐇(𝐒) = , c/cs equation: 1 + KG(S)H(S) = 0,
𝐒 𝟑 +𝟓𝟔.𝟏𝟐∗𝐒 𝟐 +𝟑𝟖𝟎.𝟖𝟖𝟕𝟓∗𝐒

S 3 + 56.12 ∗ S 2 + 380.8875 ∗ S + 300K = 0

By using Routh-Hurwitz:

𝑆3 1 380.8875

𝑆2 56.12 300K

300𝐾−56.12∗380.8875
𝑆1
56.12

𝑆0 300K

‫ ؞‬Marginally stable occurs at K = 71.251355

‫ ؞‬Auxiliary equation: 56.12 ∗ 𝑆 2 + 300 ∗ 𝐾 = 0, ‫ ؞‬S = ± 19.51634

Fig.8 Gain and poles at marginal stability

5
d) Controller gain to satisfy:

i. Damping ratio equals to 0.7: K = 4.3632

Fig.9 Gain which satisfy damping ratio = 0.7

ii. Settling time less than 0.75 sec, 2 sec ( by using sisotool(sys) )

• Less than 0.75 sec: Doesn’t exist as the minimum settling time is 0.785
which occurs at gain = 3.617.

Fig.10 Gain which satisfy minimum settling time =0.785 sec


6
• Less than 2 sec : From MATLAB we get that the values of gain which
maintain the settling time less than 2 sec is 1.953 ≤ K ≤ 32.598

Fig.11 Minimum gain to satisfy settling time less than 2 sec

Fig.12 Maximum gain to satisfy settling time less than 2


sec sec

7
iii. Natural frequency equals to 5 rad/sec: K = 4.0671

Fig.9 Gain which satisfy natural frequency = 5 rad/sec


e) Get the controller gain to achieve critically damped response, draw
the output and the control action if the system reference is unit
step.
e.1 Gain: k=2.3063
e.2 Step response

Fig.10 Step response at critically damped condition

8
d
e.3 Control action

Fig.13 Control action at critically damped condition

f) Calculate the error steady state error for unit step and unit ramp input using
this gain controller in (e)

We have to calculate 𝐾𝑣 and 𝐾𝑝 to get S.S.E

Ramp input Step input

𝐾𝑣 =lim 𝑘𝑠𝐺(𝑠) = 1.823 𝐾𝑝 = lim 𝑘𝐺(𝑠) = ∞


𝑠→0 𝑠→0

1 1
s.s.e= = . 𝟓𝟒𝟗𝟐 s.s.e= =0
𝐾𝑣 1+𝐾𝑝

9
𝒔+𝟏𝟓
g) the system is cascaded by a controller C(s) = 7∗
𝒔+𝟐𝟓
g.1 Control action

Fig.14 Control action after adding C(S)

g.2 Settling time /overshoot /steady state error

Fig.15 Settling time / O.S / final value

Since the system is of type 1, so error steady state = 𝟎

10
h) Design a compensator to achieve maximum percent overshoot less
than 5 % and settling time less than 0.4 sec.

- A lead compensator is needed to modify the root locus


- The desired operating point is : S=10+10.49i
𝟒
Settling time = “according to second order approx.”
𝒓𝒆𝒂𝒍 𝒑𝒂𝒓𝒕

Real part = 10 , 𝜁 = .69


Compensator design:
Let 𝒁𝒄 = -7.899 “ to cancel one of the poles “
By applying angles condition
𝜃 p1 + 𝜃 p2 + 𝜃 p3+ 𝜃 pc −𝜃 zc = 180
𝜃 pc = 31°
10.499 ∏ 𝐿𝑝
tan(31) = , Kgain= ∏
𝑝𝑐−10 𝐿𝑧

𝑷𝒄 = -27.4 𝒁𝒄 = -7.899 K = 39

Using these values for the lead compensator the system could achieve
the required performance
• The controller given in g does not satisfy the required
performance because there is no applicable gain can achieve
these conditions

11
i) Plot the closed loop output and control action using the controller
in (h)

i.1 The step response

Fig.16 Settling time / O.S

Overshoot Settling time Steady state error


2.4% .396 sec 0

12
i.2 Control action

Fig.15 Control action for closed loop


j) State space representation:

States: θ (Position), 𝜽̇ (Velocity) & 𝒊 (Armature current)


As we got before:
𝐾𝑣 ∗𝑖 − 𝑏∗𝜃̇ −𝑏 𝐾
𝐾𝑣 ∗ 𝑖 = 𝐽 ∗ 𝜃̈ + 𝑏 ∗ 𝜃̇ , ‫= ̈𝜃؞‬ = ( ) ∗ 𝜃̇ + ( 𝑣 ) ∗ 𝑖 ,
𝐽 𝐽 𝐽
𝑑𝑖
𝑉 − 𝐾𝑣 ∗ 𝜃̇ = 𝑅𝑎 ∗ 𝑖 + 𝐿𝑎 ,
𝑑𝑡

𝑑𝑖 𝑉 −𝐾𝑣 ∗𝜃̇ − 𝑅𝑎 ∗𝑖 −𝐾𝑣 −𝑅 1


‫؞‬
𝑑𝑡
=
𝐿𝑎
=(
𝐿𝑎
) ∗ 𝜃̇ + ( 𝐿 𝑎) ∗ 𝑖 + (𝐿 ) ∗ 𝑉 ,
𝑎 𝑎

0 1 0
𝜃̇ −𝑏 𝐾𝑣 𝜃 0
0
‫= ] ̈𝜃 [؞‬ 𝐽 𝐽 [𝜃̇] + [ 01 ] ∗ 𝑉
𝑑𝑖 −𝐾𝑣 −𝑅𝑎
𝑖
𝑑𝑡 [0 𝐿𝑎 𝐿𝑎 ] 𝐿𝑎

13
𝜃
𝜃 = [1 0 0] [𝜃̇] ,
𝑖
❖ Let 𝜽 = 𝒙𝟏 , 𝜽̇ = 𝒙𝟐 , 𝒊 = 𝒙𝟑 , 𝑽 = 𝒖, 𝒘𝒉𝒆𝒓𝒆 𝒐𝒖𝒕𝒑𝒖𝒕 𝒚 = 𝜽 , then:

𝒙𝟏̇ 𝟎 𝟏 𝟎 𝒙𝟏 𝟎
[𝒙𝟐̇ ] = [𝟎 −𝟕. 𝟑𝟕 𝒙
𝟕. 𝟐 ] [ 𝟐 ] + [ 𝟎 ] ∗ 𝒖
𝒙𝟑̇ 𝟎 −𝟑 −𝟒𝟖. 𝟕𝟓 𝒙𝟑 𝟒𝟏. 𝟔𝟔𝟕
𝒙𝟏
𝒚 = [𝟏 𝟎 𝟎] [𝒙𝟐 ]
𝒙𝟑
𝟎 𝟏 𝟎
‫؞‬A = [𝟎 −𝟕. 𝟑𝟕 𝟕. 𝟐 ]
𝟎 −𝟑 −𝟒𝟖. 𝟕𝟓
𝟎
‫؞‬B = [ 𝟎 ]
𝟒𝟏. 𝟔𝟔𝟕
‫ ؞‬C = [𝟏 𝟎 𝟎]
State space representation using MATLAB:

Fig.16 MATLAB code for state space representation

Fig. 16 MATLAB code


fig 17 MATLAB code

14
Fig. 16 MATLAB code
fig 18 MATLAB code
Fig.17 State
space result
space

fig 81 State
space

Fig.17 State
k) Check controllability and observability: space
fig 82 State
i. Check controllability: space

𝑀 = [ 𝐵 𝐴𝐵 𝐴2 𝐵 ] ,
Fig.17 State
space
0 0 300
‫؞‬M = [ 0 300
fig 83 State
−16836] , ‫ = |𝑀|؞‬−3.75 ∗ 106 ≠ 0 ,
41.667 −2031 98123 space

‫؞‬System is completely controllable. Fig.17 State


space
15
fig 84 State
space
ii. Check observability:

𝐶
N = [ 𝐶𝐴 ] ,
𝐶𝐴2

1 0 0
‫؞‬N = [0 1 0 ] , ‫ = |𝑁|؞‬7.2 ≠ 0 ,
0 −7.37 7.2

‫؞‬System is completely observable.


Check using MATLAB:

Fig 18 MATLAB code


to check
controllability and
observability

Fig.18 MATLAB code


fig 142
fig 143 MATLAB
code

Fig.18 MATLAB code


fig 144 16

fig 145 MATLAB


code
Fig 19 Results of controllability and observability tests

Fig.19 Results of controllability and observability tests

Fig.19 Results of controllability and observability tests

17
Fig.19 Results of controllability and observability tests
l) Design a state feedback controller in order to stabilize the system
and achieve settling time less than 0.4 sec (consider that the states
are measurable). Compare between the controller performance in
(h) and (I). Implement your design using the SIMULINK considering
that the reference position is 90° Draw the states and output versus
time. Comment on your results.
L.1 getting the feedback controller

Fig 20 State feedback controller code and result


Fig.20 feedback controller K value
fig 266 Results of controllability and observability tests
The gain of the feedback:

K1 K2 K3
Fig.20 feedback controller K value
1152 101.4 7.5811
fig 267 Results of controllability and observability tests
18

Fig.20 feedback controller K value


l.2 the circuit implementation

The output and the states:

Fig 21 the output of the system

Fig. the output of the system

Fig. the output of the system

19
Fig. the output of the system
Fig 22 the speed curve

Fig. the speed curve

Fig. the speed curve


Fig 23 armature current curve

Comment: at the beginning armature current raised roughly for a while, that
increased the motor's speed until the position is equal to 90° with no overshoot
and settling time less than 0.4 seconds as required, and comparing with the
controller in h this controller is better as It achieves the required condition with
no overshoot Fig. the speed curve
20
m)Without measuring the states, design a full state observer to
estimate the states. Choose appropriate poles for the observer.
Plot the real and estimated states. Comment on your results.
𝑘𝑒 = acker(a',c',8*p); MATLAB code “multiply the poles by 8 to make
the observer faster than the system “
Ke1 Ke2 Ke2
0.0003*10^7 0.1956*10^7 1.1182*10^7
m.1 circuit implementation

Fig 24 circuit observer

m.2 the output and the states(real & estimated from the observer)

Fig 25 the speed curve

21

Fig. circuit observer


Fig 26 the position curve

Fig. the position curve

Fig 27 the armature current


22
Comment: the observer is capable of tracking the system because the
poles of the observer are much faster than the system.

n) Using the observer in (m), implement the state feedback in (k)


without measuring the real states. Use initial conditions for the
position as 40 degree and for speed as 10 degree/sec. Plot the
output, states, and the error in state estimation. Comment on your
results.
n.1 the circuit implementation

Fig 28 circuit implementation

23
n.2 output and states (real & estimated from the observer)

Fig 29 real position

Fig. real position

Fig 30 real and estimate position


24
Fig 31 real and estimate speed

Fig. real and estimate speed

Fig 32 real and estimate current


25
n.3 the error in states measurements

Fig 33 error in position

Fig 34 error in speed


26
Fig 35 error in current

Comment: there is an error between estimate and real states in the


transient time due to the initial conditions of the system but this error
decrease until it becomes zero at steady state

27

You might also like