GMAT - Phasing of a constellation (Earth orbiting satellites

76 views Asked by At

Trying to develop a GMAT code to perform in-plane phasing of a constellation made of 3 satellites. They have an initial scatter of 3° between each other. Allowed in-plane burns.
The first satellite ahead of the others not performing any finite burn.
Goal: minimize overall thrust while reaching a predefined semi-major axis (satisfying constraints).
Used the VF13ad optimizer. When I try to run the code below it stops after only 1 iteration, why?

NOTE: at the end of the code is also attached one user-built function.

Create Spacecraft SC1;
GMAT SC1.DateFormat = TAIGregorian;
GMAT SC1.Epoch = '01 Jan 2025 12:00:00.000';
GMAT SC1.CoordinateSystem = EarthMJ2000Eq;
GMAT SC1.DisplayStateType = Keplerian;
GMAT SC1.SMA = 6951.000000000003;
GMAT SC1.ECC = 0.01;
GMAT SC1.INC = 97.51000000000001;
GMAT SC1.RAAN = 20.00000000000001;
GMAT SC1.AOP = 0;
GMAT SC1.TA = 0.0000; %equally scattered by 3 deg at launcher deployment
GMAT SC1.Tanks = {TANK};
GMAT SC1.Thrusters = {IP_THRUSTER};

Create Spacecraft SC2;
GMAT SC2.DateFormat = TAIGregorian;
GMAT SC2.Epoch = '01 Jan 2025 12:00:00.000';
GMAT SC2.CoordinateSystem = EarthMJ2000Eq;
GMAT SC2.DisplayStateType = Keplerian;
GMAT SC2.SMA = 6950.999999999988;
GMAT SC2.ECC = 0.01;
GMAT SC2.INC = 97.51000000000001;
GMAT SC2.RAAN = 20.00000000000001;
GMAT SC2.AOP = 0;
GMAT SC2.TA = -3.0000; %equally scattered by 3 deg at launcher deployment
GMAT SC2.Tanks = {TANK};
GMAT SC2.Thrusters = {IP_THRUSTER};

Create Spacecraft SC3;
GMAT SC3.DateFormat = TAIGregorian;
GMAT SC3.Epoch = '01 Jan 2025 12:00:00.000';
GMAT SC3.CoordinateSystem = EarthMJ2000Eq;
GMAT SC3.DisplayStateType = Keplerian;
GMAT SC3.SMA = 6950.999999999991;
GMAT SC3.ECC = 0.01;
GMAT SC3.INC = 97.51000000000001;
GMAT SC3.RAAN = 20.00000000000001;
GMAT SC3.AOP = 0;
GMAT SC3.TA = -6.00000; %equally scattered by 3 deg at launcher deployment
GMAT SC3.Tanks = {TANK};
GMAT SC3.Thrusters = {IP_THRUSTER};

%----------------------------------------
%---------- Hardware Components
%----------------------------------------
Create ChemicalTank TANK;
GMAT TANK.AllowNegativeFuelMass = false;
GMAT TANK.FuelMass = 15;
GMAT TANK.Pressure = 1500;
GMAT TANK.Temperature = 20;
GMAT TANK.RefTemperature = 20;
GMAT TANK.Volume = 0.75;
GMAT TANK.FuelDensity = 1260;
GMAT TANK.PressureModel = PressureRegulated;

Create ChemicalThruster IP_THRUSTER;
GMAT IP_THRUSTER.CoordinateSystem = Local;
GMAT IP_THRUSTER.Origin = Earth;
GMAT IP_THRUSTER.Axes = VNB;
GMAT IP_THRUSTER.ThrustDirection1 = 1; %ZBODY
GMAT IP_THRUSTER.ThrustDirection2 = 0; %YBODY
GMAT IP_THRUSTER.ThrustDirection3 = 0; %XBODY
GMAT IP_THRUSTER.DutyCycle = 1;
GMAT IP_THRUSTER.ThrustScaleFactor = 1;
GMAT IP_THRUSTER.DecrementMass = false;
GMAT IP_THRUSTER.Tank = {TANK};
GMAT IP_THRUSTER.MixRatio = \[ 1\];
GMAT IP_THRUSTER.GravitationalAccel = 9.81;
GMAT IP_THRUSTER.C1 = -3.9;
GMAT IP_THRUSTER.K1 = 450;

%---------------------------------------
%---------- ForceModels
%----------------------------------------

Create ForceModel FM;
GMAT FM.CentralBody = Earth;
GMAT FM.PrimaryBodies = {Earth};
GMAT FM.SRP = On;
GMAT FM.RelativisticCorrection = Off;
GMAT FM.ErrorControl = RSSStep;
GMAT FM.GravityField.Earth.Degree = 20;
GMAT FM.GravityField.Earth.Order = 20;
GMAT FM.GravityField.Earth.StmLimit = 100;
GMAT FM.GravityField.Earth.PotentialFile = 'JGM2.cof';
GMAT FM.GravityField.Earth.TideModel = 'None';
GMAT FM.SRP.Flux = 1367;
GMAT FM.SRP.SRPModel = Spherical;
GMAT FM.SRP.Nominal_Sun = 149597870.691;
GMAT FM.Drag.AtmosphereModel = MSISE90;
GMAT FM.Drag.HistoricWeatherSource = 'ConstantFluxAndGeoMag';
GMAT FM.Drag.PredictedWeatherSource = 'ConstantFluxAndGeoMag';
GMAT FM.Drag.CSSISpaceWeatherFile = 'SpaceWeather-All-v1.2.txt';
GMAT FM.Drag.SchattenFile = 'SchattenPredict.txt';
GMAT FM.Drag.F107 = 150;
GMAT FM.Drag.F107A = 150;
GMAT FM.Drag.MagneticIndex = 3;
GMAT FM.Drag.SchattenErrorModel = 'Nominal';
GMAT FM.Drag.SchattenTimingModel = 'NominalCycle';
GMAT FM.Drag.DragModel = 'Spherical';

%-----------------------------------------------
%---------- Propagator
%-----------------------------------------------
Create Propagator Propagator_RK;
GMAT Propagator_RK.FM = FM;
GMAT Propagator_RK.Type = PrinceDormand78;
GMAT Propagator_RK.InitialStepSize = 60;
GMAT Propagator_RK.Accuracy = 0.01;
GMAT Propagator_RK.MinStep = 0;
GMAT Propagator_RK.MaxStep = 300;
GMAT Propagator_RK.MaxStepAttempts = 500;
GMAT Propagator_RK.StopIfAccuracyIsViolated = true;

%----------------------------------------
%---------- Burns
%----------------------------------------
Create FiniteBurn IP_BURN;
GMAT IP_BURN.Thrusters = {IP_THRUSTER};
GMAT IP_BURN.ThrottleLogicAlgorithm = 'MaxNumberOfThrusters';

%----------------------------------------
%---------- Solvers
%----------------------------------------
Create VF13ad VF13ad1;
GMAT VF13ad1.ShowProgress = true;
GMAT VF13ad1.ReportStyle = Debug;
GMAT VF13ad1.ReportFile = 'VF13adVF13ad1.data';
GMAT VF13ad1.MaximumIterations = 200;
GMAT VF13ad1.Tolerance = 1;
GMAT VF13ad1.UseCentralDifferences = false;
GMAT VF13ad1.FeasibilityTolerance = 1;

%----------------------------------------
%---------- Functions
%----------------------------------------
Create GmatFunction phasing_function;
GMAT phasing_function.FunctionPath
'C:\\Users\\antdi\\OneDrive\\Desktop\\GMAT\\userfunctions\\gmat\\phasing_function.gmf';

%----------------------------------------
%---------- Arrays, Variables, Strings
%----------------------------------------
Create Array PHASING_AOL\[2,1\];
Create Variable SMA_TARGET DV DPH12 DPH13 AOL1 AOL2 AOL3;
GMAT PHASING_AOL(1, 1) = 120;
GMAT PHASING_AOL(2, 1) = 240;
GMAT SMA_TARGET = 6931; %476 km

%----------------------------
%---------- Mission Sequence
%----------------------------
BeginMissionSequence;

GMAT AOL1=SC1.TA+SC1.AOP;
GMAT AOL2=SC2.TA+SC2.AOP;
GMAT AOL3=SC3.TA+SC3.AOP;

GMAT DPH12 = phasing_function(AOL1, AOL2);
GMAT DPH13 = phasing_function(AOL1, AOL3);

Optimize VF13ad1 {SolveMode = Solve, ExitMode = SaveAndContinue, ShowProgressWindow = true};

Vary VF13ad1(SC2.IP_THRUSTER.C1 = -3.9, {Perturbation = 0.001, MaxStep = 0.1});
Vary VF13ad1(SC3.IP_THRUSTER.C1 = -3.9, {Perturbation = 0.001, MaxStep = 0.1});

BeginFiniteBurn IP_BURN(SC2);
BeginFiniteBurn IP_BURN(SC3);

%GMAT expects Parameter of Spacecraft to be on the LHS of Stopping Condition when using the Propagator.
%DPH12 = PHASING_TA(1,1) is not a predefined Parameter and cannot be put as a Stopping Condtion. Then:
%Phasing Constraints shall be in the NonLinearConstraint.

Propagate Propagator_RK(SC1) {SC1.SMA = SMA_TARGET, StopTolerance=5};
Propagate Propagator_RK(SC2) {SC2.SMA = SMA_TARGET, StopTolerance=5};
Propagate Propagator_RK(SC3) {SC3.SMA = SMA_TARGET, StopTolerance=5};

EndFiniteBurn IP_BURN(SC2);
EndFiniteBurn IP_BURN(SC3);

%#SC1
NonlinearConstraint VF13ad1(SC1.ElapsedDays\<=365);

%#SC2
NonlinearConstraint VF13ad1(SC2.IP_THRUSTER.C1\<=4);
NonlinearConstraint VF13ad1(SC2.ElapsedDays\<=365);
NonlinearConstraint VF13ad1(DPH12=PHASING_AOL(1, 1));

%#SC3
NonlinearConstraint VF13ad1(SC3.IP_THRUSTER.C1\<=4);
NonlinearConstraint VF13ad1(SC3.ElapsedDays\<=365);
NonlinearConstraint VF13ad1(DPH13=PHASING_AOL(2, 1));

GMAT DV = Abs(SC2.IP_THRUSTER.C1+SC3.IP_THRUSTER.C1); %COST FUNCTION
Minimize VF13ad1(DV);

EndOptimize;  % For optimizer VF13ad1

\------------------------USER-BUILT FUNCTION---------------------------

function \[DPH\]=phasing_function(AOL1, AOL2);
Create Variable DPH, AOL1, AOL2;
BeginMissionSequence;
\[DPH\] =Abs(AOL1-AOL2);

I am trying to develop a GMAT code to perform in-plane phasing of a constellation made of 3 satellites having an initial scatter of 3° between each other, by performing in-plane burns and with the first satellite ahead of the others not performing any finite burn. The goal is to minimize the overall thrust while reaching a predefined semi-major axis and satisfying some constraints. I have used the VF13ad optimizer but when I try to run the code below it stops after only 1 iteration and I do not understand why.

0

There are 0 answers