clear all
close all
rho = 1025;
g = 9.81;
dt = .025;

Period = 6:2:18;
damping_coeff = 4000:2000:22000;

Power = cell(length(Period),length(damping_coeff));


dir = './MonoResults/';
Amp = .5;
%i = 0;
%for Amp = 1 %:3 %Wave amplitude for monochromatic case
%i = i+1;
    
j = 0;
for T = Period 
j = j+1    
k = 0;
for b = damping_coeff
    k = k+1;
    load([dir 'MonoResults_A' num2str(Amp) '_T' num2str(T) '_b' num2str(b) '.mat']);
    ['T = ' num2str(T)]
    ['b = ' num2str(b)]
    Power{j,k} = DampingPower;
    time{j,k} = dt:dt:12*T;
    Pmean(j,k) = mean(DampingPower(end-T/dt:end))
    
end

end

%end


V = 6;
c0 = rho*pi*g/4;
H = 2*Amp;
Pb = c0*V*H*(Period.^-1);

figure('Position',[196  79  1004  598],'PaperOrientation', 'landscape','PaperPositionMode','manual','PaperType','usletter','PaperPosition',[0 0 11 8.5]); 
plot(Period, Pmean);
%plot(Period, max(Pmean,[],2));
xlabel('Wave Period (s)');
ylabel('Average Power (W)');
title('Predicted power output for 6 m^3 point absorber in heave.  Wave amp = 1m');
%print('-dpdf','MaxPowerOutput');

figure('Position',[196  79  1004  598],'PaperOrientation', 'landscape','PaperPositionMode','manual','PaperType','usletter','PaperPosition',[0 0 11 8.5]); 
plot(Period, max(Pmean,[],2),Period,Pb);
%plot(Period, max(Pmean,[],2),Period,Pb);
xlabel('Wave Period (s)');
ylabel('Average Power (W)');
title('Predicted power output and maximum possible exctraction for 6 m^3 point absorber in heave.  Wave amp = 1m');
%print('-dpdf','MaxPowerOutputVsLimit');


figure('Position',[196  79  1004  598],'PaperOrientation', 'landscape','PaperPositionMode','manual','PaperType','usletter','PaperPosition',[0 0 11 8.5]); 
plot(Period,100*max(Pmean,[],2)./Pb')
xlabel('Wave Period (s)');
ylabel('Percentage');
title('Percentage achieved of maximum possible exctraction for 6 m^3 point absorber in heave.  Wave amp = 1m');
%print('-dpdf','MaxPowerOutputPercentage');
