Example #1
0
        /// <summary>
        /// Get Position of the Earth
        /// </summary>
        /// <param name="T"></param>
        /// <returns></returns>
        private static Xyz GetPosExp0(double T)
        {
            double lambda = 279.0358 + 360.00769 * T + (1.9159 - 0.00005 * T) * UdMath.udsin((356.531) + (359.991) * T);

            for (int i = 0; i < SunLambda.GetLength(0); i++)
            {
                lambda += SunLambda[i].a * UdMath.udsin(SunLambda[i].b + SunLambda[i].c * T);
            }

            lambda += 0.0057;
            lambda  = UdMath.deg2rad(UdMath.degmal(lambda));
            double beta = 0.0;

            double q = (-0.007261 + 0.0000002 * T) * UdMath.udcos((356.53) + (359.991) * T) + 0.000030;

            for (int i = 0; i < SunQ.GetLength(0); i++)
            {
                q += SunQ[i].a * UdMath.udcos(SunQ[i].b + SunQ[i].b * T);
            }

            double radius = Math.Pow(10.0, q);

            return(new Xyz(-radius * Math.Cos(beta) * Math.Cos(lambda),
                           -radius * Math.Cos(beta) * Math.Sin(lambda),
                           -radius * Math.Sin(beta)));
        }
Example #2
0
        /// <summary>
        /// Orbital element to Xyz
        /// </summary>
        /// <returns></returns>
        public Xyz GetPos()
        {
            double re = this.e * 180.0 / Math.PI;
            double E, M, oldE;

            E = M = this.L - (this.w + this.N);
            do
            {
                oldE = E;
                E    = M + re * UdMath.udsin(oldE);
            } while (Math.Abs(E - oldE) > 1.0e-5 * 180.0 / Math.PI);
            double px = this.a * (UdMath.udcos(E) - this.e);
            double py = this.a * Math.Sqrt(1.0 - this.e * this.e) * UdMath.udsin(E);

            double sinperi = UdMath.udsin(this.w);
            double cosperi = UdMath.udcos(this.w);
            double sinnode = UdMath.udsin(this.N);
            double cosnode = UdMath.udcos(this.N);
            double sinincl = UdMath.udsin(this.i);
            double cosincl = UdMath.udcos(this.i);

            double xc = px * (cosnode * cosperi - sinnode * cosincl * sinperi)
                        - py * (cosnode * sinperi + sinnode * cosincl * cosperi);

            double yc = px * (sinnode * cosperi + cosnode * cosincl * sinperi)
                        - py * (sinnode * sinperi - cosnode * cosincl * cosperi);

            double zc = px * (sinincl * sinperi)
                        + py * (sinincl * cosperi);

            return(new Xyz(xc, yc, zc));
        }
Example #3
0
        /// <summary>
        /// Mean orbital element of Jupiter with perturbation
        /// </summary>
        /// <param name="jd"></param>
        private void PerturbationJupiter(double jd)
        {
            int    year = (int)((jd - 1721423.5) / 365.244 + 1.0);
            double T    = year / 1000.0;

            double L7   = (0.42 - 0.075 * T + 0.015 * T * T - 0.003 * T * T * T) * UdMath.udsin((T - 0.62) * 360.0 / 0.925);
            double PS7  = 0.02 * UdMath.udsin((T + 0.1) * 360.0 / 0.925);
            double PH7  = 0.03 * UdMath.udsin((T + 0.36) * 360.0 / 0.925);
            double ETA  = UdMath.degmal(86.1 + 0.033459 * (jd - 1721057.0));
            double ZETA = UdMath.degmal(89.1 + 0.049630 * (jd - 1721057.0));
            double L8   = PerturbationElement(ETA, ZETA, perturbJup1) / 1000.0;
            double PS8  = PerturbationElement(ETA, ZETA, perturbJup2) / 1000.0;
            double PH8  = PerturbationElement(ETA, ZETA, perturbJup3) / 1000.0;
            double PH   = 2.58 + 0.1 * T;

            if (PH > 3.5)
            {
                PH = 3.5;
            }
            if (PH < 1.5)
            {
                PH = 1.5;
            }
            L += (L7 + L8);
            w += (PS7 + PS8) / UdMath.udsin(PH);
            e  = UdMath.udsin(PH + PH7 + PH8);
        }
Example #4
0
        /// <summary>
        /// Mean orbital element of Saturn with perturbation
        /// </summary>
        /// <param name="jd"></param>
        void PerturbationSaturn(double jd)
        {
            int    year = (int)((jd - 1721423.5) / 365.244 + 1.0);
            double T    = year / 1000.0;

            double AT   = 0.88 - 0.0633 * T + 0.03 * T * T - 0.0006 * T * T * T;
            double L7   = -0.50 + AT * UdMath.udsin((T - 0.145) * 360.0 / 0.95);
            double PS7  = -0.50 + (0.10 - 0.005 * T) * UdMath.udsin((T - 0.54) * 360.0 / 0.95);
            double PH7  = -0.50 + (0.10 - 0.005 * T) * UdMath.udsin((T - 0.32) * 360.0 / 0.95);
            double AX7  = -0.050 + (0.004 - 0.0005 * T) * UdMath.udsin((T - 0.35) * 360.0 / 0.95);
            double ETA  = UdMath.degmal(86.1 + 0.033459 * (jd - 1721057.0));
            double ZETA = UdMath.degmal(89.1 + 0.049630 * (jd - 1721057.0));
            double L8   = PerturbationElement(ETA, ZETA, perturbSat1) / 100.0;
            double PS8  = PerturbationElement(ETA, ZETA, perturbSat2) / 100.0;
            double PH8  = PerturbationElement(ETA, ZETA, perturbSat3) / 100.0;
            double AX8  = PerturbationElement(ETA, ZETA, perturbSat4) / 1000.0;
            double PH   = 3.56 - 0.175 * T - 0.005 * T * T;

            /* if year > 7000 then PH < 2.0 */
            if (PH < 2.0)
            {
                PH = 2.0;
            }
            L += (L7 + L8);
            w += (PS7 + PS8) / UdMath.udsin(PH);
            e  = UdMath.udsin(PH + PH7 + PH8);
            a += AX7 + AX8;
        }
Example #5
0
        private void DoGetPlanetOrbit(PlanetElm planetElm)
        {
            double ae2 = -2.0 * planetElm.a * planetElm.e;
            double t   = Math.Sqrt(1.0 - planetElm.e * planetElm.e);
            int    xp1 = 0;
            int    xp2 = (this.Division / 2);
            int    xp3 = (this.Division / 2);
            int    xp4 = this.Division;
            double E   = 0.0;

            for (int i = 0; i <= (this.Division / 4); i++, E += (360.0 / this.Division))
            {
                double rcosv = planetElm.a * (UdMath.udcos(E) - planetElm.e);
                double rsinv = planetElm.a * t * UdMath.udsin(E);
                this.Orbit[xp1++] = new Xyz(rcosv, rsinv, 0.0);
                this.Orbit[xp2--] = new Xyz(ae2 - rcosv, rsinv, 0.0);
                this.Orbit[xp3++] = new Xyz(ae2 - rcosv, -rsinv, 0.0);
                this.Orbit[xp4--] = new Xyz(rcosv, -rsinv, 0.0);
            }
        }