HFSS to SBR+ Coupling

This example shows how you can use PyAEDT to create an SBR+ project from Hfss antenna and run a simulation.

Import Packages

This example sets up the local path to the path for the PyAEDT directory.

import os
import tempfile
from pyaedt import examples, generate_unique_name

project_full_name = examples.download_sbr()
project_name = os.path.basename(project_full_name)[:-5]
tmpfold = tempfile.gettempdir()

temp_folder = os.path.join(tmpfold, generate_unique_name("SBR"))
if not os.path.exists(temp_folder):
from pyaedt import Hfss

Define Designs

Define two designs, one source and one target, with each one connected to a different object.

target = Hfss(
target.save_project(os.path.join(temp_folder, project_name + ".aedt"))
source = Hfss(projectname=project_name, designname="feeder", specified_version="2021.2", new_desktop_session=False)


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 4532.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20220120_153717.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 Cassegrain has been opened.
pyaedt.generic.LoadAEDTFile._read_aedt_file: 0.015623s
pyaedt info: AEDT Load time 0.12500643730163574
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded
pyaedt info: Saving Cassegrain Project
pyaedt.generic.LoadAEDTFile._read_aedt_file: 0.046883s
pyaedt info: AEDT Load time 0.1718909740447998
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded

Define a Linked Antenna

This is HFSS Far Field applied to SBR+.

target.create_sbr_linked_antenna(source, target_cs="feederPosition", fieldtype="farfield")


pyaedt info: Native Component Linked Antenna feeder_X5KXJJ has been correctly created

<pyaedt.modules.Boundary.NativeComponentObject object at 0x000001D06414FA60>

Assign Boundaries

These commands assign boundaries.

target.assign_perfecte_to_sheets(["Reflector", "Subreflector"])
target.mesh.assign_curvilinear_elements(["Reflector", "Subreflector"])


pyaedt info: Boundary PerfectE PerfE_II1EEE has been correctly created.

<pyaedt.modules.Mesh.MeshOperation object at 0x000001D05E773CD0>

Plot the model

source.plot(show=False, export_path=os.path.join(target.working_directory, "Image.jpg"), plot_air_objects=True)
SBR Example


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

Create a Setup and Solve

This example creates a setup and then solves it.

setup1 = target.create_setup()
setup1.props["RayDensityPerWavelength"] = 2
setup1.props["ComputeFarFields"] = True
setup1.props["MaxNumberOfBounces"] = 3
setup1.props["Sweeps"]["Sweep"]["RangeType"] = "SinglePoints"
setup1.props["Sweeps"]["Sweep"]["RangeStart"] = "10GHz"
setup1.props["RadiationSetup"] = "ATK_3D"


pyaedt info: Solving design setup MySetupAuto
pyaedt info: Design setup MySetupAuto solved correctly


Plot Results

This example plots results.

variations = target.available_variations.nominal_w_values_dict
variations["Freq"] = ["10GHz"]
variations["Theta"] = ["All"]
variations["Phi"] = ["All"]
    "db(GainTotal)", target.nominal_adaptive, variations, "Theta", "ATK_3D", report_category="Far Fields"
if os.name != "posix":


pyaedt info: Report Plot_J7JADT correctly created.

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

Gallery generated by Sphinx-Gallery