View previous topic :: View next topic |
Author |
Message |
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Simple PID control |
Posted: Thu Sep 27, 2001 4:12 pm |
|
|
This is turned out to be a really easy way to impliment a PID control.
All variables are floats
//PID PWM calculation routine for SupplyTemperature
errorNOW = Setpoint - SupplyTemperature;
PWMonTIME = PWMonTIME + (PWMp * errorNOW ) + (PWMi * (errorNOW - (PWMd * (errorNOW - errorLAST))));
errorLAST = errorNOW;
if (PWMon > 190) PWMon = 190; //maximum on time
if (PWMon < 10) PWMon =10; //minimum on time
PWMoff = 200 - PWMon;
___________________________
This message was ported from CCS's old forum
Original Post ID: 427 |
|
|
valemike Guest
|
Neutone....Re: Simple PID control |
Posted: Tue Mar 30, 2004 11:49 am |
|
|
Neutone,
Since i have to maintain temperature at around 405 degrees F, i looked at your past post. I'm new to PID, and am wondering the following:
1. PWMp*errorNOW is obviously your Proportional Term.
2. PWMi * (errorNOW)
3. PWMd*(errorNOW -errorLAST) looks like your Derivative Term.
What I don't understand is why do you multiply PWMi with the Derivative stuff too?
Looking at a bunch of ESP magazines, I see that the Integral Term is theoretically calculated by: Ki*sum_of_errors.
Is this a "quasi PID" algorithm you simplified that is good for your particular application?
Thanks,
Mike
Neutone wrote: | This is turned out to be a really easy way to impliment a PID control.
All variables are floats
Code: |
//PID PWM calculation routine for SupplyTemperature
errorNOW = Setpoint - SupplyTemperature;
PWMonTIME = PWMonTIME + (PWMp * errorNOW ) + (PWMi * (errorNOW - (PWMd * (errorNOW - errorLAST))));
errorLAST = errorNOW;
if (PWMon > 190) PWMon = 190; //maximum on time
if (PWMon < 10) PWMon =10; //minimum on time
PWMoff = 200 - PWMon;
|
___________________________
This message was ported from CCS's old forum
Original Post ID: 427 |
|
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: Neutone....Re: Simple PID control |
Posted: Tue Mar 30, 2004 12:36 pm |
|
|
valemike wrote: | Neutone,
Since i have to maintain temperature at around 405 degrees F, i looked at your past post. I'm new to PID, and am wondering the following:
1. PWMp*errorNOW is obviously your Proportional Term.
2. PWMi * (errorNOW)
3. PWMd*(errorNOW -errorLAST) looks like your Derivative Term.
What I don't understand is why do you multiply PWMi with the Derivative stuff too?
Looking at a bunch of ESP magazines, I see that the Integral Term is theoretically calculated by: Ki*sum_of_errors.
Is this a "quasi PID" algorithm you simplified that is good for your particular application?
Thanks,
Mike
Neutone wrote: | This is turned out to be a really easy way to impliment a PID control.
All variables are floats
Code: |
//PID PWM calculation routine for SupplyTemperature
errorNOW = Setpoint - SupplyTemperature;
PWMonTIME = PWMonTIME + (PWMp * errorNOW ) + (PWMi * (errorNOW - (PWMd * (errorNOW - errorLAST))));
errorLAST = errorNOW;
if (PWMon > 190) PWMon = 190; //maximum on time
if (PWMon < 10) PWMon =10; //minimum on time
PWMoff = 200 - PWMon;
|
___________________________
This message was ported from CCS's old forum
Original Post ID: 427 |
|
I don't really remember. It was 3 and a half years ago. I do remember that it has to be called a a periodic rate. I also think you may have over simplified what I posted. I think I took a formula with the P, I and D terms solved seperately and combined the I and D terms so that it would run faster. I do remember that it took a good bit of research to arive at that formula. It's like the difference in finding the slope between two points on a curve and finding the slope at a single point on a curve. Because you perform the process at a fixed rate this works. I was going to use just P but I had greate difficulty with temperature osilation due the the laitency of the temperature readings. This formula worked for me. The only hard part is experimentaly solving for P I and D. |
|
|
falleaf
Joined: 23 May 2004 Posts: 48
|
|
Posted: Tue Jun 29, 2004 12:30 pm |
|
|
Yes mike, normally, we can compute PID like Kp, Ki, Kd, but in some case, they use Kp (1 + Ki' (...) + Kd' (...)). But in this case, it's so strange. And it must be something wrong.
I finished my PID position controller with great results, and I think with uC software controller, we should compute directly. |
|
|
sonicdeejay
Joined: 20 Dec 2005 Posts: 112
|
|
Posted: Sun Feb 05, 2006 9:22 pm |
|
|
thx.. |
|
|
|