% ************************************************************************** % CASCADE-FEEDFORWARD CONTROL SIMULATOR % COPYRIGHT (C) 1994, T.E. MARLIN % % FILENAME : CFFNAME.M % WRITTEN BY : F.BOUDREAU % VERSION : 2.0 % LAST UPDATED : NOVEMBER 1994 % DESCRIPTION OF FILE : % MENU FOR VARIABLES NAMES, INITIAL VALUES, BOUNDS. % IF 'RETURN' ONLY IS PRESSED INSTEAD OF ENTERING A NEW VARIABLE % NAME, A DEFAULT NAME IS ASSIGNED. THESE DEFAULTS ARE DEFINED % IN THIS PROGRAM (E.G. CV1, MV). % ALL FILES IN THIS PACKAGE : % CFF .M - MAIN MENU AND ENTRY POINT % CFFDAT .M - EXTERNAL DATA FILE % CFFGRAPH.M - PLOTS SIMULATION RESULTS % CFFM1 .M - MENU FOR PROCESS T.F. EDITING % CFFM2 .M - MENU FOR PID TUNING % CFFM3 .M - MENU FOR DISTURBANCE T.F. EDITING % CFFMFF .M - FEEDFORWARD CONTROLLER MENU % CFFMSIM .M - SIMULATION OPTIONS MENU % CFFNAME .M - MENU FOR VARIABLES NAMES, INITIAL VALUES, BOUNDS % CFFSIM .M - EXECUTES SIMULATION % ************************************************************************** while 1 clc; fprintf('**********************************************************************\n') fprintf('* VARIABLE IDENTIFICATIONS *\n') fprintf('**********************************************************************\n\n') fprintf('WHAT PARAMETER WOULD YOU LIKE TO UPDATE ?\n') fprintf(' Present Values\n') disp([' 1) Primary Controlled Var. - Name ',Y1nam]) fprintf(' 2) Primary Controlled Var. - Initial Value %-g\n',Yinit(1)) disp([' 3) Secondary Controlled Var. - Name ',Y2nam]) fprintf(' 4) Secondary Controlled Var. - Initial Value %-g\n',Yinit(2)) disp([' 5) Manipulated Variable - Name ',MVnam]) fprintf(' 6) Manipulated Variable - Initial Value %-g\n',MVinit) disp([' 7) Primary Loop Disturbance - Name ',D1nam]) fprintf(' 8) Primary Loop Disturbance - Initial Value %-g\n',Dinit(1)) disp([' 9) Secondary Loop Disturbance - Name ',D2nam]) fprintf('10) Secondary Loop Disturbance - Initial Value %-g\n',Dinit(2)) fprintf(' -- BOUNDS ON CONTROLLER OUTPUTS --\n') fprintf('11) PriContr Out/ SecContr SP - Upper Bound %-g\n',maxC(1)) fprintf('12) PriContr Out/ SecContr SP - Lower Bound %-g\n',minC(1)) fprintf('13) Final Element - Upper Bound %-g\n',maxC(2)) fprintf('14) Final Element - Lower Bound %-g\n',minC(2)) fprintf('15) Quit to Main Menu\n') mm = input('PLEASE ENTER A SELECTION : '); if isempty(mm)==1 break end mm = round(mm); % round off selection if (mm<1 | mm>15) disp('') % selection validation disp('NOT A VALID SELECTION') disp('PRESS ENTER TO CONTINUE') pause; end % A SERIES OF PROMPTS FOR OPTIONS if mm == 1 temp = input('Primary Controlled Variable Name : ','s'); if isempty(temp) ~= 1 Y1nam=temp; else Y1nam='CV1'; end elseif mm == 2 temp = input('Primary Controlled Variable Initial Value : '); if isempty(temp) ~= 1 Yinit(1)=temp; end elseif mm == 3 temp = input('Secondary Controlled Variable Name : ','s'); if isempty(temp) ~= 1 Y2nam=temp; else Y2nam='CV2'; end elseif mm == 4 temp = input('Secondary Controlled Variable Initial Value : '); if isempty(temp) ~= 1 Yinit(2)=temp; end elseif mm == 5 temp = input('Manipulated Variable Name : ','s'); if isempty(temp) ~= 1 MVnam=temp; else MVnam='MV'; end elseif mm == 6 temp = input('Manipulated Variable Initial Value : '); if isempty(temp) ~= 1 MVinit = temp; end elseif mm == 7 temp = input('Primary Loop Disturbance Name : ','s'); if isempty(temp) ~= 1 D1nam = temp; else D1nam = 'D1'; end elseif mm == 8 temp = input('Primary Loop Disturbance Initial Value : '); if isempty(temp) ~= 1 Dinit(1) = temp; end elseif mm == 9 temp = input('Secondary Loop Disturbance Name : ','s'); if isempty(temp) ~= 1 D2nam = temp; else D2nam = 'D2'; end elseif mm == 10 temp = input('Secondary Loop Disturbance Initial Value : '); if isempty(temp) ~= 1 Dinit(2) = temp; end elseif mm == 11 temp=input('Upper Bound : '); if isempty(temp) ~= 1 if (temp) > minC(1) maxC(1)=temp; else disp('upper bound not greater than lower bound') disp('please reenter') pause (3) end end elseif mm == 12 temp=input('Lower Bound : '); if isempty(temp) ~= 1 if (temp) < maxC(1) minC(1)=temp; else disp('lower bound not less than upper bound') disp('please reenter') pause (3) end end elseif mm == 13 temp=input('Upper Bound : '); if isempty(temp) ~= 1 if (temp) > minC(2) maxC(2)=temp; else disp('upper bound not greater than lower bound') disp('please reenter') pause (3) end end elseif mm == 14 temp=input('Lower Bound : '); if isempty(temp) ~= 1 if (temp) < maxC(2) minC(2)=temp; else disp('lower bound not less than upper bound') disp('please reenter') pause (3) end end elseif mm == 15 return end % if end % while