Sitrec - Metabunk's Situation Recreation Tool - Development Discussion

Gosh darn it! What type of graphics card/system do you have?
mine lasted 50 secs. was a bit laggy, the dot paused for a millisecond every now and then..but i have an online game on one tab and youtube playing on another. i also havent rebooted or cleaned my computer in a while.

on windows, edge browser. 8gb ram, no idea about a graphics card but a pretty cheap laptop so probably not top of the line.

this?
1662241468292.png
 
Nvidia GTX 1080, i7 6700k
It seems like the issue is my video rendering code. I've been decompressing the entire video into individual frames, just because it was easy. But that seems to be causing memory problems. I'll have to rejig it to only cache a few frames, but that's going to be complicated.

It wasn't causing me problems, seemingly because of Apple's M1 magic.
 
Added a "Focus Track" menu option that locks the cursor to a track, making inspection a lot easier, as it will rotate around the cursor and zoom appropiately. Particularly useful in Aguadilla.
http://localhost/sitrec/dist/index.html?sitch=agua

Also in Agua, improved the smoothing of the camera track by using multiple iterations of a narrower window rolling average.
 
I did a pretty major restructuring of the rendering pipeline over the last few days, just uploaded.
This should mostly be invisible. Better resolution on some displays.
The main change is to allow post-processing effects, to make the simulated view more like the original video. So far I've just done a vaguely FLIR-like pass (invert and reduce red and blue, boost greenish colors) to Aguadilla:
https://www.metabunk.org/sitrec/?sitch=agua
2022-10-12_09-07-00.jpg

This can be toggled:
2022-10-12_09-10-01.jpg

This seems to work on everything I've tried it on, but if you notice anything, then let me know, thanks.
 
- and hopefully make it available so others can use it on arbitrary videos. You can see (and use) it here:
https://www.metabunk.org/sitrec/

Hey Mick,
Any further news on this, such as how far along development is? I'm very interested in Sitrec getting to a stage where it can be used for any arbitrary video/scene

Do you have a rough time frame on releasing it (hopefully to a Github repo) so others can tinker and possibly help with development?
 
Hey Mick,
Any further news on this, such as how far along development is? I'm very interested in Sitrec getting to a stage where it can be used for any arbitrary video/scene

Do you have a rough time frame on releasing it (hopefully to a Github repo) so others can tinker and possibly help with development?
I've been a bunch of refactoring and adding things. But it's on and off. Probably going to be a while.
 
Minor fun update. Double clicking on any window will make it full screen. A quick method of removing the clutter.

2024-05-24_07-46-47.jpg


becomes

2024-05-24_07-47-02.jpg

Or:
2024-05-24_07-48-10.jpg
 
So looking in sitrec, I struggled a little to get the satellite formations to match up with what is in the video. I'm pretty sure the date & time is right and we've got the right flight & kml data, so the only other thing that could be wrong is the satellite data. I made sure I was updating the TLE for Date in sitrec, but that didnt work. So I went back to space-track.org and downloaded the archived Starlink TLEs for that date (file attached, link below , account needed) . This gives an an exact match for the satellite flares seen at 1m38 seconds in @UAPF 's video.

https://www.space-track.org/basicsp...T_ID,EPOCH/format/3le/OBJECT_NAME/STARLINK~~/

Sitrec permalink - https://www.metabunk.org/u/Po8Suo.html
View attachment 76955

