Fuzzy Logic

MisterBill2

Joined Jan 23, 2018
27,522
"Fuzzy" Logic is a scheme that seems to be a whole lot of "IF, Then" decisions, the goal is for the code to not be so inflexible.
An example:" If the tanklevel is low then run the pump for a while to fill it some." Really, there is a bit more to being serious about fizzy logic, but that is a frequent example.
 

MisterBill2

Joined Jan 23, 2018
27,522
"Fuzzy Logic" was very highly touted a few years back,I suspect that was because some group was making a profit from selling "fuzzification" software. What it actually appears to be is code that allows different actions depending on some variable that may have seemingly randomly different values.
What it looks like to me is adaptive software that is not forced into a single flow path. Sort of like the "IF, THEN" but possibly with multiple choices.
 

crutschow

Joined Mar 14, 2008
38,507
"Fuzzy" Logic is a scheme that seems to be a whole lot of "IF, Then" decisions, the goal is for the code to not be so inflexible.
Fuzzy Logic basically uses a series if IF-THEN-ELSE commands to control the loop, and is not predicated on the controlled system being linear as PID analog (discrete-time, digitized form in a computer) loops do.
And it's generally easy to see what the control loop is doing and what needs to be tweaked to improve the system response.

There was a thread some time ago where the poster was tying to automate the control of water and steam in an espresso machine and was having problems with the PID loop being unstable due to the various non-linearities of the water and steam vs temperature and pressure.
He then tried a Fuzzy Logic loop and said his first program try worked better than the PID loop he'd been working on for some time.
 
Last edited:

Irving

Joined Jan 30, 2016
5,121
The way I see FL working is it uses probabilities rather than absolute values. So instead of 'temp > 50' it's the probability of the temp being in the region of, say, 50 - 75 based on where it last was and it's rate of change versus the probability of being <50 or >75. Then, based on its history it can, over time, tweak those boundaries to accommodate noise, non-linearity, etc. thus removing instability from the system.
 

crutschow

Joined Mar 14, 2008
38,507
The way I see FL working is it uses probabilities rather than absolute values. So instead of 'temp > 50' it's the probability of the temp being in the region of, say, 50 - 75 based on where it last was and it's rate of change versus the probability of being <50 or >75. Then, based on its history it can, over time, tweak those boundaries to accommodate noise, non-linearity, etc. thus removing instability from the system.
No, I don't really see where probability comes into using FL.
It does look at how far the measured value is from the desired value, and adjusts the control voltages accordingly using IF-THEN-ELSE statements, but I don't see that as being a probability.
 

Irving

Joined Jan 30, 2016
5,121
No, I don't really see where probability comes into using FL.
It does look at how far the measured value is from the desired value, and adjusts the control voltages accordingly using IF-THEN-ELSE statements, but I don't see that as being a probability.
OK, probability is the wrong word, though to my mind its sort of like one. Call it a membership 'goodness' function. If you look at the geeks for geeks article I posted above, the fuzzification process is creating a valuation of membership of one set or another, as illustrated for the temperature of 32C graphically below. It's 0.8 in the Warm category and 0.2 in the Hot category. This is then used to calculate a fan speed based on assigned speeds for "Warm" (50%) and "Hot" (80%) giving a final fan speed of 56%. In this instance no IF-THEN statements are used, just simple integer math. There's no 'error' function as in a PID controller. I've added a new category "Very Hot" with a fan speed of 100% so a temperature above 40C would attract a mix of 80% and 100%, showing how fuzzy logic can easily be extended when a new circumstance arises.

1779036642116.png
 

Irving

Joined Jan 30, 2016
5,121
I'd imagine that a bit of machine learning (Generative AI) could be applied to adjust, or even find from scratch, the membership boundaries that were optimal for that configuration.
 

MisterBill2

Joined Jan 23, 2018
27,522
Certainly it is possible to create a much better software version of a PID (Proportional, Integral, Derivative) control that will better control a motor speed.
Servo loop systems are not some new mystery yet to be solved.

Negative comment deleted.
 

SamR

Joined Mar 19, 2019
5,491
I dunno, I've used PID control to maintain 0.01°C temperature control on several of our 100'+ fractional distillation columns. Didn't think it was possible until an outside distillation specialist contractor specified some temperature sensor instrumentation that after installation allowed our GSE Solutions control software running on DEC Alphas (upgraded from PDP 8s) to actually do it. In fact, I thought he was crazy as a loon until I saw the results. Of course, GSE Solutions control software was/is about the only control software certified for use by the Atomic Energy Commission for nuclear power plant control.
 

crutschow

Joined Mar 14, 2008
38,507
Certainly it is possible to create a much better software version of a PID (Proportional, Integral, Derivative) control that will better control a motor speed.
Servo loop systems are not some new mystery yet to be solved.
Of course.
PID has been used since the start of feedback control systems, when they were purely all mechanical.
That doesn't mean a Fuzzy Logic control loop couldn't do as well or possibly better, especially if there are non-linearities in the loop, and it also likely requires less processor power to do the control-loop calculations.
 

MisterBill2

Joined Jan 23, 2018
27,522
Really, PID unning with "Big", "some", and "a little bit", instead of actual exact numbers , could probably work very well as a feedback controller.
 
Top