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

ECEg4324: Neural Networks

& Fuzzy Logic Control


Nigusu Teshome,
Lecturer/Electrical and Computer Engineering Department,
Institute of Technology,
University of Gondar, Ethiopia.
eMail: nigusteshome@gmail.com
Chapter Three
Fuzzy Logic Control
(FLC) 2
Contents/Out Lines
3.1. Fuzzy Implication Methods
3.2. Defuzzification Methods
3.3. Classical Programmable Logic Control
3.4. Fuzzy Logic Control
3.5. Matlab Simulations using the Fuzzy Toolbox
3
3.1. Fuzzy Implication Methods
Fuzzy implication refers to the interpretation of each rule, that is, to determine
the effect of the antecedent on the consequent part of the rule.
As fuzzy propositions and fuzzy relations are expressed by MFs, it follows that
fuzzy implications also imply MFs as a method of interpretation.
There are four inference and aggregation mechanisms named after
 Mamdani, Larsen, Takagi-Sugeno-Kang, and Tsukamoto commonly used to
interpret a collection of rules.
For control applications two of them are preferred: a max-min or a Mamdani and
a product or Larsen implication.
1. Mamdani Inference Method
• Given rules “If x is Ai then y is Bi ”, i = 1, . . . , n where x = (x1, x2, . . . , xk ), they
are combined in the Mamdani model as:
R(x, y ) = max{min{Ai (x ), Bi (y )}} 4
Cont’d…
Note that for the expanded set of rules:
Ri : If Ai1 and Ai2 and . . . and Aik then Bi , i = 1, 2, . . . , n

5
Cont’d…
2. Larsen Inference Method
In this method, the MFs are not truncated, instead they are scaled.
• It uses the same max-min rule as Mamdani rule.
Ri : If Ai1 and Ai2 and . . . and Aik then Bi , i = 1, 2, . . . , n

6
3.2. Defuzzification Methods
The result of implication and aggregation steps is the fuzzy output, which is the union
of all outputs of individual rules that are validated.
In control theory, a crisp output is often needed which requires the process of
defuzzification.
1. Center of Area Method
The center of area, or center of gravity, or centroid method computes the center of
area of the region under the curve defined by a fuzzy set and selects the first
component.
 If C is the fuzzy set in question and C is integrable, then the defuzzified value of C by
this method is:
𝑏
𝑎
𝑧𝐶 𝑧 𝑑(𝑧)
𝑧0 = 𝑏
𝑎
𝐶 𝑧 𝑑(𝑧)
7
Cont’d…
 If the support of C is finite, the computation is
𝑛
𝑗=1 𝑧𝑗 𝐶(𝑧𝑗 )
𝑧0 = 𝑛
𝑗=1 𝐶(𝑧𝑗 )

2. Height-center of Area Method


The height-center of area defuzzification method ignores values of the fuzzy set
below some level α, then uses the center of area method on the resulting curve.
3. Max Criterion Method
This method chooses an arbitrary value from the set of values in the domain on
which the fuzzy set assumes its maximum.
4. First of Maxima Method
First of maxima takes the smallest value in the domain on which the fuzzy set
assumes its maximum.
8
Cont’d…
5. Middle of Maxima Method
Middle of maxima, or mean of maxima, takes the average of the smallest and largest
values in the domain on which the fuzzy set assumes its maximum.
Example 1:
A FLC that emulates a PD controller will be required to minimize the error 𝑒(𝑡) and
the rate of change of error 𝑑𝑒(𝑡) 𝑑𝑡 or 𝑐𝑒.
a) The Fuzzification Process
• The size of the universe of discourse will depend on the expected range (usually up to
saturation level) of the input variables.
• Assume for the system about to be considered that 𝑒 has a range of ±6 and 𝑐𝑒 has a
range of ±1.
• The number and shape of fuzzy sets in a particular universe of discourse is a trade-off
between precision of control action and real time computational complexity. 9
Cont’d…
• In this example, seven triangular sets will be used.
• Each set (MF) is given a linguistic label to identify it, such as positive big (PB),
positive medium (PM), positive small (PS), about zero (Z), negative small (NS),
negative medium (NM), negative big (NB).
• If at a particular instant, 𝑒(𝑡) = 2.5 and 𝑐𝑒 = −0.2, then the input fuzzy set
membership values are:
µ𝑃𝑆(𝑒) = 0.7, µ𝑃𝑀 (𝑒) = 0.4
µ𝑁𝑆(𝑐𝑒) = 0.6, µ𝑍(𝑐𝑒) = 0.3
b) The Fuzzy Rule Base
• The fuzzy rule base consists of a set of antecedent-consequent linguistic rules of the
form:
IF e is PS AND ce is NS THEN u is PS.
10
Cont’d…

11
Cont’d…

c) The Fuzzy Inference


The output window for the control signal assumes seven fuzzy sets with the
universe of discourse ±9. 12
Cont’d…

• The fuzzy sets that were ‘hit’ in the error window when 𝑒(𝑡) = 2.5 were PS and PM.
• In the rate of change input window when 𝑐𝑒 = −0.2, the fuzzy set to be ‘hit’ were
NS and Z. 13
Cont’d…
 Thus, the relevant rules that correspond to these hits are:
R1: IF e is PS AND ce is NS OR IF e is PS AND ce is Z THEN u is PS.
R2: IF e is PM AND ce is NS OR IF e is PM AND ce is Z THEN u is PM.
Applying the max-min inference for R1:
µ𝑃𝑆(𝑢) = 𝑚𝑎𝑥[𝑚𝑖𝑛(µ𝑃𝑆(𝑒), µ𝑁𝑆(𝑐𝑒)), 𝑚𝑖𝑛(µ𝑃𝑆(𝑒), µ𝑍(𝑐𝑒))]
• Inserting the obtained values:
µ𝑃𝑆(𝑢) = 𝑚𝑎𝑥[𝑚𝑖𝑛(0.7, 0.6), 𝑚𝑖𝑛(0.7, 0.3)] = 0.6
Similarly applying the max-min inference for R2:
µ𝑃𝑀(𝑢) = 𝑚𝑎𝑥[𝑚𝑖𝑛(µ𝑃𝑀(𝑒), µ𝑁𝑆(𝑐𝑒)), 𝑚𝑖𝑛(µ𝑃𝑀(𝑒), µ𝑍(𝑐𝑒))]
• Inserting the obtained values:
µ𝑃𝑀(𝑢) = 𝑚𝑎𝑥[𝑚𝑖𝑛(0.4, 0.6), 𝑚𝑖𝑛(0.4, 0.3)] = 0.4
14
Cont’d…
d) The Defuzzification Process
By using the center of area defuzzification technique,
Sum of first moments of area
Crisp control signal =
Sum of areas
0.6(6 + 2.4)
Area𝑃𝑆 = = 2.52
2
0.4(6 + 3.6)
Area𝑃𝑀 = = 1.92
2
• Finally,
2.52 × 3 + 1.92 × 6
𝑢 𝑡 = = 𝟒. 𝟑
2.52 + 1.92
• Hence, for given error of 2.5, and a rate of change of error of −𝟎. 𝟐, the control signal
from the fuzzy controller is 4.3. 15
Cont’d…

 Exercise: For the input and output fuzzy windows given above together with the
fuzzy rule base, determine
a) The membership values of the input windows e and ce
b) The max-min fuzzy inference equations
c) The crisp control signal 𝑢(𝑡).
when 𝑒 = −3 and 𝑐𝑒 = 0.3. 16
3.3. Classical Programmable Logic Control
 A programmable logic controller (PLC) is a simple microprocessor-based,
specialized computer which performs various logical control functions.

