20250528CubeSat3ULifetime2.script.txt%General Mission Analysis Tool(GMAT) Script%Created: 2025-05-23%3U CubeSat Orbital Lifetime Analysis - Fast Version
%----------------------------------------%---------- Spacecraft%----------------------------------------Create Spacecraft CubeSat3U;GMAT CubeSat3U.DateFormat = UTCGregorian;GMAT CubeSat3U.Epoch = '01 Jan 2025 12:00:00.000';GMAT CubeSat3U.CoordinateSystem = EarthMJ2000Eq;GMAT CubeSat3U.DisplayStateType = Keplerian;GMAT CubeSat3U.SMA = 6878.137;GMAT CubeSat3U.ECC = 0;GMAT CubeSat3U.INC = 90;GMAT CubeSat3U.RAAN = 0;GMAT CubeSat3U.AOP = 0;GMAT CubeSat3U.TA = 0;GMAT CubeSat3U.DryMass = 6;GMAT CubeSat3U.Cd = 2.2;GMAT CubeSat3U.Cr = 1.8;GMAT CubeSat3U.DragArea = 0.02;GMAT CubeSat3U.SRPArea = 0.02;
%----------------------------------------%---------- Force Model - Optimized for Speed%----------------------------------------Create ForceModel LEO_ForceModel;GMAT LEO_ForceModel.CentralBody = Earth;GMAT LEO_ForceModel.PrimaryBodies = {Earth};GMAT LEO_ForceModel.PointMasses = {Sun, Luna};GMAT LEO_ForceModel.SRP = Off;GMAT LEO_ForceModel.ErrorControl = RSSStep;GMAT LEO_ForceModel.GravityField.Earth.Degree = 4;GMAT LEO_ForceModel.GravityField.Earth.Order = 4;GMAT LEO_ForceModel.GravityField.Earth.PotentialFile = 'JGM2.cof';GMAT LEO_ForceModel.Drag.AtmosphereModel = JacchiaRoberts;GMAT LEO_ForceModel.Drag.HistoricWeatherSource = 'ConstantFluxAndGeoMag';GMAT LEO_ForceModel.Drag.PredictedWeatherSource = 'ConstantFluxAndGeoMag';GMAT LEO_ForceModel.Drag.F107 = 150;GMAT LEO_ForceModel.Drag.F107A = 150;GMAT LEO_ForceModel.Drag.MagneticIndex = 4;
%----------------------------------------%---------- Propagator - Fast Settings%----------------------------------------Create Propagator LEO_Prop;GMAT LEO_Prop.FM = LEO_ForceModel;GMAT LEO_Prop.Type = RungeKutta89;GMAT LEO_Prop.InitialStepSize = 300;GMAT LEO_Prop.Accuracy = 1e-10;GMAT LEO_Prop.MinStep = 60;GMAT LEO_Prop.MaxStep = 86400;GMAT LEO_Prop.MaxStepAttempts = 50;
%----------------------------------------%---------- Output - Reduced Frequency%----------------------------------------Create ReportFile LifetimeReport;GMAT LifetimeReport.SolverIterations = Current;GMAT LifetimeReport.UpperLeft = [ 0 0 ];GMAT LifetimeReport.Size = [ 0 0 ];GMAT LifetimeReport.RelativeZOrder = 0;GMAT LifetimeReport.Maximized = false;GMAT LifetimeReport.Filename = 'CubeSat3U_Lifetime_Fast.txt';GMAT LifetimeReport.Precision = 16;GMAT LifetimeReport.WriteHeaders = true;GMAT LifetimeReport.LeftJustify = On;GMAT LifetimeReport.ZeroFill = Off;GMAT LifetimeReport.FixedWidth = true;GMAT LifetimeReport.Delimiter = ' ';GMAT LifetimeReport.ColumnWidth = 23;GMAT LifetimeReport.WriteReport = true;
Create XYPlot AltitudePlot;GMAT AltitudePlot.SolverIterations = Current;GMAT AltitudePlot.UpperLeft = [ 0.1 0.1 ];GMAT AltitudePlot.Size = [ 0.5 0.5 ];GMAT AltitudePlot.RelativeZOrder = 0;GMAT AltitudePlot.Maximized = false;GMAT AltitudePlot.XVariable = CubeSat3U.ElapsedDays;GMAT AltitudePlot.YVariables = {CubeSat3U.Earth.Altitude};GMAT AltitudePlot.ShowGrid = true;GMAT AltitudePlot.ShowPlot = true;
%----------------------------------------%---------- Mission Sequence - Efficient%----------------------------------------BeginMissionSequence;
% Initial reportReport LifetimeReport CubeSat3U.UTCGregorian CubeSat3U.Earth.Altitude CubeSat3U.ElapsedDays;
% Propagate with periodic reportingWhile CubeSat3U.Earth.Altitude > 100 Propagate LEO_Prop(CubeSat3U) {CubeSat3U.ElapsedDays = 30}; Report LifetimeReport CubeSat3U.UTCGregorian CubeSat3U.Earth.Altitude CubeSat3U.ElapsedDays;EndWhile;
% Final precise propagationPropagate LEO_Prop(CubeSat3U) {CubeSat3U.Earth.Altitude = 100};Report LifetimeReport CubeSat3U.UTCGregorian CubeSat3U.Earth.Altitude CubeSat3U.ElapsedDays;