Hfss 3D Layout: Parametric Via Analysis#

This example shows how to use HFSS 3D Layout to create and solve a parametric design.

# sphinx_gallery_thumbnail_path = 'Resources/3dlayout.png'

# Import the Hfss3dlayout Object#

This example imports the Hfss3dlayout object and initializes it on version 2022R2.

from pyaedt import Hfss3dLayout
import os

Set Non Graphical Mode. Default is False

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

Launch AEDT in Graphical Mode#

This examples launches AEDT 2022R2 in graphical mode.

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


pyaedt info: Logger Started
pyaedt info: Launching PyAEDT outside Electronics Desktop with CPython and Pythonnet
pyaedt info: AEDT installation Path C:\Program Files\AnsysEM\v222\Win64.
pyaedt info: Launching AEDT with module Pythonnet.
pyaedt info: Ansoft.ElectronicsDesktop.2022.2 Started with process ID 2216.
pyaedt info: Logger file D:\Temp\pyaedt20220624_103520.log in use.
pyaedt info: pyaedt v0.4.87
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 Project2 has been created.
pyaedt info: No design is present. Inserting a new design.
pyaedt info: Added design 'HFSS 3D Layout Design_GY7' of type HFSS 3D Layout Design.
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded
pyaedt info: Analysis Loaded
pyaedt info: Loading Modeler.
pyaedt info: Modeler loaded.
pyaedt info: EDB loaded.
pyaedt info: Layers loaded.
pyaedt info: Primitives loaded.
pyaedt info: Modeler Loaded

Set Up Parametric Variables#

This example sets 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"

Create a Stackup#

This example creates a stackup.

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 0x00000185FF7B1520>

Create a Signal Net and Ground Planes#

This example 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"])



Create Vias with Parametric Positions#

This example creates 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")



Add Circuit Ports#

This example adds circuit ports to the setup.

h3d.create_edge_port("microstrip", 0)
h3d.create_edge_port("microstrip", 2)



Create a Setup and Sweep#

This example create a setup and sweep.

setup = h3d.create_setup()


pyaedt info: Linear count sweep sweep1 has been correctly created

<pyaedt.modules.SetupTemplates.SweepHFSS3DLayout object at 0x00000185F738E340>

Solve and Plot Results#

This example solves and plots results.

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


pyaedt info: Solving design setup MySetupAuto
pyaedt info: Design setup MySetupAuto solved correctly
pyaedt error: Method create_report Failed:  Type Error. Please Check again
Method create_report Failed:  Type Error. Please Check again
pyaedt error: create_report() got an unexpected keyword argument 'families_dict'
create_report() got an unexpected keyword argument 'families_dict'
pyaedt error: Arguments Provided:
Arguments Provided:
pyaedt error:     expressions = ['dB(S(Port1,Port1))', 'dB(S(Port1,Port2))']
    expressions = ['dB(S(Port1,Port1))', 'dB(S(Port1,Port2))']
pyaedt error:     setup_sweep_name = None
    setup_sweep_name = None
pyaedt error:     domain = None
    domain = None
pyaedt error:     variations = None
    variations = None
pyaedt error:     primary_sweep_variable = None
    primary_sweep_variable = None
pyaedt error:     secondary_sweep_variable = None
    secondary_sweep_variable = None
pyaedt error:     report_category = None
    report_category = None
pyaedt error:     plot_type = None
    plot_type = None
pyaedt error:     context = None
    context = None
pyaedt error:     subdesign_id = None
    subdesign_id = None
pyaedt error:     polyline_points = None
    polyline_points = None
pyaedt error:     plotname = None
    plotname = None
pyaedt error:     families_dict = {'viatotrace': '5mm', 'viatovia': '10mm', 'w1': '1mm', 'sp': '0.5mm', 'len': '50mm'}
    families_dict = {'viatotrace': '5mm', 'viatovia': '10mm', 'w1': '1mm', 'sp': '0.5mm', 'len': '50mm'}
pyaedt error: Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_report
Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_report


Create Report outside AEDT#

Create Report using Matplotlib.

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

solutions = h3d.post.get_solution_data(expressions=traces)
Simulation Results Plot


pyaedt info: Solution Data Correctly Loaded.

<Figure size 2000x1000 with 1 Axes>

Close AEDT#

After the simulaton is completed, you can close AEDT or release it using the pyaedt.Desktop.release_desktop() method. All methods provide for saving the project before exiting.

if os.name != "posix":

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

Gallery generated by Sphinx-Gallery