summaryrefslogtreecommitdiff
path: root/examples/tsukamoto/tsukamoto.fcl
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tsukamoto/tsukamoto.fcl')
-rw-r--r--examples/tsukamoto/tsukamoto.fcl63
1 files changed, 63 insertions, 0 deletions
diff --git a/examples/tsukamoto/tsukamoto.fcl b/examples/tsukamoto/tsukamoto.fcl
new file mode 100644
index 0000000..16a4bbd
--- /dev/null
+++ b/examples/tsukamoto/tsukamoto.fcl
@@ -0,0 +1,63 @@
+FUNCTION_BLOCK
+
+VAR_INPUT
+ X: REAL;
+END_VAR
+
+VAR_OUTPUT
+ Ramps: REAL;
+ Sigmoids: REAL;
+ ZSShapes: REAL;
+ Concaves: REAL;
+END_VAR
+
+FUZZIFY X
+ RANGE := (-10.000 .. 10.000);
+ TERM small := Bell -10.000 5.000 3.000;
+ TERM medium := Bell 0.000 5.000 3.000;
+ TERM large := Bell 10.000 5.000 3.000;
+END_FUZZIFY
+
+DEFUZZIFY Ramps
+ RANGE := (0.000 .. 1.000);
+ TERM b := Ramp 0.600 0.400;
+ TERM a := Ramp 0.000 0.250;
+ TERM c := Ramp 0.700 1.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY Sigmoids
+ RANGE := (0.020 .. 1.000);
+ TERM b := Sigmoid 0.500 -30.000;
+ TERM a := Sigmoid 0.130 30.000;
+ TERM c := Sigmoid 0.830 30.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY ZSShapes
+ RANGE := (0.000 .. 1.000);
+ TERM b := ZShape 0.300 0.600;
+ TERM a := SShape 0.000 0.250;
+ TERM c := SShape 0.700 1.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY Concaves
+ RANGE := (0.000 .. 1.000);
+ TERM b := Concave 0.500 0.400;
+ TERM a := Concave 0.240 0.250;
+ TERM c := Concave 0.900 1.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ RULE 1 : if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a
+ RULE 2 : if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b
+ RULE 3 : if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK