Exemplo n.º 1
0
def idbpf(
        em,  # openems instance
        sub,  # substrate, define with Dielectric()
        z=[],  # z position, z[0] = sub bottom, z[1] = sub top, z[2] = foil top
        lidz=0,  # upper substrate thickness
        rl=[],  # length of resonator fingers
        rw=[],  # width of resonator fingers
        space=[],  # space between resonator fingers
        endmetal=True,  # add metal to filter ends
        portlength=0.2 * mm,  # length of the openems port
        feedwidth=0.85 * mm,  # width of the trace leaving the filter and port
        end_gap=0.3 * mm,  # space between the end of a resonator and ground
        via_radius=0.15 * mm,  # radius of the via drills
        via_padradius=0.3 * mm,  # radius of the via pads
        pcb_layer='F.Cu',  # Kicad layer
        mask=None,  # mask, define with Dielectric()
        mask_thickness=0,  # set to non-zero to enable solder mask over filter
):
    edge_space = 0.5 * mm
    pec = Metal(em, 'pec_filter')
    ring_ix = 0.5 * (np.max(rl) + end_gap)
    ring_ox = ring_ix + 2.0 * via_padradius
    via_z = [[z[0], z[1] + lidz], [z[1], z[2]]]
    # fingers
    y = -0.5 * space[-1:][0]
    mirror = False
    mirrorstring = ['', 'x']
    for i in range(len(space))[::-1]:  # reverse order
        x1 = 0.5 * (ring_ox + ring_ix)
        x2 = ring_ix - rl[i]
        y += space[i]
        start = [x1, y, z[1]]
        y += rw[i]
        stop = [x2, y, z[2]]
        box = Box(pec, 9, start, stop, padname='poly', pcb_layer=pcb_layer)
        box.mirror(mirrorstring[mirror])
        mirror = not mirror
        box2 = box.duplicate()
        box2.mirror('xy')
        if i == 0:
            continue
        v = Via(pec,
                priority=2,
                x=ring_ix + via_padradius,
                y=y - 0.5 * rw[i],
                z=via_z,
                drillradius=via_radius,
                padradius=via_padradius,
                padname='2')
        if not mirror:
            v.mirror('x')
        v.duplicate().mirror('xy')
    mirror = not mirror
    # ports
    y1 = y + feedwidth - rw[0]  # outer edge of feed
    y2 = y - rw[0]  # inner edge
    px = ring_ox
    start = [px, y2, z[1]]
    stop = [px - portlength, y1, z[2]]
    p = Port(em, start, stop, direction='x', z=50)
    p.mirror(mirrorstring[mirror])
    p2 = p.duplicate().mirror('xy')
    # feed lines
    start = [-ring_ix + rl[0], y1, z[1]]
    stop = [px - portlength, y2, z[2]]
    box = Box(pec, 9, start, stop, padname='1', pcb_layer=pcb_layer)
    box.mirror(mirrorstring[mirror])
    box2 = box.duplicate()
    box2.mirror('xy')
    box2.padname = '3'
    # substrate
    start = np.array([ring_ox, y1 + edge_space, z[0]])
    stop = mirror(start, 'xy')
    stop[2] = z[1] + lidz
    sub = Box(sub, 1, start, stop)
    # mask
    if mask_thickness > 0.0:
        start = np.array([ring_ox, y2, z[1]])
        stop = mirror(start, 'xy')
        stop[2] += mask_thickness
        Box(mask, 1, start, stop)
    # grounded end metal
    if endmetal:
        for m in ['', 'xy']:
            Box(pec,
                9,
                start=[ring_ix, -y2 + space[0], z[1]],
                stop=[ring_ix + 2.0 * via_padradius, y1 + edge_space, z[2]],
                padname='2',
                pcb_layer=pcb_layer,
                mirror=m)
Exemplo n.º 2
0
 def generate(self):
     ring_ix = 0.5 * (np.max(self.rl) + self.end_gap)
     ring_ox = ring_ix + 2.0 * self.via_padradius
     via_z = [[self.z[0], self.z[2]], [self.z[1], self.z[2]]]
     # fingers
     y = -0.5 * self.space[-1:][0]
     mirror = False
     mirrorstring = ['', 'x']
     for i in range(len(self.space))[::-1]:  # reverse order
         x1 = 0.5 * (ring_ox + ring_ix)
         x2 = ring_ix - self.rl[i]
         y += self.space[i]
         start = [x1, y, self.z[1]]
         y += self.rw[i]
         stop = [x2, y, self.z[2]]
         box = openems.Box(self.em,
                           None,
                           self.metal_name,
                           self.priority,
                           start,
                           stop,
                           padname='2')
         box.mirror(mirrorstring[mirror])
         mirror = not mirror
         box2 = box.duplicate()
         box2.mirror('xy')
         v = openems.Via(self.em,
                         None,
                         'pec',
                         2,
                         x=ring_ix + self.via_padradius,
                         y=y - 0.5 * self.rw[i],
                         z=via_z,
                         drillradius=self.via_radius,
                         padradius=self.via_padradius,
                         padname='2')
         v.mirror(mirrorstring[not mirror])
         v2 = v.duplicate()
         v2.mirror('xy')
     mirror = not mirror
     # ports
     y1 = y
     y -= 0.5 * self.rw[0]  # center of line
     y2 = y + 0.5 * self.feedwidth + self.ring_y_width  # y outside
     px = ring_ix - self.tapoffset
     py = y2 - self.portlength
     start = [px + 0.5 * self.feedwidth, y2, self.z[1]]
     stop = [px - 0.5 * self.feedwidth, py, self.z[2]]
     p = openems.Port(self.em, start, stop, direction='y', z=50)
     p.mirror(mirrorstring[mirror])
     p2 = p.duplicate().mirror('xy')
     # feed lines
     start = [px + 0.5 * self.feedwidth, py, self.z[1]]
     stop = [px - 0.5 * self.feedwidth, py - self.feedwidth, self.z[2]]
     box = openems.Box(self.em,
                       None,
                       self.metal_name,
                       self.priority,
                       start,
                       stop,
                       padname='1')
     box.mirror(mirrorstring[mirror])
     box2 = box.duplicate()
     box2.mirror('xy')
     box2.padname = '3'
     tie = openems.Polygon(self.em,
                           points=[[-px + 0.5 * self.feedwidth, py],
                                   [-px - 0.5 * self.feedwidth, py],
                                   [-px - 0.5 * self.feedwidth, y1],
                                   [-px + 0.5 * self.feedwidth, y1]],
                           elevation=[self.z[1], self.z[2]],
                           priority=9)
     tie2 = tie.duplicate().mirror('xy')
     # substrate
     start = np.array([ring_ox, y2, self.z[0]])
     stop = openems.mirror(start, 'xy')
     stop[2] = self.z[1]
     sub = openems.Box(self.em, None, 'sub', 1, start, stop)
     # mask
     if self.mask_thickness > 0.0:
         start = np.array([ring_ox, y2, self.z[1]])
         stop = openems.mirror(start, 'xy')
         stop[2] += self.mask_thickness
         openems.Box(self.em, None, 'mask', 1, start, stop)
