The VSS block, AMP_F, is a file based behavioral amplifier model whose RF performance originates from a text data file. Details on how to use the AMP_F model including the data file formatting requirements can be found in this link. There are two main file formats: frequency dependent where the RF performance is a function of frequency and power dependent where the RF performance is a function of input power.
Creation of the AMP_F model data files from a manufacturer's data sheet is normally a manual process involving editing the text file associated with the AMP_F model. This can become a time consuming process and is prone to errors in both transferring the data sheet values to the AMP_F text file as well as ensuring proper formatting of the AMP_F data file. To assist in the process of transferring the manufacturer's data sheet specifications to an AMP_F compatible text file, a Python based script has been developed. Manufacturer's data can be read in from a two-port Touchstone formatted data file. This data is then converted to the formatting required for the AMP_F text file. Additionally, graphical data from the manufacturer's data sheet can be read in and with user assisted mouse-clicks, data is written to the AMP_F compatible data file.
This document explains how to create AMP_F compatible data files using the Python script. A video is also available using this link.
Running the script first opens the Main Window dialog box where frequency, power, independent variables, directory path and file name can be entered:
In the Main Window under the Parameters tab, which data sheet specifications to include in the AMP_F text file are selected:
For each parameter, clicking the Edit button opens the Data Entry dialog box:
In this dialog box, depending of the parameter type selected, data is either read in from a Touchstone data file or a graphical image of the data sheet specification. For graphical input, the user clicks the mouse along the desired data trace (shown above with the red dots along the green +25 degC trace).
Once all data has been entered, an AMP_F compatible text file is created. This data file can then be imported into an AWR Design Environment (AWRDE) project.
Python with an IDE (Integrated Development Environment) must be installed. Please see this link for a basic IDE along with Python installation instructions. For more advanced Python users, this link or this link are alternatives for IDE and Python installation instructions.
The graphical user interface for the script uses the PyQt5 package. Once Python is installed, the pip Python package installer can be used to install PyQt. In a command window, type:
Matplotlib and Numpy
Matplotlib is used for plotting and image viewing. Numpy is a mathematics package. From a command window, type:
Download and extract this .zip file: MakeAMP_F.zip
There are three .py files, ensure all three files are in the same directory. MakeAMP_F.py is the main Python script whereas the other two .py files are for the graphical user interface.
Starting the Script
Open a Python IDE (instructions for running the standard IDLE IDE is found in this link). Using IDLE as the IDE, go to File > Open
Navigate to MakeAMP_F.py and open.
Then run the script:
If successful, the entry dialog box should open:
Preparing the Data
Before running the script, specifications from the manufacturer must be gathered and prepared. The first decision is to determine which type of AMP_F data file format is to be used: frequency dependent or power dependent. The two formats cannot be combined within one AMP_F data file, only one format is possible. If the manufacturer's specification sheet only contains data such as gain, noise, or distortion as a function of frequency then only the frequency dependent AMP_F data file format will work. Normally only amplifiers designated as power amplifiers contain data that is power dependent.
Up to two independent variables can be used in the Python script. The independent variables can be used for generating multiple blocks of data. See AMP_F help for more information on independent variables. For instance frequency dependent data at multiple temperatures can be entered. Or for power dependent file format, power dependent data at multiple frequencies can be entered using frequency as one of the independent variables.
Frequency Dependent AMP_F Data File Format
The following .zip file is an example of the kinds of manufacturer's data files required for creating an AMP_F frequency dependent data file.
This example uses the Analog Devices HMC788A. Data sheet is included in the .zip file. If Touchstone two-port data files are available from the manufacturer, then these files can be used for frequency dependent AMP_F files. For all other data, individual graphics files must be created from the manufacturer’s data sheet.
For the frequency dependent AMP_F model, the script supports the following specifications:
S21 Magnitude, S21 Phase vs. Frequency
S11 Magnitude, S11 Phase vs. Frequency
S22 Magnitude, S22 Phase vs. Frequency
S12 Magnitude, S12 Phase vs. Frequency
Gain vs. Frequency
Input VSWR, Output VSWR vs. Frequency
Noise Figure vs. Frequency
Input IP3, Output IP3 vs. Frequency
Input IP2, Output IP2 vs. Frequency
Input IP2H, Output IP2H vs. Frequency (2nd harmonic intercept point)
Input P1 dBm, Output P1 dBm vs Frequency
Power Dependent AMP_F Data File Format
The following .zip file is an example of the kinds of manufacturer's data files required for creating an AMP_F power dependent data file.
This example uses the Qorvo TGA2219-CP (data sheet included in the .zip file). For the power dependent AMP_F model, the script supports the following specifications:
Power Out Magnitude, Power Out Phase vs Input Power
IM3 vs Output Power (3rd order intermodulation distortion level)
Output IP3 vs Output Power (3rd order output intermodulation intercept point)
IM2 vs Output Power (2nd order intermodulation distortion level)
Output IP2 vs Output Power (2nd order output intermodulation intercept point)
H2 vs Output Power (2nd harmonic level)
Noise Figure vs Output Power
Note: Touchstone files are not compatible with the power dependent AMP_F model when using the script
Creating Graphics Files from the Data Sheet
For all data besides frequency dependent Touchstone files, graphics files must be created from the manufacturer's specification sheet. Compatible graphics file formats are:
Joint Photographic Experts Group (.jpg or .jpeg)
Portable Network Graphics (.png)
Graphics Interchange Format (.gif)
Bitmap Image File (.bmp)
A number of different methods are available to take a screenshot and save as a graphics file. Here is one example using standard Windows tools:
- Open the manufacturer’s data sheet and display the desired graph. In this example, noise figure graph is of interest:
- With the data sheet active, press Alt-Print Screen. This will take a screen shot of the data sheet.
- Open Windows Paint (for Windows 10: Start > Windows Accessories > Paint)
In Microsoft Paint, click Paste so that the screen shot is displayed in Paint. Then click Select. Drag over the graph of interest (Noise figure in the following example)
- Then click Crop
- Then File > Save as. Select the desired graphics file format (PNG is a good choice)
Repeat this procedure for all of the desired specification types. Place all files in one single directory.
Running the Script
Once all the data files have been prepared, start the script (see this link). The script opens the Main Window dialog box with default settings as shown:
Main Menu selections:
New: Starts a new data file session. Removes all existing data and set all parameters to default values.
Set Default Directory: Opens file browser. Navigate to directory with all the prepared data files. This will also be the directory where the AMP_F compatible text file is stored
Exit: Stops the script
AMP_F File Format
Frequency Dependent: AMP_F data file format set to frequency dependent
Power Dependent: AMP_F file format set to power dependent
Generate AMP_F File: Once all data has been entered, this creates the AMP_F compatible data file
Frequency Dependent File Format
Choose frequency parameters to be used in the AMP_F text file. Edit Start Frequency, Stop Frequency, Number of Frequency points, Frequency units. After making any changes, the entry boxes will gray out and frequency data will not be updated until the Frequencies Apply button is clicked.
VAR 1 and VAR 2
These are the two independent variables to be using in the AMP_F data file. The check box must be checked in order for the independent variable to be used. Values must be separated by commas. Both numeric and alpha numeric values can be accepted. Click the corresponding Apply button to update the independent variable data.
AMP_F File Name
Enter the file name without extension. The file will automatically be given a .txt extension.
Display only. To set the default directory, choose main menu > File > Set Default Directory
Power Dependent File Format
Similar setting as with Frequency Dependent file format except for:
Input Power (X-axis): This is the AMP_F data file's input power range and number of points
Output Power (X-axis): When entering data that is output power dependent, this is the range and number of points to be used. This is only used for data entry purposes, output data will be converted to input data before writing the AMP_F data file.
Frequency Dependent File Format
Enable the check box for each parameter to be used. Many of the parameters are mutually exclusive. For instance, only Output IP3 or Input IP3 can be selected, not both.
Power Dependent File Format
Enable the check box for each parameter to be used.
Displays the state of the data entry for each parameter and each independent variable:
Clicking the Edit button associated with each specification under the Parameters tab opens the Data Entry dialog box. How to use the Data Entry box is dependent on the parameter type.
Image File Data Entry:
File Name: Opens a file browser to allow the appropriate image file to be selected.
Independent Variables: If independent variables have been chosen, then use the pull-down to select each independent variable value for the current data entry. If no independent variables have been configured, then the two independent variables will be grayed out.
Extrapolate Data: For frequency dependent file format, if the frequency range of the entered data does not cover the whole frequency range specified in the Main Window Settings tab, then data below or above the data entry points will be extrapolated if this box is checked. Otherwise data below the lowest data entry point frequency will use the lowest frequency data entry point value and data above the highest frequency data entry point will use the highest frequency data point value.
Graphical Input tab
First the graph needs to be calibrated. Enter the lower-left and upper-right graph coordinates in the appropriate data entry boxes. Click the Pick Lower Left Point button and click the lower-left point on the graph. A green dot will appear. Repeat the procedure for the Pick Upper Right Point button, this time clicking on the upper-right point on the graph.
Now start adding data point by using the left mouse button click. Red dots will appear at the data points as shown:
Right mouse click will remove the nearest data point. Clear Pick Points will remove all data entry points.
Show Data Trace will display a red dashed line. This is the data that will be written to the AMP_F data file. Data is linearly interpolated between data entry points. If the data trace points are too coarse, then increase the number of frequency (or power) points in the Main Window Setting tab. The above image only has 10 frequency points which is too coarse. Setting the number of frequency points to 101 gives better agreement.
Remove Data Trace will remove the red-dashed trace from the graph
Tabular Input tab:
This tab can be used for fine tuning either the data entry points or the data that will be used for the AMP_F text file
The Data Points box shows the data that will be used for the AMP_F text file. The frequency points cannot be modified, however the points in the Data column can be modified. After editing the entries under the Data column, click Apply Modifications to update the data. Restore from Pick Points will reset any modifications.
Set All Y-axis Data can be used to set all data points to the same value.
The Pick Points box shows the data entry points (red dots in the Graphical Input tab). Frequency and Data can be modified. After edits are made, click the Apply Modifications to update both the data entry points as well as the data that will be used for the AMP_F text file.
S-Parameter File Data Entry:
For S-parameter data read froma Touchstone file, there is an option for either converting the Touchstone data directly to data that will be used for the AMP_F text file or entering data graphically as outlined above. The radio buttons under the Main tab in the Data Entry dialog box Read Data From S-parameter File and Enter Data From Graph allow for the selection of the data entry method:
If Enter Data From Graph is selected, the procedure follows the procedure outlined above for using image files for data entry.
If Read Data From S-parameter File is selected then the Graphical Input and Tabular Input tabs are replaced by the File Based Input tab. Under the File Based Input tab, the data from the selected Touchstone file is read and plotted. Entries X Min, X Max, Num X Divisions, Y Min, Y Max, Num Y Divisions are used to adjust the x and y-axis graph settings.
Clicking Show Data Points displays the data that will be used for the AMP_F text file. The red dots with the red-dashed line shows this data:
Exiting Data Entry Mode:
After entering data, return to the Main tab. If independent variables are used, then select the next independent variable value using the pull down list and selecte Graphical Input tab or File Based Input tab as appropriate.
When all data has been entered, click Exit Data Entry button on the Main tab. This will close the Data Entry dialog box and return to the Main Window dialog box.
Generating AMP_F Text File
When all data has been entered for all the desired parameters, from the Main Window dialog box select Generate Files > Generate AMP_F File.
An information dialog box that shows the directory path and file name of the AMP_F text file will be displayed:
Exiting the Script
From the Main Window dialog box, select File > Exit
Using AMP_F Data File
In AWRDE, from the project browser tab select Data Files > Import Data File and browse to the generated AMP_F text file.
The following shows the procedure involved with creating a frequency dependent AMP_F file that has one independent variable.
Prepare The Data
For the amplifier of interest, gather the data which typically originates from the manufacturer. In this example, S-parameters and Noise Figure at 25 deg C and 85 deg C are to be used in the creation of the AMP_F file. So two .s2p (Touchstone formatted S-parameters) files will be required as well as a screenshot of noise figure vs. frequency saved as a compatible image file is also required. See this link for details on preparing the data.
Data used in this example can be found in this link.
Start the MakeAMP_F.py Script
- Open Python Integrated Development Environment (IDE) and open MakeAMP_F.py file. See this link for details.
- Run the script to bring up the Main Window dialog box.
- The script defaults to frequency dependent AMP_F file format. If power dependent formatted AMP_F file is desired, this is found in Main Menu > AMP_F File Format:
- Set the Default Directory. This is the directory that contains the data files gathered during the data preparation steps. This directory will also be used to store the AMP)
The Settings tab Default Directory will display the selection (this field is read only)
Configure the Settings Tab
- Enter the frequencies. Enter Start, Stop, Number Freqs, Units. Then click the Apply button.
- This example will use one independent variable labelled Temperature. Check the box associated with VAR 1 to enable this independent variable. Enter the Name and Values. For Values, each entry is separated by a comma. Click the associated Apply button.
- Enter the AMP_F file name. No extension is required. The script will automatically give this a .txt file name extension.
Configure the Parameters Tab
- Check the boxes associated with the desired parameters. Each associated Edit button will highlight in yellow for each selected parameter. For this example All S Parameters and Noise Figure are the desired parameters.
File Based Data Entry
File based data entry only applies for s-parameter data that is read from .s2p files. All other parameters use image based data entry.
- In the Main Window dialog box under the Parameters tab, click Edit associated with Use All S Parameters. This will open the Data Entry dialog box
- In the Data Entry dialog box click the Browse button and select the appropriate .s2p file (the file associated with the independent variable entry).
- Select the File Based Input tab. The s-parameter data read in from the .s2p file will be displayed in the plot. Use the X Min, X Max, Num X Divisions, Y Min, Y Max, Num Y Divisions to adjust the plot axis. Click the associated Apply buttons to update axis settings
- Click Show Data Points to display the data that will be used in the AMP_F file creation
Remove Data Points deletes this data. This button is useful to ensure that the number of frequency points selected in the Main Window dialog box are adequate.
- Return to the Main tab in the Data Entry dialog box. Select the .s2p file for the next independent variable. Select the next independent variable from the drop down selection associated with the independent variable
- Select the File Based Input tab to verify that the data is correct for this next independent variable. Then return to the Main tab and click the Exit Data Entry button.
- The Data Entry dialog box will close
Imaged Based Data Entry
For all non s-parameter data, the data is enter using an image of the data taken from the device datasheet as part of the data preparation steps above.
- For this example in the Main Window dialog box under the Parameters tab, click the Edit button associated with Noise Figure. This will open the Data Entry dialog box once again.
- In the Data Entry dialog box select the appropriate image file and then click the Graphical Input tab
- Under the Graphical Input tab, enter the lower-left x,y values and the upper-right x,y values. Keep the frequency units the same as the units selected in the Main Window dialog box. For instance for this example, the selected frequency units are GHz.
- Click the Pick Lower Left Point button and then use the left mouse button to choose the lower-left point in the plot. A green dot will appear. Repeat the procedure with the Pick Upper Right Point button.
- Next use the left mouse button to choose data points along the trace of interest (+25C for this case). To erase a single point, use the right mouse button. To erase all points click the Clear Pick Points button.
- Click Show Data Trace button to display the data that will be used in the AMP_F file creation (red dashed line). Click Remove Data Trace to disable this trace.
- Click Tabular Input tab to show both the AMP_F file data points as well as the data points selected from the mouse clicks under the Graphical Input tab.
The left pane is the data the will be used in the AMP_F file creation, termed Data Points. The right pane is the data associated with the mouse clicks under the Graphical Input tab, termed Pick Points. Edit the points and then click the associated Apply Modifications button.
- Return back to the Main tab, select the next independent variable value, then select the Graphical Input tab to enter data for the new independent variable value.
- When all data is entered for all the independent variable values, return to the Main tab and click Exit Data Entry button. This will close the Data Entry dialog box.
Writing the AMP_F File
- When all data entry for all the parameters is complete, click the Status tab in the Main Window dialog box to ensure all the data entry is valid. Each status should read Data Exists.
- Click Main Menu > Generate Files > Generate AMP_F File to write the AMP_F text file
- A dialog box should appear showing where the AMP_F data file was stored
Importing AMP_F File into AWRDE
- Open AWR Design Environment (AWRDE)
- In the Project browser pane, right click on Data Files. Then click on Import Data File... and browse to the AMP_F text file that was generated.
- In a system diagram, add an AMP_F element and set the DATA parameter to the the imported AMP_F text file
- Simulate and verify the results