CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Simple PID control

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Simple PID control
PostPosted: Thu Sep 27, 2001 4:12 pm     Reply with quote

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
PostPosted: Tue Mar 30, 2004 11:49 am     Reply with quote

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

View user's profile Send private message

Re: Neutone....Re: Simple PID control
PostPosted: Tue Mar 30, 2004 12:36 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 29, 2004 12:30 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Feb 05, 2006 9:22 pm     Reply with quote

thx..
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group