17
Cont’d…
o A PLC usually operates on ordinary house current but may control circuits of
large amperage and voltage of 440V and higher.
o A PLC typically has a detachable programmer module, used to construct a new
program or modify an existing one.
o The program instructions are typed into the memory by the user via a keyboard.
o The central processing unit (CPU) is the heart of the PLC, which has three
parts: the processor, memory, and power supply.
o In the input-output (I/O) modules,
 The input module has terminals into which the user enters outside process
electrical signals and
 The output module has another set of terminals that send action signals to the
processor. 18
Cont’d…
o A remote electronic system for connecting the I/O modules to long-distance locations
can be added,
 So that the actual operating process under the PLC control can be some miles
away from the CPU and its I/O modules.
o Optional units include racks, chassis, printer, program recorder/player, etc.
o The design procedure is time-consuming. However, once a design has been
completed, the PLC can be automatically programmed over and over again.
o When the job assignment is changed, the PLC has the flexibility to be reprogrammed
to perform a new logic control process.
o But PLC can only perform classical two-valued logic in programming some relatively
simple but very precise automatic control processes.
o To carry out fuzzy logic-based control programming, a new type of programmable
fuzzy logic controllers is needed. 19
3.4. Fuzzy Logic Control (FLC)
 The majority of FLC systems are knowledge-based systems in that either their fuzzy
models or their fuzzy logic controllers are described by fuzzy IF-THEN rules.
These rules have to be established based on experts’ knowledge about the systems,
controllers, performance, etc.
Moreover, the introduction of input-output intervals and membership functions is more or
less subjective,
depending on the designer’s experience and the available information.
However, we emphasize once again that after the determination of the fuzzy sets, all
mathematics to follow are rigorous.
Also, the purpose of designing and applying fuzzy logic control systems is, above all, to
tackle those
 vague, ill-described, and complex plants and processes that can hardly be handled by
classical systems theory, classical control techniques, and classical two-valued logic.
20
Cont’d…
A Closed-Loop Set-Point Tracking System
 Assume a conventional (crisp) plant, which is given but its mathematical model may
not be known, and that all the signals (𝑟, 𝑒, and 𝑦) are crisp.

The closed-loop set-point tracking control problem is to design the controller such
that the output signal of the controlled plant, 𝑦, can track the given reference signal 𝑟
(need not be a constant):
𝑒 𝑡 ∶= 𝑟 𝑡 − 𝑦 𝑡 ⟶ 0 (𝑡 ⟶ ∞) 21
Cont’d…
 To design a conventional controller, a precise mathematical model (formulation) of
the plant is usually necessary.
Here, let’s discuss how to design a fuzzy logic controller, not necessarily of PID-type,
for set-point tracking.
We suppose that the mathematical formulation of the plant is completely unknown.
If the mathematical formula of the plant is unknown, how can we design a controller
to perform the required set-point tracking?
One may think of designing a conventional controller and try to answer this question
at this point, to appreciate the ease of fuzzy logic controller design to be studied
below.
Before we discuss how to design fuzzy logic controller let’s clarify some basic
concepts and to introduce some new terminology.
22
Cont’d…
 First, the general structure of a FLC consists of three basic portions: the
fuzzification unit, the inference engine, and the defuzzification unit.

 The fuzzification module transforms the physical values of the input (error signal) into a
normalized fuzzy subset.
• The subset for the range of the input values and an associate MF describes the degrees of
confidence of the input belonging to this range.
• The purpose of this fuzzification step is to make the input physical signal compatible with
the fuzzy control rule base in the core of the controller. 23
Cont’d…
The role of the inference engine in the FLC is key to make the controller work effectively.
• The job of the “engine” is to create the control actions, in fuzzy terms, according to the
information provided by the fuzzification module.
• The establishment of the rule base depends heavily on the designer’s work experience,
knowledge about the physical plant, analysis and design skills, etc., and is, hence, more or
less subjective.
• Thus, a good design can make the controller work; a better design can make it work more
effectively.
• This situation is just like conventional design: any specific design is not unique in
general.
The defuzzification module is the connection between the control rule base and the physical
plant to be controlled, which plays the role of a transformer mapping the controller outputs
(generated by the control rule base in fuzzy terms) back to the crisp values that the plant can
accept.
• Hence, in a sense the defuzzification module is the inverse of the fuzzification module.
24
Cont’d…
Assumptions in a Fuzzy Control System Design
i. The plant is observable and controllable: state, input, and output variables are
usually available for observation and measurement or computation.
ii. There exists a body of knowledge comprising a set of linguistic rules, engineering
common sense, intuition, or a set of input–output measurements data from which
rules can be extracted.
iii. A solution exists.
iv. The control engineer is looking for a “good enough” solution, not necessarily the
optimum one.
v. The controller will be designed within an acceptable range of precision.
vi. The problems of stability and optimality are not addressed explicitly; such issues
are still open problems in fuzzy controller design.
25
Cont’d…
Design Principle of Fuzzy Logic Controllers (a)
In this example, we start with a design of PID control for a simple model of an automobile
cruise control system.
The control objective is to maintain a speed preset by the driver.
If we neglect the inertia of the wheels, and assume that friction is what is opposing the
motion of the car, then the plant description is reduced as shown in Figure below.

26
Cont’d…
 Using Newton’s law of motion, the model equations for this system are
𝑑𝑣
𝐹=𝑚 + 𝑏𝑣
𝑑𝑡
𝑦=𝑣
where 𝐹 is the force produced by the engine and 𝑣 is the measured velocity of the
automobile.
 For this example, Let us assume that 𝑚 = 1000𝑘𝑔, 𝑏 = 50𝑁s/m, and 𝐹 = 500𝑁, a
constant force produced by the engine.
• When the engine produces a 500N force, the car will reach a maximum velocity of
10m/s.
• An automobile should be able to accelerate up to that speed in less than 5s.
• For this simple cruise control system, we can assume an allowable overshoot of 10% on
the velocity and a 2% steady-state error.
27
Cont’d…
 Correspondingly, the plant transfer function becomes
𝑌(𝑠) 1 1 1000
= =
𝐹(𝑠) 𝑚𝑠 + 𝑏 𝑠 + 0.05
For a constant force of 500N produced from the start, with the automobile initially at rest, this
represents a step input where 𝐹(𝑠) = 500/𝑠.
We can now compute the open-loop response of the system to examine how well the system
behaves without any controller action.
The open-loop response of the plant is that produced by the engine force acting on the mass
of the automobile.
In this analysis, there is no controller action as there is no feedback. Therefore, the output
response is
0.5
𝑌 𝑠 =
𝑠(𝑠 + 0.05)
The time domain response is: 𝑦 𝑡 = 10𝑢 𝑡 − 10𝑒 −0.05𝑡 𝑢(𝑡) 28
Cont’d…
 The graph in Figure below shows that the vehicle takes more than 100s to reach the steady-
state speed of 10m/s.
Clearly, this does not satisfy our rise time criterion of less than 5 seconds.

From the above analysis, we have determined that a controller is needed to improve the
performance.
The performance of this system can be improved by providing a unity feedback controller.
29
Cont’d…

We choose the standard PID transfer function for the controller, namely,
𝐾𝐼
𝐺𝑐 𝑠 = 𝐾𝑃 + + 𝐾𝐷 𝑠
𝑠
The objective in the controller design then is to select the appropriate parameters for
KP , KI , and KD to satisfy all design criteria.
To design a PID controller for a given system, follow the steps shown below to obtain
a desired response. 30
Cont’d…
i. Obtain the open-loop response and determine what needs to be improved.
ii. Add proportional control to improve the rise time, KP > 0.
iii. Add derivative control to improve the overshoot, KD > 0.
iv. Add integral control to eliminate the steady-state error, KI > 0.
v. Adjust each of KP , KI , and KD until a desired overall response is obtained.
In general, it is intuitive to think that if the rise time is made too small, the velocity
might reach the desired value at the expense of large overshoot.
Naturally then, we need to be concerned about how we can best control the overshoot
as a consequence of reducing the rise time.
To achieve only proportional control action, we select KP > 0 and set KD = KI = 0 in
the controller transfer function Gc(s).
Selecting values for any of the constants is on a purely trial and error basis.
However, we should keep in mind that the proportional gain KP affects the time
constant and consequently the rate of rise. 31
Cont’d…
 The controller and plant can be combined into a single transfer function, namely,
