P only = Fuzzy Logic?

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,513
I see a few comments regarding fuzzy logic today.
I am implementing a DC drive using this premise, P =1 only, (not PID) Would it also be considered fuzzy
Logic?
The feedback is via a slotted opto wheel and the motor PWM value is based on degree of error.
(Abstract below).
Max.
 

Attachments

crutschow

Joined Mar 14, 2008
34,044
Fuzzy Logic generally uses a series of If-Then-Else statements for the loop to perform control similar to that achieved by PID.
If you are just using a proportional control, where the PWM is linearly related to error, then I would just classify that as a PID loop without the ID. :)
 

kjj

Joined Mar 30, 2018
31
No. Fuzzy logic is based on conditional statements and logic, as written by crutschow. When you only have P, and not ID, it is simply called a P-controller or proportional controller. Fixing P to 1 is just stupid. The task of the designer is to tune to controller, to tune the parameter P in your case.
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,513
The micro periodically compares the RPM (every 40ms) with the set value , if the speed is low it incrementally increases the PWM until a match, If high then the PWM is incrementally lowered every 40ms.
This is the way it was done in the abstract project.
I am starting with this premise and go from there, including the recommendation of increasing the feedback resolution for faster control (20ms).
Max.
 

kjj

Joined Mar 30, 2018
31
I see. That is called a perturb and observe algorithm. It is used in MPPT, maximum power point tracking for solar panels. Can work for many things of course, but it is NOT a P-controller.

Edit: you are also limited by increasing the speed by timestep*perturbation. A P controller can change the speed very fast under some circumstances.
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,513
I see. That is called a perturb and observe algorithm. Can work for many things of course, but it is NOT a P-controller.

.
So what would it be termed?
Also is there an example of what fuzzy logic would look like in this case using the same control and feedback method?.
Max.
 

crutschow

Joined Mar 14, 2008
34,044
Here's a very simple example:
A Fuzzy Logic program is written the way a (fast) human operator might tweak knobs or switches to control a system:
(e.g.
If the speed is slightly high Then slightly reduce the PWM Else
If the speed is slightly low Then slightly increase the PWM Else
If the speed is correct Then maintain the PWM Else
If the speed is moderately high Then moderately reduce the PWM Else...)


The number of If-Then-Else statements is determined by the complexity of the system and how precisely and rapidly the control loop needs to bring the output to the desired level.

The exact values for what constitutes slightly, moderately, etc. are part of writing and optimizing the actual program.
 

kjj

Joined Mar 30, 2018
31
Here's a very simple example:
A Fuzzy Logic program is written the way a (fast) human operator might tweak knobs or switches to control a system:
(e.g.
If the speed is slightly high Then slightly reduce the PWM Else
If the speed is slightly low Then slightly increase the PWM Else
If the speed is correct Then maintain the PWM Else
If the speed is moderately high Then moderately reduce the PWM Else...)


The number of If-Then-Else statements is determined by the complexity of the system and how precisely and rapidly the control loop needs to bring the output to the desired level.

The exact values for what constitutes slightly, moderately, etc. are part of writing and optimizing the actual program.
I think this is a good example of the fuzzy IF-statements. However, i guess the result would be similar to a (discontinuous) P or PI-controller, since the output is proportional to the error. If the error is slightly small, output a slightly small signal. If the error is moderately high, output a moderately high signal.
 

crutschow

Joined Mar 14, 2008
34,044
I think this is a good example of the fuzzy IF-statements. However, i guess the result would be similar to a (discontinuous) P or PI-controller, since the output is proportional to the error.
Of course. The purpose of a Fuzzy Logic control system is to generally provide the same result as a PID system, i.e. to control a feedback loop to get a desired result.
But Fuzzy Logic can usually handle system nonlinearities or discontinuities (such as hysteresis) more easily than PID control, which is based upon a linear system.
 

crutschow

Joined Mar 14, 2008
34,044
"Fuzzy Logic" was a marketing term from the 90's to make things sound new and cool- it wasn't
No, the name has nothing to do with marketing.
The term was introduced by academic Lotfi Zadeh in his paper on fuzzy set theory.
It is a legitimate logic method the can be used (and has been used) to design complex control systems.
Here's some info on it, if interested.
 

Sensacell

