1 #include <fl/Headers.h>
2 
main(int argc,char ** argv)3 int main(int argc, char** argv){
4 //Code automatically generated with fuzzylite 6.0.
5 
6 using namespace fl;
7 
8 Engine* engine = new Engine;
9 engine->setName("slcpp1");
10 engine->setDescription("");
11 
12 InputVariable* in1 = new InputVariable;
13 in1->setName("in1");
14 in1->setDescription("");
15 in1->setEnabled(true);
16 in1->setRange(-0.300, 0.300);
17 in1->setLockValueInRange(false);
18 engine->addInputVariable(in1);
19 
20 InputVariable* in2 = new InputVariable;
21 in2->setName("in2");
22 in2->setDescription("");
23 in2->setEnabled(true);
24 in2->setRange(-1.000, 1.000);
25 in2->setLockValueInRange(false);
26 engine->addInputVariable(in2);
27 
28 InputVariable* in3 = new InputVariable;
29 in3->setName("in3");
30 in3->setDescription("");
31 in3->setEnabled(true);
32 in3->setRange(-3.000, 3.000);
33 in3->setLockValueInRange(false);
34 engine->addInputVariable(in3);
35 
36 InputVariable* in4 = new InputVariable;
37 in4->setName("in4");
38 in4->setDescription("");
39 in4->setEnabled(true);
40 in4->setRange(-3.000, 3.000);
41 in4->setLockValueInRange(false);
42 engine->addInputVariable(in4);
43 
44 InputVariable* in5 = new InputVariable;
45 in5->setName("in5");
46 in5->setDescription("");
47 in5->setEnabled(true);
48 in5->setRange(-3.000, 3.000);
49 in5->setLockValueInRange(false);
50 engine->addInputVariable(in5);
51 
52 InputVariable* in6 = new InputVariable;
53 in6->setName("in6");
54 in6->setDescription("");
55 in6->setEnabled(true);
56 in6->setRange(-3.000, 3.000);
57 in6->setLockValueInRange(false);
58 engine->addInputVariable(in6);
59 
60 InputVariable* pole_length = new InputVariable;
61 pole_length->setName("pole_length");
62 pole_length->setDescription("");
63 pole_length->setEnabled(true);
64 pole_length->setRange(0.500, 1.500);
65 pole_length->setLockValueInRange(false);
66 pole_length->addTerm(new ZShape("mf1", 0.500, 0.600));
67 pole_length->addTerm(new PiShape("mf2", 0.500, 0.600, 0.600, 0.700));
68 pole_length->addTerm(new PiShape("mf3", 0.600, 0.700, 0.700, 0.800));
69 pole_length->addTerm(new PiShape("mf4", 0.700, 0.800, 0.800, 0.900));
70 pole_length->addTerm(new PiShape("mf5", 0.800, 0.900, 0.900, 1.000));
71 pole_length->addTerm(new PiShape("mf6", 0.900, 1.000, 1.000, 1.100));
72 pole_length->addTerm(new PiShape("mf7", 1.000, 1.100, 1.100, 1.200));
73 pole_length->addTerm(new PiShape("mf8", 1.100, 1.200, 1.200, 1.300));
74 pole_length->addTerm(new PiShape("mf9", 1.200, 1.300, 1.300, 1.400));
75 pole_length->addTerm(new PiShape("mf10", 1.300, 1.400, 1.400, 1.500));
76 pole_length->addTerm(new SShape("mf11", 1.400, 1.500));
77 engine->addInputVariable(pole_length);
78 
79 OutputVariable* out = new OutputVariable;
80 out->setName("out");
81 out->setDescription("");
82 out->setEnabled(true);
83 out->setRange(-10.000, 10.000);
84 out->setLockValueInRange(false);
85 out->setAggregation(fl::null);
86 out->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
87 out->setDefaultValue(fl::nan);
88 out->setLockPreviousValue(false);
89 out->addTerm(Linear::create("outmf1", engine, 168.400, 31.000, -188.050, -49.250, -1.000, -2.700, 0.000, 0.000));
90 out->addTerm(Linear::create("outmf2", engine, 233.950, 47.190, -254.520, -66.580, -1.000, -2.740, 0.000, 0.000));
91 out->addTerm(Linear::create("outmf3", engine, 342.940, 74.730, -364.370, -95.230, -1.000, -2.780, 0.000, 0.000));
92 out->addTerm(Linear::create("outmf4", engine, 560.710, 130.670, -582.960, -152.240, -1.000, -2.810, 0.000, 0.000));
93 out->addTerm(Linear::create("outmf5", engine, 1213.880, 300.190, -1236.900, -322.800, -1.000, -2.840, 0.000, 0.000));
94 out->addTerm(Linear::create("outmf6", engine, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000));
95 out->addTerm(Linear::create("outmf7", engine, -1399.120, -382.950, 1374.630, 358.340, -1.000, -2.900, 0.000, 0.000));
96 out->addTerm(Linear::create("outmf8", engine, -746.070, -213.420, 720.900, 187.840, -1.000, -2.930, 0.000, 0.000));
97 out->addTerm(Linear::create("outmf9", engine, -528.520, -157.460, 502.680, 130.920, -1.000, -2.960, 0.000, 0.000));
98 out->addTerm(Linear::create("outmf10", engine, -419.870, -129.890, 393.380, 102.410, -1.000, -2.980, 0.000, 0.000));
99 out->addTerm(Linear::create("outmf11", engine, -354.770, -113.680, 327.650, 85.270, -1.000, -3.010, 0.000, 0.000));
100 engine->addOutputVariable(out);
101 
102 RuleBlock* ruleBlock = new RuleBlock;
103 ruleBlock->setName("");
104 ruleBlock->setDescription("");
105 ruleBlock->setEnabled(true);
106 ruleBlock->setConjunction(fl::null);
107 ruleBlock->setDisjunction(fl::null);
108 ruleBlock->setImplication(fl::null);
109 ruleBlock->setActivation(new General);
110 ruleBlock->addRule(Rule::parse("if pole_length is mf1 then out is outmf1", engine));
111 ruleBlock->addRule(Rule::parse("if pole_length is mf2 then out is outmf2", engine));
112 ruleBlock->addRule(Rule::parse("if pole_length is mf3 then out is outmf3", engine));
113 ruleBlock->addRule(Rule::parse("if pole_length is mf4 then out is outmf4", engine));
114 ruleBlock->addRule(Rule::parse("if pole_length is mf5 then out is outmf5", engine));
115 ruleBlock->addRule(Rule::parse("if pole_length is mf6 then out is outmf6", engine));
116 ruleBlock->addRule(Rule::parse("if pole_length is mf7 then out is outmf7", engine));
117 ruleBlock->addRule(Rule::parse("if pole_length is mf8 then out is outmf8", engine));
118 ruleBlock->addRule(Rule::parse("if pole_length is mf9 then out is outmf9", engine));
119 ruleBlock->addRule(Rule::parse("if pole_length is mf10 then out is outmf10", engine));
120 ruleBlock->addRule(Rule::parse("if pole_length is mf11 then out is outmf11", engine));
121 engine->addRuleBlock(ruleBlock);
122 
123 
124 }
125