NEC2Logo
cocoaNEC 2.0 Manuals

Kok Chen, W7AY [w7ay (at) arrl.net]
Last edited: June 4, 2009




Introduction

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. Please write to me if you'd like a copy of the Xcode project and sources. cocoaNEC 2.0 sources do not contain any GPL code.

The application 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.


User Interfaces

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 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.


What cocoaNEC does

cocoaNEC turns an antenna description into a "card deck" that is passed on to the NEC-2 engine that runs inside cocoaNEC. The card decks are images of the Hollerith cards which the NEC-2 engine uses as input.

After NEC-2 has finished processing the input card deck, cocoaNEC distills the line-printer output from the NEC-2 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":

ncinput

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


necoutput


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

spreadsheetandvars

and your output will look like this:


swr

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


ncexample



Files

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 only contains a list of the antenna models that were most recently used by cocoaNEC (this allows the Open Recent... menu items to find the files).

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.)


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 using the f2c program. The old cocoaNEC had used an interpreter (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. However, it may be easier for casual usage.

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.

For use in cocoaNEC 2.0, I have modified the standalone nec2c.rxq program into a Mac OS X static library. This library includes duplicate copies for double and quad precision computation. cocoaNEC allows the user to switch the precision from one modeling run to another.


Acknowledgments

cocoaNEC 2.0 uses the public domain nec2c.rxq code as its 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. Thanks to Bill, K1GQ for prodding me to add some advanced features, and also for tracking down a re-entrancy problem when the Sommerfeld ground model is used in the nec2c core. 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)