예제 #1
0
def geometry_monopole_ground(freq_mhz, monopole_length, ground_wire_length,
                             nr_segments):
    wire_radius = 0.0005  # 0.5 mm

    nec = context_clean(nec_context())
    nec.set_extended_thin_wire_kernel(True)

    geo = geometry_clean(nec.get_geometry())

    bottom = np.array([0, 0, 0])
    top = np.array([0, 0, monopole_length])

    wire_tag = 1
    geo.wire(tag_id=wire_tag,
             nr_segments=nr_segments,
             src=bottom,
             dst=top,
             radius=wire_radius)

    add_ground_screen(geo, start_tag=2, length=ground_wire_length)

    # Everything is in brass
    nec.set_wire_conductivity(brass_conductivity)

    nec.geometry_complete(
        ground_plane=False)  # We added our own 'ground plane'

    nec.voltage_excitation(wire_tag=wire_tag, segment_nr=1, voltage=1.0)

    return nec
예제 #2
0
def geometry_logperiodic(l_1, x_1, tau):
  """
      x_1 is the distance from the origin to the largest (farthest away) dipole, which has a length of l_1.
      The spacing is as follows: l_{i+1}/l_i = tau = x_{i+1}/x_i
  """
  wire_radius = 0.00025 # 0.25 mm

  # alpha = np.arctan( (l_1/2.0) / x_1 )

  nec = context_clean(nec_context())
  nec.set_extended_thin_wire_kernel(True)

  geo = geometry_clean(nec.get_geometry())

  # Dipoles should be oriented in the Z direction; they should be placed on the (positive) X axis

  x_i = x_1
  l_i = x_1
  
  # As ususal, note that nec tags start at 1, and we typically index from 0!
  dipole_center_segs = {} # Maps from NEC wire id!
  
  dipoles_count = 5

  for dipole_tag in range(1, dipoles_count + 1):
      nr_segments = int(math.ceil(50*l_i/wavelength)) # TODO this might vary when sweeping even!
      #print nr_segments

      dipole_center_segs[dipole_tag] = nr_segments / 2 + 1

      center      = np.array([x_i, 0, 0])
      half_height = np.array([0  , 0, l_i/2.0])
      top         = center + half_height
      bottom      = center - half_height

      geo.wire(tag_id=dipole_tag, nr_segments=nr_segments, src=bottom, dst=top, radius=wire_radius)

      x_i = tau * x_i
      l_i = tau * l_i

  # Everything is in brass
  nec.set_wire_conductivity(brass_conductivity)

  nec.geometry_complete(ground_plane=False)

  # The 6th tag is the smallest tag is the source element
  for dipole in range(0, dipoles_count - 1):
      src_tag = 1 + dipole # NEC indexing
      src_seg = dipole_center_segs[src_tag]

      dst_tag = src_tag + 1
      dst_seg = dipole_center_segs[dst_tag]

      nec.transmission_line((src_tag, src_seg), (dst_tag, dst_seg), tl_impedance, crossed_line=True)

  smallest_dipole_tag = dipoles_count # Again, start at 1

  nec.voltage_excitation(wire_tag=smallest_dipole_tag, segment_nr=dipole_center_segs[smallest_dipole_tag], voltage=1.0)

  return nec
예제 #3
0
def geometry(freq_mhz, length, nr_segments):
    wire_radius = 0.01e-3  # 0.01 mm

    nec = context_clean(nec_context())
    nec.set_extended_thin_wire_kernel(False)

    geo = geometry_clean(nec.get_geometry())

    center = np.array([0, 0, 0])
    half = np.array([length / 2, 0, 0])

    pt1 = center - half
    pt2 = center + half

    wire_tag = 1
    geo.wire(tag_id=wire_tag,
             nr_segments=nr_segments,
             src=pt1,
             dst=pt2,
             radius=wire_radius)

    nec.geometry_complete(ground_plane=False)

    nec.set_frequency(freq_mhz)

    # Voltage excitation in the center of the antenna
    nec.voltage_excitation(wire_tag=wire_tag,
                           segment_nr=int(nr_segments / 2),
                           voltage=1.0)

    return nec
