Example Code

Automate Circuits Analyses with the NI LabVIEW Multisim API Toolkit

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Multisim

Code and Documents

Attachment

Download All

Description

Overview

The NI LabVIEW Multisim API Toolkit has been developed for the LabVIEW environment and provides access to more than 120 functions to automate the simulation of a Multisim circuit from LabVIEW. This toolkit is an innovative new connection between the worlds of design and graphical programming. You can for automate simulations easily from a graphical programming language, to:

• Access simulated measurements within the LabVIEW environment for further, domain specific analysis

• Correlate simulated and real measurements in a single LabVIEW environment

• Use simulated measurements as a design under test (DUT), in order to build test/validate cases earlier in the design flow

 

Description

Multisim allows engineers to use simulation to optimize the performance of designs earlier in the design flow and ensure circuits meet specifications with fewer prototype iterations. The LabVIEW Multisim API toolkit added in Multisim 13.0 enables designers of analog and mixed-mode circuits to easily create graphical program in LabVIEW that rapidly perform or automate critical design tasks which is impossible in other simulation tools.  Some of the critical types of analyses that are available include:

  • Evaluating circuit performance with non-ideal signals from real measurements
  • Visualizing outputs of circuits in custom graphs and interfaces
  • Automating and iterating through different design scenarios with LabVIEW

Steps to Implement or Execute Code

 

What is the LabVIEW Multisim API Toolkit?

 

Multisim natively provides an Application Programming Interface (API) that allows for the automation of circuit simulation and analyses through a COM interface that designers can use to programmatically control.

 

The LabVIEW Multisim API Toolkit is a collection of VIs that makes the Multisim API ready-to-use for LabVIEW users. With this API toolkit users can take advantage of over 120 ready-to-use LabVIEW Virtual Instruments (VIs) to:

 

  1. Establish a connection to Multisim, check the connection status, disconnect from Multisim, query the application location and version.
  2. Manage Multisim files (open, create and save files, as well as query file information).
  3. Configure inputs and outputs, as well as also set data for inputs or get data from outputs.
  4. Control and check the state of the simulation (DC, AC, or Transient). 
  5. Execute analyses and use the SPICE command line.
  6. Configure component values, switch models, change circuit parameters, and replace variants of a Multisim circuit.
  7. Perform different utility functions. 
  8. Check for error messages, get a circuit image or generate reports.

How to Install the LabVIEW Multisim API Toolkit

 

The LabVIEW Multisim API Toolkit is installed automatically with Multisim 13

image9068198791219974651.png

 

Example 1: Efficiency Calculation of a Buck Converter

 

This example uses theLabVIEW Multisim API Toolkit to iterate through multiple critical values in a circuit in an automated fashion to assist us in calculating efficiency. Without a toolkit such as this one in LabVIEW an individual would try to optimize efficiency by manually changing values in a circuit and recording the simulated value in each. This is time consuming and error-prone.

 

Our goal for this example will therefore be to set the switching frequency of parameters on a buck converter based on NXP components and then perform a sweep across several switching frequency, Fsw, values. For each step a transient analysis is run and the efficiency of the circuit is automatically calculated. This can all then be plotted and the best switching frequency will be observed through this process.

 

Using the circuit parameters and toolkit, we can step through the development of this test.

 

All the example files are attached to this document in the folder called apidemo.zip

 

  • Open the file Circuit Parameters.vi in LabVIEW 2013
  • Go to the block diagram and see the new VIs for the Multisim connectivity. They are under Connectivity>Multisim

    cvayqtma720669745399912366.jpg

     

  • Notice how from LabVIEW  there are now ready to use VIs for establishing a Multisim connection, running simulation files, configuring circuits, and read/write IOs.
  • On the block diagram there are available explanations on what each of the VIs accomplishes.

    vhleatge2439879999231273807.jpg

     

  • Open the Multisim circuit that this VI is supposed to control and notice the DC-DC buck circuit converting 10V to 3.1V (BuckConverter_API.ms13).
  • Run a quick interactive simulation by pressing the play button to evaluate the circuit operation. The probes should be showing the expected values.

    dferinst1699944545808651202.jpg

     

  • Go to the LabVIEW front panel and run the VI
  • LabVIEW is now controlling Multisim and iterating over multiple values of the switching frequency and creating a plot of the circuit efficiency

By using this approach we can clearly see the various efficiency values of our circuit. The best option can be chosen and we have been able to automate what has traditionally been a complex and error-heavy process.

 

ffbvyydj8278431250530862846.jpg

 

 

Example 2: Automating a Simulation of a Signal Conditioning Circuit with Acquired Heart-Beat Signal

 

In this example a signal conditioning circuit is designed in Multisim to filter acquired heartbeat signals for the development of a biomedical device application.

 

The circuit is a single stage active filter using operational amplifiers from Texas Instruments. While the heart beat signals are real-world signals that could be acquired using a sensor device or simulated using the LabVIEW Biomedical Toolkit.

 

All the design files of this example are in the attached file sigcond.rar

image371051151334773878.jpg

 

image8275850088701797579.jpg

 

As you can see the transient simulation in Multisim could be used to evaluate whether the chosen op-amp will provide the desired filtering response or not for this low-voltage signal. However, for the purpose of this design, the LabVIEW Multisim API Toolkit is leveraged to automate multiple simulation runs that:

 

  • Iterate over a various selection of op-amp to determine which op-amp provide better conditioning
  • Iterate over various input heart-beat signals with various noise levels
  • Calculate the transient responses for each op-amp versus multiple input noise levels
  • Perform advanced signal processing tasks to calculate critical parameters such as the Signal to Noise Ratio (SNR)

The application below is written in LabVIEW. You can simply download and run main.vi under the project Heart Beat Signal Conditioning.lvproj.

 

image8699336526076832957.jpg

 

As you can see using this automation code multiple output plots for different op-amps and input signals have been very easily created. Also the table on top of the graph indicates the different corresponding SNR values. Without the automation of LabVIEW this toolkit provides, such calculation would a separate simulation run for each case which is a lengthy process.

 

Additional Information or References

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.