{ "cells": [ { "cell_type": "markdown", "id": "7d2160d3", "metadata": {}, "source": [ "# Antenna Cosite Interference\n", "\n", "This example shows how to create a project in EMIT for\n", "the simulation of an antenna cosite interference scenario.\n", "\n", "\n", "\n", "Keywords: **EMIT**, **Antenna**." ] }, { "cell_type": "markdown", "id": "d5487dcb", "metadata": {}, "source": [ "## Prerequisites\n", "\n", "### Perform imports" ] }, { "cell_type": "code", "execution_count": null, "id": "871c4b8a", "metadata": {}, "outputs": [], "source": [ "import os\n", "import tempfile\n", "import time\n", "\n", "import ansys.aedt.core\n", "from ansys.aedt.core.emit_core.emit_constants import ResultType, TxRxMode\n", "from ansys.aedt.core.emit_core.nodes.generated import AntennaNode, RadioNode\n" ] }, { "cell_type": "markdown", "id": "07759e41", "metadata": {}, "source": [ "### Define constants\n", "Constants help ensure consistency and avoid repetition throughout the example." ] }, { "cell_type": "code", "execution_count": null, "id": "6a9c910f", "metadata": {}, "outputs": [], "source": [ "AEDT_VERSION = \"2026.1\"\n", "NG_MODE = False # Open AEDT UI when it is launched." ] }, { "cell_type": "markdown", "id": "a2c11b76", "metadata": {}, "source": [ "### Create temporary directory\n", "\n", "Create a temporary working directory.\n", "The name of the working folder is stored in ``temp_folder.name``.\n", "\n", "> **Note:** The final cell in the notebook cleans up the temporary folder. If you want to\n", "> retrieve the AEDT project and data, do so before executing the final cell in the notebook." ] }, { "cell_type": "code", "execution_count": null, "id": "ffa62e57", "metadata": {}, "outputs": [], "source": [ "temp_folder = tempfile.TemporaryDirectory(suffix=\".ansys\")" ] }, { "cell_type": "markdown", "id": "17aa01a7", "metadata": {}, "source": [ "### Launch application\n", "\n", "Launch AEDT with EMIT. The ``Emit`` class initializes AEDT\n", "and creates an EMIT design in the project." ] }, { "cell_type": "code", "execution_count": null, "id": "29468c61", "metadata": {}, "outputs": [], "source": [ "project_name = os.path.join(temp_folder.name, \"antenna_cosite.aedt\")\n", "aedtapp = ansys.aedt.core.Emit(\n", " project=project_name,\n", " version=AEDT_VERSION,\n", " non_graphical=NG_MODE,\n", " new_desktop=True,\n", ")" ] }, { "cell_type": "markdown", "id": "18f2c63a", "metadata": {}, "source": [ "## Model Preparation\n", "\n", "Create radios and antennas and connect them in the EMIT schematic.\n", "\n", "### Create and connect EMIT components\n", "\n", "Create a radio and connect an antenna to it." ] }, { "cell_type": "code", "execution_count": null, "id": "5bf2d700", "metadata": {}, "outputs": [], "source": [ "rad1: RadioNode = aedtapp.schematic.create_component(\"New Radio\")\n", "ant1: AntennaNode = aedtapp.schematic.create_component(\"Antenna\")\n", "if rad1 and ant1:\n", " aedtapp.schematic.connect_components(rad1.name, ant1.name)" ] }, { "cell_type": "markdown", "id": "87a71add", "metadata": {}, "source": [ "### Place radio/antenna pairs\n", "\n", "Use the ``create_radio_antenna()`` method to place additional radio/antenna pairs.\n", "The first argument is the type of radio. The second argument is the name to\n", "assign to the radio." ] }, { "cell_type": "code", "execution_count": null, "id": "dd57b902", "metadata": {}, "outputs": [], "source": [ "rad2, ant2 = aedtapp.schematic.create_radio_antenna(\"GPS Receiver\")\n", "rad3, ant3 = aedtapp.schematic.create_radio_antenna(\"Bluetooth Low Energy (LE)\", \"Bluetooth\")" ] }, { "cell_type": "markdown", "id": "a1f3fc59", "metadata": {}, "source": [ "### Define the RF environment\n", "\n", "Specify the RF coupling among antennas.\n", "This functionality is not yet implemented in the API, but it can be entered from the UI.\n", "\n", "" ] }, { "cell_type": "markdown", "id": "3307c5db", "metadata": {}, "source": [ "### Run analysis\n", "\n", "Run the EMIT simulation." ] }, { "cell_type": "code", "execution_count": null, "id": "d2f7ca91", "metadata": {}, "outputs": [], "source": [ "if AEDT_VERSION > \"2023.1\":\n", " rev = aedtapp.results.analyze()" ] }, { "cell_type": "markdown", "id": "b3550947", "metadata": {}, "source": [ "## Postprocess\n", "\n", "Evaluate the worst-case EMI between the GPS receiver and Bluetooth radio." ] }, { "cell_type": "code", "execution_count": null, "id": "fca56ff0", "metadata": {}, "outputs": [], "source": [ "if AEDT_VERSION > \"2023.1\":\n", " rx_bands = rev.get_band_names(radio_node=rad2, tx_rx_mode=TxRxMode.RX)\n", " tx_bands = rev.get_band_names(radio_node=rad3, tx_rx_mode=TxRxMode.TX)\n", " domain = aedtapp.results.interaction_domain()\n", " domain.set_receiver(rad2.name, rx_bands[0], -1)\n", " domain.set_interferer(rad3.name, tx_bands[0])\n", " interaction = rev.run(domain)\n", " worst = interaction.get_worst_instance(ResultType.EMI)\n", " if worst.has_valid_values():\n", " emi = worst.get_value(ResultType.EMI)\n", " print(\"Worst case interference is: {} dB\".format(emi))" ] }, { "cell_type": "markdown", "id": "93cafe19", "metadata": {}, "source": [ "## Finish\n", "\n", "### Save the project" ] }, { "cell_type": "code", "execution_count": null, "id": "436db677", "metadata": {}, "outputs": [], "source": [ "aedtapp.save_project()\n", "aedtapp.release_desktop()\n", "# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.\n", "time.sleep(3)" ] }, { "cell_type": "markdown", "id": "273776df", "metadata": {}, "source": [ "### Clean up\n", "\n", "All project files are saved in the folder ``temp_folder.name``.\n", "If you've run this example as a Jupyter notebook, you\n", "can retrieve those project files. The following cell\n", "removes all temporary files, including the project folder." ] }, { "cell_type": "code", "execution_count": null, "id": "33c49fb7", "metadata": {}, "outputs": [], "source": [ "temp_folder.cleanup()" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" }, "nbsphinx": { "execute": "never" } }, "nbformat": 4, "nbformat_minor": 5 }