Matlab与STK连接函数库最新整理.docx
《Matlab与STK连接函数库最新整理.docx》由会员分享,可在线阅读,更多相关《Matlab与STK连接函数库最新整理.docx(95页珍藏版)》请在冰豆网上搜索。
Matlab与STK连接函数库最新整理
Matlab与STK连接函数库
整理者:
龚德仁
2008年10月7日
一、Matlab/Simulink、STK联合仿真的优势
STK/MATLAB,SIMULINKSTK与Matlab联合实现可视化仿真集成,该方案可以适用于航空航天、航海、作战模拟、电子对抗、卫星导航定位、遥感遥测、卫星通信等各个可视化仿真集成案例之中。
STK/MATLAB接口为STK和MATLAB提供了双向通讯功能,在MATLAB工作区通过Connect模块以TCP/IP协议打开STK端口。
利用超过150个MATLAB命令增强STK的轨道、弹道、轨迹的分析能力,MexConnect还提供在MATLAB命令行直接使用任意STK/Connect命令的功能。
MexConnect工具可以建立各种不同级别的STK对象,进行操作并生成报告。
所有STK的数据,包括动态位置、速度和姿态数据,可以返回到MATLAB工作空间,用于数学分析。
宇航工具箱让MATLAB用户可以输出多重坐标系,以及符合STK格式的星历和姿态文件用于VO模块的三维可视化。
另外此工具还可以使用STK附加模块的功能如STK/COMM(通信),STK/Coverage(覆盖)和STK/Radar(雷达)。
表1STK模块
基本模块
基本版
专业版
三维显示
高级三维显示
SatelliteToolKit(STK)
STK/Professioal(STK/PRO)
STK/VisualizationOption(STK/VO)
STK/AdvancedVO
分析模块
轨道机动
链路分析
通信分析
接近分析
覆盖分析
拦截飞行工具
导弹飞行工具
精确定轨
雷达分析
空间环境
STK/Astrogator
STK/Chains
STK/Comm
STK/ConjunctionAnalysisTools
STK/Coverage
STK/InterceptorFlightTool(IFT)
STK/MissileFlightTool(MFT)
STK/PrecisionOrbitDeterminationSystem(PODS)
STK/Radar
STK/SpaceEnvironment
综合数据
高精度数字地图
高分辨率地球影像
雷达高级环境
全球三维地形
STK/HighResolutionMaps
STK/VOEarthImagery
STK/RadarAdvancedEnvironment(RAE)
STK/Terrain
扩展与接口
连接模块
网络实时播放
MATlLAB接口
分布式仿真
地理信息接口
程序开发库
STK/ConnectandSTK/Server
STK/WebCast
STK/MATLABInterface
STK/DistributedInteractiveSimulation(DIS)
STK/GeographicInformationSystems(GIS)
STK/Programmer'sLibrary(PL)
二、mexConnect函数详细介绍
2.1STK服务器命令(STKServerCommands)
2.1.1stkDefaultConID
作用:
返回STK的默认标识
2.1.2stkDefaultHost
作用:
返回STK的默认地址
2.1.3stkSetDefaultHost
作用:
设置STK的新地址
用法:
stkSetDefaultHost('host:
port')
2.2应用命令(ApplicationCommands)
2.2.1stkAutoSave
作用:
自动保存STK
用法:
stkAutoSave('onOff','directory',period)
stkAutoSave('onOff')
说明:
onOff-'on'or'off'
directory-stringpathnameofautosavedirectory
period-secondsbetweensaves
2.2.2stkHomeDir
作用:
返回STK的安装路径
用法:
dir=stkHomeDir
2.2.3stkCurrentDir
作用:
返回STK的当前路径
用法:
dir=stkHomeDir
2.2.4stkSetCurrentDir
作用:
设置STK的当前路径
用法:
stkSetCurrentDir('directory')
2.2.5stkObjNames
作用:
返回STK中对象的名字
用法:
objNames=stkObjNames
objNames=stkObjNames(classCell)
说明:
classCell-optionalcellarrayofSTKclassnames.
objNames-cellarrayofSTKobjectnames2.2.4stkSetCurrentDir
2.2.6stkTimerStart
作用:
启动计时器
用法:
stkTimerStart
2.2.7stkTimer
作用:
返回计时器时间
用法:
[split,total]=stkTimer
说明:
split-elapsedtimesincelaststkTimercommand
total-elapsedtimesincelaststkTimerStartcommand
2.3普通对象命令(GenericObjectCommands)
2.3.1stkCentralBody
作用:
返回坐标系的中心体
用法:
centBody=stkCentralBody('objPath')
说明:
objPath-StringnameofobjectobtainedfromstkObjNames.
Ifommitted,thescenariocentralbodyisreturned.
centBody-Stringnameofobjectcoordinatesystemcentralbody.
备注:
更多内容参见stkObjNames、aeroToolbox。
2.3.2stkLoadObj
作用:
导入对象文件
用法:
stkLoadObj('parentPath','class','fileName')
stkLoadObj('scenarioFileName')
说明:
parentPath-Validpath,maybeobtainedfromstkObjNames.
class-Validclassname.ConsultSTKdocumentationfora
listofvalidclasses.Namesarecase-sensitive.
fileName-Filepathofobjectfile
2.3.3stkSaveObj
作用:
将对象保存
用法:
stkSaveObj('objPath','dirName')
stkSaveObj('objPath')
说明:
objPath-Validpath,maybeobtainedfromstkObjNames.
dirName-Directorypathofobjectfile.Whenomitted,
thedefaultdirectoryisused.
2.3.4stkNewObj
作用:
创建一个新对象
用法:
stkNewObj('parentPath','class','name')
说明:
parentPath-Validpath,maybeobtainedfromstkObjNames.
class-Validclassname.ConsultSTKdocumentationfora
listofvalidclasses.Namesarecase-sensitive.
name-Nameofnewobject
备注:
创建场景时,语法为stkNewObj('Scenario','','Scenario1')
2.3.5stkUnload
作用:
卸载对象
用法:
stkUnload('objPath')
说明:
objPath-Validpath,maybeobtainedfromstkObjNames.
2.3.6stkUnloadChildren
作用:
卸载对象的所有子对象
用法:
stkUnloadChildren('objPath')
说明:
objPath-Validpath,maybeobtainedfromstkObjNames.
2.3.7stkRename
作用:
将对象重命名
用法:
stkRename('objPath','newName')
说明:
objPath-Validpath,maybeobtainedfromstkObjNames.
newName-Newinstancename.
2.3.8stkTimePeriod
作用:
获取对象起止时间
用法:
timePeriod=stkTimePeriod('dateFormat')
timePeriod=stkTimePeriod('objPath','dateFormat')
说明:
objPath-Validvehicleobjectpath,defaultstoscenariopath.
timePeriod-Structurearraywithstartandstopfields.
Eachfieldcontainsastringdatevalue.
dateFormat-Validdateformat.Optionsare:
EPOCHSECEPOCHSECOND
EPOCHMINEPOCHMINUTE
EPOCHHREPOCHHOUR
EPOCHDAY
GMTZULUGMTSYSTEM
GREGLCLGREGORIANLOCALGREGORIANLCL
GREGUTCGREGORIANUTC
GREGTAIGREGORIANTAI
GREGTDTGREGORIANTDT
GREGGPSTIMEGREGGPSGREGORIANGPSTIME
GPSTIMEGPS
JULDATEJULIANDATE
JULLCLJULIANLOCALJULIANLCL
JULUTCJULIANUTC
JUL4JULIAN4
JULIAN4UTC
JDATEOFFJDATEOFFSETJULDATEOFFSET
JULEPHEMDATEJULIANEPHEMERISDATE
JULIANEPHEM
JULTAIJULIANTAI
MISELAPMISSIONELAPSED
MODJULDATEMODIFIEDJULIANDATE
YYDDD
YYDDD.DDD
YYYYDDD
YYYYDDD.HHMMSS
YYYYMMDD
YYYYMMDD.DDD
YYYY/MM/DDTIME
YYYY/MM/DD
备注:
更对内容参见stkConvertDate、stkObjNames
2.3.9stkTimePeriodInSec
作用:
获取对象起止时间,以s为单位
用法:
[start,stop]=stkTimePeriodInSec(objPath)
[start,stop]=stkTimePeriodInSec
说明:
objPath-validobjectpath,seestkObjNames.When
notprovided,thescenariotimeperiodisreturned.
start,stop-timeinseconds
2.3.10stkValidObj
作用:
检查对象的有效性
用法:
result=stkValidObj('path')
说明:
path-objectpathname
result-1ifvalid,0otherwise
2.3.11stkDescrip
作用:
获取对象的描述
用法:
description=stkDescrip('objPath','shortLong')
说明:
objPath-Validpath,maybeobtainedfromstkObjNames.
shortLong-Typeofdescriptiontoget,'short'or'long'.
2.3.12stkSetDescrip
作用:
设置对象的描述
用法:
stkSetDescrip('objPath','shortLong','description')
说明:
objPath-Validpath,maybeobtainedfromstkObjNames.
shortLong-Typeofdescriptiontoset,'short'or'long'.
description-Descriptiontext.
2.4场景命令(ScenarioCommands)
2.4.1stkAnimTime
作用:
返回当前动画时间
用法:
time=stkAnimTime
说明:
time-currentSTKanimationtime(sec)
2.4.2stkEpoch
作用:
返回当前场景历元
用法:
epoch=stkEpoch('dateFormat')
说明:
dateFormat-Validdateformat.
epoch-stringrepresentationofscenarioepoch.
2.4.3stkSetEpoch
作用:
设置场景历元
用法:
stkSetEpoch('epoch','dateFormat')
说明:
dateFormat-Validdateformat.
epoch-stringrepresentationofscenarioepoch.
2.4.4stkSetEpochInSec
作用:
设置场景历元
用法:
stkSetEpochInSec(newEpoch)
说明:
newEpoch-numberofsecondselapsedbetweencurrentepoch
andthedesiredepoch.
2.4.5stkSyncEpoch
作用:
aeroToolbox与STK场景有同样的历元
用法:
stkSyncEpoch
备注:
STKandaeroToolboxmaintainseparatescenarioepochs.
ThisfunctionshouldbecalledanytimetheSTKepochischanged
throughmexConnectorviatheSTKGUI.
2.4.6stkConvertDate
作用:
转换日期格式
用法:
newDate=stkConvertDate('date','format','newFormat')
2.4.7stkSetTimePeriod
作用:
设置场景或卫星的时间周期
用法:
stkSetTimePeriod('start','stop','dateFormat')
stkSetTimePeriod('satpath','start','stop','dateFormat')
说明:
satpath-satellitepathname,defaultstoscenario
start,stop-stringdates
2.4.8stkSetTimePeriodInSec
作用:
设置场景的时间周期
用法:
stkTimePeriodInSec(start,stop)
说明:
start,stop-timeinseconds
2.4.9stkScenFilePath
作用:
返回场景文件的路径
用法:
path=stkScenFilePath
说明:
path-currentSTKscenariodirectory
2.4.10stkValidScen
作用:
检查可用的场景
用法:
result=stkValidScen
说明:
result-1ifvalid,0otherwise
2.5基本飞行器数据(BasicVehicleData)
2.5.1stkTimePeriod
作用:
获取对象的时间周期
用法:
timePeriod=stkTimePeriod('dateFormat')
timePeriod=stkTimePeriod('objPath','dateFormat')
说明:
objPath-Validvehicleobjectpath,defaultstoscenariopath.
timePeriod-Structurearraywithstartandstopfields.
Eachfieldcontainsastringdatevalue.
2.5.2stkTimePeriodInSec
作用:
获取对象的时间周期
用法:
[start,stop]=stkTimePeriodInSec(objPath)
[start,stop]=stkTimePeriodInSec
说明:
objPath-validobjectpath,seestkObjNames.When
notprovided,thescenariotimeperiodisreturned.
start,stop-timeinseconds
2.5.3stkSetTimePeriod
作用:
设置场景或对象的时间周期
用法:
stkSetTimePeriod('start','stop','dateFormat')
stkSetTimePeriod('satpath','start','stop','dateFormat')
说明:
satpath-satellitepathname,defaultstoscenario
start,stop-stringdates
2.6卫星运动属性(SatellitePropagators)
2.6.1stkSetPropCart
作用:
设置笛卡尔坐标系下卫星运动的参数
用法:
stkSetPropCart('objPath','propagator','coordSystem',...
tStart,tStop,dt,orbitEpoch,pos,vel,coordEpoch)
说明:
objPath-Validpath,maybeobtainedfromstkObjNames.
propagator-'TwoBody','J2Perturbation','J4Perturbation','HPOP'or'PODS'
Thisparameteriscasesensitive!
coordSystem-stringnameofcoordinatesystem,validchoicesare:
'Fixed','J2000','MeanOfDate','MeanOfEpoch',
'TrueOfDate','TrueOfEpoch','B1950',
'TEMEOfDate','TEMEOfEpoch','AlignmentAtEpoch'.
Thisparameteriscasesensitive!
tStart,tStop-timesinepochseconds.
dt-timestepinseconds.
orbitEpoch-referencetimeoforbitdata,inscenarioepochseconds
pos-3x1vectorofpositionsatreferencetime,meters
vel-3x1vectorofvelocityatreferencetime,meters/sec
coordEpoch-coordinatesystemepoch,requiredbyall'...OfEpoch'
coordinatesystems.
2.6.2stkSetPropClassical
作用:
设置经典轨道根数描述下卫星运动的参数
用法:
stkSetPropClassical('objPath','propagator','coordSystem',...
tStart,tStop,dt,orbitEpoch,semimajorAxis,eccentricity,...
inclination,argOfPerigree,RAAN,meanAnomaly,coordEpoch)
说明:
objPath-Validpath,maybeobtainedfromstkObjNames.
propagator-'TwoBody','J2Perturbation','J4Perturbation','HPOP'or'PODS'
Thisparameteriscasesensitive!
coordSystem-stringnameofcoordinatesystem,validchoicesare:
'Fixed','J2000','MeanOfDate','MeanOfEpoch',
'TrueOfDate','TrueOfEpoch','B1950',
'TEMEOfDate','TEMEOfEpoch','AlignmentAtEpoch'.
Thisparameteriscasesensitive!
tStart,