close all
clear all

suffix = 'PTO';   
path = ['./',suffix,'/'];

tether_length = 23; 
PTO_k = 2000;
PTO_b = 14000;

run_num = 1;

%Pierson Moskowitz Spectrum
           H_S = [1 2 3];  %meters
           PER = [6.0 7.5 9.0];  %Seconds
           SPD = [0 0 0];  %meters/sec
           
wave_amp = H_S(run_num)/2;
wave_per = PER(run_num);
wind_spd = SPD(run_num);


results_filenm = [path,'Res-',num2str(tether_length),'l-',num2str(PTO_k),'k-',num2str(wave_amp),'A-',num2str(wave_per),'T-',num2str(wind_spd),'W-',num2str(PTO_b),'b']

cmd = ['load ' results_filenm '.mat'];
eval(cmd); 

cmd = ['load ' results_filenm '-SPEC.mat'];
eval(cmd); 

figure('Position',[89 84  856 1044],'PaperOrientation','portrait','PaperPosition',[0 0 8.5 11]);
subplot(3,1,1)
plot(t,(phi_t(:,40)-phi_t(:,50))*180/pi)
xlabel('time (s)');
ylabel('Tether Angle (degrees)');

subplot(3,1,2)
plot(t,T_t(:,40).*sin(phi_t(:,40)-phi_t(:,50)))
xlabel('time (s)');
ylabel('PTO side loading (lbs)');

subplot(3,1,3)
plot(abs(180*sin(phi_t(:,40)-phi_t(:,50))/pi),T_t(:,40))
xlabel('time (s)');
ylabel('PTO side loading (lbs)');


figure('Position',[89 84  856 1044],'PaperOrientation','portrait','PaperPosition',[0 0 8.5 11]);
subplot(3,1,1)
plot(t,T_t(:,20));


subplot(3,1,2)
plot(t,sqrt((z_t(:,21)-z_t(:,20)).^2+(x_t(:,21)-x_t(:,20)).^2));

subplot(3,1,3)
plot(T_t(:,20),sqrt((z_t(:,21)-z_t(:,20)).^2+(x_t(:,21)-x_t(:,20)).^2));

