0% found this document useful (0 votes)
295 views55 pages

Control System & Fuzzy Logic - Lab Manual - 23 - 24

Performed on: Submitted on: Aim: To obtain the state space model from the given transfer function Prerequisite: - Knowledge of transfer function - Knowledge of state space model Objective: To obtain the state space model (A, B, C, D matrices) from the given transfer function. Theory: A state-space representation is a mathematical model of a physical system as a set of input, output and state variables related by first-order differential equations. It is a popular way of representing multiple-input multiple-output (MIMO) linear time-invariant (LTI) systems, such as electrical circuits, mechanical systems, and biological systems.
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)
295 views55 pages

Control System & Fuzzy Logic - Lab Manual - 23 - 24

Performed on: Submitted on: Aim: To obtain the state space model from the given transfer function Prerequisite: - Knowledge of transfer function - Knowledge of state space model Objective: To obtain the state space model (A, B, C, D matrices) from the given transfer function. Theory: A state-space representation is a mathematical model of a physical system as a set of input, output and state variables related by first-order differential equations. It is a popular way of representing multiple-input multiple-output (MIMO) linear time-invariant (LTI) systems, such as electrical circuits, mechanical systems, and biological systems.
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/ 55

School of Electronics and Communication

Engineering

Second Year B. Tech. ECE AI ML

Control Systems and Fuzzy Logic

Course Code: ECE2008B

Laboratory Manual
2023-24
Preface
Control Systems and Fuzzy Logic Laboratory
Fuzzy logic provides mathematical strength to the emulation of certain perceptual and
linguistic attributes associated with human cognition.
Fuzzy logic means approximate reasoning, information granulation, computing with words
and so on. Ambiguity is always present in any realistic process. This ambiguity may arise
from the interpretation of the data inputs and in the rules used to describe the relationships
between the informative attributes. Fuzzy logic provides an inference structure that enables
the human reasoning capabilities to be applied to artificial knowledge-based systems. Fuzzy
logic provides a means for converting linguistic strategy into control actions and thus offers a
high-level computation.
So in this laboratory we introduce various membership functions, fuzzy inference systems
and different methods of defuzzification. With the help of this information students can
develop their own knowledge based system and find the solution to real world problems with
and can design Fuzzy logic controllers.
A control system manages, commands, directs, or regulates the behavior of other devices or
systems using control loops. It can range from a single home heating controller using
a thermostat controlling a domestic boiler to large industrial control systems which are used
for controlling processes or machines. The control systems are designed via control
engineering process. The PID controllers compare the value or status of the process
variable (PV) being controlled with the desired value or setpoint (SP), and applies the
difference as a control signal to bring the process variable output of the plant to the same
value as the setpoint. So students can understand basics of PID controller and Fuzzy Logic
Controller.
After successful completion of the Lab, students will be able to write the programs based on
control system and fuzzy systems. Practicals can be performed using Python/ MATLAB /any
appropriate open source software. Students should perform all the experiments and 100%
attendance for practicals is must to appear for final University Examination.
Control System and Fuzzy Logic
INDEX
Sr. Date of Signature of
Name of the Experiment Page
No. Checking Batch I/C
To obtain Pole, Zero and gain Value of
1
given transfer function
To obtain the state space model from the
2
given transfer function
To obtain transient response of second
3
order system.
To control the closed loop system using
4 PID controller

Implement various fuzzy membership


5 functions

Implement defuzzification using Max-


6 membership principle, Centroid method,
Weighted average method
Implement Fuzzy Inference System with
7 Mamdani Inferencing mechanism
Application of Fuzzy controller
implement Application of Fuzzy controller
8

CERTIFICATE

Certified that Mr./Ms.__________________________________________ of


Class S. Y. B. Tech. (ECE AI ML) Division_____ Roll No.____________ has
completed the laboratory work in the subject Control System and Fuzzy Logic
during the semester III in the School of Electronics and Communication
Engineering during the Academic Year 2023-2024.

Signature of the Faculty Head of the Department


Laboratory Instructions
Control Systems and Fuzzy Logic
1. In addition to the instructions in this laboratory manual, follow all verbal
and written instructions provided by the instructional staff.
2. Maintain silence and discipline in the laboratory.
3. Before coming to the laboratory, students should carefully read the
sections of text which are covered in the assigned experiment. If the topic
has been covered in lectures, the lecture notes should be studied as well.
4. Students should wear a valid ID card before entering the lab.
5. Use of mobile phone in the lab is strictly prohibited. Each student must
keep mobile phones in “Switched Off” mode while entering and working
in the Lab.
6. If any problem arises, please bring the same to the notice of lab in-charge.
7. Handle all computers softly and gently.
8. In case of theft / destruction of the instruments in the lab, double cost
of the Lost/destructed instrument will be charged from the student/user.
9. Lab Assistants are available to assist basic computer handling problems.
10. Do not leave the laboratory without permission of concerned staff
11. Before leaving the laboratory, save your work properly and take backup of
your programs.
12.It is mandatory to get checked the experiments write-ups in the next
practical turn.
S. Y. B. Tech
Semester: III Subject: Control System and Fuzzy Logic
Name: Class:

Roll No: Batch:

Experiment No: 01
Name of the Experiment: To obtain pole, zero and gain value of a transfer function.

Marks Teacher’s Signature with date


Performed on:

Submitted on:

Aim: To obtain pole, zero and gain value of a transfer function

Prerequisite:
 knowledge of various types of signals
 Idea about software MATLAB
Objective:
To obtain
1. Pole, zero, gain values from a given transfer function
2. Transfer function model from pole, zero, gain values
3. Pole, zero plot of a transfer function
Theory:
A transfer function is also known as the network function is a mathematical
representation, in terms of spatial or temporal frequency, of the relation
between the input and output of a (linear time invariant) system. The transfer
function is the ratio of the output Laplace Transform to the input Laplace
Transform assuming zero initial conditions. Many important characteristics of
dynamic or control systems can be determined from the transfer function. The
transfer function is commonly used in the analysis of single-input single-
output electronic system, for instance. It is mainly used in signal processing,
communication theory, and control theory. The term is often used exclusively
to refer to linear time-invariant systems (LTI). In its simplest form for

www.mitwpu.edu.in
continuous time input signal x(t) and output y(t), the transfer function is the
linear mapping of the Laplace transform of the input, X(s), to the output Y(s).

Zeros are the value(s) for z where the numerator of the transfer function
equals zero. The complex frequencies that make the overall gain of the filter
transfer function zero.

Poles are the value(s) for z where the denominator of the transfer function
equals zero. The complex frequencies that make the overall gain of the filter
transfer function infinite.

The general procedure to find the transfer function of a linear differential


equation from input to output is to take the Laplace Transforms of both sides
assuming zero conditions, and to solve for the ratio of the output Laplace over
the input Laplace.

The transfer function provides a basis for determining important system


response characteristics without solving the complete differential equation. As
defined, the transfer function is a rational function in the complex variable ‘s’
that is It is often convenient to factor the polynomials in the numerator and
the denominator, and to write the transfer function in terms of those factors:

N (s ) ( s−z 1 ) ( s−z 2 ) … … .. ( s−z n )


G ( s )= =K
D (s ) ( s−p 1 )( s− p2 ) … … .. ( s− pm )

where, the numerator and denominator polynomials, N(s) and D(s).

The values of s for which N(S) = 0, are known as zeros of the system. i.e; at
s = z 1 , z 2 , … … . , zn .
The values of s for which D(S) = 0, are known as poles of the system. i.e; at s =
p1 , p2 , … … ., pn .

Procedure: Draw flowchart and Implement the program for given transfer function
Calculations: Calculate poles and Zeros for given transfer function

Conclusions:
2

www.mitwpu.edu.in
Post lab questions:

1. What do you mean by poles?


2. What is a transfer function?
3. What is the significance of poles and zeros in stability of a system?
4. Find poles and zeros of the transfer function and comment on stability of the system
i) TF= (s^2 + 4 s + 3)/( s^3 + 8s^2 + 19s + 12)
ii) TF= (2s^2 - 64)/( s^3 + 6 s^2 + 11 s - 6)

S. Y. B. Tech
3

www.mitwpu.edu.in
Semester: III Subject: Control System and Fuzzy logic
Name: Class:

Roll No: Batch:

Experiment No: 02

Name of the Experiment: To obtain the state space model from the given
transfer function

Marks Teacher’s Signature with date

Performed on:

Submitted on:

Aim: To obtain the state space model from the given transfer function

Prerequisite:

 knowledge of control system


 Idea about software MATLAB

Objective:

 To find the multi output for multi input system for the given transfer function.
 To obtain the state space model for given transfer function or vice versa.
Theory:

1. A. Introduction: A state-space model is commonly used for representing a linear time-


invariant (LTI) system. It describes a system with a set of first-order differential or
difference equations using inputs, outputs, and state variables. In the absence of these
equations, a model of a desired order (or number of states) can be estimated from
measured input-output data.
The models are widely used in modern control applications for designing controllers and
analyzing system performance in the time domain and frequency domain. The models
4

www.mitwpu.edu.in
can be applied to nonlinear systems or systems with non-zero initial conditions. They also
provide a convenient way to represent, analyze, and control multi-input/multi-output
(MIMO) systems.

State space modeling of dynamic LTI systems allows the control system designer to bring
the vast array of tools from linear system theory to bear on the design problem. In
addition to MatLab's standard selection of linear systems tools, a number of specialized
state-space design and analysis tools are available through the Control Systems Toolbox.
Key Commands:
ss - conversion to state-space
ssdata - extraction of state-space data from a SYS model
rss - random stable state-space models
ss2ss - state transformations
canon - canonical state-space realizations
ctrb - controllability matrix
obsv - observability matrix
A.model creation using ss(), ssdata(), rss()
To begin, consider the same spring-mass-damper system

The differential equation for this simple system is

An easy state-space form to convert this system into is the controllability canonical form
(CCF).
This conversion is done using the following state definitions:

x1 = x
x2 = dx/dt
In this manner, the CCF form of the system becomes:

The output equation in this state-space model assumes the system output is simply the
mass position, x(t).

www.mitwpu.edu.in
To create this state-space system within Matlab, use the ss() function, which generates
a SYS object, just like the tf() command for transfer function system representations:
A = [0 1; -2/3 -8/3]
B = [0; 1/3]
C = [1 0]
D=0
sys = ss(A, B, C, D)
Using this SYS object, all the MatLab system response tools such as step(), lsim(), etc.,
can be used on the state-space model of this system.

Given a SYS object, the component A, B, C, D matrices of the state-space model may be
extracted using the ssdata() command, which has the following syntax: [A,B,C,D] =
SSDATA(SYS) retrieves the matrix data A,B,C,D for the state-space model SYS. If SYS
is not a state-space model, it is first converted to the state-space representation.

Finally, the rss() command may be used to generate a random state-space model. For full
syntax, enter "help rss" within MatLab.

1.1 State-space transformations

the standard state-space description of a linear continuous system is given by a state


equation that relates the rate of change of the state of the system to the state of the system
and the input signals and the output equation where the outputs are related to the state
variables and the input signals. The state-space model is a set of two matrix equations
written in the compact form as: x. = Ax + Bu

y = Cx + Du

where

• x is an (nx × 1) state vector, where nx is the number of states or system order

• u is an (nu × 1) input vector, where nu is the number of input functions

• y is a (ny × 1) output vector where ny is the number of outputs

• A is an (nx × nx) square matrix called the system matrix or state matrix

• B is an (nx × nu) matrix called the input matrix

• C is a (ny × nx) matrix called the output matrix


6

www.mitwpu.edu.in
• D is a (ny × nu) matrix which represents any direct connection between the input and
the output. It as called the feed through matrix.

1.2. State transformations using ss2ss(), canon()

State transformations are important for converting between various canonical state-space
forms, and for reconfiguring a given state-space models into a transformed model with
controllable, uncontrollable, observable, and unobservable components decoupled.

Consider a state transformation z = Lx, where x is the original state vector, L is a linear
transformation matrix, and z is the transformed state vector. Under this transformation,
the resulting system becomes:

z = [LAL] -1z + [LB] u


y = [CL]-1 z + D u
The ss2ss() function performs this transformation directly. For example, the system
created in part A can be converted into diagonal canonical form using the following
transformation:
x = Tz where T = [p1 p2 ... pn], pi = ith eigenvector of A
First, note that MatLab's transformation, where the transformation is defined as x = Tz.
Thus, the MatLab transformation matrix L is the inverse of the transform T defined
above.

Next, form the transform matrix T using the "eig()" function, which is defined as:

[V,D] = EIG(X) produces a diagonal matrix D of eigenvalues and a


full matrix V whose columns are the corresponding eigenvectors.
This, the desired transformation matrix is, [T,D] = eig(A)
Now the transformed system can be generated by entering: diagonalsys = ss2ss(sys,
inv(T))
The resulting transformed A,B,C,D matrices can be extracted using ssdata():
[Abar, Bbar, Cbar, Dbar] = ssdata(diagonalsys)

Abar = -0.2792 0
0.0000 -2.3874

Bbar = 0.1642
0.4093
7

www.mitwpu.edu.in
Cbar = 0.9632 -0.3863

Dbar= 0

Note that the A matrix has been converted to a diagonal form. Furthermore, the diagonal
elements are -0.2792 and -2.3874, which corresponds to the eigenvalues of the original
matrix A as was seen from the eig() command above. As discussed in lecture, this should
be expected due to the invariance of the system's characteristic equation under any given
similarity transformation.

Also, note that both eigenvalues of the system are negative. This implies that the
unforced (natural, homogeneous) response of the system is stable, i.e. if you pull the mass
to some initial position y(0) = x1(0) = yo, then both the displacement (x1) and velocity
(x2) of the system will decay exponentially to y=0.

The above approach works for any given transformation, i.e. transformation into CCF or
OCF. However, MatLab actually provides a more convenient method for converting a
system into diagonal canonical form, using the "canon()" function. This is just a shortcut
to what we did above, providing both the transformed system equations and the
transformation matrix itself in a single function. Try entering:

[diagonalsys2, L] = canon(sys, 'modal')


One should find that diagonalsys2 and the original diagonalsys are the same, and that the
returned transformation matrix L is equal to the inverse of the eigenvector matrix T
determined previously.

1.3. Controllability, observability matrices

The controllability matrix, U, and observability matrix, V, are defined as,

U = [B A*B A^2*B ... A^(n-1)*B]