예제 #4
0
def geometry(freq_mhz, length, nr_segments):
    wire_radius = 0.01e-3  # 0.01 mm

    nec = context_clean(nec_context())
    nec.set_extended_thin_wire_kernel(False)

    geo = geometry_clean(nec.get_geometry())

    center = np.array([0, 0, 0])
    half = np.array([length / 2, 0, 0])

    pt1 = center - half
    pt2 = center + half

    wire_tag = 1
    geo.wire(tag_id=wire_tag, nr_segments=nr_segments, src=pt1, dst=pt2, radius=wire_radius)

    nec.geometry_complete(ground_plane=False)

    nec.set_frequency(freq_mhz)

    # Voltage excitation in the center of the antenna
    nec.voltage_excitation(wire_tag=wire_tag, segment_nr=int(nr_segments / 2), voltage=1.0)

    return nec
예제 #5
0
def geometry_logperiodic(l_1, x_1, tau):
  """
      x_1 is the distance from the origin to the largest (farthest away) dipole, which has a length of l_1.
      The spacing is as follows: l_{i+1}/l_i = tau = x_{i+1}/x_i
  """
  wire_radius = 0.00025 # 0.25 mm

  # alpha = np.arctan( (l_1/2.0) / x_1 )

  nec = context_clean(nec_context())
  nec.set_extended_thin_wire_kernel(True)

  geo = geometry_clean(nec.get_geometry())

  # Dipoles should be oriented in the Z direction; they should be placed on the (positive) X axis

  x_i = x_1
  l_i = x_1
  
  # As ususal, note that nec tags start at 1, and we typically index from 0!
  dipole_center_segs = {} # Maps from NEC wire id!
  
  dipoles_count = 5

  for dipole_tag in range(1, dipoles_count + 1):
      nr_segments = int(math.ceil(50*l_i/wavelength)) # TODO this might vary when sweeping even!
      #print nr_segments

      dipole_center_segs[dipole_tag] = nr_segments / 2 + 1

      center      = np.array([x_i, 0, 0])
      half_height = np.array([0  , 0, l_i/2.0])
      top         = center + half_height
      bottom      = center - half_height

      geo.wire(tag_id=dipole_tag, nr_segments=nr_segments, src=bottom, dst=top, radius=wire_radius)

      x_i = tau * x_i
      l_i = tau * l_i

  # Everything is in brass
  nec.set_wire_conductivity(brass_conductivity)

  nec.geometry_complete(ground_plane=False)

  # The 6th tag is the smallest tag is the source element
  for dipole in range(0, dipoles_count - 1):
      src_tag = 1 + dipole # NEC indexing
      src_seg = dipole_center_segs[src_tag]

      dst_tag = src_tag + 1
      dst_seg = dipole_center_segs[dst_tag]

      nec.transmission_line((src_tag, src_seg), (dst_tag, dst_seg), tl_impedance, crossed_line=True)

  smallest_dipole_tag = dipoles_count # Again, start at 1

  nec.voltage_excitation(wire_tag=smallest_dipole_tag, segment_nr=dipole_center_segs[smallest_dipole_tag], voltage=1.0)

  return nec
