Created
June 15, 2023 03:05
-
-
Save pukpr/91241973cb825abd663484a884c8a2d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Tide_Sum (Template : in Data_Pairs; | |
Constituents : in Long_Periods_Amp_Phase; | |
Periods : in Long_Periods; | |
Ref_Time : in Long_Float := 0.0; | |
Scaling : in Long_Float := 1.0; | |
Cos_Phase : in Boolean := True; | |
Year_Len : in Long_Float := Year_Length; | |
Integ: in Long_Float := 0.0 | |
) return Data_Pairs is | |
Pi : Long_Float := Ada.Numerics.Pi; | |
Time : Long_Float; | |
Res : Data_Pairs := Template; | |
Yr : Long_Float := Year_Len; | |
Drac : Long_Float := 2.0*pi*Yr/Draconic; | |
Trop : Long_Float := 2.0*pi*Yr/Tropical; | |
Anom : Long_Float := 2.0*pi*Yr/Anomalistic; | |
Nodal : Long_Float := Drac-Trop; | |
Peri : Long_Float := (Trop-Anom)/2.0; | |
K1 : Long_Float := Constituents(1).Value; | |
K2 : Long_Float := Constituents(2).Value; | |
TA : Long_Float := Constituents(3).Value; | |
TP : Long_Float := Constituents(4).Value; | |
AA : Long_Float := Constituents(5).Value; | |
AP : Long_Float := Constituents(6).Value; | |
T2A : Long_Float := Constituents(7).Value; | |
T2P : Long_Float := Constituents(8).Value; | |
SA : Long_Float := Constituents(9).Value; | |
SP : Long_Float := Constituents(10).Value; | |
A2A : Long_Float := Constituents(11).Value; | |
SYA : Long_Float := Constituents(12).Value; | |
SYP : Long_Float := Constituents(13).Value; | |
EA : Long_Float := Constituents(14).Value; | |
EP : Long_Float := Constituents(15).Value; | |
E2A : Long_Float := Constituents(16).Value; | |
YA : Long_Float := Constituents(17).Value; | |
YP : Long_Float := Constituents(18).Value; | |
Q1 : Long_Float := Constituents(19).Value; | |
Q2 : Long_Float := Constituents(20).Value; | |
DA : Long_Float := Constituents(21).Value; | |
DP : Long_Float := Constituents(22).Value; | |
K3 : Long_Float := Constituents(23).Value; | |
NA : Long_Float := Constituents(24).Value; | |
NP : Long_Float := Constituents(25).Value; | |
PA : Long_Float := Constituents(26).Value; | |
PP : Long_Float := Constituents(27).Value; | |
N2A : Long_Float := Constituents(28).Value; | |
N2P : Long_Float := Constituents(29).Value; | |
function Ds is new gsin (DA, 2.0*Drac, DP); -- = A*sin(2*Drac*(x+p)); | |
function Ts is new gsin (TA, 2.0*Trop, TP); -- = A*sin(2*Trop*(x+p)) | |
function T2s is new gsin (T2A, Trop+Drac, T2P); -- = A*sin((Trop+Drac)*(x+p)) | |
function As is new gsin (AA, Anom, AP); -- = A*sin(Anom*(x+p)) | |
function Semi is new gsin(SA, 4.0*Pi, SP); -- = A*sin(4*pi*(x+p)) | |
function Evect is new gsin(EA, 2.0*Trop-Anom-4.0*Pi, EP); -- = A*sin((2*Trop-Anom-4*pi)*(x+p)) | |
function Syn is new gsin(SYA, 2.0*Trop-4.0*Pi, SYP); -- = A*sin((2*Trop-4*pi)*(x+p)) | |
function Annual is new gsin(YA, 2.0*Pi, YP); -- = A*cos(2*pi*(x+p)) | |
function N is new gsin (NA, Nodal, NP); -- = A*sin(Nodal*(x+p)) | |
function N2 is new gsin (N2A, Nodal/2.0, N2P); -- = A*sin(Nodal/2.0*(x+p)) | |
function P is new gsin (PA, Peri, PP); -- = A*sin(Peri*(x+p)) | |
-- # Define the model | |
function Model (Time : in Long_Float) return Long_Float is | |
MM : Long_Float := As(Time); | |
Msm : Long_Float := Evect(Time); | |
Mfp : Long_Float := T2s(Time + A2A*Mm + E2A*Msm); | |
Mf : Long_Float := Ts(Time + A2A*Mm + E2A*Msm); | |
Mfd : Long_Float := Ds(Time + A2A*Mm + E2A*Msm); | |
Msf : Long_Float := Syn(Time + Q1*Mf + Q2*Mfp); | |
begin | |
return Mf + Mfp + Mfd + Semi(Time) + Annual(Time) + Msm + Msf + N(Time) + N2(Time) + P(Time) + | |
As(Time + K1*(Mf+Mfp+Mfd) + K2*Mm + K3*Msf); | |
end Model; | |
begin | |
for I in Template'Range loop | |
Time := Template(I).Date - Ref_Time; | |
declare | |
TF : Long_Float := 0.0; | |
begin | |
Tf := Model (Time); | |
Res(I) := (Time, Scaling * TF); | |
end; | |
end loop; | |
return Res; | |
end Tide_Sum; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using a sin^N delta of power N= 15
PS C:\Users\pp\github\pukpr\GEM2\GeoEnergyMath\eqlong> ......\GeoEnergyMath\io\backup.bat darwin_constituents2crossvalid3bSINcomplement
Delta variant
2390 ......\GeoEnergyMath\io\restore.bat darwin_constituents2crossvalid3b
2392 ......\GeoEnergyMath\io\restore.bat darwin_constituents2crossvalid3b
2393 $env:CC_START="1880"
2394 $env:CC_END="1932"
2400 ......\GeoEnergyMath\io\backup.bat darwin_constituents2crossvalid3bSIN
2404 ......\GeoEnergyMath\io\backup.bat darwin_constituents2crossvalid3bSINhigh
2406 ......\GeoEnergyMath\io\backup.bat darwin_constituents2crossvalid3bSINhigh-pt8
2408 ......\GeoEnergyMath\io\backup.bat darwin_constituents2crossvalid3bSINhigh-pt85worse
2409 ......\GeoEnergyMath\io\restore.bat darwin_constituents2crossvalid3bSIN
2410 $env:CC_END="2015"
2411 $env:CC_START="1935"
2414 ......\GeoEnergyMath\io\backup.bat darwin_constituents2crossvalid3bSINcomplement
2415 .\enso_opt.exe
complement
compare to delta version
![image](https://user-images.githubusercontent.com/2855758/247016799-6f866d7d-61de-46aa-9ae1-36a4a5a59c79.png)
PS C:\Users\pp\github\pukpr\GEM2\GeoEnergyMath\eqlong> ......\GeoEnergyMath\io\restore.bat darwin_constituents2crossvalid3b
PS C:\Users\pp\github\pukpr\GEM2\GeoEnergyMath\eqlong> $env:CC_START="1880"
PS C:\Users\pp\github\pukpr\GEM2\GeoEnergyMath\eqlong> $env:CC_END="1932"