Difference between revisions of "Undocumented LTspice"
|Line 55:||Line 55:|
The three , 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
The XXXX seems to be the only straightforward, generic , but very spice-efficient are quite easy to make using standard, approved devices.
=== SRflop ===
=== SRflop ===
Revision as of 16:38, 7 September 2009
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.
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)
- XOR – uses correct definition (not commonly expected false definition) for more than two inputs
- Schmitt (aka SchmittBuf SchmittInv DifSchmitt DiffSchmittBuf Diff SchmittInv)
- 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:
The three DACs, 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 DAC, but very spice-efficient DACs are quite easy to make using standard, approved devices.
located in Digital
PhaseDet (aka PhiDet)
located in Digital located in examples/Educational/PLL2.asc
SampleHold (aka Sample)
located in Special Functions located in examples/Educational/S&H.asc
used in UniversalOpamp plaintext subcircuits (in lib/sub)
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.
While many b-source features were not documented until relatively recently (~2007), most are now at least touched upon in Help and the few that are not are covered in the B sources (complete reference) in this wiki.
- BR=f(x) arbitrary resistor where f is an arbitrary function of x (with the special meaning of the voltage across R in this context) and/or any valid node voltage, branch current, etc.
- [[units] Freq=<valuelist> [delay=<value>]] (Pspice compatible format)
The transfer function of the Freq circuit element is specified by an ordered list of points of freq(Hz), mag(dB) and phase(deg) as follows: <(f1,m1,p1)[(f2,m2,p2)...]> where f1<f2<f3, etc. The following units specifiers may optionally precede the Freq keyword: “rad”=radians, “mag”=non dB, (“dB” and “deg” return the defaults), “r_i”=real and imaginary in place of magnitude and phase. If a delay value is called out, the phases of the table values are modified to reflect the delay (delay is automatically adjusted to maintain causality in any case).
- NoJacob The optional NoJacob flag parameter unburdens a device from carrying the mathematical overhead of a Jacobian. For linear or certain well behaved b-source expressions, this small reduction in computational burden can reduce run times slightly. Use with extreme caution, as this greatly increases the risk of creating convergence problems or other errors if misapplied.
- ~ Boolean operator: convert succeeding expression to Boolean then invert
- == Boolean operator: true if preceding expression is equal to succeeding expression, otherwise false
- boltz Boltzmann constant = 1.38062 e-23
- planck Planck's constant = 6.62620 e-34
- echarge Charge of an electron = 1.6021765 e-19
- kelvin Absolute Zero in degrees C = -273.150
- square(x) Function = x**2
- tbl Alternate function name, aka table (look-up table)
- stp(x) Alternate function name, aka u(x) (unit step)
- fra(x) Function, very similar to white(x), but = 0 if not SMPS in steady state condition
Add documentation for data file input and triggered sources and the Pspice compatible behavioral forms for E and G sources.
Other Stuff I Forgot
... should be added here or given its own section if warranted.
Miscellaneous Hints and Tricks
Schematic Editor Key Combinations:
- Shift-Ctrl-Alt-R: Permanently renumbers all reference designators within the schematic
- Shift-Ctrl-Alt-H: Temporarily highlights all hidden text within the 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).