Create ReportFile r
r.Filename = 'MoonEphem.report'
r.WriteHeaders = off
Create Spacecraft moonSat
moonSat.CoordinateSystem = MoonMJ2000Eq
moonSat.X = 0
moonSat.Y = 0
moonSat.Z = 0
moonSat.VX = 0
moonSat.VY = 0
moonSat.VZ = 0
Create CoordinateSystem MoonMJ2000Eq
MoonMJ2000Eq.Origin = Luna
MoonMJ2000Eq.Axes = MJ2000Eq
Create Variable i
BeginMissionSequence
Report r moonSat.Epoch.TAIModJulian moonSat.EarthMJ2000Eq.X moonSat.EarthMJ2000Eq.Y moonSat.EarthMJ2000Eq.Z moonSat.EarthMJ2000Eq.VX moonSat.EarthMJ2000Eq.VY moonSat.EarthMJ2000Eq.VZ
For i = 1:1:1440
moonSat.Epoch.TAIModJulian = moonSat.Epoch.TAIModJulian + 60/86400
moonSat.X = 0
moonSat.Y = 0
moonSat.Z = 0
moonSat.VX = 0
moonSat.VY = 0
moonSat.VZ = 0
Report r moonSat.Epoch.TAIModJulian moonSat.EarthMJ2000Eq.X moonSat.EarthMJ2000Eq.Y moonSat.EarthMJ2000Eq.Z moonSat.EarthMJ2000Eq.VX moonSat.EarthMJ2000Eq.VY moonSat.EarthMJ2000Eq.VZ
EndFor
Create ReportFile r
r.Filename = 'MoonEphem.report'
r.WriteHeaders = off
Create Spacecraft mySat
mySat.DateFormat = TAIModJulian
mySat.Epoch = 21545
Create Spacecraft moonSat
moonSat.CoordinateSystem = MoonMJ2000Eq
moonSat.X = 0
moonSat.Y = 0
moonSat.Z = 0
moonSat.VX = 0
moonSat.VY = 0
moonSat.VZ = 0
Create Propagator myProp
Create CoordinateSystem MoonMJ2000Eq
MoonMJ2000Eq.Origin = Luna
MoonMJ2000Eq.Axes = MJ2000Eq
BeginMissionSequence
stopTime = 21546
While mySat.Epoch.TAIModJulian < stopTime
Propagate myProp(mySat) % take one propagation step
moonSat.Epoch.TAIModJulian = mySat.Epoch.TAIModJulian % sync epochs
% put MoonSat back at the moon
moonSat.X = 0
moonSat.Y = 0
moonSat.Z = 0
moonSat.VX = 0
moonSat.VY = 0
moonSat.VZ = 0
% report data (add mySat data to this line also)
Report r moonSat.Epoch.TAIModJulian moonSat.EarthMJ2000Eq.X moonSat.EarthMJ2000Eq.Y moonSat.EarthMJ2000Eq.Z moonSat.EarthMJ2000Eq.VX moonSat.EarthMJ2000Eq.VY moonSat.EarthMJ2000Eq.VZ
EndWhile
From GMAT:
From GMAT:
earthSC.SunMJ2000Eq.X earthSC.SunMJ2000Eq.Y earthSC.SunMJ2000Eq.Z earthSC.SunMJ2000Eq.VX earthSC.SunMJ2000Eq.VY earthSC.SunMJ2000Eq.VZ
-111952540.371195 -92670675.63547888 -40174606.10513786 19.46131271331472 -20.40118294028324 -8.844418610754932
From DE405 Ephemeris Reader in MATLAB:
-111952540.3709442 -92670675.63574182 -40174606.10525182 19.46131271337087 -20.40118294023733e+01 -8.844418610734984
Create CoordinateSystem SunMJ2000Eq;
GMAT SunMJ2000Eq.Origin = Sun;
GMAT SunMJ2000Eq.Axes = MJ2000Eq;
Create CoordinateSystem myEarthMJ2000Eq;
GMAT myEarthMJ2000Eq.Origin = Earth;
GMAT myEarthMJ2000Eq.Axes = MJ2000Eq;
GMAT helioEarthSC.X = earthSC.SunMJ2000Eq.X;
GMAT helioEarthSC.Y = earthSC.SunMJ2000Eq.Y;
GMAT helioEarthSC.Z = earthSC.SunMJ2000Eq.Z;
GMAT helioEarthSC.VX = earthSC.SunMJ2000Eq.VX;
GMAT helioEarthSC.VY = earthSC.SunMJ2000Eq.VY;
GMAT helioEarthSC.VZ = earthSC.SunMJ2000Eq.VZ;
Report rf helioEarthSC.X helioEarthSC.Y helioEarthSC.Z helioEarthSC.VX helioEarthSC.VY helioEarthSC.VZ;
Report rf helioEarthSC.ECC;
Parameter exception: *** Error *** Cannot convert from Cartesian to Keplerian because position vector is a zero vector.
Report rf helioEarthSC.X
Report rf helioEarthSC.EarthMJ2000Eq.X
Report rf helioEarthSC.SunMJ2000Eq.X
Users browsing this forum: No registered users and 1 guest