private Time ConvertAtomicTimeForward(TimeScale newScale) { var currentScale = Scale; var seconds = TotalSeconds; var leapSecond = AryanKernel.GetLeapSecond(); if (currentScale != newScale && currentScale == TimeScale.Utc) { // Convert UTC to TAI. seconds += leapSecond.GetDeltaTAI(Day); currentScale = TimeScale.Tai; } if (currentScale != newScale && currentScale == TimeScale.Tai) { // Convert TAI to TDT. seconds += DeltaTDT; currentScale = TimeScale.Tdt; } if (currentScale != newScale && currentScale == TimeScale.Tdt) { // Convert TDT to TDB. var g = M[0] + M[1] * seconds; seconds += K * Math.Sin(g + EB * Math.Sin(g)); currentScale = TimeScale.Tdb; } if (currentScale != newScale) { throw new ArgumentException(TimeScaleConversionNotSupported); } return(new Time(seconds, newScale)); }
public KernelFixture() { DataPath = Path.GetFullPath( Path.Combine( Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location), @"..\..\..\..\..\data\")); AdditionalDataPath = Path.Combine(DataPath, @"additional\"); AryanKernel.LoadEphemeris(Path.Combine(DataPath, "binary.430")); AryanKernel.LoadLeapSecond(Path.Combine(DataPath, "text.leap")); Ephemeris = AryanKernel.GetEphemeris(); LeapSecond = AryanKernel.GetLeapSecond(); }
public static void InterpolateEphemeris() { var ephemerisPath = Path.Combine(FilePaths.DataPath, "binary.430"); AryanKernel.LoadEphemeris(ephemerisPath); var ephemeris = AryanKernel.GetEphemeris(); var coordinates = ephemeris.Interpolate(2451545.0, EphemerisComponent.Sun); Console.WriteLine("Position of Sun at 2451545.0 is: "); Console.WriteLine($"x = \t {coordinates[0]}"); Console.WriteLine($"y = \t {coordinates[1]}"); Console.WriteLine($"z = \t {coordinates[2]}"); Console.WriteLine("Velocity of Sun at 2451545.0 is: "); Console.WriteLine($"x = \t {coordinates[3]}"); Console.WriteLine($"y = \t {coordinates[4]}"); Console.WriteLine($"z = \t {coordinates[5]}"); Console.ReadLine(); }