%General Mission Analysis Tool(GMAT) Script %Created: 2015-02-04 12:51:18 %---------------------------------------- %---------- Spacecraft %---------------------------------------- Create Spacecraft DefaultSC; GMAT DefaultSC.DateFormat = UTCGregorian; GMAT DefaultSC.Epoch = '15 Dec 2017 14:56:42.200'; GMAT DefaultSC.CoordinateSystem = EarthMJ2000Eq; GMAT DefaultSC.DisplayStateType = Cartesian; GMAT DefaultSC.X = -15015.40312811781; GMAT DefaultSC.Y = -23568.97680091111; GMAT DefaultSC.Z = 2241.504923500546; GMAT DefaultSC.VX = -0.485537892208224; GMAT DefaultSC.VY = -5.048763191594085; GMAT DefaultSC.VZ = -0.8799883161637991; GMAT DefaultSC.DryMass = 7; GMAT DefaultSC.Cd = 2.2; GMAT DefaultSC.Cr = 1.8; GMAT DefaultSC.DragArea = 15; GMAT DefaultSC.SRPArea = 1; GMAT DefaultSC.Tanks = {ElectricTank1}; GMAT DefaultSC.Thrusters = {ElectricThruster1}; GMAT DefaultSC.PowerSystem = SolarPowerSystem1; GMAT DefaultSC.NAIFId = -123456789; GMAT DefaultSC.NAIFIdReferenceFrame = -123456789; GMAT DefaultSC.OrbitColor = Red; GMAT DefaultSC.TargetColor = Teal; GMAT DefaultSC.Id = 'SatId'; GMAT DefaultSC.Attitude = CoordinateSystemFixed; GMAT DefaultSC.SPADSRPScaleFactor = 1; GMAT DefaultSC.ModelFile = 'aura.3ds'; GMAT DefaultSC.ModelOffsetX = 0; GMAT DefaultSC.ModelOffsetY = 0; GMAT DefaultSC.ModelOffsetZ = 0; GMAT DefaultSC.ModelRotationX = 0; GMAT DefaultSC.ModelRotationY = 0; GMAT DefaultSC.ModelRotationZ = 0; GMAT DefaultSC.ModelScale = 3; GMAT DefaultSC.AttitudeDisplayStateType = 'Quaternion'; GMAT DefaultSC.AttitudeRateDisplayStateType = 'AngularVelocity'; GMAT DefaultSC.AttitudeCoordinateSystem = EarthMJ2000Eq; GMAT DefaultSC.EulerAngleSequence = '321'; %---------------------------------------- %---------- Spacecraft %---------------------------------------- Create Spacecraft initSat; GMAT initSat.DateFormat = TAIModJulian; GMAT initSat.Epoch = '21545'; GMAT initSat.CoordinateSystem = EarthMJ2000Eq; GMAT initSat.DisplayStateType = Cartesian; GMAT initSat.X = 7100; GMAT initSat.Y = 0; GMAT initSat.Z = 1300; GMAT initSat.VX = 0; GMAT initSat.VY = 7.35; GMAT initSat.VZ = 1; GMAT initSat.DryMass = 850; GMAT initSat.Cd = 2.2; GMAT initSat.Cr = 1.8; GMAT initSat.DragArea = 15; GMAT initSat.SRPArea = 1; GMAT initSat.NAIFId = -123456789; GMAT initSat.NAIFIdReferenceFrame = -123456789; GMAT initSat.OrbitColor = Green; GMAT initSat.TargetColor = LightGray; GMAT initSat.Id = 'SatId'; GMAT initSat.Attitude = CoordinateSystemFixed; GMAT initSat.SPADSRPScaleFactor = 1; GMAT initSat.ModelFile = 'aura.3ds'; GMAT initSat.ModelOffsetX = 0; GMAT initSat.ModelOffsetY = 0; GMAT initSat.ModelOffsetZ = 0; GMAT initSat.ModelRotationX = 0; GMAT initSat.ModelRotationY = 0; GMAT initSat.ModelRotationZ = 0; GMAT initSat.ModelScale = 3; GMAT initSat.AttitudeDisplayStateType = 'Quaternion'; GMAT initSat.AttitudeRateDisplayStateType = 'AngularVelocity'; GMAT initSat.AttitudeCoordinateSystem = EarthMJ2000Eq; GMAT initSat.EulerAngleSequence = '321'; %---------------------------------------- %---------- Hardware Components %---------------------------------------- Create ElectricTank ElectricTank1; GMAT ElectricTank1.AllowNegativeFuelMass = false; GMAT ElectricTank1.FuelMass = 5; Create ElectricThruster ElectricThruster1; GMAT ElectricThruster1.CoordinateSystem = Local; GMAT ElectricThruster1.Origin = Earth; GMAT ElectricThruster1.Axes = VNB; GMAT ElectricThruster1.ThrustDirection1 = -1; GMAT ElectricThruster1.ThrustDirection2 = 0; GMAT ElectricThruster1.ThrustDirection3 = 0; GMAT ElectricThruster1.DutyCycle = 1; GMAT ElectricThruster1.ThrustScaleFactor = 0.9; GMAT ElectricThruster1.DecrementMass = true; GMAT ElectricThruster1.Tank = {ElectricTank1}; GMAT ElectricThruster1.GravitationalAccel = 9.810000000000001; GMAT ElectricThruster1.ThrustModel = ConstantThrustAndIsp; GMAT ElectricThruster1.MaximumUsablePower = 7.266; GMAT ElectricThruster1.MinimumUsablePower = 0.01; GMAT ElectricThruster1.ThrustCoeff1 = -5.19082; GMAT ElectricThruster1.ThrustCoeff2 = 2.96519; GMAT ElectricThruster1.ThrustCoeff3 = -14.4789; GMAT ElectricThruster1.ThrustCoeff4 = 54.05382; GMAT ElectricThruster1.ThrustCoeff5 = -0.00100092; GMAT ElectricThruster1.MassFlowCoeff1 = -0.004776; GMAT ElectricThruster1.MassFlowCoeff2 = 0.05717; GMAT ElectricThruster1.MassFlowCoeff3 = -0.09956; GMAT ElectricThruster1.MassFlowCoeff4 = 0.03211; GMAT ElectricThruster1.MassFlowCoeff5 = 2.13781; GMAT ElectricThruster1.FixedEfficiency = 0.7; GMAT ElectricThruster1.Isp = 2800; GMAT ElectricThruster1.ConstantThrust = 0.0012; Create SolarPowerSystem SolarPowerSystem1; GMAT SolarPowerSystem1.EpochFormat = 'UTCGregorian'; GMAT SolarPowerSystem1.InitialEpoch = ''01 Jan 2000 11:59:28.000''; GMAT SolarPowerSystem1.InitialMaxPower = 1.2; GMAT SolarPowerSystem1.AnnualDecayRate = 5; GMAT SolarPowerSystem1.Margin = 5; GMAT SolarPowerSystem1.BusCoeff1 = 0.3; GMAT SolarPowerSystem1.BusCoeff2 = 0; GMAT SolarPowerSystem1.BusCoeff3 = 0; GMAT SolarPowerSystem1.ShadowModel = 'DualCone'; GMAT SolarPowerSystem1.ShadowBodies = {'Luna'}; GMAT SolarPowerSystem1.SolarCoeff1 = 1.32077; GMAT SolarPowerSystem1.SolarCoeff2 = -0.10848; GMAT SolarPowerSystem1.SolarCoeff3 = -0.11665; GMAT SolarPowerSystem1.SolarCoeff4 = 0.10843; GMAT SolarPowerSystem1.SolarCoeff5 = -0.01279; %---------------------------------------- %---------- ForceModels %---------------------------------------- Create ForceModel DefaultProp_ForceModel; GMAT DefaultProp_ForceModel.CentralBody = Luna; GMAT DefaultProp_ForceModel.PointMasses = {Earth, Luna, Sun}; GMAT DefaultProp_ForceModel.Drag = None; GMAT DefaultProp_ForceModel.SRP = On; GMAT DefaultProp_ForceModel.RelativisticCorrection = Off; GMAT DefaultProp_ForceModel.ErrorControl = RSSStep; GMAT DefaultProp_ForceModel.SRP.Flux = 1367; GMAT DefaultProp_ForceModel.SRP.SRPModel = Spherical; GMAT DefaultProp_ForceModel.SRP.Nominal_Sun = 149597870.691; %---------------------------------------- %---------- Propagators %---------------------------------------- Create Propagator DefaultProp; GMAT DefaultProp.FM = DefaultProp_ForceModel; GMAT DefaultProp.Type = RungeKutta89; GMAT DefaultProp.InitialStepSize = 60; GMAT DefaultProp.Accuracy = 1e-10; GMAT DefaultProp.MinStep = 0.0; GMAT DefaultProp.MaxStep = 86400; GMAT DefaultProp.MaxStepAttempts = 50; GMAT DefaultProp.StopIfAccuracyIsViolated = false; %---------------------------------------- %---------- Burns %---------------------------------------- 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; Create FiniteBurn FiniteBurn1; GMAT FiniteBurn1.Thrusters = {ElectricThruster1}; GMAT FiniteBurn1.ThrottleLogicAlgorithm = 'MaxNumberOfThrusters'; %---------------------------------------- %---------- Coordinate Systems %---------------------------------------- Create CoordinateSystem MoonJ2k; GMAT MoonJ2k.Origin = Luna; GMAT MoonJ2k.Axes = MJ2000Eq; Create CoordinateSystem CS_ESRotating; GMAT CS_ESRotating.Origin = Earth; GMAT CS_ESRotating.Axes = ObjectReferenced; GMAT CS_ESRotating.XAxis = -R; GMAT CS_ESRotating.ZAxis = N; GMAT CS_ESRotating.Primary = Earth; GMAT CS_ESRotating.Secondary = Sun; Create CoordinateSystem CS_EMRotating; GMAT CS_EMRotating.Origin = Earth; GMAT CS_EMRotating.Axes = ObjectReferenced; GMAT CS_EMRotating.XAxis = R; GMAT CS_EMRotating.ZAxis = N; GMAT CS_EMRotating.Primary = Earth; GMAT CS_EMRotating.Secondary = Luna; Create CoordinateSystem CS_MERotating; GMAT CS_MERotating.Origin = Luna; GMAT CS_MERotating.Axes = ObjectReferenced; GMAT CS_MERotating.XAxis = R; GMAT CS_MERotating.ZAxis = N; GMAT CS_MERotating.Primary = Luna; GMAT CS_MERotating.Secondary = Earth; %---------------------------------------- %---------- Solvers %---------------------------------------- Create VF13ad NLPSolver; GMAT NLPSolver.ShowProgress = true; GMAT NLPSolver.ReportStyle = Normal; GMAT NLPSolver.ReportFile = 'VF13adVF13ad1.data'; GMAT NLPSolver.MaximumIterations = 20; GMAT NLPSolver.Tolerance = 1e-005; GMAT NLPSolver.UseCentralDifferences = false; GMAT NLPSolver.FeasibilityTolerance = 0.001; %---------------------------------------- %---------- Subscribers %---------------------------------------- Create OrbitView MoonInertialView; GMAT MoonInertialView.SolverIterations = Current; GMAT MoonInertialView.UpperLeft = [ 0.337446020974707 0.2914466737064414 ]; GMAT MoonInertialView.Size = [ 0.6403454657618753 0.6853220696937699 ]; GMAT MoonInertialView.RelativeZOrder = 2147; GMAT MoonInertialView.Maximized = false; GMAT MoonInertialView.Add = {DefaultSC, Luna, Sun, Earth}; GMAT MoonInertialView.CoordinateSystem = MoonJ2k; GMAT MoonInertialView.DrawObject = [ true true true true ]; GMAT MoonInertialView.DataCollectFrequency = 1; GMAT MoonInertialView.UpdatePlotFrequency = 50; GMAT MoonInertialView.NumPointsToRedraw = 0; GMAT MoonInertialView.ShowPlot = false; GMAT MoonInertialView.ShowLabels = true; GMAT MoonInertialView.ViewPointReference = Luna; GMAT MoonInertialView.ViewPointVector = [ 0 0 10000 ]; GMAT MoonInertialView.ViewDirection = Luna; GMAT MoonInertialView.ViewScaleFactor = 1; GMAT MoonInertialView.ViewUpCoordinateSystem = MoonJ2k; GMAT MoonInertialView.ViewUpAxis = X; GMAT MoonInertialView.EclipticPlane = Off; GMAT MoonInertialView.XYPlane = On; GMAT MoonInertialView.WireFrame = Off; GMAT MoonInertialView.Axes = On; GMAT MoonInertialView.Grid = Off; GMAT MoonInertialView.SunLine = On; GMAT MoonInertialView.UseInitialView = On; GMAT MoonInertialView.StarCount = 7000; GMAT MoonInertialView.EnableStars = On; GMAT MoonInertialView.EnableConstellations = Off; Create OrbitView EarthMoonRotatingView; GMAT EarthMoonRotatingView.SolverIterations = Current; GMAT EarthMoonRotatingView.UpperLeft = [ 0.2111764705882353 0.002111932418162619 ]; GMAT EarthMoonRotatingView.Size = [ 0.3864705882352941 0.6145723336853221 ]; GMAT EarthMoonRotatingView.RelativeZOrder = 214; GMAT EarthMoonRotatingView.Maximized = false; GMAT EarthMoonRotatingView.Add = {DefaultSC, Earth, Sun, Luna}; GMAT EarthMoonRotatingView.CoordinateSystem = CS_EMRotating; GMAT EarthMoonRotatingView.DrawObject = [ true true true true ]; GMAT EarthMoonRotatingView.DataCollectFrequency = 1; GMAT EarthMoonRotatingView.UpdatePlotFrequency = 50; GMAT EarthMoonRotatingView.NumPointsToRedraw = 0; GMAT EarthMoonRotatingView.ShowPlot = true; GMAT EarthMoonRotatingView.ShowLabels = true; GMAT EarthMoonRotatingView.ViewPointReference = Earth; GMAT EarthMoonRotatingView.ViewPointVector = [ 0 0 300000 ]; GMAT EarthMoonRotatingView.ViewDirection = Earth; GMAT EarthMoonRotatingView.ViewScaleFactor = 5.5; GMAT EarthMoonRotatingView.ViewUpCoordinateSystem = CS_EMRotating; GMAT EarthMoonRotatingView.ViewUpAxis = Y; GMAT EarthMoonRotatingView.EclipticPlane = Off; GMAT EarthMoonRotatingView.XYPlane = On; GMAT EarthMoonRotatingView.WireFrame = Off; GMAT EarthMoonRotatingView.Axes = On; GMAT EarthMoonRotatingView.Grid = Off; GMAT EarthMoonRotatingView.SunLine = On; GMAT EarthMoonRotatingView.UseInitialView = On; GMAT EarthMoonRotatingView.StarCount = 7000; GMAT EarthMoonRotatingView.EnableStars = On; GMAT EarthMoonRotatingView.EnableConstellations = Off; Create XYPlot XYPlot1; GMAT XYPlot1.SolverIterations = Current; GMAT XYPlot1.UpperLeft = [ 0.4571252313386798 0.487856388595565 ]; GMAT XYPlot1.Size = [ 0.3158544108574954 0.4519535374868005 ]; GMAT XYPlot1.RelativeZOrder = 1441; GMAT XYPlot1.Maximized = false; GMAT XYPlot1.XVariable = DefaultSC.A1ModJulian; GMAT XYPlot1.YVariables = {DefaultSC.SolarPowerSystem1.RequiredBusPower, DefaultSC.SolarPowerSystem1.ThrustPowerAvailable, DefaultSC.SolarPowerSystem1.TotalPowerAvailable}; GMAT XYPlot1.ShowGrid = true; GMAT XYPlot1.ShowPlot = false; Create OrbitView EarthSunRotatingView; GMAT EarthSunRotatingView.SolverIterations = Current; GMAT EarthSunRotatingView.UpperLeft = [ 0.6123529411764705 0 ]; GMAT EarthSunRotatingView.Size = [ 0.4058823529411765 0.6114044350580782 ]; GMAT EarthSunRotatingView.RelativeZOrder = 216; GMAT EarthSunRotatingView.Maximized = false; GMAT EarthSunRotatingView.Add = {DefaultSC, Earth, Sun, Luna}; GMAT EarthSunRotatingView.CoordinateSystem = CS_ESRotating; GMAT EarthSunRotatingView.DrawObject = [ true true true true ]; GMAT EarthSunRotatingView.DataCollectFrequency = 1; GMAT EarthSunRotatingView.UpdatePlotFrequency = 50; GMAT EarthSunRotatingView.NumPointsToRedraw = 0; GMAT EarthSunRotatingView.ShowPlot = true; GMAT EarthSunRotatingView.ShowLabels = true; GMAT EarthSunRotatingView.ViewPointReference = Earth; GMAT EarthSunRotatingView.ViewPointVector = [ 0 0 300000 ]; GMAT EarthSunRotatingView.ViewDirection = Earth; GMAT EarthSunRotatingView.ViewScaleFactor = 5; GMAT EarthSunRotatingView.ViewUpCoordinateSystem = CS_ESRotating; GMAT EarthSunRotatingView.ViewUpAxis = Y; GMAT EarthSunRotatingView.EclipticPlane = Off; GMAT EarthSunRotatingView.XYPlane = On; GMAT EarthSunRotatingView.WireFrame = Off; GMAT EarthSunRotatingView.Axes = On; GMAT EarthSunRotatingView.Grid = Off; GMAT EarthSunRotatingView.SunLine = On; GMAT EarthSunRotatingView.UseInitialView = On; GMAT EarthSunRotatingView.StarCount = 7000; GMAT EarthSunRotatingView.EnableStars = On; GMAT EarthSunRotatingView.EnableConstellations = Off; Create XYPlot LunarDistance; GMAT LunarDistance.SolverIterations = Current; GMAT LunarDistance.UpperLeft = [ 0.5311764705882353 0.6240760295670539 ]; GMAT LunarDistance.Size = [ 0.3570588235294118 0.3611404435058078 ]; GMAT LunarDistance.RelativeZOrder = 284; GMAT LunarDistance.Maximized = false; GMAT LunarDistance.XVariable = DefaultSC.ElapsedDays; GMAT LunarDistance.YVariables = {DefaultSC.Luna.RMAG}; GMAT LunarDistance.ShowGrid = true; GMAT LunarDistance.ShowPlot = false; Create XYPlot EarthRadPer; GMAT EarthRadPer.SolverIterations = Current; GMAT EarthRadPer.UpperLeft = [ 0.4583590376310919 0.6219640971488912 ]; GMAT EarthRadPer.Size = [ 0.2498457742134485 0.3558606124604013 ]; GMAT EarthRadPer.RelativeZOrder = 2364; GMAT EarthRadPer.Maximized = false; GMAT EarthRadPer.XVariable = DefaultSC.ElapsedDays; GMAT EarthRadPer.YVariables = {DefaultSC.Earth.RadPer}; GMAT EarthRadPer.ShowGrid = true; GMAT EarthRadPer.ShowPlot = false; Create XYPlot EarthDistance; GMAT EarthDistance.SolverIterations = Current; GMAT EarthDistance.UpperLeft = [ 0.2123529411764706 0.6219640971488912 ]; GMAT EarthDistance.Size = [ 0.3158823529411765 0.3621964097148891 ]; GMAT EarthDistance.RelativeZOrder = 282; GMAT EarthDistance.Maximized = false; GMAT EarthDistance.XVariable = DefaultSC.ElapsedDays; GMAT EarthDistance.YVariables = {DefaultSC.Earth.RMAG}; GMAT EarthDistance.ShowGrid = true; GMAT EarthDistance.ShowPlot = false; Create ReportFile trajData; GMAT trajData.SolverIterations = Current; GMAT trajData.UpperLeft = [ 0.06941176470588235 0.1246040126715945 ]; GMAT trajData.Size = [ 0.5982352941176471 0.7961985216473073 ]; GMAT trajData.RelativeZOrder = 722; GMAT trajData.Maximized = true; GMAT trajData.Filename = 'trajData.txt'; GMAT trajData.Precision = 16; GMAT trajData.Add = {DefaultSC.ElapsedDays, DefaultSC.Earth.RMAG, DefaultSC.Luna.RMAG, DefaultSC.MoonJ2k.INC, DefaultSC.X, DefaultSC.Y, DefaultSC.Z, DefaultSC.CS_EMRotating.X, DefaultSC.CS_EMRotating.Y, DefaultSC.CS_EMRotating.Z, DefaultSC.Luna.C3Energy}; GMAT trajData.WriteHeaders = false; GMAT trajData.LeftJustify = On; GMAT trajData.ZeroFill = Off; GMAT trajData.FixedWidth = true; GMAT trajData.Delimiter = ' '; GMAT trajData.ColumnWidth = 23; GMAT trajData.WriteReport = true; Create ReportFile debugData; GMAT debugData.SolverIterations = Current; GMAT debugData.UpperLeft = [ 0 0 ]; GMAT debugData.Size = [ 0 0 ]; GMAT debugData.RelativeZOrder = 0; GMAT debugData.Maximized = false; GMAT debugData.Filename = 'debugData.txt'; GMAT debugData.Precision = 16; GMAT debugData.WriteHeaders = true; GMAT debugData.LeftJustify = On; GMAT debugData.ZeroFill = Off; GMAT debugData.FixedWidth = true; GMAT debugData.Delimiter = ' '; GMAT debugData.ColumnWidth = 23; GMAT debugData.WriteReport = true; Create ReportFile pointData; GMAT pointData.SolverIterations = Current; GMAT pointData.UpperLeft = [ 0.07000000000000001 0.1256599788806758 ]; GMAT pointData.Size = [ 0.5988235294117648 0.7972544878563886 ]; GMAT pointData.RelativeZOrder = 220; GMAT pointData.Maximized = false; GMAT pointData.Filename = 'ReportFile1.txt'; GMAT pointData.Precision = 16; GMAT pointData.WriteHeaders = true; GMAT pointData.LeftJustify = On; GMAT pointData.ZeroFill = Off; GMAT pointData.FixedWidth = true; GMAT pointData.Delimiter = ' '; GMAT pointData.ColumnWidth = 23; GMAT pointData.WriteReport = true; %---------------------------------------- %---------- Arrays, Variables, Strings %---------------------------------------- Create Array satVec[3,1]; Create Variable loopIdx caseIdx burnDuration count moonSatPhase BdotT BdotR; Create String newCase tempOut; GMAT count = 0; GMAT newCase = '================================ New Case ==========================='; Create Variable moonC3 orbitEnergy %---------------------------------------- %---------- Mission Sequence %---------------------------------------- BeginMissionSequence; BeginScript 'Global Initializations' GMAT initSat = DefaultSC; EndScript; %13399.99990968817 1550.00004328152 For BdotT = 11000:25:14000; For BdotR = 1100:25:1600; BeginScript 'Loop Initializations' GMAT count = count + 1; GMAT DefaultSC = initSat; Report trajData newCase; %Report pointData newCase; %Report pointData BdotT BdotR count; Report trajData burnDuration Report trajData BdotT Report trajData BdotR EndScript; Propagate 'Coast for 2 Hours' DefaultProp(DefaultSC) {DefaultSC.ElapsedSecs = 7200}; GMAT DefaultSC.ElectricThruster1.ThrustDirection1 = -1; Optimize NLPSolver {SolveMode = Solve, ExitMode = DiscardAndContinue}; Vary NLPSolver(burnDuration = 1.5, {Perturbation = .0001, MaxStep = 0.3, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0}); Vary NLPSolver(DefaultSC.ElectricThruster1.ThrustDirection1 = -1, {Perturbation = .0001, MaxStep = .4, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0}); Vary NLPSolver(DefaultSC.ElectricThruster1.ThrustDirection2 = 0, {Perturbation = .0001, MaxStep = 0.4, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0}); Vary NLPSolver(DefaultSC.ElectricThruster1.ThrustDirection3 = 0, {Perturbation = .0001, MaxStep = 0.4, AdditiveScaleFactor = 0.0, MultiplicativeScaleFactor = 1.0}); BeginFiniteBurn FiniteBurn1(DefaultSC); Propagate 'Prop Through Burn' DefaultProp(DefaultSC) {DefaultSC.ElapsedDays = burnDuration, OrbitColor = Red}; EndFiniteBurn FiniteBurn1(DefaultSC); Propagate 'Lunar Periapsis' DefaultProp(DefaultSC) {DefaultSC.Luna.Periapsis, DefaultSC.Luna.RMAG = 1800,OrbitColor = Green}; NonlinearConstraint NLPSolver(DefaultSC.CS_MERotating.BdotT=BdotT); NonlinearConstraint NLPSolver(DefaultSC.CS_MERotating.BdotR=BdotR); NonlinearConstraint NLPSolver(burnDuration>=0.1); EndOptimize; % For optimizer NLPSolver If NLPSolver.SolverState == 1 Propagate 'Prop to Periapsis' DefaultProp(DefaultSC) {DefaultSC.Earth.Apoapsis, DefaultSC.ElapsedDays = 180, OrbitColor = Green}; Propagate 'Prop to Periapsis' DefaultProp(DefaultSC) {DefaultSC.ElapsedSecs = 20000} While DefaultSC.ElapsedDays < 200 GMAT DefaultSC.ElectricThruster1.ThrustDirection1 = 1; Propagate 'Prop to Periapsis' DefaultProp(DefaultSC) {DefaultSC.Luna.Periapsis, DefaultSC.ElapsedDays = 180, OrbitColor = Green}; Propagate 'Prop to Periapsis' DefaultProp(DefaultSC) {DefaultSC.ElapsedSecs = 20000} BeginScript 'Compute Relevant Data' GMAT satVec(1,1) = DefaultSC.CS_EMRotating.X; GMAT satVec(2,1) = DefaultSC.CS_EMRotating.Y; GMAT satVec(3,1) = DefaultSC.CS_EMRotating.Z; GMAT satVec = satVec/norm(satVec); GMAT moonSatPhase = Rad2Deg(acos(satVec(1,1))); moonC3 = abs(2*(DefaultSC.MoonJ2k.VMAG)^2/2 - 4902.800/DefaultSC.Luna.RMAG) %Report pointData moonC3 %If moonC3 > 0.001 Report pointData count DefaultSC.ElapsedDays DefaultSC.Luna.C3Energy DefaultSC.Luna.RMAG DefaultSC.Earth.RadPer moonSatPhase BdotT BdotR DefaultSC.CS_MERotating.X DefaultSC.CS_MERotating.Y DefaultSC.CS_MERotating.Z; %EndIf EndScript; EndWhile; Else tempOut = 'No Solution' Report pointData count tempOut moonSatPhase DefaultSC.Luna.C3Energy DefaultSC.Luna.RMAG BdotT BdotR DefaultSC.CS_MERotating.X DefaultSC.CS_MERotating.Y DefaultSC.CS_MERotating.Z; EndIf EndFor; EndFor; Report debugData count;