public static double SummerSolstice(int Year)
    {
        //calculate the approximate date
        double JDE = 0;

        if (Year <= 1000)
        {
            double Y        = Year / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 1721233.25401 + 365241.72562 * Y - 0.05323 * Ysquared + 0.00907 * Ycubed + 0.00025 * Y4;
        }
        else
        {
            double Y        = (Year - 2000) / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 2451716.56767 + 365241.62603 * Y + 0.00325 * Ysquared + 0.00888 * Ycubed - 0.00030 * Y4;
        }

        double Correction;

        do
        {
            double SunLongitude = CAASun.ApparentEclipticLongitude(JDE);
            Correction = 58 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(90 - SunLongitude));
            JDE       += Correction;
        }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second

        return(JDE);
    }
//Static methods

    //////////////////////////////// Implementation ///////////////////////////////

    public static double SpringEquinox(int Year)
    {
        //calculate the approximate date
        double JDE = 0;

        if (Year <= 1000)
        {
            double Y        = Year / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 1721139.29189 + 365242.13740 * Y + 0.06134 * Ysquared + 0.00111 * Ycubed - 0.00071 * Y4;
        }
        else
        {
            double Y        = (Year - 2000) / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 2451623.80984 + 365242.37404 * Y + 0.05169 * Ysquared - 0.00411 * Ycubed - 0.00057 * Y4;
        }

        double Correction;

        do
        {
            double SunLongitude = CAASun.ApparentEclipticLongitude(JDE);
            Correction = 58 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(-SunLongitude));
            JDE       += Correction;
        }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second

        return(JDE);
    }
    public static double WinterSolstice(int Year)
    {
        //calculate the approximate date
        double JDE = 0;

        if (Year <= 1000)
        {
            double Y        = Year / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 1721414.39987 + 365242.88257 * Y - 0.00769 * Ysquared - 0.00933 * Ycubed - 0.00006 * Y4;
        }
        else
        {
            double Y        = (Year - 2000) / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 2451900.05952 + 365242.74049 * Y - 0.06223 * Ysquared - 0.00823 * Ycubed + 0.00032 * Y4;
        }

        double Correction;

        do
        {
            double SunLongitude = CAASun.ApparentEclipticLongitude(JDE);
            Correction = 58 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(270 - SunLongitude));
            JDE       += Correction;
        }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second

        return(JDE);
    }
    public static double AutumnEquinox(int Year)
    {
        //calculate the approximate date
        double JDE = 0;

        if (Year <= 1000)
        {
            double Y        = Year / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 1721325.70455 + 365242.49558 * Y - 0.11677 * Ysquared - 0.00297 * Ycubed + 0.00074 * Y4;
        }
        else
        {
            double Y        = (Year - 2000) / 1000.0;
            double Ysquared = Y * Y;
            double Ycubed   = Ysquared * Y;
            double Y4       = Ycubed * Y;
            JDE = 2451810.21715 + 365242.01767 * Y - 0.11575 * Ysquared + 0.00337 * Ycubed + 0.00078 * Y4;
        }

        double Correction;

        do
        {
            double SunLongitude = CAASun.ApparentEclipticLongitude(JDE);
            Correction = 58 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(180 - SunLongitude));
            JDE       += Correction;
        }while (Math.Abs(Correction) > 0.00001); //Corresponds to an error of 0.86 of a second

        return(JDE);
    }
Esempio n. 5
0
//Static methods

    ///////////////////////// Implementation //////////////////////////////////////

    public static double Calculate(double JD)
    {
        double rho        = (JD - 2451545) / 365250;
        double rhosquared = rho * rho;
        double rhocubed   = rhosquared * rho;
        double rho4       = rhocubed * rho;
        double rho5       = rho4 * rho;

        //Calculate the Suns mean longitude
        double L0 = CT.M360(280.4664567 + 360007.6982779 * rho + 0.03032028 * rhosquared + rhocubed / 49931 - rho4 / 15300 - rho5 / 2000000);

        //Calculate the Suns apparent right ascension
        double SunLong    = CAASun.ApparentEclipticLongitude(JD);
        double SunLat     = CAASun.ApparentEclipticLatitude(JD);
        double epsilon    = CAANutation.TrueObliquityOfEcliptic(JD);
        COR    Equatorial = CT.Ec2Eq(SunLong, SunLat, epsilon);

        epsilon = CT.D2R(epsilon);
        double E = L0 - 0.0057183 - Equatorial.X * 15 + CT.DMS2D(0, 0, CAANutation.NutationInLongitude(JD)) * Math.Cos(epsilon);

        if (E > 180)
        {
            E = -(360 - E);
        }
        E *= 4; //Convert to minutes of time

        return(E);
    }
Esempio n. 6
0
    public static CAASelenographicMoonDetails CalculateSelenographicPositionOfSun(double JD)
    {
        double R       = CAAEarth.RadiusVector(JD) * 149597970;
        double Delta   = CAAMoon.RadiusVector(JD);
        double lambda0 = CAASun.ApparentEclipticLongitude(JD);
        double lambda  = CAAMoon.EclipticLongitude(JD);
        double beta    = CAAMoon.EclipticLatitude(JD);

        double lambdah = CAACoordinateTransformation.MapTo0To360Range(lambda0 + 180 + Delta / R * 57.296 * Math.Cos(CAACoordinateTransformation.DegreesToRadians(beta)) * Math.Sin(CAACoordinateTransformation.DegreesToRadians(lambda0 - lambda)));
        double betah   = Delta / R * beta;

        //What will be the return value
        CAASelenographicMoonDetails details = new CAASelenographicMoonDetails();

        //Calculate the optical libration
        double omega   = 0;
        double DeltaU  = 0;
        double sigma   = 0;
        double I       = 0;
        double rho     = 0;
        double ldash0  = 0;
        double bdash0  = 0;
        double ldash20 = 0;
        double bdash20 = 0;
        double epsilon = 0;

        CalculateOpticalLibration(JD, lambdah, betah, ref ldash0, ref bdash0, ref ldash20, ref bdash20, ref epsilon, ref omega, ref DeltaU, ref sigma, ref I, ref rho);

        details.l0 = ldash0 + ldash20;
        details.b0 = bdash0 + bdash20;
        details.c0 = CAACoordinateTransformation.MapTo0To360Range(450 - details.l0);
        return(details);
    }