Sunteți pe pagina 1din 28

School of Computing,

Electronics

Coursework
TABLE OF CONTENTS
TABLE OF CONTENTS.......................................................................................2
PROBLEM 1.................................................................................................3
1a..............................................................................................................3
1b..............................................................................................................3
PROBLEM 2.................................................................................................5
2a i............................................................................................................5
2a ii...........................................................................................................6
2a iii..........................................................................................................6
2b..............................................................................................................6
2c..............................................................................................................8
2d i............................................................................................................9
2d ii..........................................................................................................9
2e i..........................................................................................................11
2e ii.........................................................................................................13
APPENDIX.................................................................................................15
REFERENCES............................................................................................19

2 | Page
PROBLEM 1
1a
(i) General expression:
2
Y (s) k n
= 2
U (s) s +2 n s + 2n

rad
Putting the given values, i.e n=2 ; =1.25 ;k=1
s

22

s2 +2 ( 1.25 ) ( 2 )+ 22

4
2
s +5 s+ 4

(ii) Differential equation:

Y ( s ) [ s2 +5 s +4 ]= [ 4 ] U ( s)

y (t ) +5 y (t ) +4 y ( t )=4 u(t )

3 | Page
1b
(i)

1b: Step response


1

0.9
Step response
0.8

0.7

0.6

0.5
y(t)

0.4

0.3

0.2

0.1

0
0 1 2 3 4 5 6
Time (sec)

Figure 1 The System Response

4 | Page
(ii) Poles are roots of denominator:

s 2 +5 s+ 4=0

5 524(1)(4)
s=
2

s=4,1

Pzmap:

5 | Page
1c: PZ map
1

0.8

0.6

0.4

0.2
Imaginary Axis

-0.2

-0.4

-0.6

-0.8

-1
-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
Real Axis

Figure 2 pzmap Function

(iii)
2 2
s +2 n s +n =0

The roots of the above equation will give the poles of a second order transfer
function model. On solving the above equation the value of poles are given
by;
s1= ( + 1 ) n
2
; s2 = (
2 1 ) n

The poles of the system give you information about how the system
responds because the poles tell us all the information about the natural
frequency and damping ratio of the system.
Plot of poles in the s-plane is given in fig;
The vertical location of the pole is the frequency of the
oscillation in

6 | Page
the response while the horizontal location of the pole is the reciprocal of the
time constant of the exponential decay.

So, farther the location of the pole to the left on s-plane, the faster the
response (transient) will die out. The distance of the pole from the origin is
the undamped natural frequency of the system. The poles of the above
system are located at s= -1 and s=-4. Since s=-4 is farther as compared to
s=-1 from origin so transient response considering only due to this pole will
die out quickly due to above mentioned reason while the response would be
dominant taking s=-1 pole and it will die out slowly due to this pole (pole at
s=-1).

Hence,

Since both poles are on the real axis, therefore the system is overdamped.
The pole at -1 is closer to the origin and will be dominant. This pole will play
a greater role in the transient response.

7 | Page
PROBLEM 2
2a
(i) Given system:
2
d y (t) dy(t)
2
+5 + 4 y ( t ) =ku(t )
dt dt

We can write as:

y (t ) +5 y (t ) +4 y ( t )=ku ( t )

y (t )=5 y ( t )4 y ( t )+ ku ( t )

We can also write an additional equation:

y (t )= y ( t)

We now have two equations:

y (t )= y ( t)

y (t )=5 y ( t )4 y ( t )+ ku ( t )

In matrix form:

[][
y
=
0 1 y 0
+ u(t )
y 4 5 y k ][ ] [ ]
y=[ 1 0 ] y[]
y

This is the desired STATE SPACE form:

8 | Page
= + u

9 | Page
2a
(ii) Transfer function is:
1
G ( s )=C ( sI A ) B

([ ] [
[ 01 ] s 0 0 1
0 s 4 5 ]) [ ]0
k

k
2
s +5 s+ 4

