Page tree
Skip to end of metadata
Go to start of metadata

Where To Find This Example

Select Help > Open Examples... from the menus and type either the example name listed above or one of the keywords below.

Or in Version 13 or higher you can open the project directly from this page using this button. Make sure to select the Enable Guided Help before clicking this button.

Design Notes

Switch Simulation Using Diodes and Data files


This example demonstrates several approaches to switching networks by showing data files and schematics example.   The example will be shown from the perspective of a switch, where there is one model for the one state and one model for the off state. 

Vector Approach:

Schematic "Diode_Vector" shows a basic switch that use a diode that’s on and off states can be simulated using different models as sub circuits. There are two schematic models for the diode at left and right of the switch circuit representing the 'off' and 'on' states, respectively. Using discrete variables, a variable is defined as an array that allows switching between the two networks by using the tuner or by optimizing (see below).


A second schematic "Data_Vector", allows the tuner to alternate between two imported measurement files (s-parameters representing the 'on' and 'off' states). This could be easily extended to other applications such as attenuators for example. The states are controlled using the sdata variable (shown below) that is also defined as an array. This variable is set to be tunable and can also be optimized similar to the diode implementation. 


The graphs “Data Vector Transfer Characteristic” andDiode Vector Transfer Characteristic respectively display the transfer characteristic of data and diode switch.

CAUTION: You need to use extreme caution using this approach.  Each data file or subcircuit that is switched must be the exact same form as the others.  For example, the number of ports of the subcircuit must the the same.  If using schematics, you cannot switch from a schematic having only linear models to one having nonlinear models.  If using data files, you should make sure they all have the same noise data.   

Switch Approach:

Schematic "Diode_Switch" is identical to the "Diode_Vector" approach except that the SPDT model is used to switch between the two data files that are placed on the schematic.  The variable “b” is used to tie the two SPDT models together.  This variable is constrained from 0 to 1 and has a step set of 1.   The same approach was taken to compare the “Data_Switch” and the “Data_Vector” approaches.  

The graphs “Data Switch Transfer Characteristic” andDiode Switch Transfer Characteristic respectively display the transfer characteristic of data and diode switch.

If you have more than two blocks to switch between, you will need to build a more complex network to pick a single path.  This is show in the “Complex_Switch” schematic.  Notice all the switches are assigned the same variable for the “State” parameter and the first column of switches uses “Bit=0” and the second column uses “Bit=1”.   Please see the help for the SPDT model for more details.   See the “Complex Switch” graph where

Response of this network is plotted and then tune on the “bit” variable to see how one path is chosen with each bit setting.  

MDIF Approach:

Schematic "Data_MDIF" is identical to the "Data_Vector" and “Data_Switch” approach except that the data is now placed in an MDIF data file.  Now, only one block is placed on the schematic and the MDIF parameter can be tuned directly on the block, no equations needed.    This approach could be used for the Diode schematic, but it would require making data files from the schematic and then constructing an MDIF file.  

If you need help making MDIF files, please see our knowledge base for utilities on making MDIF files. 

AWR currently supports two types of MDIF files.   One type only supports two ports and noise data.  The other type supports any number of ports but not noise data.     


By using Tuner, the states of all the approaches listed can be toggled and results are displayed simultaneously.

Recommendations:  Typically when switching out subcircuits, there are only a few and so we recommend using the Switch approach.   When using data files, there can be many different files and so we recommend using the MDIF approach.   

Schematic - Data_MDIF

Schematic - Data_Vector

Schematic - Data_Switch

Graph - Data Switch Transfer Characteristics