Thinking about PID controlPosted: December 19, 2012
Proportional, Integrative, Differential control. There is a function in Arduino that implements this and I started thinking about how I would do this and if it would be appropriate. The function, really an algorithm is all based on error and time. In this case the error is the difference between the set point and the actual tank temperature.
All three functions Proportional, Integrative and Differential have a factor, Kp, Ki and Kd. For example let’s calculate each portion of the formula starting with the proportional contribution Kp, if the current temperature of the tank is 100°F and the set point is 140°F the error is 40. The integrative portion of the formula adds the contribution of the error over time. This would be the Ki factor multiplied by 40 and added to the previous Ki*error for every time period. The differential portion is the Kd multiplied by the difference in the tank temperatures or in other words the tank temperature at the beginning of the time period minus the tank temperature at the end of the time period. Let’s take some of the data collected by the OpenLog microSD card and take a stab at this in Excel. We’ll assume Kp=6, Ki=.6 and Kd =.2. The time period is one minute.
Now in practical terms how is the the fire being controlled now? The auger time is being controlled. Of course practically the fire must not go out so there is a minimum time the auger must run, since in this program the auger is on a fixed time of 5 secs this really means that all of the control comes from varying the time the auger is not running. But again the fire can’t go out so I figure the max amount of time between the fixed auger feeds of five seconds is forty seconds. So that is the slowest the fire can go. How fast can it go? Well theoretically the feed could run continuously but again we are dealing with a chemical process that cannot simply absorb 100% fuel feed. In this case the auger motor added a practical aspect by limiting the feed to a duty cycle of 50%, so the maximum time that the feed can be on is half the time.
Since the PID control is based on time periods and the data collection time period is one minute,lets choose a time of 1 minute for argument. In one minute at max run the feed will be on 30 seconds and off 30 seconds. In one minute at min run the feed will be on for 5 secs, off for 40 secs, on for 5 secs and then off for the remaining 10 seconds of the minute. So again we don’t control the on time only the off time and the difference between the max on time (min off time) and min on time (max off time) is 30 secs on, 30 secs off for the max and 10 secs on and 50 secs off for the min. So the only control between full bore and idle is the difference between 50secs and 30 secs or 20 secs per minute.
This explains some of the challenge, the other challenge is the inertial effect of the combustion reaction especially if unburned fuel has built up. So now that the PID output has been calculated I’m having a hard time wrapping my mind around how this would translate to control of the time, I know I could set up a simple proportion between the PID output and the 0-20 scale of auger off time dwell. However in this example the PID output increases as the error decreases. I guess that’s the beauty of a spreadsheet I will play around with Kp, Ki and Kd to see if I can get this to work a little better.