EMIT Example

This tutorial shows how you can use PyAEDT to create a project in EMIT.

# sphinx_gallery_thumbnail_path = 'Resources/emit.png'

from pyaedt import Emit
from pyaedt import Desktop

Initialization Settings

Change NonGraphical Boolean to False to open AEDT in graphical mode With NewThread = False, an existing instance of AEDT will be used, if available. This example will use AEDT 2021.2

NonGraphical = False
NewThread = False
desktop_version = "2021.2"

Launch AEDT and EMIT Design

Desktop class initializes AEDT and starts it on specified version and specified graphical mode. NewThread Boolean variable defines if a user wants to create a new instance of AEDT or try to connect to existing instance of it.

d = Desktop(desktop_version, NonGraphical, NewThread)
aedtapp = Emit()

Out:

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 1208.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20220120_154401.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 Project2596 has been created.
pyaedt info: No design is present. Inserting a new design.

Create and Connect EMIT Components

Create 3 radios and connect an antenna to each.

rad1 = aedtapp.modeler.components.create_component("UE - Handheld")
ant1 = aedtapp.modeler.components.create_component("Antenna")
if rad1 and ant1:
    ant1.move_and_connect_to(rad1)

rad2 = aedtapp.modeler.components.create_component("GPS Receiver")
ant2 = aedtapp.modeler.components.create_component("Antenna")
if rad2 and ant2:
    ant2.move_and_connect_to(rad2)

rad3 = aedtapp.modeler.components.create_component("Bluetooth")
ant3 = aedtapp.modeler.components.create_component("Antenna")
if rad3 and ant3:
    ant3.move_and_connect_to(rad3)

Out:

pyaedt error: Method create_component Failed:  General or AEDT Error. Please Check again
Method create_component Failed:  General or AEDT Error. Please Check again
pyaedt error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
pyaedt error: Arguments Provided:
Arguments Provided:
pyaedt error:     component_type = UE - Handheld
    component_type = UE - Handheld
pyaedt error:     name = None
    name = None
pyaedt error:     library = None
    library = None
pyaedt error: Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
pyaedt error: Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
pyaedt error: Method create_component Failed:  General or AEDT Error. Please Check again
Method create_component Failed:  General or AEDT Error. Please Check again
pyaedt error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
pyaedt error: Arguments Provided:
Arguments Provided:
pyaedt error:     component_type = Antenna
    component_type = Antenna
pyaedt error:     name = None
    name = None
pyaedt error:     library = None
    library = None
pyaedt error: Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
pyaedt error: Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
pyaedt error: Method create_component Failed:  General or AEDT Error. Please Check again
Method create_component Failed:  General or AEDT Error. Please Check again
pyaedt error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
pyaedt error: Arguments Provided:
Arguments Provided:
pyaedt error:     component_type = GPS Receiver
    component_type = GPS Receiver
pyaedt error:     name = None
    name = None
pyaedt error:     library = None
    library = None
pyaedt error: Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
pyaedt error: Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
pyaedt error: Method create_component Failed:  General or AEDT Error. Please Check again
Method create_component Failed:  General or AEDT Error. Please Check again
pyaedt error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
pyaedt error: Arguments Provided:
Arguments Provided:
pyaedt error:     component_type = Antenna
    component_type = Antenna
pyaedt error:     name = None
    name = None
pyaedt error:     library = None
    library = None
pyaedt error: Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
pyaedt error: Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
pyaedt error: Method create_component Failed:  General or AEDT Error. Please Check again
Method create_component Failed:  General or AEDT Error. Please Check again
pyaedt error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
pyaedt error: Arguments Provided:
Arguments Provided:
pyaedt error:     component_type = Bluetooth
    component_type = Bluetooth
pyaedt error:     name = None
    name = None
pyaedt error:     library = None
    library = None
pyaedt error: Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
pyaedt error: Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
pyaedt error: Method create_component Failed:  General or AEDT Error. Please Check again
Method create_component Failed:  General or AEDT Error. Please Check again
pyaedt error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
(-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)
pyaedt error: Arguments Provided:
Arguments Provided:
pyaedt error:     component_type = Antenna
    component_type = Antenna
pyaedt error:     name = None
    name = None
pyaedt error:     library = None
    library = None
pyaedt error: Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
Error in :   File "C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\modeler\PrimitivesEmit.py", line 145, in create_component
pyaedt error: Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component
Check Online documentation on: https://aedtdocs.pyansys.com/search.html?q=create_component

Define Coupling Among the RF Systems

This portion of the EMIT API is not yet implemented.

Run the EMIT Simulation

This portion of the EMIT API is not yet implemented.

Close Desktop

After the simulaton is completed user can close the desktop or release it (using release_desktop method). All methods give possibility to save projects before exit.

aedtapp.save_project()
aedtapp.release_desktop(close_projects=True, close_desktop=True)

Out:

pyaedt info: Saving Project2596 Project

True

Total running time of the script: ( 0 minutes 9.697 seconds)

Gallery generated by Sphinx-Gallery