𝐾𝑃
𝐺 𝑠 = 𝐺𝑐 𝑠 𝐺𝑝 𝑠 =
𝑚𝑠 + 𝑏
For a unity feedback system, we obtain the closed-loop transfer function of the system
as:
𝑌(𝑠) 𝐾𝑃
=
𝐹(𝑠) 𝑚𝑠 + 𝑏 + 𝐾𝑃
Let us select KP = 100 as a start and see what happens.
𝑌(𝑠) 0.1
=
𝐹(𝑠) 𝑠 + 0.15
Since the desired velocity of 10m/s, we need reference of amplitude 10m/s; and using
F(s) = 10/s, we obtain the closed-loop response y (t) as
𝑦 𝑡 = 6.6667𝑢 𝑡 − 6.6667𝑒 −0.15𝑡 𝑢(𝑡) 32
Cont’d…

 Once again, we see that choosing KP = 100 still does not satisfy our rise time criterion
of less than 5s.
 However, we do see an improvement over the open-loop response shown earlier.
 Choosing KP = 1000, and carrying out an analysis similar to the above shows that the
closed-loop response satisfies the performance criteria for rise time:
𝑦 𝑡 = 9.9502𝑢 𝑡 − 9.9502𝑒 −1.005𝑡 𝑢(𝑡) 33
Cont’d…

• However, the response continues to exhibit the small steady-state error of


10 − 9.9502 = 0.0498m/s as shown in Figure above.
• We see that there is no issue in this example relating to overshoot. The only
issue is steady-state error w/c can be corrected by integral control.
• The reason for not needing derivative control should be obvious that there is no
term that can produce sinusoidal oscillation. 34
Cont’d…
 We now proceed to implement integral control by choosing values KI > 0.
Choosing a value of KP = 1000, KI = 40, and with KD = 0, we get the closed loop transfer
function as
𝑌(𝑠) 𝑠 + 0.04
= 2
𝐹(𝑠) 𝑠 + 1.05𝑠 + 0.04

35
Cont’d…
 From the above example, we have seen the trial and error nature of designing a
PID controller.
Indeed, the parameters can be selected by using Zeigler-Nichols PID tuning
methods.
But still it should be clear that if the model parameters change, so will the
parameters of the PID controller.
As such, there is significant redesign effort needed to obtain satisfactory
performance from the controller.
Let us now investigate the ease with which we can design a fuzzy controller.
We define velocity error as the difference “desired velocity minus actual
velocity” where the desired velocity is the set-point.
Then the acceleration is the time-derivative of the velocity error.
36
Cont’d…
 From the dynamics of the automobile, if the actual velocity is less than the desired
velocity, we need to accelerate the vehicle by providing as much force as needed to
bring the velocity to the desired level.
If the actual velocity is more than the desired velocity, we need to reduce the force so
that the vehicle can decelerate and attain the desired velocity.
If the vehicle is at the desired velocity, we apply sufficient force to maintain the
velocity at the set-point.
This knowledge of the system behavior allows us to formulate a set of general rules. The
following are some example rules:
1. If velocity error is positive and acceleration is negative then apply maximum force.
2. If velocity error is negative and acceleration is positive then apply minimum force.
3. If velocity error is zero and acceleration is zero then apply normal force.
The fuzzy controller we wish to design needs two inputs, velocity error and
acceleration, in order to generate the appropriate output, engine force.
37
Cont’d…

