@@ -28,25 +28,25 @@ discard block |
||
28 | 28 | public static function Calculate_Solar_Position($time, Predict_Vector $solar_vector) |
29 | 29 | { |
30 | 30 | $mjd = $time - 2415020.0; |
31 | - $year = 1900 + $mjd / 365.25; |
|
32 | - $T = ($mjd + Predict_Time::Delta_ET($year) / Predict::secday) / 36525.0; |
|
33 | - $M = Predict_Math::Radians(Predict_Math::Modulus(358.47583 + Predict_Math::Modulus(35999.04975 * $T, 360.0) |
|
34 | - - (0.000150 + 0.0000033 * $T) * ($T * $T), 360.0)); |
|
35 | - $L = Predict_Math::Radians(Predict_Math::Modulus(279.69668 + Predict_Math::Modulus(36000.76892 * $T, 360.0) |
|
36 | - + 0.0003025 * ($T * $T), 360.0)); |
|
37 | - $e = 0.01675104 - (0.0000418 + 0.000000126 * $T) * $T; |
|
38 | - $C = Predict_Math::Radians((1.919460 - (0.004789 + 0.000014 * $T) * $T) * sin($M) |
|
39 | - + (0.020094 - 0.000100 * $T) * sin(2 * $M) + 0.000293 * sin(3 * $M)); |
|
40 | - $O = Predict_Math::Radians(Predict_Math::Modulus(259.18 - 1934.142 * $T, 360.0)); |
|
41 | - $Lsa = Predict_Math::Modulus($L + $C - Predict_Math::Radians(0.00569 - 0.00479 * sin($O)), Predict::twopi); |
|
31 | + $year = 1900 + $mjd/365.25; |
|
32 | + $T = ($mjd + Predict_Time::Delta_ET($year)/Predict::secday)/36525.0; |
|
33 | + $M = Predict_Math::Radians(Predict_Math::Modulus(358.47583 + Predict_Math::Modulus(35999.04975*$T, 360.0) |
|
34 | + - (0.000150 + 0.0000033*$T)*($T*$T), 360.0)); |
|
35 | + $L = Predict_Math::Radians(Predict_Math::Modulus(279.69668 + Predict_Math::Modulus(36000.76892*$T, 360.0) |
|
36 | + + 0.0003025*($T*$T), 360.0)); |
|
37 | + $e = 0.01675104 - (0.0000418 + 0.000000126*$T)*$T; |
|
38 | + $C = Predict_Math::Radians((1.919460 - (0.004789 + 0.000014*$T)*$T)*sin($M) |
|
39 | + + (0.020094 - 0.000100*$T)*sin(2*$M) + 0.000293*sin(3*$M)); |
|
40 | + $O = Predict_Math::Radians(Predict_Math::Modulus(259.18 - 1934.142*$T, 360.0)); |
|
41 | + $Lsa = Predict_Math::Modulus($L + $C - Predict_Math::Radians(0.00569 - 0.00479*sin($O)), Predict::twopi); |
|
42 | 42 | $nu = Predict_Math::Modulus($M + $C, Predict::twopi); |
43 | - $R = 1.0000002 * (1 - ($e * $e)) / (1 + $e * cos($nu)); |
|
44 | - $eps = Predict_Math::Radians(23.452294 - (0.0130125 + (0.00000164 - 0.000000503 * $T) * $T) * $T + 0.00256 * cos($O)); |
|
45 | - $R = Predict::AU * $R; |
|
43 | + $R = 1.0000002*(1 - ($e*$e))/(1 + $e*cos($nu)); |
|
44 | + $eps = Predict_Math::Radians(23.452294 - (0.0130125 + (0.00000164 - 0.000000503*$T)*$T)*$T + 0.00256*cos($O)); |
|
45 | + $R = Predict::AU*$R; |
|
46 | 46 | |
47 | - $solar_vector->x = $R * cos($Lsa); |
|
48 | - $solar_vector->y = $R * sin($Lsa) * cos($eps); |
|
49 | - $solar_vector->z = $R * sin($Lsa) * sin($eps); |
|
47 | + $solar_vector->x = $R*cos($Lsa); |
|
48 | + $solar_vector->y = $R*sin($Lsa)*cos($eps); |
|
49 | + $solar_vector->z = $R*sin($Lsa)*sin($eps); |
|
50 | 50 | $solar_vector->w = $R; |
51 | 51 | } |
52 | 52 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | $earth = new Predict_Vector(); |
58 | 58 | |
59 | 59 | /* Determine partial eclipse */ |
60 | - $sd_earth = Predict_Math::ArcSin(Predict::xkmper / $pos->w); |
|
60 | + $sd_earth = Predict_Math::ArcSin(Predict::xkmper/$pos->w); |
|
61 | 61 | Predict_Math::Vec_Sub($sol, $pos, $Rho); |
62 | - $sd_sun = Predict_Math::ArcSin(Predict::__sr__ / $Rho->w); |
|
62 | + $sd_sun = Predict_Math::ArcSin(Predict::__sr__/$Rho->w); |
|
63 | 63 | Predict_Math::Scalar_Multiply(-1, $pos, $earth); |
64 | 64 | $delta = Predict_Math::Angle($sol, $earth); |
65 | 65 | $depth = $sd_earth - $sd_sun - $delta; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $obs_geodetic = new Predict_Geodetic(); |
91 | - $obs_geodetic->lon = $qth->lon * Predict::de2ra; |
|
92 | - $obs_geodetic->lat = $qth->lat * Predict::de2ra; |
|
93 | - $obs_geodetic->alt = $qth->alt / 1000.0; |
|
91 | + $obs_geodetic->lon = $qth->lon*Predict::de2ra; |
|
92 | + $obs_geodetic->lat = $qth->lat*Predict::de2ra; |
|
93 | + $obs_geodetic->alt = $qth->alt/1000.0; |
|
94 | 94 | $obs_geodetic->theta = 0; |
95 | 95 | |
96 | 96 | $solar_vector = new Predict_Vector(); |
@@ -12,9 +12,9 @@ |
||
12 | 12 | */ |
13 | 13 | class Predict_PassDetail |
14 | 14 | { |
15 | - public $time; /*!< time in "jul_utc" */ |
|
16 | - public $pos; /*!< Raw unprocessed position at time */ |
|
17 | - public $vel; /*!< Raw unprocessed velocity at time */ |
|
15 | + public $time; /*!< time in "jul_utc" */ |
|
16 | + public $pos; /*!< Raw unprocessed position at time */ |
|
17 | + public $vel; /*!< Raw unprocessed velocity at time */ |
|
18 | 18 | public $velo; |
19 | 19 | public $az; |
20 | 20 | public $el; |
@@ -5,8 +5,8 @@ |
||
5 | 5 | */ |
6 | 6 | class Predict_ObsSet |
7 | 7 | { |
8 | - public $az = 0.0; /*!< Azimuth [deg] */ |
|
9 | - public $el = 0.0; /*!< Elevation [deg] */ |
|
10 | - public $range = 0.0; /*!< Range [km] */ |
|
11 | - public $range_rate = 0.0; /*!< Velocity [km/sec] */ |
|
8 | + public $az = 0.0; /*!< Azimuth [deg] */ |
|
9 | + public $el = 0.0; /*!< Elevation [deg] */ |
|
10 | + public $range = 0.0; /*!< Range [km] */ |
|
11 | + public $range_rate = 0.0; /*!< Velocity [km/sec] */ |
|
12 | 12 | } |
@@ -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 | } |
@@ -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,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 |