0% found this document useful (0 votes)
14 views93 pages

C&i Lab Manual-Sscet-20.11.2024

Uploaded by

hod.eee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views93 pages

C&i Lab Manual-Sscet-20.11.2024

Uploaded by

hod.eee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 93

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

EE3512 -CONTROL AND INSTRUMENTATION LABORATORY

LABORATORY RECORD

Submitted by

STUDENT NAME :

REGISTER NUMBER :

BRANCH : EEE

YEAR/ SEM : III / V


BONAFIDE CERTIFICATE

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

Certified that to be the Record of laboratory work done by

Mr. /Ms Class

Reg.No Semester in the code/ subject

Laboratory

during the academic year

Staff in charge Head of the Department

Submitted for the Anna University Practical Examination held on

Internal Examiner External Examiner


EE3512 CONTROL AND INSTRUMENTATION LABORATORY LTPC
0042
SYLLABUS

CYCLE 1
1. Analog (op amp based) simulation of linear differential equations.
2.Numerical Simulation of given nonlinear differential equations.
3. Real time simulation of differential equations.
4. Mathematical modeling and simulation of physical systems in at least two fields
 Mechanical
 Electrical
 Chemical process
5. System Identification through process reaction curve.
6. Stability analysis using Pole zero maps and Routh Hurwitz Criterion in simulation platform.
7. Root Locus based analysis in simulation platform.
8. Determination of transfer function of a physical system using frequency response and Bode’
asymptotes.
CYCLE 2

9. Design of Lag, lead compensators and evaluation of closed loop performance.


10. Design of PID controllers and evaluation of closed loop performance.
11. Discretization of continuous system and effect of sampling.
12. Test of controllability and observability in continuous and discrete domain in simulation
platform.
13. State feedback and state observer design and evaluation of closed loop performance.
14. Mini Project 1: Simulation of complete closed loop control systems including sensor and
actuator dynamics.
15. Mini Project 2: Demonstration of a closed loop system in hardware.

TOTAL: 60 PERIODS
CONTENTS
Exp. Page Marks
Date Title of the Experiment Signature
No. No. (10)

10 .

11

12

13

14

15

16
1

EXP 1: Design and simulation of mathematical model for


a linear mechanical system
AIM:
To design and simulate a mathematical model for a linear mechanical system.
APPARATUS:

S.no Software Version

1. MATLAB R2021

2. Simulink -

FORMULA:

The corresponding differential equations are as follows:


2

𝑑2 𝑑 𝑑
𝑀2 2 (𝑦2) + 𝑓2 ( (𝑦2) − (𝑦1)) + 𝐾2(𝑦2 − 𝑦1) = 𝐹(𝑡)
𝑑𝑡 𝑑𝑡 𝑑𝑡

𝑑2 𝑑 𝑑 𝑑
𝑀1 (𝑦1) − 𝑓 2 ( (𝑦2) − (𝑦1)) − 𝐾 (𝑦
2 2 − 𝑦1 ) + 𝑓 1 ( (𝑦1)) + 𝐾1𝑦1 = 0
𝑑𝑡2 𝑑𝑡 𝑑𝑡 𝑑𝑡

Consider the parameters as given below:


M1 = M2 = 5 kg
K1 = 2 N/m
K2 = 6 N/m
f1 = 2N/m/s
f2 = 3N/m/s
The transfer function in s domain for the corresponding differential equation is:
𝑦2(𝑠) 5𝑠2 + 5𝑠 + 11
=
𝑓(𝑠) 25𝑠4 + 40𝑠3 + 91𝑠2 + 27𝑠 + 30

BLOCK DIAGRAM/CODE:

1. Code:

>>num=[5 5 11];
>>den=[25 40 91 27 30];
>>G=tf(num,den);
>>kp=dcgain(G);
>>ess=1/(1+kp);
>>step(G);
3

2. Simulink model:

OBSERVATIONS:

1. Code:

num =
5 5 11
den =
25 40 91 27 30

G=

5 s^2 + 5 s + 11
--- - - - - -
25 s^4 + 40 s^3 + 91 s^2 + 27 s + 30

Continuous-time transfer function.


kp =
0.3667

ess =
0.7317
4

2. Simulink:
5

MEASUREMENTS VALUES
60.484%
Overshoot
0.806
Preshoot
5.563
Undershoot
1.8585 seconds
Rise Time
1.848 seconds
Fall Time
45.5 seconds
Settling Time
0.347
Final Value
0.7317
Steady state Error

INFERENCE:

 The differential equations for a linear mechanical system were established and it
was realized using Simulink.
 The corresponding transfer function graph was plotted for step input, in Simulink
and MATLAB, and the properties were analyzed.
 The damping effect of the spring system was established, and the corresponding
data was tabulated.

RESULT:

Thus, the mathematical model of the linear mechanical system was simulated,
and the corresponding parameters were noted.
6

EXP 2: Design and simulation of mathematical model for


Electrical system
AIM:
To design and simulate a mathematical model for a series RLC electrical circuit
and analyze the response graph.

APPARATUS:

S.no Software Version

1. MATLAB R2021

2. Simulink -

FORMULA/DERIVATION:
In a series RLC circuit, the resistor acts as the dissipating element, while the
conductor and inductor act as energy storing elements. We utilize the transfer
function, and by giving the input as a unit step signal, we can model the system
and obtain the respective graph.

Here, let:
 L = inductance (H)
 R = resistance ( R)
 C = capacitance(F)
7

 Vs = Unit step input


 I(t) = current through the circuit(clockwise)(A)
 q = charge

The current is moving in a clockwise manner. Using Kirchhoff’s voltage law:

𝐿𝑑𝑖(𝑡) 1
𝑉𝑠 (𝑡) − − 𝑖(𝑡)𝑅 − ∫ 𝑖(𝑡)𝑑𝑡 = 0
𝑑𝑡 𝐶
𝑑𝑞(𝑡)
Here we know that 𝑖(𝑡) = ,
𝑑𝑡

𝐿𝑑 𝑑𝑞(𝑡) 𝑅𝑑𝑞(𝑡) 1
𝑉(𝑡)𝑠 = ( ) + + ∫ 𝑑𝑞
𝑑𝑡 𝑑𝑡 𝑑𝑡 𝐶

𝐿𝑑2𝑞(𝑡) 𝑅𝑑𝑞 𝑞
𝑉𝑠 (𝑡) = + +
𝑑𝑡2 𝑑𝑡 𝐶
𝑑2𝑞(𝑡) 𝑑𝑞(𝑡) 1
𝐿 = 𝑅( ) + 𝑞(𝑡) = 𝑉𝑠 (𝑡)
𝑑𝑡2 𝑑𝑡 𝐶

Taking Laplace transform, assuming Vs = u(t) [unit step response];


1
𝐿𝑠2𝑄(𝑠) + 𝑅𝑠𝑄(𝑠) + 𝑄(𝑠) = 𝑉 (𝑠)
𝑠
𝐶

𝑄(𝑠) = (1/𝐿)
𝑉 (𝑠) 𝑅𝑠 1
𝑠 𝑠2 + 𝐿 + 𝐿𝐶
8

BLOCK DIAGRAM/CODE:

1. MATLAB initialization parameters and Code:

Parameter initialization in MATLAB:


Parameters:
 R=3 Ohm
 L=1 H
 C= 0.05 F
Code:
>>R=3;
>>L=1;
>>C=0.05;

>>num=[1/L];
>>den=[1 R/L 1/(L*C) ];
>>G=tf(num,den);
>>step(G);

>>[w,zeta,p]=damp(G);
>>tau=1./w; %time constant

2. Simulink model:
9

OBSERVATIONS:

1. MATLAB code:

2. Simulink:
10

MEASUREMENTS VALUES
30.921%
Overshoot
0.658%
Pre shoot
9.302%
Undershoot
317.030 ms
Rise Time

Theory:

 We know that current lags in the inductor, leads in capacitor and is in phase in
resistor.
 Here, the graph is divided into transient and steady state regions, where the
transient state is influenced by initial conditions(R,L,C), while the steady state
component remains unchanged.
 Hence from the graphs, we can observe the under damping of the wave,
before reaching a steady state value. By changing the values of R, L and C, we
can change the damping ratio and in turn the response as well.

RESULT:

Thus, for a series RLC electrical circuit, the transfer function was
obtained, and the corresponding Simulink model and MATLAB code
was designed. For a step input, the resultant graph was plotted and
analyzed.
11

EXP 4: System Identification through Process Reaction


Curves
AIM:
To identify the given system using the process reaction curve using Simulink.
APPARATUS:

S.no Software Version

1. MATLAB R2021

2. Simulink -

FORMULA/THEORY:
A process reaction curve will be generated in response to a disturbance. This
process curve is then used to calculate the controller gain, integral time, and
derivative time. It is performed in open loop so that no control action occurs,
and the process response can be isolated.

To generate a process reaction curve, the process can reach steady state or as
close to steady state as possible. Then, in open loop, so that there is no control
action, a small step disturbance is introduced, and the reaction of the process
variable is b recorded.

For an oscillatory reaction curve, the dimensionless equation for model 1 will
be adopted. To distinguish between process models that do not have a process
zero (where 𝑎̅ = 0) and those which do have a zero (where 𝑎̅≠ 0) the following
lemma is needed.
12
13
14

BLOCK DIAGRAM:

1. Simulink model:

OBSERVATIONS:

1. Simulink:
Process A:

Process B:
15

S.no Parameters Process A Process B


tm,0 2.897s 3.297s
1.
tp,1 10.33s 8.531s
2.
yp,1 1.206 1.385
3.
tp,2 24.73s 22.73s
4.
yp,2 1.005 1.01
5.
ym,1 0.97097 0.95816
6.
p 14.4 14.3
7.

CALCULATIONS:

1. Process A:

1 1.005 − 1
𝜒= 𝑙𝑛 ( )
10.33 − 24.73 1.206 − 1

𝝌 = 𝟎. 𝟐𝟓𝟖

ln(1.206 − 1)2
𝜍= √
𝜋2 + (𝑙𝑛1.206 − 1)2

𝝇 = 𝟎. 𝟒𝟒𝟗

14.4
𝑟=
√4𝜋2 + 14.42 ∗ 0.2582

𝑟 = 𝟏. 𝟗𝟕𝟐𝟕
16

1.9727
𝜃 = 10.33 + ln(1.206 − 1)
0.449

𝜽 = 𝟑. 𝟑𝟗

2. Process B:

1 1.01 − 1
𝜒= 𝑙𝑛 ( )
8.331 − 22.73 1.385 − 1

𝝌 = 𝟎. 𝟐𝟓𝟕

14.199 ∗ 0.257
𝜍=
√4𝜋2 + 14.1992 ∗ 0.2572

𝝇 = 𝟎. 𝟓

14.199
𝑟=
√4𝜋2 + 14.1992 ∗ 0.2572

𝑟 = 𝟏. 𝟗𝟓𝟒

1.385 − 1 2
𝑎′ = 0.5 + √0.52 + (1 − ( ) )
𝑒−0.5∗8.531

𝒂′ = 𝟏. 𝟓𝟑𝟗

14.199 1.539√1 − 0.52


𝜃 = 8.537 − (π − tan−1 ( ))
6.28 1 − 1.539 ∗ 0.5
𝜽 = 𝟒. 𝟔𝟓𝟕
17

S.no Parameters Process A Process B

1. ς 0.449 0.5

2. χ 0.258 0.257

3. τ 1.9727 1.954

4. a’ 0 1.539

5. θ 3.39 4.657

Thus, the equation of process A is:


𝑒−3.39𝑠
3.88𝑠2 + 1.771𝑠 + 1
The equation of process B is:
(1 + 1.539𝑠)𝑒−4.6575
3.818𝑠2 + 1.954𝑠 + 1

INFERENCE:
 From the graphs, we can analyze the process curve and obtain the necessary
parameters.
 The damping ratio for both the processes reinforce the fact that the curves are
under damped.
 The delay time θ is higher for process B and it is indicative for the fact that
process reaction curve for process B takes longer than that of A.

RESULT:

Thus, using Simulink, it was possible to obtain the process reaction curves of the
given process. The parameters were obtained from the graph and additional
values were calculated as well. Thus, the resultant equations of the processes
were modeled from these values as well.
18

EXP 5: Stability Analysis using Pole Zero maps and


Routh Hurwitz Criterion in simulation platform
AIM:
To observe the system stability using Routh Hurwitz Criterion and pole zero
maps, and to model it using MATLAB.

APPARATUS:

S.no Software Version

1. MATLAB R2021

2. Simulink -

THEORY:

The Routh Hurwitz Criterion is an analytical procedure for determining whether


the roots of a polynomial have negative real part or not. The criterion states that:

The necessary and sufficient condition for stability is that all the elements
in the column of a Routh array be positive. If the condition is not met, the
system is unstable and the number of the sign changes in the elements of
the first column of the Routh array corresponds to the number of roots in
the characteristic equation in the right half of the s-plane.

Thus, if all the roots are placed in the left side of s-plane, then the system is
stable. Even if some roots are placed on the right side of the s-plane, then the
system becomes unstable.

Here, Wewill model a MATLAB program and plug in the values.


19

CALCULATION:
𝟐𝟓
𝑮(𝒔) =
𝒔𝟐+𝟔𝒔

The characteristic equation is: 𝑠2 + 6𝑠 + 25 = 0

s2 1 25
6
s1
25
s0
Since there are no sign changes in the first column of the Routh array, the
system is ‘Stable’. Both roots lie on the left half of s-plane.

Number of Zeros: 0
Number of Roots: 2 [0, -6]
20

MATLAB CODE:

𝟐𝟓
𝑮(𝒔) = 𝒔𝟐+𝟔𝒔

clear;
close all;
clc;
format compact;

% Taking coefficients vector and organizing the first two rows

coeffVector = input (‘input vector of your system coefficients: \n i.e. [an an-
1 an-2 ... a0] = ‘);
ceoffLength = length(coeffVector);
rhTableColumn = round(ceoffLength/2);

