Results 1 to 18 of 18

Thread: Fuzzy Control

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Fuzzy Control

    Gene Cafe Coffee Roaster $850 - Free Beans Free Freight
    Hey, I have been reading a fair few of the posts regarding PID control of the Silvia and I had a thought/question. Since the temperature/thermostat closed loop system is highly non-linear, the application of PID control is not necessarily the most ideal. I know from control systems engineering (which is what I do at uni) that PID controllers can only get so close in terms of heat recovery, tracking etc. A classic example is its use for furnaces back in the day with heat treating. Nowadays they have all shifting to fuzzy logic control which offers a very humanlike approach to control the temperature, almost the same way us humans adjust the shower taps to get the right temperature. The results are faster heat times and tighter control. Perhaps these would have little if any benefits over PID which is already well established and working for people quite well already, but since people are willing to try anything in the search for espresso nirvana, perhaps this is another avenue people could try.

    As for my contribution, I am definitely interested in discussing with people ways this could be implemented, contribute my know how and try fabricating and testing such a thermostat system. I have developed working fuzzy systems at various levels already.

    Sounds interesting I thought

    -Mikey

  2. #2
    Senior Member robusto's Avatar
    Join Date
    Feb 2005
    Posts
    2,926

    Re: Fuzzy Control

    Mikey, many PIDs utilised in coffee machines do come with fuzzy logic.

    Looks like your idea was "borrowed" in advance of you coming up with it.

    --Robusto

  3. #3
    Senior Member
    Join Date
    Mar 2006
    Posts
    188

    Re: Fuzzy Control

    Hi, Mikey -

    Im very interested in this topic. My experience to date with Fuji controllers implement fuzzy logic has not shown it to be any more effective than normal PID control.

    The central issue in controlling boiler temps on an espresso machine, at least a single boiler like a Silvia, is minimizing the time it takes to return to stable, controlled temperature after disturbing things by pulling a shot (or otherwise introducing a volume of cooler water into the boiler). Normally, minimizing overshoot is equivalent to minimizing recovery time, but not always.

    I have not observed the Fuji fuzzy logic algorithm to be any more effective in this than the non-fuzzy PID control implemented on Watlow controllers. In fact, it has been less effective.

    Any thoughts?

    Jim

  4. #4
    Mal Dimal's Avatar
    Join Date
    Oct 2004
    Location
    Warwick, QLD
    Posts
    17,124

    Re: Fuzzy Control

    Yep,

    Fuzzy Logic has been around for a long time but has no doubt progressed along with other modes of process control. We started using it in a large mineral processing plant around 1993-4 with the intention of maintaining the plant throughput at the highest possible levels commensurate with equipment longevity and quality issues. In the end, it was relegated to only one area of the plant where it displayed measurable benefits with the rest of the process remaining under PID Control via SCADA and a centralised Process Control System.

    I think the issue with FL and boiler management in Single Boiler/Dual Purpose espresso machines is that the dynamics present in the system are so significant with the hardware being used, Boiler size|Heating Element rating, etc that the arguments required for effective and meaningful control are no better placed than standard PID algorithms for achieving the desired end result. If one were to redesign the espresso machine from scratch with the intention from the outset of using FL to manage the Brew Water cycle and perhaps the Steam also, then that would be a different kettle of fish and could probably be executed reasonably successfully.

    Cheers,
    Mal.

  5. #5
    Senior Member robusto's Avatar
    Join Date
    Feb 2005
    Posts
    2,926

    Re: Fuzzy Control

    Problems really arise when we try to turn a single-boiler machine designed for a coffee now and then, into one which has to deliver multiple shots repeatedly.

    If you are lucky enough to have to make just one coffee.... then the PIDs job is relatively easy. All it has to do is maintain a steady temperature and prevent overshoot prior to pulling the shot.

    The auto-tune function can be set while the machine is in a steady state.

    The ingress of about 80 mls of cold water during the brew cycle will cause havoc with the boiler/element/PID. But that wont really affect the temperature of whats coming out downstairs. That has already been dictated by the design of the machine and the pre-existing temperature
    of the water.

    All the PID can hope to do is try to bring some order into the situation by getting the boiler ready for FUTURE use as soon as possible. It can do little -- if anything -- to affect the brew temperature underway during the current extraction.

    Now, if another coffee has to be pulled relatively close to this one, it is best to set the auto-tune NOT in the steady state situation, but while the dynamics are rapidly changing.

    In other words, as soon as you hit the brew switch, hit autotune as welll.

    The result will be less than perfect, but as good as can be hoped for in a machine with a comparatively massive 1100 watt element in a relatively tiny 300 ml boiler (and worse for a Gaggia) where time is of the essence.

    Initially, PIDs were introduced to eliminate temperature surfing. So you could walk up to the machine and pull a shot without hesitation.

    Not satisfied, we now want all that and miracles too.

    --Robusto


  6. #6
    Senior Member
    Join Date
    Jul 2006
    Posts
    604

    Re: Fuzzy Control

    Not sure whether it is different on a Silvia but on the Botticelli with Jims Watlow 93 the temp is back to setpoint by the time I grind for the next espresso. If Ive steamed milk I flush to about 110C and the PID returns to setpoint within about a minute and stays there. So no problem for me- it is either the Bott, Jims programming (because I didnt autotone from his settings) or a combination
    Brett

  7. #7
    Senior Member robusto's Avatar
    Join Date
    Feb 2005
    Posts
    2,926

    Re: Fuzzy Control

    Telemaster, in effect you are by-passing the PID, intervening with some human fuzzy logic. PIDs can only heat or not heat a boiler (via delivering or not delivering power to the element, of course).

    They cant cool. So once the water is way beyond the setpoint, as in steaming temperature, there is virtually nothing a PID can do to bring the temperature back.

    --Robusto

  8. #8
    Senior Member
    Join Date
    Jul 2006
    Posts
    604

    Re: Fuzzy Control

    Quote Originally Posted by robusto link=1178296541/0#6 date=1178457012
    Telemaster, in effect you are by-passing the PID, intervening with some *human fuzzy logic. * PIDs can only heat or not heat a boiler (via delivering or not delivering power to the element, of course). *

    They cant cool. *So once *the water is way beyond the setpoint, as in steaming temperature, there is virtually nothing a PID can do to bring the temperature back.

    --Robusto
    Hi Robusto and thanks. I take what you say about a PIDs operation, but still wonder about relative performance between PIDed machines, even discounting differences between PIDs- such as the post steaming temp drop. I wonder about boiler design, materials, wall thicknesses.
    I suppose it really isnt an issue of PID at all is it? Itd be the same looking at Silvia, Bott and Quaha after steaming whether PIDed or not.
    Brett

  9. #9
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Fuzzy Control

    Well with fuzzy logic the rules are human like as I mentioned before.

    A human can intuitively do things that a linear control algorithm cant.
    The linear control algorithm for those who dont know, takes the set point, subtracts from this the current temperature and names this the error signal. This error signal is now directly proportional (the P in PID) to the output of the system.
    So if the difference in temperature is 10 degrees, the system will turn the boiler on for 1 second in every 10. As this approaches the set point, the temperature difference decreases so that the boiler is on during a 10 second period less and less until the difference is zero and the boiler doesnt come on any longer.
    The differential (the D in PID) is there to prevent overshoot and the integral (the I in PID) is there to ensure you reach the required set point because the derivative part can cause the algorithm to never reach the set point. This is called steady state error. You can tolerate some steady state error in a boiler, say 0.5degrees and you tune the system accordingly. The less steady state error you want the longer the system will take to stabilise I think, I am not an expert on tuning PID systems at all as I have focused more of my time with fuzzy and neural control techniques.

    With a fuzzy logic control algorithm you define membership groups.

    ERROR membership groups


    OUTPUT membership groups


    Now what happens is that the error signal is generated as per usual, now this error signal is run through a set of rules. Here is an example set

    IF error IS under a lot THEN output IS fully on
    IF error IS under a little THEN output IS partially on
    IF error IS close enough THEN output IS off
    IF error IS over a little THEN output IS off
    If error IS over a lot THEN output IS off

    Assume the range of the error signal from lowest to highest is -100 to +100 with CLOSE ENOUGH being centred around 0. Assume output is a length of time from 0 to 10 seconds that the heater is on in a ten second time frame. Eg 0 seconds on for a 10 second time length which equates to fully off, 5 seconds on for every 10 seconds which is 50% on or 10 seconds on during a 10 second cycle which is fully on.

    So we have evaluated the error signal and for each rule we work out what percentage each rule is true. We will do this step by step for each rule and we will assume the error between the set point and the current temperatuer is that the current temperature is 10 degrees off.

    IF error IS under a lot THEN output IS fully on
    error is 10deg so the amount of truth that the error is under a lot is say 5%, therefore we put in our output 5% fully on

    IF error IS under a little THEN output IS partially on
    error is 10deg so the amount of truth that the error is under a little is say 80%, therefore we put in our output 80% partially off

    IF error IS close enough THEN output IS off
    error is 10deg so the amount of truth that the error is close enough is 5%, therefore we put in our output 5% fully off

    IF error IS over a little THEN output IS off
    If error IS over a lot THEN output IS off
    these two rules both equate to 0% truth therefore their outputs are 0% of their outputs thus can be neglected

    The process of converting the real world input (error) into a percentage of a rule is called fuzzification. The process of evaluation the rules is called rule inferencing.

    If we add up the outputs we end up with


    This is our output membership function and is evaluated everytime the algorithm is run. This is useless on its own so we perform defuzzification. There are lots of methods but the most common is called centre of gravity whereby you try to find the centremost point not based on averages or distances but how that would behave as a 2d solid (uniform depth). This gives you a single value which you would then use to control the boiler on/off duty cycle.

    That is a pretty short and probably terrible introduction to fuzzy control but hopefully for those who do not know about it, can perhaps think of ways this could be used to control the boiler a lot better. I haev given a link at the end of this post to a book about computational intelligence in control engineering, but it is quite math intensive. It is however a formal source of information.

    Also, we can have multiple inputs too, not just error. We could have say, ambient temperature, inlet water temperature, even temperatures along certain points of the boiler system, so long as these provide useful information which would be used for control then they are useful in a fuzzy based system. Basically if you would use certain information for controlling the system manually (a human is an expert system, for the most part I had a laugh) then it is probably useful to a fuzzy system.

    Anyway, I have a copy of LabView and some external interface boards so I could prototype a system using this... not sure if I would pull apart my Gaggia as an experiment though. Anyone got a shagged Silvia I could give it a whirl with :P

    For more infortmation on fuzzy logic and neural network systems used in control engineering check out this free eBook
    http://www.reking.protia.net/ci/

    Any questions feel free to hassle me or correct me :)

  10. #10
    Member
    Join Date
    Jan 2006
    Posts
    44

    Re: Fuzzy Control

    boil kettle,add instant coffee,couldnt be easier!

  11. #11
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Fuzzy Control

    Should slap you for that.

  12. #12
    Mal Dimal's Avatar
    Join Date
    Oct 2004
    Location
    Warwick, QLD
    Posts
    17,124

    Re: Fuzzy Control

    Hi mookins,

    Appreciate everything you have explained re FL, but the problem with small single boiler/dual purpose machines are the differences in dynamics at play. A far better solution than using either PID, FL assisted PID or FL on its own, would be to model the various dynamic modes, and probably using a PIC, or special purpose device of your own design, use the FL to determine the dynamics required by comparison with the models and then engage the control scenario most suited to achieve the objective. If I still had access to the tools and facilities required, Id give it a go myself.....

    Mal.

  13. #13
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Fuzzy Control

    Neural networking could be used to auto tune the fuzzy system to optimise the performance for any machine. Would take a while to develop though but would be quite interesting. If I took this path I would definitely go with a microcontroller and then utilise solid state switches (FETs) and use a chopper circuit to modulate the power to the boiler. Of course you would put digital pressure and temperature readouts onto an LCD naturally :D

    In terms of modelling I think that is a good idea too, but that would mean you would have to design a controller for each individual system.


  14. #14
    Mal Dimal's Avatar
    Join Date
    Oct 2004
    Location
    Warwick, QLD
    Posts
    17,124

    Re: Fuzzy Control

    Quote Originally Posted by mookins link=1178296541/0#12 date=1178581811
    Neural networking could be used to auto tune the fuzzy system to optimise the performance for any machine. Would take a while to develop though but would be quite interesting. If I took this path I would definitely go with a microcontroller and then utilise solid state switches (FETs) and use a chopper circuit to modulate the power to the boiler. Of course you would put digital pressure and temperature readouts onto an LCD naturally :D

    In terms of modelling I think that is a good idea too, but that would mean you would have to design a controller for each individual system.
    All sounds good mookins,

    Brings me back to my earlier days when hands-on problem solving and development was par for the course.... Love it. With regard to using the modelling approach, I had in mind that this would be set up with a supervisory layer and a number of sub-routines that could be tuned/modified to cater for differing thermodynamics..... saves on having to rewrite substantial lines of code/logic for each situation. With the use of "Call" routines as well to pull in FL/PID input resulting from field variables to close the loop. Used to love doing all this kind of thing, albeit on a much larger Industrial/Mining & Mineral Processing sort of scale. Those were the days.

    Anyway mookins, if you do decide to have a go at doing something, there are a lot of us here at CS that find this sort of work very interesting and would appreciate any feedback of work in progress. To get an idea, just do a google search of one of our members "Sparky" to see the sort of stuff that he gets up to and reports back, all really interesting and fun. All the best mate,

    Mal.

  15. #15
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Fuzzy Control

    Do you think a shagged and cheap sunbeam machine would be okay to test this stuff on since I could probably shell out for one of those no problems.

    I have been thinking also about pre-heating water, as I found a link on another site. Looks very interesting also.

  16. #16
    Mal Dimal's Avatar
    Join Date
    Oct 2004
    Location
    Warwick, QLD
    Posts
    17,124

    Re: Fuzzy Control

    Quote Originally Posted by mookins link=1178296541/0#14 date=1178708189
    Do you think a shagged and cheap sunbeam machine would be okay to test this stuff on since I could probably shell out for one of those no problems.
    I guess it depends on what sort of a system you want to start experimenting with.... Apart from the cheapest Sunbeam, a Ristretto, all the rest of them use Thermoblocks rather than Boilers so would require a different approach to control, more along the lines of SBs top model, the EM69xx Cafe Series which SB have gotten pretty close to sorting out. A better approach might be to buy an old Single Boiler, non-HX machine of some description that is in need of some TLC and for which components are still available should they be needed, or alternatively, you are able to manufacture.

    Quote Originally Posted by mookins link=1178296541/0#14 date=1178708189
    I have been thinking also about pre-heating water, as I found a link on another site. Looks very interesting also.
    Yep, this is indeed a beneficial addition to consider and "Sparky", the CS-er I referred to above, has already made considerable progress along these lines. It would really be worth your while to do a "search" of the forum for Threads/Posts by Sparky to catch up on where hes at. Or, maybe send him a PM and initiate some information exchange. All the best mate,

    Mal.

  17. #17
    Junior Member
    Join Date
    Apr 2007
    Posts
    20

    Re: Fuzzy Control

    I shall get on it ASAP re: Sparky.

    Re: a machine I think I will just have to be patient and the right machine will present itself on here or eBay. However if anyone happens to read this and knows where I could get one from then please let me know :)

  18. #18
    KJM
    KJM is offline
    Senior Member
    Join Date
    May 2007
    Posts
    688

    Re: Fuzzy Control

    Just a quickie note:

    1. If you use a thermoblock (or whatever) for pre-heat, youll effectively reduce the required control band to close to zero.... which would be nice because:

    2. If you need to pull in 100ml (for easy maths) of water into the boiler, you need (100 * 4.186 * delta-T) J of energy input to keep it constant. If we assume the water in the tank is 20C, and we target 125C, we now need 44kJ (rounded up) of energy whacked in.

    My Silivia (brand new out-of-box only yesterday) has a 1.1kW heating element. So 44kJ requires this on for a fair while! So practically speaking, the control regime is going to have to deal with settling times that stretch out into the O(10s) of seconds. The temperature dropped by the boiler will, of course, not be so big because of the thermal "inertia" of the system, but the nett energy required to bring you back to setpoint doesnt change.

    So I guess if you build a uController solution, one of the first things to do is switch the heater on as soon as the operator hits the pump. You also can figure out how long to leave it on for (on full bore, of course). The lag through the system will ensure any PID/FL system does not "see" the drop until the energy of the system has re-distributed itself and you *know* already youll need to heat.... SO if you have a PID controller - I suspect bypassing it when you brew is probably a way of getting tighter control - PID out of loop, hard on for xx seconds, PID back on.

    In fact, you could probably build a quite accurate control loop from simple thermodynamics - efficiency of heaters is known, specific heats are known, temperature is known - the only nasty things are the quantity of water withdrawn and the heat loss. Be interesting to match a "blind" controller in this application against a PID or FL system...

    Cheers!



Similar Threads

  1. PID Temp Control for less than $50
    By Wilki in forum Brewing Equipment (non-machine specific)
    Replies: 35
    Last Post: 23rd June 2015, 02:58 PM
  2. Linea pid control
    By PhatBoy in forum Brewing Equipment - Extreme Machines ($3000+)
    Replies: 11
    Last Post: 14th June 2010, 11:57 AM
  3. Benefits of PID Control
    By pszilard in forum Brewing Equipment - Midrange ($500-$1500)
    Replies: 15
    Last Post: 20th March 2007, 03:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •