cocoaNEC 2.0 Manuals

Kok Chen, W7AY [w7ay (at) arrl (dot) net]
Last edited: January 10, 2012


cocoaNEC 2.0 is a Mac OS X application intended primarily for the design and modeling of antennas. cocoaNEC uses the Mac OS X Cocoa framework and is a Universal Binary application.

Both the cocoaNEC 2.0 application and the Xcode project and sources are free.

Both the application and the Xcode sources can be downloaded by visiting the main cocoaNEC page (the cocoaNEC tab button at the top of this page). Or go directly to here.

cocoaNEC uses NEC-2 as the compute engine. It is highly recommended that you have a copy of the NEC-2 reference documentation nearby. The reference can be found both in html and pdf formats.

cocoaNEC can also use NEC-4. The NEC-4 reference documentation comes in the same distribution CD-ROM that contains the NEC-4 sources.

Antenna Models

cocoaNEC provides two separate input methods for describing an antenna model. One uses a tabular ("spreadsheet") input method and the other uses a programming language.

You can also import from and export to NEC-2 "card decks." In addition, you can directly import output from nec2c and NEC-4 to display in cocoaNEC's graphical back end. cocoaNEC can also directly use a non-embedded copy of NEC-4, but because of licensing requirements, you will need to compile NEC-4 yourself (instructions are here).

The Spreadsheet tab button at the top of this page takes you to the tutorial on the tabular method and the NC tab button takes you to the tutorial on the programming method. These tutorials provide quick introductions.

For details, please refer to the Reference Manuals. The Ref. Manual tab button at the top of this page takes you to the reference pages for functionality that is common to both of the two input interfaces. The part of the reference manual that is specific to the spreadsheet interface can be found in Ref. Manual II. The part of the reference manual that is specific to the NC language can be found in in Ref. Manual III.

If you are fluent with computer programming, you might find the programming method to be both a more natural way to describe an antenna and a faster way to generate the models. The "programming" method also permits you to write automatic optimizers, whereas you'd have to manually manipulate the input data when using the "spreadsheet" method.

System Requirements

cocoaNEC 2.0 works with either Intel or PowerPC based Macintosh computers that run Mac OS X 10.4 (Tiger) or newer. The Snow Leopard version of cocoaNEC 2.0 requires Mac OS X 10.6 (Snow Leopard) or Mac OS X 10.7 (Lion) to run on.

What cocoaNEC does

cocoaNEC turns an antenna description into a "card deck" that is passed on to the NEC engine. A card deck contains text images of the Hollerith cards which the NEC engine uses as input.

After NEC-2 or NEC-4 finishes processing the input card deck, cocoaNEC distills the line-printer output from the NEC program and presents the data in forms that are easier to visualize.

The following shows a few "cards" from a typical NEC-2 input card "deck":


and the following shows a few lines from a typical NEC-2 output file:


With the cocoaNEC 2.0 spreadsheet interface, instead of describing the antenna using a "card deck," your input will instead look something like this:


and your output will look like this:


In the case of the cocoaNEC programming language, the NC "program" which produces the same antenna model would look like this:



When you install cocoaNEC 2.0, the application will be placed in the /Applications folder. No other files are copied to your hard drive.

After you run cocoaNEC, a file named w7ay.cocoaNEC 2.0.plist will appear in your home directory's Library/Preferences folder. Currently, the plist file contains lists of the antenna models that were most recently used by cocoaNEC (this allows the Open Recent... menu items to find the files). The plist file also contains user preferences that are set from the Output Window.

When you run the antenna models, temporary files are created in the /tmp directory. The temporary files used for NEC-2 input are called necinputNN.dat and the output from the NEC-2 engine is written to files that are called necoutputNN.txt. If you need to see what they look like, just use the Unix terminal in Mac OS X and connect to the /tmp directory. The NN are sequence numbers starting at 1 for each time that you launch cocoaNEC.

You can download some example files that might be helpful. (Use the Example tab buttons above.)

Development History

Not finding a native antenna design program for MacOS X, I had started the original cocoaNEC (1.0) project back in 2002 as a Cocoa GUI around the NEC-2 program. The FORTRAN code for NEC-2 was originally translated automatically into C with the f2c program. The old cocoaNEC had used an interpreter (an earlier version of NC) as the sole means of describing antenna geometry.

cocoaNEC 2.0 is a major rewrite of the original application. In addition to extending the NC interpreter, I have added a spreadsheet-like interface for entering antenna models. Even though it supports variables and mathematical functions, the spreadsheet interface is still much less powerful than the NC interface, and the use of the spreadsheet interface in cocoaNEC is discouraged. However, the spreadsheet interface may be easier than the NC interface for a non-technical user to learn. cocoaNEC 2.0 was started in August 2007

Instead of the original NEC-2 engine, this newer cocoaNEC 2.0 uses a compute engine that has since been made available, called nec2c.

nec2c was manually translated from FORTRAN into C by Neoklis Kyriazis, 5B4AZ (see below) and the code runs substantially faster than the machine translation of NEC-2 by f2c. cocoaNEC 2.0 uses the nec2c.rxq variant of nec2c.

cocoaNEC 2.0 can also use the NEC-4 engine.


cocoaNEC 2.0 uses the public domain nec2c.rxq code as its embedded compute engine.

nec2c.rxq is the work of Jeroen Vreeken, PE1RXQ, and it is based on the earlier nec2c program by Neoklis Kyriazis, 5B4AZ.

nec2c was translated from the original NEC-2 program that was developed by Jerry Burke and A. J. Poggio of the Lawrence Livermore Labs.

NEC-2, nec2c and nec2c.rxq are all free for anyone to use. cocoaNEC would not have been possible without the generous contributions of the above people.

My grateful thanks to the alpha testers who I have discussed the program with, and who have fed back bug reports and documentation errors: Doug K4DSP, Duffey KK6MC/5, Steve WB6RSE and especially Russ AA7QU, without whom this manual would have been much more difficult to read. Bill, K1GQ prodded me to add important features, and also helped with tracking down a re-entrancy problem in the Sommerfeld ground model of nec2c. Bill further collaborated with me to get NEC-4 working on cocoaNEC.

All remaining bugs in the program, and errors in the documentation remain my fault, of course.

Next :Spreadsheet Tutorial

Next: Programming Language (NC) Tutorial

Back to: cocoaNEC (downloads, etc)