The procedure for requesting AWR support has changed. Please read all about the new AWR product support process.
Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

The AWR Design Environment (AWRDE) contains a built-in Scripting Development Environment (SDE) based on the SAX Basic programming language. SAX Basic is compatible with Visual Basic for Applications. Scripting automates tasks by controlling items such as schematics, EM structures, VSS system diagrams, and layout as well as retrieving data from the measurements. Python gives the user an alternate programming language in which to write scripts taking advantage of Python's access to a large body of readily available, open-source libraries. AWRDE has an extensive Application Programming Interface (API) to facilitate scripting and the API commands available with VBA can also be accessed using Python. Unlike the built-in SDE, Python is scripted using an external Integrated Development Environment (IDE) of the user's choosing. The Python executable as well the Python library modules reside outside of AWRDE, giving the user flexibility in configuring the Python environment as desired.

SAX Basic versus Python for AWR Scripting

SAX Basic and Python both have their advantages. Choosing which language to use depends on the user's experience level and the requirements that the script must perform.

...

  • For users who know Python and do not want to learn VBA.
  • Access to Python libraries and utilities not available with SAX Basic
    • high level math functions
    • digital signal processing functions
    • highly flexible plotting
  • Faster compute speed on large data arrays.
  • Python as a programming language is growing in popularity and as such, there is a large community in which to get help.
  • Analysis in a Jupyter Notebook.

Interfacing Between AWRDE and Python

AWRDE uses the Common Object Model (COM) interface as a means of interacting with external applications. COM is a well established standard for many popular applications. One of these applications is Python through the standard win32com library.

...

The pyawr library is installed using standard Python package installers such as pip. Once installed, the pyawr module is imported into the Python code similar to other commonly used Python modules. Unlike built-in VBA scripts, Python scripts are developed and executed from within an external IDE that supports code-completion. Some examples of IDE's that support code-completion with pyawr are Visual Studio Code (VS Code), PyCharm, and Spyder, however this list is not exhaustive.

Installation Prerequisites

Before installing the pyawr library, there are a number of required programs and libraries that need to be installed first.

Python and pip

Python 3.7 or later must be already installed. Python installer can either be downloaded from Python Org or from a distribution package such as Anaconda.  The instructions here will follow using Python Org as the Python installation where pip is the primary means of installing individual modules.

...

Set python.exe and python3.exe to the off position

Python IDE

There are several IDEs that support code-completion and you can use your preferred IDE if you would like. For users who do not currently use a particular IDE, Visual Studio Code is the recommended IDE, however PyCharm, Spyder, and Wing are IDEs that have been verified to work with pyawr and code-completion. The following are instructions for installing these IDES and configuring for pyawr code-completion.

...

  1. Download Spyder from https://www.spyder-ide.org and install
  2. In a command window, type pip install spyder-kernels
  3. In Spyder, Tools > Preferences > Completion and linting > Completion tab, check Enable code completion, Show completion details, and Show completions on the fly
  4. In Spyder, Tools > Preferences > Completion and linting> Advanced tab, uncheck Enable Kite

pyawr Installation Procedure

First install win32com and configure it for the AWR Design Environment using this procedure:

...

To view pyawr change history, see  https://pypi.org/project/pyawr/

Example Python Script to Verify pyawr

Copy and paste the following into the Python editor

...