An Overview of Analog and Mixed-Mode Circuit Simulation

From Emagtech Wiki
Revision as of 05:49, 2 August 2015 by Kazem Sabet (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

An Overview of Analog Circuit Simulation

An analog circuit consists of a source, one or more passive or active devices and a ground. The sources, devices and the ground are connected to one another using wires. Wires carry electric currents. The interconnections of wires create circuit nodes. Each node has a voltage, and each wire entering a node carries a current. A wire connecting two nodes forces the voltages of those two node to be equal. Analog circuits are governed by Kirchhoff’s current and voltage laws (KCL and KVL). Individual analog devices are characterized by v-i equations, which relate the terminal current(s) of a device to the voltages across those terminals or pins. Passive devices like resistors, capacitors and inductors are governed by linear v-i equations (Ohm’s law), while active devices like diodes and transistors are usually characterized by nonlinear v-i equations.


Sources supply your circuit with known voltages or currents. The voltages and currents at all other nodes of your circuit are the unknowns in an analog circuit simulation. Over the past 30 years, the faculty and graduate students at the University of California, Berkeley, have developed extensive computer algorithms for analog circuit simulation. This project, and the resulting computer code, are known as SPICE. B2.Spice A/D uses the Berkeley SPICE (with some modifications and enhancements) for all circuit simulations. Since SPICE's algorithms have been in wide-spread use by industry for a long period of time, you can be confident in the accuracy of the results you get from B2.Spice A/D. We have also incorporated major pieces of the XSPICE program from Georgia Institute of Technology. XSPICE expands the Berkeley SPICE by providing for mixed-mode simulation, a code modeling module that makes it easier to add new models, and inter-process communications. Further, we have modified the DC transfer function to allow for more general parameter sweeps, and we have added Monte Carlo simulations and parameterized AC and transient simulations.


SPICE algorithms incorporate the behavior a variety of devices including resistors, capacitors, inductors, mutual inductors, independent voltage and current sources, four types of dependent sources, switches, uniform distributed RC lines, and the five most common semiconductor devices: diodes, BJTs, JFETs, MOSFETS, and MESFETS. B2.Spice A/D uses the SPICE algorithms and offers the same circuit capabilities. The BSIM3v3.2 model is another piece that we have added to the simulation engine. This was developed by the bsim3 development team at UC Berkeley. SPICE offers default models of the semiconductor devices; however, the desired parameter values need to be specified. Default model parameters are available when you create a new model in the Device Editor. You can also specify additional device models if the defaults are not adequate.


SPICE provides several different types of analysis, including Operating Point (DS Bias), DC Sweep, AC sweep, and Transient. DC and Transient analyses are iterative processes which terminate when both of the following conditions are satisfied:

  • Nonlinear branch currents converge to within a tolerance of 0.1% or 1 picoamp, whichever is larger.
  • Node voltages converge to within a tolerance of 0.1% or 1 microvolt, whichever is larger.

Failure to converge in DC analysis usually results from incorrectly specifying circuit connections, initial values, or model parameters. Regenerative switching circuits or circuits with positive feedback will often fail to converge, unless the OFF option is used for some of the devices in the feedback path.


Two Distinct Simulation Modes

B2.Spice A/D now has two distinct simulation modes: interactive live "Simulations" and preset non-interactive "Tests". There are important differences between a Test and a Live Simulation. These differences must be understood before you can effectively use B2.Spice A/D.


A live "Simulation" is simply a continuous transient simulation, starting at time t = 0 and incrementing indefinitely by a user-defined time period. Simulations can be paused and continued but they run continuously until stopped, paused or reset. Simulations can be stimulated by Virtual Instruments such as Function Generator or Power Supply, can be measured by Virtual Instruments such as Oscilloscope, Ammeter, Voltmeter, etc. and can be manipulated in real time from the Circuit Parameters Panel in the Toolbox. Instead of using virtual instruments, you can also use regular voltage or current source devices to excite your circuits or use probes or circuit animation to display node voltages and currents.


"Tests", on the other hand, are run with preset and predefined sets of parameters. Tests are used to analyze your circuit in various time and frequency domains. These include a circuit's DC bias (operating point), transient and steady-state AC responses, its noise output, network characteristics, as well as various other responses. The results of tests are displayed on a graph or in a table, not on virtual instruments.


Running B2.Spice A/D Live Simulations

You can start a live time domain simulation of your circuit simply by pressing the green RUN B2Run Tool.png button in the Main Toolbar. But getting meaningful results requires a few more steps. A simulation needs an input such as a source as well as a probe or some kind of virtual instrument to measure the result. Inputs can be source devices found in the supplied parts database. These include voltage sources or current sources that supply power to your circuit. Alternatively, you can use the Power Supply or Function Generator in the Virtual Instruments panel to set up stimuli. To measure the results, you can use the Virtual Oscilloscope, Voltmeter, Ammeter or one of the other meters found in the Virtual Instruments or you can use circuit animation, whereby the computed data are displayed and updated on your schematic.


Set up the appropriate stimulus and meter, set the time step you desire and click the green RUN B2Run Tool.png button to start the simulation. Click the Pause B2Pause Tool.png button in the toolbar to pause the simulation. Click the green arrow B2Run Tool.png again to resume the simulation or click the Strop/Reset B2Stop Tool.png button to reset the time to t = 0. The current time is displayed in the simulation toolbar next to the control buttons. The simulation mode is controlled by the main toolbar and consists of the Reset, Pause, Step, Walk, and Run buttons. These buttons control the progress of operation of the live simulation. The Step Ceiling and Update Interval settings control how the simulation progresses and how often the results are updated. The Step button increments the simulation time by one time step and pauses. Each subsequent click of the Step button increments the simulation by another time step. The Walk button starts the simulation but increases the simulation time by the walk factor, which can be set in the Simulation | Time Options menu.

A live simulation runs a perpetual transient simulation of your circuit starting at time t = 0 and increments the time by the Step Ceiling setting. Results of the simulation are displayed in either the animated schematics or any of the virtual instruments. The results are refreshed by the time specified in the Update Interval setting.


Running a live simulation of an Op-Amp circuit in B2.Spice A/D with Circuit Animation enabled.

Setting the Input

B2.Spice A/D allows both analog and digital stimuli for live simulations. For analog stimuli, you can use the voltage and current sources or the Function Generator or Power Supply in the Virtual Instruments panel. For a digital stimulus, you can use a digital input or a digital source. Note that when you place a voltage or current source in a circuit, Workshop automatically adds a corresponding Function Generator for you. The voltage and current source's transient properties can be set in the transient page of their property dialogs. This allows a variety waveforms including sinusoidal, triangular, square, exponential, piecewise linear, etc.


Setting the Output

The voltmeter, ammeter, and markers all can be used to probe voltages and currents for all simulations. In order to use the marker as a voltage probe, check the checkbox by that name in its property dialog. You can also probe the circuit using the Virtual Instruments such as the oscilloscope, voltmeter, ammeter, wattmeter, etc. Note that virtual voltmeters and ammeters are added to the virtual instrument panel automatically every time you place a voltmeter or ammeter in your schematic. The voltage across the voltmeter, the current through each ammeter, and the voltage at each marker will show up in the various Virtual Instruments depending on their transient or frequency requirements. For more information, refer to the virtual instruments section. You can also display the results of a live simulation using Circuit Animation. In that case, the voltage, current or power data appear on the schematic next to the nodes, wires or devices either as text or graphically as colored wires.


Additional Considerations for a Successful Simulation

B2.Spice A/D operates based on a large number of numerical simulation parameters with default values. In most cases, you do note have to worry about setting or changing these values. However, in certain cases, the simulation of your circuit may not converge or hit a singularity. Then you might be able to improve the simulation speed by adjusting certain parameters. You do this through the simulation options. The options are accessed through the Simulation | Set Simulation Options menu. The options are divided up into three tabs in the dialog: Convergence, Mixed-Mode, and Miscellaneous. For details on these parameter, see the section on Simulation Options.


B2.Spice A/D Test Panel
Running a transient test of the same Op-Amp circuit as above in B2.Spice A/D.

Running B2.Spice A/D Tests

From the Toolbox's Tests tab, you can select, set up, and control any number of tests that can be performed on your circuit. To select a Test and to set it up, click on the "Tests" tab in the Toolbox. The Test Panel shows a list of the available tests with respective checkboxes. Click the "Setup" button next to each test type to set its properties and various available options and settings. Click the green "Run Enabled Tests" button to start the test(s). To learn more about individual tests, please see the section on Tests.

At the bottom of the test panel are three tabs that allow you to run different variations of the selected test. The first tab, Single Test, is a single run through the selected test type using the specified test setup parameters. A graph, table or both can be specified to display the test results. The "Preset Plots" button will allow the specification of plots to display before the test is run. Otherwise, Workshop will automatically plot any meter signals as well as signals specified by the use of Markers.

The Sweep tab allows sweeping of multiple parameters over the test range. For instance, a resistor’s resistance can be stepped from 1K to 10K, with increments by 1K, over the range of a Transient Test. This will actually run 10 Test runs, with the first run having the resistor’s value at 1K, the second will run with the resistor’s value at 2K, and so on, until the resistor’s value is 10K. You can do multilevel sweeps by specifying more than one parameter to sweep, but care must be used, as this will exponentially increase the number of test runs. The Sweep setup button brings up a box that allows you to specify which parameters and how they are swept. The table format is similar to the Live Circuit panel. Select a parameter to sweep and click the Setup Sweep Parameter to set up the sweep parameters. The Monte Carlo Test is similar to the Sweep tests, but the parameter values are varied at random, limited to a user-specified range. The Monte Carlo Setup specifies which parameter to vary and how to randomly vary it.


B2.Spice A/D Test Types

The following is a list of B2.Spice's available test types. Click on each link to read more details about each individual test type.

 

Working with the Schematic Editor   Larr.png   Back to B2.Spice A/D Wiki Main Page   Rarr.png   Digital Circuit Simulation