示例#1
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]);

        }
示例#2
0
        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="tle">TLE data.</param>
        /// <param name="name">Optional satellite name.</param>
        public Satellite(Tle tle, string name = "")
      {
         Orbit = new Orbit(tle);

         if (name == "")
         {
            Name = Orbit.SatName;
         }
         else
         {
            Name = name;
         }
      }
示例#3
0
        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="tle">TLE data.</param>
        /// <param name="name">Optional satellite name.</param>
        public Satellite(Tle tle, string name = "")
        {
            Orbit = new Orbit(tle);

            if (name == "")
            {
                Name = Orbit.SatName;
            }
            else
            {
                Name = name;
            }
        }
示例#4
0
        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="tle">Two-line element orbital parameters.</param>
        public Orbit(Tle tle)
        {
            Tle     = tle;
             Epoch = Tle.EpochJulian;

             m_Inclination   = GetRad(Tle.Field.Inclination);
             m_Eccentricity  = Tle.GetField(Tle.Field.Eccentricity);
             m_RAAN          = GetRad(Tle.Field.Raan);
             m_ArgPerigee    = GetRad(Tle.Field.ArgPerigee);
             m_BStar         = Tle.GetField(Tle.Field.BStarDrag);
             m_Drag          = Tle.GetField(Tle.Field.MeanMotionDt);
             m_MeanAnomaly   = GetRad(Tle.Field.MeanAnomaly);
             m_TleMeanMotion = Tle.GetField(Tle.Field.MeanMotion);

             // Recover the original mean motion and semimajor axis from the
             // input elements.
             double mm     = TleMeanMotion;
             double rpmin  = mm * Globals.TwoPi / Globals.MinPerDay;   // rads per minute

             double a1     = Math.Pow(Globals.Xke / rpmin, 2.0 / 3.0);
             double e      = Eccentricity;
             double i      = Inclination;
             double temp   = (1.5 * Globals.Ck2 * (3.0 * Globals.Sqr(Math.Cos(i)) - 1.0) /
                         Math.Pow(1.0 - e * e, 1.5));
             double delta1 = temp / (a1 * a1);
             double a0     = a1 *
                        (1.0 - delta1 *
                        ((1.0 / 3.0) + delta1 *
                        (1.0 + 134.0 / 81.0 * delta1)));

             double delta0 = temp / (a0 * a0);

             m_rmMeanMotionRec    = rpmin / (1.0 + delta0);
             m_aeAxisSemiMajorRec = a0 / (1.0 - delta0);
             m_aeAxisSemiMinorRec = m_aeAxisSemiMajorRec * Math.Sqrt(1.0 - (e * e));
             m_kmPerigeeRec       = Globals.Xkmper * (m_aeAxisSemiMajorRec * (1.0 - e) - Globals.Ae);
             m_kmApogeeRec        = Globals.Xkmper * (m_aeAxisSemiMajorRec * (1.0 + e) - Globals.Ae);

             if (Period.TotalMinutes >= 225.0)
             {
            // SDP4 - period >= 225 minutes.
            NoradModel = new NoradSDP4(this);
             }
             else
             {
            // SGP4 - period < 225 minutes
            NoradModel = new NoradSGP4(this);
             }
        }
示例#5
0
        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="tle">Two-line element orbital parameters.</param>
        public Orbit(Tle tle)
        {
            Tle   = tle;
            Epoch = Tle.EpochJulian;

            m_Inclination   = GetRad(Tle.Field.Inclination);
            m_Eccentricity  = Tle.GetField(Tle.Field.Eccentricity);
            m_RAAN          = GetRad(Tle.Field.Raan);
            m_ArgPerigee    = GetRad(Tle.Field.ArgPerigee);
            m_BStar         = Tle.GetField(Tle.Field.BStarDrag);
            m_Drag          = Tle.GetField(Tle.Field.MeanMotionDt);
            m_MeanAnomaly   = GetRad(Tle.Field.MeanAnomaly);
            m_TleMeanMotion = Tle.GetField(Tle.Field.MeanMotion);

            // Recover the original mean motion and semimajor axis from the
            // input elements.
            double mm    = TleMeanMotion;
            double rpmin = mm * Globals.TwoPi / Globals.MinPerDay; // rads per minute

            double a1   = Math.Pow(Globals.Xke / rpmin, 2.0 / 3.0);
            double e    = Eccentricity;
            double i    = Inclination;
            double temp = (1.5 * Globals.Ck2 * (3.0 * Globals.Sqr(Math.Cos(i)) - 1.0) /
                           Math.Pow(1.0 - e * e, 1.5));
            double delta1 = temp / (a1 * a1);
            double a0     = a1 *
                            (1.0 - delta1 *
                             ((1.0 / 3.0) + delta1 *
                              (1.0 + 134.0 / 81.0 * delta1)));

            double delta0 = temp / (a0 * a0);

            m_rmMeanMotionRec    = rpmin / (1.0 + delta0);
            m_aeAxisSemiMajorRec = a0 / (1.0 - delta0);
            m_aeAxisSemiMinorRec = m_aeAxisSemiMajorRec * Math.Sqrt(1.0 - (e * e));
            m_kmPerigeeRec       = Globals.Xkmper * (m_aeAxisSemiMajorRec * (1.0 - e) - Globals.Ae);
            m_kmApogeeRec        = Globals.Xkmper * (m_aeAxisSemiMajorRec * (1.0 + e) - Globals.Ae);

            if (Period.TotalMinutes >= 225.0)
            {
                // SDP4 - period >= 225 minutes.
                NoradModel = new NoradSDP4(this);
            }
            else
            {
                // SGP4 - period < 225 minutes
                NoradModel = new NoradSGP4(this);
            }
        }
