Skip to content

Fuzzy PID has no zAligned x Medium rule #243

Description

@dberlin

Describe the bug

While increasing test coverage on my branch, i discovered an annoying bug in fuzzy PID.

create_fuzzy_pickle() has no rule pairing delta["zAligned"] (at setpoint) with current["MediumLow"]/["MediumHigh"] (the normal ~210-350F cook band). With no rule firing, skfuzzy's centroid defuzzification falls back to the near-empty aggregate, producing a very high hold cycleratio (~0.33-0.57) instead of a low near-hold value (which should be 0.077-0.3).

This causes fuzzy to perform ... quite badly ... at these temperatures in simulation and elsewhere

Measured effect on cycle ratio (setpoint == current, delta=0, rate_of_change=0):
225F: 0.358 -> 0.077 250F: 0.330 -> 0.089
300F: 0.570 -> 0.278 320F: 0.571 -> 0.278
No other input region changes; the new rules only fire where nothing
fired before.

Fix is easy:

   rules.append(ctrl.Rule(delta["zAligned"] & (current["High"] | current["Low"]), cycleratio["Tiny"]))
+    rules.append(ctrl.Rule(delta["zAligned"] & current["MediumLow"], cycleratio["Tiny"]))
+    rules.append(ctrl.Rule(delta["zAligned"] & current["MediumHigh"], cycleratio["Short"]))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions