Design and Implementation of Fuzzy Logic Controller For A Process
Design and Implementation of Fuzzy Logic Controller For A Process
Fall 1-31-1994
Recommended Citation
Nerurkar, Sujit S., "Design and implementation of fuzzy logic controller for a process control application"
(1994). Theses. 1214.
https://digitalcommons.njit.edu/theses/1214
This Thesis is brought to you for free and open access by the Electronic Theses and Dissertations at Digital
Commons @ NJIT. It has been accepted for inclusion in Theses by an authorized administrator of Digital Commons
@ NJIT. For more information, please contact [email protected].
Copyright Warning & Restrictions
Printing note: If you do not wish to print this page, then select
“Pages from: first page # to: last page #” on the print dialog screen
The Van Houten library has removed some of the
personal information and all signatures from the
approval page and biographical sketches of theses
and dissertations in order to protect the identity of
NJIT graduates and faculty.
ABSTRACT
by
Sujit S. Nerurkar
Many industrial applications of fuzzy logic control have been reported. This thesis
studies and reports the problems associated with the Heat-exchanger temperature control
via conventional PID control implemented with Programmable Logic Controllers (PLC)
and provides an example of design and implementation of fuzzy logic controllers (PLC's)
for a Heat exchanger in a Water for Injection (WFI) system.
After a basic FLC was designed and tested, it is shown how its rule base evolved
to achieve superior performance by utilizing additional low-cost sensing information in the
process and its environment. A method for the implementation of FLC's into the existing
PLC is discussed. The system performance of the five designed FLC rule-base strategies is
compared with that of the existing Pm controller and it is concluded that better
by
Sujit S. Nerurkar
A Thesis
Submitted to the Faculty of
New Jersey Institute of Technology
in Partial Fulfillment of the Requirements for the Degree of
Master of Science in Electrical Engineering
January 1994
APPROVAL PAGE
Sujit S. Nerurkar
Chapter Page
1.0 INTRODUCTION 1
1.1 General 1
1.2 Fuzzy Control 2
1.3 When to use Fuzzy Logic? 3
1.4 Overview of Thesis 5
2.0 CONVENTIONAL PROCESS CONTROL 6
2.1 General 6
3.1 General 14
3.2 Fuzzy Terminology 15
vi
Chapter Page
4.3 Knowledge Base 24
4.3.1 Discretization/Norrnalization of Universes of Discourse 24
4.3.2 Fuzzy Partition of Input and Output Spaces 26
4.3.3 Completeness 27
4.3.4 Membership Functions of a Primary Fuzzy Set 28
4.4 Rule Base 29
4.4.1 Choice of Process State Variables and Control Variables 30
4.4.2 Source and Derivation of Fuzzy Control Rules 30
4.4.3 Types of Fuzzy Control Rules 31
4.5 Defuzzification Function 33
4.5.1 Defuzzification Operator 33
4.5.2 Defuzzification Strategies 33
5.0 DESIGN METHODOLOGY 35
5.1 General 35
5.1.1 Multiple Variables and the Human Factor 36
5.1.2 Software Validation 36
vii
LIST OF TABLES
Table Page
1 System Hardware Specifications 46
2 Rule-Base I 51
4 Rule-Base III 69
viii
LIST OF FIGURES
Figure Page
1 Process - Heat Exchanger 6
2 Feedback Control 8
3 Offset Error in a Proportional Controller 12
4 Overshoot and Cycling in a PI Controller 13
5 Diagrammatic representation of Fuzzy Speeds 18
6 A Typical Fuzzy System 19
7 Representation of Fuzzy Partitions 27
8 Bell-shaped function 29
9 FLC Design Steps 40
15 Rule-Base I 53
16 Rule-Base II 54
17 Defuzzification 56
18 Defuzzification 57
19 Defuzzification - Sample PLC code 58
20 Defuzzification - Sample PLC look-up table 59
21 Response of HD Controller 61
22 Response of Fuzzy Logic Controller Rule-Base I 61
23 Response of Fuzzy Logic Controller Rule-Base II 62
24 Modified Rule-Base I for a faster response 63
ix
Figure Page
INTRODUCTION
1.1 General
Fuzzy logic is a technique for doing computations on a digital computer without
specifying explicit mathematical formulas. These processes are concerned with continuous
phenomena that are not easily broken down into discrete segments, and the concepts
involved are difficult to model, sometimes extraordinarily so, along mathematical model-
based lines.
Fuzzy logic permits the use of different degrees of truth and allows for a multitude
of variables to be considered in the membership functions. Though the word "fuzzy" hints
vagueness, there is actually nothing fuzzy about the logic itself It's the concepts and
words used in fuzzy rules that are ambiguous or fuzzy. instead of a black-or-white
alternative, it accommodates the gray areas that also contribute towards the membership
functions. Fuzzy logic makes sense through a gradation of numerical values that range
between 0 and 1. These gradations are finally used to derive a crisp solution which has a
these adjustments are handled by a fuzzy rule-based expert system, a logical model of the
thinking processes a person might go through in the course of manipulating the system.
This shift in focus from the process to the person involved, changes the entire approach to
automatic control problems.
The inference rules in the fuzzy expert system may take the form "if observed
variable x is 'positive medium,' then change the control variable y by the amount 'negative
medium." The model derives the designation "fuzzy" from its use of such terms as
"positive medium," "positive large," and "no change," which in turn form a fuzzy subset of
the associated measurement domain. As such, the system being controlled is formally
viewed as a fuzzy system. This is why fuzzy controllers are simpler than conventional PID
controllers.
Fuzzy logic works by accepting and processing analog input signals to judge or
infer reliable conclusions from a combination of a few variable inputs, either calculated or
received from an analog output device. It is best used in applications such as set point
different interpretations by different experts at different points in the variable's domain and
> If column temperature is Warm AND pressure is Not very high, then octane
rating is High,
while a rule in a conventional proportional-integral-derivative (PID) controller would need
to be very specific:
4
> If column temperature is greater than 40degC AND pressure is less than 45,
then octane rating is 93.
Although these look a lot like traditional computer program statements, the
adjectives in the rules (Warm, Not very high, High) don't correspond to precisely defined
ranges. Thus, the temperature of 40 degC could be described as "warm", but the
temperature of 45 degC is "warm" to a greater degree. Fuzzy logic takes this into account,
so the same rule can work for many different situations.
Fuzzy logic rules are more natural, and technically more expressive, for designers
who have no mathematical background of the system models. In the case of the crude oil
distillation system the fuzzy logic rules will fire over a wider range of temperatures and
pressures. Thus one fuzzy rule can replace many conventional rules. Fuzzy logic creates a
control surface by combining rules and fuzzy sets, thus allowing designers to build
controllers even though their knowledge of the mathematical model of the system is
incomplete.
So, when is it appropriate to use fuzzy logic? When one or more of the control
variables are continuous; when a mathematical model of the process does not exist, or
exists but is too difficult to encode, or is too complex to be evaluated fast enough for real-
time operation, or involves too much memory on the designated chip architecture; when
ambient noise levels must be dealt with or it is important to use inexpensive sensors and/or
low precision tnicrocontrollers; and perhaps above all, when an expert is available who can
specify the rules underlying the system behavior and the fuzzy sets that represent the
Chapter 4 presents the idea of a fuzzy logic controller and analyzes the different
strategies involved in fuzzification, defuzzification, and generation of rule-bases.
Chapter 5 presents a structured methodology to follow in developing a fuzzy logic
application.
Chapter 6 presents the basic design of a fuzzy logic controller for a Heat-
exchanger in a Water for Injection (WFI) system. Several rule-bases were evolved to
achieve superior performance and the problems that came forth and the strategies used to
overcome them are also presented.
Chapter 7 concludes the topic, discussing the advantages and disadvantages of
incorporating fuzzy logic in software. Some of the problems present in industrial
2.1 General
Any study of process control must begin by investigating the concept of a "process". A
process [11] is identified as having one or more variables associated with it, which are
important enough for their values to be known and for them to be controlled.
We will concentrate on processes having only one controlled variable, such as
temperature in the heat-exchange process as shown in Figure 1.
To maintain the temperature of the product (hot water) in this process, another
variable influencing the variable being controlled must be available for manipulation by the
control system. In this example, the control system manipulates the position of a steam
valve. However, the temperature of the water depends not only on the position of this
6
7
valve but also on the flowrate of the water, its inlet temperature, the enthalpy of the steam,
the degree of fouling in the exchanger, and the ambient temperature.
The parameters that indicate product quality of the operating condition of the
process are called process variables (PV), such as pressure, level, temperature, pH, motor
speed, and other variables, depending on the process. Parameters that control the product
quality are called control variables (CV), such as valve position, damper position, motor
speed, etc.
All variables affecting a PV, other than the CV, are defined as loads. Both loads
and the CV may influence a PV from either the supply side or the demand side of the
process. For example, the outlet temperature of a heat exchanger can be controlled by
manipulating the steam valve, while tank level can be controlled by manipulating a valve
on the outflow from the tank. Often, a PV in one process is a load variable for another.
For example, the temperature of the outlet stream from a heat exchanger will almost
certainly affect other plant variables -- otherwise, it would not be important enough to
control.
variable. For the heat exchanger, increases in steam-valve opening, steam enthalpy, inlet
temperature, and ambient temperature tend to raise the product temperature, while it is
lowered by increases in flowrate. The temperature responds to the net effect of these
influences. If the positive influences are greater than the negative, the temperature will
rise. If the reverse is true, the temperature will fall. If load variables were to remain
constant, the steam valve could then be adjusted until the product temperature was
is generated from values based on the various load variables as they affect the process.
Setpoint
Control
Function
Steam
Actual
Temperature
Cold water Heat > Hot
Exchanger Water
Here, the value of the process variable responds to the net effect of the loads and
the control variable. A sensor/transmitter measures the current value of the process
variable and sends a signal to the feedback controller, where the signal is compared (by
subtraction) to a reference value (setpoint). The control function within the controller
generates a signal, which positions a valve on the basis of the sign and magnitude of the
difference between the measurement and the reference or setpoint values.
In the example for the heat exchanger, a temperature transmitter continuously
generates a signal that represents the actual temperature of the hot water. At the
controller, this signal is subtracted from an operator-set value that represents the desired
temperature. If these values are the same, the current position of the steam valve is
correct, and the controller will not change its output. However, if the actual value is below
the reference value, the controller will change its output in the direction that opens the
steam valve and raises the actual temperature. Conversely, if the actual temperature is
above the desired one, the controller will change its output in the direction that closes the
position is required. The controller becomes aware of the upset when the imbalance
between the loads and the control variable begins to change the process variable. The
monitors the effect of these changes on the process variable. When the controller sees that
its corrections have returned the process variable to the desired value (i.e., difference
equals zero), it holds the output steady and continues to observe the controlled variable,
proportional, integral, and derivative modes. The analytic expression [16] for a standard
PID controller is
d
P = KpEp + KpKi Epdt + KpKd — Ep + Po
dt
where,
output and the error. Thus, over some range of errors about the setpoint, each value of
error has a unique value of controller output in one-to-one correspondence.
The integral constant Ki relates the changes in the rate of controller output with
changes in error. Thus, a large value of Ki means that a small error produces a large rate
of change of output and vice versa. For example, in the case of the heat exchanger, the
controller output value initially begins to change very rapidly, but as the valve opens, the
error decreases and slows the valve opening rate.
The derivative constant Kd relates the extent of the controller output to the rate at
which the error is changing and not on the value of the error. The derivative action is also
known as rate of anticipatory control.
in load occurs. This error is referred to as offset [16]. It can be minimized by a larger
constant Kp, which also reduces the proportional band. The proportional band is defined
as that positive and negative error for which the output will be driven to 0% and 100%.
To see how offset occurs, consider a system under nominal load with the controller at
The effect of process and control system lag is shown as simple delays in the
controller output change and in the error reduction when the controller action occurs. If
the process lags are too large, the integral action causes a considerable overshoot of the
error and output before settling to the operation point. Also, the error can oscillate about
zero or even be cyclic. This is shown in Figure 4, where we see the proportional band as a
dashed band. The effect of the integral action can be viewed as a shifting of the whole
proportional band [16].
13
20
10
Error(%) 0
-10
-20
Controller
Output (%)
3.1 General
Conventional set theory principles, are based on Aristotelian logic, and form the basis of
modern mathematics [1]. Fundamental to this basic set theory is the notion that an item is
either a member or it is not a member of a given set; xEA or x0/4. However, in the real
world, the membership of an item in a set is not always so distinct. Fuzzy set theory is
based on a recognition that certain sets have imprecise boundaries. Fuzzy sets or subsets
are those collections of items with unclear boundaries of vagueness in which the transition
from membership to nonmembership in a subset of a reference set is gradual rather than
abrupt.
Membership in such sets is not characterized by either/or, but are sets in which
membership can be more adequately considered in terms of degrees. A fuzzy set is
characterized by a membership function, defined as a real number in the interval [0 , 1].
operations can be precisely defined. Some basic concepts of fuzzy set theory and fuzzy
logic are briefly summarized in the following section. A more detailed discussion may be
14
15
an ordinary set whose membership function only takes two values {0,1}. Thus a fuzzy set
F in U may be represented as a set of ordered pairs of a generic element u and its grade of
membership function:
F = {(u„ u F (u))1u E U)
F = pF
U
F I PFui
i =1 ui
The set theoretic operations of union, intersection, and complement for fuzzy sets are
defined via their membership functions. More specifically, see the following.
Definition: Union: The membership function 1.4AuB [19] of the union A.L..)B is
or
x x Un and is expressed as
17
where * could be any operator in the class of triangular norms, namely, minimum,
algebraic product, bounded product, or drastic product.
quintuple (x, T(x), U, G, M) in which x is the name of variable; T(x) is the term set of x,
that is, the set of names of linguistic values of x with each value being a fuzzy number
For example, if speed is interpreted as a linguistic variable, then its term set
T(speed) could be
T(speed) = {very slow, slow, moderate, fast, very fast, }
[0 , 100]. We might interpret "very slow" as "a speed below 10 mph," "slow" as "a speed
close to 30 mph," "moderate" as "a speed close to 55 mph," and "fast" as "a speed above
18
70 mph." These terms can be characterized as fuzzy sets whose membership functions are
shown in Figure 5. E.g., here the speed of 41 mph has a higher degree of membership in
the set "slow" (90%), than in the set "medium" (10%).
Degree
of membership
0.5
0
40 55
• 70
Speed (mph)
4.1 General
The main ideas underlying a Fuzzy Logic Controller (FLC) are covered in this chapter.
Figure 6 shows the basic configuration of an FLC, which comprises three principal
components: a fuzzification function, a knowledge base, and a defuzzification function.
C EFUZZIFICATION
FUNCTION
OUTPUT
INTERFACE
INPUT
MEMBERSHIP FUZZIFICATION INPUT
FUNCTION FUNCTION INTERFACE
The Input interface maybe of the form of an A/D converter, that measures real-
time process variables and digitizes them. It also performs the scaling function to put the
process variable into the desired numerical perspective, e.g., in process control
applications an analog input module performs the above functions by converting a 4-20mA
electrical signal into a numerical value of 0-4095.
time input variables to corresponding subsets in the defined universe of discourse. These
19
20
subsets, and the degree of membership within them are predefined by the rule base
programmer in the Input membership function. Thus, referring to the input membership
function, the fuzzification function describes the numerical input variable with adjectives
called linguistic labels that make sense to the designer, e.g., at a particular instance the
temperature might be 'cold', 'warm', or 'hot'.
The Rule base defines rules that describe the relationships between the results
desired and the data available. The Process logic executes the rules defined in the rule-
base to obtain a separate control output in the domain of the Output membership
function, for each real-time process variable. It evaluates the degree to which each rule's
situation applies. The rule is "active" to the degree that its IF part is true; then in turn
determines the degree to which each THEN part applies. Since multiple rules can be active
simultaneously, all of the active rules are combined by the Defuzzification function to
create the final crisp result.
The Output interface is of the form of a D/A converter that converts the
nonfuzzy control output to be applied to the control device. For example, an analog
output module converts the control solution to a 4-20mA signal. This signal may in turn
Symbolically,
xo =fuzzifier (x),
where xo is a crisp input value from a process; x is a fuzzy set and fuzzifier represents a
fuzzification operator.
21
two-input-single-output (MISO) fuzzy systems, fuzzy control rules have the form:
R1 : if x is Al and y is B1 then z is Cl,
R2 : if x is A2 and y is B2 then z is C2,
control variable; Ai, Bi, and Ci are linguistic values of the linguistic variables x, y, and z in
the universes of discourse U, V, and W, respectively, with i = 1, 2, , n; and an
implicit sentence connective also links the rules into a rule set or a rule base.
Although rules look like free-form natural language, they are confined to a limited
set of linguistic terms and a strict syntax. The rule language described here is very simple
and can be easily implemented in ladder logic for a programmable logic controller (PLC)
based control system. Following is an example of the syntax of a rule.
More complex fuzzy logic systems could expand on this with a corresponding
increase in software overhead to process the more complex rules.
23
In fuzzy control applications, the observed data are usually crisp. Since the data
manipulation in an FLC is based on fuzzy set theory, fuzzification is necessary during an
earlier stage. The principal ways of dealing with fuzzification are as follows.
1. A fuzzification operator "conceptually" converts a crisp value into a fuzzy
singleton [19] within a certain universe of discourse. Basically, a fuzzy singleton is a
precise value and hence no fuzziness is introduced by fuzzification in this case. This
strategy has been widely used in fuzzy control applications since it is natural and easy to
implement. It interprets an input x o as a fuzzy set A with the membership function ,uA (x)
equal to zero except at a point x o , at which PA(x0) equals one.
easier to manipulate than random variables. A variety of fuzzification functions are used,
the two most common being the isosceles triangle and the trapezoid functions, as will be
3. In large scale systems and other applications, some observations relating to the
behavior of such systems are precise, while others are measurable only in a statistical
sense, and some, referred to as "hybrids," require both probabilistic and possibilistic modes
of characterization. The strategy of fuzzification in this case is to use the concept of
"hybrid numbers", which involves both uncertainty (fuzzy numbers) and randomness
essential role in the success of an application. Some of the important concepts relating to
the construction of the data base are discussed below.
universe. A fuzzy set is then defined by assigning grade of membership values to each
generic element of the new discrete universe. A look-up table based on discrete universes,
which defines the output of a controller for all possible combinations of the input signals is
generated and used as a library function. In the case of an FLC with continuous universes,
25
transform measured variables into values in the discretized universe. The mapping can be
uniform (linear), nonuniform (nonlinear), or both. The choice of quantization levels
reflects some prior knowledge of the system model. For example, coarse resolution could
be used for large errors and fine resolution for small errors. Thus, in a three-input-one-
output fuzzy system, we may have control rules of the form:
Ri : if error (e) is Ai , sum of errors (ie) is Bi, and change of error (de) is Ci then output is
Di.
where F denotes the fuzzy relation defined by the rule base and Ki, i = 1, 2, 3, 4,
represents an appropriate scaling mapping. In this relation, we see an analogy to the
parameters of a conventional PID controller, in which as a special case F is a linear
FLC is less sensitive to small deviations in the values of the process state variables.
discourse into a finite number of segments, with each segment mapped into a suitable
segment of the normalized universe. In this setting a fuzzy set is then defined by assigning
an explicit function to its membership function. The normalization of a continuous
universe also involves a priori knowledge of the input/output space. The scale mapping
in the universe.
The cardinality of a term set in a fuzzy input space determines the maximum
number of fuzzy control rules that we can construct. For example, in the case of two-
input-one-output fuzzy system, if the cardinalities of T(x) and T(y) are 3 and 7,
respectively, the maximum number of rules is 3x7=21. It should be noted that the fuzzy
partition of the fuzzy input/output space is not deterministic and has no unique solution. A
heuristic cut and trial procedure is usually needed to find the optimal fuzzy partition.
27
0 +1
COARSE
NVB NB NM NS PS PM P B PVB
0
FINER
4.3.3 Completeness
Intuitively, a fuzzy control algorithm should always be able to infer a proper control action
for every state of the process. This property is called "completeness" [19]. The
completeness of an FLC relates to its data base, rule base, or both.
1. Data Base Strategy:
The data base strategy is concerned with the supports on which primary fuzzy sets
are defined. The union of these supports should cover the related universe of discourse in
relation to some level set e . This property of an FLC is called 6' -completeness. In
general, we choose the level e at the crossover point, implying that we have a strong
belief in the positive sense of the fuzzy control rules which are associated with the FLC. In
this sense, a dominant rule always exists and is associated with the degree of belief greater
than 0.5. In the extreme case, two dominant rules are activated with equal belief 0.5.
28
The rule base strategy has to do with the fuzzy control rules themselves. The
property of completeness is incorporated into fuzzy control rules through design
experience and engineering knowledge. An additional rule is added whenever a fuzzy
condition is not included in the rule base, or whenever the degree of partial match between
some inputs and the predefined fuzzy conditions is lower than some level, say 0.5. The
former shows that no control action will result. The latter indicates that no dominant rule
will be fired.
vector of numbers whose dimension depends on the degree of discretization. In this case,
the membership function of each primary fuzzy set has the form of
5 ai
f (u) E
1 Ui
2. Functional Definition:
Note that if the normalized universe is changed, the parameters ,uf , crf should be
changed accordingly.
Either a numerical definition or functional definition may be used to assign the
grades of membership to the primary fuzzy sets. The choice of grades of membership is
based on the subjective criteria of the decision. In particular, if the measurable data is
disturbed by noise, the membership functions should be sufficiently wide to reduce the
sensitivity to noise. This raises the issue of the fuzziness or, the specificity of a
related to fuzzy control rules: choice of process state (input) variables and control
variables in the antecedents and process control variables in the consequents. In this
connection, it should be noted that in our daily life most of the information on which our
decisions are based is linguistic rather than numerical in nature. Seen in this perspective,
fuzzy control rules provide a convenient way to express their domain knowledge.
The formulation of fuzzy control rules can be achieved by means of two heuristic
rules for a practical application domain. Obviously, for optimized performance, the use of
Fuzzy control rules of this type, which are referred to as "state evaluation fuzzy
control rules," evaluate the process state, e.g., state, state error, or state integral at time t
and compute a fuzzy control action at time t as a function of (x, ,y) and the control
rules in the rule set.
objectives are called "object evaluation fuzzy control," or "predictive fuzzy control." The
rules in question, which are derived from skilled operator's experience, are referred to as
result that satisfies the desired states and objectives. A control command u takes a crisp
set as a value, and x, y are performance indices for the evaluation of the i th rule, taking
values such as "good" or "bad". The most likely control rule is selected through predicting
In linguistic terms, the rule is interpreted as: "if the performance index x is Ai and
index y is Bi, when a control command u is chosen to be Ci, then this rule is selected and
where zo is the nonfuzzy control output and defuzzifier is the defuzzification operator.
The MOM strategy generates a control action which represents the mean value of all local
control actions whose membership functions reach the maximum.
The widely used COA strategy or the centroid method of defuzzification, generates the
center of gravity of the possibility distribution of a control action. In the case of a discrete
universe, this method yields
DESIGN METHODOLOGY
5.1 General
Achieving superior plant performance requires meeting two types of economic objectives,
one called strategic; the other, operating. The strategic objective is primarily concerned
with external rather than internal problems of a company, and specifically with selection of
a company's product mix and target markets. In most companies, operating objectives
inevitably absorb the bulk of the company's energy and attention. Everyone in the
organization is concerned with the myriad of recurring operating problems.
The design of a control system and its level of use determine how well a unit in a
process plant is run. Therefore, this directly affects the profitability of that unit. The major
problems concern how to apply effective optimizing control for operating conditions. The
key decisions involve: inventory control for mass and energy in order to maintain steady-
state operation; establishing optimal setpoints for efficient operating conditions and
consistently maintaining them.
the process. Disturbances are variables that adversely affect the process operations and
over which there is no direct control. Values of such variables are often determined by
some known or unknown factors external to the process boundary. Control action is
required to overcome adverse effects. Uncontrolled disturbances may be associated with
raw materials, ambient conditions, changes in load conditions, fuel and energy costs, and
other economic factors. It is very difficult to identify all the disturbance variables that
affect the process. Numerous factors or conditions are constantly changing. Some are
important, some are not. The best procedure, when practical, is to include all major
35
36
process disturbances and ignore those involved with second-order effects. This
approximation will render the minor disturbances indistinguishable from error.
Systems integration has led me to believe that the area of control system is the most often
neglected for improving profitability.
The disturbances discussed above have prevented several processes from being
automated because of lack of precise control techniques. Such processes, prevalent in a
Chemical or a Pharmaceutical facility need rigid operating conditions, invisible to the
multiple variables or factors affecting it. As an example, chemicals/compounds have to be
maintained at precise levels of concentration, pH, temperature, conductivity, etc. before
being used or mixed with other chemicals. The conductivity of a substance is interrelated
to its temperature or concentration and these variables have to be taken into consideration
before adding any reagents to maintain the conductivity.
Many such processes are handled manually by skilled human operators. It is a
common consensus that the human factor is prone to inconsistencies in product quality
and a wasted chemical batch could cause losses worth several thousand dollars.
strength, quality and purity they purport or are represented to possess. These procedures
and designs have to be exercised over computer systems (or PLCs or distributed control
All of the software installed and operating within a distributed control system or
other computer based automation system has to be documented with the proper paper trail
and qualified to assure that it is free of any defects and consistently operates within the set
tolerances under production conditions. Validation of the control system includes
validating the following sub components [15]:
- Operating system and file managers
- Network information management software
- Database management software
As a vendor, I have to play a significant role in assuring that the system designed is
of high quality at the time of commissioning and remains so throughout its life cycle. I was
concerned about oscillations and responses to upsets or setpoint changes (Chapter 1) in
the PID loops I commissioned. Some typical disturbances that can upset a temperature
loop are [8] [14]:
- Opening a door in a climate chamber causes a sudden drastic change in the chamber's
temperature.
- Introducing moisture into a temperature vessel speeds up the heating process by
Most of the loops (temperature and humidity) being related to HVAC (Heating
Ventilation and Air Conditioning) didn't need any critical time considerations as long as
the variable parameter stabilized within an acceptable amount of time. But, with the
exposure to Pharmaceutical industries, governed by strict FDA regulations, the approach
to tackle some of the PID loops had to be changed. I believed that the philosophy of fuzzy
logic had the potential to overcome the problems mentioned earlier.
A fairly complicated system was chosen for experimentation and a design
methodology was formulated as explained in the sections that follow. Chapter 6 explains
in detail the fuzzy logic controller designed for a Heat Exchanger used in the process of
Water for Injection (WFI).
design is done on paper, and the later steps are an iterative cycle of modeling and
simulation, carried out on a computer using software development and simulation tools,
and continued until the model behaves as desired.
The paper portion of the process is critical: understanding the mechanics behind a
system's behavior, and identifying the system dynamics in terms of the conventional input-
Even though a mathematical model of the system is not available, the designer
should have an in-depth knowledge of the process and its effectiveness in the systems
overall performance [10]. The designer should define what process variables (PV) will be
read by the system and what are the calculations to be performed on them to generate the
control variable (CV). The operating ranges of the process variables have also to be
estimated.
40
Check performance of
the system and
determine if modifications
Determine the method are necessary
of Defuzzification
Validation:
Installation Qualification
set of fuzzy regions. These regions are given unique names, called labels, within the
domain of the variable. These names express the relative quality of the variable instead of
41
the precise quantitative factor. Finally, a fuzzy set that semantically represents the concept
associated with the label is created.
Some rules of thumb help in defining fuzzy sets [10]. First, the number of labels
associated with a variable should generally be an odd number between five and nine.
Second, each label should overlap somewhat with its neighbors. This overlap, in fact, is
what gives a fuzzy controller its smooth, stable surface. The overlap should be between 10
and 50 percent of the neighboring space, and the sum of the vertical points of the overlap
should always be less than or equal to one.
Finally, the density of the fuzzy sets should be highest around the control setpoint
of the system and should thin out as the distance from that point increases.
This step involves writing the rules that tie the input variables to the output variables.
These rules are expressed in an English-like simple language with a syntax like:
-- If <fuzzy proposition>, then <fuzzy proposition>,
where the fuzzy propositions are of the form, "x is Y" or "x is not Y," x being a scalar
Such a group of rules forms a fuzzy associative memory. When a set of input
values are read, each of the rules that has any truth in its premise will be executed. Since
these rules are declarative rather than procedural, their order in the knowledge repository
is unimportant.
Generally, the number of rules a system requires is simply related to the number of
process variables. In some cases, it is possible to use fewer rules, but there are dangers in
doing so. The rules represent knowledge, so if any are deleted or omitted, knowledge is
removed from the system--knowledge that may become important if the system is later
modified.
42
Simulations are carried out in-house to compare results with the conventional system. The
fuzzy model, in the least, should provide a response comparable to the existing PLD
control, if not better. When the results are not as desired, changes are made either to the
fuzzy set descriptions or to the mappings encoded in the rules. This process of simulation
The Installation Qualification [15] provides a concise description of the control system
upgrade. A verification is made that all instrumentation, designs, drawings, procedures and
simulation test results are correctly identified, documented, and within specified set of
43
tolerances. This step basically qualifies the system to be installed and is performed in-
house.
The Operational Qualification [15] is performed on-site to verify that the system
consistently operates within a specified set of tolerances under test production conditions.
This is usually done after tuning the system. The objective of this step is to evaluate the
sequence controlled by the system. This objective will be confirmed by conducting a series
CHAPTER 6
TT PT
WFI
OUTLET INLET INLET N RETURN
TEMPERATURE TEMPERATURE FLOW
HEAT
EXCHANGER
DISTILLER WFI
STORAGE
TANK
TANK
LEVEL
WFI TO
.• PLANT
CIRCULATION
PUMP
The Heat-exchanger for a Water for Injection (WFI) system was chosen to study the
response of a fuzzy logic controller. The WFI system is shown in the Figure 10. It consists
of a Distiller, a WFI storage and distribution tank, the circulation pump, and the Heat
exchanger.
The Distiller generates distilled water and operates to keep the WFI storage tank
within acceptable production limits. The circulation pump operates on a continuous basis
and circulates WFI throughout the plant. Distilled water is used throughout the plant for
several purposes, e.g., sterilize equipment used in clean rooms, sterilize piping carrying
fluids, clean and sterilize storage vessels, diluting solutions used in the preparation of
44
45
different buffers. The unused distilled water is returned to the storage tank via the Heat-
exchanger. The primary function of the Heat-exchanger is to maintain the temperature of
the return WFI at the setpoint. This is done by regulating the flow of plant steam into the
Heat-exchanger via a steam flow control valve.
Thus, the Heat-exchanger controls the process variable i.e. temperature via the
control variable i.e. steam flow control valve position. The entire heat exchange process is
discussed in detail in Chapter 1.
Refering to Figure 6, the implementation of a FLC in a PLC is illustrated in Figure
11.
<
BASE
I NTE
CONTROL
OUTPUT OUTPUT VALVE
MEMBERSHIP DEFUZZIFICATIO1)
FUNCTION RFACE PLANT STEAM
FUNCTION
LOGIC
PROCESS WATER IN
A
INPUT
MEMBERSHIP FUZZIFIC.A.TION INPUT
FUNCTION (
FUNCTION INTERFACE
Steam flow control valve Worcester carbon steel ball valve - 1/2" 446 PMSE,
Worcester 1039SN spring return actuator,
Bettis P-2000 electro-pneumatic positioner.
WFI and minimize the effects of process upsets, e.g., overshoots, undershoots due to
associated with the conventional PM control were studied. It was decided to implement
47
the principles of fuzzy logic control in the software of the existing control system and
compare its performance to PID control.
The principle of the Heat-exchange process is based on the control of one process variable
namely, water temperature. The PID controller reads the water temperature at the outlet
of the Heat-exchanger, applies a mathematical algorithm, and produces a control variable
that manipulates the position of the steam flow control valve, which in effect controls the
steam flow into the Heat-exchanger.
It was observed that the temperature sensed at the outlet of the Heat-exchanger
was utilized to apply corrective action to the return water that was available at a later
point in time. Also, water returned from different locations in the plant varied in heat
content and hence the temperature, depending on the prevailing ambient conditions along
the path it traversed. Hence, it was decided to add another temperature sensor at the inlet
of the Heat-exchanger. But using this variable by itself would not suffice the control action
as there would be no feedback to the system about the results of the control action.
Therefore, the two parameters: inlet temperature and outlet temperature were decided to
It was also observed that load changes seriously affected the consistency of the
PM controller. Varying usage of the distilled water at different locations in the plant
caused varying return water flow rates, and this variable could not be taken into
consideration in the existing PID controller. The inclusion of return water flow-meter
RTD's (Resistance Temperature Detector) into an RTD input module housed in the main
processor chassis. The flow of the return water is measured via a flow element coupled
48
with a transmitter in terms of a 4 - 20 mA signal into an Analog input module in the main
processor chassis.
Figure 12. The center of the trapezium corresponds to the mean value of the data set.
These trapezoidal regions were given unique names, called labels, within the domain of the
variable.
Membership
function for ERROR
XX Xi X )1\ X
NVB NB NM NS Z PS PM PB PVB
1. 0
0.5
0
-11 -10 - 9 -8 -7 -6 -5 -4
. -2 -1 '0 1 2 i 4 5 6 7 8 9 10 11
ERROR
The number of labels associated with a variable corresponds to the accuracy of the
control action needed. Tighter the control action needed, more the number of labels
should be used. Also, each label should overlap somewhat with its neighbors. This
overlap, in fact, is what gives a fuzzy controller its smooth, stable control surface. The
labels used to describe the fuzzy regions are as follows:
PVB = Error is positive and very big.
PB = Error is positive and big.
PM = Error is positive and medium.
PS = Error is positive and small.
Z = Error is zero.
NS = Error is negative and small.
NM = Error is negative and medium.
NB = Error is negative and big.
NVB = Error is negative and very big.
The labels are self explanatory, and it is clear that more positive the "Error" - further away
is the actual temperature from the setpoint - more the steam needed by the Heat-
exchanger.
The input variable temperature is also used indirectly in the form of difference in
error or rate of change of error "dError":
where, dError = Previous error - Current error.
Similar labels PVB, PB, NVB are used to describe the rate of change of "Error", and
Membership
function for dERROR
.X X XX X VIC
NVB NB NM NS Z PS PB PM PVB
1. 0
0.5
0
-4 -2 -1 6 1 2 3 4 5
ERROR
The output variable "Control action" is also decomposed into fuzzy regions as shown in
the Figure 14.
Membership Membership
function for CONTROL ACTION function for CONTROL ACTION
Z PS PM PB PVB Z PS PM PB PVB
1.0 1.0
A,
0.5 0.5
0 FP 0
0 25 50 75 100 4 8 12 16 20
CONTROL ACTION (%) CONTROL ACTION (mA)
Figure 14 The output variable "CONTROL ACTION" decomposed into labeled fuzzy
regions.
The rules that describe the "Control action" to be taken on each combination of the
control variables "Error" and "dError" are explained in Table 2.
Here,
"Error" = Desired setpoint - Actual temperature at outlet of Heat-exchanger
= SP PV(out)
and
"dError" = Previous error - Current error.
Table 2 Rule-Base I.
Rule 1.1 IF Error is PVB and dError is NVB THEN Output to valve is PVB
Rule 1.2 IF Error is PVB and dError is NB THEN Output to valve is PVB
Rule 1.3 IF Error is PVB and dError is NM THEN Output to valve is PVB
Rule 1.4 IF Error is PVB and dError is NS THEN Output to valve is PVB
Rule 1.5 IF Error is PVB and dError is Z THEN Output to valve is PVB
Rule 1.9 IF Error is PVB and dError is PVB THEN Output to valve is PM
Table 2 (continued
Rule 9.9 IF Error is NVB and dError is PVB THEN Output to valve is Z
As can be seen from the Table 2, we have 81 rules covering all possible states of
the defined process variables.
The rule numbers are of the form "Rule r.c", on purpose, where "r" and "c" are
row and column numbers of the rules when tabulated in a matrix form called Rule-Base.
The Rule-Base I is shown in Figure 15.
53
Figure 15 Rule-Base I.
Another set of rules was developed to accommodate for the temperature variable at the
processor. All the rules that have any truth in their premises will fire and contribute to the
output fuzzy set -- the one that will represent the control variable controlling the steam
Suppose that at a given time, the system sensors determine the "Error" and
"dError" to be as shown in Figure 17. As shown in the figure, the "Error" falls into a
single region of the Error variable, namely PB. But "dError" has degrees of membership in
two regions of its fuzzy set, PB and PVB. This combination causes rules #2.8 and #2.9 to
fire.
The two rules have somehow to be combined to form a single system output. The
following three-step procedure [10] shows how:
- For each premise expression connected by an AND, take the minimum of the
truth of the expressions as the truth level of the premise.
- Truncate the output fuzzy set being built at the truth level of the premise.
- Copy the newly modified fuzzy set into the output variable's fuzzy set. If that
region is not empty, combine it with the current contents by taking the maximum of the
new fuzzy region and the currently existing fuzzy region at each point in the domain
(along the horizontal axis). In other words, if the region is not empty, then OR the outputs
together.
Figure 17 Defuzzification.
For the steam control valve, rule #2.8 (If Error is PB and dError is PB, then
control variable is PM), it may be seen that Error has a 1.0 degree of membership in PB,
and dError has a 0.8 degree of membership in PB. In accordance with the first step of the
procedure, therefore, the smaller of the two figures, 0.8 is taken as the truth level of the
premise. Then, in accordance with the second step, the level of the output rule #2.8,
namely PM is truncated at that level, and copied to the output variable fuzzy set.
When rule #2.9 fires, the PS fuzzy set is also truncated at the truth of its premise
(the smaller of 1.0 and 0.25) and then copied into the output control action region. But,
since the region is not empty, this modified fuzzy set is combined with the PM fuzzy set by
taking the maximum of their respective membership grades at each point along the
horizontal axis.
57
Figure 18 Defuzzification.
programming software instruction set is necessary to write software. A brief outline of the
above defuzzification process using the AB-6200 standard instruction set is shown in
Figure 19.
58
SUB
A SETPOINT Calculates
B PV ERROR = SETPOINT - PV
C ERROR
LIM ERROR_PS
2 LOW 1 If ERROR is between. 1 and 5
TEST ERROR energize coil ERROR_PS
HIGH 5
LIM
3 LOW 4 ERROR_PM If ERROR is between 4 and 8
TEST ERROR I energize coil ERROR_PM
--
HIGH 8
GEQ MOV
A F7:[ERROR_10] A FEERROR_10]
B F8:[ERROR_10] B FACTOR_1
LEQ MOV
A F7:[ER.ROR_10] A F7:[ERROR_10]
B F8:[ERROR_10] B FACTOR_1
As can be seen rung 1 calculates the ERROR between the Setpoint and the
Process Variable. "LIM" (Limit) instructions like the ones in rungs 2, 3, and 4 are used to
energize coils that indicate the membership of that ERROR to a subset within the universe
of discourse, e.g., PS, PM, PB, etc. Thus for an ERROR of 4.1, coils ERROR PS and
ERROR PM are both energized. The degree of membership of this real-time ERROR in
E.g., Refering to Figure 20, an ERROR of 4.1 uses this pointer structure to
identify itself with 90% of PS and 10% of PM i.e. degree of membership in PS is 0.9 and
degree of membership in PM is 0.1.
These values are compared using the GEQ (Greater than or equal to) and LEQ
(Less than or equal to) instructions, to move the smaller value in FACTOR1. Similarly,
FACTOR 2 is calculated for the variable DERROR. These two factors contribute towards
calculating the final crisp output of the fuzzy controller.
ERROR
2 PS PM P13 PV13
F7:10 = 0.0 F8A0 =0.0
F7:11 = 0.1 ilF8A1 = 0.1
/
F7:12 = 0.2 F8:42 = 0.2
F7:13 = 0.3 F8A3 =0.3
F7:14 = OA F8:44 = 0.4
F7:15 = 0.5 FBAS =0.5
Example: F7:16 = 0.6 F8:46 =0.6
For ERROR = 4.1 F7:17 =0.7 F8A7 = 0.7
ERROR_10 = 41 F7:18 = 0.8 F8:48=0.8
F7:19 = 0.9 F8:49 = 0,9
F7:20 = 1.0 F8:50 = 1.0
=1.0 =1.0
F7:30=1.0 F8:60=1.0
=1.0 =1.0
F7:40 =1.0 F8:70 =1.0
F7A1 = 0.9 F8:71 = 0.9
F7:42 =0.8 F8:72 = 0.8
. =
F7:50 =0.0 F8:80 = 0,0
Simulation tests were carried out in-house to make sure that the controller performance
was within acceptable stability limits. Tests were conducted using an Omega SCR70
60
Power Controller for an electrical heater. The controller accepts an 4-20mA dc signal
from the Analog output module of the PLC. The temperature was measured by an RTD
probe via an Allen-Bradley RTD module.
Hardware qualification and software simulation test results qualified the system to
be installed and tested onto the production system.
The standard PID instruction, available as a user-configurable block was used for testing
PID control. The Allen-Bradley processor has four choices of PID algorithms. The
independent gains equation was used, i.e.
The temperature loop was tuned by adjusting the loop tuning constants Kp, Ki,
and Kd. The software written in ladder logic for achieving fuzzy control was downloaded
into the PLC controlling the WFI control system.
The response of the PID controller, Rule-base I, and Rule-base II for a setpoint of 90
degC are shown in Figures 21-23.
61
It was observed that though there was no significant change in the time required to
reach the setpoint, overshoot was drastically reduced by the Rule-base I. Cycling of the
process variable around the setpoint as observed in the PM response was also
considerably reduced in Rule-base I.
The Rule-base II had similar results. There was no significant change in the time
required to reach the setpoint. The overshoot was further reduced in comparison to the
Rule-base I. This was due to the fact that the inlet water temperature was taken into
consideration before applying control action to it. Though there was practically no cycling
around the setpoint, the process variable lingered above the setpoint. This is the result of
the centroid method of deriving rules, which kept the steam flow control valve open even
though the outlet water temperature was greater than the setpoint.
A heuristic approach was followed to modify the rules. Based on experience the
Rule-bases were modified as explained below.
The Rule-base I was modified as shown Figure 24. Since the system was having a
very slow response rate, as long as the "Error" was large, I did not care about the
63
difference in error "dError" and applied a large control signal to the steam flow control
valve.
The response for the modified Rule-base I is shown in Figure 25. Though there is
some cycling around the setpoint, the response time is lower than the initial Rule-base I
and considerably lower than the PID control.
64
A similar heuristic approach was taken in modifying the Rule-base II. It was
decided to close the steam flow control valve after the temperature of the outlet water
reached the setpoint.
65
As seen from Figure 27, the response of the modified Rule-base II is far more
superior than the ND control response.
A comparison of the PID controller and the four fuzzy strategies is provided in
Table 3. The following response evaluation factors are considered.
Dead time: The dead time is defined as the time delay between a change in the control
signal and the beginning of its effect on the measurement.
Time constant: The time constant is defined as the time required to complete 63.2% of the
total response. This number is not arbitrary and has significance in terms of the differential
equations that model the process.
Peak error: It is the maximum deviation of the process variable from the setpoint.
Settling time: In the event of a transient input or a change in setpoint, the settling time is
the time required for the process control loop to bring the process variable back to within
the allowable setpoint range.
Processor scan time: The time required to the PLC processor to complete one scan. In
this case it is important because the fuzzy control is accomplished through ladder logic
software, and the time available to execute other processes is then reduced.
PID control 45 secs 4.15 mins 9.3 degC 12.15 mins 28 msec
Rule-base I
Rule-base II
67
In cases of large load changes or process upsets, the PID controller response
exhibited overshoots or undershoots followed by some cycling around the setpoint before
settling down.
Process upsets in this case were sudden return water flowrate changes, which were
manipulated by controlling a manual flow control valve in the path of the return water.
Under normal loads, the return water flow was in the range of 30 - 50 gpm. With heavy
loads, the return water flow would drop to a rate of about 10 - 25 gpm. Under very low
loads, the return water flow would be greater than 50 gpm.
It was decided to add a flow-meter in the path of the return water into the heat-
exchanger. Thus, the fuzzy logic controller has to incorporate changes in water flow. The
third variable "Flow" is decomposed into a set of labeled fuzzy regions as shown in Figure
30.
The isosceles triangle function was chosen unlike the other two variables "Error"
and "dError", where the trapezoidal function was used. This is due to the fact that "flow"
is a very fast changing variable. The vertex of this isosceles triangle function corresponds
to the mean value of the data set, while the base is twice the standard deviation of the data
set. In this way, a triangular fuzzy number is formed which is convenient to manipulate.
Only three fuzzy regions are being used. More fuzzy regions can be implemented,
but are not necessary since the occurrence of "flow glitches" was not expected to be very
often.
Figure 30 Variable "FLOW" decomposed into labeled fuzzy regions.
The rules associated with the variable "Flow" are explained in Table 4.
Table 4 Rule-Base III.
I decided to use the modified Rule-base II, because it had the best response, and
create a sort of three dimensional Rule-base III incorporating the effects of return water
flow rates. The idea of a three dimensional Rule-base III will be clear in the Figure 31.
70
The three subsections of the Rule-base III are shown in the Figures 32-34.
Figure 32 Rule-base
71
The response of the fuzzy logic controller for sudden heavy loads with the Rule-
base III in comparison to the PD response is shown in the Figure 35. As can be seen, the
overshoot is considerably reduced. Similarly, the response for sudden low loads is shown
in Figure 36.
72
within acceptable limits every time an upset was simulated. Loop upsets were purposely
CONCLUSIONS
The problems associated with the conventional PID controller were studied for a Heat
Exchanger in a WFI system. Multiple variables affecting the stability of the controller were
found to be the main problem causing the inconsistent behavior. Several Rule-base
strategies were designed and implemented with Allen-Bradley's 6200 PLC ladder logic
development software.
Rule-base I utilizes temperature error at the heat exchanger outlet and the rate of
change of this error, as the inputs to the FLC. Though the time required to reach the
setpoint had no significant improvement the overshoot was drastically reduced in
comparison to a PID controller. Rule-base I was further modified for a faster response.
Rule-base II utilized the temperature error at the heat exchanger outlet and the
temperature error at the heat exchanger inlet as inputs to the FLC. Similar to Rule-base I,
though there was no significant improvement in the time required to reach the setpoint, the
overshoot was further reduced due to the fact that temperature was sensed at the inlet.
Rule-base II was also modified for better response. Finally, the disturbances due to sudden
load changes were reduced by developing a third strategy, that utilized three inputs to the
FLC, namely, temperature error at inlet, temperature error at outlet, and flowrate at inlet.
This evolution of different Rule-base strategies signifies the importance of proper choice
demonstrated. The ladder logic developed to apply fuzzy logic theory to one process
control loop was very lengthy and cumbersome. A fair sized facilities automation project
has several such loops and scheming fuzzy logic rules for all of them would not be cost
effective. Also, it was experienced that tuning the fuzzy logic controller was a very time-
73
74
System, Distributed Manufacturing Automation and Control Software). The FIX DMACS
PLC I/O driver will read the input variables from the PLC, perform fuzzification,
implement rules, perform defuzzification, and write the output variable back to the PLC.
Graphical representation of rule-bases should be developed as aids to ease and quicken the
are specific to fuzzy logic and microcontrollers with hardware fuzzy logic engines as
peripherals to a conventional CPU. At the present time a chicken-and-egg problem
operates: Applications are waiting for fuzzy logic microcontrollers to become available,
but chip manufacturers are waiting for fuzzy logic applications to be developed so they
know what fuzzy logic features are important.
Allen-Bradley has several specialty modules that can be used for different
applications, Eg. the ASCII-Basic module that can be used for integrating with devices
that have an ASCII interface, several communication modules etc. As technology
progresses and with the availability of new fuzzy logic processors, Fuzzy control modules
should be designed to house in the processor chassis. A new set of instructions and user
configurable blocks should be developed for process control applications. User friendly
tools for easing the process of tuning and modifications should be developed. These
modules can then perform all calculations related to the fuzzy control, and free the main
processor for other tasks thus improving the overall system performance in terms of scan
times.
Validating the system was a very straightforward process. All the rules were
documented and tested. A paper trail is provided for the theory used in deriving rules and
look at its power and expressiveness, they must decide where to apply it, and also how
best to manage software projects based on this new technology. Increasingly, project
managers, system architects, and design engineers are asking tough questions: what type
of projects can benefit from the use of fuzzy logic? How do I control projects with this
technology? What is the best way to design, develop, deliver, and test systems using fuzzy
4 J. J. Barron, "Putting Fuzzy Logic Into Focus", Byte, April 1993, pp.111-118.
8 D. Brubaker, "Fuzzy Logic System Solves Control Problem", EDN, June 1992, pp.
121-127.
14 N. Infelise, "A Clear Vision Of Fuzzy Logic", Control Engineering, July 1991,
pp.28-30.
76
77
References (continued)
19 C. C. Lee, "Fuzzy Logic In Control Systems: Part I", IEEE Trans, on Systems,
Man, and Cybernetics, Vol. 20, No. 2, Mar/Apr 1990.
20 C. C. Lee, "Fuzzy Logic In Control Systems: Part II", IEEE Trans. on Systems,
Man, and Cybernetics, Vol. 20, No. 2, Mar/Apr 1990.