This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AWR1843: question about aoa

Part Number: AWR1843

Hi,ti engineer,

I read the 1843 labs demo7,and see the aoa code.

Why do you have to measure the elevation Angle and say it's greater than 1 and less than -1,the code is as follow:

if(Wz > 1)

{

Wz  = Wz  - 2;

}

else if(Wz < -1)

{

Wz  = Wz  + 2;

}

What's the theory?

Regards,

Bryant

  • Hi,

    Wz is the result of atan2().

    Please see definition of atan2()

    Thank you

    Cesar

  • Hello,Cesar

    I can not open the link you offered.I find the atan2 function that define as follow:

    Domain is  .

    However the code is as follow:

    Wz = (float) atan2sp(tempIm, tempRe) * (1.0f/PI_);  //Domain is (-1,1];
    if (Wz > 1)
    {
        Wz = Wz - 2;
    }
    else if (Wz < -1)
    {
        Wz = Wz + 2;
    }
    z = range * Wz;

    So why will Wz bigger than 1?

    Thank you

    Bryant

  • Hi,

    The code is as follows

    Thank you

    Cesar

    So first the variables Wx and Wz that we have in the code are normalized phases Wx an Wz shown in formulas. I think we mention that somewhere in the code.

     

    So let’s start for Wz:

     

    Basic proportion:

    Wz = 2*pi/lambda * AB

    where AB = d*sin(phi)    (from figure in doxygen, where we should replace (lambda/2) with d)

    So we have:

    Wz = 2*pi/lambda * d *sin(phi)       (eq1)

     

    Coordinate Z relation to spherical:

    Z = R * sin(phi)                                   (eq2)

     

    Now replace sin(phi) in eq2 from eq1

     

     

    Z = R * lambda/(2*d) * (Wz/pi)

     

    So we should add above correction when we calculate Z, not Wz.

     

    Where Wz/pi is calculated as atan2(im,re) . (I remember the formula was:  atan2(im,re)+2Wx and that is why we check if it s greater than 1 we subtract 2. This +2Wx I do not see in the line highlighted in yellow below)

     

     

    Now let’s look for Wx:

     

    Wx = 2*pi/lambda * CD

    Where CD = d * sin(theta)*cos(phi) (from figure in doxygen)

    So we have:

    Wx = 2*pi/lambda * d * sin(theta)*cos(phi)          (eq3)

     

    From FFT we calculate Wx as:

     

    Wx = (2*pi/N) * Kmax                                            (eq4)

     

    Now replace Wx in eq3 from eq4 :

     

    (2*pi/N) * Kmax = 2*pi/lambda * d * sin(theta)*cos(phi)    (eq5)

     

    The coordinate x relation to spherical:

     

    X = R * sin(theta)*cos(phi)                              (eq6)

     

    Now replace sin(theta)*cos(phi) from eq5 into eq6:

    X = R * lambda/(2*d) * 2*Kmax/N

     

     

     

    I found some old code in postprocessing.c and place there the corrections (in green):

     

    Please check, I think this should be right. We can have a call next week if you want.

     

    Regards,

    Slobodan

     

     

        Wx = 2 * (float) sMaxIdx / numAngleBins;

        x = range * (lambda/(2*d)) * Wx;

     

        if (obj->numVirtualAntElev > 0)

        {

            Wz = atan2(peakAzimIm * peakElevRe - peakAzimRe * peakElevIm,

                       peakAzimRe * peakElevRe + peakAzimIm * peakElevIm)/PI_ + (2 * Wx);

            if (Wz > 1)

            {

                  Wz = Wz - 2;

            }

            else if (Wz < -1)

            {

                  Wz = Wz + 2;

            }

            z = range * lambda/(2*d)  * Wz;

            /*record wz for debugging/testing*/

            if(objOutIndx < MMW_MAX_ELEV_OBJ_DEBUG)

            {

                obj->detObjElevationAngle[objOutIndx] = Wz;

            }

           

        }

        else

        {

            z = 0;

        }

  • Hi,

    Please find attached the derivation of this code

    thank you

    Cesar

    Wz.pdf

    Thank you

    Cesar

  • Hello,Cesar

    Thank you very much for your answer. I understand.

    BR

    Bryant

  • Great!

    Thank you

    Cesar