% FILENAME : CON_PLOT
% DATE : February 1995
% COPYRIGHT 1994-5 by T. Marlin and R. Cipolla
% DEVELOPED BY : RENO CIPOLLA
% VERSION 2.0
% This file allows the user to view the contour plot with a choice of 4 
% different measures of control performance - objective function, IAE, 
% ISE or ITAE.
% ***********************************************************************

if ct_count == 1                       % Change levels with same data set.
v0=zeros(1,numlev); v1=v0; v2=v1; v3=v2;
 for a =1:1:numlev 
  v0(a)= le_vel(a)*nom;
  v1(a)= le_vel(a)*nom1;
  v2(a)= le_vel(a)*nom2;
  v3(a)= le_vel(a)*nom3;
 end
end  

B=[kc ti];
if o_func == 0 | o_func > 3
  ss_T = ss; v_T = v0; 
elseif o_func == 1
  ss_T = ss1; v_T = v1;
elseif o_func == 2
  ss_T = ss2;  v_T = v2;
elseif o_func == 3
  ss_T = ss3;  v_T = v3;
end

%ssT = flipud(ssT);

clg
contour(b_1:b_i:b_2,c_1:c_i:c_2,ss_T,v_T);
hold on;
plot(B(2),B(1),'+g');
title('Contour Plot (Levels as a % of nominal control performance)')
xlabel(' Integral Time, Ti ')
ylabel(' Controller Gain, Kc')
%text(.4,.8,' Levels of Control Performance','sc');
hold off;

figure (1)
pause
close all

  if save_graph == 1
   pause(3)
   clc
   graph_nm = input('Enter filename (no extension) to be saved: ','s');
   if isempty(graph_nm), break; end
   eval(['meta ',graph_nm]);
   disp('')
   disp('')
   disp('')
   disp('')
   disp([' SAVING TO.... ',num2str(graph_nm),'.met'])
   pause(3)
  end
save_graph=0;
break



