一、背景知识
前面由于定轨的大作业,关于Astrogator模块的学习有所滞后,在本节将重新聚焦Astrogator模块,在本节中,首先解决的问题是已知两个卫星的轨道六根数,求解其中某一颗卫星LVLH坐标下另一颗卫星的位置速度。这里首先需要自己定义一个报表的内容,例如A,B星的轨道六根数分别为
首先利用MATLAB与STK互联生成两颗卫星
clear;clc
uiApplication = actxGetRunningServer('STK11.application');
% Get our IAgStkObjectRoot interface
global root
root = uiApplication.Personality2;
checkempty = root.Children.Count;
if checkempty ~= 0root.CurrentScenario.Unloadroot.CloseScenario;
end
%% 根据你的需要设定场景的名称
root.NewScenario('chapter2');
StartTime = '29 Sep 2023 04:00:00.000'; % 场景开始时间
StopTime = '31 Oct 2023 04:00:00.000'; % 场景结束时间
root.ExecuteCommand(['SetAnalysisTimePeriod * "',StartTime,'" "',StopTime,'"']);
root.ExecuteCommand(' Animate * Reset');
%% ----------------------------------------------
%% A卫星
Sat_Name='A';
satellite=root.CurrentScenario.Children.New('eSatellite', Sat_Name);
satellite.Propagator;
sma=7071.393;
Ecc=0.001;
Inc=20;
w=0;
RAAN=0;
TA=359.999473339175;
satellite.SetPropagatorType('ePropagatorAstrogator');
satellite.Propagator;
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList Initial_State Propagate']);
%% 初始化卫星参数
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.CoordinateType Modified Keplerian']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Epoch ',StartTime,' UTCG']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.ElementType "Kozai-Izsak Mean"']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.sma ',num2str(sma),' km']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.ecc ',num2str(Ecc)]);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.inc ',num2str(Inc),' deg']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.w ',num2str(w),' deg']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.TA ',num2str(TA),' deg']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.RAAN ',num2str(RAAN),' deg']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name,' RunMCS']);
%% B卫星
Sat_Name2='B';
satellite2=root.CurrentScenario.Children.New('eSatellite', Sat_Name2);
satellite2.Propagator;
sma=7071.393;
Ecc=0.001;
Inc=20;
w=0;
RAAN=0;
TA2=359.998946678351;
satellite.SetPropagatorType('ePropagatorAstrogator');
satellite.Propagator;
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList Initial_State Propagate Maneuver']);
%% 初始化卫星参数
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.CoordinateType Modified Keplerian']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Epoch ',StartTime,' UTCG']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.ElementType "Kozai-Izsak Mean"']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.sma ',num2str(sma),' km']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.ecc ',num2str(Ecc)]);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.inc ',num2str(Inc),' deg']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.w ',num2str(w),' deg']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.TA ',num2str(TA2),' deg']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' SetValue MainSequence.SegmentList.Initial_State.InitialState.Keplerian.RAAN ',num2str(RAAN),' deg']);
root.ExecuteCommand(['Astrogator */Satellite/',Sat_Name2,' RunMCS']);
第二步,在STK操作,生成一个B在A星的LVLH坐标系下的坐标,其内容如下
该报告生成的是卫星B在卫星A的LVLH坐标系下初始的位置和速度