PyAEDT是Python的包(Package),由ANSYS官方於2021年正式釋出,可以透過pip從PyPI網站下載。官方網站連結:https://pypi.org/project/pyaedt/。是一組用來支援AEDT模擬自動化的函式庫,可以支援AEDT全系列產品,包括HFSS, Q3D, Maxwell, Icepak, Circuit, Simplorer等等。
透過PyAEDT,使用者可以利用程式碼完成模擬前的設定及模擬後的資料處理等繁複的工作。與AEDT現行內建的自動化流程相比,最大的特色是PyAEDT支援Cpython。所以可以在Cpython3.8環境安裝PyAEDT,並用一般的IDE(整合設計環境)來編寫並支援除錯,關鍵字提醒等功能。也可以輕鬆整合Scipy, NumPy, Matplotlib等函式庫。
相較現有自動化流程,PyAEDT語法精煉許多,相容PEP8的語法規範,因此程式碼可以縮短很多。可惜現階段不支援錄製功能。另外,因為發展時間還不長,所以涵蓋功能尚不及現行AEDT內建的API,仍需要時間來完善,以下是PyAEDT與現行自動化流程的差異,給各位參考:
Why PyAEDT?
A quick and easy approach for automating a simple operation in the AEDT UI is to record and reuse a scripts. However, disadvantages of this approach are:
- Recorded code is dirty and difficult to read and understand.
- Recorded scripts are difficult to reuse and adapt.
- Complex coding is required by many global users of AEDT.
The main advantages of PyAEDT are:
- Automatic initialization of all AEDT objects, such as desktop objects like the editor, boundaries, and so on
- Error management
- Log management
- Variable management
- Compatibility with IronPython and CPython
- Simplification of complex API syntax using data objects while maintaining PEP8 compliance.
- Code reusability across different solvers
- Clear documentation on functions and API
- Unit tests of code to increase quality across different AEDT versions