In this blog post, we present a sample about antenna radiation pattern simulation. Aside from minor tweaks that we made, this was written for us by EM Photonics who offer C++ AMP consultancy. First I’ll describe the app, then the algorithm, and then the three classes used in the code. Last, I will provide instructions on how to get the sample running on your machine.
This app calculates antenna radiation patterns for simple wire antennas of varying lengths. Below is a sample screenshot of the app when running. Press Ctrl + F5 to start the demo. When it is running, you can press any key on the keyboard to switch computation method between C++ AMP and CPU. On the title bar you can see the Frames Per Second for the different modes.
The length of the antenna is increased and decreased, leading to varying patterns. Each line in the output display represents a different length antenna; tracing across a line represents the radiation pattern of the antenna as swept over a 180 degree observation arc at a distance from the antenna. Brighter colors represent stronger radiation. A lightweight version of the Method of Moments (MoM) is employed for the calculation. In this method, the length of the antenna is subdivided into small pieces. The antenna is excited by a signal and the goal is to obtain the distribution of currents on the antenna, from which the radiation pattern can be calculated. Each segment of the antenna affects each other segment, and so there are N x N interactions. Mathematically, a matrix can be constructed where each line represents all of the interactions for a single element. This matrix is thus N x N in size, and must be solved.
The solution of the matrix is a large portion of the computation, and is performed with the LAPACK method GETRF for LU Factorization. This is then followed by a series of other calls from the BLAS and LAPACK libraries (TRSM and LASWP) to obtain the final current distribution.
The code presented contains code paths for both - CPU and C++ AMP.
This class represents an antenna simulation interface. Let’s focus on some of its members.
This class implements the computation using C++ AMP. Some of its member are:
The interface of this class is similar to antenna_sim_amp, but all computation is done with a CPU multi-core implementation. Correspondingly, it calls a CPU LAPACK library to solve the matrix equation.
To run the sample you need to download three things:
To compile and run the project, you have to specify these four build macros, %LAPACK_LIB_FILES_32%, %LAPACK_LIB_PATH_32%, %LAPACK_LIB_FILES_64%, %LAPACK_LIB_PATH_64%. For the details of these four build macros, please refer to the C++ AMP LAPACK library readme.txt.
Your feedback is welcome in the comments below or on our MSDN forum.
The attached sample code is released under the MS-RSL license.