We can set up a triangular fuzzy sets for the fuzzy variables, namely, velocity error,
acceleration, and engine force.

38
Cont’d…
With the fuzzy sets defined, it is now possible to associate the fuzzy sets in the form of fuzzy
rules.
For two inputs and one output, it is easy to visualize the associations in the form of a table,
called a fuzzy associative memory or decision table.
For this system, we can obtain such a table as shown in Figure below.

A ity
V

cc
elo

e l Err
c

er
at or
io
n
NA ZA PA
NE Min Min Min

ZE Normal Normal Normal


PE Max Max Max
39
Cont’d…
The associative memory is a set of nine rules of the form:
R1: If velocity error is NE and acceleration is NA, then engine force is Min.
R2: If velocity error is NE and acceleration is ZA, then engine force is Min.
R3: If velocity error is NE and acceleration is PA, then engine force is Min.
R4: If velocity error is ZE and acceleration is NA, then engine force is Normal.
R5: If velocity error is ZE and acceleration is ZA, then engine force is Normal.
R6: If velocity error is ZE and acceleration is PA, then engine force is Normal.
R7: If velocity error is PE and acceleration is NA, then engine force is Max.
R8: If velocity error is PE and acceleration is ZA, then engine force is Max.
R9: If velocity error is PE and acceleration is PA, then engine force is Max.
 Once the rule base is determined, this can be simulated using MATLAB®/
Simulink fuzzy logic toolbox. 40
Cont’d…
Design Principle of Fuzzy Logic Controllers (b)
We now investigate the design of a fuzzy controller to control the dynamics of a DC
servomotor.
In this example, we wish to control the angular position of the rotor to coincide
with some desired position.
Let us define position error as the difference “desired position minus actual
position” where desired position is the set point.
We can then use position error and rotor velocity as the two input variables to the
controller and obtain the necessary voltage to be applied to the motor as the output
of the controller.
Schematically, the fuzzy controller can be shown in Figure below.
41
Cont’d…

 The shaft of DC motor can be rotated either in the clockwise or counter-clockwise


direction by simply reversing the polarity of the applied voltage.
 Hence, if the actual position is less than the desired (a +ve error), we can achieve the
desired position by boosting the voltage applied to the motor terminals.
 For a negative error, when the rotor position is greater than that which is desired, the
voltage polarity can be reversed so that the rotor turns in the opposite direction. 42
Cont’d…
This knowledge of the system behavior allows us to formulate a set of general rules
as, for example,
1. If position error is positive and velocity is negative, then apply positive voltage.

43
Cont’d…
With the fuzzy sets defined, it is now possible to associate the fuzzy sets in
the form of fuzzy rules.
When there are two inputs and one output, it is easy to visualize the
associations in the form of a matrix.
Po

V
elo n E
s
iti

c i r ro
o

ty
NV ZV PV
r

NE Negative Negative Negative

ZE Zero Zero Zero


PE Positive Positive Positive
44
Cont’d…
The matrix in the above table summarizes the following set of nine rules:
R1: If position error is NE and velocity is NV, then motor voltage is Negative.
R2: If position error is NE and velocity is ZV, then motor voltage is Negative.
R3: If position error is NE and velocity is PV, then motor voltage is Negative.
R4: If position error is ZE and velocity is NV, then motor voltage is Zero.
R5: If position error is ZE and velocity is ZV, then motor voltage is Zero.
R6: If position error is ZE and velocity is PV, then motor voltage is Zero.
R7: If position error is PE and velocity is NV, then motor voltage is Positive.
R8: If position error is PE and velocity is ZV, then motor voltage is Positive.
R9: If position error is PE and velocity is PV, then motor voltage is Positive.
Here also once the rule base is determined, this can be simulated using MATLAB®
fuzzy logic toolbox. 45
3.5. Matlab Simulations using the Fuzzy Toolbox
The basic fuzzy inference system may be simulated in MATLAB®, and the operations
are summarized in the following Table.

