Você está na página 1de 10

U NIVERSITY OF T ORONTO FACULTY OF A PPLIED S CIENCE AND E NGINEERING The Edward S. Rogers Sr.

Department of Electrical and Computer Engineering

ECE1229S: A DVANCED A NTENNA T HEORY S UPPLEMENTAL I NFORMATION FOR M O M S IMULATIONS Assignments in ECE1229 will make extensive use of a simple yet powerful 3D Method of Moments code based on Rao-Wilton-Glisson basis functions [1]. This code can be used to solve for the surface current density on antennas of arbitrary shape, under a variety of incident eld conditions. The core code is implemented in MATLAB, allowing you to use well-known capabilities of this software to process and visualize outputs of the code. However, to facilitate the input of the antenna geometry, and triangular meshing of the resulting structure, another set of software is used. Additional software is required because MATLAB lacks interface for dening geometries and the capability to mesh the geometry. While the MATLAB Partial Differential Equation (PDE) toolbox could be used for this purpose, it only can dened and mesh 2D geometries, and is not widely available to students. The workow between this external software and MATLAB is described in this document. A simple example is presented in a tutorial at the end, to ease you into using this tool.

Geometry and Meshing Module


The geometry and meshing module is implemented using a very powerful open-source meshing tool called Gmsh [2]. Gmsh is a tool that contains a basic interface interface for dening threedimensional geometries and a powerful mesh-generating algorithm. For antenna problems, we will use the geometry module in Gmsh for dening locations of perfect electrical conductors (PECs) in the antenna. We will use Gmsh only for dening and meshing surfaces that describe the antenna. Volumetric structures and meshing will not be considered, though volumes themselves can be analyzed by treating them as closed surfaces (which the electric eld integral equation is capable of handling). Geometries can be dened in Gmsh using a simple GUI, or in a specialized geometry language designed specically for the tool. Either of these approaches can be used for the antennas we will analyze in this course. After a geometry has been dened, a 2D meshing algorithm can be called within Gmsh to create a triangular mesh conforming to the surfaces you have dened as the antennas geometry. The mesh can also be further rened if more detail is needed in specic areas of the geometry. At the end, the mesh le is saved, and imported into MATLAB. The use of Gmsh stops here, though it is possible to export results back to Gmsh and show derived quantities on the mesh. For example, the surface current density can be imported back in Gmsh and viewed in scalar and vector form using Gmshs

powerful post-processing capabilities. These capabilities are beyond the scope of this document, given that MATLAB can also be used to display the same information. The mesh produced by Gmsh is saved in a text le. This le is not directly readable by MATLAB due to a signicant amount of metadata that is placed in the le. To facilitate importing the mesh into MATLAB, a script has been written (rwgmeshmat.py) that will convert the mesh le produced by Gmsh into a readable format for MATLAB. This mesh is then loaded into MATLAB for use in MoM calculations.

Method of Moments Implementation


A MoM technique based on RWG basis functions has been implemented in MATLAB [3]. Most signicantly, a numerical integration technique for handling the surface integrals in the EFIE associated with RWG basis functions has been elegantly and efciently implemented. While [3] nicely presents a number of canned antenna problems and meshes to consider, in this course I want you to be able to dene your own antenna problems. Hence, some of the core code from [3], in conjunction with the meshes you dene with Gmsh, will allow you to dene completely arbitrary antenna geometries and types that will be studied in the course. The core MoM kernel used here borrows code from [3] to form impedance matrices associated with antenna meshes you have dened with Gmsh. From there, you will need to dene the voltage vector yourself, and use MATLAB to solve the system of equations to solve for the coefcients in the MoM expansion. You will then formulate the (now known) surface current density, and use that to calculate useful quantities associated with the antenna (radiation pattern, input impedance, etc.).

Usage
A owchart of the steps involved in solving a MoM problem are shown in Figure 1. You begin by dening a geometry in Gmsh, either via the graphical interface or geometry language. This can be saved as a .geo le. Next, the 2D meshing module is accessed in Gmsh, which will create a mesh which can be checked in the graphical user interface. The mesh is saved in a .msh le. rwgmeshmat.py is the script that will convert this le into a text le that can be read into MATLAB. Once in MATLAB, a series of MATLAB scripts, rwg1.m rwg4.m, are called in sequence to ultimately derive the impedance matrix of the antenna: 1. rwg1.m calculates aspects of the mesh and stores them in the following variables, which are saved into mesh1.mat: p(1:3, P) array of Cartesian node coordinates, where the number of nodes is P ; t(1:4, N) array of node numbers for each triangle, where the number of triangles is N. The fourth row is the domain number which is not used;

Gmsh geometry module le.geo Gmsh 2D mesh module le.msh rwgmatmesh.py le.txt rwg1.m mesh1.mat rwg2.m mesh2.mat rwg3.m impedance.mat rwg4.m current.mat Surface current density Figure 1: Flowchart of MoM solution

Edge (1:2, m) contains the two node numbers associated with edge m; TrianglePlus(m) contains the triangle number of the plus triangle of edge m; TriangleMinus(m) contains the triangle number of the minus triangle of edge m; EdgeLength(m) length of edge m; EdgeIndicator(m) not used; Area(n) area of triangle n; Center(1:3, m) coordinates of the center of triangle n. 2. rwg2.m renes the mesh further renes the mesh so that surface integration of the triangles can be efciently carried out. Additional variables are dened and saved in mesh2.mat, but only two are of immediate interest: RHO Plus(1:3, m) contains the value of c+ ; m RHO Minus(1:3, m) contains the value of c . m 3. rwg3.m carries out the actual impedance matrix calculations. This le is the only one that needs to be modied so that the frequency of operation f can be specied. The output of this stage is saved into impedance.mat which contains the following variables: f, omega refer to the frequency associated with the impedance matrix; mu the permeability of the the surrounding medium; epsilon the permittivity of the the surrounding medium; c the speed of light in the surrounding medium; eta the intrinsic impedance of the surrounding medium; Z an M M impedance matrix, where M is the number of edge elements.

4. rwg4.m conducts the solution of the system of equations. This rst requires that a voltage vector be dened in accordance with the type of excitation used. Hence, this le can be modied extensively to suit different types of excitations. The system of equations is solved using: >> I = Z \ V. Note that the use of \ is far more efcient for solving a system of equations rather than using inv() which should only be used if the matrix inverse itself is needed for something. The coefcients can then be used to expand the surface current density at any position r according to ln + + M 2A+ n r in Tn n ln J= Im f m , f m (r) = (1) r in Tn 2An n m=1 0 elsewhere which is evaluated at the triangle centres in rwg4.m and stored in the variable J. At this point, it is up to you to take the surface current density and do something useful with it. Further post-processing can be done with other, custom scripts.

Requirements
To use this code, you will need access to a computer with: 1. A copy of MATLAB. No special toolboxes are needed, and even the Student Edition will do. 2. A copy of Gmsh, available at the website listed in [2]. Executables for a variety of platforms are supported. 3. The Python scripting language, in order to run rwgmeshmat.py. Python is available from www.python.org. The Python and MATLAB scripts can be downloaded from the course website.

Tutorial
The following tutorial shows how a driven wire dipole can be easily implemented in Gmsh. We will analyze a 150 mm wire dipole at 100 MHz, which makes the dipole short (/20). The radius of the wire is 0.5 mm. Geometry Input It makes use of the fact that PEC wires can be effectively be modeled as PEC strips, which are readily implemented and meshed. This relation is discussed in Section 9.4.5. From Table 9.3, the relationship between an innitely thin PEC strip of width w effectively models a PEC wire of radius ae = 0.25w. Hence, a 2 mm strip width will be used in the analysis. The geometry can be input into Gmsh two ways. First, it can be done interactively through Gmshs graphical user interface; refer to the screencast on the Gmsh web page [2] for details on this. However, the preferred technique is to use Gmshs geometry modelling language to describe the antenna geometry. This is done by using a text editor to create a .geo le. A suitable example is shown below: lc = 2.5e-3; w = 2e-3; l = 150e-3; Point(1) = {-w/2, 0, -l/2, lc}; Point(2) = {-w/2, 0, 0, lc}; Point(3) = {-w/2, 0, l/2, lc}; Point(4) = {w/2, 0, -l/2, lc}; Point(5) = {w/2, 0, 0, lc}; Point(6) = {w/2, 0, l/2, lc}; Line(1) = {1, 2};

