Genetic Algorithm Code
Objective
Benchmarking PyPI GA library with a known Uniformly Spaced Linear Array (USLA) case.
Methods
In order to design our electronically scanning antenna array, or phased array, we need to perform some calculations to determine its theoretical performance, or radiation pattern. More specifically, we need to find the Array Factor, which characterizes the radiation pattern of an antenna array. Calculating the AF for a Uniformly Spaced Linear Array (USLA) case is relatively simple as one can observe through the formula below.
![AF.PNG](https://static.wixstatic.com/media/d427e6_7fae6cfa7f2e4502bbc67c784eee2683~mv2.png/v1/fill/w_290,h_72,al_c,q_85,enc_auto/AF_PNG.png)
However, the AF of a USLA case comparable to our desired system design for 4 antennas is not optimal. Specifically, the AF for this case is maximized to 1 at 90º (an angle of interest), but not at 30º, 60º, 120º, and 150º (our other angles of interest); instead, AF ranges between 0.94 and 0.97, as seen in the figure below. This characteristic would imply a limited and inaccurate detection range for our system
![polar.PNG](https://static.wixstatic.com/media/d427e6_9760b080d8b24cacad603c68aaaba841~mv2.png/v1/fill/w_723,h_373,al_c,lg_1,q_85,enc_auto/polar_PNG.png)
Since the USLA case is not optimal, we cannot design our phased array to be uniformly spaced nor to have equal phase shifts between each antenna if we want adequate performance. However, calculating the AF for a non-USLA case requires heavy arithmetic and is very complex, as seen in the equation below.
![AF 1.PNG](https://static.wixstatic.com/media/d427e6_0ca3f69fa66a4a69bdaff8a89ee52e1b~mv2.png/v1/fill/w_290,h_78,al_c,q_85,enc_auto/AF%201_PNG.png)
Therefore, to optimize the design of our phased array, or specifically to find the phase shifts between each antenna and antenna separation distances that correspond to a maximum AF at the angles of interest, we decided to use Genetic Algorithms (GA). In particular, we chose to use MATLAB’s GA library to optimize the AF for our phased array system of 4 antennas. Our final results can be observed in Figure 2 below, and show that AF is maximized to 1 at each angle of interest and the beamwidths are adequately wide enough to cover the angles of interest, while also not interfering with each other to ensure adequate detection of RFID tags.
![AF.PNG](https://static.wixstatic.com/media/d427e6_a7896f2de5d64dea86f24c9e9ae3c939~mv2.png/v1/fill/w_726,h_358,al_c,lg_1,q_85,enc_auto/AF_PNG.png)