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("SimpleDimmer");
10 engine->setDescription("");
11 
12 InputVariable* Ambient = new InputVariable;
13 Ambient->setName("Ambient");
14 Ambient->setDescription("");
15 Ambient->setEnabled(true);
16 Ambient->setRange(0.000, 1.000);
17 Ambient->setLockValueInRange(false);
18 Ambient->addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
19 Ambient->addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
20 Ambient->addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));
21 engine->addInputVariable(Ambient);
22 
23 OutputVariable* Power = new OutputVariable;
24 Power->setName("Power");
25 Power->setDescription("");
26 Power->setEnabled(true);
27 Power->setRange(0.000, 1.000);
28 Power->setLockValueInRange(false);
29 Power->setAggregation(fl::null);
30 Power->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
31 Power->setDefaultValue(fl::nan);
32 Power->setLockPreviousValue(false);
33 Power->addTerm(new Constant("LOW", 0.250));
34 Power->addTerm(new Constant("MEDIUM", 0.500));
35 Power->addTerm(new Constant("HIGH", 0.750));
36 engine->addOutputVariable(Power);
37 
38 RuleBlock* ruleBlock = new RuleBlock;
39 ruleBlock->setName("");
40 ruleBlock->setDescription("");
41 ruleBlock->setEnabled(true);
42 ruleBlock->setConjunction(fl::null);
43 ruleBlock->setDisjunction(fl::null);
44 ruleBlock->setImplication(fl::null);
45 ruleBlock->setActivation(new General);
46 ruleBlock->addRule(Rule::parse("if Ambient is DARK then Power is HIGH", engine));
47 ruleBlock->addRule(Rule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
48 ruleBlock->addRule(Rule::parse("if Ambient is BRIGHT then Power is LOW", engine));
49 engine->addRuleBlock(ruleBlock);
50 
51 
52 }
53