Fuzzy Logic Control

Hello,

I have a motorized valve that I am controlling using an Opto Snap Pac PLC and I’m looking to implement fuzzy logic control (PID control is inappropriate in this application). Programming this from the ground up seems a bit daunting, especially considering that user-defined functions do not seem to be allowed in Opto.

Does anyone have any experience with fuzzy logic control in Opto 22?

Not being able to make your own functions is not as daunting as it sounds. All this means is you can’t create a procedure that has a return value for immediate assignment:

a = MyFunction();

You can make subroutines where you pass your variables by reference.

MySubroutine(a);

So what’s so special about this motorized valve?

I had a car where the marketing brochure said the transmission used “fuzzy logic”. It seemed more like it had a mind of its own to me…

1 Like

You can do amazing things with a valve using the PID functions on the PAC, but I wonder if you are talking of an ON/OFF valve or a motorized proportional actuator valve?

Agreed. My curiosity is killing me wondering what @optonovice is working with. I’m hoping for something totally unusual and interesting and he shares with us soon!

The ultimate goal is to use this valve to control the water temperatures of boilers in a boiler testing lab. By varying the flow through the boiler, I can vary the temperature rise across the boiler. Some of the testing that we do in our lab requires that very tight water temperate tolerances (+/- 0.5 deg F) are maintained for hours while measurements are taken.

Currently, we do this with just regular ball valves. It works, however it can take hours to get the temperatures dialed in. More importantly, because we’re in a lab with numerous boilers connected to the same primary flow loop turning off and on, the temperature in the loop can fluctuate up and down by a few degrees throughout the day. Thus, on the occasions when we are running tests which mandate tight tolerances, this can cause us to have to restart the test over several times before we get our results, which is very inconvenient. Hence the desire for automation.

I’ve played with PIDs before and have found that with careful tuning, they can work to control the valve so that the temperature tolerances are met. However, as soon as I connect a different boiler to the system, the tuning will be all out of whack and have to be re-tuned from scratch. That is why I’m looking into PID-alternative control strategies.

Thanks for the tip with the subroutines/submarines.

If you’ve been doing this by hand, then I would think a PID would do much better. In a PID time lag is the enemy, so try to limit that where ever you can in your process.

Here are some ideas to throw out there:

Are you sure the loop temperature fluctuation is causing a problem and it isn’t a result of a pressure change (and thus flow rate)?

Are the boilers firing at a constant load for testing? Are you using flow meters or pressure transducers anywhere that you can take advantage of?

If you can’t get the PID to respond fast enough, you may consider performing an open loop calculation (energy in = energy out, conservation of energy and all that) and set your flow rate from that plus use a PID loop to trim.

Keep us in the “loop”

Years ago I had fantastic luck with some standalone fuzzy logic PID controllers in a system that had seven interacting PID loops. I had anticipated spending at least a week tediously tuning the loops, but it took only one try, letting each controller perform its own autotune. It was astounding how well they worked.

That made a believer out of me for the potential benefits of fuzzy logic control. Those controllers are no longer available, and I wish I knew more about how their algorithms worked.

Back when fuzzy logic was a hot new thkng, I remember having some kind of development system for programming fuzzy logic using a language called FORTH. It may well be possible to create an OptoScript implementation of a fuzzy logic PID algorithm, but I don’t know how.

But something else to consider is simply letting your program adjust all of the values in your PID to fit different boiler characteristics.

You could even come up with the ideal tunings for your different boilers and switch between them in the MMI as needed.

numerous boilers connected to the same primary flow loop turning off and on

Here was your first problem, fix the problem, don’t use fuzzy logic, it is a bandaid. If you’re not using a mass flow controller for a valve, then this will never work…
As soon as one of the many valves open or close, the pressure input to your valve changes and now the whole control thing goes out the window…
If you need that close of tolerance, then you need a mass flow controller or a proportional control valve (with a tapered V port) and a precision upstream regulator and then a PID will work fantastic. Achieving 0.5 DegF with temperature is difficult at best and the problem is if there is any hysteresis in the control valve, it will not work. Also, if the control valve is not sized correctly, it will not work. If the PID needs to operate over large ranges, then you’ll need to make a lookup table that “tunes” the PID based on the range. One more thing, in order to achieve that tolerance, you’ll need several temp probes accurately calibrated and then use the average of all of them.

1 Like