Download this example
Download this example as a Jupyter Notebook or as a Python script.
Antenna#
This example shows how to create a project in EMIT for the simulation of an antenna using HFSS.
Keywords: EMIT, Antenna.
Perform imports and define constants#
Perform required imports.
[1]:
import tempfile
import time
import ansys.aedt.core
from ansys.aedt.core.emit_core.emit_constants import ResultType, TxRxMode
Define constants.
[2]:
AEDT_VERSION = "2025.2"
NG_MODE = False # Open AEDT UI when it is launched.
Create temporary directory#
Create a temporary directory where downloaded data or dumped data can be stored. If you’d like to retrieve the project data for subsequent use, the temporary folder name is given by temp_folder.name
.
[3]:
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
Launch AEDT with EMIT#
Launch AEDT with EMIT. The launch_desktop()
method initializes AEDT using the specified version. The second argument can be set to True
to run AEDT in non-graphical mode.
[4]:
project_name = ansys.aedt.core.generate_unique_project_name(
root_name=temp_folder.name, project_name="antenna_cosite"
)
d = ansys.aedt.core.launch_desktop(AEDT_VERSION, NG_MODE, new_desktop=True)
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: PyAEDT version 0.20.dev0.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_cf40cad9-d632-45bb-bb83-93b3c2384be9.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: New AEDT session is starting on gRPC port 61572.
PyAEDT INFO: Electronics Desktop started on gRPC port: 61572 after 11.216440439224243 seconds.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v252\AnsysEM
PyAEDT INFO: Ansoft.ElectronicsDesktop.2025.2 version started with process ID 8340.
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 0.20.dev0.
PyAEDT INFO: Returning found Desktop session with PID 8340!
PyAEDT INFO: Project antenna_cosite has been created.
PyAEDT INFO: No design is present. Inserting a new design.
PyAEDT INFO: Added design 'EMIT_NCE' of type EMIT.
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\v252\AnsysEM\Delcross\EmitApiPython
PyAEDT INFO: Loaded Ansys EMIT API (Beta) 2025.2.0
PyAEDT INFO: Active Design set to EMIT_NCE
Create and connect EMIT components#
Create three radios and connect an antenna to each one.
[5]:
rad1 = aedtapp.modeler.components.create_component("New Radio")
ant1 = aedtapp.modeler.components.create_component("Antenna")
if rad1 and ant1:
ant1.move_and_connect_to(rad1)
Place radio/antenna pair#
Use the create_radio_antenna()
method to place the radio/antenna pair. The first argument is the type of radio. The second argument is the name to assign to the radio.
[6]:
rad2, ant2 = aedtapp.modeler.components.create_radio_antenna("GPS Receiver")
rad3, ant3 = aedtapp.modeler.components.create_radio_antenna(
"Bluetooth Low Energy (LE)", "Bluetooth"
)
Define the RF environment#
Specify the RF coupling among antennas. This functionality is not yet implemented in the API, but it can be entered from the UI.
Run EMIT simulation#
Run the EMIT simulation.
This part of the example requires Ansys AEDT 2023 R2.
[7]:
# > **Note:** You can uncomment the following code.
#
if AEDT_VERSION > "2023.1":
rev = aedtapp.results.analyze()
rx_bands = rev.get_band_names(rad2.name, TxRxMode.RX)
tx_bands = rev.get_band_names(rad3.name, TxRxMode.TX)
domain = aedtapp.results.interaction_domain()
domain.set_receiver(rad2.name, rx_bands[0], -1)
domain.set_interferer(rad3.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 antenna_cosite Saved correctly
Worst case interference is: 16.64 dB
Release AEDT#
Release AEDT and close the example.
[8]:
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 antenna_cosite 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.
[9]:
temp_folder.cleanup()
Download this example
Download this example as a Jupyter Notebook or as a Python script.