Ejemplo n.º 1
0
//Static methods
    //L2   L3   L4  L5  L6  L7  L8  Ldash D   Mdash F   xsin      xsint xcos    xcost ysin   ysint ycos     ycost zsin   zsint zcos    zcost


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

    public static CAA3DCoordinate EarthVelocity(double JD)
    {
        double T     = (JD - 2451545) / 36525;
        double L2    = 3.1761467 + 1021.3285546 * T;
        double L3    = 1.7534703 + 628.3075849 * T;
        double L4    = 6.2034809 + 334.0612431 * T;
        double L5    = 0.5995465 + 52.9690965 * T;
        double L6    = 0.8740168 + 21.3299095 * T;
        double L7    = 5.4812939 + 7.4781599 * T;
        double L8    = 5.3118863 + 3.8133036 * T;
        double Ldash = 3.8103444 + 8399.6847337 * T;
        double D     = 5.1984667 + 7771.3771486 * T;
        double Mdash = 2.3555559 + 8328.6914289 * T;
        double F     = 1.6279052 + 8433.4661601 * T;

        CAA3DCoordinate velocity = new CAA3DCoordinate();

        int nAberrationCoefficients = GlobalMembersStdafx.g_AberrationCoefficients.Length;

        for (int i = 0; i < nAberrationCoefficients; i++)
        {
            double Argument = GlobalMembersStdafx.g_AberrationCoefficients[i].L2 * L2 + GlobalMembersStdafx.g_AberrationCoefficients[i].L3 * L3 + GlobalMembersStdafx.g_AberrationCoefficients[i].L4 * L4 + GlobalMembersStdafx.g_AberrationCoefficients[i].L5 * L5 + GlobalMembersStdafx.g_AberrationCoefficients[i].L6 * L6 + GlobalMembersStdafx.g_AberrationCoefficients[i].L7 * L7 + GlobalMembersStdafx.g_AberrationCoefficients[i].L8 * L8 + GlobalMembersStdafx.g_AberrationCoefficients[i].Ldash * Ldash + GlobalMembersStdafx.g_AberrationCoefficients[i].D * D + GlobalMembersStdafx.g_AberrationCoefficients[i].Mdash * Mdash + GlobalMembersStdafx.g_AberrationCoefficients[i].F * F;
            velocity.X += (GlobalMembersStdafx.g_AberrationCoefficients[i].xsin + GlobalMembersStdafx.g_AberrationCoefficients[i].xsint * T) * Math.Sin(Argument);
            velocity.X += (GlobalMembersStdafx.g_AberrationCoefficients[i].xcos + GlobalMembersStdafx.g_AberrationCoefficients[i].xcost * T) * Math.Cos(Argument);

            velocity.Y += (GlobalMembersStdafx.g_AberrationCoefficients[i].ysin + GlobalMembersStdafx.g_AberrationCoefficients[i].ysint * T) * Math.Sin(Argument);
            velocity.Y += (GlobalMembersStdafx.g_AberrationCoefficients[i].ycos + GlobalMembersStdafx.g_AberrationCoefficients[i].ycost * T) * Math.Cos(Argument);

            velocity.Z += (GlobalMembersStdafx.g_AberrationCoefficients[i].zsin + GlobalMembersStdafx.g_AberrationCoefficients[i].zsint * T) * Math.Sin(Argument);
            velocity.Z += (GlobalMembersStdafx.g_AberrationCoefficients[i].zcos + GlobalMembersStdafx.g_AberrationCoefficients[i].zcost * T) * Math.Cos(Argument);
        }

        return(velocity);
    }
Ejemplo n.º 2
0
    public static CAA3DCoordinate EquatorialRectangularCoordinatesAnyEquinox(double JD, double JDEquinox)
    {
        CAA3DCoordinate @value = EquatorialRectangularCoordinatesJ2000(JD);

        @value = CAAFK5.ConvertVSOPToFK5AnyEquinox(@value, JDEquinox);

        return(@value);
    }
