Пример #1
0
 public static function Calculate_Solar_Position($time, Predict_Vector $solar_vector)
 {
     $mjd = $time - 2415020.0;
     $year = 1900 + $mjd / 365.25;
     $T = ($mjd + Predict_Time::Delta_ET($year) / Predict::secday) / 36525.0;
     $M = Predict_Math::Radians(Predict_Math::Modulus(358.47583 + Predict_Math::Modulus(35999.04975 * $T, 360.0) - (0.00015 + 3.3E-6 * $T) * ($T * $T), 360.0));
     $L = Predict_Math::Radians(Predict_Math::Modulus(279.69668 + Predict_Math::Modulus(36000.76892 * $T, 360.0) + 0.0003025 * ($T * $T), 360.0));
     $e = 0.01675104 - (4.18E-5 + 1.26E-7 * $T) * $T;
     $C = Predict_Math::Radians((1.91946 - (0.004789 + 1.4E-5 * $T) * $T) * sin($M) + (0.020094 - 0.0001 * $T) * sin(2 * $M) + 0.000293 * sin(3 * $M));
     $O = Predict_Math::Radians(Predict_Math::Modulus(259.18 - 1934.142 * $T, 360.0));
     $Lsa = Predict_Math::Modulus($L + $C - Predict_Math::Radians(0.00569 - 0.00479 * sin($O)), Predict::twopi);
     $nu = Predict_Math::Modulus($M + $C, Predict::twopi);
     $R = 1.0000002 * (1 - $e * $e) / (1 + $e * cos($nu));
     $eps = Predict_Math::Radians(23.452294 - (0.0130125 + (1.64E-6 - 5.03E-7 * $T) * $T) * $T + 0.00256 * cos($O));
     $R = Predict::AU * $R;
     $solar_vector->x = $R * cos($Lsa);
     $solar_vector->y = $R * sin($Lsa) * cos($eps);
     $solar_vector->z = $R * sin($Lsa) * sin($eps);
     $solar_vector->w = $R;
 }
Пример #2
0
 /**
  * Experimental attempt at calculating apparent magnitude.  Known intrinsic
  * magnitudes are listed inside the function for now.
  *
  * @param float       $time The daynum the satellite is calculated for
  * @param Predict_QTH $qth  The observer location
  *
  * @return null on failure, float otherwise
  */
 public function calculateApparentMagnitude($time, Predict_QTH $qth)
 {
     // Recorded intrinsic magnitudes and their respective
     // illumination and distance from heavens-above.com
     static $intrinsicMagnitudes = array('25544' => array('mag' => -1.3, 'illum' => 0.5, 'distance' => 1000));
     // Return null if we don't have a record of the intrinsic mag
     if (!isset($intrinsicMagnitudes[$this->tle->catnr])) {
         return null;
     }
     $imag = $intrinsicMagnitudes[$this->tle->catnr];
     // Convert the observer's geodetic info to radians and km so
     // we can compare vectors
     $observerGeo = new Predict_Geodetic();
     $observerGeo->lat = Predict_Math::Radians($qth->lat);
     $observerGeo->lon = Predict_Math::Radians($qth->lon);
     $observerGeo->alt = $qth->alt * 1000;
     // Now determine the sun and observer positions
     $observerPos = new Predict_Vector();
     $observerVel = new Predict_Vector();
     $solarVector = new Predict_Vector();
     Predict_Solar::Calculate_Solar_Position($time, $solarVector);
     Predict_SGPObs::Calculate_User_PosVel($time, $observerGeo, $observerPos, $observerVel);
     // Determine the solar phase and and thus the percent illumination
     $observerSatPos = new Predict_Vector();
     Predict_Math::Vec_Sub($this->pos, $observerPos, $observerSatPos);
     $phaseAngle = Predict_Math::Degrees(Predict_Math::Angle($solarVector, $observerSatPos));
     $illum = $phaseAngle / 180;
     $illuminationChange = $illum / $imag['illum'];
     $inverseSquareOfDistanceChange = pow($imag['distance'] / $this->range, 2);
     $changeInMagnitude = log($illuminationChange * $inverseSquareOfDistanceChange, self::POGSONS_RATIO);
     return $imag['mag'] - $changeInMagnitude;
 }