/** * Calculate satellite visibility. * * @param Predict_Sat $sat The satellite structure. * @param Predict_QTH $qth The QTH * @param float $jul_utc The time at which the visibility should be calculated. * * @return int The visiblity constant, 0, 1, 2, or 3 (see above) */ public function get_sat_vis(Predict_Sat $sat, Predict_QTH $qth, $jul_utc) { /* gboolean sat_sun_status; gdouble sun_el; gdouble threshold; gdouble eclipse_depth; sat_vis_t vis = SAT_VIS_NONE; */ $eclipse_depth = 0.0; $zero_vector = new Predict_Vector(); $obs_geodetic = new Predict_Geodetic(); /* Solar ECI position vector */ $solar_vector = new Predict_Vector(); /* Solar observed az and el vector */ $solar_set = new Predict_ObsSet(); /* FIXME: could be passed as parameter */ $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; Predict_Solar::Calculate_Solar_Position($jul_utc, $solar_vector); Predict_SGPObs::Calculate_Obs($jul_utc, $solar_vector, $zero_vector, $obs_geodetic, $solar_set); if (Predict_Solar::Sat_Eclipsed($sat->pos, $solar_vector, $eclipse_depth)) { /* satellite is eclipsed */ $sat_sun_status = false; } else { /* satellite in sunlight => may be visible */ $sat_sun_status = true; } if ($sat_sun_status) { $sun_el = Predict_Math::Degrees($solar_set->el); if ($sun_el <= $this->threshold && $sat->el >= 0.0) { $vis = self::SAT_VIS_VISIBLE; } else { $vis = self::SAT_VIS_DAYLIGHT; } } else { $vis = self::SAT_VIS_ECLIPSED; } return $vis; }