Ejemplo n.º 3
0
    public static CAA3DCoordinate EquatorialRectangularCoordinatesB1950(double JD)
    {
        CAA3DCoordinate @value = EclipticRectangularCoordinatesJ2000(JD);

        @value = CAAFK5.ConvertVSOPToFK5B1950(@value);

        return(@value);
    }
Ejemplo n.º 4
0
    public static CAA3DCoordinate ConvertVSOPToFK5B1950(CAA3DCoordinate @value)
    {
        CAA3DCoordinate result = new CAA3DCoordinate();
        result.X = 0.999925702634 * @value.X + 0.012189716217 * @value.Y + 0.000011134016 * @value.Z;
        result.Y = -0.011179418036 * @value.X + 0.917413998946 * @value.Y - 0.397777041885 * @value.Z;
        result.Z = -0.004859003787 * @value.X + 0.397747363646 * @value.Y + 0.917482111428 * @value.Z;

        return result;
    }
Ejemplo n.º 5
0
    public static CAA3DCoordinate ConvertVSOPToFK5J2000(CAA3DCoordinate @value)
    {
        CAA3DCoordinate result = new CAA3DCoordinate();
        result.X = @value.X + 0.000000440360 * @value.Y - 0.000000190919 * @value.Z;
        result.Y = -0.000000479966 * @value.X + 0.917482137087 * @value.Y - 0.397776982902 * @value.Z;
        result.Z = 0.397776982902 * @value.Y + 0.917482137087 * @value.Z;

        return result;
    }
Ejemplo n.º 6
0
    public static CAA3DCoordinate ConvertVSOPToFK5B1950(CAA3DCoordinate @value)
    {
        CAA3DCoordinate result = new CAA3DCoordinate();

        result.X = 0.999925702634 * @value.X + 0.012189716217 * @value.Y + 0.000011134016 * @value.Z;
        result.Y = -0.011179418036 * @value.X + 0.917413998946 * @value.Y - 0.397777041885 * @value.Z;
        result.Z = -0.004859003787 * @value.X + 0.397747363646 * @value.Y + 0.917482111428 * @value.Z;

        return(result);
    }
Ejemplo n.º 7
0
    public static CAA3DCoordinate ConvertVSOPToFK5J2000(CAA3DCoordinate @value)
    {
        CAA3DCoordinate result = new CAA3DCoordinate();

        result.X = @value.X + 0.000000440360 * @value.Y - 0.000000190919 * @value.Z;
        result.Y = -0.000000479966 * @value.X + 0.917482137087 * @value.Y - 0.397776982902 * @value.Z;
        result.Z = 0.397776982902 * @value.Y + 0.917482137087 * @value.Z;

        return(result);
    }
Ejemplo n.º 8
0
    public static CAA3DCoordinate EclipticRectangularCoordinatesMeanEquinox(double JD)
    {
        double Longitude = CAACoordinateTransformation.DegreesToRadians(GeometricFK5EclipticLongitude(JD));
        double Latitude = CAACoordinateTransformation.DegreesToRadians(GeometricFK5EclipticLatitude(JD));
        double R = CAAEarth.RadiusVector(JD);
        double epsilon = CAACoordinateTransformation.DegreesToRadians(CAANutation.MeanObliquityOfEcliptic(JD));

        CAA3DCoordinate @value = new CAA3DCoordinate();
        @value.X = R * Math.Cos(Latitude) * Math.Cos(Longitude);
        @value.Y = R * (Math.Cos(Latitude) * Math.Sin(Longitude) * Math.Cos(epsilon) - Math.Sin(Latitude) * Math.Sin(epsilon));
        @value.Z = R * (Math.Cos(Latitude) * Math.Sin(Longitude) * Math.Sin(epsilon) + Math.Sin(Latitude) * Math.Cos(epsilon));

        return @value;
    }
Ejemplo n.º 9
0
    public static CAA3DCoordinate EclipticRectangularCoordinatesMeanEquinox(double JD)
    {
        double Longitude = CAACoordinateTransformation.DegreesToRadians(GeometricFK5EclipticLongitude(JD));
        double Latitude  = CAACoordinateTransformation.DegreesToRadians(GeometricFK5EclipticLatitude(JD));
        double R         = CAAEarth.RadiusVector(JD);
        double epsilon   = CAACoordinateTransformation.DegreesToRadians(CAANutation.MeanObliquityOfEcliptic(JD));

        CAA3DCoordinate @value = new CAA3DCoordinate();

        @value.X = R * Math.Cos(Latitude) * Math.Cos(Longitude);
        @value.Y = R * (Math.Cos(Latitude) * Math.Sin(Longitude) * Math.Cos(epsilon) - Math.Sin(Latitude) * Math.Sin(epsilon));
        @value.Z = R * (Math.Cos(Latitude) * Math.Sin(Longitude) * Math.Sin(epsilon) + Math.Sin(Latitude) * Math.Cos(epsilon));

        return(@value);
    }
Ejemplo n.º 10
0
    public static CAA3DCoordinate EclipticRectangularCoordinatesJ2000(double JD)
    {
        double Longitude = GeometricEclipticLongitudeJ2000(JD);
        Longitude = CAACoordinateTransformation.DegreesToRadians(Longitude);
        double Latitude = GeometricEclipticLatitudeJ2000(JD);
        Latitude = CAACoordinateTransformation.DegreesToRadians(Latitude);
        double R = CAAEarth.RadiusVector(JD);

        CAA3DCoordinate @value = new CAA3DCoordinate();
        double coslatitude = Math.Cos(Latitude);
        @value.X = R * coslatitude * Math.Cos(Longitude);
        @value.Y = R * coslatitude * Math.Sin(Longitude);
        @value.Z = R * Math.Sin(Latitude);

        return @value;
    }
Ejemplo n.º 11
0
    public static CAA3DCoordinate ConvertVSOPToFK5AnyEquinox(CAA3DCoordinate @value, double JDEquinox)
    {
        double t        = (JDEquinox - 2451545.0) / 36525;
        double tsquared = t * t;
        double tcubed   = tsquared * t;

        double sigma = 2306.2181 * t + 0.30188 * tsquared + 0.017988 * tcubed;

        sigma = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, sigma));

        double zeta = 2306.2181 * t + 1.09468 * tsquared + 0.018203 * tcubed;

        zeta = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, zeta));

        double phi = 2004.3109 * t - 0.42665 * tsquared - 0.041833 * tcubed;

        phi = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, phi));

        double cossigma = Math.Cos(sigma);
        double coszeta  = Math.Cos(zeta);
        double cosphi   = Math.Cos(phi);
        double sinsigma = Math.Sin(sigma);
        double sinzeta  = Math.Sin(zeta);
        double sinphi   = Math.Sin(phi);

        double xx = cossigma * coszeta * cosphi - sinsigma * sinzeta;
        double xy = sinsigma * coszeta + cossigma * sinzeta * cosphi;
        double xz = cossigma * sinphi;
        double yx = -cossigma * sinzeta - sinsigma * coszeta * cosphi;
        double yy = cossigma * coszeta - sinsigma * sinzeta * cosphi;
        double yz = -sinsigma * sinphi;
        double zx = -coszeta * sinphi;
        double zy = -sinzeta * sinphi;
        double zz = cosphi;

        CAA3DCoordinate result = new CAA3DCoordinate();

        result.X = xx * @value.X + yx * @value.Y + zx * @value.Z;
        result.Y = xy * @value.X + yy * @value.Y + zy * @value.Z;
        result.Z = xz * @value.X + yz * @value.Y + zz * @value.Z;

        return(result);
    }
Ejemplo n.º 12
0
    public static CAA3DCoordinate EclipticRectangularCoordinatesJ2000(double JD)
    {
        double Longitude = GeometricEclipticLongitudeJ2000(JD);

        Longitude = CAACoordinateTransformation.DegreesToRadians(Longitude);
        double Latitude = GeometricEclipticLatitudeJ2000(JD);

        Latitude = CAACoordinateTransformation.DegreesToRadians(Latitude);
        double R = CAAEarth.RadiusVector(JD);

        CAA3DCoordinate @value      = new CAA3DCoordinate();
        double          coslatitude = Math.Cos(Latitude);

        @value.X = R * coslatitude * Math.Cos(Longitude);
        @value.Y = R * coslatitude * Math.Sin(Longitude);
        @value.Z = R * Math.Sin(Latitude);

        return(@value);
    }
Ejemplo n.º 13
0
    public static CAA3DCoordinate ConvertVSOPToFK5AnyEquinox(CAA3DCoordinate @value, double JDEquinox)
    {
        var t = (JDEquinox - 2451545.0) / 36525;
        var tsquared = t *t;
        var tcubed = tsquared * t;

        var sigma = 2306.2181 *t + 0.30188 *tsquared + 0.017988 *tcubed;
        sigma = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, sigma));

        var zeta = 2306.2181 *t + 1.09468 *tsquared + 0.018203 *tcubed;
        zeta = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, zeta));

        var phi = 2004.3109 *t - 0.42665 *tsquared - 0.041833 *tcubed;
        phi = CAACoordinateTransformation.DegreesToRadians(CAACoordinateTransformation.DMSToDegrees(0, 0, phi));

        var cossigma = Math.Cos(sigma);
        var coszeta = Math.Cos(zeta);
        var cosphi = Math.Cos(phi);
        var sinsigma = Math.Sin(sigma);
        var sinzeta = Math.Sin(zeta);
        var sinphi = Math.Sin(phi);

        var xx = cossigma * coszeta * cosphi -sinsigma *sinzeta;
        var xy = sinsigma * coszeta + cossigma * sinzeta * cosphi;
        var xz = cossigma * sinphi;
        var yx = -cossigma * sinzeta - sinsigma * coszeta * cosphi;
        var yy = cossigma * coszeta - sinsigma * sinzeta * cosphi;
        var yz = -sinsigma * sinphi;
        var zx = -coszeta * sinphi;
        var zy = -sinzeta * sinphi;
        var zz = cosphi;

        var result = new CAA3DCoordinate
        {
        X = xx*@value.X + yx*@value.Y + zx*@value.Z,
        Y = xy*@value.X + yy*@value.Y + zy*@value.Z,
        Z = xz*@value.X + yz*@value.Y + zz*@value.Z
        };

          return result;
    }
Ejemplo n.º 14
0
    public static CAA2DCoordinate EquatorialAberration(double Alpha, double Delta, double JD)
    {
        //Convert to radians
        Alpha = CAACoordinateTransformation.DegreesToRadians(Alpha * 15);
        Delta = CAACoordinateTransformation.DegreesToRadians(Delta);

        double cosAlpha = Math.Cos(Alpha);
        double sinAlpha = Math.Sin(Alpha);
        double cosDelta = Math.Cos(Delta);
        double sinDelta = Math.Sin(Delta);

        CAA3DCoordinate velocity = EarthVelocity(JD);

        //What is the return value
        CAA2DCoordinate aberration = new CAA2DCoordinate();

        aberration.X = CAACoordinateTransformation.RadiansToHours((velocity.Y * cosAlpha - velocity.X * sinAlpha) / (17314463350.0 * cosDelta));
        aberration.Y = CAACoordinateTransformation.RadiansToDegrees(-(((velocity.X * cosAlpha + velocity.Y * sinAlpha) * sinDelta - velocity.Z * cosDelta) / 17314463350.0));

        return(aberration);
    }
Ejemplo n.º 15
0
    protected static void Rotations(double X, double Y, double Z, double I, double psi, double i, double omega, double lambda0, double beta0, ref double A6, ref double B6, ref double C6, out CAA3DCoordinate eclipticCoord)
    {
        double phi = psi - omega;

        //Rotation towards Jupiter's orbital plane
        double A1 = X;
        double B1 = Y *Math.Cos(I) - Z *Math.Sin(I);
        double C1 = Y *Math.Sin(I) + Z *Math.Cos(I);

        //Rotation towards the ascending node of the orbit of jupiter
        double A2 = A1 *Math.Cos(phi) - B1 *Math.Sin(phi);
        double B2 = A1 *Math.Sin(phi) + B1 *Math.Cos(phi);
        double C2 = C1;

        //Rotation towards the plane of the ecliptic
        double A3 = A2;
        double B3 = B2 *Math.Cos(i) - C2 *Math.Sin(i);
        double C3 = B2 *Math.Sin(i) + C2 *Math.Cos(i);

        //Rotation towards the vernal equinox
        double A4 = A3 *Math.Cos(omega) - B3 *Math.Sin(omega);
        double B4 = A3 *Math.Sin(omega) + B3 *Math.Cos(omega);
        double C4 = C3;

        const double JupiterRadiiToAU = 1.0 / 2095.0; // Not exact, but this is the value used elsewhere in the calculation
        eclipticCoord.X = A4 * JupiterRadiiToAU;
        eclipticCoord.Y = B4 * JupiterRadiiToAU;
        eclipticCoord.Z = C4 * JupiterRadiiToAU;

        double A5 = A4 *Math.Sin(lambda0) - B4 *Math.Cos(lambda0);
        double B5 = A4 *Math.Cos(lambda0) + B4 *Math.Sin(lambda0);
        double C5 = C4;

        A6 = A5;
        B6 = C5 *Math.Sin(beta0) + B5 *Math.Cos(beta0);
        C6 = C5 *Math.Cos(beta0) - B5 *Math.Sin(beta0);
    }
Ejemplo n.º 16
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;
    }
Ejemplo n.º 17
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);
    }
    //Static methods
    //L2   L3   L4  L5  L6  L7  L8  Ldash D   Mdash F   xsin      xsint xcos    xcost ysin   ysint ycos     ycost zsin   zsint zcos    zcost
    //////////////////////////////// Implementation ///////////////////////////////
    public static CAA3DCoordinate EarthVelocity(double JD)
    {
        double T = (JD - 2451545) / 36525;
        double L2 = 3.1761467 + 1021.3285546 * T;
        double L3 = 1.7534703 + 628.3075849 * T;
        double L4 = 6.2034809 + 334.0612431 * T;
        double L5 = 0.5995465 + 52.9690965 * T;
        double L6 = 0.8740168 + 21.3299095 * T;
        double L7 = 5.4812939 + 7.4781599 * T;
        double L8 = 5.3118863 + 3.8133036 * T;
        double Ldash = 3.8103444 + 8399.6847337 * T;
        double D = 5.1984667 + 7771.3771486 * T;
        double Mdash = 2.3555559 + 8328.6914289 * T;
        double F = 1.6279052 + 8433.4661601 * T;

        CAA3DCoordinate velocity = new CAA3DCoordinate();

        int nAberrationCoefficients = GlobalMembersStdafx.g_AberrationCoefficients.Length;
        for (int i =0; i<nAberrationCoefficients; i++)
        {
          double Argument = GlobalMembersStdafx.g_AberrationCoefficients[i].L2 *L2 + GlobalMembersStdafx.g_AberrationCoefficients[i].L3 *L3 + GlobalMembersStdafx.g_AberrationCoefficients[i].L4 *L4 + GlobalMembersStdafx.g_AberrationCoefficients[i].L5 *L5 + GlobalMembersStdafx.g_AberrationCoefficients[i].L6 *L6 + GlobalMembersStdafx.g_AberrationCoefficients[i].L7 *L7 + GlobalMembersStdafx.g_AberrationCoefficients[i].L8 *L8 + GlobalMembersStdafx.g_AberrationCoefficients[i].Ldash *Ldash + GlobalMembersStdafx.g_AberrationCoefficients[i].D *D + GlobalMembersStdafx.g_AberrationCoefficients[i].Mdash *Mdash + GlobalMembersStdafx.g_AberrationCoefficients[i].F *F;
          velocity.X += (GlobalMembersStdafx.g_AberrationCoefficients[i].xsin + GlobalMembersStdafx.g_AberrationCoefficients[i].xsint * T) * Math.Sin(Argument);
          velocity.X += (GlobalMembersStdafx.g_AberrationCoefficients[i].xcos + GlobalMembersStdafx.g_AberrationCoefficients[i].xcost * T) * Math.Cos(Argument);

          velocity.Y += (GlobalMembersStdafx.g_AberrationCoefficients[i].ysin + GlobalMembersStdafx.g_AberrationCoefficients[i].ysint * T) * Math.Sin(Argument);
          velocity.Y += (GlobalMembersStdafx.g_AberrationCoefficients[i].ycos + GlobalMembersStdafx.g_AberrationCoefficients[i].ycost * T) * Math.Cos(Argument);

          velocity.Z += (GlobalMembersStdafx.g_AberrationCoefficients[i].zsin + GlobalMembersStdafx.g_AberrationCoefficients[i].zsint * T) * Math.Sin(Argument);
          velocity.Z += (GlobalMembersStdafx.g_AberrationCoefficients[i].zcos + GlobalMembersStdafx.g_AberrationCoefficients[i].zcost * T) * Math.Cos(Argument);
        }

        return velocity;
    }
