Tuesday, June 16, 2015

Paint Flow Control Project, Fuzzy Logic, Chapter 3.1

Alas, I made a silly mistake in my LabWindows/CVI simulation code, mixing up the rows and columns of my LUT. So the charts I showed in my last post are worthless.

Here I am again with my wife Heide's painting in the background.
Below is the LUT and LUT Chart that I used for the next three response charts. The LUT Chart looks pretty ugly with various strange steps and further down in this post I will use Octave and the Fuzzy Logic Toolkit to make a somewhat smoother LUT Chart. Also, my new LUT will produce better simulation results, that is, less overshoot.
LUT and LUT Chart for the Next Response Charts.
After correcting my LW/CVI mistake accessing the LUT array, I started over to simulate the Paint Flow Control (PFC) system response and produced the following charts for three different flow responses of 25%, 33% and 50% per measurement step. These "responses" are the value that I am using in my low-pass difference equation to model the speed that the flow changes for a step function change in the control value. For example, I am using the following difference equation to model the system flow response for a 50% change in flow in response to the "out" signal from my Fuzzy Logic algorithm:

PFlow = 0.5*out + 0.5*PrevPFlow;
PrevPFlow = PFlow;

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

Control System Simulation, Stepping  between 0.4 and 1.4 lbs/min for Flow Response of 50% per Step.
Regarding the results of the simulations and the suitability of the Fuzzy Logic rules that I have chosen, I think the simulations show a pretty good response to step changes in the flow setpoint values and better than I had expected. However, the charts clearly show a serious overshoot in the system response, indicating that I need to do some modification of my FL rules. And the rules and LUT chart seem unnecessarily complex. So I am going back to my FL rules and am doing a drastic simplification and will be reducing the number of rules from 37 and am making significant adjustment in the rules. Fortunately Octave with the Fuzzy Logic Toolkit will enable me to make those big changes and I will be able to evaluate the rules with my LW/CVI simulation code.

Because I suspect the Term Set and rules that I had been using are unnecessarily complex I revised the Term set, reducing the number of terms from eight to six and reducing the number of rules from 37 down to 19.

The new simplified Term Chart and Rules are shown below. The Term Set chart and the Rules listing are from Octave and the Fuzzy Logic Toolkit.

New Simplified Term Set for Inputs and Output and the New Rules.
The resulting LUT and LUT chart are shown below. The new LUT chart is a little smoother than the previous one shown at the top of this post.

New LUT and LUT Chart from Simplified Terms and Rules.
Using the new LUT in my LW/CVI program, I ran some more simulations. I think the simulations show considerable improvement over the previous results, with much less overshoot. Here are the simulations that I ran today.

Step Test Simulation from 0.0 to 1.4 lbs/min Paint Flow, Showing Significant Overshoot.
Stepping Test Simulation from 1.4  0.2, 0.5 and 1.4 lbs/min Paint Flow, Showing Small Overshoot.
Stepping Test Simulation from 1.4  0.2, 0.5 and 1.4 lbs/min for Response of 33% per Step, Showing Small Overshoot.

Stepping Test Simulation from 1.4  0.2, 0.5 and 1.4 lbs/min for Response of 50% per Step, Showing No Overshoot.
I think the above simulation tests show very good and probably quite adequate system response and I should probably stop my tweaking of the Terms and Rules. I will check with my codeveloper on the project, Thomas Nguyen, but in the meantime I will assume that I won't have to make any further adjustment of the Fuzzy Logic Terms and Rules. Thanks to Octave, L. Markowsky and her Fuzzy Logic Toolkit and my eval copy of LabWindows/CVI for the ease of developing of my Fuzzy Logic control system.

One concern is the obvious question of the Flow Response values that I am using in the above simulations. The Flow Response value is the number that I am using to model the response of the paint pump and flowmeter. It is the a number in the low-pass difference equation below where the paint flow value is PFlow, the previous paint flow value is PrevPFlow and Out is the output signal controlling the pump:

PFlow = A*Out + (1-A)*PrevPFlow;
PrevPFlow = PFlow;

So the low-pass difference equation is saying that the paint flow is "A" times the Out signal for the first step after a step Out signal occurs. Subsequent values PFlow depend on the previous PFlow values by (1-A) times the Previous PFlow values. That is, if A is 50%, the next measurement after a step Out signal is PFlow =0.5, followed by 0.75, 0.825 ... for subsequent measurements. The graph below sort of shows this with an Out step pulse of 1 at position 1 (or step 1):

Step Response of a Low-Pass Filter with A = 0.50 (or 50%).

 The best simulation results are when the Flow Response is between about 25% and 50% per step. This means that my code is assuming that the control code is running fast enough so that it is making measurements and providing a control output signal at a rate of two to four times the response rate of the pump and flow meter system. If the control system operates very fast, some overshoot in the flow value will occur. The overshoot is probably not worrisome but it would be nice to minimize it. I will think about modifying the Fuzzy Logic rules to see if I can reduce the overshoot. That's for a possible follow-on post.



No comments:

Post a Comment