clear all
close all

dir = 'Batch6Results\';
b = 8000;
ratio = 4;

load 46042_Conditions.mat

mo = 1:12;

load [dir 'Summary_Results_b' num2str(b) '_ratio' num2str(ratio)] 

for i = 1:12
  %Compute number of wave observations cooresponding to bins centered on Hs
  %values,  Extend first bin to zero and extend top bin to 10m.
  n = histc(H_s(find(~(Month-mo(i)))),[0 0.5+Hs(1:end-1,1)' 10]);

  ntot = sum(n);

  Hrs(i,:) = 365*24*n(1:end-1)/ntot;

  Avg_Power(:,i) = PTO_Results'*Hrs(i,:)'/(365*24);
end

figure('Position', [55 100 1175 844],'PaperOrientation','landscape','PaperPosition',[0 0 11 8.5])
set(gca,'FontSize',18);
bar(Avg_Power')
xlabel('Month');
ylabel('Average Power (Watts)');
legend('BuoyA2','BuoyA10','BuoyA20','Location','North');
foo = axis;
foo(2) = 13;
axis(foo);
title(['Flapping\_Foil   Average Power Generated:    ratio = ' num2str(ratio) '    b = ' num2str(b) ' N/m/s']);
print('-dpdf',[dir 'AveragePowerProduction_b' num2str(b) '_ratio' num2str(ratio)]);
print('-dill',[dir 'AveragePowerProduction_b' num2str(b) '_ratio' num2str(ratio)]);
