创建一个卫星(在当前场景的中心体上)

root.ExecuteCommand('New / */Satellite MySatellite');

将卫星的propagator设置为J4,并指定笛卡尔的位置

root.ExecuteCommand('SetUnits / km');%Default Connect Units are meters
root.ExecuteCommand('SetState */Satellite/MySatellite Cartesian J4Perturbation "UseAnalysisStartTime" "UseAnalysisStopTime" 60 ICRF "UseAnalysisStartTime" 6678.14 0 0 0 6.78953 3.68641');

设置卫星的初始状态并进行传播

root.ExecuteCommand('SetUnits / km');%Default Connect Units are meters
root.ExecuteCommand('SetState */Satellite/MySatellite Classical TwoBody "UseAnalysisStartTime" "UseAnalysisStopTime" 60 ICRF "UseAnalysisStartTime" 6678.14 0 28 180 0 180');

将卫星传播器设置为SGP4并进行传播

root.ExecuteCommand('SetState */Satellite/MySatellite SGP4 "UseAnalysisStartTime" "UseAnalysisStopTime" 60 25544 TLESource Automatic Source AGIServer UseTLE All SwitchMethod Epoch'); %25544 is the International Space Station

将卫星传播器设置为HPOP并设置力模型属性

root.ExecuteCommand('SetUnits / km');%Default Connect Units are meters
root.ExecuteCommand('SetState */Satellite/MySatellite Cartesian HPOP "UseAnalysisStartTime" "UseAnalysisStopTime" 60 Fixed "UseAnalysisStartTime" 6406.92 -1787.59 -506.422 2.10185 6.48871 3.64041');
root.ExecuteCommand('HPOP */Satellite/MySatellite Force Gravity "C:/Program Files/AGI/STK 12/STKData/CentralBodies/Earth/WGS84.grv" 21 21');
root.ExecuteCommand('HPOP */Satellite/MySatellite Drag On 0.01 0.01 "Jacchia 1960"');
root.ExecuteCommand('HPOP */Satellite/MySatellite Force SRP Off');
root.ExecuteCommand('HPOP */Satellite/MySatellite Integrator IntegMethod RKF78 StepControl RelativeError 1.0e-13 MinStepSize 0.1 MaxStepSize 30 InterpMethod LaGrange 7');

将卫星传播器设置为SPICE并进行传播

root.ExecuteCommand('SetState */Satellite/MySatellite SPICE File "C:/Program Files/AGI/STK 12/STKData/Spice/planets.bsp" BodyID 4 TimePeriod UseScenarioInterval');

将星历文件导出到场景文件夹中

scenPath = root.ExecuteCommand('GetDirectory / Scenario').Item(0);
root.ExecuteCommand(['ExportDataFile */Satellite/MySatellite Ephemeris "' scenPath '\MySatellite.e" Type STK CoordSys J2000 CentralBody Earth InterpBoundaries Include']);

应用1

uiap = actxserver('STK11.application');
root = uiap.Personality2;
root.NewScenario('MyScenario');
root.ExecuteCommand('New / */Satellite MySatellite');
root.ExecuteCommand('SetUnits / km');%Default Connect Units are meters
root.ExecuteCommand('SetState */Satellite/MySatellite Classical TwoBody "UseAnalysisStartTime" "UseAnalysisStopTime" 60 ICRF "UseAnalysisStartTime" 6678.14 0 28 180 0 180');
scenPath = root.ExecuteCommand('GetDirectory / Scenario').Item(0);
root.ExecuteCommand(['ExportDataFile */Satellite/MySatellite Ephemeris "' scenPath '\MySatellite.e" Type STK CoordSys J2000 CentralBody Earth InterpBoundaries Include']);

命令行输入:

cd(scenPath);
open MySatellite.e

即可得到星历文件,如图: 
设置卫星姿态基本旋转

root.ExecuteCommand('SetAttitude */Satellite/MySatellite Profile Spinning Inertial Axis 0 1 0 Body Axis 0 0 1 6 0 "UseAnalysisStartTime"');

设置卫星的外部姿态

root.ExecuteCommand('SetAttitude */Satellite/MySatellite File Filename "C:/Program Files/AGI/STK 11/Help/stktraining/text/AttitudeTimeEulerAngles_Example.a"');

应用2

uiap = actxserver('STK11.application');
root = uiap.Personality2;
root.NewScenario('MyScenario');
root.ExecuteCommand('New / */Satellite MySatellite');
root.ExecuteCommand('SetUnits / km');%Default Connect Units are meters
root.ExecuteCommand('SetState */Satellite/MySatellite Classical TwoBody "UseAnalysisStartTime" "UseAnalysisStopTime" 60 ICRF "UseAnalysisStartTime" 6678.14 0 28 180 0 180');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Profile Spinning Inertial Axis 0 1 0 Body Axis 0 0 1 6 0 "UseAnalysisStartTime"');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite File Filename "C:/Program Files/AGI/STK 11/Help/stktraining/text/AttitudeTimeEulerAngles_Example.a"');

在stk的卫星三维视图中确实可以看到卫星姿态变化

注意:博主在测试官方例子的时候发现 root.ExecuteCommand('SetAttitude */Satellite/MySatellite File Filename "C:/Program Files/AGI/STK 11/Help/stktraining/text/AttitudeTimeEulerAngles_Example.a"');其中官方的代码与我电脑中AttitudeTimeEulerAngles_Example.a所在的路径有出入,如果不更改会出现调用错误

设置卫星姿态目标

root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target On');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Clear');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Add AreaTarget/MyAreaTarget Times UseAccess On');

应用3

uiap = actxserver('STK11.application');
root = uiap.Personality2;
root.NewScenario('MyScenario');
root.ExecuteCommand('New / */AreaTarget MyAreaTarget');
root.ExecuteCommand('SetBoundary */AreaTarget/MyAreaTarget Pattern LatLon 3 0 -75 20 -60 0 0');
root.ExecuteCommand('New / */Satellite MySatellite');
root.ExecuteCommand('SetUnits / km');%Default Connect Units are meters
root.ExecuteCommand('SetState */Satellite/MySatellite Classical TwoBody "UseAnalysisStartTime" "UseAnalysisStopTime" 60 ICRF "UseAnalysisStartTime" 6678.14 0 28 180 0 180');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target On');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Clear');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Add AreaTarget/MyAreaTarget Times UseAccess On');

可实现卫星扫描到区域目标都会改变朝向

设置目标回转

root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target On');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Clear');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Add AreaTarget/MyAreaTarget Times UseAccess On');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Slew Mode Constrained MaxSlewTime 20 SlewTimingBetweenTgts Optimal');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Slew Mode Constrained RateMagnitude 10 RateAxisX On RateAxisY On RateAxisZ On AccelMagnitude 10 AccelAxisX On AccelAxisY On AccelAxisZ On');
root.ExecuteCommand('SetAttitude */Satellite/MySatellite Target Slew Mode Constrained RateAxisX 5 RateAxisY 5 RateAxisZ 5 AccelAxisX 5 AccelAxisY 5 AccelAxisZ 5');

设置卫星模型的指向

root.ExecuteCommand('VO */Satellite/MySatellite ModelPointing "Solar_PanelsNode" Target Sun');

将卫星传播器设置为Astrogator,并清除片段

root.ExecuteCommand('Astrogator */Satellite/MySatellite SetProp');

确定MCS中目前有哪些分段

ASTGSegments = root.ExecuteCommand('Astrogator_RM */Satellite/MySatellite GetValue MainSequence.SegmentList');

删除所有的段

for j = 0:ASTGSegments.Count - 2
Segment = strread(ASTGSegments.Item(j), '%s');
root.ExecuteCommand(['Astrogator */Satellite/MySatellite DeleteSegment ' Segment{1}]);
end

在MCS中插入一个初始状态段并进行配置

root.ExecuteCommand('Astrogator */Satellite/MySatellite InsertSegment - Initial_State'); root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Initial_State.ComponentName Inner_Orbit'); %change name of the segment
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Inner_Orbit.InitialState.Epoch 0 EpSec'); %set epoch
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Inner_Orbit.InitialState.Keplerian.ElementType Osculating');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Inner_Orbit.InitialState.Keplerian.PeriapsisRadSize 6700 km'); %default units are m
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Inner_Orbit.InitialState.Keplerian.w 0');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Inner_Orbit.InitialState.Keplerian.ecc 0');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Inner_Orbit.InitialState.Keplerian.inc 0');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Inner_Orbit.InitialState.Keplerian.RAAN 0');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Inner_Orbit.InitialState.Keplerian.TA 0');

