Module 2 - Advanced SIMPLIS / 2.4 Advanced Probing |
To download the examples for Module 2, click Module_2_Examples.zip
In this topic:
In the previous topic, 2.4.4 Plotting Frequency Spectrums, you learned how to generate frequency spectrum plots using the Spectrum function. In this topic you will automatically plot the Spectrum function using the .GRAPH statement.
The .GRAPH statement is the underlying method SIMetrix/SIMPLIS uses to automatically generate curves after a simulation completes. A fixed schematic probe is nothing more than a symbol which composes an appropriate .GRAPH statement for plotting after the simulation completes. Because the .GRAPH statement is well documented and you have a way to add content to the netlist with the command (F11) window, you can easily generate your own custom probes using the .GRAPH statement.
In the example from the Getting Started section, a Spectrum function is used in conjunction with a .GRAPH statement to generate the frequency spectrum plot. The .GRAPH statement is stored in the F11 window of the schematic. To view the .GRAPH statement,
*** graphs a frequency spectrum using the Spectrum function .GRAPH "Spectrum( :V1#P , 4096 )" + axisType="auto" persistence=1 graphName="spectrum" curveLabel=".GRAPH Spectrum" + analysis="pop" xLog="auto" yLog="lin" nowarn=true xLabel="Frequency" yLabel="Spectrum(V1)" xUnit="Hz" yUnit="A"
.GRAPH "Spectrum( :V1#P , 4096 )"
The expression must be enclosed in double quotes. Notice this expression is exactly the same expression you used in the previous 2.4.4 Plotting Frequency Spectrums topic. Spaces have been added for readability. All whitespace is removed when evaluating expressions.
+ axisType="auto" persistence=1 graphName="spectrum" curveLabel=".GRAPH Spectrum"
+ analysis="pop" xLog="auto" yLog="lin" nowarn=true xLabel="Frequency" yLabel="Spectrum(V1)" xUnit="Hz" yUnit="A"
This line sets up the axis labels and units, as well as the scaling for the axes. The analysis option is particularly important. Because the analysis option is set to pop, the curve is only generated for POP analyses.
A few rules will be helpful when composing .GRAPH statements:
The spectrum plotted in the Getting Started section contains more frequencies than you might want. The next exercise truncates the plot with the built-in Truncate function.
"Truncate( Mag( Spectrum( :V1#P , 2^12 ) ) , 0 , 1.6Meg )"
This expression has three nested functions. The functions are evaluated in order from the inner-most to the outer-most. In this example, the three functions evaluated are:
You have to insert the Mag() function because the Spectrum function returns the complex data from the FFT, and the Truncate function is expecting a real argument. The Mag() function takes the magnitude of the complex argument, returning a real vector. You then pass this result onto the Truncate function to chop off the higher frequencies plot the result.
The example schematic already has the .GRAPH statement for this exercise stored in the F11 window of the schematic. All you need to do is comment out the default .GRAPH statement, and un-comment the new .GRAPH statement. To produce the spectrum curve over a more limited frequency span,
.GRAPH "Spectrum( :V1#P , 4096 )" + axisType="auto" persistence=1 graphName="spectrum" curveLabel=".GRAPH Spectrum" + analysis="pop" xLog="auto" yLog="lin" nowarn=true xLabel="Frequency" yLabel="Spectrum(V1)" xUnit="Hz" yUnit="A"
*** graphs a truncated frequency spectrum using the Spectrum function *** Exercise #1: comment out the above .GRAPH lines and options, uncomment the next three lines *.GRAPH "Truncate( Mag( Spectrum( :V1#P , 2^12 ) ) , 0 , 1.6Meg )" *+ axisType="auto" persistence=1 graphName="spectrum" curveLabel="Truncated .GRAPH Spectrum" *+ analysis="pop" xLog="auto" yLog="lin" nowarn=true xLabel="Frequency" yLabel="Spectrum(V1)" xUnit="Hz" yUnit="A"
*** graphs a truncated frequency spectrum using the Spectrum function *** Exercise #1: comment out the above .GRAPH lines and options, uncomment the next three lines .GRAPH "Truncate( Mag( Spectrum( :V1#P , 2^12 ) ) , 0 , 1.6Meg )" + axisType="auto" persistence=1 graphName="spectrum" curveLabel="Truncated .GRAPH Spectrum" + analysis="pop" xLog="auto" yLog="lin" nowarn=true xLabel="Frequency" yLabel="Spectrum(V1)" xUnit="Hz" yUnit="A"
In this short example you will add another curve to the Spectrum graph. The new curve will plot the maximum values of the Spectrum, that is, a spectral envelope.
"Maxima( Truncate( Mag( Spectrum( :V1#P , 2^12 ) ) , 40k , 1.6Meg ) )"
Note that compared to exercise #1, you have only added the Maxima function around the original Spectrum function. You also have changed the minimum frequency range on the Truncate function to eliminate the DC value, which is not of interest here. As with exercise #1, the .GRAPH statement and the associated options are already located in the F11 window. To add the spectral envelope,
*** this .GRAPH statement adds a curve at the maxima of the spectrum *** Exercise #2: Uncomment the next three lines *.GRAPH "Maxima( Truncate( Mag( Spectrum( :V1#P , 2^12 ) ) , 40k , 1.6Meg ) )" *+ axisType="auto" persistence=1 graphName="spectrum" curveLabel="Spectral Envelope" *+ analysis="pop" xLog="auto" yLog="lin" nowarn=true xLabel="Frequency" yLabel="Spectrum(V1)" xUnit="Hz" yUnit="A"
*** this .GRAPH statement adds a curve at the maxima of the spectrum *** Exercise #2: Uncomment the next three lines .GRAPH "Maxima( Truncate( Mag( Spectrum( :V1#P , 2^12 ) ) , 40k , 1.6Meg ) )" + axisType="auto" persistence=1 graphName="spectrum" curveLabel="Spectral Envelope" + analysis="pop" xLog="auto" yLog="lin" nowarn=true xLabel="Frequency" yLabel="Spectrum(V1)" xUnit="Hz" yUnit="A"
*** this .PRINT statement brings individual vectors out to the data group. .PRINT I(V1)
In this exercise you will comment out the .PRINT statement and change the Save options to output only voltages. The vector which you are probing is a current, and will no longer be output to the data group. This will prevent the plotting of the curves which are functions of the input current V1#P. As you will see, the .GRAPH statement will fail and no spectrum plots will be generated.
*** this .PRINT statement brings individual vectors out to the data group. *.PRINT I(V1)