コード例 #1
0
    public static CAANodeObjectDetails PassageThroDescendingNode(CAAEllipticalObjectElements elements)
    {
        double v = CAACoordinateTransformation.MapTo0To360Range(180 - elements.w);

        v = CAACoordinateTransformation.DegreesToRadians(v);
        double E = Math.Atan(Math.Sqrt((1 - elements.e) / (1 + elements.e)) * Math.Tan(v / 2)) * 2;
        double M = E - elements.e * Math.Sin(E);

        M = CAACoordinateTransformation.RadiansToDegrees(M);
        double n = CAAElliptical.MeanMotionFromSemiMajorAxis(elements.a);

        CAANodeObjectDetails details = new CAANodeObjectDetails();

        details.t      = elements.T + M / n;
        details.radius = elements.a * (1 - elements.e * Math.Cos(E));

        return(details);
    }
コード例 #2
0
//Static methods
    public static CAANearParabolicObjectDetails Calculate(double JD, CAANearParabolicObjectElements elements)
    {
        double Epsilon = CAANutation.MeanObliquityOfEcliptic(elements.JDEquinox);

        double JD0 = JD;

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

        Epsilon = CAACoordinateTransformation.DegreesToRadians(Epsilon);
        double omega = CAACoordinateTransformation.DegreesToRadians(elements.omega);
        double w     = CAACoordinateTransformation.DegreesToRadians(elements.w);
        double i     = CAACoordinateTransformation.DegreesToRadians(elements.i);

        double sinEpsilon = Math.Sin(Epsilon);
        double cosEpsilon = Math.Cos(Epsilon);
        double sinOmega   = Math.Sin(omega);
        double cosOmega   = Math.Cos(omega);
        double cosi       = Math.Cos(i);
        double sini       = Math.Sin(i);

        double F = cosOmega;
        double G = sinOmega * cosEpsilon;
        double H = sinOmega * sinEpsilon;
        double P = -sinOmega * cosi;
        double Q = cosOmega * cosi * cosEpsilon - sini * sinEpsilon;
        double R = cosOmega * cosi * sinEpsilon + sini * cosEpsilon;
        double a = Math.Sqrt(F * F + P * P);
        double b = Math.Sqrt(G * G + Q * Q);
        double c = Math.Sqrt(H * H + R * R);
        double A = Math.Atan2(F, P);
        double B = Math.Atan2(G, Q);
        double C = Math.Atan2(H, R);

        CAA3DCoordinate SunCoord = CAASun.EquatorialRectangularCoordinatesAnyEquinox(JD, elements.JDEquinox);

        for (int j = 0; j < 2; j++)
        {
            double v = 0;
            double r = 0;
            CalulateTrueAnnomalyAndRadius(JD0, elements, ref v, ref r);

            double x = r * a * Math.Sin(A + w + v);
            double y = r * b * Math.Sin(B + w + v);
            double z = r * c * Math.Sin(C + w + v);

            if (j == 0)
            {
                details.HeliocentricRectangularEquatorial.X = x;
                details.HeliocentricRectangularEquatorial.Y = y;
                details.HeliocentricRectangularEquatorial.Z = z;

                //Calculate the heliocentric ecliptic coordinates also
                double u    = omega + v;
                double cosu = Math.Cos(u);
                double sinu = Math.Sin(u);

                details.HeliocentricRectangularEcliptical.X = r * (cosOmega * cosu - sinOmega * sinu * cosi);
                details.HeliocentricRectangularEcliptical.Y = r * (sinOmega * cosu + cosOmega * sinu * cosi);
                details.HeliocentricRectangularEcliptical.Z = r * sini * sinu;

                details.HeliocentricEclipticLongitude = Math.Atan2(y, x);
                details.HeliocentricEclipticLongitude = CAACoordinateTransformation.MapTo0To24Range(CAACoordinateTransformation.RadiansToDegrees(details.HeliocentricEclipticLongitude) / 15);
                details.HeliocentricEclipticLatitude  = Math.Asin(z / r);
                details.HeliocentricEclipticLatitude  = CAACoordinateTransformation.RadiansToDegrees(details.HeliocentricEclipticLatitude);
            }

            double psi   = SunCoord.X + x;
            double nu    = SunCoord.Y + y;
            double sigma = SunCoord.Z + z;

            double Alpha = Math.Atan2(nu, psi);
            Alpha = CAACoordinateTransformation.RadiansToDegrees(Alpha);
            double Delta = Math.Atan2(sigma, Math.Sqrt(psi * psi + nu * nu));
            Delta = CAACoordinateTransformation.RadiansToDegrees(Delta);
            double Distance = Math.Sqrt(psi * psi + nu * nu + sigma * sigma);

            if (j == 0)
            {
                details.TrueGeocentricRA          = CAACoordinateTransformation.MapTo0To24Range(Alpha / 15);
                details.TrueGeocentricDeclination = Delta;
                details.TrueGeocentricDistance    = Distance;
                details.TrueGeocentricLightTime   = CAAElliptical.DistanceToLightTime(Distance);
            }
            else
            {
                details.AstrometricGeocenticRA           = CAACoordinateTransformation.MapTo0To24Range(Alpha / 15);
                details.AstrometricGeocentricDeclination = Delta;
                details.AstrometricGeocentricDistance    = Distance;
                details.AstrometricGeocentricLightTime   = CAAElliptical.DistanceToLightTime(Distance);

                double RES = Math.Sqrt(SunCoord.X * SunCoord.X + SunCoord.Y * SunCoord.Y + SunCoord.Z * SunCoord.Z);

                details.Elongation = CAACoordinateTransformation.RadiansToDegrees(Math.Acos((RES * RES + Distance * Distance - r * r) / (2 * RES * Distance)));
                details.PhaseAngle = CAACoordinateTransformation.RadiansToDegrees(Math.Acos((r * r + Distance * Distance - RES * RES) / (2 * r * Distance)));
            }

            if (j == 0) //Prepare for the next loop around
            {
                JD0 = JD - details.TrueGeocentricLightTime;
            }
        }

        return(details);
    }
コード例 #3
0
        private void ComputeOrbital(RenderContext11 renderContext)
        {
            CAAEllipticalObjectElements ee = Elements;
            Vector3d point = CAAElliptical.CalculateRectangular(SpaceTimeController.JNow, ee, out MeanAnomoly);

            Vector3d pointInstantLater = CAAElliptical.CalculateRectangular(ee, MeanAnomoly + .001);

            Vector3d direction = point - pointInstantLater;

            direction.Normalize();
            Vector3d up = point;

            up.Normalize();
            direction.Normalize();

            double dist        = point.Length();
            double scaleFactor = 1.0;

            switch (SemiMajorAxisUnits)
            {
            case AltUnits.Meters:
                scaleFactor = 1.0;
                break;

            case AltUnits.Feet:
                scaleFactor = 1.0 / 3.2808399;
                break;

            case AltUnits.Inches:
                scaleFactor = (1.0 / 3.2808399) / 12;
                break;

            case AltUnits.Miles:
                scaleFactor = 1609.344;
                break;

            case AltUnits.Kilometers:
                scaleFactor = 1000;
                break;

            case AltUnits.AstronomicalUnits:
                scaleFactor = UiTools.KilometersPerAu * 1000;
                break;

            case AltUnits.LightYears:
                scaleFactor = UiTools.AuPerLightYear * UiTools.KilometersPerAu * 1000;
                break;

            case AltUnits.Parsecs:
                scaleFactor = UiTools.AuPerParsec * UiTools.KilometersPerAu * 1000;
                break;

            case AltUnits.MegaParsecs:
                scaleFactor = UiTools.AuPerParsec * UiTools.KilometersPerAu * 1000 * 1000000;
                break;

            case AltUnits.Custom:
                scaleFactor = 1;
                break;

            default:
                break;
            }
            scaleFactor *= 1 / renderContext.NominalRadius;


            Matrix3d look = Matrix3d.LookAtLH(new Vector3d(0, 0, 0), direction, up);

            look.Invert();

            WorldMatrix = Matrix3d.Identity;
            WorldMatrix.Translate(Translation);


            double localScale = (1 / renderContext.NominalRadius) * Scale * MeanRadius;

            WorldMatrix.Scale(new Vector3d(localScale, localScale, localScale));
            WorldMatrix.Rotate(Quaternion.RotationYawPitchRoll((float)((Heading) / 180.0 * Math.PI), (float)(Pitch / 180.0 * Math.PI), (float)(Roll / 180.0 * Math.PI)));
            if (RotationalPeriod != 0)
            {
                double rotationCurrent = (((SpaceTimeController.JNow - this.ZeroRotationDate) / RotationalPeriod) * Math.PI * 2) % (Math.PI * 2);
                WorldMatrix.Multiply(Matrix3d.RotationX(-rotationCurrent));
            }

            point = Vector3d.Scale(point, scaleFactor);

            WorldMatrix.Translate(point);

            if (StationKeeping)
            {
                WorldMatrix = look * WorldMatrix;
            }
        }
コード例 #4
0
//Static methods

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

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

        double T  = (JD - 2451545) / 36525;
        double T2 = T * T;

        //Step 1. Calculate the inclination of the plane of the ring and the longitude of the ascending node referred to the ecliptic and mean equinox of the date
        double i        = 28.075216 - 0.012998 * T + 0.000004 * T2;
        double irad     = CAACoordinateTransformation.DegreesToRadians(i);
        double omega    = 169.508470 + 1.394681 * T + 0.000412 * T2;
        double omegarad = CAACoordinateTransformation.DegreesToRadians(omega);

        //Step 2. Calculate the heliocentric longitude, latitude and radius vector of the Earth in the FK5 system
        double l0 = CAAEarth.EclipticLongitude(JD);
        double b0 = CAAEarth.EclipticLatitude(JD);

        l0 += CAAFK5.CorrectionInLongitude(l0, b0, JD);
        double l0rad = CAACoordinateTransformation.DegreesToRadians(l0);

        b0 += CAAFK5.CorrectionInLatitude(l0, JD);
        double b0rad = CAACoordinateTransformation.DegreesToRadians(b0);
        double R     = CAAEarth.RadiusVector(JD);

        //Step 3. Calculate the corresponding coordinates l,b,r for Saturn but for the instance t-lightraveltime
        double DELTA = 9;
        double PreviousEarthLightTravelTime = 0;
        double EarthLightTravelTime         = CAAElliptical.DistanceToLightTime(DELTA);
        double JD1      = JD - EarthLightTravelTime;
        bool   bIterate = true;
        double x        = 0;
        double y        = 0;
        double z        = 0;
        double l        = 0;
        double b        = 0;
        double r        = 0;

        while (bIterate)
        {
            //Calculate the position of Saturn
            l  = CAASaturn.EclipticLongitude(JD1);
            b  = CAASaturn.EclipticLatitude(JD1);
            l += CAAFK5.CorrectionInLongitude(l, b, JD1);
            b += CAAFK5.CorrectionInLatitude(l, JD1);

            double lrad = CAACoordinateTransformation.DegreesToRadians(l);
            double brad = CAACoordinateTransformation.DegreesToRadians(b);
            r = CAASaturn.RadiusVector(JD1);

            //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);
            EarthLightTravelTime = CAAElliptical.DistanceToLightTime(DELTA);

            //Prepare for the next loop around
            bIterate = (Math.Abs(EarthLightTravelTime - PreviousEarthLightTravelTime) > 2E-6); //2E-6 corresponds to 0.17 of a second
            if (bIterate)
            {
                JD1 = JD - EarthLightTravelTime;
                PreviousEarthLightTravelTime = EarthLightTravelTime;
            }
        }

        //Step 5. Calculate Saturn's geocentric Longitude and Latitude
        double lambda = Math.Atan2(y, x);
        double beta   = Math.Atan2(z, Math.Sqrt(x * x + y * y));

        //Step 6. Calculate B, a and b
        details.B = Math.Asin(Math.Sin(irad) * Math.Cos(beta) * Math.Sin(lambda - omegarad) - Math.Cos(irad) * Math.Sin(beta));
        details.a = 375.35 / DELTA;
        details.b = details.a * Math.Sin(Math.Abs(details.B));
        details.B = CAACoordinateTransformation.RadiansToDegrees(details.B);

        //Step 7. Calculate the longitude of the ascending node of Saturn's orbit
        double N        = 113.6655 + 0.8771 * T;
        double Nrad     = CAACoordinateTransformation.DegreesToRadians(N);
        double ldash    = l - 0.01759 / r;
        double ldashrad = CAACoordinateTransformation.DegreesToRadians(ldash);
        double bdash    = b - 0.000764 * Math.Cos(ldashrad - Nrad) / r;
        double bdashrad = CAACoordinateTransformation.DegreesToRadians(bdash);

        //Step 8. Calculate Bdash
        details.Bdash = CAACoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sin(irad) * Math.Cos(bdashrad) * Math.Sin(ldashrad - omegarad) - Math.Cos(irad) * Math.Sin(bdashrad)));

        //Step 9. Calculate DeltaU
        double U1 = Math.Atan2(Math.Sin(irad) * Math.Sin(bdashrad) + Math.Cos(irad) * Math.Cos(bdashrad) * Math.Sin(ldashrad - omegarad), Math.Cos(bdashrad) * Math.Cos(ldashrad - omegarad));
        double U2 = Math.Atan2(Math.Sin(irad) * Math.Sin(beta) + Math.Cos(irad) * Math.Cos(beta) * Math.Sin(lambda - omegarad), Math.Cos(beta) * Math.Cos(lambda - omegarad));

        details.DeltaU = CAACoordinateTransformation.RadiansToDegrees(Math.Abs(U1 - U2));

        //Step 10. Calculate the Nutations
        double Obliquity           = CAANutation.TrueObliquityOfEcliptic(JD);
        double NutationInLongitude = CAANutation.NutationInLongitude(JD);

        //Step 11. Calculate the Ecliptical longitude and latitude of the northern pole of the ring plane
        double lambda0 = omega - 90;
        double beta0   = 90 - i;

        //Step 12. Correct lambda and beta for the aberration of Saturn
        lambda += CAACoordinateTransformation.DegreesToRadians(0.005693 * Math.Cos(l0rad - lambda) / Math.Cos(beta));
        beta   += CAACoordinateTransformation.DegreesToRadians(0.005693 * Math.Sin(l0rad - lambda) * Math.Sin(beta));

        //Step 13. Add nutation in longitude to lambda0 and lambda
        //double NLrad = CAACoordinateTransformation::DegreesToRadians(NutationInLongitude/3600);
        lambda   = CAACoordinateTransformation.RadiansToDegrees(lambda);
        lambda  += NutationInLongitude / 3600;
        lambda   = CAACoordinateTransformation.MapTo0To360Range(lambda);
        lambda0 += NutationInLongitude / 3600;
        lambda0  = CAACoordinateTransformation.MapTo0To360Range(lambda0);

        //Step 14. Convert to equatorial coordinates
        beta = CAACoordinateTransformation.RadiansToDegrees(beta);
        CAA2DCoordinate GeocentricEclipticSaturn = CAACoordinateTransformation.Ecliptic2Equatorial(lambda, beta, Obliquity);
        double          alpha = CAACoordinateTransformation.HoursToRadians(GeocentricEclipticSaturn.X);
        double          delta = CAACoordinateTransformation.DegreesToRadians(GeocentricEclipticSaturn.Y);
        CAA2DCoordinate GeocentricEclipticNorthPole = CAACoordinateTransformation.Ecliptic2Equatorial(lambda0, beta0, Obliquity);
        double          alpha0 = CAACoordinateTransformation.HoursToRadians(GeocentricEclipticNorthPole.X);
        double          delta0 = CAACoordinateTransformation.DegreesToRadians(GeocentricEclipticNorthPole.Y);

        //Step 15. Calculate the Position angle
        details.P = CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(Math.Cos(delta0) * Math.Sin(alpha0 - alpha), Math.Sin(delta0) * Math.Cos(delta) - Math.Cos(delta0) * Math.Sin(delta) * Math.Cos(alpha0 - alpha)));

        return(details);
    }
