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

Where To Find This Example

AWR Version 14

Understanding AWR .emz Files

AWR Version 13

Understanding AWR .emz Files

Design Notes

Output Equation Syntax With Swept Variables

With the addition of the swept variable framework in AWR products comes an enhanced output equation capability that elegantly handles swept data.  This project will shows how the new output equations work with an example of a device IV curves.  

Device IV Schematic - A very simple schematic used to generate swept data. 

IV Curves Graph - Graph displaying the device IV curves and a scaled version of these curves calculated in the output equations.

Interpolation results Graph - Graph displaying one trace of the IV curves and then results from the output equations interpolating this data to a finer x-axis resolution. Notice that the linear interpolation matches the original data, but the other types of interpolation give a much smoother curve. 

General Output Equation Comments

Any output equation that isn't multi-dimentional (meaning only swept frequency, etc) would be displayed in {}.   Now if there is a swept variable included in the simulation results in the output equations, the results get displayed with nested brackets.  The values for each group of inner brackets are at each x-axis value for the measurement (set in the output equation dialog box) and the values in each inner bracket set are the results at each non x-axis sweep. 

For example, lets say we have a project setup to sweep over frequencies f1,f2,f3,f4 and over powers p1 and p2.  Now lets say we setup an output equation to return these results with frequency on the x-axis and all of the power points.  If we displayed the results they would look like:


    (f1)        (f2)        (f3)      (f4)

where the values in () wont be displayed but are to show what swept value corresponds to which group of data. 

If we set power to be the x-axis and all of the frequency points, the displayed results would look like:


       (p1)             (p2)  

So having discussed the basics of how these work, here is an explanation of the equations in the Output Equations.  To see the resulting value please see the Output Equations block.

The variable x is being assigned the IV curves from the schematic "Device IV". 

x = Device IV:IDC(IVCURVE@VSweep)

The swpvals(x) returns the values set for the x-axis of the measurement, in this case, these are the swept drain voltage of the device


Each group of the inner bracket data in x, corresponds to the swept value in this array.The first value, 0, is the first swept voltage data point.  In the x vector the first group of data is at Vd of 0 and then at all the stepped voltages.  These should all be zero.

The array size function returns the total size of the data, first value is x-axis, second value is the number of swept values


The transpose function transposes the swept variable data.  When IV data is transposed, it re-arranges the data so that now each inner grouping of data corresponds to one stepped value of the data.  If you look closely at the data below you will see this. 

xt = transpose(x)

The three equations below are used to scale the original IV data.  The 1000 term is there to convert from A to mA Remember output equations always return values in base units (A, Hz, Farads, Henries, etc).  These results are then plotted on the "IV Curves" graph.   Try tuning on the scale variable and watch what happens


vg2 = x*1000*scale

The output equations now have an interpolation function where you specify the interpolation type (linear, polynomial, rational function, or cubic), the original x-axis data the original y-axis data and the new x-axis data to be interpolated to.  It will return the interpolated y-axis data.  Results from the different types of interpolation are displayed on the "Interpolation results" graph and are the result of the equations below

First get and display the original x-axis values using the swpvals equation as discussed above

orig_x = swpvals(x)

Second, get the original y-axis data.  This will only be done at one of the stepped values (vg = -0.8).   You can return individual rows or columns of the swept data by using the * operator in the matrix index syntax [row,column].  So below, the synatx x[*,2] means get the results of all the x-axis points at the 2nd swept value point.

orig_y = x[*,2]

Third, create the new x-axis data using the stepped function

new_x = stepped(0,4,0.25)

Fourth, do the interpolation, the first parameter is the interpolation type, 0=linear, 1=polynomial, 2=rational function, 3= spline

new_y_linear = interp(0,orig_x,orig_y,new_x)*1000

Fifth, use the plot_vs function to create a variable with the new arrays.  The plot_vs functions allows you to specify what values to use for the x-axis when plotting an output equation result.  If you don't use this function when you want to plot results, the x-axis will just be the index numbers of the array.

new_y_linear_plot = plot_vs(new_y_linear,new_x)

Sixth, assign the proper units to the x-axis of the data.  The 2nd parameter is a number representing the units.  These are the units enumerations setup in the AWR API.  1 = frequency, 2 = capacitance, 3 = inductance, 4= resistance, 5=conductance, 6=length (metric), 7=length (english), 8=temperature, 9=angle, 10=time, 11=voltage, 12=current, 13= power(log), 14= power)


The three groupings below repeat the six steps above but use the different types of interpolation.

new_y_poly = interp(1,orig_x,orig_y,new_x)*1000

new_y_poly_plot = plot_vs(new_y_poly,new_x)


new_y_rational = interp(2,orig_x,orig_y,new_x)*1000

new_y_rational_plot = plot_vs(new_y_rational,new_x)


new_y_cubic = interp(3,orig_x,orig_y,new_x)*1000

new_y_cubic_plot = plot_vs(new_y_cubic,new_x)


Schematic - Device_IV

Graph - Interpolation results

Graph - IV Curves