%  MODIFY PROCESS MODEL PARAMETERS 

%  FILENAME: MODEPAR.M 
%  DATE: October 1994
%  VERSION: 02
%  COPYRIGHT 1993, 1994 M.Gretzinger & T.Marlin
%            McMaster University   

% This m-file is called from STABLE.M. It sets up a menu to allow user to
%       modify the process model parameters.

while 1
  clc
  disp('*************************************************************')
  disp('*           MODIFY PROCESS MODEL PARAMETERS                 *')
  disp('*                                                           *')
  disp('*************************************************************')
  disp('')
  disp('SELECT THE APPROPRIATE MENU ITEM')
  disp('')
  disp('MODIFY...')
  disp('                                       PRESENT VALUES')
  fprintf('1) Process Gain, Kp                    %4.4f\n',kp)
  fprintf('2) Dead time, theta                    %4.2f\n',theta)
  fprintf('3) Time Constant, taulead (numerator)  %4.2f\n',taulead)
  fprintf('4) Time Constant, tau1                 %4.2f\n',tau1)
  fprintf('5) Time Constant, tau2                 %4.2f\n',tau2)
  fprintf('6) Time Constant, tau3                 %4.2f\n',tau3)
  fprintf('7) Damping Factor, xi                  %4.2f\n',xi)
  disp('8) Return to main menu')
  disp('')
        
  m1 = input('Please enter the desired selection:   ');
  
  if isempty(m1), break, end
      
  m1 = round(m1);
  if (m1<1) | (m1>8)
      disp('')
      disp('Not a valid selection')
      disp('')
      disp('Press ENTER to continue')
      pause;
  end    
  if m1 == 1
      kp = input('Enter value for process gain, Kp:  ') ;
      if isempty(kp)
          kp = 0 ;
      end
  elseif m1 == 2
      theta = input('Enter value for dead time, theta:  ') ;
      if isempty(theta)
          theta = 0 ;
      end
      if theta < 0
          disp('Illegal entry, theta must be >= 0')
          disp('')
          disp('Press ENTER to continue')
          pause
      end
  elseif m1 == 3
      taulead = input('Enter value for time constant in numerator, taulead:  ') ;
      if isempty(taulead)
          taulead = 0 ;
      end
  elseif m1 == 4
      tau1 = input('Enter value for time constant, tau1:  ') ;
      if isempty(tau1)
         tau1 = 0 ;
      end
  elseif m1 == 5
      tau2 = input('Enter value for time constant, tau2:  ') ;
      if isempty(tau2)
          tau2 = 0 ;
      end
  elseif m1 == 6
      tau3 = input('Enter value for time constant, tau3:  ') ;
      if isempty(tau3)
          tau3 = 0 ;
      end
  elseif m1 == 7
      xi = input('Enter value for damping factor, xi:  ') ;
      if isempty(xi)
          xi = 0 ;
      end
  else
      break
  end        % if m1


end    % while 1 (line 3)

