Sie sind auf Seite 1von 37

Fuzzy Logic

PL7 FUZ

Operating Modes Manual


Benutzerhandbuch
Manuel modes opératoires
Contents

ENGLISH
Section Page
1 Introduction 1/1

1.1 Presentation of the product 1/1

1.2 Installation 1/2


1.2-1 The target machine 1/2
1.2-2 Contents of the PL7 FUZ product 1/2
1.2-3 Installation procedure 1/2

2 The FUZ function 2/1

2.1 Prerequisites 2/1

2.2 Function parameters 2/1


2.2-1 Function call syntax 2/2
2.2-2 Description and use of parameters 2/3

2.3 Operating modes 2/4

2.4 Help with entering parameters 2/5

3 The fuzzy logic tool 3/1

3.1 Activating the fuzzy logic tool 3/1


3.1-1 Selecting a function 3/1
3.1-2 Tests performed when the tool is open 3/2

3.2 Configuring fuzzy logic 3/3


3.2-1 "Parameters" tab 3/3
3.2-2 "Membership Functions" tab 3/4
3.2-3 "Rules" tab 3/7

3.3 "Adjustment" tab 3/9


3.3-1 Simulation 3/9
3.3-2 Online mode 3/10
___________________________________________________________________________
3
Contents
ENGLISH

Section Page
3.4 Confirm - Cancel 3/12

3.5 Archiving 3/12

3.6 Operation of the tool in the PL7 environment 3/13

3.7 Printing 3/14

4 Performance 4/1
Memory usage 4/1

5 Appendix 5/1

5.1 Operating principle of the function 5/1


5.1-1 Fuzzy inference algorithm 5/1
5.1-2 Using fuzzy logic operators for calculating inferences 5/2

5.2 Example 5/4

___________________________________________________________________________
4
Section 11
Introduction
1 Introduction

ENGLISH
The "Fuzzy logic" function is designed to allow the integration of fuzzy rule databases
in TSX 37 and TSX 57 PLCs.
Simple to understand and easy to set up, it must allow a user with minimum knowledge
of fuzzy logic to integrate application-specific expertise into an application.
For this reason, the choices available when setting up the fuzzy logic function have
been reduced as far as is possible.
Moreover, this function can be used most of the time by selecting default configurations
and without specific knowledge of the various operators which can be used in fuzzy
logic.

1.1 Presentation of the product


The PL7 FUZ product is a software offer consisting of three elements :
• A function providing help with entry of function parameters which can be accessed
from the Function Library screen in the form of a special screen integrated in the
PL7 Micro and PL7 Junior editor.
• A fuzzy logic application development and debug tool which can be integrated in the
PL7 Micro and PL7 Junior programming workshops. This tool can be accessed from
the Tools menu under Fuzzy Logic.
• A fuzzy logic function called "FUZ", which is part of the "Fuzzy logic" family, can be
integrated in a PLC application and used to execute fuzzy inferences at the heart of
the PLC.

___________________________________________________________________________
1/1
1.2 Installation
ENGLISH

1.2-1 The target machine

PL7 FUZ operates on :


• an IBM PC or compatible microcomputer

The minimum configuration is as follows :


• microprocessor 486 DX 33Mhz
• 32 Mb of RAM
• 20 Mb available on disk
• VGA monitor
• COM serial port available (COM1 to COM4) for connection to the PLC
• Windows 95, NT operating system
• PL7 Micro, Junior or Pro V3.0 minimum

The typical machine configuration is as follows :


• microprocessor Pentium at 33 Mhz
• 48 Mb of RAM

1.2-2 Contents of the PL7 FUZ product

The product you have just received includes :


• an installation disk,
• this manual.

1.2-3 Installation procedure

PL7 FUZ should be installed on a development station which already contains PL7
Micro, Junior or Pro, version 3.0 minimum.

After inserting the disk into the drive, proceed with installation as follows :
• Open Windows Explorer, select the drive (A) then double-click on setup.exe or, in
Run from the Start Menu, type a:\setup then click on OK.

___________________________________________________________________________
1/2
Introduction 1

ENGLISH
• Enter your name and your organization
• Select the installation language
• To use this product, simply launch PL7 and then access the various components
required for fuzzy logic.

___________________________________________________________________________
1/3
ENGLISH

___________________________________________________________________________
1/4
The FUZ Section
function 22
2 The FUZ function

ENGLISH
Characteristics of the function :
• 5 inputs, 4 outputs,
• 25 rules maximum,
• 3 predicates and 2 conclusions per rule maximum,
• 20 membership functions maximum for inputs and 16 maximum for outputs,
• "Singleton" type outputs.
Operators :
For each stage of fuzzy reasoning, the function uses the following operators :
• composition operator : MAX/MIN,
• "AND" operator between predicates of a rule : MIN,
• implication operator : MIN,
• aggregate operator : MAX,
• defuzzification operator : center of gravity for singletons.

For further details on the operation of the fuzzy logic integrated in this function, see
section 5 "Appendix".

2.1 Prerequisites
The FUZ function operates on the application data, which it receives in the form of
parameters. It is not instantiated.

The function can only be executed by a call during processing of a task. By definition
it has no synchronized entry point in one or other of the PLC operating modes.
All parameters must be entered, the concept of optional parameters does not exist.

2.2 Function parameters


A fuzzy logic function is entered from the LD, IL and ST editors in a language statement.
Caution, a fuzzy logic function cannot be call in a Data Function Block (DFB).
Caution, a fuzzy logic function must not be conditioned.

___________________________________________________________________________
2/1
ENGLISH

If the function is conditioned, it will not be able to detect a cold restart and will therefore
be unable to perform its initializations (and in particular check the validity of the
knowledge base).

Using Ò Û , the user can call the function library which offers help with entering
function parameters. Simply select :
• the family of the function : "Fuzzy logic",
• the name of the function : FUZ,
then update the entry zone with the required parameters.

2.2-1 Function call syntax


(Help with entering parameters is available in section 2.4).

FUZ (
word, word, word, word, word, cst word[217],
IN IN IN IN IN IN
Input 1 Input 2 Input 3 Input 4 Input 5 Knowledge
base :
217 elements

word, word, word, word, bit, word [240],


OUT OUT OUT OUT OUT IN/OUT
Output 1 Output 2 Output 3 Output 4 error bit Work
space :
240 elements
word)
IN/OUT
Status/Command Word

Example of a call :
FUZ ( %MW0, %MW1, %MW2, %MW3, %MW4, %KW1000:217,
%MW200, %MW201, %MW202, %MW203, %M100, %MW1000:240,
%MW50)

Reminder : All the parameters used in a function must be entered. The concept of
optional parameters does not exist.

___________________________________________________________________________
2/2
The FUZ function 2

ENGLISH
2.2-2 Description and use of parameters
Parameter Type Description
Inp1 WORD Input 1
Inp2 WORD Input 2
Inp3 WORD Input 3
Inp4 WORD Input 4
Inp5 WORD Input 5
Csts AR_W Knowledge base : 217 elements
Out1 WORD Output 1
Out2 WORD Output 2
Out3 WORD Output 3
Out4 WORD Output 4
Berr EBOOL Error bit
Work AR_W Work space : 240 elements
StCm WORD Status/command word

Status/Command Word :

Bit no. Symbol Initial value Accessibility Meaning


0 INIT 0 W 1 triggers initialization, automatically
reset to zero after initialization
1 MAN_AUTO 1 R/W Manual/automatic mode selection
0 : manual mode
1 : automatic mode
2 START 0 W 1 triggers an inference on each scan if
the user is in On Request mode
3 CONT_ASK Param. R/W Continuous/On Request mode selection
0 : continuous mode
1 : on request mode
4 IN_FORC 0 R Set to 1, signals that the inputs are
forced
5 DEBUG 0 R Set to 1, signals that the function is in
Debug mode, ie the tool controls the
function directly and the PL7 code can
only send the INIT command (command
has priority in debug mode).
6 to 15 Reserved

