Code Monkey home page Code Monkey logo

predict's Introduction

Overview

Predict is a partial PHP port of the Gpredict program that allows real-time tracking and orbit prediction of satellites from two line element sets. It supports the SGP4 and SDP4 models for prediction.

Installation

Just clone this repo and try out the tests and examples from the root of the checkout.

Examples/Tests

The tests directory includes a port of the original sgpsdp test files from Gpredict. They are pretty close.

Included in the examples directory is a sample iss.tle (with an update script, which you should run first). There are two examples, the visible_passes.php script and the benchmark.php script. The former is for generating visible pass predictions of the ISS, and its output is similar to what you might get from the Heavens-Above website, and it is heavily commented. The latter just does predictions for benchmarking with xhprof.

You can see an image of a Predict/Google Maps API mash-up I did for fun:

Google Maps Mashup

You can also see an example visible pass plotted from the polar view of the observer:

Google Maps Mashup

About this port

This port largely maintains the style and organization of the original C code, but scopes methods into classes rather than leaving everything in the global scope. The motivation for this is so that changes upstream can more easily be integrated over time. Only the prediction routines have been ported.

predict's People

Contributors

shupp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

predict's Issues

Use future time stamp for TLE epoch date

Firstly, many thanks for your work on this, it's been a number of years since you developed it but it's still working well with PHP 7.4 today!

As I understand it the orbit data is derived from the epoch timestamp in the TLE, if I want to run a prediction for orbit data for the next X hours how can I pass in a custom epoch timestamp?

just retrieve a lat long from TLE

Hi there and thanks for your work.
I would like to retrieve the actual position (lat,long,alt) of a satellite using it tle

is there an easy way to achieve this with your library ?

thx

Generate the polar view

Hi,
First of all thank you for your work, it is very useful to me.

I was wondering what tools did you use to generate this polar view? :

Regards,

Baptiste

find_aos

While running the examples, system hangs and never returns. I used benchmark.php to pinout the problem.
in find_aos there is a while loop that never returns as it never meets its exit criteria

            /* coarse time steps */
            while (($sat->el < -1.0) && ($t <= ($start + $maxdt))) {
                $t -= 0.00035 * ($sat->el * (($sat->alt / 8400.0) + 0.46) - 2.0);
                $this->predict_calc($sat, $qth, $t);
	    }

I have logged the values pr. iteration but could not upload the file by some reason, but what I see is that $t does not change much pr iteration, the same goes for $sat->el. Result is that the while never returns

The values below is representative for millions of iterations

Questions is if there is php modules that is needed for this to work other than the default installed.

iterations sat->el sat->alt t start maxdt
0 -73,975175626402 -4560,103514259 2459617,4481556 2459617,4481556 10
1 -73,87032519055 -4561,181733378 2459617,44671 2459617,4481556 10
2 -73,464149095807 -4560,5291291953 2459617,4452641 2459617,4481556 10
3 -75,310423177676 -4563,847366679 2459617,443832 2459617,4481556 10
4 -78,015114451347 -4566,4703585768 2459617,442336 2459617,4481556 10
5 -77,516865451781 -4560,4099581754 2459617,4407525 2459617,4481556 10
6 -74,636932324811 -4554,8049470713 2459617,4392032 2459617,4481556 10
7 -73,668009331926 -4557,434459539 2459617,4377549 2459617,4481556 10
8 -74,451387515641 -4561,3075714539 2459617,4363264 2459617,4481556 10
9 -73,65694944637 -4560,7715054378 2459617,4348632 2459617,4481556 10
10 -73,875387357264 -4561,5292445828 2459617,4334248 2459617,4481556 10
11 -76,699016024553 -4565,749786223 2459617,4319777 2459617,4481556 10
12 -78,917294329151 -4565,075014268 2459617,4304351 2459617,4481556 10
13 -76,604863196001 -4557,2245809497 2459617,4288298 2459617,4481556 10
14 -73,886629026637 -4555,2627792388 2459617,4273171 2459617,4481556 10
15 -74,156655017189 -4559,6561184997 2459617,425889 2459617,4481556 10
16 -74,689487120297 -4561,5841579956 2459617,4244395 2459617,4481556 10
17 -73,409089479928 -4560,6666999958 2459617,4229686 2459617,4481556 10
18 -74,876013372407 -4563,4031843497 2459617,4215376 2459617,4481556 10

visible_passes example produces no output

I run the visible_passes.php and it only outputs the execution time. I run the update_iss_tle.php, switched to the Munich coordinates no change. (PHP 7.3.11)

I also run the tests:
test-001:

