SPICE Netlist Simulation Using
NI LabVIEW and NI Multisim
Estimated time to complete: 45 minutes
This tutorial demonstrates the step-by-step process to run text-based SPICE
netlist simulations from NI LabVIEW. NI Multisim is used as the simulation
engine and it is run in a background process connected to LabVIEW using the
LabVIEW Multisim API Toolkit.
The LabVIEW Multisim API Toolkit is installed by Multisim and it provides
over 80 VIs to control a Multisim application instance from LabVIEW. In this
tutorial, you will explore the functionality of the SPICE command line interface
this toolkit offers.
Tip Consult the toolkit Help to find programming guides, ...view middle of the document...
Create your own vs. use sample files
If you would like to follow this tutorial and create your own files all you need to
start is the SPICE Command Line.ms13 Multisim design file from the
samples folder. Then follow the implementation instructions of this tutorial.
If you just want to quickly see the demonstration and/or study the sample code
provided, grab all the files in the SPICE Command Line folder, and run the
SPICE Command Line.vi LabVIEW VI.
Tip We recommend that you try to create your own files to get the most out of this exercise.
Do Command Line VI
In the implementation section later in this tutorial you will review the necessary
code to connect to Multisim, simulate and then disconnect. However, the
particular VI that will run the SPICE analysis is called Do Command Line VI.
This VI is found in the functions palette, under the Connectivity » Multisim »
Simulation and Analyses subpalette. The short name displayed in the subpalette
for this VI is SPICE Cmd.
Two file paths are needed as terminals. These are the Command File and the
Log File. You will create and/or specify these paths later.
Command File—this is a SPICE nutmeg command file, which includes
instructions on what SPICE netlist to simulate, what analysis to run (and
its parameters), and where to store the results. You will create this file
with information from Multisim.
Log File—this is a text file created during simulation, it lists every single
command sent to the SPICE engine and the outcome of the command.
Two other files are involved in a SPICE command line simulation, the SPICE
netlist and the raw data files. These two file paths are specified inside the
SPICE Netlist File—this is the circuit description as a regular text-based
SPICE netlist. You will create this file from Multisim.
Raw Data File—this is a text file created during simulation, which
stores the simulation results. You will parse this file to get the results.
The Do Command Line VI does not return the simulation results in a convenient
LabVIEW-formatted data structure like other API toolkit VIs (for example,
Waveform format). Inside the Command File you will specify the file path of the
Raw Data file where the results will be saved in text format. You will then use
LabVIEW File I/O and String VIs to properly parse the Raw Data file.
Standard SPICE netlist files from sources other than Multisim can also be used.
Typically, you will see in the same netlist the circuit description and the analysis
to run. To use the Do Command Line VI for that type of file, we suggest that you
split such netlist into two files, one that only describes the circuit (SPICE Netlist
File), and a second file that describes the analysis to run (Command File).
This section contains the step-by-step instructions to create your own SPICE
netlist files and the VI.
Numbered lines provide the high-level task. The...