Undocumented LTspice

From LTwiki-Wiki for LTspice
Revision as of 03:23, 7 September 2009 by Analogspiceman (talk | contribs)

Introduction

LTspice/SwitcherCAD III is a complete and fully functional SPICE program (electronic circuit simulator) that is available free of charge from the Linear Technology Corporation (LTC).  Because of its superior performance, excellent community support and ease of file sharing, it is rapidly replacing all other SPICE programs (regardless of price) as the simulator of choice for hobbyists, students and professionals alike.

The purpose of this topic is to explore and explain some of the many useful or quirky features that have never appeared in the standard documentation whether due to simple oversight, the feature being considered not important enough, not polished enough or functionally obsolete – or even due to the feature being considered proprietary to another brand of SPICE or to LTspice itself.  LTC considers some of these undocumented features as fair game for open discussion in public forums such as the LTspice Yahoo users group, whereas for others, it considers any such open discussions as a violation of its License Agreement.

"Fair game" is any feature that is or has ever been part of the normal distribution, i.e., appears or ever has appeared in the Help file, as plain text in any of the included sample or example files, in any program menu available during normal use of the program, or in any of the materials, presentation files or handouts from any LTspice seminar presentation.  Such items are all considered as having been officially "documented" and are specifically allowed as discussion topics in public forums such as the LTspice Yahoo users group.  However, be advised that any items that have been dropped from the documentation, even if still functional, should generally be considered obsolete and in risk of being purged from the program code at any time (fortunately, such items are quite rare).

As to the classification of anything not covered above, you must make your own common sense judgment or ask the advice of the users group moderator or the program author via private email.  Clearly any standard, generic SPICE feature that works in LTspice would be okay for general use and discussion regardless of its state of documentation in LTspice.  A lot of the standard devices have undocumented parameters (e.g., tempcos) or syntax (e.g., Pspice specific compatibility) that would fall into this category.  Just as clearly, any undocumented A-device that is specific to LTC’s encrypted, high performance SMPS IC models would likely be considered proprietary knowledge to be protected with due diligence from release to the public domain, lest LTC’s competitors gain the de facto permission to freely copy them in their own circuit simulator offerings (however, it is difficult to see how LTC could legitimately prevent private individuals from making use of such undocumented features in their own simulations or discussing them via private communications).  For these reasons, this last category of undocumented features will not be directly discussed here.


Undocumented A-devices

A-devices are Linear Technology Corporation's proprietary special function/mixed mode circuit simulation elements.  According to LTspice’s Help file, the behavior of a number of these is undocumented because they frequently change with each new set of models available for LTspice (this simply is not true and is most likely offered as both as a credible reason for keeping them hidden and to discourage anyone from bothering to attempt to explore and/or use them).

The Help file lists A-device syntax as:

Annn n001 n002 n003 n004 n005 n006 n007 n008 <model> [instance parameters]

Note that all A-devices have up to 8 possible active device connections, up to 5 inputs (terminals 1 through 5) usually 2 outputs (terminals 6 and 7), and with terminal 8 always as the device common.  A-devices are always netlisted with the full eight connections.  The netlister connects any unused inputs and outputs to terminal 8.  The A-device compiler recognizes this condition as a flag that that terminal is not used and removes it from the simulation matrix.  Current is sourced or sunk from the complementary outputs, terminals 6 and 7, and returned through device common, terminal 8.

A-devices are implemented this way to allow a single device type to act as any combination of a 1 to 5 input, 1 to 2 output device, but with no simulation speed penalty for unused terminals.  Refer to the program Help file for more details about LTspice’s documented A-devices.

Here is a listing of all known LTspice A-devices.

Documented directly in Help:

  • Buf (aka Buf1 Inv)
  • AND
  • OR
  • XOR
  • Schmitt (aka SchmittBuf SchmittInv DifSchmitt DiffSchmittBuf Diff SchmittInv)
  • Dflop
  • Varistor
  • Modulator (aka Modulate Modulate2)

Not documented in Help but available via the schematic Component Selector:

  • SRflop - located in Digital
  • PhaseDet (aka PhiDet) - located in Digital
  • SampleHold (aka Sample) - located in Special Functions

Documented in sample schematics included with the program distribution:

  • PhaseDet (aka PhiDet) - located in examples/Educational/PLL2.asc
  • SampleHold (aka Sample) - located in examples/Educational/S&H.asc
  • OTA – used in UniversalOpamp plaintext subcircuits (in lib/sub), but users group posts (some long standing) containing information about additional aspects of this have been censored

Not documented anywhere by LTC:

  • Counter – documented in the users group (has been officially approved for public use)
  • XxxxxxXxxx – prior long standing users group posts about the device have now been censored
  • XxXxxXXX - never discussed in the users group
  • XXXXX - never discussed in the users group
  • XXXX - never discussed in the users group
  • Xxx - never discussed in the users group

Not documented anywhere by LTC, but the first two of these devices were extensively documented in the users group.  All three devices were eliminated /protected in June 2006 (approximately at release 2.17u ) and all users group posts (some long standing) about these devices have been censored /deleted from the users group archive:

  • XXXxxxx – PWM current mode control comparator and latch
  • XxxXxx – used for making PWM IC oscillators
  • Xxxxx – used for making PWM IC oscillators

Obsolete devices that have been deleted from the LTspice executable:

  • JKflop
  • PGateDrive
  • invPGateDrive
  • invGateDrive

The three XXXs, XxXxxXXX, XxxXXX, XXXX, are specialized A-devices that probably are of little general interest (although their functions and pinouts could likely be easily guessed by examining the data sheets of the few specialized LTC ICs making use of them).

The XXXX seems to be the only straightforward, generic XXX, but very spice-efficient XXXs are quite easy to make using standard, approved devices.

The Counter (divide by n):

This simple device divides the pulse stream on terminal 1 by round(n) where n is specified by the ex-pression assigned to the cycles parameter (this expression may contain node voltages and branch currents).  Standard complementary digital outputs are available on terminals 6 and 7.  Key parameters (with non default example values) are: cycles=3 duty=0.2 (if omitted, defaults to 0.5).  The width of output pulses is, width = round(cycles*duty).  Most of the usual digital a-device parameters also apply, e.g.: Trise, Vhigh, Vlow, Ref, etc. with the exception of Td, which is ignored (the Counter accepts no delay).

Symbol and test circuit are available in the online Yahoo LTspice users group: Files > Tut > Digital A-Devices > A-counter_test1.asc and counter1.asy.


Miscellaneous Hints and Tricks

Schematic Editor Key Combinations:

  • Shift-Ctrl-Alt-R: Permanently renumbers all reference designators within schematic
  • Shift-Ctrl-Alt-H: Temporarily highlights all hidden text within schematic

There's a new option called tseed that lets you seed the integrator with a specific timestep guess.  Just add the SPICE directive ".options tseed=100n" to your schematic (see section on .options).