`
V = [C C*A C*A^2 ... C*A^(n-1)]'
MatLab ctrb() and obsv() functions will create these matrices for you automatically. For
example, the observability matrix for our 2-state spring-mass-damper example can be found
by hand, and by ctrb(), as follows:
U1 = [B A*B]

U1 = 0 0.3333
8

www.mitwpu.edu.in
0.3333 0.2222

U2 = ctrb(sys)

U2 =0 0.3333
0.3333 0.2222
Clearly, the output is the same. This can save a bit of effort for many important operations,
such as when forming transformation matrices for conversion to CCF or OCF which require
U and V, respectively.

1.4. State-space / transfer function conversion

We can readily convert back-and-forth between state-space and transfer function


representations of an LTI system using MatLab. Once you have a MatLab SYS object
defined as in part A, the transfer function form of the system is found through "tf(sys)".
Similarly, given a SYS object created from a transfer function, a state-space model of the
system can be found using "ss(sys)". For example, convert the state-space model in part A as
follows:

sys2 = tf(sys)

Transfer function:
0.3333
----------------------
s^2 + 2.667 s + 0.6667

Now convert it back to state-space form as,


sys3 = ss(sys2);
[A3 B3 C3 D3] = ssdata(sys2)

A3 = -2.6667 -0.6667
1.0000 0

B3 = 0.5000
0

C3 = 0 0.6667

D3 = 0
9

www.mitwpu.edu.in
From state-space transfer function can be obtained from following relation

To obtain:
1) state space from the given Transfer function:

Y(s)/U(s)=numerator polynomial in s/denominator polynomial in s=num/den


MATLAB command for this is
[A, B, C, D]=tf2ss(num,den)
2) Transfer function from the given state space
If A,B,C,D are the state space variables &
Y(s)/U(s)=numerator polynomial in s/denominator polynomial in s=num/den
MATLAB command for this is
[num,den]=ss2tf(A, B, C, D)
If multiple inputs, MATLAB command for this is
[num,den]=ss2tf(A, B, C, D,iu)

2. PROCEDURE:
1) Write the program from transfer Function to State Space
%T.F = s/(s+10)(s2+4*s+16)

num = [0 0 1 0];
den = [1 14 56 160];
[A,B,C,D] = tf2ss(num,den)
Run the program and get the state space variables.
2) Write the program from State Space to transfer Function
A= [0 1 0; 0 0 1; -5 -25 -5];
B= [0; 25; -120];
10

www.mitwpu.edu.in
C = [1 0 0];
D = [0];
[num,den] = ss2tf(A,B,C,D)
Run the program and get the transfer Function.
3) Write the program to check the controllability and observability of given system.
3. CONCLUSIONS:

Post lab questions:


1) What do you mean by state space analysis?
2) What are state vectors, state variables &state space?
3) How state space is different from other time domain and frequency domain analysis?
4) Find transfer function from given state space model

A = [ -6 -40 -16
1 0 0
0 1 0]
B= [1
0
0]
C = [ 0 1 0]
D= 0

S. Y. B. Tech

11

www.mitwpu.edu.in
Semester: III Subject: Control System and Fuzzy
logic
Name: Class:

Roll No: Batch:

Experiment No: 03
Name of the Experiment: To obtain transient response 2nd order system using
MATLAB

Marks Teacher’s Signature with date


Performed on:

Submitted on:

Aim: To obtain transient response 2nd order system


Prerequisite:
 knowledge of various types of signals
 Idea about software MATLAB

Objective:
 To understand the various orders of the system.
 To understand the response of the system when nature of input signal is
changing.

Theory:

Introduction: In practice the time response curves of systems higher than


second order is through computer simulation. This experiment shows us the
computational approach to the transient-response . In particular step response
is discussed in detail.

12

www.mitwpu.edu.in
2nd Order System is represented as

• The dynamic behavior of 2nd order system can be described in terms of ξ and
wn
• The systems are classified as
– Un-damped System(ξ=0)
– Under-damped System(0<ξ<1)
– Critically damped System(ξ=1)
– Over-damped System(1< ξ)

Representation of Linear systems: The transfer function of a system is


represented by two arrays of numbers. Consider the system
G(s) = C(s)/R(s) = wn2/(s2+2ζwns+wn2)

13

www.mitwpu.edu.in
This system can be represented as two arrays, each containing the coefficients
of the polynomials
in decreasing powers of s as follows:

Num=[wn2]
Den=[1 2*ζ*wn wn2]

An alternative representation is
Num=[0 0 wn2]
Den=[1 2*ζ*wn wn2]
In this expression zeros is padded, this is to make the dimensions of the
numerator and denominator vector (ie.num and den respectively) the same.
Obtaining the unit-step response of the transfer-Function using MATLAB: By
knowing the numerator and denominator of the closed loop transfer function,
commands such as step(num,den), step(num,den,t) can be used to generate the
unit-step response. t in the step command is the user specified time. Using the
step response with left hand side arguments, the X axis and Y axis labels can
be given to the response curves.
Step Response
The step response of different types of second order systems is dependant
on the value of ξ.
A family of unit-step response curve with various values of ξ is shown in
fig.1

Fig.1

14

www.mitwpu.edu.in
Transient Response Specifications
The performance characteristics of a control system are specified in terms of
the transient
response. The transient response of second order under damped system to unit
step is shown in
fig.2

Fig.2

PROCEDURE:

Run the program for unit-step input ( namedunit_step.m) by assigning different


values of wn and ζ (for example (wn, ζ ) = (1.0, 0.2), (1.0, 0.4), (1.0, 0.6), (1.0,
0.8), (1.0, 1.0), (1.0, 1.2), (1.0, 1.4), (2.0, 0.6), (2.0, 1.0), (2.0, 1.2) etc.). Observe
the output response and note the values of delay time, rise time, peak time,
maximum overshoot and settling time obtained from the program. For
overdamped systems, the value of r (multiplying factor for the time constant)
should be selected according to the value of zeta viz. for large values of zeta, the
response will take a long time to reach its final value and hence r should be large.

CALCULATIONS: For the underdamped cases (ζ < 1.0), calculate the theoretical
values of

15

www.mitwpu.edu.in
delay time, rise time, peak time, maximum overshoot and settling time using the
following
Formulae:

Where 1
T=
ζωn

Compare the values obtained from the program with the above theoretical values.

16

www.mitwpu.edu.in
CONCLUSIONS:

Post lab questions:


1) What is difference in transient time analysis and steady state time analysis?
2) What are the various performance parameters in 2nd order system?
3) What are various types of the systems?
4) What are the various ways of analyzing the system in time domain and
frequency domain?
5) Define delay time, rise time, peak time , setting time of underdamped second
order system with
unit step response and calculate the same for the system with characteristic
equation
S2 + 10S + 25=0

17

www.mitwpu.edu.in
S. Y. B. Tech (ECE)
Semester: III Subject: Control System and Fuzzy Logic
Name: Class:
Roll No: Batch:

Experiment No: 04
Name of the Experiment: To control the closed loop system using PID controller

Marks Teacher’s Signature with date


Performed on:

Submitted on:

Aim : To Control the Speed of DC Motor Using PID Controller


Pre-requisite: PID controller

Objective:
1. To understand importance of PID controller ion Control Systems.
2. To understand Tuning of PID controller.
3. To find values of Kp, Ki, Kd

Theory:

PID Controller is a most common control algorithm used in industrial automation &
applications and more than 95% of the industrial controllers are of PID type. PID controllers are
used for more precise and accurate control of various parameters. Most often these are used for
the regulation of temperature, pressure, speed, flow and other process variables. Due to robust
performance and functional simplicity, these have been accepted by enormous industrial
applications where a more precise control is the foremost requirement.

18

www.mitwpu.edu.in
What is a PID Controller?

A combination of proportional, integral and derivative actions is more commonly referred as PID
action and hence the name, PID (Proportional-Integral-Derivative) controller. These three
basic coefficients are varied in each PID controller for specific application in order to get optimal
response.

It gets the input parameter from the sensor which is referred as actual process variable. It also
accepts the desired actuator output, which is referred as set variable, and then it calculates and
combines the proportional, integral and derivative responses to compute the output for the
actuator.

Fig.1 Block Diagram of PID controller

Combining all three modes of control i.e. proportional, integral & derivative produces a
controller known as three mode controller or PID controller. The equation describing as
action can be determined as.

Controller O/P = Kp.e + ki ∫edt + kd de/dt

e is error between setpoint & feedback.

Where kp is the proportionality constant, ki the integral constant & kd the derivative constant.
Taking the laplace, transfer function is dtermind.

19

www.mitwpu.edu.in
Deviation of actual value from the desired value in the PID control algorithm causes to produce
the output to the depending on the combination of proportional, integral and derivative
responses. So the PID controller continuously varies the output to the actuator till the process
variable settle down to the set value. This is also called as closed loop feedback control
system.

All modern industrial controllers are of automatic type (or closed loop controllers), which are
usually made to produce one or combination of control actions. These control actions include

 ON-OFF Controller
 Proportional Controller
 Proportional-Integral Controller
 Proportional-Derivative Controller
 Proportional-Integral-Derivative Controller
In case of ON-OFF controller, two states are possible to control the manipulated variable, i.e.,
either fully ON (when process variable is below the set point) or Fully OFF (when process
variable is above the set point). So the output will be of oscillating in nature. In order to achieve
the precise control, most industries use the PID controller (or PI or PD depends on the
application)

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.

Proportional Control

By only employing proportional control, a steady state error occurs.

Proportional and Integral Control


20

www.mitwpu.edu.in
The response becomes more oscillatory and needs longer to settle, the error disappears.

Proportional, Integral and Derivative Control

All design specifications can be reached

Table 1: Characteristics of P, I, and D controllers

OVERSHOO SETTLING
CL RESPONSERISE TIME S-S ERROR
T TIME

Kp Decrease Increase Small Change Decrease

Ki Decrease Increase Increase Eliminate

Small Small
Kd Decrease Decrease
Change Change
Tips for
Designing a PID Controller

1. Obtain an open-loop response and determine what needs to be improved

2. Add a proportional control to improve the rise time

3. Add a derivative control to improve the overshoot

4. Add an integral control to eliminate the steady-state error

5. Adjust each of Kp, Ki, and Kd until you obtain a desired overall response.

TECHNICAL SPECIFICATION: -
PMDC Motor :- 12V DC, 1500 RPM, 1.5 Amp, Torque: ½ Kgcm, Mounting Horizontal

Optical Sensor / Inductive Proximity Sensor :- 3 Wire, Sensing Distance: 10cm/ 7mm, 24 VDC

RPM Indicator/ Tachometer :- Speed: 0-1500 RPM, Supply: 230V AC, Cut out size :92 X 92
Retransmission O/P: 4-20mA according 0-1500rpm, 3 ½ digital display.

DC Drive :- Power Supply: 230 V AC, Input : 4-20mA, Output Voltage. 0-12 V DC.
21

www.mitwpu.edu.in
Electrical Control Panel :- MS Powder coated panel with switches, indicator, test Points,
controller on front facia, UK 2.5 Terminal Connectors mounted on DIN rail channel, Use of 1sq
mm multi-strand wire with proper insulated Lugs, Feruling & Neat wire dressing & clamping.
Wires & power cables are seated through 1’’×1’’PVC cable tray.

Dimension: 1ft (L) ×1ft (W) ×1ft (H)

PID Controller :-Input: 4-20mA, Output:4-20mA, 3½ Digit display, Display: Dual for PV & SP
, Bar graph Display for Output & Deviation, High-Low Alarm Annunciation, Cut Out Size:
92mmX92mmX144mm

OPERATING PROCEDURE USING PID

1. Provide 230V AC supply to the set up.


2. Switch ‘ON’ all the rocker switches on the panel.
3. Make the toggle switch in UP position to select the control mode to AUTO MODE.
4. In AUTO MODE the control action is taking place by PID controller, If we connect R.
IND. OP (IN+) to PID I/N (IN+), R. IND. OP (IN-) to PID I/N (IN-) and PID O/P (IN+)
to DC DRIVE IP (IN+) and PID O/P (IN-) to DC DRIVE IP (IN-).i.e T1 TO T3, T2 TOO
T4, T5 TO T7 AND T6 T0 T8
5. Keep set point 50% i.e. 750 RPM, take PID controller in manual mode, as process
variable goes above the set point then take controller in auto mode for proper results.
6. Observe the speed of motor on Speed Indicator (RPM indicator).
7. Voltmeter and Ammeter shows voltage and current consumption of motor.
8. The speed of the motor will be controlled according to the set point.
9. RPM of Motor & corresponding time along with set point of RPM Should be noted. &
rest of the observations done.
10. Draw a graph between RPM & Time.

22

www.mitwpu.edu.in
Observation Table :
Test Report for DC Motor Speed control
Date RPM PV RPM SP OUT %
Time

23

www.mitwpu.edu.in
GRAPH OF RPM
1600
1400
1200
1000 TIME IN
RPM
MINUTE
800
RPM
600
400
200
0
1 2 3 4 5 6 7 8 9 10 11 12 13

Note: PV(Yellow)=processing value, SP(Green)=Set point, OUT(White)=Deviation

Conclusion:

24

www.mitwpu.edu.in
Post Lab Questions:
1) What is significance of Kp, Ki, Kd while designing PID controller?
2) Draw and explain block diagram of PID controller.
3) What are different applications of PID controller?
4) What is difference between Fuzzy Logic Controller and PID controller?

S. Y. B. Tech (ECE)
Semester: III Subject: Control System and Fuzzy Logic
Name: Class:
Roll No: Batch:

Experiment No: 05

Name of the Experiment: Implement various fuzzy membership functions.

Marks Teacher’s Signature with date


Performed on:

Submitted on:

Aim: To implement various fuzzy membership functions

Pre-requisite: Importance of membership function in fuzzy inference systems

Objective:
1. To understand importance of membership functions in fuzzy logic.
2. To understand importance of the parameters of every membership function.
3. To plot all membership functions.

25

www.mitwpu.edu.in
Theory:
The membership function of a fuzzy set is a generalization of the indicator function in
classical sets. In fuzzy logic, it represents the degree of truth as an extension of
valuation. Degrees of truth are often confused with probabilities, although they are
conceptually distinct, because fuzzy truth represents membership in vaguely defined
sets, not likelihood of some event or condition. Membership functions were introduced
by Zadeh in the first paper on fuzzy sets (1965).
Formal Definition of membership function Let us consider fuzzy set A, A = {(x, µA(x))|
x Є X} where µA(x) is called the membership function for the fuzzy set A. X is referred
to as the universe of discourse. The membership function associates each element x Є X
with a value in the interval [0, 1]. In fuzzy sets, each elements is mapped to [0,1] by
membership function. That is, μA : X €[0, 1], where [0,1] means real numbers between 0
and 1 (including 0,1). Consequently, fuzzy set is with ‘vague boundary set’ comparing
with crisp set. The fuzzy set A can be alternatively denoted as follows:
If X is discrete then A = Σ μA(xi) / xi
If X is continuous then A = ʃ μA(x) / x
Here, μA (x) is the “membership function”. Value of this function is between 0 and 1.
This value represents the “degree of membership” (membership value) of element x in
set A. The members of a fuzzy set are members to some degree, known as a membership
grade or degree of membership. The membership grade is the degree of belonging to the
fuzzy set. The larger the number (in [0, 1]) the more the degree of belonging. (N.B. This
is not a probability).The translation from x to µA(x) is known as fuzzification. In the
fuzzy theory, fuzzy set A of universe X is defined by function µA(x) called the
membership function of set A.
Fuzzy Set: Fuzzy set, as the name implies is a set without a crisp boundary. That is, the
transition from “belong to a set”, to “not belong to a set” is gradual, and this smooth
transition is characterized by membership functions that give fuzzy commonly used
linguistic expressions, such as “the water is hot” or “the temperature is high”. Such
imprecisely defined sets or classes play an important role, in the domain of pattern
recognition.

26

www.mitwpu.edu.in
If X is a collection of objects denoted generally by x, then a fuzzy set A in X is defined
as a set of ordered pairs:
A={ (x,µa(x) | xεX };
where µa(x) is a membership function for the fuzzy set A.

 Membership Function: Membership Function defines the fuzziness in a fuzzy set


irrespective of the elements in the set, which are discrete or continuous. The Membership
Function defines all the information contained in a fuzzy set.
The Membership Function maps each element of X to a membership grade (or value)
between 0 or 1.
Here X is referred to as the universe of discourse (information).
Membership functions: Parameterization and Formulation
1) Triangular Membership function
2) Trapezoidal MF
3) Gaussian MF
4) Generalized bell MF
5) Sigmoid membership function

27

www.mitwpu.edu.in
Figure 1.1: Various types of Fuzzy membership functions
Triangular Membership Function-

Triangular Membership Function is specified by 3 parameters {a,b,c} as follows:

triangle(x;a,b,c)= 0 ; x<=a

= (x-a)/(b-a); a<=x<=b

= (c-x)/(c-b); b<=x<=c

= 0; c<=x

An alternative expression for triangular membership function:


triangle(x;a,b,c)=max(min(((x-a)/(b-a)),(c-x)/(c-b)),0)
The parameters {a,b,c} (with a<b<c) determine the x coordinates of the three corners of
the underlying triangular MF (x;20,60,80).

28

www.mitwpu.edu.in
Figure 1.2: Triangular Membership Function

Trapezoidal Membership Function-

A trapezoidal MF is specified by 5 parameters {a,b,c,d} as follows:

trapezoid(x;a,b,c,d)=0 ; x<=a

=(x-a)/(b-a) ; a<=x<=b

= 1 ; b<=x<=c

=(d-x)/(d-c) ; c<=x<=d

= 0 ; d<=x

An alternative expression for trapezoidal membership function:

Trapezoidal(x;a,b,c,d)=max(min(min(((x-a)/(b-a)),1),((d-x)/(d-c))),0);

The parameters {a,b,c,d} (with a<b<c<d) determine the x coordinates of the four corners
of the underlying trapezoidal MF(x;10,20,60,95).

29

www.mitwpu.edu.in
Figure 1.3: Trapezoidal Membership Function

Gaussian Membership Function-

A Gaussian MF is specified by two parameters {C,σ}.

Gaussian(x;C,σ)= e[(-1/2)*((x-C)/ σ) ^2].

A Gaussian MF is determined completely by C and σ, C represents the MF’s centre and σ


determines the MF’s width.

Figure 1.4: Gaussian Membership Function

Generalized Bell Membership Function-


30

www.mitwpu.edu.in
A generalized bell MF (or bell MF) is specified by three parameters {a,b,c}.

bell(x;a,b,c)=1/(1+|(x-c)/a|2*b).

where the parameter b is usually positive (if b is –ve, the shape of this MF

becomes an upside down bell).

Figure 1.5.1: bell(x;20,4,50)

Figure 1.5.2: bell(x;50,4,50) ‘changing a’

31

www.mitwpu.edu.in
Figure 1.5.3: bell(x;20,10,50) ‘changing b’

Figure 1.5.4: bell(x;20,4,80) ‘changing c’

Sigmoidal Membership Function-

Sig(x;a,c)=1/(1+e(-a*(x-c)).

32

www.mitwpu.edu.in
where a controls the slope at the crossover point x=c.

Figure 1.6: Sigmoidal Membership Function

Algorithm:

1. Identify the variables (inputs, states, and outputs) of the system.


2. Partition the universe of discourse or the interval spanned by each variable into a
number
of fuzzy subsets, assigning each a linguistic label (subsets include all the elements in
the universe).
3. Assign or determine a membership function for each fuzzy subset.
4. Vary the parameters of membership function and understand their importance.

Conclusion:

33

www.mitwpu.edu.in
Post Lab Questions:
1. What is membership function? State its importance in fuzzy logic?
2. List and explain various methods employed for membership value assignment.
3. Compare “Medium wave (MW)” and “Short wave (SW)” receivers according to their
frequency range. Plot the membership functions using intuition. The linguistic variables
are defined based on the following”
Medium wave receivers: frequency less than 1MHz
Short wave receivers: frequency greater than 1MHz
4. What are different features of a membership function?
5. Write short note on “degree of uncertainty”
6. Justify intuition is based on human reasoning. Give some suitable examples.

S. Y. B. Tech (ECE)
Semester: III Subject: Control System and Fuzzy Logic
Name: Class:
Roll No: Batch:

Experiment No: 06
Name of the Experiment: Implement Defuzzyfication.
Marks Teacher’s Signature with date
Performed on:

Submitted on:

Aim: Implement defuzzification using Max-membership principle, Centroid method,


34

www.mitwpu.edu.in
Weighted average method.

Prerequisite: Fuzzification and Fuzzy inference system

Objectives:
1. To understand and implement fuzzification.
2. To understand importance of defuzzification.
3. To implement real time application and defuzzify the output.

Theory:
Defuzzification:
Conversion of Fuzzy set into a single crisp value is called Defuzzification. The set of
rules is applied to the fuzzified input. The output of each rule is fuzzy. These fuzzy
outputs need to be converted into a scalar output quantity so that the nature of the action
to be performed can be determined by the system. The process of converting the fuzzy
output is called defuzzification. Before an output is defuzzified all the fuzzy outputs of
the system are aggregated with an union operator. The union is the max of the set of
given membership functions. There are many defuzzification techniques but primarily
only three of them are in common use. These defuzzification techniques are discussed
below in detail.

Types Of Defuzzification Techniques:

1. Centroid Defuzzification Technique

This method is also known as center of gravity or center of area defuzzification. This
technique was developed by Sugeno in 1985. This is the most commonly used technique
and is very accurate. The centroid defuzzification technique can be expressed as

--(equ.2)

35

www.mitwpu.edu.in
where x* is the defuzzified output, µi(x) is the aggregated membership function and x is
the output variable. The only disadvantage of this method is that it is computationally
difficult for complex membership functions.

Consider following three membership functions.

1 1 1

0.9 0.9 0.9

0.8 0.8 0.8

0.7 0.7 0.7

0.6 0.6 0.6

0.5 0.5 0.5

0.4 0.4 0.4

0.3 0.3 0.3

0.2 0.2 0.2

0.1 0.1 0.1

0 0 0
0 5 10 0 5 10 0 5 10

Figure 2.1: Three Membership Function

Then using mean-max membership these membership functions are combined to form a
fuzzy rule set.

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 1 2 3 4 5 6 7 8 9 10

Figure 2.2: Fuzzification


36

www.mitwpu.edu.in
Above resultant is divided in the shapes of triangles and trapezoids. Centroids and area
for each shape. Defuzzified value is determined using equ.2.

2. Maximum Defuzzification Technique

This method gives the output with the highest membership function. This defuzzification
technique is very fast but is only accurate for peaked output. This technique is given by

algebraic expression as

; for all x X --
(equ.1)

where x* is the defuzzified value. This is shown graphically in Figure.

Figure 2.3: Maximum Defuzzification

3. Weighted Average Defuzzification Technique:

37

www.mitwpu.edu.in
In this method the output is obtained by the weighted average of the each output of the
set of rules stored in the knowledge base of the system. The weighted average
defuzzification technique can be expressed as

--
(equ.3) .

where x* is the defuzzified output, mi is the membership of the output of each rule,
and wi is the weight associated with each rule.

4. Mean-Max Membership Defuzzification Technique:

In this method mean of the maximum values of membership function is considered as


defuzzified value for the associated fuzzy set rule.

¿
x=
∑ ai --(equ.4)
∑i
¿
Where x is defuzzified output, ai is maximum value of membership rule.

5. First or Last of Membership Defuzzification technique.

Algorithm:

Defuzzification using Center of Gravity Method:

1. Enter the membership sets.


2. Using mean-max membership or max membership or First(or Last) membership form the
fuzzy set of given membership functions. Divide fuzzy set in the shapes of triangles and
trapezoids.
3. Calculate center of gravity and area for each shape.
4. Using (equ.2) determine defuzzified value.

38

www.mitwpu.edu.in
Conclusion:

39

www.mitwpu.edu.in
Post Lab Questions:
1. Define Defuzzification process. What is the necessity to convert the fuzzy quantities into
crisp quantities?
2. Compare various defuzzification methods.
3. How is lambda cut method employed for a fuzzy relation?
4. For the given membership function as shown in Fig. 2.4 determines the defuzzified
output
value by seven methods
(1) Max-membership principle, (2) Centroid method, (3) Weighted average method, (4)
Mean–max membership, (5) Centre of sums, (6) Centre of largest area, and (7) First of
maxima or last of maxima

Figure 2.4: Membership function

S. Y. B. Tech (ECE)
Semester: III Subject: Control System and Fuzzy Logic
Name: Class:
Roll No: Batch:

Experiment No: 07

Name of the Experiment: Implement Fuzzy Inference System with Mamdani Inferencing
mechanism

Marks Teacher’s Signature with date


Performed on:
40

www.mitwpu.edu.in
Submitted on:

Aim: Implement Fuzzy Inference System with Mamdani Inferencing mechanism

Prerequisite: Concepts of fuzzy membership functions, fuzzy relation and fuzzificztion

Objectives:
1. To understand fuzzification and defuzzification.
2. To implement Mamdani Fuzzy Inference System

Theory:
The Mamdani fuzzy inference system was proposed as the first attempt to control a steam
engine and boiler combination by a set of linguistic control rules obtained from experienced
human operators.
As an illustration of this model we would consider an example in which two input linguistic
variables, Temperature (T) and Pressure (P) are considered with following membership
functions:

Figure 3.1: Temperature MF.

41

www.mitwpu.edu.in
Figure 3.2: Pressure MF.

Legend: L: Low, BA: Below Average, A: Average, AA: Above Average, H: High.

The output linguistic variable is Heater Power (HP) whose membership functions are
given as follows:

Figure 3.3: Heater Power MF

Legend: L: Low, ML: Medium Low, M: Medium, MH: Medium High, H: High.

Let us consider only two rules from the Rule Base:

42

www.mitwpu.edu.in
R1: If the Temperature is BELOW AVERAGE and Pressure is BELOW
AVERAGE, then Heater Power is MEDIUM HIGH.
R2: If the Temperature is LOW and Pressure is LOW then Heater Power is HIGH.

Note: There exist 25 such rules in the Rule Base corresponding to:
5 (Ranges of Temperature) X 5 (Ranges of Pressure).

Now, let us consider a fact that is given as input to the fuzzy inference system:
T = 22.5o C (T falls in two ranges, L and BA).
P = 1.5 atm (P falls in two ranges, L and BA).

For this input Mamdani fuzzy inference system will work as follows:

Rule 1 Inference:

Figure 3.4: Rule 1

uTBA (22.5) = 0.5 uPBA (1.5) = 0.3333 Inference MF(shaded)


= uHPMH (new)
= 0.3333 x uHPMH

43

www.mitwpu.edu.in
Rule 2 Inference:

min (0.5, 0.3333) = 0.3333

Figure 3.5: Rule 2


uTL (22.5) = 0.16667 uPL (1.5) = 0.3333 Inference MF (shaded)
= uHPH (new)
= 0.1667 x uHPH
min (0.1667, 0.3333) = 0.1667
Resultant Fuzzy reasoning:

44

www.mitwpu.edu.in
Figure 3.6: Fuzzified output

Defuzzification Step:

Area (uHPMH) = ½ x 1 x 1 = 0.5

Area (uHPH) = 2 x ( ½ x 0.75 x 1 ) = 0.75

Centre (uHPMH) = 4

Centre (uHPH) = 5

uHPMH (new) = 0.3333

uHPH (new) = 0.1667

Centroid =

[ uHPMH (new) x Area (uHPMH) x Centre (uHPMH) + uHPH (new) x Area (uHPH) x Centre (uHPH) ] =

[uHPMH (new) x Area (uHPMH) + uHPH (new) x Area (uHPH) ]

[ 0.3333 x 0.5 x 4 + 0.1667 x 0.75 x 5 ] = 4.4287 W

[ 0.3333 x 0.5 + 0.1667 x 0.75 ]

Thus, a heater power required to maintain the temperature and pressure is 4.4287 W
when the temperature reading of the boiler is 22.5o C and pressure reading is 1.5 atm.

Algorithm:
The steps in designing a simple fuzzy control system are as follows:
1. Identify the variables (inputs, states, and outputs) of the system.
2. Partition the universe of discourse or the interval spanned by each variable into a
number
of fuzzy subsets, assigning each a linguistic label (subsets include all the elements in

45

www.mitwpu.edu.in
the
universe).
3. Assign or determine a membership function for each fuzzy subset.
4. Assign the fuzzy relationships between the inputs or state’s fuzzy subsets on the one
hand and the outputs fuzzy subsets on the other hand, thus forming the rule-base.
5. Choose appropriate scaling factors for the input and output variables in order to
normalize the variables to the [0, 1] or the [−1, 1] interval.
6. Fuzzify the inputs to the controller.
7. Use fuzzy approximate reasoning to infer the output contributed from each rule.
8. Aggregate the fuzzy outputs recommended by each rule.
9. Apply defuzzification to form a crisp output.

Conclusion:

46

www.mitwpu.edu.in
Post Lab Questions:
1.With a suitable block diagram, explain the construction and working of fuzzy inference
system
2 Write a short note on the Mamdani method of fuzzy inference system
3. Write in detail about the Sugeno method adopted in fuzzy inference system.
4. The age of building is to be determined the linguistic terms are “old” and “young”

For the building in years, find the membership functions for the following expressions: (a)
Very old (b) Very old or very young (c) Not very old and fairly young ( [young]2/3) (d)
Young or slightly old.

S. Y. B. Tech (ECE)
Semester: III Subject: Control System and Fuzzy Logic
Name: Class:
Roll No: Batch:

Experiment No: 08
Name of the Experiment: Implement various fuzzy membership functions.

Marks Teacher’s Signature with date


Performed on:

Submitted on:

47

www.mitwpu.edu.in
Aim: To implement Application of Fuzzy controller

Pre-requisite: basics of fuzzy logic, fuzzy inference systems

Objective:
1. To implement any real time application of fuzzy logic controller.
2. To understand working of plant and formation of rules.
3. Design Fuzzy Association Memory
Theory:
Architecture and Operations of FLC System:
The basic architecture of a fuzzy logic controller is shown in Figure 1. The principal
components of an FLC system is a fuzzifier, a fuzzy rule base, a fuzzy knowledge base, an
inference engine, and a defuzz.ifier. It also includes parameters for normalization. When the
output from the defuzzifier is not a control action for a plant, then the system is a fuzzy logic
decision system. The fuzzifier present converts crisp quantities into fuzzy quantities. The fuzzy
rule base stores knowledge about the operation of the process of domain expertise. The fuzzy
knowledge base stores the knowledge about all the input-output fuzzy relationships. It includes
the membership functions defining the input variables to the fuzzy rule base and the out
variables to the plant under control. The inference engine is the kernel of an FLC system, and it
possesses the capability to simulate human decisions by performing approximate reasoning to
achieve the desired control strategy. The defuzzifier converts the fuzzy quantities into crisp
quantities from an inferred fuzzy control action by the inference engine.

48

www.mitwpu.edu.in
Fig 1: Basic architecture of a FLC System

The various steps involved in designing a fuzzy logic controller are as follows:

 Step 1: Locate the input, output, and state variables of the plane under consideration. I
 Step 2: Split the complete universe of discourse spanned by each variable into a number of
fuzzy subsets, assigning each with a linguistic label. The subsets include all the elements in
the universe.
 Step 3: Obtain the membership function for each fuzzy subset.
 Step 4: Assign the fuzzy relationships between the inputs or states of fuzzy subsets on one
side and the output of fuzzy subsets on the other side, thereby forming the rule base.
 Step 5: Choose appropriate scaling factors for the input and output variables for
normalizing the variables between [0, 1] and [-1, I] interval.
 Step 6: Carry out the fuzzification process.
 Step 7: Identify the output contributed from each rule using fuzzy approximate reasoning.
 Step 8: Combine the fuzzy outputs obtained from each rule.
 Step 9: Finally, apply defuzzification to form a crisp output.
The above steps are performed and executed for a simple FLC system. The following design
elements are adopted for designing a general FLC system:

1. Fuzzification strategies and the interpretation of a fuzzifier.

49

www.mitwpu.edu.in
2. Fuzzy knowledge base: Normalization of the parameters involved; partitioning of input
and output spaces; selection of membership functions of a primary fuzzy set.
3. Fuzzy rule base: Selection of input and output variables; the source from which fuzzy
control rules are to be derived; types of fuzzy control rules; completeness of fuzzy control
rules.
4. Decision· making logic: The proper definition of fuzzy implication; interpretation of
connective “and”; interpretation of connective “or”; inference engine.
5. Defuzzification materials and the interpretation of a defuzzifier.
Applications:
FLC systems find a wide range of applications in various industrial and commercial products
and systems. In several applications- related to nonlinear, time-varying, ill-defined systems and
also complex systems – FLC systems have proved to be very efficient in comparison with other
conventional control systems. The applications of FLC systems include:

1. Traffic Control
2. Steam Engine
3. Aircraft Flight Control
4. Missile Control
5. Adaptive Control
6. Liquid-Level Control
7. Helicopter Model
8. Automobile Speed Controller
9. Braking System Controller
10. Process Control (includes cement kiln control)
11. Robotic Control
12. Elevator (Automatic Lift) control;
13. Automatic Running Control
14. Cooling Plant Control
15. Water Treatment
16. Boiler Control;
17. Nuclear Reactor Control;
50

www.mitwpu.edu.in
18. Power Systems Control;
19. Air Conditioner Control (Temperature Controller)
20. Biological Processes
21. Knowledge-Based System
22. Fault Detection Control Unit
Conclusion:

Post Lab Questions:


1. What are advantages of Fuzzy logic controller over PID controller?
2. What are the steps while designing Fuzzy Logic controller.
3. Explain any one application of Fuzzy Logic Controller in detail.

51

www.mitwpu.edu.in

You might also like