Example #1
0
        public List <Satellite> GetSatellites(string[] Norad)
        {
            string predicateValues = "/class/tle_latest/ORDINAL/1/NORAD_CAT_ID/" + string.Join(",", Norad) + "/orderby/NORAD_CAT_ID%20ASC/format/3le";
            string request         = uriBase + requestController + requestAction + predicateValues;

            // Create new WebClient object to communicate with the service
            using (var client = new WebClientEx())
            {
                if (Auth(client))
                {
                    var response4           = client.DownloadData(request);
                    var stringData          = (System.Text.Encoding.Default.GetString(response4)).Split('\n');
                    List <Satellite> result = new List <Satellite>();
                    for (Int32 i = 0; i < stringData.Length - 1; i += 3)
                    {
                        Tle       tle = new Tle(stringData[i], stringData[i + 1], stringData[i + 2]);
                        Satellite sat = new Satellite(tle);
                        result.Add(sat);
                        OnProgress(new ProgressEventArgs(i, stringData.Length - 1));
                    }
                    return(result);
                }
                else
                {
                    throw new NoAuthException();
                }
            }
        }
        public List <SurfaceSgp4Pair> GetCoordinatePairs(Tle satalite, DateTime from, DateTime to, int resolution)
        {
            Sgp4 sgp4Propagator = new Sgp4(satalite, 1);

            var epochFrom = new EpochTime(from);
            var epochTo   = new EpochTime(to);

            var stepSize = (to - from).TotalMinutes / resolution;

            sgp4Propagator.runSgp4Cal(epochFrom, epochTo, stepSize);

            var results = sgp4Propagator.getRestults()
                          .Select((sgp, i) => {
                var time = from.AddMinutes(i * stepSize);
                return(new SurfaceSgp4Pair
                {
                    TimePointUtc = time,
                    SatalitePoint = sgp,
                    SurfacePoint = this.GetMePosition(time)
                });
            })
                          .ToList();

            return(results);
        }
Example #3
0
        /// <summary>
        ///     Creates a new numerical orbital element descriptor set for the provided two-line element set
        /// </summary>
        /// <param name="tle">The set to extract numerical values from</param>
        public Orbit(Tle tle)
        {
            // extract and format tle data
            MeanAnomoly     = tle.MeanAnomaly;
            AscendingNode   = tle.RightAscendingNode;
            ArgumentPerigee = tle.ArgumentPerigee;
            Eccentricity    = tle.Eccentricity;
            Inclination     = tle.Inclination;
            MeanMotion      = tle.MeanMotionRevPerDay * SgpConstants.TwoPi / SgpConstants.MinutesPerDay;
            BStar           = tle.BStarDragTerm;
            Epoch           = tle.Epoch;

            // recover original mean motion (xnodp) and semimajor axis (aodp) from input elements
            var a1     = Math.Pow(SgpConstants.ReciprocalOfMinutesPerTimeUnit / MeanMotion, SgpConstants.TwoThirds);
            var cosio  = Math.Cos(Inclination.Radians);
            var theta2 = cosio * cosio;
            var x3Thm1 = 3.0 * theta2 - 1.0;
            var eosq   = Eccentricity * Eccentricity;
            var betao2 = 1.0 - eosq;
            var betao  = Math.Sqrt(betao2);
            var temp   = 1.5 * SgpConstants.Ck2 * x3Thm1 / (betao * betao2);
            var del1   = temp / (a1 * a1);
            var a0     = a1 * (1.0 - del1 * (1.0 / 3.0 + del1 * (1.0 + del1 * 134.0 / 81.0)));
            var del0   = temp / (a0 * a0);

            RecoveredMeanMotion    = MeanMotion / (1.0 + del0);
            RecoveredSemiMajorAxis = a0 / (1.0 - del0);

            // find perigee and period
            Perigee = (RecoveredSemiMajorAxis * (1.0 - Eccentricity) - SgpConstants.DistanceUnitsPerEarthRadii) *
                      SgpConstants.EarthRadiusKm;
            Apogee = (RecoveredSemiMajorAxis * (1.0 + Eccentricity) - SgpConstants.DistanceUnitsPerEarthRadii) *
                     SgpConstants.EarthRadiusKm;
            Period = SgpConstants.TwoPi / RecoveredMeanMotion;
        }