2a
(iii) Eigenvalues of A are:

eig ([ 0
])
1 =4,1
4 5

Pol e s of tr a n sfer fu n ctio n a r e :


2
s +5 s+ 4=0

5 524(1)(4)
s=
2

s=4,1

Bot h a r e t h e s a m e .

Reason:

In control theory, the system state-space equation

x= Ax+Bu

y= Cx+Du

10 | P a g e
has the transfer function G(s) =C(sIA)1B+D.

adj(sI A)
Since (sIA)1 = det( sI A) , where adj(sIA) is the adjugate of (sIA) the poles of G(s) are

the numbers that satisfy det(sIA) =0. This is exactly the characteristic equation of matrix A,
whose solutions are the eigenvalues of A.

2b

(i) Simulink model:

Figure 3 The state space

(ii) Matlab script:

%2b
si m( ' m y m dl',[0 1 0]);%r u n si m ulink m o d el

fi g u r e ; % n e w fi g u r e
plo t(t,y);% s t e p
title('2 b: St e p r e s p o n s e fro m Si m ulink' );% title
yl a b el('y(t)');%l a b el
le g e n d ( 'St e p r e s p o n s e fro m Si m ulink' );%l e g e n d

(iii) Response :
The signals received by a system are called excitations or inputs of the
system and the signals generated by the system because of these
excitations are called responses or outputs of the system.

11 | P a g e
St e p Re s p o n s e : Its the dynamic response of the system (assuming zero
initial conditions) when the input is the step function u(t) = 1, t > 0. In order
to obtain the step response of the system, the command step is used with its
variations.

Re s ult:

2b: Step response from Simulink


1
Step response from Simulink
0.9

0.8

0.7

0.6
y (t)

0.5

0.4

0.3

0.2

0.1

0
0 1 2 3 4 5 6 7 8 9 10
Time (s)

Figure 4 Step response

2c
(i) Using reaction curve method:
A linearized quantitative version of a simple plant can be obtained with an
open loop experiment using the following procedure;
1) With the plant in open loop take the plant manually to a normal
operating point. Say that the plant output settles at y(t)=y o for constant
plant input u(t)=uo.
2) At initial time, to , apply a step change to the plant input, from u o to u
(this should be in the range of 10 % to 20% of full scale).
3) Record the plant output until it settles to the new operating point. The
curve obtained in this way as shown in fig. is called Reaction curve.

12 | P a g e
2b: Step response from Simulink
1
Step response from Simulink
0.9

0.8

0.7

0.6
y(t)

0.5

0.4

0.3

0.2

0.1

0
0 1 2 3 4 5 6 7 8 9 10
Time (s)

Figure 5 Using Reaction Curve Method

Th er e is n o d e a d ti m e a s t h e c u r v e s t a r t s fro m z ero. Th e ti m e c o n s t a n t is 2 a s
s h o w n b y t h e c alc ul a tio n s . We c a n fi t t h e fi r st or d er m o d el:

13 | P a g e
1 1
G ( s )= =
s+1 2 s+1

This is t h e a p proxi m a t e m o d el.

14 | P a g e
2d
(i) Simulink model is shown below:

Figure 6 PID

2d
PID TUNNING:

PID stands for Proportional, Integral, Derivative. Controllers are designed to eliminate the need
for continuous operator attention. Controllers are used to automatically adjust some variable to
hold the measurement (or process variable) at the set-point. The set-point is where you would
like the measurement to be. Error is defined as the difference between set-point and
measurement.

(error) = (set-point) - (measurement)

The variable being adjusted is called the manipulated variable which usually is equal to the
output of the controller. The output of PID controllers will change in response to a change in
measurement or set-point.

Proportional Gain:

With proportional gain, the controller output is proportional to the error or a change in
measurement (depending on the controller).

(Controller output) = (error)*100/(proportional band)

With a proportional controller offset (deviation from set-point) is present. Increasing the
controller gain will make the loop go unstable. Integral action was included in controllers to
eliminate this offset.

