这个仿真案例,是利用Astrogator模块完成霍曼轨道转移设置。这个案例参考AGI官网提供的例子。请大家共同学习一下。
先说一下基本思路:
卫星初始为500km圆轨道,经过霍曼转移,变为2000km的圆轨道。轨道转移过程中,倾角不变。
下面上代码:
uiap = actxserver(‘STK11.application’);
root = uiap.Personality2;
root.NewScenario(‘Astro’);
sc = root.CurrentScenario;
sat = sc.Children.New(18,‘mysat’);
sat.SetPropagatorType(‘ePropagatorAstrogator’);
satMS = sat.Propagator.MainSequence;
%清除所有模块,然后再添加模块。
satMS.RemoveAll();
%先插入Target Sequence模块
mytars = satMS.Insert(‘eVASegmentTypeTargetSequence’,‘mytarget’,’-’);
%在Target Sequence模块前插入初始状态模块
myinit = satMS.Insert(‘eVASegmentTypeInitialState’,‘myinit’,‘mytarget’);
%从上面语句,就可以看出Insert方法的使用方式,三个参数分别是:模块类
%型、自定义的模块名称、后一个模块的名称(在该模块前插入新的模块)
pro500 = satMS.Insert(‘eVASegmentTypePropagate’,‘pro500’,‘mytarget’);
%设置卫星初始状态,500km圆轨道,倾角50°,其他参数选用默认值
%设置轨道参数类型为轨道六根数形式
myinit.InitialState.SetElementType(‘eVAElementTypeKeplerian’);
%设置轨道高度为500km
myinit.InitialState.Element.SemiMajorAxis = 6.8781e+03;
myinit.InitialState.Element.Inclination = 50;
%设置pro500模块运行500s
%Propagate模块默认的停止条件是运行时间,这里我们就不修改了,下一篇
%我们专门讲解一下Propagate的设置
pro500.StoppingConditions.Item(0).Properties.Trip = 500;
执行完以上语句,就完成了轨道初始状态设置,卫星可运行500s。
首先解释一下霍曼转移:两次变轨,实现轨道转移。是最节省燃料的轨道转移方式。对于本案例,卫星两次点火,第二次点火在远地点实施。为简化分析,这里我们使用脉冲机动方式,有限推力的方式,后续会讨论到。
接下来,也就是本文的关键,设置Target Sequence模块参数,实现霍曼转移。向Target Sequence模块添加子模块:
%第一次脉冲点火设置
man_hm1 = mytars.Segments.Insert(‘eVASegmentTypeManeuver’,‘man_hm1’,’-’);
Pro2App = mytars.Segments.Insert(‘eVASegmentTypePropagate’,‘Pro2App’,’-’);
man_hm2 = mytars.Segments.Insert(‘eVASegmentTypeManeuver’,‘man_hm2’,’-’);
%设置优化目标,即轨道高度2000km的圆轨道。
将这个过程分为两部分,即第一个脉冲负责将远地点高度设置为2000km,第二个脉冲,将偏心率调整为0.因此需要在对应模块的Results属性中添加约束参数
%添加约束条件,近地点高度、偏心率
Pro2App.Results.Add(‘Keplerian Elems/Altitude of Apoapsis’);
man_hm2.Results.Add(‘Keplerian Elems/Eccentricity’);
%设置Pro2App模块的停止条件,停止条件是运动到远地点。并删除默认的
%停止条件,也可以通过控制条件的激活/非激活状态
Pro2App.StoppingConditions.Add(‘Apoapsis’);
Pro2App.StoppingConditions.Remove(‘Duration’);
设置控制参数。为两次机动模块的速度增量:
man_hm1.SetManeuverType(‘eVAManeuverTypeImpulsive’);
man_hm1.Maneuver.SetAttitudeControlType(‘eVAAttitudeControlThrustVector’);
man_hm1.Maneuver.AttitudeControl.ThrustAxesName = ‘Satellite VNC(Earth)’;
man_hm1.EnableControlParameter(‘eVAControlManeuverImpulsiveCartesianX’);
man_hm2.SetManeuverType(‘eVAManeuverTypeImpulsive’);
man_hm2.Maneuver.SetAttitudeControlType(‘eVAAttitudeControlThrustVector’);
man_hm2.Maneuver.AttitudeControl.ThrustAxesName = ‘Satellite VNC(Earth)’;
man_hm2.EnableControlParameter(‘eVAControlManeuverImpulsiveCartesianX’);
dc = mytars.Profiles.Item(‘Differential Corrector’);
xControlParam1 = dc.ControlParameters.GetControlByPaths(‘man_hm1’, ‘ImpulsiveMnvr.Cartesian.X’);
xControlParam1.Enable = true;
xControlParam1.MaxStep = 0.3;
xControlParam2 = dc.ControlParameters.GetControlByPaths(‘man_hm2’, ‘ImpulsiveMnvr.Cartesian.X’);
xControlParam2.Enable = true;
xControlParam2.MaxStep = 0.3;
设置目标参数,即轨道高度、偏心率
aResult = dc.Results.GetResultByPaths(‘Pro2App’, ‘Altitude Of Apoapsis’);
aResult.Enable = true;
aResult.DesiredValue = 2000;
aResult.Tolerance = 0.1;
eccResult = dc.Results.GetResultByPaths(‘man_hm2’, ‘Eccentricity’);
eccResult.Enable = true;
eccResult.DesiredValue = 0;
eccResult.Tolerance = 0.01;
将Target Sequence模块设置为激活状态
mytars.Action = ‘eVATargetSeqActionRunActiveProfiles’
sat.Propagator.RunMCS
这篇博文就先写到这吧,断断续续、写得太久。。。后面再详细讲解里面的一些细节。