Skip to content

Instantly share code, notes, and snippets.

@kzyapkov
Created May 18, 2018 11:21
Show Gist options
  • Save kzyapkov/02ccfb62b7d9f3d73d29271c86afd48a to your computer and use it in GitHub Desktop.
Save kzyapkov/02ccfb62b7d9f3d73d29271c86afd48a to your computer and use it in GitHub Desktop.
necpp collinear antenna error
CM --- NEC2 Input File created or edited by xnec2c 3.5 ---
CM GW 2 25 0.00000E+00 6.90000E-02 4.00000E-03 0.00000E+00 6.90000E-02 -4.00000E-03 1.50000E-03
CM tag segs x1 y1 z1 x2 y2 z2
CE
GW 1 1 0.00000E+00 5.30000E-02 -4.00000E-03 0.00000E+00 5.30000E-02 4.00000E-03 7.50000E-04
GW 3 25 0.00000E+00 0.00000E+00 4.00000E-03 0.00000E+00 5.30000E-02 4.00000E-03 7.50000E-04
GW 4 15 0.00000E+00 5.30000E-02 4.00000E-03 0.00000E+00 6.90000E-02 4.00000E-03 7.50000E-04
GW 5 15 0.00000E+00 0.00000E+00 -4.00000E-03 0.00000E+00 5.30000E-02 -4.00000E-03 7.50000E-04
GW 6 15 0.00000E+00 5.30000E-02 -4.00000E-03 0.00000E+00 6.90000E-02 -4.00000E-03 7.50000E-04
GA 10 35 4.00000E-03 9.00000E+01 2.70000E+02 7.50000E-04 1.38921E-01 0.00000E+00 0.00000E+00
GM 0 0 0.00000E+00 0.00000E+00 2.70000E+02 0.00000E+00 6.90000E-02 0.00000E+00 1.00000E+01
GW 15 80 0.00000E+00 0.00000E+00 4.00000E-03 0.00000E+00 0.00000E+00 1.55000E-01 7.50000E-04
GW 16 80 0.00000E+00 0.00000E+00 -4.00000E-03 0.00000E+00 0.00000E+00 -1.55000E-01 7.50000E-04
GE 0 0 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
EX 0 1 1 0 1.00000E-03 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
FR 0 51 0 0 1.02000E+03 2.80000E+00 1.16000E+03 0.00000E+00 0.00000E+00 0.00000E+00
NH 0 1 1 1 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
NE 0 10 1 10 -1.35000E+00 0.00000E+00 -1.35000E+00 3.00000E-01 0.00000E+00 3.00000E-01
RP 0 19 37 1000 0.00000E+00 0.00000E+00 1.00000E+01 1.00000E+01 0.00000E+00 0.00000E+00
EN 0 0 0 0 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00
import numpy as np
import PyNEC
from scipy.constants import c
def make_collinear(nec, f0=1090e6, wdia=1.5e-3):
"""Originally designed for ADS-B by PY4ZBZ
http://www.qsl.net/py4zbz/adsb.htm#e
"""
geo = nec.get_geometry()
l = c/f0
wrad = wdia/2
arm_k = 0.555
stub_k = 0.2533
tap_k = 0.758
gap_len = 8e-3 # fix stub gap at 8mm
arm_len = l * arm_k
stub_len = l * stub_k
tap_y = stub_len * tap_k
# load element
geo.wire(1, 5, 0, tap_y, -gap_len/2, 0, tap_y, gap_len/2, wrad, 1, 1)
# end of stub
geo.arc(3, 25, gap_len/2, 90, 270, wrad)
geo.move(0, 0, 270, 0, stub_len, 0, 3, 0, 0)
# long arms of stub
geo.wire(5, 35, 0, 0, gap_len/2, 0, tap_y, gap_len/2, wrad, 1, 1)
geo.wire(6, 35, 0, 0, -gap_len/2, 0, tap_y, -gap_len/2, wrad, 1, 1)
# short arms of stub
geo.wire(10, 25, 0, tap_y, -gap_len/2, 0, stub_len, -gap_len/2, wrad, 1, 1)
geo.wire(11, 25, 0, tap_y, gap_len/2, 0, stub_len, gap_len/2, wrad, 1, 1)
# active elements
geo.wire(17, 150, 0, 0, gap_len/2, 0, 0, arm_len + (gap_len/2), wrad, 1, 1)
geo.wire(18, 150, 0, 0, -gap_len/2, 0, 0, -arm_len - (gap_len/2), wrad, 1, 1)
geo.geometry_complete(0)
return geo
nec = PyNEC.nec_context()
geo = make_collinear(nec)
print(geo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment