Like with what we did the Moon phase, the method of calculating the Moon age is the same, for the most part, as finding the Moon’s position.

The only difference is in finding the formula for finding the distance
Distance = (Semi-major axis) * (1 – (ecc * ecc)) / (1 + (ecc * Cos(MM1 + MEC)))
where MM1 and MEC come from the calculation

		public static void CalcMoonDistance(DateTime dDate, DateTime dEpoch, double fMEpochLong, double fMPeriLong, double fMAscNode, double fMIncl, double fMEcc, double fSEpochEclLong, double fSPeriEclLong, double fSEcc, double fMSMA, ref double fMDistance)
		{
			double fN, fSM, fSE, fSLambda;
			double fL, fMM, fMN, fME, fAE, fMEC, fA3, fMM1;
			double fJD1, fJD2, fDays;

			fJD1 = UraniaTime.GetJulianDay(dDate, 0);
			fJD2 = UraniaTime.GetJulianDay(dEpoch, 0);
			fDays = (fJD1 - fJD2);
			fDays += 1;

			fN = (360.0/365.242191) * fDays;
			fN = Trig.PutIn360Deg(fN);
			fSM = fN + fSEpochEclLong - fSPeriEclLong;
			fSM = Trig.PutIn360Deg(fSM);

			fSE = (360.0 / Math.PI) * fSEcc * Math.Sin(Trig.DegToRad(fSM));
			fSLambda = fN + fSE + fSEpochEclLong;

			fL = (13.176396 * fDays) + fMEpochLong;
			fL = Trig.PutIn360Deg(fL);

			fMM = fL - (0.111404 * fDays) - fMPeriLong;
			fMM = Trig.PutIn360Deg(fMM);

			fMN = fMAscNode - (0.0529539 * fDays);
			fMN = Trig.PutIn360Deg(fMN);

			fME = 1.2739 * Trig.Sin((2.0 * (fL - fSLambda)) - fMM);
			fAE = 0.1858 * Trig.Sin(fSM);
			fA3 = 0.37 * Trig.Sin(fSM);

			fMM1 = fMM + fME - fAE + fA3;

			fMEC = 6.2886 * Trig.Sin(fMM1);

			fMDistance = fMSMA * ((1.0 - (fMEcc * fMEcc))/(1.0 + (fMEcc * Trig.Cos(fMM1 + fMEC))));
		}
  • Share/Bookmark

Related posts:

  1. Astronomical calculations in C#: Calculating the Moon phase Once we have Moon’s position, as we did in the...
  2. Astronomical calculations in C#: Finding the position of the Moon Finding the position of the Moon is in many ways...
  3. Astronomical calculations in C#: Finding the distance to a planet The calculation for the distance of the Earth to a...
  4. Astronomical calculations in C#: Calculating the phase of a planet Once we know how to find the position of the...
  5. Astronomical calculations in C#: Finding the parallax of the Moon Parallax, in the case of the Moon, is caused by...

Related posts brought to you by Yet Another Related Posts Plugin.