Пример #1
0
/*************************************************************************

   Description:
     This function uses the NOVAS software library to compute the position
     of the Sun on the local horizon, but for an input time, instead of the
     current time.
 
   Inputs:
      here - The point on the surface of the earth we are at.
      time_in - The UTC time in seconds that we need to compute
                the Sun's position.
 
   Outputs:
      *SunAz - The returned sun azimuth, in degrees from true north.
      *SunEl - The returned sun elevation, in degrees above the
               local horizon.
 
**************************************************************************/
void ORPGSUN_NovasComputePosAtTime( site_info here, double *SunAz, 
                                    double *SunEl, time_t time_in ){

    /* The earth and sun body structures.  See NOVAS documentation for 
       more information. */
    body earth, sun;

    /* The right ascension, and declination of the sun */
    double ra, declination;

    /* The terrestrial dynamical time (TDT) julian date */
    double tdt_julian_date;

    /* Zenith distance, measured from the local vertical. */
    double zenith_distance;

    /* The Sun's azimuth is measured from the north */
    double azimuth;

    /* rar -right ascension. decr -declination. In equatorial 
       coordinate system */
    double rar, decr;

    /* The distance to the Sun, units of AU, not returned by this function. */
    double distanceAU;

    /* Call NOVAS subroutine set_body to setup Sun and Earth body structures. */
    set_body( 0, 10, "Sun", &sun );
    set_body( 0, 3, "Earth", &earth );

    /* Get the TDT date for the input time. */
    Get_tdt_julian_date_at_time( &tdt_julian_date, time_in, ORPGSUN_DELTAT );

    /* Call NOVAS routine topo_planet to get the right ascension and 
       declination of the Sun in topographic/equatorial coordinate 
       system. */
    topo_planet( tdt_julian_date, &sun, &earth, ORPGSUN_DELTAT, &here,
                 &ra, &declination, &distanceAU );

    /* Call NOVAS subroutine equ2hor to convert the Sun's position to
       local horizon coordinates. */
    equ2hor( tdt_julian_date, ORPGSUN_DELTAT,
             0.0 /* x_ephemeris */, 
             0.0 /* y_ephemeris */,
             &here, ra, declination, 1 /* normal refraction */,
             &zenith_distance,
             &azimuth,
             &rar, &decr );

    /* Convert zenith_distance reference point so that the Sun's
       elevation is referenced to the local horizon. */
    *SunEl = 90.0 - zenith_distance;

    /* Azimuth needs no conversion, its local horizon reference
       is already true north. */
    *SunAz = azimuth;

} /* End of ORPGSUN_NovasComputePosAtTime() */
Пример #2
0
/**
 * This function uses the NOVAS software library to compute the position 
 * of the Sun on the local horizon, but for an input time, instead of the current time.
 *
 * --------------------------------------------------------
 *  
 * @param here (site_info)  The point on the surface of the earth we are at.
 * @param deltat (double)   The difference between terrestrial dynamical time system 1 time, and universal time.
 * @param *SunAz (double *) The returned sun azimuth, in degrees from true north.
 * @param *SunEl (double *) The returned sun elevation, in degrees above the local horizon.
 * @param time_in (time_t)  The utc time in seconds that we need to compute the Sun's position.
 *
 * --------------------------------------------------------
 */
void rsts_SunNovasComputePosAtTime( site_info here, double deltat, double *SunAz, double *SunEl, time_t time_in )
{
  /** <b> Local Variables </b> */
  /** <ul> */
  /** <li><b> body earth,sun </b> - The earth and sun body structures. See NOVAS documentation for more information. </li> */
  body earth,sun;
  /** <li><b> double ra,declination </b> - The right ascension, and declination of the sun </li> */
  double ra,declination;
  /** <li><b> double tdt_julian_date </b> - the current terrestrial dynamical time (TDT) julian date </li> */
  double  tdt_julian_date;
  /** <li><b> double zenith_distance </b> - Zenith distance, measured from the local vertical. </li> */
  double zenith_distance;
  /** <li><b> double azimuth </b> - The Sun's azimuth is measured from the north </li> */
  double azimuth;
  /** <li><b> double rar,decr </b> - rar -right ascension. decr -declination. In equatorial coordinate system </li> */
  double rar,decr;
  /** <li><b> double distanceAU </b> - The distance to the Sun, units of AU, not returned by this function. </li> */
  double distanceAU;
  /** </ul> */

  /**------------------------------------------------------*/
  /** <h3> The following is a detailed description of the steps for rsts_SunNovasComputePosAtTime(): </h3> */
  
  /** Call NOVAS subroutine set_body to setup Sun and Earth body structures. */
  set_body(0,10,"Sun",&sun);
  set_body(0,3,"Earth",&earth);

  /** Get the TDT date for the input time. */
  rsts_get_tdt_julian_date_at_time( &tdt_julian_date, time_in);

  /** Call NOVOS routine topo_planet to get the right ascension and declination 
   * of the Sun in topographic/equatorial coordinate system. */
  topo_planet( tdt_julian_date,
	       &sun, &earth, deltat,
	       &here ,
	       &ra , &declination , &distanceAU);
	       
  /** Call NOVAS subroutine equ2hor to convert the Sun's position to local horizon coordinates. */
  equ2hor( tdt_julian_date, deltat,
	   0.0 /*x_ephemeris*/, 0.0 /*y_ephemeris*/,
	   &here,ra,declination,1/*normal refraction*/,
	   &zenith_distance,
	   &azimuth,
	   &rar,&decr);

 /** Convert zenith_distance reference point so that the Sun's elevation is referenced to the local horizon. */
  *SunEl = 90.0 - zenith_distance; 
  /** Azimuth needs no conversion, its local horizon reference is already true north. */
  *SunAz = azimuth;
  /** Log a message to the test log with the input time, and position of the sun given. */
  /** RSTS_LOG_MSG(LOG_RDA_OTEST,"Sun Pos at TDT JD %f - Az %f  El %f",tdt_julian_date,*SunAz,*SunEl); */
  /** If this is a stand alone unit test, the results of the subroutine are printed 
   * for comparison with the naval observatory's web pages. */
#ifdef _RSTS_SUN_POS_UNIT_TEST
  printf(" El : %f   Az : %f \n", *SunEl, *SunAz);
#endif
}