Designing antennas for 4NEC2 modelling

Part #8 of the "Roger Writes" series - November 2023

This page explains the steps to design a simple antenna, in NEC2 format (using variables, so for 4NEC2). See 4NEC2 antenna models for lots of examples (aka starting points)

A brief history of mathematical antenna modelling

Note: MiniNEC is an independent package based on the concepts of NEC. The source code for improved versions has been released, MiniNEC2 (1984) and MiniNEC3 (1986).

Modelling packages

These are essentially graphical wrappers around the NEC (Or MiniNEC) engines. Generally they allow: The most widely used packages for Windows are:

Main limitations of antenna modelling

These are the main limitations of the NEC engines, (similar for most antenna modelling): The good news: Many errors are really warnings, and often the result is "close enough" as a starting point when making an antenna.

Basic design / NEC file commands

The core algorithms only model straight line segments, although helix, arcs, and wires can be entered, they get split into straight segments. (Note: By default the dimensions are in meters.)
Here are a few basic commands:
CommandDescription
CMFull line comment
CEEnd of initial comment block
SYVariables definition (4nec2 only)
GWWire Specification
GEEnd of Geometry Input
GNGround parameters
GSScale Structure Dimensions (if you really want to use feet instead of meters add a "GS 0.3048" to your file)
EXExcitation - usually via one of the defined wire segments
FRFrequency - frequency for calculations and plots
ENEnd of input
'Adds comments to the end of a line.


In the NEC file format, wires are defined one at a time, with a GW line:
GW {ID} {SEGS} {X1} {Y1} {Z1} {X2} {Y2} {Z2} {RAD}
{ID}
Wire identifier/tag (integer, 0=special case)
{SEGS}
Number of segments to split this wire into (integer)
{X1} {Y1} {Z1}
Start point of the wire in 3D space
{X2} {Y2} {Z2}
End point of the wire in 3D space
{RAD}
Radius of the wire
Examples:
GW 99 1  -0.04 0 8  0.04 0 8  0.0005
GW = Wire
Tag 99
With 1 segment
From (-0.04,0.0,8.0)
To (0.04,0.0,8.0)
Radius of 0.0005 = 1mm diameter
Description: A small wire 8m up, and 4cm either side of the centre point
GW 10 45  -0.04 0 8  -9.72 0 5  0.0005
GW = Wire
Tag 10
With 45 segments
From (-0.04,0.0,8.0)
To (-9.72,0.0,5.0)
Radius of 0.0005 = 1mm diameter
Description: A long diagonal wire starting from the left side of tag 99, at 8 meters up, ending nearly 10meters away, 5 meters up
GW 11 45  0.04 0 8  9.72 0 5  0.0005
GW = Wire
Tag 11
With 45 segments
From (0.04,0.0,8.0)
To (9.72,0.0,5.0)
Radius of 0.0005 = 1mm diameter
Description: A long diagonal wire starting from the right side of tag 99, at 8 meters up, ending nearly 10meters away, 5 meters up
If we plot these out we get a very recognisable shape:

Example

Why variables

While we can sketch out an antenna, and work out where the 3D coordinates should be by hand (or spreadsheet). Every time something changes, we have to do the calculations over (and over) again. Allowing variables is a major advantage of 4NEC2 over the EZNEC and MMANA packages.
Using variables, and the built in calculations, allows a bunch of input parameters to define the whole antenna, then uses the computer to do the calculations!
If you really want the pretty graphics and other features of the other package, then from 4NEC2 you can select Calculate|NEC Output-data|Use original file, and take the 4nec2\out\{whatever}.inp file, then import this raw nec2 file into EZNEC and MMANA, and display it from there.

Start of file

Let's start our parametrised inverted V design, with something about the antenna:
CommandComment
CMClassic Inverted V for 40m, taller centre pole shorter outer poles
CMExample by Roger Walker, GW6HRU
CE

Defines/Calculations

Now define some values, and do some calculations:
CommandVariableValue/CalcComment
CM These are the input values
SYfreq =7.100'Frequency (in MHz) - Usually easier to work with than wavelength
SYmidheight =8.0'Midpoint height (in meters)
SYendheight =5.0'End height (in meters)
SYfeedwidth =0.08'Feed point width (in meters)
SYradius =0.0005'Wire radius (in meters)
SYfactor =0.98'Velocity and ground proximity factor, start with 98%
CM These are the calculated values
SYwavelen =299.792458/freq'Wavelength of freq (in freespace)
SYwirelen =factor*wavelen/4'Length of each wire (a quarter wave, with velocity/ground factor)
SYhalfwidth =sqr(wirelen^2 - (midheight-endheight)^2)'Pythagoras: Diagonal2 = Width2 + Height2
So: Width=√(Diagonal2 - Height2)

Wires

Using these variables in the wire commands we get:
CommandTagNum segsStartEndRadiusComment
GW991-feedwidth/2 0.0 midheight feedwidth/2 0.0 midheight radius'Feed point
GW1045-feedwidth/2 0.0 midheight -halfwidth 0.0 endheight radius'Left diagonal wire
GW1145feedwidth/2 0.0 midheight halfwidth 0.0 endheight radius'Right diagonal wire

Admin commands

Now we add a few extra commands, to create a complete .nec file:
CommandParametersComment
GE1'End of geomentry, 1=Use Real Ground
GN2 0 0 0 4 0.003'Ground parameters, 2=Moderate, 4=dielectric constant, 0.003=Conductivity
EX0 99 1 0 1 0 0'Tag=99, segment=1, Load 0=Voltage source
FR0 0 0 0 7.100 0'Default frequency for modelling=7.100
EN

What can we do with it?

Putting the above lines in a basic .nec file allows us to do some simple analysis in 4NEC2 (start 4NEC2, then File|Open 4nec2 in/out file).
Starting with an SWR frequency sweep of this file (Calculate|NEC output-data|Frequency sweep), we can see that our initial velocity estimate is not so great. For our "perfect" antenna model, we get:



Because we have defined this antenna in terms of variables, we can easily change the them, 4NEC2 will automatically modify the antenna design, and we can re-simulate.
We could guess different velocity factors, homing in on a better value, or we can let the computer do the work. If we ask it to optimise the "factor" variable, giving SWR 100% weighting factor, for 7.1MHz (Calculate|Start Optimiser|Select "factor"|Start), we get:



This finds a factor of 0.9654 (so 96.54%), if we use that, and re-run the SWR sweep, we get:



We can now use these modified values to view a number of parameters, like gain:



Or a Smith chart:


So we now have a better estimate for the design. To find the calculated lengths we can click on the wires in the graphical editor, and it will show the wire lengths. Using them we can go and make something!
If you want to see how close the simulations can be to physical antennas, see my writeup on building a 3-element cubical quad for 2m.


The Roger Writes series

I research / dabble with lots of things, and figured that if I write my notes here, I can quickly reference them, also, sometimes, they are useful to others!
Here is what I have so far:





Homepage.
This page was lasted updated on Tuesday, 28-Nov-2023 14:57:39 GMT

This content comes from a hidden element on this page.

The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.

Click me, it will be preserved!

If you try to open a new Colorbox while it is already open, it will update itself with the new content.

Updating Content Example:
Click here to load new content