function [gc kc ti] =  simc_tuning(kp,tp,theta, type)

% ------------------------------------------------------------%
%                                                             %
%        --  Function for Determining SIMC Tuning --          %
%                                                             %
% Determins SIMC tuning parameters for 1st order models       %
%                                                             %
%                       written by: Chriss Grimholt 19/10-10  %
% ----------------------------------------------------------- %
if type == 1
    
    tc = theta;

    kc = (1/kp)*(tp/(tc+theta));

    ti = min(tp,4*(tc+theta));

    gc = controller(1,kc,ti);
    
elseif type == 0
    
        tc = theta;
        
        ti = 4*(tc+theta);
        
        kc = (1/kp)*(tp/(tc+theta));
        
        gc = controller(1,kc,ti);
end

end
