0
$\begingroup$

I've asked a few questions to do with this in the last day or so and received answers that have led to more questions...

How to use David Vallado's AstroLib to do reference frame conversions

https://space.stackexchange.com/a/61482/18594

https://softwareengineering.stackexchange.com/questions/443264/how-to-implement-converters-without-needing-to-implement-every-permutation/443273?noredirect=1#comment974333_443273


In essense, I need to convert Keplerian Orbital Definitions in this form:

[
  {
    "CCSDS_OMM_VERS": "2.0",
    "COMMENT": "GENERATED VIA SPACE-TRACK.ORG API",
    "CREATION_DATE": "2022-12-22T18:47:50",
    "ORIGINATOR": "18 SPCS",
    "OBJECT_NAME": "TBA - TO BE ASSIGNED",
    "OBJECT_ID": "",
    "CENTER_NAME": "EARTH",
    "REF_FRAME": "TEME",
    "TIME_SYSTEM": "UTC",
    "MEAN_ELEMENT_THEORY": "SGP4",
    "EPOCH": "2022-12-22T09:47:18.097440",
    "MEAN_MOTION": "12.95271318",
    "ECCENTRICITY": "0.00298554",
    "INCLINATION": "90.2548",
    "RA_OF_ASC_NODE": "337.7299",
    "ARG_OF_PERICENTER": "225.6432",
    "MEAN_ANOMALY": "134.2241",
    "EPHEMERIS_TYPE": "0",
    "CLASSIFICATION_TYPE": "U",
    "NORAD_CAT_ID": "270288",
    "ELEMENT_SET_NO": "999",
    "REV_AT_EPOCH": "12946",
    "BSTAR": "0.00171121940000",
    "MEAN_MOTION_DOT": "0.00000489",
    "MEAN_MOTION_DDOT": "0.0000000000000",
    "SEMIMAJOR_AXIS": "7658.811",
    "PERIOD": "111.174",
    "APOAPSIS": "1303.541",
    "PERIAPSIS": "1257.810",
    "OBJECT_TYPE": "UNKNOWN",
    "RCS_SIZE": null,
    "COUNTRY_CODE": null,
    "LAUNCH_DATE": null,
    "SITE": null,
    "DECAY_DATE": null,
    "FILE": "3719197",
    "GP_ID": "221188557",
    "TLE_LINE0": "0 TBA - TO BE ASSIGNED",
    "TLE_LINE1": "1 T0288U          22356.40784835  .00000489  00000-0  17112-2 0  9990",
    "TLE_LINE2": "2 T0288  90.2548 337.7299 0029855 225.6432 134.2241 12.95271318129469"
  }
]

Between TEME and J2000. (Later on, I might add other reference frames)

The prevailing wisdom seems to be to use David Vallado's Astrolib. Unfortunately, that lib seems quite poorly documented and the code is written from the perspective of an astrodynamicist, not a software engineer, so it's not exactly the most legible. I'm sure if I had his textbook, it would explain things further, but I don't have a spare £200 and a week to wait.

So, piecing together bits and bobs from various different sources, I've come up with this:

public static Orbit ConvertTEMEToJ2000(Orbit orbit)
{
    // Convert the TEME orbital elements to J2000 orbital elements
    double a = orbit.SemiMajorAxis;
    double e = orbit.Eccentricity;
    double i = orbit.Inclination;
    double argOfPeriapsis = orbit.ArgumentOfPeriapsis;
    double raan = orbit.RightAscensionOfAscendingNode;
    double m = orbit.MeanAnomaly;
    double t = (double)(DateTime.NowUtc.Year - 2000)/100;

    // Calculate precession angles
    double zeta = (2306.2181 + 1.39656 * t - 0.000139 * t * t) * 0.00001 * Math.Pi / 180;
    double z = (2306.2181 + 1.39656 * t - 0.000139 * t * t) * 0.00001 * Math.Pi / 180;
    double theta = (2004.3109 - 0.85330 * t - 0.000217 * t * t) * 0.00001 * Math.PI / 180;


    // Calculate the new longitude of the ascending node
    double newRaan = raan - zeta - theta;

    // Calculate the new argument of periapsis
    double newArgPeriapsis = argOfPeriapsis - z - theta;

    // Create a new orbit object in the J2000 reference frame
    Orbit j2000Orbit = new Orbit(a, e, i, omega2, omega1, m);
    return j2000Orbit;
}

This seems far simpler than what's in the library I mentioned, so I'm all but certain I'm missing something.

My question boils down to:

  • Is my above attempt correct?
  • If not, what algorithm is used for the conversion (I have a bounty on this question asking for the same as all other answers to that question just refer to libs).
$\endgroup$
4
  • $\begingroup$ Trying to learn the API through Stack Overflow questions is going to be a frustrating process. You can't compute the Kelperian orbit yourself, you have to use the sgp4() function. Vallado's book is $100 if you purchase it through the link you posted to the source code (astrobooks.com). Much of the overall concepts are documented in the articles on Celestrack. $\endgroup$ Jan 9 at 2:42
  • $\begingroup$ I really don't understand why swapping between two reference frames requires the use of SGP4. Surely it shouldn't be that complicated a process. I get that space-track is giving out mean element values, which is fine for what I need, so I don't see the need for SGP4? I have actually reached out to my university library to try and get a copy of the book, but it's taking a while. In an ideal world, I'd really rather understand and implement the algorithm than just consume a library, this isn't going into a commercial product. $\endgroup$ Jan 9 at 9:36
  • $\begingroup$ Several people have directed you to reading material at celestrak on your other questions. It doesn't seem like you're taking their advice. It answers all of the questions you have. $\endgroup$ Jan 9 at 16:38
  • $\begingroup$ @GregMiller - I'll have another look through the documentation tonight, it's very possible I've missed something. I haven't yet found anything in there that answers my question here. There's a fair few examples of how to use the library but this question specifically pertains to avoiding the use of a library all together. I've put in a request with my library for a copy of the textbook, but it's going to take a bit because they're having to request it from other libraries, so I'm trying to work out how to do it in the meantime. $\endgroup$ Jan 9 at 18:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.