question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong predictions for Molniya orbits

See original GitHub issue

I’m trying to predict the position of a satellite with a Molniya orbit, Molniya 3-47:

1 23642U 95042A   18058.62866679  .00000210  00000-0 -75405-2 0  9996
2 23642  62.9606 257.1441 7218342 288.9618  10.0525  2.01983768165381

The prediction turns out to be completely incorrect. The minimal example below is taken from the readme almost line-by-line:

var tleLine1 = '1 23642U 95042A   18058.62866679  .00000210  00000-0 -75405-2 0  9996',
    tleLine2 = '2 23642  62.9606 257.1441 7218342 288.9618  10.0525  2.01983768165381';
var satrec = twoline2satrec(tleLine1, tleLine2);
var positionAndVelocity = propagate(satrec, new Date());
var positionEci = positionAndVelocity.position;
var gmst = gstime(new Date());
var positionGd = eciToGeodetic(positionEci, gmst);
console.log('Molniya', positionGd.latitude * (180 / Math.PI), positionGd.longitude * (180 / Math.PI));

It gives me 39.8491516985329 -157.00043723551485, while the correct coordinates are 38.64 72.56. At other times it’s even more off. Here’s the plotting of the orbit on Google Maps:

screenshot 2018-03-01 04 20 45

In reality it’s supposed to look like this (see n2yo):

screenshot 2018-03-01 04 22 00

Predictions for any other orbit (including highly elliptical orbits, like the Tundra orbit of QZSS satellites) seem to be correct.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ezzecommented, Apr 16, 2018

@nhamer, nice catch! Thanks a lot for this.

Following Airbnb code style forced me to add many parentheses to satisfy no-mixed-operators rule. As we see now, it doesn’t give any benefits but adds headaches like this issue. Probably, it would be better to disable this rule in .eslintrc.json as it was done for function-paren-newline later. It was my mistake, sorry for this, guys.

A fix is made in https://github.com/shashwatak/satellite-js/commit/d398bd5fb880a48708c3ef6be712a595360c12b3. You can update the library to 2.0.2. @emedvedev, please check whether everything works fine for you. @dangodev, hope nothing is broken for you too.

All tests are passed but we don’t have too much tests to cover everything. If someone of you, guys, can prepare some test fixtures for Molniya 3-47 with C++ or Python version of the library, you are welcome. 😃

1reaction
nhamercommented, Apr 14, 2018

Almost certain that the issue is https://github.com/shashwatak/satellite-js/blob/226d8d5520c0cf03a591a6f0bd4ddfd8a1de0965/src/propagation/dspace.js#L248

The equivalent C code (sgpunit.cpp@1114) is: mm = xl - 2.0 * nodem + 2.0 * theta;

(slightly different runs over a few seconds, so gmstime is not identical):

Old satellite.js (irez=0): Molniya 62.97302163853729 -152.31526401326246 Current satellite.js (irez=2): Molniya 30.900731334965187 -76.42315864995993 Correcting mm irez=2) gives: Molniya 62.864247526501345 -155.86674453746895

swoopy

Read more comments on GitHub >

github_iconTop Results From Across the Web

LIVE REAL TIME SATELLITE TRACKING AND PREDICTIONS
Select any satellite orbiting the Earth and check where is located now. Check satellite passes over your location and receive alerts on your...
Read more >
Challenging the Classical 12-h Molniya Orbit Concept in
A novel type of multiple-apogee highly elliptical orbits termed as MAP HEO with a period of rotation between 14 h and 15 h...
Read more >
Kosmos 482: questions around a failed Venera lander from ...
Unlike its successful sister ship, Kosmos 482 got stuck in a 206 x 9802 kilometer, 52-degree inclined highly elliptical orbit around the Earth....
Read more >
Contemporaneous Monitoring of the Whole Dynamic Earth ...
Potential Earth observing orbits, Molniya (Red), Tundra (Green), and Geostationary (Blue). To run the simulations described in Section 2.1 for a GEO +...
Read more >
THE PREDICTION OF SATELLITE LIFETIMES - DTIC
graphical-analytical methods devised for two common types of high-eccentricity orbit -geosynchronous transfer orbits and Molniya-type orbits ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found