(You can actually see the aircraft clock tick over from 1609hrs to 1610hrs at the 0m58s mark in the YouTube video, so the timings match up perfectly). (@Mick West - not sure why but the TLEs don't seem to updating correctly for the date in sitrec)

I'll try and do a video later.
Juicy!

I wonder if something is broken in Sitrec for the historical TLE retrieval?
 
So looking in sitrec, I struggled a little to get the satellite formations to match up with what is in the video. I'm pretty sure the date & time is right and we've got the right flight & kml data, so the only other thing that could be wrong is the satellite data. I made sure I was updating the TLE for Date in sitrec, but that didnt work. So I went back to space-track.org and downloaded the archived Starlink TLEs for that date (file attached, link below, account needed) . This gives an an exact match for the satellite flares seen at 1m38 seconds in @UAPF 's video.

https://www.space-track.org/basicsp...T_ID,EPOCH/format/3le/OBJECT_NAME/STARLINK~~/

Sitrec permalink - https://www.metabunk.org/u/Po8Suo.html
View attachment 76955

You can actually see the aircraft clock tick over from 1609hrs to 1610hrs at the 0m58s mark in the YouTube video, so the timings match up perfectly. (@Mick West - not sure why but the TLEs don't seem to updating correctly for the date in sitrec)

I'll try and do a video later.
So the difference seems to be that for your manually obtained file you used a date range of
2025-01-10--2025-01-11

But Sitrec used:
2025-01-11--2025-01-12

The Sitrec retrival is all working fine. If I go back one day to 01-10, click on "Update Starlink TLE" and then go forward to 01-11 it works fine:
2025-02-05_11-20-11.jpg


But if it then click it again (with the date 01-11) it gives a VERY different result for the exact same time.

2025-02-05_11-20-49.jpg


I'm a little bemused as to why one day should make such a radical difference, but perhaps it's related to to the way I pick which .tle element to use. Look at the difference between the files:

2025-02-05_11-26-58.jpg


Each satellite has multiple entries. Right now I just pick the last on. Looking at the differences here:

Starlink-1008 has two on 10->11 (good), but only one on 11->12 (bad).

The date format is like 25011.14150333, which is the year in the first two digits, and then a decimal for the day of the year (starting at 1, not 0). Since this is January it's easy to read

the time in the screenshot is
2025-01-11T16:10:40.155Z
which is 25011.67408

So, with the 10->11 tle, every date is before this date. With the 11->12 (bad) TLE, some date are after, some before, but since I just use the last one (the most recent) it's usually going to use a date/time that's AFTER the required date.

So my theory here is that interpolating backwards from a date is not working well. A simple fix would be to always use .TLE values that are before the date in question.

There's some validation here looking at the TLEs from the 9th, 10th and 11th. 9th and 10th are all before the needed time, and are similar

2025-02-05_11-46-55.jpg


In particular, they have all the same satellites.

But compare 10th and 11th:
2025-02-05_11-47-52.jpg


Some satellites are still close, some are missing entirely. So I'm thinking the missing ones have a date after the needed date, and the backwards interpolation is not working.

I shall address this.
 

Attachments

  • 2025-02-05_11-48-16.jpg
    2025-02-05_11-48-16.jpg
    194.4 KB · Views: 11
Last edited:
Some satellites are still close, some are missing entirely. So I'm thinking the missing ones have a date after the needed date, and the backwards interpolation is not working.

I shall address this.
For a quick fix I've just made it get the TLE from the day before. So now the behavior seems correct.

I need to improve this to always get the best TLE entry, which presumably is the nearest one that predates the current time.

Unless there's some other bug I'm missing. Should satellite.js be able to interpolate backwards?
 
Darn robots are going to take our jobs!

Mick, this is a fairly common issue with TLE propagation libraries (including the SGP4/SDP4-based satellite.js) when you try to propagate to a time that is before the TLE's epoch. The SGP4 model can mathematically propagate both forward and backward from the TLE epoch, but in practice, several factors can cause errors to blow up when you go backward in time.

Here's a formal breakdown of why that often happens:


1. TLEs Are Snapshots, Not Ephemerides

A TLE is essentially a snapshot of a satellite's orbit at a specific reference time (the "epoch"), plus some parameters (like drag term B*) that approximate the satellite's motion going forward. It was never really designed as a fully reversible ephemeris—especially far before or far after its epoch.

  • Forward vs. Backward Accuracy: The model's built-in drag parameters (and other approximations) are tuned for the time after the epoch. If you go too far backward, the model might introduce large errors, because actual atmospheric drag or maneuver changes prior to the TLE epoch aren't accounted for.

2. Sensitivity to Epoch Selection

Many operators release TLEs daily or even more frequently. Each TLE is valid in a window (often ± a few days at best) around its epoch, with best accuracy closest to that epoch.

  • If your simulation time TTT is earlier than the TLE epoch:
    • You are effectively pushing SGP4 in a direction the orbit solution was not primarily fitted for.
    • Small numerical differences or mismatched drag conditions can cause surprisingly large position errors, even with just a few hours of backward propagation.
  • If your simulation time TTT is later than the TLE epoch:
    • You'll usually see more stable results because that's precisely what TLEs are used for: forward prediction from the epoch. The error might grow over time, but it usually grows in a more predictable way.

3. The SGP4 Model Can Work Backwards, But…

Under the hood, satellite.js (which implements SGP4) simply takes your input time, calculates Δt=(time - epoch)\Delta t = \text{(time - epoch)}Δt=(time - epoch) in minutes, and plugs that into the SGP4 equations. If Δt\Delta tΔt is negative, it will do a backward propagation. Mathematically, that's allowed, but it's more prone to instability for the reasons discussed:

  1. Atmospheric Drag is Forward-Looking
    The single ballistic coefficient (B*) in a TLE is an average approximation of drag for some future period. Going backward might not reflect the real drag history.
  2. Maneuvers or Other Orbit Perturbations
    If the satellite made a maneuver before the TLE epoch, the TLE would not reflect that if you propagate backward—leading to large position and velocity mismatches.
  3. Model Limitations
    SGP4 is a simplified analytic model, not a precise numerical integrator over extended times. Short backward windows can be fine, but you might see rapidly increasing errors as you go further back.

4. Best Practices

  1. Use a TLE Epoch Before or Very Close to the Time of Interest
    • For times prior to the TLE epoch, try to obtain an older TLE that covers that time.
    • If you must propagate backward, be aware of reduced accuracy and keep the backward interval as short as possible.
  2. Check Multiple TLEs
    • If you have TLEs for multiple days, use the one with an epoch closest to (but not after) your desired time TTT.
  3. Consider a Higher-Fidelity Orbit Propagation If Accuracy Is Crucial
    • For serious historical orbit analysis, you might need a more rigorous orbital ephemeris or a numerical integrator that accounts for actual drag events, maneuvers, etc., rather than a single TLE snapshot.

Short Answer to "What Causes It?"

  • Yes, satellite.js can interpolate backward (i.e., it tries to propagate the orbit backward in time), but TLE-based SGP4 solutions are inherently less accurate the farther you get from the epoch, especially in reverse.
  • It "suddenly goes wrong" because the TLE was never intended to be used for times prior to its epoch—the simplifications and drag approximations that make SGP4 convenient become very inaccurate backward in time.
Hence, if you want consistent results at time TTT, you should use a TLE with an epoch before or very close to TTT. That will usually solve the sudden inaccuracies you're seeing.

Summary:
External Quote:

Short Answer to "What Causes It?"

  • Yes, satellite.js can interpolate backward (i.e., it tries to propagate the orbit backward in time), but TLE-based SGP4 solutions are inherently less accurate the farther you get from the epoch, especially in reverse.
  • It "suddenly goes wrong" because the TLE was never intended to be used for times prior to its epoch—the simplifications and drag approximations that make SGP4 convenient become very inaccurate backward in time.
Hence, if you want consistent results at time TTT, you should use a TLE with an epoch before or very close to TTT. That will usually solve the sudden inaccuracies you're seeing.
 
For a quick fix I've just made it get the TLE from the day before. So now the behavior seems correct.

I need to improve this to always get the best TLE entry, which presumably is the nearest one that predates the current time.
I've implemented the full fix now, and the code now requests the TLE for the current day and the previous day, and will pick the closest TLE element that precedes the sitch start date, or, if there are none, the closest one after.
 
Back
Top