Example #4
0
        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="tle">The two-line representation of the satellite</param>
        public Satellite(Tle tle)
        {
            Tle   = tle;
            _sgp4 = new Sgp4(tle);

            Name = tle.Name;
        }
Example #5
0
        public List <Satellite> GetSatellites(string LanuchYaer)
        {
            string predicateValues = "/class/tle_latest/LAUNCH_YEAR/=" + LanuchYaer + "/orderby/INTLDES asc/metadata/false";
            string request         = uriBase + requestController + requestAction + predicateValues;

            // Create new WebClient object to communicate with the service
            using (var client = new WebClientEx())
            {
                if (Auth(client))
                {
                    var response4           = client.DownloadData(request);
                    var stringData          = (System.Text.Encoding.Default.GetString(response4)).Split('\n');
                    List <Satellite> result = new List <Satellite>();
                    for (Int32 i = 0; i < stringData.Length - 1; i += 3)
                    {
                        Tle       tle = new Tle(stringData[i], stringData[i + 1], stringData[i + 2]);
                        Satellite sat = new Satellite(tle);
                        result.Add(sat);
                        OnProgress(new ProgressEventArgs(i, stringData.Length - 1));
                    }
                    return(result);
                }
                else
                {
                    throw new NoAuthException();
                }
            }
        }
Example #6
0
        //Returns the azimuth and elevation from a TLE
        private double[] getSkyCoords(Tle tle)
        {
            double[] array = { -1, -1 };
            //create a viewing site
            Site site = new Site(latitude, longitude, 0.240949);
            //make an orbit out of the tle
            Orbit orbit = new Orbit(tle);
            //get the date
            DateTime dt = DateTime.UtcNow;
            //get the time since the epoch
            TimeSpan ts = orbit.TPlusEpoch(dt);

            //then calculate the position
            try
            {
                EciTime eci      = orbit.GetPosition(dt);
                Topo    topoLook = site.GetLookAngle(eci);
                array[0] = topoLook.AzimuthDeg;
                array[1] = topoLook.ElevationDeg;
                return(array);
            }
            catch
            {
                return(array);
            }
        }
Example #7
0
    public static Tle[] TlesFromTxt(string filename)
    {
        ArrayList    list1 = new ArrayList();
        StreamReader sr = new StreamReader(filename);
        int          i = 1;
        string       line1 = "", line2 = "", line3 = "";

        while (sr.Peek() >= 0)
        {
            switch (i)
            {
            case 1:
                line1 = sr.ReadLine();
                i++;
                break;

            case 2:
                line2 = sr.ReadLine();
                i++;
                break;

            case 3:
                line3 = sr.ReadLine();
                Tle tle0 = new Tle(line1, line2, line3);
                list1.Add(tle0);
                i = 1;
                break;
            }
        }
        Tle[] tles = (Tle[])(list1).ToArray(typeof(Tle));
        return(tles);
    }
    IEnumerator LoadDebris()
    {
        spaceCraft   = GameObject.Find("SpaceCraft");
        attribute    = spaceCraft.GetComponent <attributeDefiner>();
        Loading.text = "Downloading Game Debris Data";
        yield return(new WaitForSeconds(1));

        string jsonURL  = @"https://worldwind.arc.nasa.gov/spacebirds/data/TLE.json";
        WWW    download = new WWW(jsonURL);

        while (!download.isDone)
        {
            Progress.fillAmount = download.progress;
            float prog = download.progress * 100;
            ProgressText.text = "" + (int)prog + "%";

            yield return(null);
        }

        yield return(download);

        List <Debris> debrisData = JsonConvert.DeserializeObject <List <Debris> >(download.text);

        Loading.text = "Loading Game Debris.";


        foreach (var item in debrisData)
        {
            if (item.OBJECT_TYPE == "DEBRIS")
            {
                Tle        tle    = new Tle(item.OBJECT_ID, item.TLE_LINE1, item.TLE_LINE2);
                Satellite  sat    = new Satellite(tle);
                List <Eci> coords = new List <Eci>();

                Eci eci = sat.PositionEci(900);

                Vector3 pos = new Vector3((float)eci.Position.X, (float)eci.Position.Y, (float)eci.Position.Z);
                Debug.Log(pos);
                float decider = Random.value;

                if (decider <= 0.33)
                {
                    DebrisGenerator(bolt, pos);
                }
                else if (decider > 0.33 && decider <= 0.66)
                {
                    DebrisGenerator(nut, pos);
                }
                else
                {
                    DebrisGenerator(sheet, pos);
                }
            }
        }
        yield return(new WaitForSeconds(1));

        LoadingScreen.SetActive(false);
        attribute.IsLoading = false;
    }
