[go: up one dir, main page]

0% found this document useful (0 votes)
13 views22 pages

SW1 03

Uploaded by

sleepyheadv01
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)
13 views22 pages

SW1 03

Uploaded by

sleepyheadv01
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

Department of Electrical and Electronic Engineering

Software Report Submission


Semester: Summer2024

Course Code: EEE305L


Course Title: Control System Laboratory
Section: 01

Experiment no: 01

Experiment Name: Analysis of Open Loop and Closed Loop Control Systems
and Effect of Gain on Stability of the System via Root Locus

Group members:
Sl. Name ID
1. SHAFIN AHMED 22121029
2. MEHEDI HASSAN 22121074
3. ABU TALHA 22121105

Date of Submission: / /2024


Objective:
● Analyzing the output of open loop and closed loop control system using MATLAB and
SIMULINK
● Observing the effect of proportional, Integral, and Differential Controller us MATLAB
● Learn the basics of root locus (Simulink)
● Analyze the effect of gain on the stability of the system (Simulink)

Requirements:
● Working Pc
● MATLAB with Simulink.

Theoretical Background:
An open-loop control system is a control system in which the control action is totally
independent of the output of the system. A manual control system is also an open-loop control
system.
The control system in which the output affects the input quantity in such a manner that the input
quantity will adjust itself based on the output generated is called a closed-loop control system.
An open-loop control system can be converted into a closed-loop control system by providing
feedback. This feedback automatically makes suitable changes in the output due to external
disturbance.

There are three classes of controllers available – proportional, derivative, and integral.
Combining them, proportional-integral controller, proportional-derivative controller, and
proportional-integral-derivative controller can also be made. The transfer function of the
controllers is:
(𝐾𝑝 + 𝐾𝑖/𝑠 + 𝐾𝑑 * 𝑠) where Kp = proportional gain, Ki = integral gain and Kd = derivative gain.
1 a) Plot the step response of the system 𝐺(𝑠) = 25/(𝑠2 + 11𝑠 + 25) in the same plot if
proportional controller of Kp=5,10,50 and 100 are used and make a table containing the
settling time, overshoot and steady state error. Show the step response using Simulink for
any one of the Kp values.

Matlab Code:
close all;
clear all;
clc;

s = tf('s'); % Laplace variable definition


num = 25;
den = s^2 + 11*s + 25;
G = num/den;
kp_values = [5, 10, 50, 100];

figure;
hold on;

for kp = kp_values
G1 = feedback(kp*G, 1)
step(G1,0:0.1:5);
disp(['For Kp = ', num2str(kp)]);
stepinfo(G1)
e_ss = 1 - dcgain(G1); % Steady-state error using final value theorem
fprintf('Steady-state = %f\n', e_ss);
end

legend(arrayfun(@(kp) sprintf('Kp = %d', kp), kp_values, 'UniformOutput', false));


title('Closed Loop Response with different Kp values');
xlabel('Time (seconds)');
ylabel('Response');

hold off;
Output :
Output Graph:

Data Table:
Kp Settling time Overshoot Steady
State Error
5 0.6816 20.6097 0.16667

10 0.6700 33.1388 0.0909

50 0.6498 60.9171 0.0196

100 0.7009 70.7428 0.0099


Implementing the Block Diagram in Simulink:
For Kp = 10

Simulink:

Response Graph:
1 b) Plot the step response of the system 𝐺(𝑠) = 25/(𝑠2 + 11𝑠 + 25) in the same plot if
proportional integral controller of Kp=5 and Ki=5,10,20 and 50 are used and make a table
containing the settling time, overshoot and steady state error. Show the step response using
Simulink for any one of the Kp and Ki combinations.

Matlab Code
close all;
clear all;
clc;

s = tf('s'); % Laplace variable definition


num = 25;
den = s^2 + 11*s + 25;
G = num/den;
kp = 5;
ki_values = [5, 10, 20, 50];

figure;
hold on;

for ki = ki_values
G1 = feedback((kp+ki/s)*G, 1, -1)
step(G1,0:0.1:5);
disp(['For Ki = ', num2str(ki)]);
stepinfo(G1)
e_ss = 1 - dcgain(G1); % Steady-state error using final value theorem
fprintf('Steady-state = %f\n', e_ss);
end

legend(arrayfun(@(ki) sprintf('Ki = %d', ki), ki_values, 'UniformOutput', false));


title('Closed Loop Response with different Ki values');
xlabel('Time (seconds)');
ylabel('Response');

hold off;
Output :
Output Graph:

Data Table:
Ki Settling time Overshoot Steady
State Error
5 2.0267 10.7209 0

10 0.7676 20.3862 0

20 1.0170 37.5154 0

50 4.4038 75.4982 0
Simulink:
Here Kp = 5, Ki = 50.

Response Graph:
1 c) Plot the step response of the system 𝐺(𝑠) = 25/(𝑠2 + 11𝑠 + 25) in the same plot if
proportional derivative controller of Kp=5 and Kd=0.5,1,2 and 3 are used and make a table
containing the settling time, overshoot and steady state error. Show the step response using
Simulink for any one of the Kp and Kd combinations

Matlab Code:
close all;
clear all;
clc;

s = tf('s'); % Laplace variable definition


num = 25;
den = s^2 + 11*s + 25;
G = num/den;
kp = 5;
kd_values = [0.5, 1, 2, 3];

figure;
hold on;

for kd = kd_values
G1 = feedback((kp+kd*s)*G, 1, -1)
step(G1,0:0.1:5);
disp(['For Kd = ', num2str(kd)]);
stepinfo(G1)
e_ss = 1 - dcgain(G1); % Steady-state error using final value theorem
fprintf('Steady-state error = %f\n', e_ss);
end

legend(arrayfun(@(kd) sprintf('Kd = %d', kd), kd_values, 'UniformOutput', false));


title('Closed Loop Response with different Kd values');
xlabel('Time (seconds)');
ylabel('Response');

hold off;
Output:
Output Graph:

Data Table:
Kd Settling time Overshoot Steady
State Error
0.5 0.1946 0.9129 0.1667

1 0.1940 0 0.1667

2 0.0538 1.9687 0.1667

3 0.7044 5.9545 0.1667


Simulink:
Here Kp = 5, Kd = 1.

Response Graph:
1 d)Determine the Kp, Kd and Ki required to design the best control system in terms of
both steady state and transient performance and plot the step response using the PID
controller. Use Simulink to obtain the values of Kp, Kd and Ki fulfilling following criteriai.
● Rise time- 0.4-0.5 sec
● Settling time is less than 0.8 sec
● Maximum overshoot 5%

Simulink:

Setting the initial values of Kp =5, Ki=10 and Kd=2.


Tuning the values of Kp, Ki, Kd in order to get the best system in terms of both steady state and
transient performace where-
● Rising time: 0.4-0.5 sec
● Settling time is less than 0.8 sec
● Minimum overshoot 5%

Updated values of Kp, Ki & Kd:

Updated Graph:
Desired value of
● Kp = 2.2953
● Ki = 5.5446
● Kd = 0.21303

Desired response graph:

The system has a rise time of 0.4032 seconds, the system responds promptly to input changes,
falling within the desired range of 0.4-0.5 seconds. The settling time of 0.6656 seconds is
notably shorter than the 0.8-second requirement, indicating that the system stabilizes quickly
after disturbances. The overshoot is very low at 0.3330%, well within the maximum allowable
5%, which demonstrates excellent control with minimal deviation from the desired final value.
The output settles between 0.9010 and 1.0033, showing that the response is well-contained with
only minor fluctuations around the final value. The peak time of 1.1661 seconds highlights
effective control without excessive oscillation. Overall, this design achieves a strong balance
between transient and steady-state performance, delivering a responsive, stable, and precise
control system.
2) Consider the following system: 𝐺(𝑠)=𝐾 * [(𝑠 − 3)(𝑠 − 5)/(𝑠 + 1)(𝑠 + 2)]
Find the range or value of gain K that makes the system:
a. Overdamped
b. Critically Damped
c. Under Damped
d. Marginally Stable
e. Unstable

Matlab Code:

close all;
clear all;
clc;

s = tf('s'); %Laplace variable definition


num = (s-3)*(s-5);
den = (s+1)*(s+2);
G = num/den

figure;
rlocus(G);
[k,poles] = rlocfind(G);
figure;
G1 = feedback(k*G,1);
step(G1,0:0.1:10);
stepinfo(G1)
Output Figure 1:

Unstable: For K > 0.3740


Undamped: For K = 0.3740

Critically damped: For K = 0.0086


Overdamped: For K < 0.0086
Underdamped: For K > 0.0086
Undamped (K = 0.3740)

Unstable (K > 0.3740)


Critically damped (K = 0.0086)

Overdamped (K < 0.0086)


Underdamped (K > 0.0086)

Discussion:
In our control system analysis, we encountered some notable differences between the MATLAB
code results and the Simulink simulations. For the PI controller with Kp=5 and Ki=50, the
Simulink results showed a rise time of 0.1033 seconds, a settling time of 4.3488 seconds, and an
overshoot of 75.0848%. These results were quite different from what the MATLAB code
predicted. The discrepancies likely stem from differences in numerical methods, solver settings,
and simulation precision between the two platforms.

Similarly, for the PD controller with Kp=5 and Kd=1, Simulink results indicated a rise time of
0.4945 seconds, a settling time of 0.9051 seconds, and a minimal overshoot of 0.0528%.
Although these results were generally in line with expectations, small differences from the
MATLAB code suggest that variations in numerical precision and solver configurations can
impact the outcomes.

In our root locus analysis, we identified that the system was critically damped at K=0.0086,
overdamped for K<0.0086, and underdamped for K>0.0086. The system became unstable for
K>0.3740 and undamped at K=0.3740. Pinpointing the exact gain K was tricky, as even minor
errors could lead to instability.

These variations highlight the importance of carefully tuning simulation parameters and
recognizing the differences between theoretical models and practical simulations. While the root
locus method helped understand system stability, the differences between MATLAB and
Simulink emphasize the need for accurate setup and validation to achieve reliable control system
performance.

You might also like