Exemplo n.º 3
0
def idbpf(
    em, # openems instance
    sub, # substrate, define with openems.Dielectric()
    z = [], # z position, z[0] = sub bottom, z[1] = sub top, z[2] = foil top
    lidz = 0, # upper substrate thickness
    rl = [], # length of resonator fingers
    rw = [], # width of resonator fingers
    space = [], # space between resonator fingers
    endmetal = True, # add metal to filter ends
    portlength = 0.2*mm, # length of the openems port
    feedwidth = 0.85*mm, # width of the trace leaving the filter and port
    end_gap = 0.3*mm, # space between the end of a resonator and ground
    via_radius = 0.15*mm, # radius of the via drills
    via_padradius = 0.3*mm, # radius of the via pads
    pcb_layer = 'F.Cu', # Kicad layer
    mask = None, # mask, define with openems.Dielectric()
    mask_thickness = 0, # set to non-zero to enable solder mask over filter
):
    edge_space = 0.5*mm
    pec = openems.Metal(em, 'pec_filter')
    ring_ix = 0.5 * (np.max(rl) + end_gap)
    ring_ox = ring_ix + 2.0 * via_padradius
    via_z = [[z[0], z[1]+lidz], [z[1], z[2]]]
    # fingers
    y = -0.5*space[-1:][0]
    mirror = False
    mirrorstring = ['', 'x']
    for i in range(len(space))[::-1]: # reverse order
        x1 = 0.5 * (ring_ox + ring_ix)
        x2 = ring_ix - rl[i]
        y += space[i]
        start = [x1, y, z[1]];
        y += rw[i]
        stop  = [x2, y, z[2]];
        box = openems.Box(pec, 9, start, stop, padname = 'poly', pcb_layer=pcb_layer)
        box.mirror(mirrorstring[mirror])
        mirror = not mirror
        box2 = box.duplicate()
        box2.mirror('xy')
        if i == 0:
            continue
        v = openems.Via(
            pec, priority=2,
            x=ring_ix+via_padradius,
            y=y-0.5*rw[i], z=via_z,
            drillradius=via_radius,
            padradius=via_padradius, padname='2')
        if not mirror:
            v.mirror('x')
        v.duplicate().mirror('xy')
    mirror = not mirror
    # ports
    y1 = y + feedwidth - rw[0] # outer edge of feed
    y2 = y - rw[0] # inner edge
    px = ring_ox
    start = [px, y2, z[1]]
    stop  = [px - portlength, y1, z[2]]
    p = openems.Port(em, start, stop, direction='x', z=50)
    p.mirror(mirrorstring[mirror])
    p2 = p.duplicate().mirror('xy')
    # feed lines
    start = [-ring_ix + rl[0], y1, z[1]]
    stop  = [px - portlength, y2, z[2]]
    box = openems.Box(pec, 9, start, stop, padname = '1', pcb_layer=pcb_layer)
    box.mirror(mirrorstring[mirror])
    box2 = box.duplicate()
    box2.mirror('xy')
    box2.padname = '3'
    # substrate
    start = np.array([ring_ox, y1 + edge_space, z[0]])
    stop  = openems.mirror(start, 'xy')
    stop[2] = z[1]+lidz
    sub = openems.Box(sub, 1, start, stop)
    # mask
    if mask_thickness > 0.0:
        start = np.array([ring_ox, y2, z[1]])
        stop  = openems.mirror(start, 'xy')
        stop[2] += mask_thickness
        openems.Box(mask, 1, start, stop)
    # grounded end metal
    if endmetal:
        em1 = openems.Box(
            pec, 9,
            start = [ring_ix, -y2+space[0], z[1]],
            stop = [ring_ix + 2.0*via_padradius, y1+edge_space, z[2]],
            padname = '2', pcb_layer=pcb_layer)
        em1.duplicate().mirror('xy')
Exemplo n.º 4
0
box_width = 4 * mm / 4
ms_width = 1.1 * mm / 4
notch = 0.9 * mm / 4
# dimensions Z
substrate_bottom = 0.0
substrate_top = substrate_bottom + substrate_thickness
foil_top = substrate_top + foil_thickness
em.mesh.add_z(foil_top + ms_air_above)

from math import sqrt
em.resolution = c / (f_max * sqrt(3.0)) / 130.0
#resolution of lambda/50

# substrate
start = np.array([0.5 * box_length, 0.5 * box_width, substrate_bottom])
stop = openems.mirror(start, 'xy') + np.array([0, 0, substrate_top])
em.add_box('sub', 'is680', 1, start, stop)

# line
start = np.array(
    [-0.5 * box_length + port_length, 0.5 * ms_width, substrate_top])
stop = np.array([0.5 * ms_width - notch, -0.5 * ms_width, foil_top])
em.add_box('line', 'copper', 1, start, stop)

# ground via
start = np.array([1.55 * mm, 0.5 * ms_width + 0.15 * mm, foil_top])
stop = np.array([0.5 * box_length, 0.5 * box_width, 0.0])
#em.add_box('via', 'copper', 10, start, stop)
start = np.array(
    [-0.5 * ms_width - 0.15 * mm, 0.5 * ms_width + 0.15 * mm, foil_top])
stop = np.array([-0.5 * box_length, 0.5 * box_width, 0.0])
Exemplo n.º 5
0
 def generate(self):
     # fingers
     y = -0.5 * self.space[-1:][0]
     mirror = False
     mirrorstring = ['', 'x']
     for i in range(len(self.space))[::-1]:  # reverse order
         x1 = 0.5 * (self.ring_ox + self.ring_ix)
         x2 = self.ring_ix - self.rl[i]
         y += self.space[i]
         start = [x1, y, self.z[1]]
         y += self.rw[i]
         stop = [x2, y, self.z[2]]
         box = openems.Box(self.em,
                           None,
                           self.metal_name,
                           self.priority,
                           start,
                           stop,
                           padname='2')
         box.mirror(mirrorstring[mirror])
         mirror = not mirror
         box2 = box.duplicate()
         box2.mirror('xy')
         if i == 0:
             box.padname = '1'
             box2.padname = '3'
         box.offset(self.offset)
         box2.offset(self.offset)
     # feed lines
     mirror = not mirror
     y -= 0.5 * self.rw[0]  # center of line
     start = [self.ring_ix, y + 0.5 * self.feedwidth, self.z[1]]
     stop = [
         self.ring_ox - self.portlength, y - 0.5 * self.feedwidth, self.z[2]
     ]
     box = openems.Box(self.em,
                       None,
                       self.metal_name,
                       self.priority,
                       start,
                       stop,
                       padname='1')
     box.mirror(mirrorstring[mirror])
     box2 = box.duplicate()
     box2.mirror('xy')
     box2.padname = '3'
     box.offset(self.offset)
     box2.offset(self.offset)
     # ports
     start = [self.ring_ox, y + 0.5 * self.feedwidth, self.z[1]]
     stop = [
         self.ring_ox - self.portlength, y - 0.5 * self.feedwidth, self.z[2]
     ]
     p = openems.Port(self.em, start, stop, direction='x', z=50)
     p.mirror(mirrorstring[mirror])
     p2 = p.duplicate().mirror('xy')
     p.offset(self.offset)
     p2.offset(self.offset)
     # metal ring (sides)
     y1 = y + 0.5 * self.feedwidth + self.feedgap
     y2 = y1 + self.ring_y_width
     start = [self.ring_ox, y1, self.z[1]]
     stop = [-1.0 * self.ring_ox, y2, self.z[2]]
     box = openems.Box(self.em,
                       None,
                       self.metal_name,
                       self.priority,
                       start,
                       stop,
                       padname='2')
     box.mirror(mirrorstring[mirror])
     box2 = box.duplicate().mirror('xy')
     box.offset(self.offset)
     box2.offset(self.offset)
     # metal ring (sides)
     y3 = y - (0.5 * self.feedwidth + self.feedgap)
     start = [self.ring_ox, y3, self.z[1]]
     stop = [self.ring_ix, -1.0 * y2, self.z[2]]
     box = openems.Box(self.em,
                       None,
                       self.metal_name,
                       self.priority,
                       start,
                       stop,
                       padname='2')
     box.mirror(mirrorstring[mirror])
     box2 = box.duplicate().mirror('xy')
     box.offset(self.offset)
     box2.offset(self.offset)
     # metal - inner ends
     if self.inner_metal:
         for z in self.inner_metal_z:
             start = [self.ring_ox, y1, z[0]]
             stop = [-1.0 * self.ring_ox, y2, z[1]]
             box = openems.Box(self.em,
                               None,
                               self.metal_name,
                               self.priority,
                               start,
                               stop,
                               padname=None)
             box2 = box.duplicate().mirror('xy')
             box.offset(self.offset)
             box2.offset(self.offset)
             start = [self.ring_ox, y2, z[0]]
             stop = [self.ring_ix, -1.0 * y2, z[1]]
             box = openems.Box(self.em,
                               None,
                               self.metal_name,
                               self.priority,
                               start,
                               stop,
                               padname=None)
             box2 = box.duplicate().mirror('xy')
             box.offset(self.offset)
             box2.offset(self.offset)
     # substrate
     start = np.array([self.ring_ox, y2, self.z[0]])
     stop = openems.mirror(start, 'xy')
     stop[2] = self.z[1]
     sub = openems.Box(self.em, None, 'sub', 1, start, stop)
     sub.offset(self.offset)
     # mask
     if self.mask_thickness > 0.0:
         start = np.array([self.ring_ox, y2, self.z[1]])
         stop = openems.mirror(start, 'xy')
         stop[2] += self.mask_thickness
         openems.Box(self.em, None, 'mask', 1, start, stop)
     # vias (along y)
     via_z = [[self.z[0], self.z[2]]]  #, [self.z[1], self.z[2]]]
     y_start = y3 - self.via_padradius
     y_stop = -1.0 * y1 - self.via_padradius
     x = self.ring_ix + self.via_padradius
     if not self.via_radius:
         return
     n_via = 0
     n_vias = 1 + np.floor(
         np.abs(y_start - y_stop) / (2.0 * self.via_padradius))
     for y in np.linspace(y_start, y_stop, n_vias):
         v = openems.Via(self.em,
                         None,
                         'pec',
                         2,
                         x=x,
                         y=y,
                         z=via_z,
                         drillradius=self.via_radius,
                         padradius=self.via_padradius,
                         padname='2')
         v.mirror(mirrorstring[mirror])
         v2 = v.duplicate().mirror('xy')
         n_via += 2
         v.offset(self.offset)
         v2.offset(self.offset)
     # vias (along x)
     y = y_stop
     x_start = self.ring_ix + self.via_padradius
     x_stop = self.via_padradius - self.ring_ox
     n_vias = 1 + np.floor(
         np.abs(x_start - x_stop) / (2.0 * self.via_padradius))
     for x in np.linspace(x_start, x_stop, n_vias)[1:]:
         v = openems.Via(self.em,
                         None,
                         'pec',
                         2,
                         x=x,
                         y=y,
                         z=via_z,
                         drillradius=self.via_radius,
                         padradius=self.via_padradius,
                         padname='2')
         v.mirror(mirrorstring[mirror])
         v2 = v.duplicate().mirror('xy')
         n_via += 2
         v.offset(self.offset)
         v2.offset(self.offset)
Exemplo n.º 6
0
    def generate(self):
        pec = openems.Metal(self.em, 'pec_filter')
        ring_ix = 0.5 * (np.max(self.rl) + self.end_gap)
        ring_ox = ring_ix + 2.0 * self.via_padradius
        via_z = [[self.z[0], self.z[1] + self.lidz], [self.z[1], self.z[2]]]
        # fingers
        y = -0.5 * self.space[-1:][0]
        mirror = False
        mirrorstring = ['', 'x']
        for i in range(len(self.space))[::-1]:  # reverse order
            x1 = 0.5 * (ring_ox + ring_ix)
            x2 = ring_ix - self.rl[i]
            y += self.space[i]
            start = [x1, y, self.z[1]]
            y += self.rw[i]
            stop = [x2, y, self.z[2]]
            box = openems.Box(pec,
                              9,
                              start,
                              stop,
                              padname='poly',
                              pcb_layer=self.pcb_layer)
            box.mirror(mirrorstring[mirror])
            mirror = not mirror
            box2 = box.duplicate()
            box2.mirror('xy')
            v = openems.Via(pec,
                            priority=2,
                            x=ring_ix + self.via_padradius,
                            y=y - 0.5 * self.rw[i],
                            z=via_z,
                            drillradius=self.via_radius,
                            padradius=self.via_padradius,
                            padname='2')
            if not mirror:
                v.mirror('x')
            v.duplicate().mirror('xy')
            if self.endmetal:
                v.duplicate().mirror('y')
                v.duplicate().mirror('x')

        mirror = not mirror
        # ports
        y1 = y
        y -= 0.5 * self.rw[0]  # center of line
        y2 = y + 0.5 * self.feedwidth + self.ring_y_width  # y outside
        px = ring_ix - self.tapoffset
        py = y2 - self.portlength
        start = [px + 0.5 * self.feedwidth, y2, self.z[1]]
        stop = [px - 0.5 * self.feedwidth, py, self.z[2]]
        p = openems.Port(self.em, start, stop, direction='y', z=50)
        p.mirror(mirrorstring[mirror])
        p2 = p.duplicate().mirror('xy')
        # feed lines
        start = [px + 0.5 * self.feedwidth, py, self.z[1]]
        stop = [px - 0.5 * self.feedwidth, y - 0.5 * self.rw[0], self.z[2]]
        box = openems.Box(pec,
                          9,
                          start,
                          stop,
                          padname='1',
                          pcb_layer=self.pcb_layer)
        box.mirror(mirrorstring[mirror])
        box2 = box.duplicate()
        box2.mirror('xy')
        box2.padname = '3'
        # substrate
        start = np.array([ring_ox, y2, self.z[0]])
        stop = openems.mirror(start, 'xy')
        stop[2] = self.z[1] + self.lidz
        sub = openems.Box(self.sub, 1, start, stop)
        # mask
        if self.mask_thickness > 0.0:
            start = np.array([ring_ox, y2, self.z[1]])
            stop = openems.mirror(start, 'xy')
            stop[2] += self.mask_thickness
            openems.Box(mask, 1, start, stop)
        # grounded end metal
        if self.endmetal:
            em1 = openems.Box(
                pec,
                9,
                start=[ring_ix, y2, self.z[1]],
                stop=[ring_ix + 2.0 * self.via_padradius, -y2, self.z[2]],
                padname='2',
                pcb_layer=self.pcb_layer)
            em1.duplicate().mirror('x')
