Ejemplo n.º 1
0
        private TwoLineElement GetTwoLineElement()
        {
            string         str = this.textBox_input.Text;
            TwoLineElement tle = new TwoLineElement(str);

            return(tle);
        }
Ejemplo n.º 2
0
        // /////////////////////////////////////////////////////////////////////
        static void Main(string[] args)
        {
            // Sample obsCodeode to test the SGP4 and SDP4 implementation. The test
            // TLEs come from the NORAD document "Space Track Report No. 3".

            // Test SGP4
            string str1 = "SGP4 Test";
            string str2 = "1 88888U          80275.98708465  .00073094  13844-3  66816-4 0     8";
            string str3 = "2 88888  72.8435 115.9689 0086731  52.6988 110.5714 16.05824518   105";

            TwoLineElement tle1 = new TwoLineElement(str1, str2, str3);

            PrintPosVel(tle1);

            Console.WriteLine();

            // Test SDP4
            str1 = "SDP4 Test";
            str2 = "1 11801U          80230.29629788  .01431103  00000-0  14311-1       8";
            str3 = "2 11801  46.7916 230.4354 7318036  47.4722  10.4117  2.28537848     6";

            TwoLineElement tle2 = new TwoLineElement(str1, str2, str3);

            PrintPosVel(tle2);

            Console.WriteLine("\nExample output:");

            // Example: Define a location on the earth, then determine the look-angle
            // to the SDP4 satellite defined above.

            // Create an orbit object using the SDP4 TLE object.
            // Satellite satSDP4 = new Satellite(tle2);
            Orbit orbit = new Orbit(tle2);
            // Get the location of the satellite from the Orbit object. The
            // earth-centered inertial information is placed into eciSDP4.
            // Here we ask for the location of the satellite 90 minutes after
            // the TLE epoch.
            TimedMotionState eciSDP4 = orbit.PositionEci(90.0);

            // Now create a site object. Site objects represent a location on the
            // surface of the earth. Here we arbitrarily select a point on the
            // equator.
            GeoCoord siteEquator = new GeoCoord(0.0, -100.0, 0); // 0.00 N, 100.00 W, 0 km altitude

            // Now get the "look angle" from the site to the satellite.
            // Note that the ECI object "eciSDP4" has a time associated
            // with the coordinates it contains; this is the time at which
            // the look angle is valid.
            TopoCoord topoLook = OrbitUtils.GetSatTopoCoord(eciSDP4, siteEquator);

            // Print out the results. Note that the Azimuth and Elevation are
            // stored in the CoordTopo object as radians. Here we funcKeyToDouble
            // to degrees using Rad2Deg()
            Console.Write("AZ: {0:f3}  EL: {1:f3}\n",
                          topoLook.Azimuth,
                          topoLook.Elevation);
        }
Ejemplo n.º 3
0
        // //////////////////////////////////////////////////////////////////////////
        //
        // Routine to output position and velocity information of satellite
        // in orbit described by TLE information.
        //
        static void PrintPosVel(TwoLineElement tle)
        {
            const int Step  = 360;
            Orbit     orbit = new Orbit(tle);
            // Satellite sat = new Satellite(tle);
            List <MotionState> coords = new List <MotionState>();

            // Calculate position, velocity
            // mpe = "minutes past epoch"
            for (int mpe = 0; mpe <= (Step * 4); mpe += Step)
            {
                // Get the position of the satellite at time "mpe".
                // The coordinates are placed into the variable "eci".
                MotionState eci = orbit.PositionEci(mpe);

                // Add the coordinate object to the colName
                coords.Add(eci);
            }

            // Print TLE satData
            Console.Write("{0}\n", tle.Name);
            Console.Write("{0}\n", tle.Line1);
            Console.Write("{0}\n", tle.Line2);

            // Header
            Console.Write("\n  TSINCE            X                Y                Z\n\n");

            // Iterate over each of the ECI position objects pushed onto the
            // coordinate colName, above, printing the ECI position information
            // as we go.
            for (int i = 0; i < coords.Count; i++)
            {
                MotionState e = coords[i] as MotionState;

                Console.Write("{0,8}.00 {1,16:f8} {2,16:f8} {3,16:f8}\n",
                              i * Step,
                              e.Position.X,
                              e.Position.Y,
                              e.Position.Z);
            }

            Console.Write("\n                  XDOT             YDOT             ZDOT\n\n");

            // Iterate over each of the ECI position objects in the coordinate
            // colName again, but this time print the velocity information.
            for (int i = 0; i < coords.Count; i++)
            {
                MotionState e = coords[i] as MotionState;

                Console.Write("{0,24:f8} {1,16:f8} {2,16:f8}\n",
                              e.Velocity.X,
                              e.Velocity.Y,
                              e.Velocity.Z);
            }
            Console.ReadKey();
        }