15 | P a g e
Integral Gain:

With integral gain, the controller output is proportional to the amount of time the error is present.
Integral action eliminates offset.

CONTROLLER OUTPUT = (1/INTEGRAL) (Integral of) e(t) d(t)


Offset (deviation from set-point) in the time response plots is reduced by increasing the integral
gain.

Derivative Gain:

With derivative action, the controller output is proportional to the rate of change of the
measurement or error. The controller output is calculated by the rate of change of the
measurement with time.

dm
CONTROLLER OUTPUT = DERIVATIVE ----
dt

Where m is the measurement at time t. Derivative gain can compensate for a changing
measurement. Thus derivative takes action to inhibit more rapid changes of the measurement
than proportional action. Derivative is often used to avoid overshoot.

The above mentioned rules are kept in mind while tuning PID controller for question no.2d
(ii)

16 | P a g e
(ii) We tune the PID controller as follows:

St e p r e s p o n s e ( g ai n s s h o w n o n e a c h plo t) Ob s er v a tio n s
O v er s h o o t is b el ow
2d: Step response from Simulink with PID Controller [Kp=1,Ki=0,Kd=0]
0.7 20%
Step response from Simulink Ris e ti m e a b o u t 1
0.6 s econd
St e a d y s t a t e e rror
0.5
is lar g e
We m u s t intro d u c e
int e g r al g ain
0.4
y(t)

0.3

0.2

0.1

0
0 1 2 3 4 5 6 7 8 9 10
Time (s)

17 | P a g e
2d: Step response from Simulink with PID Controller [Kp=1,Ki=2,Kd=0]
Overshoot is 20%
1.4 Rise ti me about 1
Step response from Simulink second
1.2 Steady state error
is zero
1 We try to increase
proportional gain
0.8 and reduce rise
ti me
y(t)

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (s)

2d: Step response from Simulink with PID Controller [Kp=10,Ki=5,Kd=0]


Overshoot is more
1.4 than 20%
Step response from Simulink
Rise ti me about
1.2 0.2 second
Steady state error
1 is zero
We try to increase
0.8 derivative gai n to
reduce overshoot
y(t)

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (s)

18 | P a g e
Overshoot is less
2d: Step response from Simulink with PID Controller [Kp=10,Ki=5,Kd=1]
1.4 than 20%
Step response from Simulink Rise time about
0.4 second
1.2
Steady state error
is zero
1 Good response

0.8
y(t)

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (s)

2e
(i) Delay added to the model:

Figure 7 PID Added Delay

19 | P a g e
Response with step reference:

sim('mdl_pid_Control_Delay',[0 200]);%run simulink model


figure;%new figure
plot(t,y);%step
title(['2d: Step response from Simulink with PID Controller and Delay [Kp='
num2str(Kp) ',Ki=' num2str(Ki) ',Kd=' num2str(Kd) ']']);%title
ylabel('y(t)');xlabel('Time (s)')%label
legend('Step response from Simulink');%legend

2d: Step response from Simulink with PID Controller and Delay [Kp=10,Ki=5,Kd=1]
2000
Step response from Simulink
1500

1000

500
y(t)

-500

-1000

-1500

-2000
0 20 40 60 80 100 120 140 160 180 200
Time (s)

Figure 8 Simulation

Response shows system becomes unstable.

20 | P a g e
2e
(ii) Implementing a smith predictor:

P y_smith

First Order Model To Workspace

PID Controller

PID G

Step Slew Rate System Transport


Limiter Delay

y_p

To Workspace1

t_smith
Clock
To Workspace

Figure 9 Smith Predictor

Response plots:

%2d ii
P = (1/(2*s+1));%process transfer function

sim('mdl_smith',[0 10]);%run simulink model