コード例 #5
0
    //////////////////////////////// Implementation ///////////////////////////////

    protected static CAAGalileanMoonsDetails CalculateHelper(double JD, double sunlongrad, double betarad, double R)
    {
        //What will be the return value
        CAAGalileanMoonsDetails details = new CAAGalileanMoonsDetails();

        //Calculate the position of Jupiter decreased by the light travel time from Jupiter to the specified position
        double DELTA = 5;
        double PreviousLightTravelTime = 0;
        double LightTravelTime         = CAAElliptical.DistanceToLightTime(DELTA);
        double x        = 0;
        double y        = 0;
        double z        = 0;
        double l        = 0;
        double lrad     = 0;
        double b        = 0;
        double brad     = 0;
        double r        = 0;
        double JD1      = JD - LightTravelTime;
        bool   bIterate = true;

        while (bIterate)
        {
            //Calculate the position of Jupiter
            l    = CAAJupiter.EclipticLongitude(JD1);
            lrad = CAACoordinateTransformation.DegreesToRadians(l);
            b    = CAAJupiter.EclipticLatitude(JD1);
            brad = CAACoordinateTransformation.DegreesToRadians(b);
            r    = CAAJupiter.RadiusVector(JD1);

            x               = r * Math.Cos(brad) * Math.Cos(lrad) + R * Math.Cos(sunlongrad);
            y               = r * Math.Cos(brad) * Math.Sin(lrad) + R * Math.Sin(sunlongrad);
            z               = r * Math.Sin(brad) + R * Math.Sin(betarad);
            DELTA           = Math.Sqrt(x * x + y * y + z * z);
            LightTravelTime = CAAElliptical.DistanceToLightTime(DELTA);

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

        //Calculate Jupiter's Longitude and Latitude
        double lambda0 = Math.Atan2(y, x);
        double beta0   = Math.Atan(z / Math.Sqrt(x * x + y * y));

        double t = JD - 2443000.5 - LightTravelTime;

        //Calculate the mean longitudes
        double l1    = 106.07719 + 203.488955790 * t;
        double l1rad = CAACoordinateTransformation.DegreesToRadians(l1);
        double l2    = 175.73161 + 101.374724735 * t;
        double l2rad = CAACoordinateTransformation.DegreesToRadians(l2);
        double l3    = 120.55883 + 50.317609207 * t;
        double l3rad = CAACoordinateTransformation.DegreesToRadians(l3);
        double l4    = 84.44459 + 21.571071177 * t;
        double l4rad = CAACoordinateTransformation.DegreesToRadians(l4);

        //Calculate the perijoves
        double pi1 = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.MapTo0To360Range(97.0881 + 0.16138586 * t));
        double pi2 = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.MapTo0To360Range(154.8663 + 0.04726307 * t));
        double pi3 = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.MapTo0To360Range(188.1840 + 0.00712734 * t));
        double pi4 = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.MapTo0To360Range(335.2868 + 0.00184000 * t));

        //Calculate the nodes on the equatorial plane of jupiter
        double w1    = 312.3346 - 0.13279386 * t;
        double w1rad = CAACoordinateTransformation.DegreesToRadians(w1);
        double w2    = 100.4411 - 0.03263064 * t;
        double w2rad = CAACoordinateTransformation.DegreesToRadians(w2);
        double w3    = 119.1942 - 0.00717703 * t;
        double w3rad = CAACoordinateTransformation.DegreesToRadians(w3);
        double w4    = 322.6186 - 0.00175934 * t;
        double w4rad = CAACoordinateTransformation.DegreesToRadians(w4);

        //Calculate the Principal inequality in the longitude of Jupiter
        double GAMMA = 0.33033 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(163.679 + 0.0010512 * t)) + 0.03439 * Math.Sin(CAACoordinateTransformation.DegreesToRadians(34.486 - 0.0161731 * t));

        //Calculate the "phase of free libration"
        double philambda = CAACoordinateTransformation.DegreesToRadians(199.6766 + 0.17379190 * t);

        //Calculate the longitude of the node of the equator of Jupiter on the ecliptic
        double psi = CAACoordinateTransformation.DegreesToRadians(316.5182 - 0.00000208 * t);

        //Calculate the mean anomalies of Jupiter and Saturn
        double G     = CAACoordinateTransformation.DegreesToRadians(30.23756 + 0.0830925701 * t + GAMMA);
        double Gdash = CAACoordinateTransformation.DegreesToRadians(31.97853 + 0.0334597339 * t);

        //Calculate the longitude of the perihelion of Jupiter
        double PI = CAACoordinateTransformation.DegreesToRadians(13.469942);

        //Calculate the periodic terms in the longitudes of the satellites
        double Sigma1 = 0.47259 * Math.Sin(2 * (l1rad - l2rad)) + -0.03478 * Math.Sin(pi3 - pi4) + 0.01081 * Math.Sin(l2rad - 2 * l3rad + pi3) + 0.00738 * Math.Sin(philambda) + 0.00713 * Math.Sin(l2rad - 2 * l3rad + pi2) + -0.00674 * Math.Sin(pi1 + pi3 - 2 * PI - 2 * G) + 0.00666 * Math.Sin(l2rad - 2 * l3rad + pi4) + 0.00445 * Math.Sin(l1rad - pi3) + -0.00354 * Math.Sin(l1rad - l2rad) + -0.00317 * Math.Sin(2 * psi - 2 * PI) + 0.00265 * Math.Sin(l1rad - pi4) + -0.00186 * Math.Sin(G) + 0.00162 * Math.Sin(pi2 - pi3) + 0.00158 * Math.Sin(4 * (l1rad - l2rad)) + -0.00155 * Math.Sin(l1rad - l3rad) + -0.00138 * Math.Sin(psi + w3rad - 2 * PI - 2 * G) + -0.00115 * Math.Sin(2 * (l1rad - 2 * l2rad + w2rad)) + 0.00089 * Math.Sin(pi2 - pi4) + 0.00085 * Math.Sin(l1rad + pi3 - 2 * PI - 2 * G) + 0.00083 * Math.Sin(w2rad - w3rad) + 0.00053 * Math.Sin(psi - w2rad);

        double Sigma2 = 1.06476 * Math.Sin(2 * (l2rad - l3rad)) + 0.04256 * Math.Sin(l1rad - 2 * l2rad + pi3) + 0.03581 * Math.Sin(l2rad - pi3) + 0.02395 * Math.Sin(l1rad - 2 * l2rad + pi4) + 0.01984 * Math.Sin(l2rad - pi4) + -0.01778 * Math.Sin(philambda) + 0.01654 * Math.Sin(l2rad - pi2) + 0.01334 * Math.Sin(l2rad - 2 * l3rad + pi2) + 0.01294 * Math.Sin(pi3 - pi4) + -0.01142 * Math.Sin(l2rad - l3rad) + -0.01057 * Math.Sin(G) + -0.00775 * Math.Sin(2 * (psi - PI)) + 0.00524 * Math.Sin(2 * (l1rad - l2rad)) + -0.00460 * Math.Sin(l1rad - l3rad) + 0.00316 * Math.Sin(psi - 2 * G + w3rad - 2 * PI) + -0.00203 * Math.Sin(pi1 + pi3 - 2 * PI - 2 * G) + 0.00146 * Math.Sin(psi - w3rad) + -0.00145 * Math.Sin(2 * G) + 0.00125 * Math.Sin(psi - w4rad) + -0.00115 * Math.Sin(l1rad - 2 * l3rad + pi3) + -0.00094 * Math.Sin(2 * (l2rad - w2rad)) + 0.00086 * Math.Sin(2 * (l1rad - 2 * l2rad + w2rad)) + -0.00086 * Math.Sin(5 * Gdash - 2 * G + CAACoordinateTransformation.DegreesToRadians(52.225)) + -0.00078 * Math.Sin(l2rad - l4rad) + -0.00064 * Math.Sin(3 * l3rad - 7 * l4rad + 4 * pi4) + 0.00064 * Math.Sin(pi1 - pi4) + -0.00063 * Math.Sin(l1rad - 2 * l3rad + pi4) + 0.00058 * Math.Sin(w3rad - w4rad) + 0.00056 * Math.Sin(2 * (psi - PI - G)) + 0.00056 * Math.Sin(2 * (l2rad - l4rad)) + 0.00055 * Math.Sin(2 * (l1rad - l3rad)) + 0.00052 * Math.Sin(3 * l3rad - 7 * l4rad + pi3 + 3 * pi4) + -0.00043 * Math.Sin(l1rad - pi3) + 0.00041 * Math.Sin(5 * (l2rad - l3rad)) + 0.00041 * Math.Sin(pi4 - PI) + 0.00032 * Math.Sin(w2rad - w3rad) + 0.00032 * Math.Sin(2 * (l3rad - G - PI));

        double Sigma3 = 0.16490 * Math.Sin(l3rad - pi3) + 0.09081 * Math.Sin(l3rad - pi4) + -0.06907 * Math.Sin(l2rad - l3rad) + 0.03784 * Math.Sin(pi3 - pi4) + 0.01846 * Math.Sin(2 * (l3rad - l4rad)) + -0.01340 * Math.Sin(G) + -0.01014 * Math.Sin(2 * (psi - PI)) + 0.00704 * Math.Sin(l2rad - 2 * l3rad + pi3) + -0.00620 * Math.Sin(l2rad - 2 * l3rad + pi2) + -0.00541 * Math.Sin(l3rad - l4rad) + 0.00381 * Math.Sin(l2rad - 2 * l3rad + pi4) + 0.00235 * Math.Sin(psi - w3rad) + 0.00198 * Math.Sin(psi - w4rad) + 0.00176 * Math.Sin(philambda) + 0.00130 * Math.Sin(3 * (l3rad - l4rad)) + 0.00125 * Math.Sin(l1rad - l3rad) + -0.00119 * Math.Sin(5 * Gdash - 2 * G + CAACoordinateTransformation.DegreesToRadians(52.225)) + 0.00109 * Math.Sin(l1rad - l2rad) + -0.00100 * Math.Sin(3 * l3rad - 7 * l4rad + 4 * pi4) + 0.00091 * Math.Sin(w3rad - w4rad) + 0.00080 * Math.Sin(3 * l3rad - 7 * l4rad + pi3 + 3 * pi4) + -0.00075 * Math.Sin(2 * l2rad - 3 * l3rad + pi3) + 0.00072 * Math.Sin(pi1 + pi3 - 2 * PI - 2 * G) + 0.00069 * Math.Sin(pi4 - PI) + -0.00058 * Math.Sin(2 * l3rad - 3 * l4rad + pi4) + -0.00057 * Math.Sin(l3rad - 2 * l4rad + pi4) + 0.00056 * Math.Sin(l3rad + pi3 - 2 * PI - 2 * G) + -0.00052 * Math.Sin(l2rad - 2 * l3rad + pi1) + -0.00050 * Math.Sin(pi2 - pi3) + 0.00048 * Math.Sin(l3rad - 2 * l4rad + pi3) + -0.00045 * Math.Sin(2 * l2rad - 3 * l3rad + pi4) + -0.00041 * Math.Sin(pi2 - pi4) + -0.00038 * Math.Sin(2 * G) + -0.00037 * Math.Sin(pi3 - pi4 + w3rad - w4rad) + -0.00032 * Math.Sin(3 * l3rad - 7 * l4rad + 2 * pi3 + 2 * pi4) + 0.00030 * Math.Sin(4 * (l3rad - l4rad)) + 0.00029 * Math.Sin(l3rad + pi4 - 2 * PI - 2 * G) + -0.00028 * Math.Sin(w3rad + psi - 2 * PI - 2 * G) + 0.00026 * Math.Sin(l3rad - PI - G) + 0.00024 * Math.Sin(l2rad - 3 * l3rad + 2 * l4rad) + 0.00021 * Math.Sin(l3rad - PI - G) + -0.00021 * Math.Sin(l3rad - pi2) + 0.00017 * Math.Sin(2 * (l3rad - pi3));

        double Sigma4 = 0.84287 * Math.Sin(l4rad - pi4) + 0.03431 * Math.Sin(pi4 - pi3) + -0.03305 * Math.Sin(2 * (psi - PI)) + -0.03211 * Math.Sin(G) + -0.01862 * Math.Sin(l4rad - pi3) + 0.01186 * Math.Sin(psi - w4rad) + 0.00623 * Math.Sin(l4rad + pi4 - 2 * G - 2 * PI) + 0.00387 * Math.Sin(2 * (l4rad - pi4)) + -0.00284 * Math.Sin(5 * Gdash - 2 * G + CAACoordinateTransformation.DegreesToRadians(52.225)) + -0.00234 * Math.Sin(2 * (psi - pi4)) + -0.00223 * Math.Sin(l3rad - l4rad) + -0.00208 * Math.Sin(l4rad - PI) + 0.00178 * Math.Sin(psi + w4rad - 2 * pi4) + 0.00134 * Math.Sin(pi4 - PI) + 0.00125 * Math.Sin(2 * (l4rad - G - PI)) + -0.00117 * Math.Sin(2 * G) + -0.00112 * Math.Sin(2 * (l3rad - l4rad)) + 0.00107 * Math.Sin(3 * l3rad - 7 * l4rad + 4 * pi4) + 0.00102 * Math.Sin(l4rad - G - PI) + 0.00096 * Math.Sin(2 * l4rad - psi - w4rad) + 0.00087 * Math.Sin(2 * (psi - w4rad)) + -0.00085 * Math.Sin(3 * l3rad - 7 * l4rad + pi3 + 3 * pi4) + 0.00085 * Math.Sin(l3rad - 2 * l4rad + pi4) + -0.00081 * Math.Sin(2 * (l4rad - psi)) + 0.00071 * Math.Sin(l4rad + pi4 - 2 * PI - 3 * G) + 0.00061 * Math.Sin(l1rad - l4rad) + -0.00056 * Math.Sin(psi - w3rad) + -0.00054 * Math.Sin(l3rad - 2 * l4rad + pi3) + 0.00051 * Math.Sin(l2rad - l4rad) + 0.00042 * Math.Sin(2 * (psi - G - PI)) + 0.00039 * Math.Sin(2 * (pi4 - w4rad)) + 0.00036 * Math.Sin(psi + PI - pi4 - w4rad) + 0.00035 * Math.Sin(2 * Gdash - G + CAACoordinateTransformation.DegreesToRadians(188.37)) + -0.00035 * Math.Sin(l4rad - pi4 + 2 * PI - 2 * psi) + -0.00032 * Math.Sin(l4rad + pi4 - 2 * PI - G) + 0.00030 * Math.Sin(2 * Gdash - 2 * G + CAACoordinateTransformation.DegreesToRadians(149.15)) + 0.00029 * Math.Sin(3 * l3rad - 7 * l4rad + 2 * pi3 + 2 * pi4) + 0.00028 * Math.Sin(l4rad - pi4 + 2 * psi - 2 * PI) + -0.00028 * Math.Sin(2 * (l4rad - w4rad)) + -0.00027 * Math.Sin(pi3 - pi4 + w3rad - w4rad) + -0.00026 * Math.Sin(5 * Gdash - 3 * G + CAACoordinateTransformation.DegreesToRadians(188.37)) + 0.00025 * Math.Sin(w4rad - w3rad) + -0.00025 * Math.Sin(l2rad - 3 * l3rad + 2 * l4rad) + -0.00023 * Math.Sin(3 * (l3rad - l4rad)) + 0.00021 * Math.Sin(2 * l4rad - 2 * PI - 3 * G) + -0.00021 * Math.Sin(2 * l3rad - 3 * l4rad + pi4) + 0.00019 * Math.Sin(l4rad - pi4 - G) + -0.00019 * Math.Sin(2 * l4rad - pi3 - pi4) + -0.00018 * Math.Sin(l4rad - pi4 + G) + -0.00016 * Math.Sin(l4rad + pi3 - 2 * PI - 2 * G);

        details.Satellite1.MeanLongitude = CAACoordinateTransformation.MapTo0To360Range(l1);
        details.Satellite1.TrueLongitude = CAACoordinateTransformation.MapTo0To360Range(l1 + Sigma1);
        double L1 = CAACoordinateTransformation.DegreesToRadians(details.Satellite1.TrueLongitude);

        details.Satellite2.MeanLongitude = CAACoordinateTransformation.MapTo0To360Range(l2);
        details.Satellite2.TrueLongitude = CAACoordinateTransformation.MapTo0To360Range(l2 + Sigma2);
        double L2 = CAACoordinateTransformation.DegreesToRadians(details.Satellite2.TrueLongitude);

        details.Satellite3.MeanLongitude = CAACoordinateTransformation.MapTo0To360Range(l3);
        details.Satellite3.TrueLongitude = CAACoordinateTransformation.MapTo0To360Range(l3 + Sigma3);
        double L3 = CAACoordinateTransformation.DegreesToRadians(details.Satellite3.TrueLongitude);

        details.Satellite4.MeanLongitude = CAACoordinateTransformation.MapTo0To360Range(l4);
        details.Satellite4.TrueLongitude = CAACoordinateTransformation.MapTo0To360Range(l4 + Sigma4);
        double L4 = CAACoordinateTransformation.DegreesToRadians(details.Satellite4.TrueLongitude);

        //Calculate the periodic terms in the latitudes of the satellites
        double B1 = Math.Atan(0.0006393 * Math.Sin(L1 - w1rad) + 0.0001825 * Math.Sin(L1 - w2rad) + 0.0000329 * Math.Sin(L1 - w3rad) + -0.0000311 * Math.Sin(L1 - psi) + 0.0000093 * Math.Sin(L1 - w4rad) + 0.0000075 * Math.Sin(3 * L1 - 4 * l2rad - 1.9927 * Sigma1 + w2rad) + 0.0000046 * Math.Sin(L1 + psi - 2 * PI - 2 * G));

        details.Satellite1.EquatorialLatitude = CAACoordinateTransformation.RadiansToDegrees(B1);

        double B2 = Math.Atan(0.0081004 * Math.Sin(L2 - w2rad) + 0.0004512 * Math.Sin(L2 - w3rad) + -0.0003284 * Math.Sin(L2 - psi) + 0.0001160 * Math.Sin(L2 - w4rad) + 0.0000272 * Math.Sin(l1rad - 2 * l3rad + 1.0146 * Sigma2 + w2rad) + -0.0000144 * Math.Sin(L2 - w1rad) + 0.0000143 * Math.Sin(L2 + psi - 2 * PI - 2 * G) + 0.0000035 * Math.Sin(L2 - psi + G) + -0.0000028 * Math.Sin(l1rad - 2 * l3rad + 1.0146 * Sigma2 + w3rad));

        details.Satellite2.EquatorialLatitude = CAACoordinateTransformation.RadiansToDegrees(B2);

        double B3 = Math.Atan(0.0032402 * Math.Sin(L3 - w3rad) + -0.0016911 * Math.Sin(L3 - psi) + 0.0006847 * Math.Sin(L3 - w4rad) + -0.0002797 * Math.Sin(L3 - w2rad) + 0.0000321 * Math.Sin(L3 + psi - 2 * PI - 2 * G) + 0.0000051 * Math.Sin(L3 - psi + G) + -0.0000045 * Math.Sin(L3 - psi - G) + -0.0000045 * Math.Sin(L3 + psi - 2 * PI) + 0.0000037 * Math.Sin(L3 + psi - 2 * PI - 3 * G) + 0.0000030 * Math.Sin(2 * l2rad - 3 * L3 + 4.03 * Sigma3 + w2rad) + -0.0000021 * Math.Sin(2 * l2rad - 3 * L3 + 4.03 * Sigma3 + w3rad));

        details.Satellite3.EquatorialLatitude = CAACoordinateTransformation.RadiansToDegrees(B3);

        double B4 = Math.Atan(-0.0076579 * Math.Sin(L4 - psi) + 0.0044134 * Math.Sin(L4 - w4rad) + -0.0005112 * Math.Sin(L4 - w3rad) + 0.0000773 * Math.Sin(L4 + psi - 2 * PI - 2 * G) + 0.0000104 * Math.Sin(L4 - psi + G) + -0.0000102 * Math.Sin(L4 - psi - G) + 0.0000088 * Math.Sin(L4 + psi - 2 * PI - 3 * G) + -0.0000038 * Math.Sin(L4 + psi - 2 * PI - G));

        details.Satellite4.EquatorialLatitude = CAACoordinateTransformation.RadiansToDegrees(B4);

        //Calculate the periodic terms for the radius vector
        details.Satellite1.r = 5.90569 * (1 + (-0.0041339 * Math.Cos(2 * (l1rad - l2rad)) + -0.0000387 * Math.Cos(l1rad - pi3) + -0.0000214 * Math.Cos(l1rad - pi4) + 0.0000170 * Math.Cos(l1rad - l2rad) + -0.0000131 * Math.Cos(4 * (l1rad - l2rad)) + 0.0000106 * Math.Cos(l1rad - l3rad) + -0.0000066 * Math.Cos(l1rad + pi3 - 2 * PI - 2 * G)));

        details.Satellite2.r = 9.39657 * (1 + (0.0093848 * Math.Cos(l1rad - l2rad) + -0.0003116 * Math.Cos(l2rad - pi3) + -0.0001744 * Math.Cos(l2rad - pi4) + -0.0001442 * Math.Cos(l2rad - pi2) + 0.0000553 * Math.Cos(l2rad - l3rad) + 0.0000523 * Math.Cos(l1rad - l3rad) + -0.0000290 * Math.Cos(2 * (l1rad - l2rad)) + 0.0000164 * Math.Cos(2 * (l2rad - w2rad)) + 0.0000107 * Math.Cos(l1rad - 2 * l3rad + pi3) + -0.0000102 * Math.Cos(l2rad - pi1) + -0.0000091 * Math.Cos(2 * (l1rad - l3rad))));

        details.Satellite3.r = 14.98832 * (1 + (-0.0014388 * Math.Cos(l3rad - pi3) + -0.0007919 * Math.Cos(l3rad - pi4) + 0.0006342 * Math.Cos(l2rad - l3rad) + -0.0001761 * Math.Cos(2 * (l3rad - l4rad)) + 0.0000294 * Math.Cos(l3rad - l4rad) + -0.0000156 * Math.Cos(3 * (l3rad - l4rad)) + 0.0000156 * Math.Cos(l1rad - l3rad) + -0.0000153 * Math.Cos(l1rad - l2rad) + 0.0000070 * Math.Cos(2 * l2rad - 3 * l3rad + pi3) + -0.0000051 * Math.Cos(l3rad + pi3 - 2 * PI - 2 * G)));

        details.Satellite4.r = 26.36273 * (1 + (-0.0073546 * Math.Cos(l4rad - pi4) + 0.0001621 * Math.Cos(l4rad - pi3) + 0.0000974 * Math.Cos(l3rad - l4rad) + -0.0000543 * Math.Cos(l4rad + pi4 - 2 * PI - 2 * G) + -0.0000271 * Math.Cos(2 * (l4rad - pi4)) + 0.0000182 * Math.Cos(l4rad - PI) + 0.0000177 * Math.Cos(2 * (l3rad - l4rad)) + -0.0000167 * Math.Cos(2 * l4rad - psi - w4rad) + 0.0000167 * Math.Cos(psi - w4rad) + -0.0000155 * Math.Cos(2 * (l4rad - PI - G)) + 0.0000142 * Math.Cos(2 * (l4rad - psi)) + 0.0000105 * Math.Cos(l1rad - l4rad) + 0.0000092 * Math.Cos(l2rad - l4rad) + -0.0000089 * Math.Cos(l4rad - PI - G) + -0.0000062 * Math.Cos(l4rad + pi4 - 2 * PI - 3 * G) + 0.0000048 * Math.Cos(2 * (l4rad - w4rad))));



        //Calculate T0
        double T0 = (JD - 2433282.423) / 36525;

        //Calculate the precession in longitude from Epoch B1950 to the date
        double P = CAACoordinateTransformation.DegreesToRadians(1.3966626 * T0 + 0.0003088 * T0 * T0);

        //Add it to L1 - L4 and psi
        L1 += P;
        details.Satellite1.TropicalLongitude = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(L1));
        L2 += P;
        details.Satellite2.TropicalLongitude = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(L2));
        L3 += P;
        details.Satellite3.TropicalLongitude = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(L3));
        L4 += P;
        details.Satellite4.TropicalLongitude = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(L4));
        psi += P;

        //Calculate the inclination of Jupiter's axis of rotation on the orbital plane
        double T    = (JD - 2415020.5) / 36525;
        double I    = 3.120262 + 0.0006 * T;
        double Irad = CAACoordinateTransformation.DegreesToRadians(I);

        double X1 = details.Satellite1.r * Math.Cos(L1 - psi) * Math.Cos(B1);
        double X2 = details.Satellite2.r * Math.Cos(L2 - psi) * Math.Cos(B2);
        double X3 = details.Satellite3.r * Math.Cos(L3 - psi) * Math.Cos(B3);
        double X4 = details.Satellite4.r * Math.Cos(L4 - psi) * Math.Cos(B4);
        double X5 = 0;

        double Y1 = details.Satellite1.r * Math.Sin(L1 - psi) * Math.Cos(B1);
        double Y2 = details.Satellite2.r * Math.Sin(L2 - psi) * Math.Cos(B2);
        double Y3 = details.Satellite3.r * Math.Sin(L3 - psi) * Math.Cos(B3);
        double Y4 = details.Satellite4.r * Math.Sin(L4 - psi) * Math.Cos(B4);
        double Y5 = 0;

        double Z1 = details.Satellite1.r * Math.Sin(B1);
        double Z2 = details.Satellite2.r * Math.Sin(B2);
        double Z3 = details.Satellite3.r * Math.Sin(B3);
        double Z4 = details.Satellite4.r * Math.Sin(B4);
        double Z5 = 1;

        //Now do the rotations, first for the ficticious 5th satellite, so that we can calculate D
        double          omega = CAACoordinateTransformation.DegreesToRadians(CAAElementsPlanetaryOrbit.JupiterLongitudeAscendingNode(JD));
        double          i     = CAACoordinateTransformation.DegreesToRadians(CAAElementsPlanetaryOrbit.JupiterInclination(JD));
        double          A6    = 0;
        double          B6    = 0;
        double          C6    = 0;
        CAA3DCoordinate north = new CAA3DCoordinate();

        Rotations(X5, Y5, Z5, Irad, psi, i, omega, lambda0, beta0, ref A6, ref B6, ref C6, out north);
        double D = Math.Atan2(A6, C6);

        //Now calculate the values for satellite 1
        Rotations(X1, Y1, Z1, Irad, psi, i, omega, lambda0, beta0, ref A6, ref B6, ref C6, out details.Satellite1.EclipticRectangularCoordinates);
        details.Satellite1.TrueRectangularCoordinates.X = A6 * Math.Cos(D) - C6 * Math.Sin(D);
        details.Satellite1.TrueRectangularCoordinates.Y = A6 * Math.Sin(D) + C6 * Math.Cos(D);
        details.Satellite1.TrueRectangularCoordinates.Z = B6;

        //Now calculate the values for satellite 2
        Rotations(X2, Y2, Z2, Irad, psi, i, omega, lambda0, beta0, ref A6, ref B6, ref C6, out details.Satellite2.EclipticRectangularCoordinates);
        details.Satellite2.TrueRectangularCoordinates.X = A6 * Math.Cos(D) - C6 * Math.Sin(D);
        details.Satellite2.TrueRectangularCoordinates.Y = A6 * Math.Sin(D) + C6 * Math.Cos(D);
        details.Satellite2.TrueRectangularCoordinates.Z = B6;

        //Now calculate the values for satellite 3
        Rotations(X3, Y3, Z3, Irad, psi, i, omega, lambda0, beta0, ref A6, ref B6, ref C6, out details.Satellite3.EclipticRectangularCoordinates);
        details.Satellite3.TrueRectangularCoordinates.X = A6 * Math.Cos(D) - C6 * Math.Sin(D);
        details.Satellite3.TrueRectangularCoordinates.Y = A6 * Math.Sin(D) + C6 * Math.Cos(D);
        details.Satellite3.TrueRectangularCoordinates.Z = B6;

        //And finally for satellite 4
        Rotations(X4, Y4, Z4, Irad, psi, i, omega, lambda0, beta0, ref A6, ref B6, ref C6, out details.Satellite4.EclipticRectangularCoordinates);
        details.Satellite4.TrueRectangularCoordinates.X = A6 * Math.Cos(D) - C6 * Math.Sin(D);
        details.Satellite4.TrueRectangularCoordinates.Y = A6 * Math.Sin(D) + C6 * Math.Cos(D);
        details.Satellite4.TrueRectangularCoordinates.Z = B6;

        //apply the differential light-time correction
        details.Satellite1.ApparentRectangularCoordinates.X = details.Satellite1.TrueRectangularCoordinates.X + Math.Abs(details.Satellite1.TrueRectangularCoordinates.Z) / 17295 * Math.Sqrt(1 - (details.Satellite1.TrueRectangularCoordinates.X / details.Satellite1.r) * (details.Satellite1.TrueRectangularCoordinates.X / details.Satellite1.r));
        details.Satellite1.ApparentRectangularCoordinates.Y = details.Satellite1.TrueRectangularCoordinates.Y;
        details.Satellite1.ApparentRectangularCoordinates.Z = details.Satellite1.TrueRectangularCoordinates.Z;

        details.Satellite2.ApparentRectangularCoordinates.X = details.Satellite2.TrueRectangularCoordinates.X + Math.Abs(details.Satellite2.TrueRectangularCoordinates.Z) / 21819 * Math.Sqrt(1 - (details.Satellite2.TrueRectangularCoordinates.X / details.Satellite2.r) * (details.Satellite2.TrueRectangularCoordinates.X / details.Satellite2.r));
        details.Satellite2.ApparentRectangularCoordinates.Y = details.Satellite2.TrueRectangularCoordinates.Y;
        details.Satellite2.ApparentRectangularCoordinates.Z = details.Satellite2.TrueRectangularCoordinates.Z;

        details.Satellite3.ApparentRectangularCoordinates.X = details.Satellite3.TrueRectangularCoordinates.X + Math.Abs(details.Satellite3.TrueRectangularCoordinates.Z) / 27558 * Math.Sqrt(1 - (details.Satellite3.TrueRectangularCoordinates.X / details.Satellite3.r) * (details.Satellite3.TrueRectangularCoordinates.X / details.Satellite3.r));
        details.Satellite3.ApparentRectangularCoordinates.Y = details.Satellite3.TrueRectangularCoordinates.Y;
        details.Satellite3.ApparentRectangularCoordinates.Z = details.Satellite3.TrueRectangularCoordinates.Z;

        details.Satellite4.ApparentRectangularCoordinates.X = details.Satellite4.TrueRectangularCoordinates.X + Math.Abs(details.Satellite4.TrueRectangularCoordinates.Z) / 36548 * Math.Sqrt(1 - (details.Satellite4.TrueRectangularCoordinates.X / details.Satellite4.r) * (details.Satellite4.TrueRectangularCoordinates.X / details.Satellite4.r));
        details.Satellite4.ApparentRectangularCoordinates.Y = details.Satellite4.TrueRectangularCoordinates.Y;
        details.Satellite4.ApparentRectangularCoordinates.Z = details.Satellite4.TrueRectangularCoordinates.Z;

        //apply the perspective effect correction
        double W = DELTA / (DELTA + details.Satellite1.TrueRectangularCoordinates.Z / 2095);

        details.Satellite1.ApparentRectangularCoordinates.X *= W;
        details.Satellite1.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite2.TrueRectangularCoordinates.Z / 2095);
        details.Satellite2.ApparentRectangularCoordinates.X *= W;
        details.Satellite2.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite3.TrueRectangularCoordinates.Z / 2095);
        details.Satellite3.ApparentRectangularCoordinates.X *= W;
        details.Satellite3.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite4.TrueRectangularCoordinates.Z / 2095);
        details.Satellite4.ApparentRectangularCoordinates.X *= W;
        details.Satellite4.ApparentRectangularCoordinates.Y *= W;

        return(details);
    }
コード例 #6
0
//Static methods
    public static CAAGalileanMoonsDetails Calculate(double JD)
    {
        //Calculate the position of the Sun
        double sunlong    = CAASun.GeometricEclipticLongitude(JD);
        double sunlongrad = CAACoordinateTransformation.DegreesToRadians(sunlong);
        double beta       = CAASun.GeometricEclipticLatitude(JD);
        double betarad    = CAACoordinateTransformation.DegreesToRadians(beta);
        double R          = CAAEarth.RadiusVector(JD);

        //Calculate the the light travel time from Jupiter to the Earth
        double DELTA = 5;
        double PreviousEarthLightTravelTime = 0;
        double EarthLightTravelTime         = CAAElliptical.DistanceToLightTime(DELTA);
        double JD1      = JD - EarthLightTravelTime;
        bool   bIterate = true;
        double x        = 0;
        double y        = 0;
        double z        = 0;

        double l    = 0;
        double lrad = 0;
        double b    = 0;
        double brad = 0;
        double r    = 0;

        while (bIterate)
        {
            //Calculate the position of Jupiter
            l    = CAAJupiter.EclipticLongitude(JD1);
            lrad = CAACoordinateTransformation.DegreesToRadians(l);
            b    = CAAJupiter.EclipticLatitude(JD1);
            brad = CAACoordinateTransformation.DegreesToRadians(b);
            r    = CAAJupiter.RadiusVector(JD1);

            x     = r * Math.Cos(brad) * Math.Cos(lrad) + R * Math.Cos(sunlongrad);
            y     = r * Math.Cos(brad) * Math.Sin(lrad) + R * Math.Sin(sunlongrad);
            z     = r * Math.Sin(brad) + R * Math.Sin(betarad);
            DELTA = Math.Sqrt(x * x + y * y + z * z);
            EarthLightTravelTime = CAAElliptical.DistanceToLightTime(DELTA);

            //Prepare for the next loop around
            bIterate = (Math.Abs(EarthLightTravelTime - PreviousEarthLightTravelTime) > 2E-6); //2E-6 corresponds to 0.17 of a second
            if (bIterate)
            {
                JD1 = JD - EarthLightTravelTime;
                PreviousEarthLightTravelTime = EarthLightTravelTime;
            }
        }

        //Calculate the details as seen from the earth
        CAAGalileanMoonsDetails details1 = CalculateHelper(JD, sunlongrad, betarad, R);

        FillInPhenomenaDetails(ref details1.Satellite1);
        FillInPhenomenaDetails(ref details1.Satellite2);
        FillInPhenomenaDetails(ref details1.Satellite3);
        FillInPhenomenaDetails(ref details1.Satellite4);

        //Calculate the the light travel time from Jupiter to the Sun
        JD1   = JD - EarthLightTravelTime;
        l     = CAAJupiter.EclipticLongitude(JD1);
        lrad  = CAACoordinateTransformation.DegreesToRadians(l);
        b     = CAAJupiter.EclipticLatitude(JD1);
        brad  = CAACoordinateTransformation.DegreesToRadians(b);
        r     = CAAJupiter.RadiusVector(JD1);
        x     = r * Math.Cos(brad) * Math.Cos(lrad);
        y     = r * Math.Cos(brad) * Math.Sin(lrad);
        z     = r * Math.Sin(brad);
        DELTA = Math.Sqrt(x * x + y * y + z * z);
        double SunLightTravelTime = CAAElliptical.DistanceToLightTime(DELTA);

        //Calculate the details as seen from the Sun
        CAAGalileanMoonsDetails details2 = CalculateHelper(JD + SunLightTravelTime - EarthLightTravelTime, sunlongrad, betarad, 0);

        FillInPhenomenaDetails(ref details2.Satellite1);
        FillInPhenomenaDetails(ref details2.Satellite2);
        FillInPhenomenaDetails(ref details2.Satellite3);
        FillInPhenomenaDetails(ref details2.Satellite4);

        //Finally transfer the required values from details2 to details1
        details1.Satellite1.bInEclipse       = details2.Satellite1.bInOccultation;
        details1.Satellite2.bInEclipse       = details2.Satellite2.bInOccultation;
        details1.Satellite3.bInEclipse       = details2.Satellite3.bInOccultation;
        details1.Satellite4.bInEclipse       = details2.Satellite4.bInOccultation;
        details1.Satellite1.bInShadowTransit = details2.Satellite1.bInTransit;
        details1.Satellite2.bInShadowTransit = details2.Satellite2.bInTransit;
        details1.Satellite3.bInShadowTransit = details2.Satellite3.bInTransit;
        details1.Satellite4.bInShadowTransit = details2.Satellite4.bInTransit;
//C++ TO C# CONVERTER WARNING: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created if it does not yet exist:
//ORIGINAL LINE: details1.Satellite1.ApparentShadowRectangularCoordinates = details2.Satellite1.ApparentRectangularCoordinates;
        details1.Satellite1.ApparentShadowRectangularCoordinates = details2.Satellite1.ApparentRectangularCoordinates;
//C++ TO C# CONVERTER WARNING: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created if it does not yet exist:
//ORIGINAL LINE: details1.Satellite2.ApparentShadowRectangularCoordinates = details2.Satellite2.ApparentRectangularCoordinates;
        details1.Satellite2.ApparentShadowRectangularCoordinates = details2.Satellite2.ApparentRectangularCoordinates;
//C++ TO C# CONVERTER WARNING: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created if it does not yet exist:
//ORIGINAL LINE: details1.Satellite3.ApparentShadowRectangularCoordinates = details2.Satellite3.ApparentRectangularCoordinates;
        details1.Satellite3.ApparentShadowRectangularCoordinates = details2.Satellite3.ApparentRectangularCoordinates;
//C++ TO C# CONVERTER WARNING: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created if it does not yet exist:
//ORIGINAL LINE: details1.Satellite4.ApparentShadowRectangularCoordinates = details2.Satellite4.ApparentRectangularCoordinates;
        details1.Satellite4.ApparentShadowRectangularCoordinates = details2.Satellite4.ApparentRectangularCoordinates;
        return(details1);
    }
コード例 #7
0
    public static CAAEllipticalPlanetaryDetails Calculate(double JD, EllipticalObject @object)
    {
        //What will the the return value
        CAAEllipticalPlanetaryDetails details = new CAAEllipticalPlanetaryDetails();

        double JD0   = JD;
        double L0    = 0;
        double B0    = 0;
        double R0    = 0;
        double cosB0 = 0;

        if (@object != EllipticalObject.SUN)
        {
            L0    = CAAEarth.EclipticLongitude(JD0);
            B0    = CAAEarth.EclipticLatitude(JD0);
            R0    = CAAEarth.RadiusVector(JD0);
            L0    = CAACoordinateTransformation.DegreesToRadians(L0);
            B0    = CAACoordinateTransformation.DegreesToRadians(B0);
            cosB0 = Math.Cos(B0);
        }


        //Calculate the initial values
        double L = 0;
        double B = 0;
        double R = 0;

        double Lrad;
        double Brad;
        double cosB;
        double cosL;
        double x;
        double y;
        double z;
        bool   bRecalc      = true;
        bool   bFirstRecalc = true;
        double LPrevious    = 0;
        double BPrevious    = 0;
        double RPrevious    = 0;

        while (bRecalc)
        {
            switch (@object)
            {
            case EllipticalObject.SUN:
            {
                L = CAASun.GeometricEclipticLongitude(JD0);
                B = CAASun.GeometricEclipticLatitude(JD0);
                R = CAAEarth.RadiusVector(JD0);
                break;
            }

            case EllipticalObject.MERCURY:
            {
                L = CAAMercury.EclipticLongitude(JD0);
                B = CAAMercury.EclipticLatitude(JD0);
                R = CAAMercury.RadiusVector(JD0);
                break;
            }

            case EllipticalObject.VENUS:
            {
                L = CAAVenus.EclipticLongitude(JD0);
                B = CAAVenus.EclipticLatitude(JD0);
                R = CAAVenus.RadiusVector(JD0);
                break;
            }

            case EllipticalObject.MARS:
            {
                L = CAAMars.EclipticLongitude(JD0);
                B = CAAMars.EclipticLatitude(JD0);
                R = CAAMars.RadiusVector(JD0);
                break;
            }

            case EllipticalObject.JUPITER:
            {
                L = CAAJupiter.EclipticLongitude(JD0);
                B = CAAJupiter.EclipticLatitude(JD0);
                R = CAAJupiter.RadiusVector(JD0);
                break;
            }

            case EllipticalObject.SATURN:
            {
                L = CAASaturn.EclipticLongitude(JD0);
                B = CAASaturn.EclipticLatitude(JD0);
                R = CAASaturn.RadiusVector(JD0);
                break;
            }

            case EllipticalObject.URANUS:
            {
                L = CAAUranus.EclipticLongitude(JD0);
                B = CAAUranus.EclipticLatitude(JD0);
                R = CAAUranus.RadiusVector(JD0);
                break;
            }

            case EllipticalObject.NEPTUNE:
            {
                L = CAANeptune.EclipticLongitude(JD0);
                B = CAANeptune.EclipticLatitude(JD0);
                R = CAANeptune.RadiusVector(JD0);
                break;
            }

            case EllipticalObject.PLUTO:
            {
                L = CAAPluto.EclipticLongitude(JD0);
                B = CAAPluto.EclipticLatitude(JD0);
                R = CAAPluto.RadiusVector(JD0);
                break;
            }

            default:
            {
                Debug.Assert(false);
                break;
            }
            }

            if (!bFirstRecalc)
            {
                bRecalc   = ((Math.Abs(L - LPrevious) > 0.00001) || (Math.Abs(B - BPrevious) > 0.00001) || (Math.Abs(R - RPrevious) > 0.000001));
                LPrevious = L;
                BPrevious = B;
                RPrevious = R;
            }
            else
            {
                bFirstRecalc = false;
            }



            //Calculate the new value
            if (bRecalc)
            {
                double distance = 0;
                if (@object != EllipticalObject.SUN)
                {
                    Lrad     = CAACoordinateTransformation.DegreesToRadians(L);
                    Brad     = CAACoordinateTransformation.DegreesToRadians(B);
                    cosB     = Math.Cos(Brad);
                    cosL     = Math.Cos(Lrad);
                    x        = R * cosB * cosL - R0 * cosB0 * Math.Cos(L0);
                    y        = R * cosB * Math.Sin(Lrad) - R0 * cosB0 * Math.Sin(L0);
                    z        = R * Math.Sin(Brad) - R0 * Math.Sin(B0);
                    distance = Math.Sqrt(x * x + y * y + z * z);
                }
                else
                {
                    distance = R; //Distance to the sun from the earth is in fact the radius vector
                }
                //Prepare for the next loop around
                JD0 = JD - CAAElliptical.DistanceToLightTime(distance);
            }
        }

        Lrad = CAACoordinateTransformation.DegreesToRadians(L);
        Brad = CAACoordinateTransformation.DegreesToRadians(B);
        cosB = Math.Cos(Brad);
        cosL = Math.Cos(Lrad);
        x    = R * cosB * cosL - R0 * cosB0 * Math.Cos(L0);
        y    = R * cosB * Math.Sin(Lrad) - R0 * cosB0 * Math.Sin(L0);
        z    = R * Math.Sin(Brad) - R0 * Math.Sin(B0);
        double x2 = x * x;
        double y2 = y * y;

        details.ApparentGeocentricLatitude  = CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(z, Math.Sqrt(x2 + y2)));
        details.ApparentGeocentricDistance  = Math.Sqrt(x2 + y2 + z * z);
        details.ApparentGeocentricLongitude = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(y, x)));
        details.ApparentLightTime           = CAAElliptical.DistanceToLightTime(details.ApparentGeocentricDistance);

        //Adjust for Aberration
        CAA2DCoordinate Aberration = CAAAberration.EclipticAberration(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, JD);

        details.ApparentGeocentricLongitude += Aberration.X;
        details.ApparentGeocentricLatitude  += Aberration.Y;

        //convert to the FK5 system
        double DeltaLong = CAAFK5.CorrectionInLongitude(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, JD);

        details.ApparentGeocentricLatitude  += CAAFK5.CorrectionInLatitude(details.ApparentGeocentricLongitude, JD);
        details.ApparentGeocentricLongitude += DeltaLong;

        //Correct for nutation
        double NutationInLongitude = CAANutation.NutationInLongitude(JD);
        double Epsilon             = CAANutation.TrueObliquityOfEcliptic(JD);

        details.ApparentGeocentricLongitude += CAACoordinateTransformation.DMSToDegrees(0, 0, NutationInLongitude);

        //Convert to RA and Dec
        CAA2DCoordinate ApparentEqu = CAACoordinateTransformation.Ecliptic2Equatorial(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, Epsilon);

        details.ApparentGeocentricRA          = ApparentEqu.X;
        details.ApparentGeocentricDeclination = ApparentEqu.Y;

        return(details);
    }
コード例 #8
0
        public static AstroRaDec GetPlanet(double jDate, int planet, double locLat, double locLong, double locHeight)
        {
            locLong = -locLong;
            if (planet < 9)
            {
                CAAEllipticalPlanetaryDetails Details = CAAElliptical.Calculate(jDate, (EllipticalObject)planet);
                CAA2DCoordinate corrected             = CAAParallax.Equatorial2Topocentric(Details.ApparentGeocentricRA, Details.ApparentGeocentricDeclination, Details.ApparentGeocentricDistance, locLong, locLat, locHeight, jDate);
                return(new AstroRaDec(corrected.X, corrected.Y, Details.ApparentGeocentricDistance, false, false));
            }
            else if (planet == 9)
            {
                double          lat       = CAAMoon.EclipticLatitude(jDate);
                double          lng       = CAAMoon.EclipticLongitude(jDate);
                double          dis       = CAAMoon.RadiusVector(jDate) / 149598000;
                double          epsilon   = CAANutation.TrueObliquityOfEcliptic(jDate);
                CAA2DCoordinate d         = CAACoordinateTransformation.Ecliptic2Equatorial(lng, lat, epsilon);
                CAA2DCoordinate corrected = CAAParallax.Equatorial2Topocentric(d.X, d.Y, dis, locLong, locLat, locHeight, jDate);

                return(new AstroRaDec(corrected.X, corrected.Y, dis, false, false));
            }
            else
            {
                if (jDate != jDateLast)
                {
                    jupDetails  = CAAElliptical.Calculate(jDate, (EllipticalObject)4);
                    jupPhisical = CAAPhysicalJupiter.Calculate(jDate);
                    CAA2DCoordinate corrected = CAAParallax.Equatorial2Topocentric(jupDetails.ApparentGeocentricRA, jupDetails.ApparentGeocentricDeclination, jupDetails.ApparentGeocentricDistance, locLong, locLat, locHeight, jDate);
                    jupDetails.ApparentGeocentricRA          = corrected.X;
                    jupDetails.ApparentGeocentricDeclination = corrected.Y;
                    galDetails = CAAGalileanMoons.Calculate(jDate);
                    jDateLast  = jDate;
                }


                double jupiterDiameter = 0.000954501;
                double scale           = (Math.Atan(.5 * (jupiterDiameter / jupDetails.ApparentGeocentricDistance))) / 3.1415927 * 180;

                double raScale = (scale / Math.Cos(jupDetails.ApparentGeocentricDeclination / 180.0 * 3.1415927)) / 15;

                double xMoon    = 0;
                double yMoon    = 0;
                double zMoon    = 0;
                bool   shadow   = false;
                bool   eclipsed = false;

                switch (planet)
                {
                case 10:                         // IO
                    xMoon    = galDetails.Satellite1.ApparentRectangularCoordinates.X;
                    yMoon    = galDetails.Satellite1.ApparentRectangularCoordinates.Y;
                    zMoon    = galDetails.Satellite1.ApparentRectangularCoordinates.Z;
                    eclipsed = galDetails.Satellite1.bInEclipse;
                    shadow   = galDetails.Satellite1.bInShadowTransit;
                    break;

                case 11:                         //Europa
                    xMoon    = galDetails.Satellite2.ApparentRectangularCoordinates.X;
                    yMoon    = galDetails.Satellite2.ApparentRectangularCoordinates.Y;
                    zMoon    = galDetails.Satellite2.ApparentRectangularCoordinates.Z;
                    eclipsed = galDetails.Satellite2.bInEclipse;
                    shadow   = galDetails.Satellite2.bInShadowTransit;
                    break;

                case 12:                         //Ganymede
                    xMoon    = galDetails.Satellite3.ApparentRectangularCoordinates.X;
                    yMoon    = galDetails.Satellite3.ApparentRectangularCoordinates.Y;
                    zMoon    = galDetails.Satellite3.ApparentRectangularCoordinates.Z;
                    eclipsed = galDetails.Satellite3.bInEclipse;
                    shadow   = galDetails.Satellite3.bInShadowTransit;
                    break;

                case 13:                         //Callisto
                    xMoon    = galDetails.Satellite4.ApparentRectangularCoordinates.X;
                    yMoon    = galDetails.Satellite4.ApparentRectangularCoordinates.Y;
                    zMoon    = galDetails.Satellite4.ApparentRectangularCoordinates.Z;
                    eclipsed = galDetails.Satellite4.bInEclipse;
                    shadow   = galDetails.Satellite4.bInShadowTransit;
                    break;

                case 14:                         // IO Shadow
                    xMoon  = galDetails.Satellite1.ApparentShadowRectangularCoordinates.X;
                    yMoon  = galDetails.Satellite1.ApparentShadowRectangularCoordinates.Y;
                    zMoon  = galDetails.Satellite1.ApparentShadowRectangularCoordinates.Z * .9;
                    shadow = galDetails.Satellite1.bInShadowTransit;
                    break;

                case 15:                         //Europa Shadow
                    xMoon  = galDetails.Satellite2.ApparentShadowRectangularCoordinates.X;
                    yMoon  = galDetails.Satellite2.ApparentShadowRectangularCoordinates.Y;
                    zMoon  = galDetails.Satellite2.ApparentShadowRectangularCoordinates.Z * .9;
                    shadow = galDetails.Satellite2.bInShadowTransit;
                    break;

                case 16:                         //Ganymede Shadow
                    xMoon  = galDetails.Satellite3.ApparentShadowRectangularCoordinates.X;
                    yMoon  = galDetails.Satellite3.ApparentShadowRectangularCoordinates.Y;
                    zMoon  = galDetails.Satellite3.ApparentShadowRectangularCoordinates.Z * .9;
                    shadow = galDetails.Satellite3.bInShadowTransit;
                    break;

                case 17:                         //Callisto Shadow
                    xMoon  = galDetails.Satellite4.ApparentShadowRectangularCoordinates.X;
                    yMoon  = galDetails.Satellite4.ApparentShadowRectangularCoordinates.Y;
                    zMoon  = galDetails.Satellite4.ApparentShadowRectangularCoordinates.Z * .9;
                    shadow = galDetails.Satellite4.bInShadowTransit;
                    break;
                }

                double xTemp;
                double yTemp;
                double radians = jupPhisical.P / 180.0 * 3.1415927;
                xTemp = xMoon * Math.Cos(radians) - yMoon * Math.Sin(radians);
                yTemp = xMoon * Math.Sin(radians) + yMoon * Math.Cos(radians);
                xMoon = xTemp;
                yMoon = yTemp;

                return(new AstroRaDec(jupDetails.ApparentGeocentricRA - (xMoon * raScale), jupDetails.ApparentGeocentricDeclination + yMoon * scale, jupDetails.ApparentGeocentricDistance + (zMoon * jupiterDiameter / 2), shadow, eclipsed));
            }
        }
