NEC2Logo
cocoaNEC 2.0 Reference Manual (Section 2)
NC Interpretive Language Interface

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



The NC Interface

NC is a programming language which you can use in cocoaNEC to describe antenna geometries, set physical parameters, request different output options and run optimization loops. The NC language is patterned after the C Programming Language, thus the name (NC stands for "NEC C").

To create a new NC model of an antenna, select New NC Model in the File Menu, cocoaNEC will open a new window for the model, with the title Untitled NC Model-N, where N starts with 1 for the first window that you open in cocoaNEC.

newnc

If you select Save in the File Menu while an NC window is still untitled, cocoaNEC will use the same mechanism as a Save As... .

Save As... presents you with a Save File dialog for you to select the folder and file name to save the model to. The model is saved as a plain text file. The default extension for a NC file file is '.nc'.

If the NC window has previously been saved, or you have opened the window from an existing .nc file by using the Open NC Model item in the File Menu, Save will update the NC file without prompting with a dialog.

Your program is entered as text into the NC Source panel of the window.

The Output Console panel is where all printf statements from your NC program send their output to.

The Listing panel is where all syntax errors of your programs are logged to. If NC finds a syntax error when you press the Run button (Command G), it will automatically switch the window to the Listing view.

If your NC programs runs successfully, the NEC-2 card dec will be sent to the NEC-2 engine. If NEC-2 finds an error (for example wires that are too close to ground), it may not succeed in creating an output and nothing (including the Card Deck) will show up in the Output window. However, the deck that is generated will appear in the Card Deck panel of the NC window and you might be able to discover the cause of the problem.

There is a normally hidden Stop button next to the Run button in the NC window.
stop

This button appears while the NC program is running and is hidden again when the NC program has finished executing. The Stop button allows you to quit from a repeat or while loop.