예제 #6
0
def sc_quad_helix(height, diameter, wire_diameter = 0.02):
    
    nec = context_clean(nec_context())
    nec.set_extended_thin_wire_kernel(True)
    
    geo = geometry_clean(nec.get_geometry())

    wire_r = wire_diameter/2;
    helix_r = diameter/2;
    
    
    #print "Wire Diameter %s" % (wire_r * 2)
    
    helix_turns = 0.5
    helix_elevation = 0.1  # elevation of helix above conductive plate
    excitation_lenght = 0.1
    
    # helix loop 
    helix_twist_height = height / helix_turns
    geo.wire(tag_id=1, nr_segments=1, src=np.array([helix_r, 0, 0]), dst=np.array([helix_r, 0, -excitation_lenght]), radius=wire_r)
    geo.helix(tag_id=1, nr_segments=50, spacing=helix_twist_height, lenght=height, start_radius=np.array([helix_r, helix_r]), end_radius=np.array([helix_r, helix_r]), wire_radius=wire_r)
    geo.move(rotate_z=90, move_z=0, copies=3, segment=0, tag_inc=1)
    geo.wire(tag_id=10, nr_segments=2, src=np.array([0, 0, height]), dst=np.array([helix_r, 0, height]), radius=wire_r)
    geo.wire(tag_id=11, nr_segments=2, src=np.array([0, 0, height]), dst=np.array([0, helix_r, height]), radius=wire_r)
    geo.wire(tag_id=12, nr_segments=2, src=np.array([0, 0, height]), dst=np.array([-helix_r, 0, height]), radius=wire_r)
    geo.wire(tag_id=13, nr_segments=2, src=np.array([0, 0, height]), dst=np.array([0, -helix_r, height]), radius=wire_r)
    
    ## bottom helix connecting wires
    geo.wire(tag_id=20, nr_segments=2, src=np.array([0, 0, -excitation_lenght]), dst=np.array([helix_r, 0, -excitation_lenght]), radius=wire_r)
    geo.wire(tag_id=21, nr_segments=2, src=np.array([0, 0, -excitation_lenght]), dst=np.array([0, helix_r, -excitation_lenght]), radius=wire_r)
    geo.wire(tag_id=22, nr_segments=2, src=np.array([0, 0, -excitation_lenght]), dst=np.array([-helix_r, 0, -excitation_lenght]), radius=wire_r)
    geo.wire(tag_id=23, nr_segments=2, src=np.array([0, 0, -excitation_lenght]), dst=np.array([0, -helix_r, -excitation_lenght]), radius=wire_r)
    
    geo.wire(tag_id=1, nr_segments=1, src=np.array([0, 0, -excitation_lenght]), dst=np.array([0, 0, -helix_elevation -excitation_lenght]), radius=wire_r) # vertical wire connecting the patch and helixal antenna
    geo.rectangular_patch(a1 = np.array([-1, -1, -helix_elevation - excitation_lenght]), a2 = np.array([1, -1, -helix_elevation - excitation_lenght]), a3= np.array([1, 1, -helix_elevation - excitation_lenght]))
    #geo.rectangular_patch(a1 = np.array([-1, -1, 0]), a2 = np.array([1, -1, 0]), a3= np.array([1, 1, 0]))

    # Everything is copper
    nec.set_wire_conductivity(copper_conductivity)
    # finish structure definition
    nec.geometry_complete(ground_plane=False)

    # Voltage excitation at legs of the antenna
    nec.voltage_excitation(wire_tag=1, segment_nr=1, voltage=1.0)
    nec.voltage_excitation(wire_tag=2, segment_nr=1, voltage=0.0+1.0j)
    nec.voltage_excitation(wire_tag=3, segment_nr=1, voltage=-1.0)
    nec.voltage_excitation(wire_tag=4, segment_nr=1, voltage=0.0-1.0j)
    #nec.set_frequencies_linear(start_frequency=140, stop_frequency=150, count=100)
    #nec.radiation_pattern(thetas=Range(90, 90, count=1), phis=Range(180,180,count=1))

    return nec
