%  SIMULATION PARAMETERS 

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

% This m-file is called by CSTR.M. It sets up a menu to allow the user to 
%       modify the simulation parameters for the CSTR.

      
selection5 = 1;

if baseloaded ~= 1
    disp('')
    disp('No data has not been loaded. Press ENTER to continue.')
    pause
    selection5 = 0;
end

while selection5
   clc
   disp('*************************************************************')
   disp('*              SIMULATION PARAMETERS                        *')
   disp('*                                                           *')
   disp('*************************************************************')
   disp('')
   disp('SELECT THE APPROPRIATE MENU ITEM')
   disp('')
   disp('MODIFY...')
   disp('                                               PRESENT VALUES')
   fprintf('1) Initial Concentration, Ca_init              %4.2f   kg-moles/m^3\n',cainit)
   fprintf('2) Initial Temperature, Tinit                  %4.2f K\n',tinit)
   fprintf('3) Magnitude of Inlet Temperature Disturbance  %4.2f   K\n',tindist)
   disp('4) Return to main menu')
   disp('')
        
   m5 = input('Please enter the desired selection:   ');
        
   if isempty(m5), break, end
        
   m5 = round(m5);
   if (m5<1) | (m5>4)
       disp('')
       disp('Not a valid selection, press ENTER to continue')
       pause;
   end    

   if m5 == 1
       cainith = input('Enter new value for Initial Concentration, Ca_init:  ');
       if isempty(cainith) 
              cainit = cainit; 
       else       
              cainit = cainith;
       end
   
   elseif m5 == 2
       tinith = input('Enter new value for Initial Temperature, Tinit:  ');
       if isempty(tinith) 
              tinit = tinit; 
       else       
              tinit = tinith;
       end
   
   elseif m5 == 3
       tindisth = input('Enter new value for Inlet Temperature Disturbance Magnitude:  ');
       if isempty(tindisth) 
              tindist = tindist; 
       else       
              tindist = tindisth;
       end
   
   elseif m5 == 4
       break
   end    % if m5
        
end    % while selection5 (line )
