HFSS 3D Layout: parametric via analysis#

This example shows how you can use HFSS 3D Layout to create and solve a parametric via analysis.

Perform required imports#

Perform required inports.

from pyaedt import Hfss3dLayout
import os

Set non-graphical mode#

Set non-graphical mode. "PYAEDT_NON_GRAPHICAL" is needed to generate documentation only. You can set non_graphical either to True or False.

non_graphical = os.getenv("PYAEDT_NON_GRAPHICAL", "False").lower() in ("true", "1", "t")

Launch AEDT#

Launch AEDT 2022 R2 in graphical mode.

h3d = Hfss3dLayout(specified_version="2022.2", new_desktop_session=True, non_graphical=non_graphical)

Set up variables#

Set up all parametric variables to use in the layout.

h3d["viatotrace"] = "5mm"
h3d["viatovia"] = "10mm"
h3d["w1"] = "1mm"
h3d["sp"] = "0.5mm"
h3d["len"] = "50mm"

Add stackup layers#

Add stackup layers.

h3d.modeler.layers.add_layer("GND", "signal", thickness="0", isnegative=True)
h3d.modeler.layers.add_layer("diel", "dielectric", thickness="0.2mm", material="FR4_epoxy")
h3d.modeler.layers.add_layer("TOP", "signal", thickness="0.035mm", elevation="0.2mm")
<pyaedt.modules.LayerStackup.Layer object at 0x0000021DFA82D8B0>

Create signal net and ground planes#

Create a signal net and ground planes.

h3d.modeler.create_line("TOP", [[0, 0], ["len", 0]], lw="w1", netname="microstrip", name="microstrip")
h3d.modeler.create_rectangle("TOP", [0, "-w1/2-sp"], ["len", "-w1/2-sp-20mm"])
h3d.modeler.create_rectangle("TOP", [0, "w1/2+sp"], ["len", "w1/2+sp+20mm"])
'NewObject_BM6PYS'

Create vias#

Create vias with parametric positions.

h3d.modeler.create_via(x="viatovia", y="-viatotrace", name="via1")
h3d.modeler.create_via(x="viatovia", y="viatotrace", name="via2")
h3d.modeler.create_via(x="2*viatovia", y="-viatotrace")
h3d.modeler.create_via(x="2*viatovia", y="viatotrace")
h3d.modeler.create_via(x="3*viatovia", y="-viatotrace")
h3d.modeler.create_via(x="3*viatovia", y="viatotrace")
'via_5U84HU'

Create circuit ports#

Create circuit ports.

h3d.create_edge_port("microstrip", 0)
h3d.create_edge_port("microstrip", 2)
<pyaedt.modules.Boundary.BoundaryObject3dLayout object at 0x0000021DF1AF0880>

Create setup and sweep#

Create a setup and a sweep.

setup = h3d.create_setup()
h3d.create_linear_count_sweep(
    setupname=setup.name,
    unit="GHz",
    freqstart=3,
    freqstop=7,
    num_of_freq_points=1001,
    sweepname="sweep1",
    sweep_type="Interpolating",
    interpolation_tol_percent=1,
    interpolation_max_solutions=255,
    save_fields=False,
    use_q3d_for_dc=False,
)
<pyaedt.modules.SetupTemplates.SweepHFSS3DLayout object at 0x0000021DF1727910>

Solve and plot results#

Solve and plot the results.

h3d.analyze_nominal()
traces = h3d.get_traces_for_plot(first_element_filter="Port1")
h3d.post.create_report(traces, families_dict=h3d.available_variations.nominal_w_values_dict)
False

Create report outside AEDT#

Create a report using Matplotlib.

traces = h3d.get_traces_for_plot(first_element_filter="Port1", category="S")

solutions = h3d.post.get_solution_data(expressions=traces)
solutions.plot(math_formula="db20")
Simulation Results Plot
<Figure size 2000x1000 with 1 Axes>

Close AEDT#

After the simulation completes, you can close AEDT or release it using the pyaedt.Desktop.release_desktop() method. All methods provide for saving the project before closing.

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

Total running time of the script: ( 2 minutes 14.285 seconds)

Gallery generated by Sphinx-Gallery