Last active
January 23, 2021 18:54
-
-
Save jorgepiloto/9ba39b782f0623537511d238c6c04463 to your computer and use it in GitHub Desktop.
gmat2020_hohmann.script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%---------------------------------------- | |
%---------- Spacecraft | |
%---------------------------------------- | |
% Create spacecraft and define its orbit | |
Create Spacecraft ss_0; | |
GMAT ss_0.DateFormat = TAIModJulian; | |
GMAT ss_0.Epoch = '21545'; | |
GMAT ss_0.CoordinateSystem = EarthICRF; | |
GMAT ss_0.DisplayStateType = Cartesian; | |
GMAT ss_0.X = 7200; | |
GMAT ss_0.Y = -1000; | |
GMAT ss_0.Z = 0; | |
GMAT ss_0.VX = 0; | |
GMAT ss_0.VY = 8; | |
GMAT ss_0.VZ =0; | |
GMAT ss_0.DryMass = 850; | |
GMAT ss_0.Cd = 2.2; | |
GMAT ss_0.Cr = 1.8; | |
GMAT ss_0.DragArea = 15; | |
GMAT ss_0.SRPArea = 1; | |
GMAT ss_0.SPADDragScaleFactor = 1; | |
GMAT ss_0.SPADSRPScaleFactor = 1; | |
GMAT ss_0.NAIFId = -10012001; | |
GMAT ss_0.NAIFIdReferenceFrame = -9012001; | |
GMAT ss_0.OrbitColor = Red; | |
GMAT ss_0.TargetColor = Teal; | |
GMAT ss_0.OrbitErrorCovariance = [ 1e+70 0 0 0 0 0 ; 0 1e+70 0 0 0 0 ; 0 0 1e+70 0 0 0 ; 0 0 0 1e+70 0 0 ; 0 0 0 0 1e+70 0 ; 0 0 0 0 0 1e+70 ]; | |
GMAT ss_0.CdSigma = 1e+70; | |
GMAT ss_0.CrSigma = 1e+70; | |
GMAT ss_0.Id = 'SatId'; | |
GMAT ss_0.Attitude = CoordinateSystemFixed; | |
GMAT ss_0.SPADSRPInterpolationMethod = Bilinear; | |
GMAT ss_0.SPADSRPScaleFactorSigma = 1e+70; | |
GMAT ss_0.SPADDragInterpolationMethod = Bilinear; | |
GMAT ss_0.SPADDragScaleFactorSigma = 1e+70; | |
GMAT ss_0.ModelFile = 'aura.3ds'; | |
GMAT ss_0.ModelOffsetX = 0; | |
GMAT ss_0.ModelOffsetY = 0; | |
GMAT ss_0.ModelOffsetZ = 0; | |
GMAT ss_0.ModelRotationX = 0; | |
GMAT ss_0.ModelRotationY = 0; | |
GMAT ss_0.ModelRotationZ = 0; | |
GMAT ss_0.ModelScale = 1; | |
GMAT ss_0.AttitudeDisplayStateType = 'Quaternion'; | |
GMAT ss_0.AttitudeRateDisplayStateType = 'AngularVelocity'; | |
GMAT ss_0.AttitudeCoordinateSystem = EarthMJ2000Eq; | |
GMAT ss_0.EulerAngleSequence = '321'; | |
%---------------------------------------- | |
%---------- ForceModel | |
%---------------------------------------- | |
% Define Force Model with point mass only | |
Create ForceModel PointMass; | |
GMAT PointMass.CentralBody = Earth; | |
GMAT PointMass.PrimaryBodies = {Earth}; | |
GMAT PointMass.Drag = None; | |
GMAT PointMass.SRP = Off; | |
GMAT PointMass.RelativisticCorrection = Off; | |
GMAT PointMass.ErrorControl = RSSStep; | |
GMAT PointMass.GravityField.Earth.Degree = 0; | |
GMAT PointMass.GravityField.Earth.Order = 0; | |
GMAT PointMass.GravityField.Earth.StmLimit = 100; | |
GMAT PointMass.GravityField.Earth.PotentialFile = '../data/gravity/earth/JGM2.cof'; | |
GMAT PointMass.GravityField.Earth.TideModel = 'None'; | |
%---------------------------------------- | |
%---------- Propagators | |
%---------------------------------------- | |
% Create propgator with point mass only | |
Create Propagator EarthPointMass; | |
GMAT EarthPointMass.FM = PointMass; | |
GMAT EarthPointMass.Type = PrinceDormand78; | |
GMAT EarthPointMass.InitialStepSize = 0.5; | |
GMAT EarthPointMass.Accuracy = 1e-12; | |
GMAT EarthPointMass.MinStep = 0; | |
GMAT EarthPointMass.MaxStep = 86400; | |
GMAT EarthPointMass.MaxStepAttempts = 500; | |
GMAT EarthPointMass.StopIfAccuracyIsViolated = false; | |
%---------------------------------------- | |
%---------- Burns | |
%---------------------------------------- | |
Create ImpulsiveBurn TOI; | |
GMAT TOI.CoordinateSystem = Local; | |
GMAT TOI.Origin = Earth; | |
GMAT TOI.Axes = VNB; | |
GMAT TOI.Element1 = 0; | |
GMAT TOI.Element2 = 0; | |
GMAT TOI.Element3 = 0; | |
GMAT TOI.DecrementMass = false; | |
GMAT TOI.Isp = 300; | |
GMAT TOI.GravitationalAccel = 9.81; | |
Create ImpulsiveBurn GOI; | |
GMAT GOI.CoordinateSystem = Local; | |
GMAT GOI.Origin = Earth; | |
GMAT GOI.Axes = VNB; | |
GMAT GOI.Element1 = 0; | |
GMAT GOI.Element2 = 0; | |
GMAT GOI.Element3 = 0; | |
GMAT GOI.DecrementMass = false; | |
GMAT GOI.Isp = 300; | |
GMAT GOI.GravitationalAccel = 9.81; | |
%---------------------------------------- | |
%---------- Solvers | |
%---------------------------------------- | |
Create DifferentialCorrector DC; | |
GMAT DC.ShowProgress = true; | |
GMAT DC.ReportStyle = Normal; | |
GMAT DC.ReportFile = 'DifferentialCorrectorDC.data'; | |
GMAT DC.MaximumIterations = 25; | |
GMAT DC.DerivativeMethod = ForwardDifference; | |
GMAT DC.Algorithm = NewtonRaphson; | |
%---------------------------------------- | |
%---------- Plots/Reports | |
%---------------------------------------- | |
Create OrbitView GLPlot; | |
GMAT GLPlot.SolverIterations = Current; | |
GMAT GLPlot.UpperLeft = [ 0.2175843694493783 0.05272727272727273 ]; | |
GMAT GLPlot.Size = [ 0.9911190053285968 0.9436363636363636 ]; | |
GMAT GLPlot.RelativeZOrder = 143; | |
GMAT GLPlot.Maximized = true; | |
GMAT GLPlot.Add = {ss_0, Earth}; | |
GMAT GLPlot.CoordinateSystem = EarthICRF; | |
GMAT GLPlot.DrawObject = [ true true ]; | |
GMAT GLPlot.DataCollectFrequency = 1; | |
GMAT GLPlot.UpdatePlotFrequency = 50; | |
GMAT GLPlot.NumPointsToRedraw = 0; | |
GMAT GLPlot.ShowPlot = true; | |
GMAT GLPlot.MaxPlotPoints = 20000; | |
GMAT GLPlot.ShowLabels = true; | |
GMAT GLPlot.ViewPointReference = Earth; | |
GMAT GLPlot.ViewPointVector = [ -10000 -15000 3000 ]; | |
GMAT GLPlot.ViewDirection = Earth; | |
GMAT GLPlot.ViewScaleFactor = 1.4; | |
GMAT GLPlot.ViewUpCoordinateSystem = EarthICRF; | |
GMAT GLPlot.ViewUpAxis = Z; | |
GMAT GLPlot.EclipticPlane = Off; | |
GMAT GLPlot.XYPlane = On; | |
GMAT GLPlot.WireFrame = Off; | |
GMAT GLPlot.Axes = On; | |
GMAT GLPlot.Grid = Off; | |
GMAT GLPlot.SunLine = Off; | |
GMAT GLPlot.UseInitialView = On; | |
GMAT GLPlot.StarCount = 7000; | |
GMAT GLPlot.EnableStars = On; | |
GMAT GLPlot.EnableConstellations = On; | |
Create ReportFile report; | |
GMAT report.SolverIterations = Current; | |
GMAT report.UpperLeft = [ 0.2175843694493783 0.05272727272727273 ]; | |
GMAT report.Size = [ 0.9911190053285968 0.9436363636363636 ]; | |
GMAT report.RelativeZOrder = 146; | |
GMAT report.Maximized = true; | |
GMAT report.Filename = 'ReportData.txt'; | |
GMAT report.Precision = 16; | |
GMAT report.Add = {ss_0.UTCGregorian, ss_0.X, ss_0.Y, ss_0.Z, ss_0.VX, ss_0.VY, ss_0.VZ}; | |
GMAT report.WriteHeaders = true; | |
GMAT report.LeftJustify = On; | |
GMAT report.ZeroFill = Off; | |
GMAT report.FixedWidth = true; | |
GMAT report.Delimiter = ' '; | |
GMAT report.ColumnWidth = 23; | |
GMAT report.WriteReport = true; | |
%---------------------------------------- | |
%---------- Mission Sequence | |
%---------------------------------------- | |
BeginMissionSequence; | |
Propagate 'Prop to Perigee' EarthPointMass(ss_0) {ss_0.Periapsis}; | |
% Burn in the velocity direction to reach an alternate Apoapsis point | |
Target 'Raise and Circularize' DC {SolveMode = Solve, ExitMode = DiscardAndContinue, ShowProgressWindow = false}; | |
Vary 'Vary TOI.V' DC(TOI.Element1 = 0.5, {Perturbation = 0.0001, Lower = 0, Upper = 3.14159, MaxStep = 0.2, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0}); | |
Maneuver 'Apply TOI' TOI(ss_0); | |
Propagate 'Prop to Apogee' EarthPointMass(ss_0) {ss_0.Apoapsis}; | |
Achieve 'Achieve RMAG' DC(ss_0.Earth.RMAG = 35781.34857, {Tolerance = 0.01}); | |
Vary 'Vary GOI.V' DC(GOI.Element1 = 0.5, {Perturbation = 0.0001, Lower = 0, Upper = 3.14159, MaxStep = 0.2, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0}); | |
Maneuver 'Apply GOI' GOI(ss_0); | |
Achieve 'Achieve ECC' DC(ss_0.ECC = 0, {Tolerance = 0.01}); | |
EndTarget; % For targeter DC | |
Propagate 'Prop 1 hour' EarthPointMass(ss_0) {ss_0.ElapsedSecs = 3600}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment