Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

PID algorithm - determining coefficients 1

Status
Not open for further replies.

GabiS

Computer
Mar 6, 2003
3
Hi.

Please help me with the pid algorithm.
In order to regulate the temperature to follow a diagram ( to increase from 20 celsius degrees to 250 for 2 hours, then stay at 250 for 1 hour, then increase from 250 - 350 for 1 hour, etc.) I need to give some power to a device.

I inspired from:

CO(k) = CO(K-1) - KP * (PV(K) - PV(K-1)) + KI * TS * E(K) + KD / TS * (PV(K) - 2 * PV(K-1) + PV(K-2))

where
CO = controller output between 0 and 100. (the power to be given in order to grow the temperature)
PV = process variable (measured temperature)
SP = set point (the temperature that should be)
E = SP - PV = error
KP = proportional coefficient
KI = integral coefficient
KD = derivative coefficient
TS= time sample = the time interval at which the regulation of the temperature is made

Questions:
1. Does this alg. apply also when the temperature to be set is not constant (e. g. is growing?)
2. How do i get the p, i, d coefficients? i run the program succesively how many times?
- p,i,d between what ranges?
- At consequent runs, i modify the coefficients with what increment?
- I select the p,i,d which makes the minimum error? how is measured the error? the sum of consequent errors?

Thank you for your help.
Gaby.
 
Replies continue below

Recommended for you

Why did you select that PID formula in particular?

 
Gaby, to write one algorithm to adequately perform your control task is quite a mission!
The best approach is to separate the control tasks - one to perform the PID control at the given setpoint and one to provide the setpoint to the PID control (eg. to ramp the setpoint from 20deg to 250 deg over 2 hours, maintain 250deg for 1 hours etc.)
The tuning of the PID loop is a matter of experience and in fact the coefficients will not necessarily be the same across such a wide temperature range to achieve acceptable control across that range.
It is impossible to advise what coefficients to use as these are totally dependent on the system being controlled and the inherent lags of that system.
If the system can be 'played with' safely without causing undue damage or danger in the event of poor control, the best approach is a trial and error one. Set no integral or derivative terms, and then 'play' with the proportional setting until the system oscillates at fixed frequency. The final settings for all 3 terms can then be calculated from the proportional setting at the point of oscillation. (I've forgotten the actual ratios at the moment!) From there, fine tuning can be done by altering the coefficients by small amounts until satisfactory control occurs.
If poor performance of the control loop would introduce an unacceptable hazard, then it's best to leave it to someone who knows what they're doing!
 
Several things, 1st your temp profile is a seperate issue from the PID control loop and is, in fact, a profile of the setpoint as suggested above. It is an easy matter to control that. 2nd, before you aquire optimum parameters for PID, you need to determine TC of process because it is probably very slow. If this was a fast loop it would be fairly easy to aquire these. As a rule, you would set I and D parameters to 0 and increase P until the Pband tightness just to oscillation, then divide p/1.85 and increase integral until it comes in. D probably won't be required. This is only rough; but, will get you close.
 
skills is correct: the problem has two parts. Profiling the setpoint and tuning the loop. The other option instead of the Ziegler-Nichols (Z-N) closed loop method that skills mentioned above is to use the Z-N open loop method. Put the controller in manual mode (i.e., feedback loop is open and controller output can be manually entered) and implement a step change of about 5-15% in the controller output. Log resulting plant transient and use the curve you get and Z-N open loop formulas to calculate your tuning parameters. I, too, think a PI controller should do the trick.

By the way, do a search on PID tuning on the Internet. You'll find a ton of information. There are other methods of tuning, and since you're doing setpoint changes your controller needs to be very responsive to them. Some tuning models work better for setpoint changes; some for disturbance rejection. Z-N handles both pretty well from what I understand.

xnuke Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Thanks for the useful hints. I'll try to apply them.

Gaby.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor