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(); }