Numerical Electromagnetics Code
The Numerical Electromagnetics Code (NEC) is a popular antenna modeling software package for wire and surface antennas. It is credited to Gerald J. Burke and Andrew J. Poggio, and was originally written in FORTRAN in the 1970s. The code was made publicly available for general use and has subsequently been distributed for many computer platforms from mainframes to PCs.
The code traces its history to an earlier program, the Antenna Modeling Program (AMP), written for the Navy in the early 1970s. NEC is an advanced version with more options and features. Both programs originated in the mainframe era. Output is fixed format for printing, and likewise is normally interpreted by modern programs into more useful formats.
How it works
The code is based on the method of moments solution of the electric field integral equation for thin wires and the magnetic field integral equation for closed, conducting surfaces. The algorithm has no theoretical size limit and can be applied to very large arrays or for detailed modeling of very small antenna systems, but the implementation has many practical limits. NEC models can include wires buried in a homogeneous ground, insulated wires and impedance loads.
The algorithm has proven reliable (likely to converge to a solution) and accurate (likely to produce results comparable to measured performance) at modeling 'pipelike' structures like Yagi antennas and radiating towers. The NEC engine provides support for modeling patch antennas as well.
The method of moments algorithm has practical limitations as well—the number of calculations required to model a three-dimensional structure of N radiating elements is roughly proportional to the cube of the number of elements—i.e. modeling an antenna with 100 wire segments requires (100)^3 = 1 million calculations. Increasing the number of elements by a factor of 10 increases the computing time by a factor of 1000, assuming the simulation completes at all. Consequently, there are other approaches such as geometric optics which are preferred for modeling large structures.
Models are defined as elements of wire or similar as an input text file (typically in ASCII). They are then input into the NEC application to generate tabular results. The results can then be input into subsequent 'helper' applications for visual viewing and the generation of other graphical representations as smith charts, etc.
There are at least four versions of NEC, with NEC-2 emerging in 1981 and NEC-4 appearing in 1992.
NEC-2 is the highest version of the code within the public domain without a license.
- NEC-2 does not model tapered elements such as those made of telescoping aluminum.
- NEC-2 does not model buried radials or ground stakes.
MININEC was a version first written in BASIC for home computers. It first emerged in 1982 on the Apple II computer. MININEC computational engines are now written in FORTRAN to improve speed. MININEC is an independent implementation of the method of moments. The basic algorithms are based upon the advice of Professor Wilton at the University of Mississippi (now with the University of Houston).
MININEC suffers from some known flaws compared to NEC, the best known being that resonant frequencies may be slightly in error. However, MININEC handles different wire diameters better than NEC2 and probably NEC4; this includes different diameter parallel wires, different diameter wires joined at an angle, and tapered diameter antenna elements. Placing sources at an intersection of two wires is a problem for NEC2 but not MININEC. MININEC converges more slowly (requires more segments) when wires join at an angle, when wire segments of significantly different length are adjacent, and has a weaker ground model.
NEC in the field
Although antennas can be simple structures, the modeling of these systems does require a certain level of understanding of the electrical characteristics of antennas.
Public domain resources
- nec2++ - an extensive rewrite of NEC-2 in C++ licensed under GPLv2, with a C/C++ interface and python bindings. It can easily be incorporated into automatic optimizers.
- 4nec2 - A free NEC2/NEC4 implementation for Microsoft Windows. It is a tool for designing 2D and 3D antennas and modeling their near-field/far-field radiation patterns.
- L. B. Cebik's Antennas, Service and Education - A great repository of antenna modeling and related information, particularly including the survey Some Antenna Modeling Programs.
- Numerical Electromagnetics Code NEC2 unofficial home page - NEC2 documentation and code examples
- MMANA-GAL basic - A free antenna modeling program based on MININEC.
- Xnec2c - A translation of NEC2 into C, NEC2C, and a GTK2 based GUI, Xnec2c.
- NEC Lab - NEC Lab is a powerful tool that uses Numerical Electromagnetics Code (NEC2) and Artificial Intelligence (AI) to design antennas.
- CocoaNEC - Open source GUI front-end for Apple OS X. Includes NEC2 and supports NEC4 with separate license.
- AN-SOF - Simulation software for modeling wire antennas and scatterers. The free version is AN-SOF100.
- EZnec - A well known commercial-based antenna modeling package based on NEC3 and NEC4.
- NEC4WIN NEC4WIN /VM - A Windows XP, Vista simulation program based on Mininec 3.
- AC6LA antenna utilities - A collection of commercial antenna utilities
- Nec-Win plus - A commercial modeling package.
- GAL-ANA - A commercial antenna modeling package based on NEC2 and MININEC.
- GNEC - A commercial NEC package with a graphical user interface.
- MMANA-GAL PRO - A commercial modeling package, up to 45000 segments.