示例#6
0
        public static void Main()
        {
            string str1 = "ISS (ZARYA)             ";
            string str2 = "1 25544U 98067A   13222.08683053  .00004563  00000-0  87202-4 0  3628";
            string str3 = "2 25544  51.6485 201.2720 0004128 298.2475 180.8024 15.50224716843064";
            Tle tle1 = new Tle(str1, str2, str3);
            Site siteEquator = new Site(52.1259155, -0.219355, 0);
            Orbit orbit = new Orbit(tle1);
            DateTime now = DateTime.Now;
            Track t = new Track();
            t.GetPasses(siteEquator, orbit, DateTime.Now);

            while (true)
            {
                EciTime eciSDP4 = orbit.GetPosition(DateTime.Now);
                Topo topoLook = siteEquator.GetLookAngle(eciSDP4);
                CoordGeo g = eciSDP4.ToGeo();
                Debug.Print(g.Latitude.ToString() + " " + g.Longitude.ToString() + " " + g.Altitude.ToString());
                Thread.Sleep(1000);
            }
        }
示例#7
0
        // ///////////////////////////////////////////////////////////////////
        public Orbit(Tle tle)
        {
            m_tle     = tle;
            m_jdEpoch = m_tle.EpochJulian;

            // Recover the original mean motion and semimajor axis from the
            // input elements.
            double mm    = mnMotion;
            double rpmin = mm * Globals.TWOPI / Globals.MIN_PER_DAY; // rads per minute

            double a1   = Math.Pow(Globals.XKE / rpmin, Globals.TWOTHRD);
            double e    = Eccentricity;
            double i    = Inclination;
            double temp = (1.5 * Globals.CK2 * (3.0 * Globals.Sqr(Math.Cos(i)) - 1.0) /
                           Math.Pow(1.0 - e * e, 1.5));
            double delta1 = temp / (a1 * a1);
            double a0     = a1 *
                            (1.0 - delta1 *
                             ((1.0 / 3.0) + delta1 *
                              (1.0 + 134.0 / 81.0 * delta1)));

            double delta0 = temp / (a0 * a0);

            m_rmMeanMotionRec    = rpmin / (1.0 + delta0);
            m_aeAxisSemiMajorRec = a0 / (1.0 - delta0);
            m_aeAxisSemiMinorRec = m_aeAxisSemiMajorRec * Math.Sqrt(1.0 - (e * e));
            m_kmPerigeeRec       = Globals.XKMPER * (m_aeAxisSemiMajorRec * (1.0 - e) - Globals.AE);
            m_kmApogeeRec        = Globals.XKMPER * (m_aeAxisSemiMajorRec * (1.0 + e) - Globals.AE);

            if (Period.TotalMinutes >= 225.0)
            {
                // SDP4 - period >= 225 minutes.
                m_NoradModel = new NoradSDP4(this);
            }
            else
            {
                // SGP4 - period < 225 minutes
                m_NoradModel = new NoradSGP4(this);
            }
        }
示例#8
0
        void TimerTick(Timer timer)
        {
            string str1 = "ISS (ZARYA)             ";
            string str2 = "1 25544U 98067A   15352.54319571  .00014358  00000-0  21741-3 0  9990";
            string str3 = "2 25544  51.6437 244.0274 0008333 295.0996 127.4199 15.54892795976727";
            Tle tle1 = new Tle(str1, str2, str3);
            Site siteEquator = new Site(52.454935, 0.201279, 0);
            Orbit orbit = new Orbit(tle1);
            DateTime now = DateTime.Now;
            EciTime eciSDP4 = orbit.GetPosition(now);
            Topo topoLook = siteEquator.GetLookAngle(eciSDP4);

            CoordGeo coords = eciSDP4.ToGeo();

            UpdateTextBlock(RealTimeClock.GetDateTime().ToString(@"dd\/MM\/yyyy HH:mm"), "date");

            UpdateTextBlock(coords.Altitude.ToString("F2"), "satAlt");
            UpdateTextBlock(coords.Latitude.ToString("F2"), "satLat");
            UpdateTextBlock((360 - coords.Longitude).ToString("F2"), "satLon");
            UpdateTextBlock(topoLook.AzimuthDeg.ToString("F2"), "satAz");
            UpdateTextBlock(topoLook.ElevationDeg.ToString("F2"), "satEl");
        }
示例#9
0
 // ///////////////////////////////////////////////////////////////////
 protected double GetDeg(Tle.Field fld)
 {
     return(Tle.GetField(fld, Tle.Unit.Degrees));
 }