Example #9
0
 public SGP4Thread(Tle tleData,
                   TimeDate starttime, TimeDate stoptime, double step)
 {
     satTleData = tleData;
     startTime  = starttime;
     stopTime   = stoptime;
     tick       = step;
 }
Example #10
0
 public satObjData(string satName, Tle tle, Vector3 scale, Quaternion rot)
 {
     this.satName = satName;
     this.tle     = tle;
     this.scale   = scale;
     this.rot     = rot;
     updatePos();
 }
Example #11
0
 public SGP4Thread(SatelliteDataVector dataVector, Tle tleData,
                   TimeDate starttime, TimeDate stoptime, double step)
 {
     satTleData    = tleData;
     startTime     = starttime;
     stopTime      = stoptime;
     tick          = step;
     dataVectorRes = dataVector;
 }
        // /////////////////////////////////////////////////////////////////////
        static void Main(string[] args)
        {
            // Sample code 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";

            Tle tle1 = new Tle(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";

            Tle tle2 = new Tle(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);

            // 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.
            EciTime eciSDP4 = satSDP4.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.
            Site siteEquator = new Site(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.
            Topo topoLook = siteEquator.GetLookAngle(eciSDP4);

            // Print out the results. Note that the Azimuth and Elevation are
            // stored in the CoordTopo object as radians. Here we convert
            // to degrees using Rad2Deg()
            Console.Write("AZ: {0:f3}  EL: {1:f3}\n",
                          topoLook.AzimuthDeg,
                          topoLook.ElevationDeg);
        }
Example #13
0
    // Use this for initialization
    void Start()
    {
        this._tle           = new Tle("sat", TLE1, TLE2);
        this._satellite     = new Satellite(_tle);
        this._site          = new Site(Lat, Long, Altitude);
        this._detailsCanvas = this.transform.Find("detailsCanvas").gameObject;

        mainLabel.text = SatelliteName;
    }
Example #14
0
 public Orbit(Tle tle)  //construction using file
     : this(tle.GetField(Tle.Field.Inclination),
            tle.GetField(Tle.Field.Eccentricity),
            tle.GetField(Tle.Field.Raan),
            tle.GetField(Tle.Field.MeanMotion),
            tle.GetField(Tle.Field.ArgPerigee))
 {
     _tle = tle;
 }
Example #15
0
        public void TleParseFromLinesShouldSucceed()
        {
            //             0.........1.........2.........3.........4.........5.........6.........7
            string line1 = "1 42784U 17036Vvv 17175.91623346  .00001083  00000-0  52625-4 0  9993";
            string line2 = "2 42784  97.4499 235.6602 0011188 243.9018 116.1066 15.20524655   207";

            Tle t = ParserTLE.parseTle(line1, line2);

            Assert.That(t.isValidData, Is.True);
            Assert.That(t.getClassification(), Is.EqualTo(0));
            Assert.That(t.getDrag(), Is.EqualTo(0.000052625));
            Assert.That(t.getEccentriciy(), Is.EqualTo(0.0011188));
            Assert.That(t.getEphemeris(), Is.EqualTo(0));
            Assert.That(t.getEpochDay(), Is.EqualTo(175.91623346));
            Assert.That(t.getEpochYear(), Is.EqualTo(17));
            Assert.That(t.getFirstMeanMotion(), Is.EqualTo(.00001083));
            Assert.That(t.getInclination(), Is.EqualTo(97.4499));
            Assert.That(t.getMeanAnomoly(), Is.EqualTo(116.1066));
            Assert.That(t.getMeanMotion(), Is.EqualTo(15.20524655));
            Assert.That(t.getName(), Is.EqualTo("1736Vvv"));
            Assert.That(t.getNoradID(), Is.EqualTo("42784"));
            Assert.That(t.getPerigee(), Is.EqualTo(243.9018));
            Assert.That(t.getPice(), Is.EqualTo("Vvv"));
            Assert.That(t.getRelevationNumber(), Is.EqualTo(20));
            Assert.That(t.getRightAscendingNode(), Is.EqualTo(235.6602));
            Assert.That(t.getSatNumber(), Is.EqualTo(42784));
            Assert.That(t.getSecondMeanMotion(), Is.EqualTo(0));
            Assert.That(t.getSetNumber(), Is.EqualTo(999));
            Assert.That(t.getStartNr(), Is.EqualTo(36));
            Assert.That(t.getStartYear(), Is.EqualTo(17));

            t = ParserTLE.parseTle(line1, line2, "Pegasus");

            Assert.That(t.isValidData, Is.True);
            Assert.That(t.getClassification(), Is.EqualTo(0));
            Assert.That(t.getDrag(), Is.EqualTo(0.000052625));
            Assert.That(t.getEccentriciy(), Is.EqualTo(0.0011188));
            Assert.That(t.getEphemeris(), Is.EqualTo(0));
            Assert.That(t.getEpochDay(), Is.EqualTo(175.91623346));
            Assert.That(t.getEpochYear(), Is.EqualTo(17));
            Assert.That(t.getFirstMeanMotion(), Is.EqualTo(.00001083));
            Assert.That(t.getInclination(), Is.EqualTo(97.4499));
            Assert.That(t.getMeanAnomoly(), Is.EqualTo(116.1066));
            Assert.That(t.getMeanMotion(), Is.EqualTo(15.20524655));
            Assert.That(t.getName(), Is.EqualTo("Pegasus"));
            Assert.That(t.getNoradID(), Is.EqualTo("42784"));
            Assert.That(t.getPerigee(), Is.EqualTo(243.9018));
            Assert.That(t.getPice(), Is.EqualTo("Vvv"));
            Assert.That(t.getRelevationNumber(), Is.EqualTo(20));
            Assert.That(t.getRightAscendingNode(), Is.EqualTo(235.6602));
            Assert.That(t.getSatNumber(), Is.EqualTo(42784));
            Assert.That(t.getSecondMeanMotion(), Is.EqualTo(0));
            Assert.That(t.getSetNumber(), Is.EqualTo(999));
            Assert.That(t.getStartNr(), Is.EqualTo(36));
            Assert.That(t.getStartYear(), Is.EqualTo(17));
        }
        // //////////////////////////////////////////////////////////////////////////
        //
        // Routine to output position and velocity information of satellite
        // in orbit described by TLE information.
        //
        static void PrintPosVel(Tle tle)
        {
            const int Step = 360;

            Satellite  sat    = new Satellite(tle);
            List <Eci> coords = new List <Eci>();

            // 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".
                Eci eci = sat.PositionEci(mpe);

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

            // Print TLE data
            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 list, above, printing the ECI position information
            // as we go.
            for (int i = 0; i < coords.Count; i++)
            {
                Eci e = coords[i] as Eci;

                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
            // list again, but this time print the velocity information.
            for (int i = 0; i < coords.Count; i++)
            {
                Eci e = coords[i] as Eci;

                Console.Write("{0,24:f8} {1,16:f8} {2,16:f8}\n",
                              e.Velocity.X,
                              e.Velocity.Y,
                              e.Velocity.Z);
            }
        }
Example #17
0
 public Satellite(long id, string name, string line1, string line2)
 {
     ID       = id;
     Name     = name;
     TleLine1 = line1;
     TleLine2 = line2;
     Tle      = ParserTLE.parseTle(
         line1,
         line2,
         name);
 }
Example #18
0
        private void ProcessTLE_Click(object sender, RoutedEventArgs e)
        {
            var lines = TLEedit.Text.Split(new char[] { '\n', '\r' }, 3);

            if (lines.Count() < 3)
            {
                return;
            }
            var nm = lines[0].TrimEnd(new char[] { ' ' });

            tle = new Tle(nm, lines[1], lines[2]);
        }
Example #19
0
 public void testFuckShit2()
 {
     SGP4.Sgp4 sgp = new SGP4.Sgp4(satTleData, 0);
     sgp.runSgp4Cal(startTime, stopTime, tick / 60.0);
     results = new List <Sgp4Data>(sgp.getRestults());
     sgp.clear();
     sgp           = null;
     satTleData    = null;
     startTime     = null;
     stopTime      = null;
     dataVectorRes = null;
 }
Example #20
0
 public Satellite(Tle tle, string name = "")
 {
     Orbit   = new Orbit(tle);
     NoradID = int.Parse(tle.NoradNumber.Trim());
     if (name == "")
     {
         Name = tle.Name;
     }
     else
     {
         Name = name;
     }
 }
Example #21
0
 public void TleParseFromLinesWithChecksumErrorShouldFail(string line1, string line2)
 {
     try
     {
         Tle t = ParserTLE.parseTle(line1, line2);
         Assert.Fail("This should raise an exception!");
     }
     catch (Exception ex)
     {
         Assert.That(ex, Is.TypeOf <InvalidDataException>());
         Assert.That(ex.Message, Contains.Substring("checksum error"));
     }
 }
Example #22
0
        private List <Satellite> GetSatellites(bool Cache = true)
        {
            var    CurDir          = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string predicateValues = "/class/tle_latest/ORDINAL/1/EPOCH/%3Enow-30/orderby/APOGEE%20desc/format/3le/distinct/true";
            string request         = uriBase + requestController + requestAction + predicateValues;

            using (var client = new WebClientEx())
            {
                if (Auth(client))
                {
                    var response4  = client.DownloadData(request);
                    var stringData = System.Text.Encoding.Default.GetString(response4).Split('\n');
                    using (var sw = new StreamWriter(CurDir + "/lastrequest.dat"))
                    {
                        sw.Write(System.Text.Encoding.Default.GetString(response4));
                    }
                    var sats = new List <Satellite>();

                    using (var sw = new StreamWriter(CurDir + "/satdata.dat"))
                    {
                        for (Int32 i = 0; i < stringData.Length - 1; i += 3)
                        {
                            try
                            {
                                if (stringData[i].Contains("DEB"))
                                {
                                    continue;
                                }
                                //if (sats.Count > c_maxNumber)
                                //	break;
                                Tle tle = new Tle(stringData[i], stringData[i + 1], stringData[i + 2]);
                                sw.WriteLine(stringData[i]);
                                sw.WriteLine(stringData[i + 1]);
                                sw.WriteLine(stringData[i + 2]);
                                Satellite sat = new Satellite(tle);
                                sats.Add(sat);
                                OnProgress(new ProgressEventArgs(i, stringData.Length - 1));
                            }
                            catch { }
                        }
                    }
                    SaveSats(sats);
                    return(sats);
                }
                else
                {
                    throw new NoAuthException();
                }
            }
        }
Example #23
0
        public void TestSatContact()
        {
            Tle tleISS = ParserTLE.parseTle(
                "1 25544U 98067A   19356.46068278  .00000035  00000-0  86431-5 0  9990",
                "2 25544  51.6420 147.9381 0007793  61.6458  55.7201 15.50124783204461",
                "ISS 1");

            Coordinate position  = new Coordinate(35, 18, 0);
            EpochTime  startTime = new EpochTime(0, 0, 0, 2020, 1, 6);

            List <Pass> passes = SatFunctions.CalculatePasses(position, tleISS, startTime, 1, 1);

            Assert.AreEqual(8, passes.Count);
        }
Example #24
0
    private SataliteGameObject InstantiateSatalite(Tle satalite)
    {
        var gObject = Instantiate(this.BaseSatalite);

        gObject.transform.SetParent(BaseSatalite.transform.parent, false);
        gObject.SetActive(true);

        var script = gObject.GetComponent <SataliteBehavior>();

        script.TLeData = satalite;

        return(new SataliteGameObject {
            GameObject = gObject,
            Script = script
        });
    }
Example #25
0
        private void addTLE_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim().Length == 0 || textBox2.Text.Trim().Length == 0 || textBox3.Text.Trim().Length == 0)
            {
                MessageBox.Show("Please make sure you filled in ever box.");
                return;
            }
            List <Tle> list  = new List <Tle>();
            Tle        input = new Tle(textBox1.Text, textBox2.Text, textBox3.Text);

            list.Add(input);
            var mainWindow = Application.OpenForms.OfType <Window>().Single();

            mainWindow.updateSatList(list);
            this.Close();
        }
Example #26
0
        public void TleParseFromCorruptLinesShouldFail()
        {
            string line1 = "1 42784U 17036V   17175.91623346  .00001083  00000 - 0  52625 - 4 0  9993";
            string line2 = "2 42784  97.4499 235.6602 0011188 243.9018 116.1066 15.20524655   207";

            try
            {
                Tle t = ParserTLE.parseTle(line1, line2);
                Assert.Fail("This should raise an exception!");
            }
            catch (Exception ex)
            {
                Assert.That(ex, Is.TypeOf <InvalidDataException>());
                Assert.That(ex.Message, Contains.Substring("parse error"));
            }
        }
Example #27
0
        private void lockButton_Click(object sender, EventArgs e)
        {
            if (satList.SelectedItem == null)
            {
                return;
            }
            //This could probably break depending on the sitituation TODO: FIX
            statusText.Text = "Locking onto: " + satList.SelectedItem.ToString();
            LockedOn        = true;
            foreach (Tle tle in Satellites)
            {
                if (tle.Name == satList.SelectedItem.ToString())
                {
                    Target = tle;
                    break;
                }
            }
            aimLock = false;
            manualAimToggle.CheckState = 0;

            /*
             * WolframAlpha wolfram = new WolframAlpha(WolframAppId);
             *
             * QueryResult results = wolfram.Query(Target.Name);
             * try
             * {
             *  if (results != null)
             *  {
             *      foreach (Pod pod in results.Pods)
             *      {
             *          if (pod.Title == "Wikipedia summary")
             *          {
             *              Console.WriteLine(pod.SubPods[0].Image.Alt);
             *              desc.ImageLocation = pod.SubPods[0].Image.Src;
             *          }
             *      }
             *  }
             * }
             * catch (NullReferenceException)
             * {
             *  Console.WriteLine("ERROR");
             * }
             */
            setDescription(Target.Name);
        }
Example #28
0
        private List <Satellite> GetSatellites(Double Perigee, Double Apogee)
        {
            var    CurDir          = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string predicateValues = "/class/tle_latest/ORDINAL/1/EPOCH/%3Enow-30/APOGEE/>" + Perigee.ToString() + "/PERIGEE/<" + Apogee.ToString() + "/orderby/APOGEE%20asc/format/3le/distinct/true";
            string request         = uriBase + requestController + requestAction + predicateValues;

            using (var client = new WebClientEx())
            {
                OnStatus("Соединение с базой NORAD...");
                if (Auth(client))
                {
                    OnStatus("Загрузка данных из базы...");
                    var response4  = client.DownloadData(request);
                    var stringData = System.Text.Encoding.Default.GetString(response4).Split('\n');
                    using (var sw = new StreamWriter(CurDir + "/lastrequest.dat"))
                    {
                        sw.Write(System.Text.Encoding.Default.GetString(response4));
                    }
                    OnStatus("Генерация орбитальных данных...");
                    var sats = new List <Satellite>();
                    for (Int32 i = 0; i < stringData.Length - 1; i += 3)
                    {
                        try
                        {
                            if (stringData[i].Contains("DEB"))
                            {
                                continue;
                            }
                            Tle       tle = new Tle(stringData[i], stringData[i + 1], stringData[i + 2]);
                            Satellite sat = new Satellite(tle);
                            sats.Add(sat);
                            OnProgress(new ProgressEventArgs(i, stringData.Length - 1));
                        }
                        catch { }
                    }
                    OnStatus("Загрузка данных завершена!");
                    return(sats);
                }
                else
                {
                    throw new NoAuthException();
                }
            }
        }
Example #29
0
    /*****************************************************************************
    * @function name : calECIDateAndVelocity
    * @author : Kaguya
    * @date : 2020/12/3 12:38
    * @inparam :
    * @outparam :
    * @last change :
    * @usage : 基于one_sgp4项目,计算航天器基于ECI坐标系下的位置和速度
    *****************************************************************************/
    public void calECIDateAndVelocity()
    {
        Tle       tleISS    = ParserTLE.parseTle(first, second, "ISS 1");
        DateTime  t         = new DateTime(data[0], data[1], data[2], data[3], data[4], data[5]);
        EpochTime startTime = new EpochTime(t);
        Sgp4Data  sate      = SatFunctions.getSatPositionAtTime(tleISS, startTime, Sgp4.wgsConstant.WGS_84);

        One_Sgp4.Point3d position = sate.getPositionData();
        ECI    = new double[3];
        ECI[0] = position.x;
        ECI[1] = position.y;
        ECI[2] = position.z;

        velocity    = new double[3];
        velocity[0] = sate.getVelocityData().x;
        velocity[1] = sate.getVelocityData().y;
        velocity[2] = sate.getVelocityData().z;
        velocity    = getECEF(velocity, data);
    }
Example #30
0
        public void TestSatGroundPosition(int hh, int mm, int ss, int yyyy, int MM, int dd)
        {
            Tle tleISS = ParserTLE.parseTle(
                "1 25544U 98067A   19356.46068278  .00000035  00000-0  86431-5 0  9990",
                "2 25544  51.6420 147.9381 0007793  61.6458  55.7201 15.50124783204461",
                "ISS 1");


            EpochTime testTime = new EpochTime(hh, mm, ss, yyyy, MM, dd);
            Sgp4Data  data     = SatFunctions.getSatPositionAtTime(tleISS, testTime, Sgp4.wgsConstant.WGS_84);

            Assert.IsNotNull(data);
            Coordinate ground = SatFunctions.calcSatSubPoint(testTime, data, Sgp4.wgsConstant.WGS_84);

            Assert.Greater(ground.getHeight(), 0);
            Assert.LessOrEqual(ground.getLongitude(), 180.0);
            Assert.Greater(ground.getLongitude(), -180.0);
            Assert.LessOrEqual(ground.getLatitude(), 90.0);
            Assert.Greater(ground.getLatitude(), -90.0);
        }