Saturday, January 5, 2019

Fuzzy Logic and Paint Flow Revisited

That's me in our office with my wife Heide's painting in the background.
Back in 2016 I was very hurried in my paint flow control development, trying to get the controllers ready for my cohort Thomas Nguyen to install in a painting facility in China that painted the covers of the Comcast remote control units. I ran out of time to optimize the Python control system code. However, I did a little "trick" in the software to speed up the response. The result was that the controllers worked well to control the pumps and paint guns. My trick was as follows: first the controllers started up in Manual Mode where the overall paint flow system gain could be determined, that is, the controller output value to the paint pump required to provide an adequate paint flow. Then that gain value was used to initialize the controller output in Automatic Mode and the controller would be switched to Automatic Mode. In Automatic mode, the controller output would be controlled further in closed-loop mode. The trick allowed the controller to quickly get the paint flow to the required Setpoint value and the controller would stabilize the paint flow. This trick got around the slow response of the Fuzzy Logic Algorithm (FLA) that I had developed. See the chart below. Recently I reconsidered and began to believe that I could improve the FLA so that my speed-up trick wouldn't be needed.

Original Paint Flow Control simulated very slow response.

The chart above shows that the paint flow reaches the setpoint in about 25 seconds. So I decided to see if I could improve the FLA to speed up the response. I had used Octave (Octave) along with L. Markowsky's Fuzzy Logic Toolkit to generate a Look-Up-Table or LUT that I then used in my Python code to produce the output signal for the paint flow pump. 

The LUT that I had previously generated is shown below.
Coarse LUT, August 23, 2015
The Error axis is in the forefront of the chart. The Error_Dot or derivative of the Error is shown along the right-hand side of the chart. The 3-D graph is not perfectly smooth and so I decided to try revising the Fuzzy Rules and compute a new LUT.

The August 2015 LUT worked pretty well but I decided to rework the Fuzzy Rules from the original 25 to 49 rules, then as before I used Octave and Markowsky's Fuzzy Logic Toolkit to produce a new LUT, shown below.
LUT, January 31, 2018

However, although the revised LUT shown above is a little smoother than the August, 2015 LUT, it did not to improve the simulated controller response.

Consequently, I decided to tweak my Python code and discovered that in my haste I had mistakenly set the output_scale_factor or gain constant to 6.0 when, for large errors > 200 the output_scale_factor should have been 250.0! So drastically increasing the output_scale_factor from 6.0 to 250.0 greatly improved the simulated system response. Below is the simulated response for the corrected output_scale_factor.

New Python code response, system time constant 2.0 seconds.

So problem solved, easily, and the controller response should be greatly improved. Next to load the software into my Beaglebone Black microcomputer and give it a try.

No comments:

Post a Comment