Exemplo n.º 7
0
def idbpf(em, # openems instance
          sub, # substrate, define with openems.Dielectric()
          lidz = 0.0,
          z = [], # z position, z[0] = sub bottom, z[1] = sub top, z[2] = foil top
          space = [], # space between resonator fingers
          rl = [], # length of resonator fingers
          rw = [], # width of resonator fingers
          portlength = 0.2*mm, # length of the openems port
          feedwidth = 0.85*mm, # width of the trace leaving the filter and port
          tapoffset = 1.0*mm, # offset of tap from end of resonator
          end_gap = 0.3*mm, # space between the end of a resonator and ground
          via_radius = 0.15*mm, # radius of the via drills
          via_padradius = 0.3*mm, # radius of the via pads
          pcb_layer = 'F.Cu', # Kicad layer
          mask_thickness = 0, # set to non-zero to enable solder mask over filter
          mask = None, # mask, define with openems.Dielectric()
          endmetal = True, # add metal to filter ends
):
    pec = openems.Metal(em, 'pec_filter')
    ring_y_width = via_padradius * 2.0
    ring_ix = 0.5 * (np.max(rl) + end_gap)
    ring_ox = ring_ix + 2.0 * via_padradius
    via_z = [[z[0], z[1]+lidz], [z[1], z[2]]]
    # fingers
    y = -0.5*space[-1:][0]
    mirror = np.array([1,1,1])
    if len(space) % 2 == 0:
        mirror[0] *= -1
    for i in range(len(space))[::-1]: # reverse order
        x1 = 0.5 * (ring_ox + ring_ix)
        x2 = ring_ix - rl[i]
        y += space[i]
        start = [x1, y, z[1]];
        y += rw[i]
        stop  = [x2, y, z[2]];
        for m in [np.array([1,1,1]),np.array([-1,-1,1])]:
            m *= mirror
            openems.Box(pec, 9, start*m, stop*m, padname = 'poly', pcb_layer=pcb_layer)
            openems.Via(pec, priority=2,
                        x=m[0]*(ring_ix+via_padradius),
                        y=m[1]*(y-0.5*rw[i]),
                        z=via_z,
                        drillradius=via_radius,
                        padradius=via_padradius, padname='2')
        mirror[0] *= -1

        if endmetal:
            v.duplicate().mirror('y')
            v.duplicate().mirror('x')

    mirror *= [-1,1,1]
    # ports
    y1 = y
    y -= 0.5*rw[0] # center of line
    y2 = y + 0.5*feedwidth + ring_y_width # y outside
    px = ring_ix - tapoffset
    py = y2 - portlength
    for m in [-1,1]:
        start = [m*(px + 0.5*feedwidth), m*y2, z[1]]
        stop  = [m*(px - 0.5*feedwidth), m*py, z[2]]
        openems.Port(em, start, stop, direction='y', z=50)
        # feed lines
        start = [m*(px + 0.5*feedwidth), m*py, z[1]]
        stop  = [m*(px - 0.5*feedwidth), m*(y-0.5*rw[0]), z[2]]
        openems.Box(pec, 9, start, stop, padname = '1' if m==1 else '3',
                    pcb_layer=pcb_layer)
    # substrate
    start = np.array([ring_ox, y2, z[0]])
    stop  = openems.mirror(start, 'xy')
    stop[2] = z[1]+lidz
    sub = openems.Box(sub, 1, start, stop)
    # mask
    if mask_thickness > 0.0:
        start = np.array([ring_ox, y2, z[1]])
        stop  = openems.mirror(start, 'xy')
        stop[2] += mask_thickness
        openems.Box(mask, 1, start, stop)
    # grounded end metal
    if endmetal:
        for xm in [-1,1]:
            em1 = openems.Box(pec, 9, start = [xm*ring_ix, y2, z[1]],
                              stop = [xm*(ring_ix + 2.0*via_padradius), -y2, z[2]],
                              padname = '2', pcb_layer=pcb_layer)
