% Copyright 1997 Thomas Mc Avoy
% MATLAB routine to bump test loops in TE process.  Bump tests can be carried
% out on cascade setpoints, recycle and agitator, or level setpoints. 
function [kk,d,titl1]=pribmp
kk=-1;
s=' ';
while 1
while 1
	disp(' ')
	disp('SELECT FROM THE FOLLOWING MENU')
	disp('    1.  DISPLAY A LIST OF VARIABLES THAT CAN BE BUMPED')
	disp('    2.  SELECT A VARIABLE TO BUMP')
	k=input(' ');
	if k==1|k==2
		break
	end
end
	if k==1
	disp(' ')
	disp('	LOOP-1: THE D-FEED FLOW SET POINT')
	disp('	LOOP-2: THE E-FEED FLOW SET POINT')
	disp('	LOOP-3: THE A-FEED FLOW SET POINT') 
	disp('	LOOP-4: THE C-FEED FLOW SET POINT')
	disp('	5. COMPRESSOR RECYCLE VALVE')
	disp('	LOOP-6: THE PURGE FLOW SET POINT')
	disp('	LOOP-7: THE SEPARATOR EXIT FLOW SET POINT')
	disp('	LOOP-8: THE PRODUCT FLOW SET POINT')
	disp('	LOOP-9: THE STEAM FLOW SET POINT')
	disp('	LOOP-10: THE REACTOR CW TEMP SET POINT')
	disp('	LOOP-11: THE CONDENSER CW TEMP SET POINT')
	disp('	12. AGITATOR SPEED')
	disp('	13. REACTOR LEVEL SET POINT')
	disp('	14. SEPARATOR LEVEL SET POINT')
	disp('	15. STRIPPER LEVEL SET POINT')
	disp('	16. D/E RATIO SET POINT')
	disp(' ')
	elseif k==2
		while 1
			disp('INPUT NUMBER OF VARIABLE TO BE BUMPED')
			temp=input(' ');
			while (isempty(temp)==1)|temp<1|temp>16
				disp('PLEASE ENTER VARIABLE AGAIN BETWEEN 1&16')
				temp=input(' ');
			end
			kk=temp;
			break
	end
	end
		disp(' ')
		if kk==1
			s=('	D-SET POINT');
		elseif kk==2
			s=('	E-SET POINT');
		elseif kk==3
			s=('	A-SET POINT');
		elseif kk==4
			s=('	C-SET POINT');
		elseif kk==5
			s=('	RECYCLE VALVE');
		elseif kk==6
			s=('	PURGE-SET POINT');
		elseif kk==7
			s=('	SEP EXIT-SET POINT');
		elseif kk==8
			s=('	PRODUCT-SET POINT');
		elseif kk==9
			s=('	STEAM-SET POINT');
		elseif kk==10
			s=('	REACTOR CW TEMP-SET POINT');
		elseif kk==11
			s=('	COND CW TEMP-SET POINT');
		elseif kk==12
			s=('	AGITATOR SPEED');
		elseif kk==13
			s=('	REACTOR LEVEL SET POINT');
		elseif kk==14
			s=('	SEPARATOR LEVEL SET POINT');
		elseif kk==15
			s=('	STRIPPER LEVEL SET POINT');
		elseif kk==16
			s=('	D/E RATIO SET POINT');
		end
		ss=['VARIABLE TO BE BUMPED - ',s];

		if k==2

			disp(ss)
			disp(' ')
			break
		end
	end


loop=0;
while loop==0
	d=input ('INPUT PERCENT (UP TO 5%) PERTURBATION STEP: ');
	while (isempty(d)==1)
		disp('PLEASE ENTER % PERTURBATION (UP TO 5%) AGAIN. ')
		d=input ('INPUT PERCENT (%) PERTURBATION STEP: ');
	end
	if (d>5|d<0)          % Only 5% steps or less allowed
       disp(' ')
       disp('NOT A VALID SELECTION, PERTURBATION TOO LARGE') 
	   disp('PLEASE START OVER')
       disp('PRESS ENTER TO CONTINUE AND INPUT % PERTURBATION')
       pause;
	else;
	d=d/100;
	titl1=sprintf('Bump Percent = %4.1f',100*d);
	titl1=[titl1,'  ',s];
	loop=1;
	end
end






