lib/cir/src/cir.c
/*!
 * @fn cir_calc_aoa(float pdoa, float wavelength, float antenna_separation)
 *
 * @brief Calculate the phase difference between receivers
 *
 * @param pdoa       - phase difference of arrival in radians
 * @param wavelength - wavelength of the radio channel used in meters
 * @param antenna_separation - distance between centers of antennas in meters
 *
 * output parameters
 *
 * returns angle of arrival - float, in radians
 */
@fn cir_calc_aoa(float pdoa, float wavelength, float antenna_separation)
@brief Calculate the phase difference between receivers

@param pdoa       - phase difference of arrival in radians
@param wavelength - wavelength of the radio channel used in meters
@param antenna_separation - distance between centers of antennas in meters

output parameters

returns angle of arrival - float, in radians
@fn cir_calc_aoa ( float pdoa float wavelength float antenna_separation ) @brief Calculate the phase difference between receivers @param pdoa - phase difference of arrival in radians @param wavelength - wavelength of the radio channel used in meters @param antenna_separation - distance between centers of antennas in meters output parameters returns angle of arrival - float in radians
dpl_float32_t
cir_calc_aoa(dpl_float32_t pdoa, dpl_float32_t wavelength, dpl_float32_t antenna_separation)
{
    dpl_float32_t aoa, pd_dist;
#if __KERNEL__
    dpl_float32_t divider = DPL_FLOAT32_MUL(DPL_FLOAT32_INIT(2.0f), DPL_FLOAT32_INIT(M_PI));
    divider = DPL_FLOAT32_MUL(divider, wavelength);
    pd_dist = DPL_FLOAT32_DIV(pdoa, divider);
    pd_dist = DPL_FLOAT32_DIV(pd_dist, antenna_separation);
    aoa = DPL_FLOAT32_FROM_F64(DPL_FLOAT64_ASIN(DPL_FLOAT64_FROM_F32(pd_dist)));
#else
    pd_dist = pdoa / (DPL_FLOAT32_INIT(2.0f)*M_PI) * wavelength;
    aoa = asinf(pd_dist / antenna_separation);
#endif
    return aoa;
}
dpl_float32_t cir_calc_aoa ( dpl_float32_t pdoa , dpl_float32_t wavelength , dpl_float32_t antenna_separation ) { dpl_float32_t aoa , pd_dist ; #if __KERNEL__ dpl_float32_t divider = DPL_FLOAT32_MUL ( DPL_FLOAT32_INIT ( 2.0f ) , DPL_FLOAT32_INIT ( M_PI ) ) ; divider = DPL_FLOAT32_MUL ( divider , wavelength ) ; pd_dist = DPL_FLOAT32_DIV ( pdoa , divider ) ; pd_dist = DPL_FLOAT32_DIV ( pd_dist , antenna_separation ) ; aoa = DPL_FLOAT32_FROM_F64 ( DPL_FLOAT64_ASIN ( DPL_FLOAT64_FROM_F32 ( pd_dist ) ) ) ; #else pd_dist = pdoa / ( DPL_FLOAT32_INIT ( 2.0f ) * M_PI ) * wavelength ; aoa = asinf ( pd_dist / antenna_separation ) ; #endif return aoa ; }
@fn cir_calc_aoa(float pdoa, float wavelength, float antenna_separation)
 @brief Calculate the phase difference between receivers
@fn cir_calc_aoa ( float pdoa float wavelength float antenna_separation ) @brief Calculate the phase difference between receivers