R : Read access

W : Write access (taken into account by the function) by the program


___________________________________________________________________________
2/3
ENGLISH

Writing to the reserved bits of the Status/Command word may cause the function
to malfunction.

When the function is initialized, the Status/Command word is initialized with the values
stored in the knowledge base.

• Knowledge base :

The FUZ function must handle a knowledge base which belongs to it. Otherwise the
functions will not have remanent data (conserved whatever the state of the PLC). To
save the knowledge base, "constant" type variables are used, whose values are saved
simultaneously in the application and the PLC (even when stopped).
This concerns the Csts table.

This constants zone, which represents the knowledge base, must be protected
against any incorrect modifications.

• Work space :

The FUZ function must, for internal calculation, operate in a work space which is
represented by the Work table.

This zone, like the knowledge base, must also be protected against modifications.

2.3 Operating modes


This section describes the function operation for the different cases of PLC start-up :
• cold start :
the FUZ function is initialized. The knowledge base is copied to the work space.
Adjustment commands (forcing inputs, etc) are initialized.
• warm start :
the fuzzy logic function restarts in the current state.
• first execution after adding a function via online Modification : inserting (in RUN
or STOP) an additional call to a function already present in the application. In this
case initialization is identical to that performed on a cold restart.

___________________________________________________________________________
2/4
The FUZ function 2

2.4 Help with entering parameters

ENGLISH
To help with entering parameters, a dialog box can be accessed from the library (List
button).

If the user has entered any incorrect parameters before selecting the list, a dialog box
signals the errors and the necessary corrections. If no parameters have been entered
this box does not appear.

"Error" dialog box

"List" help with data entry dialog box

If some (or all) of the words or constants are outside the configuration, a message
advises the user once the data has been entered. In addition, the size of the tables is
fixed (cannot be modified).

___________________________________________________________________________
2/5
ENGLISH

Parameters to be entered :
1) the two internal parameter tables (constants and words),
2) the 5 word type input variables,
3) the Error bit,
4) the 4 word type output variables,
5) the status/command word.

It is possible to enter the various variables depending on their representation


("address" or "symbol") and also to modify their type of representation (in "Symbol"
mode, if no symbol is associated with a given address, the address is displayed).

All 13 function parameters must be entered.

Global confirmation is performed at the end of data entry (by pressing "OK").

___________________________________________________________________________
2/6
Section
The fuzzy logic tool 33
3 The fuzzy logic tool

ENGLISH
The Fuzzy logic tool is used to configure the fuzzy logic functions for the application.
It can be used to create and format the knowledge base associated with this function
and to simulate its behavior. Finally it allows online adjustment of the function.

3.1 Activating the fuzzy logic tool


To open the tool, select the “Fuzzy Logic” command from the “Tools” menu (the tool
can only be instantiated once) :

3.1-1 Selecting a function

At first the tool searches for all the fuzzy logic functions present in the application. The
following three scenarios are possible :
• no function is found, a message advises the user of this and the tool does not open,
• only one function is found in the application (the most common case), the tool opens
directly on this function,
• there are several fuzzy logic functions in the application, so the following dialog box
is displayed :

It is possible to display the selected function by clicking on "Display". The editor


containing the statement (or sequence or rung) in which the function is implemented
opens or is highlighted (if it is already open) and displays the statement (or sequence
or rung) concerned.

To configure the function, select it then load it by clicking on the "Configure" button or
by double-clicking on the line selected in the list.
___________________________________________________________________________
3/1
ENGLISH

If a fuzzy logic function is referenced several times in the same statement (or sequence
or rung), its number in the statement is indicated at the end of the line in the list. To see
the list of parameters, simply select the function then click on "Parameters". A message
containing the list of parameters for the selected function is displayed :

3.1-2 Tests performed when the tool is open

