6.1 Introduction
6.2 Plotting an Id–Vg Curve
6.3 Exporting Cutline Data to an ASCII File
6.4 Calculating the Sheet Resistance
6.5 Performing Fast Fourier Transforms of Periodic Signals
6.6 Creating GIF Movies
6.7 Running Inspect Scripts
Sentaurus Visual scripting commands are built on the tool command language (Tcl) and, therefore, provide a powerful and flexible way to automate tasks.
Sentaurus Visual features a large set of mathematical functions for dataset manipulation, such as differentiation, integration, and finding the minimum and maximum. In addition, a Tcl list can be converted into a Sentaurus Visual dataset, and the Sentaurus Visual dataset can be converted into a Tcl list, allowing a wide range of data manipulation of TCAD results.
Almost every action performed in the graphical user interface (GUI) of Sentaurus Visual has an equivalent Tcl command. The commands displayed in the Tcl Command panel can be saved and used to create scripts.
In this section, the first example plots an Id–Vg curve using a PLT file from Sentaurus Device. The second example creates a cutline on a 2D structure and saves the data to an ASCII file. The third example shows how to query the dataset in the structure and finds the maximum value of the field and its location. The third example is more advanced and requires an understanding of basic Tcl scripting.
The files discussed in this section are part of the Sentaurus Workbench project export. The complete project can be investigated from within Sentaurus Workbench in the directory Applications_Library/GettingStarted/svisual/export.
You can execute scripting commands in Sentaurus Visual in different ways:
> svisual -bx idvg_vis.tcl
Click to view the master file idvg_vis.tcl.
Below are explanations of the command file line by line.
set mydata [load_file idvg1_des.plt]
The load_file command loads all data in the idvg_des.plt file and returns the name of the dataset. By assigning a return value to the Tcl variable mydata, you can reference the loaded data in the script.
set myplot [create_plot -1d]
The create_plot -1d command creates a new empty frame for an xy plot. Setting the return value of the command to a Tcl variable myplot allows you to reference the plot at later steps of the script as you can see here.
set IdVgcurve [create_curve -plot $myplot -dataset $mydata \ -axisX "gate InnerVoltage" -axisY "drain TotalCurrent"] set_curve_prop $IdVgcurve -plot $myplot -show_markers -markers_size 7 \ -markers_type circlef -label "nMOS"
The first command create_curve uses data from the $mydata dataset and plots it on an empty frame of plot $myplot. To set the properties of this newly created curve, again you set the results of the create_curve command to a Tcl variable. In the second command, curve attributes are modified to include a label and to show symbols.
set_plot_prop -show_grid set_grid_prop -show_minor_lines \ -line1_style dash -line1_color #a0a0a4 \ -line2_style dot -line2_color #c0c0c0 set_axis_prop -plot $myplot -axis x -title "V<sub>gate</sub> (V)" set_axis_prop -plot $myplot -axis y -title "I<sub>drain</sub>\ (A/<greek>m</greek>m)" -type log set_axis_prop -plot $myplot -axis y -range {1e-08 0.001}
This section of the script changes the view of the plot. The first command switches on the grid lines. The second command sets the color grid lines to gray and light gray, and the line type to dashed and dotted lines. The next three commands set the title of the x-axis and y-axis, and the range.
export_view "n@node@_curve.png" -plots $myplot -resolution 500x500 \ -format PNG -overwrite
This command exports a plot into a graphics file in PNG format with resolution of 500 x 500 pixels.
The files discussed in this section are part of the Sentaurus Workbench project export. The complete project can be investigated from within Sentaurus Workbench in the directory Applications_Library/GettingStarted/svisual/export.
In this section, the second Sentaurus Visual tool instance npn is discussed. In this example, a 2D structure is cut and the cutline information is exported to a comma-separated value (CSV) file.
Click to view the master file npn_vis.tcl.
Below are explanations of the command file line by line.
set mydata2D [load_file npn_msh.tdr] # create new plot set myplot2D [create_plot -dataset $mydata2D]
The first command loads the TDR file. The command returns the value of the dataset that is assigned to the Tcl variable mydata2d. The second command creates a 2D plot from the loaded dataset.
set mydata1D [create_cutline -plot $myplot2D -type x -at -0.005]
The create_cutline command creates a 1D cutline normal to the x-axis at point x=–0.005. The result of this command is a dataset that includes all fields from the original TDR file.
export_variables {DopingConcentration xMoleFraction Y} \ -dataset $mydata1D -filename "n@node@_data.csv" -overwrite
The export_variables command exports the data for the specified datasets into a text file in CSV format.
This script exports the CSV file without generating any graphical output and does not require a virtual X server. Therefore, it can be run in batch mode using the -b option:
svisual -b npn_vis.tcl
The files discussed in this section are part of the Sentaurus Workbench project export. The complete project can be investigated from within Sentaurus Workbench in the directory Applications_Library/GettingStarted/svisual/export.
This section discusses how to extract the position of the junction along a cutline of a 2D diode and to calculate the sheet resistance of the n-well. This example assumes familiarity with Tcl scripting.
This example is the third tool instance in the Sentaurus Workbench project.
Click to view the master file sheet_res_vis.tcl.
Below are explanations of the command file line by line.
set dataName [load_file diode_des.tdr] set plotName [create_plot -dataset $dataName]
The first two commands load the TDR file and create a plot.
load_library physicalconstants set q $const::ElementaryCharge set position 10
The next block of Tcl commands initializes the variables. The value of the elementary charge is read from the library and stored in the Tcl variable q. The variable position stores the position of the cutline in micrometers.
create_field -dataset $dataName -name NetAct -function <DopingConcentration> create_field -dataset $dataName -name Cond \ -function <eDensity>*<eMobility>+<hDensity>*<hMobility>
Two new fields are created: the first one contains the net doping concentration, and the second one contains the conductance. These quantities are needed to extract the position of the junction and to evaluate the sheet resistance, respectively.
set cutline [create_cutline -plot $plotName -type x -at $position]
The create_cutline command creates a 1D cutline normal to the x-axis at point x=10 μm. The result of this command is a dataset that includes all fields from the original TDR file.
set cutplot [create_plot -dataset C1($dataName) -1d] create_curve -name NetActPlot -plot $cutplot -dataset $cutline \ -axisX Y -axisY NetAct create_curve -name CondPlot -plot $cutplot -dataset $cutline \ -axisX Y -axisY Cond create_curve -name RsheetPlot -plot $cutplot \ -function 1.0e4/($q*integr(<CondPlot>)) set_axis_prop -plot $cutplot -axis y -type log set_curve_prop NetActPlot -plot $cutplot -line_width 3 -label "Doping" set_curve_prop CondPlot -plot $cutplot -line_width 3 -label "Conductance" set_curve_prop RsheetPlot -plot $cutplot -line_width 3 -label "Sheet_Resistance"
A new empty frame for an xy plot along the cutline is created. The first two create_curve commands use data from the $cutline dataset and plot them in the empty frame. The net doping concentration and the conductance curves use the previously created fields. The third create_curve command calculates and plots the sheet resistance along the cutline. The function integr(<CondPlot>) calculates the integral of the conductance along the y-axis.
set x1 1e-10 set x2 10 set ypn "no_junction" set datax [get_curve_data NetActPlot -axisX ] set datay [get_curve_data NetActPlot -axisY ] if {[lindex $datay 0]<0} {set sign -1} else {set sign 1} for {set i 0} {$i<[expr [llength $datax] - 1]} {incr i} { if {([lindex $datax $i]>=$x1)&&([lindex $datax $i]<=$x2)} { if {[expr [lindex $datay $i]*$sign]<0.0} { set ypn [lindex $datax $i] set sign [expr -1.0*$sign] } } }
The next block extracts the position of the junction along the y-axis. The variables x1 and x2 define the window where you look for the junction position. The junction is defined as the location where the net doping concentration changes sign. Therefore, a for loop goes through all of the positions along the cutline in the defined window and checks whether the net doping concentration changes its sign. If such a condition is satisfied, the junction position is stored in the variable ypn.
set Rsheety [probe_curve RsheetPlot -valueX $ypn]
Finally, the command probe_curve extracts the value of the sheet resistance at the junction.
puts "DOE: ypn [format %.2f $ypn]" puts "DOE: Rsheet [format %.2f $Rsheety]"
The calculated junction position and sheet resistance of the n-well are printed out in Sentaurus Workbench.
The files discussed in this section are part of the Sentaurus Workbench project export. The complete project can be investigated from within Sentaurus Workbench in the directory Applications_Library/GettingStarted/svisual/export.
This section discusses how to calculate the fast Fourier transform (FFT) of a periodic signal. Familiarity with Tcl scripting is a prerequisite.
Click to view the master file of the FFT tool instance in the given Sentaurus Workbench project, FFT_vis.tcl.
To use the FFT algorithms in Sentaurus Visual, it is required that 2n equidistant data points are contained in the dataset and that the dataset spans one period of the signal. Even if these requirements are not fulfilled, Sentaurus Visual will return a curve, but the results cannot be interpreted in any meaningful way.
For this example, you will look at one period of a voltage waveform at a gate contact. The signal consists of a DC value of 0.5 V and sinusoidal components of 0.5*sin(ωt)+0.25*cos(2*ωt) V. Thereby, the angular frequency ω corresponds to 100 MHz. Figure 2 shows one period of that signal.
The following explanations describe the FFT command file line by line. To calculate the discrete Fourier transformation of that signal, first the values are read from a Sentaurus Device .plt file and the signal curve is created:
load_file transient.plt -name "ACdata" create_plot -1d -name "FFT" link_plots "FFT" -unlink create_curve -name signal -plot "FFT" -dataset "ACdata" \ -axisX "time" -axisY "gate InnerVoltage"
From the signal curve, you obtain a list tlist with the time data points. This list is used to extract information about the period length, the number of data points, and the time interval between points. This information will be used later for normalization purposes:
set tlist [get_variable_data "time" -dataset "ACdata"] set np [llength $tlist] ;#number of data points set t0 [lindex $tlist 0] ;#start time set dt [expr [lindex $tlist 1]-$t0] ;#time step set t1 [expr [lindex $tlist end]+$dt] ;#end time of period set tp [expr $t1-$t0] ;#period duration set fper [expr 1.0/$tp] ;#period frequency set fmax [expr 1.0/$dt] ;#max representable frequency set anorm [expr 1.0/double($np)] ;#normalization
Before the calculation of the FFT, you check whether the number of data points fullfils the requirement that 2n data points represent the signal and that the data points are equidistant in time:
if { [expr fmod(log($np)/log(2.0),1)] > 1e-16 } { puts "number of data points not 2^n" ; exit }
set tol [expr $dt*1e-12] for { set it 1 } { $it < $np } { incr it } { set tp1 [lindex $tlist $it] ; set tp0 [lindex $tlist [expr $it-1]] if { [expr abs($tp1-$tp0-$dt)] > $tol } { puts "data points are not equidistant"; exit } }
The real and imaginary parts of the Fourier tranform are now calculated from the signal curve <signal>. Then, the signal curve is removed:
create_curve -name ffre -plot "FFT" -function "fftre(<signal>)" create_curve -name ffim -plot "FFT" -function "fftim(<signal>)" remove_curves "signal"
Figure 3 shows the resulting Fourier coefficients.
After some self-explanatory settings of plot properties in Figure 3, the FFT curve data is exported to a file for later use:
export_curves {ffre ffim} -plot "FFT" -filename ./FFTdata.plx -format plx \
For a normalized representation, you reorder the coefficients, normalize the amplitude, and assign frequencies to the coefficient number. To that end, you extract coefficient numbers as well as real and imaginary FFT data to lists:
set freqs [get_curve_data ffre -plot "FFT" -axisX] set fftr [get_curve_data ffre -plot "FFT" -axisY] set ffti [get_curve_data ffim -plot "FFT" -axisY]
Using the symmetry of the Fourier transform, you map the coefficients above the Nyquist frequency to the negative frequency branch. The frequencies associated with the coefficient number are calculated from the signal period and the number of data points:
set frequency [list] set RePart [list] set ImPart [list] set AbsPart [list] set nNyq [expr $np/2.0] foreach freq $freqs ffr $fftr ffi $ffti { if { $freq > $nNyq } { lappend frequency [expr $freq*$fper-$fmax] lappend RePart [expr $ffr*$anorm] lappend ImPart [expr $ffi*$anorm] lappend AbsPart [expr $anorm*sqrt($ffr*$ffr + $ffi*$ffi)] }} foreach freq $freqs ffr $fftr ffi $ffti { if { $freq <= $nNyq } { lappend frequency [expr $freq*$fper] lappend RePart [expr $ffr*$anorm] lappend ImPart [expr $ffi*$anorm] lappend AbsPart [expr $anorm*sqrt($ffr*$ffr + $ffi*$ffi)] }}
For the resulting values, you create variables for a new dataset:
create_variable -name "frequency" -dataset "FFTdata" -values $frequency create_variable -name "real_part" -dataset "FFTdata" -values $RePart create_variable -name "imag_part" -dataset "FFTdata" -values $ImPart create_variable -name "magnitude" -dataset "FFTdata" -values $AbsPart
With this normalized data, a new spectrum plot is created with the real and imaginary parts, and the absolute Fourier components:
create_plot -1d -name "symFFT" link_plots "symFFT" -unlink create_curve -name absval -plot "symFFT" -dataset "FFTdata" \ -axisX "frequency" -axisY "magnitude" create_curve -name realpart -plot "symFFT" -dataset "FFTdata" \ -axisX "frequency" -axisY "real_part" create_curve -name imagpart -plot "symFFT" -dataset "FFTdata" \ -axisX "frequency" -axisY "imag_part"
Figure 4 shows the resulting plot after setting some properties for axes and curves.
In a completely analogous fashion, the inverse FFT can be calculated. To demonstrate this, the FFT data stored earlier to file is loaded, and the corresponding curves are recreated:
load_file ./FFTdata.plx -name "iFFTdata" create_plot -1d -name "iFFT" link_plots "iFFT" -unlink create_curve -name ffre -plot "iFFT" -dataset "iFFTdata" \ -axisX "ffre x" -axisY "ffre y" create_curve -name ffim -plot "iFFT" -dataset "iFFTdata" \ -axisX "ffim x" -axisY "ffim y"
Then, the inverse FFT is calculated based on these curves and scaled to obtain the original voltage components and time period. Finally, the initial FFT curves are removed from the plot:
create_curve -name sim -plot "iFFT" -function "ifftre(<ffim>)/$np" create_curve -name sre -plot "iFFT" -function "ifftim(<ffre>)" set_curve_prop -plot "iFFT" "sim sre" -xScale [expr $tp/$np] remove_curves "ffre ffim"
Figure 5 shows the resulting plots. The even part contains the DC signal part along with the even AC signal part. The DC signal could be eliminated if the 0th Fourier coefficient is set to zero before the inverse transformation is performed.
Plot properties and window-style settings form the remaining part of the FFT script.
In interactive mode, finally, you can move through different plots using the Page Up key and the Page Down key.
The files discussed in this section are part of the Sentaurus Workbench project export. The complete project can be investigated from within Sentaurus Workbench in the directory Applications_Library/GettingStarted/svisual/export.
You can execute scripting commands in Sentaurus Visual in different ways:
> svisual -bx movie_vis.tcl
Click to view the master file movie_vis.tcl.
Below are explanations of the command file line by line.
set dir "./fdsoi_movie" set filelist [lsort [glob -tails -dir $dir IdVgSat__*_des.tdr]]
The glob Tcl command returns a list of file names matching the IdVgSat__*_des.tdr pattern under the ./fdsoi_movie directory inside the Sentaurus Workbench project. The returned value is stored in the Tcl variable filelist.
set_window_full -on windows_style -style max
The first command maximizes the display of the plots within the Sentaurus Visual window (hiding all panels and toolbars). The second command maximizes the display of the active plot within the plot area.
foreach file $filelist { set data [file rootname $file] set datalist "$datalist $data" load_file $dir/$file -name $data set plotname "Plot_${data}" set plotlist "$plotlist $plotname" create_plot -name $plotname -dataset $data }
A foreach loop loads all the files (load_file $dir/$file -name $data) and creates the plots (create_plot -name $plotname -dataset $data). The lists of data and plots are stored under the datalist and plotlist Tcl lists, respectively.
link_plots $plotlist -unlink foreach plotname $plotlist data $datalist { select_plots $plotname set title "Vd=0.9V" set_plot_prop -plot $plotname -title $title -title_font_family arial \ -title_font_factor 2 -title_font_color #000000 -title_font_att bold set_material_prop Silicon -plot $plotname -geom $data -show_bulk set_field_prop -plot $plotname -geom $data Abs(eCurrentDensity-V) \ -show_bands -min 10 -min_fixed -max 1e8 -max_fixed -levels 41 set_field_prop -plot $plotname -geom $data ElectrostaticPotential \ -show -levels 41 -min -0.5 -min_fixed -max 1.5 -max_fixed zoom_plot -plot $plotname -window {-0.03 -0.040 0.02 0.045} set_legend_prop -plot $plotname -position {0.19 0.45} -size {0.51 0.33} \ -precision 1 -orientation horizontal -show_background -nof_labels 8 move_plot -plot $plotname -position {0 0} } link_plots $plotlist link_plots $plotlist -unlink
The link_plots $plotlist -unlink command unlinks all the plots and the next foreach loop applies user-specific properties to all the plots (the field to be plotted, zoom level, axis, legend, and so on). Then, the plots are linked back (link_plots $plotlist) together to ensure having exactly the same view for all plots. The plots are then unlinked (link_plots $plotlist -unlink) for the next steps.
start_movie -resolution 1300x657
The start_movie -resolution 1300x657 command starts the recording of the movie and sets the resolution of the frames.
foreach plotname $plotlist { select_plots $plotname set framename "Frame_$plotname" set framelist "$framelist $framename" add_frame -plot $plotname -name $framename }
For each plot of $plotlist, the add_frame command creates the frames to be used in the movie. The order of frames in the movie is given by the order of the Tcl list framelist that stores the list of frames.
export_movie -filename eCurrentDensity.gif -frames "$framelist" \ -frame_duration 100 -overwrite stop_movie
The GIF movie itself is created using the export_movie command with the stop_movie command. You must specify the list of frames to be used, the frame duration, and the name of the movie.
The resulting movie is shown in Figure 6.
Sentaurus Visual can run Inspect command files.
To run Inspect command files, specify either the -inspect or -i command-line option.
Some Inspect commands and library scripts are not supported. For a complete list of supported Inspect commands and library functions, refer to the Sentaurus™ Visual User Guide, Appendix D.
Inspect commands are executed in a compatibility mode. You cannot mix native Sentaurus Visual commands with Inspect commands in the same command file.
Copyright © 2017 Synopsys, Inc. All rights reserved.