Esempio n. 1
0
    public static double ApparentGreenwichSiderealTime(double JD)
    {
        double MeanObliquity       = CAANutation.MeanObliquityOfEcliptic(JD);
        double TrueObliquity       = MeanObliquity + CAANutation.NutationInObliquity(JD) / 3600;
        double NutationInLongitude = CAANutation.NutationInLongitude(JD);

        double Value = MeanGreenwichSiderealTime(JD) + (NutationInLongitude * Math.Cos(CAACoordinateTransformation.DegreesToRadians(TrueObliquity)) / 54000);

        return(CAACoordinateTransformation.MapTo0To24Range(Value));
    }
Esempio n. 2
0
    public static double ApparentGreenwichSiderealTime(double JD)
    {
        double MeanObliquity       = CAANutation.MeanObliquityOfEcliptic(JD);
        double TrueObliquity       = MeanObliquity + CAANutation.NutationInObliquity(JD) / 3600;
        double NutationInLongitude = CAANutation.NutationInLongitude(JD);

        double Value = MeanGreenwichSiderealTime(JD) + (NutationInLongitude * Math.Cos(CT.D2R(TrueObliquity)) / 54000);

        return(CT.M24(Value));
    }
Esempio n. 3
0
    //////////////////////////////// Implementation ///////////////////////////////

    protected static void CalculateOpticalLibration(double JD, double Lambda, double Beta, ref double ldash, ref double bdash, ref double ldash2, ref double bdash2, ref double epsilon, ref double omega, ref double DeltaU, ref double sigma, ref double I, ref double rho)
    {
        //Calculate the initial quantities
        double Lambdarad = CAACoordinateTransformation.DegreesToRadians(Lambda);
        double Betarad   = CAACoordinateTransformation.DegreesToRadians(Beta);

        I      = CAACoordinateTransformation.DegreesToRadians(1.54242);
        DeltaU = CAACoordinateTransformation.DegreesToRadians(CAANutation.NutationInLongitude(JD) / 3600);
        double F = CAACoordinateTransformation.DegreesToRadians(CAAMoon.ArgumentOfLatitude(JD));

        omega   = CAACoordinateTransformation.DegreesToRadians(CAAMoon.MeanLongitudeAscendingNode(JD));
        epsilon = CAANutation.MeanObliquityOfEcliptic(JD) + CAANutation.NutationInObliquity(JD) / 3600;

        //Calculate the optical librations
        double W = Lambdarad - DeltaU / 3600 - omega;
        double A = Math.Atan2(Math.Sin(W) * Math.Cos(Betarad) * Math.Cos(I) - Math.Sin(Betarad) * Math.Sin(I), Math.Cos(W) * Math.Cos(Betarad));

        ldash = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(A) - CAACoordinateTransformation.RadiansToDegrees(F));
        if (ldash > 180)
        {
            ldash -= 360;
        }
        bdash = Math.Asin(-Math.Sin(W) * Math.Cos(Betarad) * Math.Sin(I) - Math.Sin(Betarad) * Math.Cos(I));

        //Calculate the physical librations
        double T  = (JD - 2451545.0) / 36525;
        double K1 = 119.75 + 131.849 * T;

        K1 = CAACoordinateTransformation.DegreesToRadians(K1);
        double K2 = 72.56 + 20.186 * T;

        K2 = CAACoordinateTransformation.DegreesToRadians(K2);

        double M = CAAEarth.SunMeanAnomaly(JD);

        M = CAACoordinateTransformation.DegreesToRadians(M);
        double Mdash = CAAMoon.MeanAnomaly(JD);

        Mdash = CAACoordinateTransformation.DegreesToRadians(Mdash);
        double D = CAAMoon.MeanElongation(JD);

        D = CAACoordinateTransformation.DegreesToRadians(D);
        double E = CAAEarth.Eccentricity(JD);

        rho = -0.02752 * Math.Cos(Mdash) + -0.02245 * Math.Sin(F) + 0.00684 * Math.Cos(Mdash - 2 * F) + -0.00293 * Math.Cos(2 * F) + -0.00085 * Math.Cos(2 * F - 2 * D) + -0.00054 * Math.Cos(Mdash - 2 * D) + -0.00020 * Math.Sin(Mdash + F) + -0.00020 * Math.Cos(Mdash + 2 * F) + -0.00020 * Math.Cos(Mdash - F) + 0.00014 * Math.Cos(Mdash + 2 * F - 2 * D);

        sigma = -0.02816 * Math.Sin(Mdash) + 0.02244 * Math.Cos(F) + -0.00682 * Math.Sin(Mdash - 2 * F) + -0.00279 * Math.Sin(2 * F) + -0.00083 * Math.Sin(2 * F - 2 * D) + 0.00069 * Math.Sin(Mdash - 2 * D) + 0.00040 * Math.Cos(Mdash + F) + -0.00025 * Math.Sin(2 * Mdash) + -0.00023 * Math.Sin(Mdash + 2 * F) + 0.00020 * Math.Cos(Mdash - F) + 0.00019 * Math.Sin(Mdash - F) + 0.00013 * Math.Sin(Mdash + 2 * F - 2 * D) + -0.00010 * Math.Cos(Mdash - 3 * F);

        double tau = 0.02520 * E * Math.Sin(M) + 0.00473 * Math.Sin(2 * Mdash - 2 * F) + -0.00467 * Math.Sin(Mdash) + 0.00396 * Math.Sin(K1) + 0.00276 * Math.Sin(2 * Mdash - 2 * D) + 0.00196 * Math.Sin(omega) + -0.00183 * Math.Cos(Mdash - F) + 0.00115 * Math.Sin(Mdash - 2 * D) + -0.00096 * Math.Sin(Mdash - D) + 0.00046 * Math.Sin(2 * F - 2 * D) + -0.00039 * Math.Sin(Mdash - F) + -0.00032 * Math.Sin(Mdash - M - D) + 0.00027 * Math.Sin(2 * Mdash - M - 2 * D) + 0.00023 * Math.Sin(K2) + -0.00014 * Math.Sin(2 * D) + 0.00014 * Math.Cos(2 * Mdash - 2 * F) + -0.00012 * Math.Sin(Mdash - 2 * F) + -0.00012 * Math.Sin(2 * Mdash) + 0.00011 * Math.Sin(2 * Mdash - 2 * M - 2 * D);

        ldash2 = -tau + (rho * Math.Cos(A) + sigma * Math.Sin(A)) * Math.Tan(bdash);
        bdash  = CAACoordinateTransformation.RadiansToDegrees(bdash);
        bdash2 = sigma * Math.Cos(A) - rho * Math.Sin(A);
    }
//Static methods

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

    public static CAAPhysicalJupiterDetails Calculate(double JD)
    {
        //What will be the return value
        CAAPhysicalJupiterDetails details = new CAAPhysicalJupiterDetails();

        //Step 1
        double d         = JD - 2433282.5;
        double T1        = d / 36525;
        double alpha0    = 268.00 + 0.1061 * T1;
        double alpha0rad = CT.D2R(alpha0);
        double delta0    = 64.50 - 0.0164 * T1;
        double delta0rad = CT.D2R(delta0);

        //Step 2
        double W1 = CT.M360(17.710 + 877.90003539 * d);
        double W2 = CT.M360(16.838 + 870.27003539 * d);

        //Step 3
        double l0    = CAAEarth.EclipticLongitude(JD);
        double l0rad = CT.D2R(l0);
        double b0    = CAAEarth.EclipticLatitude(JD);
        double b0rad = CT.D2R(b0);
        double R     = CAAEarth.RadiusVector(JD);

        //Step 4
        double l    = CAAJupiter.EclipticLongitude(JD);
        double lrad = CT.D2R(l);
        double b    = CAAJupiter.EclipticLatitude(JD);
        double brad = CT.D2R(b);
        double r    = CAAJupiter.RadiusVector(JD);

        //Step 5
        double x     = r * Math.Cos(brad) * Math.Cos(lrad) - R * Math.Cos(l0rad);
        double y     = r * Math.Cos(brad) * Math.Sin(lrad) - R * Math.Sin(l0rad);
        double z     = r * Math.Sin(brad) - R * Math.Sin(b0rad);
        double DELTA = Math.Sqrt(x * x + y * y + z * z);

        //Step 6
        l   -= 0.012990 * DELTA / (r * r);
        lrad = CT.D2R(l);

        //Step 7
        x     = r * Math.Cos(brad) * Math.Cos(lrad) - R * Math.Cos(l0rad);
        y     = r * Math.Cos(brad) * Math.Sin(lrad) - R * Math.Sin(l0rad);
        z     = r * Math.Sin(brad) - R * Math.Sin(b0rad);
        DELTA = Math.Sqrt(x * x + y * y + z * z);

        //Step 8
        double e0    = CAANutation.MeanObliquityOfEcliptic(JD);
        double e0rad = CT.D2R(e0);

        //Step 9
        double alphas = Math.Atan2(Math.Cos(e0rad) * Math.Sin(lrad) - Math.Sin(e0rad) * Math.Tan(brad), Math.Cos(lrad));
        double deltas = Math.Asin(Math.Cos(e0rad) * Math.Sin(brad) + Math.Sin(e0rad) * Math.Cos(brad) * Math.Sin(lrad));

        //Step 10
        details.DS = CT.R2D(Math.Asin(-Math.Sin(delta0rad) * Math.Sin(deltas) - Math.Cos(delta0rad) * Math.Cos(deltas) * Math.Cos(alpha0rad - alphas)));

        //Step 11
        double u        = y * Math.Cos(e0rad) - z * Math.Sin(e0rad);
        double v        = y * Math.Sin(e0rad) + z * Math.Cos(e0rad);
        double alpharad = Math.Atan2(u, x);
        double alpha    = CT.R2D(alpharad);
        double deltarad = Math.Atan2(v, Math.Sqrt(x * x + u * u));
        double delta    = CT.R2D(deltarad);
        double xi       = Math.Atan2(Math.Sin(delta0rad) * Math.Cos(deltarad) * Math.Cos(alpha0rad - alpharad) - Math.Sin(deltarad) * Math.Cos(delta0rad), Math.Cos(deltarad) * Math.Sin(alpha0rad - alpharad));

        //Step 12
        details.DE = CT.R2D(Math.Asin(-Math.Sin(delta0rad) * Math.Sin(deltarad) - Math.Cos(delta0rad) * Math.Cos(deltarad) * Math.Cos(alpha0rad - alpharad)));

        //Step 13
        details.Geometricw1 = CT.M360(W1 - CT.R2D(xi) - 5.07033 * DELTA);
        details.Geometricw2 = CT.M360(W2 - CT.R2D(xi) - 5.02626 * DELTA);

        //Step 14
        double C = 57.2958 * (2 * r * DELTA + R * R - r * r - DELTA * DELTA) / (4 * r * DELTA);

        if (Math.Sin(lrad - l0rad) > 0)
        {
            details.Apparentw1 = CT.M360(details.Geometricw1 + C);
            details.Apparentw2 = CT.M360(details.Geometricw2 + C);
        }
        else
        {
            details.Apparentw1 = CT.M360(details.Geometricw1 - C);
            details.Apparentw2 = CT.M360(details.Geometricw2 - C);
        }

        //Step 15
        double NutationInLongitude = CAANutation.NutationInLongitude(JD);
        double NutationInObliquity = CAANutation.NutationInObliquity(JD);

        e0   += NutationInObliquity / 3600;
        e0rad = CT.D2R(e0);

        //Step 16
        alpha   += 0.005693 * (Math.Cos(alpharad) * Math.Cos(l0rad) * Math.Cos(e0rad) + Math.Sin(alpharad) * Math.Sin(l0rad)) / Math.Cos(deltarad);
        alpha    = CT.M360(alpha);
        alpharad = CT.D2R(alpha);
        delta   += 0.005693 * (Math.Cos(l0rad) * Math.Cos(e0rad) * (Math.Tan(e0rad) * Math.Cos(deltarad) - Math.Sin(alpharad) * Math.Sin(deltarad)) + Math.Cos(alpharad) * Math.Sin(deltarad) * Math.Sin(l0rad));
        deltarad = CT.D2R(delta);

        //Step 17
        double NutationRA   = CAANutation.NutationInRightAscension(alpha / 15, delta, e0, NutationInLongitude, NutationInObliquity);
        double alphadash    = alpha + NutationRA / 3600;
        double alphadashrad = CT.D2R(alphadash);
        double NutationDec  = CAANutation.NutationInDeclination(alpha / 15, delta, e0, NutationInLongitude, NutationInObliquity);
        double deltadash    = delta + NutationDec / 3600;
        double deltadashrad = CT.D2R(deltadash);

        NutationRA = CAANutation.NutationInRightAscension(alpha0 / 15, delta0, e0, NutationInLongitude, NutationInObliquity);
        double alpha0dash    = alpha0 + NutationRA / 3600;
        double alpha0dashrad = CT.D2R(alpha0dash);

        NutationDec = CAANutation.NutationInDeclination(alpha0 / 15, delta0, e0, NutationInLongitude, NutationInObliquity);
        double delta0dash    = delta0 + NutationDec / 3600;
        double delta0dashrad = CT.D2R(delta0dash);

        //Step 18
        details.P = CT.M360(CT.R2D(Math.Atan2(Math.Cos(delta0dashrad) * Math.Sin(alpha0dashrad - alphadashrad), Math.Sin(delta0dashrad) * Math.Cos(deltadashrad) - Math.Cos(delta0dashrad) * Math.Sin(deltadashrad) * Math.Cos(alpha0dashrad - alphadashrad))));

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

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

    public static CAAPhysicalMarsDetails Calculate(double JD)
    {
        //What will be the return value
        CAAPhysicalMarsDetails details = new CAAPhysicalMarsDetails();

        //Step 1
        double T          = (JD - 2451545) / 36525;
        double Lambda0    = 352.9065 + 1.17330 * T;
        double Lambda0rad = CT.D2R(Lambda0);
        double Beta0      = 63.2818 - 0.00394 * T;
        double Beta0rad   = CT.D2R(Beta0);

        //Step 2
        double l0    = CAAEarth.EclipticLongitude(JD);
        double l0rad = CT.D2R(l0);
        double b0    = CAAEarth.EclipticLatitude(JD);
        double b0rad = CT.D2R(b0);
        double R     = CAAEarth.RadiusVector(JD);

        double PreviousLightTravelTime = 0;
        double LightTravelTime         = 0;
        double x        = 0;
        double y        = 0;
        double z        = 0;
        bool   bIterate = true;
        double DELTA    = 0;
        double l        = 0;
        double lrad     = 0;
        double b        = 0;
        double brad     = 0;
        double r        = 0;

        while (bIterate)
        {
            double JD2 = JD - LightTravelTime;

            //Step 3
            l    = CAAMars.EclipticLongitude(JD2);
            lrad = CT.D2R(l);
            b    = CAAMars.EclipticLatitude(JD2);
            brad = CT.D2R(b);
            r    = CAAMars.RadiusVector(JD2);

            //Step 4
            x               = r * Math.Cos(brad) * Math.Cos(lrad) - R * Math.Cos(l0rad);
            y               = r * Math.Cos(brad) * Math.Sin(lrad) - R * Math.Sin(l0rad);
            z               = r * Math.Sin(brad) - R * Math.Sin(b0rad);
            DELTA           = Math.Sqrt(x * x + y * y + z * z);
            LightTravelTime = ELL.DistanceToLightTime(DELTA);

            //Prepare for the next loop around
            bIterate = (Math.Abs(LightTravelTime - PreviousLightTravelTime) > 2E-6); //2E-6 correponds to 0.17 of a second
            if (bIterate)
            {
                PreviousLightTravelTime = LightTravelTime;
            }
        }

        //Step 5
        double lambdarad = Math.Atan2(y, x);
        double lambda    = CT.R2D(lambdarad);
        double betarad   = Math.Atan2(z, Math.Sqrt(x * x + y * y));
        double beta      = CT.R2D(betarad);

        //Step 6
        details.DE = CT.R2D(Math.Asin(-Math.Sin(Beta0rad) * Math.Sin(betarad) - Math.Cos(Beta0rad) * Math.Cos(betarad) * Math.Cos(Lambda0rad - lambdarad)));

        //Step 7
        double N    = 49.5581 + 0.7721 * T;
        double Nrad = CT.D2R(N);

        double ldash    = l - 0.00697 / r;
        double ldashrad = CT.D2R(ldash);
        double bdash    = b - 0.000225 * (Math.Cos(lrad - Nrad) / r);
        double bdashrad = CT.D2R(bdash);

        //Step 8
        details.DS = CT.R2D(Math.Asin(-Math.Sin(Beta0rad) * Math.Sin(bdashrad) - Math.Cos(Beta0rad) * Math.Cos(bdashrad) * Math.Cos(Lambda0rad - ldashrad)));

        //Step 9
        double W = CT.M360(11.504 + 350.89200025 * (JD - LightTravelTime - 2433282.5));

        //Step 10
        double e0             = CAANutation.MeanObliquityOfEcliptic(JD);
        double e0rad          = CT.D2R(e0);
        COR    PoleEquatorial = CT.Ec2Eq(Lambda0, Beta0, e0);
        double alpha0rad      = CT.H2R(PoleEquatorial.X);
        double delta0rad      = CT.D2R(PoleEquatorial.Y);

        //Step 11
        double u        = y * Math.Cos(e0rad) - z * Math.Sin(e0rad);
        double v        = y * Math.Sin(e0rad) + z * Math.Cos(e0rad);
        double alpharad = Math.Atan2(u, x);
        double alpha    = CT.R2H(alpharad);
        double deltarad = Math.Atan2(v, Math.Sqrt(x * x + u * u));
        double delta    = CT.R2D(deltarad);
        double xi       = Math.Atan2(Math.Sin(delta0rad) * Math.Cos(deltarad) * Math.Cos(alpha0rad - alpharad) - Math.Sin(deltarad) * Math.Cos(delta0rad), Math.Cos(deltarad) * Math.Sin(alpha0rad - alpharad));

        //Step 12
        details.w = CT.M360(W - CT.R2D(xi));

        //Step 13
        double NutationInLongitude = CAANutation.NutationInLongitude(JD);
        double NutationInObliquity = CAANutation.NutationInObliquity(JD);

        //Step 14
        lambda += 0.005693 * Math.Cos(l0rad - lambdarad) / Math.Cos(betarad);
        beta   += 0.005693 * Math.Sin(l0rad - lambdarad) * Math.Sin(betarad);

        //Step 15
        Lambda0   += NutationInLongitude / 3600;
        Lambda0rad = CT.D2R(Lambda0);
        lambda    += NutationInLongitude / 3600;
        lambdarad  = CT.D2R(lambda);
        e0        += NutationInObliquity / 3600;
        e0rad      = CT.D2R(e0rad);

        //Step 16
        COR    ApparentPoleEquatorial = CT.Ec2Eq(Lambda0, Beta0, e0);
        double alpha0dash             = CT.H2R(ApparentPoleEquatorial.X);
        double delta0dash             = CT.D2R(ApparentPoleEquatorial.Y);
        COR    ApparentMars           = CT.Ec2Eq(lambda, beta, e0);
        double alphadash = CT.H2R(ApparentMars.X);
        double deltadash = CT.D2R(ApparentMars.Y);

        //Step 17
        details.P = CT.M360(CT.R2D(Math.Atan2(Math.Cos(delta0dash) * Math.Sin(alpha0dash - alphadash), Math.Sin(delta0dash) * Math.Cos(deltadash) - Math.Cos(delta0dash) * Math.Sin(deltadash) * Math.Cos(alpha0dash - alphadash))));

        //Step 18
        double SunLambda     = CAASun.GeometricEclipticLongitude(JD);
        double SunBeta       = CAASun.GeometricEclipticLatitude(JD);
        COR    SunEquatorial = CT.Ec2Eq(SunLambda, SunBeta, e0);

        details.X = MIFR.PositionAngle(SunEquatorial.X, SunEquatorial.Y, alpha, delta);

        //Step 19
        details.d = 9.36 / DELTA;
        details.k = IFR.IlluminatedFraction2(r, R, DELTA);
        details.q = (1 - details.k) * details.d;

        return(details);
    }