Pid Controller Without Noise

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

PID CONTROLLER

TEAM MEMBERS Assigned By


P.B.Madhavi B.R.Sanjeev Reddy Sir
A.Gayatri Badri Narayana Sir

PID CONTROLLER:

A proportional–integral–derivative controller (PID controller) is a generic control loop feedback


mechanism (controller) widely used in industrial control systems – a PID is the most commonly
used feedback controller. A PID controller calculates an "error" value as the difference between a
measured process variable and a desired set point. The controller attempts to minimize the error
by adjusting the process control inputs.

The three-term controller


The transfer function of the PID controller looks like the following:
• Kp = Proportional gain
• KI = Integral gain
• Kd = Derivative gain

First, let's take a look at how the PID controller works in a closed-loop system using the
schematic shown above. The variable (e) represents the tracking error, the difference between the
desired input value (R) and the actual output (Y). This error signal (e) will be sent to the PID
controller, and the controller computes both the derivative and the integral of this error signal.
The signal (u) just past the controller is now equal to the proportional gain (Kp) times the
magnitude of the error plus the integral gain (Ki) times the integral of the error plus the
derivative gain (Kd) times the derivative of the error.

This signal (u) will be sent to the plant, and the new output (Y) will be obtained. This new output
(Y) will be sent back to the sensor again to find the new error signal (e). The controller takes this
new error signal and computes its derivative and its integral again. This process goes on and on.

The characteristics of P, I, and D controllers:

A proportional controller (Kp) will have the effect of reducing the rise time and will reduce, but
never eliminate, the steady-state error. An integral control (Ki) will have the effect of eliminating
the steady-state error, but it may make the transient response worse. A derivative control (Kd)
will have the effect of increasing the stability of the system, reducing the overshoot, and
improving the transient response. Effects of each of controllers Kp, Kd, and Ki on a closed-loop
system are summarized in the table shown below.

CL SETTLING
RISE TIME OVERSHOOT S-S ERROR
RESPONSE TIME
Kp Decrease Increase Small Change Decrease
Ki Decrease Increase Increase Eliminate
Small Small
Kd Decrease Decrease
Change Change

Note that these correlations may not be exactly accurate, because Kp, Ki, and Kd are dependent
of each other. In fact, changing one of these variables can change the effect of the other two. For
this reason, the table should only be used as a reference when you are determining the values for
Ki, Kp and Kd.
LOW-PASS FILTER CHARACTERISTICS IN A PID CONTROLLER:

The behavior of a PID filter can be characterized in terms of its frequency response. A typical
curve, as shown in Figure 1, reveals distinct segments, each correlating to a different PID term.
Note that the segment associated with the D term is a place where the gain increases with
frequency. This is due to the nature of the derivative function, and it’s likely to cause a problem
in any noisy system. In fact, all high-frequency noise gets amplified by the D filter, further
intensifying its damaging effect.

We can solve this problem by modifying the PID filter such that the gain curve levels off
beyond a frequency, as shown in Figure 2. Here, all we do is limit the frequency, thereby
limiting the amplification of the noise.

The modified compensation technique essentially amounts to a PID filter followed by a low-pass
filter.

PID FILTER:

Fig1: The frequency response of a PID filter reveals the effect of the PID elements.
LOW-PASS FILTER:

Fig2: Adding a low-pass filter to a PID loop limits the high frequency gain, and hence, the
amplification of undesired high frequency components.
ALGORITHM OF A PID CONTROLLER:
Step-1: Enter the input as a step signal.

Step 2: Apply the input to the PID controller using summer.

Step 3: The output of the PID controller is given as an input to the transfer function.

Step 4: The output of the transfer function is fed back to the summer with unity feedback.

Step 5: The fed back output transfer function is subtracted from the input step signal

Step 6: The obtained output after subtraction is the error signal which is given again to PID
controller.

Step 7: This is done in order to minimize the error.

Pseudo code on PID Controller:

• Define the numerator of system’s transfer function


• Define the denominator of system’s transfer function
• Initialize the proportional gain, Integral and Derivative constants
• Define the time value for the response
• Define the numerator and denominator of the transfer function of the PID Controller
• Multiply the transfer functions of the system and PID Controller to get feedback transfer
function
• Define the numerator and denominator of a feedback transfer function
• Define the transfer functions of both closed loop and open loop systems
• Open loop and closed loop graphs are plotted along the time period 0 to 10
BLOCK DIAGRAM OF PID CONTROLLER:

PID Controller Transfer


Function
I/P

Gain=1(Unity Feedback)

Input=Step Signal, U(s)

Output=Y(s)
MATLAB CODE FOR PID CONTROLLER USING LOW PASS FILTER:

num=20*[1 2]; %Numerator of the given transfer function G(s)


den=conv([1 0.5],[1 1 4]); %Denominator of a transfer function G(s)
pi=3.14;
f= 5000; % modulating frequency
%% Initializing the proportional gain, Integral and Derivative constants
w=2*pi*f;
w=[0:100:5000];
sys1=tf(num,den);

for kp=[0.1:0.1:1]

sys2=sys1*kp;
sys3=feedback(sys2,1)
s=complex(0,w) %Substituting the s value in the above transfer function
end
bode(sys3,w)
grid;
% Design digital IIR buttorworth filters
rs= 20; %Attenuation in stop band
rp= 0.5; %Attenuation in pass band
fs= 1500; %frequency of stop band
fp= 750; %frequency of pass band
wp=2*fp/f; % Normalised pass band frequency
ws=2*fs/f; %Normalised stop band frequency
wn=[wp,ws];
%computation for an analog filter
[n,w]=buttord(wp,ws,rp,rs); % order N of the lowest order

% Low pass filter


figure;
[b,a]=butter(n,w);
p=0:0.01:pi;
%Digital filter frequency response.
[h,o]=freqz(b,a,p);%returns the N-point complex frequency response vector h
%and the N-point frequency vector o in radians/sample of
the filter

m=20*log10(abs(h)); % gain of vector h


g=angle(h);
subplot(2,1,1)
plot(o/pi,m)
xlabel('frequency->')
ylabel('gain in db->')
title('the response of digital IIR butterworth LowpassFilter')
subplot(2,1,2)
plot(o/pi,g)
xlabel('frequency->')
ylabel('gain in dB->')
OUTPUT GRAPHS:
SIMULINK BLOCK DIAGRAM:
1. PID CONTROLLER FOR A DC MOTOR TRANSFER FUNCTION
WITHOUT USING FILTER:

OUTPUT:
2. PID CONTROLLER FOR A DC MOTOR TRANSFER FUNCTION WITH
USING FILTER:

OUTPUT:

You might also like