close all
clear all

DataFile = '../April2013DeploymentSummaryData.mat';

load(DataFile);

idx = 1:length(xi);

%Plot figures for mean power versus Hs
figure
[AX,H1,H2] = plotyy(xi(idx),yi_meas(idx),xi(idx),yi_Hs(idx))
%legend(['Mean Power = ' num2str(nanmean(Meas_meanElecPow(36:602)),3) ' W']);
set(gca,'FontSize',14)

set(AX(1),'Xlim',[xi(1)-1 xi(end)+1]);
set(AX(2),'Xlim',[xi(1)-1 xi(end)+1]);

set(AX(1),'Ylim',[0 750]);
set(AX(2),'Ylim',[0 3]);

set(get(AX(1),'Ylabel'),'String','Rectified Power (W)') 
set(get(AX(1),'Ylabel'),'FontSize',14) 
set(AX(1),'FontSize',14)
set(get(AX(2),'Ylabel'),'String','Significant Wave Height (m)') 
set(get(AX(2),'Ylabel'),'FontSize',14) 
set(AX(2),'FontSize',14)
datetick(AX(1),'x','mmm-dd','keeplimits','keepticks') 
set(AX(2),'XTick',[])

print('-dpdf',['Summary_RectifiedPowerAndHs']);
print('-dpng',['Summary_RectifiedPowerAndHs']);

figure
plot(Hs(idx),Meas_meanElecPow(idx),'x')
set(gca,'FontSize',14)
ylabel('Rectified Electrical Power');
xlabel('Significant Wave Height (m)');

print('-dpdf',[PlotDirectory 'RectifiedPowerVsHs']);
print('-dpng',[PlotDirectory 'RectifiedPowerVsHs']);


%Plot figures for Budal percentage versus Hs
figure
[AX,H1,H2] = plotyy(SerialDate(idx),100*Meas_PercentOfBudal(idx),SerialDate(idx),Hs(idx))
set(gca,'FontSize',14)

set(AX(1),'Ylim',[0 14]);
set(AX(2),'Ylim',[0 2]);

set(get(AX(1),'Ylabel'),'String','% of Budal Limit Captured') 
set(get(AX(1),'Ylabel'),'FontSize',14) 
set(AX(1),'FontSize',14)
set(get(AX(2),'Ylabel'),'String','Significant Wave Height (m)') 
set(get(AX(2),'Ylabel'),'FontSize',14) 
set(AX(2),'FontSize',14)
datetick(AX(1),'x','mmm-dd','keeplimits','keepticks') 
set(AX(2),'XTick',[])

print('-dpdf',[PlotDirectory 'BudalPercentageAndHs']);
print('-dpng',[PlotDirectory 'BudalPercentageAndHs']);

figure
plot(Hs(idx),100*Meas_PercentOfBudal(idx),'x')
set(gca,'FontSize',14)
ylabel('% of Budal Limit Captured');
xlabel('Significant Wave Height (m)');

print('-dpdf',[PlotDirectory 'BudalPercentagePowerVsHs']);
print('-dpng',[PlotDirectory 'BudalPercentagePowerVsHs']);



%Plot figures for Ram behavior
figure
[AX,H1,H2] = plotyy(SerialDate(idx),Meas_StdPTOElongation(idx),SerialDate(idx),Hs(idx))
set(gca,'FontSize',14)

set(AX(1),'Ylim',[0 .2]);
set(AX(2),'Ylim',[0 2]);

set(get(AX(1),'Ylabel'),'String','Standard Deviation of Piston Elongation (m)') 
set(get(AX(1),'Ylabel'),'FontSize',14) 
set(AX(1),'FontSize',14)
set(get(AX(2),'Ylabel'),'String','Significant Wave Height (m)') 
set(get(AX(2),'Ylabel'),'FontSize',14) 
set(AX(2),'FontSize',14)
datetick(AX(1),'x','mmm-dd','keeplimits','keepticks') 
set(AX(2),'XTick',[])

print('-dpdf',[PlotDirectory 'StdRamElongationAndHs']);
print('-dpng',[PlotDirectory 'StdRamElongationAndHs']);

figure
plot(Hs(idx),Meas_StdPTOElongation(idx),'x')
set(gca,'FontSize',14)
ylabel('Standard Deviation of Piston Elongation (m)');
xlabel('Significant Wave Height (m)');

print('-dpdf',[PlotDirectory 'StdRamElongationVsHs']);
print('-dpng',[PlotDirectory 'StdRamElongationVsHs']);


%Plot figures for Ram Speed behavior
figure
[AX,H1,H2] = plotyy(SerialDate(idx),Meas_RMSPTOElongationRate(idx),SerialDate(idx),Hs(idx))
set(gca,'FontSize',14)

set(AX(1),'Ylim',[0 .18]);
set(AX(2),'Ylim',[0 2]);

set(get(AX(1),'Ylabel'),'String','RMS average of Piston Elongation Rate (m/s)') 
set(get(AX(1),'Ylabel'),'FontSize',14) 
set(AX(1),'FontSize',14)
set(get(AX(2),'Ylabel'),'String','Significant Wave Height (m)') 
set(get(AX(2),'Ylabel'),'FontSize',14) 
set(AX(2),'FontSize',14)
datetick(AX(1),'x','mmm-dd','keeplimits','keepticks') 
set(AX(2),'XTick',[])

print('-dpdf',[PlotDirectory 'RMSRamElongationRateAndHs']);
print('-dpng',[PlotDirectory 'RMSRamElongationRateAndHs']);


figure
plot(Hs(idx),Meas_StdPTOElongation(idx),'x')
set(gca,'FontSize',14)
ylabel('RMS average of Piston Elongation Rate (m/s)');
xlabel('Significant Wave Height (m)');

print('-dpdf',[PlotDirectory 'RMSRamElongationVsHs']);
print('-dpng',[PlotDirectory 'RMSRamElongationVsHs']);

figure
plot(Meas_StdPTOElongation(idx),Meas_meanElecPow(idx),'x')
set(gca,'FontSize',14)
xlabel('RMS average of Piston Elongation Rate (m/s)');
ylabel('Mean electrical power production (W)');

print('-dpdf',[PlotDirectory 'RMSRamElongationVsPow']);
print('-dpng',[PlotDirectory 'RMSRamElongationVsPow']);
