Download this example

Download this example as a Jupyter Notebook or as a Python script.


HFSS to EMIT Coupling#

This example shows how to link an HFSS design to EMIT and model RF interference among various components.

779cb0e7f279401684e474b38224c224

Note: This example uses the Cell Phone RFI Desense project that is available with the AEDT installation in the \Examples\EMIT\ directory.

Keywords: EMIT, Coupling.

Prerequisites#

Perform imports#

[1]:
import os
import shutil
import tempfile
import time

import ansys.aedt.core
from ansys.aedt.core.emit_core.emit_constants import ResultType, TxRxMode

Define constants#

Constants help ensure consistency and avoid repetition throughout the example.

[2]:
AEDT_VERSION = "2026.1"
NG_MODE = False  # Open AEDT UI when it is launched.

Create temporary directory#

Create a temporary working directory. The name of the working folder is stored in temp_folder.name.

Note: The final cell in the notebook cleans up the temporary folder. If you want to retrieve the AEDT project and data, do so before executing the final cell in the notebook.

[3]:
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")

Launch application#

Launch AEDT with EMIT. The Desktop class initializes AEDT and starts it on the specified version and in the specified graphical mode.

[4]:
d = ansys.aedt.core.launch_desktop(version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True)
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)].
PyAEDT INFO: PyAEDT version 1.1.dev0.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT INFO: AEDT version 2026.1.
PyAEDT INFO: New AEDT session is starting on gRPC port 54122.
PyAEDT INFO: Starting new AEDT gRPC session on port 54122.
PyAEDT INFO: Launching AEDT server with gRPC transport mode: wnua
PyAEDT INFO: Electronics Desktop started on gRPC port 54122 after 10.2 seconds.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v261\AnsysEM
PyAEDT INFO: Connected to AEDT gRPC session on port 54122.
PyAEDT INFO: Non-graphical mode detected. Disabling Desktop logs.

Model Preparation#

Copy example files#

Copy the Cell Phone RFI Desense example data from the installed Examples directory to the temporary working directory.

Note: The HFSS design from the installed example used to model the RF environment has been pre-solved. Hence, the results folder is copied and the RF interference between transceivers is calculated in EMIT using results from the linked HFSS design.

[5]:
file_name = lambda s: s + ".aedt"
results_name = lambda s: s + ".aedtresults"
pdf_name = lambda s: s + " Example.pdf"
[6]:
example = "Cell Phone RFI Desense"
example_dir = os.path.join(d.install_path, "Examples\\EMIT")
example_project = os.path.join(example_dir, file_name(example))
example_results_folder = os.path.join(example_dir, results_name(example))
example_pdf = os.path.join(example_dir, pdf_name(example))
[7]:
project_name = shutil.copyfile(example_project, os.path.join(temp_folder.name, file_name(example)))
results_folder = shutil.copytree(example_results_folder, os.path.join(temp_folder.name, results_name(example)))
project_pdf = shutil.copyfile(example_pdf, os.path.join(temp_folder.name, pdf_name(example)))

Open the project in the working directory.

[8]:
aedtapp = ansys.aedt.core.Emit(project_name, version=AEDT_VERSION)
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)].
PyAEDT INFO: Parsing C:\Users\ansys\AppData\Local\Temp\tmplpeixxe1.ansys\Cell Phone RFI Desense.aedt.
PyAEDT INFO: PyAEDT version 1.1.dev0.
PyAEDT INFO: Returning found Desktop session with PID 6496!
PyAEDT INFO: File C:\Users\ansys\AppData\Local\Temp\tmplpeixxe1.ansys\Cell Phone RFI Desense.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: Project Cell Phone RFI Desense has been opened.
PyAEDT INFO: Active Design set to EMIT Design1
PyAEDT INFO: AEDT objects correctly read
PyAEDT INFO: ModelerCircuit class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: ModelerEmit class has been initialized!
PyAEDT INFO: Importing EmitApiPython from: C:\Program Files\ANSYS Inc\v261\AnsysEM\Delcross\EmitApiPython
PyAEDT INFO: Loaded Ansys EMIT API (Beta) 2026.1.0
PyAEDT INFO: Active Design set to EMIT Design1

Create and connect EMIT components#

Create two radios with antennas connected to each one.

[9]:
rad1, ant1 = aedtapp.schematic.create_radio_antenna("Bluetooth Low Energy (LE)")
rad2, ant2 = aedtapp.schematic.create_radio_antenna("Bluetooth Low Energy (LE)")
PyAEDT INFO: Using component 'Bluetooth Low Energy (LE)' from library 'Radios\Commercial Unlicensed Systems\Bluetooth' for type 'Bluetooth Low Energy (LE)'.
PyAEDT INFO: Using component 'Antenna' from library 'Antennas' for type 'Antenna'.
PyAEDT INFO: Successfully connected components 'Antenna' and 'Bluetooth Low Energy (LE)'.
PyAEDT INFO: Using component 'Bluetooth Low Energy (LE)' from library 'Radios\Commercial Unlicensed Systems\Bluetooth' for type 'Bluetooth Low Energy (LE)'.
PyAEDT INFO: Using component 'Antenna' from library 'Antennas' for type 'Antenna'.
PyAEDT INFO: Successfully connected components 'Antenna 2' and 'Bluetooth Low Energy (LE) 2'.

Define coupling among RF systems#

Link and update coupling among the RF systems.

[10]:
for link in aedtapp.couplings.linkable_design_names:
    aedtapp.couplings.add_link(link)
    print('linked "' + link + '".')
[11]:
for link in aedtapp.couplings.coupling_names:
    aedtapp.couplings.update_link(link)
    print('linked "' + link + '".')
linked "ATA_Analysis".

Run analysis#

Run the EMIT simulation to calculate RF interference.

[12]:
if AEDT_VERSION > "2023.1":
    rev = aedtapp.results.analyze()

Postprocess#

Evaluate the worst-case EMI between the two Bluetooth radios.

[13]:
if AEDT_VERSION > "2023.1":
    rx_bands = rev.get_band_names(radio_node=rad1, tx_rx_mode=TxRxMode.RX)
    tx_bands = rev.get_band_names(radio_node=rad2, tx_rx_mode=TxRxMode.TX)
    domain = aedtapp.results.interaction_domain()
    domain.set_receiver(rad1.name, rx_bands[0], -1)
    domain.set_interferer(rad2.name, tx_bands[0])
    interaction = rev.run(domain)
    worst = interaction.get_worst_instance(ResultType.EMI)
    if worst.has_valid_values():
        emi = worst.get_value(ResultType.EMI)
        print("Worst case interference is: {} dB".format(emi))
PyAEDT INFO: Project Cell Phone RFI Desense Saved correctly
Worst case interference is: 90.0 dB

Finish#

Save the project#

[14]:
aedtapp.save_project()
aedtapp.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
PyAEDT INFO: Project Cell Phone RFI Desense Saved correctly
PyAEDT INFO: Desktop has been released and closed.

Clean up#

All project files are saved in the folder temp_folder.name. If you’ve run this example as a Jupyter notebook, you can retrieve those project files. The following cell removes all temporary files, including the project folder.

[15]:
temp_folder.cleanup()

Download this example

Download this example as a Jupyter Notebook or as a Python script.