1
$\begingroup$

I'm trying to control temperature with PID(Kp,Ki, Kd). During the rise time the system use one PID and when target is reached the system switch to another PID with other parameter in order to eliminate the oscillation. I know that I can remove oscillations increasing Kd but in this case it does not work.

Results of real time system

Control temperature with constant PID:

enter image description here

Control temperature using PID1 during rise time (blue color) and when temperature reach the target, the controller is changed to PID2 (Steady state error: black color):

void setTarget(...)
{
    mPid = pid1;
}

void steadyStateError()
{
    float e =  fabs( temperature - target);
    if(e<=0)
       mPID = pid2;
}

enter image description here

$\endgroup$
6
  • 1
    $\begingroup$ How would you handle the transition? $\endgroup$
    – A_A
    Commented Jul 2, 2019 at 16:26
  • 1
    $\begingroup$ If implemented correctly I think this would be equivalent to gain scheduling (this can also be used on linear systems to improve performance). $\endgroup$
    – fibonatic
    Commented Jul 2, 2019 at 17:19
  • $\begingroup$ @A_A the question was updated. $\endgroup$ Commented Jul 3, 2019 at 10:35
  • $\begingroup$ @fibonatic could you please recommend me some article or book that show me how to implement correctly this implementation in real time? $\endgroup$ Commented Jul 3, 2019 at 10:41
  • 1
    $\begingroup$ Gain scheduling is normally used for nonlinear systems with different operating points, so most books and articles will probably be about that. In order to still show stability one could use the circle criterion. Both can be found in nonlinear systems by Khalil, however it doesn't cover gain scheduling for linear systems to improve tracking or disturbance rejection. $\endgroup$
    – fibonatic
    Commented Jul 4, 2019 at 14:41

1 Answer 1

2
$\begingroup$

Switching between 2 PID controller is called gain-scheduling. There are various ways to implement gain scheduling. But basically, the idea is that the gain should change smoothly. You should not change suddenly. You could have one set of gains if T < T1, another set if T > T2 and use interpolation between the 2 sets if T1 < T < T2.

You can also use 2 PID controller with the unused PID set in tracking mode while the other controls the actuator also. However, it will be harder to have a smooth transition between the 2 controllers.

Secondly, before implementing gain scheduling, make sure your issue is really due to non-optimal gains. Typically, there are 2 problems with control loop for temperatures

1 - Actuator saturation which causes integrator windup. This happens often in temperature control when the difference between the setpoint and the measured temperature is significant. This can be fixed with an appropriate anti-windup scheme.

2 - Asymetry between heating and cooling. Typically, if you have a heater, you can only "heat" you cannot cool your system. This makes the choice of gain a bit tricky as the cooldown rate is not controllable by your controller. If you have some kind of Peltier cooler, you can both cool down and heat up, but the cooling rate is usually slower.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.