-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathchang'e 5.script
451 lines (345 loc) · 12.9 KB
/
chang'e 5.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
%General Mission Analysis Tool(GMAT) Script
%Created: 2024-02-28 12:28:02
%----------------------------------------
%---------- Spacecraft
%----------------------------------------
Create Spacecraft change5;
GMAT change5.DateFormat = UTCGregorian;
GMAT change5.Epoch = '23 Nov 2020 20:39:14.000';
GMAT change5.CoordinateSystem = guess1xyz;
GMAT change5.DisplayStateType = Cartesian;
GMAT change5.X = 3.339550858072471e-013;
GMAT change5.Y = -7.424616477180734e-015;
GMAT change5.Z = 185.0699999999999;
GMAT change5.VX = 1.639999999999998;
GMAT change5.VY = 5.81699999999999;
GMAT change5.VZ = 1.659999999999991;
GMAT change5.DryMass = 6200;
GMAT change5.Cd = 2.2;
GMAT change5.Cr = 1.8;
GMAT change5.DragArea = 15;
GMAT change5.SRPArea = 1;
GMAT change5.Tanks = {s2LH2, s2LOX, MMH};
GMAT change5.Thrusters = {YF75DX2, YF37};
GMAT change5.NAIFId = -10000001;
GMAT change5.NAIFIdReferenceFrame = -9000001;
GMAT change5.OrbitColor = Red;
GMAT change5.TargetColor = Teal;
GMAT change5.OrbitErrorCovariance = [ 1e+070 0 0 0 0 0 ; 0 1e+070 0 0 0 0 ; 0 0 1e+070 0 0 0 ; 0 0 0 1e+070 0 0 ; 0 0 0 0 1e+070 0 ; 0 0 0 0 0 1e+070 ];
GMAT change5.CdSigma = 1e+070;
GMAT change5.CrSigma = 1e+070;
GMAT change5.Id = 'SatId';
GMAT change5.Attitude = CoordinateSystemFixed;
GMAT change5.SPADSRPScaleFactor = 1;
GMAT change5.ModelFile = 'aura.3ds';
GMAT change5.ModelOffsetX = 0;
GMAT change5.ModelOffsetY = 0;
GMAT change5.ModelOffsetZ = 0;
GMAT change5.ModelRotationX = 0;
GMAT change5.ModelRotationY = 0;
GMAT change5.ModelRotationZ = 0;
GMAT change5.ModelScale = 1;
GMAT change5.AttitudeDisplayStateType = 'Quaternion';
GMAT change5.AttitudeRateDisplayStateType = 'AngularVelocity';
GMAT change5.AttitudeCoordinateSystem = EarthMJ2000Eq;
GMAT change5.EulerAngleSequence = '321';
%----------------------------------------
%---------- Hardware Components
%----------------------------------------
Create ChemicalTank s2LOX;
GMAT s2LOX.AllowNegativeFuelMass = true;
GMAT s2LOX.FuelMass = 26754;
GMAT s2LOX.Pressure = 1500;
GMAT s2LOX.Temperature = -183;
GMAT s2LOX.RefTemperature = -183;
GMAT s2LOX.Volume = 25;
GMAT s2LOX.FuelDensity = 1141;
GMAT s2LOX.PressureModel = PressureRegulated;
Create ChemicalTank s2LH2;
GMAT s2LH2.AllowNegativeFuelMass = true;
GMAT s2LH2.FuelMass = 5245;
GMAT s2LH2.Pressure = 2000;
GMAT s2LH2.Temperature = -253;
GMAT s2LH2.RefTemperature = -253;
GMAT s2LH2.Volume = 77;
GMAT s2LH2.FuelDensity = 70;
GMAT s2LH2.PressureModel = PressureRegulated;
Create ChemicalThruster YF75DX2;
GMAT YF75DX2.CoordinateSystem = Local;
GMAT YF75DX2.Origin = Earth;
GMAT YF75DX2.Axes = VNB;
GMAT YF75DX2.ThrustDirection1 = 1;
GMAT YF75DX2.ThrustDirection2 = 0;
GMAT YF75DX2.ThrustDirection3 = 0;
GMAT YF75DX2.DutyCycle = 1;
GMAT YF75DX2.ThrustScaleFactor = 1;
GMAT YF75DX2.DecrementMass = true;
GMAT YF75DX2.Tank = {s2LH2, s2LOX};
GMAT YF75DX2.MixRatio = [ 1 5.1 ];
GMAT YF75DX2.GravitationalAccel = 9.810000000000001;
GMAT YF75DX2.C1 = 176720;
GMAT YF75DX2.C2 = 0;
GMAT YF75DX2.C3 = 0;
GMAT YF75DX2.C4 = 0;
GMAT YF75DX2.C5 = 0;
GMAT YF75DX2.C6 = 0;
GMAT YF75DX2.C7 = 0;
GMAT YF75DX2.C8 = 0;
GMAT YF75DX2.C9 = 0;
GMAT YF75DX2.C10 = 0;
GMAT YF75DX2.C11 = 0;
GMAT YF75DX2.C12 = 0;
GMAT YF75DX2.C13 = 0;
GMAT YF75DX2.C14 = 0;
GMAT YF75DX2.C15 = 0;
GMAT YF75DX2.C16 = 0;
GMAT YF75DX2.K1 = 442.6;
GMAT YF75DX2.K2 = 0;
GMAT YF75DX2.K3 = 0;
GMAT YF75DX2.K4 = 0;
GMAT YF75DX2.K5 = 0;
GMAT YF75DX2.K6 = 0;
GMAT YF75DX2.K7 = 0;
GMAT YF75DX2.K8 = 0;
GMAT YF75DX2.K9 = 0;
GMAT YF75DX2.K10 = 0;
GMAT YF75DX2.K11 = 0;
GMAT YF75DX2.K12 = 0;
GMAT YF75DX2.K13 = 0;
GMAT YF75DX2.K14 = 0;
GMAT YF75DX2.K15 = 0;
GMAT YF75DX2.K16 = 0;
Create ChemicalThruster YF37;
GMAT YF37.CoordinateSystem = Local;
GMAT YF37.Origin = Earth;
GMAT YF37.Axes = VNB;
GMAT YF37.ThrustDirection1 = -1;
GMAT YF37.ThrustDirection2 = 0;
GMAT YF37.ThrustDirection3 = 0;
GMAT YF37.DutyCycle = 1;
GMAT YF37.ThrustScaleFactor = 1;
GMAT YF37.DecrementMass = true;
GMAT YF37.Tank = {MMH};
GMAT YF37.MixRatio = [ 1 ];
GMAT YF37.GravitationalAccel = 9.810000000000001;
GMAT YF37.C1 = 3000;
GMAT YF37.C2 = 0;
GMAT YF37.C3 = 0;
GMAT YF37.C4 = 0;
GMAT YF37.C5 = 0;
GMAT YF37.C6 = 0;
GMAT YF37.C7 = 0;
GMAT YF37.C8 = 0;
GMAT YF37.C9 = 0;
GMAT YF37.C10 = 0;
GMAT YF37.C11 = 0;
GMAT YF37.C12 = 0;
GMAT YF37.C13 = 0;
GMAT YF37.C14 = 0;
GMAT YF37.C15 = 0;
GMAT YF37.C16 = 0;
GMAT YF37.K1 = 316;
GMAT YF37.K2 = 0;
GMAT YF37.K3 = 0;
GMAT YF37.K4 = 0;
GMAT YF37.K5 = 0;
GMAT YF37.K6 = 0;
GMAT YF37.K7 = 0;
GMAT YF37.K8 = 0;
GMAT YF37.K9 = 0;
GMAT YF37.K10 = 0;
GMAT YF37.K11 = 0;
GMAT YF37.K12 = 0;
GMAT YF37.K13 = 0;
GMAT YF37.K14 = 0;
GMAT YF37.K15 = 0;
GMAT YF37.K16 = 0;
Create ChemicalTank MMH;
GMAT MMH.AllowNegativeFuelMass = true;
GMAT MMH.FuelMass = 2000;
GMAT MMH.Pressure = 1500;
GMAT MMH.Temperature = 20;
GMAT MMH.RefTemperature = 20;
GMAT MMH.Volume = 4;
GMAT MMH.FuelDensity = 880;
GMAT MMH.PressureModel = PressureRegulated;
%----------------------------------------
%---------- GroundStations
%----------------------------------------
Create GroundStation wenchang;
GMAT wenchang.OrbitColor = Thistle;
GMAT wenchang.TargetColor = DarkGray;
GMAT wenchang.CentralBody = Earth;
GMAT wenchang.StateType = Spherical;
GMAT wenchang.HorizonReference = Sphere;
GMAT wenchang.Location1 = 19.317;
GMAT wenchang.Location2 = 110;
GMAT wenchang.Location3 = 0.07000000000000001;
GMAT wenchang.Id = 'StationId';
GMAT wenchang.IonosphereModel = 'None';
GMAT wenchang.TroposphereModel = 'None';
GMAT wenchang.DataSource = 'Constant';
GMAT wenchang.Temperature = 295.1;
GMAT wenchang.Pressure = 1013.5;
GMAT wenchang.Humidity = 55;
GMAT wenchang.MinimumElevationAngle = 7;
Create GroundStation guess1;
GMAT guess1.OrbitColor = Thistle;
GMAT guess1.TargetColor = DarkGray;
GMAT guess1.CentralBody = Earth;
GMAT guess1.StateType = Spherical;
GMAT guess1.HorizonReference = Sphere;
GMAT guess1.Location1 = 16.05;
GMAT guess1.Location2 = 125.5;
GMAT guess1.Location3 = 0;
GMAT guess1.Id = 'StationId';
GMAT guess1.IonosphereModel = 'None';
GMAT guess1.TroposphereModel = 'None';
GMAT guess1.DataSource = 'Constant';
GMAT guess1.Temperature = 295.1;
GMAT guess1.Pressure = 1013.5;
GMAT guess1.Humidity = 55;
GMAT guess1.MinimumElevationAngle = 7;
Create GroundStation guess2;
GMAT guess2.OrbitColor = Thistle;
GMAT guess2.TargetColor = DarkGray;
GMAT guess2.CentralBody = Earth;
GMAT guess2.StateType = Spherical;
GMAT guess2.HorizonReference = Sphere;
GMAT guess2.Location1 = -24.89;
GMAT guess2.Location2 = 235.81;
GMAT guess2.Location3 = 0;
GMAT guess2.Id = 'StationId';
GMAT guess2.IonosphereModel = 'None';
GMAT guess2.TroposphereModel = 'None';
GMAT guess2.DataSource = 'Constant';
GMAT guess2.Temperature = 295.1;
GMAT guess2.Pressure = 1013.5;
GMAT guess2.Humidity = 55;
GMAT guess2.MinimumElevationAngle = 7;
%----------------------------------------
%---------- ForceModels
%----------------------------------------
Create ForceModel nearearth_ForceModel;
GMAT nearearth_ForceModel.CentralBody = Earth;
GMAT nearearth_ForceModel.PrimaryBodies = {Earth};
GMAT nearearth_ForceModel.PointMasses = {Luna, Sun};
GMAT nearearth_ForceModel.Drag = None;
GMAT nearearth_ForceModel.SRP = On;
GMAT nearearth_ForceModel.RelativisticCorrection = Off;
GMAT nearearth_ForceModel.ErrorControl = RSSStep;
GMAT nearearth_ForceModel.GravityField.Earth.Degree = 4;
GMAT nearearth_ForceModel.GravityField.Earth.Order = 4;
GMAT nearearth_ForceModel.GravityField.Earth.StmLimit = 100;
GMAT nearearth_ForceModel.GravityField.Earth.PotentialFile = 'JGM2.cof';
GMAT nearearth_ForceModel.GravityField.Earth.TideModel = 'None';
GMAT nearearth_ForceModel.SRP.Flux = 1367;
GMAT nearearth_ForceModel.SRP.SRPModel = Spherical;
GMAT nearearth_ForceModel.SRP.Nominal_Sun = 149597870.691;
Create ForceModel nearluna_ForceModel;
GMAT nearluna_ForceModel.CentralBody = Luna;
GMAT nearluna_ForceModel.PrimaryBodies = {Luna};
GMAT nearluna_ForceModel.PointMasses = {Earth, Sun};
GMAT nearluna_ForceModel.Drag = None;
GMAT nearluna_ForceModel.SRP = On;
GMAT nearluna_ForceModel.RelativisticCorrection = Off;
GMAT nearluna_ForceModel.ErrorControl = RSSStep;
GMAT nearluna_ForceModel.GravityField.Luna.Degree = 4;
GMAT nearluna_ForceModel.GravityField.Luna.Order = 4;
GMAT nearluna_ForceModel.GravityField.Luna.StmLimit = 100;
GMAT nearluna_ForceModel.GravityField.Luna.PotentialFile = 'LP165P.cof';
GMAT nearluna_ForceModel.GravityField.Luna.TideModel = 'None';
GMAT nearluna_ForceModel.SRP.Flux = 1367;
GMAT nearluna_ForceModel.SRP.SRPModel = Spherical;
GMAT nearluna_ForceModel.SRP.Nominal_Sun = 149597870.691;
%----------------------------------------
%---------- Propagators
%----------------------------------------
Create Propagator nearearth;
GMAT nearearth.FM = nearearth_ForceModel;
GMAT nearearth.Type = PrinceDormand78;
GMAT nearearth.InitialStepSize = 600;
GMAT nearearth.Accuracy = 1e-013;
GMAT nearearth.MinStep = 0;
GMAT nearearth.MaxStep = 86400;
GMAT nearearth.MaxStepAttempts = 50;
GMAT nearearth.StopIfAccuracyIsViolated = true;
Create Propagator nearluna;
GMAT nearluna.FM = nearluna_ForceModel;
GMAT nearluna.Type = PrinceDormand78;
GMAT nearluna.InitialStepSize = 600;
GMAT nearluna.Accuracy = 9.999999999999999e-012;
GMAT nearluna.MinStep = 0;
GMAT nearluna.MaxStep = 86400;
GMAT nearluna.MaxStepAttempts = 50;
GMAT nearluna.StopIfAccuracyIsViolated = true;
%----------------------------------------
%---------- Burns
%----------------------------------------
Create FiniteBurn s21;
GMAT s21.Thrusters = {YF75DX2};
GMAT s21.ThrottleLogicAlgorithm = 'MaxNumberOfThrusters';
Create FiniteBurn DSM;
GMAT DSM.Thrusters = {YF37};
GMAT DSM.ThrottleLogicAlgorithm = 'MaxNumberOfThrusters';
Create ImpulsiveBurn DefaultIB;
GMAT DefaultIB.CoordinateSystem = Local;
GMAT DefaultIB.Origin = Earth;
GMAT DefaultIB.Axes = VNB;
GMAT DefaultIB.Element1 = 0;
GMAT DefaultIB.Element2 = 0;
GMAT DefaultIB.Element3 = 0;
GMAT DefaultIB.DecrementMass = false;
GMAT DefaultIB.Isp = 300;
GMAT DefaultIB.GravitationalAccel = 9.810000000000001;
%----------------------------------------
%---------- Coordinate Systems
%----------------------------------------
Create CoordinateSystem guess1xyz;
GMAT guess1xyz.Origin = guess1;
GMAT guess1xyz.Axes = Topocentric;
Create CoordinateSystem Moonxyz;
GMAT Moonxyz.Origin = Luna;
GMAT Moonxyz.Axes = BodyInertial;
%----------------------------------------
%---------- Solvers
%----------------------------------------
Create DifferentialCorrector DefaultDC;
GMAT DefaultDC.ShowProgress = true;
GMAT DefaultDC.ReportStyle = Normal;
GMAT DefaultDC.ReportFile = 'DifferentialCorrectorDefaultDC.data';
GMAT DefaultDC.MaximumIterations = 25;
GMAT DefaultDC.DerivativeMethod = ForwardDifference;
GMAT DefaultDC.Algorithm = NewtonRaphson;
%----------------------------------------
%---------- Arrays, Variables, Strings
%----------------------------------------
Create Variable burntime;
GMAT burntime = 0;
%----------------------------------------
%---------- Mission Sequence
%----------------------------------------
BeginMissionSequence;
Target DefaultDC {SolveMode = RunInitialGuess, ExitMode = SaveAndContinue, ShowProgressWindow = true};
Vary DefaultDC(change5.VX = 1.590416144320875, {Perturbation = 0.00001, Lower = 0.0, Upper = 13.14159, MaxStep = 0.02, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0});
Vary DefaultDC(change5.VY = 5.635707965723694, {Perturbation = 0.00001, Lower = 0.0, Upper = 13.14159, MaxStep = 0.02, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0});
Vary DefaultDC(change5.VZ = 1.021074383795759, {Perturbation = 0.00001, Lower = 0.0, Upper = 13.14159, MaxStep = 0.02, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0});
GMAT 'burn210s' burntime = 210;
BeginFiniteBurn 'stage2burn1' s21(change5);
Propagate 'prop' nearearth(change5) {change5.ElapsedSecs = burntime, OrbitColor = [255 255 128]};
EndFiniteBurn s21(change5);
GMAT 'sliding937s' burntime = 937;
Propagate 'sliding' nearearth(change5) {change5.ElapsedSecs = burntime};
GMAT 'burn437s' burntime = 437;
BeginFiniteBurn 'stage2burn2' s21(change5);
Propagate 'prop' nearearth(change5) {change5.ElapsedSecs = burntime, OrbitColor = [128 255 0]};
EndFiniteBurn 'EndFiniteBurn2' s21(change5);
BeginScript 'stage 2 decouple'
GMAT change5.s2LOX.FuelMass = 0;
GMAT change5.s2LH2.FuelMass = 0;
EndScript;
Propagate 'prop to arrive' nearearth(change5) {change5.TAIModJulian = 29182.0415625, OrbitColor = [255 255 0]};
Achieve DefaultDC(change5.Moonxyz.X = 0, {Tolerance = 2000});
Achieve DefaultDC(change5.Moonxyz.Y = 0, {Tolerance = 2000});
Achieve DefaultDC(change5.Moonxyz.Z = 0, {Tolerance = 2000});
EndTarget; % For targeter DefaultDC