PID algorithm - determining coefficients
PID algorithm - determining coefficients
(OP)
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:
http://bestune.50megs.com/typeABC.htm
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.
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:
http://bestune.50megs.com/typeABC.htm
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.





RE: PID algorithm - determining coefficients
RE: PID algorithm - determining coefficients
http://bestune.50megs.com/typeABC.htm
I don't have a better source of information.
Do you have a better ideea?
Gaby.
RE: PID algorithm - determining coefficients
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!
RE: PID algorithm - determining coefficients
RE: PID algorithm - determining coefficients
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.
RE: PID algorithm - determining coefficients
Gaby.