예제 #7
0
def sc_quad_helix(height, diameter, wire_diameter = 0.02):
    
    nec = context_clean(nec_context())
    nec.set_extended_thin_wire_kernel(True)
    
    geo = geometry_clean(nec.get_geometry())

    wire_r = wire_diameter/2;
    helix_r = diameter/2;
    
    
    print "Wire Diameter %s" % (wire_r * 2)
    
    helix_turns = 0.5
    
    # helix loop 
    helix_twist_height = height / helix_turns
    geo.helix(tag_id=1, nr_segments=50, spacing=helix_twist_height, lenght=height, start_radius=np.array([helix_r, 0]), end_radius=np.array([helix_r, 0]), wire_radius=wire_r)
    geo.move(rotate_z=90, copies=3, tag_inc=1)
    geo.wire(tag_id=10, nr_segments=5, src=np.array([0, 0, height]), dst=np.array([helix_r, 0, height]), radius=wire_r)
    geo.wire(tag_id=11, nr_segments=5, src=np.array([0, 0, height]), dst=np.array([0, helix_r, height]), radius=wire_r)
    geo.wire(tag_id=12, nr_segments=5, src=np.array([0, 0, height]), dst=np.array([-helix_r, 0, height]), radius=wire_r)
    geo.wire(tag_id=13, nr_segments=5, src=np.array([0, 0, height]), dst=np.array([0, -helix_r, height]), radius=wire_r)
    
    # Everything is copper
    nec.set_wire_conductivity(copper_conductivity)
    # finish structure definition
    nec.geometry_complete(ground_plane=False)

    # Voltage excitation at legs of the antenna
    nec.voltage_excitation(wire_tag=1, segment_nr=1, voltage=1.0 )
    nec.voltage_excitation(wire_tag=2, segment_nr=1, voltage=1.0 )
    nec.voltage_excitation(wire_tag=3, segment_nr=1, voltage=1.0 )
    nec.voltage_excitation(wire_tag=4, segment_nr=1, voltage=1.0 )
    #nec.set_frequencies_linear(start_frequency=140, stop_frequency=150, count=100)
    #nec.radiation_pattern(thetas=Range(90, 90, count=1), phis=Range(180,180,count=1))

    return nec
예제 #8
0
def geometry(freq, base, length):
  conductivity = 1.45e6 # Stainless steel
  ground_conductivity = 0.002
  ground_dielectric = 10

  wavelength = 3e8/(1e6*freq)
  n_seg = int(math.ceil(50*length/wavelength))

  nec = context_clean(nec_context())

  geo = nec.get_geometry()
  geo.wire(1, n_seg, 0, 0, base, 0, 0, base+length, 0.002, 1.0, 1.0)
  nec.geometry_complete(1)

  nec.set_all_wires_conductivity(conductivity)

  nec.set_finite_ground(ground_dielectric, ground_conductivity)
  nec.set_frequency(freq)

  # Voltage excitation one third of the way along the wire
  nec.voltage_excitation(wire_tag=1, segment_nr=int(n_seg/3), voltage=1.0)

  return nec
예제 #9
0
def geometry(freq, base, length):
    conductivity = 1.45e6  # Stainless steel
    ground_conductivity = 0.002
    ground_dielectric = 10

    wavelength = 3e8 / (1e6 * freq)
    n_seg = int(math.ceil(50 * length / wavelength))

    nec = context_clean(nec_context())

    geo = nec.get_geometry()
    geo.wire(1, n_seg, 0, 0, base, 0, 0, base + length, 0.002, 1.0, 1.0)
    nec.geometry_complete(1)

    nec.set_all_wires_conductivity(conductivity)

    nec.set_finite_ground(ground_dielectric, ground_conductivity)
    nec.set_frequency(freq)

    # Voltage excitation one third of the way along the wire
    nec.voltage_excitation(wire_tag=1, segment_nr=int(n_seg / 3), voltage=1.0)

    return nec
예제 #10
0
def geometry_monopole_ground(freq_mhz, monopole_length, ground_wire_length, nr_segments):
    wire_radius = 0.005  # 0.5 mm

    nec = context_clean(nec_context())
    nec.set_extended_thin_wire_kernel(True)

    geo = geometry_clean(nec.get_geometry())

    bottom = np.array([0, 0, 0])
    top = np.array([0, 0, monopole_length])

    wire_tag = 1
    geo.wire(tag_id=wire_tag, nr_segments=nr_segments, src=bottom, dst=top, radius=wire_radius)

    add_ground_screen(geo, start_tag=2, length=ground_wire_length)

    # Everything is in brass
    nec.set_wire_conductivity(brass_conductivity)

    nec.geometry_complete(ground_plane=False)  # We added our own 'ground plane'

    nec.voltage_excitation(wire_tag=wire_tag, segment_nr=1, voltage=1.0)

    return nec