0% found this document useful (0 votes)
11 views7 pages

Program

The document outlines experiments for implementing PI, PD, and PID controllers, detailing the formulas and steps for manual calculations of output over time. It includes tabular data for each controller type, showing how to compute values and plot graphs of Time vs Output and Time vs Error. Additionally, it demonstrates the effect of each controller on system response using transfer functions and step responses.

Uploaded by

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

Program

The document outlines experiments for implementing PI, PD, and PID controllers, detailing the formulas and steps for manual calculations of output over time. It includes tabular data for each controller type, showing how to compute values and plot graphs of Time vs Output and Time vs Error. Additionally, it demonstrates the effect of each controller on system response using transfer functions and step responses.

Uploaded by

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

EXPERIMENT NO 12

IMPLEMENT PI AND PD CONTROLLERS.

Program: PI CONTROLLERS

To manually calculate values and plot a graph of Time vs Output, follow


these steps:

1. Understand the formula:


Your PI controller updates the system output with:

output(i+1)=output(i)+dt×(control signal−output(i))

Where:
 control signal = P + I
 P = Kp * error(i)
 I = Ki * integral

2. Manually compute values:

Using your system parameters:


 Set initial output as 0
 Calculate error (setpoint - output)
 Compute P and I terms
 Update output with the given equation

Let’s compute for a few first steps manually:

(a)Time=0.0
Error=setpoint-output=10-0=10
P=kp*error=(1*10)=10
Integral initial=0
I=ki*integral=0.1*0=0
Control signal=P+I=10+0=10
Initial output=0
(b)Time=0.1
Error=setpoint-output=10-0=10
P=kp*error=(1*10)=10
Integral =integral+error*dt=0+10*0.1=1
I=ki*integral=0.1*1=0.1
Control signal=P+I=10+0.1=10.1
Output(next)=output+dt(control signal-output)=0+(0.1*(10.1-0)=1.01

Tabular column:
Time P (Kp * I (Ki * Control Signal Output
Error Integral
(s) Error) Integral) (P + I) (next)
0.0 10.0 10.0 0.0 0.0 10.0 0.0
0.1 10.0 10.0 1.0 0.1 10.1 1.01
0.2 9.0 9.0 1.9 0.19 9.19 1.91
0.3 8.09 8.09 2.71 0.27 8.36 2.74
0.4 7.26 7.26 3.43 0.34 7.6 3.22
0.5 6.78 6.78 4.108 0.4108 7.19 3.617
. . . . . . .
. . . . . . .
1 5.41 5.41 7.02 0.702 6.112 4.74
2 …… ……. …… …….. ……… 5.70

Continue these steps until t = 20 sec to obtain all values.

3. Plot the graph:


Once you compute values, plot Time vs Output using any graphing tool (Excel,
MATLAB, or manually on paper). If using MATLAB, your given plot() command will
automatically create the graph.

PD CONTROLLERS
To manually calculate values and plot Time vs Output for your PD
Controller, follow these steps:
1. Understand the Update Formula:
Your PD controller updates the system output using:
output(i+1)=output(i)+dt×(control_signal−output(i))

where:
 control_signal = P + D
 Proportional Term → P = Kp * error(i)
 Derivative Term → D =( Kd * (error(i) - prev_error)) / dt

2. Manually Compute Values:


Start with:
 Initial output = 0
 Calculate error (setpoint - output)
 Compute P and D terms
 Update output using the equation

Here’s how the first few steps will look:


(a)Time=0.0
Error=setpoint-output=10-0=10
P=kp*error=(1*10)=10
Prev_error =error
Pre_error=10
D=(kd*(error-prev_error))/dt=(0.1*(10-10))/0.1=0
Control signal=P+D=10+0=10
Initial output=0

(b)Time=0.1
Error=setpoint-output=10-0=10
P=kp*error=(1*10)=10
D=(kd*(error-prev_error))/dt=(0.1*(10-10))/0.1=0
Control signal=P+I=10+0=10
Output(next)=output+dt(control signal-output)=0+(0.1*(10-0)=1

(c)Time=0.2
Error=setpoint-output(next)=10-1=9
P=kp*error=(1*9)=9
D=(kd*(error-prev_error))/dt=(0.1*(9-10))/0.1=-1.0
Control signal=P+I=9-1=8
Output(next)=output+dt(control signal-output)=1+(0.1*(8-1)=1.7

Tabular column

Control
Time P (Kp * D ( Kd * (error(i) - Output
Error Signal
(s) Error) prev_error) )/ dt) (next)
(P+D)
0.0 10.0 10.0 0.0 10.0 0.0
0.1 10.0 10.0 0.0 10.0 1.0
0.2 9.0 9.0 -1.0 8.0 1.7
0.3 8.2 8.2 -0.8 7.4 2.5

Continue calculating these values manually until t = 20 sec.

3. Plot the Graph:


Once you compute Time vs Output values:
 Use Excel, MATLAB, or graph paper to plot the points
 MATLAB’s given plot() command will automatically generate the
graph from the computed values

EXPERIMENT NO 13
IMPLEMENT A PID CONTROLLER AND HENCE REALIZE
AN ERROR DETECTOR
To manually calculate and plot Time vs Output and Time vs Error,
follow these steps:
1. Understanding the Update Formula
Your PID controller updates the system output with:
output(i+1)=output(i)+dt×(control_signal−output(i))

Where:
 Control Signal → P + I + D
 Proportional Term → P = Kp * error(i)
 Integral Term → I = Ki * integral
 Derivative Term → D = Kd * derivative

2. Manually Compute Values


Start with:
 Initial output = 0
 Compute error (setpoint - output)
 Calculate P, I, and D terms
 Update output using the equation
Here are the first few steps manually:

(a)Time=0.0
Error=setpoint-output(initial)=10-0=10
P=kp*error=(1*10)=10
I=ki*integral=0.1*0=0
D=(kd*(error-prev_error))/dt=(0.01*(10-10))/0.1=0
Control signal=P+I+D=10+0+0=10
Initial output=0

(b)Time=0.1
Error=setpoint-output(initial)=10-0=10
P=kp*error=(1*10)=10
Integral =integral+error*dt=0+10*0.1=1
I=ki*integral=0.1*1=0.1
D=(kd*(error-prev_error))/dt=(0.01*(10-10))/0.1=0
Control signal=P+I+D=10+1+0=11
Output(next)=output+dt(control signal-output)=0+(0.1*(11-0)=1.1

(c)Time=0.2
Error=setpoint-output(next)=10-1.1=8.9
P=kp*error=(1*8.9)=8.9
Integral =integral(above value)+error*dt=1+8.9*0.1=1.89
I=ki*integral=0.1*1.89=0.189
D=(kd*(error-prev_error))/dt=(0.01*(8.9-10))/0.1=-0.11
Control signal=P+I+D=8.9+0.189-0.11=8.97
Output(next)=output+dt(control signal-output)=1.1+(0.1*(8.97-1.1)=1.88

(c)Time=0.3
Error=setpoint-output(next)=10-1.88=8.12
P=kp*error=(1*8.12)=8.12
Integral =integral(above value)+error*dt=1.89+8.12*0.1=2.702
I=ki*integral=0.1*2.702=0.2702
D=(kd*(error-prev_error))/dt=(0.01*(8.12-8.9))/0.1=-0.078
Control signal=P+I+D=8.12+0.2702-0.078=8.31
Output(next)=output+dt(control signal-output)=1.88+(0.1*(8.31-1.88)=2.52

Time P (Kp * I (Ki * D (Kd * Control Output


Error
(s) Error) Integral) Derivative) Signal (next)
0.0 10.0 10.0 0.0 0.0 10.0 0.0
0.1 10.0 10.0 1.0 0.0 11.0 1.1
0.2 8.9 8.9 1.89 -0.11 8.97 1.88
0.3 8.12 8.12 2.702 -0.078 8.31 2.52

Repeat these calculations until t = 20 sec to get full values.

3. Plot the Graphs


Once you compute values:
1. For Time vs Output
o Plot Time on the x-axis and Output on the y-axis.
o Use a blue line ('b') for output.
2. For Time vs Error
o Plot Time on the x-axis and Error on the y-axis.
o Use a green line ('g') for error.

EXPERIMENT NO 14
DEMONSTRATE THE EFFECT OF PI, PD AND PID
CONTROLLER ON THE SYSTEM RESPONSE
n=[1];
d=[1 10 20];
kp_pd=500;
kd_pd=10;
c_pd=tf([kp_pd kd_pd],1);
p=tf(n,d);
t1=feedback(c_pd*p,1);
t=0:0.01:2;
subplot(3,1,1);
step(t1,t);
grid;
title('pd controller');
kp_pi=30;
kd_pi=70;
c_pi=tf([kp_pi kd_pi],[1 0]);
p=tf(n,d);
t2=feedback(c_pi*p,1);
subplot(3,1,2);
step(t2,t);
grid;
title('pi controller')
kp_pid=500;
ki_pid=400;
kd_pid=50;
c_pid=tf([kd_pid kp_pid ki_pid],[1 0]);
p=tf(n,d);
t3=feedback(c_pid*p,1);
subplot(3,1,3);
step(t3,t);
grid;
title('pid controller');
figure(2);
step(t1,t2,t3,'r---');
title('comparision of all the response');
legend({'pd controller','pi controller','pid controller'},'Location','best');
legend('boxoff');
grid;

Output:
 System Transfer Function:

G(s)=1/s^2+10s+20

1. PD Controller:

 Kp=500 or K_p = 500,

 Kd=10 or K_d = 10

Controller transfer function:

CPD(s)=Kp+Kds

=500+10s

 Open-loop transfer function:

TOL(s)=CPD(s)⋅G(s)

=(10s+500)/s^2+10s+20

 Closed-loop transfer function:

TCL(s)=TOL(s)/1+TOL(s)

=10s+500/s^2+20s+(520)

2. PI Controller:

 Kp=30 or K_p = 30,

 Ki=70 or K_i = 70
 Controller transfer function:

CPI(s)=Kp+Kis=30+70s

 Open-loop transfer function:

TOL(s)=CPI(s)⋅G(s)

=(30s+70)/s(s^2+10s+20)

 Closed-loop transfer function:

TCL(s)=TOL(s)/1+TOL(s)

=(30s+70)/s^3+10s^2+50s+70

3. PID Controller:

 Kp=500 or K_p = 500, Ki=400 or K_i = 400, Kd=50 or K_d = 50

 Controller transfer function:

CPID(s)=Kp+Kis+Kds

=500+400s+50s

 Open-loop transfer function:

TOL(s)=CPID(s)⋅G(s)

=(50s^2+500s+400)/s(s^2+10s+20)

 Closed-loop transfer function:

TCL(s)=TOL(s)/1+TOL(s)

=(50s^2+500s+400)/s^3+60s2+520s+400

You might also like