Пример #1
0
 public static function Sat_Eclipsed(Predict_Vector $pos, Predict_Vector $sol, &$depth)
 {
     $Rho = new Predict_Vector();
     $earth = new Predict_Vector();
     /* Determine partial eclipse */
     $sd_earth = Predict_Math::ArcSin(Predict::xkmper / $pos->w);
     Predict_Math::Vec_Sub($sol, $pos, $Rho);
     $sd_sun = Predict_Math::ArcSin(Predict::__sr__ / $Rho->w);
     Predict_Math::Scalar_Multiply(-1, $pos, $earth);
     $delta = Predict_Math::Angle($sol, $earth);
     $depth = $sd_earth - $sd_sun - $delta;
     if ($sd_earth < $sd_sun) {
         return 0;
     } else {
         if ($depth >= 0) {
             return 1;
         } else {
             return 0;
         }
     }
 }
Пример #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;
 }