示例#1
0
文件: SPA.cpp 项目: kamalsirsa/vtp
///////////////////////////////////////////////////////////////////////////////////////////
// Calculate all SPA parameters and put into structure
// Note: All inputs values (listed in header file) must already be in structure
///////////////////////////////////////////////////////////////////////////////////////////
void spa_calculate(spa_data *spa)
{
	spa->jd = julian_day (spa->year, spa->month,  spa->day,
						  spa->hour, spa->minute, spa->second, spa->timezone);

	calculate_geocentric_sun_right_ascension_and_declination(spa);

	spa->h  = observer_hour_angle(spa->nu, spa->longitude, spa->alpha);
	spa->xi = sun_equatorial_horizontal_parallax(spa->r);

	sun_right_ascension_parallax_and_topocentric_dec(spa->latitude, spa->elevation, spa->xi, spa->h,
									spa->delta, &(spa->del_alpha), &(spa->delta_prime));

	spa->alpha_prime = topocentric_sun_right_ascension(spa->alpha, spa->del_alpha);
	spa->h_prime	 = topocentric_local_hour_angle(spa->h, spa->del_alpha);
	spa->e0			 = topocentric_elevation_angle(spa->latitude, spa->delta_prime, spa->h_prime);
	spa->del_e		 = atmospheric_refraction_correction(spa->pressure, spa->temperature, spa->e0);
	spa->e			 = topocentric_elevation_angle_corrected(spa->e0, spa->del_e);

	spa->zenith		 = topocentric_zenith_angle(spa->e);
	spa->azimuth180	 = topocentric_azimuth_angle_neg180_180(spa->h_prime, spa->latitude,
															spa->delta_prime);
	spa->azimuth	 = topocentric_azimuth_angle_zero_360(spa->azimuth180);
	spa->incidence	 = surface_incidence_angle(spa->zenith, spa->azimuth180, spa->azm_rotation,
											   spa->slope);
	spa->altitude	 = 90.0 - spa->incidence;   //**KMB

	calculate_eot_and_sun_rise_transit_set(spa);
}
示例#2
0
文件: spa.c 项目: HEROES-GSFC/SAS
///////////////////////////////////////////////////////////////////////////////////////////
// Calculate all SPA parameters and put into structure
// Note: All inputs values (listed in header file) must already be in structure
///////////////////////////////////////////////////////////////////////////////////////////
int spa_calculate(spa_data *spa)
{
    int result;

    result = validate_inputs(spa);

    if (result == 0)
    {
        spa->jd = julian_day (spa->year, spa->month,  spa->day,
                              spa->hour, spa->minute, spa->second, spa->timezone);

        calculate_geocentric_sun_right_ascension_and_declination(spa);

        spa->h  = observer_hour_angle(spa->nu, spa->longitude, spa->alpha);
        spa->xi = sun_equatorial_horizontal_parallax(spa->r);

        sun_right_ascension_parallax_and_topocentric_dec(spa->latitude, spa->elevation, spa->xi,
                spa->h, spa->delta, &(spa->del_alpha), &(spa->delta_prime));

        spa->alpha_prime = topocentric_sun_right_ascension(spa->alpha, spa->del_alpha);
        spa->h_prime     = topocentric_local_hour_angle(spa->h, spa->del_alpha);

        spa->e0      = topocentric_elevation_angle(spa->latitude, spa->delta_prime, spa->h_prime);
        spa->del_e   = atmospheric_refraction_correction(spa->pressure, spa->temperature,
                       spa->atmos_refract, spa->e0);
        spa->e       = topocentric_elevation_angle_corrected(spa->e0, spa->del_e);

        spa->zenith     = topocentric_zenith_angle(spa->e);
        spa->azimuth180 = topocentric_azimuth_angle_neg180_180(spa->h_prime, spa->latitude,
                          spa->delta_prime);
        spa->azimuth    = topocentric_azimuth_angle_zero_360(spa->azimuth180);

        if ((spa->function == SPA_ZA_INC) || (spa->function == SPA_ALL))
            spa->incidence  = surface_incidence_angle(spa->zenith, spa->azimuth180,
                              spa->azm_rotation, spa->slope);

        if ((spa->function == SPA_ZA_RTS) || (spa->function == SPA_ALL))
            calculate_eot_and_sun_rise_transit_set(spa);
    }

    return result;
}