% Initialize Routh-Hurwitz table with empty zero array

rhTable = zeros(ceoffLength,rhTableColumn);

% Compute first row of the table

rhTable (1,: ) = coeffVector(1,1:2:ceoffLength);

% Check if length of coefficients vector is even or odd

if (rem(ceoffLength,2) ~= 0)
% if odd, second row of table will be
rhTable(2,1:rhTableColumn – 1) = coeffVector(1,2:2:ceoffLength);
else
% if even, second row of table will be
rhTable (2,: ) = coeffVector(1,2:2:ceoffLength);
end
21

%% Calculate Routh-Hurwitz table’s rows

% Set epss as a small value

epss = 0.01;

% Calculate other elements of the table

for I = 3:ceoffLength

% special case: row of all zeros


if rhTable(i-1, : ) == 0
order = (ceoffLength – i);
cnt1 = 0;
cnt2 = 1;
for j = 1: rhTableColumn – 1
rhTable(i-1,j) = (order – cnt1) * rhTable(i-2,cnt2);
cnt2 = cnt2 + 1;
cnt1 = cnt1 + 2;
end
end

for j = 1:rhTableColumn – 1
% first element of upper row
firstElemUpperRow = rhTable(i-1,1);

% compute each element of the table


rhTable(I,j) = ((rhTable(i-1,1) * rhTable(i-2,j+1)) - ....
(rhTable(i-2,1) * rhTable(i-1,j+1))) / firstElemUpperRow;
end

% special case: zero in the first column


if rhTable(I,1) == 0
rhTable(I,1) = epss;
end
end
%% Compute number of right hand side poles(unstable poles)

% Initialize unstable poles with zero


22

unstablePoles = 0;

% Check change in signs

for I = 1:ceoffLength – 1
if sign(rhTable(I,1)) * sign(rhTable(i+1,1)) == -1
unstablePoles = unstablePoles + 1;
end
end

% Print calculated data on screen

fprintf (‘\n Routh-Hurwitz Table:\n’)


rhTable

% Print the stability result on screen

if unstablePoles == 0
fprintf (‘~~~~~> it is a stable system! <~~~~~\n’)
else
fprintf (‘~~~~~> it is an unstable system! <~~~~~\n’)
end
fprintf (‘\n Number of right hand side poles =%2.0f\n’,unstablePoles)
reply = input (‘Do you want roots of system be shown? Y/N ‘, ‘s’);
if reply == ‘y’ || reply == ‘Y’
sysRoots = roots(coeffVector);
fprintf (‘\n Given polynomial coefficients roots :\n’)
sysRoots
end

H1=tf([0 0 25],[1 6 0])


pzmap(H1)
grid on
23

OBSERVATIONS:

1. Code:
𝟐𝟓
𝑮(𝒔) = 𝒔𝟐+𝟔𝒔

input vector of your system coefficients:


i.e. [an an-1 an-2 ... a0] = [1 6 25]

Routh-Hurwitz Table:
rhTable =
1 25
6 0
25 0
~~~~~> it is a stable system! <~~~~~

Number of right hand side poles = 0


Do you want roots of system be shown? Y/N y

Given polynomial coefficients roots :


sysRoots =
-3.0000 + 4.0000i
24

-3.0000 - 4.0000i

H1 =

25
--- - -
s^2 + 6 s

Continuous-time transfer function.


25

INFERENCE:

 For a stable system, the roots of the characteristic equation must have negative
real parts.
 If any root of the characteristic equation has a positive real part or if there is a
repeated root on the imaginary axis, then the system is unstable.
 If all the roots of the characteristic equation have negative real parts except for
the presence of one or more non repeated roots on the imaginary axis, then the
system is limitedly or marginally stable.
 The pole zero map also reinforces the above conditions, in a graphical manner.

RESULT:

Thus, the system stability of different systems was observed by implementing


pole zero maps and Routh Hurwitz criterion, using MATLAB.
26

EXP 6: Root Locus Based Analysis in Simulation Platform


AIM:
To analyze the Root Locus plot of a given system using MATLAB.
APPARATUS:

S.no Software Version

1. MATLAB R2021

THEORY:
The root locus technique in control system was first introduced in the
year 1948 by Evans. Any physical system is represented by a transfer
function in the form of

We can find poles and zeros from G(s). The location of poles and zeros are crucial
keeping view stability, relative stability, transient response, and error analysis.
When the system is put to service stray inductance and capacitance get into the
system, thus changes the location of poles and zeros.

In root locus technique in control system, we will evaluate the position of the
roots, their locus of movement and associated information. This information will
be used to comment upon the system performance.

Some of the advantages of root locus technique are:

1. Root locus technique in control system is easy to implement as


compared to other methods.
2. With the help of root locus, we can easily predict the performance of
the whole system.
3. Root locus provides the better way to indicate the parameters.
27

Procedure to Plot Root Locus:

Keeping all these points in mind we are able to draw the root locus plot for any
kind of system. Now let us discuss the procedure of making a root locus:

 Find out all the roots and poles from the open loop transfer function and
then plot them on the complex plane.

 All the root loci start from the poles where k = 0 and terminates at the
zeros where K tends to infinity. The number of branches terminating at
infinity equals to the difference between the number of poles & number
of zeros of G(s)H(s).

 Find the region of existence of the root loci from the method described
above after finding the values of M and N.

 Calculate break away points and break in points if any.

 Plot the asymptotes and centroid point on the complex plane for the root
loci by calculating the slope of the asymptotes.

 Now calculate angle of departure and the intersection of root loci with
imaginary axis.

 Now determine the value of K by using any one method that I have
described above. By following above procedure, you can easily draw the
root locus plot for any open loop transfer function.

 Calculate the gain margin.

 Calculate the phase margin.

 You can easily comment on the stability of the system by using Routh
Array.
28

MATLAB CODE:

1. Code:

1
1. 𝑠3+6𝑠2+45𝑠
29

0.075𝑠2+𝑠+1
2.
𝑠3+3𝑠2+5𝑠

OBSERVATIONS:

1. Code:

1
1.
𝑠3+6𝑠2+45𝑠
30

0.075𝑠2+𝑠+1
2.
𝑠3+3𝑠2+5𝑠

INFERENCE:
 Note that if the denominator of G(s) and the numerator of H(s) involve common
factors then the corresponding open-loop poles and zeros will cancel each other,
reducing the degree of the characteristic equation by one or more.
 A slight change in the pole-zero configuration may cause significant
changes in the root- locus configurations.
 The cancelled pole of G(s)H(s) is a closed-loop pole of the system and this must
be added to the closed-loop poles obtained from the root-locus plot of G(s)H(s).
 General effects of the addition of zeros:

o pull root locus to the left


o makes system more stable
o speed up the settling of the response
31

 General effects of the addition of poles:

o pull root locus to the right


o lower system’s relative stability
o slow down the settling of the response

RESULT:

Thus, the Root Locus analysis is done on the given systems using MATLAB, and
the corresponding characteristics and graphs were obtained and studied.
32

EXP 7: Frequency Response Analysis of a 3rd Order


System Using Bode Plot
AIM:
To analyze the frequency response of a 3rd order system from the Bode Plot.
APPARATUS:

S.no Software Version

1. MATLAB R2021
33

A) Bode plot A
34

B) Bode plot B

TABULATION:

s.no Parameters Bode Plot A Bode Plot B


Gain Margin 48Db infinite
1.
𝜔𝑐𝑔 6.7 rad/s -
2.
Phase Margin 89.8° 94.5°
3.
𝜔𝑐𝑝 0.022rad/s 0.203rad/s
4.

INFERENCE:

 For both the system the phase starts at -90 and hence there is a pole at the
origin for both the systems.

 From the tabular column Gain margin for A is 48dB and that for B it is infinity.
35

Generally, for stability Gain margin is expected to be more.

 Since for the magnitude Bode plot B the Gain margin is infinity it is inferred
that it is a very stable system, but the response is sluggish with no
oscillations. It is a very stable system because infinite gain can be increased
or decreased, and the stability of the system won’t be affected

 For the bode plot B 48db can be increased or decreased till the system
becomes unstable.

 Greater the phase margin greater the stability of the system. The phase
margin of B is > than the phase margin of A.

 The greater stability of B over A is because B can tolerate a maximum


phase change of 94 degrees without making the system unstable
whereas A can tolerate a maximum of 84degrees without making the
system unstable.

RESULT:

Thus, the 3rd order system was analyzed using bode plot and the frequency
parameters were tabulated
36

EXP 8: Determination of Transfer Function of a Physical


System using Frequency Response and Bode’s
Asymptotes
AIM:
To determine the transfer function of a physical system from the given frequency
response curve (Bode plot).

APPARATUS:

S.no Software Version

1. MATLAB R2021

FORMULA/THEORY:
Frequency response is the quantitative measure of the output
spectrum of a system inresponse to a stimulus, usually a sinusoidal
input, and is used to characterize the dynamics of the system.
Frequency response analysis is the technique whereby a sinusoidal test
signal is usedto measure points on the frequency response of a transfer
function.

It is sometimes useful, while working on experimental data obtained


from physicalsystems, to reverse engineer the frequency response
analysis, i.e., obtaining the transfer function of a system from a given
Bode plot. This is possible because, the Bode plot completely gives the
frequency domain parameters. From the magnitude and phase plots, it
is possible to determine the no. of poles andzeros, the relative order of
the system, the break frequencies of the poles and zeros and the open-
loop system gain.
37

CALCULATION:

To determine the Transfer function of the above plot:

1. Relative order of the system:

 The phase plot ends at −180.

 Thus, the system has 2 more poles than zeros.

2. Number of zeros and poles:

 From the magnitude plot, there are no slope changes from


negative to positive (+20 dB/dec). Thus, the system has no zeros.

Number of poles=2
Number of zeros=0

3. Location of poles and zeros:

 From the magnitude plot, it can be seen that the slope with
which it starts is -20 dB/dec. Thus, the system is a type-1 system,
i.e., it has a pole at 𝑠 = 0. This can also be said from the fact that
the phase plot begins at −90°.

 Secondly, we need to look for change in slope and the corresponding


frequency. From the magnitude plot, it is clear that at 𝜔𝑐𝑝1 = 0.5 𝑟𝑎𝑑/𝑠,
there is a change in slope from −20 𝑑𝐵/𝑑𝑒𝑐 𝑡𝑜−40 𝑑𝐵/𝑑𝑒𝑐. Thus, 𝜔𝑐𝑝1is a
break frequency.
38

4. Finding Gain:

 From the magnitude plot, 𝜔𝑠 = 0.1 𝑟𝑎𝑑/𝑠 and 𝑀 = 34 𝑑𝐵. Thus:

 Thus, the transfer function is given by:


39

MATLAB CODE:

>> sys = tf([5], [2 1 0])


>> figure (1)
>>bode(sys)
>>title ('Bode Plot of G(s)')
>>figure (2)
>>asymp(sys)
>>title ('Asymptotic Bode Plot of G(s)')

MATLAB:
40

INFERENCE:
 A pole contributes −90° to the phase plot because:

 The time constant form of the transfer function is:


41

 This method of finding the transfer function is immensely helpful when working
with experimental data. From the data, the Bode plot can be obtained and thus,
the transfer function of the system can be easily obtained.

RESULT:

Thus, the transfer function of the given system was found using frequency
response and Bode’s asymptotes.
42

EXP 9: Design of Lag, Lead compensators and Evaluation


of Closed Loop Performance
AIM:
To design Lag, lead compensators and evaluation of closed loop
performance for the given system using MATLAB.
APPARATUS:

S.no Software Version

1. MATLAB R2021

FORMULA/THEORY:

1. Lead compensator:

The lead compensator is an electrical network which produces a sinusoidal output


having phase lead when a sinusoidal input is applied. The lead compensator circuit
in the ‘s’ domain is shown in the following figure. Here, the capacitor is parallel to
the resistor R1 and the output is measured across resistor R2.

The transfer function of this lead compensator is –


43

We know that the phase of the output sinusoidal signal is equal to the sum of the
phase angles of input sinusoidal signal and the transfer function. So, to produce
the phase lead at the output of this compensator, the phase angle of the transfer
function should be positive. This will happen when 0<β <1. Therefore, zero will be
nearer to origin in pole-zero configuration of the lead compensator.

2. Lag Compensator:

The Lag Compensator is an electrical network which produces a sinusoidal output


having the phase lag when a sinusoidal input is applied. The lag compensator
circuit in the ‘s’ domain is shown in the following figure.
44

Here, the capacitor is in series with the resistor R2 and the output is measured
across this combination.

From the transfer function, we can conclude that the lag compensator has one
1 1
pole at 𝑠 = − and one zero at 𝑠 = − . This means, the pole will be nearer to
𝑐𝛼 𝛼
origin in the pole-zero configuration of the lag compensator.
Substitute, 𝑠 = 𝑗𝜔 in the transfer function.
45

PROCEDURE:

Q1. The open loop transfer function of certain unity feedback control system is given by
G(s) = K/s(s+4) (s+80). It is desired to have the phase margin to be at least 33° and the
velocity error constant Kv= 30 sec-1. Design a phase lag series compensator.

ANS:

1. Determining the value of K.

2. The bode plot of the uncompensated system.


3. The phase margin is calculated.
4. Suitable values for the phase margin of the compensated system.
5. New gain crossover frequency is determined.

6. The value 𝛽 of the compensator is determined.

7. The transfer function of lag compensator is determined.


The zero of the compensator is arbitrarily placed at one tenth of the new
gain crossover frequency. Where Zc and Pc is the zero and pole of the
compensator.

The TF is given as follows

8. The open loop response is generated by placing the plant in series with the lag
compensator.
46

The actual phase margin is calculated at the new gain crossover frequency.