The validity of the parameters and the knowledge base, if there is one, is checked
during this phase. If the knowledge base is invalid, a message suggests that the user
open the tool on an empty base.
If one of the parameters is not valid, the tool does not open.

___________________________________________________________________________
3/2
The fuzzy logic tool 3

3.2 Configuring fuzzy logic

ENGLISH
When it opens, the PL7 FUZ display is either a predefined size (size of the views) or full
screen if the other tools open are using this mode. It respects standard PL7 operation.

3.2-1 "Parameters" tab


This tab is mainly an information page describing the function parameters, as they have
already been entered.

Mode selection - Calculation of inferences

On Request mode :
The function will be executed on the user’s request (in this case, a single inference is
launched). This is the default mode.

Continuous mode :
Continuous execution of the function.
If this mode is selected the user must enter an activation period which represents the
execution period of the function in tenths of a second (this value will be rounded off to
a multiple of the task period in which the function is programmed). Using this period could
be useful for processes in which the function does not need to be executed on each scan.
If the period is 0, the function executes on each PLC scan.
Default value : 10 (one second).

___________________________________________________________________________
3/3
ENGLISH

3.2-2 "Membership Functions" tab


This tab is used to define the membership functions for inputs and outputs and their
associated linguistic terms. The maximum number of membership functions is 20 for
input variables and 16 for output variables.

The list of linguistic variables for inputs and outputs is displayed with an indication of the
type (I for input, O for output). To enter the list of membership functions associated with
a variable, simply select the variable from the list.

Entering linguistic terms


To enter a linguistic term, the user can either select a predefined term displayed in the
list, or enter a new term (16 characters maximum) and then simply insert it ("Ins." button).

The "Del." button is used to delete the selected term from the list.

The "Ren" button is used to rename a linguistic term.

It is possible to access a predefined term more quickly by entering the first few
characters. The list displayed will then be sorted according to these characters.

___________________________________________________________________________
3/4
The fuzzy logic tool 3

ENGLISH
List of linguistic terms
The list of linguistic terms is made up of predefined terms (manufacturer) and user
terms.
All of the terms (manufacturer and user) are stored in the application.
The maximum number of terms contained in the list is 255 (manufacturer and user).

List of predefined linguistic terms :


Median Bp : Big positive
Low Negative Fast
Good N : Negative Upper
Light Small negative Very light
Correct Sn : Small negative Very low
Raised Average negative Very good
Weak An : Average negative Very dark
Dark Big negative Very raised
Strong Bn : Big negative Very weak
Big No Very strong
B : big Normal Very big
High Nothing Very high
Ideal Yes Very slow
Lower Small Very bad
Slow Positive Very negative
Bad P : Positive Very small
Average Small positive Very positive
A : Average Sp : Small positive Very fast
Minimum Average positive Zero
Min Ap : Average positive Z : Zero
Maximum Big positive
Max

___________________________________________________________________________
3/5
ENGLISH

Creating membership functions


Once a linguistic term has been entered, a membership function must be associated
with it. To do this, simply choose the function type by clicking on one of the following
buttons :
• input membership functions
Left half trapezoid

xA xB

Symmetrical or asymmetrical triangle

xA xB xC

Symmetrical or asymmetrical trapezoid

xA xB xC xD

Right half trapezoid

xA xB

• output membership function


Singleton selected automatically

xA
___________________________________________________________________________
3/6
The fuzzy logic tool 3

ENGLISH
The > character appears in front of a linguistic term when a membership function has
been associated with it (automatically for an output).
Then, simply enter the values of the points of inflection xA, xB, xC and/or xD.

The display scale is managed automatically depending on the membership functions


defined.

All of the membership functions associated with a linguistic variable are displayed (thin
line for each function, bold line for that corresponding to the linguistic term selected).

Default value : This must be entered for an output : this is the default value assigned
to this output if no active rule calculates it (this field does not exist for an input).

3.2-3 "Rules" tab


