STK组件:根据星历拟合出双行根数

2020-08-13  本文已影响0人  奔跑伯爵

STK Components可以根据TEME坐标系下的星历拟合出双行根数,如果星历是其它坐标系下,可以转换到TEME坐标系下,再执行拟合操作。

  1. 添加对AGI.Foundation.Core.dllAGI.Foundation.Models.dll的引用
  2. 完整代码如下
using System;
using AGI.Foundation;
using AGI.Foundation.Coordinates;
using AGI.Foundation.Propagators;
using AGI.Foundation.Time;

namespace Example006
{
    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 tle0 = new TwoLineElementSet(line1 + "\n" + line2);

            // 生成卫星在TEME坐标系下的星历
            var sgp4 = new Sgp4Propagator(tle0);
            PropagatorPoint satPoint = sgp4.CreatePoint();
            DateMotionCollection<Cartesian> ephemerisInTEME = satPoint.GetEvaluator().Evaluate(start, stop, oneMinute, 1);

            // 根据星历拟合出双行根数
            // 配置拟合条件
            var configuration = new Sgp4Propagator.Sgp4EstimationInput(start);
            configuration.MaxIterations = 20;    // 最大迭代次数
            configuration.SolveForDrag = false;  // 求解阻力系数
            configuration.BStarDragValue = 0;    // 阻力系数初值

            // 执行拟合
            Sgp4Propagator.Sgp4EstimationOutput output = Sgp4Propagator.EstimateElements(ephemerisInTEME, configuration);
            // 拟合结果
            Console.WriteLine("迭代次数:{0}", output.IterationsUsed);
            Console.WriteLine("初始误差:{0}", output.InitialRootMeanSquareError);
            Console.WriteLine("最终误差:{0}", output.FinalRootMeanSquareError);

            // 补全新的双行根数的信息
            Sgp4Elements sgp4Elements = output.EstimatedElements;
            var tle = new TwoLineElementSet(sgp4Elements, tle0.Name, tle0.SatelliteNumber, tle0.Classification, tle0.InternationalDesignator, output.MeanMotionDot, output.MeanMotionDotDot, 0, 0);
            Console.WriteLine(tle.ToTleString());

            Console.ReadKey();
        }
    }
}
上一篇下一篇

猜你喜欢

热点阅读