示例#10
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;
 }
示例#11
0
 // ///////////////////////////////////////////////////////////////////
 protected double GetRad(Tle.Field fld)
 {
     return(Tle.GetField(fld, Tle.Unit.Radians));
 }
示例#12
0
 // ///////////////////////////////////////////////////////////////////
 protected double GetDeg(Tle.Field fld) 
 { 
    return Tle.GetField(fld, Tle.Unit.Degrees); 
 }
示例#13
0
 // //////////////////////////////////////////////////////////////////////////
 public Tle(Tle tle) : 
    this(tle.Name, tle.Line1, tle.Line2)
 {
 }
示例#14
0
 // ///////////////////////////////////////////////////////////////////
 protected double GetRad(Tle.Field fld) 
 { 
    return Tle.GetField(fld, Tle.Unit.Radians); 
 }
示例#15
0
 /// <summary>
 /// 计算DOP值,返回可见卫星数
 /// </summary>
 /// <param name="tle"></param>
 /// <param name="time">要计算的时间</param>
 /// <param name="B">测站的,单位:度</param>
 /// <param name="L"></param>
 /// <param name="H">单位:米</param>
 /// <param name="cor_limit">截止高度角,度</param>
 /// <param name="GDOP"></param>
 /// <param name="PDOP"></param>
 /// <param name="HDOP"></param>
 /// <param name="VDOP"></param>
 /// <param name="TDOP"></param>
 /// <returns></returns>
 public static int CalcDops(Tle[] tles, DateTime time, double B, double L, double H, double cor_limit, ref double GDOP, ref double PDOP, ref double HDOP, ref double VDOP, ref double TDOP)
 {
     double x2 = 0; double y2 = 0; double z2 = 0; //测站坐标
     BLToXYZ(B / 180 * Math.PI, L / 180 * Math.PI, H, ref x2, ref y2, ref z2);
     ArrayList temp = new ArrayList();
     Site siteEquator2 = new Site(B, L, H);
     Tle tle;
     Orbit orbit;
     Eci eci;
     CoordGeo cg;
     int sum = 0;
     for (int i = 0; i < tles.Length; i++)
     {
         tle = tles[i];
         orbit = new Orbit(tle);
         eci = orbit.GetPosition(time);
         double x = eci.Position.X * 1000;
         double y = eci.Position.Y * 1000;
         double z = eci.Position.Z * 1000; //化成米
         cg = eci.ToGeo();
         CoordTopo topoLook = siteEquator2.GetLookAngle(eci);
         topoLook.Elevation = Globals.Rad2Deg(topoLook.Elevation);
         topoLook.Azimuth = Globals.Rad2Deg(topoLook.Azimuth);  //化成度
         if (topoLook.Elevation > cor_limit)
         {
             sum++;
             double d_x = x - x2;
             double d_y = y - y2;
             double d_z = z - z2;
             double r2 = Math.Sqrt(d_x * d_x + d_y * d_y + d_z * d_z);
             temp.Add(d_x / r2);
             temp.Add(d_y / r2);
             temp.Add(d_z / r2);
         }
     }
     NNMatrix Q = new NNMatrix(sum, 4);
     NNMatrix Q_x = new NNMatrix(4, 4);
     for (int j = 0; j < temp.Count; j++)
     {
         if ((j + 1) % 3 == 1)
         {
             Q.Matrix[j / 3, 0] = (double)temp[j];
         }
         else if ((j + 1) % 3 == 2)
         {
             Q.Matrix[j / 3, 1] = (double)temp[j];
         }
         else if ((j + 1) % 3 == 0)
         {
             Q.Matrix[j / 3, 2] = (double)temp[j];
         }
         Q.Matrix[j / 3, 3] = 1;
     }
     Q_x = NNMatrix.Invers(NNMatrix.Transpos(Q) * Q);
     GDOP = Math.Sqrt(Q_x.Matrix[0, 0] + Q_x.Matrix[1, 1] + Q_x.Matrix[2, 2] + Q_x.Matrix[3, 3]);
     PDOP = Math.Sqrt(Q_x.Matrix[0, 0] + Q_x.Matrix[1, 1] + Q_x.Matrix[2, 2]);
     HDOP = Math.Sqrt(Q_x.Matrix[0, 0] + Q_x.Matrix[1, 1]);
     VDOP = Math.Sqrt(Q_x.Matrix[2, 2]);
     TDOP = Math.Sqrt(Q_x.Matrix[3, 3]);
     return sum;
 }
示例#16
0
 // //////////////////////////////////////////////////////////////////////////
 public Tle(Tle tle) :
     this(tle.Name, tle.Line1, tle.Line2)
 {
 }
示例#17
0
 // ///////////////////////////////////////////////////////////////////
 protected double GetRad(Tle.Field fld) => Tle.GetField(fld, Tle.Unit.Radians);
示例#18
0
 // ///////////////////////////////////////////////////////////////////
 protected double GetDeg(Tle.Field fld) => Tle.GetField(fld, Tle.Unit.Degrees);