% DRIVER PROGRAM FOR SINGLE LOOP CONTROL SYSTEM ANALYSIS % TITLE: S_LOOP.M (STABLE.M) % DATE: October 1994 % VERSION: 02 % COPYRIGHT 1993 M.Gretzinger & T.Marlin % McMaster University % This program contains the main menu for the single loop control system % analysis. It calls a series of m-file to carry out the user's % selections: FBPAR.M to modify feedback process parameters, DISPAR.M % to modify disturbance parameters, PIDCONST.M to modify PID % controller tuning constants, PLOTPOLE.M to plot poles of closed % loop system, BODEGOL.M to create a bode plot for GOL, BODEGP.M to % create a bode plot for process, BODECL.M to create a bode plot % for closed loop responses and DYNSIM.M to carry out dynamic % simulation of system. % All files in this program: % S_LOOP .M -Main program % FBPAR .M -Menu to modify feedback process parameters % DISTPAR .M -Menu to modify disturbance parameters % PIDCONST.M -Menu to modify PID controller tuning constants % PLOTPOLE.M -plots poles of closed loop system % BODEGOL .M -Menu for GOL(s) % BODEGP .M -Menu for process only Gp(s) % BODECL .M -Menu for process, disturbance and tuning data % DYNSIM .M -Menu for process and tuning data % METAGRAF.M -Saves most recent graph % **************************************************************** axis ('auto') hold off, clc, clf, clear close all if exist('graph.met') delete graph.met end % Initialize variables which appear in the menus of all m-files called % from STABLE.M kp = 1; theta = 0.5 ; taulead = 0 ; tau1 = 0 ; tau2 = 9.5; tau3 = 0. ; xi = 1.0 ; kpd = 1; taudist = 1; kc = 6.8; ti = 3.2 ; td = 0 ; wstart = .01 ; wend = 3.5 ; w1 = .01; w2 = 100; responsetype = 'd' ; wbegin = 1e-7 ; wstop = 100 ; tend = 100; deltat = .20; change = 'd'; while 1 clc disp('************************************************************') disp('* SINGLE LOOP CONTROL SYSTEM ANALYSIS *') disp('* *') disp('* MAIN MENU *') disp('************************************************************') disp('') disp('SELECT THE APPROPRIATE MENU ITEM') disp('') disp('1) Modify Feedback Process Parameters') disp('2) Modify Disturbance Parameters') disp('3) Modify PID Controller Tuning Constants') disp('4) Plot Poles of Closed Loop System') disp('5) Bode Plot for GOL') disp('6) Bode Plot for process, Gp') disp('7) Bode Plot for Closed Loop Responses') disp('8) Dynamic Simulation of System') disp('9) Save most recent graph') disp('0) Quit to Matlab') disp('') mainmenu = input('Please enter the desired selection: '); mainmenu = round(mainmenu); if (mainmenu<0) | (mainmenu>9) disp('') disp('Not a valid selection') disp('') disp('Press ENTER to continue') pause; end if mainmenu == 1 fbpar elseif mainmenu == 2 distpar elseif mainmenu == 3 pidconst elseif mainmenu == 4 if theta > 0 disp('') disp('Dead time exists in process, plotting of poles not possible.') disp('') disp('Press ENTER to continue') pause else plotpole end elseif mainmenu == 5 bodegol elseif mainmenu == 6 bodegp elseif mainmenu == 7 bodecl elseif mainmenu == 8 dynsim elseif mainmenu == 9 metagraf elseif mainmenu == 0 break, end end % if mainmenu (line 63) end % end while 1 (line 32)