# On Modeling Antennas Using MoM-Based Algorithms: Wire-Grid versus Surface Triangulation
## 2 Materials and Methods
### Wire-Grid
#### 2.2.3 Wire-Grid: Code Implementation  
Figure 4 presents a UML diagram of the Wire-Grid program components. The choice of this diagram is based on the specific architecture of the program. The user interacts with the system primarily through the use of language syntax, combining Python language constructions (loops, functions, conditions, etc.) with domain-specific commands. The Qt Client component aggregates several classes that implement the user interface of the system and provide basic functionalities, including a basic text editor and a window for displaying simulation results, such as the antenna pattern. This diagram helps to clearly illustrate the interrelationships between different components of the Wire-Grid program.  
Figure 3: Block diagram of the Wire-Grid algorithm.  
The Wire-Grid program architecture is designed to provide high-performance computing capabilities, while also providing ease-of-use through its integration with the Python programming language. The UTIL, MATRIX, and MOMwire components are implemented as separate C++ libraries, which are connected to the executable script to offer additional functionality specifically to antenna modeling. These components, such as the MATRIX component with its integration with the Eigen library, provide the capability of performing complex matrix operations and solve SLAEs.  
The WGcore component acts as an interface between the client-side user interface, implemented in the Qt Client component, and the backend modules. It contains the Python interpreter and provides the ability to interpret commands from the system's plug-in modules. The results of the code interpretation are then returned to the user through variety of formats, including graphical, textual, and numerical ones, depending on the type of the data being returned.  
In conclusion, the Wire-Grid program provides a well-designed architecture that balances the performance and the ease of use. The use of Python programming language and the implementation of components as standalone C++ libraries allow for a flexible and powerful solution for antenna modeling.  
The Workflow diagram in Figure 5 outlines the sequence of antenna modeling steps in the Wire-Grid program, as seen from the user's perspective. To begin, the user selects a language (either Python or the built-in scripting language) that will be used by the program interpreter. This selection is made by activating the checkbox in the main menu of Wire-Grid. Next, the user configures the settings for the model, such as frequency, wire radius, and segmentation. Then, the structure of the antenna to be modeled is created by entering the command sequence <<BEGIN(x1, y1, z1); END(x2, y2, z2); CREATE_WIRE()>>, which sets the beginning and end of the wire segment. The user also specifies the antenna excitation source in this step.  
Figure 4: UML component diagram of the Wire-Grid.  
In the following step, the _GET_STRUCTURE_ function retrieves the overall antenna structure and stores it in a separate variable, which is then used to calculate the impedance matrix and obtain the currents vector. Once all matrices are obtained, the _CALCULATE_FA-R_ZONE_DATA_ function must be called to calculate the data necessary for displaying the antenna pattern.  
In the postprocessing step, the user has the option to choose what to plot (antenna structure, currents distribution in the structure, or the antenna radiation pattern) and can set the number of points as well as the step of changing the \(\theta\) and \(\varphi\) angles in which the gain of the electrical field intensity, for example, will be calculated.