function EphemerisCompareFunction(Ephemeris1, Ephemeris2, compareStart, compareEnd) % GMAT Script used to compare two ephemeris files % % Written June, 2016, D. Conway % % Revision History: % Original Script Completed 06/02/2016, D. Conway % Addressed prop start issues 08/07/2016, D. Conway % %------------------------------------------------------------------------------ %---------- System Configuration: Do not change %------------------------------------------------------------------------------ Create Propagator Prop500_1; GMAT Prop500_1.Type = Code500; GMAT Prop500_1.StartEpoch = 'FromSpacecraft'; Create ReportFile ricCompare; Create String compareStart compareEnd Sat1Id Sat2Id Ephemeris1 Ephemeris2 Create Variable CompareStep %------------------------------------------------------------------------------ %---------- SETTINGS %------------------------------------------------------------------------------ % Enter your first and second ephemeris file names and locations here %Ephemeris1 = 'soh.longeph.pc'; %Ephemeris2 = 'soh.longeph.bk.pc'; % Enter the spacecraft names, to be displayed in the report, here: Sat1Id = 'DemoLEO' Sat2Id = 'DemoLEO' % Enter the UTC Gregorian start and end epochs for the comparison %compareStart = '09 May 2016 00:00:00.000' %compareEnd = '01 Jul 2016 00:00:00.000' % Enter the step size for the comparisons, in seconds, here CompareStep = 600; Prop500_1.StepSize = 600; % Set the name (and path, if not the default output path) of the output file here ricCompare.Filename = 'G:\GMAT\Testing\Compare\May09Compare_DemoLEO_1800sec.txt' %%% Optional Settings % If the comparison is not Earth centered, uncomment and edit the following: %GMAT RIC.Primary = Earth; %------------------------------------------------------------------------------ %---------- DO NOT EDIT BELOW THIS LINE %---------- %---------- Additional configuration %---------- %---------- DO NOT EDIT BELOW THIS LINE %------------------------------------------------------------------------------ Create Spacecraft Sat1; GMAT Sat1.DateFormat = UTCGregorian; Create Spacecraft Sat2; GMAT Sat2.DateFormat = UTCGregorian; GMAT Prop500_1.CentralBody = Earth; GMAT Prop500_1.EpochFormat = 'UTCModJulian'; Create CoordinateSystem RIC; GMAT RIC.Origin = Sat1; % CS is relative to Sat1 GMAT RIC.Axes = ObjectReferenced; GMAT RIC.XAxis = R; % X is radial outwards GMAT RIC.ZAxis = N; % Z is normal => cross track, perp to radial outwards GMAT RIC.Primary = Earth; GMAT RIC.Secondary = Sat1; ricCompare.WriteHeaders = false; ricCompare.ZeroFill = On; Create Variable dt start interval dx dy dz dvx dvy dvz dr ta a1 a2; Create Variable Radial InTrack CrossTrack; Create Variable minRadial minInTrack minCrossTrack minDr; Create Variable maxRadial maxInTrack maxCrossTrack maxDr; Create Variable RadialV InTrackV CrossTrackV dv; Create Variable minRadialV minInTrackV minCrossTrackV minDv; Create Variable maxRadialV maxInTrackV maxCrossTrackV maxDv; Create Variable rssR rssI rssC rssT rssRv rssIv rssCv rssTv count; Create String description blank objectField suffix; Create String minEpochR maxEpochR minEpochI maxEpochI; Create String minEpochC maxEpochC minEpochDr maxEpochDr; Create String minEpochRV maxEpochRV minEpochIV maxEpochIV; Create String minEpochCV maxEpochCV minEpochDv maxEpochDv; Create String initialEpoch finalEpoch Create Array initialState[6,1] finalState[6,1] %---------------------------------------- %---------- Mission Sequence %---------------------------------------- BeginMissionSequence Sat1.EphemerisName = Ephemeris1; Sat2.EphemerisName = Ephemeris2; blank = ''; %%%----------------------------------------------------------- %%% HEADER DATA %%%----------------------------------------------------------- description = '****************************************************************** EPHEMERIS COMPARISON REPORT *****************************************************************'; Report ricCompare description Report ricCompare blank [initialEpoch, initialState, finalEpoch, finalState] = GetEphemStates('Code500', Sat1, 'UTCGregorian', EarthMJ2000Eq); Report ricCompare Ephemeris1; Report ricCompare Ephemeris2; Report ricCompare compareStart; Report ricCompare compareEnd;