% TITLE: MACTUNE.M % DATE:January 1995 % VERSION: 2.0 % COPYRIGHT: 1993 - 1994, Reno Cipolla and T. Marlin % This is the MAIN PROGRAM for MACTUNE!!! % all MACTUNE functions are initiated vis this M-file % ************************************************************ clear ; clc ; clf ; axis ('auto'); clear global; close all ; % Set all menu variables to global which allows them to be passed from mfile % to mfile. global tau1 tau2 tau3 Kp set deltat dist vp time pv Dyn junk2 rho1 obj distg global tdist D change tset SP t usegrh maxit IAE ISE ITAE tmg boundg violates global cn_t scn_t bound mvtest betaa Kn A useopt td maxdev mindev rise rho chg global epsl p pp bdpos bdneg bd kc ti bgen Xmis vpmis bdmis Kpp ob_j op_ts lim_it global Qp mm theta taulead xi thetad tauleadd xid taud1 taud2 taud3 Kpd x_ ver_sion global c_1 c_2 c_i b_1 b_2 b_i int_kc int_ti o_func le_vel numlev global ss ss1 ss2 ss3 v v1 v2 v3 al_pha save_graph ct_count echo off %initialize process and disturbance vectors for model mismatch. %Kp = zeros(1,3); Kpp=Kp; tau1=Kp; tau2=tau1; tau3=tau2; theta=tau3; thetad=theta; %taud1=tau1; taud2=tau2; taud3=tau3; taulead=taud3; tauleadd=taulead; ml_ver % Initializes version of MATLAB to be used. init_z % call initialization file %if ver_sion == 0 % lim_it =500; % Sets maximum allowable array size. %else % lim_it = 100000; %end while 1 clc disp('************************************************************') disp('* MACTUNE - THE OPTIMAL TUNING TOOL FOR ENGINEERS *') disp('* *') disp('* CREATED BY : RENO CIPOLLA *') disp('* *') disp('* MAIN MENU *') disp('************************************************************') disp('SELECT A MENU ITEM') disp('') disp('1) Load Previously Stored Case ') disp('2) Modify Feedback Process Parameters') disp('3) Modify Disturbance Parameters') disp('4) Modify PID Controller Tuning Constants') disp('5) Define Control Performance Paramaters') disp('6) Perform Dynamic Simulation') disp('7) Run Optimizer ') disp('8) Response Surface ') disp('9) Save Current Case ') disp('10) Plot Results') disp('11) Quit to Matlab') disp('') marlin = input('Please enter your selection: '); marlin = round(marlin); if (marlin < 1) | (marlin>11) disp('') disp('Not a valid selection') disp('') disp('Press ENTER to continue') pause; end if marlin == 1 % Loads saved case filename.mat ld_case elseif marlin == 2 % Process Parameters process1 elseif marlin == 3 % Disturbance Parameters disturb elseif marlin == 4 % Tuning Constants tune elseif marlin == 5 % Control Performance Variables p_meas % previously named perform elseif marlin == 6 % Dynamic Simulations simult1 elseif marlin == 7 % Optimization to find best tuning constants opt1 elseif marlin == 8 % Response Surface resps elseif marlin == 9 % Saves current case in filename.mat sv_case elseif marlin == 10 % Plot of Results if usegrh == 2 disp('') disp('Nothing to plot, run a simulation before using this option') disp('') disp('Press Enter to continue') pause; else save_graph = 0; grph2 end elseif marlin == 11 % Quits main menu break, end end end % end while 1