Professional Documents
Culture Documents
FUZZY SYSTEM
PART 2
Fuzzy Logic Controller
1
Step -K-
s2 +2s+5
Gain Transfer Fcn Scope
Fuzzy Logic
Controller
with Ruleviewer
Memory
Creating From m-files
• Discretize the system
• Create a system with negative feedback. FLC is in
forward path.
• Use the following commands:
– readfis (‘filename’) to call .fis file
– evalfis([input],fis_variable) to use .fis file
– To add fuzzy rule:
ruleList=[
11111
1 2 2 1 1];
a = addrule(a,ruleList);
Fuzzy Control for Tank Level Control
PID
PID
Mux animtank
Controller
1
-1 WATER
VALVE Mux2
Constant TANK S-Function
const
Mux Switch Subsystem
tank 2
Sum1 error
Mux1 Scope4
Scope1
Fuzzy Controller 0.5
Signal with Ruleviewer Scope2
Generator tank max
inflow
change
scope
du/dt
Try the demo
"sltank2" change Derivative
FLC using Scilab
Steps
• In Scilab command window type “editfls”
• From “File”menu click “New fls” then select
between Mamdani and Takagi-Sugeno
• From right side tab edit “description”, Add input
and output variables
• Setup membership functions for each variables
• Creates fuzzy rules
• “Export To File” (means save the FLS to a file)
and/or “Export To Workspace” (means we want
to use FLS right now for simulation)
Editing FLS
Plotting Variables
Usual way to use Xcos for control
Using .fls file in XCos
Creating From sci-files
• Discretize the system
Every node in this layer is a fixed node labeled N. The i-th node
calculates the ratio of the i-th rule’s firing strength to the sum
of all rule’s firing stregths:
O3,i = 𝑊𝑖 = Wi /(σ𝑖 𝑊𝑖 ) , i =1,2,..., node number in Layer 3