Spiral Inductor

This example shows how you can use PyAEDT to create a spiral inductor, solve it and plot results.

Import packages

import os
import matplotlib.pyplot as plt
from pyaedt import Hfss, constants

Launch Hfss 2021.2 in non graphical mode. Change units to micron

hfss = Hfss(specified_version="2021.2", non_graphical=False, designname="A1")
hfss.modeler.model_units = "um"
p = hfss.modeler.primitives

Out:

Launching PyAEDT outside Electronics Desktop with CPython and Pythonnet
Launching AEDT installation C:\Program Files\AnsysEM\AnsysEM21.2\Win64
===================================================================================
pyaedt info: Launching AEDT with module Pythonnet.
pyaedt info: Ansoft.ElectronicsDesktop.2021.2 Started with process ID 6940.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20220120_153507.log
pyaedt info: pyaedt v0.5.dev1
pyaedt info: Python version 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
pyaedt info: Project Project2595 has been created.
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded

Input Variables. Edit it to change your inductor.

rin = 10
width = 2
spacing = 1
thickness = 1
Np = 8
Nr = 10
gap = 3
Tsub = 6

This method standardizes the usage of polyline in this example by fixing the width, thickness and material.

def create_line(pts):
    p.create_polyline(pts, xsection_type="Rectangle", xsection_width=width, xsection_height=thickness, matname="copper")

Here a spiral inductor is created. Spiral is not parameteric but could be parametrized later on.

ind = hfss.modeler.create_spiral(
    internal_radius=rin,
    width=width,
    spacing=spacing,
    turns=Nr,
    faces=Np,
    thickness=thickness,
    material="copper",
    name="Inductor1",
)

Center Return Path.

x0, y0, z0 = ind.points[0]
x1, y1, z1 = ind.points[-1]
create_line([(x0 - width / 2, y0, -gap), (abs(x1) + 5, y0, -gap)])
p.create_box((x0 - width / 2, y0 - width / 2, -gap - thickness / 2), (width, width, gap + thickness), matname="copper")

Out:

<pyaedt.modeler.Object3d.Object3d object at 0x000001D051D1D730>

Port 1 creation.

p.create_rectangle(
    constants.PLANE.YZ, (abs(x1) + 5, y0 - width / 2, -gap - thickness / 2), (width, -Tsub + gap), name="port1"
)
hfss.create_lumped_port_to_sheet(sheet_name="port1", axisdir=constants.AXIS.Z)

Out:

pyaedt info: Boundary LumpedPort Port_Y7L4RP has been correctly created.

<pyaedt.modules.Boundary.BoundaryObject object at 0x000001D051ED1B80>

Port 2 creation.

create_line([(x1 + width / 2, y1, 0), (x1 - 5, y1, 0)])
p.create_rectangle(constants.PLANE.YZ, (x1 - 5, y1 - width / 2, -thickness / 2), (width, -Tsub), name="port2")
hfss.create_lumped_port_to_sheet(sheet_name="port2", axisdir=constants.AXIS.Z)

Out:

pyaedt info: Boundary LumpedPort Port_1AM1P5 has been correctly created.

<pyaedt.modules.Boundary.BoundaryObject object at 0x000001D064114B50>

Silicon Substrate and Ground plane.

p.create_box([x1 - 20, x1 - 20, -Tsub - thickness / 2], [-2 * x1 + 40, -2 * x1 + 40, Tsub], matname="silicon")

p.create_box([x1 - 20, x1 - 20, -Tsub - thickness / 2], [-2 * x1 + 40, -2 * x1 + 40, -0.1], matname="PEC")

Out:

<pyaedt.modeler.Object3d.Object3d object at 0x000001D051ED10A0>

Airbox and radiation assignment.

box = p.create_box(
    [x1 - 20, x1 - 20, -Tsub - thickness / 2 - 0.1], [-2 * x1 + 40, -2 * x1 + 40, 100], name="airbox", matname="air"
)

hfss.assign_radiation_boundary_to_objects("airbox")

Out:

pyaedt info: Boundary Radiation Rad__T68BXW has been correctly created.

<pyaedt.modules.Boundary.BoundaryObject object at 0x000001D052060490>

Material override is needed to avoid validation check to fail.

hfss.change_material_override()

Out:

pyaedt info: Enabling Material Override

True

Plot the model

hfss.plot(show=False, export_path=os.path.join(hfss.working_directory, "Image.jpg"), plot_air_objects=False)
HFSS Spiral

Out:

<pyaedt.modules.AdvancedPostProcessing.ModelPlotter object at 0x000001D0620B3E80>

Create a setup and define a frequency sweep. Project will be solved after that.

setup1 = hfss.create_setup(setupname="setup1")
setup1.props["Frequency"] = "10GHz"
hfss.create_linear_count_sweep("setup1", "GHz", 1e-3, 50, 451, sweep_type="Interpolating")
setup1.update()
hfss.save_project()
hfss.analyze_all()

Out:

pyaedt info: Linear count sweep Sweep_A61W6G has been correctly created
pyaedt info: Saving Project2595 Project

True

Get Report Data and plot it on matplotlib. Inductance.

L_formula = "1e9*im(1/Y(1,1))/(2*pi*freq)"
x = hfss.post.get_report_data(L_formula)

plt.plot(x.sweeps["Freq"], x.data_real(L_formula))

plt.grid()
plt.xlabel("Freq")
plt.ylabel("L(nH)")
plt.show()

plt.clf()
HFSS Spiral

Out:

pyaedt info: Solution Data Correctly Loaded.

Get Report Data and plot it on matplotlib. Quality Factor.

Q_formula = "im(Y(1,1))/re(Y(1,1))"
x = hfss.post.get_report_data(Q_formula)
hfss.save_project()

plt.plot(x.sweeps["Freq"], x.data_real(Q_formula))
plt.grid()
plt.xlabel("Freq")
plt.ylabel("Q")
plt.show()
HFSS Spiral

Out:

pyaedt info: Solution Data Correctly Loaded.
pyaedt info: Saving Project2595 Project

Get Report Data and plot it on matplotlib. Save and close the project.

hfss.save_project()
if os.name != "posix":
    hfss.release_desktop()

Out:

pyaedt info: Saving Project2595 Project

Total running time of the script: ( 1 minutes 30.016 seconds)

Gallery generated by Sphinx-Gallery