Anda di halaman 1dari 7

Document Type: Tutorial NI Supported: Yes Publish Date: Oct 7, 2008

An Introduction to Multisim Automation with the LabVIEW Multisim Connectivity Toolkit (beta)
Overview This article is an introduction to the LabVIEW Multisim Connectivity Toolkit (beta). This toolkit, available at is a wrapper for the Multisim Automation API. With this set of toolkit VIs for LabVIEW, you can create applications which acquire circuit simulation data. Within this white paper, you will learn about the use cases of Multisim Automation, and the toolkit.

Table of Contents 1. 2. 3. 4. 5. 6. 7. Introduction Need to Improve Validation Multisim and LabVIEW Automating Simulation LabVIEW Multisim Connectivity Toolkit Applying the Toolkit Use Cases of Multisim Automation with the LabVIEW Connectivity Toolkit

Introduction The traditional world of circuit design and test continue to be segregated by different tools and a lack of a common interface to facilitate the transfer of design and test data. This divide between initial analysis of a design, and the verification of prototype behavior, has long been the cause of errors and multiple prototype iterations. By leveraging simulation as a part of the design flow, the behavior of the circuit can be dynamically evaluated, and errors identified earlier. With improved validation, and benchmarking of prototype performance, the overall success of the design can more appropriately be judged. NI Multisim and NI LabVIEW are unique in their ability to transfer simulated and real measurement data, as a part of an integrated platform. Through this integration, the test environment (LabVIEW) is able to acquire not only prototype measurement data, but also simulation output. With both sets of data in a single interface, comparison and correlation can be easily approached. With an extensive set of analysis functions, LabVIEW can further analyze how the prototype deviates from the expected results (simulation). In this introductory white paper you will learn how to acquire simulated data within the LabVIEW environment, through the use of the LabVIEW Multisim Connectivity Toolkit (beta). This set of utility VIs allows you to programmatically control, and automate Multisim simulation. Multisim 10.1 employs automation functionality which allows connectivity to COM-aware programming languages. The LabVIEW Multisim Connectivity Toolkit is a wrapper for this automation functionality, thereby allowing LabVIEW to connect to, and visualize Multisim simulated measurements. Through this acquisition, you have an improved method for validation.

Need to Improve Validation To understand why validation needs to be improved, we must first examine the design flow. The traditional design flow for circuits consists of three major stages: 1. The design topology must be captured, and design decisions validated with simulation 2. The validated design must be prototyped through the layout and routing process 3. The prototype behavior must be validated Finally we enter a state of iteration, as we improve the design based upon the validation of the prototype.

However a major issue at this stage of the design flow, is that there is no integration between the traditional worlds of design and test and validation. This lack of connectivity between the two worlds increases the difficulty with which engineers can transfer data and measurements. Without an accurate perspective of design performance compared to design specifications (i.e. the simulation results), it becomes increasingly difficult to truly benchmark the performance of the design. This can mean that errors can cascade through the design flow, and make its way into fabrication. This is the Brick Wall Divide. A hindrance to a predictable, unified and streamlined flow from design specification to prototype validation.


To overcome this brick wall divide, a platform which integrates both elements of design and validation is required. The graphical design of Multisim, and the validation of LabVIEW can now be seamlessly integrated in order to overcome this hurdle and facilitate an improved validation approach.

Multisim and LabVIEW Multisim is a schematic capture and interactive simulation environment for analog and digital circuits. By wrapping the capabilities of SPICE simulation within a graphical interface, it is easier and quicker to simulate circuits. Multisim has a number of different analyses, ranging from transient to AC analysis, from Monte Carlo to Worst-Case. Multisim connects to layout tools such as Ultiboard and Mentor Graphics to physically prototype the circuit.

LabVIEW is a graphical programming language, designed for rapid development of applications. It enables engineers to quickly connect to hardware, and acquire real measurements. By utilizing LabVIEW, engineers can graphically define algorithms to analyze measured data specific to the needs of the application.

It is by unifying these two environments that both real and simulated measurements can be compared and analyzed, to improve the validation of physical circuits. This unification can be done through the Multisim Automation API.

