Kok Chen, W7AY [w7ay (at) arrl (dot) net]
Last updated: November 18, 2012
What has changed in v0.84?
(November 18, 2012)
A division-by-zero limit check in the implementation of lumpedSeriesTermination caused an error when the resistive component of the RLC is less than 1 ohm.
What has changed in v0.83?
(November 11, 2012)
In addition to the existing impedanceTermination that was implemented in v0.81, lumpedSeriesTermination and lumpedParallelTermination are now added to NC . This allows series RLC and parallel RLC networks to be inserted in a wire segment to shunt an excitation or transmission line instead of in series with the excitation or transmission line. See documentation on terminations in the User's Manual.
What has changed in v0.82?
(October 18, 2012)
- When evaluating arithmetic operators (add, subtract,
multiply, divide) between two integers, a floating point
representation was being returned internal to the NC
interpreter. As a result, an array whose index that is in
the form of an integer expression, e.g., a[i+1], was
causing cocoaNEC to crash.
This is now fixed in v0.82.
Many thanks to Steve K9AN for alerting me of the array index problem.
- The cocoaNEC app is now signed with my Apple
developer ID. You should no longer need to keep Mountain
Lion's Gatekeeper completely open.
It is now sufficient to instruct the Security and Privacy preference panel in Mountain Lion to allow "identified developers" instead of having to allow applications from "anywhere."
- When importing directly from a NEC card deck, an ill
formed RP (radiation pattern) card can cause cocoaNEC to
crash. There is now a sanity check in the card deck
import to catch bad RP cards.
What has changed in v0.81?
(June 18, 2012)
The NEC TL card only models an ideal lossless transmission line. cocoaNEC now lets you use more realistic coax and twin-lead models by modeling a transmission line with the admittance matrix of a NEC NT (network) card. For modeling common mode current, the shield of a coax cable can also be included.
For convenience, many types of coax and twin-lead lines are built-in, e.g., RG-8, RG-174, LMR-200, Wireman 551, etc.
The NEC LD card that is generated by the NC impedanceLoad function places an impedance in series with voltage sources (EX) and transmission line (TL) and network (NT) cards that are placed in the same wire segment. cocoaNEC now adds an extension (impedanceTermination) to NEC that places an impedance in parallel with the other objects.
A plot of the current distribution on a wire is now generated when you control click on a wire in the Geometry View.
- Text Views (including the NC Source in the NC window
and NEC2 Output in the Output Window) are now searchable
(command-F and Find Menu in the Edit menu of the Menu
You can now chose to draw distributed loads by selecting the checkbox in the Output Window's drawer.
- Each time a model is executed from a control function
by using runModel, the result from a previous run in the
Smith Chart and Scalar Plot outputs are replaced by new
data. NC now includes a new function keepDataBetweenModelRuns, which
plots new feed points without erasing the previous
feed points. Sample code "OCF sweep.nc" is added to
the Examples folder that plots a sequence
of feed point impedances of an off-center fed dipole
when the feed point is moved.
- Some cocoaNEC features such as current sources
require the generation of auxiliary wires in the far
field. The prior implementation did not allow 2 different
current sources to be located on the same segment of a
wire, since their auxiliary wires would touch. This
limitation no longer exists. cocoaNEC now allows multiple
current sources (and the new impedanceTermination loads)
to be located on the same wire segment.
- frequencySweep now generates extra NT cards when the
NT parameters are frequency dependent. This is needed for
the new coax function.
- Fixed a bug in the NC line() function.
- Fixed a bug with local variables that causes certain
function recursions to fail.
- Fixed a bug where NEC-4.2 (GN3) was calling the nec2c
context in the Output window. Thanks the Bill K1GQ for
noticing the bug and reporting it. NEC-4.2 with GN3
should work properly now.
What has changed in v0.77, v0.78, v0.79 and v0.80?
(May 27, 2012)
(Note: v0.77 was only distributed as an Xcode project on April 22, 2012. The v0.78 release (May 25) incorporates the v0.77 changes, together with new developments. v0.79 (May 26) includes a bug fix involving data interpolation, and v0.80 allows you to choose to use the GN2 instead of the GN3 Sommerfeld ground model with NEC-4.2.)
cocoaNEC now supports NEC-4.2.
The cocoaNEC preference now allows you to specify which version of NEC-4 to use. Unless you check the "Use GN2" checkbox, cocoaNEC uses the new GN3 ground model in NEC-4.2 when you ask for the Sommerfeld ground approximation.
When NEC-4.1 is selected, cocoaNEC uses the nec4d Unix executable in the Applications folder as before. When NEC-4.2 is selected, cocoaNEC looks for a nec4d42 executable in the Applications folder.
See the following two web pages for details on using NEC-4.2 in cocoaNEC and how to compile NEC-4.2 for Mac OS X.
- This release of cocoaNEC incorporates the nec2c
(v0.4) bug fix that cured the segmentation fault error
when a single segment wire is fed by an excitation or
loaded by a LD card. When using NEC-2, cocoaNEC used to
convert all single segment wires to at least 3 segments.
It no longer needs to do that.
That being said, single segment wires are not recommended with NEC. This can be confirmed by inspecting the Average Gain in the Summary View.
- Wires that are much shorter than a wavelength were
drawn with poor accuracy in the Geometry view of the
Output Window. This is due to the fact that the Geometry
view had obtained its coordinates from the location of
currents in NEC's output, which are expressed in units of
The Geometry view now obtains wire coordinates from the structure specification, which have higher resolutions for wavelengths above 1m.
- NEC-4 line printer output was not refreshing when the
Output Window was already opened to the line printer
output tab. This is now fixed.
- Line printer format differences between nec2c and
NEC-4 caused loads in NEC-4 to not show up in the
Geometry view. This should now be fixed.
- Fixed a bug in the NC transmissionLineAtSegments
- Added yurkovInsulate and cebiklnsulate NC functions
to directly access the Yurkov (RA9MB) and Cebik (W4RNL)
approximation for an insulated wire.
- Progress indicators and the Stop button are now run
from the Main Thread. Although rare, it could have caused
sporadic thread safety crashes.
What has changed in v0.75 and v0.76?
(January 17, 2012)
The cocoaNEC User's Manual has been reorganized, together with the addition of an Index page. A link to the web copy of the Index appears in the cocoaNEC Documentation menu. Please refresh your web browser caches.
- Insulated Wire is now supported on
NEC-2 by using the Yurkov (RA9MB) solution. Empirically, the Yurkov
approximation appears to be very good for isolated
insulated wires but does not agree closely with the
NEC-4 IS card for closed-in insulated wires, such as a
wired pair in a window line.
- Multiple loads can now be placed on the same wire
(e.g., assigning a finite conductance to a wire, while
also applying an insulation to the same wire). A second
NC load on the same wire was ignored in earlier cocoaNEC
- All the NC in-line card functions (e.g., wire_ for GW
card) have been rename with a "Card suffix (e.g.,
wireCard) instead of the underscore character.
The output from multiple GH cards (helixCard in NC) will now show up in the Geometry View.
helixCard now works on NEC-4; the arguments of helixCard function is a little different from the old deleted helix_ function, to make the call compatible with the NEC-4 GH card.
A control click (or right mouse click) in the Geometry View will display the coordinates and current information of the center of the closest segment of a wire at the bottom right hand corner of the view.
A unit vector triad is now drawn to the upper right hand corner of the Geometry View. The red, green and blue (RGB) vectors point in the direction of the NEC-2 x, y and z coordinates, respectively.
- (v0.76) Fixed a bug in the NC runtime that kept
certain recursions from working properly.
What has changed in v0.73 and v0.74?
(December 28, 2011)
- Insulated Wires is now supported by the NC input
method of cocoaNEC. Please refer to the functions
insulate() and insulateAtSegment() in the NC documentation.
Please note that insulate() makes use of the IS card that is only available in NEC-4.
If the "Smart Interpolation" checkbox at the bottom of the Smith Chart View is selected, cocoaNEC will not draw an interpolated curve in between disjoint frequency bands of a multiband antenna. The following shows the Smith Chart View of the W1ZR two-band sleeve dipole drawn with Smart Interpolation turned off (left) and with Smart Interpolation turned on (right):
- The nec2c engine does not allow a wire with a single
segment to be fed by an excitation. cocoaNEC issues a
warning when this occurs. This restriction has been
removed when NEC-4 is selected as the compute engine
(thanks to Bill, K1GQ for the suggestion).
- For convenience, the " (inch) and ' (foot) suffixes
had been available for use as a scaling factor for any NC
constant. You can now also use the u, n and p suffixes to
indicate scaling factors for micro, nano and pico. E.g.,
10.5p is the same as 10.5*1E-12. Please note that as with
the inch and foot cases, there can be no spaces between
the numbers and the u, n or p suffixes.
What has changed in v0.70, v0.71 and v0.72?
(July 10, 2011)
- Two issues had prevented cocoaNEC from
compiling/running in Mac OS X 10.7 Lion. These are now
fixed. Many thanks to Bill K1GQ for identifying the
- The azimuth boresight in the Geometry view of the
Output window was off by 90 degrees from the actual
antenna geometry. Thanks to Toomas Altosaar for noticing
- An NC return statement that is contained
inside an if statement in an NC function did not
work. This is now fixed, together with a related problem
of a return statement that is embedded inside an
else clause. Thanks to Toomas Altosaar for
reporting the return statement bug.
- NC now includes a system function to add more than
one frequency at a time:
frequencySweep( freq0, freq1, n )
The above is equivalent to a collection of setFrequency() and addFrequency() calls, and generates n equal-spaced frequency steps between freq0 and freq1 (inclusive).
- NC now quits execution when a divide-by-zero is
encountered and reports a single error event. Before
v0.70, cocoaNEC had displayed an alert on the screen and
continues after the user responds, requiring multiple
responses by the user when a divide-by-zero is inside of
- The reference plot menu items had been inadvertently
dropped in the previous version. Reference plots should
now work again.
Major changes have been made in v0.70 to the Output window and cocoaNEC printing (for details, see here):
The output window can now be resized. The window size and location are saved to the plist.
A new Scalar plot view is added to the Output window. You can display a plot of the complex impedance, |Z|, VSWR or return loss against the frequency. Please read the Reference manual for more details. With this addition, the old SWR view has been renamed to the Smith Chart view.
The Output window actions have been moved from the Main menu to the Output window's toolbar (top right part of the Output window). You can now print a view by clicking on the printer toolbar icon. If you need more vertical screen space for the views, you can collapse the toolbar by pressing the translucent button that is located at the top rightmost of the Output window.
The Options tab in the previous versions of cocoaNEC is now incorporated in a drawer that is opened and closed by using the gear shaped toolbar icon. The options for polarization of plots, reference impedances, etc are now moved to this drawer.
Instead of two fixed SWR circles in the Smith Chart, the radius of a single SWR circle is now a parameter in the Options drawer. The SWR circle is absent from the Smith Chart view when the SWR Circle parameter is set to 0.
The color wheel in the Toolbar lets you open the window of two sets of color wells used to define custom colors for your plots. One set of color wells is shared between all the radiation plots, while the second set of color wells is used to distinguish different feed points in the Smith Chart view. These colors are saved to the plist when you exit cocoaNEC.
To change a color, click once on a color well and you can adjust the color of the well using the familiar Mac OS X Color Picker. The color in the color well and in your plots should track in real time (on faster computers, anyway) with the changes in the Color Picker.
When there are 4 or more frequency points, the Smith Chart view now has the option to draw a curve that interpolates between the frequency points. Please note that this curve is not the output from NEC-2 but it simply is a guess (estimated by using both a circular spline in the bilinear transform space and cubic spline in the impedance-reactance space). Unless the frequency points are moderately tightly spaced, do not depend on the curve in between the points to present an accurate estimate of actual impedances.
To reduce clutter, there is now an option in the Smith Chart view to control if you want to view the output from multiple feed points, or to view the output from a single feed point at a time. The single feed point is selected by a popup menu.
You can now get a detailed display of the data of each frequency in the Smith Chart view. When you click on a frequency point (a green dot), it will change the appearance of the point (into a green donut). The frequency, impedance and VSWR of the selected point shows up below the Smith Chart.
The Summary view now reports two different F/B ratio numbers. Both numbers are taken for an azimuth angle that is 180 degrees from the azimuth of the largest lobe. One number is for the rear lobe that has the same elevation angle of the front lobe, and the second, less optimistic value (the single value that cocoaNEC had earlier reported in the Summary view), is taken at the elevation angle where the rear lobe is strongest.
The printing interface has been completely rewritten. The horizontal dimension of a view should now fit the paper size that you have selected in the Mac OS Print Panel. You can for example choose different custom sizes for printing to a PDF file instead of to a physical printer. To conserve toner/ink, you can avoid printing the background color for the new Scalar view by unselecting the Draw Backgrounds checkbox in the options drawer of the Output window. Similarly, you can choose not to print the borders and/or the NC filename and time stamp in the footer.
- (v 0.71) Made a cosmetic fix in the Smith Chart
impedance display when the reactance component is
negative. Thanks to Bill K1GQ for spotting it.
- (v 0.72) Check for Updates in the cocoaNEC
menu and the items in the Documents menu now point to the
new web site www.w7ay.net instead of the former site on
What has changed in v0.69 ?
(May 25, 2011)
- Fixed bug that causes a crash when printing the
Azimuth or Elevation views of the Output Window.
- Fixed a bug that causes directivity to be computed
What has changed in v0.68 ?
(November 27, 2010)
- "Horizontal+Vertical" and "RHCP+LHCP" selections are
added to the Output Window's Options panel.
When "Horizontal+Vertical" is selected, both horizontal (solid line) and vertical (dashed line) polarizations are now displayed in the antenna patterns. When "RHCP+LHCP" is selected, both right hand circular polarization (solid line) and left hand circular polarization (dashed line) are now displayed.
The following shows the Summary view patterns of a quadrature fed Inverted Vee Turnstile antenna when "RHCP+LHCP" is selected:
The solid line represents right hand circular polarization and the dashed line represents left hand circular polarization.
- You can now select the polarization of the antenna
pattern from the Output Menu of the cocoaNEC Main Menu
bar. This allows you to quickly change polarization
without having to tab back and forth in the Output window
between a pattern view and the options view.
What has changed in v0.67 ?
(October 6, 2010)
You can now choose left hand circular and right hand circular in the Polarization selection column in the Output Window's Options panel for plotting the antenna response to LHCP and RHCP signals.
- The two radiation patterns in the Summary view of the
output window used to always display the total gain (sum
of vertical and horizontal gains). Like the azimuth,
elevation and 3D plots, these two plots in the Summary
view are now controlled by the same Polarization
selection in the Options tab (see above).
- Fixed a bug in the printf function in the NC
interpreter that caused a second argument in the variable
list not to print. The %g format (same meaning as the
printf format in the C library) is now support in
addition to %d, %f and %e.
What has changed in v0.66 ?
(July 9, 2010)
The printf function in the NC interpreter has been changed to work around a Snow Leopard problem. The vsprintf system call that was used by NC's printf implementation was causing the application to crash (only in Snow Leopard). The latest (v0.66) rework avoids the use of vsprintf completely.
Thanks to Jon W1JP for sending a bug report.
What has changed in v0.65 ?
(June 5, 2010)
The E-field columns showed identically zero values in the Output Listing view when Grand Central Dispatch (Snow Leopard version) was used. This should now be fixed. Thanks to Kevin Bandura for sending in the bug report.
The error did not affect the radiation pattern plots, nor was there a problem with the non-Snow Leopard version. The only change made to the Tiger/Leopard version of v0.65 is just the version number in the application bundle.
What has changed in v0.64 ?
(May 31, 2010)
- NEC-2 Card Deck export (in the File menu) has not
been working since v0.61. It should again work in v0.64.
- Worked around Cocoa's NSTextView slowness problem by
truncating the Summary view when it grows large.
- In addition to the above, the NEC-2 Output file
listing is deferred until the tab view for the output
listing is chosen. This should further speed up the
processing of NC loops.
- Fixed some memory leaks.
What has changed in v0.63 ?
(January 6, 2010)
- Sotirios Papathanasiou had sent me localization files
for the Greek language. cocoaNEC GUI now appears in Greek
if you have selected it as the language of choice in Mac
OS X. Many thanks to Mr. Papathanasiou.
- long (greater than 180 characters) lines in NC was
causing cocoaNEC to crash when it creates a listing file
in the output viewer window. This should now be fixed.
Thanks to Russ, AA7QU for sending me an NC file that
caused a crash.
What has changed in v0.62 ?
(September 25, 2009)
- v0.62 of cocoaNEC 2.0 turns on the Average Power Gain computation
whenever a 3D Radiation Pattern is generated.
The Average Power Gain is the gain of the modeled antenna relative to an isotropic antenna, averaged over the 4π steradian sphere. For an ideal lossless antenna, this value is 1.0, and the gain number is often used as one of the criteria to check for convergence (usually called the Average Gain Test, or AGT in the literature) of the model (e.g., whether wires are cut into sufficient segments, corners of loops are well formed, etc). Any model whose average gain is within about 0.2 dB of unity gain can be considered a reasonable model. Please note that the inclusion of any lossy elements in the model will render the average gain number meaningless for convergence testing purpose.
When the 3D radiation plot is not disabled (see the notes for v0.61 below), the Average Gain is reported in the Summary tab of the Output Window, as shown in the figure below:
- Additionally, averageGain is now available
as a model variable (similar to the maxGain
model variable) that can be referenced from inside of an
NC control function. This allows you to change the number
of wire segments, etc under programmed control instead of
manually adjusting them for convergence.
- The bundle name for cocoaNEC 2.0 has been changed
from w7ay.cocoaNEC 2.0 to
w7ay.cocoaNEC-2.0. This will change the name of
the preference (plist) file for cocoaNEC. The only
preference currently is the choice between using NEC-2 or
NEC-4, so this is the only thing that you would need to
change if you are defaulting cocoaNEC to using NEC-4.
The change is made so that cocoaNEC files (NC or spreadsheet models) can comply with the Snow Leopard sole scheme to connect a file with an application. Mac OS X 10.6 no longer uses the Resource Signature to distinguish between application.
What has changed in v0.61 ?
(September 19, 2009)
v0.61 of cocoaNEC 2.0 is a performance release. No new function has been added.
- Only one RP card is now generated for the 3D
radiation pattern in models that call for multiple
- An Options Menu is added to suppress the generation
of all 3D RP cards. The will further reduce the
time used by the NEC-2 engine, in the case where the 3D
radiation pattern is not going to be viewed.
- The v0.61 checkpoint is released as two installers in
the Download page. One version is
compatible with Mac OS X 10.4 (Tiger), MacOS 10.5
(Leopard) and Mac OS X 10.6 (Snow Leopard). The second
version can only be used in Snow Leopard. The Snow
Leopard (SL) version can be identified by opening the
About cocoaNEC 2.0 panel:
The Snow Leopard version includes optimizations in the NEC-2 engine to take advantage of the Grand Central Dispatch (GCD) support even when the antenna is modeled only at one frequency. GCD was introduced in Mac OS X 10.6.0. Some of the NEC-2 engine code can now run concurrently in multiple cores of the Macintosh. Except for the Core Solo model (early 2006) of the Mac Mini, all Intel based Macintoshes have at least two cores. The current MacPros have four or eight cores, all other current Macinoshes have 2 cores.
The blue bars are times for a PowerBook that has a single 1.5 GHz G4 PowerPC processor, running Mac OS X 10.5.8 Leopard. The green bars are times for the oldest Intel computer that Apple had shipped, a 1.83 Core Duo based MacBook Pro, running Snow Leopard Mac OS X 10.6.1. The red bars are times for the current stock (2.26 GHz) 8-core MacPro, also running Snow Leopard MacOS X 10.6.1..
The antenna model is a KLM 40M4, swept through seven different frequencies. 92 GW cards are created by the model.
Note that the Snow Leopard version of v0.61 (with some code rewritten for Grand Central Dispatch in Snow Leopard) runs faster than the non-SL version. If you are using Snow Leopard, please download the SL version. The 2-core (Intel Yonah Core Duo processor) machine's compute time shrunk by a factor of 1.5, from 4.6 seconds to 3 seconds (and compared to 13 seconds for v0.60). The 8-core (Intel Nehalem processors) machine improved even more (understandably, since Grand Central Dispatch has more cores to distribute the computation), shrinking by a factor of 2.5, from 2.1 seconds to 0.84 seconds, (and compared to 9 seconds with v0.60).
What has changed in v0.60 ?
(September 8, 2009)
- Fixed a string overflow bug in the SWRView that could cause unpredicatable crashes when large SWR is encountered.
What has changed in v0.59 ?
(September 4, 2009)
- Allow Spreadsheet variables to access the spreadsheet constants (c_pi, c_frequency, etc)
What has changed in v0.58 ?
(September 3, 2009)
- Fixed a bug where the Spreadsheet interface was
rounding loading parameters that are less than 0.000001
up to 0.000001.
What has changed in v0.57 ?
(August 18, 2009)
The following bugs are fixed:
- The NC parser for scientific notation constants was
scanning an extra character past the constant itself,
requiring an extra space following the number in the NC
source. Since the Spreadsheet interface now uses NC as
the intermediate "language," constants that are expressed
in scientific notion was breaking.
- The spreadsheet global variables, g_pi, g_frequency,
g_dielectric, etc, were not included into the NC source,
causing a spreadsheet model to fail if these variables
What has changed in v0.56 ?
(August 11, 2009)
The following bugs are fixed:
- Returning a variable from an NC user function used to
cause all the code between the statement where the
variable is defined up to the return statement itself to
- Placing an excitation on an NC taperedWire could
cause the EX card to reference a non-existant segment.
The excitation should now be placed in the center segment
of a tapered wire.
What has changed in v0.55 ?
(June 21, 2009)
- You can now quickly check if your copy of cocoaNEC is up to date. Please note that you have to manually check for updates. cocoaNEC will not pester you by itself. When directed to do so with the Check for Updates menu item, it will check the running version of cocoaNEC against a web file.
- NC now includes the following calls.
These calls are added to support the new way that the Spreadsheet method works, but these NC calls can be used by any NC programs (for example to generate arcs or helices). The new geometry calls include the ability to generate GM cards for each Geometry element.
The voltageFeedAtSegment and currentFeedAtSegment allow you to feed a wire, arc or helix not just at the center segment but at any segment. networkAtSegments and transmissionLineAtSegments also allow you to connect geometry elements at points that are not their centers.
Similarly, seriesLoadsAtSegments, parallelLoadsAtSegments and impedanceAtSegments allow you to insert series or parallel lumped RLC or R+iX element in any range of segments of a geometry element instead of only at the center segment. conductivityAtSegments allows you to specify conductivity for a range of segments instead of being applied to all segments of a wire when you use the conductivity call.
You can now directly generate arbitrary surface patches, rectangular patches, triangular patches, quadrilateral patches and multiple patches from NC.
Please check NCFunctions page for details.
- In prior versions of cocoaNEC, the Spreadsheet and NC
methods had used independent mechanisms to generate a
NEC-2 card deck. From version 0.55 onwards, a Spreadsheet
model no longer generates a card deck. Instead, the
Spreadsheet generates an NC program, and the NC program
is executed to produce the actual card images. This
reduces the amount of code that I need to maintain.
If you have an existing Spreadsheet model that had worked under version 0.54 but no longer works under version 0.55, please revert the application back to v0.54, which is still available in the Download page, and please drop me an e-mail.
- Each Spreadsheet row now includes a "transform"
column. When the transform cell is empty, the
row behaves as before. However, when a transform variable
is included, it is associated with a NEC-2 "GM" card.
This allows a geometry element to be rotated or
translated. Multiple geometry elements can share the same
Just as with ordinary variables and network and transmission line elements, the transform variables are defined in its own drop down sheet.
- The spreadsheet interface now has a Show Cards
button. This can be used to inspect the card deck or NC
program from a failed run.
- More examples have been added to the examples folder. New files include
simple spreadsheet models for an arc and a helix, and
an NC model of a Log Periodic Dipole Array by Doug,
K4DSP that is defined with recursive function calls.
What has changed in v0.54 ?
(June 9, 2009)
interpreter now supports arrays
transform data types.
model ( "array example" )
vector u, v ;
transform t ;
element e ;
t = translate( 0, 0, 10 ) ;
t = translate( 4, 0, 0 ) * t ;
e = wirev( t, u, v, #14, 21 ) ;
e = wirev( t, u, v, #14, 21 ) ;
feed( e, 1 ) ;
void feed( element *ele, int index )
voltageFeed( ele[index], 1.0, 0.0 ) ;
As seen above, you can also pass arrays to a function. For details, see Arrays in the NC User's Manual.
What has changed in v0.53 ?
(June 4, 2009)
interpreter now supports vectors
model ( "vectors" )
vector u, v, d ;
transform t ;
real height ;
u = vect( 0, -5, 0 ) ;
d = vect( 0, 10, 0 ) ;
v = u + d ;
t = translate( 0,0, height ) * rotateZ( 20.0 ) ;
wirev( t, u, v, #14, 21 ) ;
For details, see Vectors and Transforms in the NC User's Manual. Coordinates (x, y and z) of vectors can be extracted, allowing vector arithmetic (together with transforms) to be used as parameters for the Card Deck functions that were introduced in cocoaNEC 2.0 v0.52. This allows the creation of NEC-2 card decks whose geometry elements are individually transformed.
- Three new
geometry functions are added: wirev, taperedWirev and
linev. These are vector versions of their scalar
counterparts. In addition to using the vector
notation, these functions have a transform parameter
that transforms (e.g., rotate and translate, shown
above) the vectors before creating the geometry.
- Pre-increment (++v) and
pre-decrement (--v) operators on scalar (int and
real) variables have been added to
What has changed in v0.52 ?
(May 29, 2009)
interpreter now supports user defined functions.
model ( "stacked dipoles" )
currentFeed( dipole( 60' ), 1.0, 0.0 ) ;
currentFeed( dipole( 50' ), -1.3, 0.0 ) ;
currentFeed( dipole( 40' ), 1.0, 0.0 ) ;
element dipole ( real height )
return wire( 0, -5.2, height, 0, 5.2, height, #14, 21 ) ;
The user defined functions can return void (nothing, as in a subroutine), an int value, a real value, or an element (as in the case above). The function arguments (which can be empty) has to be an int, real or element. For details, check the User Functions page in the NC User's Manual.
allows you to mix NEC-2 geometry cards with the NC
intrinsics. This lets you use functions, such as
surface patches, that are not directly implementd
in NC. For example:
model ( "example of surface patch" )
voltageFeed( wire( 0, 5.2, 4, 0, -5.2, 4, #14, 3 ), 1, 0 ) ;
spCard( 0, 0, 0, -0.7, 90, 0, 120.0 ) ; // add an SP card
For details, check the Card Functions page in the NC User's Manual.
- NC now
includes three new keywords, void,
float and return.
can be used
interchangeably with real.
- The NC
compiler now accepts an #include directive to include
other text (e.g., a file with functions) into the NC
source. For example:
The pathname must be an absolute path, but can include the ~ character. The included file should not itself contain a #include directive.
What has changed in v0.51 ?
(February 17, 2009)
- Added the following functions to NC.
incidentPlaneWave( element, theta, phi, eta ) ;
rightPolarizedIncidentPlaneWave( element, theta, phi, eta ) ;
leftPolarizedIncidentPlaneWave( element, theta, phi, eta ) ;
These generate the corresponding NEC-2 EX cards. Many thanks to Rick Chapman, WA3LHN for pointing out that these are useful for obtaining Radar Cross Sections.
- Included NC taperedWire bug fixes from Bill K1GQ.
- A frequency specification that exceeded 1 GHz in a Spreadsheet model had generated a card deck that although NEC-2 can read, nec2c could not. This is now fixed. Thanks to Loren WA6LMZ for reporting the problem.
What has changed in v0.50 ?
(November 13, 2008)
The modulus (%) function was missing in the NC implementation. Thanks to David Johnson for reporting this.
What has changed in v0.49 ?
(October 9, 2008)
Fixed bug where a Spreadsheet model (.nec) file did not update the Free Space environment menu correctly (missing the needed free space flag).
What has changed in v0.48 ?
- CrossedTransmissionLine function in NC was not negating the impedance of the transmission line.
- each wire in NC could only connect to one transmission line. You can now connect multiple transmission lines to the same wire segment.
What has changed in v0.47 ?
- Applied NEC-2 extended thin wire approximation bug fixes to the nec2c library in cocoaNEC. This should not have affected anyone before, unless you are using surface patches from the card deck interface.
- The NEC-4 task is now run from the same directory the source file (NC, Spreadsheet or Hollerith card deck) resides in. NEC-4 generates auxiliary files (SOMD.NEC and NGFD.NEC) when the Sommerfeld/Norton ground model and Numerical Green Function are used. These auxiliary files should now be created in the folder the source file is in.
What has changed in v0.46 ?
- cocoaNEC can now use NEC-4 as the compute engine.
Unlike NEC-2, which is embedded into cocoaNEC, NEC-4 from the Lawrence Livermore National Lab (LLNL) comes with U. S. export restrictions and controls. As such, you will have to personally obtain a licensed copy from LLNL, and for the MacOS X operating system, you will also have to create your own Unix executable on your own computer since the distribution CD-ROM does not (currently) contain binaries that runs on MacOS X.
You can get the instructions for how to obtain NEC-4 and how to build a Unix executable from the NEC-4 sources here, or you can use the NEC-4 tab at the top of this page.
Once you have placed a Unix executable called nec4d in the /Applications folder, you can proceed to use NEC-4 as the compute engine by opening the cocoaNEC Preferences (open the Preference panel from the cocoaNEC menu in the Main menu bar) and selecting NEC-4 as the compute engine.
- feed point of the Reference model now appear in the SWR view.
When you choose a "Use as reference" or "Use Previous Run As Previous Run" in the Output menu (in the main menu bar), the reference (or previous) feedpoint(s) now appear in the SWR view as a gray circle.
- Implemented tapered wires in NC.
You can now generate a multi-segment wire whose segment lengths are tapered from one end of the wire to the second end of the wire. Se details here
- arcsin/arccos implemented in NC.
NC's math library was missing arcsin, arccos, arcsind and arccosd. There are now implemented.
- repeated radials in NC loops fixed.
When an NC model is repeated called from a control block, radials are accumulated. This is now fixed -- the radials are first cleared at the start of a control block.
- temporary file extension changed to .dat
The card deck file name in the /tmp directory now use the .dat extension instead of the .txt extension.
What has changed in v0.45 ?
- You can now open the cocoaNEC web documentation in the default web browser from a Documentation menu in the main menu of occoaNEC:
- The Geometry view of the Output window has four new features. There is now a Scaled Magnitude item in the Current menu, which expands the current scale to better show low segment currents.
- the Geometry view can now be scaled. A slider at the top left of the view magnifies the structure geometry from the original 1x continuously up to a scale factor of 16x. You can also "pan" the drawing up and down and left to right by holding down the mouse and dragging the cursor while the mouse button is held down. While the mouse is held down inside the Geometry view, the cursor turns from an arrow to an open hand.
When the Geometry view is panned, a re-center button will appear and you can reset the panning action with the button:
- Loads (impedance, RLC) are now indicated in the Geometry view with a small cross.
- Single segment wires were not drawn into the Geometry view, They should now be drawn.
- A warning alert is now issued before closing an NC window that has unsaved changes.
- Implemented auto-tabbing in the NC window. Whenever a newline is typed, the beginning spaces and tabs of the previous line are automatically inserted to the start of the new line of the NC window.
- v0.45 fixes a precedence bug in the division and modulus (%) functions in NC. a/b/c used to be evaluated as a/(b/c). It is correctly evaluated now as (a/b)/c.
- Output data files ("line printer output") that are generated by NEC-4 can now be directly read and and displayed in cocoaNEC's Output window. Like regular NEC-2 outputs from the embedded NEC-2 engine in cocoaNEC, the NEC-4 output instances that are read in can be used as the reference antenna:
What has changed in v0.44 ?
- Moved the setQuadPrecision function of NC to the global context. Before this, setQuadPrecision could only be set from the control block in NC.
- Added a line function to NC. This is the same as a wire function, except that cocoaNEC turns the number of segments of the wire function into an odd number to facilitate center feeding of the wire. With the line function, the number of segments is explicitly obeyed.
- Added a new Scaled Magnitude option in the Geometry view to change the colors for the currents in the wires so that variations in low currents will show up better.
- Fixed a reentrancy bug in the NEC-2 core for the Sommerfeld-Norton approximation. The nec2c engine that cococNEC uses was written as a stand-alone program to be run once before needing to be relaunched. For cocoaNEC, I had adapted nec2c into a library that is called each time a new model run is requested. It turns out that nec2c has a subroutine which was not reentrant when the Sommerfeld approximation is selected. Many thanks to Bill, K1GQ for pin-pointing the source of the problem. Please note that this is purely my fault and not the fault of the nec2c engine, which was not intended to be used in a reentrant manner in the first place.
- Added a cache for the Sommerfeld-Norton calculations. The results of up to 16 ground parameters and frequencies are cached so that if you reuse them (e.g., when you only change the antenna structure geometry), the Sommerfeld-Norton coefficients need not be recomputed.
What has changed in v0.43 ?
Fixed printing problem from Summary View. cocoaNEC was sending multiple copies (one for each subview) to the printer.
What has changed in v0.42 ?
Added a new function called addFrequency() to NC.
The behavior of the old setFrequency() has changed. It used to be setFrequency() will keep adding more frequencies (for a multi-frequency plot). setFreqency() has changed so that when you call it, all previous frequencies are removed first and only a single frequency is set. Use addFrequency() to add more frequencies.
This allows you to have finer control of the frequencies in between optimization phases.
What has changed in v0.41 ?
Fixed more formatting bugs (this time for NC models).
Fixed bug where one of the frequencies in a multifrequency set for the spreadsheet interface was not being recovered from a saved file.
Puts out a warning dialog when an NC model contains no excitation.
Fixed caption position in the SWR view (common with NC and spreadsheet).
Removed the minimum-of-3-segment restriction for wires. Instead, you are warned when placing an excitation or load on a 1 segment wire. Unloaded 1 segment wires are now passed on to the NEC-2 engine as a single segment.
Instead of having to manually convert a Windows terminated card deck to a Unix terminated card deck, cocoaNEC can now read the Windows text files directly.
The nec2c engine crashes when a NEC-4 "End geometry" card is seen when importing a Card Deck. All such imported cards are now converted to the NEC-2 style cards.
Added the option to include RP card to a Card Deck to generate the cocoaNEC 3D radiation plots.
Added a page where all NC functions are listed in one place at
Many thanks to Lou, KC0ZMO for sending in some of the code fixes.
What has changed in v0.40 ?
Fixed formatting bug for series and parallel RLC loads for spreadsheet models.
What has changed in v0.39 ?
Corrected antenna directivity figure for antennas over real ground to be relative to the average radiation over 4.pi steradians rather than 2.pi steradians.
What has changed in v0.38 ?
You can now open an .nc or .nec file by double clicking on it.
(The first time you do this, the system might ask you to choose the Application. Select cocoaNEC. You can also set it with GetInfo in the Finder. )
Once the file types has been registered (it might take a reboot of the Mac to see it), the .nec and .nc files will also take on custom icons.
v0.41 Dec 8, 2007
Allow windows line ending for card deck.
Converted NEC-4 GE format to NEC-2 GE format.
Added 3D RP generation for Hollerith decks.
Rearrange card decks so that EX follows an FR card.
Removed 3-segment restriction to wires, and added a warning instead.
Spreadsheet frequency set not completely correct (4-th frequency not restored)
Fixed more format values for numbers smaller than 10e-9 in NC model.
Don't send NC models with missing excitation to NEC-2.
Caption position in SWR view.
v0.40 Nov 26, 2007
Fixed format values for numbers smaller than 10e-9 in Spreadsheet model
v 0.39 Nov, 12, 2007
Directivity computed over 4 pi steradians.
v 0.38 Nov 5, 2007
Double click on nc and nec files.
v 0.37 Nov 2, 2007
Removed extraneous threads.
v 0.36 Oct 29, 2007
Clean up threads and memory leaks
Use period for decimals in Environment panels for European systems
v 0.35 Oct 27, 2007
fixed NC symbol table bug in Leopard (Mac OS X 10.5)
v 0.34 Oct 24, 2007
Alpha Release History
v 0.34 Oct 24, 2007
clean up for beta
v 0.33 Oct 23, 2007
prettied up printing
v 0.32 Oct 22, 2007
Added power to plot and auto contrast.
v 0.31 Oct 22, 2007
Added vertical and horizontal polarization to 3d plot.
v 0.30 Oct 21, 2007
Added 3D plot.
v 0.29 Oct 18, 2007
Added efficiency variable to NC.
v 0.28 Oct 17, 2007
Print composite summary view.
Fixed multiple current source bug in Geometry View.
Fixed NC to emit NT cards for current sources before any EX cards.
Fixed Spreadsheet to emit NT cards for current sources before any EX cards.
v 0.27 Oct 14, 2007
Added plots to output summary
v 0.26 Oct 13, 2007
Lock an NC run when previous run still active.
abs() and fabs() in NC
fixed freespace bug in NC
v 0.25 Oct 12, 2007
changed GE 1 to GE -1 for non free space case
extened thin wire kernels for Spreadsheet and NC
run NC on separate thread
added "stop" button, pause() to NC
added NEC-2 grounds to Spreadsheet
v 0.24 Oct 6, 2007
if-then-else and while-break statements in NC.
v 0.23 Oct 3, 2007
NC Network and Transmission lines.
Make NC window the active window after a Command-G.
"Use Previous Run As Reference"
Removed small current segments in spreadsheet when current source is removed.
Added directivity to plots
v 0.22 Sept 27, 2007
Fixed bug where source of hollerith deck was from fixed directory.
Fixed bug with Azimuth pattern (elevation angle was also changing)
v 0.21 Sept 13, 2007
Fixed current source release bug.
Fixed bug with radials values overflowing float format
v 0.20 Sept 12, 2007
Removed angle menu, sind() for sin of degrees, etc, added pi and C constants
Added current source.
Added Sommerfeld ground.
Added Radial and option to draw it.
v 0.19 Sep 9, 2007
Fixed cosine bug.
v 0.18 Sep 9, 2007
Work around nec2c bug with single segment wires. Changed 1 segment wires to have 3 segments.
Warn when there is no excitation or no wire.
Menu selection to view spreadsheet as formula.
v 0.17 Sept 8, 2007
Disable File menu states that are not currently for hollerith/spreadsheet.
Implemented frequency sweeps.
v 0.16 Sep 7, 2007
Allow removal of all output contexts.
v 0.15 Sep 6, 2007
Geometry and Currents.
Element Inspector menu and keyboard shortcut.
v 0.14 Sep 2, 2007
Implemented free space and perfect grounds.
Added fresh and salt water grounds.
Move aux windows to sheets.
v 0.13 Aug 31, 2007
Implemented reference Antenna
Tabbing in spreadsheet from Cell Editor (formulaBar)
v 0.12 Aug 31, 2007
Moved Run Model to a new Model Menu.
Fixed bug where Environment dictionary was not updated when a new model is loaded.
v 0.11 Aug 30, 2007
Added Run Model and Command R to File Menu
Added more fixes to avoid using 10 column floating point fields (bug in nec2c.rxq)
Added missing RP card for directivity
v 0.10 Aug 30 2007
Initial alpha release.
Started: Aug 1 2007
Rewrite of original cocoaNEC program, replacing NC with a spreadsheet user interface.
- The NC interpreter now supports vectors and coordinate transforms.