figure;%new figure
plot(t_smith,y_smith);%step
hold on;
plot(tpid,ypid,'r:');
title(['2d: Step response from Simulink with Smith Predictor [Kp='
num2str(Kp) ',Ki=' num2str(Ki) ',Kd=' num2str(Kd) ']']);%title
ylabel('y(t)');xlabel('Time (s)')%label
legend('Step response with Smith Predictor','Step response with PID
Controller');%legend

21 | P a g e
2d: Step response from Simulink with Smith Predictor [Kp=10,Ki=5,Kd=1]
1.4
Step response with Smith Predictor
Step response with PID Controller
1.2

0.8
y(t)

0.6

0.4

0.2

0
0 1 2 3 4 5 6 7 8 9 10
Time (s)

Figure 10 Simulation

The response with Smith predictor is close to that given by the PID controller.
Thus, this shows that the first order model we used quite accurately
represents the delay and time constant of the model. Thus the Smith
predictor is able to offset the effects of the delay.

22 | P a g e
APPENDIX
Code:

clc;clear all;close all;

%1b
s=tf('s');%laplace variable
G=4/(s^2+5*s+4);%system

figure;%new figure
step(G);%step
title('1b: Step response');%title
ylabel('y(t)');%label
legend('Step response');%legend

figure;%new figure
pzmap(G);%step
title('1c: PZ map');%title

%2a ii
k=4;%k value
A=[0 1;-4 -5];%A matrix
B=[0;k];%B matrix
C=[1 0];%C matrix

eig(A)%eigenvalues of A

%2b
sim('mymdl',[0 10]);%run simulink model

figure;%new figure
plot(t,y);%step
title('2b: Step response from Simulink');%title
ylabel('y(t)');xlabel('Time (s)')%label
legend('Step response from Simulink');%legend

%2d
G=4/(s^2+5*s+4);%system

Kp=10;
Ki=5;
Kd=1;

sim('mdl_pid_Control',[0 10]);%run simulink model


figure;%new figure

23 | P a g e
plot(t,y);%step
title(['2d: Step response from Simulink with PID Controller [Kp=' num2str(Kp)
',Ki=' num2str(Ki) ',Kd=' num2str(Kd) ']']);%title
ylabel('y(t)');xlabel('Time (s)')%label
legend('Step response from Simulink');%legend
tpid=t;ypid=y;

sim('mdl_pid_Control_Delay',[0 200]);%run simulink model


figure;%new figure
plot(t,y);%step
title(['2d: Step response from Simulink with PID Controller and Delay [Kp='
num2str(Kp) ',Ki=' num2str(Ki) ',Kd=' num2str(Kd) ']']);%title
ylabel('y(t)');xlabel('Time (s)')%label
legend('Step response from Simulink');%legend

%2d ii
P = (1/(2*s+1));%process transfer function

sim('mdl_smith',[0 10]);%run simulink model


figure;%new figure
plot(t_smith,y_smith);%step
hold on;
plot(tpid,ypid,'r:');
title(['2d: Step response from Simulink with Smith Predictor [Kp='
num2str(Kp) ',Ki=' num2str(Ki) ',Kd=' num2str(Kd) ']']);%title
ylabel('y(t)');xlabel('Time (s)')%label
legend('Step response with Smith Predictor','Step response with PID
Controller');%legend

Simulink Model for 2b:

24 | P a g e
25 | P a g e
Simulink model for 2d:

Simulink model for 2e:

t
Clock To Workspace1

PID G y

Step PID Controller Slew Rate LTI System Transport To Workspace


Limiter Delay

26 | P a g e
Simulink model for Smith predictor:

27 | P a g e
REFERENCES

1. Nise, N.S., 2007. CONTROL SYSTEMS ENGINEERING, (With CD). John


Wiley & Sons.
2. Ogata, K., 2001. Modern control engineering. Prentice Hall PTR.
3. Matlab and Simulink at https://www.mathworks.com/.
4. An Introduction to system dynamics
www.facstaff.bucknell.edu/mastascu/eControlHTML/SysDyn/SysDyn2.ht
ml
5. http://www.expertune.com/tutor.aspx

28 | P a g e

S-ar putea să vă placă și