JSIR 65(2) 142

advertisement
Journal of Scientific & Industrial Research
Vol. 65, February 2006, pp. 142-147
Implementation of fuzzy temperature control using microprocessor
M D Hanamane, R R Mudholkar, B T Jadhav and S R Sawant*
Department of Electronics, Shivaji University, Kolhapur 416 004
Received 27 March 2005; revised 21 October 2005; accepted 11 November 2005
Fuzzy Logic has been employed to control temperature by varying ON-time of heater through PPI 8255. Thermister is
used as a temperature sensor forming the resistive component of RC-Timer of IC 555 operated in novel Astable mode. The
actual temperature is read as a function of frequency and compared with corresponding count of set-point temperature. The
error-count is used to trigger the Fuzzy Inference process. This develops an overall duty for heater control that maintains the
temperature of furnace to the set value. The hardware implementation followed by flow chart depicting the software
approach has been given. The results are satisfactory when the duty cycle is around 50%.
Keywords: Duty cycle, Fuzzy logic, Microprocessor, Temperature control
IPC Code: G06N7/02; G05D23/00
Introduction
Many chemical reactions, industrial processes and
experiments require temperature to be maintained at
predetermined value1-3. There are many modes to
regulate the temperature like ON/OFF, Proportional
Derivative (PI), and Proportional Integral Derivative
(PID). Of late, Fuzzy Logic Control (FLC) has
become very popular over the Conventional Control
Logic (CCL), mainly because the process of FLC is
simply to put the realization of human control
strategy, where CCL heavily relies on the mathematical formulations. In this study, FLC was used for
temperature control using microprocessor for a small
furnace.
Fuzzy Control System and its Design
FLC incorporates temperature control4 as fuzzy
relation between the present temperature to be controlled and the set-point (Fig. 1). The essence of
Fuzzy Control Algorithm is the conditional statement
between fuzzy input variable (present furnace temperature) and fuzzy output variable (heater current).
kit with built-in port (IC 8255) and Counter/Timer (IC
8253) and Dimmerstat of Automatic Electric Ltd,
Bombay, 0-230V AC, 15 A output (Fig. 2). Furnace
(resistance, 10 Ω; operating voltage, 50 Volts; power,
250 W) is made up of aluminium chassis with ceramic
inside (Fig. 3). IC-555 used in a novel astable mode
with thermister in the timing network forms the
sensor part. The output (pin-3) of IC-555 goes to the
interrupt RST 7.5 used to count the pulses as function
of temperature.
(a) Micro Processor based Control Circuit
Present experiment used 8085-based circuit to
implement the fuzzy controller. The I/O 8255 has
been used for the heater control operation while the
temperature in the form of count was measured using
the interrupt RST 7.5.
(b) Zero Crossing Detector
In order to fire Triac exactly at zero point of the
AC cycle, zero crossing detector has been employed
(Fig. 4).
(c) Heater Control Circuit
Hardware Details
5-7
Microprocessor based system
comprises
Anshuman Classic, Pune make 8085 Microprocessor
_______________
*Author for correspondence
Tel: 091-0231-2690571; Fax: 091-0231-2691533
E-mail: srs600112@yahoo.com
Port C of 8255 senses the output of detector and
initiates firing on level change. Heater circuit used for
delivering power to the furnace is shown in Fig. 5.
Specifications of transistor were as follows: Type, BC
147; Case, TO92; VCE, 45 V; VCB, 50 V; IC, 100 ma;
hfe, 110-800; and PD, 500 mW. Specifications for
HANAMANE et al.: FUZZY TEMPERATURE CONTROL USING MICROPROCESSOR
143
Fig. 4Zero crossing detector circuit
Fig. 1Schematic fuzzy controller
Fig. 5Heater control circuit using Opto-coupler and Triac
Triac were: Type, BT139; Case, TO220; VDRM, 500V;
IT (rms), 16 A; IGT, 50 ma; VGT, 1.5 V; and PG
(AV), 0.5 W.
Implementation of Fuzzy Logic Temperature
Controller
Step-1: Defining Inputs and outputs Variables
Fig. 2Furnace details
Universe of discourse for input and output8-12 is
from room temperature to 100°C and PWM uses ON-
Fig. 3Hardware set up of temperature controller
J SCI IND RES VOL 65, FEBRUARY 2006
144
Table 1Universe of discourse for input and output variables
Characteristics
Input/
Output
Minimum
value
Maximum
value
Temperature sense, °C
Duty cycle for PWM, %
Input
Output
Room temp.
20
100
80
Table 2Fuzzy variable for temperature
S No
Crisp input rangen
°C
Fuzzy variable name
1
2
3
4
5
6
7
30 - 40
30 - 50
40 - 60
50 - 70
60 - 80
70 - 90
80 - 100
VVL
VL
L
LL
ML
N
H
Fig. 6Fuzzy membership function for temperature
Fig. 7Fuzzy membership function for count as temperature
sense
Table 3Fuzzy Variable for temperature sense
S No
Crisp input range for count
%
Fuzzy variable name
1
2
3
4
5
6
7
104 - 123
104 - 138
123 - 152
138 - 164
152 - 171
164 - 180
171 - 180
VVLC
VLC
LC
LLC
MC
NC
HC
time (20-80%) to control the heater circuit (Table 1).
Input temperature is sensed by thermister, which is
connected in novel astable multivibrator whose frequency varies as a function of temperature. The count
corresponding to a particular temperature is measured
with the help of a microprocessor-based circuit and
the same is stored in a memory location. Microprocessor acts as a FLC. Thus, count acts as an input
variable to FLC. By using rule base, FLC decides
output variable, which is percentage duty cycle.
Step-2: Fuzzification of Input Variable
Input to FLC is temperature sensed. Triangular
membership functions have been used to fuzzify the
input. For fuzzifier program, it is necessary to
determine range of fuzzy variables related to the crisp
inputs. Temperature sensed as input variable is
restricted to positive values. The following fuzzy sets
have been used: VVL =very very low, VL=very low,
L= low, LL=little low, ML= medium low, N= normal,
H= high (Table 2, Fig. 6).
Since temperature is sensed in terms of count, the
crisp inputs to fuzzy controller are counts received by
controller. The following fuzzy sets for count have
been used: VVLC, very very low count; VLC, very
low count; LC, low count; LLC, little low count; MC,
medium count; NC, normal count; and HC, high
count (Table 3, Fig. 7).
Step-3: Fuzzy Membership Functions for Outputs
Present study considered typically one output
variable, which is percent duty cycle. It is necessary
to assign fuzzy memberships to output variable,
similar to input variable. The following fuzzy sets
have been used for percent duty cycle: VVLD = very
very large duty cycle, VLD = very large duty cycle,
LD = large duty cycle, LLD = little large duty cycle,
MD = medium duty cycle, ND = normal duty cycle,
SD = small duty cycle (Table 4, Fig. 8).
Step-4: Knowledge Representation
The temperature control policy is structurally
formulated in terms of fuzzy-rules. The relevant
information of rules is stored in the database. Thus
knowledge base consists of Rule Base and Database.
The Database contains the following information: (1)
Labels of linguistic variables; and (2) Operating range
of variable.
Rule Base
The control policy of heater is structurally
formulated in terms of fuzzy rules as follows:
HANAMANE et al.: FUZZY TEMPERATURE CONTROL USING MICROPROCESSOR
145
Fig. 8Fuzzy membership function for the output % duty cycle
Fig. 9Fuzzy inference and height defuzzification
Table 4Fuzzy variable ranges for output % Duty cycle
S No
1
2
3
4
5
6
7
Crisp input
range
of temp.
°C
Fuzzy variable
range for
output
%
Fuzzy
variable
name
30 - 40
30 - 50
40 - 60
50 - 70
60 - 80
70 - 90
80 - 90
75 - 70
75 - 65
70 - 69
65 - 55
60 - 50
55 - 40
50 - 40
VVLD
VLD
LD
LLD
MD
ND
SD
determined by fuzzification. Activation of each fuzzy
input variable will cause different fuzzy output rule to
fire.
Step-5: Defuzzification of the Outputs
In order to control the duty cycle, a crisp temperature reading is required. To arrive at single crisp
output, there are several methods of defuzzification.
To obtain crisp value of duty cycle from clipped fuzzy
set, a height defuzzification has been employed
(Fig. 9). The crisp-duty cycle is given by:
q
∑P
(r )
m
If the temperature is Then Duty cycle is
H
N
ML
LL
L
VL
VVL
SD
ND
MD
LLD
LD
VLD
VVLD
Here output and input to fuzzy rule base are fuzzy
variables. For any crisp input value, there may be
fuzzy membership in several fuzzy input variables
D* =
h(r )
r =1
q
∑h
(r )
r =1
where, q = number of fuzzy rules fired, Pm(r) = Peak
value of rth clipped fuzzy set, and h(r) = height of rth
clipped fuzzy set.
Results and Discussion
The temperatures in case study are as follows: set
temperature, 80°C; and current temperature, 42.5°C.
For Rule Base, if temperature is L, duty cycle is LD;
and for temperature VL, duty cycle is VLD.
J SCI IND RES VOL 65, FEBRUARY 2006
146
Table 5Performance of system at 80°C
Set
Duty cycle
%
Steady state temperature
°C
I
II
III
IV
V
60
55
50
45
40
98
87
81
78
76
Table 6Performance of system at 50°C
Set
Duty cycle
%
Steady state temperature
°C
I
II
III
IV
V
70
65
60
55
50
80
78
65
60
50
Rule Fired
Temperature VL with degree of satisfaction (DOS)
Duty cycle VLD with DOS
Temperature L with DOS
Duty cycle LD with DOS
=
=
=
=
0.72
0.72
0.28
0.28
Defuzzified duty cycle,
D* =
70 × 0.72 + 0.28 × 65
= 68.6%
0.72 + 0.28
Similarly, data for different values of temperature
and corresponding defuzzified duty cycle is calculated
for Sets I-IV (Tables 5 & 6).
This program after initialization of 8255 as output
device calls the heater-on program and loads an initial
count corresponding to the room temperature
(Fig. 10). The comparison with the defuzzified count
corresponding to the set-point fires the rule and
accordingly ON and OFF times (counts) get modulated till the set-point temperature is attained. At this
stage, defuzzified counts corresponding to the ON and
OFF times are evaluated and the heater power is
controlled to maintain the temperature constant. The
temperature is displayed and the process of temperature control continues.
Conclusions
To test the performance of system, two temperatures of 80°C (Table 5) and 50°C (Table 6) were
selected and tuning process was employed to select
suitable duty cycle to get the temperature near the setpoint value. The scaling factor for the purpose of
turning 1.072 and the width of temperature domain
Fig. 10System flowchart
was 5. It has been concluded that the temperatures are
exactly near the set-point when duty cycle is 50%.
Results are satisfactory if the set-point is higher
(80°C). The use of microprocessor though has certain
limitations in developing membership function and
inference scheme, in the present study, a novel fuzzy
encoding is used in terms of counts.
HANAMANE et al.: FUZZY TEMPERATURE CONTROL USING MICROPROCESSOR
References
1
2
3
4
5
6
Modi R K & Pal N R, Self tuning PD controller, IETE J Res,
44 (1998) 177-189.
Williams B W, Power Electronics, Devices, Drivers,
Applications and Passive Components (ELBS with Mc
Millan) 1992, 123-200.
Hantek E R, Applications of Linear Integrated Circuits (John
Wiley and Sons, N Y) 1975, 438-445.
Driankow D, Hellendoorn H & Reinfrank M, An
Introduction to Fuzzy Control (Narosa Publishing House,
New Dehli) 1996,1-144.
Gaonkar R S, Microprocessor Architecture, Programming
and Applications with 8085/8085A (Wiley Eastern Ltd, New
Delhi) 1993.
Microprocessor Data Handbook (BPB Publications, New
Delhi) 1989.
7
147
Motorola Opto Electronic Device Data (Motorola
Semiconductor Product Inc.) 1981, 35-52.
8 Mudholkar R R & Sawant S R, Fuzzy logic build estimation
(FLTBE), Trans Indust Electron, IEEE, 49 (2002).
9 Mudholkar R R, Sawant S R, Tengshe G G & Bagwan A B,
Fuzzy Logic Transformer Design Algorithm (FLTDA), Active
and Passive Elec. Comp., vol 22 (Overseas Publishers
Association, N Y) 1999, 17-29.
10 Klir G J & Yuan B, Logic Fuzzy Sets and Fuzzy (PrenticeHall of India, New Delhi) 1997, 11-338.
11 Tanaka K, An Introduction to Fuzzy Logic for
Practical Applications (Springer-Verlag, New York) 1997,
86-136.
12 Cox E, The Fuzzy Systems Handbook-A Practitioners Guide
to Building, Using and Maintaining Fuzzy Systems (APProfessional, Boston) 1998, 45-46.
Download