Wednesday, June 17, 2015

Paint Flow Control Project, Fuzzy Logic, Chapter 3.11

Smiling Me.
I'm still working on the Fuzzy Logic control system for our Paint Flow Control (PFC) project. Last night I found a little mistake in my FL Rules and re-ran Octave and the Fuzzy Logic Toolkit to get an updated LUT. This morning I ran my LabWindows/CVI code with the updated LUT and saw some improvement in the response: considerably less overshoot. Now I have more reason to smile as my simulations look pretty good and probably good enough for reasonable control of the paint flow.


I should explain that I'm using the "Fuzzy PI" configuration of a Fuzzy Logic controller system as described in chapter 5 of "Fuzzy Logic & NeuroFuzzy Applications Explained" by Constantin Von Altrock. The Fuzzy PI configuration is that of a Fuzzy Logic system followed by an Integrator, so the output of the Fuzzy system causes increases or decreases in the control output rather than directly setting the control output. The Integrator provides the direct output of the control signals. Also, I am using the Mamdani-Type Fuzzy Inference technique as described in the Mathworks article: (Mamdani). I write my own FL Rules and then analyze them to produce the Look-Up-Table (LUT). I had previously developed my own FL analysis program to compute the LUT but am currently using Octave (Octave) and the Fuzzy Logic Toolkit (Fuzzy Logic Toolkit) to compute the LUT. Then I simulate the operation of the Paint Flow Control System using code that I have written in LabWindows/CVI (LW/CVI) and can evaluate the LUT from the results of the simulations.

Below are my new FL Rules and Terms chart from Octave and the Fuzzy Logic Toolkit. The Rules are revised somewhat mostly because I had forgotten that a large positive Error actually means that the measured quantity is much lower than the Setpoint. So for control systems:

Error = Setpoint - measured value

Or in the case of the Paint Flow:
Error = Setpoint - PFlow.

Also, I have an ErrorDot term that is the difference between the current PFlow and the previous Pflow:

ErrorDot = PFlow - prevPFlow.

Of course, in Fuzzy Logic, one doesn't need to use Error and ErrorDot as the Fuzzy variables. I could have simply used the Flow and IncreaseOfFlow as the variables and said, for example, if the Flow is too low but the Flow is increasing at a very high rate (i.e. IncreaseOfFlow is very high), don't increase the Output to the pump. I should probably have used those variables instead of Error and ErrorDot as conceptually those FL variables might be more understandable than Error and ErrorDot.

Revised (corrected) Rules and Term Set for Inputs and Output.

 And below is the new LUT and LUT Chart.

Revised LUT and LUT Chart.
Note that the LUT Chart is smoother in most areas than the previous LUT Chart. I suspect the smoothness has resulted in less overshoot that is shown in the simulation charts. The following charts are my latest simulations for various system Response values. In these charts, the yellow trace is the control signal and the red trace is the Paint Flow value.

Control System Simulation, Stepping between 0.2 and 1.4 lbs/min for Flow Response of 10% per Step.
The chart above is for the case of the control system measuring and controlling very fast compared to the response speed of the pump and flowmeter. That is, the pump and flowmeter response is only 10% between control system signal changes. The result, for my Rules, is some overshoot and ringing in the Flow compared to the Setpoint.

Control System Simulation, Stepping between 0.2 and 1.4 lbs/min for Flow Response of 25% per Step.
The above chart is for a pump and flowmeter response of 25% per control system step. Note that the control system response exhibits very little overshoot, suggesting a good match of the timing of the control system relative to the flow system response for my FL Rules.

Control System Simulation, Stepping between 0.2 and 1.4 lbs/min for Flow Response of 33% per Step.

As with the chart for the 25% pump and flow response rate, the above chart for the response rate of 33% suggests that the control system is well matched to the pump and flowmeter response.

Control System Simulation, Stepping between 0.2 and 1.4 lbs/min for Flow Response of 50% per Step.
As with the charts for the 25% and 33% pump and flow response rate, the above chart for the response rate of 50% suggests that the control system is well matched to the pump and flowmeter response.

Control System Simulation, Stepping between 0.2 and 1.4 lbs/min for Flow Response of nearly 80% per Step.
The chart for the system response of 80% per step shows a little overshoot suggesting that the control system is measuring and controlling rather slowly compared to the response time of the pump and flowmeter.

So my conclusion from these simulations is that for my FL Rules, the control system measurement and control output rate should be two to five times the response rate of the pump and flowmeter. I suspect that should be easy to accomplish as the pump and flowmeter response is probably around one to two seconds for a step function change in flow setpoint. So the control system should measure and output updated control signals at a rate of once per second to 2.5 times per second. Also, my FL Rules could be improved a little to minimize the overshoot for a slowly responding paint flow and flowmeter but the accuracy and response is probably adequate for the requirements of the Paint Flow Control System. I plan to try to adjust the Rules somewhat to minimize the control system overshoot for all system response times.

No comments:

Post a Comment