osakechan / notoriousPID

PID fermentation control for AVR platforms
GNU General Public License v2.0
26 stars 17 forks source link

Question: kPIDs #6

Open cobysy opened 9 years ago

cobysy commented 9 years ago

How did you arrive at the PID constants for the cooling and heating. Do I need to tune them myself before putting into use?

P.S. I really like your work on creating notoriousPID. BrewPI is so convoluted I don't understand what's going on in their codebase.

osakechan commented 9 years ago

Yes, those constants are unique to each installation and must be determined experimentally (this is the largest challenge in configuring a PID algorithm for good process control). They will be affected by the BTU output of your heater/cooler, probe placement, fans, degree of insulation in your chamber, batch sizes, even the physical arrangement of your system.

I highly recommend reading through Practical Process Control by Doug J. Cooper (aka controlguru). It can be found online at http://www.controlguru.com/pages/table.html. It is an excellent resource and details methods for determination of the constants through a procedure known as a bump test:

Allow the system to reach a steady state condition at constant PID output, then 'bump' the process by changing the PID output and observe the response of the system. The data logging capabilities make it easy to record this response. From there, it is relatively straight forward to determine the constants from the response curve with a few simple equations. Once you've established the base constants, there is some further tweaking you can do to try to minimize overshoot, oscillations, etc.

Just to be clear, there are two sets of constants because there are two PID algorithms. This type of configuration is called cascading control. The main PID outputs an air temperature necessary to maintain the desired fermentation temperature setpoint (set by the user). This main PID output serves as the setpoint for two additional control algorithms which correspond to the two final control elements (the fridge/freezer compressor and the resistive heating element). The algorithm in control of cooling is essentially a finite state machine and can be tuned by adjusting the parameters that determine a change of state (idle, compressor on, heating, etc). The algorithm in control of heating is a second PID instance utilizing a technique known as time proportioning. Both of these secondary control algorithms are necessary because the output of a PID can continuously vary while the compressor and heater are simple FULL ON/FULL OFF devices.

Hope this has given you enough info to be headed in the right direction without being too overwhelming. With regards to the BrewPI, I totally agree that much of the code seems convoluted or at least over-my-head in complexity. It was still a great reference when designing notoriousPID and I do have to credit its maker for inspiring the cascading control scheme I ultimately implemented. Good luck and Cheers!

-Mike aka Osakechan

On Sat, Apr 11, 2015 at 9:11 AM, cobysy notifications@github.com wrote:

How did you arrive at the PID constants for the cooling and heating. Do I need to tune them myself before putting into use?

— Reply to this email directly or view it on GitHub https://github.com/osakechan/notoriousPID/issues/6.

cobysy commented 9 years ago

Thank you for finding the time to write the explanation osakechan (is that from お酒ちゃん I wonder?). Especially the part about the two PID algorithms I really appreciate. Because I could never find a good resource about how to PID a fridge compressor because, as you say, it's either fully ON or OFF. In fact the same goes for the resistive heat element (aquarium heater on a glass pitcher filled with water).

I'm still waiting for a few parts to arrive - hopefully I can get it all set up soon (and before my new work). Otherwise the STC1000 will have to do.

divya0056 commented 9 years ago

Hi, I am a newbie learning more about this awesome project of yours. Wondering if you have a basic version of your project without data logging feature. So I can flash it on UNO rev3. I am trying to make a yougurt maker and any help from your end would be much appreciated. Thanks Divya0056@gmail.com