- 添加对三个dll的引用:
AGI.Foundation.Core.dll
,AGI.Foundation.Models.dll
和AGI.Foundation.Platforms.dll
- 过境预报只能输出添加的约束条件下过境的起止时间,具体的点位数据是要另外加代码计算得到
- 完整代码如下
using AGI.Foundation;
using AGI.Foundation.Access;
using AGI.Foundation.Access.Constraints;
using AGI.Foundation.Celestial;
using AGI.Foundation.Coordinates;
using AGI.Foundation.Geometry;
using AGI.Foundation.Propagators;
using AGI.Foundation.Time;
using System;
namespace Example007
{
/// <summary>
/// 过境预报
/// </summary>
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, 14, 0, 0, 0));
// 给定卫星根数
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();
// 角度转弧度
double d2r = Math.PI / 180;
// 获取地球
EarthCentralBody earth = CentralBodiesFacet.GetFromContext().Earth;
// 预报相对于测站的方位、仰角和距离
// 先定义测站位置
var stationPoint = new PointCartographic(earth, new Cartographic(120 * d2r, 30 * d2r, 100));
// 使用仰角约束
var constraint = new ElevationAngleConstraint
{
MinimumValue = Trig.DegreesToRadians(10.0),
MaximumValue = Constants.HalfPi,
ConstrainedLink = new LinkInstantaneous(satPoint, stationPoint),
ConstrainedLinkEnd = LinkRole.Receiver
};
AccessQueryResult result = constraint.GetEvaluator().Evaluate(new TimeInterval(start, stop));
foreach(var ti in result.SatisfactionIntervals)
{
Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss.fff} {1:yyyy-MM-dd HH:mm:ss.fff}",
ti.Start.ToDateTime(), ti.Stop.ToDateTime());
}
Console.ReadKey();
}
}
}