close all
clear all


results_path = 'Results\';

name = 'DelMar_hamilton_v1';



  LAYOUT.title = name;
  
  ENV.depth = 100;
  ENV.tf = 330; 
  ENV.ramptime = 30;
  ENV.xwaveamp = 1.5;
  ENV.xwaveperiod = 10;
  ENV.xwavephase = 0;
  ENV.xwind = 8;

  ENV.dynamiclambda = -0.5;

  ENV.currentscale = 1;
  ENV.xcurrent = [0 0.515];
 
  ENV.forcing_type =  'wave-follower'; %'velocity';  % -or- 'wave-follower'
 
  ENV.input_type = 'random';  % regular -or- 'random'

  LAYOUT.config = 2;  %1 = Catenary w/ stretch hose
		      %2 = Catenary w/ EM Chain
		      %3 = Taut w/ stretch hose
              
  if(LAYOUT.config == 2)
     ENV.dt = 0.01;
  else
     ENV.dt = 0.04;
  end 

   filenm = [results_path make_filename(ENV,LAYOUT,name)]



  load([filenm '.mat']);

figure('Position',[1000 246 1028 1252],'PaperType','usletter','PaperOrientation','portrait','PaperPositionMode','auto','PaperPosition',[.5 .5 7.5 10.5]);

subplot(4,2,1)
  plot(x_s,z_s)
  xlabel('m');
  ylabel('m');
  axis equal;
text(0,1.2*max(z),['Del Mar Configuration ' num2str(LAYOUT.config) '     Hs = ' num2str(2*ENV.xwaveamp) ' m   Tp = ' num2str(ENV.xwaveperiod) ' s   Wind = ' num2str(ENV.xwind/.515,3) ' kts    Surface Current = ' num2str(ENV.xcurrent(1,2)/.515) ' kt'])

subplot(4,2,2)
  plot(s,T)
  xlabel('distance along mooring from anchor (m)');
  ylabel('Static Tension (lbs)');
  
subplot(4,2,3:4)
plot(t,T_t(:,end),t,T_t(:,end-2),t,T_t(:,4));
xlabel('time (s)');
ylabel('Tension (lbs)');
legend('Tension Below Buoy','Tension Below ESP','Tension at Release');

at_t = diff(u_t)/(t(2)-t(1));
an_t = diff(v_t)/(t(2)-t(1));

subplot(4,2,5:6)
plot(t,ENV.depth-z_t(:,end-1));
xlabel('time (s)');
ylabel('ESP depth (m)');
legend('ESP depth');

subplot(4,2,7:8)
plot(t(1:end-1),at_t(:,end-2)/9.81,t(1:end-1),an_t(:,end-2)/9.81);
xlabel('time (s)');
ylabel('ESP Acceleration (g''s)');
legend('Tangential Acceleration of ESP','Normal Acceleration of ESP');

print('-dpdf',[filenm '_ResultsSummary.pdf']);