Joined Jun 19, 2012
3,399
No, the name has nothing to do with marketing.
The term was introduced by academic Lotfi Zadeh in his paper on fuzzy set theory.
It is a legitimate logic method the can be used (and has been used) to design complex control systems.
Here's some info on it, if interested.
Very interesting.

It seems to have gone out of fashion? I hardly ever hear the term nowadays?
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,513
A Fuzzy Logic program is written the way a (fast) human operator might tweak knobs or switches to control a system:
(e.g.
If the speed is slightly high Then slightly reduce the PWM Else
If the speed is slightly low Then slightly increase the PWM Else
If the speed is correct Then maintain the PWM Else
If the speed is moderately high Then moderately reduce the PWM Else...)
This is the thesis in full and the writer mentions it is also Fuzzy logic.
It seems to fill the above, a rpm reading is taken and the amount of feedback is dependent on the degree of error.
i.e. increased or decreased proportionately.
I have taken it and used a 18F and cleaned it up a little and made it faster response.
Max.
 

Attachments

strantor

Joined Oct 3, 2010
6,778
The micro periodically compares the RPM (every 40ms) with the set value , if the speed is low it incrementally increases the PWM until a match, If high then the PWM is incrementally lowered every 40ms.
This is the way it was done in the abstract project.
I am starting with this premise and go from there, including the recommendation of increasing the feedback resolution for faster control (20ms).
Max.
I see. That is called a perturb and observe algorithm. It is used in MPPT, maximum power point tracking for solar panels. Can work for many things of course, but it is NOT a P-controller.

Edit: you are also limited by increasing the speed by timestep*perturbation. A P controller can change the speed very fast under some circumstances.
I do not think that "Perturb and Observe" is exactly what he's doing. In the MPPT example, there is no setpoint. Only maximum. "Are we at maximum? I don't know, let's move a little in a direction (Perturb) and see (Observe) if we can go any higher. If not, try (Perturb and Observe) the other direction."

In his speed controller, he has a setpoint. He's not deviating (Perturbing) from an error-free steady state to observe any "improvement" when none is possible.

Although he's stated it as a Proportional controller (P-only), there IS a time component. "PWM is incrementally lowered every 40ms." So I don't think it can be called strictly a proportional controller. Neither can it be called a PI controller because it doesn't fully integrate. So I'm just going to call it a "Time-damped Proportional Controller" and I'm not sure if that's actually "a thing."
 

kjj

Joined Mar 30, 2018
31
I do not think that "Perturb and Observe" is exactly what he's doing. In the MPPT example, there is no setpoint. Only maximum. "Are we at maximum? I don't know, let's move a little in a direction (Perturb) and see (Observe) if we can go any higher. If not, try (Perturb and Observe) the other direction."

In his speed controller, he has a setpoint. He's not deviating (Perturbing) from an error-free steady state to observe any "improvement" when none is possible.

Although he's stated it as a Proportional controller (P-only), there IS a time component. "PWM is incrementally lowered every 40ms." So I don't think it can be called strictly a proportional controller. Neither can it be called a PI controller because it doesn't fully integrate. So I'm just going to call it a "Time-damped Proportional Controller" and I'm not sure if that's actually "a thing."
You have some good points there. However, the perturb and observe algorithm can be used either to maximize something, or to minimize something. With MPPT you are correct. The task could also be to minimize the error. "Are we at minimum (zero error)? I don't know, let's move a little in a direction (Perturb) and see (Observe) if we can go any lower. If not, try (Perturb and Observe) the other direction."
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,513
The task could also be to minimize the error. "Are we at minimum (zero error)? I don't know, let's move a little in a direction (Perturb) and see (Observe) if we can go any lower. If not, try (Perturb and Observe) the other direction."
The routine in question checks for zero error and if it is zero, in this case retains the status quo without action.
Max.
 

kjj

Joined Mar 30, 2018
31
The routine in question checks for zero error and if it is zero, in this case retains the status quo without action.
Max.
I see. But can the error really be zero? If the error is a 32bit floating point, it can be as low 10^-38 or something, and practically you may encounter a situation where it never will be EXACTLY zero.

Anyway, i took a quick glance at the thesis. And even though it works, and i think you can actually prove that it works, it still doesn't seem like an optimal solution.
 
Top