Example #1
0
 /**
  * Finds the current location of the sun based on the observer location
  *
  * @param Predict_QTH $qth    The observer location
  * @param int         $daynum The daynum or null to use the current daynum
  *
  * @return Predict_ObsSet
  */
 public static function FindSun(Predict_QTH $qth, $daynum = null)
 {
     if ($daynum === null) {
         $daynum = Predict_Time::get_current_daynum();
     }
     $obs_geodetic = new Predict_Geodetic();
     $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;
     $solar_vector = new Predict_Vector();
     $zero_vector = new Predict_Vector();
     $solar_set = new Predict_ObsSet();
     self::Calculate_Solar_Position($daynum, $solar_vector);
     Predict_SGPObs::Calculate_Obs($daynum, $solar_vector, $zero_vector, $obs_geodetic, $solar_set);
     $solar_set->az = Predict_Math::Degrees($solar_set->az);
     $solar_set->el = Predict_Math::Degrees($solar_set->el);
     return $solar_set;
 }
Example #2
0
require_once 'Predict/Time.php';
// Set to true to profile
$profile = true;
// Example check at the top of your application for enabling profiling
if ($profile && extension_loaded('xhprof')) {
    $xproflib = './xhprof_lib';
    include_once $xproflib . '/utils/xhprof_lib.php';
    include_once $xproflib . '/utils/xhprof_runs.php';
    xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
    function stop_xhprof_profiling()
    {
        $xhprofData = xhprof_disable();
        $xhprofNameSpace = 'predict';
        $xhprofRuns = new XHProfRuns_Default();
        $xhprofRunID = $xhprofRuns->save_run($xhprofData, $xhprofNameSpace);
    }
    register_shutdown_function('stop_xhprof_profiling');
}
$start = microtime(true);
$predict = new Predict();
$qth = new Predict_QTH();
$qth->lat = 37.655;
$qth->lon = -122.407;
$qth->alt = 0;
$tleFile = file('examples/iss.tle');
$tle = new Predict_TLE($tleFile[0], $tleFile[1], $tleFile[2]);
$sat = new Predict_Sat($tle);
$now = Predict_Time::get_current_daynum();
$results = $predict->get_passes($sat, $qth, $now, 10);
echo "Execution time:  " . number_format((microtime(true) - $start) * 1000, 2) . "ms\n";
exit;
Example #3
0
 /**
  *  Predict the next pass.
  *
  * This function simply wraps the get_pass function using the current time
  * as parameter.
  *
  * Note: the data in sat will be corrupt (future) and must be refreshed
  *       by the caller, if the caller will need it later on (eg. if the caller
  *       is GtkSatList).
  *
  * @param Predict_Sat $sat   The satellite data.
  * @param Predict_QTH $qth   The observer data.
  * @param int         $maxdt The maximum number of days to look ahead.
  *
  * @return Predict_Pass Pointer instance or NULL if no pass can be
  *         found.
  */
 public function get_next_pass(Predict_Sat $sat, Predict_QTH $qth, $maxdt)
 {
     /* get the current time and call the get_pass function */
     $now = Predict_Time::get_current_daynum();
     return $this->get_pass($sat, $qth, $now, $maxdt);
 }