% FILENAME: PBOUND.M
% DONE BY : RENO CIPOLLA
% DATE: NOV/93 
% VERSION: 2.0
% REVISED: JANUARY 1995
% COPYRIGHT 1994-5 T. MARLIN AND R. CIPOLLA  
% This file allows the user to specify the MV bound parameters
% used in calculating the control performance.
% ************************************************************

while 1
  clc
  disp('*************************************************************')
  disp('*                MODIFY MV BOUND PARAMATERS                 *')
  disp('*                                                           *')
  disp('*************************************************************')
  disp('')
  disp('SELECT THE APPROPRIATE MENU ITEM(s)')
  disp('')
  disp('MODIFY...')
  disp('                                                  PRESENT VALUES')
  fprintf('1) Initial Maximum Over (fract. of S-S)          %4.2f\n',maxdev)
  fprintf('2) Bound Time Constant (fract. of FB dyn.)       %4.2f\n',rise)
  fprintf('3) MV Variability (4 sigma) at end of transient  %4.2f\n',mindev)
  disp('4) Return to previous menu')
  disp('')
        
  pbd = input('Enter the desired selection:   ');
  
  if isempty(pbd), break, end   % go back to main menu if ENTER is pressed
      
  pbd = round(pbd);
  if (pbd<1) | (pbd>4)
      disp('')
      disp('Not a valid selection')
      disp('')
      disp('Press ENTER to continue')
      pause;
  end    
  
  if pbd == 1
      junk = input('Enter maximum deviation:  ') ;
      
      if isempty(junk)
          junk=maxdev;
      end

      if junk < 0
       disp('')
       disp(' Must be nonnegative')
       disp('')
       disp(' Press any key to continue')
       pause
       junk=maxdev;
      end
      mvtest=1; cn_t=1; scn_t=1;
      maxdev=junk;

  elseif pbd == 2
      junk = input('Enter time constant:  ') ;
      
      if isempty(junk)
          junk=rise;
      end

      if junk < 0
       disp('')
       disp(' Must be nonnegative')
       disp('')
       disp(' Press any key to continue')
       pause
       junk=rise;
      end
      
      mvtest=1; cn_t=1; scn_t;
      rise=junk;

  elseif pbd == 3
      junk = input('Enter minimum deviation as a % :  ') ;
      
      if isempty(junk)
          junk=mindev;
      end
      
      if junk < 0
       disp('')
       disp(' Must be positive')
       disp('')
       disp(' Press any key to continue')
       pause
       junk=mindev;
      end
      mvtest=1; cn_t=1; scn_t=1;
      mindev=junk;
  else
      break
  end 
  
end 
