/ 8_Utils / Python / patch_antenna.py
patch_antenna.py
 1  import numpy as np
 2  
 3  def calculate_patch_antenna_parameters(frequency, epsilon_r, h_sub, h_cu, array):
 4      # Constants
 5      c = 3e8  # Speed of light in m/s
 6      
 7      # Convert height from mm to meters
 8      h_sub_m = h_sub * 1e-3
 9      h_cu_m = h_cu * 1e-3
10  
11      # Calculate Lambda
12      lamb = c /(frequency * 1e9)
13      
14      # Calculate the effective dielectric constant
15      epsilon_eff = (epsilon_r + 1) / 2 + (epsilon_r - 1) / 2 * (1 + 12 * h_sub_m / (array[1] * h_cu_m)) ** (-0.5)
16      
17      # Calculate the width of the patch
18      W = c / (2 * frequency * 1e9) * np.sqrt(2 / (epsilon_r + 1))
19      
20      # Calculate the effective length
21      delta_L = 0.412 * h_sub_m * (epsilon_eff + 0.3) * (W / h_sub_m + 0.264) / ((epsilon_eff - 0.258) * (W / h_sub_m + 0.8))
22      
23      # Calculate the length of the patch
24      L = c / (2 * frequency * 1e9 * np.sqrt(epsilon_eff)) - 2 * delta_L
25      
26      # Calculate the separation distance in the horizontal axis (dx)
27      dx = lamb/2  # Typically 1.5 times the width of the patch
28      
29      # Calculate the separation distance in the vertical axis (dy)
30      dy = lamb/2  # Typically 1.5 times the length of the patch
31      
32      # Calculate the feeding line width (W_feed)
33      Z0 = 50  # Characteristic impedance of the feeding line (typically 50 ohms)
34      A = Z0 / 60 * np.sqrt((epsilon_r + 1) / 2) + (epsilon_r - 1) / (epsilon_r + 1) * (0.23 + 0.11 / epsilon_r)
35      W_feed = 8 * h_sub_m / np.exp(A) - 2 * h_cu_m
36      
37      # Convert results back to mm
38      W_mm = W * 1e3
39      L_mm = L * 1e3
40      dx_mm = dx * 1e3
41      dy_mm = dy * 1e3
42      W_feed_mm = W_feed * 1e3
43      
44      return W_mm, L_mm, dx_mm, dy_mm, W_feed_mm
45  
46  # Example usage
47  frequency = 10.5  # Frequency in GHz
48  epsilon_r = 3.48  # Relative permittivity of the substrate
49  h_sub = 0.102  # Height of substrate in mm
50  h_cu = 0.07  # Height of copper in mm
51  array = [2, 2]  # 2x2 array
52  
53  W_mm, L_mm, dx_mm, dy_mm, W_feed_mm = calculate_patch_antenna_parameters(frequency, epsilon_r, h_sub, h_cu, array)
54  
55  print(f"Width of the patch: {W_mm:.4f} mm")
56  print(f"Length of the patch: {L_mm:.4f} mm")
57  print(f"Separation distance in horizontal axis: {dx_mm:.4f} mm")
58  print(f"Separation distance in vertical axis: {dy_mm:.4f} mm")
59  print(f"Feeding line width: {W_feed_mm:.2f} mm")