0
\$\begingroup\$

I am trying to find the maximum range of a directional antenna whose beamwidth can be varied. The goal is to understand if a particular (x,y) user lies within the antenna. The distance between the transmitter and the user(x,y) can be calculated using the distance formulae.

I have attached my code for your reference. Here I have assumed Dmax to be 29, although that is the one that needs to be found out.

count = np.zeros(24)
def checkPoint(Dmax, x, y, percent, startAngle,index):

    # calculate endAngle
    endAngle = 360 / percent + startAngle

    # Calculate polar co-ordinates
    polarradius = math.sqrt(x * x + y * y)
    if (x!=0 and y!=0):
        Angle = math.atan(y / x)
        degrees = math.degrees(Angle)       
    if (x==0):
        degrees=90
    elif (x==0 and y<0):
        degrees=270
    if (x>=0 and y<0): 
    
        degrees=360+degrees;
    
    elif (x<0 and y<0):
    
        degrees=180-degrees
    
    elif (x<0 and y>0):
    
        degrees=180+degrees;
    print(degrees)
    

    # Check whether polarradius is less
    # then the maximum range
    # Angle is between startAngle and
    # endAngle or not    
    if (degrees >= startAngle and degrees <= endAngle
                        and polardistance < Dmax):
        print("Point (", x, ",", y, ") "
            "exist in the circle sector",i)
        count[i]+=1
    else:
        print("Point (", x, ",", y, ") "
            "does not exist in the circle sector",i)

Driver code

for i in range(0,50):    
    x=(int(random.randint(-29,29)))
    y= (int(random.randint(-29,29)))
    Dmax = 29
    percent, startAngle = 24, 0

    for i in range(0,24):
        checkPoint(Dmax, x, y, percent, startAngle,i)
        startAngle= startAngle+ 15 
        print(startAngle)
print(count)
max_value = np.max(count)
print(max_value)
max_index = np.where(count == max_value)
print(max_index)
\$\endgroup\$
6
  • 1
    \$\begingroup\$ hi welcome here! So, what is your precise question? \$\endgroup\$ Commented Jun 29, 2021 at 9:41
  • \$\begingroup\$ To find the Maximum range(Dmax) of a directional antenna \$\endgroup\$ Commented Jun 29, 2021 at 10:17
  • \$\begingroup\$ so, what's the precise question? Is it "What is the maximum range of an antenna?" \$\endgroup\$ Commented Jun 29, 2021 at 10:25
  • \$\begingroup\$ because then, electronics.stackexchange.com/questions/573108/… \$\endgroup\$ Commented Jun 29, 2021 at 10:26
  • \$\begingroup\$ electronics.stackexchange.com/questions/50454/…. I found this to be beneficial, assume that h is the maximum range of the beam, I am struggling to find the radius (r). Since if r is known, for a particular beamwidth, we can find h \$\endgroup\$ Commented Jun 29, 2021 at 10:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.