# Parameter identification for PI controller

I have a PI temperature controller being used in experiments, which I am also trying to simulate. However, using the proportional gain and integral time as used in the experiments gives different outputs from the experiments.

Is there a way to determine the k_p and T_i of the controller using only the measured input and output temperatures? A linear regression on the difference between output and input temperatures as a function of the error and the integral of the error gives unrealistic results.

The (possibly incorrect) estimation code in MATLAB I used is:

error = T_target - T_in(1:end-1);
integ = cumsum(error.*diff(time));
ctrl_input_exp = T_out(1:end-1) - T_in(1:end-1);
fit_model = @(a,b,x,y) a*x + a/b*y ;
fittedmodel = fit([error,integ],ctrl_input_exp,fit_model);
fit_coeffs = coeffvalues(fittedmodel);
k_p = fit_coeffs(1);
T_i = fit_coeffs(2);

• Yes there are ways. Perhaps the best technique is to put a DC signal in and wait until the output becomes a straight line with constant slope. The slope gives the integration constant; having that you can vary the input by steps and get the P factor. – rrogers Feb 16 '16 at 23:01
• I guess I might have put that up as an answer; but it hardly merits it. I have been in situations where the type of regression analysis you seemed to try was necessary; and it was considerably more difficult in a thermal situation. Controlled experiments with known loads are much better. If you are trying to regress around an active thermal load, you are asking for problems. Every tab and surface leads to time delayed energy "reflections"; in addition environmental effects confuse the issue. If you must do it with a thermal load let me know and I will try to help; but it won't be short – rrogers Feb 16 '16 at 23:07
• Let me put it a different way: a thermal system basically has an infinite number of poles; and that obscures what you are trying to do. – rrogers Feb 16 '16 at 23:11