Exemplo n.º 1
0
        def _generate_elements(self, elems):

            shape_rect = i3.ShapeRectangle(box_size=(self.length, self.width))
            elems += i3.Boundary(layer=i3.TECH.PPLAYER.WG.CORE,
                                 shape=shape_rect)

            return elems
        def _generate_instances(self, insts):

            sr1 = i3.ShapeCircle(center=(0.0, 0.0),
                                 radius=self.radius)  #, line_width = 200)

            sr2 = i3.ShapeCircle(
                center=(0.0, 0.0),
                radius=self.radius -
                self.vacuum_channel_circular)  #, line_width = 200)

            #Rectangles
            sc1 = i3.ShapeRectangle(
                center=(self.cInp.x - self.radius, -self.radius),
                box_size=(self.radius * 2, self.radius * 2 +
                          100))  #100 has to be linked to channel input width))
            #Define the boundaries for shapes
            br1 = i3.Boundary(layer=self.layer, shape=sr1)
            br2 = i3.Boundary(layer=self.layer, shape=sr2)

            bc1 = i3.Boundary(layer=self.layer, shape=sc1)

            #Substruct boundaries and add to the element list
            b_sub = br1 - br2

            s = i3.Structure(elements=b_sub)

            b_sub = b_sub[0] - bc1

            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)

            #Input channel - segment
            channel1 = microfluidics.Channel(
                trace_template=self.cell.channel_template)
            channel1_lo = channel1.Layout(
                shape=[(0, 0),
                       (0, self.inlet_channel_length +
                        self.vacuum_channel_circular * 0.5)])
            insts += i3.SRef(channel1_lo,
                             position=(0, self.radius -
                                       self.vacuum_channel_circular * 0.5),
                             transformation=i3.Rotation((0.0, 0.0), 0.0))

            return insts
        def _generate_instances(self, insts):
            # First create shapes
            # Break the channel that contain two obstacles into three segments
            # Obstacles need to intersect these three segments
            #  Obs 1. Segment 1:2,   Obs 2 Segment 2:3
            #define points will be helpful to make schematic
            p1 = (self.cInp.x + 0.0, self.cInp.y + 0.0)
            p2 = ((self.gap_btw_barriers + self.obstacle_trap_length) * 0.5,
                  0.0)
            p3 = ((self.gap_btw_barriers + self.obstacle_trap_length) * 0.5,
                  self.channel_trap_width)
            p4 = (0.0, self.channel_trap_width)
            p5 = ((self.gap_btw_barriers + self.obstacle_trap_length) * 1.5,
                  0.0)
            p6 = ((self.gap_btw_barriers + self.obstacle_trap_length) * 2, 0.0)
            p7 = ((self.gap_btw_barriers + self.obstacle_trap_length) * 2,
                  self.channel_trap_width)
            p8 = ((self.gap_btw_barriers + self.obstacle_trap_length) * 1.5,
                  self.channel_trap_width)

            sr1 = i3.Shape(points=[p1, p2, p3, p4], closed=True)
            sr2 = i3.Shape(points=[p2, p5, p8, p3], closed=True)
            sr3 = i3.Shape(points=[p5, p6, p7, p8], closed=True)

            #Internal holes as Circles  #It is needed to define position of SC2 as a function of perpendicular GAP
            #sc1 = i3.ShapeCircle(center = (self.cInp.x+(self.gap_btw_barriers+self.obstacle_trap_length)*0.65, 0.0), radius = (self.obstacle_trap_width))
            #sc2 = i3.ShapeCircle(center = (self.cInp.x+(self.gap_btw_barriers+self.obstacle_trap_length)*1.35,self.cInp.y+self.channel_trap_width), radius = (self.obstacle_trap_width))

            #Internal holes as Rectangles
            sc1 = i3.ShapeRectangle(center=(
                self.cInp.x +
                (self.gap_btw_barriers + self.obstacle_trap_length) * 0.5,
                self.cInp.y + self.obstacle_trap_width * 0.5),
                                    box_size=(self.obstacle_trap_length,
                                              self.obstacle_trap_width))
            sc2 = i3.ShapeRectangle(center=(
                self.cInp.x +
                (self.gap_btw_barriers + self.obstacle_trap_length) * 1.5,
                self.cInp.y + self.channel_trap_width -
                self.obstacle_trap_width * 0.5),
                                    box_size=(self.obstacle_trap_length,
                                              self.obstacle_trap_width))

            #Define the boundaries for shapes
            br1 = i3.Boundary(layer=self.layer, shape=sr1)
            br2 = i3.Boundary(layer=self.layer, shape=sr2)
            br3 = i3.Boundary(layer=self.layer, shape=sr3)

            bc1 = i3.Boundary(layer=self.layer, shape=sc1)
            bc2 = i3.Boundary(layer=self.layer, shape=sc2)

            #Substruct boundaries and add to the element list
            b_sub = br1 - bc1

            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)

            b_sub = br2 - bc1
            b_sub = b_sub[0] - bc2

            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)

            b_sub = br3 - bc2

            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)

            return insts
        def _generate_instances(self, insts):
            # First create shapes
            # Break the block containig the feature into two segments
            # Block need to intersect these two segments
            #  Feature 1. Segment 1:2
            #define points will be helpful to make schematic
            p1 = ((self.feature_width + self.gap_horiz + self.vacuum_width) *
                  (-0.5), 0.0)
            p2 = (self.cInp.x + 0.0, self.cInp.y + 0.0)
            p3 = (self.cInp.x, self.feature_height * 0.5 + self.vacuum_width)
            p4 = ((self.feature_width + self.gap_horiz + self.vacuum_width) *
                  (-0.5), self.feature_height * 0.5 + self.vacuum_width)
            p5 = ((self.feature_width + self.gap_horiz + self.vacuum_width) *
                  (0.5), 0.0)
            p6 = ((self.feature_width + self.gap_horiz + self.vacuum_width) *
                  (0.5), self.feature_height * 0.5 + self.vacuum_width)
            p7 = ((self.feature_width + self.gap_horiz + self.vacuum_width) *
                  (-0.5), -(self.feature_height * 0.5 + self.vacuum_width))
            p8 = (self.cInp.x,
                  -(self.feature_height * 0.5 + self.vacuum_width))
            p9 = ((self.feature_width + self.gap_horiz + self.vacuum_width) *
                  (0.5), -(self.feature_height * 0.5 + self.vacuum_width))

            sr1 = i3.Shape(points=[p1, p2, p3, p4], closed=True)
            sr2 = i3.Shape(points=[p2, p5, p6, p3], closed=True)
            sr3 = i3.Shape(points=[p7, p8, p2, p1], closed=True)
            sr4 = i3.Shape(points=[p8, p9, p5, p2], closed=True)

            #Internal holes as Circles  #It is needed to define position of SC2 as a function of perpendicular GAP
            #sc1 = i3.ShapeCircle(center = (self.cInp.x+(self.gap_btw_barriers+self.obstacle_trap_length)*0.65, 0.0), radius = (self.obstacle_trap_width))
            #sc2 = i3.ShapeCircle(center = (self.cInp.x+(self.gap_btw_barriers+self.obstacle_trap_length)*1.35,self.cInp.y+self.channel_trap_width), radius = (self.obstacle_trap_width))

            #Internal holes as Rectangles
            sc1 = i3.ShapeRectangle(
                center=(self.cInp.x, self.cInp.y),
                box_size=(self.feature_width + self.gap_horiz,
                          self.feature_height + self.gap_vertical))

            #Define the boundaries for shapes
            br1 = i3.Boundary(layer=self.layer, shape=sr1)
            br2 = i3.Boundary(layer=self.layer, shape=sr2)
            br3 = i3.Boundary(layer=self.layer, shape=sr3)
            br4 = i3.Boundary(layer=self.layer, shape=sr4)

            bc1 = i3.Boundary(layer=self.layer, shape=sc1)

            #Substruct boundaries and add to the element list
            b_sub = br1 - bc1

            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)

            b_sub = br2 - bc1
            b_sub = b_sub[0] - bc1

            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)

            b_sub = br3 - bc1

            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)

            b_sub = br4 - bc1

            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)
            return insts
        def _generate_instances(self, insts):
            width = 200.0
            p1 = (-self.radius, -self.radius)  #near cylinders
            p2 = (-self.radius, -2 * self.radius)  #bottom
            p3 = (2 * self.radius, -2 * self.radius)  #right
            p4 = (2 * self.radius, 0)  #top
            p5 = (2 * self.radius + 500, 0)  #out
            pax = (-width * 0.5 * math.cos(45), width * 0.5 * math.sin(45))

            #generate a circle
            sr1 = i3.ShapeCircle(center=(0.0, 0.0),
                                 radius=self.radius)  #, line_width = 200)
            br1 = i3.Boundary(layer=self.layer, shape=sr1)
            #s= i3.Structure(elements = br1)

            #rectangle
            sc1 = i3.ShapeRectangle(center=p1,
                                    box_size=(self.radius * 4,
                                              self.radius * 0.25))
            bc1 = i3.Boundary(layer=self.layer,
                              shape=sc1,
                              transformation=i3.Rotation((0, 0),
                                                         -45.0))  # was -35
            #Substruct boundaries and add to the element list
            b_sub = br1 - bc1
            s = i3.Structure(elements=b_sub)
            insts += i3.SRef(s)

            #Input channel - segment
            channel1 = microfluidics.Channel(
                trace_template=self.cell.channel_template)
            #channel_template = microfluidics.ShortChannelTemplate().Layout(width=200.0)
            channel1_lo = channel1.Layout(shape=[(self.inlet_channel_length +
                                                  self.offset_matching * 0.5,
                                                  0), (0, 0)])
            insts += i3.SRef(
                channel1_lo,
                position=(-(self.inlet_channel_length + self.radius), 0),
                transformation=i3.Rotation((0.0, 0.0), 0.0))

            #############################routing

            from ipkiss.plugins.photonics.routing.manhattan import RouteManhattan

            channel_4 = microfluidics.RoundedChannel(
                trace_template=self.cell.channel_template)  # used for routing
            channel_4_layout = channel_4.Layout()

            import operator
            p1Array = tuple(map(operator.add, p1, pax))

            print 'p1: ', p1
            print 'pax: ', pax
            print 'p1Array: ', p1Array

            #obstacles
            insts += i3.SRef(reference=self.obstacles,
                             position=p1Array,
                             transformation=i3.Rotation((0, 0), -45.0))

            in_port_1 = microfluidics.FluidicPort(
                position=p1, trace_template=self.cell.channel_template)
            out_port_1 = microfluidics.FluidicPort(
                trace_template=self.cell.channel_template)
            in_port_1.angle_deg = 225
            out_port_1.angle_deg = 45

            in_port_2 = microfluidics.FluidicPort(
                position=p2, trace_template=self.cell.channel_template)
            in_port_2.angle_deg = 225
            channel_4_layout.set(bend_radius=150.0,
                                 shape=RouteManhattan(input_port=in_port_2,
                                                      points=[p2, p3, p4, p5],
                                                      output_port=out_port_1,
                                                      bend_radius=300.0))
            insts += i3.SRef(name="Route_1", reference=channel_4)
            ##############################routing

            from ipkiss3.pcell.routing import RouteToAngle

            # create the route object
            channel_1 = microfluidics.RoundedChannel(
                trace_template=self.cell.channel_template)  # used for routing
            channel_1_layout = channel_1.Layout()
            channel_1_layout.set(bend_radius=50.0,
                                 shape=RouteToAngle(input_port=in_port_1,
                                                    start_straight=300,
                                                    end_straight=300,
                                                    angle_out=45))
            #insts += i3.SRef(name = "Route_2", reference = channel_1)

            from ipkiss3.pcell.routing import RouteToEastAtMaxY, RouteToEastAtMinY, RouteToEastAtY

            # create the route object
            input_portx = i3.OpticalPort(name="in",
                                         position=(-self.radius, -self.radius),
                                         angle_deg=225.0)
            channel_x = microfluidics.RoundedChannel(
                trace_template=self.cell.channel_template)  # used for routing
            channel_x_layout = channel_x.Layout()
            channel_x_layout.set(bend_radius=150.0,
                                 shape=RouteToEastAtY(input_port=input_portx,
                                                      start_straight=200,
                                                      end_straight=200,
                                                      y_position=-2 *
                                                      self.radius))
            insts += i3.SRef(name="Route_x", reference=channel_x)

            return insts