Thursday, June 11, 2015

Paint Flow Control Project #5, Chapter 3: Revising My Fuzzy Logic Algorithm

Well, we don't yet have the go-ahead on our Paint Flow Control (PFC) Project that I have been reporting on, but I decided to go ahead and start working on the Fuzzy Logic control. I had previously posted some work on my Fuzzy Logic work on the Silk Screen Project. My previous blog post on my Fuzzy Logic work is at Octave and Fuzzy Logic ... I used my own Fuzzy Logic (FL) analysis
program and also Octave and the Fuzzy Logic Toolkit. Octave is an analysis program, similar to Matlab. The Octave website is at https://www.gnu.org/software/octave/.Octave is free but I had difficulty downloading it until I found instructions at http://youneedtoprogram.wordpress.com/2013/10/12/installing-octave-3-6-4-on-windows-8/. The Fuzzy Logic Toolkit was developed by L. Markowsky while a student at the University of Maine. Info on the toolkit can be found at http://octave.sourceforge.net/fuzzy-logic-toolkit/overview.html and it's a free download from https://sourceforge.net/projects/octave-fuzzy/.

I had thought that my original FL rules and Look-Up-Table (LUT) were just fine but after putting the rules into the Fuzzy Logic Toolkit and running the code, I saw some glitches that I didn't like, so modified my rules a little. My new fis file, Flow_Calculator.fis, and new m file, FlowControl3.m, are pretty long, so I am not including them in the blog but the Terminal Set for the Error, ErrorDot and Output rules are below along with the LUT and chart.

Fuzzy Logic Term Set for the Error, ErrorDot and Output Rules.
Revised LUT  and LUT Chart for Paint Flow Control System.

 This LUT chart is a little smoother than the original that I had included in my Octave and Fuzzy Logic post mentioned above, probably because it's a 15x15 LUT whereas the original LUT was only a 11x11.

I plan on using National Instrument's LabWindows/CVI (LabWindows/CVI) for communicating with the BL2600 SBC for the PFC System but don't yet have a licensed copy, so I got an eval copy for the time-being, and decided to test out my new FL LUT with the eval LW/CVI. I had previously used LW/CVI for the Silk Screen Project and had made a simulation program to test out my FL algorithm. So I have been working to revise the program for the PFC. LabWindows/CVI isn't National Instrument's main software: that's their graphical language LabView, but I really like using LW/CVI as I can program in C and feel that I have better control of the code.

The simulation code is quite long and messy, so I won't show it here but only the results from the first test. The Chart below is the output of the simulation. The paint flow setpoint is 1.4 lbs/min and you can see that the flow control in the simulation has responded well but the flow value is far short of the setpoint at only slightly above 1 lb/min with a 25% error. Actually, it isn't surprising that the flow value error is so large as my FL algorithm is incomplete. I need to add a couple more steps in the algorithm to fine-tune the control when the error drops below 30% or so and then when it drops below 5 or 10% as suggested in the Li and Lau IEEE paper that I referred to in my previous post on the Silk Screen project (Development of fuzzy algorithms for servo systems). I'll continue to work on the algorithm and report on the results in my next post.

First Simulation of Fuzzy Logic LUT for the Paint Flow Control System.
________________
This morning I realized that I had made some mistakes or bad assumptions in applying my FL LUT in my simulation. In the chart above, the yellow trace is the "out" signal and the red trace is the simulated paint flow. To compute the paint flow, I was simply integrating or summing the out signal. And to compute the paint flow, I assumed that the paint flow would change immediately without any delay. If Dr. Lofti Zadeh, the originator of Fuzzy Logic, had seen this, he would probably cringe at my mistake. Clearly, I need to brush up on my FL knowledge and its application. However, before I do that, I revised my simulation analysis, now integrating/summing the out signal between steps and also using a simple low-pass difference equation to compute the paint flow from the integrated out signal. First I assumed that the paint flow would adjust halfway per step and next I assumed that the paint flow would adjust 25% per step, using the difference equations shown below.

50% per step:
PFlow = 0.5*out + 0.5*PrevPFlow;
PrevPFlow = PFlow;

25% per step:

PFlow = 0.25*out + 0.75*PrevPFlow;
PrevPFlow = PFlow;

Charts for these two simulation runs are shown below.
Simulation Assuming the Paint Flow Steps 50% Per Step Times the Out Signal.
Simulation Assuming the Paint Flow Steps 25% Per Step Times the Out Signal.

My description above is not quite correct. I am summing my out signal and a more correct description might be that I am increasing the output according to the Fuzzy Logic LUT that I am applying to the paint flow error signal.

Certainly I don't have my simulations all worked out yet, but hopefully I'm on the right track. As I make some progress, I will be adding new posts to my blog.

No comments:

Post a Comment