20.6.12.2. Introduction to the FIS file format
The Fuzzy block in RecurDyn/CoLink loads the FIS file and executes the Fuzzy logic controller defined in the FIS file. The FIS file can be created either by using MATLAB® or by using a simple text-editor. In this section, the FIS file format is explained so that the user can create a FIS file using any text-editor application.
The FIS file format in RecurDyn/CoLink adopts the fuzzy file format used in Fuzzy Logic Toolbox in MATLAB® package. If the user is familiar with the FIS file format used in the Fuzzy logic controller in MATLAB® package, the user can skip this section.
FIS file format
File extension of the FIS file is ‘-.fis’.
The FIS file contains all the necessary information to describe the Fuzzy logic controller and it includes:
Type of Fuzzy logic
Control inputs including input Fuzzy membership functions
Control outputs including output Fuzzy membership functions
Fuzzy rules
Types of Fuzzy operation method
A FIS file consists of 4 sections
Fuzzy system information ( [system])
This section needs to start with section indicator, [System], at the beginning of the section. In this section, the overall properties of the fuzzy logic controller are defined.
Name: Name of the Fuzzy controller system. A string value. Write the values between single-quotation marks (’ ‘).
Syntax: Name=‘name_of_the_fuzzy_controller’
Type: Type of fuzzy interference method to be used. A string value. Either ‘mamdani’ or ‘sugeno’.
Syntax: Type = ‘mamdani’ OR Type= ‘sugeno’
NumInputs: Number of inputs. An integer number.
Syntax: NumInputs = an_integer
NumOutputs: Number of outpus. An integer number.
Syntax: NumOutputs = an_integer
NumRules: Number of fuzzy rules to be defined and used. An integer number.
Syntax: NumRules = an_integer
AndMethod: The method to be used for AND operation. A string value. Either ‘min’ or ‘prod’.
Syntax: AndMethod = ‘min’ OR AndMethod= ‘prod’
OrMethod: The method to be used for OR operation. a string value. Either ‘max’ or ‘probor’.
Syntax: OrMethod = ‘max’ OR OrMethod = ‘probor’
ImpMethod: Implementation method: a string value. Either ‘min’ or ‘prod’
Syntax: ImpMethod = ‘min’ OR ImpMethod = ‘prod’
AggMethod: Aggregation method: a string value. Either ‘max’ or ‘sum’ or ‘probor’.
Syntax: AggMethod = ‘max’ OR AggMethod = ‘sum’ OR AggMethod=’probor’
DefuzzMethod: Defuzzification method: a string value. It depends on Fuzzy type.
Mamdani type: ‘centroid’, ‘bisector’, ‘mom’, ‘som’, or ‘lom’.
Sugeno type: ‘wtaver’, or ‘wtsum’.
Syntax: ImpMethod = ‘defuzzification_type_name’
Inputs
This section needs to start with section indicator, [Input#], at the beginning of the section, where # represents the number of input. There can be multiple inputs and each input definition needs to start with [Input#] (Please refer to the example listed at the end).
Name: Name of the input. A string value. Write the values between quotation marks (’ ‘). ∙ Syntax: Name= ‘name_of_the_input’
Syntax: Name= ‘name_of_the_input’
Range of x values: Range of input value. Write the minimum value and maximum value between ‘[’ and ‘]’
Syntax: Range=[minimum_value maximum_value]
NumMFs: Number of Input Member functions (MFs)
Syntax : NumMFs= an_integer
MF #: Member Function properties
Syntax:MF1=‘member_function_name’:‘member_function_type’,[parameter_1 parameter_2 … parameter_n ]
Member Function Types available (for details refer to the following section)
‘dsigmf’ : requires 4 parameters.
‘gauss2mf’ : requires 4 parameters.
‘gaussmf’ : requires 2 parameters.
‘gbellmf’ : requires 3 parameters.
‘pimf’ : requires 4 parameters.
‘psigmf’ : requires 4 parameters.
‘sigmf’ : requires 2 parameters.
‘smf’ : requires 2 parameters.
‘trapmf’ : requires 4 parameters.
‘trimf’ : requires 3 parameters.
‘zmf’ : 2 parameters.
Member Function parameters
Each member function requires some parameters to completely define the member function. The number of parameters is 4 or less.
Outputs
This section needs to start with section indicator, [Output#], at the beginning of the section, where # represents the number of input. There can be multiple inputs and each input definition needs to start with [Output #] (Please refer to the example listed at the end).
Name: Name of the input. a string value. Write the values between quotation marks (’ ‘).
Syntax: Name= ‘name_of_the_input’
Range: Range of output value. Write the minimum value and maximum value between ‘[’ and ‘]’
Syntax: Range=[minimum_value maximum_value]
NumMFs: Number of Input Member functions (MFs)
Syntax: NumMFs= an_integer
MF #: Member Function properties
Syntax: MF1=‘member_function_name’:‘member_function_type’, [parameter_1 parameter_2 … parameter_n ]
Member Function Types available for ‘Mamadani’
‘dsigmf’: requires 4 parameters.
‘gauss2mf’: requires 4 parameters.
‘gaussmf’: requires 2 parameters.
‘gbellmf’: requires 3 parameters.
‘pimf’: requires 4 parameters.
‘psigmf’: requires 4 parameters.
‘sigmf’: requires 2 parameters.
‘smf’: requires 2 parameters.
‘trapmf’: requires 4 parameters.
‘trimf’: requires 3 parameters.
‘zmf’: nrequires 2 parameters.
Member Function Types available for ‘Sugeno’
‘linear’: requires 2 (‘number of inputs’ + 1) parameters
‘constant’: requires (‘number of inputs’ + 1) parameters
Rules
This section needs to start with section indicator, [Rules], at the beginning of the section. The IF-THEN rules defined in this section are used to formulate the conditional statements that are required by fuzzy logic. There can be multiple IF-THEN rules. Each rule consists of four parts: Inputs, Outputs, Rule Weighting, and Operation type. Each rule should start in a new line.
Syntax: MF#_of_Input1 MF#_of_Input2 … MF#_of_Input#, MF#_of_Output1 …
MF#_of_Input: indicates the index number of the input member function to be used in the rule.
An integer. Any negative value means ‘NOT’ operation. (Mathematical definition of ‘Not’ operation is 1 minus by a variable.)
MF#_of_Output: indicates the index number of the output member function to be used in the rule. An integer. Any negative value means ‘NOT’ operation. (Mathematical definition of ‘Not’ operation is 1 minus by a variable.)
Rule_Weighting: Rule weighting value. A real number between 0 and 1 (including 0 and 1).
Operation Type: Logic operation type. 1 means ‘AND’ operation in that rule. 2 means ‘OR’ operation.
Example
[Rules]
1 -3, 2 (1): 2
This rule means ‘IF MF1 of Input1 OR Not MF3 of Input2, THEN MF2 of Output1, weight is 1’
FIS Example
For an example ‘tipper.fis’ file in MATLAB® Fuzzy demo is listed below.
01: % $Revision: 1.1 $02: [System]03: Name=’tipper’04: Type=’mamdani’05: NumInputs=206: NumOutputs=107: NumRules=308: AndMethod=’min’09: OrMethod=’max’10: ImpMethod=’min’11: AggMethod=’max’12: DefuzzMethod=’centroid’13:14: [Input1]15: Name=’service’16: Range=[0 10]17: NumMFs=318: MF1=’poor’:’gaussmf’,[1.5 0]19: MF2=’good’:’gaussmf’,[1.5 5]20: MF3=’excellent’:’gaussmf’,[1.5 10]21:22: [Input2]23: Name=’food’24: Range=[0 10]25: NumMFs=226: MF1=’rancid’:’trapmf’,[0 0 1 3]27: MF2=’delicious’:’trapmf’,[7 9 10 10]28:29: [Output1]30: Name=’tip’31: Range=[0 30]32: NumMFs=333: MF1=’cheap’:’trimf’,[0 5 10]34: MF2=’average’:’trimf’,[10 15 20]35: MF3=’generous’:’trimf’,[20 25 30]36:37: [Rules]38: 1 1, 1 (1) : 239: 2 0, 2 (1) : 140: 3 2, 3 (1) : 2