Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // string line0 = "ISS (ZARYA)    ";
            string line1 = "1 25544U 98067A   20206.38292522 -.00000985  00000-0 -95291-5 0  9998";
            string line2 = "2 25544  51.6430 164.3636 0001088 140.8410 323.1994 15.49511774237787";

            Sat_Io io     = new Sat_Io();
            Satrec satrec = io.twoline2satrec(line1, line2);

            Sgp4 sgp4 = new Sgp4();
            PositionAndVelocity positionAndVelocity = sgp4.sgp4(satrec, 0);



            // Set the Observer at 122.03 West by 36.96 North, in RADIANS
            Geodetic  observerGd = new Geodetic();
            Transform tf         = new Transform();

            observerGd.longitude = tf.degreesToRadians(-122.0308);
            observerGd.latitude  = tf.degreesToRadians(36.9613422);
            observerGd.height    = 0.370;


            Console.WriteLine(positionAndVelocity.position_ECI.x);
            Console.WriteLine(positionAndVelocity.position_ECI.y);
            Console.WriteLine(positionAndVelocity.position_ECI.z);



            Console.WriteLine("Look i didnt crash");
        }
Ejemplo n.º 2
0
        public Geodetic eciToGeodetic(Coordiantes eci, double gmst)
        {
            // http://www.celestrak.com/columns/v02n03/
            double a  = 6378.137;
            double b  = 6356.7523142;
            double R  = Math.Sqrt((eci.x * eci.x) + (eci.y * eci.y));
            double f  = (a - b) / a;
            double e2 = ((2 * f) - (f * f));

            double longitude = Math.Atan2(eci.y, eci.x) - gmst;

            while (longitude < -pi)
            {
                longitude += twoPi;
            }
            while (longitude > pi)
            {
                longitude -= twoPi;
            }

            double kmax     = 20;
            double k        = 0;
            double latitude = Math.Atan2(
                eci.z,
                Math.Sqrt((eci.x * eci.x) + (eci.y * eci.y))
                );

            double C = 0;

            while (k < kmax)
            {
                C        = 1 / Math.Sqrt(1 - (e2 * (Math.Sin(latitude) * Math.Sin(latitude))));
                latitude = Math.Atan2(eci.z + (a * C * e2 * Math.Sin(latitude)), R);
                k       += 1;
            }
            double height = (R / Math.Cos(latitude)) - (a * C);

            Geodetic geodetic = new Geodetic();

            geodetic.longitude = longitude;
            geodetic.latitude  = latitude;
            geodetic.height    = height;

            return(geodetic);
        }
Ejemplo n.º 3
0
        public Coordiantes geodeticToEcf(Geodetic geodetic)
        {
            double longitude = geodetic.longitude;
            double latitude  = geodetic.latitude;
            double height    = geodetic.height;

            double a      = 6378.137;
            double b      = 6356.7523142;
            double f      = (a - b) / a;
            double e2     = ((2 * f) - (f * f));
            double normal = a / Math.Sqrt(1 - (e2 * (Math.Sin(latitude) * Math.Sin(latitude))));

            double x = (normal + height) * Math.Cos(latitude) * Math.Cos(longitude);
            double y = (normal + height) * Math.Cos(latitude) * Math.Sin(longitude);
            double z = ((normal * (1 - e2)) + height) * Math.Sin(latitude);

            Coordiantes ecf = new Coordiantes();

            ecf.x = x;
            ecf.y = y;
            ecf.z = z;

            return(ecf);
        }