public void Subtract() { JulianDate jd = new JulianDate(new DateTime(2003, 1, 1)); double JD = jd.ToDouble() - 1.5; Assert.That(jd - JD, Is.EqualTo(1.5)); }
public void Conversion() { JulianDate jd = new JulianDate(new DateTime(2003, 1, 1)); double JD = jd.ToDouble(); Assert.AreEqual(JD, 2452640.5); }
public void AddSecond() { JulianDate jd = new JulianDate(new DateTime(2003, 1, 1)); JulianDate jd1 = new JulianDate(jd); jd1.AddSeconds(24); Assert.That(jd1 - jd, Is.EqualTo(24.0 / (3600 * 24)).Within(0.00000000000001)); DateTime dt = jd1.ToDateTime(); Assert.That(dt.Second, Is.EqualTo(24)); }
public double Subtract(JulianDate aJD) { _Day -= aJD._Day; _Fraction -= aJD._Fraction; if (_Fraction < 0.0) { _Fraction += 1.0; _Day -= 1; } return(ToDouble()); }
public void TestEquinox() { JulianDate jd = new JulianDate(new DateTime(2003, 1, 1)); Nutation nut = new Nutation(jd); Assert.That(nut.EquationOfEquinox, Is.EqualTo(-0.9381).Within(0.00005)); Assert.That(nut.DeltaPsi, Is.EqualTo(-15.340).Within(0.0005)); Assert.That(nut.DeltaEpsilon, Is.EqualTo(3.024).Within(0.0005)); Assert.That(nut.Epsilon.Seconds, Is.EqualTo(23.068)); jd = new JulianDate(new DateTime(2003, 2, 1)); nut = new Nutation(jd); Assert.That(nut.EquationOfEquinox, Is.EqualTo(-0.8444).Within(0.00005)); Assert.That(nut.DeltaPsi, Is.EqualTo(-13.808).Within(0.0005)); Assert.That(nut.DeltaEpsilon, Is.EqualTo(3.782).Within(0.0005)); //Assert.That(nut.Epsilon, Is.EqualTo(Angle.FromDegrees(23, 26, 23.068))); }
public Nutation(JulianDate aJD) { _d = aJD - JulianDate.J2000; _T = _d / 36525; Angle c0 = Angle.FromDegrees(134, 57, 46.733); Angle c1 = Angle.FromDegrees(1325 * 360) + Angle.FromDegrees(198, 52, 2.633); Angle c2 = Angle.FromDegrees(0, 0, 31.310); Angle c3 = Angle.FromDegrees(0, 0, 0.064); Angle l = TimeSeries(_T, c0, c1, c2, c3); c0 = Angle.FromDegrees(357, 31, 39.804); c1 = Angle.FromDegrees(99 * 360) + Angle.FromDegrees(359, 3, 1.224); c2 = -1 * Angle.FromDegrees(0, 0, 0.577); c3 = -1 * Angle.FromDegrees(0, 0, 0.012); Angle lp = TimeSeries(_T, c0, c1, c2, c3); c0 = Angle.FromDegrees(93, 16, 18.877); c1 = Angle.FromDegrees(1342 * 360) + Angle.FromDegrees(82, 1, 3.137); c2 = -1 * Angle.FromDegrees(0, 0, 13.257); c3 = Angle.FromDegrees(0, 0, 0.011); Angle F = TimeSeries(_T, c0, c1, c2, c3); c0 = Angle.FromDegrees(297, 51, 1.307); c1 = Angle.FromDegrees(1236 * 360) + Angle.FromDegrees(307, 6, 41.328); c2 = -1 * Angle.FromDegrees(0, 0, 6.891); c3 = Angle.FromDegrees(0, 0, 0.019); Angle D = TimeSeries(_T, c0, c1, c2, c3); c0 = Angle.FromDegrees(125, 2, 40.280); c1 = -1 * (Angle.FromDegrees(5 * 360) + Angle.FromDegrees(134, 8, 10.539)); c2 = Angle.FromDegrees(0, 0, 7.455); c3 = Angle.FromDegrees(0, 0, 0.008); Angle Omega = TimeSeries(_T, c0, c1, c2, c3); Angle[] FA = new Angle[] { l, lp, F, D, Omega }; Angle _Epsilon0 = TimeSeries(_T, Angle.FromDegrees(23, 26, 21.488), -1 * Angle.FromDegrees(0, 0, 46.8150), -1 * Angle.FromDegrees(0, 0, 0.00059), Angle.FromDegrees(0, 0, 0.001813)); double deltaPsi = 0.0; double deltaEpsilon = 0.0; for (int i = 0; i < coeffList.Length; i++) { Angle Ai = new Angle(); coeff coefficient = coeffList[i]; double Si = (coefficient.S[0] + coefficient.S[1] * _T) / 10000.0; double Ci = (coefficient.C[0] + coefficient.C[1] * _T) / 10000.0; for (int j = 0; j < FA.Length; j++) { Ai += FA[j] * coeffList[i].coefficients[j]; } deltaPsi += Si * Angle.Sin(Ai); deltaEpsilon += Ci * Angle.Cos(Ai); } //for (int i = 0; i < correctionList.Length; i++) //{ // Angle Ai = new Angle(); // correction corr = correctionList[i]; // for (int j = 0; j < FA.Length; j++) // { // Ai += FA[j] * corr.coefficients[j]; // } // deltaPsi += corr.LS * Angle.Sin(Ai) + corr.LC * Angle.Cos(Ai); // deltaEpsilon += corr.OC * Angle.Cos(Ai) + corr.OS * Angle.Sin(Ai); //} _Epsilon = _Epsilon0 + Angle.FromDegrees(0, 0, deltaEpsilon); _EE = (deltaPsi * Angle.Cos(Epsilon) + 0.00264 * Angle.Sin(Omega) + 0.000063 * Angle.Sin(2.0 * Omega)) / 15.0; _DeltaPsi = deltaPsi; _DeltaEpsilon = deltaEpsilon; }
public double BesselianCentury(JulianDate aJD) { double days = this - aJD; return(days / 36525); }
public JulianDate(JulianDate aJD) { _Day = aJD._Day; _Fraction = aJD._Fraction; }
static void Main(string[] args) { JulianDate jd = new JulianDate(new DateTime(2003, 1, 1, 12, 42, 10, 500)); DateTime result = jd.ToDateTime(); }
private static double JdToGMST(JulianDate aJD) { double Tu = aJD.BesselianCentury(JulianDate.J2000); double gmst = 24110.54841 + (8640184.812866 + (0.093104 - 6.2e-6 * Tu) * Tu) * Tu; return gmst; }
public double Subtract(JulianDate aJD) { _Day -= aJD._Day; _Fraction -= aJD._Fraction; if (_Fraction < 0.0) { _Fraction += 1.0; _Day -= 1; } return ToDouble(); }
public double BesselianCentury(JulianDate aJD) { double days = this - aJD; return days / 36525; }
public void ReverseConvert() { DateTime dt = new DateTime(2003, 3, 5, 13, 22, 4); JulianDate jd = new JulianDate(dt); Assert.That(dt, Is.EqualTo(jd.ToDateTime())); }
public void ImplicitToDouble() { JulianDate jd = new JulianDate(new DateTime(2003, 1, 1)); double jdd = jd; Assert.That(jdd, Is.EqualTo(jd.ToDouble())); }