Closed ryancoe closed 4 years ago
@zmorrell-sand - Can you create a script and make changes to existing code in order to do the following:
S = bretschneider([],[8,10],0);
RM3_getPow
, make optional arguments for delta_Zmax
and delta_Fmax
(current hardcoded on lines 58 and 59 of RM3_getPow
). These arguments should only be considered when controlType
is set to PS
.delta_Zmax
: pow(ii,1) = RM3_getPow(S,'PS','scalar',1,delta_Zmax);
for delta_Zmax = 1:1:20
delta_Fmax
: pow(ii,2) = RM3_getPow(S,'PS','scalar',1,delta_Fmax);
for delta_Fmax = ?
(to fill in ?, play around with this a bit; can use SNL-WaterPower/WecOptTool_old#19 for guidance)delta_Zmax
and delta_Fmax
increase, you should see the power value asymptote. In fact, the result should asymptote such that at large values of delta_Zmax
and delta_Fmax
, P_lim = pow(end,1) = pow(end,2)
and this should also be roughly equal to RM3_getPow(S,'CC','scalar',1)
(i.e., the PS controller should approach the CC controller when constraints are large)@ryancoe
Here are the graphs of the asymptotic approach of deltaFmax and deltaZmax. I only evaluated deltaFmax from 6 to 14, hence the strange shape.
@zmorrell-sand - Can you please confirm that the PS mode gives the same result now as it did for f5e63405a53894febcfb597ddb1d8fb35cd33051?
@ryancoe
Here are the asymptotic values that are given by the three different functions (RM3_getPow('CC') = bench_cc, RM3_getPow('PS') = asymptotebig, RM3_ps = oldPSCode
)
bench_cc = -5.737286e+06
asymptotebig = -2.737691e+06
oldPSCode = -5.475385e+05
I used 1e10, 1e10 for the large values to check for asymptotic behavior.
@zmorrell-sand - Looks like I introduced a bug to the PS at some point between then and now. Perhaps you can write a script to help find the point at which this changed?
@ryancoe That might be doable. Do we know which value is correct?
Neither... :) Still want to know when it changed
@gbacelli - We may need your input on this.
@ryancoe Here is a screenshot of the various asymptotes that are given by the program, labeled by date. It should be noted that the value output has not changed at the very least since April 15. It should also be noted that in no case has the output of PS == CC.
@gbacelli - Here's an MWE that you can use to debug the PS
S = bretschneider([],[8,10],0);
S.ph = rand(length(S.w),1)* 2 * pi;
bigZ = 1e2;
Fs = logspace(5,15,5);
parfor ii = 1:length(Fs)
pow(ii) = RM3_getPow(S,'PS','scalar',1,bigZ,Fs(ii))
end
%%
CCpow = RM3_getPow(S,'CC','scalar',1);
%%
figure
semilogx(Fs,pow,'.-')
hold on
semilogx(xlim,CCpow*ones(2,1),'r')
grid on
xlabel('F_{max}')
ylabel('P')
legend('PS','CC')
@gbacelli completed this week
@gbacelli has done this before, so more to verify the code, we need to see that pseudo-spectral control approaches complex conjugate control as the limits are expanded.