def series(oEditor, cpw_filter, x0=0, y0=0, var_x=0.5, var_y=0.5, l2=0.02, l3=0.3, d=0.001, W=0.003, W1=0.001, W2=0.002, n=8): l1 = (var_y - l2 - l3 - l2 - 2 * d) / 2 rect = hfss.create_rectangle(oEditor, i_s(x0 - var_x / 2), i_s(y0), 0, i_s(var_x), i_s(var_y)) cl = [ hfss.create_rectangle(oEditor, i_s(x0 - W / 2), i_s(y0), 0, i_s(W), i_s(l1)), hfss.create_rectangle(oEditor, i_s(x0 - (n - 1 / 2) * W1 - (n - 1) * W2), i_s(y0 + l1), 0, i_s((2 * n - 1) * W1 + 2 * (n - 1) * W2), i_s(l2)) ] for i in range(n): cl.append( hfss.create_rectangle( oEditor, i_s(x0 - (n - 1 / 2) * W1 - (n - 1) * W2 + i * 2 * (W1 + W2)), i_s(y0 + l1 + l2), 0, i_s(W1), i_s(d + l3))) for i in range(n - 1): cl.append( hfss.create_rectangle( oEditor, i_s(x0 - (n - 1 / 2) * W1 - (n - 1) * W2 + i * 2 * (W1 + W2) + (W1 + W2)), i_s(y0 + l1 + l2 + d), 0, i_s(W1), i_s(d + l3))) cl.append( hfss.create_rectangle(oEditor, i_s(x0 - (n - 1 / 2) * W1 - (n - 1) * W2), i_s(y0 + l1 + l2 + l3 + 2 * d), 0, i_s((2 * n - 1) * W1 + 2 * (n - 1) * W2), i_s(l2))) cl.append( hfss.create_rectangle(oEditor, i_s(x0 - W / 2), i_s(y0 + l1 + l2 + l3 + l2 + 2 * d), 0, i_s(W), i_s(l1))) finger = hfss.unite(oEditor, cl) cpw_filter = hfss.subtract(oEditor, [cpw_filter], [rect]) cpw_filter = hfss.unite(oEditor, [cpw_filter, finger]) return cpw_filter
def shunt(oEditor, cpw_filter, x0=0, y0=0, var_x=0.5, l2=0.02, l3=0.447, d=0.001, W=0.003, W1=0.0011, W2=0.0017, n=8): l1 = (var_x - l2 - l3 - l2 - 2 * d) / 2 cl = [ hfss.create_rectangle(oEditor, i_s(x0), i_s(y0 - W / 2), 0, i_s(l1), i_s(W)), hfss.create_rectangle(oEditor, i_s(x0 + l1), i_s(y0 - (n - 1 / 2) * W1 - (n - 1) * W2), 0, i_s(l2), i_s((2 * n - 1) * W1 + 2 * (n - 1) * W2)) ] for i in range(n): cl.append( hfss.create_rectangle( oEditor, i_s(x0 + l1 + l2), i_s(y0 - (n - 1 / 2) * W1 - (n - 1) * W2 + i * 2 * (W1 + W2)), 0, i_s(d + l3), i_s(W1))) for i in range(n - 1): cl.append( hfss.create_rectangle( oEditor, i_s(x0 + l1 + l2 + d), i_s(y0 - (n - 1 / 2) * W1 - (n - 1) * W2 + i * 2 * (W1 + W2) + (W1 + W2)), 0, i_s(d + l3), i_s(W1))) cl.append( hfss.create_rectangle(oEditor, i_s(x0 + l1 + l2 + l3 + 2 * d), i_s(y0 - (n - 1 / 2) * W1 - (n - 1) * W2), 0, i_s(l2), i_s((2 * n - 1) * W1 + 2 * (n - 1) * W2))) cl.append( hfss.create_rectangle(oEditor, i_s(x0 + l1 + l2 + l3 + l2 + 2 * d), i_s(y0 - W / 2), 0, i_s(l1), i_s(W))) finger = hfss.unite(oEditor, cl) cpw_filter = hfss.unite(oEditor, [cpw_filter, finger]) return cpw_filter
substrate = hfss.create_box(oEditor, 0, 0, '-h', 'a', 'b', 'h', Name='Substrate', Color=(143, 175, 143), Transparency=0.75, MaterialValue='\"sapphire\"') cpw_filter = hfss.create_rectangle(oEditor, 0, 0, 0, 'a', 'b', Color=(255, 128, 64)) cpw_filter = hfss.subtract(oEditor, [cpw_filter], [ hfss.create_rectangle(oEditor, 'a/2-var_x/2', 'b/2-var_x/2', 0, 'var_x', 'var_x') ]) line1 = hfss.create_rectangle(oEditor, 'a/2-W/2', 'd0', 0, 'W', 'l0') cpw_filter = hfss.unite(oEditor, [cpw_filter, line1]) line2 = hfss.create_rectangle(oEditor, 'a/2-W/2', 'd0+l0', 0, 'W', 'W1') cpw_filter = hfss.unite(oEditor, [cpw_filter, line2])
oProject = hfss.new_project(oDesktop) raw_input('Press "Enter" to insert a new DrivenModal design named HFSSDesign1.>') oDesign = hfss.insert_design(oProject, "HFSSDesign1", "DrivenModal") raw_input('Press "Enter" to set the active editor to "3D Modeler" (The default and only known correct value).>') oEditor = hfss.set_active_editor(oDesign) raw_input('Press "Enter" to draw a red rectangle named Rectangle1.>') hfss.create_rectangle(oEditor, 1, 2, 3, 4, 5, Name='Rectangle1', Color=(255, 0, 0)) raw_input('Press "Enter" to quit HFSS.>') hfss.quit_application(oDesktop) del oEditor del oDesign del oProject del oDesktop del oAnsoftApp
W0=0.004 hfss.add_property(design, 'W0', vm(W0)) W1=0.003 hfss.add_property(design, 'W1', vm(W1)) W2=0.0012 hfss.add_property(design, 'W2', vm(W2)) substrate=hfss.create_box(oEditor, 0,0,'-h', 'a','b','h', Name='Substrate', Color=(143,175,143), Transparency=0.75, MaterialValue='\"sapphire\"') cpw_filter = hfss.create_rectangle(oEditor, 0, 0, 0, 'a', 'b', Color=(255, 128, 64)) rect1=hfss.create_rectangle(oEditor,'a/2-W0/2','d0',0,'W0','l0') line1=hfss.create_rectangle(oEditor, 'a/2-W/2', 'd0', 0, 'W', 'l0') cpw_filter=hfss.subtract(oEditor, [cpw_filter], [rect1]) cpw_filter=hfss.unite(oEditor, [cpw_filter, line1]) rect2=hfss.create_rectangle(oEditor, 'a/2-W0/2','d0+l0',0,'W0','W1') line2=hfss.create_rectangle(oEditor,'a/2-W/2', 'd0+l0',0,'W0/2+W/2','W1') cpw_filter=hfss.subtract(oEditor, [cpw_filter], [rect2]) cpw_filter=hfss.unite(oEditor, [cpw_filter, line2]) rect3=hfss.create_rectangle(oEditor,'a/2-W0/2','d0+l0+W1',0,'W0','l0') line3=hfss.create_rectangle(oEditor,'a/2-W/2','d0+l0+W1',0,'W','l0') cpw_filter=hfss.subtract(oEditor, [cpw_filter], [rect3]) cpw_filter=hfss.unite(oEditor, [cpw_filter, line3])
def shunt(oEditor, cpw_filter, x0=0, y0=0, var_x=0.5, l4=0.01, W3=0.003, r0=0.0024, r1=0.0024, n=4): l3 = var_x / 2 - r0 - n * r1 if (l3 <= 0): print "Parametrics<0" exit() d3 = var_x / 2 - W3 / 2 - r0 - r1 - l4 if (d3 <= 0): print "Parametrics<0" exit() rect = hfss.create_rectangle(oEditor, i_s(x0), i_s(y0 - var_x / 2), 0, i_s(var_x), i_s(var_x)) cl = [ hfss.create_polyline( oEditor, [i_s(x0), i_s(x0 + l3)], [i_s(y0), i_s(y0)], [0, 0], IsPolylineCovered=False, ), hfss.create_EQbasedcurve( oEditor, i_s(x0 + l3) + '+' + i_s(r0) + '*sin(_t)', i_s(y0 + r0) + '-' + i_s(r0) + '*cos(_t)', '0', 0, 'pi/2', 0, ) ] for i in range(n - 1): if i % 2 == 0: cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + i * 2 * r1), i_s(x0 + l3 + r0 + i * 2 * r1) ], [i_s(y0 + r0), i_s(y0 + r0 + l4)], [0, 0], IsPolylineCovered=False)) cl.append( hfss.create_EQbasedcurve( oEditor, i_s(x0 + l3 + r0 + r1 + i * 2 * r1) + '-' + i_s(r1) + '*cos(_t)', i_s(y0 + r0 + l4) + '+' + i_s(r1) + '*sin(_t)', '0', 0, 'pi', 0)) cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + 2 * r1 + i * 2 * r1), i_s(x0 + l3 + r0 + 2 * r1 + i * 2 * r1) ], [i_s(y0 + r0 + l4), i_s(y0 + r0)], [0, 0], IsPolylineCovered=False)) cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + 2 * r1 + i * 2 * r1), i_s(x0 + l3 + r0 + 2 * r1 + i * 2 * r1) ], [i_s(y0 + r0), i_s(y0 - r0)], [0, 0], IsPolylineCovered=False)) else: cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + i * 2 * r1), i_s(x0 + l3 + r0 + i * 2 * r1) ], [i_s(y0 - r0), i_s(y0 - r0 - l4)], [0, 0], IsPolylineCovered=False)) cl.append( hfss.create_EQbasedcurve( oEditor, i_s(x0 + l3 + r0 + r1 + i * 2 * r1) + '-' + i_s(r1) + '*cos(_t)', i_s(y0 - r0 - l4) + '-' + i_s(r1) + '*sin(_t)', '0', 0, 'pi', 0)) cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + 2 * r1 + i * 2 * r1), i_s(x0 + l3 + r0 + 2 * r1 + i * 2 * r1) ], [i_s(y0 - r0 - l4), i_s(y0 - r0)], [0, 0], IsPolylineCovered=False)) cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + 2 * r1 + i * 2 * r1), i_s(x0 + l3 + r0 + 2 * r1 + i * 2 * r1) ], [i_s(y0 - r0), i_s(y0 + r0)], [0, 0], IsPolylineCovered=False)) if n % 2 == 0: cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + (n - 1) * 2 * r1), i_s(x0 + l3 + r0 + (n - 1) * 2 * r1) ], [i_s(y0 - r0), i_s(y0 - r0 - l4)], [0, 0], IsPolylineCovered=False)) cl.append( hfss.create_EQbasedcurve( oEditor, i_s(x0 + l3 + r0 + r1 + (n - 1) * 2 * r1) + '-' + i_s(r1) + '*cos(_t)', i_s(y0 - r0 - l4) + '-' + i_s(r1) + '*sin(_t)', '0', 0, 'pi', 0)) cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + 2 * r1 + (n - 1) * 2 * r1), i_s(x0 + l3 + r0 + 2 * r1 + (n - 1) * 2 * r1) ], [i_s(y0 - r0 - l4), i_s(y0 - r0)], [0, 0], IsPolylineCovered=False)) cl.append( hfss.create_EQbasedcurve(oEditor, i_s(x0 + l3 + r0 + n * 2 * r1 + r0) + '-' + i_s(r0) + '*cos(_t)', i_s(y0 - r0) + '+' + i_s(r0) + '*sin(_t)', '0', 0, 'pi/2', 0, Name='Quarter_Line')) cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + n * 2 * r1 + r0), i_s(x0 + l3 + r0 + n * 2 * r1 + r0 + l3) ], [i_s(y0), i_s(y0)], [0, 0], IsPolylineCovered=False)) else: cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + (n - 1) * 2 * r1), i_s(x0 + l3 + r0 + (n - 1) * 2 * r1) ], [i_s(y0 + r0), i_s(y0 + r0 + l4)], [0, 0], IsPolylineCovered=False)) cl.append( hfss.create_EQbasedcurve( oEditor, i_s(x0 + l3 + r0 + r1 + (n - 1) * 2 * r1) + '-' + i_s(r1) + '*cos(_t)', i_s(y0 + r0 + l4) + '+' + i_s(r1) + '*sin(_t)', '0', 0, 'pi', 0)) cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + 2 * r1 + (n - 1) * 2 * r1), i_s(x0 + l3 + r0 + 2 * r1 + (n - 1) * 2 * r1) ], [i_s(y0 + r0 + l4), i_s(y0 + r0)], [0, 0], IsPolylineCovered=False)) cl.append( hfss.create_EQbasedcurve(oEditor, i_s(x0 + l3 + r0 + n * 2 * r1 + r0) + '-' + i_s(r0) + '*cos(_t)', i_s(y0 + r0) + '-' + i_s(r0) + '*sin(_t)', '0', 0, 'pi/2', 0, Name='Quarter_Line')) cl.append( hfss.create_polyline(oEditor, [ i_s(x0 + l3 + r0 + n * 2 * r1 + r0), i_s(x0 + l3 + r0 + n * 2 * r1 + r0 + l3) ], [i_s(y0), i_s(y0)], [0, 0], IsPolylineCovered=False)) cl = hfss.unite(oEditor, cl) temp_l = hfss.create_polyline( oEditor, [i_s(x0), i_s(x0)], [i_s(y0 - W3 / 2), i_s(y0 + W3 / 2)], [0, 0], IsPolylineClosed=False) meander = hfss.sweep_along_path(oEditor, [temp_l], [cl]) cpw_filter = hfss.subtract(oEditor, [cpw_filter], [rect]) cpw_filter = hfss.unite(oEditor, [cpw_filter, meander[0]]) return cpw_filter