The fuzzy rules used are based on "Mamdani" type rules. There is only one rules
database (rules are all activated at the same time). Each rule has a maximum of 3
predicates and 2 conclusions. The knowledge base consists of 25 rules maximum.

___________________________________________________________________________
3/7
ENGLISH

Data Entry
The rules entry zone consists of drop-down lists of variables and linguistic terms. To
write a rule, simply enter the predicates and the conclusions using these drop-down
lists.
A list of linguistic terms gives only the terms defined for the variable selected
from the list of variables.

A negation can be selected on predicates. In the drop-down list, simply select the
linguistic term preceded by "!". There is no negation for conclusions.

Once the rule has been described, simply add it ("Add" button) to the list of rules. It will
be inserted at the end of the list. If the maximum number of rules is exceeded, a
message advises the user.

A number is associated with each rule. Rules are displayed in the order of their
numbers. Browser buttons can be used to change the order of the rules.

A rule must have at least one predicate and one conclusion. If this is not so, a message
advises the user of this.

One click on the "Initialize" button deletes all the fields in the "Rule Entry" group,
allowing entry on an empty rule.

Modifying - Deleting
To modify a rule, simply select it from the list. It is then displayed in the "Rule Entry"
zone. Once modifications have been made, select "Modify".
To delete a rule, select it from the list and delete it ("Delete" button).

___________________________________________________________________________
3/8
The fuzzy logic tool 3

3.3 "Adjustment" tab

ENGLISH
This tab is used in two ways :
• in offline mode for simulation,
• in online mode for debugging.

3.3-1 Simulation

In offline mode, this tab is used to simulate the operation of the function. This simulation
has three main advantages :
• activation of the rules for all the operating points is checked,
• the degree of activation of the rules is tested to improve/adapt the knowledge base,
• a PLC is not required (the knowledge base can be validated in the design office, for
example).

To activate simulation, simply enter the input values (forced inputs entry zones) then
launch the inference with <Start>. The simulated outputs are displayed. The degree of
truth of the rules contained in the knowledge base is displayed in the table.
All activated rules have a degree of truth displayed in red.
The drop-down list of rules located below the table summarizes this information and
gives a description of the rules.

___________________________________________________________________________
3/9
ENGLISH

All the other entry and check zones, which are not used in offline mode, are grayed out.
In this mode, the words “Simulation Commands” appear above the block of commands.

3.3-2 Online mode


This mode is used for debugging :

Force inputs
Inputs can be forced to simulate the operation of the function and therefore test it, then
to validate the associated knowledge base online.
Boxes 1,2,3,4,5 : Selection of forced inputs.
Force inputs : Forces the inputs selected in boxes 1,2,3,4,5. In this case, the true
inputs are not taken into account and only the values entered in the Forced Inputs are
used.

Error bit : The error bit is set to 1 when :


- the knowledge base cannot be used (working words corrupted);
- the size of the tables is incorrect.
The error bit is at zero in all other cases.

___________________________________________________________________________
3/10
The fuzzy logic tool 3

ENGLISH
When the error bit is at 1, the output parameters are no longer updated, they maintain
their state. The application program must therefore test this bit to impose a
fallback position if necessary.

Force Commands : Selecting this box permits direct commands from this screen
(the status/command word is inhibited).
In this mode, only initialization (“Init” button) can still be controlled by the status/
command word (ie the program can reinitialize the function even if the user is in the
debug phase). The status/command word informs the program of the user’s actions.
For the commands to be taken into account, the PLC must be in RUN.

Disconnecting or exiting the debug screen (changing tab or closing the tool) cancels
command forcing while retaining the current operating mode.

Automatic : The calculated outputs are assigned to the real outputs of the function.
Manual : Restart in manual mode. The manual outputs are assigned to the real
outputs of the function.
Operation on request - Continuous operation - Activation period (see section 3.2-1)
Start : Launches an inference. This button is active when the function is in operation
on Request.
Init : Reinitialization of the function. The knowledge base is copied into the work space.
Adjustment commands (force inputs, etc) are reinitialized.
Rules : This zone is used to display the degree of truth for instantiated inputs of each
of the rules contained in the knowledge base of the function. It is expressed as a %.

___________________________________________________________________________
3/11
3.4 Confirm - Cancel
ENGLISH

It is possible to Confirm or Cancel modifications at any moment when the function is


being used.
In effect, the whole knowledge base is permanently stored in the memory.
A configuration with a modified FUZ function is displayed with a * in the title bar.
Confirmation results in the archiving of the knowledge base linked to the function, then
the updating of the table of constants and transfer to the work space with initialization
of the function if the PLC is in online mode.
Cancellation restores the last confirmed knowledge base.
Management of Cancel - Confirm mode is therefore global (it is not possible to cancel
or confirm several consecutive modifications) and it is still possible to cancel until the tool
is closed.

3.5 Archiving
On each confirmation, the knowledge base is automatically archived in the application,
for the FUZ function identified by its address in the program.
The knowledge base is restored via the “Utilities/Restore” menu.
Restoration can be requested to reload the knowledge base from the function just
archived.
Restoration is still possible even after the tool or the application has been closed.
This command can also be used to :
• retrieve the knowledge base after constants have been modified (handling error in the
variables editor).
• move the knowledge base (having moved the knowledge base from a language editor,
simply apply the restore command),
Example : Changing the “Knowledge base” parameter from a language editor :
• Old knowledge base : %KW0 : 217
• New knowledge base : %KW112 : 217
From the tool select the "Restore" command from the "Utilities" menu.
• copy the knowledge base to another function : with the language editor, enter the
same address for the table of constants in the target function as is used in the source
function and confirm. Then request the table of constants to be moved as indicated
above.

___________________________________________________________________________
3/12
The fuzzy logic tool 3

3.6 Operation of the tool in the PL7 environment

ENGLISH
PL7 is a workshop made up of tools. It is therefore possible, during configuration of the
function, to activate another tool or to switch to an editor in which the configured
function is referenced, then delete this function or modify its parameters and confirm.
Moreover, the main menu common to all the tools can still be accessed and it is
therefore possible to modify the PLC operating mode or switch from offline to online
mode, for example.
The table below summarizes all possible situations and describes the behavior of the
tool in each of them.

External event Behavior


Closing PL7 Message asking the user to confirm/cancel the
Closing the Application modifications made in the tool is displayed (if no
modifications have been made, there is no message).
Tool highlighted The application knowledge base table has been
modified other than by the tool. There are two
possible scenarios :
- the application knowledge base is invalid : a
message suggests replacing it with the tool’s current
base. If the response is negative, the tool automati-
cally closes.
- the application knowledge base is valid but differs
from that of the tool : a message suggests continuing
to work on the application database.
If the parameters of the function call statement have
been modified, the user is warned of this by a
message.
Modifying the symbol of a Automatic modification of the symbol display
linguistic variable in the variables
editor
Offline -> Online If the "Adjustment" tab is active : switch to online
mode.
Checks are no longer grayed out.
Online -> Offline If the "Adjustment" tab is active : switch to simulation
mode.
Checks are no longer grayed out.
Transferring a PLC application - Symbols associated with linguistic variables are lost.
to a new terminal - User linguistic terms are replaced by generic
linguistic terms (Undef_0, etc)
Importing an application User linguistic terms are replaced by generic linguistic
terms (Undef_0, etc)

___________________________________________________________________________
3/13
3.7 Printing
ENGLISH

Two types of printing are possible :


• local printing from the tool accessed by the Print command in the File menu,
• printing the characteristics of the function, using the “Documentation” tool in PL7
which manages the printing of the application documentation file.
The application description uses, for this documentation file, FCL (Fuzzy Control
Language) code, the standard IEC 1131-7 representation.

Two scenarios are possible :


