Fuzzy logic block
From Piki
The fuzzy logic component is a full Fuzzy Inference System (FIS) integrated into a block that can be used to integrate fuzzy logic rules and inference into systems.
| Function layer | |
| Input ports | 1 |
| Output ports | 1 |
| Deployable | Yes |
| Weights | No |
| Memory | No |
| Interactive GUI | Yes |
Contents |
Usage
Fuzzy Logic is an extension of regular Boolean logic that allows the use of vague linguistic expression rather than the limited Boolean true/false values.
It is a very powerful tool for use in conjunction with adaptive systems as it is a simple and intuitive way of incorporating a priori knowledge into your system. It allows you to use expressions as for instance:
If speed is very high and ground is slightly wet then breaking distance is very long
An introduction to fuzzy logic goes beyond the documentation of this component, but you can find more theory on fuzzy logic in the following tutorials on the Peltarion blog:
Settings
The settings can be modified using the settings browser.
| Fuzzy Logic settings |
|---|
|
|
GUI details
| Fuzzy Logic design GUI |
|---|
|
Memberhip function editor
| Membership Function Editor (MFE) |
|---|
|
In the MFE you can define your membership functions. The number of input variables is equal to the number of inputs and the number of output variables are equal to the number of outputs. The input variables are marked with a big "I" while the output variables are marked with a big "O" in the System explorer:
| System explorer |
|---|
|
If you select a variable in the explorer, you can change its settings such as name and range:
| Fuzzy variable settings. |
|---|
|
If you select a membership function in the explorer (marked with "MF" under the variables), you can change the function form by using the bar under the graph:
| Membership function selection |
|---|
| |
When you select a membership function in the explorer it becomes blue in the graph and its name is written in the title.
| Membership function graphs |
|---|
|
In the settings browser you can then change the settings of that specific membership function, such as name and control points (that control the position and shape of the function).
| Membership function settings |
|---|
|
When you are done defining membership functions, you can press the "Close" button to close the MFE.
Rule Editor
| Rule Editor |
|---|
|
In the rule editor, you can write your fuzzy rules. The most straight forward way is simply typing each rule into the textbox and clicking "Add Rule" to add a rule to the system. When typing the rules manually, you can use parentheses to group your logic:
| Fuzzy rule entry |
|---|
|
If you are not going to use parentheses, then the easiest way to enter a rule is by simply double-clicking on the two tree views. The blue items are the valid ones you can double-click on, and they will automatically be entered in the text box. The top box contains the variables and the membership functions. If you would for instance click on "high", it would write in the text box "If speed is high".
| System view |
|---|
|
In the lower treeview you can double-click on keywords, operators and hedges.
| Operator selection |
|---|
|
Example: To enter "If speed is high and ground is very wet then breaking_distance is long", you would use the following sequence of double clicks:
[high] [and] [ground] [very] [wet] [then] [long]
When you add a rule to the system it will be entered in the rules list. If the rule is grammatically and semantically valid a green checked box will be next to it. If it is invalid a red x will be next to it. If you move your mouse over an incorrect rule, you will see a description of the error in the title bar.
| Rules view |
|---|
|
When you are done defining rules you can press the "Close" button. Remember that all your rules need to be valid for the system to run
See also
- Block - Article covering general block principles.
- List of Block components - List of all available blocks.
- Fuzzy Math, Part 1 -The Theory - Beginer level tutorial explaining the theory behind fuzzy logic, illustrated with examples.
- Fuzzy Math, Part 2 - In Synapse - Practical tutorial covering Fuzzy Logic in Synapse.











