Go Back   Orbiter-Forum > Blogs > SolarLiner's Blog
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

My personnal blog on pretty much everything. Dev posts goes here, non-dev posts goes here too.
Rate this Entry

AOSP Development - Read dem TLEs!

Posted 11-24-2013 at 02:03 AM by SolarLiner


I've been making some progress, some of you might know about my launcher that copies seasonal textures for you, and some knew that I worked with the library. It was kind of a testing program, I resolved a lot of bugs there (it was my first try at running it "properly"), so it was a great achievement to get it working just fine.
Though, you might ask why using AOSP just to get the description and the MJD of the scenario. I'll answer then "Why not?" and then repeat myself the paragraph above.

But anyway, there was a thing I wanted to do for ages: read TLE and transpose them into Orbiter. Well, I'm into it, and the progress are huge !
AOSP is only used to make the magic TLE -> Orbiter elements happen. The rest ("Where to put data ?" "Where to pick it on the first place?") is done by an external application. You can either choose a local TLE file, or paste a link to a TLE set. Then the application will load all the TLEs and tell AOSP to convert them. It will ask you to give it the vessel class for the current TLE (it is shown to you by the TLE name) and proceed to the next one. I know, for 20+ TLEs it is kinda boring to do in the end, I need to make something to let you enter a vessel class and take it for all the vessels. But this is not the subject of the post today.
The thing is, you can output two formats. One is the traditional scenario format, the other is only the ELEMENTS lines. So, taking This TLE set, and converting it into Orbiter Elements:
	ELEMENTS 13533.8170756595 0.0001145 0 0 105.5046 238.1262 -678580

	ELEMENTS 13253.9116486096 0.0006472 0 0 317.9962 189.7956 -678580

	ELEMENTS 13542.8059613007 9.89E-05 0 0 126.4609 354.0773 -678580

	ELEMENTS 13515.6865895502 0.0003919 0 0 33.8788 100.9129 -678580

	ELEMENTS 13511.5410425493 0.0003412 0 0 37.093 97.6629 -678580

	ELEMENTS 13514.913016011 0.000419 0 0 34.6651 100.1025 -678580

	ELEMENTS 13504.235955324 0.0002346 0 0 294.3197 148.2891 -678580
The Orbiter Scenario Elite, or the ones that are actually quite good with scenario making, will see the huge mistake. Well, I don't. I mean, I know what every number do, but I can't make an orbit out of my head with these numbers. So if one can help me with that, I'll be happy

For the ones that are intrested: (but don't take my work as reference, as I surely made a lot of mistakes!)
This is a TLE template, the X chars are ignored by AOSP, the | does not count as a char, it is just here to show that AOSP treat that as two parameters:
CCCCCCCCCC (taken by OrbVessel)
We have here:
  1. Last two digits of the year
  2. Day number (and how far in the day)
  3. Inclination []
  4. Ascending Node []
  5. Eccentricity
  6. Argument of Perigee []
  7. Mean Anomaly []
  8. Mean Motion [Rev/day]

And this is where the headaches math starts.

Easy ones first, we have the Inclination, which needs nothing to change.
Same for the Argument of Perigee (Pe Longitude), and the Right Ascension of Ascending Node (AscNode Longitude).
The eccentricity is pretty simple as well, as we just have to add the leading decimal.
The Semi-Major Axis makes the things pretty complicated. Since we don't have a direct implementation in TLE (would have been too easy), we will have to get it ... from the Mean Motion!
a = \frac{6.228}{N^{2/3}}*6371

Here, the division returns the semi-major axis in Earth radii. So, jst multiply by the mean radius to get a meter sma !
We see then that as the Mean Motion increases, the SMA decreases and that's just fine because the closer you get the faster you will travel with less distance. So you will make more revolutions a day.

The reference date is calculated with the remaining data: the epoch year and day. We just have to check if the date is "under 57" to verify if the epoch is on the 1900s or in the 2000s, and then use the days to fine-tune the epoch. Then, transform the date into MJD and you're done !

double M = double.Parse(tle2[4]);
double N = double.Parse(tle2[5]);

el.Inc = double.Parse(tle2[0]);
el.AscNode = double.Parse(tle2[1]);
el.Ecc = double.Parse("0." + tle2[2]);
el.PeLong = double.Parse(tle2[3]);
el.SMA = (6.6228d / Math.Pow(N, 2d / 3d)) * 6371;
el.MeanLong = M;

string yr = (int.Parse(tle1[0]) < DateTime.Now.Year - 2000 ? "20" + tle1[0] : "19" + tle1[0]);
int iYr = int.Parse(yr);
float dys = float.Parse(tle1[1]);

DateTime dt = new DateTime();

el.ReferenceMJD = Misc.GetMJD(dt);
Well, there's something that doesn't work for me, and I don't know what.
I might have exploded your eyes with my orbital calculation mistakes here but you helped science !

Thanks for reading and happy orbiting !
« Prev     Main     Next »
Total Comments 0



All times are GMT. The time now is 09:52 PM.

Quick Links Need Help?

About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.