• the function parameters have been defined but not configured (with the fuzzy logic
tool). In this case, printing of the function resumes when the list of parameters is
described,
• the function parameters have been defined using the fuzzy logic tool. All of the
function parameters as well as the knowledge base are printed.
Printing is in the following format :
Parameters
Input no.1 : %MW1501
Input no.2 : %MW1502
Input no.3 : %MW1503
Input no.4 : %MW1504
Input no.5 : %MW1505
Knowledge base : %KW1500:217
Output no.1 : %MW1511
Output no.2 : %MW1512
Output no.3 : %MW1513
Output no.4 : %MW1514
Error bit : %M1500
Work space : %MW1600:240
Status/command word : %MW1520
Knowledge base
VAR_INPUT
%MW1501 : INT;
%MW1502 : INT;
%MW1503 : INT;
%MW1504 : INT;
%MW1505 : INT;
END_VAR
VAR_OUTPUT
%MW1511 : INT;
%MW1512 : INT;
%MW1513 : INT;
%MW1514 : INT;
END_VAR
___________________________________________________________________________
3/14
The fuzzy logic tool 3

ENGLISH
FUZZIFY %MW1501;
TERM Raised := (0,1) (1000,0);
END_FUZZIFY
FUZZIFY %MW1503;
TERM Raised := (0,1) (1000,0);
END_FUZZIFY
FUZZIFY %MW1501;
TERM Raised := (0,1) (100,0);
END_FUZZIFY
FUZZIFY %MW1505;
TERM Slow := (-10,1) (0,0);
TERM Bad := (-10,1) (0,1) (0,0);
TERM Big Negative := (0,0) (0,1) (10,0);
TERM N := (0,0) (10,1);
END_FUZZIFY

DEFUZZIFY %MW1511;
METHOD : COGS;
TERM Median := 0;
TERM Correct := 600;
DEFAULT := 0;
END_DEFUZZIFY
DEFUZZIFY %MW1512;
METHOD : COGS;
TERM Slow := -50;
TERM Bad := -10;
TERM Upper := 0;
TERM Big Negative := 10;
DEFAULT := 0;
END_DEFUZZIFY

RULEBLOCK No 1
AND : MIN;
ACCU : MAX;
RULE 1 : IF %MW1501 IS Raised THEN %MW1511 IS Median
RULE 2 : IF %MW1501 IS NOT Raised AND %MW1505 IS NOT N THEN %MW1511
IS Correct
RULE 3 : IF %MW1505 IS Slow THEN %MW1512 IS N
RULE 4 : IF %MW1505 IS Bad THEN %MW1512 IS Big Negative
RULE 5 : IF %MW1505 IS Big Negative THEN %MW1512 IS Bad
RULE 6 : IF %MW1505 IS N THEN %MW1512 IS Slow, %MW1511 IS Median
END_RULEBLOCK

___________________________________________________________________________
3/15
ENGLISH

___________________________________________________________________________
3/16
Section 44
Performance
4 Performance

ENGLISH
Memory usage
Program space 1608 words

Execution time (per scan)


Execution times vary greatly depending on the knowledge base used. The figures given
in the tables below have been measured in the following conditions :

• 1 input, 2 outputs,
• 3 rules,
• 9 membership functions.

TSX MICRO TSX PREMIUM

37.10 37.22 57.10 57.20

7 ms 5.5 ms 7 ms 4.8 ms

• 4 inputs, 3 outputs,
• 13 rules,
• 19 membership functions.

TSX MICRO TSX PREMIUM

37.10 37.22 57.10 57.20

9.6 ms 7 ms 9.2 ms 6.6 ms

• 5 inputs, 4 outputs,
• 25 rules,
• 36 membership functions.

TSX MICRO TSX PREMIUM

37.10 37.22 57.10 57.20

17.5 ms 13.5 ms 13.5 ms 9.6 ms

___________________________________________________________________________
4/1
ENGLISH

___________________________________________________________________________
4/2
Section 55
Appendix
5 Appendix
5.1 Operating principle of the function

ENGLISH
5.1-1 Fuzzy inference algorithm

