美文网首页
STK组件:利用双行根数TLE做预报

STK组件:利用双行根数TLE做预报

作者: 奔跑伯爵 | 来源:发表于2020-08-13 22:49 被阅读0次

    一、双行根数TLE下载

    网上有一些下载最新双行根数的网站,例如:

    二、利用STK Components做预报

    1. 新建控制台项目,并添加对AGI.Foundation.Core.dllAGI.Foundation.Models.dll的引用
    2. 完整代码如下
    using System;
    using AGI.Foundation;
    using AGI.Foundation.Celestial;
    using AGI.Foundation.Coordinates;
    using AGI.Foundation.Geometry;
    using AGI.Foundation.Propagators;
    using AGI.Foundation.Time;
    
    namespace Example005
    {
        class Program
        {
            static void Main(string[] args)
            {
                string license = "....需要有效的lic....";
                Licensing.ActivateLicense(license);
    
                // 定义需预报的时间区间
                JulianDate start = new JulianDate(new DateTime(2020, 8, 13, 0, 0, 0));
                JulianDate stop = new JulianDate(new DateTime(2020, 8, 13, 0, 10, 0));
    
                // 定义1分钟间隔
                var oneMinute = new Duration(0, 60);
    
                // 给定卫星根数
                string line1 = "1 25544U 98067A   20226.06311231  .00000634  00000-0  19556-4 0  9992";
                string line2 = "2 25544  51.6462  66.9823 0001637  29.7739 108.2756 15.49160058240839";
    
                // 创建卫星的运动点
                var sgp4 = new Sgp4Propagator(new TwoLineElementSet(line1 + "\n" + line2));
                PropagatorPoint satPoint = sgp4.CreatePoint();
    
                // 直接预报TLE坐标系下的位置和速度
                // Evaluate的order参数,0阶只求位置,1阶求位置和速度,2阶求位置、速度和加速度
                DateMotionCollection<Cartesian> posList = satPoint.GetEvaluator().Evaluate(start, stop, oneMinute, 1);
                WritePosList("TLE坐标系", posList);
    
                // 获取地球
                EarthCentralBody earth = CentralBodiesFacet.GetFromContext().Earth;
    
                // 预报地固系下的位置和速度
                PointEvaluator satPointInFixed = GeometryTransformer.ObservePoint(satPoint, earth.FixedFrame);
                DateMotionCollection<Cartesian> posListInFixed = satPointInFixed.Evaluate(start, stop, oneMinute, 1);
                WritePosList("地固坐标系", posListInFixed);
    
                // 预报惯性坐标系下的位置和速度
                PointEvaluator satPointInIcrf = GeometryTransformer.ObservePoint(satPoint, earth.InternationalCelestialReferenceFrame);
                DateMotionCollection<Cartesian> posListInIcrf = satPointInIcrf.Evaluate(start, stop, oneMinute, 1);
                WritePosList("惯性坐标系", posListInIcrf);
    
                // 角度转弧度
                double d2r = Math.PI / 180;
    
                // 预报相对于测站的方位、仰角和距离
                // 先定义测站位置
                var stationPoint = new PointCartographic(earth, new Cartographic(120 * d2r, 30 * d2r, 100));
                // 定义测站坐标轴和坐标系,xyz三轴为北东下右手坐标系
                var stationAxes = new AxesNorthEastDown(earth, stationPoint);
                var stationReferenceFrame = new ReferenceFrame(stationPoint, stationAxes);
                // 在测站坐标系下观察卫星点
                PointEvaluator satPointInStation = GeometryTransformer.ObservePoint(satPoint, stationReferenceFrame);
                DateMotionCollection<Cartesian> posListInStation = satPointInStation.Evaluate(start, stop, oneMinute, 0);
                // 卫星在测站坐标系下的位置值转换为方位、仰角和斜距
                Console.WriteLine("测站坐标系");
                for (int i = 0; i < posListInStation.Count; i++)
                {
                    JulianDate time = posListInStation.Dates[i];
                    Cartesian pos = posListInStation.Values[i];
                    var aer = new AzimuthElevationRange(pos);
                    Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss}  {1,9:0.0000} {2,9:0.0000} {3,14:0.000}",
                      time.ToDateTime(), aer.Azimuth / d2r, aer.Elevation / d2r, aer.Range / 1000);
                }
    
                Console.ReadKey();
            }
    
            /// <summary>
            /// 屏幕输出时间、位置和速度
            /// </summary>
            /// <param name="posList"></param>
            static void WritePosList(string header, DateMotionCollection<Cartesian> posList)
            {
                Console.WriteLine(header);
                for (int i = 0; i < posList.Count; i++)
                {
                    JulianDate time = posList.Dates[i];
                    Cartesian pos = posList.Values[i];            // Values中存储的是位置
                    Cartesian vel = posList.FirstDerivatives[i];  // FirstDerivatives中存储的是速度
                    Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss}  {1,9:0.000}  {2,9:0.000}  {3,9:0.000}  {4,9:0.000}  {5,9:0.000}  {6,9:0.000}",
                        time.ToDateTime(), pos.X / 1000, pos.Y / 1000, pos.Z / 1000, vel.X / 1000, vel.Y / 1000, vel.Z / 1000);
                }
    
                Console.WriteLine();
            }
        }
    }
    

    相关文章

      网友评论

          本文标题:STK组件:利用双行根数TLE做预报

          本文链接:https://www.haomeiwen.com/subject/sygidktx.html