home Forums Feature Requests Add Center of Gravity Defuzzification Method Reply To: Add Center of Gravity Defuzzification Method

#2604

Hi Aaron,

I am sorry that your posts were marked as spam by wordpress, and hence not shown. Thank you for emailing me.

For completeness, I will elaborate on your issue.

The problem in your controller is the usage of Constant terms in the output variable for Off and Full. The centroid defuzzifier integrates over the terms in the output variable, and the integration over the constant terms is just not supported by this defuzzifier. The people from National must be doing some very specific handling of this case of integration over.

The solution I proposed to you (see at the end of post) substitutes the constant terms by integrative Triangle terms at the locations where you want them (0 and 100), which makes me extend the range of the output variable a bit more to integrate over the terms. In addition, I have increased the resolution of the defuzzifier for better accuracy.

Personally, I do not like my solution much. In the short term, I would avoid using the Engine::process() method to process the engine, and do it manually instead. You can look at the logic inside this method, and add the exceptions to turn the engine off and full if the corresponding memberships are activated.

In the long term, I want to improve the fuzzy consequents to override defuzzification. For example, if x is a then z is 0.9.

Lastly, I am sorry I did not see your messages being marked as spam. I would have elaborated on your case then.

Kindly let me know if this is of any help, or if you found a better solution.

Cheers.


Engine: TestController
InputVariable: TestInputVar
  enabled: true
  range: 0.000 549.999
  lock-range: false
  term: AtSetpoint PiShape 298.000 299.000 301.000 302.000
  term: VeryLow Trapezoid 0.000 0.000 260.000 300.000
  term: VeryHigh Trapezoid 300.000 305.000 550.000 550.000
  term: Low PiShape 260.000 300.000 300.000 300.000
  term: High PiShape 300.000 300.000 300.000 305.000
OutputVariable: TestOutputVar
  enabled: true
  range: -5.000 105.000
  lock-range: false
  aggregation: Maximum
  defuzzifier: Centroid 1000
  default: nan
  lock-previous: false
  term: Off Triangle -1.000 0.000 1.000
  term: Low PiShape 0.000 5.000 25.000 30.000
  term: Medium PiShape 10.000 15.000 30.000 35.000
  term: High PiShape 15.000 20.000 40.000 45.000
  term: Full Triangle 99.000 100.000 101.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