@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | </span> |
4 | 4 | <div class="sub-menu sub-menu-container"> |
5 | 5 | <ul class="nav nav-pills"> |
6 | - <li><a href="<?php print $globalURL; ?>/country/<?php print $country; ?>" <?php if (strtolower($current_page) == "country-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
6 | + <li><a href="<?php print $globalURL; ?>/country/<?php print $country; ?>" <?php if (strtolower($current_page) == "country-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
7 | 7 | <li class="dropdown"> |
8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "country-statistics-aircraft" || strtolower($current_page) == "country-statistics-registration" || strtolower($current_page) == "country-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "country-statistics-aircraft" || strtolower($current_page) == "country-statistics-registration" || strtolower($current_page) == "country-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
10 | 10 | </a> |
11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | </ul> |
16 | 16 | </li> |
17 | 17 | <li class="dropdown"> |
18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "country-statistics-airline" || strtolower($current_page) == "country-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "country-statistics-airline" || strtolower($current_page) == "country-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
19 | 19 | <?php echo _("Airline"); ?> <span class="caret"></span> |
20 | 20 | </a> |
21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | </ul> |
25 | 25 | </li> |
26 | 26 | <li class="dropdown"> |
27 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "country-statistics-departure-airport" || strtolower($current_page) == "country-statistics-departure-airport-country" || strtolower($current_page) == "country-statistics-arrival-airport" || strtolower($current_page) == "country-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
27 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "country-statistics-departure-airport" || strtolower($current_page) == "country-statistics-departure-airport-country" || strtolower($current_page) == "country-statistics-arrival-airport" || strtolower($current_page) == "country-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
28 | 28 | <?php echo _("Airport"); ?> <span class="caret"></span> |
29 | 29 | </a> |
30 | 30 | <ul class="dropdown-menu" role="menu"> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <li><a href="<?php print $globalURL; ?>/country/statistics/arrival-airport-country/<?php print $country; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
35 | 35 | </ul> |
36 | 36 | </li> |
37 | - <li><a href="<?php print $globalURL; ?>/country/statistics/route/<?php print $country; ?>" <?php if (strtolower($current_page) == "country-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
38 | - <li><a href="<?php print $globalURL; ?>/country/statistics/time/<?php print $country; ?>" <?php if (strtolower($current_page) == "country-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
37 | + <li><a href="<?php print $globalURL; ?>/country/statistics/route/<?php print $country; ?>" <?php if (strtolower($current_page) == "country-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
38 | + <li><a href="<?php print $globalURL; ?>/country/statistics/time/<?php print $country; ?>" <?php if (strtolower($current_page) == "country-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
39 | 39 | </ul> |
40 | 40 | </div> |
41 | 41 | \ No newline at end of file |
@@ -8,7 +8,9 @@ |
||
8 | 8 | if ($registration != '') { |
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | -} else $spotter_array=array(); |
|
11 | +} else { |
|
12 | + $spotter_array=array(); |
|
13 | +} |
|
12 | 14 | |
13 | 15 | if (!empty($spotter_array)) |
14 | 16 | { |
@@ -3,16 +3,16 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort=filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($registration != '') { |
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | -} else $spotter_array=array(); |
|
11 | +} else $spotter_array = array(); |
|
12 | 12 | |
13 | 13 | if (!empty($spotter_array)) |
14 | 14 | { |
15 | - $title = sprintf(_("Most Common Arrival Airports of aircraft with registration %s"),$registration); |
|
15 | + $title = sprintf(_("Most Common Arrival Airports of aircraft with registration %s"), $registration); |
|
16 | 16 | |
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | include('registration-sub-menu.php'); |
26 | 26 | print '<div class="column">'; |
27 | 27 | print '<h2>'._("Most Common Arrival Airports").'</h2>'; |
28 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>'; |
|
28 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>'; |
|
29 | 29 | $airport_airport_array = $Spotter->countAllArrivalAirportsByRegistration($registration); |
30 | 30 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
31 | 31 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | print '<script>'; |
35 | 35 | print 'var series = ['; |
36 | 36 | $airport_data = ''; |
37 | - foreach($airport_airport_array as $airport_item) |
|
37 | + foreach ($airport_airport_array as $airport_item) |
|
38 | 38 | { |
39 | 39 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_name'].' ('.$airport_item['airport_arrival_icao'].')",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
40 | 40 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | print '</thead>'; |
89 | 89 | print '<tbody>'; |
90 | 90 | $i = 1; |
91 | - foreach($airport_airport_array as $airport_item) |
|
91 | + foreach ($airport_airport_array as $airport_item) |
|
92 | 92 | { |
93 | 93 | print '<tr>'; |
94 | 94 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,7 +8,9 @@ |
||
8 | 8 | if ($registration != '') { |
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | -} else $spotter_array=array(); |
|
11 | +} else { |
|
12 | + $spotter_array=array(); |
|
13 | +} |
|
12 | 14 | |
13 | 15 | if (!empty($spotter_array)) |
14 | 16 | { |
@@ -3,16 +3,16 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($registration != '') { |
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | -} else $spotter_array=array(); |
|
11 | +} else $spotter_array = array(); |
|
12 | 12 | |
13 | 13 | if (!empty($spotter_array)) |
14 | 14 | { |
15 | - $title = sprintf(_("Most Common Arrival Airports by Country of aircraft with registration %s"),$registration); |
|
15 | + $title = sprintf(_("Most Common Arrival Airports by Country of aircraft with registration %s"), $registration); |
|
16 | 16 | require_once('header.php'); |
17 | 17 | print '<div class="info column">'; |
18 | 18 | print '<h1>'.$registration.' - '.$aircraft_array[0]['aircraft_name'].' ('.$aircraft_array[0]['aircraft_icao'].')</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('registration-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>'; |
|
28 | 28 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByRegistration($registration); |
29 | 29 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
30 | 30 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
33 | 33 | print 'var series = ['; |
34 | 34 | $country_data = ''; |
35 | - foreach($airport_country_array as $airport_item) |
|
35 | + foreach ($airport_country_array as $airport_item) |
|
36 | 36 | { |
37 | 37 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
38 | 38 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | print '</thead>'; |
80 | 80 | print '<tbody>'; |
81 | 81 | $i = 1; |
82 | - foreach($airport_country_array as $airport_item) |
|
82 | + foreach ($airport_country_array as $airport_item) |
|
83 | 83 | { |
84 | 84 | print '<tr>'; |
85 | 85 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -35,7 +35,9 @@ |
||
35 | 35 | $first = ''; |
36 | 36 | foreach($data as $value => $key) { |
37 | 37 | $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
38 | - if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
38 | + if ($first == '') { |
|
39 | + $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
40 | + } |
|
39 | 41 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
40 | 42 | } |
41 | 43 | $output .= $first; |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | header('Content-Type: text/javascript'); |
18 | 18 | |
19 | 19 | |
20 | -$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
20 | +$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
21 | 21 | $output = '{"type": "FeatureCollection","features": ['; |
22 | 22 | if (!empty($polar)) { |
23 | - foreach($polar as $eachpolar) { |
|
23 | + foreach ($polar as $eachpolar) { |
|
24 | 24 | $data = json_decode($eachpolar['source_data']); |
25 | 25 | $name = $eachpolar['source_name']; |
26 | 26 | $coord = $Location->getLocationInfobySourceName($name); |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | $initial_longitude = $globalCenterLongitude; |
34 | 34 | } |
35 | 35 | $first = ''; |
36 | - foreach($data as $value => $key) { |
|
37 | - $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
|
38 | - if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
36 | + foreach ($data as $value => $key) { |
|
37 | + $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude, $initial_longitude, $value*22.5, $key); |
|
38 | + if ($first == '') $first = '['.round($final_coord['longitude'], 5).','.round($final_coord['latitude'], 5).']'; |
|
39 | 39 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
40 | 40 | } |
41 | 41 | $output .= $first; |
42 | 42 | $output .= ']]}},'; |
43 | 43 | } |
44 | - $output = substr($output, 0, -1); |
|
44 | + $output = substr($output, 0, -1); |
|
45 | 45 | } |
46 | 46 | $output .= ']}'; |
47 | 47 | print $output; |
@@ -146,20 +146,6 @@ discard block |
||
146 | 146 | |
147 | 147 | /** Predict first pass after a certain time. |
148 | 148 | * |
149 | - * @param Predict_Sat $sat The satellite data. |
|
150 | - * @param Predict_QTH $qth The observer's location data. |
|
151 | - * @param float $start Starting time. |
|
152 | - * @param int $maxdt The maximum number of days to look ahead (0 for no limit). |
|
153 | - * |
|
154 | - * @return Predict_Pass or NULL if there was an error. |
|
155 | - * |
|
156 | - * This function will find the first upcoming pass with AOS no earlier than |
|
157 | - * t = start and no later than t = (start+maxdt). |
|
158 | - * |
|
159 | - * note For no time limit use maxdt = 0.0 |
|
160 | - * |
|
161 | - * note the data in sat will be corrupt (future) and must be refreshed |
|
162 | - * by the caller, if the caller will need it later on |
|
163 | 149 | */ |
164 | 150 | public function get_pass(Predict_Sat $sat_in, Predict_QTH $qth, $start, $maxdt) |
165 | 151 | { |
@@ -407,7 +393,7 @@ discard block |
||
407 | 393 | * @param Predict_QTH $qth The observer's location (QTH) data. |
408 | 394 | * @param float $start The julian date where calculation should start. |
409 | 395 | * @param int $maxdt The upper time limit in days (0.0 = no limit) |
410 | - * @return The julain date of the next AOS or 0.0 if the satellite has no AOS. |
|
396 | + * @return double julain date of the next AOS or 0.0 if the satellite has no AOS. |
|
411 | 397 | * |
412 | 398 | * This function finds the time of AOS for the first coming pass taking place |
413 | 399 | * no earlier that start. |
@@ -563,7 +549,7 @@ discard block |
||
563 | 549 | * @param Predict_QTH $qth The QTH observer location data. |
564 | 550 | * @param float $start The time where calculation should start. (Julian Date) |
565 | 551 | * @param int $maxdt The upper time limit in days (0.0 = no limit) |
566 | - * @return The time (julian date) of the next LOS or 0.0 if the satellite has no LOS. |
|
552 | + * @return double time (julian date) of the next LOS or 0.0 if the satellite has no LOS. |
|
567 | 553 | * |
568 | 554 | * This function finds the time of LOS for the first coming pass taking place |
569 | 555 | * no earlier that start. |
@@ -648,7 +634,7 @@ discard block |
||
648 | 634 | * @param Predict_Sat $sat The satellite to find AOS for. |
649 | 635 | * @param Predict_QTH $qth The ground station. |
650 | 636 | * @param float $start Start time, prefereably now. |
651 | - * @return The time of the previous AOS or 0.0 if the satellite has no AOS. |
|
637 | + * @return double time of the previous AOS or 0.0 if the satellite has no AOS. |
|
652 | 638 | * |
653 | 639 | * This function can be used to find the AOS time in the past of the |
654 | 640 | * current pass. |
@@ -52,824 +52,824 @@ |
||
52 | 52 | */ |
53 | 53 | class Predict |
54 | 54 | { |
55 | - const de2ra = 1.74532925E-2; /* Degrees to Radians */ |
|
56 | - const pi = 3.1415926535898; /* Pi */ |
|
57 | - const pio2 = 1.5707963267949; /* Pi/2 */ |
|
58 | - const x3pio2 = 4.71238898; /* 3*Pi/2 */ |
|
59 | - const twopi = 6.2831853071796; /* 2*Pi */ |
|
60 | - const e6a = 1.0E-6; |
|
61 | - const tothrd = 6.6666667E-1; /* 2/3 */ |
|
62 | - const xj2 = 1.0826158E-3; /* J2 Harmonic */ |
|
63 | - const xj3 = -2.53881E-6; /* J3 Harmonic */ |
|
64 | - const xj4 = -1.65597E-6; /* J4 Harmonic */ |
|
65 | - const xke = 7.43669161E-2; |
|
66 | - const xkmper = 6.378135E3; /* Earth radius km */ |
|
67 | - const xmnpda = 1.44E3; /* Minutes per day */ |
|
68 | - const km2mi = 0.621371; /* Kilometers per Mile */ |
|
69 | - const ae = 1.0; |
|
70 | - const ck2 = 5.413079E-4; |
|
71 | - const ck4 = 6.209887E-7; |
|
72 | - const __f = 3.352779E-3; |
|
73 | - const ge = 3.986008E5; |
|
74 | - const __s__ = 1.012229; |
|
75 | - const qoms2t = 1.880279E-09; |
|
76 | - const secday = 8.6400E4; /* Seconds per day */ |
|
77 | - const omega_E = 1.0027379; |
|
78 | - const omega_ER = 6.3003879; |
|
79 | - const zns = 1.19459E-5; |
|
80 | - const c1ss = 2.9864797E-6; |
|
81 | - const zes = 1.675E-2; |
|
82 | - const znl = 1.5835218E-4; |
|
83 | - const c1l = 4.7968065E-7; |
|
84 | - const zel = 5.490E-2; |
|
85 | - const zcosis = 9.1744867E-1; |
|
86 | - const zsinis = 3.9785416E-1; |
|
87 | - const zsings = -9.8088458E-1; |
|
88 | - const zcosgs = 1.945905E-1; |
|
89 | - const zcoshs = 1; |
|
90 | - const zsinhs = 0; |
|
91 | - const q22 = 1.7891679E-6; |
|
92 | - const q31 = 2.1460748E-6; |
|
93 | - const q33 = 2.2123015E-7; |
|
94 | - const g22 = 5.7686396; |
|
95 | - const g32 = 9.5240898E-1; |
|
96 | - const g44 = 1.8014998; |
|
97 | - const g52 = 1.0508330; |
|
98 | - const g54 = 4.4108898; |
|
99 | - const root22 = 1.7891679E-6; |
|
100 | - const root32 = 3.7393792E-7; |
|
101 | - const root44 = 7.3636953E-9; |
|
102 | - const root52 = 1.1428639E-7; |
|
103 | - const root54 = 2.1765803E-9; |
|
104 | - const thdt = 4.3752691E-3; |
|
105 | - const rho = 1.5696615E-1; |
|
106 | - const mfactor = 7.292115E-5; |
|
107 | - const __sr__ = 6.96000E5; /*Solar radius - kilometers (IAU 76)*/ |
|
108 | - const AU = 1.49597870E8; /*Astronomical unit - kilometers (IAU 76)*/ |
|
109 | - |
|
110 | - /* visibility constants */ |
|
111 | - const SAT_VIS_NONE = 0; |
|
112 | - const SAT_VIS_VISIBLE = 1; |
|
113 | - const SAT_VIS_DAYLIGHT = 2; |
|
114 | - const SAT_VIS_ECLIPSED = 3; |
|
115 | - |
|
116 | - /* preferences */ |
|
117 | - public $minEle = 10; // Minimum elevation |
|
118 | - public $timeRes = 10; // Pass details: time resolution |
|
119 | - public $numEntries = 20; // Pass details: number of entries |
|
120 | - public $threshold = -6; // Twilight threshold |
|
121 | - |
|
122 | - /** |
|
123 | - * Predict the next pass. |
|
124 | - * |
|
125 | - * This function simply wraps the get_pass function using the current time |
|
126 | - * as parameter. |
|
127 | - * |
|
128 | - * Note: the data in sat will be corrupt (future) and must be refreshed |
|
129 | - * by the caller, if the caller will need it later on (eg. if the caller |
|
130 | - * is GtkSatList). |
|
131 | - * |
|
132 | - * @param Predict_Sat $sat The satellite data. |
|
133 | - * @param Predict_QTH $qth The observer data. |
|
134 | - * @param int $maxdt The maximum number of days to look ahead. |
|
135 | - * |
|
136 | - * @return Predict_Pass Pointer instance or NULL if no pass can be |
|
137 | - * found. |
|
138 | - */ |
|
139 | - public function get_next_pass(Predict_Sat $sat, Predict_QTH $qth, $maxdt) |
|
140 | - { |
|
141 | - /* get the current time and call the get_pass function */ |
|
142 | - $now = Predict_Time::get_current_daynum(); |
|
143 | - |
|
144 | - return $this->get_pass($sat, $qth, $now, $maxdt); |
|
145 | - } |
|
146 | - |
|
147 | - /** Predict first pass after a certain time. |
|
148 | - * |
|
149 | - * @param Predict_Sat $sat The satellite data. |
|
150 | - * @param Predict_QTH $qth The observer's location data. |
|
151 | - * @param float $start Starting time. |
|
152 | - * @param int $maxdt The maximum number of days to look ahead (0 for no limit). |
|
153 | - * |
|
154 | - * @return Predict_Pass or NULL if there was an error. |
|
155 | - * |
|
156 | - * This function will find the first upcoming pass with AOS no earlier than |
|
157 | - * t = start and no later than t = (start+maxdt). |
|
158 | - * |
|
159 | - * note For no time limit use maxdt = 0.0 |
|
160 | - * |
|
161 | - * note the data in sat will be corrupt (future) and must be refreshed |
|
162 | - * by the caller, if the caller will need it later on |
|
163 | - */ |
|
164 | - public function get_pass(Predict_Sat $sat_in, Predict_QTH $qth, $start, $maxdt) |
|
165 | - { |
|
166 | - $aos = 0.0; /* time of AOS */ |
|
167 | - $tca = 0.0; /* time of TCA */ |
|
168 | - $los = 0.0; /* time of LOS */ |
|
169 | - $dt = 0.0; /* time diff */ |
|
170 | - $step = 0.0; /* time step */ |
|
171 | - $t0 = $start; |
|
172 | - $tres = 0.0; /* required time resolution */ |
|
173 | - $max_el = 0.0; /* maximum elevation */ |
|
174 | - $pass = null; |
|
175 | - $detail = null; |
|
176 | - $done = false; |
|
177 | - $iter = 0; /* number of iterations */ |
|
178 | - /* FIXME: watchdog */ |
|
179 | - |
|
180 | - /*copy sat_in to a working structure*/ |
|
181 | - $sat = clone $sat_in; |
|
182 | - $sat_working = clone $sat_in; |
|
183 | - |
|
184 | - /* get time resolution; sat-cfg stores it in seconds */ |
|
185 | - $tres = $this->timeRes / 86400.0; |
|
186 | - |
|
187 | - /* loop until we find a pass with elevation > SAT_CFG_INT_PRED_MIN_EL |
|
55 | + const de2ra = 1.74532925E-2; /* Degrees to Radians */ |
|
56 | + const pi = 3.1415926535898; /* Pi */ |
|
57 | + const pio2 = 1.5707963267949; /* Pi/2 */ |
|
58 | + const x3pio2 = 4.71238898; /* 3*Pi/2 */ |
|
59 | + const twopi = 6.2831853071796; /* 2*Pi */ |
|
60 | + const e6a = 1.0E-6; |
|
61 | + const tothrd = 6.6666667E-1; /* 2/3 */ |
|
62 | + const xj2 = 1.0826158E-3; /* J2 Harmonic */ |
|
63 | + const xj3 = -2.53881E-6; /* J3 Harmonic */ |
|
64 | + const xj4 = -1.65597E-6; /* J4 Harmonic */ |
|
65 | + const xke = 7.43669161E-2; |
|
66 | + const xkmper = 6.378135E3; /* Earth radius km */ |
|
67 | + const xmnpda = 1.44E3; /* Minutes per day */ |
|
68 | + const km2mi = 0.621371; /* Kilometers per Mile */ |
|
69 | + const ae = 1.0; |
|
70 | + const ck2 = 5.413079E-4; |
|
71 | + const ck4 = 6.209887E-7; |
|
72 | + const __f = 3.352779E-3; |
|
73 | + const ge = 3.986008E5; |
|
74 | + const __s__ = 1.012229; |
|
75 | + const qoms2t = 1.880279E-09; |
|
76 | + const secday = 8.6400E4; /* Seconds per day */ |
|
77 | + const omega_E = 1.0027379; |
|
78 | + const omega_ER = 6.3003879; |
|
79 | + const zns = 1.19459E-5; |
|
80 | + const c1ss = 2.9864797E-6; |
|
81 | + const zes = 1.675E-2; |
|
82 | + const znl = 1.5835218E-4; |
|
83 | + const c1l = 4.7968065E-7; |
|
84 | + const zel = 5.490E-2; |
|
85 | + const zcosis = 9.1744867E-1; |
|
86 | + const zsinis = 3.9785416E-1; |
|
87 | + const zsings = -9.8088458E-1; |
|
88 | + const zcosgs = 1.945905E-1; |
|
89 | + const zcoshs = 1; |
|
90 | + const zsinhs = 0; |
|
91 | + const q22 = 1.7891679E-6; |
|
92 | + const q31 = 2.1460748E-6; |
|
93 | + const q33 = 2.2123015E-7; |
|
94 | + const g22 = 5.7686396; |
|
95 | + const g32 = 9.5240898E-1; |
|
96 | + const g44 = 1.8014998; |
|
97 | + const g52 = 1.0508330; |
|
98 | + const g54 = 4.4108898; |
|
99 | + const root22 = 1.7891679E-6; |
|
100 | + const root32 = 3.7393792E-7; |
|
101 | + const root44 = 7.3636953E-9; |
|
102 | + const root52 = 1.1428639E-7; |
|
103 | + const root54 = 2.1765803E-9; |
|
104 | + const thdt = 4.3752691E-3; |
|
105 | + const rho = 1.5696615E-1; |
|
106 | + const mfactor = 7.292115E-5; |
|
107 | + const __sr__ = 6.96000E5; /*Solar radius - kilometers (IAU 76)*/ |
|
108 | + const AU = 1.49597870E8; /*Astronomical unit - kilometers (IAU 76)*/ |
|
109 | + |
|
110 | + /* visibility constants */ |
|
111 | + const SAT_VIS_NONE = 0; |
|
112 | + const SAT_VIS_VISIBLE = 1; |
|
113 | + const SAT_VIS_DAYLIGHT = 2; |
|
114 | + const SAT_VIS_ECLIPSED = 3; |
|
115 | + |
|
116 | + /* preferences */ |
|
117 | + public $minEle = 10; // Minimum elevation |
|
118 | + public $timeRes = 10; // Pass details: time resolution |
|
119 | + public $numEntries = 20; // Pass details: number of entries |
|
120 | + public $threshold = -6; // Twilight threshold |
|
121 | + |
|
122 | + /** |
|
123 | + * Predict the next pass. |
|
124 | + * |
|
125 | + * This function simply wraps the get_pass function using the current time |
|
126 | + * as parameter. |
|
127 | + * |
|
128 | + * Note: the data in sat will be corrupt (future) and must be refreshed |
|
129 | + * by the caller, if the caller will need it later on (eg. if the caller |
|
130 | + * is GtkSatList). |
|
131 | + * |
|
132 | + * @param Predict_Sat $sat The satellite data. |
|
133 | + * @param Predict_QTH $qth The observer data. |
|
134 | + * @param int $maxdt The maximum number of days to look ahead. |
|
135 | + * |
|
136 | + * @return Predict_Pass Pointer instance or NULL if no pass can be |
|
137 | + * found. |
|
138 | + */ |
|
139 | + public function get_next_pass(Predict_Sat $sat, Predict_QTH $qth, $maxdt) |
|
140 | + { |
|
141 | + /* get the current time and call the get_pass function */ |
|
142 | + $now = Predict_Time::get_current_daynum(); |
|
143 | + |
|
144 | + return $this->get_pass($sat, $qth, $now, $maxdt); |
|
145 | + } |
|
146 | + |
|
147 | + /** Predict first pass after a certain time. |
|
148 | + * |
|
149 | + * @param Predict_Sat $sat The satellite data. |
|
150 | + * @param Predict_QTH $qth The observer's location data. |
|
151 | + * @param float $start Starting time. |
|
152 | + * @param int $maxdt The maximum number of days to look ahead (0 for no limit). |
|
153 | + * |
|
154 | + * @return Predict_Pass or NULL if there was an error. |
|
155 | + * |
|
156 | + * This function will find the first upcoming pass with AOS no earlier than |
|
157 | + * t = start and no later than t = (start+maxdt). |
|
158 | + * |
|
159 | + * note For no time limit use maxdt = 0.0 |
|
160 | + * |
|
161 | + * note the data in sat will be corrupt (future) and must be refreshed |
|
162 | + * by the caller, if the caller will need it later on |
|
163 | + */ |
|
164 | + public function get_pass(Predict_Sat $sat_in, Predict_QTH $qth, $start, $maxdt) |
|
165 | + { |
|
166 | + $aos = 0.0; /* time of AOS */ |
|
167 | + $tca = 0.0; /* time of TCA */ |
|
168 | + $los = 0.0; /* time of LOS */ |
|
169 | + $dt = 0.0; /* time diff */ |
|
170 | + $step = 0.0; /* time step */ |
|
171 | + $t0 = $start; |
|
172 | + $tres = 0.0; /* required time resolution */ |
|
173 | + $max_el = 0.0; /* maximum elevation */ |
|
174 | + $pass = null; |
|
175 | + $detail = null; |
|
176 | + $done = false; |
|
177 | + $iter = 0; /* number of iterations */ |
|
178 | + /* FIXME: watchdog */ |
|
179 | + |
|
180 | + /*copy sat_in to a working structure*/ |
|
181 | + $sat = clone $sat_in; |
|
182 | + $sat_working = clone $sat_in; |
|
183 | + |
|
184 | + /* get time resolution; sat-cfg stores it in seconds */ |
|
185 | + $tres = $this->timeRes / 86400.0; |
|
186 | + |
|
187 | + /* loop until we find a pass with elevation > SAT_CFG_INT_PRED_MIN_EL |
|
188 | 188 | or we run out of time |
189 | 189 | FIXME: we should have a safety break |
190 | 190 | */ |
191 | - while (!$done) { |
|
192 | - /* Find los of next pass or of current pass */ |
|
193 | - $los = $this->find_los($sat, $qth, $t0, $maxdt); // See if a pass is ongoing |
|
194 | - $aos = $this->find_aos($sat, $qth, $t0, $maxdt); |
|
195 | - /* sat_log_log(SAT_LOG_LEVEL_MSG, "%s:%s:%d: found aos %f and los %f for t0=%f", */ |
|
196 | - /* __FILE__, */ |
|
197 | - /* __FUNCTION__, */ |
|
198 | - /* __LINE__, */ |
|
199 | - /* aos, */ |
|
200 | - /* los, */ |
|
201 | - /* t0); */ |
|
202 | - if ($aos > $los) { |
|
203 | - // los is from an currently happening pass, find previous aos |
|
204 | - $aos = $this->find_prev_aos($sat, $qth, $t0); |
|
205 | - } |
|
206 | - |
|
207 | - /* aos = 0.0 means no aos */ |
|
208 | - if ($aos == 0.0) { |
|
209 | - $done = true; |
|
210 | - } else if (($maxdt > 0.0) && ($aos > ($start + $maxdt)) ) { |
|
211 | - /* check whether we are within time limits; |
|
191 | + while (!$done) { |
|
192 | + /* Find los of next pass or of current pass */ |
|
193 | + $los = $this->find_los($sat, $qth, $t0, $maxdt); // See if a pass is ongoing |
|
194 | + $aos = $this->find_aos($sat, $qth, $t0, $maxdt); |
|
195 | + /* sat_log_log(SAT_LOG_LEVEL_MSG, "%s:%s:%d: found aos %f and los %f for t0=%f", */ |
|
196 | + /* __FILE__, */ |
|
197 | + /* __FUNCTION__, */ |
|
198 | + /* __LINE__, */ |
|
199 | + /* aos, */ |
|
200 | + /* los, */ |
|
201 | + /* t0); */ |
|
202 | + if ($aos > $los) { |
|
203 | + // los is from an currently happening pass, find previous aos |
|
204 | + $aos = $this->find_prev_aos($sat, $qth, $t0); |
|
205 | + } |
|
206 | + |
|
207 | + /* aos = 0.0 means no aos */ |
|
208 | + if ($aos == 0.0) { |
|
209 | + $done = true; |
|
210 | + } else if (($maxdt > 0.0) && ($aos > ($start + $maxdt)) ) { |
|
211 | + /* check whether we are within time limits; |
|
212 | 212 | maxdt = 0 mean no time limit. |
213 | 213 | */ |
214 | - $done = true; |
|
215 | - } else { |
|
216 | - //los = find_los (sat, qth, aos + 0.001, maxdt); // +1.5 min later |
|
217 | - $dt = $los - $aos; |
|
214 | + $done = true; |
|
215 | + } else { |
|
216 | + //los = find_los (sat, qth, aos + 0.001, maxdt); // +1.5 min later |
|
217 | + $dt = $los - $aos; |
|
218 | 218 | |
219 | - /* get time step, which will give us the max number of entries */ |
|
220 | - $step = $dt / $this->numEntries; |
|
219 | + /* get time step, which will give us the max number of entries */ |
|
220 | + $step = $dt / $this->numEntries; |
|
221 | 221 | |
222 | - /* but if this is smaller than the required resolution |
|
222 | + /* but if this is smaller than the required resolution |
|
223 | 223 | we go with the resolution |
224 | 224 | */ |
225 | - if ($step < $tres) { |
|
226 | - $step = $tres; |
|
227 | - } |
|
228 | - |
|
229 | - /* create a pass_t entry; FIXME: g_try_new in 2.8 */ |
|
230 | - $pass = new Predict_Pass(); |
|
231 | - |
|
232 | - $pass->aos = $aos; |
|
233 | - $pass->los = $los; |
|
234 | - $pass->max_el = 0.0; |
|
235 | - $pass->aos_az = 0.0; |
|
236 | - $pass->los_az = 0.0; |
|
237 | - $pass->maxel_az = 0.0; |
|
238 | - $pass->vis = '---'; |
|
239 | - $pass->satname = $sat->nickname; |
|
240 | - $pass->details = array(); |
|
241 | - |
|
242 | - /* iterate over each time step */ |
|
243 | - for ($t = $pass->aos; $t <= $pass->los; $t += $step) { |
|
244 | - |
|
245 | - /* calculate satellite data */ |
|
246 | - $this->predict_calc($sat, $qth, $t); |
|
247 | - |
|
248 | - /* in the first iter we want to store |
|
225 | + if ($step < $tres) { |
|
226 | + $step = $tres; |
|
227 | + } |
|
228 | + |
|
229 | + /* create a pass_t entry; FIXME: g_try_new in 2.8 */ |
|
230 | + $pass = new Predict_Pass(); |
|
231 | + |
|
232 | + $pass->aos = $aos; |
|
233 | + $pass->los = $los; |
|
234 | + $pass->max_el = 0.0; |
|
235 | + $pass->aos_az = 0.0; |
|
236 | + $pass->los_az = 0.0; |
|
237 | + $pass->maxel_az = 0.0; |
|
238 | + $pass->vis = '---'; |
|
239 | + $pass->satname = $sat->nickname; |
|
240 | + $pass->details = array(); |
|
241 | + |
|
242 | + /* iterate over each time step */ |
|
243 | + for ($t = $pass->aos; $t <= $pass->los; $t += $step) { |
|
244 | + |
|
245 | + /* calculate satellite data */ |
|
246 | + $this->predict_calc($sat, $qth, $t); |
|
247 | + |
|
248 | + /* in the first iter we want to store |
|
249 | 249 | pass->aos_az |
250 | 250 | */ |
251 | - if ($t == $pass->aos) { |
|
252 | - $pass->aos_az = $sat->az; |
|
253 | - $pass->orbit = $sat->orbit; |
|
254 | - } |
|
255 | - |
|
256 | - /* append details to sat->details */ |
|
257 | - $detail = new Predict_PassDetail(); |
|
258 | - $detail->time = $t; |
|
259 | - $detail->pos->x = $sat->pos->x; |
|
260 | - $detail->pos->y = $sat->pos->y; |
|
261 | - $detail->pos->z = $sat->pos->z; |
|
262 | - $detail->pos->w = $sat->pos->w; |
|
263 | - $detail->vel->x = $sat->vel->x; |
|
264 | - $detail->vel->y = $sat->vel->y; |
|
265 | - $detail->vel->z = $sat->vel->z; |
|
266 | - $detail->vel->w = $sat->vel->w; |
|
267 | - $detail->velo = $sat->velo; |
|
268 | - $detail->az = $sat->az; |
|
269 | - $detail->el = $sat->el; |
|
270 | - $detail->range = $sat->range; |
|
271 | - $detail->range_rate = $sat->range_rate; |
|
272 | - $detail->lat = $sat->ssplat; |
|
273 | - $detail->lon = $sat->ssplon; |
|
274 | - $detail->alt = $sat->alt; |
|
275 | - $detail->ma = $sat->ma; |
|
276 | - $detail->phase = $sat->phase; |
|
277 | - $detail->footprint = $sat->footprint; |
|
278 | - $detail->orbit = $sat->orbit; |
|
279 | - $detail->vis = $this->get_sat_vis($sat, $qth, $t); |
|
280 | - |
|
281 | - /* also store visibility "bit" */ |
|
282 | - switch ($detail->vis) { |
|
283 | - case self::SAT_VIS_VISIBLE: |
|
284 | - $pass->vis[0] = 'V'; |
|
285 | - break; |
|
286 | - case self::SAT_VIS_DAYLIGHT: |
|
287 | - $pass->vis[1] = 'D'; |
|
288 | - break; |
|
289 | - case self::SAT_VIS_ECLIPSED: |
|
290 | - $pass->vis[2] = 'E'; |
|
291 | - break; |
|
292 | - default: |
|
293 | - break; |
|
294 | - } |
|
295 | - |
|
296 | - // Using an array, no need to prepend and reverse the list |
|
297 | - // as gpredict does |
|
298 | - $pass->details[] = $detail; |
|
299 | - |
|
300 | - // Look up apparent magnitude if this is a visible pass |
|
301 | - if ($detail->vis === self::SAT_VIS_VISIBLE) { |
|
302 | - $apmag = $sat->calculateApparentMagnitude($t, $qth); |
|
303 | - if ($pass->max_apparent_magnitude === null || $apmag < $pass->max_apparent_magnitude) { |
|
304 | - $pass->max_apparent_magnitude = $apmag; |
|
305 | - } |
|
306 | - } |
|
307 | - |
|
308 | - /* store elevation if greater than the |
|
251 | + if ($t == $pass->aos) { |
|
252 | + $pass->aos_az = $sat->az; |
|
253 | + $pass->orbit = $sat->orbit; |
|
254 | + } |
|
255 | + |
|
256 | + /* append details to sat->details */ |
|
257 | + $detail = new Predict_PassDetail(); |
|
258 | + $detail->time = $t; |
|
259 | + $detail->pos->x = $sat->pos->x; |
|
260 | + $detail->pos->y = $sat->pos->y; |
|
261 | + $detail->pos->z = $sat->pos->z; |
|
262 | + $detail->pos->w = $sat->pos->w; |
|
263 | + $detail->vel->x = $sat->vel->x; |
|
264 | + $detail->vel->y = $sat->vel->y; |
|
265 | + $detail->vel->z = $sat->vel->z; |
|
266 | + $detail->vel->w = $sat->vel->w; |
|
267 | + $detail->velo = $sat->velo; |
|
268 | + $detail->az = $sat->az; |
|
269 | + $detail->el = $sat->el; |
|
270 | + $detail->range = $sat->range; |
|
271 | + $detail->range_rate = $sat->range_rate; |
|
272 | + $detail->lat = $sat->ssplat; |
|
273 | + $detail->lon = $sat->ssplon; |
|
274 | + $detail->alt = $sat->alt; |
|
275 | + $detail->ma = $sat->ma; |
|
276 | + $detail->phase = $sat->phase; |
|
277 | + $detail->footprint = $sat->footprint; |
|
278 | + $detail->orbit = $sat->orbit; |
|
279 | + $detail->vis = $this->get_sat_vis($sat, $qth, $t); |
|
280 | + |
|
281 | + /* also store visibility "bit" */ |
|
282 | + switch ($detail->vis) { |
|
283 | + case self::SAT_VIS_VISIBLE: |
|
284 | + $pass->vis[0] = 'V'; |
|
285 | + break; |
|
286 | + case self::SAT_VIS_DAYLIGHT: |
|
287 | + $pass->vis[1] = 'D'; |
|
288 | + break; |
|
289 | + case self::SAT_VIS_ECLIPSED: |
|
290 | + $pass->vis[2] = 'E'; |
|
291 | + break; |
|
292 | + default: |
|
293 | + break; |
|
294 | + } |
|
295 | + |
|
296 | + // Using an array, no need to prepend and reverse the list |
|
297 | + // as gpredict does |
|
298 | + $pass->details[] = $detail; |
|
299 | + |
|
300 | + // Look up apparent magnitude if this is a visible pass |
|
301 | + if ($detail->vis === self::SAT_VIS_VISIBLE) { |
|
302 | + $apmag = $sat->calculateApparentMagnitude($t, $qth); |
|
303 | + if ($pass->max_apparent_magnitude === null || $apmag < $pass->max_apparent_magnitude) { |
|
304 | + $pass->max_apparent_magnitude = $apmag; |
|
305 | + } |
|
306 | + } |
|
307 | + |
|
308 | + /* store elevation if greater than the |
|
309 | 309 | previously stored one |
310 | 310 | */ |
311 | - if ($sat->el > $max_el) { |
|
312 | - $max_el = $sat->el; |
|
313 | - $tca = $t; |
|
314 | - $pass->maxel_az = $sat->az; |
|
315 | - } |
|
316 | - |
|
317 | - /* g_print ("TIME: %f\tAZ: %f\tEL: %f (MAX: %f)\n", */ |
|
318 | - /* t, sat->az, sat->el, max_el); */ |
|
319 | - } |
|
320 | - |
|
321 | - /* calculate satellite data */ |
|
322 | - $this->predict_calc($sat, $qth, $pass->los); |
|
323 | - /* store los_az, max_el and tca */ |
|
324 | - $pass->los_az = $sat->az; |
|
325 | - $pass->max_el = $max_el; |
|
326 | - $pass->tca = $tca; |
|
327 | - |
|
328 | - /* check whether this pass is good */ |
|
329 | - if ($max_el >= $this->minEle) { |
|
330 | - $done = true; |
|
331 | - } else { |
|
332 | - $done = false; |
|
333 | - $t0 = $los + 0.014; // +20 min |
|
334 | - $pass = null; |
|
335 | - } |
|
336 | - |
|
337 | - $iter++; |
|
338 | - } |
|
339 | - } |
|
340 | - |
|
341 | - return $pass; |
|
342 | - } |
|
343 | - |
|
344 | - /** |
|
345 | - * Calculate satellite visibility. |
|
346 | - * |
|
347 | - * @param Predict_Sat $sat The satellite structure. |
|
348 | - * @param Predict_QTH $qth The QTH |
|
349 | - * @param float $jul_utc The time at which the visibility should be calculated. |
|
350 | - * |
|
351 | - * @return int The visiblity constant, 0, 1, 2, or 3 (see above) |
|
352 | - */ |
|
353 | - public function get_sat_vis(Predict_Sat $sat, Predict_QTH $qth, $jul_utc) |
|
354 | - { |
|
355 | - /* gboolean sat_sun_status; |
|
311 | + if ($sat->el > $max_el) { |
|
312 | + $max_el = $sat->el; |
|
313 | + $tca = $t; |
|
314 | + $pass->maxel_az = $sat->az; |
|
315 | + } |
|
316 | + |
|
317 | + /* g_print ("TIME: %f\tAZ: %f\tEL: %f (MAX: %f)\n", */ |
|
318 | + /* t, sat->az, sat->el, max_el); */ |
|
319 | + } |
|
320 | + |
|
321 | + /* calculate satellite data */ |
|
322 | + $this->predict_calc($sat, $qth, $pass->los); |
|
323 | + /* store los_az, max_el and tca */ |
|
324 | + $pass->los_az = $sat->az; |
|
325 | + $pass->max_el = $max_el; |
|
326 | + $pass->tca = $tca; |
|
327 | + |
|
328 | + /* check whether this pass is good */ |
|
329 | + if ($max_el >= $this->minEle) { |
|
330 | + $done = true; |
|
331 | + } else { |
|
332 | + $done = false; |
|
333 | + $t0 = $los + 0.014; // +20 min |
|
334 | + $pass = null; |
|
335 | + } |
|
336 | + |
|
337 | + $iter++; |
|
338 | + } |
|
339 | + } |
|
340 | + |
|
341 | + return $pass; |
|
342 | + } |
|
343 | + |
|
344 | + /** |
|
345 | + * Calculate satellite visibility. |
|
346 | + * |
|
347 | + * @param Predict_Sat $sat The satellite structure. |
|
348 | + * @param Predict_QTH $qth The QTH |
|
349 | + * @param float $jul_utc The time at which the visibility should be calculated. |
|
350 | + * |
|
351 | + * @return int The visiblity constant, 0, 1, 2, or 3 (see above) |
|
352 | + */ |
|
353 | + public function get_sat_vis(Predict_Sat $sat, Predict_QTH $qth, $jul_utc) |
|
354 | + { |
|
355 | + /* gboolean sat_sun_status; |
|
356 | 356 | gdouble sun_el; |
357 | 357 | gdouble threshold; |
358 | 358 | gdouble eclipse_depth; |
359 | 359 | sat_vis_t vis = SAT_VIS_NONE; */ |
360 | 360 | |
361 | - $eclipse_depth = 0.0; |
|
362 | - $zero_vector = new Predict_Vector(); |
|
363 | - $obs_geodetic = new Predict_Geodetic(); |
|
364 | - |
|
365 | - /* Solar ECI position vector */ |
|
366 | - $solar_vector = new Predict_Vector(); |
|
367 | - |
|
368 | - /* Solar observed az and el vector */ |
|
369 | - $solar_set = new Predict_ObsSet(); |
|
370 | - |
|
371 | - /* FIXME: could be passed as parameter */ |
|
372 | - $obs_geodetic->lon = $qth->lon * self::de2ra; |
|
373 | - $obs_geodetic->lat = $qth->lat * self::de2ra; |
|
374 | - $obs_geodetic->alt = $qth->alt / 1000.0; |
|
375 | - $obs_geodetic->theta = 0; |
|
376 | - |
|
377 | - Predict_Solar::Calculate_Solar_Position($jul_utc, $solar_vector); |
|
378 | - Predict_SGPObs::Calculate_Obs($jul_utc, $solar_vector, $zero_vector, $obs_geodetic, $solar_set); |
|
379 | - |
|
380 | - if (Predict_Solar::Sat_Eclipsed($sat->pos, $solar_vector, $eclipse_depth)) { |
|
381 | - /* satellite is eclipsed */ |
|
382 | - $sat_sun_status = false; |
|
383 | - } else { |
|
384 | - /* satellite in sunlight => may be visible */ |
|
385 | - $sat_sun_status = true; |
|
386 | - } |
|
387 | - |
|
388 | - if ($sat_sun_status) { |
|
389 | - $sun_el = Predict_Math::Degrees($solar_set->el); |
|
390 | - |
|
391 | - if ($sun_el <= $this->threshold && $sat->el >= 0.0) { |
|
392 | - $vis = self::SAT_VIS_VISIBLE; |
|
393 | - } else { |
|
394 | - $vis = self::SAT_VIS_DAYLIGHT; |
|
395 | - } |
|
396 | - } else { |
|
397 | - $vis = self::SAT_VIS_ECLIPSED; |
|
398 | - } |
|
399 | - |
|
400 | - return $vis; |
|
401 | - } |
|
402 | - |
|
403 | - /** Find the AOS time of the next pass. |
|
404 | - * @author Alexandru Csete, OZ9AEC |
|
405 | - * @author John A. Magliacane, KD2BD |
|
406 | - * @param Predict_Sat $sat The satellite data. |
|
407 | - * @param Predict_QTH $qth The observer's location (QTH) data. |
|
408 | - * @param float $start The julian date where calculation should start. |
|
409 | - * @param int $maxdt The upper time limit in days (0.0 = no limit) |
|
410 | - * @return The julain date of the next AOS or 0.0 if the satellite has no AOS. |
|
411 | - * |
|
412 | - * This function finds the time of AOS for the first coming pass taking place |
|
413 | - * no earlier that start. |
|
414 | - * If the satellite is currently within range, the function first calls |
|
415 | - * find_los to get the next LOS time. Then the calculations are done using |
|
416 | - * the new start time. |
|
417 | - * |
|
418 | - */ |
|
419 | - public function find_aos(Predict_Sat $sat, Predict_QTH $qth, $start, $maxdt) |
|
420 | - { |
|
421 | - $t = $start; |
|
422 | - $aostime = 0.0; |
|
423 | - |
|
424 | - |
|
425 | - /* make sure current sat values are |
|
361 | + $eclipse_depth = 0.0; |
|
362 | + $zero_vector = new Predict_Vector(); |
|
363 | + $obs_geodetic = new Predict_Geodetic(); |
|
364 | + |
|
365 | + /* Solar ECI position vector */ |
|
366 | + $solar_vector = new Predict_Vector(); |
|
367 | + |
|
368 | + /* Solar observed az and el vector */ |
|
369 | + $solar_set = new Predict_ObsSet(); |
|
370 | + |
|
371 | + /* FIXME: could be passed as parameter */ |
|
372 | + $obs_geodetic->lon = $qth->lon * self::de2ra; |
|
373 | + $obs_geodetic->lat = $qth->lat * self::de2ra; |
|
374 | + $obs_geodetic->alt = $qth->alt / 1000.0; |
|
375 | + $obs_geodetic->theta = 0; |
|
376 | + |
|
377 | + Predict_Solar::Calculate_Solar_Position($jul_utc, $solar_vector); |
|
378 | + Predict_SGPObs::Calculate_Obs($jul_utc, $solar_vector, $zero_vector, $obs_geodetic, $solar_set); |
|
379 | + |
|
380 | + if (Predict_Solar::Sat_Eclipsed($sat->pos, $solar_vector, $eclipse_depth)) { |
|
381 | + /* satellite is eclipsed */ |
|
382 | + $sat_sun_status = false; |
|
383 | + } else { |
|
384 | + /* satellite in sunlight => may be visible */ |
|
385 | + $sat_sun_status = true; |
|
386 | + } |
|
387 | + |
|
388 | + if ($sat_sun_status) { |
|
389 | + $sun_el = Predict_Math::Degrees($solar_set->el); |
|
390 | + |
|
391 | + if ($sun_el <= $this->threshold && $sat->el >= 0.0) { |
|
392 | + $vis = self::SAT_VIS_VISIBLE; |
|
393 | + } else { |
|
394 | + $vis = self::SAT_VIS_DAYLIGHT; |
|
395 | + } |
|
396 | + } else { |
|
397 | + $vis = self::SAT_VIS_ECLIPSED; |
|
398 | + } |
|
399 | + |
|
400 | + return $vis; |
|
401 | + } |
|
402 | + |
|
403 | + /** Find the AOS time of the next pass. |
|
404 | + * @author Alexandru Csete, OZ9AEC |
|
405 | + * @author John A. Magliacane, KD2BD |
|
406 | + * @param Predict_Sat $sat The satellite data. |
|
407 | + * @param Predict_QTH $qth The observer's location (QTH) data. |
|
408 | + * @param float $start The julian date where calculation should start. |
|
409 | + * @param int $maxdt The upper time limit in days (0.0 = no limit) |
|
410 | + * @return The julain date of the next AOS or 0.0 if the satellite has no AOS. |
|
411 | + * |
|
412 | + * This function finds the time of AOS for the first coming pass taking place |
|
413 | + * no earlier that start. |
|
414 | + * If the satellite is currently within range, the function first calls |
|
415 | + * find_los to get the next LOS time. Then the calculations are done using |
|
416 | + * the new start time. |
|
417 | + * |
|
418 | + */ |
|
419 | + public function find_aos(Predict_Sat $sat, Predict_QTH $qth, $start, $maxdt) |
|
420 | + { |
|
421 | + $t = $start; |
|
422 | + $aostime = 0.0; |
|
423 | + |
|
424 | + |
|
425 | + /* make sure current sat values are |
|
426 | 426 | in sync with the time |
427 | 427 | */ |
428 | - $this->predict_calc($sat, $qth, $start); |
|
429 | - |
|
430 | - /* check whether satellite has aos */ |
|
431 | - if (($sat->otype == Predict_SGPSDP::ORBIT_TYPE_GEO) || |
|
432 | - ($sat->otype == Predict_SGPSDP::ORBIT_TYPE_DECAYED) || |
|
433 | - !$this->has_aos($sat, $qth)) { |
|
434 | - |
|
435 | - return 0.0; |
|
436 | - } |
|
437 | - |
|
438 | - if ($sat->el > 0.0) { |
|
439 | - $t = $this->find_los($sat, $qth, $start, $maxdt) + 0.014; // +20 min |
|
440 | - } |
|
441 | - |
|
442 | - /* invalid time (potentially returned by find_los) */ |
|
443 | - if ($t < 0.1) { |
|
444 | - return 0.0; |
|
445 | - } |
|
446 | - |
|
447 | - /* update satellite data */ |
|
448 | - $this->predict_calc($sat, $qth, $t); |
|
449 | - |
|
450 | - /* use upper time limit */ |
|
451 | - if ($maxdt > 0.0) { |
|
452 | - |
|
453 | - /* coarse time steps */ |
|
454 | - while (($sat->el < -1.0) && ($t <= ($start + $maxdt))) { |
|
455 | - $t -= 0.00035 * ($sat->el * (($sat->alt / 8400.0) + 0.46) - 2.0); |
|
456 | - $this->predict_calc($sat, $qth, $t); |
|
457 | - } |
|
458 | - |
|
459 | - /* fine steps */ |
|
460 | - while (($aostime == 0.0) && ($t <= ($start + $maxdt))) { |
|
461 | - |
|
462 | - if (abs($sat->el) < 0.005) { |
|
463 | - $aostime = $t; |
|
464 | - } else { |
|
465 | - $t -= $sat->el * sqrt($sat->alt) / 530000.0; |
|
466 | - $this->predict_calc($sat, $qth, $t); |
|
467 | - } |
|
468 | - } |
|
469 | - } else { |
|
470 | - /* don't use upper time limit */ |
|
471 | - |
|
472 | - /* coarse time steps */ |
|
473 | - while ($sat->el < -1.0) { |
|
474 | - |
|
475 | - $t -= 0.00035 * ($sat->el * (($sat->alt / 8400.0) + 0.46) - 2.0); |
|
476 | - $this->predict_calc($sat, $qth, $t); |
|
477 | - } |
|
478 | - |
|
479 | - /* fine steps */ |
|
480 | - while ($aostime == 0.0) { |
|
481 | - |
|
482 | - if (abs($sat->el) < 0.005) { |
|
483 | - $aostime = $t; |
|
484 | - } else { |
|
485 | - $t -= $sat->el * sqrt($sat->alt) / 530000.0; |
|
486 | - $this->predict_calc($sat, $qth, $t); |
|
487 | - } |
|
488 | - |
|
489 | - } |
|
490 | - } |
|
491 | - |
|
492 | - return $aostime; |
|
493 | - } |
|
494 | - |
|
495 | - /** SGP4SDP4 driver for doing AOS/LOS calculations. |
|
496 | - * @param Predict_Sat $sat The satellite data. |
|
497 | - * @param Predict_QTH $qth The QTH observer location data. |
|
498 | - * @param float $t The time for calculation (Julian Date) |
|
499 | - * |
|
500 | - */ |
|
501 | - public function predict_calc(Predict_Sat $sat, Predict_QTH $qth, $t) |
|
502 | - { |
|
503 | - $obs_set = new Predict_ObsSet(); |
|
504 | - $sat_geodetic = new Predict_Geodetic(); |
|
505 | - $obs_geodetic = new Predict_Geodetic(); |
|
506 | - |
|
507 | - $obs_geodetic->lon = $qth->lon * self::de2ra; |
|
508 | - $obs_geodetic->lat = $qth->lat * self::de2ra; |
|
509 | - $obs_geodetic->alt = $qth->alt / 1000.0; |
|
510 | - $obs_geodetic->theta = 0; |
|
511 | - |
|
512 | - $sat->jul_utc = $t; |
|
513 | - $sat->tsince = ($sat->jul_utc - $sat->jul_epoch) * self::xmnpda; |
|
514 | - |
|
515 | - /* call the norad routines according to the deep-space flag */ |
|
516 | - $sgpsdp = Predict_SGPSDP::getInstance($sat); |
|
517 | - if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) { |
|
518 | - $sgpsdp->SDP4($sat, $sat->tsince); |
|
519 | - } else { |
|
520 | - $sgpsdp->SGP4($sat, $sat->tsince); |
|
521 | - } |
|
522 | - |
|
523 | - Predict_Math::Convert_Sat_State($sat->pos, $sat->vel); |
|
524 | - |
|
525 | - /* get the velocity of the satellite */ |
|
526 | - $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z); |
|
527 | - $sat->velo = $sat->vel->w; |
|
528 | - Predict_SGPObs::Calculate_Obs($sat->jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set); |
|
529 | - Predict_SGPObs::Calculate_LatLonAlt($sat->jul_utc, $sat->pos, $sat_geodetic); |
|
530 | - |
|
531 | - while ($sat_geodetic->lon < -self::pi) { |
|
532 | - $sat_geodetic->lon += self::twopi; |
|
533 | - } |
|
534 | - |
|
535 | - while ($sat_geodetic->lon > (self::pi)) { |
|
536 | - $sat_geodetic->lon -= self::twopi; |
|
537 | - } |
|
538 | - |
|
539 | - $sat->az = Predict_Math::Degrees($obs_set->az); |
|
540 | - $sat->el = Predict_Math::Degrees($obs_set->el); |
|
541 | - $sat->range = $obs_set->range; |
|
542 | - $sat->range_rate = $obs_set->range_rate; |
|
543 | - $sat->ssplat = Predict_Math::Degrees($sat_geodetic->lat); |
|
544 | - $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon); |
|
545 | - $sat->alt = $sat_geodetic->alt; |
|
546 | - $sat->ma = Predict_Math::Degrees($sat->phase); |
|
547 | - $sat->ma *= 256.0 / 360.0; |
|
548 | - $sat->phase = Predict_Math::Degrees($sat->phase); |
|
549 | - |
|
550 | - /* same formulas, but the one from predict is nicer */ |
|
551 | - //sat->footprint = 2.0 * xkmper * acos (xkmper/sat->pos.w); |
|
552 | - $sat->footprint = 12756.33 * acos(self::xkmper / (self::xkmper + $sat->alt)); |
|
553 | - $age = $sat->jul_utc - $sat->jul_epoch; |
|
554 | - $sat->orbit = floor(($sat->tle->xno * self::xmnpda / self::twopi + |
|
555 | - $age * $sat->tle->bstar * self::ae) * $age + |
|
556 | - $sat->tle->xmo / self::twopi) + $sat->tle->revnum - 1; |
|
557 | - } |
|
558 | - |
|
559 | - /** Find the LOS time of the next pass. |
|
560 | - * @author Alexandru Csete, OZ9AEC |
|
561 | - * @author John A. Magliacane, KD2BD |
|
562 | - * @param Predict_Sat $sat The satellite data. |
|
563 | - * @param Predict_QTH $qth The QTH observer location data. |
|
564 | - * @param float $start The time where calculation should start. (Julian Date) |
|
565 | - * @param int $maxdt The upper time limit in days (0.0 = no limit) |
|
566 | - * @return The time (julian date) of the next LOS or 0.0 if the satellite has no LOS. |
|
567 | - * |
|
568 | - * This function finds the time of LOS for the first coming pass taking place |
|
569 | - * no earlier that start. |
|
570 | - * If the satellite is currently out of range, the function first calls |
|
571 | - * find_aos to get the next AOS time. Then the calculations are done using |
|
572 | - * the new start time. |
|
573 | - * The function has a built-in watchdog to ensure that we don't end up in |
|
574 | - * lengthy loops. |
|
575 | - * |
|
576 | - */ |
|
577 | - public function find_los(Predict_Sat $sat, Predict_QTH $qth, $start, $maxdt) |
|
578 | - { |
|
579 | - $t = $start; |
|
580 | - $lostime = 0.0; |
|
581 | - |
|
582 | - |
|
583 | - $this->predict_calc($sat, $qth, $start); |
|
584 | - |
|
585 | - /* check whether satellite has aos */ |
|
586 | - if (($sat->otype == Predict_SGPSDP::ORBIT_TYPE_GEO) || |
|
587 | - ($sat->otype == Predict_SGPSDP::ORBIT_TYPE_DECAYED) || |
|
588 | - !$this->has_aos ($sat, $qth)) { |
|
589 | - |
|
590 | - return 0.0; |
|
591 | - } |
|
592 | - |
|
593 | - if ($sat->el < 0.0) { |
|
594 | - $t = $this->find_aos($sat, $qth, $start, $maxdt) + 0.001; // +1.5 min |
|
595 | - } |
|
596 | - |
|
597 | - /* invalid time (potentially returned by find_aos) */ |
|
598 | - if ($t < 0.01) { |
|
599 | - return 0.0; |
|
600 | - } |
|
601 | - |
|
602 | - /* update satellite data */ |
|
603 | - $this->predict_calc($sat, $qth, $t); |
|
604 | - |
|
605 | - /* use upper time limit */ |
|
606 | - if ($maxdt > 0.0) { |
|
607 | - |
|
608 | - /* coarse steps */ |
|
609 | - while (($sat->el >= 1.0) && ($t <= ($start + $maxdt))) { |
|
610 | - $t += cos(($sat->el - 1.0) * self::de2ra) * sqrt($sat->alt) / 25000.0; |
|
611 | - $this->predict_calc($sat, $qth, $t); |
|
612 | - } |
|
613 | - |
|
614 | - /* fine steps */ |
|
615 | - while (($lostime == 0.0) && ($t <= ($start + $maxdt))) { |
|
616 | - |
|
617 | - $t += $sat->el * sqrt($sat->alt) / 502500.0; |
|
618 | - $this->predict_calc($sat, $qth, $t); |
|
619 | - |
|
620 | - if (abs($sat->el) < 0.005) { |
|
621 | - $lostime = $t; |
|
622 | - } |
|
623 | - } |
|
624 | - } else { |
|
625 | - /* don't use upper limit */ |
|
626 | - |
|
627 | - /* coarse steps */ |
|
628 | - while ($sat->el >= 1.0) { |
|
629 | - $t += cos(($sat->el - 1.0) * self::de2ra) * sqrt($sat->alt) / 25000.0; |
|
630 | - $this->predict_calc($sat, $qth, $t); |
|
631 | - } |
|
632 | - |
|
633 | - /* fine steps */ |
|
634 | - while ($lostime == 0.0) { |
|
635 | - |
|
636 | - $t += $sat->el * sqrt($sat->alt) / 502500.0; |
|
637 | - $this->predict_calc($sat, $qth, $t); |
|
638 | - |
|
639 | - if (abs($sat->el) < 0.005) |
|
640 | - $lostime = $t; |
|
641 | - } |
|
642 | - } |
|
643 | - |
|
644 | - return $lostime; |
|
645 | - } |
|
646 | - |
|
647 | - /** Find AOS time of current pass. |
|
648 | - * @param Predict_Sat $sat The satellite to find AOS for. |
|
649 | - * @param Predict_QTH $qth The ground station. |
|
650 | - * @param float $start Start time, prefereably now. |
|
651 | - * @return The time of the previous AOS or 0.0 if the satellite has no AOS. |
|
652 | - * |
|
653 | - * This function can be used to find the AOS time in the past of the |
|
654 | - * current pass. |
|
655 | - */ |
|
656 | - public function find_prev_aos(Predict_Sat $sat, Predict_QTH $qth, $start) |
|
657 | - { |
|
658 | - $aostime = $start; |
|
659 | - |
|
660 | - /* make sure current sat values are |
|
428 | + $this->predict_calc($sat, $qth, $start); |
|
429 | + |
|
430 | + /* check whether satellite has aos */ |
|
431 | + if (($sat->otype == Predict_SGPSDP::ORBIT_TYPE_GEO) || |
|
432 | + ($sat->otype == Predict_SGPSDP::ORBIT_TYPE_DECAYED) || |
|
433 | + !$this->has_aos($sat, $qth)) { |
|
434 | + |
|
435 | + return 0.0; |
|
436 | + } |
|
437 | + |
|
438 | + if ($sat->el > 0.0) { |
|
439 | + $t = $this->find_los($sat, $qth, $start, $maxdt) + 0.014; // +20 min |
|
440 | + } |
|
441 | + |
|
442 | + /* invalid time (potentially returned by find_los) */ |
|
443 | + if ($t < 0.1) { |
|
444 | + return 0.0; |
|
445 | + } |
|
446 | + |
|
447 | + /* update satellite data */ |
|
448 | + $this->predict_calc($sat, $qth, $t); |
|
449 | + |
|
450 | + /* use upper time limit */ |
|
451 | + if ($maxdt > 0.0) { |
|
452 | + |
|
453 | + /* coarse time steps */ |
|
454 | + while (($sat->el < -1.0) && ($t <= ($start + $maxdt))) { |
|
455 | + $t -= 0.00035 * ($sat->el * (($sat->alt / 8400.0) + 0.46) - 2.0); |
|
456 | + $this->predict_calc($sat, $qth, $t); |
|
457 | + } |
|
458 | + |
|
459 | + /* fine steps */ |
|
460 | + while (($aostime == 0.0) && ($t <= ($start + $maxdt))) { |
|
461 | + |
|
462 | + if (abs($sat->el) < 0.005) { |
|
463 | + $aostime = $t; |
|
464 | + } else { |
|
465 | + $t -= $sat->el * sqrt($sat->alt) / 530000.0; |
|
466 | + $this->predict_calc($sat, $qth, $t); |
|
467 | + } |
|
468 | + } |
|
469 | + } else { |
|
470 | + /* don't use upper time limit */ |
|
471 | + |
|
472 | + /* coarse time steps */ |
|
473 | + while ($sat->el < -1.0) { |
|
474 | + |
|
475 | + $t -= 0.00035 * ($sat->el * (($sat->alt / 8400.0) + 0.46) - 2.0); |
|
476 | + $this->predict_calc($sat, $qth, $t); |
|
477 | + } |
|
478 | + |
|
479 | + /* fine steps */ |
|
480 | + while ($aostime == 0.0) { |
|
481 | + |
|
482 | + if (abs($sat->el) < 0.005) { |
|
483 | + $aostime = $t; |
|
484 | + } else { |
|
485 | + $t -= $sat->el * sqrt($sat->alt) / 530000.0; |
|
486 | + $this->predict_calc($sat, $qth, $t); |
|
487 | + } |
|
488 | + |
|
489 | + } |
|
490 | + } |
|
491 | + |
|
492 | + return $aostime; |
|
493 | + } |
|
494 | + |
|
495 | + /** SGP4SDP4 driver for doing AOS/LOS calculations. |
|
496 | + * @param Predict_Sat $sat The satellite data. |
|
497 | + * @param Predict_QTH $qth The QTH observer location data. |
|
498 | + * @param float $t The time for calculation (Julian Date) |
|
499 | + * |
|
500 | + */ |
|
501 | + public function predict_calc(Predict_Sat $sat, Predict_QTH $qth, $t) |
|
502 | + { |
|
503 | + $obs_set = new Predict_ObsSet(); |
|
504 | + $sat_geodetic = new Predict_Geodetic(); |
|
505 | + $obs_geodetic = new Predict_Geodetic(); |
|
506 | + |
|
507 | + $obs_geodetic->lon = $qth->lon * self::de2ra; |
|
508 | + $obs_geodetic->lat = $qth->lat * self::de2ra; |
|
509 | + $obs_geodetic->alt = $qth->alt / 1000.0; |
|
510 | + $obs_geodetic->theta = 0; |
|
511 | + |
|
512 | + $sat->jul_utc = $t; |
|
513 | + $sat->tsince = ($sat->jul_utc - $sat->jul_epoch) * self::xmnpda; |
|
514 | + |
|
515 | + /* call the norad routines according to the deep-space flag */ |
|
516 | + $sgpsdp = Predict_SGPSDP::getInstance($sat); |
|
517 | + if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) { |
|
518 | + $sgpsdp->SDP4($sat, $sat->tsince); |
|
519 | + } else { |
|
520 | + $sgpsdp->SGP4($sat, $sat->tsince); |
|
521 | + } |
|
522 | + |
|
523 | + Predict_Math::Convert_Sat_State($sat->pos, $sat->vel); |
|
524 | + |
|
525 | + /* get the velocity of the satellite */ |
|
526 | + $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z); |
|
527 | + $sat->velo = $sat->vel->w; |
|
528 | + Predict_SGPObs::Calculate_Obs($sat->jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set); |
|
529 | + Predict_SGPObs::Calculate_LatLonAlt($sat->jul_utc, $sat->pos, $sat_geodetic); |
|
530 | + |
|
531 | + while ($sat_geodetic->lon < -self::pi) { |
|
532 | + $sat_geodetic->lon += self::twopi; |
|
533 | + } |
|
534 | + |
|
535 | + while ($sat_geodetic->lon > (self::pi)) { |
|
536 | + $sat_geodetic->lon -= self::twopi; |
|
537 | + } |
|
538 | + |
|
539 | + $sat->az = Predict_Math::Degrees($obs_set->az); |
|
540 | + $sat->el = Predict_Math::Degrees($obs_set->el); |
|
541 | + $sat->range = $obs_set->range; |
|
542 | + $sat->range_rate = $obs_set->range_rate; |
|
543 | + $sat->ssplat = Predict_Math::Degrees($sat_geodetic->lat); |
|
544 | + $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon); |
|
545 | + $sat->alt = $sat_geodetic->alt; |
|
546 | + $sat->ma = Predict_Math::Degrees($sat->phase); |
|
547 | + $sat->ma *= 256.0 / 360.0; |
|
548 | + $sat->phase = Predict_Math::Degrees($sat->phase); |
|
549 | + |
|
550 | + /* same formulas, but the one from predict is nicer */ |
|
551 | + //sat->footprint = 2.0 * xkmper * acos (xkmper/sat->pos.w); |
|
552 | + $sat->footprint = 12756.33 * acos(self::xkmper / (self::xkmper + $sat->alt)); |
|
553 | + $age = $sat->jul_utc - $sat->jul_epoch; |
|
554 | + $sat->orbit = floor(($sat->tle->xno * self::xmnpda / self::twopi + |
|
555 | + $age * $sat->tle->bstar * self::ae) * $age + |
|
556 | + $sat->tle->xmo / self::twopi) + $sat->tle->revnum - 1; |
|
557 | + } |
|
558 | + |
|
559 | + /** Find the LOS time of the next pass. |
|
560 | + * @author Alexandru Csete, OZ9AEC |
|
561 | + * @author John A. Magliacane, KD2BD |
|
562 | + * @param Predict_Sat $sat The satellite data. |
|
563 | + * @param Predict_QTH $qth The QTH observer location data. |
|
564 | + * @param float $start The time where calculation should start. (Julian Date) |
|
565 | + * @param int $maxdt The upper time limit in days (0.0 = no limit) |
|
566 | + * @return The time (julian date) of the next LOS or 0.0 if the satellite has no LOS. |
|
567 | + * |
|
568 | + * This function finds the time of LOS for the first coming pass taking place |
|
569 | + * no earlier that start. |
|
570 | + * If the satellite is currently out of range, the function first calls |
|
571 | + * find_aos to get the next AOS time. Then the calculations are done using |
|
572 | + * the new start time. |
|
573 | + * The function has a built-in watchdog to ensure that we don't end up in |
|
574 | + * lengthy loops. |
|
575 | + * |
|
576 | + */ |
|
577 | + public function find_los(Predict_Sat $sat, Predict_QTH $qth, $start, $maxdt) |
|
578 | + { |
|
579 | + $t = $start; |
|
580 | + $lostime = 0.0; |
|
581 | + |
|
582 | + |
|
583 | + $this->predict_calc($sat, $qth, $start); |
|
584 | + |
|
585 | + /* check whether satellite has aos */ |
|
586 | + if (($sat->otype == Predict_SGPSDP::ORBIT_TYPE_GEO) || |
|
587 | + ($sat->otype == Predict_SGPSDP::ORBIT_TYPE_DECAYED) || |
|
588 | + !$this->has_aos ($sat, $qth)) { |
|
589 | + |
|
590 | + return 0.0; |
|
591 | + } |
|
592 | + |
|
593 | + if ($sat->el < 0.0) { |
|
594 | + $t = $this->find_aos($sat, $qth, $start, $maxdt) + 0.001; // +1.5 min |
|
595 | + } |
|
596 | + |
|
597 | + /* invalid time (potentially returned by find_aos) */ |
|
598 | + if ($t < 0.01) { |
|
599 | + return 0.0; |
|
600 | + } |
|
601 | + |
|
602 | + /* update satellite data */ |
|
603 | + $this->predict_calc($sat, $qth, $t); |
|
604 | + |
|
605 | + /* use upper time limit */ |
|
606 | + if ($maxdt > 0.0) { |
|
607 | + |
|
608 | + /* coarse steps */ |
|
609 | + while (($sat->el >= 1.0) && ($t <= ($start + $maxdt))) { |
|
610 | + $t += cos(($sat->el - 1.0) * self::de2ra) * sqrt($sat->alt) / 25000.0; |
|
611 | + $this->predict_calc($sat, $qth, $t); |
|
612 | + } |
|
613 | + |
|
614 | + /* fine steps */ |
|
615 | + while (($lostime == 0.0) && ($t <= ($start + $maxdt))) { |
|
616 | + |
|
617 | + $t += $sat->el * sqrt($sat->alt) / 502500.0; |
|
618 | + $this->predict_calc($sat, $qth, $t); |
|
619 | + |
|
620 | + if (abs($sat->el) < 0.005) { |
|
621 | + $lostime = $t; |
|
622 | + } |
|
623 | + } |
|
624 | + } else { |
|
625 | + /* don't use upper limit */ |
|
626 | + |
|
627 | + /* coarse steps */ |
|
628 | + while ($sat->el >= 1.0) { |
|
629 | + $t += cos(($sat->el - 1.0) * self::de2ra) * sqrt($sat->alt) / 25000.0; |
|
630 | + $this->predict_calc($sat, $qth, $t); |
|
631 | + } |
|
632 | + |
|
633 | + /* fine steps */ |
|
634 | + while ($lostime == 0.0) { |
|
635 | + |
|
636 | + $t += $sat->el * sqrt($sat->alt) / 502500.0; |
|
637 | + $this->predict_calc($sat, $qth, $t); |
|
638 | + |
|
639 | + if (abs($sat->el) < 0.005) |
|
640 | + $lostime = $t; |
|
641 | + } |
|
642 | + } |
|
643 | + |
|
644 | + return $lostime; |
|
645 | + } |
|
646 | + |
|
647 | + /** Find AOS time of current pass. |
|
648 | + * @param Predict_Sat $sat The satellite to find AOS for. |
|
649 | + * @param Predict_QTH $qth The ground station. |
|
650 | + * @param float $start Start time, prefereably now. |
|
651 | + * @return The time of the previous AOS or 0.0 if the satellite has no AOS. |
|
652 | + * |
|
653 | + * This function can be used to find the AOS time in the past of the |
|
654 | + * current pass. |
|
655 | + */ |
|
656 | + public function find_prev_aos(Predict_Sat $sat, Predict_QTH $qth, $start) |
|
657 | + { |
|
658 | + $aostime = $start; |
|
659 | + |
|
660 | + /* make sure current sat values are |
|
661 | 661 | in sync with the time |
662 | 662 | */ |
663 | - $this->predict_calc($sat, $qth, $start); |
|
664 | - |
|
665 | - /* check whether satellite has aos */ |
|
666 | - if (($sat->otype == Predict_SGPSDP::ORBIT_TYPE_GEO) || |
|
667 | - ($sat->otype == Predict_SGPSDP::ORBIT_TYPE_DECAYED) || |
|
668 | - !$this->has_aos($sat, $qth)) { |
|
669 | - |
|
670 | - return 0.0; |
|
671 | - } |
|
672 | - |
|
673 | - while ($sat->el >= 0.0) { |
|
674 | - $aostime -= 0.0005; // 0.75 min |
|
675 | - $this->predict_calc($sat, $qth, $aostime); |
|
676 | - } |
|
677 | - |
|
678 | - return $aostime; |
|
679 | - } |
|
680 | - |
|
681 | - /** Determine whether satellite ever reaches AOS. |
|
682 | - * @author John A. Magliacane, KD2BD |
|
683 | - * @author Alexandru Csete, OZ9AEC |
|
684 | - * @param Predict_Sat $sat The satellite data. |
|
685 | - * @param Predict_QTH $qth The observer's location data |
|
686 | - * @return bool true if the satellite will reach AOS, false otherwise. |
|
687 | - * |
|
688 | - */ |
|
689 | - public function has_aos(Predict_Sat $sat, Predict_QTH $qth) |
|
690 | - { |
|
691 | - $retcode = false; |
|
692 | - |
|
693 | - /* FIXME */ |
|
694 | - if ($sat->meanmo == 0.0) { |
|
695 | - $retcode = false; |
|
696 | - } else { |
|
697 | - |
|
698 | - /* xincl is already in RAD by select_ephemeris */ |
|
699 | - $lin = $sat->tle->xincl; |
|
700 | - if ($lin >= self::pio2) { |
|
701 | - $lin = self::pi - $lin; |
|
702 | - } |
|
703 | - |
|
704 | - $sma = 331.25 * exp(log(1440.0 / $sat->meanmo) * (2.0 / 3.0)); |
|
705 | - $apogee = $sma * (1.0 + $sat->tle->eo) - self::xkmper; |
|
706 | - |
|
707 | - if ((acos(self::xkmper / ($apogee + self::xkmper)) + ($lin)) > abs($qth->lat * self::de2ra)) { |
|
708 | - $retcode = true; |
|
709 | - } else { |
|
710 | - $retcode = false; |
|
711 | - } |
|
712 | - } |
|
713 | - |
|
714 | - return $retcode; |
|
715 | - } |
|
716 | - |
|
717 | - /** Predict passes after a certain time. |
|
718 | - * |
|
719 | - * |
|
720 | - * This function calculates num upcoming passes with AOS no earlier |
|
721 | - * than t = start and not later that t = (start+maxdt). The function will |
|
722 | - * repeatedly call get_pass until |
|
723 | - * the number of predicted passes is equal to num, the time has reached |
|
724 | - * limit or the get_pass function returns NULL. |
|
725 | - * |
|
726 | - * note For no time limit use maxdt = 0.0 |
|
727 | - * |
|
728 | - * note the data in sat will be corrupt (future) and must be refreshed |
|
729 | - * by the caller, if the caller will need it later on (eg. if the caller |
|
730 | - * is GtkSatList). |
|
731 | - * |
|
732 | - * note Prepending to a singly linked list is much faster than appending. |
|
733 | - * Therefore, the elements are prepended whereafter the GSList is |
|
734 | - * reversed |
|
735 | - * |
|
736 | - * |
|
737 | - * @param Predict_Sat $sat The satellite data |
|
738 | - * @param Predict_QTH $qth The observer's location data |
|
739 | - * @param float $start The start julian date |
|
740 | - * @param int $maxdt The max # of days to look |
|
741 | - * @param int $num The max # of passes to get |
|
742 | - * @return array of Predict_Pass instances if found, empty array otherwise |
|
743 | - */ |
|
744 | - public function get_passes(Predict_Sat $sat, Predict_QTH $qth, $start, $maxdt, $num = 0) |
|
745 | - { |
|
746 | - $passes = array(); |
|
747 | - |
|
748 | - /* if no number has been specified |
|
663 | + $this->predict_calc($sat, $qth, $start); |
|
664 | + |
|
665 | + /* check whether satellite has aos */ |
|
666 | + if (($sat->otype == Predict_SGPSDP::ORBIT_TYPE_GEO) || |
|
667 | + ($sat->otype == Predict_SGPSDP::ORBIT_TYPE_DECAYED) || |
|
668 | + !$this->has_aos($sat, $qth)) { |
|
669 | + |
|
670 | + return 0.0; |
|
671 | + } |
|
672 | + |
|
673 | + while ($sat->el >= 0.0) { |
|
674 | + $aostime -= 0.0005; // 0.75 min |
|
675 | + $this->predict_calc($sat, $qth, $aostime); |
|
676 | + } |
|
677 | + |
|
678 | + return $aostime; |
|
679 | + } |
|
680 | + |
|
681 | + /** Determine whether satellite ever reaches AOS. |
|
682 | + * @author John A. Magliacane, KD2BD |
|
683 | + * @author Alexandru Csete, OZ9AEC |
|
684 | + * @param Predict_Sat $sat The satellite data. |
|
685 | + * @param Predict_QTH $qth The observer's location data |
|
686 | + * @return bool true if the satellite will reach AOS, false otherwise. |
|
687 | + * |
|
688 | + */ |
|
689 | + public function has_aos(Predict_Sat $sat, Predict_QTH $qth) |
|
690 | + { |
|
691 | + $retcode = false; |
|
692 | + |
|
693 | + /* FIXME */ |
|
694 | + if ($sat->meanmo == 0.0) { |
|
695 | + $retcode = false; |
|
696 | + } else { |
|
697 | + |
|
698 | + /* xincl is already in RAD by select_ephemeris */ |
|
699 | + $lin = $sat->tle->xincl; |
|
700 | + if ($lin >= self::pio2) { |
|
701 | + $lin = self::pi - $lin; |
|
702 | + } |
|
703 | + |
|
704 | + $sma = 331.25 * exp(log(1440.0 / $sat->meanmo) * (2.0 / 3.0)); |
|
705 | + $apogee = $sma * (1.0 + $sat->tle->eo) - self::xkmper; |
|
706 | + |
|
707 | + if ((acos(self::xkmper / ($apogee + self::xkmper)) + ($lin)) > abs($qth->lat * self::de2ra)) { |
|
708 | + $retcode = true; |
|
709 | + } else { |
|
710 | + $retcode = false; |
|
711 | + } |
|
712 | + } |
|
713 | + |
|
714 | + return $retcode; |
|
715 | + } |
|
716 | + |
|
717 | + /** Predict passes after a certain time. |
|
718 | + * |
|
719 | + * |
|
720 | + * This function calculates num upcoming passes with AOS no earlier |
|
721 | + * than t = start and not later that t = (start+maxdt). The function will |
|
722 | + * repeatedly call get_pass until |
|
723 | + * the number of predicted passes is equal to num, the time has reached |
|
724 | + * limit or the get_pass function returns NULL. |
|
725 | + * |
|
726 | + * note For no time limit use maxdt = 0.0 |
|
727 | + * |
|
728 | + * note the data in sat will be corrupt (future) and must be refreshed |
|
729 | + * by the caller, if the caller will need it later on (eg. if the caller |
|
730 | + * is GtkSatList). |
|
731 | + * |
|
732 | + * note Prepending to a singly linked list is much faster than appending. |
|
733 | + * Therefore, the elements are prepended whereafter the GSList is |
|
734 | + * reversed |
|
735 | + * |
|
736 | + * |
|
737 | + * @param Predict_Sat $sat The satellite data |
|
738 | + * @param Predict_QTH $qth The observer's location data |
|
739 | + * @param float $start The start julian date |
|
740 | + * @param int $maxdt The max # of days to look |
|
741 | + * @param int $num The max # of passes to get |
|
742 | + * @return array of Predict_Pass instances if found, empty array otherwise |
|
743 | + */ |
|
744 | + public function get_passes(Predict_Sat $sat, Predict_QTH $qth, $start, $maxdt, $num = 0) |
|
745 | + { |
|
746 | + $passes = array(); |
|
747 | + |
|
748 | + /* if no number has been specified |
|
749 | 749 | set it to something big */ |
750 | - if ($num == 0) { |
|
751 | - $num = 100; |
|
752 | - } |
|
750 | + if ($num == 0) { |
|
751 | + $num = 100; |
|
752 | + } |
|
753 | 753 | |
754 | - $t = $start; |
|
754 | + $t = $start; |
|
755 | 755 | |
756 | - for ($i = 0; $i < $num; $i++) { |
|
757 | - $pass = $this->get_pass($sat, $qth, $t, $maxdt); |
|
756 | + for ($i = 0; $i < $num; $i++) { |
|
757 | + $pass = $this->get_pass($sat, $qth, $t, $maxdt); |
|
758 | 758 | |
759 | - if ($pass != null) { |
|
760 | - $passes[] = $pass; |
|
761 | - $t = $pass->los + 0.014; // +20 min |
|
759 | + if ($pass != null) { |
|
760 | + $passes[] = $pass; |
|
761 | + $t = $pass->los + 0.014; // +20 min |
|
762 | 762 | |
763 | - /* if maxdt > 0.0 check whether we have reached t = start+maxdt |
|
763 | + /* if maxdt > 0.0 check whether we have reached t = start+maxdt |
|
764 | 764 | if yes finish predictions |
765 | 765 | */ |
766 | - if (($maxdt > 0.0) && ($t >= ($start + $maxdt))) { |
|
767 | - $i = $num; |
|
768 | - } |
|
769 | - } else { |
|
770 | - /* we can't get any more passes */ |
|
771 | - $i = $num; |
|
772 | - } |
|
773 | - } |
|
774 | - |
|
775 | - return $passes; |
|
776 | - } |
|
777 | - |
|
778 | - /** |
|
779 | - * Filters out visible passes and adds the visible aos, tca, los, and |
|
780 | - * corresponding az and ele for each. |
|
781 | - * |
|
782 | - * @param array $passes The passes returned from get_passes() |
|
783 | - * |
|
784 | - * @author Bill Shupp |
|
785 | - * @return array |
|
786 | - */ |
|
787 | - public function filterVisiblePasses(array $passes) |
|
788 | - { |
|
789 | - $filtered = array(); |
|
790 | - |
|
791 | - foreach ($passes as $result) { |
|
792 | - // Dummy check |
|
793 | - if ($result->vis[0] != 'V') { |
|
794 | - continue; |
|
795 | - } |
|
796 | - |
|
797 | - $aos = false; |
|
798 | - $aos_az = false; |
|
799 | - $aos = false; |
|
800 | - $tca = false; |
|
801 | - $los_az = false; |
|
802 | - $max_el = 0; |
|
803 | - |
|
804 | - foreach ($result->details as $detail) { |
|
805 | - if ($detail->vis != Predict::SAT_VIS_VISIBLE) { |
|
806 | - continue; |
|
807 | - } |
|
808 | - if ($detail->el < $this->minEle) { |
|
809 | - continue; |
|
810 | - } |
|
811 | - |
|
812 | - if ($aos == false) { |
|
813 | - $aos = $detail->time; |
|
814 | - $aos_az = $detail->az; |
|
815 | - $aos_el = $detail->el; |
|
816 | - $tca = $detail->time; |
|
817 | - $los = $detail->time; |
|
818 | - $los_az = $detail->az; |
|
819 | - $los_el = $detail->el; |
|
820 | - $max_el = $detail->el; |
|
821 | - $max_el_az = $detail->el; |
|
822 | - continue; |
|
823 | - } |
|
824 | - $los = $detail->time; |
|
825 | - $los_az = $detail->az; |
|
826 | - $los_el = $detail->el; |
|
827 | - |
|
828 | - if ($detail->el > $max_el) { |
|
829 | - $tca = $detail->time; |
|
830 | - $max_el = $detail->el; |
|
831 | - $max_el_az = $detail->az; |
|
832 | - } |
|
833 | - } |
|
834 | - |
|
835 | - if ($aos === false) { |
|
836 | - // Does not reach minimum elevation, skip |
|
837 | - continue; |
|
838 | - } |
|
839 | - |
|
840 | - $result->visible_aos = $aos; |
|
841 | - $result->visible_aos_az = $aos_az; |
|
842 | - $result->visible_aos_el = $aos_el; |
|
843 | - $result->visible_tca = $tca; |
|
844 | - $result->visible_max_el = $max_el; |
|
845 | - $result->visible_max_el_az = $max_el_az; |
|
846 | - $result->visible_los = $los; |
|
847 | - $result->visible_los_az = $los_az; |
|
848 | - $result->visible_los_el = $los_el; |
|
849 | - |
|
850 | - $filtered[] = $result; |
|
851 | - } |
|
852 | - |
|
853 | - return $filtered; |
|
854 | - } |
|
855 | - |
|
856 | - /** |
|
857 | - * Translates aziumuth degrees to compass direction: |
|
858 | - * |
|
859 | - * N (0°), NNE (22.5°), NE (45°), ENE (67.5°), E (90°), ESE (112.5°), |
|
860 | - * SE (135°), SSE (157.5°), S (180°), SSW (202.5°), SW (225°), |
|
861 | - * WSW (247.5°), W (270°), WNW (292.5°), NW (315°), NNW (337.5°) |
|
862 | - * |
|
863 | - * @param int $az The azimuth in degrees, defaults to 0 |
|
864 | - * |
|
865 | - * @return string |
|
866 | - */ |
|
867 | - public function azDegreesToDirection($az = 0) |
|
868 | - { |
|
869 | - $i = floor($az / 22.5); |
|
870 | - $m = (22.5 * (2 * $i + 1)) / 2; |
|
871 | - $i = ($az >= $m) ? $i + 1 : $i; |
|
872 | - |
|
873 | - return trim(substr('N NNENE ENEE ESESE SSES SSWSW WSWW WNWNW NNWN ', $i * 3, 3)); |
|
874 | - } |
|
766 | + if (($maxdt > 0.0) && ($t >= ($start + $maxdt))) { |
|
767 | + $i = $num; |
|
768 | + } |
|
769 | + } else { |
|
770 | + /* we can't get any more passes */ |
|
771 | + $i = $num; |
|
772 | + } |
|
773 | + } |
|
774 | + |
|
775 | + return $passes; |
|
776 | + } |
|
777 | + |
|
778 | + /** |
|
779 | + * Filters out visible passes and adds the visible aos, tca, los, and |
|
780 | + * corresponding az and ele for each. |
|
781 | + * |
|
782 | + * @param array $passes The passes returned from get_passes() |
|
783 | + * |
|
784 | + * @author Bill Shupp |
|
785 | + * @return array |
|
786 | + */ |
|
787 | + public function filterVisiblePasses(array $passes) |
|
788 | + { |
|
789 | + $filtered = array(); |
|
790 | + |
|
791 | + foreach ($passes as $result) { |
|
792 | + // Dummy check |
|
793 | + if ($result->vis[0] != 'V') { |
|
794 | + continue; |
|
795 | + } |
|
796 | + |
|
797 | + $aos = false; |
|
798 | + $aos_az = false; |
|
799 | + $aos = false; |
|
800 | + $tca = false; |
|
801 | + $los_az = false; |
|
802 | + $max_el = 0; |
|
803 | + |
|
804 | + foreach ($result->details as $detail) { |
|
805 | + if ($detail->vis != Predict::SAT_VIS_VISIBLE) { |
|
806 | + continue; |
|
807 | + } |
|
808 | + if ($detail->el < $this->minEle) { |
|
809 | + continue; |
|
810 | + } |
|
811 | + |
|
812 | + if ($aos == false) { |
|
813 | + $aos = $detail->time; |
|
814 | + $aos_az = $detail->az; |
|
815 | + $aos_el = $detail->el; |
|
816 | + $tca = $detail->time; |
|
817 | + $los = $detail->time; |
|
818 | + $los_az = $detail->az; |
|
819 | + $los_el = $detail->el; |
|
820 | + $max_el = $detail->el; |
|
821 | + $max_el_az = $detail->el; |
|
822 | + continue; |
|
823 | + } |
|
824 | + $los = $detail->time; |
|
825 | + $los_az = $detail->az; |
|
826 | + $los_el = $detail->el; |
|
827 | + |
|
828 | + if ($detail->el > $max_el) { |
|
829 | + $tca = $detail->time; |
|
830 | + $max_el = $detail->el; |
|
831 | + $max_el_az = $detail->az; |
|
832 | + } |
|
833 | + } |
|
834 | + |
|
835 | + if ($aos === false) { |
|
836 | + // Does not reach minimum elevation, skip |
|
837 | + continue; |
|
838 | + } |
|
839 | + |
|
840 | + $result->visible_aos = $aos; |
|
841 | + $result->visible_aos_az = $aos_az; |
|
842 | + $result->visible_aos_el = $aos_el; |
|
843 | + $result->visible_tca = $tca; |
|
844 | + $result->visible_max_el = $max_el; |
|
845 | + $result->visible_max_el_az = $max_el_az; |
|
846 | + $result->visible_los = $los; |
|
847 | + $result->visible_los_az = $los_az; |
|
848 | + $result->visible_los_el = $los_el; |
|
849 | + |
|
850 | + $filtered[] = $result; |
|
851 | + } |
|
852 | + |
|
853 | + return $filtered; |
|
854 | + } |
|
855 | + |
|
856 | + /** |
|
857 | + * Translates aziumuth degrees to compass direction: |
|
858 | + * |
|
859 | + * N (0°), NNE (22.5°), NE (45°), ENE (67.5°), E (90°), ESE (112.5°), |
|
860 | + * SE (135°), SSE (157.5°), S (180°), SSW (202.5°), SW (225°), |
|
861 | + * WSW (247.5°), W (270°), WNW (292.5°), NW (315°), NNW (337.5°) |
|
862 | + * |
|
863 | + * @param int $az The azimuth in degrees, defaults to 0 |
|
864 | + * |
|
865 | + * @return string |
|
866 | + */ |
|
867 | + public function azDegreesToDirection($az = 0) |
|
868 | + { |
|
869 | + $i = floor($az / 22.5); |
|
870 | + $m = (22.5 * (2 * $i + 1)) / 2; |
|
871 | + $i = ($az >= $m) ? $i + 1 : $i; |
|
872 | + |
|
873 | + return trim(substr('N NNENE ENEE ESESE SSES SSWSW WSWW WNWNW NNWN ', $i * 3, 3)); |
|
874 | + } |
|
875 | 875 | } |
@@ -636,8 +636,9 @@ |
||
636 | 636 | $t += $sat->el * sqrt($sat->alt) / 502500.0; |
637 | 637 | $this->predict_calc($sat, $qth, $t); |
638 | 638 | |
639 | - if (abs($sat->el) < 0.005) |
|
640 | - $lostime = $t; |
|
639 | + if (abs($sat->el) < 0.005) { |
|
640 | + $lostime = $t; |
|
641 | + } |
|
641 | 642 | } |
642 | 643 | } |
643 | 644 |
@@ -52,60 +52,60 @@ discard block |
||
52 | 52 | */ |
53 | 53 | class Predict |
54 | 54 | { |
55 | - const de2ra = 1.74532925E-2; /* Degrees to Radians */ |
|
56 | - const pi = 3.1415926535898; /* Pi */ |
|
57 | - const pio2 = 1.5707963267949; /* Pi/2 */ |
|
58 | - const x3pio2 = 4.71238898; /* 3*Pi/2 */ |
|
59 | - const twopi = 6.2831853071796; /* 2*Pi */ |
|
60 | - const e6a = 1.0E-6; |
|
61 | - const tothrd = 6.6666667E-1; /* 2/3 */ |
|
62 | - const xj2 = 1.0826158E-3; /* J2 Harmonic */ |
|
63 | - const xj3 = -2.53881E-6; /* J3 Harmonic */ |
|
64 | - const xj4 = -1.65597E-6; /* J4 Harmonic */ |
|
65 | - const xke = 7.43669161E-2; |
|
66 | - const xkmper = 6.378135E3; /* Earth radius km */ |
|
67 | - const xmnpda = 1.44E3; /* Minutes per day */ |
|
68 | - const km2mi = 0.621371; /* Kilometers per Mile */ |
|
69 | - const ae = 1.0; |
|
70 | - const ck2 = 5.413079E-4; |
|
71 | - const ck4 = 6.209887E-7; |
|
72 | - const __f = 3.352779E-3; |
|
73 | - const ge = 3.986008E5; |
|
74 | - const __s__ = 1.012229; |
|
75 | - const qoms2t = 1.880279E-09; |
|
76 | - const secday = 8.6400E4; /* Seconds per day */ |
|
77 | - const omega_E = 1.0027379; |
|
78 | - const omega_ER = 6.3003879; |
|
79 | - const zns = 1.19459E-5; |
|
80 | - const c1ss = 2.9864797E-6; |
|
81 | - const zes = 1.675E-2; |
|
82 | - const znl = 1.5835218E-4; |
|
83 | - const c1l = 4.7968065E-7; |
|
84 | - const zel = 5.490E-2; |
|
85 | - const zcosis = 9.1744867E-1; |
|
86 | - const zsinis = 3.9785416E-1; |
|
55 | + const de2ra = 1.74532925E-2; /* Degrees to Radians */ |
|
56 | + const pi = 3.1415926535898; /* Pi */ |
|
57 | + const pio2 = 1.5707963267949; /* Pi/2 */ |
|
58 | + const x3pio2 = 4.71238898; /* 3*Pi/2 */ |
|
59 | + const twopi = 6.2831853071796; /* 2*Pi */ |
|
60 | + const e6a = 1.0E-6; |
|
61 | + const tothrd = 6.6666667E-1; /* 2/3 */ |
|
62 | + const xj2 = 1.0826158E-3; /* J2 Harmonic */ |
|
63 | + const xj3 = -2.53881E-6; /* J3 Harmonic */ |
|
64 | + const xj4 = -1.65597E-6; /* J4 Harmonic */ |
|
65 | + const xke = 7.43669161E-2; |
|
66 | + const xkmper = 6.378135E3; /* Earth radius km */ |
|
67 | + const xmnpda = 1.44E3; /* Minutes per day */ |
|
68 | + const km2mi = 0.621371; /* Kilometers per Mile */ |
|
69 | + const ae = 1.0; |
|
70 | + const ck2 = 5.413079E-4; |
|
71 | + const ck4 = 6.209887E-7; |
|
72 | + const __f = 3.352779E-3; |
|
73 | + const ge = 3.986008E5; |
|
74 | + const __s__ = 1.012229; |
|
75 | + const qoms2t = 1.880279E-09; |
|
76 | + const secday = 8.6400E4; /* Seconds per day */ |
|
77 | + const omega_E = 1.0027379; |
|
78 | + const omega_ER = 6.3003879; |
|
79 | + const zns = 1.19459E-5; |
|
80 | + const c1ss = 2.9864797E-6; |
|
81 | + const zes = 1.675E-2; |
|
82 | + const znl = 1.5835218E-4; |
|
83 | + const c1l = 4.7968065E-7; |
|
84 | + const zel = 5.490E-2; |
|
85 | + const zcosis = 9.1744867E-1; |
|
86 | + const zsinis = 3.9785416E-1; |
|
87 | 87 | const zsings = -9.8088458E-1; |
88 | - const zcosgs = 1.945905E-1; |
|
89 | - const zcoshs = 1; |
|
90 | - const zsinhs = 0; |
|
91 | - const q22 = 1.7891679E-6; |
|
92 | - const q31 = 2.1460748E-6; |
|
93 | - const q33 = 2.2123015E-7; |
|
94 | - const g22 = 5.7686396; |
|
95 | - const g32 = 9.5240898E-1; |
|
96 | - const g44 = 1.8014998; |
|
97 | - const g52 = 1.0508330; |
|
98 | - const g54 = 4.4108898; |
|
99 | - const root22 = 1.7891679E-6; |
|
100 | - const root32 = 3.7393792E-7; |
|
101 | - const root44 = 7.3636953E-9; |
|
102 | - const root52 = 1.1428639E-7; |
|
103 | - const root54 = 2.1765803E-9; |
|
104 | - const thdt = 4.3752691E-3; |
|
105 | - const rho = 1.5696615E-1; |
|
106 | - const mfactor = 7.292115E-5; |
|
107 | - const __sr__ = 6.96000E5; /*Solar radius - kilometers (IAU 76)*/ |
|
108 | - const AU = 1.49597870E8; /*Astronomical unit - kilometers (IAU 76)*/ |
|
88 | + const zcosgs = 1.945905E-1; |
|
89 | + const zcoshs = 1; |
|
90 | + const zsinhs = 0; |
|
91 | + const q22 = 1.7891679E-6; |
|
92 | + const q31 = 2.1460748E-6; |
|
93 | + const q33 = 2.2123015E-7; |
|
94 | + const g22 = 5.7686396; |
|
95 | + const g32 = 9.5240898E-1; |
|
96 | + const g44 = 1.8014998; |
|
97 | + const g52 = 1.0508330; |
|
98 | + const g54 = 4.4108898; |
|
99 | + const root22 = 1.7891679E-6; |
|
100 | + const root32 = 3.7393792E-7; |
|
101 | + const root44 = 7.3636953E-9; |
|
102 | + const root52 = 1.1428639E-7; |
|
103 | + const root54 = 2.1765803E-9; |
|
104 | + const thdt = 4.3752691E-3; |
|
105 | + const rho = 1.5696615E-1; |
|
106 | + const mfactor = 7.292115E-5; |
|
107 | + const __sr__ = 6.96000E5; /*Solar radius - kilometers (IAU 76)*/ |
|
108 | + const AU = 1.49597870E8; /*Astronomical unit - kilometers (IAU 76)*/ |
|
109 | 109 | |
110 | 110 | /* visibility constants */ |
111 | 111 | const SAT_VIS_NONE = 0; |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function get_pass(Predict_Sat $sat_in, Predict_QTH $qth, $start, $maxdt) |
165 | 165 | { |
166 | - $aos = 0.0; /* time of AOS */ |
|
167 | - $tca = 0.0; /* time of TCA */ |
|
168 | - $los = 0.0; /* time of LOS */ |
|
169 | - $dt = 0.0; /* time diff */ |
|
170 | - $step = 0.0; /* time step */ |
|
166 | + $aos = 0.0; /* time of AOS */ |
|
167 | + $tca = 0.0; /* time of TCA */ |
|
168 | + $los = 0.0; /* time of LOS */ |
|
169 | + $dt = 0.0; /* time diff */ |
|
170 | + $step = 0.0; /* time step */ |
|
171 | 171 | $t0 = $start; |
172 | - $tres = 0.0; /* required time resolution */ |
|
172 | + $tres = 0.0; /* required time resolution */ |
|
173 | 173 | $max_el = 0.0; /* maximum elevation */ |
174 | 174 | $pass = null; |
175 | 175 | $detail = null; |
176 | 176 | $done = false; |
177 | - $iter = 0; /* number of iterations */ |
|
177 | + $iter = 0; /* number of iterations */ |
|
178 | 178 | /* FIXME: watchdog */ |
179 | 179 | |
180 | 180 | /*copy sat_in to a working structure*/ |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $sat_working = clone $sat_in; |
183 | 183 | |
184 | 184 | /* get time resolution; sat-cfg stores it in seconds */ |
185 | - $tres = $this->timeRes / 86400.0; |
|
185 | + $tres = $this->timeRes/86400.0; |
|
186 | 186 | |
187 | 187 | /* loop until we find a pass with elevation > SAT_CFG_INT_PRED_MIN_EL |
188 | 188 | or we run out of time |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | /* aos = 0.0 means no aos */ |
208 | 208 | if ($aos == 0.0) { |
209 | 209 | $done = true; |
210 | - } else if (($maxdt > 0.0) && ($aos > ($start + $maxdt)) ) { |
|
210 | + } else if (($maxdt > 0.0) && ($aos > ($start + $maxdt))) { |
|
211 | 211 | /* check whether we are within time limits; |
212 | 212 | maxdt = 0 mean no time limit. |
213 | 213 | */ |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $dt = $los - $aos; |
218 | 218 | |
219 | 219 | /* get time step, which will give us the max number of entries */ |
220 | - $step = $dt / $this->numEntries; |
|
220 | + $step = $dt/$this->numEntries; |
|
221 | 221 | |
222 | 222 | /* but if this is smaller than the required resolution |
223 | 223 | we go with the resolution |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | $solar_set = new Predict_ObsSet(); |
370 | 370 | |
371 | 371 | /* FIXME: could be passed as parameter */ |
372 | - $obs_geodetic->lon = $qth->lon * self::de2ra; |
|
373 | - $obs_geodetic->lat = $qth->lat * self::de2ra; |
|
374 | - $obs_geodetic->alt = $qth->alt / 1000.0; |
|
372 | + $obs_geodetic->lon = $qth->lon*self::de2ra; |
|
373 | + $obs_geodetic->lat = $qth->lat*self::de2ra; |
|
374 | + $obs_geodetic->alt = $qth->alt/1000.0; |
|
375 | 375 | $obs_geodetic->theta = 0; |
376 | 376 | |
377 | 377 | Predict_Solar::Calculate_Solar_Position($jul_utc, $solar_vector); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | |
453 | 453 | /* coarse time steps */ |
454 | 454 | while (($sat->el < -1.0) && ($t <= ($start + $maxdt))) { |
455 | - $t -= 0.00035 * ($sat->el * (($sat->alt / 8400.0) + 0.46) - 2.0); |
|
455 | + $t -= 0.00035*($sat->el*(($sat->alt/8400.0) + 0.46) - 2.0); |
|
456 | 456 | $this->predict_calc($sat, $qth, $t); |
457 | 457 | } |
458 | 458 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | if (abs($sat->el) < 0.005) { |
463 | 463 | $aostime = $t; |
464 | 464 | } else { |
465 | - $t -= $sat->el * sqrt($sat->alt) / 530000.0; |
|
465 | + $t -= $sat->el*sqrt($sat->alt)/530000.0; |
|
466 | 466 | $this->predict_calc($sat, $qth, $t); |
467 | 467 | } |
468 | 468 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | /* coarse time steps */ |
473 | 473 | while ($sat->el < -1.0) { |
474 | 474 | |
475 | - $t -= 0.00035 * ($sat->el * (($sat->alt / 8400.0) + 0.46) - 2.0); |
|
475 | + $t -= 0.00035*($sat->el*(($sat->alt/8400.0) + 0.46) - 2.0); |
|
476 | 476 | $this->predict_calc($sat, $qth, $t); |
477 | 477 | } |
478 | 478 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | if (abs($sat->el) < 0.005) { |
483 | 483 | $aostime = $t; |
484 | 484 | } else { |
485 | - $t -= $sat->el * sqrt($sat->alt) / 530000.0; |
|
485 | + $t -= $sat->el*sqrt($sat->alt)/530000.0; |
|
486 | 486 | $this->predict_calc($sat, $qth, $t); |
487 | 487 | } |
488 | 488 | |
@@ -504,13 +504,13 @@ discard block |
||
504 | 504 | $sat_geodetic = new Predict_Geodetic(); |
505 | 505 | $obs_geodetic = new Predict_Geodetic(); |
506 | 506 | |
507 | - $obs_geodetic->lon = $qth->lon * self::de2ra; |
|
508 | - $obs_geodetic->lat = $qth->lat * self::de2ra; |
|
509 | - $obs_geodetic->alt = $qth->alt / 1000.0; |
|
507 | + $obs_geodetic->lon = $qth->lon*self::de2ra; |
|
508 | + $obs_geodetic->lat = $qth->lat*self::de2ra; |
|
509 | + $obs_geodetic->alt = $qth->alt/1000.0; |
|
510 | 510 | $obs_geodetic->theta = 0; |
511 | 511 | |
512 | 512 | $sat->jul_utc = $t; |
513 | - $sat->tsince = ($sat->jul_utc - $sat->jul_epoch) * self::xmnpda; |
|
513 | + $sat->tsince = ($sat->jul_utc - $sat->jul_epoch)*self::xmnpda; |
|
514 | 514 | |
515 | 515 | /* call the norad routines according to the deep-space flag */ |
516 | 516 | $sgpsdp = Predict_SGPSDP::getInstance($sat); |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | Predict_Math::Convert_Sat_State($sat->pos, $sat->vel); |
524 | 524 | |
525 | 525 | /* get the velocity of the satellite */ |
526 | - $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z); |
|
526 | + $sat->vel->w = sqrt($sat->vel->x*$sat->vel->x + $sat->vel->y*$sat->vel->y + $sat->vel->z*$sat->vel->z); |
|
527 | 527 | $sat->velo = $sat->vel->w; |
528 | 528 | Predict_SGPObs::Calculate_Obs($sat->jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set); |
529 | 529 | Predict_SGPObs::Calculate_LatLonAlt($sat->jul_utc, $sat->pos, $sat_geodetic); |
@@ -544,16 +544,16 @@ discard block |
||
544 | 544 | $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon); |
545 | 545 | $sat->alt = $sat_geodetic->alt; |
546 | 546 | $sat->ma = Predict_Math::Degrees($sat->phase); |
547 | - $sat->ma *= 256.0 / 360.0; |
|
547 | + $sat->ma *= 256.0/360.0; |
|
548 | 548 | $sat->phase = Predict_Math::Degrees($sat->phase); |
549 | 549 | |
550 | 550 | /* same formulas, but the one from predict is nicer */ |
551 | 551 | //sat->footprint = 2.0 * xkmper * acos (xkmper/sat->pos.w); |
552 | - $sat->footprint = 12756.33 * acos(self::xkmper / (self::xkmper + $sat->alt)); |
|
552 | + $sat->footprint = 12756.33*acos(self::xkmper/(self::xkmper + $sat->alt)); |
|
553 | 553 | $age = $sat->jul_utc - $sat->jul_epoch; |
554 | - $sat->orbit = floor(($sat->tle->xno * self::xmnpda / self::twopi + |
|
555 | - $age * $sat->tle->bstar * self::ae) * $age + |
|
556 | - $sat->tle->xmo / self::twopi) + $sat->tle->revnum - 1; |
|
554 | + $sat->orbit = floor(($sat->tle->xno*self::xmnpda/self::twopi + |
|
555 | + $age*$sat->tle->bstar*self::ae)*$age + |
|
556 | + $sat->tle->xmo/self::twopi) + $sat->tle->revnum - 1; |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** Find the LOS time of the next pass. |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | /* check whether satellite has aos */ |
586 | 586 | if (($sat->otype == Predict_SGPSDP::ORBIT_TYPE_GEO) || |
587 | 587 | ($sat->otype == Predict_SGPSDP::ORBIT_TYPE_DECAYED) || |
588 | - !$this->has_aos ($sat, $qth)) { |
|
588 | + !$this->has_aos($sat, $qth)) { |
|
589 | 589 | |
590 | 590 | return 0.0; |
591 | 591 | } |
@@ -607,14 +607,14 @@ discard block |
||
607 | 607 | |
608 | 608 | /* coarse steps */ |
609 | 609 | while (($sat->el >= 1.0) && ($t <= ($start + $maxdt))) { |
610 | - $t += cos(($sat->el - 1.0) * self::de2ra) * sqrt($sat->alt) / 25000.0; |
|
610 | + $t += cos(($sat->el - 1.0)*self::de2ra)*sqrt($sat->alt)/25000.0; |
|
611 | 611 | $this->predict_calc($sat, $qth, $t); |
612 | 612 | } |
613 | 613 | |
614 | 614 | /* fine steps */ |
615 | - while (($lostime == 0.0) && ($t <= ($start + $maxdt))) { |
|
615 | + while (($lostime == 0.0) && ($t <= ($start + $maxdt))) { |
|
616 | 616 | |
617 | - $t += $sat->el * sqrt($sat->alt) / 502500.0; |
|
617 | + $t += $sat->el*sqrt($sat->alt)/502500.0; |
|
618 | 618 | $this->predict_calc($sat, $qth, $t); |
619 | 619 | |
620 | 620 | if (abs($sat->el) < 0.005) { |
@@ -626,14 +626,14 @@ discard block |
||
626 | 626 | |
627 | 627 | /* coarse steps */ |
628 | 628 | while ($sat->el >= 1.0) { |
629 | - $t += cos(($sat->el - 1.0) * self::de2ra) * sqrt($sat->alt) / 25000.0; |
|
629 | + $t += cos(($sat->el - 1.0)*self::de2ra)*sqrt($sat->alt)/25000.0; |
|
630 | 630 | $this->predict_calc($sat, $qth, $t); |
631 | 631 | } |
632 | 632 | |
633 | 633 | /* fine steps */ |
634 | 634 | while ($lostime == 0.0) { |
635 | 635 | |
636 | - $t += $sat->el * sqrt($sat->alt) / 502500.0; |
|
636 | + $t += $sat->el*sqrt($sat->alt)/502500.0; |
|
637 | 637 | $this->predict_calc($sat, $qth, $t); |
638 | 638 | |
639 | 639 | if (abs($sat->el) < 0.005) |
@@ -701,10 +701,10 @@ discard block |
||
701 | 701 | $lin = self::pi - $lin; |
702 | 702 | } |
703 | 703 | |
704 | - $sma = 331.25 * exp(log(1440.0 / $sat->meanmo) * (2.0 / 3.0)); |
|
705 | - $apogee = $sma * (1.0 + $sat->tle->eo) - self::xkmper; |
|
704 | + $sma = 331.25*exp(log(1440.0/$sat->meanmo)*(2.0/3.0)); |
|
705 | + $apogee = $sma*(1.0 + $sat->tle->eo) - self::xkmper; |
|
706 | 706 | |
707 | - if ((acos(self::xkmper / ($apogee + self::xkmper)) + ($lin)) > abs($qth->lat * self::de2ra)) { |
|
707 | + if ((acos(self::xkmper/($apogee + self::xkmper)) + ($lin)) > abs($qth->lat*self::de2ra)) { |
|
708 | 708 | $retcode = true; |
709 | 709 | } else { |
710 | 710 | $retcode = false; |
@@ -866,10 +866,10 @@ discard block |
||
866 | 866 | */ |
867 | 867 | public function azDegreesToDirection($az = 0) |
868 | 868 | { |
869 | - $i = floor($az / 22.5); |
|
870 | - $m = (22.5 * (2 * $i + 1)) / 2; |
|
869 | + $i = floor($az/22.5); |
|
870 | + $m = (22.5*(2*$i + 1))/2; |
|
871 | 871 | $i = ($az >= $m) ? $i + 1 : $i; |
872 | 872 | |
873 | - return trim(substr('N NNENE ENEE ESESE SSES SSWSW WSWW WNWNW NNWN ', $i * 3, 3)); |
|
873 | + return trim(substr('N NNENE ENEE ESESE SSES SSWSW WSWW WNWNW NNWN ', $i*3, 3)); |
|
874 | 874 | } |
875 | 875 | } |
@@ -42,6 +42,10 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /* Returns arccosine of rgument */ |
45 | + |
|
46 | + /** |
|
47 | + * @param double $arg |
|
48 | + */ |
|
45 | 49 | public static function ArcCos($arg) |
46 | 50 | { |
47 | 51 | return Predict::pio2 - self::ArcSin($arg); |
@@ -68,6 +72,10 @@ discard block |
||
68 | 72 | } |
69 | 73 | |
70 | 74 | /* Multiplies the vector v1 by the scalar k to produce the vector v2 */ |
75 | + |
|
76 | + /** |
|
77 | + * @param integer $k |
|
78 | + */ |
|
71 | 79 | public static function Scalar_Multiply($k, Predict_Vector $v1, Predict_Vector $v2) |
72 | 80 | { |
73 | 81 | $v2->x = $k * $v1->x; |
@@ -155,6 +163,10 @@ discard block |
||
155 | 163 | } |
156 | 164 | |
157 | 165 | /* Returns arg1 mod arg2 */ |
166 | + |
|
167 | + /** |
|
168 | + * @param double $arg1 |
|
169 | + */ |
|
158 | 170 | public static function Modulus($arg1, $arg2) |
159 | 171 | { |
160 | 172 | $ret_val = $arg1; |
@@ -169,6 +181,10 @@ discard block |
||
169 | 181 | } |
170 | 182 | |
171 | 183 | /* Returns fractional part of double argument */ |
184 | + |
|
185 | + /** |
|
186 | + * @param double $arg |
|
187 | + */ |
|
172 | 188 | public static function Frac($arg) |
173 | 189 | { |
174 | 190 | return $arg - floor($arg); |
@@ -19,178 +19,178 @@ |
||
19 | 19 | */ |
20 | 20 | class Predict_Math |
21 | 21 | { |
22 | - /* Returns sign of a float */ |
|
23 | - public static function Sign($arg) |
|
24 | - { |
|
25 | - if ($arg > 0 ) { |
|
26 | - return 1; |
|
27 | - } else if ($arg < 0 ) { |
|
28 | - return -1; |
|
29 | - } else { |
|
30 | - return 0; |
|
31 | - } |
|
32 | - } |
|
33 | - |
|
34 | - /* Returns the arcsine of the argument */ |
|
35 | - public static function ArcSin($arg) |
|
36 | - { |
|
37 | - if (abs($arg) >= 1 ) { |
|
38 | - return (self::Sign($arg) * Predict::pio2); |
|
39 | - } else { |
|
40 | - return(atan($arg / sqrt(1 - $arg * $arg))); |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - /* Returns arccosine of rgument */ |
|
45 | - public static function ArcCos($arg) |
|
46 | - { |
|
47 | - return Predict::pio2 - self::ArcSin($arg); |
|
48 | - } |
|
49 | - |
|
50 | - /* Adds vectors v1 and v2 together to produce v3 */ |
|
51 | - public static function Vec_Add(Predict_Vector $v1, Predict_Vector $v2, Predict_Vector $v3) |
|
52 | - { |
|
53 | - $v3->x = $v1->x + $v2->x; |
|
54 | - $v3->y = $v1->y + $v2->y; |
|
55 | - $v3->z = $v1->z + $v2->z; |
|
56 | - |
|
57 | - $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
58 | - } |
|
59 | - |
|
60 | - /* Subtracts vector v2 from v1 to produce v3 */ |
|
61 | - public static function Vec_Sub(Predict_Vector $v1, Predict_Vector $v2, Predict_Vector $v3) |
|
62 | - { |
|
63 | - $v3->x = $v1->x - $v2->x; |
|
64 | - $v3->y = $v1->y - $v2->y; |
|
65 | - $v3->z = $v1->z - $v2->z; |
|
66 | - |
|
67 | - $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
68 | - } |
|
69 | - |
|
70 | - /* Multiplies the vector v1 by the scalar k to produce the vector v2 */ |
|
71 | - public static function Scalar_Multiply($k, Predict_Vector $v1, Predict_Vector $v2) |
|
72 | - { |
|
73 | - $v2->x = $k * $v1->x; |
|
74 | - $v2->y = $k * $v1->y; |
|
75 | - $v2->z = $k * $v1->z; |
|
76 | - $v2->w = abs($k) * $v1->w; |
|
77 | - } |
|
78 | - |
|
79 | - /* Multiplies the vector v1 by the scalar k */ |
|
80 | - public static function Scale_Vector($k, Predict_Vector $v) |
|
81 | - { |
|
82 | - $v->x *= $k; |
|
83 | - $v->y *= $k; |
|
84 | - $v->z *= $k; |
|
85 | - |
|
86 | - $v->w = sqrt($v->x * $v->x + $v->y * $v->y + $v->z * $v->z); |
|
87 | - } |
|
88 | - |
|
89 | - /* Returns the dot product of two vectors */ |
|
90 | - public static function Dot(Predict_Vector $v1, Predict_Vector $v2) |
|
91 | - { |
|
92 | - return ($v1->x * $v2->x + $v1->y * $v2->y + $v1->z * $v2->z); |
|
93 | - } |
|
94 | - |
|
95 | - /* Calculates the angle between vectors v1 and v2 */ |
|
96 | - public static function Angle(Predict_Vector $v1, Predict_Vector $v2) |
|
97 | - { |
|
98 | - $v1->w = sqrt($v1->x * $v1->x + $v1->y * $v1->y + $v1->z * $v1->z); |
|
99 | - $v2->w = sqrt($v2->x * $v2->x + $v2->y * $v2->y + $v2->z * $v2->z); |
|
100 | - return (self::ArcCos(self::Dot($v1, $v2) / ($v1->w * $v2->w))); |
|
101 | - } |
|
102 | - |
|
103 | - /* Produces cross product of v1 and v2, and returns in v3 */ |
|
104 | - public static function Cross(Predict_Vector $v1, Predict_Vector $v2 ,Predict_Vector $v3) |
|
105 | - { |
|
106 | - $v3->x = $v1->y * $v2->z - $v1->z * $v2->y; |
|
107 | - $v3->y = $v1->z * $v2->x - $v1->x * $v2->z; |
|
108 | - $v3->z = $v1->x * $v2->y - $v1->y * $v2->x; |
|
109 | - |
|
110 | - $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
111 | - } |
|
112 | - |
|
113 | - /* Normalizes a vector */ |
|
114 | - public static function Normalize(Predict_Vector $v ) |
|
115 | - { |
|
116 | - $v->x /= $v->w; |
|
117 | - $v->y /= $v->w; |
|
118 | - $v->z /= $v->w; |
|
119 | - } |
|
120 | - |
|
121 | - /* Four-quadrant arctan function */ |
|
122 | - public static function AcTan($sinx, $cosx) |
|
123 | - { |
|
124 | - if ($cosx == 0) { |
|
125 | - if ($sinx > 0) { |
|
126 | - return Predict::pio2; |
|
127 | - } else { |
|
128 | - return Predict::x3pio2; |
|
129 | - } |
|
130 | - } else { |
|
131 | - if ($cosx > 0) { |
|
132 | - if ($sinx > 0) { |
|
133 | - return atan($sinx / $cosx); |
|
134 | - } else { |
|
135 | - return Predict::twopi + atan($sinx / $cosx); |
|
136 | - } |
|
137 | - } else { |
|
138 | - return Predict::pi + atan($sinx / $cosx); |
|
139 | - } |
|
140 | - } |
|
141 | - } |
|
142 | - |
|
143 | - /* Returns mod 2pi of argument */ |
|
144 | - public static function FMod2p($x) |
|
145 | - { |
|
146 | - $ret_val = $x; |
|
147 | - $i = (int) ($ret_val / Predict::twopi); |
|
148 | - $ret_val -= $i * Predict::twopi; |
|
149 | - |
|
150 | - if ($ret_val < 0) { |
|
151 | - $ret_val += Predict::twopi; |
|
152 | - } |
|
153 | - |
|
154 | - return $ret_val; |
|
155 | - } |
|
156 | - |
|
157 | - /* Returns arg1 mod arg2 */ |
|
158 | - public static function Modulus($arg1, $arg2) |
|
159 | - { |
|
160 | - $ret_val = $arg1; |
|
161 | - $i = (int) ($ret_val / $arg2); |
|
162 | - $ret_val -= $i * $arg2; |
|
163 | - |
|
164 | - if ($ret_val < 0) { |
|
165 | - $ret_val += $arg2; |
|
166 | - } |
|
167 | - |
|
168 | - return $ret_val; |
|
169 | - } |
|
170 | - |
|
171 | - /* Returns fractional part of double argument */ |
|
172 | - public static function Frac($arg) |
|
173 | - { |
|
174 | - return $arg - floor($arg); |
|
175 | - } |
|
176 | - |
|
177 | - /* Converts the satellite's position and velocity */ |
|
178 | - /* vectors from normalised values to km and km/sec */ |
|
179 | - public static function Convert_Sat_State(Predict_Vector $pos, Predict_Vector $vel) |
|
180 | - { |
|
181 | - self::Scale_Vector(Predict::xkmper, $pos); |
|
182 | - self::Scale_Vector(Predict::xkmper * Predict::xmnpda / Predict::secday, $vel); |
|
183 | - } |
|
184 | - |
|
185 | - /* Returns angle in radians from arg in degrees */ |
|
186 | - public static function Radians($arg) |
|
187 | - { |
|
188 | - return $arg * Predict::de2ra; |
|
189 | - } |
|
190 | - |
|
191 | - /* Returns angle in degrees from arg in rads */ |
|
192 | - public static function Degrees($arg) |
|
193 | - { |
|
194 | - return $arg / Predict::de2ra; |
|
195 | - } |
|
22 | + /* Returns sign of a float */ |
|
23 | + public static function Sign($arg) |
|
24 | + { |
|
25 | + if ($arg > 0 ) { |
|
26 | + return 1; |
|
27 | + } else if ($arg < 0 ) { |
|
28 | + return -1; |
|
29 | + } else { |
|
30 | + return 0; |
|
31 | + } |
|
32 | + } |
|
33 | + |
|
34 | + /* Returns the arcsine of the argument */ |
|
35 | + public static function ArcSin($arg) |
|
36 | + { |
|
37 | + if (abs($arg) >= 1 ) { |
|
38 | + return (self::Sign($arg) * Predict::pio2); |
|
39 | + } else { |
|
40 | + return(atan($arg / sqrt(1 - $arg * $arg))); |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + /* Returns arccosine of rgument */ |
|
45 | + public static function ArcCos($arg) |
|
46 | + { |
|
47 | + return Predict::pio2 - self::ArcSin($arg); |
|
48 | + } |
|
49 | + |
|
50 | + /* Adds vectors v1 and v2 together to produce v3 */ |
|
51 | + public static function Vec_Add(Predict_Vector $v1, Predict_Vector $v2, Predict_Vector $v3) |
|
52 | + { |
|
53 | + $v3->x = $v1->x + $v2->x; |
|
54 | + $v3->y = $v1->y + $v2->y; |
|
55 | + $v3->z = $v1->z + $v2->z; |
|
56 | + |
|
57 | + $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
58 | + } |
|
59 | + |
|
60 | + /* Subtracts vector v2 from v1 to produce v3 */ |
|
61 | + public static function Vec_Sub(Predict_Vector $v1, Predict_Vector $v2, Predict_Vector $v3) |
|
62 | + { |
|
63 | + $v3->x = $v1->x - $v2->x; |
|
64 | + $v3->y = $v1->y - $v2->y; |
|
65 | + $v3->z = $v1->z - $v2->z; |
|
66 | + |
|
67 | + $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
68 | + } |
|
69 | + |
|
70 | + /* Multiplies the vector v1 by the scalar k to produce the vector v2 */ |
|
71 | + public static function Scalar_Multiply($k, Predict_Vector $v1, Predict_Vector $v2) |
|
72 | + { |
|
73 | + $v2->x = $k * $v1->x; |
|
74 | + $v2->y = $k * $v1->y; |
|
75 | + $v2->z = $k * $v1->z; |
|
76 | + $v2->w = abs($k) * $v1->w; |
|
77 | + } |
|
78 | + |
|
79 | + /* Multiplies the vector v1 by the scalar k */ |
|
80 | + public static function Scale_Vector($k, Predict_Vector $v) |
|
81 | + { |
|
82 | + $v->x *= $k; |
|
83 | + $v->y *= $k; |
|
84 | + $v->z *= $k; |
|
85 | + |
|
86 | + $v->w = sqrt($v->x * $v->x + $v->y * $v->y + $v->z * $v->z); |
|
87 | + } |
|
88 | + |
|
89 | + /* Returns the dot product of two vectors */ |
|
90 | + public static function Dot(Predict_Vector $v1, Predict_Vector $v2) |
|
91 | + { |
|
92 | + return ($v1->x * $v2->x + $v1->y * $v2->y + $v1->z * $v2->z); |
|
93 | + } |
|
94 | + |
|
95 | + /* Calculates the angle between vectors v1 and v2 */ |
|
96 | + public static function Angle(Predict_Vector $v1, Predict_Vector $v2) |
|
97 | + { |
|
98 | + $v1->w = sqrt($v1->x * $v1->x + $v1->y * $v1->y + $v1->z * $v1->z); |
|
99 | + $v2->w = sqrt($v2->x * $v2->x + $v2->y * $v2->y + $v2->z * $v2->z); |
|
100 | + return (self::ArcCos(self::Dot($v1, $v2) / ($v1->w * $v2->w))); |
|
101 | + } |
|
102 | + |
|
103 | + /* Produces cross product of v1 and v2, and returns in v3 */ |
|
104 | + public static function Cross(Predict_Vector $v1, Predict_Vector $v2 ,Predict_Vector $v3) |
|
105 | + { |
|
106 | + $v3->x = $v1->y * $v2->z - $v1->z * $v2->y; |
|
107 | + $v3->y = $v1->z * $v2->x - $v1->x * $v2->z; |
|
108 | + $v3->z = $v1->x * $v2->y - $v1->y * $v2->x; |
|
109 | + |
|
110 | + $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
111 | + } |
|
112 | + |
|
113 | + /* Normalizes a vector */ |
|
114 | + public static function Normalize(Predict_Vector $v ) |
|
115 | + { |
|
116 | + $v->x /= $v->w; |
|
117 | + $v->y /= $v->w; |
|
118 | + $v->z /= $v->w; |
|
119 | + } |
|
120 | + |
|
121 | + /* Four-quadrant arctan function */ |
|
122 | + public static function AcTan($sinx, $cosx) |
|
123 | + { |
|
124 | + if ($cosx == 0) { |
|
125 | + if ($sinx > 0) { |
|
126 | + return Predict::pio2; |
|
127 | + } else { |
|
128 | + return Predict::x3pio2; |
|
129 | + } |
|
130 | + } else { |
|
131 | + if ($cosx > 0) { |
|
132 | + if ($sinx > 0) { |
|
133 | + return atan($sinx / $cosx); |
|
134 | + } else { |
|
135 | + return Predict::twopi + atan($sinx / $cosx); |
|
136 | + } |
|
137 | + } else { |
|
138 | + return Predict::pi + atan($sinx / $cosx); |
|
139 | + } |
|
140 | + } |
|
141 | + } |
|
142 | + |
|
143 | + /* Returns mod 2pi of argument */ |
|
144 | + public static function FMod2p($x) |
|
145 | + { |
|
146 | + $ret_val = $x; |
|
147 | + $i = (int) ($ret_val / Predict::twopi); |
|
148 | + $ret_val -= $i * Predict::twopi; |
|
149 | + |
|
150 | + if ($ret_val < 0) { |
|
151 | + $ret_val += Predict::twopi; |
|
152 | + } |
|
153 | + |
|
154 | + return $ret_val; |
|
155 | + } |
|
156 | + |
|
157 | + /* Returns arg1 mod arg2 */ |
|
158 | + public static function Modulus($arg1, $arg2) |
|
159 | + { |
|
160 | + $ret_val = $arg1; |
|
161 | + $i = (int) ($ret_val / $arg2); |
|
162 | + $ret_val -= $i * $arg2; |
|
163 | + |
|
164 | + if ($ret_val < 0) { |
|
165 | + $ret_val += $arg2; |
|
166 | + } |
|
167 | + |
|
168 | + return $ret_val; |
|
169 | + } |
|
170 | + |
|
171 | + /* Returns fractional part of double argument */ |
|
172 | + public static function Frac($arg) |
|
173 | + { |
|
174 | + return $arg - floor($arg); |
|
175 | + } |
|
176 | + |
|
177 | + /* Converts the satellite's position and velocity */ |
|
178 | + /* vectors from normalised values to km and km/sec */ |
|
179 | + public static function Convert_Sat_State(Predict_Vector $pos, Predict_Vector $vel) |
|
180 | + { |
|
181 | + self::Scale_Vector(Predict::xkmper, $pos); |
|
182 | + self::Scale_Vector(Predict::xkmper * Predict::xmnpda / Predict::secday, $vel); |
|
183 | + } |
|
184 | + |
|
185 | + /* Returns angle in radians from arg in degrees */ |
|
186 | + public static function Radians($arg) |
|
187 | + { |
|
188 | + return $arg * Predict::de2ra; |
|
189 | + } |
|
190 | + |
|
191 | + /* Returns angle in degrees from arg in rads */ |
|
192 | + public static function Degrees($arg) |
|
193 | + { |
|
194 | + return $arg / Predict::de2ra; |
|
195 | + } |
|
196 | 196 | } |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | /* Returns sign of a float */ |
23 | 23 | public static function Sign($arg) |
24 | 24 | { |
25 | - if ($arg > 0 ) { |
|
25 | + if ($arg > 0) { |
|
26 | 26 | return 1; |
27 | - } else if ($arg < 0 ) { |
|
27 | + } else if ($arg < 0) { |
|
28 | 28 | return -1; |
29 | 29 | } else { |
30 | 30 | return 0; |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | /* Returns the arcsine of the argument */ |
35 | 35 | public static function ArcSin($arg) |
36 | 36 | { |
37 | - if (abs($arg) >= 1 ) { |
|
38 | - return (self::Sign($arg) * Predict::pio2); |
|
37 | + if (abs($arg) >= 1) { |
|
38 | + return (self::Sign($arg)*Predict::pio2); |
|
39 | 39 | } else { |
40 | - return(atan($arg / sqrt(1 - $arg * $arg))); |
|
40 | + return(atan($arg/sqrt(1 - $arg*$arg))); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $v3->y = $v1->y + $v2->y; |
55 | 55 | $v3->z = $v1->z + $v2->z; |
56 | 56 | |
57 | - $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
57 | + $v3->w = sqrt($v3->x*$v3->x + $v3->y*$v3->y + $v3->z*$v3->z); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /* Subtracts vector v2 from v1 to produce v3 */ |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | $v3->y = $v1->y - $v2->y; |
65 | 65 | $v3->z = $v1->z - $v2->z; |
66 | 66 | |
67 | - $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
67 | + $v3->w = sqrt($v3->x*$v3->x + $v3->y*$v3->y + $v3->z*$v3->z); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /* Multiplies the vector v1 by the scalar k to produce the vector v2 */ |
71 | 71 | public static function Scalar_Multiply($k, Predict_Vector $v1, Predict_Vector $v2) |
72 | 72 | { |
73 | - $v2->x = $k * $v1->x; |
|
74 | - $v2->y = $k * $v1->y; |
|
75 | - $v2->z = $k * $v1->z; |
|
76 | - $v2->w = abs($k) * $v1->w; |
|
73 | + $v2->x = $k*$v1->x; |
|
74 | + $v2->y = $k*$v1->y; |
|
75 | + $v2->z = $k*$v1->z; |
|
76 | + $v2->w = abs($k)*$v1->w; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /* Multiplies the vector v1 by the scalar k */ |
@@ -83,35 +83,35 @@ discard block |
||
83 | 83 | $v->y *= $k; |
84 | 84 | $v->z *= $k; |
85 | 85 | |
86 | - $v->w = sqrt($v->x * $v->x + $v->y * $v->y + $v->z * $v->z); |
|
86 | + $v->w = sqrt($v->x*$v->x + $v->y*$v->y + $v->z*$v->z); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /* Returns the dot product of two vectors */ |
90 | 90 | public static function Dot(Predict_Vector $v1, Predict_Vector $v2) |
91 | 91 | { |
92 | - return ($v1->x * $v2->x + $v1->y * $v2->y + $v1->z * $v2->z); |
|
92 | + return ($v1->x*$v2->x + $v1->y*$v2->y + $v1->z*$v2->z); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /* Calculates the angle between vectors v1 and v2 */ |
96 | 96 | public static function Angle(Predict_Vector $v1, Predict_Vector $v2) |
97 | 97 | { |
98 | - $v1->w = sqrt($v1->x * $v1->x + $v1->y * $v1->y + $v1->z * $v1->z); |
|
99 | - $v2->w = sqrt($v2->x * $v2->x + $v2->y * $v2->y + $v2->z * $v2->z); |
|
100 | - return (self::ArcCos(self::Dot($v1, $v2) / ($v1->w * $v2->w))); |
|
98 | + $v1->w = sqrt($v1->x*$v1->x + $v1->y*$v1->y + $v1->z*$v1->z); |
|
99 | + $v2->w = sqrt($v2->x*$v2->x + $v2->y*$v2->y + $v2->z*$v2->z); |
|
100 | + return (self::ArcCos(self::Dot($v1, $v2)/($v1->w*$v2->w))); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /* Produces cross product of v1 and v2, and returns in v3 */ |
104 | - public static function Cross(Predict_Vector $v1, Predict_Vector $v2 ,Predict_Vector $v3) |
|
104 | + public static function Cross(Predict_Vector $v1, Predict_Vector $v2, Predict_Vector $v3) |
|
105 | 105 | { |
106 | - $v3->x = $v1->y * $v2->z - $v1->z * $v2->y; |
|
107 | - $v3->y = $v1->z * $v2->x - $v1->x * $v2->z; |
|
108 | - $v3->z = $v1->x * $v2->y - $v1->y * $v2->x; |
|
106 | + $v3->x = $v1->y*$v2->z - $v1->z*$v2->y; |
|
107 | + $v3->y = $v1->z*$v2->x - $v1->x*$v2->z; |
|
108 | + $v3->z = $v1->x*$v2->y - $v1->y*$v2->x; |
|
109 | 109 | |
110 | - $v3->w = sqrt($v3->x * $v3->x + $v3->y * $v3->y + $v3->z * $v3->z); |
|
110 | + $v3->w = sqrt($v3->x*$v3->x + $v3->y*$v3->y + $v3->z*$v3->z); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /* Normalizes a vector */ |
114 | - public static function Normalize(Predict_Vector $v ) |
|
114 | + public static function Normalize(Predict_Vector $v) |
|
115 | 115 | { |
116 | 116 | $v->x /= $v->w; |
117 | 117 | $v->y /= $v->w; |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | } else { |
131 | 131 | if ($cosx > 0) { |
132 | 132 | if ($sinx > 0) { |
133 | - return atan($sinx / $cosx); |
|
133 | + return atan($sinx/$cosx); |
|
134 | 134 | } else { |
135 | - return Predict::twopi + atan($sinx / $cosx); |
|
135 | + return Predict::twopi + atan($sinx/$cosx); |
|
136 | 136 | } |
137 | 137 | } else { |
138 | - return Predict::pi + atan($sinx / $cosx); |
|
138 | + return Predict::pi + atan($sinx/$cosx); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | public static function FMod2p($x) |
145 | 145 | { |
146 | 146 | $ret_val = $x; |
147 | - $i = (int) ($ret_val / Predict::twopi); |
|
148 | - $ret_val -= $i * Predict::twopi; |
|
147 | + $i = (int) ($ret_val/Predict::twopi); |
|
148 | + $ret_val -= $i*Predict::twopi; |
|
149 | 149 | |
150 | 150 | if ($ret_val < 0) { |
151 | 151 | $ret_val += Predict::twopi; |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | public static function Modulus($arg1, $arg2) |
159 | 159 | { |
160 | 160 | $ret_val = $arg1; |
161 | - $i = (int) ($ret_val / $arg2); |
|
162 | - $ret_val -= $i * $arg2; |
|
161 | + $i = (int) ($ret_val/$arg2); |
|
162 | + $ret_val -= $i*$arg2; |
|
163 | 163 | |
164 | 164 | if ($ret_val < 0) { |
165 | 165 | $ret_val += $arg2; |
@@ -179,18 +179,18 @@ discard block |
||
179 | 179 | public static function Convert_Sat_State(Predict_Vector $pos, Predict_Vector $vel) |
180 | 180 | { |
181 | 181 | self::Scale_Vector(Predict::xkmper, $pos); |
182 | - self::Scale_Vector(Predict::xkmper * Predict::xmnpda / Predict::secday, $vel); |
|
182 | + self::Scale_Vector(Predict::xkmper*Predict::xmnpda/Predict::secday, $vel); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /* Returns angle in radians from arg in degrees */ |
186 | 186 | public static function Radians($arg) |
187 | 187 | { |
188 | - return $arg * Predict::de2ra; |
|
188 | + return $arg*Predict::de2ra; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /* Returns angle in degrees from arg in rads */ |
192 | 192 | public static function Degrees($arg) |
193 | 193 | { |
194 | - return $arg / Predict::de2ra; |
|
194 | + return $arg/Predict::de2ra; |
|
195 | 195 | } |
196 | 196 | } |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** Initialise satellite data. |
127 | - * @param sat The satellite to initialise. |
|
128 | - * @param qth Optional QTH info, use (0,0) if NULL. |
|
127 | + * @param sat Predict_Sat satellite to initialise. |
|
128 | + * @param qth Predict_QTH QTH info, use (0,0) if NULL. |
|
129 | 129 | * |
130 | 130 | * This function calculates the satellite data at t = 0, ie. epoch time |
131 | 131 | * The function is called automatically by gtk_sat_data_read_sat. |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | |
217 | 217 | /** Determinte whether satellite is in geostationary orbit. |
218 | 218 | * @author John A. Magliacane, KD2BD |
219 | - * @param sat Pointer to satellite data. |
|
220 | - * @return TRUE if the satellite appears to be in geostationary orbit, |
|
219 | + * @param sat Predict_Sat to satellite data. |
|
220 | + * @return boolean if the satellite appears to be in geostationary orbit, |
|
221 | 221 | * FALSE otherwise. |
222 | 222 | * |
223 | 223 | * A satellite is in geostationary orbit if |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | /** Determine whether satellite has decayed. |
240 | 240 | * @author John A. Magliacane, KD2BD |
241 | 241 | * @author Alexandru Csete, OZ9AEC |
242 | - * @param sat Pointer to satellite data. |
|
243 | - * @return TRUE if the satellite appears to have decayed, FALSE otherwise. |
|
242 | + * @param sat Predict_Sat to satellite data. |
|
243 | + * @return boolean if the satellite appears to have decayed, FALSE otherwise. |
|
244 | 244 | * @bug Modified version of the predict code but it is not tested. |
245 | 245 | * |
246 | 246 | * A satellite is decayed if |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @param float $time The daynum the satellite is calculated for |
274 | 274 | * @param Predict_QTH $qth The observer location |
275 | 275 | * |
276 | - * @return null on failure, float otherwise |
|
276 | + * @return null|double on failure, float otherwise |
|
277 | 277 | */ |
278 | 278 | public function calculateApparentMagnitude($time, Predict_QTH $qth) |
279 | 279 | { |
@@ -22,304 +22,304 @@ |
||
22 | 22 | */ |
23 | 23 | class Predict_Sat |
24 | 24 | { |
25 | - // Fifth root of a hundred, used for magnitude calculation |
|
26 | - const POGSONS_RATIO = 2.5118864315096; |
|
27 | - |
|
28 | - public $name = null; |
|
29 | - public $nickname = null; |
|
30 | - public $website = null; |
|
31 | - |
|
32 | - public $tle = null; /*!< Keplerian elements */ |
|
33 | - public $flags = 0; /*!< Flags for algo ctrl */ |
|
34 | - public $sgps = null; |
|
35 | - public $dps = null; |
|
36 | - public $deep_arg = null; |
|
37 | - public $pos = null; /*!< Raw position and range */ |
|
38 | - public $vel = null; /*!< Raw velocity */ |
|
39 | - |
|
40 | - /*** FIXME: REMOVE */ |
|
41 | - public $bearing = null; /*!< Az, El, range and vel */ |
|
42 | - public $astro = null; /*!< Ra and Decl */ |
|
43 | - /*** END */ |
|
44 | - |
|
45 | - /* time keeping fields */ |
|
46 | - public $jul_epoch = null; |
|
47 | - public $jul_utc = null; |
|
48 | - public $tsince = null; |
|
49 | - public $aos = null; /*!< Next AOS. */ |
|
50 | - public $los = null; /*!< Next LOS */ |
|
51 | - |
|
52 | - public $az = null; /*!< Azimuth [deg] */ |
|
53 | - public $el = null; /*!< Elevation [deg] */ |
|
54 | - public $range = null; /*!< Range [km] */ |
|
55 | - public $range_rate = null; /*!< Range Rate [km/sec] */ |
|
56 | - public $ra = null; /*!< Right Ascension [deg] */ |
|
57 | - public $dec = null; /*!< Declination [deg] */ |
|
58 | - public $ssplat = null; /*!< SSP latitude [deg] */ |
|
59 | - public $ssplon = null; /*!< SSP longitude [deg] */ |
|
60 | - public $alt = null; /*!< altitude [km] */ |
|
61 | - public $velo = null; /*!< velocity [km/s] */ |
|
62 | - public $ma = null; /*!< mean anomaly */ |
|
63 | - public $footprint = null; /*!< footprint */ |
|
64 | - public $phase = null; /*!< orbit phase */ |
|
65 | - public $meanmo = null; /*!< mean motion kept in rev/day */ |
|
66 | - public $orbit = null; /*!< orbit number */ |
|
67 | - public $otype = null; /*!< orbit type. */ |
|
68 | - |
|
69 | - public function __construct(Predict_TLE $tle) |
|
70 | - { |
|
71 | - $headerParts = explode(' ', $tle->header); |
|
72 | - $this->name = $headerParts[0]; |
|
73 | - $this->nickname = $this->name; |
|
74 | - $this->tle = $tle; |
|
75 | - $this->pos = new Predict_Vector(); |
|
76 | - $this->vel = new Predict_Vector(); |
|
77 | - $this->sgps = new Predict_SGSDPStatic(); |
|
78 | - $this->deep_arg = new Predict_DeepArg(); |
|
79 | - $this->dps = new Predict_DeepStatic(); |
|
80 | - |
|
81 | - $this->select_ephemeris(); |
|
82 | - $this->sat_data_init_sat($this); |
|
83 | - } |
|
84 | - |
|
85 | - /* Selects the apropriate ephemeris type to be used */ |
|
86 | - /* for predictions according to the data in the TLE */ |
|
87 | - /* It also processes values in the tle set so that */ |
|
88 | - /* they are apropriate for the sgp4/sdp4 routines */ |
|
89 | - public function select_ephemeris() |
|
90 | - { |
|
91 | - /* Preprocess tle set */ |
|
92 | - $this->tle->xnodeo *= Predict::de2ra; |
|
93 | - $this->tle->omegao *= Predict::de2ra; |
|
94 | - $this->tle->xmo *= Predict::de2ra; |
|
95 | - $this->tle->xincl *= Predict::de2ra; |
|
96 | - $temp = Predict::twopi / Predict::xmnpda / Predict::xmnpda; |
|
97 | - |
|
98 | - /* store mean motion before conversion */ |
|
99 | - $this->meanmo = $this->tle->xno; |
|
100 | - $this->tle->xno = $this->tle->xno * $temp * Predict::xmnpda; |
|
101 | - $this->tle->xndt2o *= $temp; |
|
102 | - $this->tle->xndd6o = $this->tle->xndd6o * $temp / Predict::xmnpda; |
|
103 | - $this->tle->bstar /= Predict::ae; |
|
104 | - |
|
105 | - /* Period > 225 minutes is deep space */ |
|
106 | - $dd1 = Predict::xke / $this->tle->xno; |
|
107 | - $dd2 = Predict::tothrd; |
|
108 | - $a1 = pow($dd1, $dd2); |
|
109 | - $r1 = cos($this->tle->xincl); |
|
110 | - $dd1 = 1.0 - $this->tle->eo * $this->tle->eo; |
|
111 | - $temp = Predict::ck2 * 1.5 * ($r1 * $r1 * 3.0 - 1.0) / pow($dd1, 1.5); |
|
112 | - $del1 = $temp / ($a1 * $a1); |
|
113 | - $ao = $a1 * (1.0 - $del1 * (Predict::tothrd * 0.5 + $del1 * |
|
114 | - ($del1 * 1.654320987654321 + 1.0))); |
|
115 | - $delo = $temp / ($ao * $ao); |
|
116 | - $xnodp = $this->tle->xno / ($delo + 1.0); |
|
117 | - |
|
118 | - /* Select a deep-space/near-earth ephemeris */ |
|
119 | - if (Predict::twopi / $xnodp / Predict::xmnpda >= .15625) { |
|
120 | - $this->flags |= Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG; |
|
121 | - } else { |
|
122 | - $this->flags &= ~Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG; |
|
123 | - } |
|
124 | - } |
|
125 | - |
|
126 | - /** Initialise satellite data. |
|
127 | - * @param sat The satellite to initialise. |
|
128 | - * @param qth Optional QTH info, use (0,0) if NULL. |
|
129 | - * |
|
130 | - * This function calculates the satellite data at t = 0, ie. epoch time |
|
131 | - * The function is called automatically by gtk_sat_data_read_sat. |
|
132 | - */ |
|
133 | - public function sat_data_init_sat(Predict_Sat $sat, Predict_QTH $qth = null) |
|
134 | - { |
|
135 | - $obs_geodetic = new Predict_Geodetic(); |
|
136 | - $obs_set = new Predict_ObsSet(); |
|
137 | - $sat_geodetic = new Predict_Geodetic(); |
|
138 | - /* double jul_utc, age; */ |
|
139 | - |
|
140 | - $jul_utc = Predict_Time::Julian_Date_of_Epoch($sat->tle->epoch); // => tsince = 0.0 |
|
141 | - $sat->jul_epoch = $jul_utc; |
|
142 | - |
|
143 | - /* initialise observer location */ |
|
144 | - if ($qth != null) { |
|
145 | - $obs_geodetic->lon = $qth->lon * Predict::de2ra; |
|
146 | - $obs_geodetic->lat = $qth->lat * Predict::de2ra; |
|
147 | - $obs_geodetic->alt = $qth->alt / 1000.0; |
|
148 | - $obs_geodetic->theta = 0; |
|
149 | - } |
|
150 | - else { |
|
151 | - $obs_geodetic->lon = 0.0; |
|
152 | - $obs_geodetic->lat = 0.0; |
|
153 | - $obs_geodetic->alt = 0.0; |
|
154 | - $obs_geodetic->theta = 0; |
|
155 | - } |
|
156 | - |
|
157 | - /* execute computations */ |
|
158 | - $sdpsgp = Predict_SGPSDP::getInstance($sat); |
|
159 | - if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) { |
|
160 | - $sdpsgp->SDP4($sat, 0.0); |
|
161 | - } else { |
|
162 | - $sdpsgp->SGP4($sat, 0.0); |
|
163 | - } |
|
164 | - |
|
165 | - /* scale position and velocity to km and km/sec */ |
|
166 | - Predict_Math::Convert_Sat_State($sat->pos, $sat->vel); |
|
167 | - |
|
168 | - /* get the velocity of the satellite */ |
|
169 | - $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z); |
|
170 | - $sat->velo = $sat->vel->w; |
|
171 | - Predict_SGPObs::Calculate_Obs($jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set); |
|
172 | - Predict_SGPObs::Calculate_LatLonAlt($jul_utc, $sat->pos, $sat_geodetic); |
|
173 | - |
|
174 | - while ($sat_geodetic->lon < -Predict::pi) { |
|
175 | - $sat_geodetic->lon += Predict::twopi; |
|
176 | - } |
|
177 | - |
|
178 | - while ($sat_geodetic->lon > Predict::pi) { |
|
179 | - $sat_geodetic->lon -= Predict::twopi; |
|
180 | - } |
|
181 | - |
|
182 | - $sat->az = Predict_Math::Degrees($obs_set->az); |
|
183 | - $sat->el = Predict_Math::Degrees($obs_set->el); |
|
184 | - $sat->range = $obs_set->range; |
|
185 | - $sat->range_rate = $obs_set->range_rate; |
|
186 | - $sat->ssplat = Predict_Math::Degrees($sat_geodetic->lat); |
|
187 | - $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon); |
|
188 | - $sat->alt = $sat_geodetic->alt; |
|
189 | - $sat->ma = Predict_Math::Degrees($sat->phase); |
|
190 | - $sat->ma *= 256.0 / 360.0; |
|
191 | - $sat->footprint = 2.0 * Predict::xkmper * acos (Predict::xkmper/$sat->pos->w); |
|
192 | - $age = 0.0; |
|
193 | - $sat->orbit = floor(($sat->tle->xno * Predict::xmnpda / Predict::twopi + |
|
194 | - $age * $sat->tle->bstar * Predict::ae) * $age + |
|
195 | - $sat->tle->xmo / Predict::twopi) + $sat->tle->revnum - 1; |
|
196 | - |
|
197 | - /* orbit type */ |
|
198 | - $sat->otype = $sat->get_orbit_type($sat); |
|
199 | - } |
|
200 | - |
|
201 | - public function get_orbit_type(Predict_Sat $sat) |
|
202 | - { |
|
203 | - $orbit = Predict_SGPSDP::ORBIT_TYPE_UNKNOWN; |
|
204 | - |
|
205 | - if ($this->geostationary($sat)) { |
|
206 | - $orbit = Predict_SGPSDP::ORBIT_TYPE_GEO; |
|
207 | - } else if ($this->decayed($sat)) { |
|
208 | - $orbit = Predict_SGPSDP::ORBIT_TYPE_DECAYED; |
|
209 | - } else { |
|
210 | - $orbit = Predict_SGPSDP::ORBIT_TYPE_UNKNOWN; |
|
211 | - } |
|
212 | - |
|
213 | - return $orbit; |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - /** Determinte whether satellite is in geostationary orbit. |
|
218 | - * @author John A. Magliacane, KD2BD |
|
219 | - * @param sat Pointer to satellite data. |
|
220 | - * @return TRUE if the satellite appears to be in geostationary orbit, |
|
221 | - * FALSE otherwise. |
|
222 | - * |
|
223 | - * A satellite is in geostationary orbit if |
|
224 | - * |
|
225 | - * fabs (sat.meanmotion - 1.0027) < 0.0002 |
|
226 | - * |
|
227 | - * Note: Appearantly, the mean motion can deviate much more from 1.0027 than 0.0002 |
|
228 | - */ |
|
229 | - public function geostationary(Predict_Sat $sat) |
|
230 | - { |
|
231 | - if (abs($sat->meanmo - 1.0027) < 0.0002) { |
|
232 | - return true; |
|
233 | - } else { |
|
234 | - return false; |
|
235 | - } |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - /** Determine whether satellite has decayed. |
|
240 | - * @author John A. Magliacane, KD2BD |
|
241 | - * @author Alexandru Csete, OZ9AEC |
|
242 | - * @param sat Pointer to satellite data. |
|
243 | - * @return TRUE if the satellite appears to have decayed, FALSE otherwise. |
|
244 | - * @bug Modified version of the predict code but it is not tested. |
|
245 | - * |
|
246 | - * A satellite is decayed if |
|
247 | - * |
|
248 | - * satepoch + ((16.666666 - sat.meanmo) / (10.0*fabs(sat.drag))) < "now" |
|
249 | - * |
|
250 | - */ |
|
251 | - public function decayed(Predict_Sat $sat) |
|
252 | - { |
|
253 | - /* tle.xndt2o/(twopi/xmnpda/xmnpda) is the value before converted the |
|
25 | + // Fifth root of a hundred, used for magnitude calculation |
|
26 | + const POGSONS_RATIO = 2.5118864315096; |
|
27 | + |
|
28 | + public $name = null; |
|
29 | + public $nickname = null; |
|
30 | + public $website = null; |
|
31 | + |
|
32 | + public $tle = null; /*!< Keplerian elements */ |
|
33 | + public $flags = 0; /*!< Flags for algo ctrl */ |
|
34 | + public $sgps = null; |
|
35 | + public $dps = null; |
|
36 | + public $deep_arg = null; |
|
37 | + public $pos = null; /*!< Raw position and range */ |
|
38 | + public $vel = null; /*!< Raw velocity */ |
|
39 | + |
|
40 | + /*** FIXME: REMOVE */ |
|
41 | + public $bearing = null; /*!< Az, El, range and vel */ |
|
42 | + public $astro = null; /*!< Ra and Decl */ |
|
43 | + /*** END */ |
|
44 | + |
|
45 | + /* time keeping fields */ |
|
46 | + public $jul_epoch = null; |
|
47 | + public $jul_utc = null; |
|
48 | + public $tsince = null; |
|
49 | + public $aos = null; /*!< Next AOS. */ |
|
50 | + public $los = null; /*!< Next LOS */ |
|
51 | + |
|
52 | + public $az = null; /*!< Azimuth [deg] */ |
|
53 | + public $el = null; /*!< Elevation [deg] */ |
|
54 | + public $range = null; /*!< Range [km] */ |
|
55 | + public $range_rate = null; /*!< Range Rate [km/sec] */ |
|
56 | + public $ra = null; /*!< Right Ascension [deg] */ |
|
57 | + public $dec = null; /*!< Declination [deg] */ |
|
58 | + public $ssplat = null; /*!< SSP latitude [deg] */ |
|
59 | + public $ssplon = null; /*!< SSP longitude [deg] */ |
|
60 | + public $alt = null; /*!< altitude [km] */ |
|
61 | + public $velo = null; /*!< velocity [km/s] */ |
|
62 | + public $ma = null; /*!< mean anomaly */ |
|
63 | + public $footprint = null; /*!< footprint */ |
|
64 | + public $phase = null; /*!< orbit phase */ |
|
65 | + public $meanmo = null; /*!< mean motion kept in rev/day */ |
|
66 | + public $orbit = null; /*!< orbit number */ |
|
67 | + public $otype = null; /*!< orbit type. */ |
|
68 | + |
|
69 | + public function __construct(Predict_TLE $tle) |
|
70 | + { |
|
71 | + $headerParts = explode(' ', $tle->header); |
|
72 | + $this->name = $headerParts[0]; |
|
73 | + $this->nickname = $this->name; |
|
74 | + $this->tle = $tle; |
|
75 | + $this->pos = new Predict_Vector(); |
|
76 | + $this->vel = new Predict_Vector(); |
|
77 | + $this->sgps = new Predict_SGSDPStatic(); |
|
78 | + $this->deep_arg = new Predict_DeepArg(); |
|
79 | + $this->dps = new Predict_DeepStatic(); |
|
80 | + |
|
81 | + $this->select_ephemeris(); |
|
82 | + $this->sat_data_init_sat($this); |
|
83 | + } |
|
84 | + |
|
85 | + /* Selects the apropriate ephemeris type to be used */ |
|
86 | + /* for predictions according to the data in the TLE */ |
|
87 | + /* It also processes values in the tle set so that */ |
|
88 | + /* they are apropriate for the sgp4/sdp4 routines */ |
|
89 | + public function select_ephemeris() |
|
90 | + { |
|
91 | + /* Preprocess tle set */ |
|
92 | + $this->tle->xnodeo *= Predict::de2ra; |
|
93 | + $this->tle->omegao *= Predict::de2ra; |
|
94 | + $this->tle->xmo *= Predict::de2ra; |
|
95 | + $this->tle->xincl *= Predict::de2ra; |
|
96 | + $temp = Predict::twopi / Predict::xmnpda / Predict::xmnpda; |
|
97 | + |
|
98 | + /* store mean motion before conversion */ |
|
99 | + $this->meanmo = $this->tle->xno; |
|
100 | + $this->tle->xno = $this->tle->xno * $temp * Predict::xmnpda; |
|
101 | + $this->tle->xndt2o *= $temp; |
|
102 | + $this->tle->xndd6o = $this->tle->xndd6o * $temp / Predict::xmnpda; |
|
103 | + $this->tle->bstar /= Predict::ae; |
|
104 | + |
|
105 | + /* Period > 225 minutes is deep space */ |
|
106 | + $dd1 = Predict::xke / $this->tle->xno; |
|
107 | + $dd2 = Predict::tothrd; |
|
108 | + $a1 = pow($dd1, $dd2); |
|
109 | + $r1 = cos($this->tle->xincl); |
|
110 | + $dd1 = 1.0 - $this->tle->eo * $this->tle->eo; |
|
111 | + $temp = Predict::ck2 * 1.5 * ($r1 * $r1 * 3.0 - 1.0) / pow($dd1, 1.5); |
|
112 | + $del1 = $temp / ($a1 * $a1); |
|
113 | + $ao = $a1 * (1.0 - $del1 * (Predict::tothrd * 0.5 + $del1 * |
|
114 | + ($del1 * 1.654320987654321 + 1.0))); |
|
115 | + $delo = $temp / ($ao * $ao); |
|
116 | + $xnodp = $this->tle->xno / ($delo + 1.0); |
|
117 | + |
|
118 | + /* Select a deep-space/near-earth ephemeris */ |
|
119 | + if (Predict::twopi / $xnodp / Predict::xmnpda >= .15625) { |
|
120 | + $this->flags |= Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG; |
|
121 | + } else { |
|
122 | + $this->flags &= ~Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG; |
|
123 | + } |
|
124 | + } |
|
125 | + |
|
126 | + /** Initialise satellite data. |
|
127 | + * @param sat The satellite to initialise. |
|
128 | + * @param qth Optional QTH info, use (0,0) if NULL. |
|
129 | + * |
|
130 | + * This function calculates the satellite data at t = 0, ie. epoch time |
|
131 | + * The function is called automatically by gtk_sat_data_read_sat. |
|
132 | + */ |
|
133 | + public function sat_data_init_sat(Predict_Sat $sat, Predict_QTH $qth = null) |
|
134 | + { |
|
135 | + $obs_geodetic = new Predict_Geodetic(); |
|
136 | + $obs_set = new Predict_ObsSet(); |
|
137 | + $sat_geodetic = new Predict_Geodetic(); |
|
138 | + /* double jul_utc, age; */ |
|
139 | + |
|
140 | + $jul_utc = Predict_Time::Julian_Date_of_Epoch($sat->tle->epoch); // => tsince = 0.0 |
|
141 | + $sat->jul_epoch = $jul_utc; |
|
142 | + |
|
143 | + /* initialise observer location */ |
|
144 | + if ($qth != null) { |
|
145 | + $obs_geodetic->lon = $qth->lon * Predict::de2ra; |
|
146 | + $obs_geodetic->lat = $qth->lat * Predict::de2ra; |
|
147 | + $obs_geodetic->alt = $qth->alt / 1000.0; |
|
148 | + $obs_geodetic->theta = 0; |
|
149 | + } |
|
150 | + else { |
|
151 | + $obs_geodetic->lon = 0.0; |
|
152 | + $obs_geodetic->lat = 0.0; |
|
153 | + $obs_geodetic->alt = 0.0; |
|
154 | + $obs_geodetic->theta = 0; |
|
155 | + } |
|
156 | + |
|
157 | + /* execute computations */ |
|
158 | + $sdpsgp = Predict_SGPSDP::getInstance($sat); |
|
159 | + if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) { |
|
160 | + $sdpsgp->SDP4($sat, 0.0); |
|
161 | + } else { |
|
162 | + $sdpsgp->SGP4($sat, 0.0); |
|
163 | + } |
|
164 | + |
|
165 | + /* scale position and velocity to km and km/sec */ |
|
166 | + Predict_Math::Convert_Sat_State($sat->pos, $sat->vel); |
|
167 | + |
|
168 | + /* get the velocity of the satellite */ |
|
169 | + $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z); |
|
170 | + $sat->velo = $sat->vel->w; |
|
171 | + Predict_SGPObs::Calculate_Obs($jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set); |
|
172 | + Predict_SGPObs::Calculate_LatLonAlt($jul_utc, $sat->pos, $sat_geodetic); |
|
173 | + |
|
174 | + while ($sat_geodetic->lon < -Predict::pi) { |
|
175 | + $sat_geodetic->lon += Predict::twopi; |
|
176 | + } |
|
177 | + |
|
178 | + while ($sat_geodetic->lon > Predict::pi) { |
|
179 | + $sat_geodetic->lon -= Predict::twopi; |
|
180 | + } |
|
181 | + |
|
182 | + $sat->az = Predict_Math::Degrees($obs_set->az); |
|
183 | + $sat->el = Predict_Math::Degrees($obs_set->el); |
|
184 | + $sat->range = $obs_set->range; |
|
185 | + $sat->range_rate = $obs_set->range_rate; |
|
186 | + $sat->ssplat = Predict_Math::Degrees($sat_geodetic->lat); |
|
187 | + $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon); |
|
188 | + $sat->alt = $sat_geodetic->alt; |
|
189 | + $sat->ma = Predict_Math::Degrees($sat->phase); |
|
190 | + $sat->ma *= 256.0 / 360.0; |
|
191 | + $sat->footprint = 2.0 * Predict::xkmper * acos (Predict::xkmper/$sat->pos->w); |
|
192 | + $age = 0.0; |
|
193 | + $sat->orbit = floor(($sat->tle->xno * Predict::xmnpda / Predict::twopi + |
|
194 | + $age * $sat->tle->bstar * Predict::ae) * $age + |
|
195 | + $sat->tle->xmo / Predict::twopi) + $sat->tle->revnum - 1; |
|
196 | + |
|
197 | + /* orbit type */ |
|
198 | + $sat->otype = $sat->get_orbit_type($sat); |
|
199 | + } |
|
200 | + |
|
201 | + public function get_orbit_type(Predict_Sat $sat) |
|
202 | + { |
|
203 | + $orbit = Predict_SGPSDP::ORBIT_TYPE_UNKNOWN; |
|
204 | + |
|
205 | + if ($this->geostationary($sat)) { |
|
206 | + $orbit = Predict_SGPSDP::ORBIT_TYPE_GEO; |
|
207 | + } else if ($this->decayed($sat)) { |
|
208 | + $orbit = Predict_SGPSDP::ORBIT_TYPE_DECAYED; |
|
209 | + } else { |
|
210 | + $orbit = Predict_SGPSDP::ORBIT_TYPE_UNKNOWN; |
|
211 | + } |
|
212 | + |
|
213 | + return $orbit; |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + /** Determinte whether satellite is in geostationary orbit. |
|
218 | + * @author John A. Magliacane, KD2BD |
|
219 | + * @param sat Pointer to satellite data. |
|
220 | + * @return TRUE if the satellite appears to be in geostationary orbit, |
|
221 | + * FALSE otherwise. |
|
222 | + * |
|
223 | + * A satellite is in geostationary orbit if |
|
224 | + * |
|
225 | + * fabs (sat.meanmotion - 1.0027) < 0.0002 |
|
226 | + * |
|
227 | + * Note: Appearantly, the mean motion can deviate much more from 1.0027 than 0.0002 |
|
228 | + */ |
|
229 | + public function geostationary(Predict_Sat $sat) |
|
230 | + { |
|
231 | + if (abs($sat->meanmo - 1.0027) < 0.0002) { |
|
232 | + return true; |
|
233 | + } else { |
|
234 | + return false; |
|
235 | + } |
|
236 | + } |
|
237 | + |
|
238 | + |
|
239 | + /** Determine whether satellite has decayed. |
|
240 | + * @author John A. Magliacane, KD2BD |
|
241 | + * @author Alexandru Csete, OZ9AEC |
|
242 | + * @param sat Pointer to satellite data. |
|
243 | + * @return TRUE if the satellite appears to have decayed, FALSE otherwise. |
|
244 | + * @bug Modified version of the predict code but it is not tested. |
|
245 | + * |
|
246 | + * A satellite is decayed if |
|
247 | + * |
|
248 | + * satepoch + ((16.666666 - sat.meanmo) / (10.0*fabs(sat.drag))) < "now" |
|
249 | + * |
|
250 | + */ |
|
251 | + public function decayed(Predict_Sat $sat) |
|
252 | + { |
|
253 | + /* tle.xndt2o/(twopi/xmnpda/xmnpda) is the value before converted the |
|
254 | 254 | value matches up with the value in predict 2.2.3 */ |
255 | - /*** FIXME decayed is treated as a static quantity. |
|
255 | + /*** FIXME decayed is treated as a static quantity. |
|
256 | 256 | It is time dependent. Also sat->jul_utc is often zero |
257 | 257 | when this function is called |
258 | 258 | ***/ |
259 | - if ((10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda))) == 0) { |
|
260 | - return true; |
|
261 | - } elseif ($sat->jul_epoch + ((16.666666 - $sat->meanmo) / |
|
262 | - (10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda)))) < $sat->jul_utc) { |
|
263 | - return true; |
|
264 | - } else { |
|
265 | - return false; |
|
266 | - } |
|
267 | - } |
|
268 | - |
|
269 | - /** |
|
270 | - * Experimental attempt at calculating apparent magnitude. Known intrinsic |
|
271 | - * magnitudes are listed inside the function for now. |
|
272 | - * |
|
273 | - * @param float $time The daynum the satellite is calculated for |
|
274 | - * @param Predict_QTH $qth The observer location |
|
275 | - * |
|
276 | - * @return null on failure, float otherwise |
|
277 | - */ |
|
278 | - public function calculateApparentMagnitude($time, Predict_QTH $qth) |
|
279 | - { |
|
280 | - // Recorded intrinsic magnitudes and their respective |
|
281 | - // illumination and distance from heavens-above.com |
|
282 | - static $intrinsicMagnitudes = array( |
|
283 | - '25544' => array( |
|
284 | - 'mag' => -1.3, |
|
285 | - 'illum' => .5, |
|
286 | - 'distance' => 1000, |
|
287 | - ) |
|
288 | - ); |
|
289 | - |
|
290 | - // Return null if we don't have a record of the intrinsic mag |
|
291 | - if (!isset($intrinsicMagnitudes[$this->tle->catnr])) { |
|
292 | - return null; |
|
293 | - } |
|
294 | - $imag = $intrinsicMagnitudes[$this->tle->catnr]; |
|
295 | - |
|
296 | - // Convert the observer's geodetic info to radians and km so |
|
297 | - // we can compare vectors |
|
298 | - $observerGeo = new Predict_Geodetic(); |
|
299 | - $observerGeo->lat = Predict_Math::Radians($qth->lat); |
|
300 | - $observerGeo->lon = Predict_Math::Radians($qth->lon); |
|
301 | - $observerGeo->alt = $qth->alt * 1000; |
|
302 | - |
|
303 | - // Now determine the sun and observer positions |
|
304 | - $observerPos = new Predict_Vector(); |
|
305 | - $observerVel = new Predict_Vector(); |
|
306 | - $solarVector = new Predict_Vector(); |
|
307 | - Predict_Solar::Calculate_Solar_Position($time, $solarVector); |
|
308 | - Predict_SGPObs::Calculate_User_PosVel($time, $observerGeo, $observerPos, $observerVel); |
|
309 | - |
|
310 | - // Determine the solar phase and and thus the percent illumination |
|
311 | - $observerSatPos = new Predict_Vector(); |
|
312 | - Predict_Math::Vec_Sub($this->pos, $observerPos, $observerSatPos); |
|
313 | - $phaseAngle = Predict_Math::Degrees(Predict_Math::Angle($solarVector, $observerSatPos)); |
|
314 | - $illum = $phaseAngle / 180; |
|
315 | - |
|
316 | - $illuminationChange = $illum / $imag['illum']; |
|
317 | - $inverseSquareOfDistanceChange = pow(($imag['distance'] / $this->range), 2); |
|
318 | - $changeInMagnitude = log( |
|
319 | - $illuminationChange * $inverseSquareOfDistanceChange, |
|
320 | - self::POGSONS_RATIO |
|
321 | - ); |
|
322 | - |
|
323 | - return $imag['mag'] - $changeInMagnitude; |
|
324 | - } |
|
259 | + if ((10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda))) == 0) { |
|
260 | + return true; |
|
261 | + } elseif ($sat->jul_epoch + ((16.666666 - $sat->meanmo) / |
|
262 | + (10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda)))) < $sat->jul_utc) { |
|
263 | + return true; |
|
264 | + } else { |
|
265 | + return false; |
|
266 | + } |
|
267 | + } |
|
268 | + |
|
269 | + /** |
|
270 | + * Experimental attempt at calculating apparent magnitude. Known intrinsic |
|
271 | + * magnitudes are listed inside the function for now. |
|
272 | + * |
|
273 | + * @param float $time The daynum the satellite is calculated for |
|
274 | + * @param Predict_QTH $qth The observer location |
|
275 | + * |
|
276 | + * @return null on failure, float otherwise |
|
277 | + */ |
|
278 | + public function calculateApparentMagnitude($time, Predict_QTH $qth) |
|
279 | + { |
|
280 | + // Recorded intrinsic magnitudes and their respective |
|
281 | + // illumination and distance from heavens-above.com |
|
282 | + static $intrinsicMagnitudes = array( |
|
283 | + '25544' => array( |
|
284 | + 'mag' => -1.3, |
|
285 | + 'illum' => .5, |
|
286 | + 'distance' => 1000, |
|
287 | + ) |
|
288 | + ); |
|
289 | + |
|
290 | + // Return null if we don't have a record of the intrinsic mag |
|
291 | + if (!isset($intrinsicMagnitudes[$this->tle->catnr])) { |
|
292 | + return null; |
|
293 | + } |
|
294 | + $imag = $intrinsicMagnitudes[$this->tle->catnr]; |
|
295 | + |
|
296 | + // Convert the observer's geodetic info to radians and km so |
|
297 | + // we can compare vectors |
|
298 | + $observerGeo = new Predict_Geodetic(); |
|
299 | + $observerGeo->lat = Predict_Math::Radians($qth->lat); |
|
300 | + $observerGeo->lon = Predict_Math::Radians($qth->lon); |
|
301 | + $observerGeo->alt = $qth->alt * 1000; |
|
302 | + |
|
303 | + // Now determine the sun and observer positions |
|
304 | + $observerPos = new Predict_Vector(); |
|
305 | + $observerVel = new Predict_Vector(); |
|
306 | + $solarVector = new Predict_Vector(); |
|
307 | + Predict_Solar::Calculate_Solar_Position($time, $solarVector); |
|
308 | + Predict_SGPObs::Calculate_User_PosVel($time, $observerGeo, $observerPos, $observerVel); |
|
309 | + |
|
310 | + // Determine the solar phase and and thus the percent illumination |
|
311 | + $observerSatPos = new Predict_Vector(); |
|
312 | + Predict_Math::Vec_Sub($this->pos, $observerPos, $observerSatPos); |
|
313 | + $phaseAngle = Predict_Math::Degrees(Predict_Math::Angle($solarVector, $observerSatPos)); |
|
314 | + $illum = $phaseAngle / 180; |
|
315 | + |
|
316 | + $illuminationChange = $illum / $imag['illum']; |
|
317 | + $inverseSquareOfDistanceChange = pow(($imag['distance'] / $this->range), 2); |
|
318 | + $changeInMagnitude = log( |
|
319 | + $illuminationChange * $inverseSquareOfDistanceChange, |
|
320 | + self::POGSONS_RATIO |
|
321 | + ); |
|
322 | + |
|
323 | + return $imag['mag'] - $changeInMagnitude; |
|
324 | + } |
|
325 | 325 | } |
@@ -146,8 +146,7 @@ |
||
146 | 146 | $obs_geodetic->lat = $qth->lat * Predict::de2ra; |
147 | 147 | $obs_geodetic->alt = $qth->alt / 1000.0; |
148 | 148 | $obs_geodetic->theta = 0; |
149 | - } |
|
150 | - else { |
|
149 | + } else { |
|
151 | 150 | $obs_geodetic->lon = 0.0; |
152 | 151 | $obs_geodetic->lat = 0.0; |
153 | 152 | $obs_geodetic->alt = 0.0; |
@@ -29,42 +29,42 @@ discard block |
||
29 | 29 | public $nickname = null; |
30 | 30 | public $website = null; |
31 | 31 | |
32 | - public $tle = null; /*!< Keplerian elements */ |
|
33 | - public $flags = 0; /*!< Flags for algo ctrl */ |
|
32 | + public $tle = null; /*!< Keplerian elements */ |
|
33 | + public $flags = 0; /*!< Flags for algo ctrl */ |
|
34 | 34 | public $sgps = null; |
35 | 35 | public $dps = null; |
36 | 36 | public $deep_arg = null; |
37 | - public $pos = null; /*!< Raw position and range */ |
|
38 | - public $vel = null; /*!< Raw velocity */ |
|
37 | + public $pos = null; /*!< Raw position and range */ |
|
38 | + public $vel = null; /*!< Raw velocity */ |
|
39 | 39 | |
40 | 40 | /*** FIXME: REMOVE */ |
41 | - public $bearing = null; /*!< Az, El, range and vel */ |
|
42 | - public $astro = null; /*!< Ra and Decl */ |
|
41 | + public $bearing = null; /*!< Az, El, range and vel */ |
|
42 | + public $astro = null; /*!< Ra and Decl */ |
|
43 | 43 | /*** END */ |
44 | 44 | |
45 | 45 | /* time keeping fields */ |
46 | 46 | public $jul_epoch = null; |
47 | 47 | public $jul_utc = null; |
48 | 48 | public $tsince = null; |
49 | - public $aos = null; /*!< Next AOS. */ |
|
50 | - public $los = null; /*!< Next LOS */ |
|
51 | - |
|
52 | - public $az = null; /*!< Azimuth [deg] */ |
|
53 | - public $el = null; /*!< Elevation [deg] */ |
|
54 | - public $range = null; /*!< Range [km] */ |
|
55 | - public $range_rate = null; /*!< Range Rate [km/sec] */ |
|
56 | - public $ra = null; /*!< Right Ascension [deg] */ |
|
57 | - public $dec = null; /*!< Declination [deg] */ |
|
58 | - public $ssplat = null; /*!< SSP latitude [deg] */ |
|
59 | - public $ssplon = null; /*!< SSP longitude [deg] */ |
|
60 | - public $alt = null; /*!< altitude [km] */ |
|
61 | - public $velo = null; /*!< velocity [km/s] */ |
|
62 | - public $ma = null; /*!< mean anomaly */ |
|
63 | - public $footprint = null; /*!< footprint */ |
|
64 | - public $phase = null; /*!< orbit phase */ |
|
65 | - public $meanmo = null; /*!< mean motion kept in rev/day */ |
|
66 | - public $orbit = null; /*!< orbit number */ |
|
67 | - public $otype = null; /*!< orbit type. */ |
|
49 | + public $aos = null; /*!< Next AOS. */ |
|
50 | + public $los = null; /*!< Next LOS */ |
|
51 | + |
|
52 | + public $az = null; /*!< Azimuth [deg] */ |
|
53 | + public $el = null; /*!< Elevation [deg] */ |
|
54 | + public $range = null; /*!< Range [km] */ |
|
55 | + public $range_rate = null; /*!< Range Rate [km/sec] */ |
|
56 | + public $ra = null; /*!< Right Ascension [deg] */ |
|
57 | + public $dec = null; /*!< Declination [deg] */ |
|
58 | + public $ssplat = null; /*!< SSP latitude [deg] */ |
|
59 | + public $ssplon = null; /*!< SSP longitude [deg] */ |
|
60 | + public $alt = null; /*!< altitude [km] */ |
|
61 | + public $velo = null; /*!< velocity [km/s] */ |
|
62 | + public $ma = null; /*!< mean anomaly */ |
|
63 | + public $footprint = null; /*!< footprint */ |
|
64 | + public $phase = null; /*!< orbit phase */ |
|
65 | + public $meanmo = null; /*!< mean motion kept in rev/day */ |
|
66 | + public $orbit = null; /*!< orbit number */ |
|
67 | + public $otype = null; /*!< orbit type. */ |
|
68 | 68 | |
69 | 69 | public function __construct(Predict_TLE $tle) |
70 | 70 | { |
@@ -93,30 +93,30 @@ discard block |
||
93 | 93 | $this->tle->omegao *= Predict::de2ra; |
94 | 94 | $this->tle->xmo *= Predict::de2ra; |
95 | 95 | $this->tle->xincl *= Predict::de2ra; |
96 | - $temp = Predict::twopi / Predict::xmnpda / Predict::xmnpda; |
|
96 | + $temp = Predict::twopi/Predict::xmnpda/Predict::xmnpda; |
|
97 | 97 | |
98 | 98 | /* store mean motion before conversion */ |
99 | 99 | $this->meanmo = $this->tle->xno; |
100 | - $this->tle->xno = $this->tle->xno * $temp * Predict::xmnpda; |
|
100 | + $this->tle->xno = $this->tle->xno*$temp*Predict::xmnpda; |
|
101 | 101 | $this->tle->xndt2o *= $temp; |
102 | - $this->tle->xndd6o = $this->tle->xndd6o * $temp / Predict::xmnpda; |
|
102 | + $this->tle->xndd6o = $this->tle->xndd6o*$temp/Predict::xmnpda; |
|
103 | 103 | $this->tle->bstar /= Predict::ae; |
104 | 104 | |
105 | 105 | /* Period > 225 minutes is deep space */ |
106 | - $dd1 = Predict::xke / $this->tle->xno; |
|
106 | + $dd1 = Predict::xke/$this->tle->xno; |
|
107 | 107 | $dd2 = Predict::tothrd; |
108 | 108 | $a1 = pow($dd1, $dd2); |
109 | 109 | $r1 = cos($this->tle->xincl); |
110 | - $dd1 = 1.0 - $this->tle->eo * $this->tle->eo; |
|
111 | - $temp = Predict::ck2 * 1.5 * ($r1 * $r1 * 3.0 - 1.0) / pow($dd1, 1.5); |
|
112 | - $del1 = $temp / ($a1 * $a1); |
|
113 | - $ao = $a1 * (1.0 - $del1 * (Predict::tothrd * 0.5 + $del1 * |
|
114 | - ($del1 * 1.654320987654321 + 1.0))); |
|
115 | - $delo = $temp / ($ao * $ao); |
|
116 | - $xnodp = $this->tle->xno / ($delo + 1.0); |
|
110 | + $dd1 = 1.0 - $this->tle->eo*$this->tle->eo; |
|
111 | + $temp = Predict::ck2*1.5*($r1*$r1*3.0 - 1.0)/pow($dd1, 1.5); |
|
112 | + $del1 = $temp/($a1*$a1); |
|
113 | + $ao = $a1*(1.0 - $del1*(Predict::tothrd*0.5 + $del1* |
|
114 | + ($del1*1.654320987654321 + 1.0))); |
|
115 | + $delo = $temp/($ao*$ao); |
|
116 | + $xnodp = $this->tle->xno/($delo + 1.0); |
|
117 | 117 | |
118 | 118 | /* Select a deep-space/near-earth ephemeris */ |
119 | - if (Predict::twopi / $xnodp / Predict::xmnpda >= .15625) { |
|
119 | + if (Predict::twopi/$xnodp/Predict::xmnpda >= .15625) { |
|
120 | 120 | $this->flags |= Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG; |
121 | 121 | } else { |
122 | 122 | $this->flags &= ~Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG; |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | /* initialise observer location */ |
144 | 144 | if ($qth != null) { |
145 | - $obs_geodetic->lon = $qth->lon * Predict::de2ra; |
|
146 | - $obs_geodetic->lat = $qth->lat * Predict::de2ra; |
|
147 | - $obs_geodetic->alt = $qth->alt / 1000.0; |
|
145 | + $obs_geodetic->lon = $qth->lon*Predict::de2ra; |
|
146 | + $obs_geodetic->lat = $qth->lat*Predict::de2ra; |
|
147 | + $obs_geodetic->alt = $qth->alt/1000.0; |
|
148 | 148 | $obs_geodetic->theta = 0; |
149 | 149 | } |
150 | 150 | else { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | Predict_Math::Convert_Sat_State($sat->pos, $sat->vel); |
167 | 167 | |
168 | 168 | /* get the velocity of the satellite */ |
169 | - $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z); |
|
169 | + $sat->vel->w = sqrt($sat->vel->x*$sat->vel->x + $sat->vel->y*$sat->vel->y + $sat->vel->z*$sat->vel->z); |
|
170 | 170 | $sat->velo = $sat->vel->w; |
171 | 171 | Predict_SGPObs::Calculate_Obs($jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set); |
172 | 172 | Predict_SGPObs::Calculate_LatLonAlt($jul_utc, $sat->pos, $sat_geodetic); |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon); |
188 | 188 | $sat->alt = $sat_geodetic->alt; |
189 | 189 | $sat->ma = Predict_Math::Degrees($sat->phase); |
190 | - $sat->ma *= 256.0 / 360.0; |
|
191 | - $sat->footprint = 2.0 * Predict::xkmper * acos (Predict::xkmper/$sat->pos->w); |
|
190 | + $sat->ma *= 256.0/360.0; |
|
191 | + $sat->footprint = 2.0*Predict::xkmper*acos(Predict::xkmper/$sat->pos->w); |
|
192 | 192 | $age = 0.0; |
193 | - $sat->orbit = floor(($sat->tle->xno * Predict::xmnpda / Predict::twopi + |
|
194 | - $age * $sat->tle->bstar * Predict::ae) * $age + |
|
195 | - $sat->tle->xmo / Predict::twopi) + $sat->tle->revnum - 1; |
|
193 | + $sat->orbit = floor(($sat->tle->xno*Predict::xmnpda/Predict::twopi + |
|
194 | + $age*$sat->tle->bstar*Predict::ae)*$age + |
|
195 | + $sat->tle->xmo/Predict::twopi) + $sat->tle->revnum - 1; |
|
196 | 196 | |
197 | 197 | /* orbit type */ |
198 | 198 | $sat->otype = $sat->get_orbit_type($sat); |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | It is time dependent. Also sat->jul_utc is often zero |
257 | 257 | when this function is called |
258 | 258 | ***/ |
259 | - if ((10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda))) == 0) { |
|
259 | + if ((10.0*abs($sat->tle->xndt2o/(Predict::twopi/Predict::xmnpda/Predict::xmnpda))) == 0) { |
|
260 | 260 | return true; |
261 | - } elseif ($sat->jul_epoch + ((16.666666 - $sat->meanmo) / |
|
262 | - (10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda)))) < $sat->jul_utc) { |
|
261 | + } elseif ($sat->jul_epoch + ((16.666666 - $sat->meanmo)/ |
|
262 | + (10.0*abs($sat->tle->xndt2o/(Predict::twopi/Predict::xmnpda/Predict::xmnpda)))) < $sat->jul_utc) { |
|
263 | 263 | return true; |
264 | 264 | } else { |
265 | 265 | return false; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $observerGeo = new Predict_Geodetic(); |
299 | 299 | $observerGeo->lat = Predict_Math::Radians($qth->lat); |
300 | 300 | $observerGeo->lon = Predict_Math::Radians($qth->lon); |
301 | - $observerGeo->alt = $qth->alt * 1000; |
|
301 | + $observerGeo->alt = $qth->alt*1000; |
|
302 | 302 | |
303 | 303 | // Now determine the sun and observer positions |
304 | 304 | $observerPos = new Predict_Vector(); |
@@ -311,12 +311,12 @@ discard block |
||
311 | 311 | $observerSatPos = new Predict_Vector(); |
312 | 312 | Predict_Math::Vec_Sub($this->pos, $observerPos, $observerSatPos); |
313 | 313 | $phaseAngle = Predict_Math::Degrees(Predict_Math::Angle($solarVector, $observerSatPos)); |
314 | - $illum = $phaseAngle / 180; |
|
314 | + $illum = $phaseAngle/180; |
|
315 | 315 | |
316 | - $illuminationChange = $illum / $imag['illum']; |
|
317 | - $inverseSquareOfDistanceChange = pow(($imag['distance'] / $this->range), 2); |
|
316 | + $illuminationChange = $illum/$imag['illum']; |
|
317 | + $inverseSquareOfDistanceChange = pow(($imag['distance']/$this->range), 2); |
|
318 | 318 | $changeInMagnitude = log( |
319 | - $illuminationChange * $inverseSquareOfDistanceChange, |
|
319 | + $illuminationChange*$inverseSquareOfDistanceChange, |
|
320 | 320 | self::POGSONS_RATIO |
321 | 321 | ); |
322 | 322 |
@@ -56,6 +56,10 @@ |
||
56 | 56 | /* It is intended to be used to determine the ground track of */ |
57 | 57 | /* a satellite. The calculations assume the earth to be an */ |
58 | 58 | /* oblate spheroid as defined in WGS '72. */ |
59 | + |
|
60 | + /** |
|
61 | + * @param double $_time |
|
62 | + */ |
|
59 | 63 | public static function Calculate_LatLonAlt($_time, Predict_Vector $pos, Predict_Geodetic $geodetic) |
60 | 64 | { |
61 | 65 | /* Reference: The 1992 Astronomical Almanac, page K12. */ |
@@ -25,131 +25,131 @@ |
||
25 | 25 | */ |
26 | 26 | class Predict_SGPObs |
27 | 27 | { |
28 | - /* Procedure Calculate_User_PosVel passes the user's geodetic position */ |
|
29 | - /* and the time of interest and returns the ECI position and velocity */ |
|
30 | - /* of the observer. The velocity calculation assumes the geodetic */ |
|
31 | - /* position is stationary relative to the earth's surface. */ |
|
32 | - public static function Calculate_User_PosVel( |
|
33 | - $_time, Predict_Geodetic $geodetic, Predict_Vector $obs_pos, Predict_Vector $obs_vel |
|
34 | - ) |
|
35 | - { |
|
36 | - /* Reference: The 1992 Astronomical Almanac, page K11. */ |
|
37 | - |
|
38 | - $sinGeodeticLat = sin($geodetic->lat); /* Only run sin($geodetic->lat) once */ |
|
39 | - |
|
40 | - $geodetic->theta = Predict_Math::FMod2p(Predict_Time::ThetaG_JD($_time) + $geodetic->lon);/*LMST*/ |
|
41 | - $c = 1 / sqrt(1 + Predict::__f * (Predict::__f - 2) * $sinGeodeticLat * $sinGeodeticLat); |
|
42 | - $sq = (1 - Predict::__f) * (1 - Predict::__f) * $c; |
|
43 | - $achcp = (Predict::xkmper * $c + $geodetic->alt) * cos($geodetic->lat); |
|
44 | - $obs_pos->x = $achcp * cos($geodetic->theta); /*kilometers*/ |
|
45 | - $obs_pos->y = $achcp * sin($geodetic->theta); |
|
46 | - $obs_pos->z = (Predict::xkmper * $sq + $geodetic->alt) * $sinGeodeticLat; |
|
47 | - $obs_vel->x = -Predict::mfactor * $obs_pos->y; /*kilometers/second*/ |
|
48 | - $obs_vel->y = Predict::mfactor * $obs_pos->x; |
|
49 | - $obs_vel->z = 0; |
|
50 | - $obs_pos->w = sqrt($obs_pos->x * $obs_pos->x + $obs_pos->y * $obs_pos->y + $obs_pos->z * $obs_pos->z); |
|
51 | - $obs_vel->w = sqrt($obs_vel->x * $obs_vel->x + $obs_vel->y * $obs_vel->y + $obs_vel->z * $obs_vel->z); |
|
52 | - } |
|
53 | - |
|
54 | - /* Procedure Calculate_LatLonAlt will calculate the geodetic */ |
|
55 | - /* position of an object given its ECI position pos and time. */ |
|
56 | - /* It is intended to be used to determine the ground track of */ |
|
57 | - /* a satellite. The calculations assume the earth to be an */ |
|
58 | - /* oblate spheroid as defined in WGS '72. */ |
|
59 | - public static function Calculate_LatLonAlt($_time, Predict_Vector $pos, Predict_Geodetic $geodetic) |
|
60 | - { |
|
61 | - /* Reference: The 1992 Astronomical Almanac, page K12. */ |
|
62 | - |
|
63 | - /* double r,e2,phi,c; */ |
|
64 | - |
|
65 | - $geodetic->theta = Predict_Math::AcTan($pos->y, $pos->x); /*radians*/ |
|
66 | - $geodetic->lon = Predict_Math::FMod2p($geodetic->theta - Predict_Time::ThetaG_JD($_time)); /*radians*/ |
|
67 | - $r = sqrt(($pos->x * $pos->x) + ($pos->y * $pos->y)); |
|
68 | - $e2 = Predict::__f * (2 - Predict::__f); |
|
69 | - $geodetic->lat = Predict_Math::AcTan($pos->z, $r); /*radians*/ |
|
70 | - |
|
71 | - do { |
|
72 | - $phi = $geodetic->lat; |
|
73 | - $sinPhi = sin($phi); |
|
74 | - $c = 1 / sqrt(1 - $e2 * ($sinPhi * $sinPhi)); |
|
75 | - $geodetic->lat = Predict_Math::AcTan($pos->z + Predict::xkmper * $c * $e2 * $sinPhi, $r); |
|
76 | - } while (abs($geodetic->lat - $phi) >= 1E-10); |
|
77 | - |
|
78 | - $geodetic->alt = $r / cos($geodetic->lat) - Predict::xkmper * $c;/*kilometers*/ |
|
79 | - |
|
80 | - if ($geodetic->lat > Predict::pio2) { |
|
81 | - $geodetic->lat -= Predict::twopi; |
|
82 | - } |
|
83 | - } |
|
84 | - |
|
85 | - /* The procedures Calculate_Obs and Calculate_RADec calculate */ |
|
86 | - /* the *topocentric* coordinates of the object with ECI position, */ |
|
87 | - /* {pos}, and velocity, {vel}, from location {geodetic} at {time}. */ |
|
88 | - /* The {obs_set} returned for Calculate_Obs consists of azimuth, */ |
|
89 | - /* elevation, range, and range rate (in that order) with units of */ |
|
90 | - /* radians, radians, kilometers, and kilometers/second, respectively. */ |
|
91 | - /* The WGS '72 geoid is used and the effect of atmospheric refraction */ |
|
92 | - /* (under standard temperature and pressure) is incorporated into the */ |
|
93 | - /* elevation calculation; the effect of atmospheric refraction on */ |
|
94 | - /* range and range rate has not yet been quantified. */ |
|
95 | - |
|
96 | - /* The {obs_set} for Calculate_RADec consists of right ascension and */ |
|
97 | - /* declination (in that order) in radians. Again, calculations are */ |
|
98 | - /* based on *topocentric* position using the WGS '72 geoid and */ |
|
99 | - /* incorporating atmospheric refraction. */ |
|
100 | - public static function Calculate_Obs($_time, Predict_Vector $pos, Predict_Vector $vel, Predict_Geodetic $geodetic, Predict_ObsSet $obs_set) |
|
101 | - { |
|
102 | - $obs_pos = new Predict_Vector(); |
|
103 | - $obs_vel = new Predict_Vector(); |
|
104 | - $range = new Predict_Vector(); |
|
105 | - $rgvel = new Predict_Vector(); |
|
106 | - |
|
107 | - self::Calculate_User_PosVel($_time, $geodetic, $obs_pos, $obs_vel); |
|
108 | - |
|
109 | - $range->x = $pos->x - $obs_pos->x; |
|
110 | - $range->y = $pos->y - $obs_pos->y; |
|
111 | - $range->z = $pos->z - $obs_pos->z; |
|
112 | - |
|
113 | - $rgvel->x = $vel->x - $obs_vel->x; |
|
114 | - $rgvel->y = $vel->y - $obs_vel->y; |
|
115 | - $rgvel->z = $vel->z - $obs_vel->z; |
|
116 | - |
|
117 | - $range->w = sqrt($range->x * $range->x + $range->y * $range->y + $range->z * $range->z); |
|
118 | - |
|
119 | - $sin_lat = sin($geodetic->lat); |
|
120 | - $cos_lat = cos($geodetic->lat); |
|
121 | - $sin_theta = sin($geodetic->theta); |
|
122 | - $cos_theta = cos($geodetic->theta); |
|
123 | - $top_s = $sin_lat * $cos_theta * $range->x |
|
124 | - + $sin_lat * $sin_theta * $range->y |
|
125 | - - $cos_lat * $range->z; |
|
126 | - $top_e = -$sin_theta * $range->x |
|
127 | - + $cos_theta * $range->y; |
|
128 | - $top_z = $cos_lat * $cos_theta * $range->x |
|
129 | - + $cos_lat * $sin_theta * $range->y |
|
130 | - + $sin_lat * $range->z; |
|
131 | - $azim = atan(-$top_e / $top_s); /*Azimuth*/ |
|
132 | - if ($top_s > 0) { |
|
133 | - $azim = $azim + Predict::pi; |
|
134 | - } |
|
135 | - if ($azim < 0 ) { |
|
136 | - $azim = $azim + Predict::twopi; |
|
137 | - } |
|
138 | - $el = Predict_Math::ArcSin($top_z / $range->w); |
|
139 | - $obs_set->az = $azim; /* Azimuth (radians) */ |
|
140 | - $obs_set->el = $el; /* Elevation (radians)*/ |
|
141 | - $obs_set->range = $range->w; /* Range (kilometers) */ |
|
142 | - |
|
143 | - /* Range Rate (kilometers/second)*/ |
|
144 | - $obs_set->range_rate = Predict_Math::Dot($range, $rgvel) / $range->w; |
|
145 | - |
|
146 | - /* Corrections for atmospheric refraction */ |
|
147 | - /* Reference: Astronomical Algorithms by Jean Meeus, pp. 101-104 */ |
|
148 | - /* Correction is meaningless when apparent elevation is below horizon */ |
|
149 | - // obs_set->el = obs_set->el + Radians((1.02/tan(Radians(Degrees(el)+ |
|
150 | - // 10.3/(Degrees(el)+5.11))))/60); |
|
151 | - if ($obs_set->el < 0) { |
|
152 | - $obs_set->el = $el; /*Reset to true elevation*/ |
|
153 | - } |
|
154 | - } |
|
28 | + /* Procedure Calculate_User_PosVel passes the user's geodetic position */ |
|
29 | + /* and the time of interest and returns the ECI position and velocity */ |
|
30 | + /* of the observer. The velocity calculation assumes the geodetic */ |
|
31 | + /* position is stationary relative to the earth's surface. */ |
|
32 | + public static function Calculate_User_PosVel( |
|
33 | + $_time, Predict_Geodetic $geodetic, Predict_Vector $obs_pos, Predict_Vector $obs_vel |
|
34 | + ) |
|
35 | + { |
|
36 | + /* Reference: The 1992 Astronomical Almanac, page K11. */ |
|
37 | + |
|
38 | + $sinGeodeticLat = sin($geodetic->lat); /* Only run sin($geodetic->lat) once */ |
|
39 | + |
|
40 | + $geodetic->theta = Predict_Math::FMod2p(Predict_Time::ThetaG_JD($_time) + $geodetic->lon);/*LMST*/ |
|
41 | + $c = 1 / sqrt(1 + Predict::__f * (Predict::__f - 2) * $sinGeodeticLat * $sinGeodeticLat); |
|
42 | + $sq = (1 - Predict::__f) * (1 - Predict::__f) * $c; |
|
43 | + $achcp = (Predict::xkmper * $c + $geodetic->alt) * cos($geodetic->lat); |
|
44 | + $obs_pos->x = $achcp * cos($geodetic->theta); /*kilometers*/ |
|
45 | + $obs_pos->y = $achcp * sin($geodetic->theta); |
|
46 | + $obs_pos->z = (Predict::xkmper * $sq + $geodetic->alt) * $sinGeodeticLat; |
|
47 | + $obs_vel->x = -Predict::mfactor * $obs_pos->y; /*kilometers/second*/ |
|
48 | + $obs_vel->y = Predict::mfactor * $obs_pos->x; |
|
49 | + $obs_vel->z = 0; |
|
50 | + $obs_pos->w = sqrt($obs_pos->x * $obs_pos->x + $obs_pos->y * $obs_pos->y + $obs_pos->z * $obs_pos->z); |
|
51 | + $obs_vel->w = sqrt($obs_vel->x * $obs_vel->x + $obs_vel->y * $obs_vel->y + $obs_vel->z * $obs_vel->z); |
|
52 | + } |
|
53 | + |
|
54 | + /* Procedure Calculate_LatLonAlt will calculate the geodetic */ |
|
55 | + /* position of an object given its ECI position pos and time. */ |
|
56 | + /* It is intended to be used to determine the ground track of */ |
|
57 | + /* a satellite. The calculations assume the earth to be an */ |
|
58 | + /* oblate spheroid as defined in WGS '72. */ |
|
59 | + public static function Calculate_LatLonAlt($_time, Predict_Vector $pos, Predict_Geodetic $geodetic) |
|
60 | + { |
|
61 | + /* Reference: The 1992 Astronomical Almanac, page K12. */ |
|
62 | + |
|
63 | + /* double r,e2,phi,c; */ |
|
64 | + |
|
65 | + $geodetic->theta = Predict_Math::AcTan($pos->y, $pos->x); /*radians*/ |
|
66 | + $geodetic->lon = Predict_Math::FMod2p($geodetic->theta - Predict_Time::ThetaG_JD($_time)); /*radians*/ |
|
67 | + $r = sqrt(($pos->x * $pos->x) + ($pos->y * $pos->y)); |
|
68 | + $e2 = Predict::__f * (2 - Predict::__f); |
|
69 | + $geodetic->lat = Predict_Math::AcTan($pos->z, $r); /*radians*/ |
|
70 | + |
|
71 | + do { |
|
72 | + $phi = $geodetic->lat; |
|
73 | + $sinPhi = sin($phi); |
|
74 | + $c = 1 / sqrt(1 - $e2 * ($sinPhi * $sinPhi)); |
|
75 | + $geodetic->lat = Predict_Math::AcTan($pos->z + Predict::xkmper * $c * $e2 * $sinPhi, $r); |
|
76 | + } while (abs($geodetic->lat - $phi) >= 1E-10); |
|
77 | + |
|
78 | + $geodetic->alt = $r / cos($geodetic->lat) - Predict::xkmper * $c;/*kilometers*/ |
|
79 | + |
|
80 | + if ($geodetic->lat > Predict::pio2) { |
|
81 | + $geodetic->lat -= Predict::twopi; |
|
82 | + } |
|
83 | + } |
|
84 | + |
|
85 | + /* The procedures Calculate_Obs and Calculate_RADec calculate */ |
|
86 | + /* the *topocentric* coordinates of the object with ECI position, */ |
|
87 | + /* {pos}, and velocity, {vel}, from location {geodetic} at {time}. */ |
|
88 | + /* The {obs_set} returned for Calculate_Obs consists of azimuth, */ |
|
89 | + /* elevation, range, and range rate (in that order) with units of */ |
|
90 | + /* radians, radians, kilometers, and kilometers/second, respectively. */ |
|
91 | + /* The WGS '72 geoid is used and the effect of atmospheric refraction */ |
|
92 | + /* (under standard temperature and pressure) is incorporated into the */ |
|
93 | + /* elevation calculation; the effect of atmospheric refraction on */ |
|
94 | + /* range and range rate has not yet been quantified. */ |
|
95 | + |
|
96 | + /* The {obs_set} for Calculate_RADec consists of right ascension and */ |
|
97 | + /* declination (in that order) in radians. Again, calculations are */ |
|
98 | + /* based on *topocentric* position using the WGS '72 geoid and */ |
|
99 | + /* incorporating atmospheric refraction. */ |
|
100 | + public static function Calculate_Obs($_time, Predict_Vector $pos, Predict_Vector $vel, Predict_Geodetic $geodetic, Predict_ObsSet $obs_set) |
|
101 | + { |
|
102 | + $obs_pos = new Predict_Vector(); |
|
103 | + $obs_vel = new Predict_Vector(); |
|
104 | + $range = new Predict_Vector(); |
|
105 | + $rgvel = new Predict_Vector(); |
|
106 | + |
|
107 | + self::Calculate_User_PosVel($_time, $geodetic, $obs_pos, $obs_vel); |
|
108 | + |
|
109 | + $range->x = $pos->x - $obs_pos->x; |
|
110 | + $range->y = $pos->y - $obs_pos->y; |
|
111 | + $range->z = $pos->z - $obs_pos->z; |
|
112 | + |
|
113 | + $rgvel->x = $vel->x - $obs_vel->x; |
|
114 | + $rgvel->y = $vel->y - $obs_vel->y; |
|
115 | + $rgvel->z = $vel->z - $obs_vel->z; |
|
116 | + |
|
117 | + $range->w = sqrt($range->x * $range->x + $range->y * $range->y + $range->z * $range->z); |
|
118 | + |
|
119 | + $sin_lat = sin($geodetic->lat); |
|
120 | + $cos_lat = cos($geodetic->lat); |
|
121 | + $sin_theta = sin($geodetic->theta); |
|
122 | + $cos_theta = cos($geodetic->theta); |
|
123 | + $top_s = $sin_lat * $cos_theta * $range->x |
|
124 | + + $sin_lat * $sin_theta * $range->y |
|
125 | + - $cos_lat * $range->z; |
|
126 | + $top_e = -$sin_theta * $range->x |
|
127 | + + $cos_theta * $range->y; |
|
128 | + $top_z = $cos_lat * $cos_theta * $range->x |
|
129 | + + $cos_lat * $sin_theta * $range->y |
|
130 | + + $sin_lat * $range->z; |
|
131 | + $azim = atan(-$top_e / $top_s); /*Azimuth*/ |
|
132 | + if ($top_s > 0) { |
|
133 | + $azim = $azim + Predict::pi; |
|
134 | + } |
|
135 | + if ($azim < 0 ) { |
|
136 | + $azim = $azim + Predict::twopi; |
|
137 | + } |
|
138 | + $el = Predict_Math::ArcSin($top_z / $range->w); |
|
139 | + $obs_set->az = $azim; /* Azimuth (radians) */ |
|
140 | + $obs_set->el = $el; /* Elevation (radians)*/ |
|
141 | + $obs_set->range = $range->w; /* Range (kilometers) */ |
|
142 | + |
|
143 | + /* Range Rate (kilometers/second)*/ |
|
144 | + $obs_set->range_rate = Predict_Math::Dot($range, $rgvel) / $range->w; |
|
145 | + |
|
146 | + /* Corrections for atmospheric refraction */ |
|
147 | + /* Reference: Astronomical Algorithms by Jean Meeus, pp. 101-104 */ |
|
148 | + /* Correction is meaningless when apparent elevation is below horizon */ |
|
149 | + // obs_set->el = obs_set->el + Radians((1.02/tan(Radians(Degrees(el)+ |
|
150 | + // 10.3/(Degrees(el)+5.11))))/60); |
|
151 | + if ($obs_set->el < 0) { |
|
152 | + $obs_set->el = $el; /*Reset to true elevation*/ |
|
153 | + } |
|
154 | + } |
|
155 | 155 | } |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | |
38 | 38 | $sinGeodeticLat = sin($geodetic->lat); /* Only run sin($geodetic->lat) once */ |
39 | 39 | |
40 | - $geodetic->theta = Predict_Math::FMod2p(Predict_Time::ThetaG_JD($_time) + $geodetic->lon);/*LMST*/ |
|
41 | - $c = 1 / sqrt(1 + Predict::__f * (Predict::__f - 2) * $sinGeodeticLat * $sinGeodeticLat); |
|
42 | - $sq = (1 - Predict::__f) * (1 - Predict::__f) * $c; |
|
43 | - $achcp = (Predict::xkmper * $c + $geodetic->alt) * cos($geodetic->lat); |
|
44 | - $obs_pos->x = $achcp * cos($geodetic->theta); /*kilometers*/ |
|
45 | - $obs_pos->y = $achcp * sin($geodetic->theta); |
|
46 | - $obs_pos->z = (Predict::xkmper * $sq + $geodetic->alt) * $sinGeodeticLat; |
|
47 | - $obs_vel->x = -Predict::mfactor * $obs_pos->y; /*kilometers/second*/ |
|
48 | - $obs_vel->y = Predict::mfactor * $obs_pos->x; |
|
49 | - $obs_vel->z = 0; |
|
50 | - $obs_pos->w = sqrt($obs_pos->x * $obs_pos->x + $obs_pos->y * $obs_pos->y + $obs_pos->z * $obs_pos->z); |
|
51 | - $obs_vel->w = sqrt($obs_vel->x * $obs_vel->x + $obs_vel->y * $obs_vel->y + $obs_vel->z * $obs_vel->z); |
|
40 | + $geodetic->theta = Predict_Math::FMod2p(Predict_Time::ThetaG_JD($_time) + $geodetic->lon); /*LMST*/ |
|
41 | + $c = 1/sqrt(1 + Predict::__f*(Predict::__f - 2)*$sinGeodeticLat*$sinGeodeticLat); |
|
42 | + $sq = (1 - Predict::__f)*(1 - Predict::__f)*$c; |
|
43 | + $achcp = (Predict::xkmper*$c + $geodetic->alt)*cos($geodetic->lat); |
|
44 | + $obs_pos->x = $achcp*cos($geodetic->theta); /*kilometers*/ |
|
45 | + $obs_pos->y = $achcp*sin($geodetic->theta); |
|
46 | + $obs_pos->z = (Predict::xkmper*$sq + $geodetic->alt)*$sinGeodeticLat; |
|
47 | + $obs_vel->x = -Predict::mfactor*$obs_pos->y; /*kilometers/second*/ |
|
48 | + $obs_vel->y = Predict::mfactor*$obs_pos->x; |
|
49 | + $obs_vel->z = 0; |
|
50 | + $obs_pos->w = sqrt($obs_pos->x*$obs_pos->x + $obs_pos->y*$obs_pos->y + $obs_pos->z*$obs_pos->z); |
|
51 | + $obs_vel->w = sqrt($obs_vel->x*$obs_vel->x + $obs_vel->y*$obs_vel->y + $obs_vel->z*$obs_vel->z); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /* Procedure Calculate_LatLonAlt will calculate the geodetic */ |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /* It is intended to be used to determine the ground track of */ |
57 | 57 | /* a satellite. The calculations assume the earth to be an */ |
58 | 58 | /* oblate spheroid as defined in WGS '72. */ |
59 | - public static function Calculate_LatLonAlt($_time, Predict_Vector $pos, Predict_Geodetic $geodetic) |
|
59 | + public static function Calculate_LatLonAlt($_time, Predict_Vector $pos, Predict_Geodetic $geodetic) |
|
60 | 60 | { |
61 | 61 | /* Reference: The 1992 Astronomical Almanac, page K12. */ |
62 | 62 | |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | |
65 | 65 | $geodetic->theta = Predict_Math::AcTan($pos->y, $pos->x); /*radians*/ |
66 | 66 | $geodetic->lon = Predict_Math::FMod2p($geodetic->theta - Predict_Time::ThetaG_JD($_time)); /*radians*/ |
67 | - $r = sqrt(($pos->x * $pos->x) + ($pos->y * $pos->y)); |
|
68 | - $e2 = Predict::__f * (2 - Predict::__f); |
|
67 | + $r = sqrt(($pos->x*$pos->x) + ($pos->y*$pos->y)); |
|
68 | + $e2 = Predict::__f*(2 - Predict::__f); |
|
69 | 69 | $geodetic->lat = Predict_Math::AcTan($pos->z, $r); /*radians*/ |
70 | 70 | |
71 | 71 | do { |
72 | 72 | $phi = $geodetic->lat; |
73 | 73 | $sinPhi = sin($phi); |
74 | - $c = 1 / sqrt(1 - $e2 * ($sinPhi * $sinPhi)); |
|
75 | - $geodetic->lat = Predict_Math::AcTan($pos->z + Predict::xkmper * $c * $e2 * $sinPhi, $r); |
|
74 | + $c = 1/sqrt(1 - $e2*($sinPhi*$sinPhi)); |
|
75 | + $geodetic->lat = Predict_Math::AcTan($pos->z + Predict::xkmper*$c*$e2*$sinPhi, $r); |
|
76 | 76 | } while (abs($geodetic->lat - $phi) >= 1E-10); |
77 | 77 | |
78 | - $geodetic->alt = $r / cos($geodetic->lat) - Predict::xkmper * $c;/*kilometers*/ |
|
78 | + $geodetic->alt = $r/cos($geodetic->lat) - Predict::xkmper*$c; /*kilometers*/ |
|
79 | 79 | |
80 | 80 | if ($geodetic->lat > Predict::pio2) { |
81 | 81 | $geodetic->lat -= Predict::twopi; |
@@ -114,34 +114,34 @@ discard block |
||
114 | 114 | $rgvel->y = $vel->y - $obs_vel->y; |
115 | 115 | $rgvel->z = $vel->z - $obs_vel->z; |
116 | 116 | |
117 | - $range->w = sqrt($range->x * $range->x + $range->y * $range->y + $range->z * $range->z); |
|
117 | + $range->w = sqrt($range->x*$range->x + $range->y*$range->y + $range->z*$range->z); |
|
118 | 118 | |
119 | 119 | $sin_lat = sin($geodetic->lat); |
120 | 120 | $cos_lat = cos($geodetic->lat); |
121 | 121 | $sin_theta = sin($geodetic->theta); |
122 | 122 | $cos_theta = cos($geodetic->theta); |
123 | - $top_s = $sin_lat * $cos_theta * $range->x |
|
124 | - + $sin_lat * $sin_theta * $range->y |
|
125 | - - $cos_lat * $range->z; |
|
126 | - $top_e = -$sin_theta * $range->x |
|
127 | - + $cos_theta * $range->y; |
|
128 | - $top_z = $cos_lat * $cos_theta * $range->x |
|
129 | - + $cos_lat * $sin_theta * $range->y |
|
130 | - + $sin_lat * $range->z; |
|
131 | - $azim = atan(-$top_e / $top_s); /*Azimuth*/ |
|
123 | + $top_s = $sin_lat*$cos_theta*$range->x |
|
124 | + + $sin_lat*$sin_theta*$range->y |
|
125 | + - $cos_lat*$range->z; |
|
126 | + $top_e = -$sin_theta*$range->x |
|
127 | + + $cos_theta*$range->y; |
|
128 | + $top_z = $cos_lat*$cos_theta*$range->x |
|
129 | + + $cos_lat*$sin_theta*$range->y |
|
130 | + + $sin_lat*$range->z; |
|
131 | + $azim = atan(-$top_e/$top_s); /*Azimuth*/ |
|
132 | 132 | if ($top_s > 0) { |
133 | 133 | $azim = $azim + Predict::pi; |
134 | 134 | } |
135 | - if ($azim < 0 ) { |
|
135 | + if ($azim < 0) { |
|
136 | 136 | $azim = $azim + Predict::twopi; |
137 | 137 | } |
138 | - $el = Predict_Math::ArcSin($top_z / $range->w); |
|
139 | - $obs_set->az = $azim; /* Azimuth (radians) */ |
|
140 | - $obs_set->el = $el; /* Elevation (radians)*/ |
|
138 | + $el = Predict_Math::ArcSin($top_z/$range->w); |
|
139 | + $obs_set->az = $azim; /* Azimuth (radians) */ |
|
140 | + $obs_set->el = $el; /* Elevation (radians)*/ |
|
141 | 141 | $obs_set->range = $range->w; /* Range (kilometers) */ |
142 | 142 | |
143 | 143 | /* Range Rate (kilometers/second)*/ |
144 | - $obs_set->range_rate = Predict_Math::Dot($range, $rgvel) / $range->w; |
|
144 | + $obs_set->range_rate = Predict_Math::Dot($range, $rgvel)/$range->w; |
|
145 | 145 | |
146 | 146 | /* Corrections for atmospheric refraction */ |
147 | 147 | /* Reference: Astronomical Algorithms by Jean Meeus, pp. 101-104 */ |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | // obs_set->el = obs_set->el + Radians((1.02/tan(Radians(Degrees(el)+ |
150 | 150 | // 10.3/(Degrees(el)+5.11))))/60); |
151 | 151 | if ($obs_set->el < 0) { |
152 | - $obs_set->el = $el; /*Reset to true elevation*/ |
|
152 | + $obs_set->el = $el; /*Reset to true elevation*/ |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
@@ -67,6 +67,10 @@ discard block |
||
67 | 67 | /* structure with Keplerian orbital elements and pos and vel */ |
68 | 68 | /* are vector_t structures returning ECI satellite position and */ |
69 | 69 | /* velocity. Use Convert_Sat_State() to convert to km and km/s.*/ |
70 | + |
|
71 | + /** |
|
72 | + * @param double $tsince |
|
73 | + */ |
|
70 | 74 | public function SGP4(Predict_Sat $sat, $tsince) |
71 | 75 | { |
72 | 76 | /* Initialization */ |
@@ -312,6 +316,10 @@ discard block |
||
312 | 316 | /* structure with Keplerian orbital elements and pos and vel */ |
313 | 317 | /* are vector_t structures returning ECI satellite position and */ |
314 | 318 | /* velocity. Use Convert_Sat_State() to convert to km and km/s. */ |
319 | + |
|
320 | + /** |
|
321 | + * @param double $tsince |
|
322 | + */ |
|
315 | 323 | public function SDP4(Predict_Sat $sat, $tsince) |
316 | 324 | { |
317 | 325 | /* Initialization */ |
@@ -538,6 +546,10 @@ discard block |
||
538 | 546 | /* DEEP */ |
539 | 547 | /* This function is used by SDP4 to add lunar and solar */ |
540 | 548 | /* perturbation effects to deep-space orbit objects. */ |
549 | + |
|
550 | + /** |
|
551 | + * @param integer $ientry |
|
552 | + */ |
|
541 | 553 | public function Deep($ientry, Predict_Sat $sat) |
542 | 554 | { |
543 | 555 | switch ($ientry) { |
@@ -23,1037 +23,1037 @@ |
||
23 | 23 | */ |
24 | 24 | class Predict_SGPSDP |
25 | 25 | { |
26 | - const ALL_FLAGS = -1; |
|
27 | - const SGP_INITIALIZED_FLAG = 0x000001; |
|
28 | - const SGP4_INITIALIZED_FLAG = 0x000002; |
|
29 | - const SDP4_INITIALIZED_FLAG = 0x000004; |
|
30 | - const SGP8_INITIALIZED_FLAG = 0x000008; |
|
31 | - const SDP8_INITIALIZED_FLAG = 0x000010; |
|
32 | - const SIMPLE_FLAG = 0x000020; |
|
33 | - const DEEP_SPACE_EPHEM_FLAG = 0x000040; |
|
34 | - const LUNAR_TERMS_DONE_FLAG = 0x000080; |
|
35 | - const NEW_EPHEMERIS_FLAG = 0x000100; |
|
36 | - const DO_LOOP_FLAG = 0x000200; |
|
37 | - const RESONANCE_FLAG = 0x000400; |
|
38 | - const SYNCHRONOUS_FLAG = 0x000800; |
|
39 | - const EPOCH_RESTART_FLAG = 0x001000; |
|
40 | - const VISIBLE_FLAG = 0x002000; |
|
41 | - const SAT_ECLIPSED_FLAG = 0x004000; |
|
42 | - |
|
43 | - /* orbit_type_t struct */ |
|
44 | - const ORBIT_TYPE_UNKNOWN = 0; |
|
45 | - const ORBIT_TYPE_LEO = 1; /*!< Low Earth orbit, up to 1200 km. */ |
|
46 | - const ORBIT_TYPE_ICO = 2; /*!< Intermediate Circular Orbit, up to 1400 km. */ |
|
47 | - const ORBIT_TYPE_GEO = 3; /*!< Geostationary. */ |
|
48 | - const ORBIT_TYPE_GSO = 4; /*!< Geosynchronuous. */ |
|
49 | - const ORBIT_TYPE_MOLNIYA = 5; |
|
50 | - const ORBIT_TYPE_TUNDRA = 6; |
|
51 | - const ORBIT_TYPE_POLAR = 7; |
|
52 | - const ORBIT_TYPE_SUNSYNC = 8; |
|
53 | - const ORBIT_TYPE_DECAYED = 9; |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /* Entry points of Deep() |
|
26 | + const ALL_FLAGS = -1; |
|
27 | + const SGP_INITIALIZED_FLAG = 0x000001; |
|
28 | + const SGP4_INITIALIZED_FLAG = 0x000002; |
|
29 | + const SDP4_INITIALIZED_FLAG = 0x000004; |
|
30 | + const SGP8_INITIALIZED_FLAG = 0x000008; |
|
31 | + const SDP8_INITIALIZED_FLAG = 0x000010; |
|
32 | + const SIMPLE_FLAG = 0x000020; |
|
33 | + const DEEP_SPACE_EPHEM_FLAG = 0x000040; |
|
34 | + const LUNAR_TERMS_DONE_FLAG = 0x000080; |
|
35 | + const NEW_EPHEMERIS_FLAG = 0x000100; |
|
36 | + const DO_LOOP_FLAG = 0x000200; |
|
37 | + const RESONANCE_FLAG = 0x000400; |
|
38 | + const SYNCHRONOUS_FLAG = 0x000800; |
|
39 | + const EPOCH_RESTART_FLAG = 0x001000; |
|
40 | + const VISIBLE_FLAG = 0x002000; |
|
41 | + const SAT_ECLIPSED_FLAG = 0x004000; |
|
42 | + |
|
43 | + /* orbit_type_t struct */ |
|
44 | + const ORBIT_TYPE_UNKNOWN = 0; |
|
45 | + const ORBIT_TYPE_LEO = 1; /*!< Low Earth orbit, up to 1200 km. */ |
|
46 | + const ORBIT_TYPE_ICO = 2; /*!< Intermediate Circular Orbit, up to 1400 km. */ |
|
47 | + const ORBIT_TYPE_GEO = 3; /*!< Geostationary. */ |
|
48 | + const ORBIT_TYPE_GSO = 4; /*!< Geosynchronuous. */ |
|
49 | + const ORBIT_TYPE_MOLNIYA = 5; |
|
50 | + const ORBIT_TYPE_TUNDRA = 6; |
|
51 | + const ORBIT_TYPE_POLAR = 7; |
|
52 | + const ORBIT_TYPE_SUNSYNC = 8; |
|
53 | + const ORBIT_TYPE_DECAYED = 9; |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /* Entry points of Deep() |
|
58 | 58 | // FIXME: Change to enu */ |
59 | - const dpinit = 1; /* Deep-space initialization code */ |
|
60 | - const dpsec = 2; /* Deep-space secular code */ |
|
61 | - const dpper = 3; /* Deep-space periodic code */ |
|
62 | - |
|
63 | - /* SGP4 */ |
|
64 | - /* This function is used to calculate the position and velocity */ |
|
65 | - /* of near-earth (period < 225 minutes) satellites. tsince is */ |
|
66 | - /* time since epoch in minutes, tle is a pointer to a tle_t */ |
|
67 | - /* structure with Keplerian orbital elements and pos and vel */ |
|
68 | - /* are vector_t structures returning ECI satellite position and */ |
|
69 | - /* velocity. Use Convert_Sat_State() to convert to km and km/s.*/ |
|
70 | - public function SGP4(Predict_Sat $sat, $tsince) |
|
71 | - { |
|
72 | - /* Initialization */ |
|
73 | - if (~$sat->flags & self::SGP4_INITIALIZED_FLAG) { |
|
74 | - $sat->flags |= self::SGP4_INITIALIZED_FLAG; |
|
75 | - |
|
76 | - /* Recover original mean motion (xnodp) and */ |
|
77 | - /* semimajor axis (aodp) from input elements. */ |
|
78 | - $a1 = pow(Predict::xke / $sat->tle->xno, Predict::tothrd); |
|
79 | - $sat->sgps->cosio = cos($sat->tle->xincl); |
|
80 | - $theta2 = $sat->sgps->cosio * $sat->sgps->cosio; |
|
81 | - $sat->sgps->x3thm1 = 3 * $theta2 - 1.0; |
|
82 | - $eosq = $sat->tle->eo * $sat->tle->eo; |
|
83 | - $betao2 = 1 - $eosq; |
|
84 | - $betao = sqrt($betao2); |
|
85 | - $del1 = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / ($a1 * $a1 * $betao * $betao2); |
|
86 | - $ao = $a1 * (1 - $del1 * (0.5 * Predict::tothrd + $del1 * (1 + 134.0 / 81.0 * $del1))); |
|
87 | - $delo = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / ($ao * $ao * $betao * $betao2); |
|
88 | - $sat->sgps->xnodp = $sat->tle->xno / (1.0 + $delo); |
|
89 | - $sat->sgps->aodp = $ao / (1.0 - $delo); |
|
90 | - |
|
91 | - /* For perigee less than 220 kilometers, the "simple" flag is set */ |
|
92 | - /* and the equations are truncated to linear variation in sqrt a */ |
|
93 | - /* and quadratic variation in mean anomaly. Also, the c3 term, */ |
|
94 | - /* the delta omega term, and the delta m term are dropped. */ |
|
95 | - if (($sat->sgps->aodp * (1.0 - $sat->tle->eo) / Predict::ae) < (220.0 / Predict::xkmper + Predict::ae)) { |
|
96 | - $sat->flags |= self::SIMPLE_FLAG; |
|
97 | - } else { |
|
98 | - $sat->flags &= ~self::SIMPLE_FLAG; |
|
99 | - } |
|
100 | - |
|
101 | - /* For perigee below 156 km, the */ |
|
102 | - /* values of s and qoms2t are altered. */ |
|
103 | - $s4 = Predict::__s__; |
|
104 | - $qoms24 = Predict::qoms2t; |
|
105 | - $perige = ($sat->sgps->aodp * (1 - $sat->tle->eo) - Predict::ae) * Predict::xkmper; |
|
106 | - if ($perige < 156.0) { |
|
107 | - if ($perige <= 98.0) { |
|
108 | - $s4 = 20.0; |
|
109 | - } else { |
|
110 | - $s4 = $perige - 78.0; |
|
111 | - } |
|
112 | - $qoms24 = pow((120.0 - $s4) * Predict::ae / Predict::xkmper, 4); |
|
113 | - $s4 = $s4 / Predict::xkmper + Predict::ae; |
|
114 | - }; /* FIXME FIXME: End of if(perige <= 98) NO WAY!!!! */ |
|
115 | - |
|
116 | - $pinvsq = 1.0 / ($sat->sgps->aodp * $sat->sgps->aodp * $betao2 * $betao2); |
|
117 | - $tsi = 1.0 / ($sat->sgps->aodp - $s4); |
|
118 | - $sat->sgps->eta = $sat->sgps->aodp * $sat->tle->eo * $tsi; |
|
119 | - $etasq = $sat->sgps->eta * $sat->sgps->eta; |
|
120 | - $eeta = $sat->tle->eo * $sat->sgps->eta; |
|
121 | - $psisq = abs(1.0 - $etasq); |
|
122 | - $coef = $qoms24 * pow($tsi, 4); |
|
123 | - $coef1 = $coef / pow($psisq, 3.5); |
|
124 | - $c2 = $coef1 * $sat->sgps->xnodp * ($sat->sgps->aodp * |
|
125 | - (1.0 + 1.5 * $etasq + $eeta * (4.0 + $etasq)) + |
|
126 | - 0.75 * Predict::ck2 * $tsi / $psisq * $sat->sgps->x3thm1 * |
|
127 | - (8.0 + 3.0 * $etasq * (8 + $etasq))); |
|
128 | - $sat->sgps->c1 = $c2 * $sat->tle->bstar; |
|
129 | - $sat->sgps->sinio = sin($sat->tle->xincl); |
|
130 | - $a3ovk2 = -Predict::xj3 / Predict::ck2 * pow(Predict::ae, 3); |
|
131 | - $c3 = $coef * $tsi * $a3ovk2 * $sat->sgps->xnodp * Predict::ae * $sat->sgps->sinio / $sat->tle->eo; |
|
132 | - $sat->sgps->x1mth2 = 1.0 - $theta2; |
|
133 | - $sat->sgps->c4 = 2.0 * $sat->sgps->xnodp * $coef1 * $sat->sgps->aodp * $betao2 * |
|
134 | - ($sat->sgps->eta * (2.0 + 0.5 * $etasq) + |
|
135 | - $sat->tle->eo * (0.5 + 2.0 * $etasq) - |
|
136 | - 2.0 * Predict::ck2 * $tsi / ($sat->sgps->aodp * $psisq) * |
|
137 | - (-3.0 * $sat->sgps->x3thm1 * (1.0 - 2.0 * $eeta + $etasq * (1.5 - 0.5 * $eeta)) + |
|
138 | - 0.75 * $sat->sgps->x1mth2 * (2.0 * $etasq - $eeta * (1.0 + $etasq)) * |
|
139 | - cos(2.0 * $sat->tle->omegao))); |
|
140 | - $sat->sgps->c5 = 2.0 * $coef1 * $sat->sgps->aodp * $betao2 * |
|
141 | - (1.0 + 2.75 * ($etasq + $eeta) + $eeta * $etasq); |
|
142 | - $theta4 = $theta2 * $theta2; |
|
143 | - $temp1 = 3.0 * Predict::ck2 * $pinvsq * $sat->sgps->xnodp; |
|
144 | - $temp2 = $temp1 * Predict::ck2 * $pinvsq; |
|
145 | - $temp3 = 1.25 * Predict::ck4 * $pinvsq * $pinvsq * $sat->sgps->xnodp; |
|
146 | - $sat->sgps->xmdot = $sat->sgps->xnodp + 0.5 * $temp1 * $betao * $sat->sgps->x3thm1 + |
|
147 | - 0.0625 * $temp2 * $betao * (13.0 - 78.0 * $theta2 + 137.0 * $theta4); |
|
148 | - $x1m5th = 1.0 - 5.0 * $theta2; |
|
149 | - $sat->sgps->omgdot = -0.5 * $temp1 * $x1m5th + |
|
150 | - 0.0625 * $temp2 * (7.0 - 114.0 * $theta2 + 395.0 * $theta4) + |
|
151 | - $temp3 * (3.0 - 36.0 * $theta2 + 49.0 * $theta4); |
|
152 | - $xhdot1 = -$temp1 * $sat->sgps->cosio; |
|
153 | - $sat->sgps->xnodot = $xhdot1 + (0.5 * $temp2 * (4.0 - 19.0 * $theta2) + |
|
154 | - 2.0 * $temp3 * (3.0 - 7.0 * $theta2)) * $sat->sgps->cosio; |
|
155 | - $sat->sgps->omgcof = $sat->tle->bstar * $c3 * cos($sat->tle->omegao); |
|
156 | - $sat->sgps->xmcof = -Predict::tothrd * $coef * $sat->tle->bstar * Predict::ae / $eeta; |
|
157 | - $sat->sgps->xnodcf = 3.5 * $betao2 * $xhdot1 * $sat->sgps->c1; |
|
158 | - $sat->sgps->t2cof = 1.5 * $sat->sgps->c1; |
|
159 | - $sat->sgps->xlcof = 0.125 * $a3ovk2 * $sat->sgps->sinio * |
|
160 | - (3.0 + 5.0 * $sat->sgps->cosio) / (1.0 + $sat->sgps->cosio); |
|
161 | - $sat->sgps->aycof = 0.25 * $a3ovk2 * $sat->sgps->sinio; |
|
162 | - $sat->sgps->delmo = pow(1.0 + $sat->sgps->eta * cos($sat->tle->xmo), 3); |
|
163 | - $sat->sgps->sinmo = sin($sat->tle->xmo); |
|
164 | - $sat->sgps->x7thm1 = 7.0 * $theta2 - 1.0; |
|
165 | - if (~$sat->flags & self::SIMPLE_FLAG) { |
|
166 | - $c1sq = $sat->sgps->c1 * $sat->sgps->c1; |
|
167 | - $sat->sgps->d2 = 4.0 * $sat->sgps->aodp * $tsi * $c1sq; |
|
168 | - $temp = $sat->sgps->d2 * $tsi * $sat->sgps->c1 / 3.0; |
|
169 | - $sat->sgps->d3 = (17.0 * $sat->sgps->aodp + $s4) * $temp; |
|
170 | - $sat->sgps->d4 = 0.5 * $temp * $sat->sgps->aodp * $tsi * |
|
171 | - (221.0 * $sat->sgps->aodp + 31.0 * $s4) * $sat->sgps->c1; |
|
172 | - $sat->sgps->t3cof = $sat->sgps->d2 + 2.0 * $c1sq; |
|
173 | - $sat->sgps->t4cof = 0.25 * (3.0 * $sat->sgps->d3 + $sat->sgps->c1 * |
|
174 | - (12.0 * $sat->sgps->d2 + 10.0 * $c1sq)); |
|
175 | - $sat->sgps->t5cof = 0.2 * (3.0 * $sat->sgps->d4 + |
|
176 | - 12.0 * $sat->sgps->c1 * $sat->sgps->d3 + |
|
177 | - 6.0 * $sat->sgps->d2 * $sat->sgps->d2 + |
|
178 | - 15.0 * $c1sq * (2.0 * $sat->sgps->d2 + $c1sq)); |
|
179 | - }; /* End of if (isFlagClear(SIMPLE_FLAG)) */ |
|
180 | - }; /* End of SGP4() initialization */ |
|
181 | - |
|
182 | - /* Update for secular gravity and atmospheric drag. */ |
|
183 | - $xmdf = $sat->tle->xmo + $sat->sgps->xmdot * $tsince; |
|
184 | - $omgadf = $sat->tle->omegao + $sat->sgps->omgdot * $tsince; |
|
185 | - $xnoddf = $sat->tle->xnodeo + $sat->sgps->xnodot * $tsince; |
|
186 | - $omega = $omgadf; |
|
187 | - $xmp = $xmdf; |
|
188 | - $tsq = $tsince * $tsince; |
|
189 | - $xnode = $xnoddf + $sat->sgps->xnodcf * $tsq; |
|
190 | - $tempa = 1.0 - $sat->sgps->c1 * $tsince; |
|
191 | - $tempe = $sat->tle->bstar * $sat->sgps->c4 * $tsince; |
|
192 | - $templ = $sat->sgps->t2cof * $tsq; |
|
193 | - if (~$sat->flags & self::SIMPLE_FLAG) { |
|
194 | - $delomg = $sat->sgps->omgcof * $tsince; |
|
195 | - $delm = $sat->sgps->xmcof * (pow(1 + $sat->sgps->eta * cos($xmdf), 3) - $sat->sgps->delmo); |
|
196 | - $temp = $delomg + $delm; |
|
197 | - $xmp = $xmdf + $temp; |
|
198 | - $omega = $omgadf - $temp; |
|
199 | - $tcube = $tsq * $tsince; |
|
200 | - $tfour = $tsince * $tcube; |
|
201 | - $tempa = $tempa - $sat->sgps->d2 * $tsq - $sat->sgps->d3 * $tcube - $sat->sgps->d4 * $tfour; |
|
202 | - $tempe = $tempe + $sat->tle->bstar * $sat->sgps->c5 * (sin($xmp) - $sat->sgps->sinmo); |
|
203 | - $templ = $templ + $sat->sgps->t3cof * $tcube + $tfour * |
|
204 | - ($sat->sgps->t4cof + $tsince * $sat->sgps->t5cof); |
|
205 | - }; /* End of if (isFlagClear(SIMPLE_FLAG)) */ |
|
206 | - |
|
207 | - $a = $sat->sgps->aodp * pow($tempa, 2); |
|
208 | - $e = $sat->tle->eo - $tempe; |
|
209 | - $xl = $xmp + $omega + $xnode + $sat->sgps->xnodp * $templ; |
|
210 | - $beta = sqrt(1.0 - ($e * $e)); |
|
211 | - $xn = Predict::xke / pow($a, 1.5); |
|
212 | - |
|
213 | - /* Long period periodics */ |
|
214 | - $axn = $e * cos($omega); |
|
215 | - $temp = 1.0 / ($a * $beta * $beta); |
|
216 | - $xll = $temp * $sat->sgps->xlcof * $axn; |
|
217 | - $aynl = $temp * $sat->sgps->aycof; |
|
218 | - $xlt = $xl + $xll; |
|
219 | - $ayn = $e * sin($omega) + $aynl; |
|
220 | - |
|
221 | - /* Solve Kepler's' Equation */ |
|
222 | - $capu = Predict_Math::FMod2p($xlt - $xnode); |
|
223 | - $temp2 = $capu; |
|
224 | - |
|
225 | - $i = 0; |
|
226 | - do { |
|
227 | - $sinepw = sin($temp2); |
|
228 | - $cosepw = cos($temp2); |
|
229 | - $temp3 = $axn * $sinepw; |
|
230 | - $temp4 = $ayn * $cosepw; |
|
231 | - $temp5 = $axn * $cosepw; |
|
232 | - $temp6 = $ayn * $sinepw; |
|
233 | - $epw = ($capu - $temp4 + $temp3 - $temp2) / (1.0 - $temp5 - $temp6) + $temp2; |
|
234 | - if (abs($epw - $temp2) <= Predict::e6a) { |
|
235 | - break; |
|
236 | - } |
|
237 | - $temp2 = $epw; |
|
238 | - } while ($i++ < 10); |
|
239 | - |
|
240 | - /* Short period preliminary quantities */ |
|
241 | - $ecose = $temp5 + $temp6; |
|
242 | - $esine = $temp3 - $temp4; |
|
243 | - $elsq = $axn * $axn + $ayn * $ayn; |
|
244 | - $temp = 1.0 - $elsq; |
|
245 | - $pl = $a * $temp; |
|
246 | - $r = $a * (1.0 - $ecose); |
|
247 | - $temp1 = 1.0 / $r; |
|
248 | - $rdot = Predict::xke * sqrt($a) * $esine * $temp1; |
|
249 | - $rfdot = Predict::xke * sqrt($pl) * $temp1; |
|
250 | - $temp2 = $a * $temp1; |
|
251 | - $betal = sqrt($temp); |
|
252 | - $temp3 = 1.0 / (1.0 + $betal); |
|
253 | - $cosu = $temp2 * ($cosepw - $axn + $ayn * $esine * $temp3); |
|
254 | - $sinu = $temp2 * ($sinepw - $ayn - $axn * $esine * $temp3); |
|
255 | - $u = Predict_Math::AcTan($sinu, $cosu); |
|
256 | - $sin2u = 2.0 * $sinu * $cosu; |
|
257 | - $cos2u = 2.0 * $cosu * $cosu - 1.0; |
|
258 | - $temp = 1.0 / $pl; |
|
259 | - $temp1 = Predict::ck2 * $temp; |
|
260 | - $temp2 = $temp1 * $temp; |
|
261 | - |
|
262 | - /* Update for short periodics */ |
|
263 | - $rk = $r * (1.0 - 1.5 * $temp2 * $betal * $sat->sgps->x3thm1) + |
|
264 | - 0.5 * $temp1 * $sat->sgps->x1mth2 * $cos2u; |
|
265 | - $uk = $u - 0.25 * $temp2 * $sat->sgps->x7thm1 * $sin2u; |
|
266 | - $xnodek = $xnode + 1.5 * $temp2 * $sat->sgps->cosio * $sin2u; |
|
267 | - $xinck = $sat->tle->xincl + 1.5 * $temp2 * $sat->sgps->cosio * $sat->sgps->sinio * $cos2u; |
|
268 | - $rdotk = $rdot - $xn * $temp1 * $sat->sgps->x1mth2 * $sin2u; |
|
269 | - $rfdotk = $rfdot + $xn * $temp1 * ($sat->sgps->x1mth2 * $cos2u + 1.5 * $sat->sgps->x3thm1); |
|
270 | - |
|
271 | - |
|
272 | - /* Orientation vectors */ |
|
273 | - $sinuk = sin($uk); |
|
274 | - $cosuk = cos($uk); |
|
275 | - $sinik = sin($xinck); |
|
276 | - $cosik = cos($xinck); |
|
277 | - $sinnok = sin($xnodek); |
|
278 | - $cosnok = cos($xnodek); |
|
279 | - $xmx = -$sinnok * $cosik; |
|
280 | - $xmy = $cosnok * $cosik; |
|
281 | - $ux = $xmx * $sinuk + $cosnok * $cosuk; |
|
282 | - $uy = $xmy * $sinuk + $sinnok * $cosuk; |
|
283 | - $uz = $sinik * $sinuk; |
|
284 | - $vx = $xmx * $cosuk - $cosnok * $sinuk; |
|
285 | - $vy = $xmy * $cosuk - $sinnok * $sinuk; |
|
286 | - $vz = $sinik * $cosuk; |
|
287 | - |
|
288 | - /* Position and velocity */ |
|
289 | - $sat->pos->x = $rk * $ux; |
|
290 | - $sat->pos->y = $rk * $uy; |
|
291 | - $sat->pos->z = $rk * $uz; |
|
292 | - $sat->vel->x = $rdotk * $ux + $rfdotk * $vx; |
|
293 | - $sat->vel->y = $rdotk * $uy + $rfdotk * $vy; |
|
294 | - $sat->vel->z = $rdotk * $uz + $rfdotk * $vz; |
|
295 | - |
|
296 | - $sat->phase = $xlt - $xnode - $omgadf + Predict::twopi; |
|
297 | - if ($sat->phase < 0) { |
|
298 | - $sat->phase += Predict::twopi; |
|
299 | - } |
|
300 | - $sat->phase = Predict_Math::FMod2p($sat->phase); |
|
301 | - |
|
302 | - $sat->tle->omegao1 = $omega; |
|
303 | - $sat->tle->xincl1 = $xinck; |
|
304 | - $sat->tle->xnodeo1 = $xnodek; |
|
305 | - |
|
306 | - } /*SGP4*/ |
|
307 | - |
|
308 | - /* SDP4 */ |
|
309 | - /* This function is used to calculate the position and velocity */ |
|
310 | - /* of deep-space (period > 225 minutes) satellites. tsince is */ |
|
311 | - /* time since epoch in minutes, tle is a pointer to a tle_t */ |
|
312 | - /* structure with Keplerian orbital elements and pos and vel */ |
|
313 | - /* are vector_t structures returning ECI satellite position and */ |
|
314 | - /* velocity. Use Convert_Sat_State() to convert to km and km/s. */ |
|
315 | - public function SDP4(Predict_Sat $sat, $tsince) |
|
316 | - { |
|
317 | - /* Initialization */ |
|
318 | - if (~$sat->flags & self::SDP4_INITIALIZED_FLAG) { |
|
319 | - |
|
320 | - $sat->flags |= self::SDP4_INITIALIZED_FLAG; |
|
321 | - |
|
322 | - /* Recover original mean motion (xnodp) and */ |
|
323 | - /* semimajor axis (aodp) from input elements. */ |
|
324 | - $a1 = pow(Predict::xke / $sat->tle->xno, Predict::tothrd); |
|
325 | - $sat->deep_arg->cosio = cos($sat->tle->xincl); |
|
326 | - $sat->deep_arg->theta2 = $sat->deep_arg->cosio * $sat->deep_arg->cosio; |
|
327 | - $sat->sgps->x3thm1 = 3.0 * $sat->deep_arg->theta2 - 1.0; |
|
328 | - $sat->deep_arg->eosq = $sat->tle->eo * $sat->tle->eo; |
|
329 | - $sat->deep_arg->betao2 = 1.0 - $sat->deep_arg->eosq; |
|
330 | - $sat->deep_arg->betao = sqrt($sat->deep_arg->betao2); |
|
331 | - $del1 = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / |
|
332 | - ($a1 * $a1 * $sat->deep_arg->betao * $sat->deep_arg->betao2); |
|
333 | - $ao = $a1 * (1.0 - $del1 * (0.5 * Predict::tothrd + $del1 * (1.0 + 134.0 / 81.0 * $del1))); |
|
334 | - $delo = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / |
|
335 | - ($ao * $ao * $sat->deep_arg->betao * $sat->deep_arg->betao2); |
|
336 | - $sat->deep_arg->xnodp = $sat->tle->xno / (1.0 + $delo); |
|
337 | - $sat->deep_arg->aodp = $ao / (1.0 - $delo); |
|
338 | - |
|
339 | - /* For perigee below 156 km, the values */ |
|
340 | - /* of s and qoms2t are altered. */ |
|
341 | - $s4 = Predict::__s__; |
|
342 | - $qoms24 = Predict::qoms2t; |
|
343 | - $perige = ($sat->deep_arg->aodp * (1.0 - $sat->tle->eo) - Predict::ae) * Predict::xkmper; |
|
344 | - if ($perige < 156.0) { |
|
345 | - if ($perige <= 98.0) { |
|
346 | - $s4 = 20.0; |
|
347 | - } else { |
|
348 | - $s4 = $perige - 78.0; |
|
349 | - } |
|
350 | - $qoms24 = pow((120.0 - $s4) * Predict::ae / Predict::xkmper, 4); |
|
351 | - $s4 = $s4 / Predict::xkmper + Predict::ae; |
|
352 | - } |
|
353 | - $pinvsq = 1.0 / ($sat->deep_arg->aodp * $sat->deep_arg->aodp * |
|
354 | - $sat->deep_arg->betao2 * $sat->deep_arg->betao2); |
|
355 | - $sat->deep_arg->sing = sin($sat->tle->omegao); |
|
356 | - $sat->deep_arg->cosg = cos($sat->tle->omegao); |
|
357 | - $tsi = 1.0 / ($sat->deep_arg->aodp - $s4); |
|
358 | - $eta = $sat->deep_arg->aodp * $sat->tle->eo * $tsi; |
|
359 | - $etasq = $eta * $eta; |
|
360 | - $eeta = $sat->tle->eo * $eta; |
|
361 | - $psisq = abs(1.0 - $etasq); |
|
362 | - $coef = $qoms24 * pow($tsi, 4); |
|
363 | - $coef1 = $coef / pow($psisq, 3.5); |
|
364 | - $c2 = $coef1 * $sat->deep_arg->xnodp * ($sat->deep_arg->aodp * |
|
365 | - (1.0 + 1.5 * $etasq + $eeta * |
|
366 | - (4.0 + $etasq)) + 0.75 * Predict::ck2 * $tsi / $psisq * |
|
367 | - $sat->sgps->x3thm1 * (8.0 + 3.0 * $etasq * |
|
368 | - (8.0 + $etasq))); |
|
369 | - $sat->sgps->c1 = $sat->tle->bstar * $c2; |
|
370 | - $sat->deep_arg->sinio = sin($sat->tle->xincl); |
|
371 | - $a3ovk2 = -Predict::xj3 / Predict::ck2 * pow(Predict::ae, 3); |
|
372 | - $sat->sgps->x1mth2 = 1.0 - $sat->deep_arg->theta2; |
|
373 | - $sat->sgps->c4 = 2.0 * $sat->deep_arg->xnodp * $coef1 * |
|
374 | - $sat->deep_arg->aodp * $sat->deep_arg->betao2 * |
|
375 | - ($eta * (2.0 + 0.5 * $etasq) + $sat->tle->eo * |
|
376 | - (0.5 + 2.0 * $etasq) - 2.0 * Predict::ck2 * $tsi / |
|
377 | - ($sat->deep_arg->aodp * $psisq) * (-3.0 * $sat->sgps->x3thm1 * |
|
378 | - (1.0 - 2.0 * $eeta + $etasq * |
|
379 | - (1.5 - 0.5 * $eeta)) + |
|
380 | - 0.75 * $sat->sgps->x1mth2 * |
|
381 | - (2.0 * $etasq - $eeta * (1.0 + $etasq)) * |
|
382 | - cos(2.0 * $sat->tle->omegao))); |
|
383 | - $theta4 = $sat->deep_arg->theta2 * $sat->deep_arg->theta2; |
|
384 | - $temp1 = 3.0 * Predict::ck2 * $pinvsq * $sat->deep_arg->xnodp; |
|
385 | - $temp2 = $temp1 * Predict::ck2 * $pinvsq; |
|
386 | - $temp3 = 1.25 * Predict::ck4 * $pinvsq * $pinvsq * $sat->deep_arg->xnodp; |
|
387 | - $sat->deep_arg->xmdot = $sat->deep_arg->xnodp + 0.5 * $temp1 * $sat->deep_arg->betao * |
|
388 | - $sat->sgps->x3thm1 + 0.0625 * $temp2 * $sat->deep_arg->betao * |
|
389 | - (13.0 - 78.0 * $sat->deep_arg->theta2 + 137.0 * $theta4); |
|
390 | - $x1m5th = 1.0 - 5.0 * $sat->deep_arg->theta2; |
|
391 | - $sat->deep_arg->omgdot = -0.5 * $temp1 * $x1m5th + 0.0625 * $temp2 * |
|
392 | - (7.0 - 114.0 * $sat->deep_arg->theta2 + 395.0 * $theta4) + |
|
393 | - $temp3 * (3.0 - 36.0 * $sat->deep_arg->theta2 + 49.0 * $theta4); |
|
394 | - $xhdot1 = -$temp1 * $sat->deep_arg->cosio; |
|
395 | - $sat->deep_arg->xnodot = $xhdot1 + (0.5 * $temp2 * (4.0 - 19.0 * $sat->deep_arg->theta2) + |
|
396 | - 2.0 * $temp3 * (3.0 - 7.0 * $sat->deep_arg->theta2)) * |
|
397 | - $sat->deep_arg->cosio; |
|
398 | - $sat->sgps->xnodcf = 3.5 * $sat->deep_arg->betao2 * $xhdot1 * $sat->sgps->c1; |
|
399 | - $sat->sgps->t2cof = 1.5 * $sat->sgps->c1; |
|
400 | - $sat->sgps->xlcof = 0.125 * $a3ovk2 * $sat->deep_arg->sinio * |
|
401 | - (3.0 + 5.0 * $sat->deep_arg->cosio) / (1.0 + $sat->deep_arg->cosio); |
|
402 | - $sat->sgps->aycof = 0.25 * $a3ovk2 * $sat->deep_arg->sinio; |
|
403 | - $sat->sgps->x7thm1 = 7.0 * $sat->deep_arg->theta2 - 1.0; |
|
404 | - |
|
405 | - /* initialize Deep() */ |
|
406 | - $this->Deep(self::dpinit, $sat); |
|
407 | - }; /*End of SDP4() initialization */ |
|
408 | - |
|
409 | - /* Update for secular gravity and atmospheric drag */ |
|
410 | - $xmdf = $sat->tle->xmo + $sat->deep_arg->xmdot * $tsince; |
|
411 | - $sat->deep_arg->omgadf = $sat->tle->omegao + $sat->deep_arg->omgdot * $tsince; |
|
412 | - $xnoddf = $sat->tle->xnodeo + $sat->deep_arg->xnodot * $tsince; |
|
413 | - $tsq = $tsince * $tsince; |
|
414 | - $sat->deep_arg->xnode = $xnoddf + $sat->sgps->xnodcf * $tsq; |
|
415 | - $tempa = 1.0 - $sat->sgps->c1 * $tsince; |
|
416 | - $tempe = $sat->tle->bstar * $sat->sgps->c4 * $tsince; |
|
417 | - $templ = $sat->sgps->t2cof * $tsq; |
|
418 | - $sat->deep_arg->xn = $sat->deep_arg->xnodp; |
|
419 | - |
|
420 | - /* Update for deep-space secular effects */ |
|
421 | - $sat->deep_arg->xll = $xmdf; |
|
422 | - $sat->deep_arg->t = $tsince; |
|
423 | - |
|
424 | - $this->Deep(self::dpsec, $sat); |
|
425 | - |
|
426 | - $xmdf = $sat->deep_arg->xll; |
|
427 | - $a = pow(Predict::xke / $sat->deep_arg->xn, Predict::tothrd) * $tempa * $tempa; |
|
428 | - $sat->deep_arg->em = $sat->deep_arg->em - $tempe; |
|
429 | - $xmam = $xmdf + $sat->deep_arg->xnodp * $templ; |
|
430 | - |
|
431 | - /* Update for deep-space periodic effects */ |
|
432 | - $sat->deep_arg->xll = $xmam; |
|
433 | - |
|
434 | - $this->Deep(self::dpper, $sat); |
|
435 | - |
|
436 | - $xmam = $sat->deep_arg->xll; |
|
437 | - $xl = $xmam + $sat->deep_arg->omgadf + $sat->deep_arg->xnode; |
|
438 | - $beta = sqrt(1.0 - $sat->deep_arg->em * $sat->deep_arg->em); |
|
439 | - $sat->deep_arg->xn = Predict::xke / pow($a, 1.5); |
|
440 | - |
|
441 | - /* Long period periodics */ |
|
442 | - $axn = $sat->deep_arg->em * cos($sat->deep_arg->omgadf); |
|
443 | - $temp = 1.0 / ($a * $beta * $beta); |
|
444 | - $xll = $temp * $sat->sgps->xlcof * $axn; |
|
445 | - $aynl = $temp * $sat->sgps->aycof; |
|
446 | - $xlt = $xl + $xll; |
|
447 | - $ayn = $sat->deep_arg->em * sin($sat->deep_arg->omgadf) + $aynl; |
|
448 | - |
|
449 | - /* Solve Kepler's Equation */ |
|
450 | - $capu = Predict_Math::FMod2p ($xlt - $sat->deep_arg->xnode); |
|
451 | - $temp2 = $capu; |
|
452 | - |
|
453 | - $i = 0; |
|
454 | - do { |
|
455 | - $sinepw = sin($temp2); |
|
456 | - $cosepw = cos($temp2); |
|
457 | - $temp3 = $axn * $sinepw; |
|
458 | - $temp4 = $ayn * $cosepw; |
|
459 | - $temp5 = $axn * $cosepw; |
|
460 | - $temp6 = $ayn * $sinepw; |
|
461 | - $epw = ($capu - $temp4 + $temp3 - $temp2) / (1.0 - $temp5 - $temp6) + $temp2; |
|
462 | - if (abs($epw - $temp2) <= Predict::e6a) { |
|
463 | - break; |
|
464 | - } |
|
465 | - $temp2 = $epw; |
|
466 | - } while ($i++ < 10); |
|
467 | - |
|
468 | - /* Short period preliminary quantities */ |
|
469 | - $ecose = $temp5 + $temp6; |
|
470 | - $esine = $temp3 - $temp4; |
|
471 | - $elsq = $axn * $axn + $ayn * $ayn; |
|
472 | - $temp = 1.0 - $elsq; |
|
473 | - $pl = $a * $temp; |
|
474 | - $r = $a * (1.0 - $ecose); |
|
475 | - $temp1 = 1.0 / $r; |
|
476 | - $rdot = Predict::xke * sqrt($a) * $esine * $temp1; |
|
477 | - $rfdot = Predict::xke * sqrt($pl) * $temp1; |
|
478 | - $temp2 = $a * $temp1; |
|
479 | - $betal = sqrt($temp); |
|
480 | - $temp3 = 1.0 / (1.0 + $betal); |
|
481 | - $cosu = $temp2 * ($cosepw - $axn + $ayn * $esine * $temp3); |
|
482 | - $sinu = $temp2 * ($sinepw - $ayn - $axn * $esine * $temp3); |
|
483 | - $u = Predict_Math::AcTan($sinu, $cosu); |
|
484 | - $sin2u = 2.0 * $sinu * $cosu; |
|
485 | - $cos2u = 2.0 * $cosu * $cosu - 1.0; |
|
486 | - $temp = 1.0 / $pl; |
|
487 | - $temp1 = Predict::ck2 * $temp; |
|
488 | - $temp2 = $temp1 * $temp; |
|
489 | - |
|
490 | - /* Update for short periodics */ |
|
491 | - $rk = $r * (1.0 - 1.5 * $temp2 * $betal * $sat->sgps->x3thm1) + |
|
492 | - 0.5 * $temp1 * $sat->sgps->x1mth2 * $cos2u; |
|
493 | - $uk = $u - 0.25 * $temp2 * $sat->sgps->x7thm1 * $sin2u; |
|
494 | - $xnodek = $sat->deep_arg->xnode + 1.5 * $temp2 * $sat->deep_arg->cosio * $sin2u; |
|
495 | - $xinck = $sat->deep_arg->xinc + 1.5 * $temp2 * |
|
496 | - $sat->deep_arg->cosio * $sat->deep_arg->sinio * $cos2u; |
|
497 | - $rdotk = $rdot - $sat->deep_arg->xn * $temp1 * $sat->sgps->x1mth2 * $sin2u; |
|
498 | - $rfdotk = $rfdot + $sat->deep_arg->xn * $temp1 * |
|
499 | - ($sat->sgps->x1mth2 * $cos2u + 1.5 * $sat->sgps->x3thm1); |
|
500 | - |
|
501 | - /* Orientation vectors */ |
|
502 | - $sinuk = sin($uk); |
|
503 | - $cosuk = cos($uk); |
|
504 | - $sinik = sin($xinck); |
|
505 | - $cosik = cos($xinck); |
|
506 | - $sinnok = sin($xnodek); |
|
507 | - $cosnok = cos($xnodek); |
|
508 | - $xmx = -$sinnok * $cosik; |
|
509 | - $xmy = $cosnok * $cosik; |
|
510 | - $ux = $xmx * $sinuk + $cosnok * $cosuk; |
|
511 | - $uy = $xmy * $sinuk + $sinnok * $cosuk; |
|
512 | - $uz = $sinik * $sinuk; |
|
513 | - $vx = $xmx * $cosuk - $cosnok * $sinuk; |
|
514 | - $vy = $xmy * $cosuk - $sinnok * $sinuk; |
|
515 | - $vz = $sinik * $cosuk; |
|
516 | - |
|
517 | - /* Position and velocity */ |
|
518 | - $sat->pos->x = $rk * $ux; |
|
519 | - $sat->pos->y = $rk * $uy; |
|
520 | - $sat->pos->z = $rk * $uz; |
|
521 | - $sat->vel->x = $rdotk * $ux + $rfdotk * $vx; |
|
522 | - $sat->vel->y = $rdotk * $uy + $rfdotk * $vy; |
|
523 | - $sat->vel->z = $rdotk * $uz + $rfdotk * $vz; |
|
524 | - |
|
525 | - /* Phase in rads */ |
|
526 | - $sat->phase = $xlt - $sat->deep_arg->xnode - $sat->deep_arg->omgadf + Predict::twopi; |
|
527 | - if ($sat->phase < 0.0) { |
|
528 | - $sat->phase += Predict::twopi; |
|
529 | - } |
|
530 | - $sat->phase = Predict_Math::FMod2p ($sat->phase); |
|
531 | - |
|
532 | - $sat->tle->omegao1 = $sat->deep_arg->omgadf; |
|
533 | - $sat->tle->xincl1 = $sat->deep_arg->xinc; |
|
534 | - $sat->tle->xnodeo1 = $sat->deep_arg->xnode; |
|
535 | - } /* SDP4 */ |
|
536 | - |
|
537 | - |
|
538 | - /* DEEP */ |
|
539 | - /* This function is used by SDP4 to add lunar and solar */ |
|
540 | - /* perturbation effects to deep-space orbit objects. */ |
|
541 | - public function Deep($ientry, Predict_Sat $sat) |
|
542 | - { |
|
543 | - switch ($ientry) { |
|
544 | - case self::dpinit : /* Entrance for deep space initialization */ |
|
545 | - $sat->dps->thgr = Predict_Time::ThetaG($sat->tle->epoch, $sat->deep_arg); |
|
546 | - $eq = $sat->tle->eo; |
|
547 | - $sat->dps->xnq = $sat->deep_arg->xnodp; |
|
548 | - $aqnv = 1.0 / $sat->deep_arg->aodp; |
|
549 | - $sat->dps->xqncl = $sat->tle->xincl; |
|
550 | - $xmao = $sat->tle->xmo; |
|
551 | - $xpidot = $sat->deep_arg->omgdot + $sat->deep_arg->xnodot; |
|
552 | - $sinq = sin($sat->tle->xnodeo); |
|
553 | - $cosq = cos($sat->tle->xnodeo); |
|
554 | - $sat->dps->omegaq = $sat->tle->omegao; |
|
555 | - $sat->dps->preep = 0; |
|
556 | - |
|
557 | - /* Initialize lunar solar terms */ |
|
558 | - $day = $sat->deep_arg->ds50 + 18261.5; /* Days since 1900 Jan 0.5 */ |
|
559 | - if ($day != $sat->dps->preep) { |
|
560 | - $sat->dps->preep = $day; |
|
561 | - $xnodce = 4.5236020 - 9.2422029E-4 * $day; |
|
562 | - $stem = sin($xnodce); |
|
563 | - $ctem = cos($xnodce); |
|
564 | - $sat->dps->zcosil = 0.91375164 - 0.03568096 * $ctem; |
|
565 | - $sat->dps->zsinil = sqrt(1.0 - $sat->dps->zcosil * $sat->dps->zcosil); |
|
566 | - $sat->dps->zsinhl = 0.089683511 * $stem / $sat->dps->zsinil; |
|
567 | - $sat->dps->zcoshl = sqrt(1.0 - $sat->dps->zsinhl * $sat->dps->zsinhl); |
|
568 | - $c = 4.7199672 + 0.22997150 * $day; |
|
569 | - $gam = 5.8351514 + 0.0019443680 * $day; |
|
570 | - $sat->dps->zmol = Predict_Math::FMod2p($c - $gam); |
|
571 | - $zx = 0.39785416 * $stem / $sat->dps->zsinil; |
|
572 | - $zy = $sat->dps->zcoshl * $ctem + 0.91744867 * $sat->dps->zsinhl * $stem; |
|
573 | - $zx = Predict_Math::AcTan($zx, $zy); |
|
574 | - $zx = $gam + $zx - $xnodce; |
|
575 | - $sat->dps->zcosgl = cos($zx); |
|
576 | - $sat->dps->zsingl = sin($zx); |
|
577 | - $sat->dps->zmos = 6.2565837 + 0.017201977 * $day; |
|
578 | - $sat->dps->zmos = Predict_Math::FMod2p($sat->dps->zmos); |
|
579 | - } /* End if(day != preep) */ |
|
580 | - |
|
581 | - /* Do solar terms */ |
|
582 | - $sat->dps->savtsn = 1E20; |
|
583 | - $zcosg = Predict::zcosgs; |
|
584 | - $zsing = Predict::zsings; |
|
585 | - $zcosi = Predict::zcosis; |
|
586 | - $zsini = Predict::zsinis; |
|
587 | - $zcosh = $cosq; |
|
588 | - $zsinh = $sinq; |
|
589 | - $cc = Predict::c1ss; |
|
590 | - $zn = Predict::zns; |
|
591 | - $ze = Predict::zes; |
|
592 | - $zmo = $sat->dps->zmos; |
|
593 | - $xnoi = 1.0 / $sat->dps->xnq; |
|
594 | - |
|
595 | - /* Loop breaks when Solar terms are done a second */ |
|
596 | - /* time, after Lunar terms are initialized */ |
|
597 | - for(;;) { |
|
598 | - /* Solar terms done again after Lunar terms are done */ |
|
599 | - $a1 = $zcosg * $zcosh + $zsing * $zcosi * $zsinh; |
|
600 | - $a3 = -$zsing * $zcosh + $zcosg * $zcosi * $zsinh; |
|
601 | - $a7 = -$zcosg * $zsinh + $zsing * $zcosi * $zcosh; |
|
602 | - $a8 = $zsing * $zsini; |
|
603 | - $a9 = $zsing * $zsinh + $zcosg * $zcosi * $zcosh; |
|
604 | - $a10 = $zcosg * $zsini; |
|
605 | - $a2 = $sat->deep_arg->cosio * $a7 + $sat->deep_arg->sinio * $a8; |
|
606 | - $a4 = $sat->deep_arg->cosio * $a9 + $sat->deep_arg->sinio * $a10; |
|
607 | - $a5 = -$sat->deep_arg->sinio * $a7 + $sat->deep_arg->cosio * $a8; |
|
608 | - $a6 = -$sat->deep_arg->sinio * $a9 + $sat->deep_arg->cosio * $a10; |
|
609 | - $x1 = $a1 * $sat->deep_arg->cosg + $a2 * $sat->deep_arg->sing; |
|
610 | - $x2 = $a3 * $sat->deep_arg->cosg + $a4 * $sat->deep_arg->sing; |
|
611 | - $x3 = -$a1 * $sat->deep_arg->sing + $a2 * $sat->deep_arg->cosg; |
|
612 | - $x4 = -$a3 * $sat->deep_arg->sing + $a4 * $sat->deep_arg->cosg; |
|
613 | - $x5 = $a5 * $sat->deep_arg->sing; |
|
614 | - $x6 = $a6 * $sat->deep_arg->sing; |
|
615 | - $x7 = $a5 * $sat->deep_arg->cosg; |
|
616 | - $x8 = $a6 * $sat->deep_arg->cosg; |
|
617 | - $z31 = 12 * $x1 * $x1 - 3 * $x3 * $x3; |
|
618 | - $z32 = 24 * $x1 * $x2 - 6 * $x3 * $x4; |
|
619 | - $z33 = 12 * $x2 * $x2 - 3 * $x4 * $x4; |
|
620 | - $z1 = 3 * ($a1 * $a1 + $a2 * $a2) + $z31 * $sat->deep_arg->eosq; |
|
621 | - $z2 = 6 * ($a1 * $a3 + $a2 * $a4) + $z32 * $sat->deep_arg->eosq; |
|
622 | - $z3 = 3 * ($a3 * $a3 + $a4 * $a4) + $z33 * $sat->deep_arg->eosq; |
|
623 | - $z11 = -6 * $a1 * $a5 + $sat->deep_arg->eosq * (-24 * $x1 * $x7 - 6 * $x3 * $x5); |
|
624 | - $z12 = -6 * ($a1 * $a6 + $a3 * $a5) + $sat->deep_arg->eosq * |
|
625 | - (-24 * ($x2 * $x7 + $x1 * $x8) - 6 * ($x3 * $x6 + $x4 * $x5)); |
|
626 | - $z13 = -6 * $a3 * $a6 + $sat->deep_arg->eosq * (-24 * $x2 * $x8 - 6 * $x4 * $x6); |
|
627 | - $z21 = 6 * $a2 * $a5 + $sat->deep_arg->eosq * (24 * $x1 * $x5 - 6 * $x3 * $x7); |
|
628 | - $z22 = 6 * ($a4 * $a5 + $a2 * $a6) + $sat->deep_arg->eosq * |
|
629 | - (24 * ($x2 * $x5 + $x1 * $x6) - 6 * ($x4 * $x7 + $x3 * $x8)); |
|
630 | - $z23 = 6 * $a4 * $a6 + $sat->deep_arg->eosq * (24 * $x2 * $x6 - 6 * $x4 * $x8); |
|
631 | - $z1 = $z1 + $z1 + $sat->deep_arg->betao2 * $z31; |
|
632 | - $z2 = $z2 + $z2 + $sat->deep_arg->betao2 * $z32; |
|
633 | - $z3 = $z3 + $z3 + $sat->deep_arg->betao2 * $z33; |
|
634 | - $s3 = $cc * $xnoi; |
|
635 | - $s2 = -0.5 * $s3 / $sat->deep_arg->betao; |
|
636 | - $s4 = $s3 * $sat->deep_arg->betao; |
|
637 | - $s1 = -15 * $eq * $s4; |
|
638 | - $s5 = $x1 * $x3 + $x2 * $x4; |
|
639 | - $s6 = $x2 * $x3 + $x1 * $x4; |
|
640 | - $s7 = $x2 * $x4 - $x1 * $x3; |
|
641 | - $se = $s1 * $zn * $s5; |
|
642 | - $si = $s2 * $zn * ($z11 + $z13); |
|
643 | - $sl = -$zn * $s3 * ($z1 + $z3 - 14 - 6 * $sat->deep_arg->eosq); |
|
644 | - $sgh = $s4 * $zn * ($z31 + $z33 - 6); |
|
645 | - $sh = -$zn * $s2 * ($z21 + $z23); |
|
646 | - if ($sat->dps->xqncl < 5.2359877E-2) { |
|
647 | - $sh = 0; |
|
648 | - } |
|
649 | - $sat->dps->ee2 = 2 * $s1 * $s6; |
|
650 | - $sat->dps->e3 = 2 * $s1 * $s7; |
|
651 | - $sat->dps->xi2 = 2 * $s2 * $z12; |
|
652 | - $sat->dps->xi3 = 2 * $s2 * ($z13 - $z11); |
|
653 | - $sat->dps->xl2 = -2 * $s3 * $z2; |
|
654 | - $sat->dps->xl3 = -2 * $s3 * ($z3 - $z1); |
|
655 | - $sat->dps->xl4 = -2 * $s3 * (-21 - 9 * $sat->deep_arg->eosq) * $ze; |
|
656 | - $sat->dps->xgh2 = 2 * $s4 * $z32; |
|
657 | - $sat->dps->xgh3 = 2 * $s4 * ($z33 - $z31); |
|
658 | - $sat->dps->xgh4 = -18 * $s4 * $ze; |
|
659 | - $sat->dps->xh2 = -2 * $s2 * $z22; |
|
660 | - $sat->dps->xh3 = -2 * $s2 * ($z23 - $z21); |
|
661 | - |
|
662 | - if ($sat->flags & self::LUNAR_TERMS_DONE_FLAG) { |
|
663 | - break; |
|
664 | - } |
|
665 | - |
|
666 | - /* Do lunar terms */ |
|
667 | - $sat->dps->sse = $se; |
|
668 | - $sat->dps->ssi = $si; |
|
669 | - $sat->dps->ssl = $sl; |
|
670 | - $sat->dps->ssh = $sh / $sat->deep_arg->sinio; |
|
671 | - $sat->dps->ssg = $sgh - $sat->deep_arg->cosio * $sat->dps->ssh; |
|
672 | - $sat->dps->se2 = $sat->dps->ee2; |
|
673 | - $sat->dps->si2 = $sat->dps->xi2; |
|
674 | - $sat->dps->sl2 = $sat->dps->xl2; |
|
675 | - $sat->dps->sgh2 = $sat->dps->xgh2; |
|
676 | - $sat->dps->sh2 = $sat->dps->xh2; |
|
677 | - $sat->dps->se3 = $sat->dps->e3; |
|
678 | - $sat->dps->si3 = $sat->dps->xi3; |
|
679 | - $sat->dps->sl3 = $sat->dps->xl3; |
|
680 | - $sat->dps->sgh3 = $sat->dps->xgh3; |
|
681 | - $sat->dps->sh3 = $sat->dps->xh3; |
|
682 | - $sat->dps->sl4 = $sat->dps->xl4; |
|
683 | - $sat->dps->sgh4 = $sat->dps->xgh4; |
|
684 | - $zcosg = $sat->dps->zcosgl; |
|
685 | - $zsing = $sat->dps->zsingl; |
|
686 | - $zcosi = $sat->dps->zcosil; |
|
687 | - $zsini = $sat->dps->zsinil; |
|
688 | - $zcosh = $sat->dps->zcoshl * $cosq + $sat->dps->zsinhl * $sinq; |
|
689 | - $zsinh = $sinq * $sat->dps->zcoshl - $cosq * $sat->dps->zsinhl; |
|
690 | - $zn = Predict::znl; |
|
691 | - $cc = Predict::c1l; |
|
692 | - $ze = Predict::zel; |
|
693 | - $zmo = $sat->dps->zmol; |
|
694 | - $sat->flags |= self::LUNAR_TERMS_DONE_FLAG; |
|
695 | - } /* End of for(;;) */ |
|
696 | - |
|
697 | - $sat->dps->sse = $sat->dps->sse + $se; |
|
698 | - $sat->dps->ssi = $sat->dps->ssi + $si; |
|
699 | - $sat->dps->ssl = $sat->dps->ssl + $sl; |
|
700 | - $sat->dps->ssg = $sat->dps->ssg + $sgh - $sat->deep_arg->cosio / $sat->deep_arg->sinio * $sh; |
|
701 | - $sat->dps->ssh = $sat->dps->ssh + $sh / $sat->deep_arg->sinio; |
|
702 | - |
|
703 | - /* Geopotential resonance initialization for 12 hour orbits */ |
|
704 | - $sat->flags &= ~self::RESONANCE_FLAG; |
|
705 | - $sat->flags &= ~self::SYNCHRONOUS_FLAG; |
|
706 | - |
|
707 | - if (!(($sat->dps->xnq < 0.0052359877) && ($sat->dps->xnq > 0.0034906585))) { |
|
708 | - if( ($sat->dps->xnq < 0.00826) || ($sat->dps->xnq > 0.00924) ) { |
|
709 | - return; |
|
710 | - } |
|
711 | - if ($eq < 0.5) { |
|
712 | - return; |
|
713 | - } |
|
714 | - $sat->flags |= self::RESONANCE_FLAG; |
|
715 | - $eoc = $eq * $sat->deep_arg->eosq; |
|
716 | - $g201 = -0.306 - ($eq - 0.64) * 0.440; |
|
717 | - if ($eq <= 0.65) { |
|
718 | - $g211 = 3.616 - 13.247 * $eq + 16.290 * $sat->deep_arg->eosq; |
|
719 | - $g310 = -19.302 + 117.390 * $eq - 228.419 * |
|
720 | - $sat->deep_arg->eosq + 156.591 * $eoc; |
|
721 | - $g322 = -18.9068 + 109.7927 * $eq - 214.6334 * |
|
722 | - $sat->deep_arg->eosq + 146.5816 * $eoc; |
|
723 | - $g410 = -41.122 + 242.694 * $eq - 471.094 * |
|
724 | - $sat->deep_arg->eosq + 313.953 * $eoc; |
|
725 | - $g422 = -146.407 + 841.880 * $eq - 1629.014 * |
|
726 | - $sat->deep_arg->eosq + 1083.435 * $eoc; |
|
727 | - $g520 = -532.114 + 3017.977 * $eq - 5740 * |
|
728 | - $sat->deep_arg->eosq + 3708.276 * $eoc; |
|
729 | - } else { |
|
730 | - $g211 = -72.099 + 331.819 * $eq - 508.738 * |
|
731 | - $sat->deep_arg->eosq + 266.724 * $eoc; |
|
732 | - $g310 = -346.844 + 1582.851 * $eq - 2415.925 * |
|
733 | - $sat->deep_arg->eosq + 1246.113 * $eoc; |
|
734 | - $g322 = -342.585 + 1554.908 * $eq - 2366.899 * |
|
735 | - $sat->deep_arg->eosq + 1215.972 * $eoc; |
|
736 | - $g410 = -1052.797 + 4758.686 * $eq - 7193.992 * |
|
737 | - $sat->deep_arg->eosq + 3651.957 * $eoc; |
|
738 | - $g422 = -3581.69 + 16178.11 * $eq - 24462.77 * |
|
739 | - $sat->deep_arg->eosq+ 12422.52 * $eoc; |
|
740 | - if ($eq <= 0.715) { |
|
741 | - $g520 = 1464.74 - 4664.75 * $eq + 3763.64 * $sat->deep_arg->eosq; |
|
742 | - } else { |
|
743 | - $g520 = -5149.66 + 29936.92 * $eq - 54087.36 * |
|
744 | - $sat->deep_arg->eosq + 31324.56 * $eoc; |
|
745 | - } |
|
746 | - } /* End if (eq <= 0.65) */ |
|
747 | - |
|
748 | - if ($eq < 0.7) { |
|
749 | - $g533 = -919.2277 + 4988.61 * $eq - 9064.77 * |
|
750 | - $sat->deep_arg->eosq + 5542.21 * $eoc; |
|
751 | - $g521 = -822.71072 + 4568.6173 * $eq - 8491.4146 * |
|
752 | - $sat->deep_arg->eosq + 5337.524 * $eoc; |
|
753 | - $g532 = -853.666 + 4690.25 * $eq - 8624.77 * |
|
754 | - $sat->deep_arg->eosq + 5341.4 * $eoc; |
|
755 | - } |
|
756 | - else { |
|
757 | - $g533 = -37995.78 + 161616.52 * $eq - 229838.2* |
|
758 | - $sat->deep_arg->eosq + 109377.94 * $eoc; |
|
759 | - $g521 = -51752.104 + 218913.95 * $eq - 309468.16* |
|
760 | - $sat->deep_arg->eosq + 146349.42 * $eoc; |
|
761 | - $g532 = -40023.88 + 170470.89 * $eq - 242699.48* |
|
762 | - $sat->deep_arg->eosq + 115605.82 * $eoc; |
|
763 | - } /* End if (eq <= 0.7) */ |
|
764 | - |
|
765 | - $sini2 = $sat->deep_arg->sinio * $sat->deep_arg->sinio; |
|
766 | - $f220 = 0.75 * (1 + 2 * $sat->deep_arg->cosio + $sat->deep_arg->theta2); |
|
767 | - $f221 = 1.5 * $sini2; |
|
768 | - $f321 = 1.875 * $sat->deep_arg->sinio * (1 - 2 * |
|
769 | - $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
770 | - $f322 = -1.875 * $sat->deep_arg->sinio * (1 + 2* |
|
771 | - $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
772 | - $f441 = 35 * $sini2 * $f220; |
|
773 | - $f442 = 39.3750 * $sini2 * $sini2; |
|
774 | - $f522 = 9.84375 * $sat->deep_arg->sinio * ($sini2 * (1 - 2 * $sat->deep_arg->cosio - 5 * |
|
775 | - $sat->deep_arg->theta2) + 0.33333333 * (-2 + 4 * $sat->deep_arg->cosio + |
|
776 | - 6 * $sat->deep_arg->theta2)); |
|
777 | - $f523 = $sat->deep_arg->sinio * (4.92187512 * $sini2 * (-2 - 4 * |
|
778 | - $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2) + 6.56250012 |
|
779 | - * (1 + 2 * $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2)); |
|
780 | - $f542 = 29.53125 * $sat->deep_arg->sinio * (2 - 8 * |
|
781 | - $sat->deep_arg->cosio + $sat->deep_arg->theta2 * |
|
782 | - (-12 + 8 * $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2)); |
|
783 | - $f543 = 29.53125 * $sat->deep_arg->sinio * (-2 - 8 * $sat->deep_arg->cosio + |
|
784 | - $sat->deep_arg->theta2 * (12 + 8 * $sat->deep_arg->cosio - 10 * |
|
785 | - $sat->deep_arg->theta2)); |
|
786 | - $xno2 = $sat->dps->xnq * $sat->dps->xnq; |
|
787 | - $ainv2 = $aqnv * $aqnv; |
|
788 | - $temp1 = 3 * $xno2 * $ainv2; |
|
789 | - $temp = $temp1 * Predict::root22; |
|
790 | - $sat->dps->d2201 = $temp * $f220 * $g201; |
|
791 | - $sat->dps->d2211 = $temp * $f221 * $g211; |
|
792 | - $temp1 = $temp1 * $aqnv; |
|
793 | - $temp = $temp1 * Predict::root32; |
|
794 | - $sat->dps->d3210 = $temp * $f321 * $g310; |
|
795 | - $sat->dps->d3222 = $temp * $f322 * $g322; |
|
796 | - $temp1 = $temp1 * $aqnv; |
|
797 | - $temp = 2 * $temp1 * Predict::root44; |
|
798 | - $sat->dps->d4410 = $temp * $f441 * $g410; |
|
799 | - $sat->dps->d4422 = $temp * $f442 * $g422; |
|
800 | - $temp1 = $temp1 * $aqnv; |
|
801 | - $temp = $temp1 * Predict::root52; |
|
802 | - $sat->dps->d5220 = $temp * $f522 * $g520; |
|
803 | - $sat->dps->d5232 = $temp * $f523 * $g532; |
|
804 | - $temp = 2 * $temp1 * Predict::root54; |
|
805 | - $sat->dps->d5421 = $temp * $f542 * $g521; |
|
806 | - $sat->dps->d5433 = $temp * $f543 * $g533; |
|
807 | - $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->xnodeo - $sat->dps->thgr - $sat->dps->thgr; |
|
808 | - $bfact = $sat->deep_arg->xmdot + $sat->deep_arg->xnodot + |
|
809 | - $sat->deep_arg->xnodot - Predict::thdt - Predict::thdt; |
|
810 | - $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssh + $sat->dps->ssh; |
|
811 | - } else { |
|
812 | - $sat->flags |= self::RESONANCE_FLAG; |
|
813 | - $sat->flags |= self::SYNCHRONOUS_FLAG; |
|
814 | - /* Synchronous resonance terms initialization */ |
|
815 | - $g200 = 1 + $sat->deep_arg->eosq * (-2.5 + 0.8125 * $sat->deep_arg->eosq); |
|
816 | - $g310 = 1 + 2 * $sat->deep_arg->eosq; |
|
817 | - $g300 = 1 + $sat->deep_arg->eosq * (-6 + 6.60937 * $sat->deep_arg->eosq); |
|
818 | - $f220 = 0.75 * (1 + $sat->deep_arg->cosio) * (1 + $sat->deep_arg->cosio); |
|
819 | - $f311 = 0.9375 * $sat->deep_arg->sinio * $sat->deep_arg->sinio * |
|
820 | - (1 + 3 * $sat->deep_arg->cosio) - 0.75 * (1 + $sat->deep_arg->cosio); |
|
821 | - $f330 = 1 + $sat->deep_arg->cosio; |
|
822 | - $f330 = 1.875 * $f330 * $f330 * $f330; |
|
823 | - $sat->dps->del1 = 3 * $sat->dps->xnq * $sat->dps->xnq * $aqnv * $aqnv; |
|
824 | - $sat->dps->del2 = 2 * $sat->dps->del1 * $f220 * $g200 * Predict::q22; |
|
825 | - $sat->dps->del3 = 3 * $sat->dps->del1 * $f330 * $g300 * Predict::q33 * $aqnv; |
|
826 | - $sat->dps->del1 = $sat->dps->del1 * $f311 * $g310 * Predict::q31 * $aqnv; |
|
827 | - $sat->dps->fasx2 = 0.13130908; |
|
828 | - $sat->dps->fasx4 = 2.8843198; |
|
829 | - $sat->dps->fasx6 = 0.37448087; |
|
830 | - $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->omegao - $sat->dps->thgr; |
|
831 | - $bfact = $sat->deep_arg->xmdot + $xpidot - Predict::thdt; |
|
832 | - $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssg + $sat->dps->ssh; |
|
833 | - } /* End if( !(xnq < 0.0052359877) && (xnq > 0.0034906585) ) */ |
|
834 | - |
|
835 | - $sat->dps->xfact = $bfact - $sat->dps->xnq; |
|
836 | - |
|
837 | - /* Initialize integrator */ |
|
838 | - $sat->dps->xli = $sat->dps->xlamo; |
|
839 | - $sat->dps->xni = $sat->dps->xnq; |
|
840 | - $sat->dps->atime = 0; |
|
841 | - $sat->dps->stepp = 720; |
|
842 | - $sat->dps->stepn = -720; |
|
843 | - $sat->dps->step2 = 259200; |
|
844 | - /* End case self::dpinit: */ |
|
845 | - return; |
|
846 | - |
|
847 | - case self::dpsec: /* Entrance for deep space secular effects */ |
|
848 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->ssl * $sat->deep_arg->t; |
|
849 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $sat->dps->ssg * $sat->deep_arg->t; |
|
850 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + $sat->dps->ssh * $sat->deep_arg->t; |
|
851 | - $sat->deep_arg->em = $sat->tle->eo + $sat->dps->sse * $sat->deep_arg->t; |
|
852 | - $sat->deep_arg->xinc = $sat->tle->xincl + $sat->dps->ssi * $sat->deep_arg->t; |
|
853 | - if ($sat->deep_arg->xinc < 0) { |
|
854 | - $sat->deep_arg->xinc = -$sat->deep_arg->xinc; |
|
855 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + Predict::pi; |
|
856 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf - Predict::pi; |
|
857 | - } |
|
858 | - if(~$sat->flags & self::RESONANCE_FLAG ) { |
|
859 | - return; |
|
860 | - } |
|
861 | - |
|
862 | - do { |
|
863 | - if ( ($sat->dps->atime == 0) || |
|
864 | - (($sat->deep_arg->t >= 0) && ($sat->dps->atime < 0)) || |
|
865 | - (($sat->deep_arg->t < 0) && ($sat->dps->atime >= 0)) ) { |
|
866 | - /* Epoch restart */ |
|
867 | - if ($sat->deep_arg->t >= 0) { |
|
868 | - $delt = $sat->dps->stepp; |
|
869 | - } else { |
|
870 | - $delt = $sat->dps->stepn; |
|
871 | - } |
|
872 | - |
|
873 | - $sat->dps->atime = 0; |
|
874 | - $sat->dps->xni = $sat->dps->xnq; |
|
875 | - $sat->dps->xli = $sat->dps->xlamo; |
|
876 | - } else { |
|
877 | - if (abs($sat->deep_arg->t) >= abs($sat->dps->atime)) { |
|
878 | - if ($sat->deep_arg->t > 0) { |
|
879 | - $delt = $sat->dps->stepp; |
|
880 | - } else { |
|
881 | - $delt = $sat->dps->stepn; |
|
882 | - } |
|
883 | - } |
|
884 | - } |
|
885 | - |
|
886 | - do { |
|
887 | - if (abs($sat->deep_arg->t - $sat->dps->atime) >= $sat->dps->stepp) { |
|
888 | - $sat->flags |= self::DO_LOOP_FLAG; |
|
889 | - $sat->flags &= ~self::EPOCH_RESTART_FLAG; |
|
890 | - } |
|
891 | - else { |
|
892 | - $ft = $sat->deep_arg->t - $sat->dps->atime; |
|
893 | - $sat->flags &= ~self::DO_LOOP_FLAG; |
|
894 | - } |
|
895 | - |
|
896 | - if (abs($sat->deep_arg->t) < abs($sat->dps->atime)) { |
|
897 | - if ($sat->deep_arg->t >= 0) { |
|
898 | - $delt = $sat->dps->stepn; |
|
899 | - } else { |
|
900 | - $delt = $sat->dps->stepp; |
|
901 | - } |
|
902 | - $sat->flags |= (self::DO_LOOP_FLAG | self::EPOCH_RESTART_FLAG); |
|
903 | - } |
|
904 | - |
|
905 | - /* Dot terms calculated */ |
|
906 | - if ($sat->flags & self::SYNCHRONOUS_FLAG) { |
|
907 | - $xndot = $sat->dps->del1 * sin($sat->dps->xli - $sat->dps->fasx2) + $sat->dps->del2 * sin(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
908 | - + $sat->dps->del3 * sin(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
909 | - $xnddt = $sat->dps->del1 * cos($sat->dps->xli - $sat->dps->fasx2) + 2 * $sat->dps->del2 * cos(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
910 | - + 3 * $sat->dps->del3 * cos(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
911 | - } else { |
|
912 | - $xomi = $sat->dps->omegaq + $sat->deep_arg->omgdot * $sat->dps->atime; |
|
913 | - $x2omi = $xomi + $xomi; |
|
914 | - $x2li = $sat->dps->xli + $sat->dps->xli; |
|
915 | - $xndot = $sat->dps->d2201 * sin($x2omi + $sat->dps->xli - Predict::g22) |
|
916 | - + $sat->dps->d2211 * sin($sat->dps->xli - Predict::g22) |
|
917 | - + $sat->dps->d3210 * sin($xomi + $sat->dps->xli - Predict::g32) |
|
918 | - + $sat->dps->d3222 * sin(-$xomi + $sat->dps->xli - Predict::g32) |
|
919 | - + $sat->dps->d4410 * sin($x2omi + $x2li- Predict::g44) |
|
920 | - + $sat->dps->d4422 * sin($x2li- Predict::g44) |
|
921 | - + $sat->dps->d5220 * sin($xomi + $sat->dps->xli- Predict::g52) |
|
922 | - + $sat->dps->d5232 * sin(-$xomi + $sat->dps->xli- Predict::g52) |
|
923 | - + $sat->dps->d5421 * sin($xomi + $x2li - Predict::g54) |
|
924 | - + $sat->dps->d5433 * sin(-$xomi + $x2li - Predict::g54); |
|
925 | - $xnddt = $sat->dps->d2201 * cos($x2omi + $sat->dps->xli- Predict::g22) |
|
926 | - + $sat->dps->d2211 * cos($sat->dps->xli - Predict::g22) |
|
927 | - + $sat->dps->d3210 * cos($xomi + $sat->dps->xli - Predict::g32) |
|
928 | - + $sat->dps->d3222 * cos(-$xomi + $sat->dps->xli - Predict::g32) |
|
929 | - + $sat->dps->d5220 * cos($xomi + $sat->dps->xli - Predict::g52) |
|
930 | - + $sat->dps->d5232 * cos(-$xomi + $sat->dps->xli - Predict::g52) |
|
931 | - + 2 * ($sat->dps->d4410 * cos($x2omi + $x2li - Predict::g44) |
|
932 | - + $sat->dps->d4422 * cos($x2li - Predict::g44) |
|
933 | - + $sat->dps->d5421 * cos($xomi + $x2li - Predict::g54) |
|
934 | - + $sat->dps->d5433 * cos(-$xomi + $x2li - Predict::g54)); |
|
935 | - } /* End of if (isFlagSet(SYNCHRONOUS_FLAG)) */ |
|
936 | - |
|
937 | - $xldot = $sat->dps->xni + $sat->dps->xfact; |
|
938 | - $xnddt = $xnddt * $xldot; |
|
939 | - |
|
940 | - if ($sat->flags & self::DO_LOOP_FLAG) { |
|
941 | - $sat->dps->xli = $sat->dps->xli + $xldot * $delt + $xndot * $sat->dps->step2; |
|
942 | - $sat->dps->xni = $sat->dps->xni + $xndot * $delt + $xnddt * $sat->dps->step2; |
|
943 | - $sat->dps->atime = $sat->dps->atime + $delt; |
|
944 | - } |
|
945 | - } while (($sat->flags & self::DO_LOOP_FLAG) && |
|
946 | - (~$sat->flags & self::EPOCH_RESTART_FLAG)); |
|
947 | - } |
|
948 | - while (($sat->flags & self::DO_LOOP_FLAG) && ($sat->flags & self::EPOCH_RESTART_FLAG)); |
|
949 | - |
|
950 | - $sat->deep_arg->xn = $sat->dps->xni + $xndot * $ft + $xnddt * $ft * $ft * 0.5; |
|
951 | - $xl = $sat->dps->xli + $xldot * $ft + $xndot * $ft * $ft * 0.5; |
|
952 | - $temp = -$sat->deep_arg->xnode + $sat->dps->thgr + $sat->deep_arg->t * Predict::thdt; |
|
953 | - |
|
954 | - if (~$sat->flags & self::SYNCHRONOUS_FLAG) { |
|
955 | - $sat->deep_arg->xll = $xl + $temp + $temp; |
|
956 | - } else { |
|
957 | - $sat->deep_arg->xll = $xl - $sat->deep_arg->omgadf + $temp; |
|
958 | - } |
|
959 | - |
|
960 | - return; |
|
961 | - /* End case dpsec: */ |
|
962 | - |
|
963 | - case self::dpper: /* Entrance for lunar-solar periodics */ |
|
964 | - $sinis = sin($sat->deep_arg->xinc); |
|
965 | - $cosis = cos($sat->deep_arg->xinc); |
|
966 | - if (abs($sat->dps->savtsn - $sat->deep_arg->t) >= 30) { |
|
967 | - $sat->dps->savtsn = $sat->deep_arg->t; |
|
968 | - $zm = $sat->dps->zmos + Predict::zns * $sat->deep_arg->t; |
|
969 | - $zf = $zm + 2 * Predict::zes * sin($zm); |
|
970 | - $sinzf = sin($zf); |
|
971 | - $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
972 | - $f3 = -0.5 * $sinzf * cos($zf); |
|
973 | - $ses = $sat->dps->se2 * $f2 + $sat->dps->se3 * $f3; |
|
974 | - $sis = $sat->dps->si2 * $f2 + $sat->dps->si3 * $f3; |
|
975 | - $sls = $sat->dps->sl2 * $f2 + $sat->dps->sl3 * $f3 + $sat->dps->sl4 * $sinzf; |
|
976 | - $sat->dps->sghs = $sat->dps->sgh2 * $f2 + $sat->dps->sgh3 * $f3 + $sat->dps->sgh4 * $sinzf; |
|
977 | - $sat->dps->shs = $sat->dps->sh2 * $f2 + $sat->dps->sh3 * $f3; |
|
978 | - $zm = $sat->dps->zmol + Predict::znl * $sat->deep_arg->t; |
|
979 | - $zf = $zm + 2 * Predict::zel * sin($zm); |
|
980 | - $sinzf = sin($zf); |
|
981 | - $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
982 | - $f3 = -0.5 * $sinzf * cos($zf); |
|
983 | - $sel = $sat->dps->ee2 * $f2 + $sat->dps->e3 * $f3; |
|
984 | - $sil = $sat->dps->xi2 * $f2 + $sat->dps->xi3 * $f3; |
|
985 | - $sll = $sat->dps->xl2 * $f2 + $sat->dps->xl3 * $f3 + $sat->dps->xl4 * $sinzf; |
|
986 | - $sat->dps->sghl = $sat->dps->xgh2 * $f2 + $sat->dps->xgh3 * $f3 + $sat->dps->xgh4 * $sinzf; |
|
987 | - $sat->dps->sh1 = $sat->dps->xh2 * $f2 + $sat->dps->xh3 * $f3; |
|
988 | - $sat->dps->pe = $ses + $sel; |
|
989 | - $sat->dps->pinc = $sis + $sil; |
|
990 | - $sat->dps->pl = $sls + $sll; |
|
991 | - } |
|
992 | - |
|
993 | - $pgh = $sat->dps->sghs + $sat->dps->sghl; |
|
994 | - $ph = $sat->dps->shs + $sat->dps->sh1; |
|
995 | - $sat->deep_arg->xinc = $sat->deep_arg->xinc + $sat->dps->pinc; |
|
996 | - $sat->deep_arg->em = $sat->deep_arg->em + $sat->dps->pe; |
|
997 | - |
|
998 | - if ($sat->dps->xqncl >= 0.2) { |
|
999 | - /* Apply periodics directly */ |
|
1000 | - $ph = $ph / $sat->deep_arg->sinio; |
|
1001 | - $pgh = $pgh - $sat->deep_arg->cosio * $ph; |
|
1002 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $pgh; |
|
1003 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + $ph; |
|
1004 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
|
1005 | - } else { |
|
1006 | - /* Apply periodics with Lyddane modification */ |
|
1007 | - $sinok = sin($sat->deep_arg->xnode); |
|
1008 | - $cosok = cos($sat->deep_arg->xnode); |
|
1009 | - $alfdp = $sinis * $sinok; |
|
1010 | - $betdp = $sinis * $cosok; |
|
1011 | - $dalf = $ph * $cosok + $sat->dps->pinc * $cosis * $sinok; |
|
1012 | - $dbet = -$ph * $sinok + $sat->dps->pinc * $cosis * $cosok; |
|
1013 | - $alfdp = $alfdp + $dalf; |
|
1014 | - $betdp = $betdp + $dbet; |
|
1015 | - $sat->deep_arg->xnode = Predict_Math::FMod2p($sat->deep_arg->xnode); |
|
1016 | - $xls = $sat->deep_arg->xll + $sat->deep_arg->omgadf + $cosis * $sat->deep_arg->xnode; |
|
1017 | - $dls = $sat->dps->pl + $pgh - $sat->dps->pinc * $sat->deep_arg->xnode * $sinis; |
|
1018 | - $xls = $xls + $dls; |
|
1019 | - $xnoh = $sat->deep_arg->xnode; |
|
1020 | - $sat->deep_arg->xnode = Predict_Math::AcTan($alfdp, $betdp); |
|
1021 | - |
|
1022 | - /* This is a patch to Lyddane modification */ |
|
1023 | - /* suggested by Rob Matson. */ |
|
1024 | - if(abs($xnoh - $sat->deep_arg->xnode) > Predict::pi) { |
|
1025 | - if ($sat->deep_arg->xnode < $xnoh) { |
|
1026 | - $sat->deep_arg->xnode += Predict::twopi; |
|
1027 | - } else { |
|
1028 | - $sat->deep_arg->xnode -= Predict::twopi; |
|
1029 | - } |
|
1030 | - } |
|
1031 | - |
|
1032 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
|
1033 | - $sat->deep_arg->omgadf = $xls - $sat->deep_arg->xll - cos($sat->deep_arg->xinc) * |
|
1034 | - $sat->deep_arg->xnode; |
|
1035 | - } /* End case dpper: */ |
|
1036 | - return; |
|
1037 | - |
|
1038 | - } /* End switch(ientry) */ |
|
1039 | - |
|
1040 | - } /* End of Deep() */ |
|
1041 | - |
|
1042 | - /** |
|
1043 | - * Singleton |
|
1044 | - * |
|
1045 | - * @param Predict_Sat $sat The current satellite data instance |
|
1046 | - * |
|
1047 | - * @return Predict_SGPSDP |
|
1048 | - */ |
|
1049 | - public static function getInstance(Predict_Sat $sat) |
|
1050 | - { |
|
1051 | - static $instances = array(); |
|
1052 | - $catnr = $sat->tle->catnr; |
|
1053 | - if (!isset($instances[$catnr])) { |
|
1054 | - $instances[$catnr] = new self(); |
|
1055 | - } |
|
1056 | - return $instances[$catnr]; |
|
1057 | - } |
|
59 | + const dpinit = 1; /* Deep-space initialization code */ |
|
60 | + const dpsec = 2; /* Deep-space secular code */ |
|
61 | + const dpper = 3; /* Deep-space periodic code */ |
|
62 | + |
|
63 | + /* SGP4 */ |
|
64 | + /* This function is used to calculate the position and velocity */ |
|
65 | + /* of near-earth (period < 225 minutes) satellites. tsince is */ |
|
66 | + /* time since epoch in minutes, tle is a pointer to a tle_t */ |
|
67 | + /* structure with Keplerian orbital elements and pos and vel */ |
|
68 | + /* are vector_t structures returning ECI satellite position and */ |
|
69 | + /* velocity. Use Convert_Sat_State() to convert to km and km/s.*/ |
|
70 | + public function SGP4(Predict_Sat $sat, $tsince) |
|
71 | + { |
|
72 | + /* Initialization */ |
|
73 | + if (~$sat->flags & self::SGP4_INITIALIZED_FLAG) { |
|
74 | + $sat->flags |= self::SGP4_INITIALIZED_FLAG; |
|
75 | + |
|
76 | + /* Recover original mean motion (xnodp) and */ |
|
77 | + /* semimajor axis (aodp) from input elements. */ |
|
78 | + $a1 = pow(Predict::xke / $sat->tle->xno, Predict::tothrd); |
|
79 | + $sat->sgps->cosio = cos($sat->tle->xincl); |
|
80 | + $theta2 = $sat->sgps->cosio * $sat->sgps->cosio; |
|
81 | + $sat->sgps->x3thm1 = 3 * $theta2 - 1.0; |
|
82 | + $eosq = $sat->tle->eo * $sat->tle->eo; |
|
83 | + $betao2 = 1 - $eosq; |
|
84 | + $betao = sqrt($betao2); |
|
85 | + $del1 = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / ($a1 * $a1 * $betao * $betao2); |
|
86 | + $ao = $a1 * (1 - $del1 * (0.5 * Predict::tothrd + $del1 * (1 + 134.0 / 81.0 * $del1))); |
|
87 | + $delo = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / ($ao * $ao * $betao * $betao2); |
|
88 | + $sat->sgps->xnodp = $sat->tle->xno / (1.0 + $delo); |
|
89 | + $sat->sgps->aodp = $ao / (1.0 - $delo); |
|
90 | + |
|
91 | + /* For perigee less than 220 kilometers, the "simple" flag is set */ |
|
92 | + /* and the equations are truncated to linear variation in sqrt a */ |
|
93 | + /* and quadratic variation in mean anomaly. Also, the c3 term, */ |
|
94 | + /* the delta omega term, and the delta m term are dropped. */ |
|
95 | + if (($sat->sgps->aodp * (1.0 - $sat->tle->eo) / Predict::ae) < (220.0 / Predict::xkmper + Predict::ae)) { |
|
96 | + $sat->flags |= self::SIMPLE_FLAG; |
|
97 | + } else { |
|
98 | + $sat->flags &= ~self::SIMPLE_FLAG; |
|
99 | + } |
|
100 | + |
|
101 | + /* For perigee below 156 km, the */ |
|
102 | + /* values of s and qoms2t are altered. */ |
|
103 | + $s4 = Predict::__s__; |
|
104 | + $qoms24 = Predict::qoms2t; |
|
105 | + $perige = ($sat->sgps->aodp * (1 - $sat->tle->eo) - Predict::ae) * Predict::xkmper; |
|
106 | + if ($perige < 156.0) { |
|
107 | + if ($perige <= 98.0) { |
|
108 | + $s4 = 20.0; |
|
109 | + } else { |
|
110 | + $s4 = $perige - 78.0; |
|
111 | + } |
|
112 | + $qoms24 = pow((120.0 - $s4) * Predict::ae / Predict::xkmper, 4); |
|
113 | + $s4 = $s4 / Predict::xkmper + Predict::ae; |
|
114 | + }; /* FIXME FIXME: End of if(perige <= 98) NO WAY!!!! */ |
|
115 | + |
|
116 | + $pinvsq = 1.0 / ($sat->sgps->aodp * $sat->sgps->aodp * $betao2 * $betao2); |
|
117 | + $tsi = 1.0 / ($sat->sgps->aodp - $s4); |
|
118 | + $sat->sgps->eta = $sat->sgps->aodp * $sat->tle->eo * $tsi; |
|
119 | + $etasq = $sat->sgps->eta * $sat->sgps->eta; |
|
120 | + $eeta = $sat->tle->eo * $sat->sgps->eta; |
|
121 | + $psisq = abs(1.0 - $etasq); |
|
122 | + $coef = $qoms24 * pow($tsi, 4); |
|
123 | + $coef1 = $coef / pow($psisq, 3.5); |
|
124 | + $c2 = $coef1 * $sat->sgps->xnodp * ($sat->sgps->aodp * |
|
125 | + (1.0 + 1.5 * $etasq + $eeta * (4.0 + $etasq)) + |
|
126 | + 0.75 * Predict::ck2 * $tsi / $psisq * $sat->sgps->x3thm1 * |
|
127 | + (8.0 + 3.0 * $etasq * (8 + $etasq))); |
|
128 | + $sat->sgps->c1 = $c2 * $sat->tle->bstar; |
|
129 | + $sat->sgps->sinio = sin($sat->tle->xincl); |
|
130 | + $a3ovk2 = -Predict::xj3 / Predict::ck2 * pow(Predict::ae, 3); |
|
131 | + $c3 = $coef * $tsi * $a3ovk2 * $sat->sgps->xnodp * Predict::ae * $sat->sgps->sinio / $sat->tle->eo; |
|
132 | + $sat->sgps->x1mth2 = 1.0 - $theta2; |
|
133 | + $sat->sgps->c4 = 2.0 * $sat->sgps->xnodp * $coef1 * $sat->sgps->aodp * $betao2 * |
|
134 | + ($sat->sgps->eta * (2.0 + 0.5 * $etasq) + |
|
135 | + $sat->tle->eo * (0.5 + 2.0 * $etasq) - |
|
136 | + 2.0 * Predict::ck2 * $tsi / ($sat->sgps->aodp * $psisq) * |
|
137 | + (-3.0 * $sat->sgps->x3thm1 * (1.0 - 2.0 * $eeta + $etasq * (1.5 - 0.5 * $eeta)) + |
|
138 | + 0.75 * $sat->sgps->x1mth2 * (2.0 * $etasq - $eeta * (1.0 + $etasq)) * |
|
139 | + cos(2.0 * $sat->tle->omegao))); |
|
140 | + $sat->sgps->c5 = 2.0 * $coef1 * $sat->sgps->aodp * $betao2 * |
|
141 | + (1.0 + 2.75 * ($etasq + $eeta) + $eeta * $etasq); |
|
142 | + $theta4 = $theta2 * $theta2; |
|
143 | + $temp1 = 3.0 * Predict::ck2 * $pinvsq * $sat->sgps->xnodp; |
|
144 | + $temp2 = $temp1 * Predict::ck2 * $pinvsq; |
|
145 | + $temp3 = 1.25 * Predict::ck4 * $pinvsq * $pinvsq * $sat->sgps->xnodp; |
|
146 | + $sat->sgps->xmdot = $sat->sgps->xnodp + 0.5 * $temp1 * $betao * $sat->sgps->x3thm1 + |
|
147 | + 0.0625 * $temp2 * $betao * (13.0 - 78.0 * $theta2 + 137.0 * $theta4); |
|
148 | + $x1m5th = 1.0 - 5.0 * $theta2; |
|
149 | + $sat->sgps->omgdot = -0.5 * $temp1 * $x1m5th + |
|
150 | + 0.0625 * $temp2 * (7.0 - 114.0 * $theta2 + 395.0 * $theta4) + |
|
151 | + $temp3 * (3.0 - 36.0 * $theta2 + 49.0 * $theta4); |
|
152 | + $xhdot1 = -$temp1 * $sat->sgps->cosio; |
|
153 | + $sat->sgps->xnodot = $xhdot1 + (0.5 * $temp2 * (4.0 - 19.0 * $theta2) + |
|
154 | + 2.0 * $temp3 * (3.0 - 7.0 * $theta2)) * $sat->sgps->cosio; |
|
155 | + $sat->sgps->omgcof = $sat->tle->bstar * $c3 * cos($sat->tle->omegao); |
|
156 | + $sat->sgps->xmcof = -Predict::tothrd * $coef * $sat->tle->bstar * Predict::ae / $eeta; |
|
157 | + $sat->sgps->xnodcf = 3.5 * $betao2 * $xhdot1 * $sat->sgps->c1; |
|
158 | + $sat->sgps->t2cof = 1.5 * $sat->sgps->c1; |
|
159 | + $sat->sgps->xlcof = 0.125 * $a3ovk2 * $sat->sgps->sinio * |
|
160 | + (3.0 + 5.0 * $sat->sgps->cosio) / (1.0 + $sat->sgps->cosio); |
|
161 | + $sat->sgps->aycof = 0.25 * $a3ovk2 * $sat->sgps->sinio; |
|
162 | + $sat->sgps->delmo = pow(1.0 + $sat->sgps->eta * cos($sat->tle->xmo), 3); |
|
163 | + $sat->sgps->sinmo = sin($sat->tle->xmo); |
|
164 | + $sat->sgps->x7thm1 = 7.0 * $theta2 - 1.0; |
|
165 | + if (~$sat->flags & self::SIMPLE_FLAG) { |
|
166 | + $c1sq = $sat->sgps->c1 * $sat->sgps->c1; |
|
167 | + $sat->sgps->d2 = 4.0 * $sat->sgps->aodp * $tsi * $c1sq; |
|
168 | + $temp = $sat->sgps->d2 * $tsi * $sat->sgps->c1 / 3.0; |
|
169 | + $sat->sgps->d3 = (17.0 * $sat->sgps->aodp + $s4) * $temp; |
|
170 | + $sat->sgps->d4 = 0.5 * $temp * $sat->sgps->aodp * $tsi * |
|
171 | + (221.0 * $sat->sgps->aodp + 31.0 * $s4) * $sat->sgps->c1; |
|
172 | + $sat->sgps->t3cof = $sat->sgps->d2 + 2.0 * $c1sq; |
|
173 | + $sat->sgps->t4cof = 0.25 * (3.0 * $sat->sgps->d3 + $sat->sgps->c1 * |
|
174 | + (12.0 * $sat->sgps->d2 + 10.0 * $c1sq)); |
|
175 | + $sat->sgps->t5cof = 0.2 * (3.0 * $sat->sgps->d4 + |
|
176 | + 12.0 * $sat->sgps->c1 * $sat->sgps->d3 + |
|
177 | + 6.0 * $sat->sgps->d2 * $sat->sgps->d2 + |
|
178 | + 15.0 * $c1sq * (2.0 * $sat->sgps->d2 + $c1sq)); |
|
179 | + }; /* End of if (isFlagClear(SIMPLE_FLAG)) */ |
|
180 | + }; /* End of SGP4() initialization */ |
|
181 | + |
|
182 | + /* Update for secular gravity and atmospheric drag. */ |
|
183 | + $xmdf = $sat->tle->xmo + $sat->sgps->xmdot * $tsince; |
|
184 | + $omgadf = $sat->tle->omegao + $sat->sgps->omgdot * $tsince; |
|
185 | + $xnoddf = $sat->tle->xnodeo + $sat->sgps->xnodot * $tsince; |
|
186 | + $omega = $omgadf; |
|
187 | + $xmp = $xmdf; |
|
188 | + $tsq = $tsince * $tsince; |
|
189 | + $xnode = $xnoddf + $sat->sgps->xnodcf * $tsq; |
|
190 | + $tempa = 1.0 - $sat->sgps->c1 * $tsince; |
|
191 | + $tempe = $sat->tle->bstar * $sat->sgps->c4 * $tsince; |
|
192 | + $templ = $sat->sgps->t2cof * $tsq; |
|
193 | + if (~$sat->flags & self::SIMPLE_FLAG) { |
|
194 | + $delomg = $sat->sgps->omgcof * $tsince; |
|
195 | + $delm = $sat->sgps->xmcof * (pow(1 + $sat->sgps->eta * cos($xmdf), 3) - $sat->sgps->delmo); |
|
196 | + $temp = $delomg + $delm; |
|
197 | + $xmp = $xmdf + $temp; |
|
198 | + $omega = $omgadf - $temp; |
|
199 | + $tcube = $tsq * $tsince; |
|
200 | + $tfour = $tsince * $tcube; |
|
201 | + $tempa = $tempa - $sat->sgps->d2 * $tsq - $sat->sgps->d3 * $tcube - $sat->sgps->d4 * $tfour; |
|
202 | + $tempe = $tempe + $sat->tle->bstar * $sat->sgps->c5 * (sin($xmp) - $sat->sgps->sinmo); |
|
203 | + $templ = $templ + $sat->sgps->t3cof * $tcube + $tfour * |
|
204 | + ($sat->sgps->t4cof + $tsince * $sat->sgps->t5cof); |
|
205 | + }; /* End of if (isFlagClear(SIMPLE_FLAG)) */ |
|
206 | + |
|
207 | + $a = $sat->sgps->aodp * pow($tempa, 2); |
|
208 | + $e = $sat->tle->eo - $tempe; |
|
209 | + $xl = $xmp + $omega + $xnode + $sat->sgps->xnodp * $templ; |
|
210 | + $beta = sqrt(1.0 - ($e * $e)); |
|
211 | + $xn = Predict::xke / pow($a, 1.5); |
|
212 | + |
|
213 | + /* Long period periodics */ |
|
214 | + $axn = $e * cos($omega); |
|
215 | + $temp = 1.0 / ($a * $beta * $beta); |
|
216 | + $xll = $temp * $sat->sgps->xlcof * $axn; |
|
217 | + $aynl = $temp * $sat->sgps->aycof; |
|
218 | + $xlt = $xl + $xll; |
|
219 | + $ayn = $e * sin($omega) + $aynl; |
|
220 | + |
|
221 | + /* Solve Kepler's' Equation */ |
|
222 | + $capu = Predict_Math::FMod2p($xlt - $xnode); |
|
223 | + $temp2 = $capu; |
|
224 | + |
|
225 | + $i = 0; |
|
226 | + do { |
|
227 | + $sinepw = sin($temp2); |
|
228 | + $cosepw = cos($temp2); |
|
229 | + $temp3 = $axn * $sinepw; |
|
230 | + $temp4 = $ayn * $cosepw; |
|
231 | + $temp5 = $axn * $cosepw; |
|
232 | + $temp6 = $ayn * $sinepw; |
|
233 | + $epw = ($capu - $temp4 + $temp3 - $temp2) / (1.0 - $temp5 - $temp6) + $temp2; |
|
234 | + if (abs($epw - $temp2) <= Predict::e6a) { |
|
235 | + break; |
|
236 | + } |
|
237 | + $temp2 = $epw; |
|
238 | + } while ($i++ < 10); |
|
239 | + |
|
240 | + /* Short period preliminary quantities */ |
|
241 | + $ecose = $temp5 + $temp6; |
|
242 | + $esine = $temp3 - $temp4; |
|
243 | + $elsq = $axn * $axn + $ayn * $ayn; |
|
244 | + $temp = 1.0 - $elsq; |
|
245 | + $pl = $a * $temp; |
|
246 | + $r = $a * (1.0 - $ecose); |
|
247 | + $temp1 = 1.0 / $r; |
|
248 | + $rdot = Predict::xke * sqrt($a) * $esine * $temp1; |
|
249 | + $rfdot = Predict::xke * sqrt($pl) * $temp1; |
|
250 | + $temp2 = $a * $temp1; |
|
251 | + $betal = sqrt($temp); |
|
252 | + $temp3 = 1.0 / (1.0 + $betal); |
|
253 | + $cosu = $temp2 * ($cosepw - $axn + $ayn * $esine * $temp3); |
|
254 | + $sinu = $temp2 * ($sinepw - $ayn - $axn * $esine * $temp3); |
|
255 | + $u = Predict_Math::AcTan($sinu, $cosu); |
|
256 | + $sin2u = 2.0 * $sinu * $cosu; |
|
257 | + $cos2u = 2.0 * $cosu * $cosu - 1.0; |
|
258 | + $temp = 1.0 / $pl; |
|
259 | + $temp1 = Predict::ck2 * $temp; |
|
260 | + $temp2 = $temp1 * $temp; |
|
261 | + |
|
262 | + /* Update for short periodics */ |
|
263 | + $rk = $r * (1.0 - 1.5 * $temp2 * $betal * $sat->sgps->x3thm1) + |
|
264 | + 0.5 * $temp1 * $sat->sgps->x1mth2 * $cos2u; |
|
265 | + $uk = $u - 0.25 * $temp2 * $sat->sgps->x7thm1 * $sin2u; |
|
266 | + $xnodek = $xnode + 1.5 * $temp2 * $sat->sgps->cosio * $sin2u; |
|
267 | + $xinck = $sat->tle->xincl + 1.5 * $temp2 * $sat->sgps->cosio * $sat->sgps->sinio * $cos2u; |
|
268 | + $rdotk = $rdot - $xn * $temp1 * $sat->sgps->x1mth2 * $sin2u; |
|
269 | + $rfdotk = $rfdot + $xn * $temp1 * ($sat->sgps->x1mth2 * $cos2u + 1.5 * $sat->sgps->x3thm1); |
|
270 | + |
|
271 | + |
|
272 | + /* Orientation vectors */ |
|
273 | + $sinuk = sin($uk); |
|
274 | + $cosuk = cos($uk); |
|
275 | + $sinik = sin($xinck); |
|
276 | + $cosik = cos($xinck); |
|
277 | + $sinnok = sin($xnodek); |
|
278 | + $cosnok = cos($xnodek); |
|
279 | + $xmx = -$sinnok * $cosik; |
|
280 | + $xmy = $cosnok * $cosik; |
|
281 | + $ux = $xmx * $sinuk + $cosnok * $cosuk; |
|
282 | + $uy = $xmy * $sinuk + $sinnok * $cosuk; |
|
283 | + $uz = $sinik * $sinuk; |
|
284 | + $vx = $xmx * $cosuk - $cosnok * $sinuk; |
|
285 | + $vy = $xmy * $cosuk - $sinnok * $sinuk; |
|
286 | + $vz = $sinik * $cosuk; |
|
287 | + |
|
288 | + /* Position and velocity */ |
|
289 | + $sat->pos->x = $rk * $ux; |
|
290 | + $sat->pos->y = $rk * $uy; |
|
291 | + $sat->pos->z = $rk * $uz; |
|
292 | + $sat->vel->x = $rdotk * $ux + $rfdotk * $vx; |
|
293 | + $sat->vel->y = $rdotk * $uy + $rfdotk * $vy; |
|
294 | + $sat->vel->z = $rdotk * $uz + $rfdotk * $vz; |
|
295 | + |
|
296 | + $sat->phase = $xlt - $xnode - $omgadf + Predict::twopi; |
|
297 | + if ($sat->phase < 0) { |
|
298 | + $sat->phase += Predict::twopi; |
|
299 | + } |
|
300 | + $sat->phase = Predict_Math::FMod2p($sat->phase); |
|
301 | + |
|
302 | + $sat->tle->omegao1 = $omega; |
|
303 | + $sat->tle->xincl1 = $xinck; |
|
304 | + $sat->tle->xnodeo1 = $xnodek; |
|
305 | + |
|
306 | + } /*SGP4*/ |
|
307 | + |
|
308 | + /* SDP4 */ |
|
309 | + /* This function is used to calculate the position and velocity */ |
|
310 | + /* of deep-space (period > 225 minutes) satellites. tsince is */ |
|
311 | + /* time since epoch in minutes, tle is a pointer to a tle_t */ |
|
312 | + /* structure with Keplerian orbital elements and pos and vel */ |
|
313 | + /* are vector_t structures returning ECI satellite position and */ |
|
314 | + /* velocity. Use Convert_Sat_State() to convert to km and km/s. */ |
|
315 | + public function SDP4(Predict_Sat $sat, $tsince) |
|
316 | + { |
|
317 | + /* Initialization */ |
|
318 | + if (~$sat->flags & self::SDP4_INITIALIZED_FLAG) { |
|
319 | + |
|
320 | + $sat->flags |= self::SDP4_INITIALIZED_FLAG; |
|
321 | + |
|
322 | + /* Recover original mean motion (xnodp) and */ |
|
323 | + /* semimajor axis (aodp) from input elements. */ |
|
324 | + $a1 = pow(Predict::xke / $sat->tle->xno, Predict::tothrd); |
|
325 | + $sat->deep_arg->cosio = cos($sat->tle->xincl); |
|
326 | + $sat->deep_arg->theta2 = $sat->deep_arg->cosio * $sat->deep_arg->cosio; |
|
327 | + $sat->sgps->x3thm1 = 3.0 * $sat->deep_arg->theta2 - 1.0; |
|
328 | + $sat->deep_arg->eosq = $sat->tle->eo * $sat->tle->eo; |
|
329 | + $sat->deep_arg->betao2 = 1.0 - $sat->deep_arg->eosq; |
|
330 | + $sat->deep_arg->betao = sqrt($sat->deep_arg->betao2); |
|
331 | + $del1 = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / |
|
332 | + ($a1 * $a1 * $sat->deep_arg->betao * $sat->deep_arg->betao2); |
|
333 | + $ao = $a1 * (1.0 - $del1 * (0.5 * Predict::tothrd + $del1 * (1.0 + 134.0 / 81.0 * $del1))); |
|
334 | + $delo = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / |
|
335 | + ($ao * $ao * $sat->deep_arg->betao * $sat->deep_arg->betao2); |
|
336 | + $sat->deep_arg->xnodp = $sat->tle->xno / (1.0 + $delo); |
|
337 | + $sat->deep_arg->aodp = $ao / (1.0 - $delo); |
|
338 | + |
|
339 | + /* For perigee below 156 km, the values */ |
|
340 | + /* of s and qoms2t are altered. */ |
|
341 | + $s4 = Predict::__s__; |
|
342 | + $qoms24 = Predict::qoms2t; |
|
343 | + $perige = ($sat->deep_arg->aodp * (1.0 - $sat->tle->eo) - Predict::ae) * Predict::xkmper; |
|
344 | + if ($perige < 156.0) { |
|
345 | + if ($perige <= 98.0) { |
|
346 | + $s4 = 20.0; |
|
347 | + } else { |
|
348 | + $s4 = $perige - 78.0; |
|
349 | + } |
|
350 | + $qoms24 = pow((120.0 - $s4) * Predict::ae / Predict::xkmper, 4); |
|
351 | + $s4 = $s4 / Predict::xkmper + Predict::ae; |
|
352 | + } |
|
353 | + $pinvsq = 1.0 / ($sat->deep_arg->aodp * $sat->deep_arg->aodp * |
|
354 | + $sat->deep_arg->betao2 * $sat->deep_arg->betao2); |
|
355 | + $sat->deep_arg->sing = sin($sat->tle->omegao); |
|
356 | + $sat->deep_arg->cosg = cos($sat->tle->omegao); |
|
357 | + $tsi = 1.0 / ($sat->deep_arg->aodp - $s4); |
|
358 | + $eta = $sat->deep_arg->aodp * $sat->tle->eo * $tsi; |
|
359 | + $etasq = $eta * $eta; |
|
360 | + $eeta = $sat->tle->eo * $eta; |
|
361 | + $psisq = abs(1.0 - $etasq); |
|
362 | + $coef = $qoms24 * pow($tsi, 4); |
|
363 | + $coef1 = $coef / pow($psisq, 3.5); |
|
364 | + $c2 = $coef1 * $sat->deep_arg->xnodp * ($sat->deep_arg->aodp * |
|
365 | + (1.0 + 1.5 * $etasq + $eeta * |
|
366 | + (4.0 + $etasq)) + 0.75 * Predict::ck2 * $tsi / $psisq * |
|
367 | + $sat->sgps->x3thm1 * (8.0 + 3.0 * $etasq * |
|
368 | + (8.0 + $etasq))); |
|
369 | + $sat->sgps->c1 = $sat->tle->bstar * $c2; |
|
370 | + $sat->deep_arg->sinio = sin($sat->tle->xincl); |
|
371 | + $a3ovk2 = -Predict::xj3 / Predict::ck2 * pow(Predict::ae, 3); |
|
372 | + $sat->sgps->x1mth2 = 1.0 - $sat->deep_arg->theta2; |
|
373 | + $sat->sgps->c4 = 2.0 * $sat->deep_arg->xnodp * $coef1 * |
|
374 | + $sat->deep_arg->aodp * $sat->deep_arg->betao2 * |
|
375 | + ($eta * (2.0 + 0.5 * $etasq) + $sat->tle->eo * |
|
376 | + (0.5 + 2.0 * $etasq) - 2.0 * Predict::ck2 * $tsi / |
|
377 | + ($sat->deep_arg->aodp * $psisq) * (-3.0 * $sat->sgps->x3thm1 * |
|
378 | + (1.0 - 2.0 * $eeta + $etasq * |
|
379 | + (1.5 - 0.5 * $eeta)) + |
|
380 | + 0.75 * $sat->sgps->x1mth2 * |
|
381 | + (2.0 * $etasq - $eeta * (1.0 + $etasq)) * |
|
382 | + cos(2.0 * $sat->tle->omegao))); |
|
383 | + $theta4 = $sat->deep_arg->theta2 * $sat->deep_arg->theta2; |
|
384 | + $temp1 = 3.0 * Predict::ck2 * $pinvsq * $sat->deep_arg->xnodp; |
|
385 | + $temp2 = $temp1 * Predict::ck2 * $pinvsq; |
|
386 | + $temp3 = 1.25 * Predict::ck4 * $pinvsq * $pinvsq * $sat->deep_arg->xnodp; |
|
387 | + $sat->deep_arg->xmdot = $sat->deep_arg->xnodp + 0.5 * $temp1 * $sat->deep_arg->betao * |
|
388 | + $sat->sgps->x3thm1 + 0.0625 * $temp2 * $sat->deep_arg->betao * |
|
389 | + (13.0 - 78.0 * $sat->deep_arg->theta2 + 137.0 * $theta4); |
|
390 | + $x1m5th = 1.0 - 5.0 * $sat->deep_arg->theta2; |
|
391 | + $sat->deep_arg->omgdot = -0.5 * $temp1 * $x1m5th + 0.0625 * $temp2 * |
|
392 | + (7.0 - 114.0 * $sat->deep_arg->theta2 + 395.0 * $theta4) + |
|
393 | + $temp3 * (3.0 - 36.0 * $sat->deep_arg->theta2 + 49.0 * $theta4); |
|
394 | + $xhdot1 = -$temp1 * $sat->deep_arg->cosio; |
|
395 | + $sat->deep_arg->xnodot = $xhdot1 + (0.5 * $temp2 * (4.0 - 19.0 * $sat->deep_arg->theta2) + |
|
396 | + 2.0 * $temp3 * (3.0 - 7.0 * $sat->deep_arg->theta2)) * |
|
397 | + $sat->deep_arg->cosio; |
|
398 | + $sat->sgps->xnodcf = 3.5 * $sat->deep_arg->betao2 * $xhdot1 * $sat->sgps->c1; |
|
399 | + $sat->sgps->t2cof = 1.5 * $sat->sgps->c1; |
|
400 | + $sat->sgps->xlcof = 0.125 * $a3ovk2 * $sat->deep_arg->sinio * |
|
401 | + (3.0 + 5.0 * $sat->deep_arg->cosio) / (1.0 + $sat->deep_arg->cosio); |
|
402 | + $sat->sgps->aycof = 0.25 * $a3ovk2 * $sat->deep_arg->sinio; |
|
403 | + $sat->sgps->x7thm1 = 7.0 * $sat->deep_arg->theta2 - 1.0; |
|
404 | + |
|
405 | + /* initialize Deep() */ |
|
406 | + $this->Deep(self::dpinit, $sat); |
|
407 | + }; /*End of SDP4() initialization */ |
|
408 | + |
|
409 | + /* Update for secular gravity and atmospheric drag */ |
|
410 | + $xmdf = $sat->tle->xmo + $sat->deep_arg->xmdot * $tsince; |
|
411 | + $sat->deep_arg->omgadf = $sat->tle->omegao + $sat->deep_arg->omgdot * $tsince; |
|
412 | + $xnoddf = $sat->tle->xnodeo + $sat->deep_arg->xnodot * $tsince; |
|
413 | + $tsq = $tsince * $tsince; |
|
414 | + $sat->deep_arg->xnode = $xnoddf + $sat->sgps->xnodcf * $tsq; |
|
415 | + $tempa = 1.0 - $sat->sgps->c1 * $tsince; |
|
416 | + $tempe = $sat->tle->bstar * $sat->sgps->c4 * $tsince; |
|
417 | + $templ = $sat->sgps->t2cof * $tsq; |
|
418 | + $sat->deep_arg->xn = $sat->deep_arg->xnodp; |
|
419 | + |
|
420 | + /* Update for deep-space secular effects */ |
|
421 | + $sat->deep_arg->xll = $xmdf; |
|
422 | + $sat->deep_arg->t = $tsince; |
|
423 | + |
|
424 | + $this->Deep(self::dpsec, $sat); |
|
425 | + |
|
426 | + $xmdf = $sat->deep_arg->xll; |
|
427 | + $a = pow(Predict::xke / $sat->deep_arg->xn, Predict::tothrd) * $tempa * $tempa; |
|
428 | + $sat->deep_arg->em = $sat->deep_arg->em - $tempe; |
|
429 | + $xmam = $xmdf + $sat->deep_arg->xnodp * $templ; |
|
430 | + |
|
431 | + /* Update for deep-space periodic effects */ |
|
432 | + $sat->deep_arg->xll = $xmam; |
|
433 | + |
|
434 | + $this->Deep(self::dpper, $sat); |
|
435 | + |
|
436 | + $xmam = $sat->deep_arg->xll; |
|
437 | + $xl = $xmam + $sat->deep_arg->omgadf + $sat->deep_arg->xnode; |
|
438 | + $beta = sqrt(1.0 - $sat->deep_arg->em * $sat->deep_arg->em); |
|
439 | + $sat->deep_arg->xn = Predict::xke / pow($a, 1.5); |
|
440 | + |
|
441 | + /* Long period periodics */ |
|
442 | + $axn = $sat->deep_arg->em * cos($sat->deep_arg->omgadf); |
|
443 | + $temp = 1.0 / ($a * $beta * $beta); |
|
444 | + $xll = $temp * $sat->sgps->xlcof * $axn; |
|
445 | + $aynl = $temp * $sat->sgps->aycof; |
|
446 | + $xlt = $xl + $xll; |
|
447 | + $ayn = $sat->deep_arg->em * sin($sat->deep_arg->omgadf) + $aynl; |
|
448 | + |
|
449 | + /* Solve Kepler's Equation */ |
|
450 | + $capu = Predict_Math::FMod2p ($xlt - $sat->deep_arg->xnode); |
|
451 | + $temp2 = $capu; |
|
452 | + |
|
453 | + $i = 0; |
|
454 | + do { |
|
455 | + $sinepw = sin($temp2); |
|
456 | + $cosepw = cos($temp2); |
|
457 | + $temp3 = $axn * $sinepw; |
|
458 | + $temp4 = $ayn * $cosepw; |
|
459 | + $temp5 = $axn * $cosepw; |
|
460 | + $temp6 = $ayn * $sinepw; |
|
461 | + $epw = ($capu - $temp4 + $temp3 - $temp2) / (1.0 - $temp5 - $temp6) + $temp2; |
|
462 | + if (abs($epw - $temp2) <= Predict::e6a) { |
|
463 | + break; |
|
464 | + } |
|
465 | + $temp2 = $epw; |
|
466 | + } while ($i++ < 10); |
|
467 | + |
|
468 | + /* Short period preliminary quantities */ |
|
469 | + $ecose = $temp5 + $temp6; |
|
470 | + $esine = $temp3 - $temp4; |
|
471 | + $elsq = $axn * $axn + $ayn * $ayn; |
|
472 | + $temp = 1.0 - $elsq; |
|
473 | + $pl = $a * $temp; |
|
474 | + $r = $a * (1.0 - $ecose); |
|
475 | + $temp1 = 1.0 / $r; |
|
476 | + $rdot = Predict::xke * sqrt($a) * $esine * $temp1; |
|
477 | + $rfdot = Predict::xke * sqrt($pl) * $temp1; |
|
478 | + $temp2 = $a * $temp1; |
|
479 | + $betal = sqrt($temp); |
|
480 | + $temp3 = 1.0 / (1.0 + $betal); |
|
481 | + $cosu = $temp2 * ($cosepw - $axn + $ayn * $esine * $temp3); |
|
482 | + $sinu = $temp2 * ($sinepw - $ayn - $axn * $esine * $temp3); |
|
483 | + $u = Predict_Math::AcTan($sinu, $cosu); |
|
484 | + $sin2u = 2.0 * $sinu * $cosu; |
|
485 | + $cos2u = 2.0 * $cosu * $cosu - 1.0; |
|
486 | + $temp = 1.0 / $pl; |
|
487 | + $temp1 = Predict::ck2 * $temp; |
|
488 | + $temp2 = $temp1 * $temp; |
|
489 | + |
|
490 | + /* Update for short periodics */ |
|
491 | + $rk = $r * (1.0 - 1.5 * $temp2 * $betal * $sat->sgps->x3thm1) + |
|
492 | + 0.5 * $temp1 * $sat->sgps->x1mth2 * $cos2u; |
|
493 | + $uk = $u - 0.25 * $temp2 * $sat->sgps->x7thm1 * $sin2u; |
|
494 | + $xnodek = $sat->deep_arg->xnode + 1.5 * $temp2 * $sat->deep_arg->cosio * $sin2u; |
|
495 | + $xinck = $sat->deep_arg->xinc + 1.5 * $temp2 * |
|
496 | + $sat->deep_arg->cosio * $sat->deep_arg->sinio * $cos2u; |
|
497 | + $rdotk = $rdot - $sat->deep_arg->xn * $temp1 * $sat->sgps->x1mth2 * $sin2u; |
|
498 | + $rfdotk = $rfdot + $sat->deep_arg->xn * $temp1 * |
|
499 | + ($sat->sgps->x1mth2 * $cos2u + 1.5 * $sat->sgps->x3thm1); |
|
500 | + |
|
501 | + /* Orientation vectors */ |
|
502 | + $sinuk = sin($uk); |
|
503 | + $cosuk = cos($uk); |
|
504 | + $sinik = sin($xinck); |
|
505 | + $cosik = cos($xinck); |
|
506 | + $sinnok = sin($xnodek); |
|
507 | + $cosnok = cos($xnodek); |
|
508 | + $xmx = -$sinnok * $cosik; |
|
509 | + $xmy = $cosnok * $cosik; |
|
510 | + $ux = $xmx * $sinuk + $cosnok * $cosuk; |
|
511 | + $uy = $xmy * $sinuk + $sinnok * $cosuk; |
|
512 | + $uz = $sinik * $sinuk; |
|
513 | + $vx = $xmx * $cosuk - $cosnok * $sinuk; |
|
514 | + $vy = $xmy * $cosuk - $sinnok * $sinuk; |
|
515 | + $vz = $sinik * $cosuk; |
|
516 | + |
|
517 | + /* Position and velocity */ |
|
518 | + $sat->pos->x = $rk * $ux; |
|
519 | + $sat->pos->y = $rk * $uy; |
|
520 | + $sat->pos->z = $rk * $uz; |
|
521 | + $sat->vel->x = $rdotk * $ux + $rfdotk * $vx; |
|
522 | + $sat->vel->y = $rdotk * $uy + $rfdotk * $vy; |
|
523 | + $sat->vel->z = $rdotk * $uz + $rfdotk * $vz; |
|
524 | + |
|
525 | + /* Phase in rads */ |
|
526 | + $sat->phase = $xlt - $sat->deep_arg->xnode - $sat->deep_arg->omgadf + Predict::twopi; |
|
527 | + if ($sat->phase < 0.0) { |
|
528 | + $sat->phase += Predict::twopi; |
|
529 | + } |
|
530 | + $sat->phase = Predict_Math::FMod2p ($sat->phase); |
|
531 | + |
|
532 | + $sat->tle->omegao1 = $sat->deep_arg->omgadf; |
|
533 | + $sat->tle->xincl1 = $sat->deep_arg->xinc; |
|
534 | + $sat->tle->xnodeo1 = $sat->deep_arg->xnode; |
|
535 | + } /* SDP4 */ |
|
536 | + |
|
537 | + |
|
538 | + /* DEEP */ |
|
539 | + /* This function is used by SDP4 to add lunar and solar */ |
|
540 | + /* perturbation effects to deep-space orbit objects. */ |
|
541 | + public function Deep($ientry, Predict_Sat $sat) |
|
542 | + { |
|
543 | + switch ($ientry) { |
|
544 | + case self::dpinit : /* Entrance for deep space initialization */ |
|
545 | + $sat->dps->thgr = Predict_Time::ThetaG($sat->tle->epoch, $sat->deep_arg); |
|
546 | + $eq = $sat->tle->eo; |
|
547 | + $sat->dps->xnq = $sat->deep_arg->xnodp; |
|
548 | + $aqnv = 1.0 / $sat->deep_arg->aodp; |
|
549 | + $sat->dps->xqncl = $sat->tle->xincl; |
|
550 | + $xmao = $sat->tle->xmo; |
|
551 | + $xpidot = $sat->deep_arg->omgdot + $sat->deep_arg->xnodot; |
|
552 | + $sinq = sin($sat->tle->xnodeo); |
|
553 | + $cosq = cos($sat->tle->xnodeo); |
|
554 | + $sat->dps->omegaq = $sat->tle->omegao; |
|
555 | + $sat->dps->preep = 0; |
|
556 | + |
|
557 | + /* Initialize lunar solar terms */ |
|
558 | + $day = $sat->deep_arg->ds50 + 18261.5; /* Days since 1900 Jan 0.5 */ |
|
559 | + if ($day != $sat->dps->preep) { |
|
560 | + $sat->dps->preep = $day; |
|
561 | + $xnodce = 4.5236020 - 9.2422029E-4 * $day; |
|
562 | + $stem = sin($xnodce); |
|
563 | + $ctem = cos($xnodce); |
|
564 | + $sat->dps->zcosil = 0.91375164 - 0.03568096 * $ctem; |
|
565 | + $sat->dps->zsinil = sqrt(1.0 - $sat->dps->zcosil * $sat->dps->zcosil); |
|
566 | + $sat->dps->zsinhl = 0.089683511 * $stem / $sat->dps->zsinil; |
|
567 | + $sat->dps->zcoshl = sqrt(1.0 - $sat->dps->zsinhl * $sat->dps->zsinhl); |
|
568 | + $c = 4.7199672 + 0.22997150 * $day; |
|
569 | + $gam = 5.8351514 + 0.0019443680 * $day; |
|
570 | + $sat->dps->zmol = Predict_Math::FMod2p($c - $gam); |
|
571 | + $zx = 0.39785416 * $stem / $sat->dps->zsinil; |
|
572 | + $zy = $sat->dps->zcoshl * $ctem + 0.91744867 * $sat->dps->zsinhl * $stem; |
|
573 | + $zx = Predict_Math::AcTan($zx, $zy); |
|
574 | + $zx = $gam + $zx - $xnodce; |
|
575 | + $sat->dps->zcosgl = cos($zx); |
|
576 | + $sat->dps->zsingl = sin($zx); |
|
577 | + $sat->dps->zmos = 6.2565837 + 0.017201977 * $day; |
|
578 | + $sat->dps->zmos = Predict_Math::FMod2p($sat->dps->zmos); |
|
579 | + } /* End if(day != preep) */ |
|
580 | + |
|
581 | + /* Do solar terms */ |
|
582 | + $sat->dps->savtsn = 1E20; |
|
583 | + $zcosg = Predict::zcosgs; |
|
584 | + $zsing = Predict::zsings; |
|
585 | + $zcosi = Predict::zcosis; |
|
586 | + $zsini = Predict::zsinis; |
|
587 | + $zcosh = $cosq; |
|
588 | + $zsinh = $sinq; |
|
589 | + $cc = Predict::c1ss; |
|
590 | + $zn = Predict::zns; |
|
591 | + $ze = Predict::zes; |
|
592 | + $zmo = $sat->dps->zmos; |
|
593 | + $xnoi = 1.0 / $sat->dps->xnq; |
|
594 | + |
|
595 | + /* Loop breaks when Solar terms are done a second */ |
|
596 | + /* time, after Lunar terms are initialized */ |
|
597 | + for(;;) { |
|
598 | + /* Solar terms done again after Lunar terms are done */ |
|
599 | + $a1 = $zcosg * $zcosh + $zsing * $zcosi * $zsinh; |
|
600 | + $a3 = -$zsing * $zcosh + $zcosg * $zcosi * $zsinh; |
|
601 | + $a7 = -$zcosg * $zsinh + $zsing * $zcosi * $zcosh; |
|
602 | + $a8 = $zsing * $zsini; |
|
603 | + $a9 = $zsing * $zsinh + $zcosg * $zcosi * $zcosh; |
|
604 | + $a10 = $zcosg * $zsini; |
|
605 | + $a2 = $sat->deep_arg->cosio * $a7 + $sat->deep_arg->sinio * $a8; |
|
606 | + $a4 = $sat->deep_arg->cosio * $a9 + $sat->deep_arg->sinio * $a10; |
|
607 | + $a5 = -$sat->deep_arg->sinio * $a7 + $sat->deep_arg->cosio * $a8; |
|
608 | + $a6 = -$sat->deep_arg->sinio * $a9 + $sat->deep_arg->cosio * $a10; |
|
609 | + $x1 = $a1 * $sat->deep_arg->cosg + $a2 * $sat->deep_arg->sing; |
|
610 | + $x2 = $a3 * $sat->deep_arg->cosg + $a4 * $sat->deep_arg->sing; |
|
611 | + $x3 = -$a1 * $sat->deep_arg->sing + $a2 * $sat->deep_arg->cosg; |
|
612 | + $x4 = -$a3 * $sat->deep_arg->sing + $a4 * $sat->deep_arg->cosg; |
|
613 | + $x5 = $a5 * $sat->deep_arg->sing; |
|
614 | + $x6 = $a6 * $sat->deep_arg->sing; |
|
615 | + $x7 = $a5 * $sat->deep_arg->cosg; |
|
616 | + $x8 = $a6 * $sat->deep_arg->cosg; |
|
617 | + $z31 = 12 * $x1 * $x1 - 3 * $x3 * $x3; |
|
618 | + $z32 = 24 * $x1 * $x2 - 6 * $x3 * $x4; |
|
619 | + $z33 = 12 * $x2 * $x2 - 3 * $x4 * $x4; |
|
620 | + $z1 = 3 * ($a1 * $a1 + $a2 * $a2) + $z31 * $sat->deep_arg->eosq; |
|
621 | + $z2 = 6 * ($a1 * $a3 + $a2 * $a4) + $z32 * $sat->deep_arg->eosq; |
|
622 | + $z3 = 3 * ($a3 * $a3 + $a4 * $a4) + $z33 * $sat->deep_arg->eosq; |
|
623 | + $z11 = -6 * $a1 * $a5 + $sat->deep_arg->eosq * (-24 * $x1 * $x7 - 6 * $x3 * $x5); |
|
624 | + $z12 = -6 * ($a1 * $a6 + $a3 * $a5) + $sat->deep_arg->eosq * |
|
625 | + (-24 * ($x2 * $x7 + $x1 * $x8) - 6 * ($x3 * $x6 + $x4 * $x5)); |
|
626 | + $z13 = -6 * $a3 * $a6 + $sat->deep_arg->eosq * (-24 * $x2 * $x8 - 6 * $x4 * $x6); |
|
627 | + $z21 = 6 * $a2 * $a5 + $sat->deep_arg->eosq * (24 * $x1 * $x5 - 6 * $x3 * $x7); |
|
628 | + $z22 = 6 * ($a4 * $a5 + $a2 * $a6) + $sat->deep_arg->eosq * |
|
629 | + (24 * ($x2 * $x5 + $x1 * $x6) - 6 * ($x4 * $x7 + $x3 * $x8)); |
|
630 | + $z23 = 6 * $a4 * $a6 + $sat->deep_arg->eosq * (24 * $x2 * $x6 - 6 * $x4 * $x8); |
|
631 | + $z1 = $z1 + $z1 + $sat->deep_arg->betao2 * $z31; |
|
632 | + $z2 = $z2 + $z2 + $sat->deep_arg->betao2 * $z32; |
|
633 | + $z3 = $z3 + $z3 + $sat->deep_arg->betao2 * $z33; |
|
634 | + $s3 = $cc * $xnoi; |
|
635 | + $s2 = -0.5 * $s3 / $sat->deep_arg->betao; |
|
636 | + $s4 = $s3 * $sat->deep_arg->betao; |
|
637 | + $s1 = -15 * $eq * $s4; |
|
638 | + $s5 = $x1 * $x3 + $x2 * $x4; |
|
639 | + $s6 = $x2 * $x3 + $x1 * $x4; |
|
640 | + $s7 = $x2 * $x4 - $x1 * $x3; |
|
641 | + $se = $s1 * $zn * $s5; |
|
642 | + $si = $s2 * $zn * ($z11 + $z13); |
|
643 | + $sl = -$zn * $s3 * ($z1 + $z3 - 14 - 6 * $sat->deep_arg->eosq); |
|
644 | + $sgh = $s4 * $zn * ($z31 + $z33 - 6); |
|
645 | + $sh = -$zn * $s2 * ($z21 + $z23); |
|
646 | + if ($sat->dps->xqncl < 5.2359877E-2) { |
|
647 | + $sh = 0; |
|
648 | + } |
|
649 | + $sat->dps->ee2 = 2 * $s1 * $s6; |
|
650 | + $sat->dps->e3 = 2 * $s1 * $s7; |
|
651 | + $sat->dps->xi2 = 2 * $s2 * $z12; |
|
652 | + $sat->dps->xi3 = 2 * $s2 * ($z13 - $z11); |
|
653 | + $sat->dps->xl2 = -2 * $s3 * $z2; |
|
654 | + $sat->dps->xl3 = -2 * $s3 * ($z3 - $z1); |
|
655 | + $sat->dps->xl4 = -2 * $s3 * (-21 - 9 * $sat->deep_arg->eosq) * $ze; |
|
656 | + $sat->dps->xgh2 = 2 * $s4 * $z32; |
|
657 | + $sat->dps->xgh3 = 2 * $s4 * ($z33 - $z31); |
|
658 | + $sat->dps->xgh4 = -18 * $s4 * $ze; |
|
659 | + $sat->dps->xh2 = -2 * $s2 * $z22; |
|
660 | + $sat->dps->xh3 = -2 * $s2 * ($z23 - $z21); |
|
661 | + |
|
662 | + if ($sat->flags & self::LUNAR_TERMS_DONE_FLAG) { |
|
663 | + break; |
|
664 | + } |
|
665 | + |
|
666 | + /* Do lunar terms */ |
|
667 | + $sat->dps->sse = $se; |
|
668 | + $sat->dps->ssi = $si; |
|
669 | + $sat->dps->ssl = $sl; |
|
670 | + $sat->dps->ssh = $sh / $sat->deep_arg->sinio; |
|
671 | + $sat->dps->ssg = $sgh - $sat->deep_arg->cosio * $sat->dps->ssh; |
|
672 | + $sat->dps->se2 = $sat->dps->ee2; |
|
673 | + $sat->dps->si2 = $sat->dps->xi2; |
|
674 | + $sat->dps->sl2 = $sat->dps->xl2; |
|
675 | + $sat->dps->sgh2 = $sat->dps->xgh2; |
|
676 | + $sat->dps->sh2 = $sat->dps->xh2; |
|
677 | + $sat->dps->se3 = $sat->dps->e3; |
|
678 | + $sat->dps->si3 = $sat->dps->xi3; |
|
679 | + $sat->dps->sl3 = $sat->dps->xl3; |
|
680 | + $sat->dps->sgh3 = $sat->dps->xgh3; |
|
681 | + $sat->dps->sh3 = $sat->dps->xh3; |
|
682 | + $sat->dps->sl4 = $sat->dps->xl4; |
|
683 | + $sat->dps->sgh4 = $sat->dps->xgh4; |
|
684 | + $zcosg = $sat->dps->zcosgl; |
|
685 | + $zsing = $sat->dps->zsingl; |
|
686 | + $zcosi = $sat->dps->zcosil; |
|
687 | + $zsini = $sat->dps->zsinil; |
|
688 | + $zcosh = $sat->dps->zcoshl * $cosq + $sat->dps->zsinhl * $sinq; |
|
689 | + $zsinh = $sinq * $sat->dps->zcoshl - $cosq * $sat->dps->zsinhl; |
|
690 | + $zn = Predict::znl; |
|
691 | + $cc = Predict::c1l; |
|
692 | + $ze = Predict::zel; |
|
693 | + $zmo = $sat->dps->zmol; |
|
694 | + $sat->flags |= self::LUNAR_TERMS_DONE_FLAG; |
|
695 | + } /* End of for(;;) */ |
|
696 | + |
|
697 | + $sat->dps->sse = $sat->dps->sse + $se; |
|
698 | + $sat->dps->ssi = $sat->dps->ssi + $si; |
|
699 | + $sat->dps->ssl = $sat->dps->ssl + $sl; |
|
700 | + $sat->dps->ssg = $sat->dps->ssg + $sgh - $sat->deep_arg->cosio / $sat->deep_arg->sinio * $sh; |
|
701 | + $sat->dps->ssh = $sat->dps->ssh + $sh / $sat->deep_arg->sinio; |
|
702 | + |
|
703 | + /* Geopotential resonance initialization for 12 hour orbits */ |
|
704 | + $sat->flags &= ~self::RESONANCE_FLAG; |
|
705 | + $sat->flags &= ~self::SYNCHRONOUS_FLAG; |
|
706 | + |
|
707 | + if (!(($sat->dps->xnq < 0.0052359877) && ($sat->dps->xnq > 0.0034906585))) { |
|
708 | + if( ($sat->dps->xnq < 0.00826) || ($sat->dps->xnq > 0.00924) ) { |
|
709 | + return; |
|
710 | + } |
|
711 | + if ($eq < 0.5) { |
|
712 | + return; |
|
713 | + } |
|
714 | + $sat->flags |= self::RESONANCE_FLAG; |
|
715 | + $eoc = $eq * $sat->deep_arg->eosq; |
|
716 | + $g201 = -0.306 - ($eq - 0.64) * 0.440; |
|
717 | + if ($eq <= 0.65) { |
|
718 | + $g211 = 3.616 - 13.247 * $eq + 16.290 * $sat->deep_arg->eosq; |
|
719 | + $g310 = -19.302 + 117.390 * $eq - 228.419 * |
|
720 | + $sat->deep_arg->eosq + 156.591 * $eoc; |
|
721 | + $g322 = -18.9068 + 109.7927 * $eq - 214.6334 * |
|
722 | + $sat->deep_arg->eosq + 146.5816 * $eoc; |
|
723 | + $g410 = -41.122 + 242.694 * $eq - 471.094 * |
|
724 | + $sat->deep_arg->eosq + 313.953 * $eoc; |
|
725 | + $g422 = -146.407 + 841.880 * $eq - 1629.014 * |
|
726 | + $sat->deep_arg->eosq + 1083.435 * $eoc; |
|
727 | + $g520 = -532.114 + 3017.977 * $eq - 5740 * |
|
728 | + $sat->deep_arg->eosq + 3708.276 * $eoc; |
|
729 | + } else { |
|
730 | + $g211 = -72.099 + 331.819 * $eq - 508.738 * |
|
731 | + $sat->deep_arg->eosq + 266.724 * $eoc; |
|
732 | + $g310 = -346.844 + 1582.851 * $eq - 2415.925 * |
|
733 | + $sat->deep_arg->eosq + 1246.113 * $eoc; |
|
734 | + $g322 = -342.585 + 1554.908 * $eq - 2366.899 * |
|
735 | + $sat->deep_arg->eosq + 1215.972 * $eoc; |
|
736 | + $g410 = -1052.797 + 4758.686 * $eq - 7193.992 * |
|
737 | + $sat->deep_arg->eosq + 3651.957 * $eoc; |
|
738 | + $g422 = -3581.69 + 16178.11 * $eq - 24462.77 * |
|
739 | + $sat->deep_arg->eosq+ 12422.52 * $eoc; |
|
740 | + if ($eq <= 0.715) { |
|
741 | + $g520 = 1464.74 - 4664.75 * $eq + 3763.64 * $sat->deep_arg->eosq; |
|
742 | + } else { |
|
743 | + $g520 = -5149.66 + 29936.92 * $eq - 54087.36 * |
|
744 | + $sat->deep_arg->eosq + 31324.56 * $eoc; |
|
745 | + } |
|
746 | + } /* End if (eq <= 0.65) */ |
|
747 | + |
|
748 | + if ($eq < 0.7) { |
|
749 | + $g533 = -919.2277 + 4988.61 * $eq - 9064.77 * |
|
750 | + $sat->deep_arg->eosq + 5542.21 * $eoc; |
|
751 | + $g521 = -822.71072 + 4568.6173 * $eq - 8491.4146 * |
|
752 | + $sat->deep_arg->eosq + 5337.524 * $eoc; |
|
753 | + $g532 = -853.666 + 4690.25 * $eq - 8624.77 * |
|
754 | + $sat->deep_arg->eosq + 5341.4 * $eoc; |
|
755 | + } |
|
756 | + else { |
|
757 | + $g533 = -37995.78 + 161616.52 * $eq - 229838.2* |
|
758 | + $sat->deep_arg->eosq + 109377.94 * $eoc; |
|
759 | + $g521 = -51752.104 + 218913.95 * $eq - 309468.16* |
|
760 | + $sat->deep_arg->eosq + 146349.42 * $eoc; |
|
761 | + $g532 = -40023.88 + 170470.89 * $eq - 242699.48* |
|
762 | + $sat->deep_arg->eosq + 115605.82 * $eoc; |
|
763 | + } /* End if (eq <= 0.7) */ |
|
764 | + |
|
765 | + $sini2 = $sat->deep_arg->sinio * $sat->deep_arg->sinio; |
|
766 | + $f220 = 0.75 * (1 + 2 * $sat->deep_arg->cosio + $sat->deep_arg->theta2); |
|
767 | + $f221 = 1.5 * $sini2; |
|
768 | + $f321 = 1.875 * $sat->deep_arg->sinio * (1 - 2 * |
|
769 | + $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
770 | + $f322 = -1.875 * $sat->deep_arg->sinio * (1 + 2* |
|
771 | + $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
772 | + $f441 = 35 * $sini2 * $f220; |
|
773 | + $f442 = 39.3750 * $sini2 * $sini2; |
|
774 | + $f522 = 9.84375 * $sat->deep_arg->sinio * ($sini2 * (1 - 2 * $sat->deep_arg->cosio - 5 * |
|
775 | + $sat->deep_arg->theta2) + 0.33333333 * (-2 + 4 * $sat->deep_arg->cosio + |
|
776 | + 6 * $sat->deep_arg->theta2)); |
|
777 | + $f523 = $sat->deep_arg->sinio * (4.92187512 * $sini2 * (-2 - 4 * |
|
778 | + $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2) + 6.56250012 |
|
779 | + * (1 + 2 * $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2)); |
|
780 | + $f542 = 29.53125 * $sat->deep_arg->sinio * (2 - 8 * |
|
781 | + $sat->deep_arg->cosio + $sat->deep_arg->theta2 * |
|
782 | + (-12 + 8 * $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2)); |
|
783 | + $f543 = 29.53125 * $sat->deep_arg->sinio * (-2 - 8 * $sat->deep_arg->cosio + |
|
784 | + $sat->deep_arg->theta2 * (12 + 8 * $sat->deep_arg->cosio - 10 * |
|
785 | + $sat->deep_arg->theta2)); |
|
786 | + $xno2 = $sat->dps->xnq * $sat->dps->xnq; |
|
787 | + $ainv2 = $aqnv * $aqnv; |
|
788 | + $temp1 = 3 * $xno2 * $ainv2; |
|
789 | + $temp = $temp1 * Predict::root22; |
|
790 | + $sat->dps->d2201 = $temp * $f220 * $g201; |
|
791 | + $sat->dps->d2211 = $temp * $f221 * $g211; |
|
792 | + $temp1 = $temp1 * $aqnv; |
|
793 | + $temp = $temp1 * Predict::root32; |
|
794 | + $sat->dps->d3210 = $temp * $f321 * $g310; |
|
795 | + $sat->dps->d3222 = $temp * $f322 * $g322; |
|
796 | + $temp1 = $temp1 * $aqnv; |
|
797 | + $temp = 2 * $temp1 * Predict::root44; |
|
798 | + $sat->dps->d4410 = $temp * $f441 * $g410; |
|
799 | + $sat->dps->d4422 = $temp * $f442 * $g422; |
|
800 | + $temp1 = $temp1 * $aqnv; |
|
801 | + $temp = $temp1 * Predict::root52; |
|
802 | + $sat->dps->d5220 = $temp * $f522 * $g520; |
|
803 | + $sat->dps->d5232 = $temp * $f523 * $g532; |
|
804 | + $temp = 2 * $temp1 * Predict::root54; |
|
805 | + $sat->dps->d5421 = $temp * $f542 * $g521; |
|
806 | + $sat->dps->d5433 = $temp * $f543 * $g533; |
|
807 | + $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->xnodeo - $sat->dps->thgr - $sat->dps->thgr; |
|
808 | + $bfact = $sat->deep_arg->xmdot + $sat->deep_arg->xnodot + |
|
809 | + $sat->deep_arg->xnodot - Predict::thdt - Predict::thdt; |
|
810 | + $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssh + $sat->dps->ssh; |
|
811 | + } else { |
|
812 | + $sat->flags |= self::RESONANCE_FLAG; |
|
813 | + $sat->flags |= self::SYNCHRONOUS_FLAG; |
|
814 | + /* Synchronous resonance terms initialization */ |
|
815 | + $g200 = 1 + $sat->deep_arg->eosq * (-2.5 + 0.8125 * $sat->deep_arg->eosq); |
|
816 | + $g310 = 1 + 2 * $sat->deep_arg->eosq; |
|
817 | + $g300 = 1 + $sat->deep_arg->eosq * (-6 + 6.60937 * $sat->deep_arg->eosq); |
|
818 | + $f220 = 0.75 * (1 + $sat->deep_arg->cosio) * (1 + $sat->deep_arg->cosio); |
|
819 | + $f311 = 0.9375 * $sat->deep_arg->sinio * $sat->deep_arg->sinio * |
|
820 | + (1 + 3 * $sat->deep_arg->cosio) - 0.75 * (1 + $sat->deep_arg->cosio); |
|
821 | + $f330 = 1 + $sat->deep_arg->cosio; |
|
822 | + $f330 = 1.875 * $f330 * $f330 * $f330; |
|
823 | + $sat->dps->del1 = 3 * $sat->dps->xnq * $sat->dps->xnq * $aqnv * $aqnv; |
|
824 | + $sat->dps->del2 = 2 * $sat->dps->del1 * $f220 * $g200 * Predict::q22; |
|
825 | + $sat->dps->del3 = 3 * $sat->dps->del1 * $f330 * $g300 * Predict::q33 * $aqnv; |
|
826 | + $sat->dps->del1 = $sat->dps->del1 * $f311 * $g310 * Predict::q31 * $aqnv; |
|
827 | + $sat->dps->fasx2 = 0.13130908; |
|
828 | + $sat->dps->fasx4 = 2.8843198; |
|
829 | + $sat->dps->fasx6 = 0.37448087; |
|
830 | + $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->omegao - $sat->dps->thgr; |
|
831 | + $bfact = $sat->deep_arg->xmdot + $xpidot - Predict::thdt; |
|
832 | + $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssg + $sat->dps->ssh; |
|
833 | + } /* End if( !(xnq < 0.0052359877) && (xnq > 0.0034906585) ) */ |
|
834 | + |
|
835 | + $sat->dps->xfact = $bfact - $sat->dps->xnq; |
|
836 | + |
|
837 | + /* Initialize integrator */ |
|
838 | + $sat->dps->xli = $sat->dps->xlamo; |
|
839 | + $sat->dps->xni = $sat->dps->xnq; |
|
840 | + $sat->dps->atime = 0; |
|
841 | + $sat->dps->stepp = 720; |
|
842 | + $sat->dps->stepn = -720; |
|
843 | + $sat->dps->step2 = 259200; |
|
844 | + /* End case self::dpinit: */ |
|
845 | + return; |
|
846 | + |
|
847 | + case self::dpsec: /* Entrance for deep space secular effects */ |
|
848 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->ssl * $sat->deep_arg->t; |
|
849 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $sat->dps->ssg * $sat->deep_arg->t; |
|
850 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + $sat->dps->ssh * $sat->deep_arg->t; |
|
851 | + $sat->deep_arg->em = $sat->tle->eo + $sat->dps->sse * $sat->deep_arg->t; |
|
852 | + $sat->deep_arg->xinc = $sat->tle->xincl + $sat->dps->ssi * $sat->deep_arg->t; |
|
853 | + if ($sat->deep_arg->xinc < 0) { |
|
854 | + $sat->deep_arg->xinc = -$sat->deep_arg->xinc; |
|
855 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + Predict::pi; |
|
856 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf - Predict::pi; |
|
857 | + } |
|
858 | + if(~$sat->flags & self::RESONANCE_FLAG ) { |
|
859 | + return; |
|
860 | + } |
|
861 | + |
|
862 | + do { |
|
863 | + if ( ($sat->dps->atime == 0) || |
|
864 | + (($sat->deep_arg->t >= 0) && ($sat->dps->atime < 0)) || |
|
865 | + (($sat->deep_arg->t < 0) && ($sat->dps->atime >= 0)) ) { |
|
866 | + /* Epoch restart */ |
|
867 | + if ($sat->deep_arg->t >= 0) { |
|
868 | + $delt = $sat->dps->stepp; |
|
869 | + } else { |
|
870 | + $delt = $sat->dps->stepn; |
|
871 | + } |
|
872 | + |
|
873 | + $sat->dps->atime = 0; |
|
874 | + $sat->dps->xni = $sat->dps->xnq; |
|
875 | + $sat->dps->xli = $sat->dps->xlamo; |
|
876 | + } else { |
|
877 | + if (abs($sat->deep_arg->t) >= abs($sat->dps->atime)) { |
|
878 | + if ($sat->deep_arg->t > 0) { |
|
879 | + $delt = $sat->dps->stepp; |
|
880 | + } else { |
|
881 | + $delt = $sat->dps->stepn; |
|
882 | + } |
|
883 | + } |
|
884 | + } |
|
885 | + |
|
886 | + do { |
|
887 | + if (abs($sat->deep_arg->t - $sat->dps->atime) >= $sat->dps->stepp) { |
|
888 | + $sat->flags |= self::DO_LOOP_FLAG; |
|
889 | + $sat->flags &= ~self::EPOCH_RESTART_FLAG; |
|
890 | + } |
|
891 | + else { |
|
892 | + $ft = $sat->deep_arg->t - $sat->dps->atime; |
|
893 | + $sat->flags &= ~self::DO_LOOP_FLAG; |
|
894 | + } |
|
895 | + |
|
896 | + if (abs($sat->deep_arg->t) < abs($sat->dps->atime)) { |
|
897 | + if ($sat->deep_arg->t >= 0) { |
|
898 | + $delt = $sat->dps->stepn; |
|
899 | + } else { |
|
900 | + $delt = $sat->dps->stepp; |
|
901 | + } |
|
902 | + $sat->flags |= (self::DO_LOOP_FLAG | self::EPOCH_RESTART_FLAG); |
|
903 | + } |
|
904 | + |
|
905 | + /* Dot terms calculated */ |
|
906 | + if ($sat->flags & self::SYNCHRONOUS_FLAG) { |
|
907 | + $xndot = $sat->dps->del1 * sin($sat->dps->xli - $sat->dps->fasx2) + $sat->dps->del2 * sin(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
908 | + + $sat->dps->del3 * sin(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
909 | + $xnddt = $sat->dps->del1 * cos($sat->dps->xli - $sat->dps->fasx2) + 2 * $sat->dps->del2 * cos(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
910 | + + 3 * $sat->dps->del3 * cos(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
911 | + } else { |
|
912 | + $xomi = $sat->dps->omegaq + $sat->deep_arg->omgdot * $sat->dps->atime; |
|
913 | + $x2omi = $xomi + $xomi; |
|
914 | + $x2li = $sat->dps->xli + $sat->dps->xli; |
|
915 | + $xndot = $sat->dps->d2201 * sin($x2omi + $sat->dps->xli - Predict::g22) |
|
916 | + + $sat->dps->d2211 * sin($sat->dps->xli - Predict::g22) |
|
917 | + + $sat->dps->d3210 * sin($xomi + $sat->dps->xli - Predict::g32) |
|
918 | + + $sat->dps->d3222 * sin(-$xomi + $sat->dps->xli - Predict::g32) |
|
919 | + + $sat->dps->d4410 * sin($x2omi + $x2li- Predict::g44) |
|
920 | + + $sat->dps->d4422 * sin($x2li- Predict::g44) |
|
921 | + + $sat->dps->d5220 * sin($xomi + $sat->dps->xli- Predict::g52) |
|
922 | + + $sat->dps->d5232 * sin(-$xomi + $sat->dps->xli- Predict::g52) |
|
923 | + + $sat->dps->d5421 * sin($xomi + $x2li - Predict::g54) |
|
924 | + + $sat->dps->d5433 * sin(-$xomi + $x2li - Predict::g54); |
|
925 | + $xnddt = $sat->dps->d2201 * cos($x2omi + $sat->dps->xli- Predict::g22) |
|
926 | + + $sat->dps->d2211 * cos($sat->dps->xli - Predict::g22) |
|
927 | + + $sat->dps->d3210 * cos($xomi + $sat->dps->xli - Predict::g32) |
|
928 | + + $sat->dps->d3222 * cos(-$xomi + $sat->dps->xli - Predict::g32) |
|
929 | + + $sat->dps->d5220 * cos($xomi + $sat->dps->xli - Predict::g52) |
|
930 | + + $sat->dps->d5232 * cos(-$xomi + $sat->dps->xli - Predict::g52) |
|
931 | + + 2 * ($sat->dps->d4410 * cos($x2omi + $x2li - Predict::g44) |
|
932 | + + $sat->dps->d4422 * cos($x2li - Predict::g44) |
|
933 | + + $sat->dps->d5421 * cos($xomi + $x2li - Predict::g54) |
|
934 | + + $sat->dps->d5433 * cos(-$xomi + $x2li - Predict::g54)); |
|
935 | + } /* End of if (isFlagSet(SYNCHRONOUS_FLAG)) */ |
|
936 | + |
|
937 | + $xldot = $sat->dps->xni + $sat->dps->xfact; |
|
938 | + $xnddt = $xnddt * $xldot; |
|
939 | + |
|
940 | + if ($sat->flags & self::DO_LOOP_FLAG) { |
|
941 | + $sat->dps->xli = $sat->dps->xli + $xldot * $delt + $xndot * $sat->dps->step2; |
|
942 | + $sat->dps->xni = $sat->dps->xni + $xndot * $delt + $xnddt * $sat->dps->step2; |
|
943 | + $sat->dps->atime = $sat->dps->atime + $delt; |
|
944 | + } |
|
945 | + } while (($sat->flags & self::DO_LOOP_FLAG) && |
|
946 | + (~$sat->flags & self::EPOCH_RESTART_FLAG)); |
|
947 | + } |
|
948 | + while (($sat->flags & self::DO_LOOP_FLAG) && ($sat->flags & self::EPOCH_RESTART_FLAG)); |
|
949 | + |
|
950 | + $sat->deep_arg->xn = $sat->dps->xni + $xndot * $ft + $xnddt * $ft * $ft * 0.5; |
|
951 | + $xl = $sat->dps->xli + $xldot * $ft + $xndot * $ft * $ft * 0.5; |
|
952 | + $temp = -$sat->deep_arg->xnode + $sat->dps->thgr + $sat->deep_arg->t * Predict::thdt; |
|
953 | + |
|
954 | + if (~$sat->flags & self::SYNCHRONOUS_FLAG) { |
|
955 | + $sat->deep_arg->xll = $xl + $temp + $temp; |
|
956 | + } else { |
|
957 | + $sat->deep_arg->xll = $xl - $sat->deep_arg->omgadf + $temp; |
|
958 | + } |
|
959 | + |
|
960 | + return; |
|
961 | + /* End case dpsec: */ |
|
962 | + |
|
963 | + case self::dpper: /* Entrance for lunar-solar periodics */ |
|
964 | + $sinis = sin($sat->deep_arg->xinc); |
|
965 | + $cosis = cos($sat->deep_arg->xinc); |
|
966 | + if (abs($sat->dps->savtsn - $sat->deep_arg->t) >= 30) { |
|
967 | + $sat->dps->savtsn = $sat->deep_arg->t; |
|
968 | + $zm = $sat->dps->zmos + Predict::zns * $sat->deep_arg->t; |
|
969 | + $zf = $zm + 2 * Predict::zes * sin($zm); |
|
970 | + $sinzf = sin($zf); |
|
971 | + $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
972 | + $f3 = -0.5 * $sinzf * cos($zf); |
|
973 | + $ses = $sat->dps->se2 * $f2 + $sat->dps->se3 * $f3; |
|
974 | + $sis = $sat->dps->si2 * $f2 + $sat->dps->si3 * $f3; |
|
975 | + $sls = $sat->dps->sl2 * $f2 + $sat->dps->sl3 * $f3 + $sat->dps->sl4 * $sinzf; |
|
976 | + $sat->dps->sghs = $sat->dps->sgh2 * $f2 + $sat->dps->sgh3 * $f3 + $sat->dps->sgh4 * $sinzf; |
|
977 | + $sat->dps->shs = $sat->dps->sh2 * $f2 + $sat->dps->sh3 * $f3; |
|
978 | + $zm = $sat->dps->zmol + Predict::znl * $sat->deep_arg->t; |
|
979 | + $zf = $zm + 2 * Predict::zel * sin($zm); |
|
980 | + $sinzf = sin($zf); |
|
981 | + $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
982 | + $f3 = -0.5 * $sinzf * cos($zf); |
|
983 | + $sel = $sat->dps->ee2 * $f2 + $sat->dps->e3 * $f3; |
|
984 | + $sil = $sat->dps->xi2 * $f2 + $sat->dps->xi3 * $f3; |
|
985 | + $sll = $sat->dps->xl2 * $f2 + $sat->dps->xl3 * $f3 + $sat->dps->xl4 * $sinzf; |
|
986 | + $sat->dps->sghl = $sat->dps->xgh2 * $f2 + $sat->dps->xgh3 * $f3 + $sat->dps->xgh4 * $sinzf; |
|
987 | + $sat->dps->sh1 = $sat->dps->xh2 * $f2 + $sat->dps->xh3 * $f3; |
|
988 | + $sat->dps->pe = $ses + $sel; |
|
989 | + $sat->dps->pinc = $sis + $sil; |
|
990 | + $sat->dps->pl = $sls + $sll; |
|
991 | + } |
|
992 | + |
|
993 | + $pgh = $sat->dps->sghs + $sat->dps->sghl; |
|
994 | + $ph = $sat->dps->shs + $sat->dps->sh1; |
|
995 | + $sat->deep_arg->xinc = $sat->deep_arg->xinc + $sat->dps->pinc; |
|
996 | + $sat->deep_arg->em = $sat->deep_arg->em + $sat->dps->pe; |
|
997 | + |
|
998 | + if ($sat->dps->xqncl >= 0.2) { |
|
999 | + /* Apply periodics directly */ |
|
1000 | + $ph = $ph / $sat->deep_arg->sinio; |
|
1001 | + $pgh = $pgh - $sat->deep_arg->cosio * $ph; |
|
1002 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $pgh; |
|
1003 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + $ph; |
|
1004 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
|
1005 | + } else { |
|
1006 | + /* Apply periodics with Lyddane modification */ |
|
1007 | + $sinok = sin($sat->deep_arg->xnode); |
|
1008 | + $cosok = cos($sat->deep_arg->xnode); |
|
1009 | + $alfdp = $sinis * $sinok; |
|
1010 | + $betdp = $sinis * $cosok; |
|
1011 | + $dalf = $ph * $cosok + $sat->dps->pinc * $cosis * $sinok; |
|
1012 | + $dbet = -$ph * $sinok + $sat->dps->pinc * $cosis * $cosok; |
|
1013 | + $alfdp = $alfdp + $dalf; |
|
1014 | + $betdp = $betdp + $dbet; |
|
1015 | + $sat->deep_arg->xnode = Predict_Math::FMod2p($sat->deep_arg->xnode); |
|
1016 | + $xls = $sat->deep_arg->xll + $sat->deep_arg->omgadf + $cosis * $sat->deep_arg->xnode; |
|
1017 | + $dls = $sat->dps->pl + $pgh - $sat->dps->pinc * $sat->deep_arg->xnode * $sinis; |
|
1018 | + $xls = $xls + $dls; |
|
1019 | + $xnoh = $sat->deep_arg->xnode; |
|
1020 | + $sat->deep_arg->xnode = Predict_Math::AcTan($alfdp, $betdp); |
|
1021 | + |
|
1022 | + /* This is a patch to Lyddane modification */ |
|
1023 | + /* suggested by Rob Matson. */ |
|
1024 | + if(abs($xnoh - $sat->deep_arg->xnode) > Predict::pi) { |
|
1025 | + if ($sat->deep_arg->xnode < $xnoh) { |
|
1026 | + $sat->deep_arg->xnode += Predict::twopi; |
|
1027 | + } else { |
|
1028 | + $sat->deep_arg->xnode -= Predict::twopi; |
|
1029 | + } |
|
1030 | + } |
|
1031 | + |
|
1032 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
|
1033 | + $sat->deep_arg->omgadf = $xls - $sat->deep_arg->xll - cos($sat->deep_arg->xinc) * |
|
1034 | + $sat->deep_arg->xnode; |
|
1035 | + } /* End case dpper: */ |
|
1036 | + return; |
|
1037 | + |
|
1038 | + } /* End switch(ientry) */ |
|
1039 | + |
|
1040 | + } /* End of Deep() */ |
|
1041 | + |
|
1042 | + /** |
|
1043 | + * Singleton |
|
1044 | + * |
|
1045 | + * @param Predict_Sat $sat The current satellite data instance |
|
1046 | + * |
|
1047 | + * @return Predict_SGPSDP |
|
1048 | + */ |
|
1049 | + public static function getInstance(Predict_Sat $sat) |
|
1050 | + { |
|
1051 | + static $instances = array(); |
|
1052 | + $catnr = $sat->tle->catnr; |
|
1053 | + if (!isset($instances[$catnr])) { |
|
1054 | + $instances[$catnr] = new self(); |
|
1055 | + } |
|
1056 | + return $instances[$catnr]; |
|
1057 | + } |
|
1058 | 1058 | } |
1059 | 1059 | ?> |
@@ -541,499 +541,499 @@ |
||
541 | 541 | public function Deep($ientry, Predict_Sat $sat) |
542 | 542 | { |
543 | 543 | switch ($ientry) { |
544 | - case self::dpinit : /* Entrance for deep space initialization */ |
|
545 | - $sat->dps->thgr = Predict_Time::ThetaG($sat->tle->epoch, $sat->deep_arg); |
|
546 | - $eq = $sat->tle->eo; |
|
547 | - $sat->dps->xnq = $sat->deep_arg->xnodp; |
|
548 | - $aqnv = 1.0 / $sat->deep_arg->aodp; |
|
549 | - $sat->dps->xqncl = $sat->tle->xincl; |
|
550 | - $xmao = $sat->tle->xmo; |
|
551 | - $xpidot = $sat->deep_arg->omgdot + $sat->deep_arg->xnodot; |
|
552 | - $sinq = sin($sat->tle->xnodeo); |
|
553 | - $cosq = cos($sat->tle->xnodeo); |
|
554 | - $sat->dps->omegaq = $sat->tle->omegao; |
|
555 | - $sat->dps->preep = 0; |
|
556 | - |
|
557 | - /* Initialize lunar solar terms */ |
|
558 | - $day = $sat->deep_arg->ds50 + 18261.5; /* Days since 1900 Jan 0.5 */ |
|
559 | - if ($day != $sat->dps->preep) { |
|
560 | - $sat->dps->preep = $day; |
|
561 | - $xnodce = 4.5236020 - 9.2422029E-4 * $day; |
|
562 | - $stem = sin($xnodce); |
|
563 | - $ctem = cos($xnodce); |
|
564 | - $sat->dps->zcosil = 0.91375164 - 0.03568096 * $ctem; |
|
565 | - $sat->dps->zsinil = sqrt(1.0 - $sat->dps->zcosil * $sat->dps->zcosil); |
|
566 | - $sat->dps->zsinhl = 0.089683511 * $stem / $sat->dps->zsinil; |
|
567 | - $sat->dps->zcoshl = sqrt(1.0 - $sat->dps->zsinhl * $sat->dps->zsinhl); |
|
568 | - $c = 4.7199672 + 0.22997150 * $day; |
|
569 | - $gam = 5.8351514 + 0.0019443680 * $day; |
|
570 | - $sat->dps->zmol = Predict_Math::FMod2p($c - $gam); |
|
571 | - $zx = 0.39785416 * $stem / $sat->dps->zsinil; |
|
572 | - $zy = $sat->dps->zcoshl * $ctem + 0.91744867 * $sat->dps->zsinhl * $stem; |
|
573 | - $zx = Predict_Math::AcTan($zx, $zy); |
|
574 | - $zx = $gam + $zx - $xnodce; |
|
575 | - $sat->dps->zcosgl = cos($zx); |
|
576 | - $sat->dps->zsingl = sin($zx); |
|
577 | - $sat->dps->zmos = 6.2565837 + 0.017201977 * $day; |
|
578 | - $sat->dps->zmos = Predict_Math::FMod2p($sat->dps->zmos); |
|
579 | - } /* End if(day != preep) */ |
|
580 | - |
|
581 | - /* Do solar terms */ |
|
582 | - $sat->dps->savtsn = 1E20; |
|
583 | - $zcosg = Predict::zcosgs; |
|
584 | - $zsing = Predict::zsings; |
|
585 | - $zcosi = Predict::zcosis; |
|
586 | - $zsini = Predict::zsinis; |
|
587 | - $zcosh = $cosq; |
|
588 | - $zsinh = $sinq; |
|
589 | - $cc = Predict::c1ss; |
|
590 | - $zn = Predict::zns; |
|
591 | - $ze = Predict::zes; |
|
592 | - $zmo = $sat->dps->zmos; |
|
593 | - $xnoi = 1.0 / $sat->dps->xnq; |
|
594 | - |
|
595 | - /* Loop breaks when Solar terms are done a second */ |
|
596 | - /* time, after Lunar terms are initialized */ |
|
597 | - for(;;) { |
|
598 | - /* Solar terms done again after Lunar terms are done */ |
|
599 | - $a1 = $zcosg * $zcosh + $zsing * $zcosi * $zsinh; |
|
600 | - $a3 = -$zsing * $zcosh + $zcosg * $zcosi * $zsinh; |
|
601 | - $a7 = -$zcosg * $zsinh + $zsing * $zcosi * $zcosh; |
|
602 | - $a8 = $zsing * $zsini; |
|
603 | - $a9 = $zsing * $zsinh + $zcosg * $zcosi * $zcosh; |
|
604 | - $a10 = $zcosg * $zsini; |
|
605 | - $a2 = $sat->deep_arg->cosio * $a7 + $sat->deep_arg->sinio * $a8; |
|
606 | - $a4 = $sat->deep_arg->cosio * $a9 + $sat->deep_arg->sinio * $a10; |
|
607 | - $a5 = -$sat->deep_arg->sinio * $a7 + $sat->deep_arg->cosio * $a8; |
|
608 | - $a6 = -$sat->deep_arg->sinio * $a9 + $sat->deep_arg->cosio * $a10; |
|
609 | - $x1 = $a1 * $sat->deep_arg->cosg + $a2 * $sat->deep_arg->sing; |
|
610 | - $x2 = $a3 * $sat->deep_arg->cosg + $a4 * $sat->deep_arg->sing; |
|
611 | - $x3 = -$a1 * $sat->deep_arg->sing + $a2 * $sat->deep_arg->cosg; |
|
612 | - $x4 = -$a3 * $sat->deep_arg->sing + $a4 * $sat->deep_arg->cosg; |
|
613 | - $x5 = $a5 * $sat->deep_arg->sing; |
|
614 | - $x6 = $a6 * $sat->deep_arg->sing; |
|
615 | - $x7 = $a5 * $sat->deep_arg->cosg; |
|
616 | - $x8 = $a6 * $sat->deep_arg->cosg; |
|
617 | - $z31 = 12 * $x1 * $x1 - 3 * $x3 * $x3; |
|
618 | - $z32 = 24 * $x1 * $x2 - 6 * $x3 * $x4; |
|
619 | - $z33 = 12 * $x2 * $x2 - 3 * $x4 * $x4; |
|
620 | - $z1 = 3 * ($a1 * $a1 + $a2 * $a2) + $z31 * $sat->deep_arg->eosq; |
|
621 | - $z2 = 6 * ($a1 * $a3 + $a2 * $a4) + $z32 * $sat->deep_arg->eosq; |
|
622 | - $z3 = 3 * ($a3 * $a3 + $a4 * $a4) + $z33 * $sat->deep_arg->eosq; |
|
623 | - $z11 = -6 * $a1 * $a5 + $sat->deep_arg->eosq * (-24 * $x1 * $x7 - 6 * $x3 * $x5); |
|
624 | - $z12 = -6 * ($a1 * $a6 + $a3 * $a5) + $sat->deep_arg->eosq * |
|
625 | - (-24 * ($x2 * $x7 + $x1 * $x8) - 6 * ($x3 * $x6 + $x4 * $x5)); |
|
626 | - $z13 = -6 * $a3 * $a6 + $sat->deep_arg->eosq * (-24 * $x2 * $x8 - 6 * $x4 * $x6); |
|
627 | - $z21 = 6 * $a2 * $a5 + $sat->deep_arg->eosq * (24 * $x1 * $x5 - 6 * $x3 * $x7); |
|
628 | - $z22 = 6 * ($a4 * $a5 + $a2 * $a6) + $sat->deep_arg->eosq * |
|
629 | - (24 * ($x2 * $x5 + $x1 * $x6) - 6 * ($x4 * $x7 + $x3 * $x8)); |
|
630 | - $z23 = 6 * $a4 * $a6 + $sat->deep_arg->eosq * (24 * $x2 * $x6 - 6 * $x4 * $x8); |
|
631 | - $z1 = $z1 + $z1 + $sat->deep_arg->betao2 * $z31; |
|
632 | - $z2 = $z2 + $z2 + $sat->deep_arg->betao2 * $z32; |
|
633 | - $z3 = $z3 + $z3 + $sat->deep_arg->betao2 * $z33; |
|
634 | - $s3 = $cc * $xnoi; |
|
635 | - $s2 = -0.5 * $s3 / $sat->deep_arg->betao; |
|
636 | - $s4 = $s3 * $sat->deep_arg->betao; |
|
637 | - $s1 = -15 * $eq * $s4; |
|
638 | - $s5 = $x1 * $x3 + $x2 * $x4; |
|
639 | - $s6 = $x2 * $x3 + $x1 * $x4; |
|
640 | - $s7 = $x2 * $x4 - $x1 * $x3; |
|
641 | - $se = $s1 * $zn * $s5; |
|
642 | - $si = $s2 * $zn * ($z11 + $z13); |
|
643 | - $sl = -$zn * $s3 * ($z1 + $z3 - 14 - 6 * $sat->deep_arg->eosq); |
|
644 | - $sgh = $s4 * $zn * ($z31 + $z33 - 6); |
|
645 | - $sh = -$zn * $s2 * ($z21 + $z23); |
|
646 | - if ($sat->dps->xqncl < 5.2359877E-2) { |
|
647 | - $sh = 0; |
|
648 | - } |
|
649 | - $sat->dps->ee2 = 2 * $s1 * $s6; |
|
650 | - $sat->dps->e3 = 2 * $s1 * $s7; |
|
651 | - $sat->dps->xi2 = 2 * $s2 * $z12; |
|
652 | - $sat->dps->xi3 = 2 * $s2 * ($z13 - $z11); |
|
653 | - $sat->dps->xl2 = -2 * $s3 * $z2; |
|
654 | - $sat->dps->xl3 = -2 * $s3 * ($z3 - $z1); |
|
655 | - $sat->dps->xl4 = -2 * $s3 * (-21 - 9 * $sat->deep_arg->eosq) * $ze; |
|
656 | - $sat->dps->xgh2 = 2 * $s4 * $z32; |
|
657 | - $sat->dps->xgh3 = 2 * $s4 * ($z33 - $z31); |
|
658 | - $sat->dps->xgh4 = -18 * $s4 * $ze; |
|
659 | - $sat->dps->xh2 = -2 * $s2 * $z22; |
|
660 | - $sat->dps->xh3 = -2 * $s2 * ($z23 - $z21); |
|
661 | - |
|
662 | - if ($sat->flags & self::LUNAR_TERMS_DONE_FLAG) { |
|
663 | - break; |
|
664 | - } |
|
665 | - |
|
666 | - /* Do lunar terms */ |
|
667 | - $sat->dps->sse = $se; |
|
668 | - $sat->dps->ssi = $si; |
|
669 | - $sat->dps->ssl = $sl; |
|
670 | - $sat->dps->ssh = $sh / $sat->deep_arg->sinio; |
|
671 | - $sat->dps->ssg = $sgh - $sat->deep_arg->cosio * $sat->dps->ssh; |
|
672 | - $sat->dps->se2 = $sat->dps->ee2; |
|
673 | - $sat->dps->si2 = $sat->dps->xi2; |
|
674 | - $sat->dps->sl2 = $sat->dps->xl2; |
|
675 | - $sat->dps->sgh2 = $sat->dps->xgh2; |
|
676 | - $sat->dps->sh2 = $sat->dps->xh2; |
|
677 | - $sat->dps->se3 = $sat->dps->e3; |
|
678 | - $sat->dps->si3 = $sat->dps->xi3; |
|
679 | - $sat->dps->sl3 = $sat->dps->xl3; |
|
680 | - $sat->dps->sgh3 = $sat->dps->xgh3; |
|
681 | - $sat->dps->sh3 = $sat->dps->xh3; |
|
682 | - $sat->dps->sl4 = $sat->dps->xl4; |
|
683 | - $sat->dps->sgh4 = $sat->dps->xgh4; |
|
684 | - $zcosg = $sat->dps->zcosgl; |
|
685 | - $zsing = $sat->dps->zsingl; |
|
686 | - $zcosi = $sat->dps->zcosil; |
|
687 | - $zsini = $sat->dps->zsinil; |
|
688 | - $zcosh = $sat->dps->zcoshl * $cosq + $sat->dps->zsinhl * $sinq; |
|
689 | - $zsinh = $sinq * $sat->dps->zcoshl - $cosq * $sat->dps->zsinhl; |
|
690 | - $zn = Predict::znl; |
|
691 | - $cc = Predict::c1l; |
|
692 | - $ze = Predict::zel; |
|
693 | - $zmo = $sat->dps->zmol; |
|
694 | - $sat->flags |= self::LUNAR_TERMS_DONE_FLAG; |
|
695 | - } /* End of for(;;) */ |
|
696 | - |
|
697 | - $sat->dps->sse = $sat->dps->sse + $se; |
|
698 | - $sat->dps->ssi = $sat->dps->ssi + $si; |
|
699 | - $sat->dps->ssl = $sat->dps->ssl + $sl; |
|
700 | - $sat->dps->ssg = $sat->dps->ssg + $sgh - $sat->deep_arg->cosio / $sat->deep_arg->sinio * $sh; |
|
701 | - $sat->dps->ssh = $sat->dps->ssh + $sh / $sat->deep_arg->sinio; |
|
702 | - |
|
703 | - /* Geopotential resonance initialization for 12 hour orbits */ |
|
704 | - $sat->flags &= ~self::RESONANCE_FLAG; |
|
705 | - $sat->flags &= ~self::SYNCHRONOUS_FLAG; |
|
706 | - |
|
707 | - if (!(($sat->dps->xnq < 0.0052359877) && ($sat->dps->xnq > 0.0034906585))) { |
|
708 | - if( ($sat->dps->xnq < 0.00826) || ($sat->dps->xnq > 0.00924) ) { |
|
709 | - return; |
|
710 | - } |
|
711 | - if ($eq < 0.5) { |
|
712 | - return; |
|
713 | - } |
|
714 | - $sat->flags |= self::RESONANCE_FLAG; |
|
715 | - $eoc = $eq * $sat->deep_arg->eosq; |
|
716 | - $g201 = -0.306 - ($eq - 0.64) * 0.440; |
|
717 | - if ($eq <= 0.65) { |
|
718 | - $g211 = 3.616 - 13.247 * $eq + 16.290 * $sat->deep_arg->eosq; |
|
719 | - $g310 = -19.302 + 117.390 * $eq - 228.419 * |
|
720 | - $sat->deep_arg->eosq + 156.591 * $eoc; |
|
721 | - $g322 = -18.9068 + 109.7927 * $eq - 214.6334 * |
|
722 | - $sat->deep_arg->eosq + 146.5816 * $eoc; |
|
723 | - $g410 = -41.122 + 242.694 * $eq - 471.094 * |
|
724 | - $sat->deep_arg->eosq + 313.953 * $eoc; |
|
725 | - $g422 = -146.407 + 841.880 * $eq - 1629.014 * |
|
726 | - $sat->deep_arg->eosq + 1083.435 * $eoc; |
|
727 | - $g520 = -532.114 + 3017.977 * $eq - 5740 * |
|
728 | - $sat->deep_arg->eosq + 3708.276 * $eoc; |
|
729 | - } else { |
|
730 | - $g211 = -72.099 + 331.819 * $eq - 508.738 * |
|
731 | - $sat->deep_arg->eosq + 266.724 * $eoc; |
|
732 | - $g310 = -346.844 + 1582.851 * $eq - 2415.925 * |
|
733 | - $sat->deep_arg->eosq + 1246.113 * $eoc; |
|
734 | - $g322 = -342.585 + 1554.908 * $eq - 2366.899 * |
|
735 | - $sat->deep_arg->eosq + 1215.972 * $eoc; |
|
736 | - $g410 = -1052.797 + 4758.686 * $eq - 7193.992 * |
|
737 | - $sat->deep_arg->eosq + 3651.957 * $eoc; |
|
738 | - $g422 = -3581.69 + 16178.11 * $eq - 24462.77 * |
|
739 | - $sat->deep_arg->eosq+ 12422.52 * $eoc; |
|
740 | - if ($eq <= 0.715) { |
|
741 | - $g520 = 1464.74 - 4664.75 * $eq + 3763.64 * $sat->deep_arg->eosq; |
|
742 | - } else { |
|
743 | - $g520 = -5149.66 + 29936.92 * $eq - 54087.36 * |
|
744 | - $sat->deep_arg->eosq + 31324.56 * $eoc; |
|
745 | - } |
|
746 | - } /* End if (eq <= 0.65) */ |
|
747 | - |
|
748 | - if ($eq < 0.7) { |
|
749 | - $g533 = -919.2277 + 4988.61 * $eq - 9064.77 * |
|
750 | - $sat->deep_arg->eosq + 5542.21 * $eoc; |
|
751 | - $g521 = -822.71072 + 4568.6173 * $eq - 8491.4146 * |
|
752 | - $sat->deep_arg->eosq + 5337.524 * $eoc; |
|
753 | - $g532 = -853.666 + 4690.25 * $eq - 8624.77 * |
|
754 | - $sat->deep_arg->eosq + 5341.4 * $eoc; |
|
755 | - } |
|
756 | - else { |
|
757 | - $g533 = -37995.78 + 161616.52 * $eq - 229838.2* |
|
758 | - $sat->deep_arg->eosq + 109377.94 * $eoc; |
|
759 | - $g521 = -51752.104 + 218913.95 * $eq - 309468.16* |
|
760 | - $sat->deep_arg->eosq + 146349.42 * $eoc; |
|
761 | - $g532 = -40023.88 + 170470.89 * $eq - 242699.48* |
|
762 | - $sat->deep_arg->eosq + 115605.82 * $eoc; |
|
763 | - } /* End if (eq <= 0.7) */ |
|
764 | - |
|
765 | - $sini2 = $sat->deep_arg->sinio * $sat->deep_arg->sinio; |
|
766 | - $f220 = 0.75 * (1 + 2 * $sat->deep_arg->cosio + $sat->deep_arg->theta2); |
|
767 | - $f221 = 1.5 * $sini2; |
|
768 | - $f321 = 1.875 * $sat->deep_arg->sinio * (1 - 2 * |
|
769 | - $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
770 | - $f322 = -1.875 * $sat->deep_arg->sinio * (1 + 2* |
|
771 | - $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
772 | - $f441 = 35 * $sini2 * $f220; |
|
773 | - $f442 = 39.3750 * $sini2 * $sini2; |
|
774 | - $f522 = 9.84375 * $sat->deep_arg->sinio * ($sini2 * (1 - 2 * $sat->deep_arg->cosio - 5 * |
|
775 | - $sat->deep_arg->theta2) + 0.33333333 * (-2 + 4 * $sat->deep_arg->cosio + |
|
776 | - 6 * $sat->deep_arg->theta2)); |
|
777 | - $f523 = $sat->deep_arg->sinio * (4.92187512 * $sini2 * (-2 - 4 * |
|
778 | - $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2) + 6.56250012 |
|
779 | - * (1 + 2 * $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2)); |
|
780 | - $f542 = 29.53125 * $sat->deep_arg->sinio * (2 - 8 * |
|
781 | - $sat->deep_arg->cosio + $sat->deep_arg->theta2 * |
|
782 | - (-12 + 8 * $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2)); |
|
783 | - $f543 = 29.53125 * $sat->deep_arg->sinio * (-2 - 8 * $sat->deep_arg->cosio + |
|
784 | - $sat->deep_arg->theta2 * (12 + 8 * $sat->deep_arg->cosio - 10 * |
|
785 | - $sat->deep_arg->theta2)); |
|
786 | - $xno2 = $sat->dps->xnq * $sat->dps->xnq; |
|
787 | - $ainv2 = $aqnv * $aqnv; |
|
788 | - $temp1 = 3 * $xno2 * $ainv2; |
|
789 | - $temp = $temp1 * Predict::root22; |
|
790 | - $sat->dps->d2201 = $temp * $f220 * $g201; |
|
791 | - $sat->dps->d2211 = $temp * $f221 * $g211; |
|
792 | - $temp1 = $temp1 * $aqnv; |
|
793 | - $temp = $temp1 * Predict::root32; |
|
794 | - $sat->dps->d3210 = $temp * $f321 * $g310; |
|
795 | - $sat->dps->d3222 = $temp * $f322 * $g322; |
|
796 | - $temp1 = $temp1 * $aqnv; |
|
797 | - $temp = 2 * $temp1 * Predict::root44; |
|
798 | - $sat->dps->d4410 = $temp * $f441 * $g410; |
|
799 | - $sat->dps->d4422 = $temp * $f442 * $g422; |
|
800 | - $temp1 = $temp1 * $aqnv; |
|
801 | - $temp = $temp1 * Predict::root52; |
|
802 | - $sat->dps->d5220 = $temp * $f522 * $g520; |
|
803 | - $sat->dps->d5232 = $temp * $f523 * $g532; |
|
804 | - $temp = 2 * $temp1 * Predict::root54; |
|
805 | - $sat->dps->d5421 = $temp * $f542 * $g521; |
|
806 | - $sat->dps->d5433 = $temp * $f543 * $g533; |
|
807 | - $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->xnodeo - $sat->dps->thgr - $sat->dps->thgr; |
|
808 | - $bfact = $sat->deep_arg->xmdot + $sat->deep_arg->xnodot + |
|
809 | - $sat->deep_arg->xnodot - Predict::thdt - Predict::thdt; |
|
810 | - $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssh + $sat->dps->ssh; |
|
811 | - } else { |
|
812 | - $sat->flags |= self::RESONANCE_FLAG; |
|
813 | - $sat->flags |= self::SYNCHRONOUS_FLAG; |
|
814 | - /* Synchronous resonance terms initialization */ |
|
815 | - $g200 = 1 + $sat->deep_arg->eosq * (-2.5 + 0.8125 * $sat->deep_arg->eosq); |
|
816 | - $g310 = 1 + 2 * $sat->deep_arg->eosq; |
|
817 | - $g300 = 1 + $sat->deep_arg->eosq * (-6 + 6.60937 * $sat->deep_arg->eosq); |
|
818 | - $f220 = 0.75 * (1 + $sat->deep_arg->cosio) * (1 + $sat->deep_arg->cosio); |
|
819 | - $f311 = 0.9375 * $sat->deep_arg->sinio * $sat->deep_arg->sinio * |
|
820 | - (1 + 3 * $sat->deep_arg->cosio) - 0.75 * (1 + $sat->deep_arg->cosio); |
|
821 | - $f330 = 1 + $sat->deep_arg->cosio; |
|
822 | - $f330 = 1.875 * $f330 * $f330 * $f330; |
|
823 | - $sat->dps->del1 = 3 * $sat->dps->xnq * $sat->dps->xnq * $aqnv * $aqnv; |
|
824 | - $sat->dps->del2 = 2 * $sat->dps->del1 * $f220 * $g200 * Predict::q22; |
|
825 | - $sat->dps->del3 = 3 * $sat->dps->del1 * $f330 * $g300 * Predict::q33 * $aqnv; |
|
826 | - $sat->dps->del1 = $sat->dps->del1 * $f311 * $g310 * Predict::q31 * $aqnv; |
|
827 | - $sat->dps->fasx2 = 0.13130908; |
|
828 | - $sat->dps->fasx4 = 2.8843198; |
|
829 | - $sat->dps->fasx6 = 0.37448087; |
|
830 | - $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->omegao - $sat->dps->thgr; |
|
831 | - $bfact = $sat->deep_arg->xmdot + $xpidot - Predict::thdt; |
|
832 | - $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssg + $sat->dps->ssh; |
|
833 | - } /* End if( !(xnq < 0.0052359877) && (xnq > 0.0034906585) ) */ |
|
834 | - |
|
835 | - $sat->dps->xfact = $bfact - $sat->dps->xnq; |
|
836 | - |
|
837 | - /* Initialize integrator */ |
|
838 | - $sat->dps->xli = $sat->dps->xlamo; |
|
839 | - $sat->dps->xni = $sat->dps->xnq; |
|
840 | - $sat->dps->atime = 0; |
|
841 | - $sat->dps->stepp = 720; |
|
842 | - $sat->dps->stepn = -720; |
|
843 | - $sat->dps->step2 = 259200; |
|
844 | - /* End case self::dpinit: */ |
|
845 | - return; |
|
846 | - |
|
847 | - case self::dpsec: /* Entrance for deep space secular effects */ |
|
848 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->ssl * $sat->deep_arg->t; |
|
849 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $sat->dps->ssg * $sat->deep_arg->t; |
|
850 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + $sat->dps->ssh * $sat->deep_arg->t; |
|
851 | - $sat->deep_arg->em = $sat->tle->eo + $sat->dps->sse * $sat->deep_arg->t; |
|
852 | - $sat->deep_arg->xinc = $sat->tle->xincl + $sat->dps->ssi * $sat->deep_arg->t; |
|
853 | - if ($sat->deep_arg->xinc < 0) { |
|
854 | - $sat->deep_arg->xinc = -$sat->deep_arg->xinc; |
|
855 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + Predict::pi; |
|
856 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf - Predict::pi; |
|
857 | - } |
|
858 | - if(~$sat->flags & self::RESONANCE_FLAG ) { |
|
859 | - return; |
|
860 | - } |
|
861 | - |
|
862 | - do { |
|
863 | - if ( ($sat->dps->atime == 0) || |
|
864 | - (($sat->deep_arg->t >= 0) && ($sat->dps->atime < 0)) || |
|
865 | - (($sat->deep_arg->t < 0) && ($sat->dps->atime >= 0)) ) { |
|
866 | - /* Epoch restart */ |
|
867 | - if ($sat->deep_arg->t >= 0) { |
|
868 | - $delt = $sat->dps->stepp; |
|
869 | - } else { |
|
870 | - $delt = $sat->dps->stepn; |
|
871 | - } |
|
872 | - |
|
873 | - $sat->dps->atime = 0; |
|
874 | - $sat->dps->xni = $sat->dps->xnq; |
|
875 | - $sat->dps->xli = $sat->dps->xlamo; |
|
876 | - } else { |
|
877 | - if (abs($sat->deep_arg->t) >= abs($sat->dps->atime)) { |
|
878 | - if ($sat->deep_arg->t > 0) { |
|
879 | - $delt = $sat->dps->stepp; |
|
880 | - } else { |
|
881 | - $delt = $sat->dps->stepn; |
|
882 | - } |
|
883 | - } |
|
884 | - } |
|
885 | - |
|
886 | - do { |
|
887 | - if (abs($sat->deep_arg->t - $sat->dps->atime) >= $sat->dps->stepp) { |
|
888 | - $sat->flags |= self::DO_LOOP_FLAG; |
|
889 | - $sat->flags &= ~self::EPOCH_RESTART_FLAG; |
|
890 | - } |
|
891 | - else { |
|
892 | - $ft = $sat->deep_arg->t - $sat->dps->atime; |
|
893 | - $sat->flags &= ~self::DO_LOOP_FLAG; |
|
894 | - } |
|
895 | - |
|
896 | - if (abs($sat->deep_arg->t) < abs($sat->dps->atime)) { |
|
897 | - if ($sat->deep_arg->t >= 0) { |
|
898 | - $delt = $sat->dps->stepn; |
|
899 | - } else { |
|
900 | - $delt = $sat->dps->stepp; |
|
901 | - } |
|
902 | - $sat->flags |= (self::DO_LOOP_FLAG | self::EPOCH_RESTART_FLAG); |
|
903 | - } |
|
904 | - |
|
905 | - /* Dot terms calculated */ |
|
906 | - if ($sat->flags & self::SYNCHRONOUS_FLAG) { |
|
907 | - $xndot = $sat->dps->del1 * sin($sat->dps->xli - $sat->dps->fasx2) + $sat->dps->del2 * sin(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
908 | - + $sat->dps->del3 * sin(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
909 | - $xnddt = $sat->dps->del1 * cos($sat->dps->xli - $sat->dps->fasx2) + 2 * $sat->dps->del2 * cos(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
910 | - + 3 * $sat->dps->del3 * cos(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
911 | - } else { |
|
912 | - $xomi = $sat->dps->omegaq + $sat->deep_arg->omgdot * $sat->dps->atime; |
|
913 | - $x2omi = $xomi + $xomi; |
|
914 | - $x2li = $sat->dps->xli + $sat->dps->xli; |
|
915 | - $xndot = $sat->dps->d2201 * sin($x2omi + $sat->dps->xli - Predict::g22) |
|
916 | - + $sat->dps->d2211 * sin($sat->dps->xli - Predict::g22) |
|
917 | - + $sat->dps->d3210 * sin($xomi + $sat->dps->xli - Predict::g32) |
|
918 | - + $sat->dps->d3222 * sin(-$xomi + $sat->dps->xli - Predict::g32) |
|
919 | - + $sat->dps->d4410 * sin($x2omi + $x2li- Predict::g44) |
|
920 | - + $sat->dps->d4422 * sin($x2li- Predict::g44) |
|
921 | - + $sat->dps->d5220 * sin($xomi + $sat->dps->xli- Predict::g52) |
|
922 | - + $sat->dps->d5232 * sin(-$xomi + $sat->dps->xli- Predict::g52) |
|
923 | - + $sat->dps->d5421 * sin($xomi + $x2li - Predict::g54) |
|
924 | - + $sat->dps->d5433 * sin(-$xomi + $x2li - Predict::g54); |
|
925 | - $xnddt = $sat->dps->d2201 * cos($x2omi + $sat->dps->xli- Predict::g22) |
|
926 | - + $sat->dps->d2211 * cos($sat->dps->xli - Predict::g22) |
|
927 | - + $sat->dps->d3210 * cos($xomi + $sat->dps->xli - Predict::g32) |
|
928 | - + $sat->dps->d3222 * cos(-$xomi + $sat->dps->xli - Predict::g32) |
|
929 | - + $sat->dps->d5220 * cos($xomi + $sat->dps->xli - Predict::g52) |
|
930 | - + $sat->dps->d5232 * cos(-$xomi + $sat->dps->xli - Predict::g52) |
|
931 | - + 2 * ($sat->dps->d4410 * cos($x2omi + $x2li - Predict::g44) |
|
932 | - + $sat->dps->d4422 * cos($x2li - Predict::g44) |
|
933 | - + $sat->dps->d5421 * cos($xomi + $x2li - Predict::g54) |
|
934 | - + $sat->dps->d5433 * cos(-$xomi + $x2li - Predict::g54)); |
|
935 | - } /* End of if (isFlagSet(SYNCHRONOUS_FLAG)) */ |
|
936 | - |
|
937 | - $xldot = $sat->dps->xni + $sat->dps->xfact; |
|
938 | - $xnddt = $xnddt * $xldot; |
|
939 | - |
|
940 | - if ($sat->flags & self::DO_LOOP_FLAG) { |
|
941 | - $sat->dps->xli = $sat->dps->xli + $xldot * $delt + $xndot * $sat->dps->step2; |
|
942 | - $sat->dps->xni = $sat->dps->xni + $xndot * $delt + $xnddt * $sat->dps->step2; |
|
943 | - $sat->dps->atime = $sat->dps->atime + $delt; |
|
944 | - } |
|
945 | - } while (($sat->flags & self::DO_LOOP_FLAG) && |
|
946 | - (~$sat->flags & self::EPOCH_RESTART_FLAG)); |
|
947 | - } |
|
948 | - while (($sat->flags & self::DO_LOOP_FLAG) && ($sat->flags & self::EPOCH_RESTART_FLAG)); |
|
949 | - |
|
950 | - $sat->deep_arg->xn = $sat->dps->xni + $xndot * $ft + $xnddt * $ft * $ft * 0.5; |
|
951 | - $xl = $sat->dps->xli + $xldot * $ft + $xndot * $ft * $ft * 0.5; |
|
952 | - $temp = -$sat->deep_arg->xnode + $sat->dps->thgr + $sat->deep_arg->t * Predict::thdt; |
|
953 | - |
|
954 | - if (~$sat->flags & self::SYNCHRONOUS_FLAG) { |
|
955 | - $sat->deep_arg->xll = $xl + $temp + $temp; |
|
956 | - } else { |
|
957 | - $sat->deep_arg->xll = $xl - $sat->deep_arg->omgadf + $temp; |
|
958 | - } |
|
959 | - |
|
960 | - return; |
|
961 | - /* End case dpsec: */ |
|
962 | - |
|
963 | - case self::dpper: /* Entrance for lunar-solar periodics */ |
|
964 | - $sinis = sin($sat->deep_arg->xinc); |
|
965 | - $cosis = cos($sat->deep_arg->xinc); |
|
966 | - if (abs($sat->dps->savtsn - $sat->deep_arg->t) >= 30) { |
|
967 | - $sat->dps->savtsn = $sat->deep_arg->t; |
|
968 | - $zm = $sat->dps->zmos + Predict::zns * $sat->deep_arg->t; |
|
969 | - $zf = $zm + 2 * Predict::zes * sin($zm); |
|
970 | - $sinzf = sin($zf); |
|
971 | - $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
972 | - $f3 = -0.5 * $sinzf * cos($zf); |
|
973 | - $ses = $sat->dps->se2 * $f2 + $sat->dps->se3 * $f3; |
|
974 | - $sis = $sat->dps->si2 * $f2 + $sat->dps->si3 * $f3; |
|
975 | - $sls = $sat->dps->sl2 * $f2 + $sat->dps->sl3 * $f3 + $sat->dps->sl4 * $sinzf; |
|
976 | - $sat->dps->sghs = $sat->dps->sgh2 * $f2 + $sat->dps->sgh3 * $f3 + $sat->dps->sgh4 * $sinzf; |
|
977 | - $sat->dps->shs = $sat->dps->sh2 * $f2 + $sat->dps->sh3 * $f3; |
|
978 | - $zm = $sat->dps->zmol + Predict::znl * $sat->deep_arg->t; |
|
979 | - $zf = $zm + 2 * Predict::zel * sin($zm); |
|
980 | - $sinzf = sin($zf); |
|
981 | - $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
982 | - $f3 = -0.5 * $sinzf * cos($zf); |
|
983 | - $sel = $sat->dps->ee2 * $f2 + $sat->dps->e3 * $f3; |
|
984 | - $sil = $sat->dps->xi2 * $f2 + $sat->dps->xi3 * $f3; |
|
985 | - $sll = $sat->dps->xl2 * $f2 + $sat->dps->xl3 * $f3 + $sat->dps->xl4 * $sinzf; |
|
986 | - $sat->dps->sghl = $sat->dps->xgh2 * $f2 + $sat->dps->xgh3 * $f3 + $sat->dps->xgh4 * $sinzf; |
|
987 | - $sat->dps->sh1 = $sat->dps->xh2 * $f2 + $sat->dps->xh3 * $f3; |
|
988 | - $sat->dps->pe = $ses + $sel; |
|
989 | - $sat->dps->pinc = $sis + $sil; |
|
990 | - $sat->dps->pl = $sls + $sll; |
|
991 | - } |
|
992 | - |
|
993 | - $pgh = $sat->dps->sghs + $sat->dps->sghl; |
|
994 | - $ph = $sat->dps->shs + $sat->dps->sh1; |
|
995 | - $sat->deep_arg->xinc = $sat->deep_arg->xinc + $sat->dps->pinc; |
|
996 | - $sat->deep_arg->em = $sat->deep_arg->em + $sat->dps->pe; |
|
997 | - |
|
998 | - if ($sat->dps->xqncl >= 0.2) { |
|
999 | - /* Apply periodics directly */ |
|
1000 | - $ph = $ph / $sat->deep_arg->sinio; |
|
1001 | - $pgh = $pgh - $sat->deep_arg->cosio * $ph; |
|
1002 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $pgh; |
|
1003 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + $ph; |
|
1004 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
|
1005 | - } else { |
|
1006 | - /* Apply periodics with Lyddane modification */ |
|
1007 | - $sinok = sin($sat->deep_arg->xnode); |
|
1008 | - $cosok = cos($sat->deep_arg->xnode); |
|
1009 | - $alfdp = $sinis * $sinok; |
|
1010 | - $betdp = $sinis * $cosok; |
|
1011 | - $dalf = $ph * $cosok + $sat->dps->pinc * $cosis * $sinok; |
|
1012 | - $dbet = -$ph * $sinok + $sat->dps->pinc * $cosis * $cosok; |
|
1013 | - $alfdp = $alfdp + $dalf; |
|
1014 | - $betdp = $betdp + $dbet; |
|
1015 | - $sat->deep_arg->xnode = Predict_Math::FMod2p($sat->deep_arg->xnode); |
|
1016 | - $xls = $sat->deep_arg->xll + $sat->deep_arg->omgadf + $cosis * $sat->deep_arg->xnode; |
|
1017 | - $dls = $sat->dps->pl + $pgh - $sat->dps->pinc * $sat->deep_arg->xnode * $sinis; |
|
1018 | - $xls = $xls + $dls; |
|
1019 | - $xnoh = $sat->deep_arg->xnode; |
|
1020 | - $sat->deep_arg->xnode = Predict_Math::AcTan($alfdp, $betdp); |
|
1021 | - |
|
1022 | - /* This is a patch to Lyddane modification */ |
|
1023 | - /* suggested by Rob Matson. */ |
|
1024 | - if(abs($xnoh - $sat->deep_arg->xnode) > Predict::pi) { |
|
1025 | - if ($sat->deep_arg->xnode < $xnoh) { |
|
1026 | - $sat->deep_arg->xnode += Predict::twopi; |
|
1027 | - } else { |
|
1028 | - $sat->deep_arg->xnode -= Predict::twopi; |
|
1029 | - } |
|
1030 | - } |
|
1031 | - |
|
1032 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
|
1033 | - $sat->deep_arg->omgadf = $xls - $sat->deep_arg->xll - cos($sat->deep_arg->xinc) * |
|
1034 | - $sat->deep_arg->xnode; |
|
1035 | - } /* End case dpper: */ |
|
1036 | - return; |
|
544 | + case self::dpinit : /* Entrance for deep space initialization */ |
|
545 | + $sat->dps->thgr = Predict_Time::ThetaG($sat->tle->epoch, $sat->deep_arg); |
|
546 | + $eq = $sat->tle->eo; |
|
547 | + $sat->dps->xnq = $sat->deep_arg->xnodp; |
|
548 | + $aqnv = 1.0 / $sat->deep_arg->aodp; |
|
549 | + $sat->dps->xqncl = $sat->tle->xincl; |
|
550 | + $xmao = $sat->tle->xmo; |
|
551 | + $xpidot = $sat->deep_arg->omgdot + $sat->deep_arg->xnodot; |
|
552 | + $sinq = sin($sat->tle->xnodeo); |
|
553 | + $cosq = cos($sat->tle->xnodeo); |
|
554 | + $sat->dps->omegaq = $sat->tle->omegao; |
|
555 | + $sat->dps->preep = 0; |
|
556 | + |
|
557 | + /* Initialize lunar solar terms */ |
|
558 | + $day = $sat->deep_arg->ds50 + 18261.5; /* Days since 1900 Jan 0.5 */ |
|
559 | + if ($day != $sat->dps->preep) { |
|
560 | + $sat->dps->preep = $day; |
|
561 | + $xnodce = 4.5236020 - 9.2422029E-4 * $day; |
|
562 | + $stem = sin($xnodce); |
|
563 | + $ctem = cos($xnodce); |
|
564 | + $sat->dps->zcosil = 0.91375164 - 0.03568096 * $ctem; |
|
565 | + $sat->dps->zsinil = sqrt(1.0 - $sat->dps->zcosil * $sat->dps->zcosil); |
|
566 | + $sat->dps->zsinhl = 0.089683511 * $stem / $sat->dps->zsinil; |
|
567 | + $sat->dps->zcoshl = sqrt(1.0 - $sat->dps->zsinhl * $sat->dps->zsinhl); |
|
568 | + $c = 4.7199672 + 0.22997150 * $day; |
|
569 | + $gam = 5.8351514 + 0.0019443680 * $day; |
|
570 | + $sat->dps->zmol = Predict_Math::FMod2p($c - $gam); |
|
571 | + $zx = 0.39785416 * $stem / $sat->dps->zsinil; |
|
572 | + $zy = $sat->dps->zcoshl * $ctem + 0.91744867 * $sat->dps->zsinhl * $stem; |
|
573 | + $zx = Predict_Math::AcTan($zx, $zy); |
|
574 | + $zx = $gam + $zx - $xnodce; |
|
575 | + $sat->dps->zcosgl = cos($zx); |
|
576 | + $sat->dps->zsingl = sin($zx); |
|
577 | + $sat->dps->zmos = 6.2565837 + 0.017201977 * $day; |
|
578 | + $sat->dps->zmos = Predict_Math::FMod2p($sat->dps->zmos); |
|
579 | + } /* End if(day != preep) */ |
|
580 | + |
|
581 | + /* Do solar terms */ |
|
582 | + $sat->dps->savtsn = 1E20; |
|
583 | + $zcosg = Predict::zcosgs; |
|
584 | + $zsing = Predict::zsings; |
|
585 | + $zcosi = Predict::zcosis; |
|
586 | + $zsini = Predict::zsinis; |
|
587 | + $zcosh = $cosq; |
|
588 | + $zsinh = $sinq; |
|
589 | + $cc = Predict::c1ss; |
|
590 | + $zn = Predict::zns; |
|
591 | + $ze = Predict::zes; |
|
592 | + $zmo = $sat->dps->zmos; |
|
593 | + $xnoi = 1.0 / $sat->dps->xnq; |
|
594 | + |
|
595 | + /* Loop breaks when Solar terms are done a second */ |
|
596 | + /* time, after Lunar terms are initialized */ |
|
597 | + for(;;) { |
|
598 | + /* Solar terms done again after Lunar terms are done */ |
|
599 | + $a1 = $zcosg * $zcosh + $zsing * $zcosi * $zsinh; |
|
600 | + $a3 = -$zsing * $zcosh + $zcosg * $zcosi * $zsinh; |
|
601 | + $a7 = -$zcosg * $zsinh + $zsing * $zcosi * $zcosh; |
|
602 | + $a8 = $zsing * $zsini; |
|
603 | + $a9 = $zsing * $zsinh + $zcosg * $zcosi * $zcosh; |
|
604 | + $a10 = $zcosg * $zsini; |
|
605 | + $a2 = $sat->deep_arg->cosio * $a7 + $sat->deep_arg->sinio * $a8; |
|
606 | + $a4 = $sat->deep_arg->cosio * $a9 + $sat->deep_arg->sinio * $a10; |
|
607 | + $a5 = -$sat->deep_arg->sinio * $a7 + $sat->deep_arg->cosio * $a8; |
|
608 | + $a6 = -$sat->deep_arg->sinio * $a9 + $sat->deep_arg->cosio * $a10; |
|
609 | + $x1 = $a1 * $sat->deep_arg->cosg + $a2 * $sat->deep_arg->sing; |
|
610 | + $x2 = $a3 * $sat->deep_arg->cosg + $a4 * $sat->deep_arg->sing; |
|
611 | + $x3 = -$a1 * $sat->deep_arg->sing + $a2 * $sat->deep_arg->cosg; |
|
612 | + $x4 = -$a3 * $sat->deep_arg->sing + $a4 * $sat->deep_arg->cosg; |
|
613 | + $x5 = $a5 * $sat->deep_arg->sing; |
|
614 | + $x6 = $a6 * $sat->deep_arg->sing; |
|
615 | + $x7 = $a5 * $sat->deep_arg->cosg; |
|
616 | + $x8 = $a6 * $sat->deep_arg->cosg; |
|
617 | + $z31 = 12 * $x1 * $x1 - 3 * $x3 * $x3; |
|
618 | + $z32 = 24 * $x1 * $x2 - 6 * $x3 * $x4; |
|
619 | + $z33 = 12 * $x2 * $x2 - 3 * $x4 * $x4; |
|
620 | + $z1 = 3 * ($a1 * $a1 + $a2 * $a2) + $z31 * $sat->deep_arg->eosq; |
|
621 | + $z2 = 6 * ($a1 * $a3 + $a2 * $a4) + $z32 * $sat->deep_arg->eosq; |
|
622 | + $z3 = 3 * ($a3 * $a3 + $a4 * $a4) + $z33 * $sat->deep_arg->eosq; |
|
623 | + $z11 = -6 * $a1 * $a5 + $sat->deep_arg->eosq * (-24 * $x1 * $x7 - 6 * $x3 * $x5); |
|
624 | + $z12 = -6 * ($a1 * $a6 + $a3 * $a5) + $sat->deep_arg->eosq * |
|
625 | + (-24 * ($x2 * $x7 + $x1 * $x8) - 6 * ($x3 * $x6 + $x4 * $x5)); |
|
626 | + $z13 = -6 * $a3 * $a6 + $sat->deep_arg->eosq * (-24 * $x2 * $x8 - 6 * $x4 * $x6); |
|
627 | + $z21 = 6 * $a2 * $a5 + $sat->deep_arg->eosq * (24 * $x1 * $x5 - 6 * $x3 * $x7); |
|
628 | + $z22 = 6 * ($a4 * $a5 + $a2 * $a6) + $sat->deep_arg->eosq * |
|
629 | + (24 * ($x2 * $x5 + $x1 * $x6) - 6 * ($x4 * $x7 + $x3 * $x8)); |
|
630 | + $z23 = 6 * $a4 * $a6 + $sat->deep_arg->eosq * (24 * $x2 * $x6 - 6 * $x4 * $x8); |
|
631 | + $z1 = $z1 + $z1 + $sat->deep_arg->betao2 * $z31; |
|
632 | + $z2 = $z2 + $z2 + $sat->deep_arg->betao2 * $z32; |
|
633 | + $z3 = $z3 + $z3 + $sat->deep_arg->betao2 * $z33; |
|
634 | + $s3 = $cc * $xnoi; |
|
635 | + $s2 = -0.5 * $s3 / $sat->deep_arg->betao; |
|
636 | + $s4 = $s3 * $sat->deep_arg->betao; |
|
637 | + $s1 = -15 * $eq * $s4; |
|
638 | + $s5 = $x1 * $x3 + $x2 * $x4; |
|
639 | + $s6 = $x2 * $x3 + $x1 * $x4; |
|
640 | + $s7 = $x2 * $x4 - $x1 * $x3; |
|
641 | + $se = $s1 * $zn * $s5; |
|
642 | + $si = $s2 * $zn * ($z11 + $z13); |
|
643 | + $sl = -$zn * $s3 * ($z1 + $z3 - 14 - 6 * $sat->deep_arg->eosq); |
|
644 | + $sgh = $s4 * $zn * ($z31 + $z33 - 6); |
|
645 | + $sh = -$zn * $s2 * ($z21 + $z23); |
|
646 | + if ($sat->dps->xqncl < 5.2359877E-2) { |
|
647 | + $sh = 0; |
|
648 | + } |
|
649 | + $sat->dps->ee2 = 2 * $s1 * $s6; |
|
650 | + $sat->dps->e3 = 2 * $s1 * $s7; |
|
651 | + $sat->dps->xi2 = 2 * $s2 * $z12; |
|
652 | + $sat->dps->xi3 = 2 * $s2 * ($z13 - $z11); |
|
653 | + $sat->dps->xl2 = -2 * $s3 * $z2; |
|
654 | + $sat->dps->xl3 = -2 * $s3 * ($z3 - $z1); |
|
655 | + $sat->dps->xl4 = -2 * $s3 * (-21 - 9 * $sat->deep_arg->eosq) * $ze; |
|
656 | + $sat->dps->xgh2 = 2 * $s4 * $z32; |
|
657 | + $sat->dps->xgh3 = 2 * $s4 * ($z33 - $z31); |
|
658 | + $sat->dps->xgh4 = -18 * $s4 * $ze; |
|
659 | + $sat->dps->xh2 = -2 * $s2 * $z22; |
|
660 | + $sat->dps->xh3 = -2 * $s2 * ($z23 - $z21); |
|
661 | + |
|
662 | + if ($sat->flags & self::LUNAR_TERMS_DONE_FLAG) { |
|
663 | + break; |
|
664 | + } |
|
665 | + |
|
666 | + /* Do lunar terms */ |
|
667 | + $sat->dps->sse = $se; |
|
668 | + $sat->dps->ssi = $si; |
|
669 | + $sat->dps->ssl = $sl; |
|
670 | + $sat->dps->ssh = $sh / $sat->deep_arg->sinio; |
|
671 | + $sat->dps->ssg = $sgh - $sat->deep_arg->cosio * $sat->dps->ssh; |
|
672 | + $sat->dps->se2 = $sat->dps->ee2; |
|
673 | + $sat->dps->si2 = $sat->dps->xi2; |
|
674 | + $sat->dps->sl2 = $sat->dps->xl2; |
|
675 | + $sat->dps->sgh2 = $sat->dps->xgh2; |
|
676 | + $sat->dps->sh2 = $sat->dps->xh2; |
|
677 | + $sat->dps->se3 = $sat->dps->e3; |
|
678 | + $sat->dps->si3 = $sat->dps->xi3; |
|
679 | + $sat->dps->sl3 = $sat->dps->xl3; |
|
680 | + $sat->dps->sgh3 = $sat->dps->xgh3; |
|
681 | + $sat->dps->sh3 = $sat->dps->xh3; |
|
682 | + $sat->dps->sl4 = $sat->dps->xl4; |
|
683 | + $sat->dps->sgh4 = $sat->dps->xgh4; |
|
684 | + $zcosg = $sat->dps->zcosgl; |
|
685 | + $zsing = $sat->dps->zsingl; |
|
686 | + $zcosi = $sat->dps->zcosil; |
|
687 | + $zsini = $sat->dps->zsinil; |
|
688 | + $zcosh = $sat->dps->zcoshl * $cosq + $sat->dps->zsinhl * $sinq; |
|
689 | + $zsinh = $sinq * $sat->dps->zcoshl - $cosq * $sat->dps->zsinhl; |
|
690 | + $zn = Predict::znl; |
|
691 | + $cc = Predict::c1l; |
|
692 | + $ze = Predict::zel; |
|
693 | + $zmo = $sat->dps->zmol; |
|
694 | + $sat->flags |= self::LUNAR_TERMS_DONE_FLAG; |
|
695 | + } /* End of for(;;) */ |
|
696 | + |
|
697 | + $sat->dps->sse = $sat->dps->sse + $se; |
|
698 | + $sat->dps->ssi = $sat->dps->ssi + $si; |
|
699 | + $sat->dps->ssl = $sat->dps->ssl + $sl; |
|
700 | + $sat->dps->ssg = $sat->dps->ssg + $sgh - $sat->deep_arg->cosio / $sat->deep_arg->sinio * $sh; |
|
701 | + $sat->dps->ssh = $sat->dps->ssh + $sh / $sat->deep_arg->sinio; |
|
702 | + |
|
703 | + /* Geopotential resonance initialization for 12 hour orbits */ |
|
704 | + $sat->flags &= ~self::RESONANCE_FLAG; |
|
705 | + $sat->flags &= ~self::SYNCHRONOUS_FLAG; |
|
706 | + |
|
707 | + if (!(($sat->dps->xnq < 0.0052359877) && ($sat->dps->xnq > 0.0034906585))) { |
|
708 | + if( ($sat->dps->xnq < 0.00826) || ($sat->dps->xnq > 0.00924) ) { |
|
709 | + return; |
|
710 | + } |
|
711 | + if ($eq < 0.5) { |
|
712 | + return; |
|
713 | + } |
|
714 | + $sat->flags |= self::RESONANCE_FLAG; |
|
715 | + $eoc = $eq * $sat->deep_arg->eosq; |
|
716 | + $g201 = -0.306 - ($eq - 0.64) * 0.440; |
|
717 | + if ($eq <= 0.65) { |
|
718 | + $g211 = 3.616 - 13.247 * $eq + 16.290 * $sat->deep_arg->eosq; |
|
719 | + $g310 = -19.302 + 117.390 * $eq - 228.419 * |
|
720 | + $sat->deep_arg->eosq + 156.591 * $eoc; |
|
721 | + $g322 = -18.9068 + 109.7927 * $eq - 214.6334 * |
|
722 | + $sat->deep_arg->eosq + 146.5816 * $eoc; |
|
723 | + $g410 = -41.122 + 242.694 * $eq - 471.094 * |
|
724 | + $sat->deep_arg->eosq + 313.953 * $eoc; |
|
725 | + $g422 = -146.407 + 841.880 * $eq - 1629.014 * |
|
726 | + $sat->deep_arg->eosq + 1083.435 * $eoc; |
|
727 | + $g520 = -532.114 + 3017.977 * $eq - 5740 * |
|
728 | + $sat->deep_arg->eosq + 3708.276 * $eoc; |
|
729 | + } else { |
|
730 | + $g211 = -72.099 + 331.819 * $eq - 508.738 * |
|
731 | + $sat->deep_arg->eosq + 266.724 * $eoc; |
|
732 | + $g310 = -346.844 + 1582.851 * $eq - 2415.925 * |
|
733 | + $sat->deep_arg->eosq + 1246.113 * $eoc; |
|
734 | + $g322 = -342.585 + 1554.908 * $eq - 2366.899 * |
|
735 | + $sat->deep_arg->eosq + 1215.972 * $eoc; |
|
736 | + $g410 = -1052.797 + 4758.686 * $eq - 7193.992 * |
|
737 | + $sat->deep_arg->eosq + 3651.957 * $eoc; |
|
738 | + $g422 = -3581.69 + 16178.11 * $eq - 24462.77 * |
|
739 | + $sat->deep_arg->eosq+ 12422.52 * $eoc; |
|
740 | + if ($eq <= 0.715) { |
|
741 | + $g520 = 1464.74 - 4664.75 * $eq + 3763.64 * $sat->deep_arg->eosq; |
|
742 | + } else { |
|
743 | + $g520 = -5149.66 + 29936.92 * $eq - 54087.36 * |
|
744 | + $sat->deep_arg->eosq + 31324.56 * $eoc; |
|
745 | + } |
|
746 | + } /* End if (eq <= 0.65) */ |
|
747 | + |
|
748 | + if ($eq < 0.7) { |
|
749 | + $g533 = -919.2277 + 4988.61 * $eq - 9064.77 * |
|
750 | + $sat->deep_arg->eosq + 5542.21 * $eoc; |
|
751 | + $g521 = -822.71072 + 4568.6173 * $eq - 8491.4146 * |
|
752 | + $sat->deep_arg->eosq + 5337.524 * $eoc; |
|
753 | + $g532 = -853.666 + 4690.25 * $eq - 8624.77 * |
|
754 | + $sat->deep_arg->eosq + 5341.4 * $eoc; |
|
755 | + } |
|
756 | + else { |
|
757 | + $g533 = -37995.78 + 161616.52 * $eq - 229838.2* |
|
758 | + $sat->deep_arg->eosq + 109377.94 * $eoc; |
|
759 | + $g521 = -51752.104 + 218913.95 * $eq - 309468.16* |
|
760 | + $sat->deep_arg->eosq + 146349.42 * $eoc; |
|
761 | + $g532 = -40023.88 + 170470.89 * $eq - 242699.48* |
|
762 | + $sat->deep_arg->eosq + 115605.82 * $eoc; |
|
763 | + } /* End if (eq <= 0.7) */ |
|
764 | + |
|
765 | + $sini2 = $sat->deep_arg->sinio * $sat->deep_arg->sinio; |
|
766 | + $f220 = 0.75 * (1 + 2 * $sat->deep_arg->cosio + $sat->deep_arg->theta2); |
|
767 | + $f221 = 1.5 * $sini2; |
|
768 | + $f321 = 1.875 * $sat->deep_arg->sinio * (1 - 2 * |
|
769 | + $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
770 | + $f322 = -1.875 * $sat->deep_arg->sinio * (1 + 2* |
|
771 | + $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
772 | + $f441 = 35 * $sini2 * $f220; |
|
773 | + $f442 = 39.3750 * $sini2 * $sini2; |
|
774 | + $f522 = 9.84375 * $sat->deep_arg->sinio * ($sini2 * (1 - 2 * $sat->deep_arg->cosio - 5 * |
|
775 | + $sat->deep_arg->theta2) + 0.33333333 * (-2 + 4 * $sat->deep_arg->cosio + |
|
776 | + 6 * $sat->deep_arg->theta2)); |
|
777 | + $f523 = $sat->deep_arg->sinio * (4.92187512 * $sini2 * (-2 - 4 * |
|
778 | + $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2) + 6.56250012 |
|
779 | + * (1 + 2 * $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2)); |
|
780 | + $f542 = 29.53125 * $sat->deep_arg->sinio * (2 - 8 * |
|
781 | + $sat->deep_arg->cosio + $sat->deep_arg->theta2 * |
|
782 | + (-12 + 8 * $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2)); |
|
783 | + $f543 = 29.53125 * $sat->deep_arg->sinio * (-2 - 8 * $sat->deep_arg->cosio + |
|
784 | + $sat->deep_arg->theta2 * (12 + 8 * $sat->deep_arg->cosio - 10 * |
|
785 | + $sat->deep_arg->theta2)); |
|
786 | + $xno2 = $sat->dps->xnq * $sat->dps->xnq; |
|
787 | + $ainv2 = $aqnv * $aqnv; |
|
788 | + $temp1 = 3 * $xno2 * $ainv2; |
|
789 | + $temp = $temp1 * Predict::root22; |
|
790 | + $sat->dps->d2201 = $temp * $f220 * $g201; |
|
791 | + $sat->dps->d2211 = $temp * $f221 * $g211; |
|
792 | + $temp1 = $temp1 * $aqnv; |
|
793 | + $temp = $temp1 * Predict::root32; |
|
794 | + $sat->dps->d3210 = $temp * $f321 * $g310; |
|
795 | + $sat->dps->d3222 = $temp * $f322 * $g322; |
|
796 | + $temp1 = $temp1 * $aqnv; |
|
797 | + $temp = 2 * $temp1 * Predict::root44; |
|
798 | + $sat->dps->d4410 = $temp * $f441 * $g410; |
|
799 | + $sat->dps->d4422 = $temp * $f442 * $g422; |
|
800 | + $temp1 = $temp1 * $aqnv; |
|
801 | + $temp = $temp1 * Predict::root52; |
|
802 | + $sat->dps->d5220 = $temp * $f522 * $g520; |
|
803 | + $sat->dps->d5232 = $temp * $f523 * $g532; |
|
804 | + $temp = 2 * $temp1 * Predict::root54; |
|
805 | + $sat->dps->d5421 = $temp * $f542 * $g521; |
|
806 | + $sat->dps->d5433 = $temp * $f543 * $g533; |
|
807 | + $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->xnodeo - $sat->dps->thgr - $sat->dps->thgr; |
|
808 | + $bfact = $sat->deep_arg->xmdot + $sat->deep_arg->xnodot + |
|
809 | + $sat->deep_arg->xnodot - Predict::thdt - Predict::thdt; |
|
810 | + $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssh + $sat->dps->ssh; |
|
811 | + } else { |
|
812 | + $sat->flags |= self::RESONANCE_FLAG; |
|
813 | + $sat->flags |= self::SYNCHRONOUS_FLAG; |
|
814 | + /* Synchronous resonance terms initialization */ |
|
815 | + $g200 = 1 + $sat->deep_arg->eosq * (-2.5 + 0.8125 * $sat->deep_arg->eosq); |
|
816 | + $g310 = 1 + 2 * $sat->deep_arg->eosq; |
|
817 | + $g300 = 1 + $sat->deep_arg->eosq * (-6 + 6.60937 * $sat->deep_arg->eosq); |
|
818 | + $f220 = 0.75 * (1 + $sat->deep_arg->cosio) * (1 + $sat->deep_arg->cosio); |
|
819 | + $f311 = 0.9375 * $sat->deep_arg->sinio * $sat->deep_arg->sinio * |
|
820 | + (1 + 3 * $sat->deep_arg->cosio) - 0.75 * (1 + $sat->deep_arg->cosio); |
|
821 | + $f330 = 1 + $sat->deep_arg->cosio; |
|
822 | + $f330 = 1.875 * $f330 * $f330 * $f330; |
|
823 | + $sat->dps->del1 = 3 * $sat->dps->xnq * $sat->dps->xnq * $aqnv * $aqnv; |
|
824 | + $sat->dps->del2 = 2 * $sat->dps->del1 * $f220 * $g200 * Predict::q22; |
|
825 | + $sat->dps->del3 = 3 * $sat->dps->del1 * $f330 * $g300 * Predict::q33 * $aqnv; |
|
826 | + $sat->dps->del1 = $sat->dps->del1 * $f311 * $g310 * Predict::q31 * $aqnv; |
|
827 | + $sat->dps->fasx2 = 0.13130908; |
|
828 | + $sat->dps->fasx4 = 2.8843198; |
|
829 | + $sat->dps->fasx6 = 0.37448087; |
|
830 | + $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->omegao - $sat->dps->thgr; |
|
831 | + $bfact = $sat->deep_arg->xmdot + $xpidot - Predict::thdt; |
|
832 | + $bfact = $bfact + $sat->dps->ssl + $sat->dps->ssg + $sat->dps->ssh; |
|
833 | + } /* End if( !(xnq < 0.0052359877) && (xnq > 0.0034906585) ) */ |
|
834 | + |
|
835 | + $sat->dps->xfact = $bfact - $sat->dps->xnq; |
|
836 | + |
|
837 | + /* Initialize integrator */ |
|
838 | + $sat->dps->xli = $sat->dps->xlamo; |
|
839 | + $sat->dps->xni = $sat->dps->xnq; |
|
840 | + $sat->dps->atime = 0; |
|
841 | + $sat->dps->stepp = 720; |
|
842 | + $sat->dps->stepn = -720; |
|
843 | + $sat->dps->step2 = 259200; |
|
844 | + /* End case self::dpinit: */ |
|
845 | + return; |
|
846 | + |
|
847 | + case self::dpsec: /* Entrance for deep space secular effects */ |
|
848 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->ssl * $sat->deep_arg->t; |
|
849 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $sat->dps->ssg * $sat->deep_arg->t; |
|
850 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + $sat->dps->ssh * $sat->deep_arg->t; |
|
851 | + $sat->deep_arg->em = $sat->tle->eo + $sat->dps->sse * $sat->deep_arg->t; |
|
852 | + $sat->deep_arg->xinc = $sat->tle->xincl + $sat->dps->ssi * $sat->deep_arg->t; |
|
853 | + if ($sat->deep_arg->xinc < 0) { |
|
854 | + $sat->deep_arg->xinc = -$sat->deep_arg->xinc; |
|
855 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + Predict::pi; |
|
856 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf - Predict::pi; |
|
857 | + } |
|
858 | + if(~$sat->flags & self::RESONANCE_FLAG ) { |
|
859 | + return; |
|
860 | + } |
|
861 | + |
|
862 | + do { |
|
863 | + if ( ($sat->dps->atime == 0) || |
|
864 | + (($sat->deep_arg->t >= 0) && ($sat->dps->atime < 0)) || |
|
865 | + (($sat->deep_arg->t < 0) && ($sat->dps->atime >= 0)) ) { |
|
866 | + /* Epoch restart */ |
|
867 | + if ($sat->deep_arg->t >= 0) { |
|
868 | + $delt = $sat->dps->stepp; |
|
869 | + } else { |
|
870 | + $delt = $sat->dps->stepn; |
|
871 | + } |
|
872 | + |
|
873 | + $sat->dps->atime = 0; |
|
874 | + $sat->dps->xni = $sat->dps->xnq; |
|
875 | + $sat->dps->xli = $sat->dps->xlamo; |
|
876 | + } else { |
|
877 | + if (abs($sat->deep_arg->t) >= abs($sat->dps->atime)) { |
|
878 | + if ($sat->deep_arg->t > 0) { |
|
879 | + $delt = $sat->dps->stepp; |
|
880 | + } else { |
|
881 | + $delt = $sat->dps->stepn; |
|
882 | + } |
|
883 | + } |
|
884 | + } |
|
885 | + |
|
886 | + do { |
|
887 | + if (abs($sat->deep_arg->t - $sat->dps->atime) >= $sat->dps->stepp) { |
|
888 | + $sat->flags |= self::DO_LOOP_FLAG; |
|
889 | + $sat->flags &= ~self::EPOCH_RESTART_FLAG; |
|
890 | + } |
|
891 | + else { |
|
892 | + $ft = $sat->deep_arg->t - $sat->dps->atime; |
|
893 | + $sat->flags &= ~self::DO_LOOP_FLAG; |
|
894 | + } |
|
895 | + |
|
896 | + if (abs($sat->deep_arg->t) < abs($sat->dps->atime)) { |
|
897 | + if ($sat->deep_arg->t >= 0) { |
|
898 | + $delt = $sat->dps->stepn; |
|
899 | + } else { |
|
900 | + $delt = $sat->dps->stepp; |
|
901 | + } |
|
902 | + $sat->flags |= (self::DO_LOOP_FLAG | self::EPOCH_RESTART_FLAG); |
|
903 | + } |
|
904 | + |
|
905 | + /* Dot terms calculated */ |
|
906 | + if ($sat->flags & self::SYNCHRONOUS_FLAG) { |
|
907 | + $xndot = $sat->dps->del1 * sin($sat->dps->xli - $sat->dps->fasx2) + $sat->dps->del2 * sin(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
908 | + + $sat->dps->del3 * sin(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
909 | + $xnddt = $sat->dps->del1 * cos($sat->dps->xli - $sat->dps->fasx2) + 2 * $sat->dps->del2 * cos(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
910 | + + 3 * $sat->dps->del3 * cos(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
911 | + } else { |
|
912 | + $xomi = $sat->dps->omegaq + $sat->deep_arg->omgdot * $sat->dps->atime; |
|
913 | + $x2omi = $xomi + $xomi; |
|
914 | + $x2li = $sat->dps->xli + $sat->dps->xli; |
|
915 | + $xndot = $sat->dps->d2201 * sin($x2omi + $sat->dps->xli - Predict::g22) |
|
916 | + + $sat->dps->d2211 * sin($sat->dps->xli - Predict::g22) |
|
917 | + + $sat->dps->d3210 * sin($xomi + $sat->dps->xli - Predict::g32) |
|
918 | + + $sat->dps->d3222 * sin(-$xomi + $sat->dps->xli - Predict::g32) |
|
919 | + + $sat->dps->d4410 * sin($x2omi + $x2li- Predict::g44) |
|
920 | + + $sat->dps->d4422 * sin($x2li- Predict::g44) |
|
921 | + + $sat->dps->d5220 * sin($xomi + $sat->dps->xli- Predict::g52) |
|
922 | + + $sat->dps->d5232 * sin(-$xomi + $sat->dps->xli- Predict::g52) |
|
923 | + + $sat->dps->d5421 * sin($xomi + $x2li - Predict::g54) |
|
924 | + + $sat->dps->d5433 * sin(-$xomi + $x2li - Predict::g54); |
|
925 | + $xnddt = $sat->dps->d2201 * cos($x2omi + $sat->dps->xli- Predict::g22) |
|
926 | + + $sat->dps->d2211 * cos($sat->dps->xli - Predict::g22) |
|
927 | + + $sat->dps->d3210 * cos($xomi + $sat->dps->xli - Predict::g32) |
|
928 | + + $sat->dps->d3222 * cos(-$xomi + $sat->dps->xli - Predict::g32) |
|
929 | + + $sat->dps->d5220 * cos($xomi + $sat->dps->xli - Predict::g52) |
|
930 | + + $sat->dps->d5232 * cos(-$xomi + $sat->dps->xli - Predict::g52) |
|
931 | + + 2 * ($sat->dps->d4410 * cos($x2omi + $x2li - Predict::g44) |
|
932 | + + $sat->dps->d4422 * cos($x2li - Predict::g44) |
|
933 | + + $sat->dps->d5421 * cos($xomi + $x2li - Predict::g54) |
|
934 | + + $sat->dps->d5433 * cos(-$xomi + $x2li - Predict::g54)); |
|
935 | + } /* End of if (isFlagSet(SYNCHRONOUS_FLAG)) */ |
|
936 | + |
|
937 | + $xldot = $sat->dps->xni + $sat->dps->xfact; |
|
938 | + $xnddt = $xnddt * $xldot; |
|
939 | + |
|
940 | + if ($sat->flags & self::DO_LOOP_FLAG) { |
|
941 | + $sat->dps->xli = $sat->dps->xli + $xldot * $delt + $xndot * $sat->dps->step2; |
|
942 | + $sat->dps->xni = $sat->dps->xni + $xndot * $delt + $xnddt * $sat->dps->step2; |
|
943 | + $sat->dps->atime = $sat->dps->atime + $delt; |
|
944 | + } |
|
945 | + } while (($sat->flags & self::DO_LOOP_FLAG) && |
|
946 | + (~$sat->flags & self::EPOCH_RESTART_FLAG)); |
|
947 | + } |
|
948 | + while (($sat->flags & self::DO_LOOP_FLAG) && ($sat->flags & self::EPOCH_RESTART_FLAG)); |
|
949 | + |
|
950 | + $sat->deep_arg->xn = $sat->dps->xni + $xndot * $ft + $xnddt * $ft * $ft * 0.5; |
|
951 | + $xl = $sat->dps->xli + $xldot * $ft + $xndot * $ft * $ft * 0.5; |
|
952 | + $temp = -$sat->deep_arg->xnode + $sat->dps->thgr + $sat->deep_arg->t * Predict::thdt; |
|
953 | + |
|
954 | + if (~$sat->flags & self::SYNCHRONOUS_FLAG) { |
|
955 | + $sat->deep_arg->xll = $xl + $temp + $temp; |
|
956 | + } else { |
|
957 | + $sat->deep_arg->xll = $xl - $sat->deep_arg->omgadf + $temp; |
|
958 | + } |
|
959 | + |
|
960 | + return; |
|
961 | + /* End case dpsec: */ |
|
962 | + |
|
963 | + case self::dpper: /* Entrance for lunar-solar periodics */ |
|
964 | + $sinis = sin($sat->deep_arg->xinc); |
|
965 | + $cosis = cos($sat->deep_arg->xinc); |
|
966 | + if (abs($sat->dps->savtsn - $sat->deep_arg->t) >= 30) { |
|
967 | + $sat->dps->savtsn = $sat->deep_arg->t; |
|
968 | + $zm = $sat->dps->zmos + Predict::zns * $sat->deep_arg->t; |
|
969 | + $zf = $zm + 2 * Predict::zes * sin($zm); |
|
970 | + $sinzf = sin($zf); |
|
971 | + $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
972 | + $f3 = -0.5 * $sinzf * cos($zf); |
|
973 | + $ses = $sat->dps->se2 * $f2 + $sat->dps->se3 * $f3; |
|
974 | + $sis = $sat->dps->si2 * $f2 + $sat->dps->si3 * $f3; |
|
975 | + $sls = $sat->dps->sl2 * $f2 + $sat->dps->sl3 * $f3 + $sat->dps->sl4 * $sinzf; |
|
976 | + $sat->dps->sghs = $sat->dps->sgh2 * $f2 + $sat->dps->sgh3 * $f3 + $sat->dps->sgh4 * $sinzf; |
|
977 | + $sat->dps->shs = $sat->dps->sh2 * $f2 + $sat->dps->sh3 * $f3; |
|
978 | + $zm = $sat->dps->zmol + Predict::znl * $sat->deep_arg->t; |
|
979 | + $zf = $zm + 2 * Predict::zel * sin($zm); |
|
980 | + $sinzf = sin($zf); |
|
981 | + $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
982 | + $f3 = -0.5 * $sinzf * cos($zf); |
|
983 | + $sel = $sat->dps->ee2 * $f2 + $sat->dps->e3 * $f3; |
|
984 | + $sil = $sat->dps->xi2 * $f2 + $sat->dps->xi3 * $f3; |
|
985 | + $sll = $sat->dps->xl2 * $f2 + $sat->dps->xl3 * $f3 + $sat->dps->xl4 * $sinzf; |
|
986 | + $sat->dps->sghl = $sat->dps->xgh2 * $f2 + $sat->dps->xgh3 * $f3 + $sat->dps->xgh4 * $sinzf; |
|
987 | + $sat->dps->sh1 = $sat->dps->xh2 * $f2 + $sat->dps->xh3 * $f3; |
|
988 | + $sat->dps->pe = $ses + $sel; |
|
989 | + $sat->dps->pinc = $sis + $sil; |
|
990 | + $sat->dps->pl = $sls + $sll; |
|
991 | + } |
|
992 | + |
|
993 | + $pgh = $sat->dps->sghs + $sat->dps->sghl; |
|
994 | + $ph = $sat->dps->shs + $sat->dps->sh1; |
|
995 | + $sat->deep_arg->xinc = $sat->deep_arg->xinc + $sat->dps->pinc; |
|
996 | + $sat->deep_arg->em = $sat->deep_arg->em + $sat->dps->pe; |
|
997 | + |
|
998 | + if ($sat->dps->xqncl >= 0.2) { |
|
999 | + /* Apply periodics directly */ |
|
1000 | + $ph = $ph / $sat->deep_arg->sinio; |
|
1001 | + $pgh = $pgh - $sat->deep_arg->cosio * $ph; |
|
1002 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $pgh; |
|
1003 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + $ph; |
|
1004 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
|
1005 | + } else { |
|
1006 | + /* Apply periodics with Lyddane modification */ |
|
1007 | + $sinok = sin($sat->deep_arg->xnode); |
|
1008 | + $cosok = cos($sat->deep_arg->xnode); |
|
1009 | + $alfdp = $sinis * $sinok; |
|
1010 | + $betdp = $sinis * $cosok; |
|
1011 | + $dalf = $ph * $cosok + $sat->dps->pinc * $cosis * $sinok; |
|
1012 | + $dbet = -$ph * $sinok + $sat->dps->pinc * $cosis * $cosok; |
|
1013 | + $alfdp = $alfdp + $dalf; |
|
1014 | + $betdp = $betdp + $dbet; |
|
1015 | + $sat->deep_arg->xnode = Predict_Math::FMod2p($sat->deep_arg->xnode); |
|
1016 | + $xls = $sat->deep_arg->xll + $sat->deep_arg->omgadf + $cosis * $sat->deep_arg->xnode; |
|
1017 | + $dls = $sat->dps->pl + $pgh - $sat->dps->pinc * $sat->deep_arg->xnode * $sinis; |
|
1018 | + $xls = $xls + $dls; |
|
1019 | + $xnoh = $sat->deep_arg->xnode; |
|
1020 | + $sat->deep_arg->xnode = Predict_Math::AcTan($alfdp, $betdp); |
|
1021 | + |
|
1022 | + /* This is a patch to Lyddane modification */ |
|
1023 | + /* suggested by Rob Matson. */ |
|
1024 | + if(abs($xnoh - $sat->deep_arg->xnode) > Predict::pi) { |
|
1025 | + if ($sat->deep_arg->xnode < $xnoh) { |
|
1026 | + $sat->deep_arg->xnode += Predict::twopi; |
|
1027 | + } else { |
|
1028 | + $sat->deep_arg->xnode -= Predict::twopi; |
|
1029 | + } |
|
1030 | + } |
|
1031 | + |
|
1032 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
|
1033 | + $sat->deep_arg->omgadf = $xls - $sat->deep_arg->xll - cos($sat->deep_arg->xinc) * |
|
1034 | + $sat->deep_arg->xnode; |
|
1035 | + } /* End case dpper: */ |
|
1036 | + return; |
|
1037 | 1037 | |
1038 | 1038 | } /* End switch(ientry) */ |
1039 | 1039 |
@@ -752,8 +752,7 @@ discard block |
||
752 | 752 | $sat->deep_arg->eosq + 5337.524 * $eoc; |
753 | 753 | $g532 = -853.666 + 4690.25 * $eq - 8624.77 * |
754 | 754 | $sat->deep_arg->eosq + 5341.4 * $eoc; |
755 | - } |
|
756 | - else { |
|
755 | + } else { |
|
757 | 756 | $g533 = -37995.78 + 161616.52 * $eq - 229838.2* |
758 | 757 | $sat->deep_arg->eosq + 109377.94 * $eoc; |
759 | 758 | $g521 = -51752.104 + 218913.95 * $eq - 309468.16* |
@@ -887,8 +886,7 @@ discard block |
||
887 | 886 | if (abs($sat->deep_arg->t - $sat->dps->atime) >= $sat->dps->stepp) { |
888 | 887 | $sat->flags |= self::DO_LOOP_FLAG; |
889 | 888 | $sat->flags &= ~self::EPOCH_RESTART_FLAG; |
890 | - } |
|
891 | - else { |
|
889 | + } else { |
|
892 | 890 | $ft = $sat->deep_arg->t - $sat->dps->atime; |
893 | 891 | $sat->flags &= ~self::DO_LOOP_FLAG; |
894 | 892 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | |
43 | 43 | /* orbit_type_t struct */ |
44 | 44 | const ORBIT_TYPE_UNKNOWN = 0; |
45 | - const ORBIT_TYPE_LEO = 1; /*!< Low Earth orbit, up to 1200 km. */ |
|
46 | - const ORBIT_TYPE_ICO = 2; /*!< Intermediate Circular Orbit, up to 1400 km. */ |
|
47 | - const ORBIT_TYPE_GEO = 3; /*!< Geostationary. */ |
|
48 | - const ORBIT_TYPE_GSO = 4; /*!< Geosynchronuous. */ |
|
45 | + const ORBIT_TYPE_LEO = 1; /*!< Low Earth orbit, up to 1200 km. */ |
|
46 | + const ORBIT_TYPE_ICO = 2; /*!< Intermediate Circular Orbit, up to 1400 km. */ |
|
47 | + const ORBIT_TYPE_GEO = 3; /*!< Geostationary. */ |
|
48 | + const ORBIT_TYPE_GSO = 4; /*!< Geosynchronuous. */ |
|
49 | 49 | const ORBIT_TYPE_MOLNIYA = 5; |
50 | 50 | const ORBIT_TYPE_TUNDRA = 6; |
51 | 51 | const ORBIT_TYPE_POLAR = 7; |
@@ -75,24 +75,24 @@ discard block |
||
75 | 75 | |
76 | 76 | /* Recover original mean motion (xnodp) and */ |
77 | 77 | /* semimajor axis (aodp) from input elements. */ |
78 | - $a1 = pow(Predict::xke / $sat->tle->xno, Predict::tothrd); |
|
78 | + $a1 = pow(Predict::xke/$sat->tle->xno, Predict::tothrd); |
|
79 | 79 | $sat->sgps->cosio = cos($sat->tle->xincl); |
80 | - $theta2 = $sat->sgps->cosio * $sat->sgps->cosio; |
|
81 | - $sat->sgps->x3thm1 = 3 * $theta2 - 1.0; |
|
82 | - $eosq = $sat->tle->eo * $sat->tle->eo; |
|
80 | + $theta2 = $sat->sgps->cosio*$sat->sgps->cosio; |
|
81 | + $sat->sgps->x3thm1 = 3*$theta2 - 1.0; |
|
82 | + $eosq = $sat->tle->eo*$sat->tle->eo; |
|
83 | 83 | $betao2 = 1 - $eosq; |
84 | 84 | $betao = sqrt($betao2); |
85 | - $del1 = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / ($a1 * $a1 * $betao * $betao2); |
|
86 | - $ao = $a1 * (1 - $del1 * (0.5 * Predict::tothrd + $del1 * (1 + 134.0 / 81.0 * $del1))); |
|
87 | - $delo = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / ($ao * $ao * $betao * $betao2); |
|
88 | - $sat->sgps->xnodp = $sat->tle->xno / (1.0 + $delo); |
|
89 | - $sat->sgps->aodp = $ao / (1.0 - $delo); |
|
85 | + $del1 = 1.5*Predict::ck2*$sat->sgps->x3thm1/($a1*$a1*$betao*$betao2); |
|
86 | + $ao = $a1*(1 - $del1*(0.5*Predict::tothrd + $del1*(1 + 134.0/81.0*$del1))); |
|
87 | + $delo = 1.5*Predict::ck2*$sat->sgps->x3thm1/($ao*$ao*$betao*$betao2); |
|
88 | + $sat->sgps->xnodp = $sat->tle->xno/(1.0 + $delo); |
|
89 | + $sat->sgps->aodp = $ao/(1.0 - $delo); |
|
90 | 90 | |
91 | 91 | /* For perigee less than 220 kilometers, the "simple" flag is set */ |
92 | 92 | /* and the equations are truncated to linear variation in sqrt a */ |
93 | 93 | /* and quadratic variation in mean anomaly. Also, the c3 term, */ |
94 | 94 | /* the delta omega term, and the delta m term are dropped. */ |
95 | - if (($sat->sgps->aodp * (1.0 - $sat->tle->eo) / Predict::ae) < (220.0 / Predict::xkmper + Predict::ae)) { |
|
95 | + if (($sat->sgps->aodp*(1.0 - $sat->tle->eo)/Predict::ae) < (220.0/Predict::xkmper + Predict::ae)) { |
|
96 | 96 | $sat->flags |= self::SIMPLE_FLAG; |
97 | 97 | } else { |
98 | 98 | $sat->flags &= ~self::SIMPLE_FLAG; |
@@ -102,121 +102,121 @@ discard block |
||
102 | 102 | /* values of s and qoms2t are altered. */ |
103 | 103 | $s4 = Predict::__s__; |
104 | 104 | $qoms24 = Predict::qoms2t; |
105 | - $perige = ($sat->sgps->aodp * (1 - $sat->tle->eo) - Predict::ae) * Predict::xkmper; |
|
105 | + $perige = ($sat->sgps->aodp*(1 - $sat->tle->eo) - Predict::ae)*Predict::xkmper; |
|
106 | 106 | if ($perige < 156.0) { |
107 | 107 | if ($perige <= 98.0) { |
108 | 108 | $s4 = 20.0; |
109 | 109 | } else { |
110 | 110 | $s4 = $perige - 78.0; |
111 | 111 | } |
112 | - $qoms24 = pow((120.0 - $s4) * Predict::ae / Predict::xkmper, 4); |
|
113 | - $s4 = $s4 / Predict::xkmper + Predict::ae; |
|
112 | + $qoms24 = pow((120.0 - $s4)*Predict::ae/Predict::xkmper, 4); |
|
113 | + $s4 = $s4/Predict::xkmper + Predict::ae; |
|
114 | 114 | }; /* FIXME FIXME: End of if(perige <= 98) NO WAY!!!! */ |
115 | 115 | |
116 | - $pinvsq = 1.0 / ($sat->sgps->aodp * $sat->sgps->aodp * $betao2 * $betao2); |
|
117 | - $tsi = 1.0 / ($sat->sgps->aodp - $s4); |
|
118 | - $sat->sgps->eta = $sat->sgps->aodp * $sat->tle->eo * $tsi; |
|
119 | - $etasq = $sat->sgps->eta * $sat->sgps->eta; |
|
120 | - $eeta = $sat->tle->eo * $sat->sgps->eta; |
|
116 | + $pinvsq = 1.0/($sat->sgps->aodp*$sat->sgps->aodp*$betao2*$betao2); |
|
117 | + $tsi = 1.0/($sat->sgps->aodp - $s4); |
|
118 | + $sat->sgps->eta = $sat->sgps->aodp*$sat->tle->eo*$tsi; |
|
119 | + $etasq = $sat->sgps->eta*$sat->sgps->eta; |
|
120 | + $eeta = $sat->tle->eo*$sat->sgps->eta; |
|
121 | 121 | $psisq = abs(1.0 - $etasq); |
122 | - $coef = $qoms24 * pow($tsi, 4); |
|
123 | - $coef1 = $coef / pow($psisq, 3.5); |
|
124 | - $c2 = $coef1 * $sat->sgps->xnodp * ($sat->sgps->aodp * |
|
125 | - (1.0 + 1.5 * $etasq + $eeta * (4.0 + $etasq)) + |
|
126 | - 0.75 * Predict::ck2 * $tsi / $psisq * $sat->sgps->x3thm1 * |
|
127 | - (8.0 + 3.0 * $etasq * (8 + $etasq))); |
|
128 | - $sat->sgps->c1 = $c2 * $sat->tle->bstar; |
|
122 | + $coef = $qoms24*pow($tsi, 4); |
|
123 | + $coef1 = $coef/pow($psisq, 3.5); |
|
124 | + $c2 = $coef1*$sat->sgps->xnodp*($sat->sgps->aodp* |
|
125 | + (1.0 + 1.5*$etasq + $eeta*(4.0 + $etasq)) + |
|
126 | + 0.75*Predict::ck2*$tsi/$psisq*$sat->sgps->x3thm1* |
|
127 | + (8.0 + 3.0*$etasq*(8 + $etasq))); |
|
128 | + $sat->sgps->c1 = $c2*$sat->tle->bstar; |
|
129 | 129 | $sat->sgps->sinio = sin($sat->tle->xincl); |
130 | - $a3ovk2 = -Predict::xj3 / Predict::ck2 * pow(Predict::ae, 3); |
|
131 | - $c3 = $coef * $tsi * $a3ovk2 * $sat->sgps->xnodp * Predict::ae * $sat->sgps->sinio / $sat->tle->eo; |
|
130 | + $a3ovk2 = -Predict::xj3/Predict::ck2*pow(Predict::ae, 3); |
|
131 | + $c3 = $coef*$tsi*$a3ovk2*$sat->sgps->xnodp*Predict::ae*$sat->sgps->sinio/$sat->tle->eo; |
|
132 | 132 | $sat->sgps->x1mth2 = 1.0 - $theta2; |
133 | - $sat->sgps->c4 = 2.0 * $sat->sgps->xnodp * $coef1 * $sat->sgps->aodp * $betao2 * |
|
134 | - ($sat->sgps->eta * (2.0 + 0.5 * $etasq) + |
|
135 | - $sat->tle->eo * (0.5 + 2.0 * $etasq) - |
|
136 | - 2.0 * Predict::ck2 * $tsi / ($sat->sgps->aodp * $psisq) * |
|
137 | - (-3.0 * $sat->sgps->x3thm1 * (1.0 - 2.0 * $eeta + $etasq * (1.5 - 0.5 * $eeta)) + |
|
138 | - 0.75 * $sat->sgps->x1mth2 * (2.0 * $etasq - $eeta * (1.0 + $etasq)) * |
|
139 | - cos(2.0 * $sat->tle->omegao))); |
|
140 | - $sat->sgps->c5 = 2.0 * $coef1 * $sat->sgps->aodp * $betao2 * |
|
141 | - (1.0 + 2.75 * ($etasq + $eeta) + $eeta * $etasq); |
|
142 | - $theta4 = $theta2 * $theta2; |
|
143 | - $temp1 = 3.0 * Predict::ck2 * $pinvsq * $sat->sgps->xnodp; |
|
144 | - $temp2 = $temp1 * Predict::ck2 * $pinvsq; |
|
145 | - $temp3 = 1.25 * Predict::ck4 * $pinvsq * $pinvsq * $sat->sgps->xnodp; |
|
146 | - $sat->sgps->xmdot = $sat->sgps->xnodp + 0.5 * $temp1 * $betao * $sat->sgps->x3thm1 + |
|
147 | - 0.0625 * $temp2 * $betao * (13.0 - 78.0 * $theta2 + 137.0 * $theta4); |
|
148 | - $x1m5th = 1.0 - 5.0 * $theta2; |
|
149 | - $sat->sgps->omgdot = -0.5 * $temp1 * $x1m5th + |
|
150 | - 0.0625 * $temp2 * (7.0 - 114.0 * $theta2 + 395.0 * $theta4) + |
|
151 | - $temp3 * (3.0 - 36.0 * $theta2 + 49.0 * $theta4); |
|
152 | - $xhdot1 = -$temp1 * $sat->sgps->cosio; |
|
153 | - $sat->sgps->xnodot = $xhdot1 + (0.5 * $temp2 * (4.0 - 19.0 * $theta2) + |
|
154 | - 2.0 * $temp3 * (3.0 - 7.0 * $theta2)) * $sat->sgps->cosio; |
|
155 | - $sat->sgps->omgcof = $sat->tle->bstar * $c3 * cos($sat->tle->omegao); |
|
156 | - $sat->sgps->xmcof = -Predict::tothrd * $coef * $sat->tle->bstar * Predict::ae / $eeta; |
|
157 | - $sat->sgps->xnodcf = 3.5 * $betao2 * $xhdot1 * $sat->sgps->c1; |
|
158 | - $sat->sgps->t2cof = 1.5 * $sat->sgps->c1; |
|
159 | - $sat->sgps->xlcof = 0.125 * $a3ovk2 * $sat->sgps->sinio * |
|
160 | - (3.0 + 5.0 * $sat->sgps->cosio) / (1.0 + $sat->sgps->cosio); |
|
161 | - $sat->sgps->aycof = 0.25 * $a3ovk2 * $sat->sgps->sinio; |
|
162 | - $sat->sgps->delmo = pow(1.0 + $sat->sgps->eta * cos($sat->tle->xmo), 3); |
|
133 | + $sat->sgps->c4 = 2.0*$sat->sgps->xnodp*$coef1*$sat->sgps->aodp*$betao2* |
|
134 | + ($sat->sgps->eta*(2.0 + 0.5*$etasq) + |
|
135 | + $sat->tle->eo*(0.5 + 2.0*$etasq) - |
|
136 | + 2.0*Predict::ck2*$tsi/($sat->sgps->aodp*$psisq)* |
|
137 | + (-3.0*$sat->sgps->x3thm1*(1.0 - 2.0*$eeta + $etasq*(1.5 - 0.5*$eeta)) + |
|
138 | + 0.75*$sat->sgps->x1mth2*(2.0*$etasq - $eeta*(1.0 + $etasq))* |
|
139 | + cos(2.0*$sat->tle->omegao))); |
|
140 | + $sat->sgps->c5 = 2.0*$coef1*$sat->sgps->aodp*$betao2* |
|
141 | + (1.0 + 2.75*($etasq + $eeta) + $eeta*$etasq); |
|
142 | + $theta4 = $theta2*$theta2; |
|
143 | + $temp1 = 3.0*Predict::ck2*$pinvsq*$sat->sgps->xnodp; |
|
144 | + $temp2 = $temp1*Predict::ck2*$pinvsq; |
|
145 | + $temp3 = 1.25*Predict::ck4*$pinvsq*$pinvsq*$sat->sgps->xnodp; |
|
146 | + $sat->sgps->xmdot = $sat->sgps->xnodp + 0.5*$temp1*$betao*$sat->sgps->x3thm1 + |
|
147 | + 0.0625*$temp2*$betao*(13.0 - 78.0*$theta2 + 137.0*$theta4); |
|
148 | + $x1m5th = 1.0 - 5.0*$theta2; |
|
149 | + $sat->sgps->omgdot = -0.5*$temp1*$x1m5th + |
|
150 | + 0.0625*$temp2*(7.0 - 114.0*$theta2 + 395.0*$theta4) + |
|
151 | + $temp3*(3.0 - 36.0*$theta2 + 49.0*$theta4); |
|
152 | + $xhdot1 = -$temp1*$sat->sgps->cosio; |
|
153 | + $sat->sgps->xnodot = $xhdot1 + (0.5*$temp2*(4.0 - 19.0*$theta2) + |
|
154 | + 2.0*$temp3*(3.0 - 7.0*$theta2))*$sat->sgps->cosio; |
|
155 | + $sat->sgps->omgcof = $sat->tle->bstar*$c3*cos($sat->tle->omegao); |
|
156 | + $sat->sgps->xmcof = -Predict::tothrd*$coef*$sat->tle->bstar*Predict::ae/$eeta; |
|
157 | + $sat->sgps->xnodcf = 3.5*$betao2*$xhdot1*$sat->sgps->c1; |
|
158 | + $sat->sgps->t2cof = 1.5*$sat->sgps->c1; |
|
159 | + $sat->sgps->xlcof = 0.125*$a3ovk2*$sat->sgps->sinio* |
|
160 | + (3.0 + 5.0*$sat->sgps->cosio)/(1.0 + $sat->sgps->cosio); |
|
161 | + $sat->sgps->aycof = 0.25*$a3ovk2*$sat->sgps->sinio; |
|
162 | + $sat->sgps->delmo = pow(1.0 + $sat->sgps->eta*cos($sat->tle->xmo), 3); |
|
163 | 163 | $sat->sgps->sinmo = sin($sat->tle->xmo); |
164 | - $sat->sgps->x7thm1 = 7.0 * $theta2 - 1.0; |
|
164 | + $sat->sgps->x7thm1 = 7.0*$theta2 - 1.0; |
|
165 | 165 | if (~$sat->flags & self::SIMPLE_FLAG) { |
166 | - $c1sq = $sat->sgps->c1 * $sat->sgps->c1; |
|
167 | - $sat->sgps->d2 = 4.0 * $sat->sgps->aodp * $tsi * $c1sq; |
|
168 | - $temp = $sat->sgps->d2 * $tsi * $sat->sgps->c1 / 3.0; |
|
169 | - $sat->sgps->d3 = (17.0 * $sat->sgps->aodp + $s4) * $temp; |
|
170 | - $sat->sgps->d4 = 0.5 * $temp * $sat->sgps->aodp * $tsi * |
|
171 | - (221.0 * $sat->sgps->aodp + 31.0 * $s4) * $sat->sgps->c1; |
|
172 | - $sat->sgps->t3cof = $sat->sgps->d2 + 2.0 * $c1sq; |
|
173 | - $sat->sgps->t4cof = 0.25 * (3.0 * $sat->sgps->d3 + $sat->sgps->c1 * |
|
174 | - (12.0 * $sat->sgps->d2 + 10.0 * $c1sq)); |
|
175 | - $sat->sgps->t5cof = 0.2 * (3.0 * $sat->sgps->d4 + |
|
176 | - 12.0 * $sat->sgps->c1 * $sat->sgps->d3 + |
|
177 | - 6.0 * $sat->sgps->d2 * $sat->sgps->d2 + |
|
178 | - 15.0 * $c1sq * (2.0 * $sat->sgps->d2 + $c1sq)); |
|
166 | + $c1sq = $sat->sgps->c1*$sat->sgps->c1; |
|
167 | + $sat->sgps->d2 = 4.0*$sat->sgps->aodp*$tsi*$c1sq; |
|
168 | + $temp = $sat->sgps->d2*$tsi*$sat->sgps->c1/3.0; |
|
169 | + $sat->sgps->d3 = (17.0*$sat->sgps->aodp + $s4)*$temp; |
|
170 | + $sat->sgps->d4 = 0.5*$temp*$sat->sgps->aodp*$tsi* |
|
171 | + (221.0*$sat->sgps->aodp + 31.0*$s4)*$sat->sgps->c1; |
|
172 | + $sat->sgps->t3cof = $sat->sgps->d2 + 2.0*$c1sq; |
|
173 | + $sat->sgps->t4cof = 0.25*(3.0*$sat->sgps->d3 + $sat->sgps->c1* |
|
174 | + (12.0*$sat->sgps->d2 + 10.0*$c1sq)); |
|
175 | + $sat->sgps->t5cof = 0.2*(3.0*$sat->sgps->d4 + |
|
176 | + 12.0*$sat->sgps->c1*$sat->sgps->d3 + |
|
177 | + 6.0*$sat->sgps->d2*$sat->sgps->d2 + |
|
178 | + 15.0*$c1sq*(2.0*$sat->sgps->d2 + $c1sq)); |
|
179 | 179 | }; /* End of if (isFlagClear(SIMPLE_FLAG)) */ |
180 | 180 | }; /* End of SGP4() initialization */ |
181 | 181 | |
182 | 182 | /* Update for secular gravity and atmospheric drag. */ |
183 | - $xmdf = $sat->tle->xmo + $sat->sgps->xmdot * $tsince; |
|
184 | - $omgadf = $sat->tle->omegao + $sat->sgps->omgdot * $tsince; |
|
185 | - $xnoddf = $sat->tle->xnodeo + $sat->sgps->xnodot * $tsince; |
|
183 | + $xmdf = $sat->tle->xmo + $sat->sgps->xmdot*$tsince; |
|
184 | + $omgadf = $sat->tle->omegao + $sat->sgps->omgdot*$tsince; |
|
185 | + $xnoddf = $sat->tle->xnodeo + $sat->sgps->xnodot*$tsince; |
|
186 | 186 | $omega = $omgadf; |
187 | 187 | $xmp = $xmdf; |
188 | - $tsq = $tsince * $tsince; |
|
189 | - $xnode = $xnoddf + $sat->sgps->xnodcf * $tsq; |
|
190 | - $tempa = 1.0 - $sat->sgps->c1 * $tsince; |
|
191 | - $tempe = $sat->tle->bstar * $sat->sgps->c4 * $tsince; |
|
192 | - $templ = $sat->sgps->t2cof * $tsq; |
|
188 | + $tsq = $tsince*$tsince; |
|
189 | + $xnode = $xnoddf + $sat->sgps->xnodcf*$tsq; |
|
190 | + $tempa = 1.0 - $sat->sgps->c1*$tsince; |
|
191 | + $tempe = $sat->tle->bstar*$sat->sgps->c4*$tsince; |
|
192 | + $templ = $sat->sgps->t2cof*$tsq; |
|
193 | 193 | if (~$sat->flags & self::SIMPLE_FLAG) { |
194 | - $delomg = $sat->sgps->omgcof * $tsince; |
|
195 | - $delm = $sat->sgps->xmcof * (pow(1 + $sat->sgps->eta * cos($xmdf), 3) - $sat->sgps->delmo); |
|
194 | + $delomg = $sat->sgps->omgcof*$tsince; |
|
195 | + $delm = $sat->sgps->xmcof*(pow(1 + $sat->sgps->eta*cos($xmdf), 3) - $sat->sgps->delmo); |
|
196 | 196 | $temp = $delomg + $delm; |
197 | 197 | $xmp = $xmdf + $temp; |
198 | 198 | $omega = $omgadf - $temp; |
199 | - $tcube = $tsq * $tsince; |
|
200 | - $tfour = $tsince * $tcube; |
|
201 | - $tempa = $tempa - $sat->sgps->d2 * $tsq - $sat->sgps->d3 * $tcube - $sat->sgps->d4 * $tfour; |
|
202 | - $tempe = $tempe + $sat->tle->bstar * $sat->sgps->c5 * (sin($xmp) - $sat->sgps->sinmo); |
|
203 | - $templ = $templ + $sat->sgps->t3cof * $tcube + $tfour * |
|
204 | - ($sat->sgps->t4cof + $tsince * $sat->sgps->t5cof); |
|
199 | + $tcube = $tsq*$tsince; |
|
200 | + $tfour = $tsince*$tcube; |
|
201 | + $tempa = $tempa - $sat->sgps->d2*$tsq - $sat->sgps->d3*$tcube - $sat->sgps->d4*$tfour; |
|
202 | + $tempe = $tempe + $sat->tle->bstar*$sat->sgps->c5*(sin($xmp) - $sat->sgps->sinmo); |
|
203 | + $templ = $templ + $sat->sgps->t3cof*$tcube + $tfour* |
|
204 | + ($sat->sgps->t4cof + $tsince*$sat->sgps->t5cof); |
|
205 | 205 | }; /* End of if (isFlagClear(SIMPLE_FLAG)) */ |
206 | 206 | |
207 | - $a = $sat->sgps->aodp * pow($tempa, 2); |
|
207 | + $a = $sat->sgps->aodp*pow($tempa, 2); |
|
208 | 208 | $e = $sat->tle->eo - $tempe; |
209 | - $xl = $xmp + $omega + $xnode + $sat->sgps->xnodp * $templ; |
|
210 | - $beta = sqrt(1.0 - ($e * $e)); |
|
211 | - $xn = Predict::xke / pow($a, 1.5); |
|
209 | + $xl = $xmp + $omega + $xnode + $sat->sgps->xnodp*$templ; |
|
210 | + $beta = sqrt(1.0 - ($e*$e)); |
|
211 | + $xn = Predict::xke/pow($a, 1.5); |
|
212 | 212 | |
213 | 213 | /* Long period periodics */ |
214 | - $axn = $e * cos($omega); |
|
215 | - $temp = 1.0 / ($a * $beta * $beta); |
|
216 | - $xll = $temp * $sat->sgps->xlcof * $axn; |
|
217 | - $aynl = $temp * $sat->sgps->aycof; |
|
214 | + $axn = $e*cos($omega); |
|
215 | + $temp = 1.0/($a*$beta*$beta); |
|
216 | + $xll = $temp*$sat->sgps->xlcof*$axn; |
|
217 | + $aynl = $temp*$sat->sgps->aycof; |
|
218 | 218 | $xlt = $xl + $xll; |
219 | - $ayn = $e * sin($omega) + $aynl; |
|
219 | + $ayn = $e*sin($omega) + $aynl; |
|
220 | 220 | |
221 | 221 | /* Solve Kepler's' Equation */ |
222 | 222 | $capu = Predict_Math::FMod2p($xlt - $xnode); |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | do { |
227 | 227 | $sinepw = sin($temp2); |
228 | 228 | $cosepw = cos($temp2); |
229 | - $temp3 = $axn * $sinepw; |
|
230 | - $temp4 = $ayn * $cosepw; |
|
231 | - $temp5 = $axn * $cosepw; |
|
232 | - $temp6 = $ayn * $sinepw; |
|
233 | - $epw = ($capu - $temp4 + $temp3 - $temp2) / (1.0 - $temp5 - $temp6) + $temp2; |
|
229 | + $temp3 = $axn*$sinepw; |
|
230 | + $temp4 = $ayn*$cosepw; |
|
231 | + $temp5 = $axn*$cosepw; |
|
232 | + $temp6 = $ayn*$sinepw; |
|
233 | + $epw = ($capu - $temp4 + $temp3 - $temp2)/(1.0 - $temp5 - $temp6) + $temp2; |
|
234 | 234 | if (abs($epw - $temp2) <= Predict::e6a) { |
235 | 235 | break; |
236 | 236 | } |
@@ -240,33 +240,33 @@ discard block |
||
240 | 240 | /* Short period preliminary quantities */ |
241 | 241 | $ecose = $temp5 + $temp6; |
242 | 242 | $esine = $temp3 - $temp4; |
243 | - $elsq = $axn * $axn + $ayn * $ayn; |
|
243 | + $elsq = $axn*$axn + $ayn*$ayn; |
|
244 | 244 | $temp = 1.0 - $elsq; |
245 | - $pl = $a * $temp; |
|
246 | - $r = $a * (1.0 - $ecose); |
|
247 | - $temp1 = 1.0 / $r; |
|
248 | - $rdot = Predict::xke * sqrt($a) * $esine * $temp1; |
|
249 | - $rfdot = Predict::xke * sqrt($pl) * $temp1; |
|
250 | - $temp2 = $a * $temp1; |
|
245 | + $pl = $a*$temp; |
|
246 | + $r = $a*(1.0 - $ecose); |
|
247 | + $temp1 = 1.0/$r; |
|
248 | + $rdot = Predict::xke*sqrt($a)*$esine*$temp1; |
|
249 | + $rfdot = Predict::xke*sqrt($pl)*$temp1; |
|
250 | + $temp2 = $a*$temp1; |
|
251 | 251 | $betal = sqrt($temp); |
252 | - $temp3 = 1.0 / (1.0 + $betal); |
|
253 | - $cosu = $temp2 * ($cosepw - $axn + $ayn * $esine * $temp3); |
|
254 | - $sinu = $temp2 * ($sinepw - $ayn - $axn * $esine * $temp3); |
|
252 | + $temp3 = 1.0/(1.0 + $betal); |
|
253 | + $cosu = $temp2*($cosepw - $axn + $ayn*$esine*$temp3); |
|
254 | + $sinu = $temp2*($sinepw - $ayn - $axn*$esine*$temp3); |
|
255 | 255 | $u = Predict_Math::AcTan($sinu, $cosu); |
256 | - $sin2u = 2.0 * $sinu * $cosu; |
|
257 | - $cos2u = 2.0 * $cosu * $cosu - 1.0; |
|
258 | - $temp = 1.0 / $pl; |
|
259 | - $temp1 = Predict::ck2 * $temp; |
|
260 | - $temp2 = $temp1 * $temp; |
|
256 | + $sin2u = 2.0*$sinu*$cosu; |
|
257 | + $cos2u = 2.0*$cosu*$cosu - 1.0; |
|
258 | + $temp = 1.0/$pl; |
|
259 | + $temp1 = Predict::ck2*$temp; |
|
260 | + $temp2 = $temp1*$temp; |
|
261 | 261 | |
262 | 262 | /* Update for short periodics */ |
263 | - $rk = $r * (1.0 - 1.5 * $temp2 * $betal * $sat->sgps->x3thm1) + |
|
264 | - 0.5 * $temp1 * $sat->sgps->x1mth2 * $cos2u; |
|
265 | - $uk = $u - 0.25 * $temp2 * $sat->sgps->x7thm1 * $sin2u; |
|
266 | - $xnodek = $xnode + 1.5 * $temp2 * $sat->sgps->cosio * $sin2u; |
|
267 | - $xinck = $sat->tle->xincl + 1.5 * $temp2 * $sat->sgps->cosio * $sat->sgps->sinio * $cos2u; |
|
268 | - $rdotk = $rdot - $xn * $temp1 * $sat->sgps->x1mth2 * $sin2u; |
|
269 | - $rfdotk = $rfdot + $xn * $temp1 * ($sat->sgps->x1mth2 * $cos2u + 1.5 * $sat->sgps->x3thm1); |
|
263 | + $rk = $r*(1.0 - 1.5*$temp2*$betal*$sat->sgps->x3thm1) + |
|
264 | + 0.5*$temp1*$sat->sgps->x1mth2*$cos2u; |
|
265 | + $uk = $u - 0.25*$temp2*$sat->sgps->x7thm1*$sin2u; |
|
266 | + $xnodek = $xnode + 1.5*$temp2*$sat->sgps->cosio*$sin2u; |
|
267 | + $xinck = $sat->tle->xincl + 1.5*$temp2*$sat->sgps->cosio*$sat->sgps->sinio*$cos2u; |
|
268 | + $rdotk = $rdot - $xn*$temp1*$sat->sgps->x1mth2*$sin2u; |
|
269 | + $rfdotk = $rfdot + $xn*$temp1*($sat->sgps->x1mth2*$cos2u + 1.5*$sat->sgps->x3thm1); |
|
270 | 270 | |
271 | 271 | |
272 | 272 | /* Orientation vectors */ |
@@ -276,22 +276,22 @@ discard block |
||
276 | 276 | $cosik = cos($xinck); |
277 | 277 | $sinnok = sin($xnodek); |
278 | 278 | $cosnok = cos($xnodek); |
279 | - $xmx = -$sinnok * $cosik; |
|
280 | - $xmy = $cosnok * $cosik; |
|
281 | - $ux = $xmx * $sinuk + $cosnok * $cosuk; |
|
282 | - $uy = $xmy * $sinuk + $sinnok * $cosuk; |
|
283 | - $uz = $sinik * $sinuk; |
|
284 | - $vx = $xmx * $cosuk - $cosnok * $sinuk; |
|
285 | - $vy = $xmy * $cosuk - $sinnok * $sinuk; |
|
286 | - $vz = $sinik * $cosuk; |
|
279 | + $xmx = -$sinnok*$cosik; |
|
280 | + $xmy = $cosnok*$cosik; |
|
281 | + $ux = $xmx*$sinuk + $cosnok*$cosuk; |
|
282 | + $uy = $xmy*$sinuk + $sinnok*$cosuk; |
|
283 | + $uz = $sinik*$sinuk; |
|
284 | + $vx = $xmx*$cosuk - $cosnok*$sinuk; |
|
285 | + $vy = $xmy*$cosuk - $sinnok*$sinuk; |
|
286 | + $vz = $sinik*$cosuk; |
|
287 | 287 | |
288 | 288 | /* Position and velocity */ |
289 | - $sat->pos->x = $rk * $ux; |
|
290 | - $sat->pos->y = $rk * $uy; |
|
291 | - $sat->pos->z = $rk * $uz; |
|
292 | - $sat->vel->x = $rdotk * $ux + $rfdotk * $vx; |
|
293 | - $sat->vel->y = $rdotk * $uy + $rfdotk * $vy; |
|
294 | - $sat->vel->z = $rdotk * $uz + $rfdotk * $vz; |
|
289 | + $sat->pos->x = $rk*$ux; |
|
290 | + $sat->pos->y = $rk*$uy; |
|
291 | + $sat->pos->z = $rk*$uz; |
|
292 | + $sat->vel->x = $rdotk*$ux + $rfdotk*$vx; |
|
293 | + $sat->vel->y = $rdotk*$uy + $rfdotk*$vy; |
|
294 | + $sat->vel->z = $rdotk*$uz + $rfdotk*$vz; |
|
295 | 295 | |
296 | 296 | $sat->phase = $xlt - $xnode - $omgadf + Predict::twopi; |
297 | 297 | if ($sat->phase < 0) { |
@@ -321,100 +321,100 @@ discard block |
||
321 | 321 | |
322 | 322 | /* Recover original mean motion (xnodp) and */ |
323 | 323 | /* semimajor axis (aodp) from input elements. */ |
324 | - $a1 = pow(Predict::xke / $sat->tle->xno, Predict::tothrd); |
|
324 | + $a1 = pow(Predict::xke/$sat->tle->xno, Predict::tothrd); |
|
325 | 325 | $sat->deep_arg->cosio = cos($sat->tle->xincl); |
326 | - $sat->deep_arg->theta2 = $sat->deep_arg->cosio * $sat->deep_arg->cosio; |
|
327 | - $sat->sgps->x3thm1 = 3.0 * $sat->deep_arg->theta2 - 1.0; |
|
328 | - $sat->deep_arg->eosq = $sat->tle->eo * $sat->tle->eo; |
|
326 | + $sat->deep_arg->theta2 = $sat->deep_arg->cosio*$sat->deep_arg->cosio; |
|
327 | + $sat->sgps->x3thm1 = 3.0*$sat->deep_arg->theta2 - 1.0; |
|
328 | + $sat->deep_arg->eosq = $sat->tle->eo*$sat->tle->eo; |
|
329 | 329 | $sat->deep_arg->betao2 = 1.0 - $sat->deep_arg->eosq; |
330 | 330 | $sat->deep_arg->betao = sqrt($sat->deep_arg->betao2); |
331 | - $del1 = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / |
|
332 | - ($a1 * $a1 * $sat->deep_arg->betao * $sat->deep_arg->betao2); |
|
333 | - $ao = $a1 * (1.0 - $del1 * (0.5 * Predict::tothrd + $del1 * (1.0 + 134.0 / 81.0 * $del1))); |
|
334 | - $delo = 1.5 * Predict::ck2 * $sat->sgps->x3thm1 / |
|
335 | - ($ao * $ao * $sat->deep_arg->betao * $sat->deep_arg->betao2); |
|
336 | - $sat->deep_arg->xnodp = $sat->tle->xno / (1.0 + $delo); |
|
337 | - $sat->deep_arg->aodp = $ao / (1.0 - $delo); |
|
331 | + $del1 = 1.5*Predict::ck2*$sat->sgps->x3thm1/ |
|
332 | + ($a1*$a1*$sat->deep_arg->betao*$sat->deep_arg->betao2); |
|
333 | + $ao = $a1*(1.0 - $del1*(0.5*Predict::tothrd + $del1*(1.0 + 134.0/81.0*$del1))); |
|
334 | + $delo = 1.5*Predict::ck2*$sat->sgps->x3thm1/ |
|
335 | + ($ao*$ao*$sat->deep_arg->betao*$sat->deep_arg->betao2); |
|
336 | + $sat->deep_arg->xnodp = $sat->tle->xno/(1.0 + $delo); |
|
337 | + $sat->deep_arg->aodp = $ao/(1.0 - $delo); |
|
338 | 338 | |
339 | 339 | /* For perigee below 156 km, the values */ |
340 | 340 | /* of s and qoms2t are altered. */ |
341 | 341 | $s4 = Predict::__s__; |
342 | 342 | $qoms24 = Predict::qoms2t; |
343 | - $perige = ($sat->deep_arg->aodp * (1.0 - $sat->tle->eo) - Predict::ae) * Predict::xkmper; |
|
343 | + $perige = ($sat->deep_arg->aodp*(1.0 - $sat->tle->eo) - Predict::ae)*Predict::xkmper; |
|
344 | 344 | if ($perige < 156.0) { |
345 | 345 | if ($perige <= 98.0) { |
346 | 346 | $s4 = 20.0; |
347 | 347 | } else { |
348 | 348 | $s4 = $perige - 78.0; |
349 | 349 | } |
350 | - $qoms24 = pow((120.0 - $s4) * Predict::ae / Predict::xkmper, 4); |
|
351 | - $s4 = $s4 / Predict::xkmper + Predict::ae; |
|
350 | + $qoms24 = pow((120.0 - $s4)*Predict::ae/Predict::xkmper, 4); |
|
351 | + $s4 = $s4/Predict::xkmper + Predict::ae; |
|
352 | 352 | } |
353 | - $pinvsq = 1.0 / ($sat->deep_arg->aodp * $sat->deep_arg->aodp * |
|
354 | - $sat->deep_arg->betao2 * $sat->deep_arg->betao2); |
|
353 | + $pinvsq = 1.0/($sat->deep_arg->aodp*$sat->deep_arg->aodp* |
|
354 | + $sat->deep_arg->betao2*$sat->deep_arg->betao2); |
|
355 | 355 | $sat->deep_arg->sing = sin($sat->tle->omegao); |
356 | 356 | $sat->deep_arg->cosg = cos($sat->tle->omegao); |
357 | - $tsi = 1.0 / ($sat->deep_arg->aodp - $s4); |
|
358 | - $eta = $sat->deep_arg->aodp * $sat->tle->eo * $tsi; |
|
359 | - $etasq = $eta * $eta; |
|
360 | - $eeta = $sat->tle->eo * $eta; |
|
357 | + $tsi = 1.0/($sat->deep_arg->aodp - $s4); |
|
358 | + $eta = $sat->deep_arg->aodp*$sat->tle->eo*$tsi; |
|
359 | + $etasq = $eta*$eta; |
|
360 | + $eeta = $sat->tle->eo*$eta; |
|
361 | 361 | $psisq = abs(1.0 - $etasq); |
362 | - $coef = $qoms24 * pow($tsi, 4); |
|
363 | - $coef1 = $coef / pow($psisq, 3.5); |
|
364 | - $c2 = $coef1 * $sat->deep_arg->xnodp * ($sat->deep_arg->aodp * |
|
365 | - (1.0 + 1.5 * $etasq + $eeta * |
|
366 | - (4.0 + $etasq)) + 0.75 * Predict::ck2 * $tsi / $psisq * |
|
367 | - $sat->sgps->x3thm1 * (8.0 + 3.0 * $etasq * |
|
362 | + $coef = $qoms24*pow($tsi, 4); |
|
363 | + $coef1 = $coef/pow($psisq, 3.5); |
|
364 | + $c2 = $coef1*$sat->deep_arg->xnodp*($sat->deep_arg->aodp* |
|
365 | + (1.0 + 1.5*$etasq + $eeta* |
|
366 | + (4.0 + $etasq)) + 0.75*Predict::ck2*$tsi/$psisq* |
|
367 | + $sat->sgps->x3thm1*(8.0 + 3.0*$etasq* |
|
368 | 368 | (8.0 + $etasq))); |
369 | - $sat->sgps->c1 = $sat->tle->bstar * $c2; |
|
369 | + $sat->sgps->c1 = $sat->tle->bstar*$c2; |
|
370 | 370 | $sat->deep_arg->sinio = sin($sat->tle->xincl); |
371 | - $a3ovk2 = -Predict::xj3 / Predict::ck2 * pow(Predict::ae, 3); |
|
371 | + $a3ovk2 = -Predict::xj3/Predict::ck2*pow(Predict::ae, 3); |
|
372 | 372 | $sat->sgps->x1mth2 = 1.0 - $sat->deep_arg->theta2; |
373 | - $sat->sgps->c4 = 2.0 * $sat->deep_arg->xnodp * $coef1 * |
|
374 | - $sat->deep_arg->aodp * $sat->deep_arg->betao2 * |
|
375 | - ($eta * (2.0 + 0.5 * $etasq) + $sat->tle->eo * |
|
376 | - (0.5 + 2.0 * $etasq) - 2.0 * Predict::ck2 * $tsi / |
|
377 | - ($sat->deep_arg->aodp * $psisq) * (-3.0 * $sat->sgps->x3thm1 * |
|
378 | - (1.0 - 2.0 * $eeta + $etasq * |
|
379 | - (1.5 - 0.5 * $eeta)) + |
|
380 | - 0.75 * $sat->sgps->x1mth2 * |
|
381 | - (2.0 * $etasq - $eeta * (1.0 + $etasq)) * |
|
382 | - cos(2.0 * $sat->tle->omegao))); |
|
383 | - $theta4 = $sat->deep_arg->theta2 * $sat->deep_arg->theta2; |
|
384 | - $temp1 = 3.0 * Predict::ck2 * $pinvsq * $sat->deep_arg->xnodp; |
|
385 | - $temp2 = $temp1 * Predict::ck2 * $pinvsq; |
|
386 | - $temp3 = 1.25 * Predict::ck4 * $pinvsq * $pinvsq * $sat->deep_arg->xnodp; |
|
387 | - $sat->deep_arg->xmdot = $sat->deep_arg->xnodp + 0.5 * $temp1 * $sat->deep_arg->betao * |
|
388 | - $sat->sgps->x3thm1 + 0.0625 * $temp2 * $sat->deep_arg->betao * |
|
389 | - (13.0 - 78.0 * $sat->deep_arg->theta2 + 137.0 * $theta4); |
|
390 | - $x1m5th = 1.0 - 5.0 * $sat->deep_arg->theta2; |
|
391 | - $sat->deep_arg->omgdot = -0.5 * $temp1 * $x1m5th + 0.0625 * $temp2 * |
|
392 | - (7.0 - 114.0 * $sat->deep_arg->theta2 + 395.0 * $theta4) + |
|
393 | - $temp3 * (3.0 - 36.0 * $sat->deep_arg->theta2 + 49.0 * $theta4); |
|
394 | - $xhdot1 = -$temp1 * $sat->deep_arg->cosio; |
|
395 | - $sat->deep_arg->xnodot = $xhdot1 + (0.5 * $temp2 * (4.0 - 19.0 * $sat->deep_arg->theta2) + |
|
396 | - 2.0 * $temp3 * (3.0 - 7.0 * $sat->deep_arg->theta2)) * |
|
373 | + $sat->sgps->c4 = 2.0*$sat->deep_arg->xnodp*$coef1* |
|
374 | + $sat->deep_arg->aodp*$sat->deep_arg->betao2* |
|
375 | + ($eta*(2.0 + 0.5*$etasq) + $sat->tle->eo* |
|
376 | + (0.5 + 2.0*$etasq) - 2.0*Predict::ck2*$tsi/ |
|
377 | + ($sat->deep_arg->aodp*$psisq)*(-3.0*$sat->sgps->x3thm1* |
|
378 | + (1.0 - 2.0*$eeta + $etasq* |
|
379 | + (1.5 - 0.5*$eeta)) + |
|
380 | + 0.75*$sat->sgps->x1mth2* |
|
381 | + (2.0*$etasq - $eeta*(1.0 + $etasq))* |
|
382 | + cos(2.0*$sat->tle->omegao))); |
|
383 | + $theta4 = $sat->deep_arg->theta2*$sat->deep_arg->theta2; |
|
384 | + $temp1 = 3.0*Predict::ck2*$pinvsq*$sat->deep_arg->xnodp; |
|
385 | + $temp2 = $temp1*Predict::ck2*$pinvsq; |
|
386 | + $temp3 = 1.25*Predict::ck4*$pinvsq*$pinvsq*$sat->deep_arg->xnodp; |
|
387 | + $sat->deep_arg->xmdot = $sat->deep_arg->xnodp + 0.5*$temp1*$sat->deep_arg->betao* |
|
388 | + $sat->sgps->x3thm1 + 0.0625*$temp2*$sat->deep_arg->betao* |
|
389 | + (13.0 - 78.0*$sat->deep_arg->theta2 + 137.0*$theta4); |
|
390 | + $x1m5th = 1.0 - 5.0*$sat->deep_arg->theta2; |
|
391 | + $sat->deep_arg->omgdot = -0.5*$temp1*$x1m5th + 0.0625*$temp2* |
|
392 | + (7.0 - 114.0*$sat->deep_arg->theta2 + 395.0*$theta4) + |
|
393 | + $temp3*(3.0 - 36.0*$sat->deep_arg->theta2 + 49.0*$theta4); |
|
394 | + $xhdot1 = -$temp1*$sat->deep_arg->cosio; |
|
395 | + $sat->deep_arg->xnodot = $xhdot1 + (0.5*$temp2*(4.0 - 19.0*$sat->deep_arg->theta2) + |
|
396 | + 2.0*$temp3*(3.0 - 7.0*$sat->deep_arg->theta2))* |
|
397 | 397 | $sat->deep_arg->cosio; |
398 | - $sat->sgps->xnodcf = 3.5 * $sat->deep_arg->betao2 * $xhdot1 * $sat->sgps->c1; |
|
399 | - $sat->sgps->t2cof = 1.5 * $sat->sgps->c1; |
|
400 | - $sat->sgps->xlcof = 0.125 * $a3ovk2 * $sat->deep_arg->sinio * |
|
401 | - (3.0 + 5.0 * $sat->deep_arg->cosio) / (1.0 + $sat->deep_arg->cosio); |
|
402 | - $sat->sgps->aycof = 0.25 * $a3ovk2 * $sat->deep_arg->sinio; |
|
403 | - $sat->sgps->x7thm1 = 7.0 * $sat->deep_arg->theta2 - 1.0; |
|
398 | + $sat->sgps->xnodcf = 3.5*$sat->deep_arg->betao2*$xhdot1*$sat->sgps->c1; |
|
399 | + $sat->sgps->t2cof = 1.5*$sat->sgps->c1; |
|
400 | + $sat->sgps->xlcof = 0.125*$a3ovk2*$sat->deep_arg->sinio* |
|
401 | + (3.0 + 5.0*$sat->deep_arg->cosio)/(1.0 + $sat->deep_arg->cosio); |
|
402 | + $sat->sgps->aycof = 0.25*$a3ovk2*$sat->deep_arg->sinio; |
|
403 | + $sat->sgps->x7thm1 = 7.0*$sat->deep_arg->theta2 - 1.0; |
|
404 | 404 | |
405 | 405 | /* initialize Deep() */ |
406 | 406 | $this->Deep(self::dpinit, $sat); |
407 | 407 | }; /*End of SDP4() initialization */ |
408 | 408 | |
409 | 409 | /* Update for secular gravity and atmospheric drag */ |
410 | - $xmdf = $sat->tle->xmo + $sat->deep_arg->xmdot * $tsince; |
|
411 | - $sat->deep_arg->omgadf = $sat->tle->omegao + $sat->deep_arg->omgdot * $tsince; |
|
412 | - $xnoddf = $sat->tle->xnodeo + $sat->deep_arg->xnodot * $tsince; |
|
413 | - $tsq = $tsince * $tsince; |
|
414 | - $sat->deep_arg->xnode = $xnoddf + $sat->sgps->xnodcf * $tsq; |
|
415 | - $tempa = 1.0 - $sat->sgps->c1 * $tsince; |
|
416 | - $tempe = $sat->tle->bstar * $sat->sgps->c4 * $tsince; |
|
417 | - $templ = $sat->sgps->t2cof * $tsq; |
|
410 | + $xmdf = $sat->tle->xmo + $sat->deep_arg->xmdot*$tsince; |
|
411 | + $sat->deep_arg->omgadf = $sat->tle->omegao + $sat->deep_arg->omgdot*$tsince; |
|
412 | + $xnoddf = $sat->tle->xnodeo + $sat->deep_arg->xnodot*$tsince; |
|
413 | + $tsq = $tsince*$tsince; |
|
414 | + $sat->deep_arg->xnode = $xnoddf + $sat->sgps->xnodcf*$tsq; |
|
415 | + $tempa = 1.0 - $sat->sgps->c1*$tsince; |
|
416 | + $tempe = $sat->tle->bstar*$sat->sgps->c4*$tsince; |
|
417 | + $templ = $sat->sgps->t2cof*$tsq; |
|
418 | 418 | $sat->deep_arg->xn = $sat->deep_arg->xnodp; |
419 | 419 | |
420 | 420 | /* Update for deep-space secular effects */ |
@@ -424,9 +424,9 @@ discard block |
||
424 | 424 | $this->Deep(self::dpsec, $sat); |
425 | 425 | |
426 | 426 | $xmdf = $sat->deep_arg->xll; |
427 | - $a = pow(Predict::xke / $sat->deep_arg->xn, Predict::tothrd) * $tempa * $tempa; |
|
427 | + $a = pow(Predict::xke/$sat->deep_arg->xn, Predict::tothrd)*$tempa*$tempa; |
|
428 | 428 | $sat->deep_arg->em = $sat->deep_arg->em - $tempe; |
429 | - $xmam = $xmdf + $sat->deep_arg->xnodp * $templ; |
|
429 | + $xmam = $xmdf + $sat->deep_arg->xnodp*$templ; |
|
430 | 430 | |
431 | 431 | /* Update for deep-space periodic effects */ |
432 | 432 | $sat->deep_arg->xll = $xmam; |
@@ -435,30 +435,30 @@ discard block |
||
435 | 435 | |
436 | 436 | $xmam = $sat->deep_arg->xll; |
437 | 437 | $xl = $xmam + $sat->deep_arg->omgadf + $sat->deep_arg->xnode; |
438 | - $beta = sqrt(1.0 - $sat->deep_arg->em * $sat->deep_arg->em); |
|
439 | - $sat->deep_arg->xn = Predict::xke / pow($a, 1.5); |
|
438 | + $beta = sqrt(1.0 - $sat->deep_arg->em*$sat->deep_arg->em); |
|
439 | + $sat->deep_arg->xn = Predict::xke/pow($a, 1.5); |
|
440 | 440 | |
441 | 441 | /* Long period periodics */ |
442 | - $axn = $sat->deep_arg->em * cos($sat->deep_arg->omgadf); |
|
443 | - $temp = 1.0 / ($a * $beta * $beta); |
|
444 | - $xll = $temp * $sat->sgps->xlcof * $axn; |
|
445 | - $aynl = $temp * $sat->sgps->aycof; |
|
442 | + $axn = $sat->deep_arg->em*cos($sat->deep_arg->omgadf); |
|
443 | + $temp = 1.0/($a*$beta*$beta); |
|
444 | + $xll = $temp*$sat->sgps->xlcof*$axn; |
|
445 | + $aynl = $temp*$sat->sgps->aycof; |
|
446 | 446 | $xlt = $xl + $xll; |
447 | - $ayn = $sat->deep_arg->em * sin($sat->deep_arg->omgadf) + $aynl; |
|
447 | + $ayn = $sat->deep_arg->em*sin($sat->deep_arg->omgadf) + $aynl; |
|
448 | 448 | |
449 | 449 | /* Solve Kepler's Equation */ |
450 | - $capu = Predict_Math::FMod2p ($xlt - $sat->deep_arg->xnode); |
|
450 | + $capu = Predict_Math::FMod2p($xlt - $sat->deep_arg->xnode); |
|
451 | 451 | $temp2 = $capu; |
452 | 452 | |
453 | 453 | $i = 0; |
454 | 454 | do { |
455 | 455 | $sinepw = sin($temp2); |
456 | 456 | $cosepw = cos($temp2); |
457 | - $temp3 = $axn * $sinepw; |
|
458 | - $temp4 = $ayn * $cosepw; |
|
459 | - $temp5 = $axn * $cosepw; |
|
460 | - $temp6 = $ayn * $sinepw; |
|
461 | - $epw = ($capu - $temp4 + $temp3 - $temp2) / (1.0 - $temp5 - $temp6) + $temp2; |
|
457 | + $temp3 = $axn*$sinepw; |
|
458 | + $temp4 = $ayn*$cosepw; |
|
459 | + $temp5 = $axn*$cosepw; |
|
460 | + $temp6 = $ayn*$sinepw; |
|
461 | + $epw = ($capu - $temp4 + $temp3 - $temp2)/(1.0 - $temp5 - $temp6) + $temp2; |
|
462 | 462 | if (abs($epw - $temp2) <= Predict::e6a) { |
463 | 463 | break; |
464 | 464 | } |
@@ -468,35 +468,35 @@ discard block |
||
468 | 468 | /* Short period preliminary quantities */ |
469 | 469 | $ecose = $temp5 + $temp6; |
470 | 470 | $esine = $temp3 - $temp4; |
471 | - $elsq = $axn * $axn + $ayn * $ayn; |
|
471 | + $elsq = $axn*$axn + $ayn*$ayn; |
|
472 | 472 | $temp = 1.0 - $elsq; |
473 | - $pl = $a * $temp; |
|
474 | - $r = $a * (1.0 - $ecose); |
|
475 | - $temp1 = 1.0 / $r; |
|
476 | - $rdot = Predict::xke * sqrt($a) * $esine * $temp1; |
|
477 | - $rfdot = Predict::xke * sqrt($pl) * $temp1; |
|
478 | - $temp2 = $a * $temp1; |
|
473 | + $pl = $a*$temp; |
|
474 | + $r = $a*(1.0 - $ecose); |
|
475 | + $temp1 = 1.0/$r; |
|
476 | + $rdot = Predict::xke*sqrt($a)*$esine*$temp1; |
|
477 | + $rfdot = Predict::xke*sqrt($pl)*$temp1; |
|
478 | + $temp2 = $a*$temp1; |
|
479 | 479 | $betal = sqrt($temp); |
480 | - $temp3 = 1.0 / (1.0 + $betal); |
|
481 | - $cosu = $temp2 * ($cosepw - $axn + $ayn * $esine * $temp3); |
|
482 | - $sinu = $temp2 * ($sinepw - $ayn - $axn * $esine * $temp3); |
|
480 | + $temp3 = 1.0/(1.0 + $betal); |
|
481 | + $cosu = $temp2*($cosepw - $axn + $ayn*$esine*$temp3); |
|
482 | + $sinu = $temp2*($sinepw - $ayn - $axn*$esine*$temp3); |
|
483 | 483 | $u = Predict_Math::AcTan($sinu, $cosu); |
484 | - $sin2u = 2.0 * $sinu * $cosu; |
|
485 | - $cos2u = 2.0 * $cosu * $cosu - 1.0; |
|
486 | - $temp = 1.0 / $pl; |
|
487 | - $temp1 = Predict::ck2 * $temp; |
|
488 | - $temp2 = $temp1 * $temp; |
|
484 | + $sin2u = 2.0*$sinu*$cosu; |
|
485 | + $cos2u = 2.0*$cosu*$cosu - 1.0; |
|
486 | + $temp = 1.0/$pl; |
|
487 | + $temp1 = Predict::ck2*$temp; |
|
488 | + $temp2 = $temp1*$temp; |
|
489 | 489 | |
490 | 490 | /* Update for short periodics */ |
491 | - $rk = $r * (1.0 - 1.5 * $temp2 * $betal * $sat->sgps->x3thm1) + |
|
492 | - 0.5 * $temp1 * $sat->sgps->x1mth2 * $cos2u; |
|
493 | - $uk = $u - 0.25 * $temp2 * $sat->sgps->x7thm1 * $sin2u; |
|
494 | - $xnodek = $sat->deep_arg->xnode + 1.5 * $temp2 * $sat->deep_arg->cosio * $sin2u; |
|
495 | - $xinck = $sat->deep_arg->xinc + 1.5 * $temp2 * |
|
496 | - $sat->deep_arg->cosio * $sat->deep_arg->sinio * $cos2u; |
|
497 | - $rdotk = $rdot - $sat->deep_arg->xn * $temp1 * $sat->sgps->x1mth2 * $sin2u; |
|
498 | - $rfdotk = $rfdot + $sat->deep_arg->xn * $temp1 * |
|
499 | - ($sat->sgps->x1mth2 * $cos2u + 1.5 * $sat->sgps->x3thm1); |
|
491 | + $rk = $r*(1.0 - 1.5*$temp2*$betal*$sat->sgps->x3thm1) + |
|
492 | + 0.5*$temp1*$sat->sgps->x1mth2*$cos2u; |
|
493 | + $uk = $u - 0.25*$temp2*$sat->sgps->x7thm1*$sin2u; |
|
494 | + $xnodek = $sat->deep_arg->xnode + 1.5*$temp2*$sat->deep_arg->cosio*$sin2u; |
|
495 | + $xinck = $sat->deep_arg->xinc + 1.5*$temp2* |
|
496 | + $sat->deep_arg->cosio*$sat->deep_arg->sinio*$cos2u; |
|
497 | + $rdotk = $rdot - $sat->deep_arg->xn*$temp1*$sat->sgps->x1mth2*$sin2u; |
|
498 | + $rfdotk = $rfdot + $sat->deep_arg->xn*$temp1* |
|
499 | + ($sat->sgps->x1mth2*$cos2u + 1.5*$sat->sgps->x3thm1); |
|
500 | 500 | |
501 | 501 | /* Orientation vectors */ |
502 | 502 | $sinuk = sin($uk); |
@@ -505,29 +505,29 @@ discard block |
||
505 | 505 | $cosik = cos($xinck); |
506 | 506 | $sinnok = sin($xnodek); |
507 | 507 | $cosnok = cos($xnodek); |
508 | - $xmx = -$sinnok * $cosik; |
|
509 | - $xmy = $cosnok * $cosik; |
|
510 | - $ux = $xmx * $sinuk + $cosnok * $cosuk; |
|
511 | - $uy = $xmy * $sinuk + $sinnok * $cosuk; |
|
512 | - $uz = $sinik * $sinuk; |
|
513 | - $vx = $xmx * $cosuk - $cosnok * $sinuk; |
|
514 | - $vy = $xmy * $cosuk - $sinnok * $sinuk; |
|
515 | - $vz = $sinik * $cosuk; |
|
508 | + $xmx = -$sinnok*$cosik; |
|
509 | + $xmy = $cosnok*$cosik; |
|
510 | + $ux = $xmx*$sinuk + $cosnok*$cosuk; |
|
511 | + $uy = $xmy*$sinuk + $sinnok*$cosuk; |
|
512 | + $uz = $sinik*$sinuk; |
|
513 | + $vx = $xmx*$cosuk - $cosnok*$sinuk; |
|
514 | + $vy = $xmy*$cosuk - $sinnok*$sinuk; |
|
515 | + $vz = $sinik*$cosuk; |
|
516 | 516 | |
517 | 517 | /* Position and velocity */ |
518 | - $sat->pos->x = $rk * $ux; |
|
519 | - $sat->pos->y = $rk * $uy; |
|
520 | - $sat->pos->z = $rk * $uz; |
|
521 | - $sat->vel->x = $rdotk * $ux + $rfdotk * $vx; |
|
522 | - $sat->vel->y = $rdotk * $uy + $rfdotk * $vy; |
|
523 | - $sat->vel->z = $rdotk * $uz + $rfdotk * $vz; |
|
518 | + $sat->pos->x = $rk*$ux; |
|
519 | + $sat->pos->y = $rk*$uy; |
|
520 | + $sat->pos->z = $rk*$uz; |
|
521 | + $sat->vel->x = $rdotk*$ux + $rfdotk*$vx; |
|
522 | + $sat->vel->y = $rdotk*$uy + $rfdotk*$vy; |
|
523 | + $sat->vel->z = $rdotk*$uz + $rfdotk*$vz; |
|
524 | 524 | |
525 | 525 | /* Phase in rads */ |
526 | 526 | $sat->phase = $xlt - $sat->deep_arg->xnode - $sat->deep_arg->omgadf + Predict::twopi; |
527 | 527 | if ($sat->phase < 0.0) { |
528 | 528 | $sat->phase += Predict::twopi; |
529 | 529 | } |
530 | - $sat->phase = Predict_Math::FMod2p ($sat->phase); |
|
530 | + $sat->phase = Predict_Math::FMod2p($sat->phase); |
|
531 | 531 | |
532 | 532 | $sat->tle->omegao1 = $sat->deep_arg->omgadf; |
533 | 533 | $sat->tle->xincl1 = $sat->deep_arg->xinc; |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | $sat->dps->thgr = Predict_Time::ThetaG($sat->tle->epoch, $sat->deep_arg); |
546 | 546 | $eq = $sat->tle->eo; |
547 | 547 | $sat->dps->xnq = $sat->deep_arg->xnodp; |
548 | - $aqnv = 1.0 / $sat->deep_arg->aodp; |
|
548 | + $aqnv = 1.0/$sat->deep_arg->aodp; |
|
549 | 549 | $sat->dps->xqncl = $sat->tle->xincl; |
550 | 550 | $xmao = $sat->tle->xmo; |
551 | 551 | $xpidot = $sat->deep_arg->omgdot + $sat->deep_arg->xnodot; |
@@ -555,26 +555,26 @@ discard block |
||
555 | 555 | $sat->dps->preep = 0; |
556 | 556 | |
557 | 557 | /* Initialize lunar solar terms */ |
558 | - $day = $sat->deep_arg->ds50 + 18261.5; /* Days since 1900 Jan 0.5 */ |
|
558 | + $day = $sat->deep_arg->ds50 + 18261.5; /* Days since 1900 Jan 0.5 */ |
|
559 | 559 | if ($day != $sat->dps->preep) { |
560 | 560 | $sat->dps->preep = $day; |
561 | - $xnodce = 4.5236020 - 9.2422029E-4 * $day; |
|
561 | + $xnodce = 4.5236020 - 9.2422029E-4*$day; |
|
562 | 562 | $stem = sin($xnodce); |
563 | 563 | $ctem = cos($xnodce); |
564 | - $sat->dps->zcosil = 0.91375164 - 0.03568096 * $ctem; |
|
565 | - $sat->dps->zsinil = sqrt(1.0 - $sat->dps->zcosil * $sat->dps->zcosil); |
|
566 | - $sat->dps->zsinhl = 0.089683511 * $stem / $sat->dps->zsinil; |
|
567 | - $sat->dps->zcoshl = sqrt(1.0 - $sat->dps->zsinhl * $sat->dps->zsinhl); |
|
568 | - $c = 4.7199672 + 0.22997150 * $day; |
|
569 | - $gam = 5.8351514 + 0.0019443680 * $day; |
|
564 | + $sat->dps->zcosil = 0.91375164 - 0.03568096*$ctem; |
|
565 | + $sat->dps->zsinil = sqrt(1.0 - $sat->dps->zcosil*$sat->dps->zcosil); |
|
566 | + $sat->dps->zsinhl = 0.089683511*$stem/$sat->dps->zsinil; |
|
567 | + $sat->dps->zcoshl = sqrt(1.0 - $sat->dps->zsinhl*$sat->dps->zsinhl); |
|
568 | + $c = 4.7199672 + 0.22997150*$day; |
|
569 | + $gam = 5.8351514 + 0.0019443680*$day; |
|
570 | 570 | $sat->dps->zmol = Predict_Math::FMod2p($c - $gam); |
571 | - $zx = 0.39785416 * $stem / $sat->dps->zsinil; |
|
572 | - $zy = $sat->dps->zcoshl * $ctem + 0.91744867 * $sat->dps->zsinhl * $stem; |
|
571 | + $zx = 0.39785416*$stem/$sat->dps->zsinil; |
|
572 | + $zy = $sat->dps->zcoshl*$ctem + 0.91744867*$sat->dps->zsinhl*$stem; |
|
573 | 573 | $zx = Predict_Math::AcTan($zx, $zy); |
574 | 574 | $zx = $gam + $zx - $xnodce; |
575 | 575 | $sat->dps->zcosgl = cos($zx); |
576 | 576 | $sat->dps->zsingl = sin($zx); |
577 | - $sat->dps->zmos = 6.2565837 + 0.017201977 * $day; |
|
577 | + $sat->dps->zmos = 6.2565837 + 0.017201977*$day; |
|
578 | 578 | $sat->dps->zmos = Predict_Math::FMod2p($sat->dps->zmos); |
579 | 579 | } /* End if(day != preep) */ |
580 | 580 | |
@@ -590,74 +590,74 @@ discard block |
||
590 | 590 | $zn = Predict::zns; |
591 | 591 | $ze = Predict::zes; |
592 | 592 | $zmo = $sat->dps->zmos; |
593 | - $xnoi = 1.0 / $sat->dps->xnq; |
|
593 | + $xnoi = 1.0/$sat->dps->xnq; |
|
594 | 594 | |
595 | 595 | /* Loop breaks when Solar terms are done a second */ |
596 | 596 | /* time, after Lunar terms are initialized */ |
597 | - for(;;) { |
|
597 | + for (;;) { |
|
598 | 598 | /* Solar terms done again after Lunar terms are done */ |
599 | - $a1 = $zcosg * $zcosh + $zsing * $zcosi * $zsinh; |
|
600 | - $a3 = -$zsing * $zcosh + $zcosg * $zcosi * $zsinh; |
|
601 | - $a7 = -$zcosg * $zsinh + $zsing * $zcosi * $zcosh; |
|
602 | - $a8 = $zsing * $zsini; |
|
603 | - $a9 = $zsing * $zsinh + $zcosg * $zcosi * $zcosh; |
|
604 | - $a10 = $zcosg * $zsini; |
|
605 | - $a2 = $sat->deep_arg->cosio * $a7 + $sat->deep_arg->sinio * $a8; |
|
606 | - $a4 = $sat->deep_arg->cosio * $a9 + $sat->deep_arg->sinio * $a10; |
|
607 | - $a5 = -$sat->deep_arg->sinio * $a7 + $sat->deep_arg->cosio * $a8; |
|
608 | - $a6 = -$sat->deep_arg->sinio * $a9 + $sat->deep_arg->cosio * $a10; |
|
609 | - $x1 = $a1 * $sat->deep_arg->cosg + $a2 * $sat->deep_arg->sing; |
|
610 | - $x2 = $a3 * $sat->deep_arg->cosg + $a4 * $sat->deep_arg->sing; |
|
611 | - $x3 = -$a1 * $sat->deep_arg->sing + $a2 * $sat->deep_arg->cosg; |
|
612 | - $x4 = -$a3 * $sat->deep_arg->sing + $a4 * $sat->deep_arg->cosg; |
|
613 | - $x5 = $a5 * $sat->deep_arg->sing; |
|
614 | - $x6 = $a6 * $sat->deep_arg->sing; |
|
615 | - $x7 = $a5 * $sat->deep_arg->cosg; |
|
616 | - $x8 = $a6 * $sat->deep_arg->cosg; |
|
617 | - $z31 = 12 * $x1 * $x1 - 3 * $x3 * $x3; |
|
618 | - $z32 = 24 * $x1 * $x2 - 6 * $x3 * $x4; |
|
619 | - $z33 = 12 * $x2 * $x2 - 3 * $x4 * $x4; |
|
620 | - $z1 = 3 * ($a1 * $a1 + $a2 * $a2) + $z31 * $sat->deep_arg->eosq; |
|
621 | - $z2 = 6 * ($a1 * $a3 + $a2 * $a4) + $z32 * $sat->deep_arg->eosq; |
|
622 | - $z3 = 3 * ($a3 * $a3 + $a4 * $a4) + $z33 * $sat->deep_arg->eosq; |
|
623 | - $z11 = -6 * $a1 * $a5 + $sat->deep_arg->eosq * (-24 * $x1 * $x7 - 6 * $x3 * $x5); |
|
624 | - $z12 = -6 * ($a1 * $a6 + $a3 * $a5) + $sat->deep_arg->eosq * |
|
625 | - (-24 * ($x2 * $x7 + $x1 * $x8) - 6 * ($x3 * $x6 + $x4 * $x5)); |
|
626 | - $z13 = -6 * $a3 * $a6 + $sat->deep_arg->eosq * (-24 * $x2 * $x8 - 6 * $x4 * $x6); |
|
627 | - $z21 = 6 * $a2 * $a5 + $sat->deep_arg->eosq * (24 * $x1 * $x5 - 6 * $x3 * $x7); |
|
628 | - $z22 = 6 * ($a4 * $a5 + $a2 * $a6) + $sat->deep_arg->eosq * |
|
629 | - (24 * ($x2 * $x5 + $x1 * $x6) - 6 * ($x4 * $x7 + $x3 * $x8)); |
|
630 | - $z23 = 6 * $a4 * $a6 + $sat->deep_arg->eosq * (24 * $x2 * $x6 - 6 * $x4 * $x8); |
|
631 | - $z1 = $z1 + $z1 + $sat->deep_arg->betao2 * $z31; |
|
632 | - $z2 = $z2 + $z2 + $sat->deep_arg->betao2 * $z32; |
|
633 | - $z3 = $z3 + $z3 + $sat->deep_arg->betao2 * $z33; |
|
634 | - $s3 = $cc * $xnoi; |
|
635 | - $s2 = -0.5 * $s3 / $sat->deep_arg->betao; |
|
636 | - $s4 = $s3 * $sat->deep_arg->betao; |
|
637 | - $s1 = -15 * $eq * $s4; |
|
638 | - $s5 = $x1 * $x3 + $x2 * $x4; |
|
639 | - $s6 = $x2 * $x3 + $x1 * $x4; |
|
640 | - $s7 = $x2 * $x4 - $x1 * $x3; |
|
641 | - $se = $s1 * $zn * $s5; |
|
642 | - $si = $s2 * $zn * ($z11 + $z13); |
|
643 | - $sl = -$zn * $s3 * ($z1 + $z3 - 14 - 6 * $sat->deep_arg->eosq); |
|
644 | - $sgh = $s4 * $zn * ($z31 + $z33 - 6); |
|
645 | - $sh = -$zn * $s2 * ($z21 + $z23); |
|
599 | + $a1 = $zcosg*$zcosh + $zsing*$zcosi*$zsinh; |
|
600 | + $a3 = -$zsing*$zcosh + $zcosg*$zcosi*$zsinh; |
|
601 | + $a7 = -$zcosg*$zsinh + $zsing*$zcosi*$zcosh; |
|
602 | + $a8 = $zsing*$zsini; |
|
603 | + $a9 = $zsing*$zsinh + $zcosg*$zcosi*$zcosh; |
|
604 | + $a10 = $zcosg*$zsini; |
|
605 | + $a2 = $sat->deep_arg->cosio*$a7 + $sat->deep_arg->sinio*$a8; |
|
606 | + $a4 = $sat->deep_arg->cosio*$a9 + $sat->deep_arg->sinio*$a10; |
|
607 | + $a5 = -$sat->deep_arg->sinio*$a7 + $sat->deep_arg->cosio*$a8; |
|
608 | + $a6 = -$sat->deep_arg->sinio*$a9 + $sat->deep_arg->cosio*$a10; |
|
609 | + $x1 = $a1*$sat->deep_arg->cosg + $a2*$sat->deep_arg->sing; |
|
610 | + $x2 = $a3*$sat->deep_arg->cosg + $a4*$sat->deep_arg->sing; |
|
611 | + $x3 = -$a1*$sat->deep_arg->sing + $a2*$sat->deep_arg->cosg; |
|
612 | + $x4 = -$a3*$sat->deep_arg->sing + $a4*$sat->deep_arg->cosg; |
|
613 | + $x5 = $a5*$sat->deep_arg->sing; |
|
614 | + $x6 = $a6*$sat->deep_arg->sing; |
|
615 | + $x7 = $a5*$sat->deep_arg->cosg; |
|
616 | + $x8 = $a6*$sat->deep_arg->cosg; |
|
617 | + $z31 = 12*$x1*$x1 - 3*$x3*$x3; |
|
618 | + $z32 = 24*$x1*$x2 - 6*$x3*$x4; |
|
619 | + $z33 = 12*$x2*$x2 - 3*$x4*$x4; |
|
620 | + $z1 = 3*($a1*$a1 + $a2*$a2) + $z31*$sat->deep_arg->eosq; |
|
621 | + $z2 = 6*($a1*$a3 + $a2*$a4) + $z32*$sat->deep_arg->eosq; |
|
622 | + $z3 = 3*($a3*$a3 + $a4*$a4) + $z33*$sat->deep_arg->eosq; |
|
623 | + $z11 = -6*$a1*$a5 + $sat->deep_arg->eosq*(-24*$x1*$x7 - 6*$x3*$x5); |
|
624 | + $z12 = -6*($a1*$a6 + $a3*$a5) + $sat->deep_arg->eosq* |
|
625 | + (-24*($x2*$x7 + $x1*$x8) - 6*($x3*$x6 + $x4*$x5)); |
|
626 | + $z13 = -6*$a3*$a6 + $sat->deep_arg->eosq*(-24*$x2*$x8 - 6*$x4*$x6); |
|
627 | + $z21 = 6*$a2*$a5 + $sat->deep_arg->eosq*(24*$x1*$x5 - 6*$x3*$x7); |
|
628 | + $z22 = 6*($a4*$a5 + $a2*$a6) + $sat->deep_arg->eosq* |
|
629 | + (24*($x2*$x5 + $x1*$x6) - 6*($x4*$x7 + $x3*$x8)); |
|
630 | + $z23 = 6*$a4*$a6 + $sat->deep_arg->eosq*(24*$x2*$x6 - 6*$x4*$x8); |
|
631 | + $z1 = $z1 + $z1 + $sat->deep_arg->betao2*$z31; |
|
632 | + $z2 = $z2 + $z2 + $sat->deep_arg->betao2*$z32; |
|
633 | + $z3 = $z3 + $z3 + $sat->deep_arg->betao2*$z33; |
|
634 | + $s3 = $cc*$xnoi; |
|
635 | + $s2 = -0.5*$s3/$sat->deep_arg->betao; |
|
636 | + $s4 = $s3*$sat->deep_arg->betao; |
|
637 | + $s1 = -15*$eq*$s4; |
|
638 | + $s5 = $x1*$x3 + $x2*$x4; |
|
639 | + $s6 = $x2*$x3 + $x1*$x4; |
|
640 | + $s7 = $x2*$x4 - $x1*$x3; |
|
641 | + $se = $s1*$zn*$s5; |
|
642 | + $si = $s2*$zn*($z11 + $z13); |
|
643 | + $sl = -$zn*$s3*($z1 + $z3 - 14 - 6*$sat->deep_arg->eosq); |
|
644 | + $sgh = $s4*$zn*($z31 + $z33 - 6); |
|
645 | + $sh = -$zn*$s2*($z21 + $z23); |
|
646 | 646 | if ($sat->dps->xqncl < 5.2359877E-2) { |
647 | 647 | $sh = 0; |
648 | 648 | } |
649 | - $sat->dps->ee2 = 2 * $s1 * $s6; |
|
650 | - $sat->dps->e3 = 2 * $s1 * $s7; |
|
651 | - $sat->dps->xi2 = 2 * $s2 * $z12; |
|
652 | - $sat->dps->xi3 = 2 * $s2 * ($z13 - $z11); |
|
653 | - $sat->dps->xl2 = -2 * $s3 * $z2; |
|
654 | - $sat->dps->xl3 = -2 * $s3 * ($z3 - $z1); |
|
655 | - $sat->dps->xl4 = -2 * $s3 * (-21 - 9 * $sat->deep_arg->eosq) * $ze; |
|
656 | - $sat->dps->xgh2 = 2 * $s4 * $z32; |
|
657 | - $sat->dps->xgh3 = 2 * $s4 * ($z33 - $z31); |
|
658 | - $sat->dps->xgh4 = -18 * $s4 * $ze; |
|
659 | - $sat->dps->xh2 = -2 * $s2 * $z22; |
|
660 | - $sat->dps->xh3 = -2 * $s2 * ($z23 - $z21); |
|
649 | + $sat->dps->ee2 = 2*$s1*$s6; |
|
650 | + $sat->dps->e3 = 2*$s1*$s7; |
|
651 | + $sat->dps->xi2 = 2*$s2*$z12; |
|
652 | + $sat->dps->xi3 = 2*$s2*($z13 - $z11); |
|
653 | + $sat->dps->xl2 = -2*$s3*$z2; |
|
654 | + $sat->dps->xl3 = -2*$s3*($z3 - $z1); |
|
655 | + $sat->dps->xl4 = -2*$s3*(-21 - 9*$sat->deep_arg->eosq)*$ze; |
|
656 | + $sat->dps->xgh2 = 2*$s4*$z32; |
|
657 | + $sat->dps->xgh3 = 2*$s4*($z33 - $z31); |
|
658 | + $sat->dps->xgh4 = -18*$s4*$ze; |
|
659 | + $sat->dps->xh2 = -2*$s2*$z22; |
|
660 | + $sat->dps->xh3 = -2*$s2*($z23 - $z21); |
|
661 | 661 | |
662 | 662 | if ($sat->flags & self::LUNAR_TERMS_DONE_FLAG) { |
663 | 663 | break; |
@@ -667,8 +667,8 @@ discard block |
||
667 | 667 | $sat->dps->sse = $se; |
668 | 668 | $sat->dps->ssi = $si; |
669 | 669 | $sat->dps->ssl = $sl; |
670 | - $sat->dps->ssh = $sh / $sat->deep_arg->sinio; |
|
671 | - $sat->dps->ssg = $sgh - $sat->deep_arg->cosio * $sat->dps->ssh; |
|
670 | + $sat->dps->ssh = $sh/$sat->deep_arg->sinio; |
|
671 | + $sat->dps->ssg = $sgh - $sat->deep_arg->cosio*$sat->dps->ssh; |
|
672 | 672 | $sat->dps->se2 = $sat->dps->ee2; |
673 | 673 | $sat->dps->si2 = $sat->dps->xi2; |
674 | 674 | $sat->dps->sl2 = $sat->dps->xl2; |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | $zsing = $sat->dps->zsingl; |
686 | 686 | $zcosi = $sat->dps->zcosil; |
687 | 687 | $zsini = $sat->dps->zsinil; |
688 | - $zcosh = $sat->dps->zcoshl * $cosq + $sat->dps->zsinhl * $sinq; |
|
689 | - $zsinh = $sinq * $sat->dps->zcoshl - $cosq * $sat->dps->zsinhl; |
|
688 | + $zcosh = $sat->dps->zcoshl*$cosq + $sat->dps->zsinhl*$sinq; |
|
689 | + $zsinh = $sinq*$sat->dps->zcoshl - $cosq*$sat->dps->zsinhl; |
|
690 | 690 | $zn = Predict::znl; |
691 | 691 | $cc = Predict::c1l; |
692 | 692 | $ze = Predict::zel; |
@@ -697,113 +697,113 @@ discard block |
||
697 | 697 | $sat->dps->sse = $sat->dps->sse + $se; |
698 | 698 | $sat->dps->ssi = $sat->dps->ssi + $si; |
699 | 699 | $sat->dps->ssl = $sat->dps->ssl + $sl; |
700 | - $sat->dps->ssg = $sat->dps->ssg + $sgh - $sat->deep_arg->cosio / $sat->deep_arg->sinio * $sh; |
|
701 | - $sat->dps->ssh = $sat->dps->ssh + $sh / $sat->deep_arg->sinio; |
|
700 | + $sat->dps->ssg = $sat->dps->ssg + $sgh - $sat->deep_arg->cosio/$sat->deep_arg->sinio*$sh; |
|
701 | + $sat->dps->ssh = $sat->dps->ssh + $sh/$sat->deep_arg->sinio; |
|
702 | 702 | |
703 | 703 | /* Geopotential resonance initialization for 12 hour orbits */ |
704 | 704 | $sat->flags &= ~self::RESONANCE_FLAG; |
705 | 705 | $sat->flags &= ~self::SYNCHRONOUS_FLAG; |
706 | 706 | |
707 | 707 | if (!(($sat->dps->xnq < 0.0052359877) && ($sat->dps->xnq > 0.0034906585))) { |
708 | - if( ($sat->dps->xnq < 0.00826) || ($sat->dps->xnq > 0.00924) ) { |
|
708 | + if (($sat->dps->xnq < 0.00826) || ($sat->dps->xnq > 0.00924)) { |
|
709 | 709 | return; |
710 | 710 | } |
711 | 711 | if ($eq < 0.5) { |
712 | 712 | return; |
713 | 713 | } |
714 | 714 | $sat->flags |= self::RESONANCE_FLAG; |
715 | - $eoc = $eq * $sat->deep_arg->eosq; |
|
716 | - $g201 = -0.306 - ($eq - 0.64) * 0.440; |
|
715 | + $eoc = $eq*$sat->deep_arg->eosq; |
|
716 | + $g201 = -0.306 - ($eq - 0.64)*0.440; |
|
717 | 717 | if ($eq <= 0.65) { |
718 | - $g211 = 3.616 - 13.247 * $eq + 16.290 * $sat->deep_arg->eosq; |
|
719 | - $g310 = -19.302 + 117.390 * $eq - 228.419 * |
|
720 | - $sat->deep_arg->eosq + 156.591 * $eoc; |
|
721 | - $g322 = -18.9068 + 109.7927 * $eq - 214.6334 * |
|
722 | - $sat->deep_arg->eosq + 146.5816 * $eoc; |
|
723 | - $g410 = -41.122 + 242.694 * $eq - 471.094 * |
|
724 | - $sat->deep_arg->eosq + 313.953 * $eoc; |
|
725 | - $g422 = -146.407 + 841.880 * $eq - 1629.014 * |
|
726 | - $sat->deep_arg->eosq + 1083.435 * $eoc; |
|
727 | - $g520 = -532.114 + 3017.977 * $eq - 5740 * |
|
728 | - $sat->deep_arg->eosq + 3708.276 * $eoc; |
|
718 | + $g211 = 3.616 - 13.247*$eq + 16.290*$sat->deep_arg->eosq; |
|
719 | + $g310 = -19.302 + 117.390*$eq - 228.419* |
|
720 | + $sat->deep_arg->eosq + 156.591*$eoc; |
|
721 | + $g322 = -18.9068 + 109.7927*$eq - 214.6334* |
|
722 | + $sat->deep_arg->eosq + 146.5816*$eoc; |
|
723 | + $g410 = -41.122 + 242.694*$eq - 471.094* |
|
724 | + $sat->deep_arg->eosq + 313.953*$eoc; |
|
725 | + $g422 = -146.407 + 841.880*$eq - 1629.014* |
|
726 | + $sat->deep_arg->eosq + 1083.435*$eoc; |
|
727 | + $g520 = -532.114 + 3017.977*$eq - 5740* |
|
728 | + $sat->deep_arg->eosq + 3708.276*$eoc; |
|
729 | 729 | } else { |
730 | - $g211 = -72.099 + 331.819 * $eq - 508.738 * |
|
731 | - $sat->deep_arg->eosq + 266.724 * $eoc; |
|
732 | - $g310 = -346.844 + 1582.851 * $eq - 2415.925 * |
|
733 | - $sat->deep_arg->eosq + 1246.113 * $eoc; |
|
734 | - $g322 = -342.585 + 1554.908 * $eq - 2366.899 * |
|
735 | - $sat->deep_arg->eosq + 1215.972 * $eoc; |
|
736 | - $g410 = -1052.797 + 4758.686 * $eq - 7193.992 * |
|
737 | - $sat->deep_arg->eosq + 3651.957 * $eoc; |
|
738 | - $g422 = -3581.69 + 16178.11 * $eq - 24462.77 * |
|
739 | - $sat->deep_arg->eosq+ 12422.52 * $eoc; |
|
730 | + $g211 = -72.099 + 331.819*$eq - 508.738* |
|
731 | + $sat->deep_arg->eosq + 266.724*$eoc; |
|
732 | + $g310 = -346.844 + 1582.851*$eq - 2415.925* |
|
733 | + $sat->deep_arg->eosq + 1246.113*$eoc; |
|
734 | + $g322 = -342.585 + 1554.908*$eq - 2366.899* |
|
735 | + $sat->deep_arg->eosq + 1215.972*$eoc; |
|
736 | + $g410 = -1052.797 + 4758.686*$eq - 7193.992* |
|
737 | + $sat->deep_arg->eosq + 3651.957*$eoc; |
|
738 | + $g422 = -3581.69 + 16178.11*$eq - 24462.77* |
|
739 | + $sat->deep_arg->eosq + 12422.52*$eoc; |
|
740 | 740 | if ($eq <= 0.715) { |
741 | - $g520 = 1464.74 - 4664.75 * $eq + 3763.64 * $sat->deep_arg->eosq; |
|
741 | + $g520 = 1464.74 - 4664.75*$eq + 3763.64*$sat->deep_arg->eosq; |
|
742 | 742 | } else { |
743 | - $g520 = -5149.66 + 29936.92 * $eq - 54087.36 * |
|
744 | - $sat->deep_arg->eosq + 31324.56 * $eoc; |
|
743 | + $g520 = -5149.66 + 29936.92*$eq - 54087.36* |
|
744 | + $sat->deep_arg->eosq + 31324.56*$eoc; |
|
745 | 745 | } |
746 | 746 | } /* End if (eq <= 0.65) */ |
747 | 747 | |
748 | 748 | if ($eq < 0.7) { |
749 | - $g533 = -919.2277 + 4988.61 * $eq - 9064.77 * |
|
750 | - $sat->deep_arg->eosq + 5542.21 * $eoc; |
|
751 | - $g521 = -822.71072 + 4568.6173 * $eq - 8491.4146 * |
|
752 | - $sat->deep_arg->eosq + 5337.524 * $eoc; |
|
753 | - $g532 = -853.666 + 4690.25 * $eq - 8624.77 * |
|
754 | - $sat->deep_arg->eosq + 5341.4 * $eoc; |
|
749 | + $g533 = -919.2277 + 4988.61*$eq - 9064.77* |
|
750 | + $sat->deep_arg->eosq + 5542.21*$eoc; |
|
751 | + $g521 = -822.71072 + 4568.6173*$eq - 8491.4146* |
|
752 | + $sat->deep_arg->eosq + 5337.524*$eoc; |
|
753 | + $g532 = -853.666 + 4690.25*$eq - 8624.77* |
|
754 | + $sat->deep_arg->eosq + 5341.4*$eoc; |
|
755 | 755 | } |
756 | 756 | else { |
757 | - $g533 = -37995.78 + 161616.52 * $eq - 229838.2* |
|
758 | - $sat->deep_arg->eosq + 109377.94 * $eoc; |
|
759 | - $g521 = -51752.104 + 218913.95 * $eq - 309468.16* |
|
760 | - $sat->deep_arg->eosq + 146349.42 * $eoc; |
|
761 | - $g532 = -40023.88 + 170470.89 * $eq - 242699.48* |
|
762 | - $sat->deep_arg->eosq + 115605.82 * $eoc; |
|
757 | + $g533 = -37995.78 + 161616.52*$eq - 229838.2* |
|
758 | + $sat->deep_arg->eosq + 109377.94*$eoc; |
|
759 | + $g521 = -51752.104 + 218913.95*$eq - 309468.16* |
|
760 | + $sat->deep_arg->eosq + 146349.42*$eoc; |
|
761 | + $g532 = -40023.88 + 170470.89*$eq - 242699.48* |
|
762 | + $sat->deep_arg->eosq + 115605.82*$eoc; |
|
763 | 763 | } /* End if (eq <= 0.7) */ |
764 | 764 | |
765 | - $sini2 = $sat->deep_arg->sinio * $sat->deep_arg->sinio; |
|
766 | - $f220 = 0.75 * (1 + 2 * $sat->deep_arg->cosio + $sat->deep_arg->theta2); |
|
767 | - $f221 = 1.5 * $sini2; |
|
768 | - $f321 = 1.875 * $sat->deep_arg->sinio * (1 - 2 * |
|
769 | - $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
770 | - $f322 = -1.875 * $sat->deep_arg->sinio * (1 + 2* |
|
771 | - $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2); |
|
772 | - $f441 = 35 * $sini2 * $f220; |
|
773 | - $f442 = 39.3750 * $sini2 * $sini2; |
|
774 | - $f522 = 9.84375 * $sat->deep_arg->sinio * ($sini2 * (1 - 2 * $sat->deep_arg->cosio - 5 * |
|
775 | - $sat->deep_arg->theta2) + 0.33333333 * (-2 + 4 * $sat->deep_arg->cosio + |
|
776 | - 6 * $sat->deep_arg->theta2)); |
|
777 | - $f523 = $sat->deep_arg->sinio * (4.92187512 * $sini2 * (-2 - 4 * |
|
778 | - $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2) + 6.56250012 |
|
779 | - * (1 + 2 * $sat->deep_arg->cosio - 3 * $sat->deep_arg->theta2)); |
|
780 | - $f542 = 29.53125 * $sat->deep_arg->sinio * (2 - 8 * |
|
781 | - $sat->deep_arg->cosio + $sat->deep_arg->theta2 * |
|
782 | - (-12 + 8 * $sat->deep_arg->cosio + 10 * $sat->deep_arg->theta2)); |
|
783 | - $f543 = 29.53125 * $sat->deep_arg->sinio * (-2 - 8 * $sat->deep_arg->cosio + |
|
784 | - $sat->deep_arg->theta2 * (12 + 8 * $sat->deep_arg->cosio - 10 * |
|
765 | + $sini2 = $sat->deep_arg->sinio*$sat->deep_arg->sinio; |
|
766 | + $f220 = 0.75*(1 + 2*$sat->deep_arg->cosio + $sat->deep_arg->theta2); |
|
767 | + $f221 = 1.5*$sini2; |
|
768 | + $f321 = 1.875*$sat->deep_arg->sinio*(1 - 2* |
|
769 | + $sat->deep_arg->cosio - 3*$sat->deep_arg->theta2); |
|
770 | + $f322 = -1.875*$sat->deep_arg->sinio*(1 + 2* |
|
771 | + $sat->deep_arg->cosio - 3*$sat->deep_arg->theta2); |
|
772 | + $f441 = 35*$sini2*$f220; |
|
773 | + $f442 = 39.3750*$sini2*$sini2; |
|
774 | + $f522 = 9.84375*$sat->deep_arg->sinio*($sini2*(1 - 2*$sat->deep_arg->cosio - 5* |
|
775 | + $sat->deep_arg->theta2) + 0.33333333*(-2 + 4*$sat->deep_arg->cosio + |
|
776 | + 6*$sat->deep_arg->theta2)); |
|
777 | + $f523 = $sat->deep_arg->sinio*(4.92187512*$sini2*(-2 - 4* |
|
778 | + $sat->deep_arg->cosio + 10*$sat->deep_arg->theta2) + 6.56250012 |
|
779 | + * (1 + 2*$sat->deep_arg->cosio - 3*$sat->deep_arg->theta2)); |
|
780 | + $f542 = 29.53125*$sat->deep_arg->sinio*(2 - 8* |
|
781 | + $sat->deep_arg->cosio + $sat->deep_arg->theta2* |
|
782 | + (-12 + 8*$sat->deep_arg->cosio + 10*$sat->deep_arg->theta2)); |
|
783 | + $f543 = 29.53125*$sat->deep_arg->sinio*(-2 - 8*$sat->deep_arg->cosio + |
|
784 | + $sat->deep_arg->theta2*(12 + 8*$sat->deep_arg->cosio - 10* |
|
785 | 785 | $sat->deep_arg->theta2)); |
786 | - $xno2 = $sat->dps->xnq * $sat->dps->xnq; |
|
787 | - $ainv2 = $aqnv * $aqnv; |
|
788 | - $temp1 = 3 * $xno2 * $ainv2; |
|
789 | - $temp = $temp1 * Predict::root22; |
|
790 | - $sat->dps->d2201 = $temp * $f220 * $g201; |
|
791 | - $sat->dps->d2211 = $temp * $f221 * $g211; |
|
792 | - $temp1 = $temp1 * $aqnv; |
|
793 | - $temp = $temp1 * Predict::root32; |
|
794 | - $sat->dps->d3210 = $temp * $f321 * $g310; |
|
795 | - $sat->dps->d3222 = $temp * $f322 * $g322; |
|
796 | - $temp1 = $temp1 * $aqnv; |
|
797 | - $temp = 2 * $temp1 * Predict::root44; |
|
798 | - $sat->dps->d4410 = $temp * $f441 * $g410; |
|
799 | - $sat->dps->d4422 = $temp * $f442 * $g422; |
|
800 | - $temp1 = $temp1 * $aqnv; |
|
801 | - $temp = $temp1 * Predict::root52; |
|
802 | - $sat->dps->d5220 = $temp * $f522 * $g520; |
|
803 | - $sat->dps->d5232 = $temp * $f523 * $g532; |
|
804 | - $temp = 2 * $temp1 * Predict::root54; |
|
805 | - $sat->dps->d5421 = $temp * $f542 * $g521; |
|
806 | - $sat->dps->d5433 = $temp * $f543 * $g533; |
|
786 | + $xno2 = $sat->dps->xnq*$sat->dps->xnq; |
|
787 | + $ainv2 = $aqnv*$aqnv; |
|
788 | + $temp1 = 3*$xno2*$ainv2; |
|
789 | + $temp = $temp1*Predict::root22; |
|
790 | + $sat->dps->d2201 = $temp*$f220*$g201; |
|
791 | + $sat->dps->d2211 = $temp*$f221*$g211; |
|
792 | + $temp1 = $temp1*$aqnv; |
|
793 | + $temp = $temp1*Predict::root32; |
|
794 | + $sat->dps->d3210 = $temp*$f321*$g310; |
|
795 | + $sat->dps->d3222 = $temp*$f322*$g322; |
|
796 | + $temp1 = $temp1*$aqnv; |
|
797 | + $temp = 2*$temp1*Predict::root44; |
|
798 | + $sat->dps->d4410 = $temp*$f441*$g410; |
|
799 | + $sat->dps->d4422 = $temp*$f442*$g422; |
|
800 | + $temp1 = $temp1*$aqnv; |
|
801 | + $temp = $temp1*Predict::root52; |
|
802 | + $sat->dps->d5220 = $temp*$f522*$g520; |
|
803 | + $sat->dps->d5232 = $temp*$f523*$g532; |
|
804 | + $temp = 2*$temp1*Predict::root54; |
|
805 | + $sat->dps->d5421 = $temp*$f542*$g521; |
|
806 | + $sat->dps->d5433 = $temp*$f543*$g533; |
|
807 | 807 | $sat->dps->xlamo = $xmao + $sat->tle->xnodeo + $sat->tle->xnodeo - $sat->dps->thgr - $sat->dps->thgr; |
808 | 808 | $bfact = $sat->deep_arg->xmdot + $sat->deep_arg->xnodot + |
809 | 809 | $sat->deep_arg->xnodot - Predict::thdt - Predict::thdt; |
@@ -812,18 +812,18 @@ discard block |
||
812 | 812 | $sat->flags |= self::RESONANCE_FLAG; |
813 | 813 | $sat->flags |= self::SYNCHRONOUS_FLAG; |
814 | 814 | /* Synchronous resonance terms initialization */ |
815 | - $g200 = 1 + $sat->deep_arg->eosq * (-2.5 + 0.8125 * $sat->deep_arg->eosq); |
|
816 | - $g310 = 1 + 2 * $sat->deep_arg->eosq; |
|
817 | - $g300 = 1 + $sat->deep_arg->eosq * (-6 + 6.60937 * $sat->deep_arg->eosq); |
|
818 | - $f220 = 0.75 * (1 + $sat->deep_arg->cosio) * (1 + $sat->deep_arg->cosio); |
|
819 | - $f311 = 0.9375 * $sat->deep_arg->sinio * $sat->deep_arg->sinio * |
|
820 | - (1 + 3 * $sat->deep_arg->cosio) - 0.75 * (1 + $sat->deep_arg->cosio); |
|
815 | + $g200 = 1 + $sat->deep_arg->eosq*(-2.5 + 0.8125*$sat->deep_arg->eosq); |
|
816 | + $g310 = 1 + 2*$sat->deep_arg->eosq; |
|
817 | + $g300 = 1 + $sat->deep_arg->eosq*(-6 + 6.60937*$sat->deep_arg->eosq); |
|
818 | + $f220 = 0.75*(1 + $sat->deep_arg->cosio)*(1 + $sat->deep_arg->cosio); |
|
819 | + $f311 = 0.9375*$sat->deep_arg->sinio*$sat->deep_arg->sinio* |
|
820 | + (1 + 3*$sat->deep_arg->cosio) - 0.75*(1 + $sat->deep_arg->cosio); |
|
821 | 821 | $f330 = 1 + $sat->deep_arg->cosio; |
822 | - $f330 = 1.875 * $f330 * $f330 * $f330; |
|
823 | - $sat->dps->del1 = 3 * $sat->dps->xnq * $sat->dps->xnq * $aqnv * $aqnv; |
|
824 | - $sat->dps->del2 = 2 * $sat->dps->del1 * $f220 * $g200 * Predict::q22; |
|
825 | - $sat->dps->del3 = 3 * $sat->dps->del1 * $f330 * $g300 * Predict::q33 * $aqnv; |
|
826 | - $sat->dps->del1 = $sat->dps->del1 * $f311 * $g310 * Predict::q31 * $aqnv; |
|
822 | + $f330 = 1.875*$f330*$f330*$f330; |
|
823 | + $sat->dps->del1 = 3*$sat->dps->xnq*$sat->dps->xnq*$aqnv*$aqnv; |
|
824 | + $sat->dps->del2 = 2*$sat->dps->del1*$f220*$g200*Predict::q22; |
|
825 | + $sat->dps->del3 = 3*$sat->dps->del1*$f330*$g300*Predict::q33*$aqnv; |
|
826 | + $sat->dps->del1 = $sat->dps->del1*$f311*$g310*Predict::q31*$aqnv; |
|
827 | 827 | $sat->dps->fasx2 = 0.13130908; |
828 | 828 | $sat->dps->fasx4 = 2.8843198; |
829 | 829 | $sat->dps->fasx6 = 0.37448087; |
@@ -845,24 +845,24 @@ discard block |
||
845 | 845 | return; |
846 | 846 | |
847 | 847 | case self::dpsec: /* Entrance for deep space secular effects */ |
848 | - $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->ssl * $sat->deep_arg->t; |
|
849 | - $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $sat->dps->ssg * $sat->deep_arg->t; |
|
850 | - $sat->deep_arg->xnode = $sat->deep_arg->xnode + $sat->dps->ssh * $sat->deep_arg->t; |
|
851 | - $sat->deep_arg->em = $sat->tle->eo + $sat->dps->sse * $sat->deep_arg->t; |
|
852 | - $sat->deep_arg->xinc = $sat->tle->xincl + $sat->dps->ssi * $sat->deep_arg->t; |
|
848 | + $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->ssl*$sat->deep_arg->t; |
|
849 | + $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $sat->dps->ssg*$sat->deep_arg->t; |
|
850 | + $sat->deep_arg->xnode = $sat->deep_arg->xnode + $sat->dps->ssh*$sat->deep_arg->t; |
|
851 | + $sat->deep_arg->em = $sat->tle->eo + $sat->dps->sse*$sat->deep_arg->t; |
|
852 | + $sat->deep_arg->xinc = $sat->tle->xincl + $sat->dps->ssi*$sat->deep_arg->t; |
|
853 | 853 | if ($sat->deep_arg->xinc < 0) { |
854 | 854 | $sat->deep_arg->xinc = -$sat->deep_arg->xinc; |
855 | 855 | $sat->deep_arg->xnode = $sat->deep_arg->xnode + Predict::pi; |
856 | 856 | $sat->deep_arg->omgadf = $sat->deep_arg->omgadf - Predict::pi; |
857 | 857 | } |
858 | - if(~$sat->flags & self::RESONANCE_FLAG ) { |
|
858 | + if (~$sat->flags & self::RESONANCE_FLAG) { |
|
859 | 859 | return; |
860 | 860 | } |
861 | 861 | |
862 | 862 | do { |
863 | - if ( ($sat->dps->atime == 0) || |
|
863 | + if (($sat->dps->atime == 0) || |
|
864 | 864 | (($sat->deep_arg->t >= 0) && ($sat->dps->atime < 0)) || |
865 | - (($sat->deep_arg->t < 0) && ($sat->dps->atime >= 0)) ) { |
|
865 | + (($sat->deep_arg->t < 0) && ($sat->dps->atime >= 0))) { |
|
866 | 866 | /* Epoch restart */ |
867 | 867 | if ($sat->deep_arg->t >= 0) { |
868 | 868 | $delt = $sat->dps->stepp; |
@@ -899,47 +899,47 @@ discard block |
||
899 | 899 | } else { |
900 | 900 | $delt = $sat->dps->stepp; |
901 | 901 | } |
902 | - $sat->flags |= (self::DO_LOOP_FLAG | self::EPOCH_RESTART_FLAG); |
|
902 | + $sat->flags |= (self::DO_LOOP_FLAG|self::EPOCH_RESTART_FLAG); |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | /* Dot terms calculated */ |
906 | 906 | if ($sat->flags & self::SYNCHRONOUS_FLAG) { |
907 | - $xndot = $sat->dps->del1 * sin($sat->dps->xli - $sat->dps->fasx2) + $sat->dps->del2 * sin(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
908 | - + $sat->dps->del3 * sin(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
909 | - $xnddt = $sat->dps->del1 * cos($sat->dps->xli - $sat->dps->fasx2) + 2 * $sat->dps->del2 * cos(2 * ($sat->dps->xli - $sat->dps->fasx4)) |
|
910 | - + 3 * $sat->dps->del3 * cos(3 * ($sat->dps->xli - $sat->dps->fasx6)); |
|
907 | + $xndot = $sat->dps->del1*sin($sat->dps->xli - $sat->dps->fasx2) + $sat->dps->del2*sin(2*($sat->dps->xli - $sat->dps->fasx4)) |
|
908 | + + $sat->dps->del3*sin(3*($sat->dps->xli - $sat->dps->fasx6)); |
|
909 | + $xnddt = $sat->dps->del1*cos($sat->dps->xli - $sat->dps->fasx2) + 2*$sat->dps->del2*cos(2*($sat->dps->xli - $sat->dps->fasx4)) |
|
910 | + + 3*$sat->dps->del3*cos(3*($sat->dps->xli - $sat->dps->fasx6)); |
|
911 | 911 | } else { |
912 | - $xomi = $sat->dps->omegaq + $sat->deep_arg->omgdot * $sat->dps->atime; |
|
912 | + $xomi = $sat->dps->omegaq + $sat->deep_arg->omgdot*$sat->dps->atime; |
|
913 | 913 | $x2omi = $xomi + $xomi; |
914 | 914 | $x2li = $sat->dps->xli + $sat->dps->xli; |
915 | - $xndot = $sat->dps->d2201 * sin($x2omi + $sat->dps->xli - Predict::g22) |
|
916 | - + $sat->dps->d2211 * sin($sat->dps->xli - Predict::g22) |
|
917 | - + $sat->dps->d3210 * sin($xomi + $sat->dps->xli - Predict::g32) |
|
918 | - + $sat->dps->d3222 * sin(-$xomi + $sat->dps->xli - Predict::g32) |
|
919 | - + $sat->dps->d4410 * sin($x2omi + $x2li- Predict::g44) |
|
920 | - + $sat->dps->d4422 * sin($x2li- Predict::g44) |
|
921 | - + $sat->dps->d5220 * sin($xomi + $sat->dps->xli- Predict::g52) |
|
922 | - + $sat->dps->d5232 * sin(-$xomi + $sat->dps->xli- Predict::g52) |
|
923 | - + $sat->dps->d5421 * sin($xomi + $x2li - Predict::g54) |
|
924 | - + $sat->dps->d5433 * sin(-$xomi + $x2li - Predict::g54); |
|
925 | - $xnddt = $sat->dps->d2201 * cos($x2omi + $sat->dps->xli- Predict::g22) |
|
926 | - + $sat->dps->d2211 * cos($sat->dps->xli - Predict::g22) |
|
927 | - + $sat->dps->d3210 * cos($xomi + $sat->dps->xli - Predict::g32) |
|
928 | - + $sat->dps->d3222 * cos(-$xomi + $sat->dps->xli - Predict::g32) |
|
929 | - + $sat->dps->d5220 * cos($xomi + $sat->dps->xli - Predict::g52) |
|
930 | - + $sat->dps->d5232 * cos(-$xomi + $sat->dps->xli - Predict::g52) |
|
931 | - + 2 * ($sat->dps->d4410 * cos($x2omi + $x2li - Predict::g44) |
|
932 | - + $sat->dps->d4422 * cos($x2li - Predict::g44) |
|
933 | - + $sat->dps->d5421 * cos($xomi + $x2li - Predict::g54) |
|
934 | - + $sat->dps->d5433 * cos(-$xomi + $x2li - Predict::g54)); |
|
915 | + $xndot = $sat->dps->d2201*sin($x2omi + $sat->dps->xli - Predict::g22) |
|
916 | + + $sat->dps->d2211*sin($sat->dps->xli - Predict::g22) |
|
917 | + + $sat->dps->d3210*sin($xomi + $sat->dps->xli - Predict::g32) |
|
918 | + + $sat->dps->d3222*sin(-$xomi + $sat->dps->xli - Predict::g32) |
|
919 | + + $sat->dps->d4410*sin($x2omi + $x2li - Predict::g44) |
|
920 | + + $sat->dps->d4422*sin($x2li - Predict::g44) |
|
921 | + + $sat->dps->d5220*sin($xomi + $sat->dps->xli - Predict::g52) |
|
922 | + + $sat->dps->d5232*sin(-$xomi + $sat->dps->xli - Predict::g52) |
|
923 | + + $sat->dps->d5421*sin($xomi + $x2li - Predict::g54) |
|
924 | + + $sat->dps->d5433*sin(-$xomi + $x2li - Predict::g54); |
|
925 | + $xnddt = $sat->dps->d2201*cos($x2omi + $sat->dps->xli - Predict::g22) |
|
926 | + + $sat->dps->d2211*cos($sat->dps->xli - Predict::g22) |
|
927 | + + $sat->dps->d3210*cos($xomi + $sat->dps->xli - Predict::g32) |
|
928 | + + $sat->dps->d3222*cos(-$xomi + $sat->dps->xli - Predict::g32) |
|
929 | + + $sat->dps->d5220*cos($xomi + $sat->dps->xli - Predict::g52) |
|
930 | + + $sat->dps->d5232*cos(-$xomi + $sat->dps->xli - Predict::g52) |
|
931 | + + 2*($sat->dps->d4410*cos($x2omi + $x2li - Predict::g44) |
|
932 | + + $sat->dps->d4422*cos($x2li - Predict::g44) |
|
933 | + + $sat->dps->d5421*cos($xomi + $x2li - Predict::g54) |
|
934 | + + $sat->dps->d5433*cos(-$xomi + $x2li - Predict::g54)); |
|
935 | 935 | } /* End of if (isFlagSet(SYNCHRONOUS_FLAG)) */ |
936 | 936 | |
937 | 937 | $xldot = $sat->dps->xni + $sat->dps->xfact; |
938 | - $xnddt = $xnddt * $xldot; |
|
938 | + $xnddt = $xnddt*$xldot; |
|
939 | 939 | |
940 | 940 | if ($sat->flags & self::DO_LOOP_FLAG) { |
941 | - $sat->dps->xli = $sat->dps->xli + $xldot * $delt + $xndot * $sat->dps->step2; |
|
942 | - $sat->dps->xni = $sat->dps->xni + $xndot * $delt + $xnddt * $sat->dps->step2; |
|
941 | + $sat->dps->xli = $sat->dps->xli + $xldot*$delt + $xndot*$sat->dps->step2; |
|
942 | + $sat->dps->xni = $sat->dps->xni + $xndot*$delt + $xnddt*$sat->dps->step2; |
|
943 | 943 | $sat->dps->atime = $sat->dps->atime + $delt; |
944 | 944 | } |
945 | 945 | } while (($sat->flags & self::DO_LOOP_FLAG) && |
@@ -947,9 +947,9 @@ discard block |
||
947 | 947 | } |
948 | 948 | while (($sat->flags & self::DO_LOOP_FLAG) && ($sat->flags & self::EPOCH_RESTART_FLAG)); |
949 | 949 | |
950 | - $sat->deep_arg->xn = $sat->dps->xni + $xndot * $ft + $xnddt * $ft * $ft * 0.5; |
|
951 | - $xl = $sat->dps->xli + $xldot * $ft + $xndot * $ft * $ft * 0.5; |
|
952 | - $temp = -$sat->deep_arg->xnode + $sat->dps->thgr + $sat->deep_arg->t * Predict::thdt; |
|
950 | + $sat->deep_arg->xn = $sat->dps->xni + $xndot*$ft + $xnddt*$ft*$ft*0.5; |
|
951 | + $xl = $sat->dps->xli + $xldot*$ft + $xndot*$ft*$ft*0.5; |
|
952 | + $temp = -$sat->deep_arg->xnode + $sat->dps->thgr + $sat->deep_arg->t*Predict::thdt; |
|
953 | 953 | |
954 | 954 | if (~$sat->flags & self::SYNCHRONOUS_FLAG) { |
955 | 955 | $sat->deep_arg->xll = $xl + $temp + $temp; |
@@ -965,26 +965,26 @@ discard block |
||
965 | 965 | $cosis = cos($sat->deep_arg->xinc); |
966 | 966 | if (abs($sat->dps->savtsn - $sat->deep_arg->t) >= 30) { |
967 | 967 | $sat->dps->savtsn = $sat->deep_arg->t; |
968 | - $zm = $sat->dps->zmos + Predict::zns * $sat->deep_arg->t; |
|
969 | - $zf = $zm + 2 * Predict::zes * sin($zm); |
|
968 | + $zm = $sat->dps->zmos + Predict::zns*$sat->deep_arg->t; |
|
969 | + $zf = $zm + 2*Predict::zes*sin($zm); |
|
970 | 970 | $sinzf = sin($zf); |
971 | - $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
972 | - $f3 = -0.5 * $sinzf * cos($zf); |
|
973 | - $ses = $sat->dps->se2 * $f2 + $sat->dps->se3 * $f3; |
|
974 | - $sis = $sat->dps->si2 * $f2 + $sat->dps->si3 * $f3; |
|
975 | - $sls = $sat->dps->sl2 * $f2 + $sat->dps->sl3 * $f3 + $sat->dps->sl4 * $sinzf; |
|
976 | - $sat->dps->sghs = $sat->dps->sgh2 * $f2 + $sat->dps->sgh3 * $f3 + $sat->dps->sgh4 * $sinzf; |
|
977 | - $sat->dps->shs = $sat->dps->sh2 * $f2 + $sat->dps->sh3 * $f3; |
|
978 | - $zm = $sat->dps->zmol + Predict::znl * $sat->deep_arg->t; |
|
979 | - $zf = $zm + 2 * Predict::zel * sin($zm); |
|
971 | + $f2 = 0.5*$sinzf*$sinzf - 0.25; |
|
972 | + $f3 = -0.5*$sinzf*cos($zf); |
|
973 | + $ses = $sat->dps->se2*$f2 + $sat->dps->se3*$f3; |
|
974 | + $sis = $sat->dps->si2*$f2 + $sat->dps->si3*$f3; |
|
975 | + $sls = $sat->dps->sl2*$f2 + $sat->dps->sl3*$f3 + $sat->dps->sl4*$sinzf; |
|
976 | + $sat->dps->sghs = $sat->dps->sgh2*$f2 + $sat->dps->sgh3*$f3 + $sat->dps->sgh4*$sinzf; |
|
977 | + $sat->dps->shs = $sat->dps->sh2*$f2 + $sat->dps->sh3*$f3; |
|
978 | + $zm = $sat->dps->zmol + Predict::znl*$sat->deep_arg->t; |
|
979 | + $zf = $zm + 2*Predict::zel*sin($zm); |
|
980 | 980 | $sinzf = sin($zf); |
981 | - $f2 = 0.5 * $sinzf * $sinzf - 0.25; |
|
982 | - $f3 = -0.5 * $sinzf * cos($zf); |
|
983 | - $sel = $sat->dps->ee2 * $f2 + $sat->dps->e3 * $f3; |
|
984 | - $sil = $sat->dps->xi2 * $f2 + $sat->dps->xi3 * $f3; |
|
985 | - $sll = $sat->dps->xl2 * $f2 + $sat->dps->xl3 * $f3 + $sat->dps->xl4 * $sinzf; |
|
986 | - $sat->dps->sghl = $sat->dps->xgh2 * $f2 + $sat->dps->xgh3 * $f3 + $sat->dps->xgh4 * $sinzf; |
|
987 | - $sat->dps->sh1 = $sat->dps->xh2 * $f2 + $sat->dps->xh3 * $f3; |
|
981 | + $f2 = 0.5*$sinzf*$sinzf - 0.25; |
|
982 | + $f3 = -0.5*$sinzf*cos($zf); |
|
983 | + $sel = $sat->dps->ee2*$f2 + $sat->dps->e3*$f3; |
|
984 | + $sil = $sat->dps->xi2*$f2 + $sat->dps->xi3*$f3; |
|
985 | + $sll = $sat->dps->xl2*$f2 + $sat->dps->xl3*$f3 + $sat->dps->xl4*$sinzf; |
|
986 | + $sat->dps->sghl = $sat->dps->xgh2*$f2 + $sat->dps->xgh3*$f3 + $sat->dps->xgh4*$sinzf; |
|
987 | + $sat->dps->sh1 = $sat->dps->xh2*$f2 + $sat->dps->xh3*$f3; |
|
988 | 988 | $sat->dps->pe = $ses + $sel; |
989 | 989 | $sat->dps->pinc = $sis + $sil; |
990 | 990 | $sat->dps->pl = $sls + $sll; |
@@ -997,8 +997,8 @@ discard block |
||
997 | 997 | |
998 | 998 | if ($sat->dps->xqncl >= 0.2) { |
999 | 999 | /* Apply periodics directly */ |
1000 | - $ph = $ph / $sat->deep_arg->sinio; |
|
1001 | - $pgh = $pgh - $sat->deep_arg->cosio * $ph; |
|
1000 | + $ph = $ph/$sat->deep_arg->sinio; |
|
1001 | + $pgh = $pgh - $sat->deep_arg->cosio*$ph; |
|
1002 | 1002 | $sat->deep_arg->omgadf = $sat->deep_arg->omgadf + $pgh; |
1003 | 1003 | $sat->deep_arg->xnode = $sat->deep_arg->xnode + $ph; |
1004 | 1004 | $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
@@ -1006,22 +1006,22 @@ discard block |
||
1006 | 1006 | /* Apply periodics with Lyddane modification */ |
1007 | 1007 | $sinok = sin($sat->deep_arg->xnode); |
1008 | 1008 | $cosok = cos($sat->deep_arg->xnode); |
1009 | - $alfdp = $sinis * $sinok; |
|
1010 | - $betdp = $sinis * $cosok; |
|
1011 | - $dalf = $ph * $cosok + $sat->dps->pinc * $cosis * $sinok; |
|
1012 | - $dbet = -$ph * $sinok + $sat->dps->pinc * $cosis * $cosok; |
|
1009 | + $alfdp = $sinis*$sinok; |
|
1010 | + $betdp = $sinis*$cosok; |
|
1011 | + $dalf = $ph*$cosok + $sat->dps->pinc*$cosis*$sinok; |
|
1012 | + $dbet = -$ph*$sinok + $sat->dps->pinc*$cosis*$cosok; |
|
1013 | 1013 | $alfdp = $alfdp + $dalf; |
1014 | 1014 | $betdp = $betdp + $dbet; |
1015 | 1015 | $sat->deep_arg->xnode = Predict_Math::FMod2p($sat->deep_arg->xnode); |
1016 | - $xls = $sat->deep_arg->xll + $sat->deep_arg->omgadf + $cosis * $sat->deep_arg->xnode; |
|
1017 | - $dls = $sat->dps->pl + $pgh - $sat->dps->pinc * $sat->deep_arg->xnode * $sinis; |
|
1016 | + $xls = $sat->deep_arg->xll + $sat->deep_arg->omgadf + $cosis*$sat->deep_arg->xnode; |
|
1017 | + $dls = $sat->dps->pl + $pgh - $sat->dps->pinc*$sat->deep_arg->xnode*$sinis; |
|
1018 | 1018 | $xls = $xls + $dls; |
1019 | 1019 | $xnoh = $sat->deep_arg->xnode; |
1020 | 1020 | $sat->deep_arg->xnode = Predict_Math::AcTan($alfdp, $betdp); |
1021 | 1021 | |
1022 | 1022 | /* This is a patch to Lyddane modification */ |
1023 | 1023 | /* suggested by Rob Matson. */ |
1024 | - if(abs($xnoh - $sat->deep_arg->xnode) > Predict::pi) { |
|
1024 | + if (abs($xnoh - $sat->deep_arg->xnode) > Predict::pi) { |
|
1025 | 1025 | if ($sat->deep_arg->xnode < $xnoh) { |
1026 | 1026 | $sat->deep_arg->xnode += Predict::twopi; |
1027 | 1027 | } else { |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | } |
1031 | 1031 | |
1032 | 1032 | $sat->deep_arg->xll = $sat->deep_arg->xll + $sat->dps->pl; |
1033 | - $sat->deep_arg->omgadf = $xls - $sat->deep_arg->xll - cos($sat->deep_arg->xinc) * |
|
1033 | + $sat->deep_arg->omgadf = $xls - $sat->deep_arg->xll - cos($sat->deep_arg->xinc)* |
|
1034 | 1034 | $sat->deep_arg->xnode; |
1035 | 1035 | } /* End case dpper: */ |
1036 | 1036 | return; |