Ejemplo n.º 4
0
        private void button_solve_Click(object sender, EventArgs e)
        {
            TwoLineElement tle = GetTwoLineElement();

            Gnsser.Orbits.Orbit orbit = new Gnsser.Orbits.Orbit(tle);

            double intervalMin = Double.Parse(this.textBox_intervalMin.Text);
            double count       = Int32.Parse(this.textBox_count.Text);
            List <TimedMotionState> sateStates = new List <TimedMotionState>();

            for (int i = 0; i < count; i++)
            {
                double           time    = i * intervalMin;
                TimedMotionState eciSDP4 = orbit.PositionEci(time);
                sateStates.Add(eciSDP4);
            }

            if (sateStates.Count == 0)
            {
                return;
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(orbit.ToString());
            sb.AppendLine(tle.ToString());
            foreach (var item in sateStates)
            {
                sb.AppendLine(item.ToString());
            }

            this.textBox_show.Text = sb.ToString();

            int j = 0;

            lonlats = new List <AnyInfo.Geometries.Point>();
            foreach (var item in sateStates)
            {
                GeoCoord geoCoord = CoordTransformer.XyzToGeoCoord(item.Position * 1000, AngleUnit.Degree);
                lonlats.Add(new AnyInfo.Geometries.Point(geoCoord, j + "", item.Date.ToTime().ToString("hh:mm:ss")));
                j++;
            }
        }
Ejemplo n.º 5
0
        private void button_radarCaculate_Click(object sender, EventArgs e)
        {
            bool isGeoCoord = this.radioButton_geoCoord.Checked;

            GeoCoord siteCoord = null;

            if (isGeoCoord)
            {
                siteCoord      = GeoCoord.Parse(this.textBox_coord.Text);
                siteCoord.Unit = AngleUnit.Degree;
            }
            else
            {
                XYZ xyz = XYZ.Parse(this.textBox_coord.Text);
                siteCoord = CoordTransformer.XyzToGeoCoord(xyz);
            }

            TwoLineElement tle = GetTwoLineElement();

            Gnsser.Orbits.Orbit orbit = new Gnsser.Orbits.Orbit(tle);

            double intervalMin = Double.Parse(this.textBox_intervalMin.Text);
            double count       = Int32.Parse(this.textBox_count.Text);

            lonlats = new List <AnyInfo.Geometries.Point>();
            lonlats.Add(new AnyInfo.Geometries.Point(siteCoord, "SitePoint"));
            for (int i = 0; i < count; i++)
            {
                double           time     = i * intervalMin;
                TimedMotionState eciSDP4  = orbit.PositionEci(time);
                TopoCoord        topoLook = OrbitUtils.GetSatTopoCoord(eciSDP4, siteCoord);

                if (topoLook.Elevation > 0)
                {
                    GeoCoord geoCoord = CoordTransformer.XyzToGeoCoord(eciSDP4.Position * 1000, AngleUnit.Degree);
                    lonlats.Add(new AnyInfo.Geometries.Point(geoCoord, i + ""));
                }
            }
        }