To run this script
Select Script → Data → Generate_MDIF_Files from the Menus.
Or in Version 13 or higher you can run the utility directly from this page using this button.
This utility helps users generate MDIF files from a collection of s-parameter files.
When the you run the script, the dialog below will display.
The dialog is organized into 4 main sections.
MDIF File Name
Select which files you would like to combine into an MDIF file. There are two input modes of where files can be selected from the File Location selection.
The default selection is Project.
Any s-parameter data files at the selection located are displayed in the Available Files list. You then select files you want to add to the MDIF file from this column and use the Add>> or Add All>> button to add to the Selected Files list. You can then select form the Selected Files list and use the <<Remove to remove from the selected list. When you are selecting items in the list, hold down the Ctrl key to toggle the selection for the item selected. Hold down the Shift key to select all the items between subsequent mouse clicks. The file extension is listed next to the file to help know the port count for each file. Note: any file over 20 ports will not be listed in the available files list due to utility performance issues. If you need this limit relaxed, please contact AWR support.
When you select Disk, the Browse button will be enabled. Click this button to then browse to a folder on your computer.
The text box shown below will then display the path to the file selected and any available s-parameter files in this directory will be in the Available Files column.
Note: this script does not support cutting and pasting these paths, you must use the browse capability.
After you have added files to the selected column, you can do a preliminary error check on the files by clicking on the Error Check button. Any problems found will be displayed in the Messages text box. For example, with all the selected files shown, one does not have noise data and the message indicates this problem.
MDIF File Name
This field sets the name of the resulting MDIF file. The file will be written to the same directory as the current project, loaded into the project and opened for inspection. If a file already exists in the project with the same name, a number will be appended to the name. The one exception will be if you run the script from a new project that has not been saved, the new file is saved to the AppDataUser folder. You can find this folder from the Help > Show Files/Directories menu.
After you have selected the files to be used to generate the MDIF files, you must configure the variable settings that are used to define each block of data in the MDIF file. These settings are done in the Variable Settings section of the dialog box. There are two modes of defining the variables including: File Location selection.
Specify CSV File
The Use Filenames is the simplest mode where the variable name will be "name" and the values will be the filenames without the extensions as shown below.
The Specify CSV File allows you to use a CSV file to create the variable definitions for each file name. A CSV file is used since many different programs can be used to edit this file. Microsoft Excel makes editing the simplest, but a text editor can work also. After you have selected files, you can click the Generate button to create the start of the CSV file. This file will contain a list of each file selected. Many times, there are comments in each s-parameter file that give clues to details of each file. The 2nd column of the CSV file will be the row specified from each file in the CSV Comment Row field. To make it easier to know which line will have these comments, you can select a file in the Selected Files column and then click to the Preview button to display the first 10 lines of the selected file in the Messages section. See the example below where the first file in the Selected Files is selected and the Preview button was pushed. Note how the bias information is displayed in the 2nd row of the file.
After you have determined any rows to include in the CSV file, enter the row number in the CSV Comment Row and then click the Generate button. It will create a CSV file in the same directory as your project and open the file for editing. The dialog will also show the path to this file. From the previous example, the bias information as on row 2, so with 2 set for the CSV Comment Row, the dialog will show where this file is located as shown below.
Next, you edit the CSV file. The file is created with the filename and any comment rows. The image below shows the file for our example.
You then fill in the variable information, you can enter as many columns as you like. The first row will be the variable name in the file. You cannot use ( or ) in the variable names as these are used to determine variable types (string or double). In this example, below is one variable that contains all the bias information.
Below is another way to do the variable definitions with two variables.
After you have edited the file, the variable information is ready to go.
Note: this script does not support cutting and pasting the path to this file. The code is designed to generate the file, edit the file, save the file and then continue with generating the MDIF file.
This section is used to display any messages generated from the program including:
Error messages from the Error Check button.
Error messages when the OK button is pushed.
Previewing of the selected data file.
Generating the File
After all the data is entered, click the OK button to start generating the MDIF file. Please see the GMDIF help in the AWRDE user's guide for details on how to enable parameter interpolation since this data file type is always used for these MDIF files. This seems confusing but there are two types of MDIF files in the AWRDE, one is for legacy reasons and GMDIF file type is the most flexible.
If running many files, the code can take a while to run. All of the error checks will run with the dialog still open. Once the dialog closes, then the process of writing the file begins. When the code is complete, a dialog box will display indicating the process is complete.
The MDIF file will be loaded into the current project and the file is opened in a new window for inspection.
The following error checks are done when using this utility.
Any file names or paths specified must exist.
All the selected files must have the same port count.
All selected files must either have or not have noise data.
Variable names specified in CSV files, must not have () as these are used for defining the parameter types.
When a CSV file is specified, make sure file names match those selected.