Esempio n. 1
0
 /** SGP4SDP4 driver for doing AOS/LOS calculations.
  *  @param Predict_Sat $sat The satellite data.
  *  @param Predict_QTH $qth The QTH observer location data.
  *  @param float       $t   The time for calculation (Julian Date)
  *
  */
 public function predict_calc(Predict_Sat $sat, Predict_QTH $qth, $t)
 {
     $obs_set = new Predict_ObsSet();
     $sat_geodetic = new Predict_Geodetic();
     $obs_geodetic = new Predict_Geodetic();
     $obs_geodetic->lon = $qth->lon * self::de2ra;
     $obs_geodetic->lat = $qth->lat * self::de2ra;
     $obs_geodetic->alt = $qth->alt / 1000.0;
     $obs_geodetic->theta = 0;
     $sat->jul_utc = $t;
     $sat->tsince = ($sat->jul_utc - $sat->jul_epoch) * self::xmnpda;
     /* call the norad routines according to the deep-space flag */
     $sgpsdp = Predict_SGPSDP::getInstance($sat);
     if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) {
         $sgpsdp->SDP4($sat, $sat->tsince);
     } else {
         $sgpsdp->SGP4($sat, $sat->tsince);
     }
     Predict_Math::Convert_Sat_State($sat->pos, $sat->vel);
     /* get the velocity of the satellite */
     $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z);
     $sat->velo = $sat->vel->w;
     Predict_SGPObs::Calculate_Obs($sat->jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set);
     Predict_SGPObs::Calculate_LatLonAlt($sat->jul_utc, $sat->pos, $sat_geodetic);
     while ($sat_geodetic->lon < -self::pi) {
         $sat_geodetic->lon += self::twopi;
     }
     while ($sat_geodetic->lon > self::pi) {
         $sat_geodetic->lon -= self::twopi;
     }
     $sat->az = Predict_Math::Degrees($obs_set->az);
     $sat->el = Predict_Math::Degrees($obs_set->el);
     $sat->range = $obs_set->range;
     $sat->range_rate = $obs_set->range_rate;
     $sat->ssplat = Predict_Math::Degrees($sat_geodetic->lat);
     $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon);
     $sat->alt = $sat_geodetic->alt;
     $sat->ma = Predict_Math::Degrees($sat->phase);
     $sat->ma *= 256.0 / 360.0;
     $sat->phase = Predict_Math::Degrees($sat->phase);
     /* same formulas, but the one from predict is nicer */
     //sat->footprint = 2.0 * xkmper * acos (xkmper/sat->pos.w);
     $sat->footprint = 12756.33 * acos(self::xkmper / (self::xkmper + $sat->alt));
     $age = $sat->jul_utc - $sat->jul_epoch;
     $sat->orbit = floor(($sat->tle->xno * self::xmnpda / self::twopi + $age * $sat->tle->bstar * self::ae) * $age + $sat->tle->xmo / self::twopi) + $sat->tle->revnum - 1;
 }
Esempio n. 2
0
File: Sat.php Progetto: stml/auspex
 /** Initialise satellite data.
  *  @param sat The satellite to initialise.
  *  @param qth Optional QTH info, use (0,0) if NULL.
  *
  * This function calculates the satellite data at t = 0, ie. epoch time
  * The function is called automatically by gtk_sat_data_read_sat.
  */
 public function sat_data_init_sat(Predict_Sat $sat, Predict_QTH $qth = null)
 {
     $obs_geodetic = new Predict_Geodetic();
     $obs_set = new Predict_ObsSet();
     $sat_geodetic = new Predict_Geodetic();
     /* double jul_utc, age; */
     $jul_utc = Predict_Time::Julian_Date_of_Epoch($sat->tle->epoch);
     // => tsince = 0.0
     $sat->jul_epoch = $jul_utc;
     /* initialise observer location */
     if ($qth != null) {
         $obs_geodetic->lon = $qth->lon * Predict::de2ra;
         $obs_geodetic->lat = $qth->lat * Predict::de2ra;
         $obs_geodetic->alt = $qth->alt / 1000.0;
         $obs_geodetic->theta = 0;
     } else {
         $obs_geodetic->lon = 0.0;
         $obs_geodetic->lat = 0.0;
         $obs_geodetic->alt = 0.0;
         $obs_geodetic->theta = 0;
     }
     /* execute computations */
     $sdpsgp = Predict_SGPSDP::getInstance($sat);
     if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) {
         $sdpsgp->SDP4($sat, 0.0);
     } else {
         $sdpsgp->SGP4($sat, 0.0);
     }
     /* scale position and velocity to km and km/sec */
     Predict_Math::Convert_Sat_State($sat->pos, $sat->vel);
     /* get the velocity of the satellite */
     $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z);
     $sat->velo = $sat->vel->w;
     Predict_SGPObs::Calculate_Obs($jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set);
     Predict_SGPObs::Calculate_LatLonAlt($jul_utc, $sat->pos, $sat_geodetic);
     while ($sat_geodetic->lon < -Predict::pi) {
         $sat_geodetic->lon += Predict::twopi;
     }
     while ($sat_geodetic->lon > Predict::pi) {
         $sat_geodetic->lon -= Predict::twopi;
     }
     $sat->az = Predict_Math::Degrees($obs_set->az);
     $sat->el = Predict_Math::Degrees($obs_set->el);
     $sat->range = $obs_set->range;
     $sat->range_rate = $obs_set->range_rate;
     $sat->ssplat = Predict_Math::Degrees($sat_geodetic->lat);
     $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon);
     $sat->alt = $sat_geodetic->alt;
     $sat->ma = Predict_Math::Degrees($sat->phase);
     $sat->ma *= 256.0 / 360.0;
     $sat->footprint = 2.0 * Predict::xkmper * acos(Predict::xkmper / $sat->pos->w);
     $age = 0.0;
     $sat->orbit = floor(($sat->tle->xno * Predict::xmnpda / Predict::twopi + $age * $sat->tle->bstar * Predict::ae) * $age + $sat->tle->xmo / Predict::twopi) + $sat->tle->revnum - 1;
     /* orbit type */
     $sat->otype = $sat->get_orbit_type($sat);
 }