home › Forums › Feature Requests › Add Center of Gravity Defuzzification Method › Reply To: Add Center of Gravity Defuzzification Method
Hello,
Thanks for your explanation. There appears to be something different about what National Instruments is doing, and what everyone else does 🙂 At the end of this post I’ve listed a block of FLL “code” that I’m using. I’ve also linked images to what National Instruments GUI shows.
When I set the “TestInputVar” to a value of 160, National Instruments says the output variable “TestOutputVar” is 100. When I load the FLL block into FuzzyLiteQt, and set the input value to 160, it says that the output variable “TestOutputVar” is 50. So I’m trying to determine what the difference is and how to overcome that.
In my example, the output variable ranches from 0 to 100 where 0 would represent 0% of something and 100 would represent 100% of something (perhaps a duty cycle). The input variable ranges from 0-550.
Engine: TestController
InputVariable: TestInputVar
enabled: true
range: 0.000 549.999
lock-range: false
term: AtSetpoint PiShape 298.000 299.000 301.00 302.00
term: VeryLow Trapezoid 0.000 0.000 260.000 300.00
term: VeryHigh Trapezoid 300.000 305.000 550.000 550.00
term: Low PiShape 260.000 300.000 300.000 300.00
term: High PiShape 300.000 300.000 300.000 305.00
OutputVariable: TestOutputVar
enabled: true
range: 0.000 100.000
lock-range: false
aggregation: Maximum
defuzzifier: Centroid 100
default: nan
lock-previous: false
term: Full Constant 100.000
term: Medium PiShape 10.000 15.000 30.000 35.000
term: Off Constant 0.000
term: High PiShape 15.000 20.000 40.000 45.000
term: Low PiShape 0.000 5.000 25.000 30.000
RuleBlock: mamdani
enabled: true
conjunction: Minimum
disjunction: Maximum
implication: Minimum
activation: General
rule: if TestInputVar is AtSetpoint then TestOutputVar is Medium
rule: if TestInputVar is VeryLow then TestOutputVar is Full
rule: if TestInputVar is VeryHigh then TestOutputVar is Off
rule: if TestInputVar is Low then TestOutputVar is High
rule: if TestInputVar is High then TestOutputVar is Low
Screenshot 1 of NI Fuzzy Logic Controller:
Screenshot 2 of NI Fuzzy Logic Controller:
Screenshot 3 of NI Fuzzy Logic Controller:
[url=https://flic.kr/p/XuYQ8z]Screenshot3[/url]