Che cosa fa, blocco per blocco, lo script GMAT artemis2_freereturn.script
(traiettoria di “free return” di Artemis II), con la traiettoria che descrive ricalcolata e disegnata. ← OrbitMap
· Simulatore interattivo: orbita di partenza + impulso →
EarthMJ2000Eq visto dall'asse Z (come ViewPointVector = [0 0 600000]): l'equatore è il piano del disegno.
L'asse X punta sempre verso la Luna, quindi la Luna sta ferma: si vede la classica forma “a 8” del free return.
MoonMJ2000Eq visto dalla direzione (1, 1, 1), come ViewPointVector = [20000 20000 20000]. Luna in scala.
Distanza di Orion dal centro della Terra (come Orion.Earth.RMAG) e dal centro della Luna.
È un file per GMAT (General Mission Analysis Tool), il software open source della NASA per progettare
e analizzare traiettorie spaziali. Uno script GMAT ha due parti: prima si creano gli oggetti (veicolo, modelli di
forza, propagatori, manovre, sistemi di riferimento, solutori, grafici) con Create e GMAT x.y = …;
poi, dopo BeginMissionSequence, viene la sequenza di missione, cioè i comandi eseguiti in ordine.
Lo scopo è trovare una traiettoria di free return (ritorno libero) come quella di Artemis II: dopo una sola accensione per lasciare l'orbita terrestre (TLI, Trans‑Lunar Injection), la capsula gira attorno al lato nascosto della Luna e la gravità lunare la rimanda verso la Terra senza altre manovre. È la traiettoria “di sicurezza”: se il motore non si riaccende, l'equipaggio torna comunque a casa (lo stesso principio salvò Apollo 13).
18Create Spacecraft Orion; 19GMAT Orion.DateFormat = UTCGregorian; 20GMAT Orion.Epoch = '08 Feb 2026 18:00:00.000'; 21GMAT Orion.CoordinateSystem = EarthMJ2000Eq; 22GMAT Orion.DisplayStateType = Keplerian; 23GMAT Orion.SMA = 6563.137; 24GMAT Orion.ECC = 0.001; 25GMAT Orion.INC = 28.5; 26GMAT Orion.RAAN = 30.0; 27GMAT Orion.AOP = 0.0; 28GMAT Orion.TA = 0.0; 29GMAT Orion.DryMass = 26500; 30GMAT Orion.Cd = 2.2; 31GMAT Orion.Cr = 1.8; 32GMAT Orion.DragArea = 20; 33GMAT Orion.SRPArea = 22;
Le righe 36–51 creano OrionInit, una copia identica: serve a riportare Orion allo stato iniziale fra le due fasi di calcolo.
57Create ForceModel EarthFull_ForceModel; 58GMAT EarthFull_ForceModel.CentralBody = Earth; 59GMAT EarthFull_ForceModel.PrimaryBodies = {Earth}; 60GMAT EarthFull_ForceModel.PointMasses = {Sun, Luna, Venus, Mars, Jupiter}; 61GMAT EarthFull_ForceModel.SRP = On; 62GMAT EarthFull_ForceModel.RelativisticCorrection = Off; 63GMAT EarthFull_ForceModel.ErrorControl = RSSStep; 64GMAT EarthFull_ForceModel.GravityField.Earth.Degree = 10; 65GMAT EarthFull_ForceModel.GravityField.Earth.Order = 10; 66GMAT EarthFull_ForceModel.GravityField.Earth.PotentialFile = 'JGM2.cof'; 67GMAT EarthFull_ForceModel.Drag = None; 68GMAT EarthFull_ForceModel.SRP.Flux = 1367; 69GMAT EarthFull_ForceModel.SRP.SRPModel = Spherical; 70GMAT EarthFull_ForceModel.SRP.Nominal_Sun = 149597870.691;
EarthFull è il modello “completo” vicino alla Terra: gravità terrestre con il campo JGM‑2 sviluppato fino al grado/ordine 10 (lo schiacciamento ai poli e le altre irregolarità), più l'attrazione di Sole, Luna, Venere, Marte e Giove trattati come punti, e la pressione della luce solare (SRP). La resistenza atmosferica è disattivata.
72Create ForceModel MoonFull_ForceModel; 73GMAT MoonFull_ForceModel.CentralBody = Luna; 74GMAT MoonFull_ForceModel.PrimaryBodies = {Luna}; 75GMAT MoonFull_ForceModel.PointMasses = {Sun, Earth, Jupiter}; 76GMAT MoonFull_ForceModel.Drag = None; 77GMAT MoonFull_ForceModel.SRP = On; 78GMAT MoonFull_ForceModel.RelativisticCorrection = Off; 79GMAT MoonFull_ForceModel.ErrorControl = RSSStep; 80GMAT MoonFull_ForceModel.GravityField.Luna.Degree = 10; 81GMAT MoonFull_ForceModel.GravityField.Luna.Order = 10; 82GMAT MoonFull_ForceModel.GravityField.Luna.PotentialFile = 'LP165P.cof'; 83GMAT MoonFull_ForceModel.SRP.Flux = 1367; 84GMAT MoonFull_ForceModel.SRP.SRPModel = Spherical; 85GMAT MoonFull_ForceModel.SRP.Nominal_Sun = 149597870.691; 86 87Create ForceModel EarthPointMass_ForceModel; 88GMAT EarthPointMass_ForceModel.CentralBody = Earth; 89GMAT EarthPointMass_ForceModel.PointMasses = {Earth}; 90GMAT EarthPointMass_ForceModel.Drag = None; 91GMAT EarthPointMass_ForceModel.SRP = Off; 92GMAT EarthPointMass_ForceModel.RelativisticCorrection = Off; 93GMAT EarthPointMass_ForceModel.ErrorControl = RSSStep;
MoonFull è centrato sulla Luna, con il campo gravitazionale lunare LP165P (10×10): si usa durante il sorvolo. EarthPointMass considera solo la Terra come punto: è il problema dei due corpi di Keplero, rapido e “robusto”, usato per il primo calcolo grossolano.
99Create Propagator EarthFull; 100GMAT EarthFull.FM = EarthFull_ForceModel; 101GMAT EarthFull.Type = RungeKutta89; 102GMAT EarthFull.InitialStepSize = 60; 103GMAT EarthFull.Accuracy = 1e-012; 104GMAT EarthFull.MinStep = 0.001; 105GMAT EarthFull.MaxStep = 86400; 106GMAT EarthFull.MaxStepAttempts = 50; 107GMAT EarthFull.StopIfAccuracyIsViolated = true;
Ogni Propagator integra le equazioni del moto con un metodo Runge‑Kutta 8(9) a passo variabile, con precisione 10−12. Il passo massimo cambia: 1 giorno per EarthFull, 15.000 s per MoonFull, 2700 s per EarthPointMass.
134Create ImpulsiveBurn TLI; 135GMAT TLI.CoordinateSystem = Local; 136GMAT TLI.Origin = Earth; 137GMAT TLI.Axes = VNB; 138GMAT TLI.Element1 = 3.15; 139GMAT TLI.Element2 = 0; 140GMAT TLI.Element3 = 0; 141GMAT TLI.DecrementMass = false; 142GMAT TLI.Isp = 300; 143GMAT TLI.GravitationalAccel = 9.81;
Una manovra impulsiva (cambio istantaneo di velocità) nel sistema locale VNB: V = direzione della velocità,
N = normale al piano orbitale, B = binormale. Element1 = 3.15 significa +3,15 km/s tutti lungo la velocità.
Nella realtà lo esegue lo stadio superiore ICPS.
Conti a mano: in orbita circolare a 185 km la velocità è √(μ/r) = 7,793 km/s. Dopo il TLI trovato dal solutore (3,1487 km/s) diventa 10,942 km/s, appena sotto la velocità di fuga (11,021 km/s). L'orbita diventa un'ellisse lunghissima: semiasse ≈ 228.802 km, apogeo teorico ≈ 451.041 km, periodo ≈ 12,6 giorni. È la Luna, passando, a deviarla.
149Create CoordinateSystem MoonMJ2000Eq; 150GMAT MoonMJ2000Eq.Origin = Luna; 151GMAT MoonMJ2000Eq.Axes = MJ2000Eq; 152 153Create CoordinateSystem MoonInertial; 154GMAT MoonInertial.Origin = Luna; 155GMAT MoonInertial.Axes = BodyInertial; 156 157Create CoordinateSystem EarthMoonRot; 158GMAT EarthMoonRot.Origin = Earth; 159GMAT EarthMoonRot.Axes = ObjectReferenced; 160GMAT EarthMoonRot.XAxis = R; 161GMAT EarthMoonRot.ZAxis = N; 162GMAT EarthMoonRot.Primary = Earth; 163GMAT EarthMoonRot.Secondary = Luna;
XAxis = R), asse Z perpendicolare
all'orbita lunare (ZAxis = N). Ruota con la Luna, quindi in questo sistema la Luna è (quasi) ferma sull'asse X.
Serve sia al puntamento della fase 1 sia alla vista a “8”.169Create DifferentialCorrector DC1; 170GMAT DC1.ShowProgress = true; 171GMAT DC1.ReportStyle = Normal; 172GMAT DC1.ReportFile = './DC1_Report.data'; 173GMAT DC1.MaximumIterations = 200; 174GMAT DC1.DerivativeMethod = ForwardDifference;
Il DifferentialCorrector è il “risolutore di bersagli” di GMAT. Varia alcune grandezze (Vary) finché
altre raggiungono i valori richiesti (Achieve). Usa il metodo di Newton: stima con le differenze finite
(ForwardDifference) quanto ogni obiettivo cambia muovendo ogni variabile, poi corregge.
Le righe 180–263 definiscono le finestre grafiche: tre OrbitView (EarthView, MoonCloseUp, EarthMoonRotView), un grafico XYPlot della distanza dalla Terra e due file di testo. I quattro disegni in cima a questa pagina riproducono proprio quelle quattro finestre.
293Target 'Coarse Lunar Target' DC1 {SolveMode = Solve, ExitMode = SaveAndContinue}; 294 295 Vary 'Vary RAAN' DC1(Orion.RAAN = 30.0, {Perturbation = 0.00001, MaxStep = 5}); 296 Vary 'Vary AOP' DC1(Orion.AOP = 0.0, {Perturbation = 0.00001, MaxStep = 5}); 297 298 Maneuver 'Apply TLI' TLI(Orion); 299 300 % Save for fine targeting 301 GMAT RAAN = Orion.RAAN; 302 GMAT AOP = Orion.AOP; 303 304 % Propagate to apoapsis (near Moon) using point mass for robustness 305 Propagate 'Prop to Apoapsis' EarthPointMass(Orion) {Orion.Earth.Apoapsis, Orion.ElapsedDays = 5}; 306 307 % Constrain apoapsis direction toward Moon 308 Achieve 'RA = 0' DC1(Orion.EarthMoonRot.RA = 0, {Tolerance = 1}); 309 Achieve 'DEC = 0' DC1(Orion.EarthMoonRot.DEC = 0, {Tolerance = 1}); 310 311EndTarget;
Con il TLI fisso a 3,15 km/s, il solutore cambia RAAN e AOP, cioè ruota l'orbita di parcheggio nello spazio. Cerca l'orientamento per cui il punto raggiunto da Orion dopo 5 giorni stia sulla congiungente Terra‑Luna. In pratica chiede che, nel sistema rotante, Orion abbia ascensione retta (RA) e declinazione (DEC) nulle, con tolleranza di 1°.
Il calcolo usa solo la gravità terrestre (EarthPointMass): è un'approssimazione, ma basta a dare un buon
punto di partenza. La condizione di arresto è “apogeo oppure 5 giorni”. L'apogeo arriverebbe dopo circa
6,3 giorni (metà periodo), quindi si ferma sempre ai 5 giorni.
Risultato della mia simulazione: RAAN = 28,48°, AOP = 78,51° in 17 iterazioni.
316GMAT Orion = OrionInit; 317Toggle MoonCloseUp EarthView On; 318 319Target 'Fine Free-Return Target' DC1 {SolveMode = Solve, ExitMode = SaveAndContinue}; 320 321 % Vary parking orbit geometry and TLI magnitude 322 Vary 'Vary RAAN' DC1(Orion.RAAN = RAAN, {Perturbation = 0.000001, MaxStep = 2}); 323 Vary 'Vary AOP' DC1(Orion.AOP = AOP, {Perturbation = 0.000001, MaxStep = 2}); 324 Vary 'Vary TLI.V' DC1(TLI.Element1 = TLI.Element1, {Perturbation = 0.0000001, MaxStep = 0.01}); 325 326 % Apply TLI burn 327 Maneuver 'Apply TLI' TLI(Orion); 328 329 % Propagate to lunar vicinity 330 Propagate 'Prop to Moon' EarthFull(Orion) {Orion.Luna.Periapsis, Orion.ElapsedDays = 6, Orion.Luna.RMAG = 1000}; 331 332 % Target perilune altitude of ~6537 km from Moon center (4800 km alt + 1737 km Moon radius) 333 Achieve 'Achieve Perilune' DC1(Orion.Luna.RMAG = 6537, {Tolerance = 50}); 334 335 % Save perilune conditions before continuing 336 GMAT PeriluneRMAG = Orion.Luna.RMAG; 337 GMAT PeriluneAlt = PeriluneRMAG - 1737.4; 338 339 % Propagate past Moon and back toward Earth 340 Propagate 'Prop from Moon' MoonFull(Orion) {Orion.Luna.RMAG = 50000}; 341 Propagate 'Prop Return' EarthFull(Orion) {Orion.Earth.Periapsis, Orion.ElapsedDays = 12}; 342 343 % Constrain return perigee to ~60 km altitude (entry interface) = 6438 km from center 344 Achieve 'Achieve Return Perigee' DC1(Orion.Earth.RMAG = 6438, {Tolerance = 100}); 345 346EndTarget;
Orion torna allo stato iniziale (Orion = OrionInit). Questa volta il solutore varia tre grandezze
(RAAN, AOP e l'intensità del TLI) e la traiettoria è calcolata con il modello completo, in tre tratti:
Perché 60 km? Il perigeo è calcolato come se l'atmosfera non ci fosse. Un perigeo “virtuale” così basso garantisce che la capsula entri nell'atmosfera (che conta da circa 120 km) con l'angolo giusto: né troppo ripido, né così radente da rimbalzare via.
Le variabili sono tre e gli obiettivi due, quindi le soluzioni sono infinite. Nella mia riproduzione ho scelto ogni volta la correzione più piccola possibile (soluzione “a norma minima”).
Il problema è molto sensibile: il grafico sotto mostra le 41 iterazioni
della mia simulazione. Pochi decimi di metro al secondo di differenza nel TLI spostano il perigeo di ritorno di decine
di migliaia di km. Per questo GMAT limita ogni passo (MaxStep = 2° per gli angoli, 0,01 km/s per il TLI).
| Valore iniziale | Dopo la fase 1 | Soluzione finale | |
|---|---|---|---|
| RAAN | 30° | 28,480° | 6,964° |
| AOP | 0° | 78,511° | 86,552° |
| TLI | 3,15 km/s | 3,15 km/s | 3,14871 km/s |
351Report MissionSummary PeriluneRMAG PeriluneAlt; 352 353%---------------------------------------------------------------------- 354% Phase 4: Report return/reentry conditions (Orion is at Earth periapsis) 355%---------------------------------------------------------------------- 356GMAT ReturnPerigeeAlt = Orion.Earth.RMAG - 6378.137; 357GMAT EntrySpeed_kmps = Orion.EarthMJ2000Eq.VMAG; 358GMAT MissionDays = Orion.ElapsedDays; 359 360Report MissionSummary Orion.UTCGregorian ReturnPerigeeAlt EntrySpeed_kmps MissionDays; 361 362% Report final trajectory point 363Report TrajectoryReport Orion.UTCGregorian Orion.EarthMJ2000Eq.X Orion.EarthMJ2000Eq.Y Orion.EarthMJ2000Eq.Z Orion.EarthMJ2000Eq.VX Orion.EarthMJ2000Eq.VY Orion.EarthMJ2000Eq.VZ Orion.Earth.RMAG Orion.Luna.RMAG;
Lo script scrive su artemis2_summary.txt il perilunio, la data, la quota e la velocità al perigeo di
ritorno e la durata. Valori della mia simulazione:
| Grandezza | Valore |
|---|---|
| Perilunio | 12/02/2026 12:01 UTC — 6.536,9 km dal centro (quota 4.799,5 km), 1,51 km/s rispetto alla Luna |
| Perigeo di ritorno | 16/02/2026 08:50 UTC — quota 66,0 km |
| Velocità al perigeo (EntrySpeed_kmps) | 11,045 km/s |
| Durata (MissionDays) | 7,62 giorni |
artemis2_trajectory.csv conterrà una sola riga. Il comando Report TrajectoryReport …
alla riga 363 viene eseguito una volta sola, alla fine. Per salvare tutta la traiettoria bisogna usare il ReportFile come
“subscriber”, con GMAT TrajectoryReport.Add = {Orion.UTCGregorian, Orion.EarthMJ2000Eq.X, …};: così scrive
una riga a ogni passo di propagazione.GMAT non gira su questo Raspberry. Per questo la sequenza dello script è riprodotta in Python
(artemis2/simula.py, con SciPy e SpiceyPy): stesse condizioni iniziali, stesse condizioni di arresto,
stessi obiettivi e stessi limiti di passo. Le posizioni di Sole, Luna e pianeti vengono dalle effemeridi JPL DE432s. Le
semplificazioni rispetto a GMAT:
Per questo i valori di RAAN, AOP e TLI possono differire di poco da quelli che darebbe GMAT. Gli obiettivi raggiunti
(perilunio e perigeo di ritorno) sono comunque gli stessi. Per ricalcolare:
/mnt/ssd/juice-venv/bin/python /mnt/ssd/html/orbitmap/space/artemis2/simula.py (circa 30 secondi).
1%---------------------------------------------------------------------- 2% Artemis II Free-Return Lunar Mission Simulation 3% 4% Simulates the Artemis II mission profile: 5% - Launch from KSC into 185 km parking orbit (28.5 deg inclination) 6% - Trans-Lunar Injection (TLI) burn by ICPS 7% - Lunar flyby at ~4800 km altitude (far side) 8% - Free-return trajectory back to Earth 9% - ~10 day total mission duration 10% 11% Launch date: 08 Feb 2026 12%---------------------------------------------------------------------- 13 14%---------------------------------------- 15%---------- Spacecraft 16%---------------------------------------- 17 18Create Spacecraft Orion; 19GMAT Orion.DateFormat = UTCGregorian; 20GMAT Orion.Epoch = '08 Feb 2026 18:00:00.000'; 21GMAT Orion.CoordinateSystem = EarthMJ2000Eq; 22GMAT Orion.DisplayStateType = Keplerian; 23GMAT Orion.SMA = 6563.137; 24GMAT Orion.ECC = 0.001; 25GMAT Orion.INC = 28.5; 26GMAT Orion.RAAN = 30.0; 27GMAT Orion.AOP = 0.0; 28GMAT Orion.TA = 0.0; 29GMAT Orion.DryMass = 26500; 30GMAT Orion.Cd = 2.2; 31GMAT Orion.Cr = 1.8; 32GMAT Orion.DragArea = 20; 33GMAT Orion.SRPArea = 22; 34 35% Copy for re-initialization after coarse targeting 36Create Spacecraft OrionInit; 37GMAT OrionInit.DateFormat = UTCGregorian; 38GMAT OrionInit.Epoch = '08 Feb 2026 18:00:00.000'; 39GMAT OrionInit.CoordinateSystem = EarthMJ2000Eq; 40GMAT OrionInit.DisplayStateType = Keplerian; 41GMAT OrionInit.SMA = 6563.137; 42GMAT OrionInit.ECC = 0.001; 43GMAT OrionInit.INC = 28.5; 44GMAT OrionInit.RAAN = 30.0; 45GMAT OrionInit.AOP = 0.0; 46GMAT OrionInit.TA = 0.0; 47GMAT OrionInit.DryMass = 26500; 48GMAT OrionInit.Cd = 2.2; 49GMAT OrionInit.Cr = 1.8; 50GMAT OrionInit.DragArea = 20; 51GMAT OrionInit.SRPArea = 22; 52 53%---------------------------------------- 54%---------- Force Models 55%---------------------------------------- 56 57Create ForceModel EarthFull_ForceModel; 58GMAT EarthFull_ForceModel.CentralBody = Earth; 59GMAT EarthFull_ForceModel.PrimaryBodies = {Earth}; 60GMAT EarthFull_ForceModel.PointMasses = {Sun, Luna, Venus, Mars, Jupiter}; 61GMAT EarthFull_ForceModel.SRP = On; 62GMAT EarthFull_ForceModel.RelativisticCorrection = Off; 63GMAT EarthFull_ForceModel.ErrorControl = RSSStep; 64GMAT EarthFull_ForceModel.GravityField.Earth.Degree = 10; 65GMAT EarthFull_ForceModel.GravityField.Earth.Order = 10; 66GMAT EarthFull_ForceModel.GravityField.Earth.PotentialFile = 'JGM2.cof'; 67GMAT EarthFull_ForceModel.Drag = None; 68GMAT EarthFull_ForceModel.SRP.Flux = 1367; 69GMAT EarthFull_ForceModel.SRP.SRPModel = Spherical; 70GMAT EarthFull_ForceModel.SRP.Nominal_Sun = 149597870.691; 71 72Create ForceModel MoonFull_ForceModel; 73GMAT MoonFull_ForceModel.CentralBody = Luna; 74GMAT MoonFull_ForceModel.PrimaryBodies = {Luna}; 75GMAT MoonFull_ForceModel.PointMasses = {Sun, Earth, Jupiter}; 76GMAT MoonFull_ForceModel.Drag = None; 77GMAT MoonFull_ForceModel.SRP = On; 78GMAT MoonFull_ForceModel.RelativisticCorrection = Off; 79GMAT MoonFull_ForceModel.ErrorControl = RSSStep; 80GMAT MoonFull_ForceModel.GravityField.Luna.Degree = 10; 81GMAT MoonFull_ForceModel.GravityField.Luna.Order = 10; 82GMAT MoonFull_ForceModel.GravityField.Luna.PotentialFile = 'LP165P.cof'; 83GMAT MoonFull_ForceModel.SRP.Flux = 1367; 84GMAT MoonFull_ForceModel.SRP.SRPModel = Spherical; 85GMAT MoonFull_ForceModel.SRP.Nominal_Sun = 149597870.691; 86 87Create ForceModel EarthPointMass_ForceModel; 88GMAT EarthPointMass_ForceModel.CentralBody = Earth; 89GMAT EarthPointMass_ForceModel.PointMasses = {Earth}; 90GMAT EarthPointMass_ForceModel.Drag = None; 91GMAT EarthPointMass_ForceModel.SRP = Off; 92GMAT EarthPointMass_ForceModel.RelativisticCorrection = Off; 93GMAT EarthPointMass_ForceModel.ErrorControl = RSSStep; 94 95%---------------------------------------- 96%---------- Propagators 97%---------------------------------------- 98 99Create Propagator EarthFull; 100GMAT EarthFull.FM = EarthFull_ForceModel; 101GMAT EarthFull.Type = RungeKutta89; 102GMAT EarthFull.InitialStepSize = 60; 103GMAT EarthFull.Accuracy = 1e-012; 104GMAT EarthFull.MinStep = 0.001; 105GMAT EarthFull.MaxStep = 86400; 106GMAT EarthFull.MaxStepAttempts = 50; 107GMAT EarthFull.StopIfAccuracyIsViolated = true; 108 109Create Propagator MoonFull; 110GMAT MoonFull.FM = MoonFull_ForceModel; 111GMAT MoonFull.Type = RungeKutta89; 112GMAT MoonFull.InitialStepSize = 60; 113GMAT MoonFull.Accuracy = 1e-012; 114GMAT MoonFull.MinStep = 0.001; 115GMAT MoonFull.MaxStep = 15000; 116GMAT MoonFull.MaxStepAttempts = 50; 117GMAT MoonFull.StopIfAccuracyIsViolated = true; 118 119Create Propagator EarthPointMass; 120GMAT EarthPointMass.FM = EarthPointMass_ForceModel; 121GMAT EarthPointMass.Type = RungeKutta89; 122GMAT EarthPointMass.InitialStepSize = 60; 123GMAT EarthPointMass.Accuracy = 1e-012; 124GMAT EarthPointMass.MinStep = 0.001; 125GMAT EarthPointMass.MaxStep = 2700; 126GMAT EarthPointMass.MaxStepAttempts = 50; 127GMAT EarthPointMass.StopIfAccuracyIsViolated = true; 128 129%---------------------------------------- 130%---------- Burns 131%---------------------------------------- 132 133% Trans-Lunar Injection (TLI) - performed by ICPS 134Create ImpulsiveBurn TLI; 135GMAT TLI.CoordinateSystem = Local; 136GMAT TLI.Origin = Earth; 137GMAT TLI.Axes = VNB; 138GMAT TLI.Element1 = 3.15; 139GMAT TLI.Element2 = 0; 140GMAT TLI.Element3 = 0; 141GMAT TLI.DecrementMass = false; 142GMAT TLI.Isp = 300; 143GMAT TLI.GravitationalAccel = 9.81; 144 145%---------------------------------------- 146%---------- Coordinate Systems 147%---------------------------------------- 148 149Create CoordinateSystem MoonMJ2000Eq; 150GMAT MoonMJ2000Eq.Origin = Luna; 151GMAT MoonMJ2000Eq.Axes = MJ2000Eq; 152 153Create CoordinateSystem MoonInertial; 154GMAT MoonInertial.Origin = Luna; 155GMAT MoonInertial.Axes = BodyInertial; 156 157Create CoordinateSystem EarthMoonRot; 158GMAT EarthMoonRot.Origin = Earth; 159GMAT EarthMoonRot.Axes = ObjectReferenced; 160GMAT EarthMoonRot.XAxis = R; 161GMAT EarthMoonRot.ZAxis = N; 162GMAT EarthMoonRot.Primary = Earth; 163GMAT EarthMoonRot.Secondary = Luna; 164 165%---------------------------------------- 166%---------- Solvers 167%---------------------------------------- 168 169Create DifferentialCorrector DC1; 170GMAT DC1.ShowProgress = true; 171GMAT DC1.ReportStyle = Normal; 172GMAT DC1.ReportFile = './DC1_Report.data'; 173GMAT DC1.MaximumIterations = 200; 174GMAT DC1.DerivativeMethod = ForwardDifference; 175 176%---------------------------------------- 177%---------- Subscribers 178%---------------------------------------- 179 180Create OrbitView EarthView; 181GMAT EarthView.SolverIterations = Current; 182GMAT EarthView.UpperLeft = [ 0.0 0.0 ]; 183GMAT EarthView.Size = [ 0.5 0.5 ]; 184GMAT EarthView.Add = {Orion, Earth, Luna}; 185GMAT EarthView.CoordinateSystem = EarthMJ2000Eq; 186GMAT EarthView.DrawObject = [ true true true ]; 187GMAT EarthView.DataCollectFrequency = 1; 188GMAT EarthView.UpdatePlotFrequency = 50; 189GMAT EarthView.NumPointsToRedraw = 0; 190GMAT EarthView.ShowPlot = true; 191GMAT EarthView.ViewPointReference = Earth; 192GMAT EarthView.ViewPointVector = [ 0 0 600000 ]; 193GMAT EarthView.ViewDirection = Earth; 194GMAT EarthView.ViewScaleFactor = 1; 195GMAT EarthView.ViewUpCoordinateSystem = EarthMJ2000Eq; 196GMAT EarthView.ViewUpAxis = Z; 197 198Create OrbitView MoonCloseUp; 199GMAT MoonCloseUp.SolverIterations = Current; 200GMAT MoonCloseUp.UpperLeft = [ 0.5 0.0 ]; 201GMAT MoonCloseUp.Size = [ 0.5 0.5 ]; 202GMAT MoonCloseUp.Add = {Orion, Luna, Earth}; 203GMAT MoonCloseUp.CoordinateSystem = MoonMJ2000Eq; 204GMAT MoonCloseUp.DrawObject = [ true true true ]; 205GMAT MoonCloseUp.DataCollectFrequency = 1; 206GMAT MoonCloseUp.UpdatePlotFrequency = 50; 207GMAT MoonCloseUp.NumPointsToRedraw = 0; 208GMAT MoonCloseUp.ShowPlot = true; 209GMAT MoonCloseUp.ViewPointReference = Luna; 210GMAT MoonCloseUp.ViewPointVector = [ 20000 20000 20000 ]; 211GMAT MoonCloseUp.ViewDirection = Luna; 212GMAT MoonCloseUp.ViewScaleFactor = 1.5; 213GMAT MoonCloseUp.ViewUpCoordinateSystem = MoonMJ2000Eq; 214GMAT MoonCloseUp.ViewUpAxis = Z; 215 216Create OrbitView EarthMoonRotView; 217GMAT EarthMoonRotView.SolverIterations = Current; 218GMAT EarthMoonRotView.UpperLeft = [ 0.0 0.5 ]; 219GMAT EarthMoonRotView.Size = [ 0.5 0.5 ]; 220GMAT EarthMoonRotView.Add = {Orion, Earth, Luna}; 221GMAT EarthMoonRotView.CoordinateSystem = EarthMoonRot; 222GMAT EarthMoonRotView.DrawObject = [ true true true ]; 223GMAT EarthMoonRotView.DataCollectFrequency = 1; 224GMAT EarthMoonRotView.UpdatePlotFrequency = 50; 225GMAT EarthMoonRotView.NumPointsToRedraw = 0; 226GMAT EarthMoonRotView.ShowPlot = true; 227GMAT EarthMoonRotView.ViewPointReference = Earth; 228GMAT EarthMoonRotView.ViewPointVector = [ 10000 0 600000 ]; 229GMAT EarthMoonRotView.ViewDirection = Earth; 230GMAT EarthMoonRotView.ViewScaleFactor = 1; 231GMAT EarthMoonRotView.ViewUpCoordinateSystem = EarthMoonRot; 232GMAT EarthMoonRotView.ViewUpAxis = Z; 233 234Create XYPlot EarthDistancePlot; 235GMAT EarthDistancePlot.SolverIterations = None; 236GMAT EarthDistancePlot.UpperLeft = [ 0.5 0.5 ]; 237GMAT EarthDistancePlot.Size = [ 0.5 0.5 ]; 238GMAT EarthDistancePlot.XVariable = Orion.A1ModJulian; 239GMAT EarthDistancePlot.YVariables = {Orion.Earth.RMAG}; 240GMAT EarthDistancePlot.ShowGrid = true; 241GMAT EarthDistancePlot.ShowPlot = true; 242 243Create ReportFile TrajectoryReport; 244GMAT TrajectoryReport.Filename = './artemis2_trajectory.csv'; 245GMAT TrajectoryReport.Precision = 16; 246GMAT TrajectoryReport.WriteHeaders = true; 247GMAT TrajectoryReport.LeftJustify = On; 248GMAT TrajectoryReport.ZeroFill = Off; 249GMAT TrajectoryReport.FixedWidth = false; 250GMAT TrajectoryReport.Delimiter = ','; 251GMAT TrajectoryReport.ColumnWidth = 20; 252GMAT TrajectoryReport.WriteReport = true; 253 254Create ReportFile MissionSummary; 255GMAT MissionSummary.Filename = './artemis2_summary.txt'; 256GMAT MissionSummary.Precision = 6; 257GMAT MissionSummary.WriteHeaders = false; 258GMAT MissionSummary.LeftJustify = On; 259GMAT MissionSummary.ZeroFill = Off; 260GMAT MissionSummary.FixedWidth = true; 261GMAT MissionSummary.Delimiter = ' '; 262GMAT MissionSummary.ColumnWidth = 20; 263GMAT MissionSummary.WriteReport = true; 264 265%---------------------------------------- 266%---------- Arrays, Variables, Strings 267%---------------------------------------- 268 269Create Variable RAAN AOP TLI_dV; 270Create Variable PeriluneAlt PeriluneRMAG ReturnPerigeeAlt; 271Create Variable MissionDays EntrySpeed_kmps; 272Create String PeriluneEpoch; 273 274%************************************************************************** 275%************************* Mission Sequence ******************************* 276%************************************************************************** 277 278BeginMissionSequence; 279 280% Save initial state 281GMAT OrionInit = Orion; 282 283%---------------------------------------------------------------------- 284% Phase 0: Report initial conditions 285%---------------------------------------------------------------------- 286Report MissionSummary Orion.UTCGregorian; 287 288%---------------------------------------------------------------------- 289% Phase 1: Coarse targeting - align line of apsides with Moon 290%---------------------------------------------------------------------- 291Toggle MoonCloseUp EarthView Off; 292 293Target 'Coarse Lunar Target' DC1 {SolveMode = Solve, ExitMode = SaveAndContinue}; 294 295 Vary 'Vary RAAN' DC1(Orion.RAAN = 30.0, {Perturbation = 0.00001, MaxStep = 5}); 296 Vary 'Vary AOP' DC1(Orion.AOP = 0.0, {Perturbation = 0.00001, MaxStep = 5}); 297 298 Maneuver 'Apply TLI' TLI(Orion); 299 300 % Save for fine targeting 301 GMAT RAAN = Orion.RAAN; 302 GMAT AOP = Orion.AOP; 303 304 % Propagate to apoapsis (near Moon) using point mass for robustness 305 Propagate 'Prop to Apoapsis' EarthPointMass(Orion) {Orion.Earth.Apoapsis, Orion.ElapsedDays = 5}; 306 307 % Constrain apoapsis direction toward Moon 308 Achieve 'RA = 0' DC1(Orion.EarthMoonRot.RA = 0, {Tolerance = 1}); 309 Achieve 'DEC = 0' DC1(Orion.EarthMoonRot.DEC = 0, {Tolerance = 1}); 310 311EndTarget; 312 313%---------------------------------------------------------------------- 314% Phase 2: Fine targeting - achieve desired perilune and free-return 315%---------------------------------------------------------------------- 316GMAT Orion = OrionInit; 317Toggle MoonCloseUp EarthView On; 318 319Target 'Fine Free-Return Target' DC1 {SolveMode = Solve, ExitMode = SaveAndContinue}; 320 321 % Vary parking orbit geometry and TLI magnitude 322 Vary 'Vary RAAN' DC1(Orion.RAAN = RAAN, {Perturbation = 0.000001, MaxStep = 2}); 323 Vary 'Vary AOP' DC1(Orion.AOP = AOP, {Perturbation = 0.000001, MaxStep = 2}); 324 Vary 'Vary TLI.V' DC1(TLI.Element1 = TLI.Element1, {Perturbation = 0.0000001, MaxStep = 0.01}); 325 326 % Apply TLI burn 327 Maneuver 'Apply TLI' TLI(Orion); 328 329 % Propagate to lunar vicinity 330 Propagate 'Prop to Moon' EarthFull(Orion) {Orion.Luna.Periapsis, Orion.ElapsedDays = 6, Orion.Luna.RMAG = 1000}; 331 332 % Target perilune altitude of ~6537 km from Moon center (4800 km alt + 1737 km Moon radius) 333 Achieve 'Achieve Perilune' DC1(Orion.Luna.RMAG = 6537, {Tolerance = 50}); 334 335 % Save perilune conditions before continuing 336 GMAT PeriluneRMAG = Orion.Luna.RMAG; 337 GMAT PeriluneAlt = PeriluneRMAG - 1737.4; 338 339 % Propagate past Moon and back toward Earth 340 Propagate 'Prop from Moon' MoonFull(Orion) {Orion.Luna.RMAG = 50000}; 341 Propagate 'Prop Return' EarthFull(Orion) {Orion.Earth.Periapsis, Orion.ElapsedDays = 12}; 342 343 % Constrain return perigee to ~60 km altitude (entry interface) = 6438 km from center 344 Achieve 'Achieve Return Perigee' DC1(Orion.Earth.RMAG = 6438, {Tolerance = 100}); 345 346EndTarget; 347 348%---------------------------------------------------------------------- 349% Phase 3: Report perilune conditions (saved from inside target loop) 350%---------------------------------------------------------------------- 351Report MissionSummary PeriluneRMAG PeriluneAlt; 352 353%---------------------------------------------------------------------- 354% Phase 4: Report return/reentry conditions (Orion is at Earth periapsis) 355%---------------------------------------------------------------------- 356GMAT ReturnPerigeeAlt = Orion.Earth.RMAG - 6378.137; 357GMAT EntrySpeed_kmps = Orion.EarthMJ2000Eq.VMAG; 358GMAT MissionDays = Orion.ElapsedDays; 359 360Report MissionSummary Orion.UTCGregorian ReturnPerigeeAlt EntrySpeed_kmps MissionDays; 361 362% Report final trajectory point 363Report TrajectoryReport Orion.UTCGregorian Orion.EarthMJ2000Eq.X Orion.EarthMJ2000Eq.Y Orion.EarthMJ2000Eq.Z Orion.EarthMJ2000Eq.VX Orion.EarthMJ2000Eq.VY Orion.EarthMJ2000Eq.VZ Orion.Earth.RMAG Orion.Luna.RMAG;