Você está na página 1de 4

II: Designing a Simple Fuzzy Logic Controller

First, one must determine the input variables and the desired output. The input
variables are often referred to by linguistic terms, a way in which to describe the
meaning of the variables. For instance, Error and Actual Position are two easily
defined linguistic terms for use as input variables. The fuzzy output must then be
utilized to control the system.

Now, we go to the LabView Fuzzy Logic Toolkit which is located in the Tools menu
of the LabView programming environment. In true LabView style, the Fuzzy Logic
Toolkit is a GUI, a Graphical User Interface. We must first open a new Controller
from the File menu and select New. We name and define our variables by going to
the Edit menu and selecting Set Editor.

For example, the first Fuzzy Logic Controller I designed was a simple controller to
trace the data I collected of an analog channel on the DAQ box connected to my
computer. I read the voltage off of a function generator that was generating either
sine, square or triangle waveforms.

The output of the Fuzzy Controller I named Fuzzy Position and plotted versus
Wave Position, the analog input. I then took the difference of the two and named it
Error and made it the first Fuzzy Controller input variable. This controller would
essentially only consider the Error term in calculating its output, though considering
multiple terms is possible.

Next I had to define my Fuzzy Sets. You can define a maximum of 9 sets for each
variable. For Error, I designated the sets Far Under, Under, Mid Under,
Slightly Under, Close, Slightly Over, Mid Over, Over, and Far
Over. Now, I had to decide the range of these variables. Since I was using a
function generator whose waveforms spanned the range of 1 volt, the maximum
magnitude of error would be 2. Thus, I made the range of the error variable to be 2.

Similarly, I defined the response variable. The sets were named Down Hard,
Down, Slight Down, No Move, Slight Up, Up, and Up Hard. I also used
2 as the range of this variable as any correction to the error would have to lie in this
range.

Next, I had to designate the rules by which the Fuzzy Logic Controller would take in
inputs fuzzify them, determine their set memberships, defuzzify them and
determine the appropriate response. Complete step-by-step details for the LabView
Fuzzy Logic Controller Design environment can be found in [1] Chapter 5.
Essentially, you pick a response for each combination of inputs. Here, Wave Position
was a non-factor in how the Controller should respond to the waveform. Notice the
column labeled DoS, this is the weighting factor. This will modify how
the Defuzzification process will work, it will weight responses to give you slightly
better results if used properly.

The Fuzzy Logic Controller will then take in the input variables match them up with
your linguistic variables, and determine how the input should be converted to the
appropriate output. It can do this by one of three Defuzzification methods, Center-
of-Gravity, Center-of-Maximum or Mean-of-Maximum.

The different Defuzzification methods produce different results, but for now, we dont
need to worry about these differences. It suffices to say that for simple controllers the
outputs from the different controllers are similar enough that simply trying out the
three methods and determining which one best suits your needs is the most effective
way to choose a Defuzzification method.

Next I set up the VI to properly handle the data and the built-in capabilities of
LabView did the rest of the work. The following trace is the result of the Fuzzy
Controller responding to an inputted analog sine wave. The white line is the analog
input while the red is the fuzzy logic output.

Você também pode gostar