% DRIVER PROGRAM FOR NONISOTHERMAL CSTR % TITLE: CSTR.M % DATE: November 1994 % VERSION: 04 % COPYRIGHT 1993, 1994 M.Gretzinger & T.Marlin % McMaster University % This is the driver program for the nonisothermal cstr design and stability % analysis and the transient response. It obtains user input prompted % by menus to load and modify base case data, carry out steady state % design calculations (calls SS_PLOT.M), modify controller tuning % and simulation parameters and carry out dynamic simulation (calls % RECDYN.M) % To invoke, type cstr at the Matlab prompt. % (see Marlin's text: example 3.10, 4.8 and Appendix C for derivations) % All files in this program: % CSTR .M -Main program % BASECASE.M -Inputs the file for the base case data % MODBC .M -Modifies the base case data % SS_PLOT .M -Solves the design equations, plots a graph & finds the steady state % CSTR_TUN.M -Menu for controller tuning constants % SIMPAR .M -Menu for simulation parameters % RECDYN .M -Graphs transient response % ********************************************************************** axis('auto') hold off, clc, clf, clear close all baseloaded = 0; while 1 clc disp('************************************************************') disp('* NON-ISOTHERMAL CSTR *') disp('* *') disp('* MAIN MENU *') disp('************************************************************') disp('') disp('SELECT THE APPROPRIATE MENU ITEM') disp('') disp('1) Input Base Case Data') disp('2) Modify Base Case Data') disp('3) Steady-State Design Calculations') disp('4) Modify Controller Tuning Parameters') disp('5) Modify Simulation Parameters') disp('6) Dynamic Simulation') disp('7) Quit to Matlab') disp('') mainmenu = input('Please enter the desired selection: '); mainmenu = round(mainmenu); if (mainmenu<1) | (mainmenu>7) disp('') disp('Not a valid selection') disp('') disp('Press ENTER to continue') pause; end if mainmenu == 1 basecase elseif mainmenu == 2 modbc elseif mainmenu == 3 if baseloaded clc disp('Calculating... Please wait several moments.') disp('') pause(4) disp('When finished viewing graph, press ENTER to view table of results') ss_plot else disp('') disp('No data has not been loaded. Press ENTER to continue.') pause end elseif mainmenu == 4 cstr_tun elseif mainmenu == 5 simpar elseif mainmenu == 6 if baseloaded clc disp('Calculating... Please wait several moments.') disp('') pause(5) disp('When finished viewing graphs, press ENTER to return to main menu') recdyn else disp('') disp('No data has not been loaded. Press ENTER to continue.') pause end elseif mainmenu == 7 break end % if mainmenu (line ) end % end while 1 (line )