Antenna Modeling with 4NEC2 and NEC 5

Discussion in 'Antennas, Feedlines, Towers & Rotors' started by AK4R, Jan 22, 2021.

ad: L-HROutlet
ad: l-rl
ad: Subscribe
ad: abrind-2
ad: QSOToday-1
ad: L-MFJ
ad: Left-3
ad: Left-2
  1. AK4R

    AK4R Ham Member QRZ Page

    Does anyone know if 4NEC2 can use NEC5?
  2. W9XMT

    W9XMT Ham Member QRZ Page

    4nec2 cannot do that at this point in time, and there is some doubt as to if it ever will be re-written to do so.

    However NEC5 is supplied with its own graphical interface app to/for the NEC5 engine; intended to replace the ones presently in 4nec2 and EZNEC.
    AK4R likes this.
  3. AK4R

    AK4R Ham Member QRZ Page


    Thank you so much for your quick response. Then I figure I could eventually flail around until I could actually midel something. I’m gonna go for it!


    Steve, AK4R
  4. W9XMT

    W9XMT Ham Member QRZ Page

    That was my reaction, too, and I bought/installed NEC5 here when first available.

    I'm still flailing with the GUI for NEC5, and so far continue mostly to use 4nec2 configured with the NEC4.2 engine that I have been using for quite a few years now.
    AK4R and EA1DDO like this.
  5. WA7ARK

    WA7ARK Ham Member QRZ Page

    NEC 5.0 is a real PITA to use compared to AutoEz/EzNec6+
    I am looking to obtain some running NEC5 model examples.
    AK4R likes this.
  6. AK4R

    AK4R Ham Member QRZ Page

    Would sure like to know how that turns out...
  7. WA7ARK

    WA7ARK Ham Member QRZ Page

    I have created some running, simple NEC5 models. I will post one later today with some questions about how to interpret the results, and how to overlay model the results of two simulation runs.
    AK4R likes this.
  8. AC6LA

    AC6LA Ham Member QRZ Page

    This thread from several months ago might be of interest. Although not mentioned explicitly, it is possible to use the OUT_to_PF3 workbook mentioned in that thread along with the XLGTa workbook (see here) to show NEC5 pattern data using the 4nec2 pattern viewer windows.

    Both workbooks require Microsoft Excel (Office) with macros enabled. They cannot be used with Open Office or Office Libre.

    Example of showing NEC5 pattern data with 4nec2:


    Example of showing NEC5 pattern data with EZNEC:


    Also, for those folks who have EZNEC Pro/4 v5 or v6, it is possible to use EZNEC Options > Calculating Engine > External NEC-4 to run the NEC-5 engine and have EZNEC read the NEC-5 output file. Contact me directly for details.

    Dan, AC6LA
    Last edited: Jan 22, 2021
    AK4R likes this.
  9. WA7ARK

    WA7ARK Ham Member QRZ Page

    Even before we get to the workbook, I want to understand the intrinsic operation of NEC5. To that end, I have created a baseline model in EzNec using the NEC2d engine, which is just a center-fed, 20m long wire Copper wire dipole, elevated 10m above 5mS/13 earth. Please correct anything you find wrong in the following statements.

    Here is the NEC2/4 wire description:

    In NEC2/4, it is ok to use a single wire and an odd number of wire segments and to put a source in the center segment. OTOH, NEC5 requires that a source be placed at either end of a specified wire segment, so to build a center-fed dipole, that requires creating a model containing two equal-length, co-linear wires butted end-to-end, with the source placed where the wires join. I will use 15 segments in each of the NEC5 wires.

    I begin building the model description of the model file as follows:

    CE WA7ARK's 40m Dipole
    GW 1 15  0 -10  10  0  0 10  0.00055
    GW 2 15  0   0  10  0 10 10  0.00055
    GE 1
    The CE line is just a comment line.

    The GW lines define the two wires required by NEC5. The first parameter on the GW line is just a "tag" that we can refer to later. The second parameter is the number of segments in the wire. The next six parameters are the wire end coordinates (in m) that match one-for-one the EzNec table. The last parameter is the wire radius in m. (note that EzNec uses wire diameter in mm, so conversion to radius and m is required).

    The GE line marks the end of the "geometry" part of the model. Defining sources, ground models and other aspects of the simulation follow the GE line. The first parameter = 1 says that a "ground plane" is present.

    I ran the model in AutoEz to find that the resonant frequency of the "WA7ARK's 40m Dipole" antenna (where jX=0) is 7.229MHz and that the R=82.33 when over "average" earth. The goal is to see what NEC5 says:

    To create a runable .nec file, it is necessary to add more lines (Program Control Commands) to specify source type and placement, the ground type, the frequency(s). I am not experienced doing this, so please feel free to improve what I show...

    I am trying to run the simulation over "average" 0.005,13 earth. Here is my "Ground parameters" GN line:
    GN 0  0  0  0  13  0.005  1  0
    Please comment...

    The source specification should be equivalent to this NEC2/4 1A source:

    I am trying to placing a 1.0A@0deg current-source at end1 of segment1 of wire2. Here is my "Structure Excitation" EX line:
    EX 4  2  1  1  1.0  0.0
    I want to run the simulation at 7.237MHz. Here is my "Set Frequencies" FR line:
    FR 0  1  0  0  7.237
    I want to see a "Radiation Pattern" equivalent to the dBi patterns that EzNec produces. I am having trouble with this...
    In a naive attempt to do that, I created the following RP line:
    RP 0 46 181 1511, 0. 0. 2. 2.
    To be complete, the .nec file also needs an XQ line and an EN line. I am puzzled if the parameter on the XQ line is needed, or not?

    So here is the total file:
    CE WA7ARK's 40m Dipole Jan 22, 2021
    CM blank lines are not allowed in this file.
    CM The following GW lines create the two abutted 15 segment wires,
    CM tagged 1 & 2 respectively. The wire radius is 0.00055m.
    GW 1 15  0 -10  10 0  0 10  0.00055
    GW 2 15  0   0  10 0 10 10  0.00055
    CM The following GE line is the end of the "Structure Geometry Input" block.
    GE 1  0
    CM The following lines begin the "Program Control Commands"
    CM The following GN line specifies that the ground plane is Average dirt
    CM  (0.005mS, Dielect=13).
    GN 0  0  0  0  13  0.005  1  0
    CM Wire2, end1 of segment1 is driven with a 1A@0deg Current Source.
    EX 4  2  1  1  1.0  0.0
    CM The analysis frequency is 7.237MHz
    FR 0  1  0  0  7.237
    CM The wires tagged 1&2 have conduction loss equivalent to Copper wire.
    CM EzNec Copper loss is 1.74e-8 Ohm-m. That converts to 57.5e6 mho/m?
    LD 5  1  0   0  57.5E6
    LD 5  2  0   0  57.5E6
    CM Compute the far field radiation in 2degree patches both in elevation
    CM  (phi) and azimuth (theta)
    RP 0 46 181 1511, 0. 0. 2. 2.
    CM "Execute" and "End"
    Frankly, I found it easier to create my file using NOTEPAD.exe; not NEC5GI.exe. To do the simulation run, I run NEC5X64.exe in the "non-interactive" mode. That reads the file, and produces the WA7ARK40mDipole.out file.

    Next, I run NEC5GI.exe to read WA7ARK40mDipole.out. Initially, that produces the following view:

    The colors along the dipole show the current magnitude in that part of the wire. The source is at the center of the wire. That is similar to this produced by EzNec:

    The feedpoint impedance appears in the WA7ARK40mDipole.out file:
    I do not understand why NEC5 put the source at end 2 of seg no 16? I would have expected it to be at end 1?
    I also do not understand the Power (41 Watts) column, above? It should show about 82 Watts?

    The NEC2d version has different numbers, but the Z computed both ways is quite close.

    In NEC5GI, if you click on File/ReadNext menu item, the headings change, making it possible to make 2d and 3d plots. Here is the NEC5 3d plot:
    Compared that to the EzNec plot:

    I better save this posting, and then continue in a subsequent post.

    Attached Files:

    AK4R likes this.
  10. WA7ARK

    WA7ARK Ham Member QRZ Page

    ...continuing post # 9...

    I may have reversed the definition of phi and theta???

    Next, let us look at the current magnitude and phase calculated by NEC5 and EzNec. This comes right out of the .out file:
    Again, it shows the questionable "INPUT POWER"? It also shows the way that the two wires, tagged 1 & 2 in my model, with 15 segments each are identified. I confirmed that the source is in fact where wire2 begins (at the beginning of segment 16). After seeing this, it occurred to me that I could just as well created a single wire tagged 1 with 30 segments, and placed the source on seg 16.

    Here is a tabulation the currents in the 31segments in the EzNec model:

    Allowing for the difference in algorithms and 30 vs 31 segs, these look similar to those computed by NEC5.

    Going back to the 2D plots accessible through NECGI, this is where I need some help in the comparisons. This time, I will show the EzNec results first, computed ever 2degrees. Here is a vertical slice through the 3D plot at an azimuth of 46 degrees. I show the Total, Horizontal and Vertical fields:

    Here is the comparable 2D plot from NEC5, obtained by selecting 46 degrees from this "Theta Cut" dialog box that pops up when you select "2D Pat Plot/Plot vs Theta" from the NEC5GI banner.

    Here is the plot produced by selecting a phi of 46 degrees (Remember that I chose 2degree patches in the RP command).

    There seems to be no way to show the "Total field" in NEC5; only the "V pol" and "H pol". NEC5 only shows the first quadrant. Asking to see 134 degrees produces exactly the same plot but that would look different if the it wasn't a dipole that has symmetrical patterns on either side of the wire. Is there a way to get the total picture in one pass?

    The big mystery to me, is how is this plot scaled??? What does -16dB mean (at the top)??? I understand the plots relative to dBi produced by EzNec, but what is NEC5 telling us? Is there some better way to specify parameters in the RP command to get the more familiar values?

    After getting this far up the learning curve, now maybe the stuff that Dan posted in that earlier thread will make sense...

    One more 2D plot to show. I am used to plotting the EzNec azimuth patterns of antennas at an elevation of ~20degrees, which is the angle that most of the stations I work seem to come from... Here is that plot from EzNec:

    Here is the comparable one from NEC5. To get it, chose "2D Pat Plot/Plot vs Phi" from the NEC5GI banner, and use 70.0 degrees as the "Enter thet value for plot vs phi":

    That produces the following plot:

    Note that resulting plot is rotated 90degrees relative to the EzNec one, and that thetas (elevations) are backwards relative to how EzNec does it (NEC5 thinks that 0 degrees is straight up, and along the ground is 90 deg while EzNec is just reversed.

    Can this get more confusing????

    In case you want to play, here is a .zip containing the WA7ARK40mDipole models and the .out file

    Attached Files:

    Last edited: Jan 23, 2021

Share This Page