Q2. Design a lead compensator for a unity feedback system with open loop transfer
function, G(s) = K/s(s+8) to satisfy the following specifications (i) percentage peak
overshoot = 9.5% (ii) natural frequency response, ωn = 12 rad/sec (iii) Velocity error
constant Kv ≥ 10.
ANS:
1. Determination of the dominant pole with the given parameters

2. The pole zero plot is drawn.


3. Angle contributed by the lead network

4. The poles and zeroes of the compensator are found

5. Determination of the TF of the compensator

6. Determining the open loop transfer function of the lead compensated system

The lead compensator is connected in series with the plant the value of K is
determined by the above formula. And the vector lengths from all poles are
represented as l1,l2,l4 and for zeroes it is l3.
7. The check for error requirement is done.
47

MATLAB CODE:

Q1.
>> Kv = 30
>> K = Kv * 4 * 80
>> G=tf(K, conv([1 4 0],[1 80]))
>> [Gm Pm] = margin(G)
>> margin(G)
>> Pd = 33
>> Pd = Pd + 5
>> Phgcm = -142
>> wgcm= 4.58 % from the first bode plot use the mouse pointer and locate wgcm
corresponding to phgcm.
>> [Beta,p]=bode(G,wgcm)
>> T=10/wgcm
>> Zc=1/T
>> Pc=1/(Beta*T)
>> Gc=tf([1 Zc],[1 Pc])
>> sys=Gc*G/Beta
>> figure(1)
>> margin(G)
>> hold on
>> margin(sys)
>> legend('Without Compensator', 'With Lag compensator')
>> figure(2)
>> step(feedback(G,1))
>> hold on
>> step(feedback(sys,1))
>> legend('Without Compensator', 'With Lag compensator')

Q2.
>> Mp=9.5
>> e=log(Mp)*sqrt(1/(pi^2+(log(Mp)^2)));
>> w=12;

%open loop poles

>> s1 = 0
>> s2 = -8
48

%Dominant pole

>> sd1=-e*w+j*w*sqrt(1-e^2)
>> sd2=-e*w-j*w*sqrt(1-e^2)
>> theta1=angle(sd1 - s1)
>> theta2=angle(sd1 - s2)
>> phi = theta1 + theta2 - 3.14
>> phi1 = (phi)/2

%finding the pole and the zero

>> m2 = tan(theta1/2 - phi1)


>> x = [linspace(-100,100)]
>> syms k
>> eqn = m2*(k + 7.2) + 9.6 == 0;
>> Pc = double(solve(eqn)); % X values where y=0
>> m3 = tan((theta1/2) + phi1)
>> syms k
>> eqn = m3*(k + 7.2) + 9.6 == 0;
>> Zc = double(solve(eqn)); % X values where y=0
>> T=-1/Zc;
>> a=-1/(Pc*T);
>> s=tf('s');
>> G=(s+1/T)/(s+1/(a*T));
>> l1 = abs(sd1 - s1)
>> l2 = abs(sd1 - s2)
>> l3 = abs(sd1 - Zc)
>> l4 = abs(sd1 - Pc)

>> K=(l1*l2*l4)/l3;
>> G=K*G/(s*(s+8))
>> sys=K/(s*(s+8))
>> figure(1)
>> margin(sys)
>> hold on
>> margin(G)
>> legend('Uncompensated','Compensated')
>> figure(2)
>> step(feedback(sys,1))
>> hold on
49

>> step(feedback(G,1))
>> legend('Without Compensator', 'With Lead compensator')

OBSERVATION:

Q1.
50

Q2.
51

TABULATION:

Parameters Q1 Q2
Uncompensated Compensated Uncompensated Compensated
0.1064 0.2525 0.1110 0.1432
Rise time(s)
2.9940 2.3096 0.9089 0.4917
Settling
Time(s)
68.2050 40.4974 33.7293 12.6234
Overshoot(%)
0.2895 0.649 0.2763 0.3137
Peak time(s)
1.6821 1.4050 1.3373 1.1262
Peak Value

INFERENCE:

 Lag compensators reduce the gain crossover frequency of the system. Thus,
the system response becomes slower.

 Lag compensators reduce the high frequency gain of the system. Hence, the
high frequency noise attenuation becomes better.
52

 The time constant of the lag compensator should not be unnecessarily large.
Otherwise, the system's response will be too slow.

 From the observation table for the first question Lag compensators allow a
high gain at low frequencies and thus improve the steady state error.

 From the observation table the presence of a lead compensator increases the
gain of the system at high frequencies (the amount of this gain is equal to a).

 This can increase the crossover frequency, which will help to decrease the rise
time and settling time of the system (but may amplify high frequency noise).

 In a lead compensated design additional positive phase increases the phase


margin and thus increases the stability of the system.

 And it is seen that the gain margin of lead compensated system is infinity.
A gain margin of infinity means that no matter how much you increase
the gain, the system will always be stable.

 Due to the presence of phase lead compensation maximum overshoot of the


system decreases.

 The general comparison is summarized below:

o If the design specifications are given in terms of steady state error and
phase margin, either the lead or the lag compensator may be able to
meet the requirement.
o However, if specification on rise time or gain crossover frequency is
also to be met, then only one of the two compensators would be able
to do the job. Or we need to combine lag and lead compensator.

RESULT:

Thus, the lead and lag compensators were designed as per the requirements and
their closed loop performance was analyzed. The corresponding graphs were also
plotted and analyzed.
53

EXP 10: Design of PID controllers and Evaluation of


Closed Loop performance
AIM:
To design PI, and PID controllers and evaluate their closed loop performance.

APPARATUS:

S.no Software Version

1. MATLAB R2021

FORMULA/THEORY:

DESIGNING A PI/PID CONTROLLER ACCORDING TO GIVEN


SPECIFICATIONS:
 The most common way of tuning a P/PI/PID controller is using
Ziegler-Nichol’s technique, but that method cannot be used if
design specifications are given. 
 Two types of specifications can be given:
 In frequency domain, like phase margin
 In time domain, like damping ratio, steady state error
 We employ two different methods of design depending on the
type ofspecification given.

For a PI controller:

Step 4:
Determine open loop transfer function of compensated system.
54

For time domain specifications:

When the damping ratio 𝜁, error constant and natural frequency 𝜔d are the
design parameters, the following steps are followed:

Step 1:

Determine the dominant pole 𝑠d and calculate its magnitude and phase:

By considering the dominant pole

Step 2:

Determine magnitude and phase of G(s) at 𝑠=𝑠d.

Step 3:
Determination of transfer function of PI/PID controller

For PI controller:

For PID controller:


𝐺 (𝑠) = 𝐾 + 𝑠𝐾 𝐾𝑖
+
𝑐 𝑝 𝑑
𝑠

Determine 𝐾i from the specified error constant, such that the compensated
system meets the error requirement.
Calculate the parameter 𝐾D and 𝐾P using the following equations
55

Step 4:
Determine open loop transfer function of compensated system
Questions Given:

1. Consider a unity feedback system with open loop transfer function G(s) =
100/(s+1)(s+2)(s+5). Design a PI controller, so that the phase margin of the
system is 60° at a frequency of 0.5 rad/sec.
56

2. Consider a unity feedback system with open loop transfer function G(s) = 75/
(s+1)(s+3)(s+8). Design a PID controller to satisfy the following specifications
(a) steady state error for unit ramp input should be less than 0.08, (b)
Damping ratio = 0.8 (c) Natural frequency of oscillation = 2.5 rad/sec.

MATLAB CODE:
For 1st question:

>> PM=60/57; %60 degrees converted to radians


>> w=0.5;
>> s=tf('s');
>> G=10/((s+1)*(1+0.5*s)*(1+0.2*s))
>> G1=10/((j*w+1)*(1+0.5*j*w)*(1+0.2*j*w))
>> M1=abs(G1)
>> theta1=(angle(G1))

%finding phase margin and theta2

>> PM1=3.14+(theta1)
>> theta2=PM-PM1

%determining constants

>> Ki=(-w*sin(theta2))/M1
>> Kp=cos(theta2)/M1
>> contr=pid(Kp,Ki)
>> OL=contr*G
>> figure(1)
>> step(feedback(G,1))
>> hold on
>> step(feedback(OL,1))
>> legend('Without controller', 'With controller')
>> figure(2)
>> subplot 211
>> rlocus(OL)
>> title('Root Locus of G(s)')
57

>> subplot 212


>> rlocus(G)
>> title('Root locus of compensated system')
58

For 2nd question:

>> e=0.8;
>> ess=0.08;
>> w=2.5;
>> s=tf('s');
>> G=75/((s+1)*(s+3)*(s+8));

%Dominant pole

>> sd1=-e*w+j*w*sqrt(1-e^2)
>> sd2=-e*w-j*w*sqrt(1-e^2)
>> M1=abs(sd1)
>> theta1=angle(sd1)

%Magnitude and Phase of G(s) at s=sd

>> G1=75/((sd1+1)*(sd1+3)*(sd1+8));
>> M2=abs(G1)
>> theta2=angle(G1)

%Determining the constants

>> Kv=1/ess
>> Ki=Kv/3.125
>> Kd=(sin(theta2)/(M1*M2*sin(theta1)))+(Ki/M1^2)
>> Kp=(-sin(theta2+theta1)/(M2*sin(theta1)))-(2*Ki*cos(theta1)/M1)

%Finding the TF

>> cont=pid(Kp,Ki,Kd)
>> OL=G*cont
>> figure(1)
>> step(feedback(G, 1))
>> hold on
>> step(feedback(OL, 1))
>> legend('No controller', 'With controller')
>> figure(2)
>> subplot 211
>> rlocus(OL)
>> title('Root Locus of G(s)')
59

>> subplot 212


>> rlocus(G)
>> title('Root locus of compensated system')

OBSERVATIONS:

First question:
60

Second question:
61

TABULATIONS:

s no Settling Time(s) Steady state error

Without With Without With


Controller Controller Controller Controller

1. 21.8 8.04 0.091 0

2. 1.94 2.73 0.55 0

3. 2.7 1.28 0.242 0

INFERENCE:

 From the observations, a PI/PID controller always makes the steady state
error vanish.
 From the plots obtained, the system’s closed loop step response reaches
steady state more quickly, except in the case of controller 2, where the design
specification led to the settling time being higher than the uncompensated
system.
62

 From the Bode plot of controller 1, we can see that the design specification of
phase margin has been met, thus, the controller is functioning properly.
 From the root locus plots of the compensated and uncompensated systems,
we can see that the addition of the poles/zeros by the controller pulls the root
locus towards the left so that it can accommodate the necessary gains.
 The step responses inform us about the closed loop performance of the
system. The primary goal of any system is to obtain the desired response, i.e.,
the input. More the system is close to the input, more closed loop stable it is.

RESULT:

Thus, the PI and PID controllers were designed and their corresponding closed
loop performance was analyzed.
63

EXP 11: Discretization of a Continuous System and the


Effect of Sampling
AIM:
To discretize the given continuous system and analyze the effect sampling using
MATLAB.

APPARATUS:

S.no Software Version

1. MATLAB R2021

FORMULA/THEORY:
Discretization is the process of transferring continuous functions, models,
variables, and equations into discrete counterparts. This process is usually
carried out as a first step toward making them suitable for numerical
evaluation and implementation on digital computers. It must be made clear
that, while discretizing a system, information/data is always lost. Thus,
depending on the necessities, there can be different methods of discretizing a
system.
64

QUESTIONS:
Q1. Determine the z-domain transfer function for the following s-domain transfer
function.

Discretize the given continuous system and study the effect of sampling.
PROCEDURE:
Conversion to s-domain:
Step 1: Take Inverse Laplace transform of H(s)

Step 2: Sample the continuous response by setting t = nT where T – sampling


time:

Step 3: Finding the z-transform


65

MATLAB CODE:

>> a = 2;
>> e = 2.71;
>> i = 1;
>> t = 0.3;
>> s = tf('s');
>> z = tf('z');

>> %converting s-domain to z-domain

>> h = a/(s+a)^2;
>> disp("The s-domain transfer function converted to s-domain is: ")
>> sys = c2d(h, 1, 'impulse')
>> step(h)
>> hold on

>> while(t <= 2.7)


>> f=(a*t*z*e^(a*t))/((z*e^(a*t)-1)^2); %from theory
>> step(f)
>> hold on
>> t = t*3;
>> end
>> legend('s-domain','Ts = 0.3','Ts=0.9','Ts=2.7')
>> t = 1;
>> i = 1;
>> Ar = [2 4 6];

>> while(a<=6)
>> figure(i+1)
>> h = a/(s+a)^2;
>> f=(a*t*z*e^(a*t))/((z*e^(a*t)-1)^2);
>> step(h)
>> hold on
>> step(f)
>> legend(strcat('continuous: a=',num2str(Ar(i))), strcat('discrete:
a=',num2str(Ar(i))))
>> i = i+1;
>> a= a+2;
66

>> end

OBSERVATION:

𝑃𝑙𝑜𝑡 1: 𝐹𝑖𝑥𝑒𝑑 𝑎, 𝑣𝑎𝑟𝑦𝑖𝑛𝑔 𝑠𝑎𝑚𝑝𝑙𝑖𝑛𝑔


𝑡𝑖𝑚𝑒

𝑃𝑙𝑜𝑡 2: 𝑎 = 2, 𝑇𝑠 = 1
67

𝑃𝑙𝑜𝑡 3: 𝑎 = 4, 𝑇𝑠 = 1

𝑃𝑙𝑜𝑡 4: 𝑎 = 6, 𝑇𝑠 = 1
68

INFERENCE:

 If the signal is slowly varying, then fewer samples per second will be required
than if the waveform is rapidly varying.
 The major drawback of random undersampling is that this method can
discard potentially useful data that could be important for the induction
process.
 It can be seen that undersampling causes poor resolution and the step
response is not smooth as well.
 As the sampling time increases the resolution gets clearer. This is because of
Oversampling. It can be inferred that oversampling helps in improving the
resolution and also data is not discarded
 From the above it can be inferred that:
1. Oversampling methods duplicate or create new synthetic examples in the
minority class.
2. Undersampling methods delete or merge examples in the majority class.

 As the ‘a’ in the equation increases, the resolution increases in the step response
of the z domain

RESULT:

Thus, the given continuous system (in the form of transfer function) was
converted to z- domain and was discretized. The effect of sampling was studied
using the step response plots.
69

EXP 12: Test of Observability and Controllability in


Continuous and Discrete Domain in Simulation Platform
AIM:
To test the controllability and observability of a given system in both s and z
domain using MATLAB.

APPARATUS:

S.no Software Version

1. MATLAB R2021

FORMULA/THEORY:

Controllability and observability are two important properties of state models


which are integral to the designing of a controller. These two properties suggest
what modifications should be made to the plant (actuators and sensors) so that
the desired action is achieved.

Controllability deals with the possibility of forcing the system to a particular state
by application of a control input. More formally, if a state is controllable, it means
that there exist some control signals that allow the system to reach any state in a
finite amount of time. It is also known as reach ability. If a state is uncontrollable,
then no input will be able to control that state.
On the other hand, whether the initial states can be observed from the output
or not is determined using observability property. If all states of a system can
be known from the system output, then the system is observable.
70

Controllability:

Consider a dynamic system as follows:

The state equation (or the pair (A, B)) is said to be completely state
controllable or simply state controllable if for any initial state x(0) and any
final state x(N), there exists an input sequence u(k), k = 0, 1, 2, · · · , N, which
transfers x(0) to x(N) for some finite N. Otherwise the state equation is state
uncontrollable.

1. The state equation (1) or the pair (A, B) is state controllable if and
only if the n × np state controllability matrix has rank n, i.e., full row
rank.
The state controllability matrix is given as follows:
𝑈𝑐 = [𝐵 𝐴𝐵 𝐴2𝐵 … … … 𝐴𝑛−1 𝐵]
The full rank condition can also be stated as follows: If the
determinant of the the controllability matrix is zero, then the matrix
is full rank.

2. When the matrix ‘A’ has distinct eigenvalues and in Jordan/Diagonal


canonical form, the state model is controllable if and only if all the rows
of matrix ‘B’ are non-zero.

Observability:
The state model (or the pair (A, C) ) is said to be observable if any initial state x(0)
can be uniquely determined from the knowledge of output y(k) and input
sequence u(k), for k = 0, 1, 2, · · · , N, where N is some finite time. Otherwise, the
state model is unobservable.
71

1. The state model (1) or the pair (A, C) is observable if the np × n


observability matrix has rank n, i.e., full column rank.

2. If the state model is in observable canonical form, then the system is


observable.

QUESTIONS:
Q1. Test the controllability and observability of the given system in both continuous
and discrete domain.
Given characteristic equation: 5𝑧2 − 2𝑧 + 2 = 0

Assume: It is a unity feedback system.

PROCEDURE:
Finding the transfer function:
We know that any transfer function is of the form:

Here, as it is unity feedback, H(z) = 1.


72

The characteristic equation of the above transfer function is:

Thus,
The transfer function in z-domain is:

MATLAB CODE:

disp('To check controllability and observability in z-domain')


disp(' --- ---------------------------------------------------------------- ')
disp('Given characteristic equation: 5z^2 - 2z + 2 = 0')

H=tf([5,-2,1],[5,-2,2],0.1)
[b1 a1] = tfdata(H, 'v');
[A1,B1,C1,D1]=tf2ss(a1,b1);
g1=rank(ctrb(A1,B1));
g2=rank(obsv(A1,C1));
n = size(A1, 1);

if (g1==n || g2==n)
disp('Given system is both fully controllable and observable')
elseif (g1==n)
disp('Given system is fully controllable only')
elseif (g2==n)
disp('Given system is fully observable only')
else
disp('Given system is neither fully controllable nor observable')
end

fprintf('\n')
disp('To check controllability and obsevability in s-domain')
73

disp(' --- -------------------------------------------------------------- ')

sys=d2c(H) %converting given z domain tf to s domain


[a b] = tfdata(H, 'v');
[A,B,C,D]=tf2ss(b,a);
f1=rank(ctrb(A,B));
f2=rank(obsv(A,C));
n = size(A, 1);

if (f1==n || f2==n)
disp('Given system is both fully controllable and observable')
elseif (f1==n)
disp('Given system is fully controllable only')
elseif (f2==n)
disp('Given system is fully observable only')
else
disp('Given system is neither fully controllable nor observable')
end

OBSERVATION:
74

INFERENCE:

 If a continuous time system is controllable or observable, then its


discrete time version, with any sampling period, is controllable or
observable.
 If a continuous time system is not controllable or observable, then its
discrete time version, with any sampling period, is not controllable or
observable.
 Loss of controllability and/or observability occurs only in presence of
oscillatory modes of the system.
 Controllability is a black and white issue. That is a system can either be
completely controllable or not controllable.
 It is not always possible to observe all the states of a system in a real-life
scenario, in that case, only the critical cases are considered for observability.

RESULT:

Thus, the given system was tested for controllability and observability in both s
and z domain.
75

EXP 13: Design of State Feedback Controller and


Evaluation of Closed Loop Performance
AIM:
To design a full state feedback controller for the given systems described using
state-space and evaluate their closed-loop performance

APPARATUS:

S.no Software Version

1. MATLAB R2021

2. Simulink -

FORMULA/THEORY:
The state of a system is a minimal set of variables such that the knowledge of
these variables at a particular time t0, with the knowledge of the input(s) to the
system for t>t0, can completely determine the behavior of the system. The state
space approach is a method for modelling, analyzing, and designing a wide range
of both linear and non-linear systems. State space models use state variables to
describe a system by a set of first order differential equations.
A system is represented in state space by the following equations:
76

Question:
A single input system is described by the following equations:

Design a state feedback controller which will give closed loop poles at -1±j2, -6.
From the question, we can see that the given system will have 3 state variables. The
gain matrix ‘K’ can be found easily, as the closed loop poles, i.e., eigenvalues of the
matrix (A – BK) is given. An additional block ‘Kr’ can be added in cascade with the
reference input ‘r’ so that the steady state error of the total controlled system goes to
zero.

MATLAB CODE/BLOCK DIAGRAM:

Code:

>> A=[-1 0 0;1 -2 0;2 1 -3];


>> B=[10;1;0];
>> C=[1 0 1];
>> D=0;

%converts the matrices to state space form

>> sys=ss(A,B,C,D);

>> 'The eigenvectors/poles of the given system is:'

>> disp(eig(sys));

>> %pole placement

>> dp1=complex(-1,2);
77

>> dp2=complex(-1,-2);
>> dp3=-6;
>> dp=[dp1,dp2,dp3];
>> %Calculating Gain K

>> gainK=place(A,B,dp);

>> %new sys

>> sys_new=ss(A-B*gainK,B,C,D);
>> Kr = 1/dcgain(sys_new);
>> sys_new1=ss(A-B*gainK,B*Kr,C,D);

>> 'The eigenvectors/poles of the new state feedback-controlled system is:'

>> disp(eig(sys_new));
>> step(sys)
>> hold on
>> step(sys_new1)
>> hold on
>> plot(out.tout, out.Output, 'r')
>> legend('Without feedback','With state feedback');

Explanation:

 To convert given matrices to state space form, we use ss( ) function.


 The function eig( ) displays the eigenvalues of the system.
 The place( ) function computes the requires gain matrix K, in
accordance to the needed design parameter, i.e., the required pole
placement, which is given as input.
 The sys_new element is the new state space description of the
state-feedback controlled system.
 The constant Kr is computed to offset for the steady state error.
 Also, we plot the step response of the new system by transferring
datapoints fromSimulink via the block To Workspace.
78

1. Simulink Diagram:

OBSERVATION:
79

TABULATION:

q.no Type of Rise time(s) Settling Steady state


system Time(s) error
Without state 2.42 4.21 -17.5
1. feedback
With state 0.372 3.35 0
feedback

INFERENCE:

 The state feedback will work only for fully controllable systems. This is
because all the states of the system are fed back to the reference input,
and if the system is not controllable, then this feedback won’t properly
function.

 From the step response plot for state feedback, the step response for the
uncontrolled system has a higher rise time and has a negative steady-state
error, i.e., the output is higher than the value of the step input. Whereas,
with the state feedback, the rise time & settling time gets reduced, the
steady state error also goes to zero (This is due to the corrective gain term
Kr).

 Only one integrator is used in the Simulink model because all the gain
terms are modelled as Matrix K*u, so that the output can be
demultiplexed to obtain the different states.

 The method of pole placement is basically an upgraded version of the root locus
compensator design. In root locus, we have one gain that we can alter (i.e., ‘K’),
and we can move the positions of the poles only along the root locus. But here,
we have a gain matrix K and we have the entire s-plane to place our poles.
80

RESULT:

Thus, the state feedback controller was designed accordingly, and their closed
loop performance was analyzed.
81

EXP 14: State Observer and Evaluation of Closed Loop


Performance
AIM:
To design a full state observer for the given systems described using state-space
and evaluate their closed-loop performance.

APPARATUS:

S.no Software Version

1. MATLAB R2021

2. Simulink -
82

State observer design:


As we have already seen, an observer is designed to estimate the
unmeasurable states of a given system. The observer is an equivalent
system with the following state space description, whose sole purpose
is to estimate all the states of the system.

To ensure that the estimation of the state variables is accurate, the


observer is also fed with the error signal between the outputs, i.e., 𝑦(𝑡)
− 𝑦̂(𝑡), which is then multiplied with the gain matrix, L. Thus, the new
system takes the form:

The use of output feedback can be understood by considering the


approximation error. Let 𝜖(𝑡) denote the error of the approximation of
the state variables.

Substituting for the above equation from the previous equations, we get:

Converting to time domain:

This above equation means that, we choose the feedback gain matrix ‘L’
such that our system equation (A - LC) becomes stable, so that e(t) goes
to zero and the approximation is accurate.

In case of designing an observer, the eigenvalues of the observer will


have already been given. In that situation, with the matrices ‘A’ and
‘C’ known, and the characteristic equation of the observer system
known (as eigenvalues are known), we can find the feedback gain
matrix ‘L’ using linear algebra.
83

In MATLAB, this is done using the function acker( ) .

The quicker the approximation, better the observer system is. So,
based on the value of the gain matrix L, we will get quicker or slower
approximations. The process described above is same as the process
adopted for the state feedback controller design. So, it can be said
that both problems are mathematically the same. This property is
called duality.

Question:
84

 From the question, the given system will have 2 state variables.

 We will assume an initial condition of [1;1] for the system


because the output of the system is zero.

 We design the state observer exactly as the given


system without the initial conditions.

 The errors are calculated by feeding back the difference of the


outputs of the plant and observer via a gain matrix L.

 This matrix L is found in a similar way compared to the state feedback


controller.

MATLAB CODE/BLOCK DIAGRAM:

1. Code:

>> % Original Plant

>> a=[-1 1;1 -2];


>> b=[0;0];
>> c=[1 0];
>> d=0;

>> sys=ss(a,b,c,d);
>> eig(sys);
>> rank(obsv(sys));

>> % Observer pole placement at -5 and -5


>> L = acker(a',c',[-5;-5])
85

Explanation:

 The observability of the system is checked first. Only if the system is


observable, it is possible to design a state observer.
 The function acker( ) is very similar to the place( ) function. Here, as we are
designing an observer, we consider transposes of the original matrices, and
finally take the transpose of the total acker( ) function output. This is our
required gain matrix ‘L’.

2. Simulink Diagram:
86

OBSERVATION FOR SIMULINK:

Q1.

𝑷𝒍𝒐𝒕 𝟏: 𝒙𝟏(𝒕),𝒙̂𝟏(𝒕) 𝒗𝒔 𝒕𝒊𝒎𝒆

𝑷𝒍𝒐𝒕 𝟐:(𝒙𝟏(𝒕)−𝒙^𝟏(𝒕)) 𝒗𝒔 𝒕𝒊𝒎𝒆


87

𝑷𝒍𝒐𝒕 𝟑: 𝒙𝟐(𝒕),𝒙^𝟐(𝒕) 𝒗𝒔 𝒕𝒊𝒎𝒆

𝑷𝒍𝒐𝒕 𝟒:(𝒙𝟐(𝒕)−𝒙^𝟐(𝒕)) 𝒗𝒔 𝒕𝒊𝒎𝒆


88

𝑷𝒍𝒐𝒕 𝟓: 𝒚(𝒕),𝒚^(𝒕) 𝒗𝒔 𝒕𝒊𝒎𝒆

INFERENCE:

 From the Simulink plots of the state observer, we can see that the
observer estimatesthe states of the given system perfectly, and that is
exactly the job of an observer system; to estimate the unmeasurable
states of a given system.

 Plots 2 and 4 show the error signal between the original plant and the
observer system. It decays to zero within 2 seconds. This means that it is a
particularly good approximation, and the placement of poles/eigenvalues
is good.

 Plots 1 and 3 show the actual states of the system, and the states which
the observer estimates. As we have taken the plant with initial conditions,
the states of the plant decay to zero from that initial condition. Here too,
we can see that the observer startsto follow the state of the system very
quicky (2-3 seconds). So, the observer is tracking the states of the system
perfectly.

 Plot 5 shows the output of the plant and output of the observer. Similar to
89

the statesplot, the observer quickly starts following the output of the
system y(t).

 If the system isn’t completely observable, it is not possible to design a full


state observer, because some states can’t be observed, that is, it is not
possible to say howthe system states vary with the input.

 From the Simulink model, the difference between the outputs of theplant
and observer system is fed back to the observer via a gain matrix ‘L’. This
process continuously refines the error until it becomes zero, i.e., the
observer properlyestimates the states/output of the given system/plant. 

RESULT:

Thus, the state observer was designed accordingly, and their closed loop
performance was analyzed.

You might also like