计算访问
在STK中,“Access”通常指的是卫星与地面目标之间的可见性或访问机会。在STK API中,Access分析功能允许用户计算和分析特定时间段内卫星与地面目标之间的访问窗口。这些访问窗口可以用来确定卫星何时能够观测或通信目标。
一个Access能够return的信息如下:
I Return entry 1: I /Application/STK/Scenario/Scenario1/Facility/Facility1 /Application/STK/Scena rio/Scenario1/Satellite/Satellite2 6 21 Feb 2013 20:15:44.679 21 Feb 2013 20:2 4:59.376 21 Feb 2013 21:52:49.857 21 Feb 2013 22:04:53.155 21 Feb 2013 23:31:59. 231 21 Feb 2013 23:44:05.663 22 Feb 2013 01:11:36.897 22 Feb 2013 01:23:37.282 2 2 Feb 2013 02:50:54.118 22 Feb 2013 03:03:07.001 22 Feb 2013 04:30:18.301 22 Feb 2013 04:41:14.901 I
Return entry 2: I /Application/STK/Scenario/Scenario1/Place/Place1 /Application/STK/Scenario/Sce nario1/Facility/Facility1 NoAccesses I
Return entry 3: I /Application/STK/Scenario/Scenario1/Place/Place1 /Application/STK/Scenario/Sce nario1/Satellite/Satellite1 NoAccesses I
Return entry 4: I /Application/STK/Scenario/Scenario1/Satellite/Satellite1 /Application/STK/Sce nario/Scenario1/Facility/Facility1 3 21 Feb 2013 23:17:04.227 21 Feb 2013 23:2 3:06.747 22 Feb 2013 00:51:44.615 22 Feb 2013 00:58:44.630 22 Feb 2013 02:27:24. 003 22 Feb 2013 02:33:23.299 I Return
8.计算两个 STK 对象之间的访问(使用 IAgStkObject 接口)
facility也可以换成上面图片object中的其他目标
access = satellite.GetAccessToObject(facility)
#计算访问
access.ComputeAccess()
9.计算两个 STK 对象之间的访问(通过对象的路径来访问)
access = satellite.GetAccess('Facility/MyFacility')
#计算访问
access.ComputeAccess()
10.计算一个点 facility的访问次数 Compute an access for one point
#设置场景的开始时间和结束时间
onePtAccess = facility.CreateOnePointAccess('Satellite/MySatellite')
#设置场景的开始时间和结束时间
onePtAccess.StartTime = root.CurrentScenario.StartTime
onePtAccess.StopTime = root.CurrentScenario.StopTime
onePtAccess.StepSize = 600
onePtAccess.SummaryOption = 0 #
# Compute results
results = onePtAccess.Compute()
# Print results
for i in range(0, results.Count):
result = results.Item(i)
print('Time: %s HasAccess: %s' % (result.Time, str(result.AccessSatisfied)))
for j in range(0, result.Constraints.Count):
constraint = result.Constraints.Item(j)
print('Constraint: %s Object: %s Status: %s Value:%s' % (constraint.Constraint, constraint.ObjectPath, constraint.Status, str(constraint.Value)))
11.计算并提取访问间隔时间
# IAgStkAccess access: Access calculation
# Get and display the Computed Access Intervals
intervalCollection = access.ComputedAccessIntervalTimes
# Set the intervals to use to the Computed Access Intervals
computedIntervals = intervalCollection.ToArray(0, -1)
access.SpecifyAccessIntervals(computedIntervals)
12.将访问分析时间段配置为指定的时间。
satellite = root.GetObjectFromPath('Satellite/MySatellite')
facility = root.GetObjectFromPath('Facility/MyFacility')
# 获取卫星轨迹中海拔最小和最大的时间事件
timeOfAltMin = satellite.Vgt.Events.Item('GroundTrajectory.Detic.LLA.Altitude.TimeOfMin')
timeOfAltMax = satellite.Vgt.Events.Item('GroundTrajectory.Detic.LLA.Altitude.TimeOfMax')
#获取卫星和地面设施之间的访问对象并设置访问时间周期
access = satellite.GetAccessToObject(facility)
access.AccessTimePeriod = 2
accessTimePeriod = access.AccessTimePeriodData
#设置访问时间间隔的状态
accessTimePeriod.AccessInterval.State = 2
#设置访问时间间隔的开始和结束时间
accessStartEpoch = accessTimePeriod.AccessInterval.GetStartEpoch()
accessStartEpoch.SetImplicitTime(timeOfAltMin)
accessTimePeriod.AccessInterval.SetStartEpoch(accessStartEpoch)
accessStopEpoch = accessTimePeriod.AccessInterval.GetStopEpoch()
accessStopEpoch.SetImplicitTime(timeOfAltMax)
accessTimePeriod.AccessInterval.SetStopEpoch(accessStopEpoch)
13.获取对象访问限制的句柄
accessConstraints = satellite.AccessConstraints
- 获取访问对象的数量:
object1是第一个访问对象的第一个元素,表示访问的第一个对象,例如“Satellite/MySatellite”。
object2是第一个访问对象的第二个元素,表示访问的第二个对象,例如“Facility/MyFacility”。
computed是第一个访问对象的第三个元素,表示该访问是否已经计算完成,值为布尔类型
scenario = root.CurrentScenario
accesses = scenario.GetExistingAccesses()
#获取访问对象的数量
size = len(accesses)
#提取第一个访问对象的信息
object1 = accesses[0][0] # "Satellite/MySatellite"
object2 = accesses[0][1] # "Facility/MyFacility"
computed = accesses[0][2] # True or False
access = scenario.GetAccessBetweenObjectsByPath(object1, object2)