0% found this document useful (0 votes)
4 views

cs2

The document outlines various control system laboratory exercises for the 2024-25 academic year, including techniques for block diagram reduction, signal flow graphs, and the simulation of poles and zeros. It also covers the determination of time response specifications for second-order underdamped systems, frequency response analysis, and the implementation of PI, PD, and PID controllers. Additionally, it includes methods for analyzing system stability, drawing root locus, Bode, and Nyquist plots, and simulating system responses using state-space models.

Uploaded by

O
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)
4 views

cs2

The document outlines various control system laboratory exercises for the 2024-25 academic year, including techniques for block diagram reduction, signal flow graphs, and the simulation of poles and zeros. It also covers the determination of time response specifications for second-order underdamped systems, frequency response analysis, and the implementation of PI, PD, and PID controllers. Additionally, it includes methods for analyzing system stability, drawing root locus, Bode, and Nyquist plots, and simulating system responses using state-space models.

Uploaded by

O
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/ 22

Control System IPCC Laboratory (BEC403) 2024-25

1. Implement Block diagram reduction technique to obtain transfer function a control system.

close all;

clear

P=4

Q=[1 1 2]

A=tf (P,Q)

R=[1 0]

S= [1 2]

B= tf (R , S)

C= series (A,B)

Ans= feedback (C,1,-1)

Ans =

4s

---------------------

s^3 + 3 s^2 + 8 s + 4

P a g e 1 | 22
Control System IPCC Laboratory (BEC403) 2024-25

P a g e 2 | 22
Control System IPCC Laboratory (BEC403) 2024-25

2.Implement Signal Flow graph to obtain transfer function a control system.


close all;

clear

P=4

Q=[1 1 2]

A=tf (P,Q)

R=[1 0]

S= [1 2]

B= tf (R , S)

C= series (A,B)

Ans= feedback (C,1,-1)

Ans =

4s

---------------------

s^3 + 3 s^2 + 8 s + 4

P a g e 3 | 22
Control System IPCC Laboratory (BEC403) 2024-25
3. Simulation of poles and zeros of a transfer function.

num/den =

6s+1

-------

s+5

num=[6,1];

den=[1, 5];

sys=tf(num,den);

printsys(num,den);

[Z,P]=tf2zp(num,den)

pzmap(P,Z)

P a g e 4 | 22
Control System IPCC Laboratory (BEC403) 2024-25
4) Determination of time response specification of a second order under damped System, for different damping
factors.

% Second-Order Underdamped System Example

% Given System
wn = 10; % Natural Frequency
zeta = [0.1 0.3 0.5 0.7 0.9]; % Damping Ratio

% Calculate Time Response Specification for Different Damping Factors


for i = 1:length(zeta)
% Calculate Damped Natural Frequency
wd = wn*sqrt(1-zeta(i)^2);

% Calculate Time Response Specification


tr = pi/(wd*sqrt(1-zeta(i)^2));
ts = 4/(zeta(i)*wd);
Mp = exp(-zeta(i)*pi/sqrt(1-zeta(i)^2));

% Display Results
fprintf('Damping Ratio = %.1f\n', zeta(i));
fprintf('Damped Natural Frequency = %.2f rad/s\n', wd);
fprintf('Rise Time = %.2f s\n', tr);
fprintf('Settling Time = %.2f s\n', ts);
fprintf('Percent Overshoot = %.2f %%\n\n', Mp*100);
end

Result:

Damping Ratio = 0.1

Damped Natural Frequency = 9.95 rad/s

Rise Time = 0.32 s

Settling Time = 4.02 s

Percent Overshoot = 72.92 %

Damping Ratio = 0.3

Damped Natural Frequency = 9.54 rad/s

Rise Time = 0.35 s

Settling Time = 1.40 s

Percent Overshoot = 37.23 %

Damping Ratio = 0.5

Damped Natural Frequency = 8.66 rad/s

P a g e 5 | 22
Control System IPCC Laboratory (BEC403) 2024-25
Rise Time = 0.42 s

Settling Time = 0.92 s

Percent Overshoot = 16.30 %

Damping Ratio = 0.7

Damped Natural Frequency = 7.14 rad/s

Rise Time = 0.62 s

Settling Time = 0.80 s

Percent Overshoot = 4.60 %

Damping Ratio = 0.9

Damped Natural Frequency = 4.36 rad/s

Rise Time = 1.65 s

Settling Time = 1.02 s

Percent Overshoot = 0.15 %

Note that program calculates the time response specification of a second-order underdamped system for
different damping ratios. The program first defines the natural frequency and damping ratio of the system.
Then, it calculates the damped natural frequency, rise time, settling time, and percent overshoot for each
damping ratio using the formulas:

- Damped Natural Frequency: wd = wn*sqrt(1-zeta^2)

- Rise Time: tr = pi/(wd*sqrt(1-zeta^2))

- Settling Time: ts = 4/(zeta*wd)

- Percent Overshoot: Mp = exp(-zeta*pi/sqrt(1-zeta^2))

P a g e 6 | 22
Control System IPCC Laboratory (BEC403) 2024-25
5) Determination of frequency response of a second order System
% Second-Order System Frequency Response Example

% Given System
wn = 10; % Natural Frequency
zeta = 0.5; % Damping Ratio

% Define Transfer Function


num = wn^2;
den = [1 2*zeta*wn wn^2];
sys = tf(num, den);

% Define Frequency Range


w = logspace(-1, 2, 1000);

% Calculate Frequency Response


[mag, phase] = bode(sys, w);

% Reshape data to 2D matrix


mag2d = reshape(mag, [], size(mag, 3));
phase2d = reshape(phase, [], size(phase, 3));
% Plot Frequency Response
figure;
subplot(2,1,1);
semilogx(w, 20*log10(mag2d));
grid on;
title('Magnitude Response');
xlabel('Frequency (rad/s)');
ylabel('Magnitude (dB)');

subplot(2,1,2);
semilogx(w, phase2d);
grid on;
title('Phase Response');
xlabel('Frequency (rad/s)');
ylabel('Phase (deg)');

P a g e 7 | 22
Control System IPCC Laboratory (BEC403) 2024-25
6) Determination of frequency response of a lead lag compensator

% Lead-Lag Compensator Frequency Response Example


% Given System
K = 1; % Gain
wn = 10; % Natural Frequency
zeta = 0.5; % Damping Ratio
M = 10; % DC Gain
alpha = 0.1; % Lag Ratio
beta = 10; % Lead Ratio

% Define Transfer Function


num = [M*alpha*beta K*M*alpha K];
den = [1 2*zeta*wn wn^2];
sys = tf(num, den);

% Define Frequency Range


w = logspace(-1, 2, 1000);

% Calculate Frequency Response


[mag, phase] = bode(sys, w);

% Reshape data to 2D matrix


mag2d = reshape(mag, [], size(mag, 3));
phase2d = reshape(phase, [], size(phase, 3));
% Plot Frequency Response
figure;
subplot(2,1,1);
semilogx(w, 20*log10(mag2d));
grid on;
title('Magnitude Response');
xlabel('Frequency (rad/s)');
ylabel('Magnitude (dB)');
subplot(2,1,2);
semilogx(w, phase2d);
grid on;
title('Phase Response');
xlabel('Frequency (rad/s)');
ylabel('Phase (deg)');

P a g e 8 | 22
Control System IPCC Laboratory (BEC403) 2024-25

P a g e 9 | 22
Control System IPCC Laboratory (BEC403) 2024-25

7.Analyze the stability of the given system using Routh stability criterion.

P a g e 10 | 22
Control System IPCC Laboratory (BEC403) 2024-25

P a g e 11 | 22
Control System IPCC Laboratory (BEC403) 2024-25
8) Using suitable simulation package, draw Root locus of the given transfer function.
Here transfer function `sys` using the numerator and denominator coefficients. We then use the `rlocus` function to
plot the root locus of the system and the `bode` function to plot the Bode plot of the system.

% Given Transfer Function


num = [1 2];
den = [1 4 3];
sys = tf(num, den);

% Root Locus Plot


figure;
rlocus(sys);
grid on;
title('Root Locus Plot');

P a g e 12 | 22
Control System IPCC Laboratory (BEC403) 2024-25
9) Using suitable simulation package, draw Bode plot of the given transfer function.
Here transfer function `sys` using the numerator and denominator coefficients. We then use the `rlocus` function to
plot the root locus of the system and the `bode` function to plot the Bode plot of the system.

% Given Transfer Function


num = [1 2];
den = [1 4 3];
sys = tf(num, den);

% Bode Plot
figure;
bode(sys);
grid on;
title('Bode Plot');

P a g e 13 | 22
Control System IPCC Laboratory (BEC403) 2024-25
10) Using suitable simulation package, draw Nyquist plot of the given transfer function.
Here transfer function `sys` using the numerator and denominator coefficients. We then use the `rlocus` function to
plot the root locus of the system and the `bode` function to plot the Bode plot of the system.

% Given Transfer Function


num = [1 2];
den = [1 4 3];
sys = tf(num, den);

% Nyquist Plot
figure;
nyquist(sys);
grid on;
title('NyquistPlot');

P a g e 14 | 22
Control System IPCC Laboratory (BEC403) 2024-25
11) Using suitable simulation package, obtain the time response from state model of a system.

% Given State Model


A = [-2 -1; 1 -2];
B = [1; 0];
C = [0 1];
D = 0;
sys = ss(A, B, C, D);

% Define Input Signal


t = linspace(0, 10, 1000);
u = sin(t);

% Simulate System Response


[y, t, x] = lsim(sys, u, t);

% Plot System Response


figure;
plot(t, y);
grid on;
title('System Response');
xlabel('Time (s)');
ylabel('Output');

In this example, we define a state model `sys` using the state-space matrices `A`, `B`, `C`, and `D`.
We then define an input signal `u` and a time vector `t` for simulation. We use the `lsim` function to
simulate the system response to the input signal and obtain the output `y`, time vector `t`, and state
vector `x`. Finally, we plot the system response over time using the `plot` function.

P a g e 15 | 22
Control System IPCC Laboratory (BEC403) 2024-25

12) Implementation of PI, PD Controllers.

PI Controllers:

In this example, we define a transfer function `G` for the given system. We then define the parameters `Kp` and `Ki`
for the PI controller and calculate the transfer function `C`. We use the `feedback` function to obtain the closed-loop
system transfer function `sys`. Finally, we plot the step response of the closed-loop system using the `step` function.

% Given System

s = tf('s');
G = 1/(s*(s+1));

% PI Controller Parameters
Kp = 1;
Ki = 1;

% PI Controller Transfer Function


C = Kp + Ki/s;

% Closed-Loop System Transfer Function


sys = feedback(C*G, 1);

% Step Response
step(sys);
grid on;
title('Step Response with PI Controller');

P a g e 16 | 22
Control System IPCC Laboratory (BEC403) 2024-25

PD Controller:
In this example, we define a transfer function `G` for the given system. We then define the parameters `Kp`
and `Kd` for the PD controller and calculate the transfer function `C`. We use the `feedback` function to
obtain the closed-loop system transfer function `sys`. Finally, we plot the step response of the closed-loop
system using the `step` function.
% Given System
s = tf('s');
G = 1/(s*(s+1));

% PD Controller Parameters
Kp = 1;
Kd = 1;

% PD Controller Transfer Function


C = Kp + Kd*s;

% Closed-Loop System Transfer Function


sys = feedback(C*G, 1);

% Step Response
step(sys);
grid on;
title('Step Response with PD Controller');

P a g e 17 | 22
Control System IPCC Laboratory (BEC403) 2024-25

13) Implement a PID Controller and hence realize an Error Detector.

In this example, we define a plant transfer function `G` and a PID controller transfer function `C`. We then use the
`feedback` function to define the closed-loop transfer function `T`. We simulate the closed-loop system using the
`lsim` function and plot the input and output signals. Finally, we calculate and plot the error signal `e` by subtracting
the output signal from the input signal.

% PID Controller and Error Detector Example


% Define the plant transfer function
num = [1];
den = [1 10 20];
G = tf(num, den);

% Define the PID controller transfer function


Kp = 1;
Ki = 0.1;
Kd = 0.01;
C = pid(Kp, Ki, Kd);

% Define the closed-loop transfer function


T = feedback(C*G, 1);

% Define the input signal


t = 0:0.01:10;
r = sin(t);

% Simulate the closed-loop system


[y, t] = lsim(T, r, t);

% Plot the results


subplot(2,1,1);
plot(t, r, 'b', t, y, 'r');
xlabel('Time (s)');
ylabel('Amplitude');
title('Input (blue) and Output (red)');

% Calculate and plot the error signal


e = r - y;
subplot(2,1,2);
plot(t, e, 'g');
xlabel('Time (s)');
ylabel('Amplitude');
title('Error Signal');

P a g e 18 | 22
Control System IPCC Laboratory (BEC403) 2024-25

P a g e 19 | 22
Control System IPCC Laboratory (BEC403) 2024-25
14) Demonstrate the effect of PI, PD and PID controller on the system response.

In this example, a plant transfer function `G` and an input signal `r`. We then define the PI, PD, and PID controller
transfer functions `C_pi`, `C_pd`, and `C_pid`, respectively. We use the `feedback` function to define the closed-loop
transfer functions `T_pi`, `T_pd`, and `T_pid`. We simulate the closed-loop systems with each controller using the
`lsim` function and plot the results.
Modify can be done on the controller gains and plant transfer function to observe the effect of different controller
configurations on the system response

% PI, PD, and PID Controller Example

% Define the plant transfer function


num = [1];
den = [1 10 20];
G = tf(num, den);

% Define the input signal


t = 0:0.01:10;
r = sin(t);

% Define the PI controller transfer function


Kp = 1;
Ki = 0.1;
C_pi = pid(Kp, Ki);

% Define the PD controller transfer function


Kp = 1;
Kd = 0.1;
C_pd = pid(Kp, 0, Kd);

% Define the PID controller transfer function


Kp = 1;
Ki = 0.1;
Kd = 0.01;
C_pid = pid(Kp, Ki, Kd);

% Simulate the closed-loop system with PI controller


T_pi = feedback(C_pi*G, 1);
[y_pi, t] = lsim(T_pi, r, t);

% Simulate the closed-loop system with PD controller


T_pd = feedback(C_pd*G, 1);
[y_pd, t] = lsim(T_pd, r, t);

% Simulate the closed-loop system with PID controller


T_pid = feedback(C_pid*G, 1);
[y_pid, t] = lsim(T_pid, r, t);

% Plot the results


subplot(2,2,1);
plot(t, r, 'b', t, y_pi, 'r');
xlabel('Time (s)');
ylabel('Amplitude');
title('PI Controller');
legend('Input', 'Output');

subplot(2,2,2);
P a g e 20 | 22
Control System IPCC Laboratory (BEC403) 2024-25
plot(t, r, 'b', t, y_pd, 'r');
xlabel('Time (s)');
ylabel('Amplitude');
title('PD Controller');
legend('Input', 'Output');

subplot(2,2,3);
plot(t, r, 'b', t, y_pid, 'r');
xlabel('Time (s)');
ylabel('Amplitude');
title('PID Controller');
legend('Input', 'Output');

P a g e 21 | 22
Control System IPCC Laboratory (BEC403) 2024-25

VIVA-VOCE QUESTIONS

1)What is the order of a system?


2)What is the type of a system?
3)Analyze the response of first order system for step signal & find the steady state error for the first
order system.
4)Define the transient and steady state responses.
5)Define the time response of the system.
6)If s = σ+j ω, then how is s=j ω for frequency response
7)Define Transient response and steady state response. What is the type of a system?
8.Define first order and second order control systems
with examples.
9.Write the time domain specifications of second order system.
10.Define delay time and rise time.
Define peak time, settling time and peak overshoot
11.What are the various applications of position control systems?
12.What is degenerative and regenerative feedback?
13.Why should not a system be operated in regenerative feedback mode?
14.What is the principle of tachogenerator? Determine its transfer function.
15.What is the function of output potentiometer?
16.Under which case a lag
17.What is feedback compensation?
18.Why is lag-compensator called a low pass filter?
19.What is the effect of Lag compensator on stability? compensator is required and what is the condition
for designing it?
20.What are the applications of lag compensator?

P a g e 22 | 22

You might also like