From: kris d. <t_...@ya...> - 2007-01-15 23:49:17
|
Hi, I want to try to control temperature in an hermetic enclosure. I tryed to use a simple ON/OFF controller. I don't get any good result. So, I want to try PID controller but I don't really know where to start. I want to use PWM to set the temperature of the heating resistor and then the enclosure temperature. I didn't find any information about the way to code that controller. Do anybody could help me ? Thank you a lot for the help. Kris __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Jesse W. <jes...@gm...> - 2007-01-16 01:39:38
|
This is the best tutorial out there IMHO http://www.embedded.com/2000/0010/0010feat3.htm On 1/15/07, kris duff <t_...@ya...> wrote: > > Hi, > > I want to try to control temperature in an hermetic > enclosure. > > I tryed to use a simple ON/OFF controller. I don't > get any good result. So, I want to try PID controller > but I don't really know where to start. I want to use > PWM to set the temperature of the heating resistor and > then the enclosure temperature. > > I didn't find any information about the way to code > that controller. Do anybody could help me ? > > Thank you a lot for the help. > > Kris > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users > -- :wq |
From: Grahame J. <gb...@th...> - 2007-01-16 03:31:34
|
Hi, I am using something like this with reasonable success. The 366 value is the maximum value of my PWM. You will need to change this. typedef struct { float dState; // Last temp input float iState; // Integrator state float iMax, iMin; // Maximum and minimum allowable integrator state float iGain, pGain, dGain; // integral gain // proportional gain // derivative gain } SPid; // Setup PID gain values for BLOCK0 pid = malloc(sizeof(SPid)); pid->pGain = 18.3; // 366/100 * 5 // As error increase value should increase, Instant power pid->iGain = 14.4; // The longer the error the higher the value pid->iMax = 366.0; // Upper weighted n + iGain Correspond to 100% of output 366/iGain pid->iMin = -9.0; // Lower weighted n + iGain Correspond to 0% of output pid->iState = 0.0; // iState History pid->dGain = 0.2; // Change in error. If error is changing -vely dterm should go down pid->dState = 0.0; // dState History /*************************************************************************************************************/ // This is a pid controller intending to keep the temperatures as stable as possible to set_temp static float update_PID(SPid *pid, float temp, int set_temp) { float error = 0.0; float pidval = 0.0; float pTerm, dTerm, iTerm; float pGain = pid->pGain; error = (float)set_temp - temp; // calculate the proportional term pTerm = pGain * error; // calculate the integral state with appropriate limiting pid->iState += error; if (pid->iState > pid->iMax) pid->iState = pid->iMax; else if (pid->iState < pid->iMin) pid->iState = pid->iMin; // calculate the integral term iTerm = pid->iGain * pid->iState; // calculate the derivative term dTerm = pid->dGain * (temp - pid->dState); pid->dState = temp; if(motor0_direction == MOTOR0_FORWARD) pidval = pTerm + iTerm - dTerm; else pidval = -(pTerm + iTerm - dTerm); if(DEBUG_PID) { if(debug_pid_ctr > 25) { syslog(LOG_DEBUG, "%-3s%-6s%-7s%-7s%-7s%-6s%-6s%-6s%-6s%-6s%-6s%-7s%-7s%-7s%s\n", "id", "set", "temp", "err", "dSt", "iSt", "iMin", "iMax", "pGn", "iGn", "dGn", "pTrm", "iTrm", "dTrm", "pid"); debug_pid_ctr = 0; } syslog(LOG_DEBUG, "%-3d%-6d%-7.1f%-7.1f%-7.1f%-6.1f%-6.1f%-6.1f%-6.1f%-6.1f%-6.1f%-7.1f%-7.1f%-7.1f%.1f", pid->id, set_temp, temp, error, pid->dState, pid->iState, pid->iMin, pid->iMax, pid->pGain, pid->iGain, pid->dGain, pTerm, iTerm, dTerm, pidval); debug_pid_ctr++; } return pidval; } Jesse Welling wrote: > This is the best tutorial out there IMHO > http://www.embedded.com/2000/0010/0010feat3.htm > > On 1/15/07, * kris duff* <t_...@ya... <mailto:t_...@ya...>> > wrote: > > Hi, > > I want to try to control temperature in an hermetic > enclosure. > > I tryed to use a simple ON/OFF controller. I don't > get any good result. So, I want to try PID controller > but I don't really know where to start. I want to use > PWM to set the temperature of the heating resistor and > then the enclosure temperature. > > I didn't find any information about the way to code > that controller. Do anybody could help me ? > > Thank you a lot for the help. > > Kris > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn > cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> > _______________________________________________ > gumstix-users mailing list > gum...@li... > <mailto:gum...@li...> > https://lists.sourceforge.net/lists/listinfo/gumstix-users > <https://lists.sourceforge.net/lists/listinfo/gumstix-users> > > > > > -- > :wq > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ------------------------------------------------------------------------ > > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users > |