Changes
/* Setting the Simulation Parameters */
[[File:rfspice_banner.png|right|640px]]
[[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D | Back to RF.Spice A/D Wiki Gateway]]'''
[[Image:Tutorial_icon.png|40px]] '''[[RF.Spice_A/D#RF.Spice_A.2FD_Tutorials | RF.Spice A/D Tutorial Gateway]]'''
== SPICE Simulation of Analog Circuits ==
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.
<table>
<tr>
<td>
[[File:b2MAN_Fig212.png|thumb|left|720px|Running a live simulation of an Op-Amp circuit in RF.Spice A/D with circuit animation enabled.]]
</td>
</tr>
</table>
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. [[RF.Spice A/D]] uses the Berkeley SPICE simulation engine (with a number of modifications and enhancements) for all circuit simulations. Since SPICE's algorithms have been in widespread use by the industry for a long period of time, you can be confident in the accuracy of the results you get from [[RF.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. [[RF.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. [[Image:Tutorial_icon.png|40px]] '''[[RF.Spice_A/D#Analog_Tutorial_Lessons| RF.Spice A/D Analog Tutorial Lessons Gateway]]''' <table><tr><td> [[File:b2MAN_Fig213.png|thumb|left|720px|Running a transient test of the same Op-Amp circuit as above in RF.Spice A/D.]]</td></tr></table>
== Analog Circuit Analysis Types ==
* 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. AC frequency sweep analysis performs a nodal admittance solution of your circuit using the "Small-Signal Approximation". Under small-signal assumptions, all the nonlinear active devices of your circuit are replaced with locally linearized behavioral models established about their computed DC bias points.
The following table lists [[RF.Spice]]'s available analog circuit simulation and test types (click on each type to learn more about it):
{| class="wikitable"
! scope="col"| Output Data
|-
| [[Running_Live_Simulations_with_Circuit_Animation Performing Live Simulations with Circuit Animation or Virtual Instruments | Live Simulation]]
| Nonlinear Time-Domain Analysis
| Node Voltages, Branch Currents, Device Powers
| [[Analyzing_Circuits_Using_Predefined_Tests#Network_Analysis | Network Analysis Test]]
| Small-Signal Frequency-Domain Analysis
| Z, Y, H and S [[Parameters]]
|-
|}
== Defining Analog & Mixed-Mode Inputs & Outputs ==
The voltmeter, ammeter and markers all can be used to probe voltages and currents for analog simulations. You can also probe the circuit using the [[Virtual Instruments]] virtual instruments such as the oscilloscope, voltmeter, ammeter, wattmeter, etc. You can use a digital output or digital probe to observe the state of your digital circuit. Mixed-mode circuits may involve both analog and digital probes. 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. When you run one of RF.Spice's many test types on your circuit, you will have access to all the computed voltages and currents at all the nodes and branches of your circuit. However, before you run the test, you have to explicitly indicate which quantities you want to compute. This is done in the "Output Results Options" section of the '''Test Panel''', where you can designate one or more preset graph or table plots.
<table>
<tr>
<td> [[Image:Source1.png|thumb|360pxleft|480px|The DC and Transient tab of Voltage Source dialog showing a sinusoidal waveform.]] </td><td> [[Image:Source3.png|thumb|360px|The DC and Transient tab of Voltage Source dialog showing a square wave signal.]] </td>
</tr>
<tr>
<td> [[Image:Source3.png|thumb|left|480px|The DC and Transient tab of Voltage Source dialog showing a square wave signal.]] </td></tr><tr><td> [[Image:Source4.png|thumb|360pxleft|480px|The DC and Transient tab of Voltage Source dialog showing a piecewise linear waveform.]] </td></tr><tr><td> [[Image:Source2.png|thumb|360pxleft|480px|The Small-Signal AC and Distortion tab of Voltage Source dialog showing the AC signal settings.]] </td>
</tr>
</table>
== Setting the Simulation Parameters ==
===Temperature options===
Temperature options can be found under the Miscellaneous Options tab. To set the operating temperature for the simulation, use temp. Tnom is used to set the temperature at which the model [[parameters]] were measured at. Don’t use this unless you create custom models and you know what temperature you measured their [[parameters]] at.
===Convergence options===
For transient convergence, a number of other options are relevant. itl4 controls the number of iterations in the transient solver at a given timepoint. Increase it to a larger value, e.g. 200, to help with convergence but this may not be enough.
Trtol and chgtol are not tolerance [[parameters]]. Trtol is related to truncation error in the Local Truncation Error timestep control algorithm that is used with the transient simulation. It is related to the timestep during the transient simulation. Chgtol is also used in the LTE algorithm. It's purpose is to prevent the transient from locking up. Both of these should not be used unless you are a spice expert.
Minbreak is the minimum break between timepoints while running a transient simulation. For very sharp transitions, minbreak should be reduced. Breakpoints are inserted by the piecewise linear sources and pulse sources and indicate changes in inputs to the circuit.
Method switches between integration algorithms for calculating capacitor voltages and inductor currents for transient solutions. The possible values are gear for the gear method and trap for the trapezoidal method. The default is trap. Maxord goes along with the gear method and is the maximum order for the multiorder integration method. Higher values of maxord are more accurate but may slow down the simulation.
===Mixed-Mode Circuit Options===
Some options relate to the analog to digital and digital to analog converters that B2.Spice automatically inserts between analog and digital portions of the circuit. The [[parameters]] bb_daOutlow, bb_daOutHigh, bb_adInLow, and bb_adInHigh are for low and high output voltages for D/A converters and for low and high threshold voltages at the input of A/D converters. Bb_daOutX is the indeterminate voltage at the output of the d-to-a converter.
Maxopalter is used in operating point analysis for the maximum alternations between analog and event solutions. Maxevtiter is the maximum number of iterations for event solution. Noopalter prevents the simulator from alternating between analog and event solutions. Ramptime is the transient analysis supply ramping time, but it only seems to be used with xspice models for the capacitor and inductor (rather than the regular spice capacitor and inductor.)
Bypass allows the device calculations to bypass updating values for unchanging elements. I presume that this would speed up the simulation.
Trytocompact is used with [[Transmission Lines|transmission lines]].
Keepopinfo is not used by [[B2RF.Spice A/D]].
For more information on these options, see Inside Spice by Ron Kielkowski published by McGraw Hill.
=== Signal Coverage Options ===
The simulation data directory specifies in which directory temporary data files are written to.
== Additional Considerations for a Successful Simulation ==
Simulation Option : ITL5: This sets the maximum number of total iterations. It defaults to 5000. Try increasing it.
Make your circuit more realistic. Most importantly, add junction capacitances on transistors. These are in model [[parameters]] for transistors.
Decrease shunt resistance: Decrease the value of the shunt resistance using Set [[Simulation Options]].
Simulation Option : RELTOL: This is the relative error tolerance. The default is 0.1%. Try increasing it by a factor of 10, to 1.0 %. This is very useful in solving convergence problems due to the small time step of the transient algorithm.
Increase the absolute current tolerance
===Special Notes for the Op Amp===
<p> </p>
[[Image:Tutorial_icon.png|40px]] '''[[RF.Spice_A/D#RF.Spice_A.2FD_Tutorials | RF.Spice A/D Tutorial Gateway]]'''
[[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D | Back to RF.Spice A/D Wiki Gateway]]'''