stk-matlab-交互连接实例(含代码)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

functionbasicSTK%basicSTK-basicSTKscenariodemo%%USAGEbasicSTK%%ThisMATLABMfilewilldemonstratethecreation/parsingofareport%andtheoptimizationoffaciltyplacementbasedonaccessduration%%Thisisacontributedprogram.AGI(AnalyticalGraphicsInc.)assumesnoresponsibility%whatsoeverfortheresultsobtainedfrom,oranydamagecausedbytheuseofthis%program.remMachine=stkDefaultHost;%清除matlab中打开的任何图形delete(get(0,'children'));%%打开与STK的连接%conid=stkOpen(remMachine);dtr=pi/180;rtd=180/pi;%stkValidScen命令作用,如果stk中已经存在场景,则返回1,否则为0scen_open=stkValidScen;ifscen_open==1rtn=questdlg('Closethecurrentscenario?');%questdlg是GUI中的问题对话框命令,默认答案是‘yes’、’no’和’cancel’if~strcmp(rtn,'Yes')%strcmp是比较两个字符串的命令,如果相同则返回1,否则返回0stkClose(conid)%如果选no的话,关闭与stk的通信returnelsestkUnload('/*')%选yes的情况,卸载stk中当前存在的场景endend%建立一个新场景disp('Createanewscenario');%stk中建立一个场景的格式stkNewObj('parentPath','class','name')stkNewObj('/','Scenario','Matlab_Basic');%设置场景周期stkSetTimePeriod('start','stop','dateFormat')disp('Setscenariotimeperiod');stkSetTimePeriod('1May200000:00:00.0','2May200000:00:00.0','GREGUTC');stkSetEpoch('1May200000:00:00.0','GREGUTC');stkSyncEpoch;%stkConnect发送例行的连接命令到stk中%rtnData=stkConnect(conID,'command','objPath','cmdParamString')rtn=stkConnect(conid,'Animate','Scenario/Matlab_Basic','SetValues1May200000:00:00.0600.1');rtn=stkConnect(conid,'Animate','Scenario/Matlab_Basic','Reset');%建立新的地面站disp('Createanewfacility');stkNewObj('*/','Facility','Test_Facility');%建立新的卫星disp('Createanewsatellite');stkNewObj('*/','Satellite','Basic_Sat');%setupthepropagatorforthesatellitedisp('Setupthepropagatorforthesatellite');inc=60*dtr;raan=132.881811*dtr;%stkSetPropClassical设置propagator的参数,在传统的坐标系中%stkSetPropClassical('objPath','propagator','coordSystem',...%tStart,tStop,dt,orbitEpoch,semimajorAxis,eccentricity,...%inclination,argOfPerigee,RAAN,meanAnomaly,coordEpoch)%目标路径的说明*/Satellite/Basic_Sat,*/Satellite/是类别Basic_Sat是名字stkSetPropClassical('*/Satellite/Basic_Sat','J4Perturbation','J2000',0.0,86400.0,60.0,0,9059000.608735,0.0,inc,0.0,raan,0.0);%setuplooptomovefacilitywithina50x40gridtodetermineoptimumplacementdisp('Setuplooptomovefacilitywithina50x40gridoverthecontinentalUStodetermineoptimumplacement');disp('Facilitywillnowbemovedtovariouslocations,andaccessdatawillbeprocessed');disp('Watchthe2DMapwindowastheaccessgraphicswillbeupdated');fori=1:7lat(i)=50-4*(i-1);forj=1:7long(j)=-120+5*(j-1);stkSetFacPosLLA('Scenario/Matlab_Basic/Facility/Test_Facility',[lat(i)*pi/180;long(j)*pi/180;0]);%计算地面真和卫星的accessreply1=stkConnect(conid,'Access','*/Facility/Test_Facility*/Satellite/Basic_SatOn');%commandtoreturntheaccessreportoverthesocketintothereply2variable%stkAccessAccessintervals%intervals=stkAccess('fromPath','toPath')intervals=stkAccess('Scenario/Matlab_Basic/Satellite/Basic_Sat','Scenario/Matlab_Basic/Facility/Test_Facility');%sumupthedurationofeachaccesstogetthetotalaccessdurationbetweenthefacilityandsatelliteszInt=size(intervals,1);duration=zeros(szInt,1);fork=1:szIntduration(k)=intervals(k).stop-intervals(k).start;endaccess_duration(i,j)=sum(duration);%createthe3Dplotoflatitude,longitude,andaccessdurationdisp('Createa3Dplotofaccessdurationasafunctionoffacilitylatitudeandlongitude');figure(1);surf(long,lat,access_duration);view(-25,40);title('TotalAccessDurationvsFacilityLocation');xlabel('Longitude(deg)');ylabel('Latitude(deg)');zlabel('AccessDuration(sec)');colorbar('vert');rotate3d;disp('Createacontourplotofaccessdurationasafunctionoffacilitylatitudeandlongitude');figure(2);[c,h]=contour(long,lat,access_duration);clabel(c,h);xlabel('Longitude(deg)');ylabel('Latitude(deg)');title('AccessDuration(sec)');%关闭stk连接stkClose(conid)%thisclosesanydefaultconnectionstkCloseendend

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功