Skip to content

Commit

Permalink
v1.3.1 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsznhone authored Sep 19, 2024
1 parent 33564d8 commit c462077
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DataConverter/DataConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FastLZMA2Net" Version="0.6.0-beta" />
<PackageReference Include="FastLZMA2Net" Version="1.0.0" />
<PackageReference Include="MemoryPack" Version="1.21.1" />
</ItemGroup>

Expand Down
14 changes: 14 additions & 0 deletions EphemerisGenerator/EphemerisGenerator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\VSOP2013.NET\VSOP2013.NET.csproj" />
</ItemGroup>

</Project>
41 changes: 41 additions & 0 deletions EphemerisGenerator/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Text;
using VSOP2013;
namespace EphemerisGenerator
{
internal class Program
{
static Calculator s_calculator = new Calculator();

static void Main(string[] args)
{
StringBuilder sb = new StringBuilder();
var enddate = new DateTime(2100, 1, 1);
int lineCount = 0;
using (StreamWriter writer = new StreamWriter("./ephemeris.csv",false))
{
writer.WriteLine("body,j2000,a,l,k,h,q,p");
foreach (VSOPBody body in Enum.GetValues(typeof(VSOPBody)))
{
VSOPTime time = new VSOPTime(new DateTime(1900, 1, 1), TimeFrame.TDB);
while (time.TDB < enddate)
{
VSOPResult_ELL result = s_calculator.GetPlanetPosition_Native(body, time);
sb.Clear();
sb.Append((int)body).Append(',').Append(time.J2000).Append(',');
sb.Append(string.Join(", ", result.Variables_ELL));
writer.WriteLine(sb.ToString());
time._dt= time._dt.AddDays(1);
lineCount++;
if (lineCount % 1000==0)
{
Console.WriteLine($"Output {lineCount} lines...");
}
}

}
}
}
}
}
32 changes: 32 additions & 0 deletions VSOP2013.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,78 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataConverter", "DataConver
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NativeAccelerator", "NativeAccelerator\NativeAccelerator.vcxproj", "{1F19706F-2068-4359-A307-FF6620D57100}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EphemerisGenerator", "EphemerisGenerator\EphemerisGenerator.csproj", "{145213D0-2224-4EF8-97C1-B1234DAB6E80}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Debug|Any CPU.ActiveCfg = Debug|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Debug|Any CPU.Build.0 = Debug|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Debug|x64.ActiveCfg = Debug|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Debug|x64.Build.0 = Debug|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Debug|x86.ActiveCfg = Debug|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Debug|x86.Build.0 = Debug|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Release|Any CPU.ActiveCfg = Release|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Release|Any CPU.Build.0 = Release|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Release|x64.ActiveCfg = Release|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Release|x64.Build.0 = Release|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Release|x86.ActiveCfg = Release|x64
{A36BC2BE-D01A-497C-B17A-3B15DA455D9F}.Release|x86.Build.0 = Release|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Debug|Any CPU.ActiveCfg = Debug|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Debug|Any CPU.Build.0 = Debug|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Debug|x64.ActiveCfg = Debug|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Debug|x64.Build.0 = Debug|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Debug|x86.ActiveCfg = Debug|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Debug|x86.Build.0 = Debug|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Release|Any CPU.ActiveCfg = Release|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Release|Any CPU.Build.0 = Release|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Release|x64.ActiveCfg = Release|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Release|x64.Build.0 = Release|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Release|x86.ActiveCfg = Release|x64
{9CC39AF5-6179-4903-8F3C-ED8ACEFE2399}.Release|x86.Build.0 = Release|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Debug|Any CPU.ActiveCfg = Debug|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Debug|Any CPU.Build.0 = Debug|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Debug|x64.ActiveCfg = Debug|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Debug|x64.Build.0 = Debug|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Debug|x86.ActiveCfg = Debug|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Debug|x86.Build.0 = Debug|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Release|Any CPU.ActiveCfg = Release|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Release|Any CPU.Build.0 = Release|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Release|x64.ActiveCfg = Release|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Release|x64.Build.0 = Release|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Release|x86.ActiveCfg = Release|x64
{2A5C5EFE-C49F-436A-9FC1-176AE11E0334}.Release|x86.Build.0 = Release|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Debug|Any CPU.ActiveCfg = Debug|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Debug|Any CPU.Build.0 = Debug|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Debug|x64.ActiveCfg = Debug|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Debug|x64.Build.0 = Debug|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Debug|x86.ActiveCfg = Debug|Win32
{1F19706F-2068-4359-A307-FF6620D57100}.Debug|x86.Build.0 = Debug|Win32
{1F19706F-2068-4359-A307-FF6620D57100}.Release|Any CPU.ActiveCfg = Release|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Release|Any CPU.Build.0 = Release|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Release|x64.ActiveCfg = Release|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Release|x64.Build.0 = Release|x64
{1F19706F-2068-4359-A307-FF6620D57100}.Release|x86.ActiveCfg = Release|Win32
{1F19706F-2068-4359-A307-FF6620D57100}.Release|x86.Build.0 = Release|Win32
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Debug|x64.ActiveCfg = Debug|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Debug|x64.Build.0 = Debug|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Debug|x86.ActiveCfg = Debug|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Debug|x86.Build.0 = Debug|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Release|Any CPU.Build.0 = Release|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Release|x64.ActiveCfg = Release|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Release|x64.Build.0 = Release|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Release|x86.ActiveCfg = Release|Any CPU
{145213D0-2224-4EF8-97C1-B1234DAB6E80}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions VSOP2013.NET/Calculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private double Calculate(VariableTable Table, double JD2000)
result += t[it] * (terms[n].ss * su + terms[n].cc * cu);
}
}
if (Table.Variable == VSOPVariable.A)
if (Table.Variable == VSOPVariable.L)
{
xl = result + _freqpla[(int)Table.Body] * tj;
xl = (xl % Math.Tau + Math.Tau) % Math.Tau;
Expand Down Expand Up @@ -191,7 +191,7 @@ private unsafe double Calculate_Native(VariableTable Table, double JD2000)
Term[] terms = Table.PowerTables[it].Terms;
result += Substitution(Table.PowerTables[it].Terms, terms.Length, tj, t[it]);
}
if (Table.Variable == (VSOPVariable)1)
if (Table.Variable == VSOPVariable.L)
{
xl = result + _freqpla[(int)Table.Body] * tj;
xl = (xl % Math.Tau + Math.Tau) % Math.Tau;
Expand Down
Binary file modified VSOP2013.NET/Resources/NativeAccelerator.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions VSOP2013.NET/VSOP2013.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PlatformTarget>x64</PlatformTarget>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>x64</Platforms>
<Version>1.3.0</Version>
<Version>1.3.1</Version>
<Title>VSOP2013.NET</Title>
<Authors>KingsZNHONE</Authors>
<Description>VSOP was developed and is maintained (updated with the latest data) by the scientists at the Bureau des Longitudes in Paris.
Expand All @@ -31,7 +31,7 @@ VSOP2013, computed the positions of the planets directly at any moment, as well


<ItemGroup>
<PackageReference Include="FastLZMA2Net" Version="0.6.0-beta" />
<PackageReference Include="FastLZMA2Net" Version="1.0.0" />
<PackageReference Include="MemoryPack" Version="1.21.1" />
</ItemGroup>

Expand Down
12 changes: 6 additions & 6 deletions VSOP2013.NET/VSOPTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum TimeFrame

public class VSOPTime
{
private DateTime _dt { get; set; }
public DateTime _dt;

/// <summary>
/// UTC:Coordinated Universal Time
Expand Down Expand Up @@ -38,10 +38,10 @@ public class VSOPTime
public double J2000 => VSOPTime.ToJ2000(TDB);

private static List<Func<DateTime, DateTime>>
UpGradeFuncs = new List<Func<DateTime, DateTime>>(
s_upGradeFuncs = new List<Func<DateTime, DateTime>>(
new Func<DateTime, DateTime>[] { UTCtoTAI, TAItoTT, TTtoTDB });

private static List<Func<DateTime, DateTime>> DownGradeFuncs = new List<Func<DateTime, DateTime>>(
private static List<Func<DateTime, DateTime>> s_downGradeFuncs = new List<Func<DateTime, DateTime>>(
new Func<DateTime, DateTime>[] { TAItoUTC, TTtoTAI, TDBtoTT });

public VSOPTime(DateTime dt, TimeFrame sourceframe)
Expand All @@ -62,12 +62,12 @@ public static DateTime ChangeFrame(DateTime dt, TimeFrame SourceFrame, TimeFrame
{
if (TargetFrame > SourceFrame)
{
dt = UpGradeFuncs[(int)SourceFrame](dt);
dt = s_upGradeFuncs[(int)SourceFrame](dt);
SourceFrame += 1;
}
else if (TargetFrame < SourceFrame)
{
dt = DownGradeFuncs[(int)SourceFrame - 1](dt);
dt = s_downGradeFuncs[(int)SourceFrame - 1](dt);
SourceFrame -= 1;
}
}
Expand Down Expand Up @@ -142,4 +142,4 @@ public static DateTime FromJ2000(double J2000)

#endregion JulianDate Convert
}
}
}

0 comments on commit c462077

Please sign in to comment.