%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PURPOSE: Plot items related to the tailcone.
% AUTHOR:  rsm
% DATE:    00/5/20
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

  if exist('dataTC') ~= 1, return, end

  str = [' ',titleStr,' ',myDate];
  PaperPosn = [.5 .5 3.75 2.5];
  FigurePosn = [5 30 815 760];
  i = 0;

%  i = i+1;
%  figure(i)
%  if hardflag ==3, set(gcf,'PaperPosition',PaperPosn), end
%  set(gcf,'position',FigurePosn)
%  clf


  if exist( 'thrFig' ) ~= 1
    thrFig = figure;
  else
    figure(thrFig);
  end
  set( thrFig, 'Name', 'Thruster Plot', 'DeleteFcn', 'clear thrFig' );
  set(gcf,'position',position)

  subplot(2,1,1)
  plot(dataTC(:,1), dataTC(:,propCurrent1));
%  if exist('dataSim')
%    line(dataSim(:,1), dataSim(:,cThrAmps),'color','r');
%    legend('Nav', 'Sim');
%  end
  ylabel('Amps');
  xlabel('Elapsed Time (s)');
  title(['Thruster Current 1',str]);
  grid on;
  zoom on;

%
% Propeller speed is logged in radians/sec.
%
  subplot(2,1,2)
  plot(dataTC(:,1), dataTC(:,propRpm)/rpm2rps);
  if exist('dataSim')
    line(dataSim(:,1), [dataSim(:,sOmega_P)*60/2/pi],'color','r');
    legend('Nav', 'SimCmd');
  end
  ylabel('Rev/Min')
  title(['Propeller Speed',str]);
  xlabel('Elapsed Time (s)');
  grid on;
  zoom on;


  if exist( 'ActFig' ) ~= 1
    ActFig = figure;
    winpos( position(1,:) );
  else
    figure(ActFig);
  end
  set( ActFig, 'Name', 'Tailcone Plot', 'DeleteFcn', 'clear ActFig' );

  subplot(2,1,1)
  plot(dataTC(:,1), dataTC(:,rudderAngle)*r2d );
  if exist('dataDC'), line(dataDC(:,1), dataDC(:,cDeltaR)*r2d,'Color','r');end
  ylabel('Degrees')
  title(['Rudder Angle',str]);
  xlabel('Elapsed Time (s)');
  grid on;
  zoom on;

  subplot(2,1,2)
  plot(dataTC(:,1), -dataTC(:,elevatorAngle)*r2d);
  if exist('dataDC'), line(dataDC(:,1), dataDC(:,cDeltaE)*r2d, 'Color','r');end
  ylabel('Degrees')
  title(['Elevator Angle',str]);
  xlabel('Elapsed Time (s)');
  grid on;
  set( gca, 'ydir', 'reverse' );