Exemplo n.º 8
0
    def generate(self):
        pec = openems.Metal(self.em, 'pec_filter')
        ring_ix = 0.5 * (np.max(self.rl) + self.end_gap)
        ring_ox = ring_ix + 2.0 * self.via_padradius
        via_z = [[self.z[0], self.z[1]+self.lidz], [self.z[1], self.z[2]]]
        # fingers
        y = -0.5*self.space[-1:][0]
        mirror = False
        mirrorstring = ['', 'x']
        for i in range(len(self.space))[::-1]: # reverse order
            x1 = 0.5 * (ring_ox + ring_ix)
            x2 = ring_ix - self.rl[i]
            y += self.space[i]
            start = [x1, y, self.z[1]];
            y += self.rw[i]
            stop  = [x2, y, self.z[2]];
            box = openems.Box(pec, 9, start, stop, padname = 'poly', pcb_layer=self.pcb_layer)
            box.mirror(mirrorstring[mirror])
            mirror = not mirror
            box2 = box.duplicate()
            box2.mirror('xy')
            v = openems.Via(pec, priority=2,
                            x=ring_ix+self.via_padradius,
                            y=y-0.5*self.rw[i], z=via_z,
                            drillradius=self.via_radius,
                            padradius=self.via_padradius, padname='2')
            if not mirror:
                v.mirror('x')
            v.duplicate().mirror('xy')
            if self.endmetal:
                v.duplicate().mirror('y')
                v.duplicate().mirror('x')

        mirror = not mirror
        # ports
        y1 = y
        y -= 0.5*self.rw[0] # center of line
        y2 = y + 0.5*self.feedwidth + self.ring_y_width # y outside
        px = ring_ix - self.tapoffset
        py = y2 - self.portlength
        start = [px + 0.5*self.feedwidth, y2, self.z[1]]
        stop  = [px - 0.5*self.feedwidth, py, self.z[2]]
        p = openems.Port(self.em, start, stop, direction='y', z=50)
        p.mirror(mirrorstring[mirror])
        p2 = p.duplicate().mirror('xy')
        # feed lines
        start = [px + 0.5*self.feedwidth, py, self.z[1]]
        stop  = [px - 0.5*self.feedwidth, y-0.5*self.rw[0], self.z[2]]
        box = openems.Box(pec, 9, start, stop, padname = '1', pcb_layer=self.pcb_layer)
        box.mirror(mirrorstring[mirror])
        box2 = box.duplicate()
        box2.mirror('xy')
        box2.padname = '3'
        # substrate
        start = np.array([ring_ox, y2, self.z[0]])
        stop  = openems.mirror(start, 'xy')
        stop[2] = self.z[1]+self.lidz
        sub = openems.Box(self.sub, 1, start, stop)
        # mask
        if self.mask_thickness > 0.0:
            start = np.array([ring_ox, y2, self.z[1]])
            stop  = openems.mirror(start, 'xy')
            stop[2] += self.mask_thickness
            openems.Box(mask, 1, start, stop)
        # grounded end metal
        if self.endmetal:
            em1 = openems.Box(pec, 9, start = [ring_ix, y2, self.z[1]],
                              stop = [ring_ix + 2.0*self.via_padradius, -y2, self.z[2]],
                              padname = '2', pcb_layer=self.pcb_layer)
            em1.duplicate().mirror('x')
Exemplo n.º 9
0
ms_air_above = 0.36*mm
port_length = 0.1*mm
box_length = 10*mm
box_width = 1*mm
ms_width = 0.2*mm
# dimensions Z
substrate_bottom = 0.0
substrate_top = substrate_bottom + substrate_thickness
foil_top = substrate_top + foil_thickness

from math import sqrt
em.resolution = c/(em.fmax*sqrt(3.0))/100.0

# substrate
start = np.array([0.5*box_length, 0.5*box_width, substrate_bottom])
stop  = openems.mirror(start, 'xy') + np.array([0, 0, substrate_top+ms_air_above])
sub.AddBox(start, stop, 1);

# line
start = np.array([0.5*box_length-port_length, 0.5*ms_width, substrate_top])
stop  = np.array([0, -0.5*ms_width, foil_top])
for m in [[1,1,1], [-1,1,1]]:
    pec.AddBox(start*m, stop*m, 2)

# ports
start = np.array([-0.5*box_length, ms_width/2.0, substrate_top])
stop  = np.array([-0.5*box_length + port_length, ms_width/-2.0, foil_top])
for m in [[1,1,1], [-1,-1,1]]:
    openems.Port(em, start*m, stop*m, direction='x', z=50)

em.write_kicad(em.name)