在MCS中插入一个传播段,并进行配置

root.ExecuteCommand('Astrogator */Satellite/MySatellite InsertSegment - Propagate');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Propagate.ComponentName Transfer_Ellipse'); %change name of the segment
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Transfer_Ellipse.Propagator "Earth Point Mass"');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Transfer_Ellipse.StoppingConditions Duration');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Transfer_Ellipse.StoppingConditions.Duration.TripValue 7200 Sec');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Transfer_Ellipse.SegmentColor 16711680'); %set segment color to blue

在MCS中插入一个传播状态段,并添加/删除停止条件

root.ExecuteCommand('Astrogator */Satellite/MySatellite InsertSegment - Propagate');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Propagate.ComponentName Propagate2'); %change name of the segment
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Propagate2.StoppingConditions Apoapsis'); %overwrites any stopping conditions already there, unless specified

在MCS中插入一个目标序列段,并进行配置

root.ExecuteCommand('Astrogator */Satellite/MySatellite InsertSegment - Target_Sequence');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Target_Sequence.ComponentName Start_Transfer'); %change name of the segment
root.ExecuteCommand('Astrogator */Satellite/MySatellite InsertSegment MainSequence.SegmentList.Start_Transfer.SegmentList.- Maneuver');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Start_Transfer.SegmentList.Maneuver.ComponentName DV1');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Start_Transfer.SegmentList.DV1.MnvrType Impulsive');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Start_Transfer.SegmentList.DV1.AttitudeControl Thrust Vector');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Start_Transfer.SegmentList.DV1.ThrustAxes "Satellite VNC(Earth)"');
root.ExecuteCommand('Astrogator */Satellite/MySatellite AddMCSSegmentControl MainSequence.SegmentList.Start_Transfer.SegmentList.DV1 ImpulsiveMnvr.Cartesian.X');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Start_Transfer.SegmentList.DV1.Results "Radius Of Apoapsis"');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetMCSControlValue MainSequence.SegmentList.Start_Transfer.Profiles.Differential_Corrector DV1 ImpulsiveMnvr.Cartesian.X Active true');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetMCSControlValue MainSequence.SegmentList.Start_Transfer.Profiles.Differential_Corrector DV1 ImpulsiveMnvr.Cartesian.X MaxStep 0.3 m/sec');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetMCSConstraintValue MainSequence.SegmentList.Start_Transfer.Profiles.Differential_Corrector DV1 "Radius Of Apoapsis" Active true');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetMCSConstraintValue MainSequence.SegmentList.Start_Transfer.Profiles.Differential_Corrector DV1 "Radius Of Apoapsis" Desired 42238 km');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetMCSConstraintValue MainSequence.SegmentList.Start_Transfer.Profiles.Differential_Corrector DV1 "Radius Of Apoapsis" Tolerance 0.1 km');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Start_Transfer.Profiles.Differential_Corrector.MaxIterations 50');
root.ExecuteCommand('Astrogator */Satellite/MySatellite SetValue MainSequence.SegmentList.Start_Transfer.Action Run active profiles');
root.ExecuteCommand('Astrogator */Satellite/MySatellite RunMCS');

运行Astrogator MCS

root.ExecuteCommand('Astrogator */Satellite/MySatellite RunMCS');

