@@ -12,30 +12,30 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Predict_TLE |
14 | 14 | { |
15 | - public $header; /* Header line of TLE file */ |
|
16 | - public $line1; /* Line 1 of TLE */ |
|
17 | - public $line2; /* Line 2 of TLE */ |
|
18 | - public $epoch; /*!< Epoch Time in NORAD TLE format YYDDD.FFFFFFFF */ |
|
15 | + public $header; /* Header line of TLE file */ |
|
16 | + public $line1; /* Line 1 of TLE */ |
|
17 | + public $line2; /* Line 2 of TLE */ |
|
18 | + public $epoch; /*!< Epoch Time in NORAD TLE format YYDDD.FFFFFFFF */ |
|
19 | 19 | public $epoch_year; /*!< Epoch: year */ |
20 | - public $epoch_day; /*!< Epoch: day of year */ |
|
21 | - public $epoch_fod; /*!< Epoch: Fraction of day. */ |
|
22 | - public $xndt2o; /*!< 1. time derivative of mean motion */ |
|
23 | - public $xndd6o; /*!< 2. time derivative of mean motion */ |
|
24 | - public $bstar; /*!< Bstar drag coefficient. */ |
|
25 | - public $xincl; /*!< Inclination */ |
|
26 | - public $xnodeo; /*!< R.A.A.N. */ |
|
27 | - public $eo; /*!< Eccentricity */ |
|
28 | - public $omegao; /*!< argument of perigee */ |
|
29 | - public $xmo; /*!< mean anomaly */ |
|
30 | - public $xno; /*!< mean motion */ |
|
31 | - |
|
32 | - public $catnr; /*!< Catalogue Number. */ |
|
33 | - public $elset; /*!< Element Set number. */ |
|
34 | - public $revnum; /*!< Revolution Number at epoch. */ |
|
35 | - |
|
36 | - public $sat_name; /*!< Satellite name string. */ |
|
37 | - public $idesg; /*!< International Designator. */ |
|
38 | - public $status; /*!< Operational status. */ |
|
20 | + public $epoch_day; /*!< Epoch: day of year */ |
|
21 | + public $epoch_fod; /*!< Epoch: Fraction of day. */ |
|
22 | + public $xndt2o; /*!< 1. time derivative of mean motion */ |
|
23 | + public $xndd6o; /*!< 2. time derivative of mean motion */ |
|
24 | + public $bstar; /*!< Bstar drag coefficient. */ |
|
25 | + public $xincl; /*!< Inclination */ |
|
26 | + public $xnodeo; /*!< R.A.A.N. */ |
|
27 | + public $eo; /*!< Eccentricity */ |
|
28 | + public $omegao; /*!< argument of perigee */ |
|
29 | + public $xmo; /*!< mean anomaly */ |
|
30 | + public $xno; /*!< mean motion */ |
|
31 | + |
|
32 | + public $catnr; /*!< Catalogue Number. */ |
|
33 | + public $elset; /*!< Element Set number. */ |
|
34 | + public $revnum; /*!< Revolution Number at epoch. */ |
|
35 | + |
|
36 | + public $sat_name; /*!< Satellite name string. */ |
|
37 | + public $idesg; /*!< International Designator. */ |
|
38 | + public $status; /*!< Operational status. */ |
|
39 | 39 | |
40 | 40 | /* values needed for squint calculations */ |
41 | 41 | public $xincl1; |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | $this->xndt2o = (float) substr($line1, 33, 10); |
94 | 94 | |
95 | 95 | /* Satellite's Second Time Derivative */ |
96 | - $this->xndd6o = (float) (substr($line1, 44, 1) . '.' . substr($line1, 45, 5) . 'E' . substr($line1, 50, 2)); |
|
96 | + $this->xndd6o = (float) (substr($line1, 44, 1).'.'.substr($line1, 45, 5).'E'.substr($line1, 50, 2)); |
|
97 | 97 | |
98 | 98 | /* Satellite's bstar drag term |
99 | 99 | FIXME: How about buff[0] ???? |
100 | 100 | */ |
101 | - $this->bstar = (float) (substr($line1, 53, 1) . '.' . substr($line1, 54, 5) . 'E' . substr($line1, 59, 2)); |
|
101 | + $this->bstar = (float) (substr($line1, 53, 1).'.'.substr($line1, 54, 5).'E'.substr($line1, 59, 2)); |
|
102 | 102 | |
103 | 103 | /* Element Number */ |
104 | 104 | $this->elset = (int) substr($line1, 64, 4); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $this->xnodeo = (float) substr($line2, 17, 8); |
112 | 112 | |
113 | 113 | /* Satellite's Orbital Eccentricity */ |
114 | - $this->eo = (float) ('.' . substr($line2, 26, 7)); |
|
114 | + $this->eo = (float) ('.'.substr($line2, 26, 7)); |
|
115 | 115 | |
116 | 116 | /* Satellite's Argument of Perigee (degrees) */ |
117 | 117 | $this->omegao = (float) substr($line2, 34, 8); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | for ($i = 0; $i < 68; $i++) { |
146 | 146 | if (($tle_set[$i] >= '0') && ($tle_set[$i] <= '9')) { |
147 | 147 | $value = $tle_set[$i] - '0'; |
148 | - } else if ($tle_set[$i] == '-' ) { |
|
148 | + } else if ($tle_set[$i] == '-') { |
|
149 | 149 | $value = 1; |
150 | 150 | } else { |
151 | 151 | $value = 0; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | for ($i = 0; $i < 68; $i++) { |
217 | 217 | if (($line[$i] >= '0') && ($line[$i] <= '9')) { |
218 | 218 | $value = (int) $line[$i]; |
219 | - } else if ($line[$i] == '-' ) { |
|
219 | + } else if ($line[$i] == '-') { |
|
220 | 220 | $value = 1; |
221 | 221 | } else { |
222 | 222 | $value = 0; |
@@ -7,14 +7,14 @@ |
||
7 | 7 | */ |
8 | 8 | class Predict_QTH |
9 | 9 | { |
10 | - public $name; /*!< Name, eg. callsign. */ |
|
11 | - public $loc; /*!< Location, eg City, Country. */ |
|
12 | - public $desc; /*!< Short description. */ |
|
13 | - public $lat; /*!< Latitude in dec. deg. North. */ |
|
14 | - public $lon; /*!< Longitude in dec. deg. East. */ |
|
15 | - public $alt; /*!< Altitude above sea level in meters. */ |
|
16 | - public $qra; /*!< QRA locator */ |
|
17 | - public $wx; /*!< Weather station code (4 chars). */ |
|
10 | + public $name; /*!< Name, eg. callsign. */ |
|
11 | + public $loc; /*!< Location, eg City, Country. */ |
|
12 | + public $desc; /*!< Short description. */ |
|
13 | + public $lat; /*!< Latitude in dec. deg. North. */ |
|
14 | + public $lon; /*!< Longitude in dec. deg. East. */ |
|
15 | + public $alt; /*!< Altitude above sea level in meters. */ |
|
16 | + public $qra; /*!< QRA locator */ |
|
17 | + public $wx; /*!< Weather station code (4 chars). */ |
|
18 | 18 | |
19 | - public $data; /*!< Raw data from cfg file. */ |
|
19 | + public $data; /*!< Raw data from cfg file. */ |
|
20 | 20 | } |
@@ -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 { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | /* execute computations */ |
158 | 158 | $sdpsgp = Predict_SGPSDP::getInstance($sat); |
159 | - if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) { |
|
159 | + if ($sat->flags&Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) { |
|
160 | 160 | $sdpsgp->SDP4($sat, 0.0); |
161 | 161 | } else { |
162 | 162 | $sdpsgp->SGP4($sat, 0.0); |
@@ -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 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | /* Modification to support Y2K */ |
44 | 44 | /* Valid 1957 through 2056 */ |
45 | - $day = self::modf($epoch * 1E-3, $year) * 1E3; |
|
45 | + $day = self::modf($epoch*1E-3, $year)*1E3; |
|
46 | 46 | if ($year < 57) { |
47 | 47 | $year = $year + 2000; |
48 | 48 | } else { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | /* Equivalent to the C modf function */ |
57 | 57 | public static function modf($x, &$ipart) { |
58 | - $ipart = (int)$x; |
|
58 | + $ipart = (int) $x; |
|
59 | 59 | return $x - $ipart; |
60 | 60 | } |
61 | 61 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | /* Astronomical Formulae for Calculators, Jean Meeus, */ |
69 | 69 | /* pages 23-25. Calculate Julian Date of 0.0 Jan year */ |
70 | 70 | $year = $year - 1; |
71 | - $i = (int) ($year / 100); |
|
71 | + $i = (int) ($year/100); |
|
72 | 72 | $A = $i; |
73 | - $i = (int) ($A / 4); |
|
73 | + $i = (int) ($A/4); |
|
74 | 74 | $B = (int) (2 - $A + $i); |
75 | - $i = (int) (365.25 * $year); |
|
76 | - $i += (int) (30.6001 * 14); |
|
75 | + $i = (int) (365.25*$year); |
|
76 | + $i += (int) (30.6001*14); |
|
77 | 77 | $jdoy = $i + 1720994.5 + $B; |
78 | 78 | |
79 | 79 | return $jdoy; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /* Modification to support Y2K */ |
94 | 94 | /* Valid 1957 through 2056 */ |
95 | 95 | $year = 0; |
96 | - $day = self::modf($epoch * 1E-3, $year) * 1E3; |
|
96 | + $day = self::modf($epoch*1E-3, $year)*1E3; |
|
97 | 97 | |
98 | 98 | if ($year < 57) { |
99 | 99 | $year += 2000; |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | |
105 | 105 | $UT = fmod($day, $day); |
106 | 106 | $jd = self::Julian_Date_of_Year($year) + $day; |
107 | - $TU = ($jd - 2451545.0) / 36525; |
|
108 | - $GMST = 24110.54841 + $TU * (8640184.812866 + $TU * (0.093104 - $TU * 6.2E-6)); |
|
109 | - $GMST = Predict_Math::Modulus($GMST + Predict::secday * Predict::omega_E * $UT, Predict::secday); |
|
107 | + $TU = ($jd - 2451545.0)/36525; |
|
108 | + $GMST = 24110.54841 + $TU*(8640184.812866 + $TU*(0.093104 - $TU*6.2E-6)); |
|
109 | + $GMST = Predict_Math::Modulus($GMST + Predict::secday*Predict::omega_E*$UT, Predict::secday); |
|
110 | 110 | $deep_arg->ds50 = $jd - 2433281.5 + $UT; |
111 | 111 | |
112 | - return Predict_Math::FMod2p(6.3003880987 * $deep_arg->ds50 + 1.72944494); |
|
112 | + return Predict_Math::FMod2p(6.3003880987*$deep_arg->ds50 + 1.72944494); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /* See the ThetaG doc block above */ |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | /* Reference: The 1992 Astronomical Almanac, page B6. */ |
119 | 119 | $UT = Predict_Math::Frac($jd + 0.5); |
120 | 120 | $jd = $jd - $UT; |
121 | - $TU = ($jd - 2451545.0) / 36525; |
|
122 | - $GMST = 24110.54841 + $TU * (8640184.812866 + $TU * (0.093104 - $TU * 6.2E-6)); |
|
123 | - $GMST = Predict_Math::Modulus($GMST + Predict::secday * Predict::omega_E * $UT, Predict::secday); |
|
121 | + $TU = ($jd - 2451545.0)/36525; |
|
122 | + $GMST = 24110.54841 + $TU*(8640184.812866 + $TU*(0.093104 - $TU*6.2E-6)); |
|
123 | + $GMST = Predict_Math::Modulus($GMST + Predict::secday*Predict::omega_E*$UT, Predict::secday); |
|
124 | 124 | |
125 | - return Predict::twopi * $GMST / Predict::secday; |
|
125 | + return Predict::twopi*$GMST/Predict::secday; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public static function unix2daynum($sec, $usec = 0) |
150 | 150 | { |
151 | - $time = ((($sec + $usec) / 86400.0) - 3651.0); |
|
151 | + $time = ((($sec + $usec)/86400.0) - 3651.0); |
|
152 | 152 | return $time + 2444238.5; |
153 | 153 | } |
154 | 154 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | /* Values determined using data from 1950-1991 in the 1990 |
163 | 163 | Astronomical Almanac. See DELTA_ET.WQ1 for details. */ |
164 | 164 | |
165 | - $delta_et = 26.465 + 0.747622 * ($year - 1950) + |
|
166 | - 1.886913 * sin(Predict::twopi * ($year - 1975) / 33); |
|
165 | + $delta_et = 26.465 + 0.747622*($year - 1950) + |
|
166 | + 1.886913*sin(Predict::twopi*($year - 1975)/33); |
|
167 | 167 | |
168 | 168 | return $delta_et; |
169 | 169 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public static function daynum2unix($dn) { |
179 | 179 | // Converts a daynum to a UNIX timestamp |
180 | 180 | |
181 | - return (86400.0 * ($dn - 2444238.5 + 3651.0)); |
|
181 | + return (86400.0*($dn - 2444238.5 + 3651.0)); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | public static function daynum2readable($dn, $zone = 'America/Los_Angeles', $format = 'm-d-Y H:i:s') |
194 | 194 | { |
195 | 195 | $unix = self::daynum2unix($dn); |
196 | - $date = new DateTime("@" . round($unix)); |
|
196 | + $date = new DateTime("@".round($unix)); |
|
197 | 197 | $dateTimezone = new DateTimezone($zone); |
198 | 198 | $date->setTimezone($dateTimezone); |
199 | 199 | return $date->format($format); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | { |
211 | 211 | $year = $tle->epoch_year; |
212 | 212 | $day = $tle->epoch_day; |
213 | - $sec = round(86400 * $tle->epoch_fod); |
|
213 | + $sec = round(86400*$tle->epoch_fod); |
|
214 | 214 | |
215 | 215 | $zone = new DateTimeZone('GMT'); |
216 | 216 | $date = new DateTime(); |
@@ -218,6 +218,6 @@ discard block |
||
218 | 218 | $date->setDate($year, 1, 1); |
219 | 219 | $date->setTime(0, 0, 0); |
220 | 220 | |
221 | - return $date->format('U') + (86400 * $day) + $sec - 86400; |
|
221 | + return $date->format('U') + (86400*$day) + $sec - 86400; |
|
222 | 222 | } |
223 | 223 | } |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | |
38 | 38 | $sinGeodeticLat = sin($geodetic->lat); /* Only run sin($geodetic->lat) once */ |
39 | 39 | |
40 | - $geodetic->theta = Predict_Math::FMod2p(Predict_Time::ThetaG_JD($_time) + $geodetic->lon);/*LMST*/ |
|
41 | - $c = 1 / sqrt(1 + Predict::__f * (Predict::__f - 2) * $sinGeodeticLat * $sinGeodeticLat); |
|
42 | - $sq = (1 - Predict::__f) * (1 - Predict::__f) * $c; |
|
43 | - $achcp = (Predict::xkmper * $c + $geodetic->alt) * cos($geodetic->lat); |
|
44 | - $obs_pos->x = $achcp * cos($geodetic->theta); /*kilometers*/ |
|
45 | - $obs_pos->y = $achcp * sin($geodetic->theta); |
|
46 | - $obs_pos->z = (Predict::xkmper * $sq + $geodetic->alt) * $sinGeodeticLat; |
|
47 | - $obs_vel->x = -Predict::mfactor * $obs_pos->y; /*kilometers/second*/ |
|
48 | - $obs_vel->y = Predict::mfactor * $obs_pos->x; |
|
49 | - $obs_vel->z = 0; |
|
50 | - $obs_pos->w = sqrt($obs_pos->x * $obs_pos->x + $obs_pos->y * $obs_pos->y + $obs_pos->z * $obs_pos->z); |
|
51 | - $obs_vel->w = sqrt($obs_vel->x * $obs_vel->x + $obs_vel->y * $obs_vel->y + $obs_vel->z * $obs_vel->z); |
|
40 | + $geodetic->theta = Predict_Math::FMod2p(Predict_Time::ThetaG_JD($_time) + $geodetic->lon); /*LMST*/ |
|
41 | + $c = 1/sqrt(1 + Predict::__f*(Predict::__f - 2)*$sinGeodeticLat*$sinGeodeticLat); |
|
42 | + $sq = (1 - Predict::__f)*(1 - Predict::__f)*$c; |
|
43 | + $achcp = (Predict::xkmper*$c + $geodetic->alt)*cos($geodetic->lat); |
|
44 | + $obs_pos->x = $achcp*cos($geodetic->theta); /*kilometers*/ |
|
45 | + $obs_pos->y = $achcp*sin($geodetic->theta); |
|
46 | + $obs_pos->z = (Predict::xkmper*$sq + $geodetic->alt)*$sinGeodeticLat; |
|
47 | + $obs_vel->x = -Predict::mfactor*$obs_pos->y; /*kilometers/second*/ |
|
48 | + $obs_vel->y = Predict::mfactor*$obs_pos->x; |
|
49 | + $obs_vel->z = 0; |
|
50 | + $obs_pos->w = sqrt($obs_pos->x*$obs_pos->x + $obs_pos->y*$obs_pos->y + $obs_pos->z*$obs_pos->z); |
|
51 | + $obs_vel->w = sqrt($obs_vel->x*$obs_vel->x + $obs_vel->y*$obs_vel->y + $obs_vel->z*$obs_vel->z); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /* Procedure Calculate_LatLonAlt will calculate the geodetic */ |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /* It is intended to be used to determine the ground track of */ |
57 | 57 | /* a satellite. The calculations assume the earth to be an */ |
58 | 58 | /* oblate spheroid as defined in WGS '72. */ |
59 | - public static function Calculate_LatLonAlt($_time, Predict_Vector $pos, Predict_Geodetic $geodetic) |
|
59 | + public static function Calculate_LatLonAlt($_time, Predict_Vector $pos, Predict_Geodetic $geodetic) |
|
60 | 60 | { |
61 | 61 | /* Reference: The 1992 Astronomical Almanac, page K12. */ |
62 | 62 | |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | |
65 | 65 | $geodetic->theta = Predict_Math::AcTan($pos->y, $pos->x); /*radians*/ |
66 | 66 | $geodetic->lon = Predict_Math::FMod2p($geodetic->theta - Predict_Time::ThetaG_JD($_time)); /*radians*/ |
67 | - $r = sqrt(($pos->x * $pos->x) + ($pos->y * $pos->y)); |
|
68 | - $e2 = Predict::__f * (2 - Predict::__f); |
|
67 | + $r = sqrt(($pos->x*$pos->x) + ($pos->y*$pos->y)); |
|
68 | + $e2 = Predict::__f*(2 - Predict::__f); |
|
69 | 69 | $geodetic->lat = Predict_Math::AcTan($pos->z, $r); /*radians*/ |
70 | 70 | |
71 | 71 | do { |
72 | 72 | $phi = $geodetic->lat; |
73 | 73 | $sinPhi = sin($phi); |
74 | - $c = 1 / sqrt(1 - $e2 * ($sinPhi * $sinPhi)); |
|
75 | - $geodetic->lat = Predict_Math::AcTan($pos->z + Predict::xkmper * $c * $e2 * $sinPhi, $r); |
|
74 | + $c = 1/sqrt(1 - $e2*($sinPhi*$sinPhi)); |
|
75 | + $geodetic->lat = Predict_Math::AcTan($pos->z + Predict::xkmper*$c*$e2*$sinPhi, $r); |
|
76 | 76 | } while (abs($geodetic->lat - $phi) >= 1E-10); |
77 | 77 | |
78 | - $geodetic->alt = $r / cos($geodetic->lat) - Predict::xkmper * $c;/*kilometers*/ |
|
78 | + $geodetic->alt = $r/cos($geodetic->lat) - Predict::xkmper*$c; /*kilometers*/ |
|
79 | 79 | |
80 | 80 | if ($geodetic->lat > Predict::pio2) { |
81 | 81 | $geodetic->lat -= Predict::twopi; |
@@ -114,34 +114,34 @@ discard block |
||
114 | 114 | $rgvel->y = $vel->y - $obs_vel->y; |
115 | 115 | $rgvel->z = $vel->z - $obs_vel->z; |
116 | 116 | |
117 | - $range->w = sqrt($range->x * $range->x + $range->y * $range->y + $range->z * $range->z); |
|
117 | + $range->w = sqrt($range->x*$range->x + $range->y*$range->y + $range->z*$range->z); |
|
118 | 118 | |
119 | 119 | $sin_lat = sin($geodetic->lat); |
120 | 120 | $cos_lat = cos($geodetic->lat); |
121 | 121 | $sin_theta = sin($geodetic->theta); |
122 | 122 | $cos_theta = cos($geodetic->theta); |
123 | - $top_s = $sin_lat * $cos_theta * $range->x |
|
124 | - + $sin_lat * $sin_theta * $range->y |
|
125 | - - $cos_lat * $range->z; |
|
126 | - $top_e = -$sin_theta * $range->x |
|
127 | - + $cos_theta * $range->y; |
|
128 | - $top_z = $cos_lat * $cos_theta * $range->x |
|
129 | - + $cos_lat * $sin_theta * $range->y |
|
130 | - + $sin_lat * $range->z; |
|
131 | - $azim = atan(-$top_e / $top_s); /*Azimuth*/ |
|
123 | + $top_s = $sin_lat*$cos_theta*$range->x |
|
124 | + + $sin_lat*$sin_theta*$range->y |
|
125 | + - $cos_lat*$range->z; |
|
126 | + $top_e = -$sin_theta*$range->x |
|
127 | + + $cos_theta*$range->y; |
|
128 | + $top_z = $cos_lat*$cos_theta*$range->x |
|
129 | + + $cos_lat*$sin_theta*$range->y |
|
130 | + + $sin_lat*$range->z; |
|
131 | + $azim = atan(-$top_e/$top_s); /*Azimuth*/ |
|
132 | 132 | if ($top_s > 0) { |
133 | 133 | $azim = $azim + Predict::pi; |
134 | 134 | } |
135 | - if ($azim < 0 ) { |
|
135 | + if ($azim < 0) { |
|
136 | 136 | $azim = $azim + Predict::twopi; |
137 | 137 | } |
138 | - $el = Predict_Math::ArcSin($top_z / $range->w); |
|
139 | - $obs_set->az = $azim; /* Azimuth (radians) */ |
|
140 | - $obs_set->el = $el; /* Elevation (radians)*/ |
|
138 | + $el = Predict_Math::ArcSin($top_z/$range->w); |
|
139 | + $obs_set->az = $azim; /* Azimuth (radians) */ |
|
140 | + $obs_set->el = $el; /* Elevation (radians)*/ |
|
141 | 141 | $obs_set->range = $range->w; /* Range (kilometers) */ |
142 | 142 | |
143 | 143 | /* Range Rate (kilometers/second)*/ |
144 | - $obs_set->range_rate = Predict_Math::Dot($range, $rgvel) / $range->w; |
|
144 | + $obs_set->range_rate = Predict_Math::Dot($range, $rgvel)/$range->w; |
|
145 | 145 | |
146 | 146 | /* Corrections for atmospheric refraction */ |
147 | 147 | /* Reference: Astronomical Algorithms by Jean Meeus, pp. 101-104 */ |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | // obs_set->el = obs_set->el + Radians((1.02/tan(Radians(Degrees(el)+ |
150 | 150 | // 10.3/(Degrees(el)+5.11))))/60); |
151 | 151 | if ($obs_set->el < 0) { |
152 | - $obs_set->el = $el; /*Reset to true elevation*/ |
|
152 | + $obs_set->el = $el; /*Reset to true elevation*/ |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <button type="button" class="close">×</button> |
8 | 8 | <?php |
9 | 9 | |
10 | -$notamref = filter_input(INPUT_GET,'notam',FILTER_SANITIZE_STRING); |
|
10 | +$notamref = filter_input(INPUT_GET, 'notam', FILTER_SANITIZE_STRING); |
|
11 | 11 | $notamref = urldecode($notamref); |
12 | 12 | $NOTAM = new NOTAM(); |
13 | 13 | $notam = $NOTAM->getNOTAMbyRef($notamref); |
@@ -10,24 +10,24 @@ discard block |
||
10 | 10 | |
11 | 11 | if (isset($_GET['coord'])) |
12 | 12 | { |
13 | - $coords = explode(',',$_GET['coord']); |
|
13 | + $coords = explode(',', $_GET['coord']); |
|
14 | 14 | if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] != '' && $_COOKIE['notamscope'] != 'All') { |
15 | - $scope = filter_var($_COOOKIE['notamscope'],FILTER_SANITIZE_STRING); |
|
16 | - $spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords,$scope); |
|
15 | + $scope = filter_var($_COOOKIE['notamscope'], FILTER_SANITIZE_STRING); |
|
16 | + $spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords, $scope); |
|
17 | 17 | } elseif (isset($_GET['scope']) && $_GET['scope'] != '' && $_GET['scope'] != 'All') { |
18 | - $scope = filter_input(INPUT_GET,'scope',FILTER_SANITIZE_STRING); |
|
19 | - $spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords,$scope); |
|
18 | + $scope = filter_input(INPUT_GET, 'scope', FILTER_SANITIZE_STRING); |
|
19 | + $spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords, $scope); |
|
20 | 20 | } else { |
21 | 21 | $spotter_array = $NOTAM->getAllNOTAMbyCoord($coords); |
22 | 22 | } |
23 | 23 | // $spotter_array = $NOTAM->getAllNOTAM(); |
24 | 24 | } else { |
25 | 25 | if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] != '' && $_COOKIE['notamscope'] != 'All') { |
26 | - $scope = filter_var($_COOKIE['notamscope'],FILTER_SANITIZE_STRING); |
|
26 | + $scope = filter_var($_COOKIE['notamscope'], FILTER_SANITIZE_STRING); |
|
27 | 27 | $spotter_array = $NOTAM->getAllNOTAMbyScope($scope); |
28 | 28 | } elseif (isset($_GET['scope']) && $_GET['scope'] != '' && $_GET['scope'] != 'All') { |
29 | - $scope = filter_input(INPUT_GET,'scope',FILTER_SANITIZE_STRING); |
|
30 | - $spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords,$scope); |
|
29 | + $scope = filter_input(INPUT_GET, 'scope', FILTER_SANITIZE_STRING); |
|
30 | + $spotter_array = $NOTAM->getAllNOTAMbyCoordScope($coords, $scope); |
|
31 | 31 | } else { |
32 | 32 | $spotter_array = $NOTAM->getAllNOTAM(); |
33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | if (!empty($spotter_array)) |
39 | 39 | { |
40 | - foreach($spotter_array as $spotter_item) |
|
40 | + foreach ($spotter_array as $spotter_item) |
|
41 | 41 | { |
42 | 42 | date_default_timezone_set('UTC'); |
43 | 43 | //waypoint plotting |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $output .= '"ref": "'.$spotter_item['ref'].'",'; |
47 | 47 | $output .= '"title": "'.$spotter_item['title'].'",'; |
48 | 48 | $output .= '"fir": "'.$spotter_item['fir'].'",'; |
49 | - $output .= '"text": "'.str_replace(array("\r\n", "\r", "\n"),'<br />',str_replace(array('"',"\t"), '',$spotter_item['notam_text'])).'",'; |
|
49 | + $output .= '"text": "'.str_replace(array("\r\n", "\r", "\n"), '<br />', str_replace(array('"', "\t"), '', $spotter_item['notam_text'])).'",'; |
|
50 | 50 | $output .= '"latitude": '.$spotter_item['center_latitude'].','; |
51 | 51 | $output .= '"longitude": '.$spotter_item['center_longitude'].','; |
52 | 52 | $output .= '"lower_limit": '.$spotter_item['lower_limit'].','; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $output .= '}'; |
86 | 86 | $output .= '},'; |
87 | 87 | } |
88 | - $output = substr($output, 0, -1); |
|
88 | + $output = substr($output, 0, -1); |
|
89 | 89 | } |
90 | 90 | $output .= ']}'; |
91 | 91 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | if (isset($_GET['coord'])) |
12 | 12 | { |
13 | - $coords = explode(',',$_GET['coord']); |
|
13 | + $coords = explode(',', $_GET['coord']); |
|
14 | 14 | $spotter_array = $Spotter->getAllWaypointsInfobyCoord($coords); |
15 | 15 | } else { |
16 | 16 | die; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | if (!empty($spotter_array)) |
22 | 22 | { |
23 | 23 | // print_r($spotter_array); |
24 | - foreach($spotter_array as $spotter_item) |
|
24 | + foreach ($spotter_array as $spotter_item) |
|
25 | 25 | { |
26 | 26 | date_default_timezone_set('UTC'); |
27 | 27 | //waypoint plotting |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $output .= '"geometry": {'; |
103 | 103 | $output .= '"type": "Point",'; |
104 | 104 | $output .= '"coordinates": ['; |
105 | - $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);; |
|
105 | + $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048); ; |
|
106 | 106 | $output .= ']'; |
107 | 107 | $output .= '}'; |
108 | 108 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | <button type="button" class="close">×</button> |
8 | 8 | <?php |
9 | 9 | |
10 | -$airspaceid = filter_input(INPUT_GET,'airspace',FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$airspaceid = filter_input(INPUT_GET, 'airspace', FILTER_SANITIZE_NUMBER_INT); |
|
11 | 11 | //$notamref = urldecode($notamref); |
12 | 12 | if ($globalDBdriver == 'mysql') { |
13 | 13 | $query = "SELECT * FROM airspace WHERE ogr_fid = :id"; |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | try { |
19 | 19 | $sth = $Connection->db->prepare($query); |
20 | 20 | $sth->execute(array(':id' => $airspaceid)); |
21 | -} catch(PDOException $e) { |
|
21 | +} catch (PDOException $e) { |
|
22 | 22 | echo "error"; |
23 | 23 | } |
24 | -$result=$sth->fetchAll(PDO::FETCH_ASSOC); |
|
24 | +$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
25 | 25 | $airspace = $result[0]; |
26 | 26 | date_default_timezone_set('UTC'); |
27 | 27 | print '<div class="top">'; |