Automating Simulation The Multisim Automation API allows the automation and acquisition of Multisim simulation through a COM-based interface. The API lets you programmatically control a Multisim simulation without needing to view Multisim. Clients written in any COM-aware programming language, such as NI LabVIEW, can access Multisim through this interface, and leverage the simulation engine to acquire simulated measurements. Through the API, you can: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Open and close an existing circuit. Optionally inject a signal in place of an existing voltage or current source. Start, stop, and pause simulations. Read out simulation results from an existing static probe. Enumerate the components in the schematic. Replace components with components from the database. Get and set the values of resistor, capacitor, and inductor components. Enumerate variants. Get and set the active variant for simulation. Generate reports on the schematic, including a bill of materials and a netlist report. Produce an image of the circuit. The API can change and replace components on the top level of a design; components in sub-circuits and hierarchical blocks cannot be altered.

Setting up Inputs In order to setup a Multisim simulation for Automation, certain elements need to be defined to ultimately poll a schematic for input and output values.


By utilizing the API you are able to set the value of a source. Input values are current and voltage sources (such as V2) in the schematic below. Within the Multisim schematic place a DC or AC power supply at any point where you will require the Automation API to be able to adjust or set input values. The DC or AC power supply creates the connection between the Multisim simulation engine, and the automation program. To place a DC or AC power supply: 1. 2. 3. 4. 5. Select Place >> Component. In the Select a Component dialog select the Master Database. In the Group field, select the Sources group. In the Family field, select the POWER_SOURCES family. In here you can select either AC_POWER or DC_POWER sources.

Setting up Outputs Outputs are denoted by probes placed at nodes requiring analysis. These probes, and their associated names identify to the automation application, the exact place where simulation data is to be acquired from the schematic. To place and identify a probe: 1. 2. 3. 4. 5. Select Simulate > Instruments > Measurement Probe. Connect the probe to a node of interest in the circuit (as seen below at the output). Double-click on the probe. Select the Display tab. In the RefDes section, type the name of the probe. For the purposes of an output of a circuit output is generally an appropriate name.

Automation With the circuit setup, it is time to begin automating the simulation. Automation is based upon Active-X, and as such Active-X controls, allow you to connect from the programming language (C, Visual Basic, LabVIEW etc...) and acquire data from a Multisim schematic/simulation. Below we can see in LabVIEW a small selection of code that utilizes the Active-X based connection to Multisim.

LabVIEW Multisim Connectivity Toolkit The LabVIEW Multisim Connectivity Toolkit (beta) is a set of wrappers for the Multisim Automation API. All the various functions such as opening, closing, and viewing a circuit, as well as running, pausing and stopping simulation have been organized into VIs. This means that rather than having to access Active-X controls (as shown above), standard LabVIEW programming practices can be utilized. To download and install the Connectivity Toolkit, visit and follow the associated instructions. Once installed, the LabVIEW Multisim Connectivity Toolkit can be found in the Connectivity Function palette (as seen below) and can be selected through Functions > Connectivity > Multisim.


Toolkit Functions Below the a table describing all of the various sub-palettes in the toolkit, the associated VIs and their general use or functionality.

Connectivity Functions

Functionality Multisim Connection Multisim Multisim Is Multisim

Description These connection VIs allow you to connect/disconnect to the Multisim simulation engine.

I/O Configuration & Control Multisim Enum Multisim Reserve Multisim Set Input Multisim Clear Input Multisim Enum Multisim Set Output Multisim Output Multisim Get Output Multisim Clear Output Simulation Control Multisim Run Multisim Pause Multisim Resume Multisim Stop Multisim Run Simulation Until Next Multisim Wait For Next Multisim Simulation Multisim Do AC Multisim Do Command File Management Multisim Open Multisim Multisim New Multisim File Multisim Circuit Circuit Configuration Multisim Enum Multisim Enum Multisim Replace Multisim Enum Multisim Active

There are various I/O elements to automated simulation. These I/O functions allow you to get, set or clear inputs and outputs to the simulation.

The actual control of the simulation (run, stop, pause, resume etc) are accomplished through these control functions.

These standard VIs allow you to open, save, close and name schematics viewed through the toolkit.

As mentioned previously the toolkit allows you to use the API functionality of changing values/components in the design


Error & Utility Multisim Last Error Multisim Log Multisim Multisim Version Multisim Multisim Register Stop Multisim Get Circuit

These standard VIs allow you to handle errors, and other utilities which correspond to the use of the automation API.

Polymorphic Functions To make design easier, many of the LabVIEW functions are polymorphic, meaning that a single block has multiple functions, based upon the "personality" setting. For example if we look below at the Log File function, it can have one of three personalities: 1. Get the Log File Path 2. Set the Log File Path 3. Disable the Log File Path The following table showcases all of the various polymorphic functions that are available, and their associated personalities: Function Personalities 1D String Array Enum Inputs Variant 1D String Array Enum Outputs Variant Raw Set Input Data Sampled Input Clear Input All Inputs Output Clear Output All Outputs String AC Sweep 1D String Array Variant Save Save Save As 1D String Array Enum Components Variant Get Active Variant Set Get RLC Value Set From Application Last Error Message From Circuit BOM (Real, Virtual, Txt, Csv) Report Netlist (Probes, No Probes, Txt, Csv) Get Log File Set Disable Get Multisim Path Set

Applying the Toolkit Below we can see a small example of how to setup an AC Analysis. This code is based almost exclusively on the above mentioned LabVIEW Multisim Connectivity Toolkit VIs. You will notice that


the LabVIEW approach to coding is a based upon "data flow" from, one function to the next. By simply selecting a few basic Connectivity VIs, simulation data can be acquired. The basic flow of the code is from left to right, and performs the following functions: 1. 2. 3. 4. 5. 6. 7. 8. Connect to the Multisim Automation API (Multisim Connection palette) Open a Multisim file, based upon the "File Path In" data ( File Management palette) Enumerate the various inputs and outputs in the circuit ( I/O Configuration & Control palette) Perform an AC analysis (S imulation Control palette) Wait till the end of the AC Analysis (Simulation Control palette) Get output data from analysis ( I/O Configuration & Control palette) Show simulation data Close the connection to the Multisim Automation API ( Multisim Connection palette)

Use Cases of Multisim Automation with the LabVIEW Connectivity Toolkit There are three major use cases for the automation of simulation, and the LabVIEW Multisim Connectivity Toolkit: 1. The automation of simulation and validation in a single environment 2. Performing complex, multi-simulation analyses 3. Leveraging LabVIEW web functionality, to access simulation online

Simulation and Validation Due to the intuitive connection to hardware that LabVIEW provides, it is easy for real and simulated measurements to be acquired in a single environment. With both measurements within one interface, LabVIEW can be utilized to compare simulated and real measurements to validate the behavior of a physical prototype as compared to the simulated results. This amounts to a very simple, yet powerful way in which to benchmark prototype behavior, based upon the original design specifications. This is called Integrated Design and Test.

Learn More 1. View a webcast on Improving Circuit Design with Multisim Automation and LabVIEW 2. Learn how companies are utilizing Integrated Design and Test to improve validation

Complex Analyses Automated simulation means that complex analyses can be setup to effectively. For example if one wishes to see what the effects of changing component values will have upon a circuit design, Multisim can be automated through LabVIEW, and values of the various components can be iterated to plot, view and analyze the effects. Similarly if multiple analyses must be ran over different circuits, and their various outputs made available to managers, and other engineering groups for decision making, LabVIEW can again automate the simulation and present the data.


Learn More 1. Access a white paper on automated simulation (with example code, and reference design)

Online Simulation For applications, such as online component evaluation, SPICE simulation is a powerful tool in order to provide strong analysis of device choices. Traditionally SPICE cannot be leveraged on the web, however with LabVIEW connectivity, LabVIEW web services can be utilized in order to take simulation to the web. For example Analog Devices, have available the ADIOpAmpSim web application online which utilizes Multisim simulation in order to allow engineers to select one of 300 different OpAmps and evaluate its behavior. This ability to take simulation to the web is based upon the Multisim Automation API, and LabVIEW as a web services tool, connecting to the simulation DLL.

Learn More 1. See Multisim Automation in action, evaluating the behavior of circuits at Analog Devices ADIOpAmpSim.

Legal This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (