function dispsys(PID,LeftMargin)
%DISPLAY

%   Author(s): Rong Chen
%   Copyright 2009-2011 The MathWorks, Inc.

WITH = sprintf('%s%s',LeftMargin,...
   ctrlMsgUtils.message('Control:ltiobject:pidDisplayWith'));
if PID.Ts==0
    StrSampleTime = '';
else
    StrSampleTime = sprintf(', Ts = %.3g',PID.Ts);
end
disp(' ');
switch PID.getType
   case 'P'
      fprintf('%sKp = %.3g\n',LeftMargin,PID.Kp)
   case 'I'
      StrI = ltipack.piddata.utGetStrI(PID.Ts,PID.IFormula);
      disp([LeftMargin blanks(5) StrI(1,:)]);
      disp([LeftMargin 'Ki * ' StrI(2,:)]);
      disp([LeftMargin blanks(5) StrI(3,:)]);
      fprintf('\n%s Ki = %.3g%s\n',WITH,PID.Ki,StrSampleTime)
   case 'PI'
      StrI = ltipack.piddata.utGetStrI(PID.Ts,PID.IFormula);
      disp([LeftMargin blanks(10) StrI(1,:)]);
      disp([LeftMargin 'Kp + Ki * ' StrI(2,:)]);
      disp([LeftMargin blanks(10) StrI(3,:)]);
      fprintf('\n%s Kp = %.3g, Ki = %.3g%s\n',WITH,PID.Kp,PID.Ki,StrSampleTime)
   case 'PD'
      StrD = ltipack.piddata.utGetStrForS(PID.Ts,PID.DFormula);
      disp([LeftMargin blanks(10) StrD(1,:)]);
      disp([LeftMargin 'Kp + Kd * ' StrD(2,:)]);
      disp([LeftMargin blanks(10) StrD(3,:)]);
      fprintf('\n%s Kp = %.3g, Kd = %.3g%s\n',WITH,PID.Kp,PID.Kd,StrSampleTime)
   case 'PDF'
      StrD = ltipack.piddata.utGetStrD_Parallel(PID.Ts,PID.DFormula);
      disp([LeftMargin blanks(10) StrD(1,:)]);
      disp([LeftMargin 'Kp + Kd * ' StrD(2,:)]);
      disp([LeftMargin blanks(10) StrD(3,:)]);
      fprintf('\n%s Kp = %.3g, Kd = %.3g, Tf = %.3g%s\n',...
         WITH,PID.Kp,PID.Kd,PID.Tf,StrSampleTime)
   case 'PID'
      StrI = ltipack.piddata.utGetStrI(PID.Ts,PID.IFormula);
      StrD = ltipack.piddata.utGetStrForS(PID.Ts,PID.DFormula);
      disp([LeftMargin blanks(10) StrI(1,:) blanks(8) StrD(1,:)]);
      disp([LeftMargin 'Kp + Ki * ' StrI(2,:) ' + Kd * ' StrD(2,:)]);
      disp([LeftMargin blanks(10) StrI(3,:) blanks(8) StrD(3,:)]);
      fprintf('\n%s Kp = %.3g, Ki = %.3g, Kd = %.3g%s\n',...
         WITH,PID.Kp,PID.Ki,PID.Kd,StrSampleTime)
   case 'PIDF'
      StrI = ltipack.piddata.utGetStrI(PID.Ts,PID.IFormula);
      StrD = ltipack.piddata.utGetStrD_Parallel(PID.Ts,PID.DFormula);
      disp([LeftMargin blanks(10) StrI(1,:) blanks(8) StrD(1,:)]);
      disp([LeftMargin 'Kp + Ki * ' StrI(2,:) ' + Kd * ' StrD(2,:)]);
      disp([LeftMargin blanks(10) StrI(3,:) blanks(8) StrD(3,:)]);
      fprintf('\n%s Kp = %.3g, Ki = %.3g, Kd = %.3g, Tf = %.3g%s\n',...
         WITH,PID.Kp,PID.Ki,PID.Kd,PID.Tf,StrSampleTime)
end
disp(' ');