Line(2) = {2, 3}; Line(3) = {3, 6}; Line(4) = {6, 5}; Line(5) = {5, 4}; Line(6) = {4, 1}; Line Loop(7) = {1, 2, 3, 4, 5, 6}; Plane Surface(8) = {7}; Notice the simple language used to construct the geometry. One of the most useful aspects of the language is the ability to parameterize geometrical quantities. In this example, the dipoles length and width have been parameterized using the variables l and w, allowing you to change the dipole dimensions very quickly. This is more exible than than hard-coding the length and width of the dipole which occurs if you dened the dipole in the graphical interface. Refer to the Gmsh reference manual for more information on the geometry language. Another important point is that the characteristic length, which is the last argument to the Point, denes the mesh size. Here, lc = 2.5 mm was chosen so that a) the width of the mesh is no smaller than the width of the strip, which simplies excitation of the dipole in that a delta-gap source can be inserted between two triangles, and b) a reasonable number of triangles is produced along the length of the dipole for accuracy. Often, you may need to experiment with the characteristic length of points in your mesh to yield the desired grid you want. Also, the characteristic lengths for all the points in this example is the same, but in general can be different to rene the grid in certain regions. Refer to the Gmsh reference manual for more information on the geometry language and how the characteristic length affects the mesh generation. Notice that instead of using 4 points to dene the strip, 6 points have been used with an extra pair of points at the centre of the dipole. This is to enforce the generation of an edge at the centre of the dipole, as mesh vertices must always coincide with Points dened in the geometry. The resulting geometry can be viewed in Gmsh by loading the .geo le into the program. It is best of the dipole is viewed from the y-direction, which can be accomplished by clicking the Y button in the bottom left corner of the window, and zooming in to the dipole using the mouse wheel. Meshing The dipole can be meshed by accessing the Mesh module from the pull-down menu, and selecting 2D. A triangular mesh should appear. You can have a look at the node numbers that have been assigned to the mesh by choosing the Options item from the Tools Menu, and selecting Mesh. By toggling the Node labels checkbox, node numbers will appear in the window (which are easily viewed if you zoom in really close). Similarly, triangle numbers can be viewed by toggling the Surface labels checkbox. Both sets of numbers are relevant because they are loaded as the variables p and t in MATLAB later, and knowledge of these numbers allows you to locate specic elements in the mesh which is needed, for example, to locate the excitation port of the antenna. With the mesh created, you can save the mesh by choosing Save mesh from the File menu. By

default, the mesh le name has the same prex is your .geo lename, except has the .msh extension. Next, the mesh le must be processed so that it can be easily loaded into MATLAB. This is done by invoking the rwgmatmesh.py script at the command line. For example, on a UNIX system, from a shell, $ python rwgmatmesh.py shortdipole.msh shortdipole.txt Using mesh file shortdipole.msh Number of nodes: 176 Number of elements: 356 Number of lines: 118 Number of triangles: 232 Mesh data written to shortdipole.txt shortdipole.msh and shortdipole.txt should be replaced with suitable lenames. MoM Analysis Next, start up MATLAB. Modify the rwg1.m le so that it loads the proper mesh for the short dipole, by looking for the line that calls the helper function loadgmsh. Next, edit rwg3.m and edit the frequency variable to be 100 MHz. You may now form the impedance matrix by calling rwg1.m, rwg2.m, and rwg3.m in sequence: >> rwg1 EdgesTotal = 289 Elapsed time is 0.410901 seconds. >> rwg2 >> rwg3 counter = 578 Elapsed time is 0.204372 seconds. We now have an impedance matrix stored in the variable Z, which is valid for analysis at 100 MHz. Lets consider a delta-gap excitation at the centre of the dipole. To locate the centre, take a close look at the mesh near the centre of the dipole in Gmsh. To identify the edge where we wish to

insert the delta-gap E-eld, we identify it according to the two nodes dening the edge. Enable the display of mesh node numbers by selecting Tools Options from the menu bar. Select Mesh in the left hand side of the dialog box that opens, and then select the Visibility Tab. Click the Node labels checkbox, which should display all the node numbers in the mesh in the main window. You can then zoom into the center portion of the dipole (using the mouse-wheel to zoom) and get an window similar to that shown in Figure 2.
96 29 139 95 30 136 94 31 134 93 32 130 92 33 125 91 34 121 6 5 122 90 35 126 89 36 129 88 37 133 87 38 135 86 39 140 85 40 144 84 Y X Z

Figure 2: Mesh view Take note of the two point numbers on either side of the edge dividing the two halves of the dipole: this is where a delta-gap source will be introduced. From Figure 2, the node numbers are 5 and 6. Note there is not always a correlation between the Point number you specied in the .geo le, and the mesh node number that is generated by Gmsh. The script rwg4.m establishes the electric eld as 1 V/m at that point, and zero everywhere, according to the denition of a voltage vector for RWG elements. The two points dening the excitation edge are coded in the srcidx variable in the script, which you may need to modify. Note that you need to search for both [5 6] and [6 5] since edges could be encoded either way by Gmsh. The current coefcients are then readily found by solving the system of equations. The surface current density J is also computed at the centres of the triangles in the mesh according to (1), and stored in variable J. Take note of this, since J is the output of the MoM simulator, and is used (by you) to derive all other characteristics of the antenna. J(:, n) is a 3-element vector corresponding to the x-, y-, and z-components of current density at the centre of triangle n. rwg4.m also calculates the input impedance and feed power by determining the voltage and current associated with the excitation edge: >> rwg4

srcidx = 273 Elapsed time is 0.012005 seconds. Impedance = 4.0244e-01 - 2.8314e+03i

FeedPower = 2.5099e-08 The radiation resistance, or real part, can be readily compared to Rr = 20 2 l
2

= 0.493

(2)

and we see the correlation is very close, considering the current distribution in real life may not necessarily be perfectly triangular. Post-Processing An additional script rwg5.m performs some additional, problem-specic post-processing. After running this script, the magnitude of this surface current density is plotted on top of the mesh in one gure, while a linear plot of |Jz | and |Jx | is shown in the other gure. Jz clearly appears triangular in shape, though the shape is perturbed near the source, and is closer to what is realistically generated compared to the wire dipole current distributions we have assumed up to this point. Note that values of surface currents are only provided at the centres of the triangles, but through an appropriate expansion, can be predicted at any position along the antennas surface. Since the ordering of the points is irregular, plotting quantities as a function of position requires the positions to be sorted rst in order to produce line plots in MATLAB. rwg5.m is just an single example of the type of post-processing that can be conducted once the current coefcients are known. In this course, you will write many of your own scripts to compute useful quantities knowing the expansion coefcients associated with the surface currents.

References
[1] S. Rao, D. Wilton, and A. Glisson, Electromagnetic scattering by surfaces of arbitrary shape, IEEE Trans. Antennas. Propag., vol. 30, no. 3, pp. 409418, May 1982.

[2] C. Geuzaine. Gmsh: a three-dimensional nite element mesh generator with built-in pre- and post-processing facilities. [Online]. Available: http://www.geuz.org/gmsh/ [3] S. N. Makarov, Antenna and EM Modeling with MATLAB. John Wiley & Sons, 2002.

Você também pode gostar