% ***************************************************************************
% COPYRIGHT BY DAVE JEWELL AND T.E. MARLIN 1994
% FILNAME : NAME.M
% Version 2.0
% LAST UPDATED : DECEMBER 1994
% DISCRIPTION OF FILE :
% THIS M-FILE IS ACCESSED FROM "twobytwo.m" ALLOWS THE USER TO ENTER THE 
% VARIABLE NAMES, INITIAL CONDITIONS AND BOUNDS
% ***************************************************************************

clc;
while 1
clc;
disp('**********************************************************************')
disp('*                       VARIABLE IDENTIFICATIONS                     *')
disp('**********************************************************************')
disp('WHAT PARAMETER WOULD YOU LIKE TO UPDATE ?')
disp('                                           Present Values')
disp([' 1) Controlled  Variable 1 - Name             ',cv1name])
fprintf(' 2) Controlled  Variable 1 - Initial Value    %-g\n',initcv(1))
disp([' 3) Controlled  Variable 2 - Name             ',cv2name])
fprintf(' 4) Controlled  Variable 2 - Initial Value    %-g\n',initcv(2))
disp([' 5) Manipulated Variable 1 - Name             ',mv1name])
fprintf(' 6) Manipulated Variable 1 - Initial Value    %-g\n',initmv(1))
disp([' 7) Manipulated Variable 2 - Name             ',mv2name])
fprintf(' 8) Manipulated Variable 2 - Inital Value     %-g\n',initmv(2))
disp('  -- BOUNDS ON MANIPULATED VARIABLES (PID only) --')
fprintf(' 9) Manipulated Variable 1 - Upper Bound         %-g\n',contoutmax(1))
fprintf('10) Manipulated Variable 1 - Lower Bound         %-g\n',contoutmin(1))
fprintf('11) Manipulated Variable 2 - Upper Bound         %-g\n',contoutmax(2))
fprintf('12) Manipulated Variable 2 - Lower Bound         %-g\n',contoutmin(2))
disp('13) Previous Menu')
mm = input('PLEASE ENTER A SELECTION : ');
if isempty(mm)==1
    break
end
mm = round(mm);                          % round off selection
if (mm<1) | (mm>13)
    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('Name : ','s');
	if isempty(TEMP) ~= 1
	     cv1name=TEMP;
	else
	     cv1name='CV 1';
	end

elseif mm == 2
TEMP=input('Initial Value : ');
	if isempty(TEMP) ~= 1
	     initcv(1)=TEMP;
	end

elseif mm == 3
TEMP=input('Name : ','s');
	if isempty(TEMP) ~= 1
	     cv2name=TEMP;
	else
	     cv2name='CV 2';
	end
	
elseif mm == 4
TEMP=input('Initial Value : ');
	if isempty(TEMP) ~= 1
	     initcv(2)=TEMP;
	end


elseif mm == 5
TEMP=input('Name : ','s');
	if isempty(TEMP) ~= 1
	     mv1name=TEMP;
	else
	     mv1name='MV 1';
	end

elseif mm == 6
TEMP=input('Initial Value : ');
	if isempty(TEMP) ~= 1
	     initmv(1)=TEMP;
	end

elseif mm == 7
TEMP=input('Name : ','s');
	if isempty(TEMP) ~= 1
	     mv2name=TEMP;
	else
	     mv2name='MV 2';
	end

elseif mm == 8
TEMP=input('Initial Value : ');
	if isempty(TEMP) ~= 1
	     initmv(2)=TEMP;
	end

elseif mm == 9
TEMP=input('MV1 Upper Bound : ');
	if isempty(TEMP) ~= 1
	     contoutmax(1)=TEMP;
	     if contoutmax(1) < contoutmin(1)
		contoutmax(1) = contoutmin(1);
		disp('maximum cannot be less than minimum')
		pause (2);
	     end
	end

elseif mm == 10
TEMP=input('MV1 Lower Bound : ');
	if isempty(TEMP) ~= 1
	     contoutmin(1)=TEMP;
	     if contoutmin(1) > contoutmax(1)
		contoutmin(1) = contoutmax(1);
		disp('minimum cannot be greater than maximum')
		pause (2);
	     end
	end

elseif mm == 11
TEMP=input('MV2 Upper Bound : ');
	if isempty(TEMP) ~= 1
	     contoutmax(2)=TEMP;
	     if contoutmax(2) < contoutmin(2)
		contoutmax(2) = contoutmin(2);
		disp('maximum cannot be less than minimum')
		pause (2);
	     end

	end

elseif mm == 12
TEMP=input('MV2 Lower Bound : ');
	if isempty(TEMP) ~= 1
	     contoutmin(2)=TEMP;
	     if contoutmin(2) > contoutmax(2)
		contoutmin(2) = contoutmax(2);
		disp('minimum cannot be greater than maximum')
		pause (2);
	     end

	end

elseif mm == 13
    return
end     % if
end     % while
