|
| 1 | +%General Mission Analysis Tool(GMAT) Script |
| 2 | + |
| 3 | +%---------------------------------------- |
| 4 | +%---------- Spacecraft |
| 5 | +%---------------------------------------- |
| 6 | + |
| 7 | +% Last state vector before burn |
| 8 | +Create Spacecraft Tianwen1_pre; |
| 9 | +Tianwen1_pre.DateFormat = UTCGregorian; |
| 10 | +Tianwen1_pre.CoordinateSystem = MarsInertial; |
| 11 | +Tianwen1_pre.Epoch = '14 May 2021 20:03:29.441'; |
| 12 | +Tianwen1_pre.X = -8163.451235413843 |
| 13 | +Tianwen1_pre.Y = 20039.9547359936 |
| 14 | +Tianwen1_pre.Z = 8982.593582058193 |
| 15 | +Tianwen1_pre.VX = 0.5617731628601621 |
| 16 | +Tianwen1_pre.VY = -1.4070534212421895 |
| 17 | +Tianwen1_pre.VZ = 0.13412294116390164 |
| 18 | + |
| 19 | +% First state after burn |
| 20 | +Create Spacecraft Tianwen1_post; |
| 21 | +Tianwen1_post.DateFormat = UTCGregorian; |
| 22 | +Tianwen1_post.CoordinateSystem = MarsInertial; |
| 23 | +Tianwen1_post.Epoch = '14 May 2021 21:36:34.715'; |
| 24 | +Tianwen1_post.X = -4487.147079687842 |
| 25 | +Tianwen1_post.Y = 10856.291156934765 |
| 26 | +Tianwen1_post.Z = 9157.659416074444 |
| 27 | +Tianwen1_post.VX = 0.7825591745000139 |
| 28 | +Tianwen1_post.VY = -1.9485478281012811 |
| 29 | +Tianwen1_post.VZ = -0.14157560311486433 |
| 30 | + |
| 31 | +%---------------------------------------- |
| 32 | +%---------- ForceModels |
| 33 | +%---------------------------------------- |
| 34 | + |
| 35 | +Create ForceModel DefaultProp_ForceModel; |
| 36 | +DefaultProp_ForceModel.CentralBody = Mars; |
| 37 | +DefaultProp_ForceModel.PrimaryBodies = {Mars}; |
| 38 | +DefaultProp_ForceModel.PointMasses = {Earth, Jupiter, Luna, Mercury, Neptune, Pluto, Saturn, Sun, Uranus, Venus}; |
| 39 | +DefaultProp_ForceModel.Drag = None; |
| 40 | +DefaultProp_ForceModel.SRP = Off; |
| 41 | +DefaultProp_ForceModel.RelativisticCorrection = On; |
| 42 | +DefaultProp_ForceModel.ErrorControl = RSSStep; |
| 43 | +DefaultProp_ForceModel.GravityField.Mars.Degree = 50; |
| 44 | +DefaultProp_ForceModel.GravityField.Mars.Order = 50; |
| 45 | +DefaultProp_ForceModel.GravityField.Mars.StmLimit = 100; |
| 46 | +DefaultProp_ForceModel.GravityField.Mars.PotentialFile = 'Mars50c.cof'; |
| 47 | +DefaultProp_ForceModel.GravityField.Mars.TideModel = 'None'; |
| 48 | + |
| 49 | +%---------------------------------------- |
| 50 | +%---------- Propagators |
| 51 | +%---------------------------------------- |
| 52 | + |
| 53 | +Create Propagator DefaultProp; |
| 54 | +DefaultProp.FM = DefaultProp_ForceModel; |
| 55 | +DefaultProp.Type = PrinceDormand45; |
| 56 | +DefaultProp.InitialStepSize = 10; |
| 57 | +DefaultProp.MinStep = 1; |
| 58 | +DefaultProp.MaxStep = 60; |
| 59 | + |
| 60 | +Create Propagator FineProp; |
| 61 | +FineProp.FM = DefaultProp_ForceModel; |
| 62 | +FineProp.Type = PrinceDormand45; |
| 63 | +FineProp.InitialStepSize = 1; |
| 64 | +FineProp.MinStep = 0.1; |
| 65 | +FineProp.MaxStep = 1; |
| 66 | + |
| 67 | +%---------------------------------------- |
| 68 | +%---------- Coordinate Systems |
| 69 | +%---------------------------------------- |
| 70 | + |
| 71 | +Create CoordinateSystem MarsInertial; |
| 72 | +MarsInertial.Origin = Mars; |
| 73 | +MarsInertial.Axes = BodyInertial; |
| 74 | + |
| 75 | +%---------------------------------------- |
| 76 | +%---------- Subscribers |
| 77 | +%---------------------------------------- |
| 78 | + |
| 79 | +Create ReportFile ReportPre; |
| 80 | +ReportPre.Filename = 'Tianwen1_pre_avoidance.txt'; |
| 81 | +ReportPre.Add = {Tianwen1_pre.UTCModJulian, Tianwen1_pre.MarsInertial.X, Tianwen1_pre.MarsInertial.Y, Tianwen1_pre.MarsInertial.Z, Tianwen1_pre.MarsInertial.VX, Tianwen1_pre.MarsInertial.VY, Tianwen1_pre.MarsInertial.VZ}; |
| 82 | +ReportPre.WriteHeaders = false; |
| 83 | + |
| 84 | +Create ReportFile ReportPost; |
| 85 | +ReportPost.Filename = 'Tianwen1_post_avoidance.txt'; |
| 86 | +ReportPost.Add = {Tianwen1_post.UTCModJulian, Tianwen1_post.MarsInertial.X, Tianwen1_post.MarsInertial.Y, Tianwen1_post.MarsInertial.Z, Tianwen1_post.MarsInertial.VX, Tianwen1_post.MarsInertial.VY, Tianwen1_post.MarsInertial.VZ}; |
| 87 | +ReportPost.WriteHeaders = false; |
| 88 | + |
| 89 | +%---------------------------------------- |
| 90 | +%---------- Mission Sequence |
| 91 | +%---------------------------------------- |
| 92 | + |
| 93 | +BeginMissionSequence; |
| 94 | +Toggle ReportPost Off; |
| 95 | +Toggle ReportPre On; |
| 96 | +Propagate FineProp(Tianwen1_pre) {Tianwen1_pre.ElapsedSecs = 5500}; |
| 97 | +Toggle ReportPre Off; |
| 98 | +Toggle ReportPost On; |
| 99 | +Propagate BackProp FineProp(Tianwen1_post) {Tianwen1_post.ElapsedSecs = -5500}; |
0 commit comments