22-05-2012, 02:15 PM
Fuzzy Logic Motor Speed Control with Real-Time Interface using an 8-bit Embedded Processor
Fuzzy Logic Motor Speed Control with Real-Time Interface using an 8-bit Embedded ....pdf (Size: 797.5 KB / Downloads: 48)
Abstract
Fuzzy specific hardware systems, or the adaptation
of standard embedded controllers, are the common approaches
for real-time fuzzy logic implementation. High speed
applications may require the more sophisticated hardware, but
most embedded control applications do not have the high speed
processing requirements that necessitate the cost prohibitive
enhanced hardware. A review of embedded control fuzzy logic
applications indicates a preference for 16-bit architectures;
devoting significant processing resources for fuzzification, rule
application, and defuzzification. While faithful to the
foundations of fuzzy logic control, processor demand can limit
a controller’s ability to handle peripheral I/O interfaces. This
paper describes a generic, hybrid approach suitable for
unenhanced 8-bit microcontrollers and adaptable to most
single input, single output systems. A motor speed application
with real-time I/O interface provides proof of concept
performance data and highlights limitations.
Keywords- Fuzzy Logic Control, Real-time Control,
Embedded System Applications
I. INTRODUCTION
NDUSTRIAL control solutions based on implementations of
fuzzy logic have an established and well documented
history [1]. Linguistic rules are applied to potentially
ambiguous or incomplete input data in order to produce a
crisp output response in an attempt to mimic the capabilities
inherent to human thinking. While generally applicable to
pattern recognition problems where the input data is
incomplete, fuzzy logic control applications are useful when
the system model is inaccurate, incomplete or unknown.
In their basic form, all fuzzy logic systems have modules
to perform three essential processes: the fuzzification of
input data, an inference engine, and the defuzzification
process which produces a crisp output. The mechanics of
each process will be briefly described later in a subsequent
section.
Due to their linguistic nature, fuzzy logic systems are
typically realized by coding in a high level language on a
personal computer. This approach is commonly used in
industrial and process control situations. There are two
techniques commonly attempted in embedded control
applications. One approach uses an enhanced processing
unit with the fuzzy logic reasoning integrated in hardware.
The hardware unit supports an extended instruction set, with
rules and membership functions stored in specific formats in
either RAM or ROM [2]. Although these processors are
considerably faster at implementing fuzzy reasoning than an
equivalent, unenhanced processor, they lack the integration
of memory and I/O functionality common to microcontroller
platforms [3].
An alternate approach uses standard microcontroller
hardware programmed with a set of subroutines to perform
real-time computations that implement the fuzzy logic
reasoning algorithms. While the microcontroller platform is
better suited for direct interface in an embedded system, the
real-time computations typically require simplified data set
representations in an effort to maintain a computationally
efficient algorithm [4 - 8].
In both instances, the fuzzy logic algorithm is synthesized
on the hardware platform and based on a specific set point
value for the variable of interest. This paper describes a
hybrid approach that implements a generic fuzzy logic
algorithm based solely on error [9]. By combining the power
of a high level language running on a PC with the generic
error-based linguistics, a standard, 8-bit microcontroller
becomes a suitable platform to apply fuzzy logic control in
real-time with limited computational overhead. This allowed
the microcontroller to additionally handle the human
interface requirements of a real-time embedded system. A
DC motor speed control application, complete with keypad
input and real-time LCD output, was used to assess the
performance the approach. To help explain the hybrid fuzzy
concept, a brief description of fuzzy control reasoning is
provided in the following section.
I
This work was supported by a UT Tyler President’s Faculty-Student
Summer Research Program and the UT System LSAMP program
978-1-4244-5692-5/10/$26.00 © IEEE 2010 307
42nd South Eastern Symposium on System Theory
University of Texas at Tyler
Tyler, TX, USA, March 7-9, 2010
T1C.2
Authorized licensed use limited to: PSG College of Technology. Downloaded on July 09,2010 at 07:32:21 UTC from IEEE Xplore. Restrictions apply.
II. AN OVERVIEW OF FUZZY LOGIC REASONING
Fuzzy logic reasoning is predicated on taking a specific
data input, using rules from a knowledge base to convert
that input into fuzzy data, applying an inference engine to
produce a fuzzy output and finally converting the fuzzy
output into a crisp output. The overall process is divided
into three functional modules commonly referred to as
fuzzification, inference, and defuzzification. A brief
description of these modules follows.
Fuzzification is a process of taking specific, typically
crisp, input data and mapping it into linguistically described
fuzzy membership sets. Although the shape function used to
describe a membership set can be somewhat arbitrary, the
three most common shape functions are triangular,
trapezoidal and Gaussian. The mapping is accomplished
with the aid of a knowledge base; a set of “if – then” rules
described in natural language. The “if – then” structure is
commonly available in high level programming languages
and provides the foundation for many machine intelligence
applications, such as expert systems. The use of linguistic
rules is essential for a reasoning system to be considered as
“fuzzy.” The membership sets provide numerical domains
corresponding to the linguistic rules. The membership of
specific input data is determined from the arguments
embodied in the “if” criteria and are frequently the variables
of interest. In all instances the membership sets are designed
to overlap. This often results in situations where an input
shares membership among multiple sets. The fuzzification
module determines which membership sets contain the input,
and therefore, which linguistic rules will apply. Although a
specific number of membership sets are not required, general
guidelines for fuzzy logic systems require an odd number;
one for the ideal case and an equal number of sets on either
side of ideal. As a practical matter, systems with more than
11 fuzzy membership sets for a single variable are not
commonly encountered since computational effort outweighs
the resolution benefit. The use of three membership sets is
not an uncommon simplification for typical embedded
processor implementations of fuzzy logic.
In general, the application of rules is a binary concept; a
rule either applies or it doesn’t. In a fuzzy reasoning system,
if a fuzzified input belongs to multiple membership sets, then
all associated rules simultaneously apply. Since membership
shape functions describe a distribution, the extent, or degree
of membership for a given input varies. The degree of
membership determines how much influence a given rule
will have on the ultimate response of the system. The degree
of membership within a single set typically ranges between 0
and 1. While most often the total membership for a given
input will sum to 1, it is certainly possible to define
membership sets that do not exhibit this property. It is the
function of the inference engine to determine which rules
from the knowledge base apply, the degree of membership in
the fuzzy sets, and therefore the degree of influence, or
weight, that each rule exerts. This process effectively maps
the fuzzy inputs into fuzzy outputs.
Defuzzification takes the applicable rules from the
inference engine and maps each linguistic “then” argument
to a unique numerical value. Each of these values is adjusted
by a weighting factor corresponding to the degree of
membership. When multiple rules apply, the result of this
defuzzification process is typically the algebraic sum of the
weighted values, which produces a single, crisp, system
output. When the total membership of an input does not sum
to 1, then the defuzzification output is normalized by
dividing the algebraic sum of weighted values by the
algebraic sum of the degree of membership.
III. THE HYBRID FUZZY LOGIC SYSTEM
In the classical fuzzy logic approach, the linguistic
knowledge base and membership sets are specific to the
domain of the controlled variable. The hybrid fuzzy logic
system merges fuzzy reasoning concepts with the classical
control theory concept of error. In this context, error is
defined by the equation:
e = SP – Rm (1)
where e is the error, SP is the desired set point, and Rm is
the measured response of the system. In this context, a
positive error is the result of the response being less than the
set point, and indicates that an increased output is required.
This approach is domain independent in terms of the
linguistic knowledge base and membership sets, i.e. there is
no distinction between a speed error, a flow rate error, a
temperature error, etc; if the measured variable is not at the
set point, a corrective action can be described in terms of
increasing or decreasing the system output. Table 1
illustrates the differences between a domain specific and a
generic hybrid fuzzy system.
In addition to domain independence, the membership
sets for the error-driven, hybrid approach are independent of
the system operating point. While this does not alter the
general system response characteristics, which will remain
constant using this method, it readily allows for an end user
to interactively designate, or modify, a desired set point in
real time.
In the case of an 8-bit microcontroller, using 1-byte
signed integers for both input and output, a total of 256 error
values are possible: 128 negative values, 127 positive values
and zero. This number of error values remains constant
regardless of how the membership sets are defined. This
308
Authorized licensed use limited to: PSG College of Technology. Downloaded on July 09,2010 at 07:32:21 UTC from IEEE Xplore. Restrictions apply.
lends itself to a tabular approach that uses 256 bytes of
program memory to store a set of pre-calculated responses.
Since most microcontrollers support a form of indirect
addressing, a table offset corresponding to the error value
can directly access the appropriate correction, or
compensation value to add to the previous controller output.
The table of compensation values represents a 1-
dimensional array (Comp[]) and the individual array
elements are aligned so that their array index corresponds to
the numerical error value. This implements a fuzzy logic
control algorithm with very little computational effort on the
part of the microcontroller. Fig. 1 illustrates the flow of this
control scheme.
TABLE I. COMPARISON OF FUZZY LOGIC RULES FOR A TEMPERATURE
SPECIFIC DOMAIN AND A GENERIC, ERROR-BASED DOMAIN SYSTEM.
Rule
Number
Temperature based
Rule
Error Based Rule
1 IF Temperature is Very
Cold THEN Increase
Heat a Lot
IF error is Large Positive
THEN Correction is Large
Positive
2 IF Temperature is Cold
THEN Increase Heat a
Little
IF Error is Small Positive
THEN Correction is Small
Positive
3 IF Temperature is Ideal
THEN Do Nothing
IF Error is Zero THEN
Correction is Zero
4 IF Temperature is Hot
THEN Decrease Heat a
Little
IF Error is Small Negative
THEN Correction is Small
Negative
5 IF Temperature is Very
Hot THEN Decrease
Heat a Lot
IF Error is Large Negative
THEN Correction is Large
Negative
Figure 1. Block diagram of the hybrid fuzzy logic control system.
By reducing the computational requirements for the fuzzy
logic implementation, increased man-machine interface
activity could reasonably be expected from a common
control platform. Provided the compensation table is
generated using fuzzy logic rules, which have been based on
the hybrid approach, this can be considered a fuzzy logic
control implementation.
Using a PC as a pre-processor, the compensation table is
pre-calculated prior to run time and is based on a linguistic
interpretation of the fuzzy logic rule base. The membership
set shape functions that may be implemented are not limited
to the triangular or trapezoidal shapes, which is a limitation
of real time computational techniques using standard
microcontrollers. The PC-based program presents the
domain expert with linguistic prompts to facilitate defining
the membership set shapes and their associated key
parameters. In addition, the compensation table are
generated using floating-point calculations, and
subsequently written into a formatted table of integers based
on either round off or truncation rules. The compensation
table is then pasted into the program code prior to storing in
the microcontroller ROM.
For demonstration purposes, a proof–of–concept system
was built to test the hybrid fuzzy logic approach. The
system consists of a PC–based pre-processor program and
an MCS-51 8-bit embedded processor system for control of
a DC motor. The following section details the hardware and
software used in this system.