-
Notifications
You must be signed in to change notification settings - Fork 9
/
LPF_DGS_bowtie.py
executable file
·118 lines (108 loc) · 3.67 KB
/
LPF_DGS_bowtie.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
from openems import Box, Port, Polygon, Metal, arc
import numpy as np
def generate(
em,
sub,
mask,
min_width, # minimum copper width, typically design rule minimum
cutout_width, # width of ground plane cutouts
inductors,
capacitors,
z, # bottom of [air below, bottom metal, substrate, top metal, air above, lid]
port_length,
ms_width,
box_width,
half_fan_angle=0.25*np.pi):
em.mesh.AddLine('z', z[0]) # air above, below
em.mesh.AddLine('z', z[5])
em.mesh.AddLine('z', 0.5*(z[2]+z[3]))
em.mesh.AddLine('z', 0.25*(3*z[2]+z[3]))
em.mesh.AddLine('z', 0.25*(z[2]+3*z[3]))
em.mesh.AddLine('y', -0.5*min_width)
em.mesh.AddLine('y', 0.5*min_width)
box_length = 2.0*(np.sum(inductors) + capacitors[0] + 0.5e-3)
x0 = -0.5*box_length
x1 = x0 + port_length
x2 = x1 + ms_width
yb = 0.5*cutout_width
yo = -0.1e-3 # overlap
pec = Metal(em, 'pec')
# substrate
start = np.array([ 0.5*box_length, 0.5*box_width, z[2]])
stop = np.array([-0.5*box_length, -0.5*box_width, z[3]])
Box(sub, 1, start, stop)
# solder mask
if mask != None:
start[2] = z[3] + 25e-6
Box(mask, 1, start, stop)
# top copper polygon
points = np.zeros((6+10*len(inductors),2))
points[0] = [x1, 0.5*ms_width]
x = -np.sum(inductors)
points[1] = [x - 0.5*ms_width, 0.5*ms_width]
points[2:10] = arc(x, 0, capacitors[0],
0.5*np.pi+half_fan_angle,
0.5*np.pi-half_fan_angle,
npoints = 8)
points[10] = [x + 0.5*min_width, 0.5*min_width]
i = 11
x += inductors[0]
for j in range(1, len(inductors)):
points[i+0] = [x-0.5*min_width, 0.5*min_width]
points[i+1:i+9] = arc(x, 0, capacitors[j],
0.5*np.pi+half_fan_angle,
0.5*np.pi-half_fan_angle,
npoints = 8)
points[i+9] = [x+0.5*min_width, 0.5*min_width]
i += 10
x += inductors[j]
# center cap
points[i+0] = [-0.5*min_width, 0.5*min_width]
points[i+1:i+5] = arc(0, 0, capacitors[-1],
0.5*np.pi+half_fan_angle,
0.5*np.pi + 0.001, npoints = 4)
print(points)
points = np.concatenate((points, points[::-1]*[-1,1]))
points = np.concatenate((points, points[::-1]*[1,-1]))
Polygon(pec, points, z[3:5], priority=9, pcb_layer = 'F.Cu')
# ground plane
gpec = Metal(em, 'ground_plane')
points = np.zeros((2+6*len(inductors),2))
points[0] = [x0, 0.5*box_width]
points[1] = [x0, yo]
i = 2
x = -np.sum(inductors)
for l in inductors:
hmw = 0.5*min_width
xl = x + hmw
points[i+0] = [xl,yo]
points[i+1] = [xl,hmw]
xl = x + yb
points[i+2] = [xl,yb]
xl = x + l - yb
points[i+3] = [xl,yb]
xl = x + l - hmw
points[i+4] = [xl,hmw]
points[i+5] = [xl,yo]
i += 6
x += l
print("ground plane",points)
for ym in [1,-1]:
Polygon(gpec,
points = [1,ym] * np.concatenate((points, points[::-1]*[-1,1])),
priority = 9,
elevation = z[1:3],
pcb_layer = 'B.Cu',
is_custom_pad = True,
x=0,
y=ym*(yb+0.1e-3),
pad_name='3',
)
for (xm,padname) in [(-1,2),(1,1)]:
# main line ports
start = [x0*xm, -0.5*ms_width, z[3]]
stop = [x1*xm, 0.5*ms_width, z[4]]
Port(em, start, stop, direction='x', z=50)
# pads
start[0] = x2*xm
l1 = Box(pec, 9, start, stop, padname=padname)