function [Tc,e] = Controller_PI(T,Ts,u0,y,Kc,taui,min,max)
%PI controller with input saturation

e=T-Ts; eint=y;
u = u0 + Kc*e + (Kc/taui)*eint;
Tc = u;


if Tc<min
    Tc=min;
elseif Tc>max
    Tc=max;
end