46
Cont’d…
The following Figure shows the basic steps of developing a fuzzy inference
system in MATLAB®/Simulink.

47
Cont’d…
a) Simulating Automobile Cruise Control System
A Simulink model of fuzzy cruise control system is shown in Figure below and
parameters of the Simulink blocks are listed in the Table.

48
Cont’d…
Configuring the Fuzzy Inference System in MATLAB:
After the command “Fuzzy” is entered in the MATLAB command window, a FIS
(Fuzzy Inference System) editor window will appear as shown:

49
Cont’d…
There is only one input and one output in the newly opened FIS by default, whereas the
proposed fuzzy controller has two inputs,
One for adjusting velocity error and another for adjusting acceleration.
• Hence one more input should thus be added.
This is done by clicking ‘Edit’ on the FIS Editor and selecting ‘Add Variable’ and ‘Input’,
as shown in the Figure below.

50
Cont’d…

51
Cont’d…
Double-click any one input or output box in the ‘FIS Editor’. A ‘Membership
Function Editor’ window appears as shown in Figure below.

52
Cont’d…
The membership function of the input and output need to be configured manually in
the ‘Membership Function Editor’ with parameter values given in Table.

Double-click the fuzzy rule box ‘Untitled (mamdani)’ in the center of the FIS editor to
bring up the ‘Rule Editor’ window as shown in Figure below.
Fuzzy inference rules may be configured manually in the ‘Rule Editor’ with the rules
described in (PP. 40). 53
Cont’d…

When the editing of the Fuzzy Inference System is completed, click the ‘File’ icon
and export the Fuzzy Inference System with a filename. 54
Cont’d…
The filename should match the parameter in the ‘Fuzzy Logic Controller’ block in the
Simulink.
In this example, the file name is ‘cruise’.
Also, the file should be saved to current MATLAB paths, in order that it can be called
by the Simulink model of Fuzzy cruise controller.
MATLAB simulation results are plotted as follows.
It is clear from the simulated outputs that rapid prototyping of the controller is
possible.
However, the membership functions will have to be “tuned” to yield the desired
output characteristics – that is, the parameters of these functions will need to be
adjusted.
When the membership functions are tuned, this will change the shape of the control
surface and affect the behavior of the closed-loop control system. 55
Cont’d…

56
Cont’d…
b) Fuzzy PI Controller
A Simulink model of PI control system may be constructed as shown in Figure
below.

57
Cont’d…

58
Cont’d…
 After running the Simulink model of PI control system as shown in PP. 57, the
simulation results of controller command (dot line) and system output (solid line) are
obtained as shown in Figure below.

The performance of the PI controller may be further optimized by tuning the


proportional gain KP and the integral gain KI. 59
Cont’d…
Fuzzy Logic Control Modeling in Simulink
In the previous PI controller, both the proportional gain KP and the integral gain KI are
constant.
In order to improve the controller performance, the gains should be varied as e(t)
varies.
• This is accomplished by varying KP and KI according to some fuzzy rules when the
absolute value of error varies.
• For example, the rules may be defined as follows:
R1: If abs(e(t)) is large, then KP is large and KI is large.
R2: If abs(e(t)) is small, then KP is large and KI is zero.
R3: If abs(e(t)) is zero, then KP is large and KI is small.
A Simulink model of fuzzy PI control system is shown in Figure below and the
corresponding parameters of the blocks are listed in the Table. 60
Cont’d…

61
Cont’d…
Configuring the Fuzzy Inference System in MATLAB

62
Cont’d…

63
Cont’d…

64
Cont’d…
Running the Simulation for the PI Controller and Fuzzy Controller
• The simulation results of PI controller (dot line) and fuzzy controller (solid line) are
displayed, as shown in Figure.

65
Cont’d…
• The plot for control signal that is utilized for PI and FLC control is depicted by the
following Figure.

66
THANK YOU!!

You might also like