DEEP_SPACE_EPHEM: 0 (expected: 0)

+-----------+-------+-------------------+----------------+
| step time | label | result            | expected       |
+-----------+-------+-------------------+----------------+
| 0         | X     | 2328.970679894    | 2328.97048951  |
|           | Y     | -5995.2208365303  | -5995.22076416 |
|           | Z     | 1719.970675003    | 1719.97067261  |
|           | VX    | 2.9120722684876   | 2.9120723      |
|           | VY    | -0.98341533361961 | -0.98341546    |
|           | VZ    | -7.0908169591995  | -7.09081703    |
| 360       | X     | 2456.1078185219   | 2456.10705566  |
|           | Y     | -6071.9386872949  | -6071.9385376  |
|           | Z     | 1222.8956529742   | 1222.89727783  |
|           | VX    | 2.6793891170929   | 2.67938992     |
|           | VY    | -0.44828850697443 | -0.44829041    |
|           | VZ    | -7.2287926088171  | -7.22879231    |
| 720       | X     | 2567.5628174962   | 2567.56195068  |
|           | Y     | -6112.5038266594  | -6112.50384522 |
|           | Z     | 713.96223091205   | 713.963974     |
|           | VX    | 2.4402450448499   | 2.44024599     |
|           | VY    | 0.098110705997632 | 0.09810869     |
|           | VZ    | -7.3199594406421  | -7.31995916    |
| 1080      | X     | 2663.089901107    | 2663.0907898   |
|           | Y     | -6115.4828512355  | -6115.4822998  |
|           | Z     | 196.39997365938   | 196.39640427   |
|           | VX    | 2.1961212031747   | 2.19611958     |
|           | VY    | 0.65241593650208  | 0.65241995     |
|           | VZ    | -7.3628241569699  | -7.36282432    |
| 1440      | X     | 2742.5539796449   | 2742.55133057  |
|           | Y     | -6079.6701380186  | -6079.67144775 |
|           | Z     | -326.38990977996  | -326.38095856  |
|           | VX    | 1.9484977623213   | 1.94850229     |
|           | VY    | 1.2110724358902   | 1.21106251     |
|           | VZ    | -7.3561931161315  | -7.35619372    |
+-----------+-------+-------------------+----------------+
Execution time: 1.42ms

test-002:

DEEP_SPACE_EPHEM: 64 (expected: 64)

+-----------+-------+-------------------+------------------+
| step time | label | result            | expected         |
+-----------+-------+-------------------+------------------+
| 0         | X     | 7495.2201411522   | 7473.3706665     |
|           | Y     | 462.94809890153   | 428.95261765     |
|           | Z     | 5835.8349041958   | 5828.74786377    |
|           | VX    | 5.0882603867801   | 5.1071513        |
|           | VY    | 6.443501397454    | 6.44468284       |
|           | VZ    | -0.19471250013834 | -0.18613096      |
| 360       | X     | -3288.9442643066  | -3305.22537232   |
|           | Y     | 32406.513820666   | 32410.86328125   |
|           | Z     | -24698.039221757  | -24697.17675781  |
|           | VX    | -1.3007845995153  | -1.30113538      |
|           | VY    | -1.152411491841   | -1.15131518      |
|           | VZ    | -0.28406152599689 | -0.28333528      |
| 720       | X     | 14274.027501406   | 14271.28759766   |
|           | Y     | 24124.319408041   | 24110.46411133   |
|           | Z     | -4717.544641732   | -4725.76837158   |
|           | VX    | -0.31979616237533 | -0.32050445      |
|           | VY    | 2.6780090133369   | 2.67984074       |
|           | VZ    | -2.083730161548   | -2.08405289      |
| 1080      | X     | -9974.2370793588  | -9990.05883789   |
|           | Y     | 22705.004307077   | 22717.35522461   |
|           | Z     | -23620.751174898  | -23616.890662501 |
|           | VX    | -1.0168297875949  | -1.01667246      |
|           | VY    | -2.2917181849532  | -2.29026759      |
|           | VZ    | 0.72887185127627  | 0.72892364       |
| 1440      | X     | 9796.1208521507   | 9787.86975097    |
|           | Y     | 33758.707410724   | 33753.34667969   |
|           | Z     | -15022.996600166  | -15030.81176758  |
|           | VX    | -1.0932750515211  | -1.09425966      |
|           | VY    | 0.92249936983212  | 0.92358845       |
|           | VZ    | -1.5229952073342  | -1.52230928      |
+-----------+-------+-------------------+------------------+
Execution time: 1.82ms

I also tried with a well known tle&qth location with a valid pass in ~1 hour in the feature, same result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.