コード例 #9
0
//Static methods
    public static CAASaturnMoonsDetails Calculate(double JD)
    {
        //Calculate the position of the Sun
        double sunlong    = CAASun.GeometricEclipticLongitude(JD);
        double sunlongrad = CAACoordinateTransformation.DegreesToRadians(sunlong);
        double beta       = CAASun.GeometricEclipticLatitude(JD);
        double betarad    = CAACoordinateTransformation.DegreesToRadians(beta);
        double R          = CAAEarth.RadiusVector(JD);

        //Calculate the the light travel time from Saturn to the Earth
        double DELTA = 9;
        double PreviousEarthLightTravelTime = 0;
        double EarthLightTravelTime         = CAAElliptical.DistanceToLightTime(DELTA);
        double JD1      = JD - EarthLightTravelTime;
        bool   bIterate = true;
        double x        = 0;
        double y        = 0;
        double z        = 0;
        double l        = 0;
        double lrad     = 0;
        double b        = 0;
        double brad     = 0;
        double r        = 0;

        while (bIterate)
        {
            //Calculate the position of Jupiter
            l    = CAASaturn.EclipticLongitude(JD1);
            lrad = CAACoordinateTransformation.DegreesToRadians(l);
            b    = CAASaturn.EclipticLatitude(JD1);
            brad = CAACoordinateTransformation.DegreesToRadians(b);
            r    = CAASaturn.RadiusVector(JD1);

            x     = r * Math.Cos(brad) * Math.Cos(lrad) + R * Math.Cos(sunlongrad);
            y     = r * Math.Cos(brad) * Math.Sin(lrad) + R * Math.Sin(sunlongrad);
            z     = r * Math.Sin(brad) + R * Math.Sin(betarad);
            DELTA = Math.Sqrt(x * x + y * y + z * z);
            EarthLightTravelTime = CAAElliptical.DistanceToLightTime(DELTA);

            //Prepare for the next loop around
            bIterate = (Math.Abs(EarthLightTravelTime - PreviousEarthLightTravelTime) > 2E-6); //2E-6 corresponds to 0.17 of a second
            if (bIterate)
            {
                JD1 = JD - EarthLightTravelTime;
                PreviousEarthLightTravelTime = EarthLightTravelTime;
            }
        }

        //Calculate the details as seen from the earth
        CAASaturnMoonsDetails details1 = CalculateHelper(JD, sunlongrad, betarad, R);

        FillInPhenomenaDetails(ref details1.Satellite1);
        FillInPhenomenaDetails(ref details1.Satellite2);
        FillInPhenomenaDetails(ref details1.Satellite3);
        FillInPhenomenaDetails(ref details1.Satellite4);
        FillInPhenomenaDetails(ref details1.Satellite5);
        FillInPhenomenaDetails(ref details1.Satellite6);
        FillInPhenomenaDetails(ref details1.Satellite7);
        FillInPhenomenaDetails(ref details1.Satellite8);

        //Calculate the the light travel time from Saturn to the Sun
        JD1   = JD - EarthLightTravelTime;
        l     = CAASaturn.EclipticLongitude(JD1);
        lrad  = CAACoordinateTransformation.DegreesToRadians(l);
        b     = CAASaturn.EclipticLatitude(JD1);
        brad  = CAACoordinateTransformation.DegreesToRadians(b);
        r     = CAASaturn.RadiusVector(JD1);
        x     = r * Math.Cos(brad) * Math.Cos(lrad);
        y     = r * Math.Cos(brad) * Math.Sin(lrad);
        z     = r * Math.Sin(brad);
        DELTA = Math.Sqrt(x * x + y * y + z * z);
        double SunLightTravelTime = CAAElliptical.DistanceToLightTime(DELTA);

        //Calculate the details as seen from the Sun
        CAASaturnMoonsDetails details2 = CalculateHelper(JD + SunLightTravelTime - EarthLightTravelTime, sunlongrad, betarad, 0);

        FillInPhenomenaDetails(ref details2.Satellite1);
        FillInPhenomenaDetails(ref details2.Satellite2);
        FillInPhenomenaDetails(ref details2.Satellite3);
        FillInPhenomenaDetails(ref details2.Satellite4);
        FillInPhenomenaDetails(ref details2.Satellite5);
        FillInPhenomenaDetails(ref details2.Satellite6);
        FillInPhenomenaDetails(ref details2.Satellite7);
        FillInPhenomenaDetails(ref details2.Satellite8);

        //Finally transfer the required values from details2 to details1
        details1.Satellite1.bInEclipse       = details2.Satellite1.bInOccultation;
        details1.Satellite2.bInEclipse       = details2.Satellite2.bInOccultation;
        details1.Satellite3.bInEclipse       = details2.Satellite3.bInOccultation;
        details1.Satellite4.bInEclipse       = details2.Satellite4.bInOccultation;
        details1.Satellite5.bInEclipse       = details2.Satellite5.bInOccultation;
        details1.Satellite6.bInEclipse       = details2.Satellite6.bInOccultation;
        details1.Satellite7.bInEclipse       = details2.Satellite7.bInOccultation;
        details1.Satellite8.bInEclipse       = details2.Satellite8.bInOccultation;
        details1.Satellite1.bInShadowTransit = details2.Satellite1.bInTransit;
        details1.Satellite2.bInShadowTransit = details2.Satellite2.bInTransit;
        details1.Satellite3.bInShadowTransit = details2.Satellite3.bInTransit;
        details1.Satellite4.bInShadowTransit = details2.Satellite4.bInTransit;
        details1.Satellite5.bInShadowTransit = details2.Satellite5.bInTransit;
        details1.Satellite6.bInShadowTransit = details2.Satellite6.bInTransit;
        details1.Satellite7.bInShadowTransit = details2.Satellite7.bInTransit;
        details1.Satellite8.bInShadowTransit = details2.Satellite8.bInTransit;

        return(details1);
    }
コード例 #10
0
    protected static CAASaturnMoonsDetails CalculateHelper(double JD, double sunlongrad, double betarad, double R)
    {
        //What will be the return value
        CAASaturnMoonsDetails details = new CAASaturnMoonsDetails();

        //Calculate the position of Saturn decreased by the light travel time from Saturn to the specified position
        double DELTA = 9;
        double PreviousLightTravelTime = 0;
        double LightTravelTime         = CAAElliptical.DistanceToLightTime(DELTA);
        double x        = 0;
        double y        = 0;
        double z        = 0;
        double l        = 0;
        double lrad     = 0;
        double b        = 0;
        double brad     = 0;
        double r        = 0;
        double JD1      = JD - LightTravelTime;
        bool   bIterate = true;

        while (bIterate)
        {
            //Calculate the position of Saturn
            l    = CAASaturn.EclipticLongitude(JD1);
            lrad = CAACoordinateTransformation.DegreesToRadians(l);
            b    = CAASaturn.EclipticLatitude(JD1);
            brad = CAACoordinateTransformation.DegreesToRadians(b);
            r    = CAASaturn.RadiusVector(JD1);

            x               = r * Math.Cos(brad) * Math.Cos(lrad) + R * Math.Cos(sunlongrad);
            y               = r * Math.Cos(brad) * Math.Sin(lrad) + R * Math.Sin(sunlongrad);
            z               = r * Math.Sin(brad) + R * Math.Sin(betarad);
            DELTA           = Math.Sqrt(x * x + y * y + z * z);
            LightTravelTime = CAAElliptical.DistanceToLightTime(DELTA);

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

        //Calculate Saturn's Longitude and Latitude
        double lambda0 = Math.Atan2(y, x);

        lambda0 = CAACoordinateTransformation.RadiansToDegrees(lambda0);
        double beta0 = Math.Atan(z / Math.Sqrt(x * x + y * y));

        beta0 = CAACoordinateTransformation.RadiansToDegrees(beta0);

        //Precess the longtitude and Latitutude to B1950.0
        CAA2DCoordinate Saturn1950 = CAAPrecession.PrecessEcliptic(lambda0, beta0, JD, 2433282.4235);

        lambda0 = Saturn1950.X;
        double lambda0rad = CAACoordinateTransformation.DegreesToRadians(lambda0);

        beta0 = Saturn1950.Y;
        double beta0rad = CAACoordinateTransformation.DegreesToRadians(beta0);

        double JDE = JD - LightTravelTime;

        double t1   = JDE - 2411093.0;
        double t2   = t1 / 365.25;
        double t3   = ((JDE - 2433282.423) / 365.25) + 1950.0;
        double t4   = JDE - 2411368.0;
        double t5   = t4 / 365.25;
        double t6   = JDE - 2415020.0;
        double t7   = t6 / 36525.0;
        double t8   = t6 / 365.25;
        double t9   = (JDE - 2442000.5) / 365.25;
        double t10  = JDE - 2409786.0;
        double t11  = t10 / 36525.0;
        double t112 = t11 * t11;
        double t113 = t112 * t11;

        double W0    = CAACoordinateTransformation.MapTo0To360Range(5.095 * (t3 - 1866.39));
        double W0rad = CAACoordinateTransformation.DegreesToRadians(W0);
        double W1    = CAACoordinateTransformation.MapTo0To360Range(74.4 + 32.39 * t2);
        double W1rad = CAACoordinateTransformation.DegreesToRadians(W1);
        double W2    = CAACoordinateTransformation.MapTo0To360Range(134.3 + 92.62 * t2);
        double W2rad = CAACoordinateTransformation.DegreesToRadians(W2);
        double W3    = CAACoordinateTransformation.MapTo0To360Range(42.0 - 0.5118 * t5);
        double W3rad = CAACoordinateTransformation.DegreesToRadians(W3);
        double W4    = CAACoordinateTransformation.MapTo0To360Range(276.59 + 0.5118 * t5);
        double W4rad = CAACoordinateTransformation.DegreesToRadians(W4);
        double W5    = CAACoordinateTransformation.MapTo0To360Range(267.2635 + 1222.1136 * t7);
        double W5rad = CAACoordinateTransformation.DegreesToRadians(W5);
        double W6    = CAACoordinateTransformation.MapTo0To360Range(175.4762 + 1221.5515 * t7);
        double W6rad = CAACoordinateTransformation.DegreesToRadians(W6);
        double W7    = CAACoordinateTransformation.MapTo0To360Range(2.4891 + 0.002435 * t7);
        double W7rad = CAACoordinateTransformation.DegreesToRadians(W7);
        double W8    = CAACoordinateTransformation.MapTo0To360Range(113.35 - 0.2597 * t7);
        double W8rad = CAACoordinateTransformation.DegreesToRadians(W8);

        double s1 = Math.Sin(CAACoordinateTransformation.DegreesToRadians(28.0817));
        double s2 = Math.Sin(CAACoordinateTransformation.DegreesToRadians(168.8112));
        double c1 = Math.Cos(CAACoordinateTransformation.DegreesToRadians(28.0817));
        double c2 = Math.Cos(CAACoordinateTransformation.DegreesToRadians(168.8112));
        double e1 = 0.05589 - 0.000346 * t7;


        //Satellite 1
        double L       = CAACoordinateTransformation.MapTo0To360Range(127.64 + 381.994497 * t1 - 43.57 * Math.Sin(W0rad) - 0.720 * Math.Sin(3 * W0rad) - 0.02144 * Math.Sin(5 * W0rad));
        double p       = 106.1 + 365.549 * t2;
        double M       = L - p;
        double Mrad    = CAACoordinateTransformation.DegreesToRadians(M);
        double C       = 2.18287 * Math.Sin(Mrad) + 0.025988 * Math.Sin(2 * Mrad) + 0.00043 * Math.Sin(3 * Mrad);
        double Crad    = CAACoordinateTransformation.DegreesToRadians(C);
        double lambda1 = CAACoordinateTransformation.MapTo0To360Range(L + C);
        double r1      = 3.06879 / (1 + 0.01905 * Math.Cos(Mrad + Crad));
        double gamma1  = 1.563;
        double omega1  = CAACoordinateTransformation.MapTo0To360Range(54.5 - 365.072 * t2);

        //Satellite 2
        L    = CAACoordinateTransformation.MapTo0To360Range(200.317 + 262.7319002 * t1 + 0.25667 * Math.Sin(W1rad) + 0.20883 * Math.Sin(W2rad));
        p    = 309.107 + 123.44121 * t2;
        M    = L - p;
        Mrad = CAACoordinateTransformation.DegreesToRadians(M);
        C    = 0.55577 * Math.Sin(Mrad) + 0.00168 * Math.Sin(2 * Mrad);
        Crad = CAACoordinateTransformation.DegreesToRadians(C);
        double lambda2 = CAACoordinateTransformation.MapTo0To360Range(L + C);
        double r2      = 3.94118 / (1 + 0.00485 * Math.Cos(Mrad + Crad));
        double gamma2  = 0.0262;
        double omega2  = CAACoordinateTransformation.MapTo0To360Range(348 - 151.95 * t2);

        //Satellite 3
        double lambda3 = CAACoordinateTransformation.MapTo0To360Range(285.306 + 190.69791226 * t1 + 2.063 * Math.Sin(W0rad) + 0.03409 * Math.Sin(3 * W0rad) + 0.001015 * Math.Sin(5 * W0rad));
        double r3      = 4.880998;
        double gamma3  = 1.0976;
        double omega3  = CAACoordinateTransformation.MapTo0To360Range(111.33 - 72.2441 * t2);

        //Satellite 4
        L    = CAACoordinateTransformation.MapTo0To360Range(254.712 + 131.53493193 * t1 - 0.0215 * Math.Sin(W1rad) - 0.01733 * Math.Sin(W2rad));
        p    = 174.8 + 30.820 * t2;
        M    = L - p;
        Mrad = CAACoordinateTransformation.DegreesToRadians(M);
        C    = 0.24717 * Math.Sin(Mrad) + 0.00033 * Math.Sin(2 * Mrad);
        Crad = CAACoordinateTransformation.DegreesToRadians(C);
        double lambda4 = CAACoordinateTransformation.MapTo0To360Range(L + C);
        double r4      = 6.24871 / (1 + 0.002157 * Math.Cos(Mrad + Crad));
        double gamma4  = 0.0139;
        double omega4  = CAACoordinateTransformation.MapTo0To360Range(232 - 30.27 * t2);

        //Satellite 5
        double pdash    = 342.7 + 10.057 * t2;
        double pdashrad = CAACoordinateTransformation.DegreesToRadians(pdash);
        double a1       = 0.000265 * Math.Sin(pdashrad) + 0.001 * Math.Sin(W4rad); //Note the book uses the incorrect constant 0.01*sin(W4rad);
        double a2       = 0.000265 * Math.Cos(pdashrad) + 0.001 * Math.Cos(W4rad); //Note the book uses the incorrect constant 0.01*cos(W4rad);
        double e        = Math.Sqrt(a1 * a1 + a2 * a2);

        p = CAACoordinateTransformation.RadiansToDegrees(Math.Atan2(a1, a2));
        double N          = 345 - 10.057 * t2;
        double Nrad       = CAACoordinateTransformation.DegreesToRadians(N);
        double lambdadash = CAACoordinateTransformation.MapTo0To360Range(359.244 + 79.69004720 * t1 + 0.086754 * Math.Sin(Nrad));
        double i          = 28.0362 + 0.346898 * Math.Cos(Nrad) + 0.01930 * Math.Cos(W3rad);
        double omega      = 168.8034 + 0.736936 * Math.Sin(Nrad) + 0.041 * Math.Sin(W3rad);
        double a          = 8.725924;
        double lambda5    = 0;
        double gamma5     = 0;
        double omega5     = 0;
        double r5         = 0;

        HelperSubroutine(e, lambdadash, p, a, omega, i, c1, s1, ref r5, ref lambda5, ref gamma5, ref omega5);

        //Satellite 6
        L = 261.1582 + 22.57697855 * t4 + 0.074025 * Math.Sin(W3rad);
        double idash        = 27.45141 + 0.295999 * Math.Cos(W3rad);
        double idashrad     = CAACoordinateTransformation.DegreesToRadians(idash);
        double omegadash    = 168.66925 + 0.628808 * Math.Sin(W3rad);
        double omegadashrad = CAACoordinateTransformation.DegreesToRadians(omegadash);

        a1 = Math.Sin(W7rad) * Math.Sin(omegadashrad - W8rad);
        a2 = Math.Cos(W7rad) * Math.Sin(idashrad) - Math.Sin(W7rad) * Math.Cos(idashrad) * Math.Cos(omegadashrad - W8rad);
        double g0  = CAACoordinateTransformation.DegreesToRadians(102.8623);
        double psi = Math.Atan2(a1, a2);

        if (a2 < 0)
        {
            psi += CAACoordinateTransformation.PI();
        }
        double psideg = CAACoordinateTransformation.RadiansToDegrees(psi);
        double s      = Math.Sqrt(a1 * a1 + a2 * a2);
        double g      = W4 - omegadash - psideg;
        double w_     = 0;

        for (int j = 0; j < 3; j++)
        {
            w_ = W4 + 0.37515 * (Math.Sin(2 * CAACoordinateTransformation.DegreesToRadians(g)) - Math.Sin(2 * g0));
            g  = w_ - omegadash - psideg;
        }
        double grad     = CAACoordinateTransformation.DegreesToRadians(g);
        double edash    = 0.029092 + 0.00019048 * (Math.Cos(2 * grad) - Math.Cos(2 * g0));
        double q        = CAACoordinateTransformation.DegreesToRadians(2 * (W5 - w_));
        double b1       = Math.Sin(idashrad) * Math.Sin(omegadashrad - W8rad);
        double b2       = Math.Cos(W7rad) * Math.Sin(idashrad) * Math.Cos(omegadashrad - W8rad) - Math.Sin(W7rad) * Math.Cos(idashrad);
        double atanb1b2 = Math.Atan2(b1, b2);
        double theta    = atanb1b2 + W8rad;

        e = edash + 0.002778797 * edash * Math.Cos(q);
        p = w_ + 0.159215 * Math.Sin(q);
        double u = 2 * W5rad - 2 * theta + psi;
        double h = 0.9375 * edash * edash * Math.Sin(q) + 0.1875 * s * s * Math.Sin(2 * (W5rad - theta));

        lambdadash = CAACoordinateTransformation.MapTo0To360Range(L - 0.254744 * (e1 * Math.Sin(W6rad) + 0.75 * e1 * e1 * Math.Sin(2 * W6rad) + h));
        i          = idash + 0.031843 * s * Math.Cos(u);
        omega      = omegadash + (0.031843 * s * Math.Sin(u)) / Math.Sin(idashrad);
        a          = 20.216193;
        double lambda6 = 0;
        double gamma6  = 0;
        double omega6  = 0;
        double r6      = 0;

        HelperSubroutine(e, lambdadash, p, a, omega, i, c1, s1, ref r6, ref lambda6, ref gamma6, ref omega6);

        //Satellite 7
        double eta     = 92.39 + 0.5621071 * t6;
        double etarad  = CAACoordinateTransformation.DegreesToRadians(eta);
        double zeta    = 148.19 - 19.18 * t8;
        double zetarad = CAACoordinateTransformation.DegreesToRadians(zeta);

        theta = CAACoordinateTransformation.DegreesToRadians(184.8 - 35.41 * t9);
        double thetadash = theta - CAACoordinateTransformation.DegreesToRadians(7.5);
        double @as       = CAACoordinateTransformation.DegreesToRadians(176 + 12.22 * t8);
        double bs        = CAACoordinateTransformation.DegreesToRadians(8 + 24.44 * t8);
        double cs        = bs + CAACoordinateTransformation.DegreesToRadians(5);

        w_ = 69.898 - 18.67088 * t8;
        double phi    = 2 * (w_ - W5);
        double phirad = CAACoordinateTransformation.DegreesToRadians(phi);
        double chi    = 94.9 - 2.292 * t8;
        double chirad = CAACoordinateTransformation.DegreesToRadians(chi);

        a          = 24.50601 - 0.08686 * Math.Cos(etarad) - 0.00166 * Math.Cos(zetarad + etarad) + 0.00175 * Math.Cos(zetarad - etarad);
        e          = 0.103458 - 0.004099 * Math.Cos(etarad) - 0.000167 * Math.Cos(zetarad + etarad) + 0.000235 * Math.Cos(zetarad - etarad) + 0.02303 * Math.Cos(zetarad) - 0.00212 * Math.Cos(2 * zetarad) + 0.000151 * Math.Cos(3 * zetarad) + 0.00013 * Math.Cos(phirad);
        p          = w_ + 0.15648 * Math.Sin(chirad) - 0.4457 * Math.Sin(etarad) - 0.2657 * Math.Sin(zetarad + etarad) + -0.3573 * Math.Sin(zetarad - etarad) - 12.872 * Math.Sin(zetarad) + 1.668 * Math.Sin(2 * zetarad) + -0.2419 * Math.Sin(3 * zetarad) - 0.07 * Math.Sin(phirad);
        lambdadash = CAACoordinateTransformation.MapTo0To360Range(177.047 + 16.91993829 * t6 + 0.15648 * Math.Sin(chirad) + 9.142 * Math.Sin(etarad) + 0.007 * Math.Sin(2 * etarad) - 0.014 * Math.Sin(3 * etarad) + 0.2275 * Math.Sin(zetarad + etarad) + 0.2112 * Math.Sin(zetarad - etarad) - 0.26 * Math.Sin(zetarad) - 0.0098 * Math.Sin(2 * zetarad) + -0.013 * Math.Sin(@as) + 0.017 * Math.Sin(bs) - 0.0303 * Math.Sin(phirad));
        i          = 27.3347 + 0.643486 * Math.Cos(chirad) + 0.315 * Math.Cos(W3rad) + 0.018 * Math.Cos(theta) - 0.018 * Math.Cos(cs);
        omega      = 168.6812 + 1.40136 * Math.Cos(chirad) + 0.68599 * Math.Sin(W3rad) - 0.0392 * Math.Sin(cs) + 0.0366 * Math.Sin(thetadash);
        double lambda7 = 0;
        double gamma7  = 0;
        double omega7  = 0;
        double r7      = 0;

        HelperSubroutine(e, lambdadash, p, a, omega, i, c1, s1, ref r7, ref lambda7, ref gamma7, ref omega7);

        //Satellite 8
        L = CAACoordinateTransformation.MapTo0To360Range(261.1582 + 22.57697855 * t4);
        double w_dash = 91.796 + 0.562 * t7;

        psi = 4.367 - 0.195 * t7;
        double psirad = CAACoordinateTransformation.DegreesToRadians(psi);

        theta  = 146.819 - 3.198 * t7;
        phi    = 60.470 + 1.521 * t7;
        phirad = CAACoordinateTransformation.DegreesToRadians(phi);
        double PHI = 205.055 - 2.091 * t7;

        edash = 0.028298 + 0.001156 * t11;
        double w_0 = 352.91 + 11.71 * t11;
        double mu  = CAACoordinateTransformation.MapTo0To360Range(76.3852 + 4.53795125 * t10);

        mu        = CAACoordinateTransformation.MapTo0To360Range(189097.71668440815);
        idash     = 18.4602 - 0.9518 * t11 - 0.072 * t112 + 0.0054 * t113;
        idashrad  = CAACoordinateTransformation.DegreesToRadians(idash);
        omegadash = 143.198 - 3.919 * t11 + 0.116 * t112 + 0.008 * t113;
        l         = CAACoordinateTransformation.DegreesToRadians(mu - w_0);
        g         = CAACoordinateTransformation.DegreesToRadians(w_0 - omegadash - psi);
        double g1 = CAACoordinateTransformation.DegreesToRadians(w_0 - omegadash - phi);
        double ls = CAACoordinateTransformation.DegreesToRadians(W5 - w_dash);
        double gs = CAACoordinateTransformation.DegreesToRadians(w_dash - theta);
        double lt = CAACoordinateTransformation.DegreesToRadians(L - W4);
        double gt = CAACoordinateTransformation.DegreesToRadians(W4 - PHI);
        double u1 = 2 * (l + g - ls - gs);
        double u2 = l + g1 - lt - gt;
        double u3 = l + 2 * (g - ls - gs);
        double u4 = lt + gt - g1;
        double u5 = 2 * (ls + gs);

        a = 58.935028 + 0.004638 * Math.Cos(u1) + 0.058222 * Math.Cos(u2);
        e = edash - 0.0014097 * Math.Cos(g1 - gt) + 0.0003733 * Math.Cos(u5 - 2 * g) + 0.0001180 * Math.Cos(u3) + 0.0002408 * Math.Cos(l) + 0.0002849 * Math.Cos(l + u2) + 0.0006190 * Math.Cos(u4);
        double w = 0.08077 * Math.Sin(g1 - gt) + 0.02139 * Math.Sin(u5 - 2 * g) - 0.00676 * Math.Sin(u3) + 0.01380 * Math.Sin(l) + 0.01632 * Math.Sin(l + u2) + 0.03547 * Math.Sin(u4);

        p          = w_0 + w / edash;
        lambdadash = mu - 0.04299 * Math.Sin(u2) - 0.00789 * Math.Sin(u1) - 0.06312 * Math.Sin(ls) + -0.00295 * Math.Sin(2 * ls) - 0.02231 * Math.Sin(u5) + 0.00650 * Math.Sin(u5 + psirad);
        i          = idash + 0.04204 * Math.Cos(u5 + psirad) + 0.00235 * Math.Cos(l + g1 + lt + gt + phirad) + 0.00360 * Math.Cos(u2 + phirad);
        double wdash = 0.04204 * Math.Sin(u5 + psirad) + 0.00235 * Math.Sin(l + g1 + lt + gt + phirad) + 0.00358 * Math.Sin(u2 + phirad);

        omega = omegadash + wdash / Math.Sin(idashrad);
        double lambda8 = 0;
        double gamma8  = 0;
        double omega8  = 0;
        double r8      = 0;

        HelperSubroutine(e, lambdadash, p, a, omega, i, c1, s1, ref r8, ref lambda8, ref gamma8, ref omega8);


        u = CAACoordinateTransformation.DegreesToRadians(lambda1 - omega1);
        w = CAACoordinateTransformation.DegreesToRadians(omega1 - 168.8112);
        double gamma1rad = CAACoordinateTransformation.DegreesToRadians(gamma1);
        double X1        = r1 * (Math.Cos(u) * Math.Cos(w) - Math.Sin(u) * Math.Cos(gamma1rad) * Math.Sin(w));
        double Y1        = r1 * (Math.Sin(u) * Math.Cos(w) * Math.Cos(gamma1rad) + Math.Cos(u) * Math.Sin(w));
        double Z1        = r1 * Math.Sin(u) * Math.Sin(gamma1rad);

        u = CAACoordinateTransformation.DegreesToRadians(lambda2 - omega2);
        w = CAACoordinateTransformation.DegreesToRadians(omega2 - 168.8112);
        double gamma2rad = CAACoordinateTransformation.DegreesToRadians(gamma2);
        double X2        = r2 * (Math.Cos(u) * Math.Cos(w) - Math.Sin(u) * Math.Cos(gamma2rad) * Math.Sin(w));
        double Y2        = r2 * (Math.Sin(u) * Math.Cos(w) * Math.Cos(gamma2rad) + Math.Cos(u) * Math.Sin(w));
        double Z2        = r2 * Math.Sin(u) * Math.Sin(gamma2rad);

        u = CAACoordinateTransformation.DegreesToRadians(lambda3 - omega3);
        w = CAACoordinateTransformation.DegreesToRadians(omega3 - 168.8112);
        double gamma3rad = CAACoordinateTransformation.DegreesToRadians(gamma3);
        double X3        = r3 * (Math.Cos(u) * Math.Cos(w) - Math.Sin(u) * Math.Cos(gamma3rad) * Math.Sin(w));
        double Y3        = r3 * (Math.Sin(u) * Math.Cos(w) * Math.Cos(gamma3rad) + Math.Cos(u) * Math.Sin(w));
        double Z3        = r3 * Math.Sin(u) * Math.Sin(gamma3rad);

        u = CAACoordinateTransformation.DegreesToRadians(lambda4 - omega4);
        w = CAACoordinateTransformation.DegreesToRadians(omega4 - 168.8112);
        double gamma4rad = CAACoordinateTransformation.DegreesToRadians(gamma4);
        double X4        = r4 * (Math.Cos(u) * Math.Cos(w) - Math.Sin(u) * Math.Cos(gamma4rad) * Math.Sin(w));
        double Y4        = r4 * (Math.Sin(u) * Math.Cos(w) * Math.Cos(gamma4rad) + Math.Cos(u) * Math.Sin(w));
        double Z4        = r4 * Math.Sin(u) * Math.Sin(gamma4rad);

        u = CAACoordinateTransformation.DegreesToRadians(lambda5 - omega5);
        w = CAACoordinateTransformation.DegreesToRadians(omega5 - 168.8112);
        double gamma5rad = CAACoordinateTransformation.DegreesToRadians(gamma5);
        double X5        = r5 * (Math.Cos(u) * Math.Cos(w) - Math.Sin(u) * Math.Cos(gamma5rad) * Math.Sin(w));
        double Y5        = r5 * (Math.Sin(u) * Math.Cos(w) * Math.Cos(gamma5rad) + Math.Cos(u) * Math.Sin(w));
        double Z5        = r5 * Math.Sin(u) * Math.Sin(gamma5rad);

        u = CAACoordinateTransformation.DegreesToRadians(lambda6 - omega6);
        w = CAACoordinateTransformation.DegreesToRadians(omega6 - 168.8112);
        double gamma6rad = CAACoordinateTransformation.DegreesToRadians(gamma6);
        double X6        = r6 * (Math.Cos(u) * Math.Cos(w) - Math.Sin(u) * Math.Cos(gamma6rad) * Math.Sin(w));
        double Y6        = r6 * (Math.Sin(u) * Math.Cos(w) * Math.Cos(gamma6rad) + Math.Cos(u) * Math.Sin(w));
        double Z6        = r6 * Math.Sin(u) * Math.Sin(gamma6rad);

        u = CAACoordinateTransformation.DegreesToRadians(lambda7 - omega7);
        w = CAACoordinateTransformation.DegreesToRadians(omega7 - 168.8112);
        double gamma7rad = CAACoordinateTransformation.DegreesToRadians(gamma7);
        double X7        = r7 * (Math.Cos(u) * Math.Cos(w) - Math.Sin(u) * Math.Cos(gamma7rad) * Math.Sin(w));
        double Y7        = r7 * (Math.Sin(u) * Math.Cos(w) * Math.Cos(gamma7rad) + Math.Cos(u) * Math.Sin(w));
        double Z7        = r7 * Math.Sin(u) * Math.Sin(gamma7rad);

        u = CAACoordinateTransformation.DegreesToRadians(lambda8 - omega8);
        w = CAACoordinateTransformation.DegreesToRadians(omega8 - 168.8112);
        double gamma8rad = CAACoordinateTransformation.DegreesToRadians(gamma8);
        double X8        = r8 * (Math.Cos(u) * Math.Cos(w) - Math.Sin(u) * Math.Cos(gamma8rad) * Math.Sin(w));
        double Y8        = r8 * (Math.Sin(u) * Math.Cos(w) * Math.Cos(gamma8rad) + Math.Cos(u) * Math.Sin(w));
        double Z8        = r8 * Math.Sin(u) * Math.Sin(gamma8rad);

        double X9 = 0;
        double Y9 = 0;
        double Z9 = 1;

        //Now do the rotations, first for the ficticious 9th satellite, so that we can calculate D
        double A4 = 0;
        double B4 = 0;
        double C4 = 0;

        Rotations(X9, Y9, Z9, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        double D = Math.Atan2(A4, C4);

        //Now calculate the values for satellite 1
        Rotations(X1, Y1, Z1, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        details.Satellite1.TrueRectangularCoordinates.X = A4 * Math.Cos(D) - C4 * Math.Sin(D);
        details.Satellite1.TrueRectangularCoordinates.Y = A4 * Math.Sin(D) + C4 * Math.Cos(D);
        details.Satellite1.TrueRectangularCoordinates.Z = B4;

        //Now calculate the values for satellite 2
        Rotations(X2, Y2, Z2, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        details.Satellite2.TrueRectangularCoordinates.X = A4 * Math.Cos(D) - C4 * Math.Sin(D);
        details.Satellite2.TrueRectangularCoordinates.Y = A4 * Math.Sin(D) + C4 * Math.Cos(D);
        details.Satellite2.TrueRectangularCoordinates.Z = B4;

        //Now calculate the values for satellite 3
        Rotations(X3, Y3, Z3, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        details.Satellite3.TrueRectangularCoordinates.X = A4 * Math.Cos(D) - C4 * Math.Sin(D);
        details.Satellite3.TrueRectangularCoordinates.Y = A4 * Math.Sin(D) + C4 * Math.Cos(D);
        details.Satellite3.TrueRectangularCoordinates.Z = B4;

        //Now calculate the values for satellite 4
        Rotations(X4, Y4, Z4, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        details.Satellite4.TrueRectangularCoordinates.X = A4 * Math.Cos(D) - C4 * Math.Sin(D);
        details.Satellite4.TrueRectangularCoordinates.Y = A4 * Math.Sin(D) + C4 * Math.Cos(D);
        details.Satellite4.TrueRectangularCoordinates.Z = B4;

        //Now calculate the values for satellite 5
        Rotations(X5, Y5, Z5, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        details.Satellite5.TrueRectangularCoordinates.X = A4 * Math.Cos(D) - C4 * Math.Sin(D);
        details.Satellite5.TrueRectangularCoordinates.Y = A4 * Math.Sin(D) + C4 * Math.Cos(D);
        details.Satellite5.TrueRectangularCoordinates.Z = B4;

        //Now calculate the values for satellite 6
        Rotations(X6, Y6, Z6, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        details.Satellite6.TrueRectangularCoordinates.X = A4 * Math.Cos(D) - C4 * Math.Sin(D);
        details.Satellite6.TrueRectangularCoordinates.Y = A4 * Math.Sin(D) + C4 * Math.Cos(D);
        details.Satellite6.TrueRectangularCoordinates.Z = B4;

        //Now calculate the values for satellite 7
        Rotations(X7, Y7, Z7, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        details.Satellite7.TrueRectangularCoordinates.X = A4 * Math.Cos(D) - C4 * Math.Sin(D);
        details.Satellite7.TrueRectangularCoordinates.Y = A4 * Math.Sin(D) + C4 * Math.Cos(D);
        details.Satellite7.TrueRectangularCoordinates.Z = B4;

        //Now calculate the values for satellite 8
        Rotations(X8, Y8, Z8, c1, s1, c2, s2, lambda0rad, beta0rad, ref A4, ref B4, ref C4);
        details.Satellite8.TrueRectangularCoordinates.X = A4 * Math.Cos(D) - C4 * Math.Sin(D);
        details.Satellite8.TrueRectangularCoordinates.Y = A4 * Math.Sin(D) + C4 * Math.Cos(D);
        details.Satellite8.TrueRectangularCoordinates.Z = B4;


        //apply the differential light-time correction
        details.Satellite1.ApparentRectangularCoordinates.X = details.Satellite1.TrueRectangularCoordinates.X + Math.Abs(details.Satellite1.TrueRectangularCoordinates.Z) / 20947 * Math.Sqrt(1 - (details.Satellite1.TrueRectangularCoordinates.X / r1) * (details.Satellite1.TrueRectangularCoordinates.X / r1));
        details.Satellite1.ApparentRectangularCoordinates.Y = details.Satellite1.TrueRectangularCoordinates.Y;
        details.Satellite1.ApparentRectangularCoordinates.Z = details.Satellite1.TrueRectangularCoordinates.Z;

        details.Satellite2.ApparentRectangularCoordinates.X = details.Satellite2.TrueRectangularCoordinates.X + Math.Abs(details.Satellite2.TrueRectangularCoordinates.Z) / 23715 * Math.Sqrt(1 - (details.Satellite2.TrueRectangularCoordinates.X / r2) * (details.Satellite2.TrueRectangularCoordinates.X / r2));
        details.Satellite2.ApparentRectangularCoordinates.Y = details.Satellite2.TrueRectangularCoordinates.Y;
        details.Satellite2.ApparentRectangularCoordinates.Z = details.Satellite2.TrueRectangularCoordinates.Z;

        details.Satellite3.ApparentRectangularCoordinates.X = details.Satellite3.TrueRectangularCoordinates.X + Math.Abs(details.Satellite3.TrueRectangularCoordinates.Z) / 26382 * Math.Sqrt(1 - (details.Satellite3.TrueRectangularCoordinates.X / r3) * (details.Satellite3.TrueRectangularCoordinates.X / r3));
        details.Satellite3.ApparentRectangularCoordinates.Y = details.Satellite3.TrueRectangularCoordinates.Y;
        details.Satellite3.ApparentRectangularCoordinates.Z = details.Satellite3.TrueRectangularCoordinates.Z;

        details.Satellite4.ApparentRectangularCoordinates.X = details.Satellite4.TrueRectangularCoordinates.X + Math.Abs(details.Satellite4.TrueRectangularCoordinates.Z) / 29876 * Math.Sqrt(1 - (details.Satellite4.TrueRectangularCoordinates.X / r4) * (details.Satellite4.TrueRectangularCoordinates.X / r4));
        details.Satellite4.ApparentRectangularCoordinates.Y = details.Satellite4.TrueRectangularCoordinates.Y;
        details.Satellite4.ApparentRectangularCoordinates.Z = details.Satellite4.TrueRectangularCoordinates.Z;

        details.Satellite5.ApparentRectangularCoordinates.X = details.Satellite5.TrueRectangularCoordinates.X + Math.Abs(details.Satellite5.TrueRectangularCoordinates.Z) / 35313 * Math.Sqrt(1 - (details.Satellite5.TrueRectangularCoordinates.X / r5) * (details.Satellite5.TrueRectangularCoordinates.X / r5));
        details.Satellite5.ApparentRectangularCoordinates.Y = details.Satellite5.TrueRectangularCoordinates.Y;
        details.Satellite5.ApparentRectangularCoordinates.Z = details.Satellite5.TrueRectangularCoordinates.Z;

        details.Satellite6.ApparentRectangularCoordinates.X = details.Satellite6.TrueRectangularCoordinates.X + Math.Abs(details.Satellite6.TrueRectangularCoordinates.Z) / 53800 * Math.Sqrt(1 - (details.Satellite6.TrueRectangularCoordinates.X / r6) * (details.Satellite6.TrueRectangularCoordinates.X / r6));
        details.Satellite6.ApparentRectangularCoordinates.Y = details.Satellite6.TrueRectangularCoordinates.Y;
        details.Satellite6.ApparentRectangularCoordinates.Z = details.Satellite6.TrueRectangularCoordinates.Z;

        details.Satellite7.ApparentRectangularCoordinates.X = details.Satellite7.TrueRectangularCoordinates.X + Math.Abs(details.Satellite7.TrueRectangularCoordinates.Z) / 59222 * Math.Sqrt(1 - (details.Satellite7.TrueRectangularCoordinates.X / r7) * (details.Satellite7.TrueRectangularCoordinates.X / r7));
        details.Satellite7.ApparentRectangularCoordinates.Y = details.Satellite7.TrueRectangularCoordinates.Y;
        details.Satellite7.ApparentRectangularCoordinates.Z = details.Satellite7.TrueRectangularCoordinates.Z;

        details.Satellite8.ApparentRectangularCoordinates.X = details.Satellite8.TrueRectangularCoordinates.X + Math.Abs(details.Satellite8.TrueRectangularCoordinates.Z) / 91820 * Math.Sqrt(1 - (details.Satellite8.TrueRectangularCoordinates.X / r8) * (details.Satellite8.TrueRectangularCoordinates.X / r8));
        details.Satellite8.ApparentRectangularCoordinates.Y = details.Satellite8.TrueRectangularCoordinates.Y;
        details.Satellite8.ApparentRectangularCoordinates.Z = details.Satellite8.TrueRectangularCoordinates.Z;


        //apply the perspective effect correction
        double W = DELTA / (DELTA + details.Satellite1.TrueRectangularCoordinates.Z / 2475);

        details.Satellite1.ApparentRectangularCoordinates.X *= W;
        details.Satellite1.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite2.TrueRectangularCoordinates.Z / 2475);
        details.Satellite2.ApparentRectangularCoordinates.X *= W;
        details.Satellite2.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite3.TrueRectangularCoordinates.Z / 2475);
        details.Satellite3.ApparentRectangularCoordinates.X *= W;
        details.Satellite3.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite4.TrueRectangularCoordinates.Z / 2475);
        details.Satellite4.ApparentRectangularCoordinates.X *= W;
        details.Satellite4.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite5.TrueRectangularCoordinates.Z / 2475);
        details.Satellite5.ApparentRectangularCoordinates.X *= W;
        details.Satellite5.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite6.TrueRectangularCoordinates.Z / 2475);
        details.Satellite6.ApparentRectangularCoordinates.X *= W;
        details.Satellite6.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite7.TrueRectangularCoordinates.Z / 2475);
        details.Satellite7.ApparentRectangularCoordinates.X *= W;
        details.Satellite7.ApparentRectangularCoordinates.Y *= W;

        W = DELTA / (DELTA + details.Satellite8.TrueRectangularCoordinates.Z / 2475);
        details.Satellite8.ApparentRectangularCoordinates.X *= W;
        details.Satellite8.ApparentRectangularCoordinates.Y *= W;

        return(details);
    }
コード例 #11
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 = CAACoordinateTransformation.DegreesToRadians(Lambda0);
        double Beta0      = 63.2818 - 0.00394 * T;
        double Beta0rad   = CAACoordinateTransformation.DegreesToRadians(Beta0);

        //Step 2
        double l0    = CAAEarth.EclipticLongitude(JD);
        double l0rad = CAACoordinateTransformation.DegreesToRadians(l0);
        double b0    = CAAEarth.EclipticLatitude(JD);
        double b0rad = CAACoordinateTransformation.DegreesToRadians(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 = CAACoordinateTransformation.DegreesToRadians(l);
            b    = CAAMars.EclipticLatitude(JD2);
            brad = CAACoordinateTransformation.DegreesToRadians(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 = CAAElliptical.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    = CAACoordinateTransformation.RadiansToDegrees(lambdarad);
        double betarad   = Math.Atan2(z, Math.Sqrt(x * x + y * y));
        double beta      = CAACoordinateTransformation.RadiansToDegrees(betarad);

        //Step 6
        details.DE = CAACoordinateTransformation.RadiansToDegrees(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 = CAACoordinateTransformation.DegreesToRadians(N);

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

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

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

        //Step 10
        double          e0             = CAANutation.MeanObliquityOfEcliptic(JD);
        double          e0rad          = CAACoordinateTransformation.DegreesToRadians(e0);
        CAA2DCoordinate PoleEquatorial = CAACoordinateTransformation.Ecliptic2Equatorial(Lambda0, Beta0, e0);
        double          alpha0rad      = CAACoordinateTransformation.HoursToRadians(PoleEquatorial.X);
        double          delta0rad      = CAACoordinateTransformation.DegreesToRadians(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    = CAACoordinateTransformation.RadiansToHours(alpharad);
        double deltarad = Math.Atan2(v, Math.Sqrt(x * x + u * u));
        double delta    = CAACoordinateTransformation.RadiansToDegrees(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 = CAACoordinateTransformation.MapTo0To360Range(W - CAACoordinateTransformation.RadiansToDegrees(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 = CAACoordinateTransformation.DegreesToRadians(Lambda0);
        lambda    += NutationInLongitude / 3600;
        lambdarad  = CAACoordinateTransformation.DegreesToRadians(lambda);
        e0        += NutationInObliquity / 3600;
        e0rad      = CAACoordinateTransformation.DegreesToRadians(e0rad);

        //Step 16
        CAA2DCoordinate ApparentPoleEquatorial = CAACoordinateTransformation.Ecliptic2Equatorial(Lambda0, Beta0, e0);
        double          alpha0dash             = CAACoordinateTransformation.HoursToRadians(ApparentPoleEquatorial.X);
        double          delta0dash             = CAACoordinateTransformation.DegreesToRadians(ApparentPoleEquatorial.Y);
        CAA2DCoordinate ApparentMars           = CAACoordinateTransformation.Ecliptic2Equatorial(lambda, beta, e0);
        double          alphadash = CAACoordinateTransformation.HoursToRadians(ApparentMars.X);
        double          deltadash = CAACoordinateTransformation.DegreesToRadians(ApparentMars.Y);

        //Step 17
        details.P = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(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);
        CAA2DCoordinate SunEquatorial = CAACoordinateTransformation.Ecliptic2Equatorial(SunLambda, SunBeta, e0);

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

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

        return(details);
    }