示例#1
0
    /// <summary>
    /// Calculate precise position of the Moon.
    /// </summary>
    /// <returns>
    /// <para>moonRAHour -- Right ascension of Moon (hour part)</para>
    /// <para>moonRAMin -- Right ascension of Moon (minutes part)</para>
    /// <para>moonRASec -- Right ascension of Moon (seconds part)</para>
    /// <para>moonDecDeg -- Declination of Moon (degrees part)</para>
    /// <para>moonDecMin -- Declination of Moon (minutes part)</para>
    /// <para>moonDecSec -- Declination of Moon (seconds part)</para>
    /// <para>earthMoonDistKM -- Distance from Earth to Moon (km)</para>
    /// <para>moonHorParallaxDeg -- Horizontal parallax of Moon (degrees)</para>
    /// </returns>
    public (double moonRAHour, double moonRAMin, double moonRASec, double moonDecDeg, double moonDecMin, double moonDecSec, double earthMoonDistKM, double moonHorParallaxDeg) PrecisePositionOfMoon(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear)
    {
        var daylightSaving = (isDaylightSaving) ? 1 : 0;

        var gdateDay   = PAMacros.LocalCivilTimeGreenwichDay(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear);
        var gdateMonth = PAMacros.LocalCivilTimeGreenwichMonth(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear);
        var gdateYear  = PAMacros.LocalCivilTimeGreenwichYear(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear);

        var moonResult = PAMacros.MoonLongLatHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear);

        var nutationInLongitudeDeg = PAMacros.NutatLong(gdateDay, gdateMonth, gdateYear);
        var correctedLongDeg       = moonResult.moonLongDeg + nutationInLongitudeDeg;
        var earthMoonDistanceKM    = 6378.14 / moonResult.moonHorPara.ToRadians().Sine();
        var moonRAHours1           = PAMacros.DecimalDegreesToDegreeHours(PAMacros.EcRA(correctedLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear));
        var moonDecDeg1            = PAMacros.EcDec(correctedLongDeg, 0, 0, moonResult.moonLatDeg, 0, 0, gdateDay, gdateMonth, gdateYear);

        var moonRAHour         = PAMacros.DecimalHoursHour(moonRAHours1);
        var moonRAMin          = PAMacros.DecimalHoursMinute(moonRAHours1);
        var moonRASec          = PAMacros.DecimalHoursSecond(moonRAHours1);
        var moonDecDeg         = PAMacros.DecimalDegreesDegrees(moonDecDeg1);
        var moonDecMin         = PAMacros.DecimalDegreesMinutes(moonDecDeg1);
        var moonDecSec         = PAMacros.DecimalDegreesSeconds(moonDecDeg1);
        var earthMoonDistKM    = Math.Round(earthMoonDistanceKM, 0);
        var moonHorParallaxDeg = Math.Round(moonResult.moonHorPara, 6);

        return(moonRAHour, moonRAMin, moonRASec, moonDecDeg, moonDecMin, moonDecSec, earthMoonDistKM, moonHorParallaxDeg);
    }