STKMATLAB connect(四)卫星相关推荐

  1. python socket connect 阻塞_python 网络编程(socketserver,阻塞,其他方法)

    重点回顾: (重点)粘包 : 就是因为接收端不知道如何接收数据,造成接收数据的混乱的问题 只发生在tcp协议上. 因为tcp协议的特点是面向数据流形式的传输 粘包的发生主要是因为tcp协议有两个机制: ...

  2. 国有大型企业数据级同城异地灾难备份案例

    随着网络和信息技术的进步,企业在运营过程中对ERP系统的核心数据越来越依赖.所谓"三分技术.七分管理.十二分数据"充分说明了数据在信息化系统中的地位和作用.然而,各种各样的灾难就像 ...

  3. Qt / Moc 和信号 - 槽解析

    目录 一. MOC 二. moc_test.cpp 分析 三. connect 四. activate 五. 总结 版本 Qt5.12.3 moc_test.cpp 位于可执行文件目录下,其余源代码都 ...

  4. Prepare for Mac App Store Submission--为提交到Mac 应用商店做准备

    返回 Mac App Store Prepare for Mac App Store Submission 提交到Mac 应用商店之前的准备 Most of your time is spent on ...

  5. matlab拉格朗日曲线_数学中高耸的金字塔——拉格朗日

    对于十八世纪的数学界而言,欧拉无疑是最伟大的人物,而除去欧拉之外,最响亮的名字无疑是拉格朗日.作为法国数学著名的"三L"之首(其余二人为拉普拉斯和勒让德),拉格朗日为法国数学走向辉 ...

  6. pythontcp服务器如何关闭阻塞_python 网络编程(socketserver,阻塞,其他方法)

    重点回顾: (重点)粘包 : 就是因为接收端不知道如何接收数据,造成接收数据的混乱的问题 只发生在tcp协议上. 因为tcp协议的特点是面向数据流形式的传输 粘包的发生主要是因为tcp协议有两个机制: ...

  7. 分析获取地震台网地震数据

    文章目录 前言 一.中国地震台网CHN 二.美国地震台网USA 三.欧洲地震台网EUR 四.相关工具类 前言 中国地震台数据主要观测的是国内的地震,少量国外等级较高地震,访问太过频繁会被封IP 美国地 ...

  8. 北斗 定位开发实验箱平台

    1 概 述 本实验开发平台适用于通信.电子.信息.测量.自动控制.导航.遥控遥测.环境监测.物联网等专业本科生.研究生等应用系统的工程技术和维护人员培训使用,是高等院校和科研院所全球星基导航和组合导航 ...

  9. gps卫星位置计算程序matlab_卫星空间大地测量中GPS周跳探测的四种方法

    有哪些习惯值得坚持LESS IS MORE,SIMPLER IS BETTER THAN MORE 今天小编给大家科普一下GPS信号处理相关的方法,主要是针对卫星空间大地测量相关的信号异常时常用的四种 ...

最新文章

  1. 关于《重启人工智能》11条建议的思考
  2. 如何使用 Druid 和 Kafka 构造 Kappa 架构完成流量分析
  3. mysql for Mac 下创建数据表中文显示为?的解决方法
  4. tcp/ip 协议栈Linux内核源码分析15 udp套接字接收流程二
  5. C++的深拷贝与浅拷贝
  6. web.xml 文件中的配置节的加载顺序
  7. deploy.php
  8. 前端学习(1778):前端调试之cookie原理和查看
  9. Nginx主配置文件nginx.conf中文详解
  10. DataTable中Compute计算函数
  11. oracle日志重建,在线重建redo log日志组
  12. MapReduce运行流程分析
  13. 多路复用输入/输出 ---- select
  14. DDD 实战 (3):整体工作框架和全局需求分析
  15. 用python求3的阶乘_Python 阶乘实例 - Python 3 基础教程
  16. 攻防世界web练习5
  17. [渝粤教育] 西南科技大学 外国文学 在线考试复习资料
  18. Mac设置顶部菜单栏技巧?
  19. 独享还是共享,你选择哪一种锁?(独享锁/共享锁)
  20. 康奈尔大学计算机生物学是,康奈尔大学计算生物学难进吗?

热门文章

  1. Delphi Sender对象的使用
  2. ios 开发资源网 (from eagel)
  3. centos安装unrar并使用
  4. 如何正确学习和使用设计模式
  5. eclipse 的RSE插件不错
  6. linux 注释批处理,Linux_批处理 正则表达式(findstr) 整理,语法 findstr [/b] [/e] [/l] [/r] [/s] - phpStudy...
  7. Luogu P4147 玉蟾宫
  8. 多因子策略-APT模型
  9. 3种好用的可视化图表工具分享,快进来看!
  10. QQ Scheme跳转接口