# GS cards in NEC decks

I'm trying to understand the use of GS cards in NEC2 decks. The documentation is rather vague! Consider a basic stack:

CM My antenna
CE
GW  1   3   0   1   4   0   1.707   4.707   0.057
GS  0   0   .5
LD ...
RP ...
EN


As I understand it, in the example above the 0.5 factor will be applied to all of the measurements, in this case, the last six parameters of the GW. Now let us extend the stack (ignoring non-important lines):

GW  1   3   0   1   4   0   1.707   4.707   0.057
GS 0.5
GW  2   3   0   1   4   0   1.8     4.8     0.08
GS 0.25


First off, is this valid, or are two GS's in a stack considered improper? I looked at a number of pages, including a number of Cebik articles, and can't find a stack with more than one. The documentation doesn't say anything about this.

If it is valid, what is the outcome in this case? Does everything get 0.25 or does the first line get 0.5 and the second 0.25? If the GS applies to "the lines up to the next GS", what happens in this case:

GW  1   3   0   1   4   0   1.707   4.707   0.057
GS 0.5
GW  2   3   0   1   4   0   1.8     4.8     0.08
GS 0.25
GW  3   3   0   1   4   0   1.9     4.9     0.09


What is applied to the last line? An older post online suggests that anything below the last GS defaults to meters, but I can't speak the veracity of that claim.

I'm pretty sure that what happens is that the GS card operates on everything above it and that they do "stack".

More specifically, whenever NEC reads a GW (or another card that defines wires like GH) it stores that geometry into an array in memory, and when it encounters a GS card it simply scales the coordinates of everything already in memory. The GS card is then "forgotten", so it doesn't have any effect on anything after it, and a later GS card doesn't care whether whether or not some geometry has been scaled by an earlier GS or not; if it has, it will get scaled again by the new one and their effects will multiply.

The GM card operates in a similar way. The difference with GM is that you can ask it to apply only to a subset of tag numbers — but it still only applies to what's above it, and the default is to apply to all tags. Cebik notes that relative ordering of GM and GS matters; if you have a GS that scales to feet with a GM above it, then the size of the GM transformation will be in feet (because the geometry will be unscaled when the GM gets to it, and then everything will get scaled down, including the transformation), but if you put the GS before the GM then the transformation will be in meters.

The main reason you don't see decks with more than one GS is because it's pretty confusing — having a single GS that defines "what your units are" and putting it at the end is by far the simplest thing.

• This is excellent, thanks! Jan 7 at 15:04

You're right the documents are a bit thin here. Going through the source code would be one way. I tried this out quickly in NEC, as it helpfully prints out the whole geometry in the OUT file.
The summary is that each GS scales the structure that's been entered up to that point, and it's OK to have several GS cards.

GW  1   5   -1.0   0.0   0.0    1.0  0.0  0.00    0.01
GS  0   0   .1
GW  2   5   -1.0   1.0   0.0    1.0  1.0  0.00    0.01
GS  0   0   .1
GE


is processed to:

                             - - - STRUCTURE SPECIFICATION - - -

WIRE                                                                               NO. OF    FIRST  LAST     TAG
NO.        X1         Y1         Z1          X2         Y2         Z2      RADIUS   SEG.     SEG.   SEG.     NO.
1   -1.00000    0.00000    0.00000     1.00000    0.00000    0.00000    0.01000      5        1     5       1
STRUCTURE SCALED BY FACTOR   0.10000
2   -1.00000    1.00000    0.00000     1.00000    1.00000    0.00000    0.01000      5        6    10       2
STRUCTURE SCALED BY FACTOR   0.10000


and the segments are as follows:
I should have used better coordinates and fewer segments, but look at the WIRE RADIUS column for a clear answer. They were all specified as 0.01 m in the GW cards:

                             - - - - SEGMENTATION DATA - - - -
COORDINATES IN METERS
SEG.   COORDINATES OF SEG. CENTER     SEG.     ORIENTATION ANGLES    WIRE    CONNECTION DATA   TAG
NO.       X         Y         Z       LENGTH     ALPHA     BETA      RADIUS    I-   I    I+    NO.
1  -0.00800   0.00000   0.00000   0.00400    0.00000   0.00000   0.00010     0    1    2      1
2  -0.00400   0.00000   0.00000   0.00400    0.00000   0.00000   0.00010     1    2    3      1
3   0.00000   0.00000   0.00000   0.00400    0.00000   0.00000   0.00010     2    3    4      1
4   0.00400   0.00000   0.00000   0.00400    0.00000   0.00000   0.00010     3    4    5      1
5   0.00800   0.00000   0.00000   0.00400    0.00000   0.00000   0.00010     4    5    0      1
6  -0.08000   0.10000   0.00000   0.04000    0.00000   0.00000   0.00100     0    6    7      2
7  -0.04000   0.10000   0.00000   0.04000    0.00000   0.00000   0.00100     6    7    8      2
8   0.00000   0.10000   0.00000   0.04000    0.00000   0.00000   0.00100     7    8    9      2
9   0.04000   0.10000   0.00000   0.04000    0.00000   0.00000   0.00100     8    9   10      2
10   0.08000   0.10000   0.00000   0.04000    0.00000   0.00000   0.00100     9   10    0      2

• Right, so the first wire had BOTH scales applied. That makes perfect sense in retrospect. I can understand why real stacks wouldn't do this, scaling the scaling would seem to get hairy! Jan 9 at 15:38
• Well you could do fun things like make an LPDA or spiral antenna by repeating the same GW, TL, GM and GS cards many times over. But why?! Jan 11 at 14:45