Connect with us

Tips and tricks

Tips, tricks, caveats, pitfalls

  1. Harald Kapp
    Undocumented features:
    In addition to "Undocumented LTSPICE features" here are a few other undocumented features:
    • Alt + left click on a signal in the waveform viewer to highlight the corresponding net in the schematic editor.
    • To route wires at an angle other than 90 ° hold down the CTRL key (German: STRG) while drawing the net.
    • Create text with an overbar (e.g. low-active signal) by preceding the text with an underscore.
    • Temporarily highlight all hidden text within a schematic by pressing CTRL+ALT+SHIFT+H
    Source: LT Journal of Analog Innovation, Volume 23, Number 1, April 2013, page 25


    Base-Emitter reverse breakdown of bipolar transistors:

    As I have noted more than one time in this series of SPICE tips and tricks, SPICE simulates a circuit using models of the components. A model, however, is not a perfect replica of reality. Therefore SPICE simulation results always should be taken with a grain of salt and should be checked for plausibility.

    The BJT (Bipolar Junction Transistor) model used by LTSPICE by default does not simulate the base-emitter (B-E) breakdown when operating a bipolar transistor with reverse B-E voltage. B-E breakdown happens at approximately 5 V reverse voltage (see datasheet of the respective transistor for exact values).
    Consider the simple, useless circuit in figure 1:
    figure 1.png
    Figure 1 simple NPN circuit

    Only with Vbe > 0 V (starting at t=5 ms) a current starts to flow into the base of Q1. Even with Vbe = -100 V no current flows into the base of Q1 - far from reality.
    If you need to simulate reverse breakdown you either have to use another model (VBIC, but it may be hard to get the required parameters) or you need to resolve to an equivalent circuit. An example is given in figure 2:
    figure 2.png
    Figure 2 modified NPN circuit

    An additional diode and zener diode in figure 2 model the B-E breakdown at approx. 5 V.
    Note that this approximation may be good for some purposes but is still limited since only models the rise in B-E current during reverse breakdown, but does in no way model the effects of this breakdown on Vce and Ice. So, depending on your requirements, further refinements of the equivalent circuit may be necessary.
    A more elegant approach:
    In „undocumented LTSPICE" it is noted that LTSPICE does support B-E breakdown voltage as part of the Gummel-Poon model for bipolar transistors. You'll have to modify the library elements to add Bvbe=??, ?? being the base-emitter breakdown voltage in volts.

    References:
    SPICE help topics to look at: Q, Bipolar transistor

    Plot artifacts:
    The following example from „Simulating an RTD sensor“ shows a curious dip and peak in the resistance curve of R1 near a temperature of -250 °C:
    figure 3.png
    Figure 3 Artifact in resistance curve

    However, if you activate the display option "Mark data points" in the plot pane, it becomes obvious that there are no data points (no simulated values, green dots in figure 4) for the dip and peak. Thus the dip and peak are generated by the plot routine (possibly a problem with the interpolation algorithm).
    figure 4.png
    Figure 4 Detail of the artifact with active data point markers

    By decreasing the temperature steps from originally 10 ° per step to 1 ° per step the number of data points is increased tenfold which results in a much more accurate plot (figure 5)
    figure 5.png
    Figure 5 Detail of the artifact with active data point markers an tenfold resolution

    See also: "How to deal with SPICE error messages".

    Limiting the size of the raw file:
    Under certain circumstances the size of the raw file can become quite large, especially if :
    • the circuit is large
    • the simulation time is long
    Reduce the size of the raw file by storing only relevant signals. This is achieved using the SPICE directive".SAVE" (see "Adding LTSPICE directives“), e.g.:

    .SAVE V(n001) I(R1)​

    Instead of giving a fixed list of signals you can tell LTSPICE to prompt you for the signals to be saved:

    .SAVE dialog box​

    Now before the simulation starts a dialog box is opened showing all possible signals. Pick the ones you want to analyze with a click of the left mouse button. Select multiple signals by pressing and holding down the SHIFT key during selection.

    Tip: If you have not labeled the relevant signals it may be difficult to find out whether to save for example V(n001) or V(n002). In LTSPICE, while the dialog box is open, you can select the relevant signals from the schematic using the probe (as you are used doing without the .save directive).

    Why and how does this work:
    Normally the raw file stores simulation results for all voltages and currents of the circuit. If you run out of disc space, you can reduce the size of the raw file by limiting the number of voltages and currents stored within this file.

    A word of caution:
    The cost is that you will not be able to probe voltages and currents other than those selected prior to simulation. If you forget to list a voltage or current for saving in the raw file, you're in for another simulation run.

    SPICE help topics to look at: .SAVE, Dot commands, Schematic editing


    Additional SPICE options:
    In case you run into trouble with a simulation, you may want to change some SPICE options in order to persuade SPICE to cooperate. A list of additional SPICE options to play with can be downloaded here:
    http://lpvo.fe.uni-lj.si/fileadmin/files/Izobrazevanje/RO/LTspice/Simulator_options.txt

    See also „How to deal with SPICE error messages“.

    Note: Generally the SPICE options within LTSPICE are set up with default values that give satisfying results. Change the defaults at your own risk. The simulation results may become unreliable.

    Avoid using controlled sources:
    ... if possible, that is.

    Controlled sources (components named e, e2, f, g, g2, h) are notoriously slow and may lead to simulation problems (see "How to deal with SPICE error messages"). If possible, use independent sources or specialized models (if available).

    Example: generating two inverse pulse trains with 5 V level. Two circuits are shown:

    figure 6.png
    Figure 6 Comparison of independent sources vs. controlled sources

    • The circuit to the left simulates in 0.032 seconds computer time.
    • The circuit to the right simulates in 0.454 seconds computer time.

    The circuit without controlled sources simulates 14 times faster!

    SPICE help topics to look at: E. Voltage Dependent Voltage Source, G. Voltage Dependent Current Source

    Doing Math in LTSPICE:
    Combine parametric values (see below) and "What if?" scenarios and let SPICE do the math for you. For example:
    • Define the limit frequency for a low pass filter as {Flimit}. Unlike described below, this variable does not directly define the value of a component. Wait and see.
    • Let LTSPICE calculate the value of the filter capacitor from the limit frequency and the value of the filter resistor:

    Cfilter=1/(2*Pi*Rfilter*Flimit) - See? This is where we use Flimit.​

    Step the filter resistor through some values, e.g.

    .STEP param Rfilter LIST 1k 10k 100k
    figure 7.png
    Figure 7 Stepping a resistor value

    SPICE will step Rfilter through the three values listed. For each value of Rfilter the corresponding value of Cfilter will be computed. With these values an AC analysis will be performed. Looking at the voltage across C1 it is no surprise that the transfer function is identical for all three simulation runs, since the limit frequency of the filter remains constant. If you look at the current through R1, however, you will note the different loading of the voltage source due to the varying impedance of the circuit.

    SPICE help topics to look at: .STEP, .PARAM, .AC

    Using parametric values in LTSPICE:
    Normally, each component in a SPICE circuit (schematic) has a fixed associated value, e.g. C1=10nF in the example below.
    In some cases, however, it may be convenient to assign a variable value to a component. This variable value is defined using a variable name in curly braces and defining the value with a ".PARAM" statement elsewhere on the sheet:

    figure 8.png
    Figure 8 Using parametric values

    In this simple example it is quite unnecessary to use a variable for the series resistor R1. I use this technique whenever a schematic becomes rather large and I want to simulate the circuit using different values for components distributed across the sheet.

    Another good use is, if some components have the same value and this value shall be changed simultaneously across the schematic (a dumb example: change all Pull-Ups from 1k to 10k).

    Using variables with self-explaining names helps to keep a good overview.

    SPICE help topics to look at: .PARAM

    Harald Kapp, 2014-05-13
Electronics Point Logo
Continue to site
Quote of the day

-