Ejemplo n.º 19
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);
    }
Ejemplo n.º 20
0
    protected static void Rotations(double X, double Y, double Z, double I, double psi, double i, double omega, double lambda0, double beta0, ref double A6, ref double B6, ref double C6, out CAA3DCoordinate eclipticCoord)
    {
        double phi = psi - omega;

        //Rotation towards Jupiter's orbital plane
        double A1 = X;
        double B1 = Y * Math.Cos(I) - Z * Math.Sin(I);
        double C1 = Y * Math.Sin(I) + Z * Math.Cos(I);

        //Rotation towards the ascending node of the orbit of jupiter
        double A2 = A1 * Math.Cos(phi) - B1 * Math.Sin(phi);
        double B2 = A1 * Math.Sin(phi) + B1 * Math.Cos(phi);
        double C2 = C1;

        //Rotation towards the plane of the ecliptic
        double A3 = A2;
        double B3 = B2 * Math.Cos(i) - C2 * Math.Sin(i);
        double C3 = B2 * Math.Sin(i) + C2 * Math.Cos(i);

        //Rotation towards the vernal equinox
        double A4 = A3 * Math.Cos(omega) - B3 * Math.Sin(omega);
        double B4 = A3 * Math.Sin(omega) + B3 * Math.Cos(omega);
        double C4 = C3;

        const double JupiterRadiiToAU = 1.0 / 2095.0; // Not exact, but this is the value used elsewhere in the calculation

        eclipticCoord.X = A4 * JupiterRadiiToAU;
        eclipticCoord.Y = B4 * JupiterRadiiToAU;
        eclipticCoord.Z = C4 * JupiterRadiiToAU;

        double A5 = A4 * Math.Sin(lambda0) - B4 * Math.Cos(lambda0);
        double B5 = A4 * Math.Cos(lambda0) + B4 * Math.Sin(lambda0);
        double C5 = C4;

        A6 = A5;
        B6 = C5 * Math.Sin(beta0) + B5 * Math.Cos(beta0);
        C6 = C5 * Math.Cos(beta0) - B5 * Math.Sin(beta0);
    }