@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
|
2 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); |
|
3 | 3 | if ($id == "") |
4 | 4 | { |
5 | 5 | header('Location: /'); |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | |
17 | 17 | if (!empty($spotter_array)) |
18 | 18 | { |
19 | - if(isset($spotter_array[0]['flightaware_id'])) { |
|
19 | + if (isset($spotter_array[0]['flightaware_id'])) { |
|
20 | 20 | $flightaware_id = $spotter_array[0]['flightaware_id']; |
21 | 21 | } |
22 | - if(isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') { |
|
22 | + if (isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') { |
|
23 | 23 | $latitude = $spotter_array[0]['last_latitude']; |
24 | - } elseif(isset($spotter_array[0]['latitude'])) { |
|
24 | + } elseif (isset($spotter_array[0]['latitude'])) { |
|
25 | 25 | $latitude = $spotter_array[0]['latitude']; |
26 | 26 | } |
27 | - if(isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') { |
|
27 | + if (isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') { |
|
28 | 28 | $longitude = $spotter_array[0]['last_longitude']; |
29 | - } elseif(isset($spotter_array[0]['longitude'])) { |
|
29 | + } elseif (isset($spotter_array[0]['longitude'])) { |
|
30 | 30 | $longitude = $spotter_array[0]['longitude']; |
31 | 31 | } |
32 | 32 | |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | $title = ''; |
42 | - if(isset($spotter_array[0]['ident'])) { |
|
42 | + if (isset($spotter_array[0]['ident'])) { |
|
43 | 43 | $title .= $spotter_array[0]['ident']; |
44 | 44 | } |
45 | - if(isset($spotter_array[0]['airline_name'])) { |
|
45 | + if (isset($spotter_array[0]['airline_name'])) { |
|
46 | 46 | $title .= ' - '.$spotter_array[0]['airline_name']; |
47 | 47 | } |
48 | - if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
48 | + if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
49 | 49 | $title .= ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')'; |
50 | 50 | } |
51 | - if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') { |
|
51 | + if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') { |
|
52 | 52 | $title .= ' - '.$spotter_array[0]['registration']; |
53 | 53 | } |
54 | 54 | //$facebook_meta_image = $spotter_array[0]['image']; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $altitude_data = ''; |
69 | 69 | $hour_data = ''; |
70 | 70 | $speed_data = ''; |
71 | - foreach($all_data as $data) |
|
71 | + foreach ($all_data as $data) |
|
72 | 72 | { |
73 | 73 | $hour_data .= '"'.$data['date'].'",'; |
74 | 74 | if (isset($data['real_altitude']) && $data['real_altitude'] != '') { |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | $speed_data .= $speed.','; |
97 | 97 | } |
98 | 98 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
99 | - $altitude_data = "['altitude',".substr($altitude_data,0,-1)."]"; |
|
100 | - $speed_data = "['speed',".substr($speed_data,0,-1)."]"; |
|
99 | + $altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]"; |
|
100 | + $speed_data = "['speed',".substr($speed_data, 0, -1)."]"; |
|
101 | 101 | print 'c3.generate({ |
102 | 102 | bindto: "#chart", |
103 | 103 | data: { |
@@ -143,16 +143,16 @@ discard block |
||
143 | 143 | print '<a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a> '; |
144 | 144 | } |
145 | 145 | } |
146 | - if(isset($spotter_array[0]['ident'])) { |
|
146 | + if (isset($spotter_array[0]['ident'])) { |
|
147 | 147 | print $spotter_array[0]['ident']; |
148 | 148 | } |
149 | - if(isset($spotter_array[0]['airline_name'])) { |
|
149 | + if (isset($spotter_array[0]['airline_name'])) { |
|
150 | 150 | print ' - '.$spotter_array[0]['airline_name']; |
151 | 151 | } |
152 | - if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
152 | + if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
153 | 153 | print ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')'; |
154 | 154 | } |
155 | - if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') { |
|
155 | + if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') { |
|
156 | 156 | print ' - '.$spotter_array[0]['registration']; |
157 | 157 | } |
158 | 158 | print '</h1>'; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | print '</div>'; |
307 | 307 | */ |
308 | 308 | |
309 | - foreach($spotter_array as $spotter_item) |
|
309 | + foreach ($spotter_array as $spotter_item) |
|
310 | 310 | { |
311 | 311 | print '<div class="details">'; |
312 | 312 | print '<h3>'._("Flight Information").'</h3>'; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') { |
407 | 407 | if ($spotter_item['departure_airport_time'] > 2460) { |
408 | 408 | print '<div class="time">'; |
409 | - print 'at '.date('H:m',$spotter_item['departure_airport_time']); |
|
409 | + print 'at '.date('H:m', $spotter_item['departure_airport_time']); |
|
410 | 410 | print '</div>'; |
411 | 411 | } else { |
412 | 412 | print '<div class="time">'; |
@@ -556,19 +556,19 @@ discard block |
||
556 | 556 | if (count($departure_airport_info) > 0) { |
557 | 557 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
558 | 558 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
559 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm'; |
|
559 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm'; |
|
560 | 560 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
561 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi'; |
|
561 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi'; |
|
562 | 562 | } else { |
563 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km'; |
|
563 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km'; |
|
564 | 564 | } |
565 | 565 | } else { |
566 | 566 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
567 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm'; |
|
567 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm'; |
|
568 | 568 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
569 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi'; |
|
569 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi'; |
|
570 | 570 | } else { |
571 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km'; |
|
571 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km'; |
|
572 | 572 | } |
573 | 573 | } |
574 | 574 | } |
@@ -584,19 +584,19 @@ discard block |
||
584 | 584 | if (count($arrival_airport_info) > 0) { |
585 | 585 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
586 | 586 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
587 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm'; |
|
587 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm'; |
|
588 | 588 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
589 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi'; |
|
589 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi'; |
|
590 | 590 | } else { |
591 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km'; |
|
591 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km'; |
|
592 | 592 | } |
593 | 593 | } else { |
594 | 594 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
595 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm'; |
|
595 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm'; |
|
596 | 596 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
597 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi'; |
|
597 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi'; |
|
598 | 598 | } else { |
599 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km'; |
|
599 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km'; |
|
600 | 600 | } |
601 | 601 | } |
602 | 602 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | print '<div class="last-flights">'; |
617 | 617 | print '<h3>'._("Last 5 Flights of this Aircraft").' ('.$registration.')</h3>'; |
618 | 618 | $hide_th_links = true; |
619 | - $spotter_array = $Spotter->getSpotterDataByRegistration($registration,"0,5", ""); |
|
619 | + $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,5", ""); |
|
620 | 620 | include('table-output.php'); |
621 | 621 | print '<div class="more">'; |
622 | 622 | print '<a href="'.$globalURL.'/registration/'.$registration.'" class="btn btn-default btn" role="button">See all Flights»</a>'; |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | $globalDebug = FALSE; |
71 | 71 | $dbroot = $_SESSION['database_root']; |
72 | 72 | $dbrootpass = $_SESSION['database_rootpass']; |
73 | - $error .= create_db::create_database($dbroot,$dbrootpass,$globalDBuser,$globalDBpass,$globalDBname,$globalDBdriver,$globalDBhost); |
|
73 | + $error .= create_db::create_database($dbroot, $dbrootpass, $globalDBuser, $globalDBpass, $globalDBname, $globalDBdriver, $globalDBhost); |
|
74 | 74 | sleep(5); |
75 | 75 | if ($error != '') { |
76 | 76 | $_SESSION['error'] = $error; |
77 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database')); |
|
78 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
77 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create database')); |
|
78 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create database')); |
|
79 | 79 | $_SESSION['install'] = 'database_import'; |
80 | 80 | $_SESSION['next'] = 'Create and import tables'; |
81 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
81 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
82 | 82 | print json_encode($result); |
83 | 83 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
84 | 84 | $globalDebug = FALSE; |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | } |
93 | 93 | if ($error != '') { |
94 | 94 | $_SESSION['error'] = $error; |
95 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
96 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
95 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
96 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create and import tables')); |
|
97 | 97 | if ((!isset($globalAircraft) || $globalAircraft === TRUE) && (!isset($globalVA) || $globalVA === FALSE)) { |
98 | 98 | $_SESSION['install'] = 'populate'; |
99 | 99 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | $_SESSION['install'] = 'sources'; |
102 | 102 | $_SESSION['next'] = 'Insert data in source table'; |
103 | 103 | } |
104 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
104 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
105 | 105 | print json_encode($result); |
106 | 106 | } elseif (!is_numeric($check_version)) { |
107 | 107 | $error .= $check_version; |
108 | 108 | $_SESSION['error'] = $error; |
109 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
109 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
110 | 110 | if (!isset($_SESSION['next'])) $_SESSION['next'] = ''; |
111 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
111 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
112 | 112 | print json_encode($result); |
113 | 113 | } else { |
114 | 114 | $error .= update_schema::check_version(true); |
115 | 115 | if ($error != '') { |
116 | 116 | $_SESSION['error'] = $error; |
117 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed')); |
|
118 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
117 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Update schema if needed')); |
|
118 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Update schema if needed')); |
|
119 | 119 | $_SESSION['install'] = 'sources'; |
120 | 120 | $_SESSION['next'] = 'Insert data in source table'; |
121 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
121 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
122 | 122 | print json_encode($result); |
123 | 123 | } |
124 | 124 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'waypoints') { |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | $error .= update_db::update_waypoints(); |
128 | 128 | if ($error != '') { |
129 | 129 | $_SESSION['error'] = $error; |
130 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database')); |
|
131 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
130 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate waypoints database')); |
|
131 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate waypoints database')); |
|
132 | 132 | /* |
133 | 133 | $_SESSION['install'] = 'airspace'; |
134 | 134 | $_SESSION['next'] = 'Populate airspace table'; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | $_SESSION['install'] = 'countries'; |
147 | 147 | $_SESSION['next'] = 'Populate countries table'; |
148 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
148 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
149 | 149 | print json_encode($result); |
150 | 150 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'countries') { |
151 | 151 | include_once('class.update_db.php'); |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | $error .= update_db::update_countries(); |
154 | 154 | if ($error != '') { |
155 | 155 | $_SESSION['error'] = $error; |
156 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
|
157 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
156 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate countries database')); |
|
157 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate countries database')); |
|
158 | 158 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | 159 | $_SESSION['install'] = 'notam'; |
160 | 160 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
161 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
161 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
162 | 162 | print json_encode($result); |
163 | 163 | /* |
164 | 164 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | } else { |
172 | 172 | $_SESSION['install'] = 'sources'; |
173 | 173 | $_SESSION['next'] = 'Insert data in source table'; |
174 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
174 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
175 | 175 | print json_encode($result); |
176 | 176 | } |
177 | 177 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
178 | 178 | if (!is_writable('tmp')) { |
179 | 179 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
180 | 180 | $_SESSION['error'] = $error; |
181 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
182 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
181 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
182 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
183 | 183 | print json_encode($result); |
184 | 184 | } else { |
185 | 185 | include_once('class.update_db.php'); |
@@ -187,19 +187,19 @@ discard block |
||
187 | 187 | $error .= update_db::update_ModeS_fam(); |
188 | 188 | if ($error != '') { |
189 | 189 | $_SESSION['error'] = $error; |
190 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
191 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
190 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
191 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
192 | 192 | $_SESSION['install'] = 'populate_flarm'; |
193 | 193 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
194 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
194 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
195 | 195 | print json_encode($result); |
196 | 196 | } |
197 | 197 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
198 | 198 | if (!is_writable('tmp')) { |
199 | 199 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
200 | 200 | $_SESSION['error'] = $error; |
201 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
202 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
201 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
202 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
203 | 203 | print json_encode($result); |
204 | 204 | } else { |
205 | 205 | include_once('class.update_db.php'); |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | $error .= update_db::update_ModeS_ogn(); |
209 | 209 | if ($error != '') { |
210 | 210 | $_SESSION['error'] = $error; |
211 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
212 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
211 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
212 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
213 | 213 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
214 | 214 | $_SESSION['install'] = 'vatsim'; |
215 | 215 | if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
@@ -228,15 +228,15 @@ discard block |
||
228 | 228 | $_SESSION['install'] = 'routes'; |
229 | 229 | $_SESSION['next'] = 'Populate routes table with externals data'; |
230 | 230 | } |
231 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
231 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
232 | 232 | print json_encode($result); |
233 | 233 | } |
234 | 234 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
235 | 235 | if (!is_writable('tmp')) { |
236 | 236 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
237 | 237 | $_SESSION['error'] = $error; |
238 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
239 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
238 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
239 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
240 | 240 | print json_encode($result); |
241 | 241 | } else { |
242 | 242 | include_once('class.update_db.php'); |
@@ -244,19 +244,19 @@ discard block |
||
244 | 244 | $error .= update_db::update_routes_fam(); |
245 | 245 | if ($error != '') { |
246 | 246 | $_SESSION['error'] = $error; |
247 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data')); |
|
248 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
247 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate routes table with externals data')); |
|
248 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate routes table with externals data')); |
|
249 | 249 | $_SESSION['install'] = 'translation'; |
250 | 250 | $_SESSION['next'] = 'Populate translation table with externals data'; |
251 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
251 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
252 | 252 | print json_encode($result); |
253 | 253 | } |
254 | 254 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
255 | 255 | if (!is_writable('tmp')) { |
256 | 256 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
257 | 257 | $_SESSION['error'] = $error; |
258 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
259 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
258 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
259 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
260 | 260 | print json_encode($result); |
261 | 261 | } else { |
262 | 262 | include_once('class.update_db.php'); |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | $error .= update_db::update_translation_fam(); |
265 | 265 | if ($error != '') { |
266 | 266 | $_SESSION['error'] = $error; |
267 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
268 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
267 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
268 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate translation table with externals data')); |
|
269 | 269 | if ($_SESSION['waypoints'] == 1) { |
270 | 270 | $_SESSION['install'] = 'waypoints'; |
271 | 271 | $_SESSION['next'] = 'Populate waypoints table'; |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | $_SESSION['install'] = 'sources'; |
284 | 284 | $_SESSION['next'] = 'Insert data in source table'; |
285 | 285 | } |
286 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
286 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
287 | 287 | print json_encode($result); |
288 | 288 | } |
289 | 289 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
290 | 290 | if (!is_writable('tmp')) { |
291 | 291 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
292 | 292 | $_SESSION['error'] = $error; |
293 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
294 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
293 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
294 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
295 | 295 | print json_encode($result); |
296 | 296 | } else { |
297 | 297 | include_once('class.update_db.php'); |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | $error = update_db::update_owner_fam(); |
300 | 300 | if ($error != '') { |
301 | 301 | $_SESSION['error'] = $error; |
302 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
303 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
302 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
303 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate owner table with externals data')); |
|
304 | 304 | $_SESSION['install'] = 'sources'; |
305 | 305 | $_SESSION['next'] = 'Insert data in source table'; |
306 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
306 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
307 | 307 | print json_encode($result); |
308 | 308 | } |
309 | 309 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
310 | 310 | if (!is_writable('tmp')) { |
311 | 311 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
312 | 312 | $_SESSION['error'] = $error; |
313 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
314 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
313 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
314 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
315 | 315 | print json_encode($result); |
316 | 316 | } else { |
317 | 317 | include_once('class.update_db.php'); |
@@ -320,13 +320,13 @@ discard block |
||
320 | 320 | $error .= update_db::update_notam(); |
321 | 321 | if ($error != '') { |
322 | 322 | $_SESSION['error'] = $error; |
323 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
324 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
323 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
324 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data')); |
|
325 | 325 | } else { |
326 | 326 | if ($error != '') { |
327 | 327 | $_SESSION['error'] = $error; |
328 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)')); |
|
329 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
328 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data (no source defined)')); |
|
329 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data (no source defined)')); |
|
330 | 330 | } |
331 | 331 | /* |
332 | 332 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | $_SESSION['install'] = 'sources'; |
341 | 341 | $_SESSION['next'] = 'Insert data in source table'; |
342 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
342 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
343 | 343 | print json_encode($result); |
344 | 344 | //} |
345 | 345 | } |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $Source = new Source(); |
377 | 377 | $Source->deleteAllLocation(); |
378 | 378 | foreach ($sources as $src) { |
379 | - if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
379 | + if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'], $src['latitude'], $src['longitude'], $src['altitude'], $src['city'], $src['country'], $src['source'], 'antenna.png'); |
|
380 | 380 | } |
381 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
381 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert data in source table')); |
|
382 | 382 | unset($_SESSION['sources']); |
383 | 383 | } |
384 | 384 | /* |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $_SESSION['install'] = 'finish'; |
404 | 404 | $_SESSION['next'] = 'finish'; |
405 | 405 | } |
406 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
406 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
407 | 407 | print json_encode($result); |
408 | 408 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'vatsim') { |
409 | 409 | include_once('../install/class.create_db.php'); |
@@ -415,48 +415,48 @@ discard block |
||
415 | 415 | $error .= update_db::update_IVAO(); |
416 | 416 | if ($error != '') { |
417 | 417 | $_SESSION['error'] = $error; |
418 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
419 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
418 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
419 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
420 | 420 | } else { |
421 | 421 | $error .= update_db::update_vatsim(); |
422 | 422 | if ($error != '') { |
423 | 423 | $_SESSION['error'] = $error; |
424 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
425 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
424 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
425 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
426 | 426 | } |
427 | 427 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
428 | 428 | $error .= update_db::update_vatsim(); |
429 | 429 | if ($error != '') { |
430 | 430 | $_SESSION['error'] = $error; |
431 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
432 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
431 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
432 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
433 | 433 | } elseif (isset($globalIVAO) && $globalIVAO) { |
434 | 434 | if (file_exists('tmp/ivae_feb2013.zip')) { |
435 | 435 | $error .= update_db::update_IVAO(); |
436 | 436 | if ($error != '') { |
437 | 437 | $_SESSION['error'] = $error; |
438 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
439 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
438 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
439 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
440 | 440 | } else { |
441 | 441 | $error .= update_db::update_vatsim(); |
442 | 442 | if ($error != '') { |
443 | 443 | $_SESSION['error'] = $error; |
444 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)')); |
|
445 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
444 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data (IVAO not found)')); |
|
445 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data (IVAO not found)')); |
|
446 | 446 | } |
447 | 447 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
448 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
|
448 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert phpVMS data')); |
|
449 | 449 | } |
450 | 450 | //$_SESSION['install'] = 'routes'; |
451 | 451 | //$_SESSION['next'] = 'Populate routes table with externals data'; |
452 | 452 | $_SESSION['install'] = 'finish'; |
453 | 453 | $_SESSION['next'] = 'finish'; |
454 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
454 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
455 | 455 | print json_encode($result); |
456 | 456 | } else { |
457 | 457 | //unset($_SESSION['install']); |
458 | 458 | $_SESSION['error'] = 'Unknwon task : '.$_SESSION['install']; |
459 | - $result = array('error' => 'Unknwon task : '.$_SESSION['install'],'done' => $_SESSION['done'],'next' => 'finish','install' => 'finish'); |
|
459 | + $result = array('error' => 'Unknwon task : '.$_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish'); |
|
460 | 460 | print json_encode($result); |
461 | 461 | } |
462 | 462 | ?> |
463 | 463 | \ No newline at end of file |
@@ -117,31 +117,31 @@ discard block |
||
117 | 117 | |
118 | 118 | private function make_latf($temp) { // unsigned long |
119 | 119 | $flat = 0.0; // float |
120 | - $temp = $temp & 0x07FFFFFF; |
|
121 | - if ($temp & 0x04000000) { |
|
122 | - $temp = $temp ^ 0x07FFFFFF; |
|
120 | + $temp = $temp&0x07FFFFFF; |
|
121 | + if ($temp&0x04000000) { |
|
122 | + $temp = $temp^0x07FFFFFF; |
|
123 | 123 | $temp += 1; |
124 | - $flat = (float)($temp / (60.0 * 10000.0)); |
|
124 | + $flat = (float) ($temp/(60.0*10000.0)); |
|
125 | 125 | $flat *= -1.0; |
126 | - } else $flat = (float)($temp / (60.0 * 10000.0)); |
|
126 | + } else $flat = (float) ($temp/(60.0*10000.0)); |
|
127 | 127 | return $flat; // float |
128 | 128 | } |
129 | 129 | |
130 | 130 | private function make_lonf($temp) { // unsigned long |
131 | 131 | $flon = 0.0; // float |
132 | - $temp = $temp & 0x0FFFFFFF; |
|
133 | - if ($temp & 0x08000000) { |
|
134 | - $temp = $temp ^ 0x0FFFFFFF; |
|
132 | + $temp = $temp&0x0FFFFFFF; |
|
133 | + if ($temp&0x08000000) { |
|
134 | + $temp = $temp^0x0FFFFFFF; |
|
135 | 135 | $temp += 1; |
136 | - $flon = (float)($temp / (60.0 * 10000.0)); |
|
136 | + $flon = (float) ($temp/(60.0*10000.0)); |
|
137 | 137 | $flon *= -1.0; |
138 | - } else $flon = (float)($temp / (60.0 * 10000.0)); |
|
138 | + } else $flon = (float) ($temp/(60.0*10000.0)); |
|
139 | 139 | return $flon; |
140 | 140 | } |
141 | 141 | |
142 | 142 | private function ascii_2_dec($chr) { |
143 | - $dec=ord($chr);//get decimal ascii code |
|
144 | - $hex=dechex($dec);//convert decimal to hex |
|
143 | + $dec = ord($chr); //get decimal ascii code |
|
144 | + $hex = dechex($dec); //convert decimal to hex |
|
145 | 145 | return ($dec); |
146 | 146 | } |
147 | 147 | |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | //only process in the following range: 48-87, 96-119 |
161 | 161 | if ($ascii < 48) { } |
162 | 162 | else { |
163 | - if($ascii>119) { } |
|
163 | + if ($ascii > 119) { } |
|
164 | 164 | else { |
165 | - if ($ascii>87 && $ascii<96) ; |
|
165 | + if ($ascii > 87 && $ascii < 96); |
|
166 | 166 | else { |
167 | - $ascii=$ascii+40; |
|
168 | - if ($ascii>128){ |
|
169 | - $ascii=$ascii+32; |
|
167 | + $ascii = $ascii + 40; |
|
168 | + if ($ascii > 128) { |
|
169 | + $ascii = $ascii + 32; |
|
170 | 170 | } else { |
171 | - $ascii=$ascii+40; |
|
171 | + $ascii = $ascii + 40; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | private function dec_2_6bit($dec) { |
180 | - $bin=decbin($dec); |
|
180 | + $bin = decbin($dec); |
|
181 | 181 | return(substr($bin, -6)); |
182 | 182 | } |
183 | 183 | |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | ); |
196 | 196 | // " |
197 | 197 | $rv = ''; |
198 | - if ($_size % 6 == 0) { |
|
199 | - $len = $_size / 6; |
|
200 | - for ($i=0; $i<$len; $i++) { |
|
201 | - $offset = $i * 6; |
|
202 | - $rv .= $ais_chars[ bindec(substr($_str,$_start + $offset,6)) ]; |
|
198 | + if ($_size%6 == 0) { |
|
199 | + $len = $_size/6; |
|
200 | + for ($i = 0; $i < $len; $i++) { |
|
201 | + $offset = $i*6; |
|
202 | + $rv .= $ais_chars[bindec(substr($_str, $_start + $offset, 6))]; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | return $rv; |
@@ -226,93 +226,93 @@ discard block |
||
226 | 226 | $ro->eta_hour = ''; |
227 | 227 | $ro->eta_minute = ''; |
228 | 228 | $ro->ts = time(); |
229 | - $ro->id = bindec(substr($_aisdata,0,6)); |
|
230 | - $ro->mmsi = bindec(substr($_aisdata,8,30)); |
|
229 | + $ro->id = bindec(substr($_aisdata, 0, 6)); |
|
230 | + $ro->mmsi = bindec(substr($_aisdata, 8, 30)); |
|
231 | 231 | if ($ro->id >= 1 && $ro->id <= 3) { |
232 | - $ro->cog = bindec(substr($_aisdata,116,12))/10; |
|
233 | - $ro->sog = bindec(substr($_aisdata,50,10))/10; |
|
234 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28))); |
|
235 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27))); |
|
232 | + $ro->cog = bindec(substr($_aisdata, 116, 12))/10; |
|
233 | + $ro->sog = bindec(substr($_aisdata, 50, 10))/10; |
|
234 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28))); |
|
235 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27))); |
|
236 | 236 | $ro->cls = 1; // class A |
237 | 237 | } else if ($ro->id == 4) { |
238 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,79,28))); |
|
239 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,107,27))); |
|
238 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 79, 28))); |
|
239 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 107, 27))); |
|
240 | 240 | $ro->cls = 1; // class A |
241 | 241 | } else if ($ro->id == 5) { |
242 | - $ro->imo = bindec(substr($_aisdata,40,30)); |
|
243 | - $ro->callsign = $this->binchar($_aisdata,70,42); |
|
244 | - $ro->name = $this->binchar($_aisdata,112,120); |
|
245 | - $ro->typeid = bindec(substr($_aisdata,232,8)); |
|
242 | + $ro->imo = bindec(substr($_aisdata, 40, 30)); |
|
243 | + $ro->callsign = $this->binchar($_aisdata, 70, 42); |
|
244 | + $ro->name = $this->binchar($_aisdata, 112, 120); |
|
245 | + $ro->typeid = bindec(substr($_aisdata, 232, 8)); |
|
246 | 246 | $ro->type = $this->getShipType($ro->typeid); |
247 | 247 | //$ro->to_bow = bindec(substr($_aisdata,240,9)); |
248 | 248 | //$ro->to_stern = bindec(substr($_aisdata,249,9)); |
249 | 249 | //$ro->to_port = bindec(substr($_aisdata,258,6)); |
250 | 250 | //$ro->to_starboard = bindec(substr($_aisdata,264,6)); |
251 | - $ro->eta_month = bindec(substr($_aisdata,274,4)); |
|
252 | - $ro->eta_day = bindec(substr($_aisdata,278,5)); |
|
253 | - $ro->eta_hour = bindec(substr($_aisdata,283,5)); |
|
254 | - $ro->eta_minute = bindec(substr($_aisdata,288,6)); |
|
251 | + $ro->eta_month = bindec(substr($_aisdata, 274, 4)); |
|
252 | + $ro->eta_day = bindec(substr($_aisdata, 278, 5)); |
|
253 | + $ro->eta_hour = bindec(substr($_aisdata, 283, 5)); |
|
254 | + $ro->eta_minute = bindec(substr($_aisdata, 288, 6)); |
|
255 | 255 | //$ro->draught = bindec(substr($_aisdata,294,8)); |
256 | - $ro->destination = $this->binchar($_aisdata,302,120); |
|
256 | + $ro->destination = $this->binchar($_aisdata, 302, 120); |
|
257 | 257 | $ro->cls = 1; // class A |
258 | 258 | } else if ($ro->id == 9) { |
259 | 259 | // Search and Rescue aircraft position report |
260 | 260 | } else if ($ro->id == 18) { |
261 | - $ro->cog = bindec(substr($_aisdata,112,12))/10; |
|
262 | - $ro->sog = bindec(substr($_aisdata,46,10))/10; |
|
263 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28))); |
|
264 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27))); |
|
265 | - $ro->heading = bindec(substr($_aisdata,124,9)); |
|
261 | + $ro->cog = bindec(substr($_aisdata, 112, 12))/10; |
|
262 | + $ro->sog = bindec(substr($_aisdata, 46, 10))/10; |
|
263 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 57, 28))); |
|
264 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 85, 27))); |
|
265 | + $ro->heading = bindec(substr($_aisdata, 124, 9)); |
|
266 | 266 | if ($ro->heading == 511) $ro->heading = ''; |
267 | 267 | $ro->cls = 2; // class B |
268 | 268 | } else if ($ro->id == 19) { |
269 | - $ro->cog = bindec(substr($_aisdata,112,12))/10; |
|
270 | - $ro->sog = bindec(substr($_aisdata,46,10))/10; |
|
271 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28))); |
|
272 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27))); |
|
273 | - $ro->name = $this->binchar($_aisdata,143,120); |
|
269 | + $ro->cog = bindec(substr($_aisdata, 112, 12))/10; |
|
270 | + $ro->sog = bindec(substr($_aisdata, 46, 10))/10; |
|
271 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28))); |
|
272 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27))); |
|
273 | + $ro->name = $this->binchar($_aisdata, 143, 120); |
|
274 | 274 | $ro->cls = 2; // class B |
275 | - $ro->heading = bindec(substr($_aisdata,124,9)); |
|
275 | + $ro->heading = bindec(substr($_aisdata, 124, 9)); |
|
276 | 276 | if ($ro->heading == 511) $ro->heading = ''; |
277 | - $ro->typeid = bindec(substr($_aisdata,263,8)); |
|
277 | + $ro->typeid = bindec(substr($_aisdata, 263, 8)); |
|
278 | 278 | $ro->type = $this->getShipType($ro->typeid); |
279 | 279 | //$ro->to_bow = bindec(substr($_aisdata,271,9)); |
280 | 280 | //$ro->to_stern = bindec(substr($_aisdata,280,9)); |
281 | 281 | //$ro->to_port = bindec(substr($_aisdata,289,6)); |
282 | 282 | //$ro->to_starboard = bindec(substr($_aisdata,295,6)); |
283 | 283 | } else if ($ro->id == 21) { |
284 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,164,28))); |
|
285 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,192,27))); |
|
286 | - $ro->name = $this->binchar($_aisdata,43,120); |
|
284 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 164, 28))); |
|
285 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 192, 27))); |
|
286 | + $ro->name = $this->binchar($_aisdata, 43, 120); |
|
287 | 287 | //$ro->to_bow = bindec(substr($_aisdata,219,9)); |
288 | 288 | //$ro->to_stern = bindec(substr($_aisdata,228,9)); |
289 | 289 | //$ro->to_port = bindec(substr($_aisdata,237,6)); |
290 | 290 | //$ro->to_starboard = bindec(substr($_aisdata,243,6)); |
291 | 291 | $ro->cls = 2; // class B |
292 | 292 | } else if ($ro->id == 24) { |
293 | - $pn = bindec(substr($_aisdata,38,2)); |
|
293 | + $pn = bindec(substr($_aisdata, 38, 2)); |
|
294 | 294 | if ($pn == 0) { |
295 | - $ro->name = $this->binchar($_aisdata,40,120); |
|
295 | + $ro->name = $this->binchar($_aisdata, 40, 120); |
|
296 | 296 | } |
297 | - $ro->typeid = bindec(substr($_aisdata,40,8)); |
|
297 | + $ro->typeid = bindec(substr($_aisdata, 40, 8)); |
|
298 | 298 | $ro->type = $this->getShipType($ro->typeid); |
299 | - $ro->callsign = $this->binchar($_aisdata,90,42); |
|
299 | + $ro->callsign = $this->binchar($_aisdata, 90, 42); |
|
300 | 300 | //$ro->to_bow = bindec(substr($_aisdata,132,9)); |
301 | 301 | //$ro->to_stern = bindec(substr($_aisdata,141,9)); |
302 | 302 | //$ro->to_port = bindec(substr($_aisdata,150,6)); |
303 | 303 | //$ro->to_starboard = bindec(substr($_aisdata,156,6)); |
304 | 304 | $ro->cls = 2; // class B |
305 | 305 | } else if ($ro->id == 27) { |
306 | - $ro->cog = bindec(substr($_aisdata,85,9)); |
|
306 | + $ro->cog = bindec(substr($_aisdata, 85, 9)); |
|
307 | 307 | if ($ro->cog == 511) $ro->cog = 0.0; |
308 | - $ro->sog = bindec(substr($_aisdata,79,6)); |
|
308 | + $ro->sog = bindec(substr($_aisdata, 79, 6)); |
|
309 | 309 | if ($ro->sog == 63) $ro->sog = 0.0; |
310 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10); |
|
311 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10); |
|
310 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 44, 18))*10); |
|
311 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 62, 17))*10); |
|
312 | 312 | $ro->cls = 1; // class A |
313 | 313 | |
314 | 314 | } |
315 | - $ro->statusid = bindec(substr($_aisdata,38,4)); |
|
315 | + $ro->statusid = bindec(substr($_aisdata, 38, 4)); |
|
316 | 316 | $ro->status = $this->getStatus($ro->statusid); |
317 | 317 | return $ro; |
318 | 318 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | public function getShipTypeID($type) { |
362 | - $typeid = array_search($type,$this->shiptype); |
|
362 | + $typeid = array_search($type, $this->shiptype); |
|
363 | 363 | if ($typeid !== FALSE) return $typeid; |
364 | 364 | elseif ($type == 'Cargo' || $type == 'General Cargo' || $type == 'Bulk Carrier' || $type == 'Container Ship' || $type == 'Cargo A' || $type == 'Reefer' || $type == 'Vehicles Carrier' || $type == 'Ro-Ro Cargo') return 70; |
365 | 365 | elseif ($type == 'Passengers Ship' || $type == 'Passenger' || $type == 'Ro-Ro/Passenger Ship' || $type == 'Motor Passenger') return 60; |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) { |
382 | 382 | global $port; // tcpip port... |
383 | 383 | static $debug_counter = 0; |
384 | - $aisdata168='';//six bit array of ascii characters |
|
384 | + $aisdata168 = ''; //six bit array of ascii characters |
|
385 | 385 | $ais_nmea_array = str_split($_itu); // convert to an array |
386 | 386 | foreach ($ais_nmea_array as $value) { |
387 | 387 | $dec = $this->ascii_2_dec($value); |
388 | 388 | $bit8 = $this->asciidec_2_8bit($dec); |
389 | 389 | $bit6 = $this->dec_2_6bit($bit8); |
390 | 390 | //echo $value ."-" .$bit6 .""; |
391 | - $aisdata168 .=$bit6; |
|
391 | + $aisdata168 .= $bit6; |
|
392 | 392 | } |
393 | 393 | //echo $aisdata168 . "<br/>"; |
394 | 394 | //return $this->decode_ais($aisdata168, $aux); |
@@ -411,24 +411,24 @@ discard block |
||
411 | 411 | // calculate checksum after ! till * |
412 | 412 | // assume 1st ! is valid |
413 | 413 | // find * ensure that it is at correct position |
414 | - $end = strrpos ( $rawdata , '*' ); |
|
414 | + $end = strrpos($rawdata, '*'); |
|
415 | 415 | if ($end === FALSE) return -1; // check for NULLS!!! |
416 | - $cs = substr( $rawdata, $end + 1 ); |
|
417 | - if ( strlen($cs) != 2 ) return -1; // correct cs length |
|
418 | - $dcs = (int)hexdec( $cs ); |
|
419 | - for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum |
|
420 | - if ( $chksum == $dcs ) { // NMEA checksum pass |
|
416 | + $cs = substr($rawdata, $end + 1); |
|
417 | + if (strlen($cs) != 2) return -1; // correct cs length |
|
418 | + $dcs = (int) hexdec($cs); |
|
419 | + for ($alias = 1; $alias < $end; $alias++) $chksum ^= ord($rawdata[$alias]); // perform XOR for NMEA checksum |
|
420 | + if ($chksum == $dcs) { // NMEA checksum pass |
|
421 | 421 | $pcs = explode(',', $rawdata); |
422 | 422 | // !AI??? identifier |
423 | 423 | if (!isset($pcs[1])) { |
424 | 424 | echo "ERROR,INVALID_DATA ".time()." $rawdata\n"; |
425 | 425 | return -1; |
426 | 426 | } |
427 | - $num_seq = (int)$pcs[1]; // number of sequences |
|
428 | - $seq = (int)$pcs[2]; // get sequence |
|
427 | + $num_seq = (int) $pcs[1]; // number of sequences |
|
428 | + $seq = (int) $pcs[2]; // get sequence |
|
429 | 429 | // get msg sequence id |
430 | 430 | if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1 |
431 | - else $msg_sid = (int)$pcs[3]; // multipart message |
|
431 | + else $msg_sid = (int) $pcs[3]; // multipart message |
|
432 | 432 | $ais_ch = $pcs[4]; // get AIS channel |
433 | 433 | // message sequence checking |
434 | 434 | if ($num_seq < 1 || $num_seq > 9) { |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | } |
463 | 463 | $itu = $itu.$pcs[5]; // get itu message |
464 | - $filler += (int)$pcs[6][0]; // get filler |
|
464 | + $filler += (int) $pcs[6][0]; // get filler |
|
465 | 465 | if ($num_seq == 1 // valid single message |
466 | 466 | || $num_seq == $pseq // valid multi-part message |
467 | 467 | ) { |
@@ -483,13 +483,13 @@ discard block |
||
483 | 483 | $cbuf = $cbuf.$ibuf; |
484 | 484 | $last_pos = 0; |
485 | 485 | $result = new stdClass(); |
486 | - while ( ($start = strpos($cbuf,"VDM",$last_pos)) !== FALSE) { |
|
486 | + while (($start = strpos($cbuf, "VDM", $last_pos)) !== FALSE) { |
|
487 | 487 | //while ( ($start = strpos($cbuf,"!AI",$last_pos)) !== FALSE) { |
488 | 488 | //DEBUG echo $cbuf; |
489 | - if ( ($end = strpos($cbuf,"\r\n", $start)) !== FALSE) { //TBD need to trim? |
|
489 | + if (($end = strpos($cbuf, "\r\n", $start)) !== FALSE) { //TBD need to trim? |
|
490 | 490 | $tst = substr($cbuf, $start - 3, ($end - $start + 3)); |
491 | 491 | //DEBUG echo "[$start $end $tst]\n"; |
492 | - $result = $this->process_ais_raw( $tst, "" ); |
|
492 | + $result = $this->process_ais_raw($tst, ""); |
|
493 | 493 | $last_pos = $end + 1; |
494 | 494 | } else break; |
495 | 495 | } |
@@ -501,41 +501,41 @@ discard block |
||
501 | 501 | // incoming data from serial or IP comms |
502 | 502 | public function process_ais_line($cbuf) { |
503 | 503 | $result = new stdClass(); |
504 | - $start = strpos($cbuf,"VDM"); |
|
504 | + $start = strpos($cbuf, "VDM"); |
|
505 | 505 | $tst = substr($cbuf, $start - 3); |
506 | - $result = $this->process_ais_raw( $tst, "" ); |
|
506 | + $result = $this->process_ais_raw($tst, ""); |
|
507 | 507 | return $result; |
508 | 508 | } |
509 | 509 | |
510 | 510 | /* AIS Encoding |
511 | 511 | */ |
512 | - private function mk_ais_lat( $lat ) { |
|
512 | + private function mk_ais_lat($lat) { |
|
513 | 513 | //$lat = 1.2569; |
514 | - if ($lat<0.0) { |
|
514 | + if ($lat < 0.0) { |
|
515 | 515 | $lat = -$lat; |
516 | - $neg=true; |
|
517 | - } else $neg=false; |
|
516 | + $neg = true; |
|
517 | + } else $neg = false; |
|
518 | 518 | $latd = 0x00000000; |
519 | - $latd = intval ($lat * 600000.0); |
|
520 | - if ($neg==true) { |
|
519 | + $latd = intval($lat*600000.0); |
|
520 | + if ($neg == true) { |
|
521 | 521 | $latd = ~$latd; |
522 | - $latd+=1; |
|
522 | + $latd += 1; |
|
523 | 523 | $latd &= 0x07FFFFFF; |
524 | 524 | } |
525 | 525 | return $latd; |
526 | 526 | } |
527 | 527 | |
528 | - private function mk_ais_lon( $lon ) { |
|
528 | + private function mk_ais_lon($lon) { |
|
529 | 529 | //$lon = 103.851; |
530 | - if ($lon<0.0) { |
|
530 | + if ($lon < 0.0) { |
|
531 | 531 | $lon = -$lon; |
532 | - $neg=true; |
|
533 | - } else $neg=false; |
|
532 | + $neg = true; |
|
533 | + } else $neg = false; |
|
534 | 534 | $lond = 0x00000000; |
535 | - $lond = intval ($lon * 600000.0); |
|
536 | - if ($neg==true) { |
|
535 | + $lond = intval($lon*600000.0); |
|
536 | + if ($neg == true) { |
|
537 | 537 | $lond = ~$lond; |
538 | - $lond+=1; |
|
538 | + $lond += 1; |
|
539 | 539 | $lond &= 0x0FFFFFFF; |
540 | 540 | } |
541 | 541 | return $lond; |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | |
544 | 544 | private function char2bin($name, $max_len) { |
545 | 545 | $len = strlen($name); |
546 | - if ($len > $max_len) $name = substr($name,0,$max_len); |
|
547 | - if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6); |
|
546 | + if ($len > $max_len) $name = substr($name, 0, $max_len); |
|
547 | + if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len)*6); |
|
548 | 548 | else $pad = ''; |
549 | 549 | $rv = ''; |
550 | 550 | $ais_chars = array( |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | foreach ($_a as $_1) { |
563 | 563 | if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1]; |
564 | 564 | else $dec = 0; |
565 | - $bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT); |
|
565 | + $bin = str_pad(decbin($dec), 6, '0', STR_PAD_LEFT); |
|
566 | 566 | $rv .= $bin; |
567 | 567 | //echo "$_1 $dec ($bin)<br/>"; |
568 | 568 | } |
@@ -570,19 +570,19 @@ discard block |
||
570 | 570 | return $rv.$pad; |
571 | 571 | } |
572 | 572 | |
573 | - private function mk_ais($_enc, $_part=1,$_total=1,$_seq='',$_ch='A') { |
|
573 | + private function mk_ais($_enc, $_part = 1, $_total = 1, $_seq = '', $_ch = 'A') { |
|
574 | 574 | $len_bit = strlen($_enc); |
575 | - $rem6 = $len_bit % 6; |
|
575 | + $rem6 = $len_bit%6; |
|
576 | 576 | $pad6_len = 0; |
577 | 577 | if ($rem6) $pad6_len = 6 - $rem6; |
578 | 578 | //echo $pad6_len.'<br>'; |
579 | 579 | $_enc .= str_repeat("0", $pad6_len); // pad the text... |
580 | - $len_enc = strlen($_enc) / 6; |
|
580 | + $len_enc = strlen($_enc)/6; |
|
581 | 581 | //echo $_enc.' '.$len_enc.'<br/>'; |
582 | 582 | $itu = ''; |
583 | - for ($i=0; $i<$len_enc; $i++) { |
|
584 | - $offset = $i * 6; |
|
585 | - $dec = bindec(substr($_enc,$offset,6)); |
|
583 | + for ($i = 0; $i < $len_enc; $i++) { |
|
584 | + $offset = $i*6; |
|
585 | + $dec = bindec(substr($_enc, $offset, 6)); |
|
586 | 586 | if ($dec < 40) $dec += 48; |
587 | 587 | else $dec += 56; |
588 | 588 | //echo chr($dec)." $dec<br/>"; |
@@ -592,15 +592,15 @@ discard block |
||
592 | 592 | $chksum = 0; |
593 | 593 | $itu = "AIVDM,$_part,$_total,$_seq,$_ch,".$itu.",0"; |
594 | 594 | $len_itu = strlen($itu); |
595 | - for ($i=0; $i<$len_itu; $i++) { |
|
596 | - $chksum ^= ord( $itu[$i] ); |
|
595 | + for ($i = 0; $i < $len_itu; $i++) { |
|
596 | + $chksum ^= ord($itu[$i]); |
|
597 | 597 | } |
598 | - $hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); |
|
599 | - $lsb = $chksum & 0x0F; |
|
600 | - if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb]; |
|
598 | + $hex_arr = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); |
|
599 | + $lsb = $chksum&0x0F; |
|
600 | + if ($lsb >= 0 && $lsb <= 15) $lsbc = $hex_arr[$lsb]; |
|
601 | 601 | else $lsbc = '0'; |
602 | - $msb = (($chksum & 0xF0) >> 4) & 0x0F; |
|
603 | - if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb]; |
|
602 | + $msb = (($chksum&0xF0) >> 4)&0x0F; |
|
603 | + if ($msb >= 0 && $msb <= 15) $msbc = $hex_arr[$msb]; |
|
604 | 604 | else $msbc = '0'; |
605 | 605 | $itu = '!'.$itu."*{$msbc}{$lsbc}\r\n"; |
606 | 606 | return $itu; |
@@ -626,14 +626,14 @@ discard block |
||
626 | 626 | |
627 | 627 | public function mmsitype($mmsi) { |
628 | 628 | if (strlen($mmsi) == 9) { |
629 | - if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
|
630 | - elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device'; |
|
631 | - elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)'; |
|
632 | - elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft'; |
|
633 | - elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship'; |
|
634 | - elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation'; |
|
635 | - elseif (substr($mmsi,0,2) == '00') return 'Coastal stations'; |
|
636 | - elseif (substr($mmsi,0,1) == '0') return 'Group of ships'; |
|
629 | + if (substr($mmsi, 0, 3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
|
630 | + elseif (substr($mmsi, 0, 3) == '972') return 'MOB (Man Overboard) device'; |
|
631 | + elseif (substr($mmsi, 0, 3) == '970') return 'AIS SART (Search and Rescue Transmitter)'; |
|
632 | + elseif (substr($mmsi, 0, 3) == '111') return 'SAR (Search and Rescue) aircraft'; |
|
633 | + elseif (substr($mmsi, 0, 2) == '98') return 'Auxiliary craft associated with a parent ship'; |
|
634 | + elseif (substr($mmsi, 0, 2) == '99') return 'Aids to Navigation'; |
|
635 | + elseif (substr($mmsi, 0, 2) == '00') return 'Coastal stations'; |
|
636 | + elseif (substr($mmsi, 0, 1) == '0') return 'Group of ships'; |
|
637 | 637 | else return 'Ship'; |
638 | 638 | } |
639 | 639 | |
@@ -643,19 +643,19 @@ discard block |
||
643 | 643 | public function parse_line($buffer) { |
644 | 644 | global $globalDebug; |
645 | 645 | $result = array(); |
646 | - $start = strpos($buffer,"VDM"); |
|
646 | + $start = strpos($buffer, "VDM"); |
|
647 | 647 | $tst = substr($buffer, $start - 3); |
648 | - $data = $this->process_ais_raw( $tst, "" ); |
|
648 | + $data = $this->process_ais_raw($tst, ""); |
|
649 | 649 | if (!is_object($data)) { |
650 | 650 | //if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n"; |
651 | 651 | return array(); |
652 | 652 | } |
653 | 653 | if ($data->lon != 0) $result['longitude'] = $data->lon; |
654 | 654 | if ($data->lat != 0) $result['latitude'] = $data->lat; |
655 | - $result['ident'] = trim(str_replace('@','',$data->name)); |
|
655 | + $result['ident'] = trim(str_replace('@', '', $data->name)); |
|
656 | 656 | $result['timestamp'] = $data->ts; |
657 | 657 | $result['mmsi'] = $data->mmsi; |
658 | - if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
658 | + if (strlen($result['mmsi']) == 8 && substr($result['mmsi'], 0, 3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
659 | 659 | $result['mmsi_type'] = $this->mmsitype($result['mmsi']); |
660 | 660 | if ($data->sog != -1.0) $result['speed'] = $data->sog; |
661 | 661 | if ($data->heading !== '') $result['heading'] = $data->heading; |
@@ -665,16 +665,16 @@ discard block |
||
665 | 665 | if ($data->type !== '') $result['type'] = $data->type; |
666 | 666 | if ($data->typeid !== '') $result['typeid'] = $data->typeid; |
667 | 667 | if ($data->imo !== '') $result['imo'] = $data->imo; |
668 | - if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign)); |
|
668 | + if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@', '', $data->callsign)); |
|
669 | 669 | if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') { |
670 | - $eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
|
670 | + $eta_ts = strtotime(date('Y').'-'.sprintf("%02d", $data->eta_month).'-'.sprintf("%02d", $data->eta_day).' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00'); |
|
671 | 671 | if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
672 | 672 | } elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) { |
673 | - $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
|
673 | + $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00'); |
|
674 | 674 | if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
675 | 675 | } |
676 | 676 | if ($data->destination != '') { |
677 | - $dest = trim(str_replace('@','',$data->destination)); |
|
677 | + $dest = trim(str_replace('@', '', $data->destination)); |
|
678 | 678 | if ($dest != '') $result['destination'] = $dest; |
679 | 679 | } |
680 | 680 | $result['all'] = (array) $data; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $s3 = sin($bank/2); |
67 | 67 | $c1c2 = $c1*$c2; |
68 | 68 | $s1s2 = $s1*$s2; |
69 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
70 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
71 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
72 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
73 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
69 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
70 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
71 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
72 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
73 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
74 | 74 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
75 | 75 | |
76 | 76 | } |
@@ -92,22 +92,22 @@ discard block |
||
92 | 92 | $allhistory = false; |
93 | 93 | $filter['source'] = array(); |
94 | 94 | $limit = 0; |
95 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
96 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
97 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
98 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
99 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
100 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
101 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
102 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
103 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
104 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
105 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
106 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
95 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
96 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
97 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
98 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
99 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
100 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
101 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
102 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
103 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
104 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
105 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
106 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT); |
|
107 | 107 | if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true; |
108 | 108 | |
109 | 109 | if (isset($_COOKIE['map_3d_limit'])) { |
110 | - $limit = filter_var($_COOKIE['map_3d_limit'],FILTER_SANITIZE_NUMBER_INT); |
|
110 | + $limit = filter_var($_COOKIE['map_3d_limit'], FILTER_SANITIZE_NUMBER_INT); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /* |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | $from_archive = true; |
157 | 157 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
158 | 158 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
159 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
160 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
161 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
162 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
163 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
159 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
160 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
161 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
162 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
163 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
164 | 164 | if ($tracker) { |
165 | - $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter); |
|
165 | + $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter); |
|
166 | 166 | } elseif ($marine) { |
167 | - $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter); |
|
167 | + $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter); |
|
168 | 168 | } else { |
169 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
169 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
170 | 170 | } |
171 | 171 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
172 | 172 | $from_archive = true; |
@@ -183,36 +183,36 @@ discard block |
||
183 | 183 | } |
184 | 184 | $enddate = $_COOKIE['archive_end']; |
185 | 185 | $enddateinitial = $_COOKIE['archive_end']; |
186 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
187 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
188 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
186 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
187 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
188 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
189 | 189 | //echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
190 | 190 | if ($tracker) { |
191 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
191 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
192 | 192 | } elseif ($marine) { |
193 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
193 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
194 | 194 | } else { |
195 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
195 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
196 | 196 | } |
197 | 197 | } elseif ($tracker) { |
198 | 198 | $coord = array(); |
199 | 199 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
200 | - $coord = explode(',',$_GET['coord']); |
|
201 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
200 | + $coord = explode(',', $_GET['coord']); |
|
201 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
202 | 202 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
203 | 203 | $coord = array(); |
204 | 204 | } |
205 | 205 | } |
206 | 206 | $previous_filter = $filter; |
207 | 207 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) { |
208 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker'])); |
|
209 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false); |
|
208 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker'])); |
|
209 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false); |
|
210 | 210 | /* |
211 | 211 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
212 | 212 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']); |
213 | 213 | */ |
214 | 214 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
215 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false); |
|
215 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false); |
|
216 | 216 | } else { |
217 | 217 | $spotter_array = array(); |
218 | 218 | } |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | $coord = array(); |
222 | 222 | //if (isset($_GET['coord']) && $_GET['coord'] != '') { |
223 | 223 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
224 | - $coord = explode(',',$_GET['coord']); |
|
225 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
224 | + $coord = explode(',', $_GET['coord']); |
|
225 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
226 | 226 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
227 | 227 | $coord = array(); |
228 | 228 | } |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) { |
232 | 232 | //$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine'])); |
233 | 233 | //$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
234 | - $spotter_array = $MarineLive->getMinLastLiveMarineDataByID($_COOKIE['MapTrackMarine'],$filter,false); |
|
234 | + $spotter_array = $MarineLive->getMinLastLiveMarineDataByID($_COOKIE['MapTrackMarine'], $filter, false); |
|
235 | 235 | } elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) { |
236 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false,$_COOKIE['MapTrack']); |
|
236 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false, $_COOKIE['MapTrack']); |
|
237 | 237 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
238 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
|
238 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false); |
|
239 | 239 | } else { |
240 | 240 | $spotter_array = array(); |
241 | 241 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | } else { |
244 | 244 | $coord = array(); |
245 | 245 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
246 | - $coord = explode(',',$_GET['coord']); |
|
247 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
246 | + $coord = explode(',', $_GET['coord']); |
|
247 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
248 | 248 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
249 | 249 | $coord = array(); |
250 | 250 | } |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | $previous_filter = $filter; |
253 | 253 | if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
254 | 254 | //$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
255 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,$limit); |
|
255 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'], $filter, $limit); |
|
256 | 256 | //$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false); |
257 | 257 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '') { |
258 | 258 | //$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false); |
259 | 259 | //if (empty($spotter_array)) $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']); |
260 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,$limit,$_COOKIE['MapTrack']); |
|
260 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, $limit, $_COOKIE['MapTrack']); |
|
261 | 261 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
262 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,$limit); |
|
262 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, $limit); |
|
263 | 263 | } else { |
264 | 264 | $spotter_array = array(); |
265 | 265 | } |
@@ -269,19 +269,19 @@ discard block |
||
269 | 269 | if (!empty($spotter_array) && isset($coord)) { |
270 | 270 | if ($tracker) { |
271 | 271 | if (isset($_GET['archive'])) { |
272 | - $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter); |
|
272 | + $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter); |
|
273 | 273 | } else { |
274 | 274 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
275 | 275 | } |
276 | 276 | } elseif ($marine) { |
277 | 277 | if (isset($_GET['archive'])) { |
278 | - $flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter); |
|
278 | + $flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter); |
|
279 | 279 | } else { |
280 | 280 | $flightcnt = $MarineLive->getLiveMarineCount($filter); |
281 | 281 | } |
282 | 282 | } else { |
283 | 283 | if (isset($_GET['archive'])) { |
284 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
284 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
285 | 285 | } else { |
286 | 286 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
287 | 287 | } |
@@ -289,17 +289,17 @@ discard block |
||
289 | 289 | if ($flightcnt == '') $flightcnt = 0; |
290 | 290 | } else $flightcnt = 0; |
291 | 291 | |
292 | -$sqltime = round(microtime(true)-$begintime,2); |
|
292 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
293 | 293 | $minitime = time(); |
294 | 294 | $minitracktime_begin = time(); |
295 | 295 | $minitracktime = $minitracktime_begin; |
296 | 296 | $maxitime = 0; |
297 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
297 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
298 | 298 | $modelsdb = array(); |
299 | 299 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
300 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
301 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
302 | - if (isset($row[1]) ){ |
|
300 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
301 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
302 | + if (isset($row[1])) { |
|
303 | 303 | $model = $row[0]; |
304 | 304 | $modelsdb[$model] = $row[1]; |
305 | 305 | } |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | } |
310 | 310 | $modelsdb2 = array(); |
311 | 311 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
312 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
313 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
314 | - if (isset($row[1]) ){ |
|
312 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
313 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
314 | + if (isset($row[1])) { |
|
315 | 315 | $model = $row[0]; |
316 | 316 | $glb = $row[1]; |
317 | 317 | if (isset($row[2])) { |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | if (!empty($spotter_array) && is_array($spotter_array)) |
358 | 358 | { |
359 | 359 | $nblatlong = 0; |
360 | - foreach($spotter_array as $spotter_item) |
|
360 | + foreach ($spotter_array as $spotter_item) |
|
361 | 361 | { |
362 | 362 | $j++; |
363 | 363 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -411,17 +411,17 @@ discard block |
||
411 | 411 | } |
412 | 412 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
413 | 413 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
414 | - if (isset($spotter_item['ident'])) $output.= '"ident": '.json_encode($spotter_item['ident']).','; |
|
414 | + if (isset($spotter_item['ident'])) $output .= '"ident": '.json_encode($spotter_item['ident']).','; |
|
415 | 415 | if ($tracker) { |
416 | 416 | if (isset($spotter_item['type'])) $output .= '"tracker_type": '.json_encode($spotter_item['type']).','; |
417 | - $output.= '"type": "tracker"'; |
|
417 | + $output .= '"type": "tracker"'; |
|
418 | 418 | } elseif ($marine) { |
419 | 419 | if (isset($spotter_item['type'])) $output .= '"marine_type": '.json_encode($spotter_item['type']).','; |
420 | 420 | if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).','; |
421 | 421 | if (isset($spotter_item['race_id'])) $output .= '"raceid": '.$spotter_item['race_id'].','; |
422 | 422 | if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).','; |
423 | 423 | if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",'; |
424 | - $output.= '"type": "marine"'; |
|
424 | + $output .= '"type": "marine"'; |
|
425 | 425 | } else { |
426 | 426 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
427 | 427 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -435,14 +435,14 @@ discard block |
||
435 | 435 | if (isset($airline_icao)) { |
436 | 436 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
437 | 437 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
438 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
438 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | } |
442 | 442 | //if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
443 | 443 | } |
444 | - $output.= '"gltf2": %gltf2%,'; |
|
445 | - $output.= '"type": "flight"'; |
|
444 | + $output .= '"gltf2": %gltf2%,'; |
|
445 | + $output .= '"type": "flight"'; |
|
446 | 446 | } |
447 | 447 | $output .= '},'; |
448 | 448 | |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | $output .= '},'; |
818 | 818 | } |
819 | 819 | } |
820 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
821 | - else $output = str_replace('%onground%','false',$output); |
|
820 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
821 | + else $output = str_replace('%onground%', 'false', $output); |
|
822 | 822 | |
823 | 823 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
824 | 824 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
835 | 835 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
836 | 836 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
837 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
837 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
838 | 838 | $output .= $spotter_item['longitude'].', '; |
839 | 839 | $output .= $spotter_item['latitude']; |
840 | 840 | $prevlong = $spotter_item['longitude']; |
@@ -862,8 +862,8 @@ discard block |
||
862 | 862 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
863 | 863 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
864 | 864 | } else { |
865 | - $nblatlong = $nblatlong+1; |
|
866 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
865 | + $nblatlong = $nblatlong + 1; |
|
866 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
867 | 867 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
868 | 868 | if ($spotter_item['ground_speed'] == 0) { |
869 | 869 | $output .= $prevlong.', '; |
@@ -904,26 +904,26 @@ discard block |
||
904 | 904 | $output .= ']'; |
905 | 905 | if (isset($globalArchive) && $globalArchive === TRUE) { |
906 | 906 | if (isset($begindateinitial)) { |
907 | - $output = str_replace('%minitime%',date("c",$begindateinitial),$output); |
|
908 | - } elseif ((time()-$globalLiveInterval) > $minitime) { |
|
909 | - if (time()-$globalLiveInterval > $maxitime) { |
|
910 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
907 | + $output = str_replace('%minitime%', date("c", $begindateinitial), $output); |
|
908 | + } elseif ((time() - $globalLiveInterval) > $minitime) { |
|
909 | + if (time() - $globalLiveInterval > $maxitime) { |
|
910 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
911 | 911 | } else { |
912 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
912 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
913 | 913 | } |
914 | 914 | } |
915 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
915 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
916 | 916 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
917 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
917 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
918 | 918 | } else { |
919 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
919 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
920 | 920 | } |
921 | 921 | if (isset($enddateinitial)) { |
922 | - $output = str_replace('%maxitime%',date("c",$enddateinitial),$output); |
|
922 | + $output = str_replace('%maxitime%', date("c", $enddateinitial), $output); |
|
923 | 923 | } else { |
924 | - $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
924 | + $output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
925 | 925 | } |
926 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
927 | -else $output = str_replace('%gltf2%','false',$output); |
|
926 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
927 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
928 | 928 | print $output; |
929 | 929 | ?> |
@@ -5,16 +5,16 @@ discard block |
||
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | $Spotter = new Spotter(); |
7 | 7 | |
8 | -if (!isset($_GET['aircraft_type'])){ |
|
8 | +if (!isset($_GET['aircraft_type'])) { |
|
9 | 9 | header('Location: '.$globalURL.'/aircraft'); |
10 | 10 | } else { |
11 | 11 | //calculuation for the pagination |
12 | - if(!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2) |
|
12 | + if (!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2) |
|
13 | 13 | { |
14 | 14 | $limit_start = 0; |
15 | 15 | $limit_end = 25; |
16 | 16 | $absolute_difference = 25; |
17 | - } else { |
|
17 | + } else { |
|
18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
19 | 19 | $limit_start = $limit_explode[0]; |
20 | 20 | $limit_end = $limit_explode[1]; |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | $limit_previous_1 = $limit_start - $absolute_difference; |
29 | 29 | $limit_previous_2 = $limit_end - $absolute_difference; |
30 | 30 | |
31 | - $aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
|
31 | + $aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING); |
|
32 | 32 | $page_url = $globalURL.'/aircraft/'.$aircraft_type; |
33 | 33 | |
34 | - $sort = htmlspecialchars(filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING)); |
|
35 | - $spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,$limit_start.",".$absolute_difference, $sort); |
|
34 | + $sort = htmlspecialchars(filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING)); |
|
35 | + $spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, $limit_start.",".$absolute_difference, $sort); |
|
36 | 36 | |
37 | 37 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
38 | 38 | if (!empty($spotter_array) || !empty($aircraft_info)) |
39 | 39 | { |
40 | 40 | if (!empty($aircraft_info)) { |
41 | - $title = sprintf(_("Detailed View for %s (%s)"),$aircraft_info[0]['type'],$aircraft_info[0]['icao']); |
|
41 | + $title = sprintf(_("Detailed View for %s (%s)"), $aircraft_info[0]['type'], $aircraft_info[0]['icao']); |
|
42 | 42 | } else { |
43 | - $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
43 | + $title = sprintf(_("Detailed View for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']); |
|
44 | 44 | } |
45 | 45 | require_once('header.php'); |
46 | 46 | |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | $Stats = new Stats(); |
52 | 52 | $aircraft_types = $Stats->getAllAircraftTypes(); |
53 | 53 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
54 | - foreach($aircraft_types as $aircrafttype) |
|
54 | + foreach ($aircraft_types as $aircrafttype) |
|
55 | 55 | { |
56 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
56 | + if ($aircraft_type == $aircrafttype['aircraft_icao']) |
|
57 | 57 | { |
58 | 58 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
59 | 59 | } else { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (!empty($spotter_array)) { |
91 | 91 | include('aircraft-sub-menu.php'); |
92 | 92 | print '<div class="table column">'; |
93 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
93 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
94 | 94 | include('table-output.php'); |
95 | 95 | print '<div class="pagination">'; |
96 | 96 | if ($limit_previous_1 >= 0) |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | require_once('require/class.Stats.php'); |
6 | 6 | require_once('require/class.METAR.php'); |
7 | 7 | |
8 | -if (!isset($_GET['airport'])){ |
|
8 | +if (!isset($_GET['airport'])) { |
|
9 | 9 | header('Location: '.$globalURL.'/airport'); |
10 | 10 | } else { |
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | //calculation for the pagination |
13 | - if(!isset($_GET['limit'])) |
|
13 | + if (!isset($_GET['limit'])) |
|
14 | 14 | { |
15 | 15 | $limit_start = 0; |
16 | 16 | $limit_end = 25; |
17 | 17 | $absolute_difference = 25; |
18 | - } else { |
|
18 | + } else { |
|
19 | 19 | $limit_explode = explode(",", $_GET['limit']); |
20 | 20 | $limit_start = $limit_explode[0]; |
21 | 21 | $limit_end = $limit_explode[1]; |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | $limit_next = $limit_end + $absolute_difference; |
29 | 29 | $limit_previous_1 = $limit_start - $absolute_difference; |
30 | 30 | $limit_previous_2 = $limit_end - $absolute_difference; |
31 | - $airport_icao = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
31 | + $airport_icao = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
32 | 32 | $airport = $airport_icao; |
33 | 33 | $page_url = $globalURL.'/airport/'.$airport_icao; |
34 | 34 | |
35 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
35 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
36 | 36 | $airport_array = $Spotter->getAllAirportInfo($airport_icao); |
37 | 37 | if (!empty($airport_array)) |
38 | 38 | { |
39 | 39 | if ($sort != '') { |
40 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, $sort); |
|
40 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao, $limit_start.",".$absolute_difference, $sort); |
|
41 | 41 | } else { |
42 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, ''); |
|
42 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao, $limit_start.",".$absolute_difference, ''); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if (isset($globalMETAR) && $globalMETAR) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | //print_r($metar_parse); |
51 | 51 | } |
52 | 52 | |
53 | - $title = sprintf(_("Detailed View for %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
53 | + $title = sprintf(_("Detailed View for %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
54 | 54 | |
55 | 55 | require_once('header.php'); |
56 | 56 | |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | $airport_names = $Stats->getAllAirportNames(); |
63 | 63 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
64 | 64 | ksort($airport_names); |
65 | - foreach($airport_names as $airport_name) |
|
65 | + foreach ($airport_names as $airport_name) |
|
66 | 66 | { |
67 | - if($airport_icao == $airport_name['airport_icao']) |
|
67 | + if ($airport_icao == $airport_name['airport_icao']) |
|
68 | 68 | { |
69 | 69 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
70 | 70 | } else { |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | $date_data = ''; |
115 | 115 | $departure_data = ''; |
116 | 116 | $arrival_data = ''; |
117 | - foreach($all_data as $data) |
|
117 | + foreach ($all_data as $data) |
|
118 | 118 | { |
119 | 119 | $date_data .= '"'.$data['date'].'",'; |
120 | 120 | $departure_data .= $data['departure'].','; |
121 | 121 | $arrival_data .= $data['arrival'].','; |
122 | 122 | } |
123 | - $date_data = "['x',".substr($date_data,0,-1)."]"; |
|
124 | - $departure_data = "['departure',".substr($departure_data,0,-1)."]"; |
|
125 | - $arrival_data = "['arrival',".substr($arrival_data,0,-1)."]"; |
|
123 | + $date_data = "['x',".substr($date_data, 0, -1)."]"; |
|
124 | + $departure_data = "['departure',".substr($departure_data, 0, -1)."]"; |
|
125 | + $arrival_data = "['arrival',".substr($arrival_data, 0, -1)."]"; |
|
126 | 126 | print 'c3.generate({ |
127 | 127 | bindto: "#chart", |
128 | 128 | data: { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | print _("Dew point:").' '.$metar_parse['dew'].' °C'." - "; |
180 | 180 | } |
181 | 181 | if (isset($metar_parse['temperature']) && isset($metar_parse['dew'])) { |
182 | - $humidity = round(100 * pow((112 - (0.1 * $metar_parse['temperature']) + $metar_parse['dew']) / (112 + (0.9 * $metar_parse['temperature'])), 8),1); |
|
182 | + $humidity = round(100*pow((112 - (0.1*$metar_parse['temperature']) + $metar_parse['dew'])/(112 + (0.9*$metar_parse['temperature'])), 8), 1); |
|
183 | 183 | print _("Humidity:").' '.$humidity.'%'." - "; |
184 | 184 | } |
185 | 185 | if (isset($metar_parse['QNH'])) { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | print '<div class="table column">'; |
197 | 197 | if ($airport_array[0]['iata'] != "NA") |
198 | 198 | { |
199 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
199 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
200 | 200 | } |
201 | 201 | include('table-output.php'); |
202 | 202 | print '<div class="pagination">'; |
@@ -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; |
@@ -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 |
@@ -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 | } |