float AxesLib::getY(){
	if(_x_rev==false)
		_ry = _deg2rad((float) _y/_pgrad_y);
	else
		_ry = _deg2rad((float) (_topy+(_topy-_y))/_pgrad_y);
	return _ry;
}
Exemple #2
0
static double _rts_sun_altitude(double latitude, double delta_prime, double h_prime)
{
   double latitude_rad    = _deg2rad(latitude);
   double delta_prime_rad = _deg2rad(delta_prime);

   return _rad2deg (asin (sin(latitude_rad)*sin(delta_prime_rad) +
                          cos(latitude_rad)*cos(delta_prime_rad)*cos(_deg2rad(h_prime))));
}
Exemple #3
0
static double _top_azimuth_angle_astro(double h_prime, double latitude, double delta_prime)
{
   double h_prime_rad = _deg2rad(h_prime);
   double lat_rad     = _deg2rad(latitude);

   return _wrap (_rad2deg (atan2(sin(h_prime_rad),
                                 cos(h_prime_rad)*sin(lat_rad) - tan(_deg2rad(delta_prime))*cos(lat_rad))), 0, 360);
}
Exemple #4
0
static double _top_elevation_angle (double latitude, double delta_prime, double h_prime)
{
   double lat_rad         = _deg2rad (latitude);
   double delta_prime_rad = _deg2rad (delta_prime);

   return _rad2deg (asin(sin(lat_rad)*sin(delta_prime_rad) +
                         cos(lat_rad)*cos(delta_prime_rad) * cos(_deg2rad(h_prime))));
}
Exemple #5
0
/*!
 * \brief
 *    Calculate geocentric declination
 * \return  [deg]
 */
static double _geo_declination(double beta, double epsilon, double lamda)
{
   double beta_rad    = _deg2rad (beta);
   double epsilon_rad = _deg2rad (epsilon);

   return _rad2deg (asin (sin(beta_rad)*cos(epsilon_rad) +
                          cos(beta_rad)*sin(epsilon_rad)*sin(_deg2rad(lamda))));
}
Exemple #6
0
static double _incidence_angle (spa_output_t so, spa_location_t sl)
{
   double zenith_rad = _deg2rad (so.zenith);
   double slope_rad  = _deg2rad (sl.slope);

   return _rad2deg(acos(cos(zenith_rad)*cos(slope_rad)  +
                        sin(slope_rad )*sin(zenith_rad) *
                           cos(_deg2rad(so.azimuth_astro - sl.azm_rotation))));
}
Exemple #7
0
/*!
 * \brief
 *    Calculate geocentric right ascension
 * \return  [deg]
 */
static double _geo_right_ascension(double lamda, double epsilon, double beta)
{
   double lamda_rad   = _deg2rad (lamda);
   double epsilon_rad = _deg2rad (epsilon);

   return _wrap (_rad2deg (
                    atan2( sin (lamda_rad)*cos (epsilon_rad) - tan (_deg2rad (beta))*sin (epsilon_rad),
                           cos (lamda_rad))),
                 0, 360);
}
Exemple #8
0
static double _rts_hour_angle_at_rise_set (double latitude, double delta_zero, double h0_prime)
{
   double h0             = -99999;
   double latitude_rad   = _deg2rad (latitude);
   double delta_zero_rad = _deg2rad (delta_zero);
   double argument       = (sin(_deg2rad(h0_prime)) - sin(latitude_rad)*sin(delta_zero_rad)) /
                                                     (cos(latitude_rad)*cos(delta_zero_rad));

   if (fabs(argument) <= 1) h0 = _wrap (_rad2deg(acos(argument)), 0, 180);

   return h0;
}
Exemple #9
0
static double _refraction_correction(spa_atmos_t sa, double e0)
{
   double del_e = 0;

   if (e0 >= -1*(SUN_RADIUS + sa.refract))
      del_e = (sa.pressure / 1010.0) * (283.0 / (273.0 + sa.temperature)) *
              1.02 / (60.0 * tan(_deg2rad(e0 + 10.3/(e0 + 5.11))));
   return del_e;
}
Exemple #10
0
/*
 * \brief
 *    Calculate topocentric declination and right ascension parallax at once
 * \return  [dec]
 */
static void _delta_alpha_prime(spa_location_t sl, double xi, double h, double delta, double *delta_alpha, double *delta_prime)
{
   double delta_alpha_rad;
   double lat_rad   = _deg2rad (sl.latitude);
   double xi_rad    = _deg2rad (xi);
   double h_rad     = _deg2rad (h);
   double delta_rad = _deg2rad (delta);
   double u = atan(0.99664719 * tan(lat_rad));
   double y = 0.99664719 * sin(u) + sl.elevation*sin(lat_rad)/6378140.0;
   double x =              cos(u) + sl.elevation*cos(lat_rad)/6378140.0;

   delta_alpha_rad =      atan2(                - x*sin(xi_rad) *sin(h_rad),
                                 cos(delta_rad) - x*sin(xi_rad) *cos(h_rad));

   *delta_prime = _rad2deg (atan2((sin(delta_rad) - y*sin(xi_rad))*cos(delta_alpha_rad),
                                   cos(delta_rad) - x*sin(xi_rad) *cos(h_rad)));

   *delta_alpha = _rad2deg (delta_alpha_rad);
}
Exemple #11
0
/**
 * Calculate the distance between two geodetic location in miles.
 */
double shgeo_dist(shgeo_t *f_geo, shgeo_t *t_geo)
{
  static const shnum_t mile_mod = 90.9;
  shnum_t theta, dist;
  shnum_t lat1, lat2;
  shnum_t lon1, lon2;

  shgeo_loc(f_geo, &lat1, &lon1, NULL);
  shgeo_loc(t_geo, &lat2, &lon2, NULL);

  theta = lon1 - lon2;
  dist = (sinl(_deg2rad(lat1)) * sinl(_deg2rad(lat2))) + 
    (cosl(_deg2rad(lat1)) * cosl(_deg2rad(lat2)) * cosl(_deg2rad(theta)));
  dist = acosl(dist);
  dist = _rad2deg(dist);
  dist = dist * mile_mod;

  return ((double)dist);
}
float AxesLib::getX(){
	float degx;
	
	if(_x_rev==false)	degx = (float) _x/_pgrad_x;
	else{
		if(_x>=_revx)
			degx = (float) (_x-_revx)/_pgrad_x;
		else
			degx = (float) (_x+_revx)/_pgrad_x;
	}
	_rx = _deg2rad(360.0 - degx);
	return _rx;
}
Exemple #13
0
/*!
 * \Calculate Nutation longitude and obliquity
 * \return  [rad]
 */
static void _nutation (double jce, double x[TERM_X_COUNT], double *del_psi, double *del_epsilon)
{
   int i;
   double xy_term_sum, sum_psi=0, sum_epsilon=0;

   for (i = 0; i < Y_COUNT; i++) {
      xy_term_sum  = _deg2rad (_xy_term_sum (i, x));
      sum_psi     += (PE_TERMS[i][TERM_PSI_A] + jce*PE_TERMS[i][TERM_PSI_B])*sin(xy_term_sum);
      sum_epsilon += (PE_TERMS[i][TERM_EPS_C] + jce*PE_TERMS[i][TERM_EPS_D])*cos(xy_term_sum);
   }

   *del_psi     = sum_psi     / 36000000.0;
   *del_epsilon = sum_epsilon / 36000000.0;
}
Exemple #14
0
/*!
 * \brief
 *    Set latitude
 * \param   spa   Pointer to linked data struct
 * \param   lat   Latitude in Degrees.
 */
inline void spa_set_latitude (spa_t *spa, double lat) {
   spa->latitude = _deg2rad (lat);
}
Exemple #15
0
/*!
 * \brief
 *    Set longitude
 * \param   spa   Pointer to linked data struct
 * \param   lon   Longitude in Degrees.
 */
inline void spa_set_longitude (spa_t *spa, double lon) {
   spa->longitude = _deg2rad (lon);
}