SM 5 BSZ - Computer Program For Yagi Optimisation Using Modified NEC2
(May 9 1999)


Optimising Modified NEC program is not particularly user friendly. It is free to use for anyone interested I have devised it for my own use in my hobby, and I find it sufficiently easy to use.


The computer program is available in two sizes here for computers with modest memory sizes. They use 32 bit FORTRAN, and require DOSXMSF.EXE. and need a 386 or better.

OMNEC400.ZIP(vers 1.20 142k) can handle 400 segments and OMNEC800.ZIP(vers 1.20 142k) can handle 800 segments. If you do not have enough ram memory, the programs may use your hard disk, and then the computing speed becomes extremely slow.

For more modern computers, use OMNEC1K2.ZIP(vers 1.20 122k) This version is optimised for Pentium processors and uses more memory (about 30 megabytes). It needs DOS4GW.EXE (zip file) (Type: DOS4GW OMNEC1K2.EXE) It can handle 1200 segments and runs roughly twice as fast on a Pentium processor.

For anyone interested in modifying the optimisation for other patterns than that giving maximum gain or for any other purpuse here is the source code OMNECFOR.ZIP(54k) The fortran code of NEC2 is a bit stripped, and some attempts to make it run faster are implemented. Changes to the original code make only a few % speed improvement. The big difference is the WATCOM compiler producing better instruction sequencing for the Pentium processor and the way the pattern is integrated by use of much more memory compared to the less memory demanding older versions.


To run this program, the following two files are needed (click for examples):

INPUT.NEC A file containing the start geometry in the same format as the input used in NEC2. This test example is a 4x6 element array. Note that the antenna has to be oriented for the main lobe pointing in the direction of the Z axis. The radiation pattern parameters affect the optimisation process.

PARNR.NEC A file supplying the additional information required for the program to know what to optimise. For each wire or wire loop, as well as move line in INPUT.NEC, there has to be a line in PARNR.NEC specifying which numbers to vary in the optimisation process. Some additional lines have to be identical to the corresponding lines in INPUT.NEC. (Which is silly, but was an easy way of programming)

With the example input files, OMNEC will find the maximum gain for a 4x6 element yagi array, and the result is something like 19.6dBi or 17.5dBd. It is possible to change the input files to optimise for different criteria or to keep certain numbers fixed. Boom length or stacking distances are obvious choices.

OMNEC reads INPUT.NEC and PARNR.NEC in parallel. Look at this text file OMNEC.TXT for details on how the input is interpreted.

To analyse the optimised design, run it again. Just copy the output design OUTPUT.NEC to a new INPUT.NEC and set the "RP" parameter nonzero to get the radiation pattern listed in PATTERN.NEC. (The pattern listed is always the pattern of the input design)

You may also use the standard NEC2 to analyse the design. To do that, set the "MO" flag in PARNR.NEC = 0 during optimisation and theoretical evaluation.

If you really intend to build the antenna set the "MO" flag = 1 because the modified version of NEC is more accurate. (at least for a yagi antenna)

To SM 5 BSZ Main Page