Repository navigation
Add GMAT/Orekit accuracy comparison - #1593
Conversation
ea24a8d to
a1ea23f
Compare
|
@ReeceHumphreys @suhaslord, I Started working on a comparison, if you want to take a look. It is leading to several changes though, it could be better to split them in several PRs, what do you think @schaubh ? On another note, It would be great if someone with experience on GMAT and Orekit could review their setups. Leaving this in draft as it could still change significantly and probably isn't at the top of the priorities. |
dc6ce4d to
7208276
Compare
schaubh
left a comment
There was a problem hiding this comment.
Requesting changes to address the four inline findings below: consistent epochs for midpoint extrapolation, aligned inertial frames in the comparison, complete rate-mismatch detection, and reference-file provenance. Reviewed commit 7208276.
schaubh
left a comment
There was a problem hiding this comment.
Posted some feedback. Thanks for taking a stab at this.
I would not include the "Run Time" section of the benchmark comparison as it really is not apples-to-apples comparison. The tools have different features as you point out. If BSK has a 1Hz task rate, we force updates every 1s even if larger steps would be possible from an orbital mechanics point of view.
I would add a note at the top that these comparison are meant as a rough comparison. These are not auto-generated, so this page will become out of date with new releases of all tools!
You try hard to compare with MSIS drag included. There are a lot of factors here how this model is setup. Are you sure this is apples-and-apples at this point? Would it make more sense to just include a basic exponential density model to avoid these issues?
…hereBase and inertial frame alignment
7208276 to
24c9d8c
Compare
|
Thank you! Yes, you are right. It would be great to compare everything, but it is better to start with the basics. I changed to exponential density and worked on your comments. I'll push a few changes in a bit |
…hereBase and inertial frame alignment
24c9d8c to
e3fd30a
Compare
schaubh
left a comment
There was a problem hiding this comment.
Thanks, we are getting close now. I had two follow up comments and one new comment to consider.
…hereBase and inertial frame alignment
7786293 to
e58dab9
Compare
|
The latest commit addresses your comments and a few more issues. Forced push to rebase and solve a conflict in |
…ation extrapolation, environment-module step lag and MSIS altitude/solar time; add docs
…ation on solar time doc
…d flag for nrlmsise
…hereBase and inertial frame alignment
… wind step extrapolation in comparison
… warning, add boundary tests
… equation of time before 1970
… startup, validate reference provenance and per-case density
…net, MSIS midpoint epoch, TZ restore, comparison reference updates
9fbf51c to
e3fe825
Compare
…ation epoch, treat a zero planet DCM as identity in AtmosphereBase, share extrapolation helpers, drop the gravity spin cache
|
Removed caching in |
|
[P3] Update the PR description after removing the gravity spin cache Item 1 still says that Please replace that sentence with: “ |
schaubh
left a comment
There was a problem hiding this comment.
Ok, I think we are there. Thanks for the contribution.
…se and inertial frame alignment
Description
Adds the documentation page requested in #1456,
Support/User/accuracyComparison.rst, which compares Basilisk orbit propagation with GMAT and Orekit, together with the scripts and a guide to reproduce it. Seventeen cases add the perturbations one at a time (two-body, zonal and tesseral gravity up to degree and order 70, Sun and Moon, SRP, drag), so a disagreement can be traced to a single effect. They cover LEO, sun-synchronous, Molniya, GTO and GEO orbits, and faceted drag and SRP of a box spacecraft with a fixed and with a spinning attitude (compared with Orekit). All tools propagate in the ICRF axes (GCRFin Orekit,EarthICRFin GMAT,J2000of the DE430 kernels in Basilisk), and the drag cases use a single-scale exponential atmosphere, which all three tools can model identically.The comparison exposed a few Basilisk behaviours that are touched by this PR:
Planet orientation in
gravityEffector(gravityEffector.cpp): the orientation of a SPICE-driven planet was advanced withDCM + DCM_dot * dt, which is not a rotation. It scales the evaluated field by a relative error of order (omega dt)^2 and distorts even a point-mass field. It is now advanced as a rotation about the planet angular velocity, with the newplanetSpin()andadvanceDcm()ofstateExtrapolation.h, which are shared with the environment modules.gravityEffectorderives the planet angular velocity withplanetSpin()during each gravity evaluation and advances the orientation withadvanceDcm()to that evaluation epoch.advanceDcmDot()advancesJ20002Pfix_dotconsistently with the advanced orientation, both inextrapolatePlanetStateToEpoch()(so the angular velocity reconstructed byWindBasefrom the extrapolated planet state is unchanged) and ingravityEffector, which now stores the advancedJ20002PfixandJ20002Pfix_dotof the same epoch. These two state properties are stored as[PN]and[PN_dot], as documented ingravityEffector.h; they were the transposed[NP]after the first update, while their initial value was[PN].One-step lag of the environment modules (new
architecture/utilities/stateExtrapolation.h;AtmosphereBase,WindBase,MagneticFieldBase,Eclipse,SolarFlux): these modules run before the spacecraft, so they read its state from the previous step. They can now use the position extrapolated to the middle of the interval the next spacecraft update integrates. The extrapolation is off by default and is enabled withsetExtrapolateScStateToStepMidpoint(True).applyPlanet(),extrapolatePlanetStateToEpoch()), so a translating planet does not bias the relative position. This matters for the Sun inSolarFluxand for planet-fixed frames inAtmosphereBase.WindBasereads and extrapolates the planet state only when both the spacecraft and the planet messages were written.MSIS altitude and solar time (
AtmosphereBase,MsisAtmosphere), both opt-in so existing results are unchanged:setPlanetPolarRadius()gives the geodetic altitude (also used byExponentialAtmospherein the comparison);setUseApparentSolarTime()adds the equation of time to the local solar time (epochs before 1970 raise aBSK_ERROR).Time zone dependence of the environment modules (new
architecture/utilities/utcTime.h;AtmosphereBase,MsisAtmosphere,WindBase,MagneticFieldBase,MagneticFieldWMM): the UTC epoch was normalized withmktime, which uses the time zone of the computer. On a computer in a time zone with daylight saving time, the local solar time ofMsisAtmospherewas one hour wrong once a simulation crossed a transition. The epoch is now normalized as UTC withtimegm(_mkgmtimeon Windows). Simulations that did not cross a transition are unchanged.Solar flux of
FacetSRPDynamicEffector(facetSRPDynamicEffector.cpp): the module used1368 W/m^2at 1 AU whileRadiationPressureusesSOLAR_FLUX_EARTH(1361 W/m^2). Both now useSOLAR_FLUX_EARTH(1361 W/m^2), and the module takes the astronomical unit and the speed of light fromastroConstants.h(AU2M,SPEED_LIGHT) instead of local constants. The two Python tests that recompute the force use the same values.MSIS 3-hour Ap history (
MsisAtmosphere), opt-in so existing results are unchanged:setUseApHistory()sets switch 9 of NRLMSISE-00 to -1, so the model uses the 3-hour Ap array that the module already builds from messages 1 to 20 instead of the daily Ap of message 0. The default is the daily Ap, as before.PCPF2LLA()at a pole: the altitude was wrong for a position exactly at a pole of an oblate planet, where the equatorial component is zero.test_radiationPressureIntegratedTestfailed after the gravity-orientation fix because its stored truth contained the old orientation error. The truth is replaced with an independent scipy integration.Notes for reviewers:
compare_with_basilisk.pycompares the altitude and density that each tool computes at nine Earth-fixed probe points (density_probeincases.json, files<tool>_density_probe.csvwritten by the generators, with a manifest entry) against Basilisk, and stops if the altitude definition or the density differ beyond the tolerances there.compare_with_basilisk.pyvalidates it before running Basilisk and rejects a stale or mismatched reference with a message naming the field.benchmarks/and is not an automated test. The rotating-Earth cases use the high-precisionearth_000101_260711_260415.bpcandearth_assoc_itrf93.tfkernels, which are not in the support-data registry or this repository; the script looks for them with--kernel-dir, inbenchmarks/accuracyComparison/data/spice, or in the support-data cache.--oblate-shadowand--max-stepselect the Orekit default (such references get a variant label and are rejected by a default comparison unless--orekit-variantis given).Verification
utcTime, polar radius, MSIS apparent solar time and Ap history.benchmarks/tests/test_accuracy_comparison_manifest.py), and two-spacecraft tests of the all-or-nothing extrapolation (C++ and Python), and tests of messages written at the module update by a faster or slower spacecraft (C++ and Python).astroConstants.h.Documentation
Support/User/accuracyComparison.rst(linked fromSupport/User.rstand the validation bullet inindex.rst) with static tables, SVG figures, and a "Reproducing the Results" guide.gravityEffector,atmosphereBase,windBase,magneticFieldBase,eclipse,solarFlux,msisAtmosphere,facetSRPDynamicEffector.bskKnownIssues.rstentries.Future work
stateExtrapolation.h. Option 2: handle a spacecraft period that differs from the module period instead of disabling the extrapolation.ScStateExtrapolationalready observes the spacecraft period from the message write times, so the position could be extrapolated to the middle of the next spacecraft integration interval.planetRadiationBase/albedo/earth radiation,dentonFluxModel, charging).compare_with_basilisk.py(only the manifest and probe validation are tested now).