The FUZ function calculates fuzzy inferences by performing the following steps :
• reading numerical values of the input variables,
• evaluating each membership function (Fuzzification),
• evaluating each rule,
• calculating the resulting output membership functions,
• calculating the numerical values of the output variables (Defuzzification).

Fuzzy rules
The fuzzy rules used are based on the "Mamdani" type rules.
There is only one rules base, which means that the rules are all activated at the same
time.
Each rule has a maximum of three predicates (conditions) and two conclusions.

Membership functions
Membership functions can be defined relative to the inputs and outputs of the function.
They are all "standardized", meaning that the minimum and maximum degrees of
membership reached by the function are 0 and 100(%). Standardization is not applied
between 0 and 1 as calculations are made in whole numbers.

The following possibilities are available :

For input membership functions :


• symmetrical triangle
• asymmetrical triangle
• right half trapezoid
• left half trapezoid
• symmetrical trapezoid
• asymmetrical trapezoid

For output membership functions :


• singleton (reduced to one point).

Input membership functions are represented in the function in the form of abscissae
xA, xB, xC, xD of four consecutive characteristic points. Output membership functions are
represented by the single value of the corresponding singleton, xS.

___________________________________________________________________________
5/1
ENGLISH

B C 1 00%
100 %

A D xS O utpu t
In put

Method of inference

The FUZ function uses Mamdani fuzzy rules with the following operators :

(1) "AND" operator : MIN


(2) implication operator : MIN
(3) aggregate or "OR" operator : MAX

Defuzzification
The FUZ function uses the defuzzification method by calculating the center of gravity
of singletons.

5.1-2 Using fuzzy logic operators for calculating inferences

Fuzzification

Direct correspondence between the numerical value of the input and the degree of
membership :

Av era ge

D e gr ee
o f me mbe r sh ip

V alue of inp ut

___________________________________________________________________________
5/2
Appendix 5

ENGLISH
Rules

• AND operator : MIN


The value retained as the degree of activation for the rule is the minimum value for the
degree of membership for the predicates.

Example : IF Input1 Average AND Input2 small THEN ...

Average S m all

V alue
r etain ed
Inpu t1 I nput2
Va lue of inpu t1 V alue of input2

• Implication operator : MIN


The output membership function is “limited” to the value of the degree of activation of
the rule.
Example : ... THEN Output Weak

Weak
100%
1

D egree of activation

Output

• Aggregate operator : MAX


If several rules use the same conclusion, the output membership function is eventually
“limited” to the value of the degree of activation of the highest rule.

100%
D egree of activation
rule 1
rule 2

O utput

___________________________________________________________________________
5/3
ENGLISH

Defuzzification

The numerical value calculated for the output corresponds to the center of gravity of
all the singleton values of the output.

Weak Average Big


100%
y
3
y
1 y
2

x1 x2 x Output
3

V alue calculated

Σ ( xi . y i )
Value calculated =
Σy i

5.2 Example
Membership functions

% % %
Small Av e rage A v e rage B ig S mall A v e rage Big
100 100 100

10 30 40 60 X 60 80 90 Y 100 500 900 Z

In p u t X In p u t Y O u tp u t Z

Rules

Rule 1 : If (X is Small) Then (Z is Big)


Rule 2 : If (X is Average) And (Y is Big) Then (Z is Small)

___________________________________________________________________________
5/4
Appendix 5

ENGLISH
Calculating the inference

Values taken by the inputs : X=15, Y=85

% %
Sm all Big
100 100
75

R u le 1

10 30 40 60 X 100 500 900 Z

% % %
A v er age B ig Sm all
100 100 100

R u le 2 50
25

10 30 40 60 X 60 80 90 110 Y 100 500 900 Z

15 85

%
Sm all Big

75
D e fu z z i fy
25

100 900 Z
700

___________________________________________________________________________
5/5
ENGLISH

___________________________________________________________________________
5/6

Das könnte Ihnen auch gefallen