how to write fuzzy rules for pd controller
Show older comments
Respected Sir, please tell me how to write fuzzy rules for proportional-derivative controller and proportional integral controller. BY the way to get same response in simulink as these conventional controller(PI & PD)replacing with FL controller.
Answers (1)
To design a fuzzy controller that achieves the same performance as a conventional PI or PD controller, we can use a 9-rule Sugeno fuzzy system for clarity (although similar performance can be 100% obtained with only 4 rules [see Hao Ying’s early 90's papers]). Specifically, we design a linear fuzzy system with a mathematical structure of the form z = x + y. For example, x is the proportional-gained error (
) and y is the derivative-gained change in error (
). If necessary, the fuzzy output can then be externally scaled to match the desired magnitude.
For more details, please refer to the "Construct Type-1 FIS" section in the following article:
fis1 = sugfis;
% define the universe of discourse for inputs
fis1 = addInput(fis1, [-1 1], Name="E"); % Input 1: Error
fis1 = addInput(fis1, [-1 1], Name="CE"); % Input 2: Change in Error
% Input 1 fuzzy sets
fis1 = addMF(fis1, "E", "trimf", [-2 -1 0], Name="N"); % Negative
fis1 = addMF(fis1, "E", "trimf", [-1 0 1], Name="Z"); % Zero
fis1 = addMF(fis1, "E", "trimf", [ 0 1 2], Name="P"); % Positive
% Input 2 fuzzy sets
fis1 = addMF(fis1, "CE", "trimf", [-2 -1 0], Name="N"); % Negative
fis1 = addMF(fis1, "CE", "trimf", [-1 0 1], Name="Z"); % Zero
fis1 = addMF(fis1, "CE", "trimf", [ 0 1 2], Name="P"); % Positive
figure
subplot(2,1,1)
plotmf(fis1, "input", 1, 2001), grid on
title("MFs for Input 1: Error")
subplot(2,1,2)
plotmf(fis1, "input", 2, 2001), grid on
title("MFs for Input 2: Change in Error")
% define the universe of discourse for the output
fis1 = addOutput(fis1, [-2 2], Name="U"); % Fuzzy Control Output, U
% These are actually Singleton MFs
fis1 = addMF(fis1, "U", "constant", -2.0, Name="NB"); % Negative Big
fis1 = addMF(fis1, "U", "constant", -1.0, Name="NM"); % Negative Medium
fis1 = addMF(fis1, "U", "constant", 0.0, Name="ZO"); % Zero
fis1 = addMF(fis1, "U", "constant", 1.0, Name="PM"); % Positive Medium
fis1 = addMF(fis1, "U", "constant", 2.0, Name="PB"); % Positive Big
% Fuzzy Rules
rules = [...
"if E is N and CE is N then U is NB (1)"; % rule 1
"if E is Z and CE is N then U is NM (1)"; % rule 2
"if E is P and CE is N then U is ZO (1)"; % rule 3
"if E is N and CE is Z then U is NM (1)"; % rule 4
"if E is Z and CE is Z then U is ZO (1)"; % rule 5
"if E is P and CE is Z then U is PM (1)"; % rule 6
"if E is N and CE is P then U is ZO (1)"; % rule 7
"if E is Z and CE is P then U is PM (1)"; % rule 8
"if E is P and CE is P then U is PB (1)"; % rule 9
];
fis1 = addRule(fis1, rules);
figure
opt = gensurfOptions('NumGridPoints', 51);
gensurf(fis1, opt)
title("Control surface of a Linear Fuzzy PD Controller")
Categories
Find more on Fuzzy Inference System Modeling in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
