Hoffman Amplifiers Tube Amplifier Forum

Amp Stuff => AmpTools/Tech Tips => Topic started by: RicharD on October 05, 2010, 05:09:53 pm

Title: LT Spice
Post by: RicharD on October 05, 2010, 05:09:53 pm
This is a handy dandy tool.  It's nowhere nearly as difficult to use as I thought it would be.  In fact, it may easily become my go to "quick schematic sketch" application.  Drawing schematics is pretty darn easy.  Making the simulator run does pose a bit of a learning curve.  You have to have all your eyes dotted and tees crossed, this is certain.   If I can do it, anyone can.  The price is right (the cost of one admission is your mind) (http://www.youtube.com/watch?v=lnWY3cP8Hr0&a=GxdCwVVULXfP5uaHpGSWEJxj2MwApKkz&list=ML&playnext=1), FREE.  Here's the link:
http://www.linear.com/designtools/software/
You gotta sign up but Linear Technology is a very reputable company so I don't mind them having my eMail address.  Most of the popular tubes have already been modeled and can be snagged over at Duncan Amps.  Here's the link:
http://www.duncanamps.com/spicemodels.html
There's a pretty good tutorial at the Duncan site as well as some example circuits you can download to get your feet wet.  Norman Koren has written some required reading so here's another link:
http://www.normankoren.com/Audio/index.html

For me, the trickiest part was learning some of the syntax required to make the simulator run.  By default, LTSpice already knows how to handle resistors, capacitors, diodes -n- such.  The various opamps or tubes are not default components so you must tell the application where the models are.  It apparently does not know pots or at least I haven't found them yet.  Transformers must be built from individual inductors.  This is a tad hairy but I found some 6 year old PRR posts (on another forum) that got me pointed in the right direction.  My biggest hiccup was discovering that 1M is not 1Meg.  I was able to get my MP4 circuit to accurately sim to the actual lab results.  A screen capture is attached.  
Green = 50mV source
Blue = Grid U4
Red = between R13 & C4
Lt Blue = between C2 & L3
Violet = output between L4 & R6


  
Title: Re: LT Spice
Post by: eleventeen on October 05, 2010, 10:01:04 pm
That's quite cool! I'll have to put that on my neuron-allocation list for learning.
Title: Re: LT Spice
Post by: Shrapnel on October 05, 2010, 10:12:06 pm
I've used this before and found it to be at a very good cost (as you said: FREE!), and works well, as long as you have the right definitions for your tubes if you want to run the simulator. You can even do sweeps with the input frequency.

I also have yet to find a model for a pot, but you can always substitute two resistors for one, and adjust the values accordingly.

And as you noted you must watch your 1m and 1M as they are case sensitive to determine milli and mega. Ks, Ps, and Ns don't seem to matter.
Title: Re: LT Spice
Post by: PRR on October 07, 2010, 11:58:48 am
The core SPICE engine is NOT case-sensitive; it comes from an era when you might only have uppercase on your terminal. Therefore "m' or "M" is milli, and SPICE breaks SI convention by requiring "meg" (any letter-case) for million.

You may have a front-end which "fixes" this; but it is probably good practice to spell-out MEG so you aren't tracing silly GIGO errors.

> knows how to handle resistors, capacitors, diodes -n- such.  The various opamps or tubes are not default components

SPICE was written, well really to get a degree, but nominally to model huge MOSFET logic arrays for the then-new LSI chips. While the final result of logic is yes/no, when you run fast there's a lot of rounding and SPICE can compute waveforms very well so you know if a gate is getting behind the action. It has insane levels of MOSFET models built-in. They need voltage supplies. It has resistors and caps and coils because these are basic blocks. It has JFETs and BJTs. It has a lot of abstract functions because they are easy (a VCVS voltage controlled voltage source is an ideal transformer with infinite response but without in/out conductivity; it's pretty much just 4 pins and an equals sign).

> opamps or tubes are not default components

There may be generic OPAMP and GAIN building blocks; pSPICE has them. Its OPAMP is subtle: it has hidden power supplies, and if it clips it is liable to blow-up the math and quit.

If a perfect (tho buggy) OPAMP is not enough, then you want something which wasn't mature when SPICE was born; that's why it has sub-circuits. You can download models of most chip opamps or near-kin, Do NOT trust them too far: a full simulation of a chip opamp is too complicated and thus too slow to be useful. Most model input current, gain rolloff, and rough clipping. Almost none model power pin currents correctly (load current tends to flow in/out a phantom ground which has no physical reality).

SPICE _must_ be told where "ground" is because it references all computations to a "zero" voltage. In the real world electrons don't need ground (there's no ground on a flashlight) but without a common reference the computations would be too messy.

pSPICE has r_pot. I'm shocked that LTSPICE doesn't, but this is so. It seems to be a developer bias. There is a user-written library with pots.

http://www.diystompboxes.com/smfforum/index.php?topic=24240.0
http://gaussmarkov.net/wordpress/tools/software/ltspice/ltspice-analysis-and-the-dod-overdrive-250/
http://groups.yahoo.com/group/LTspice/
http://gaussmarkov.net/ltspice/DOD250-LTSpice.zip

There should be a "flip" command so that your L1 L2 could be placed with the curleys pretty, the dot at the top, and without the swastika connection.

LTspice labels the graph with node-numbers?? pSPICE finds the nearest part. And any wire, you can double-click, give it a name, and it may use that name for graphs.

R7 R8 R11 may be reduced to two resistors; make R7 R8 much larger and short R11. That's not exactly the same because supply current is lower; don't care here.

R12 is not needed in simulation. It does not affect audio response. The tube and wiring parasitics are not detailed enough to cause VHF troubles. I also think that 6SL7 in a clean layout does not need R12 in real life, but of course sometimes a hot tube works against parasitic L and C and needs a dash of R to stay stable. If you are using it as a schematic artwork tool, fine. R12 forces extra (pointless) computation but that won't lengthen the sim-run long enough to measure. (I remember, on 286 machines, when adding one resistor would slow the run.)
Title: Re: LT Spice
Post by: RicharD on October 10, 2010, 08:54:13 am
Spice is fun to play with, but the Achilles heel is all about data entry.  It's not so hard to get a model up -n- running, but I have to wonder, "how accurate is my approximation?"  Both of my tube models are 3rd party and come with a disclaimer.  Both of my transformers are shoot from the hip approximations each base on 1 side being 200 ohms/ 20Hz 2 Henry, and the other side being impedance ratio * H.  OTOH, my model is acting very much like the real life bread board circuit so ...    :boxing:

LTspice has an export netlist function which ended up being a disappointment whereas KiCad can't read it.  That woulda been just a little too convenient for that to work out. 
Title: Re: LT Spice
Post by: PRR on October 10, 2010, 12:04:20 pm
The triode tube models are accurate enough within "normal" current and voltage as shown on the datasheet curves (which is the usual source for the model parameters).

For your small triodes, errors will happen below 50V and especially below 10V due to ~~1V contact potentials times Mu. Errors again below 0.1mA because the plotted curves are based on data 1mA and up and the low tails were just faked with a French curve. As you get far below the intended current zone the "main" tube cuts-off and there are sneak-paths which form parasitic triodes of low Mu and perveyance.... numbers at 0.001mA are just wrong (and also not much practical use).

Grid clipping is usually a diode and a 1K resistor. Some models omit this. Be sure when you drive the grid positive the input impedance falls. Otherwise you get a free ride in the positive grid zone which makes it seem you will get much more output.

Some triode models flow current even with no power source. That's actually true (cathode heat forces electrons), but the numbers are wrong.

I have not got pentode models to give G2 effects anywhere near right. I suspect a syntax difference between the model and my SPICE.

Compare an LT netist to a netlist that KiCad can eat. Maybe the difference is small punctuation.
Title: Re: LT Spice
Post by: RicharD on October 10, 2010, 07:43:50 pm
>Compare an LT netist to a netlist that KiCad can eat. Maybe the difference is small punctuation.

I compared the 2 different .net files in a text editor.  LT is apples and KiCad is more than simply oranges, more like the deluxe combo with extra cheese and flour tortillas.  The 2+ decades between authoring dates shows in a big way.
Title: Re: LT Spice
Post by: DummyLoad on October 10, 2010, 10:41:08 pm
someone wrote a filter for orcad to kicad - unfortunately, you'll have to compile it.

http://elec4fun.free.fr/

thinking about switching to fedora 14 when it's released and running kicad on open source... i'm pretty much done with micro$oft.

--ISO
Title: Re: LT Spice
Post by: Heinz on October 11, 2010, 03:40:25 am
The second download link http://elec4fun.free.fr/rnif2ki V2.rar (http://elec4fun.free.fr/rnif2ki V2.rar) contains a pre-built binary.

Talking about open source...I switched to Linux more than ten years ago and haven't missed Windows ever since. Over the years I have tried several distributions (Debian, Mandriva, Xandros, Gentoo, SuSE, Ubuntu) and they all have their strengths and weak spots. However, I found Ubuntu to be the easiest and most intuitive for newbies. You can run Ubuntu from the installation CD and give it a try before you decide to install it. LTSpice runs fine in Wine (the windows emulator).
Title: Re: LT Spice
Post by: DummyLoad on October 11, 2010, 07:07:29 am


Talking about open source...I switched to Linux more than ten years ago and haven't missed Windows ever since.

i did a 180 out. running a large statewide network, i found myself spending more time being a unix sys admin than actually running a network. as windows matured (XP, etc) it allowed me time to manage the network without having to compile, re-compile, re-install applications and OS's with every new release, not to mention the differences between OS's at the time and sheer volume of time i spent just hacking the source to get it to compile, that is what pushed me away from open source unix. CAD applications for unix back then were roll your own or pay hefty $$$ for things like cadence, etc. in the late 1990's as more inexpensive CAD tools became available for M$ and network management tools matured, i made the switch completely to M$.

over the last couple of weeks i've been playing with fedora 13 at work, and i am impressed with the evolution of open source once again. eagle CAD is not out of reach price-wise, comes with support, and runs on linux. kicad is not bad at all for a GNU distribution. given that the administrative tools (excel, word, PP etc.) that i need to do my job have finally matured on open source unix, i think the time is right to give ballmer, gates & co. the boot.

when i started hacking unix, you loaded the OS from tape...ugh! god i'm getting old and i don't miss the good 'ol days (http://www.youtube.com/watch?v=-X8Ryn82QLo). my absolute favorite pieces of network hardware run a bastardized version of BSD.

--ISO
Title: Re: LT Spice
Post by: simonallaway on October 11, 2010, 04:09:55 pm
when i started hacking unix, you loaded the OS from tape...ugh!
Even I remember that. It was the only way to update the OS on a Silicon Graphics machine in 1989. Those 250Mb QIC tape drives with the strange cassettes that had stamped aluminium bases? and yes, these were the days when the "tar" command meant "tape archive".

I use linux for my day job, so I still get to use "tar" most days  :grin:
Title: Re: LT Spice
Post by: DummyLoad on October 11, 2010, 05:02:43 pm
you mean like these?  :laugh:

(http://i2.photobucket.com/albums/y11/pmitchel/2010-10-11_16-52-21_205.jpg)

i can't believe i still have those. i found the drive too....  :lipsrsealed:



Title: Re: LT Spice
Post by: Shrapnel on October 13, 2010, 11:17:01 pm
I remember a printer terminal for a mainframe at a college back in the mid 80's that required it's OS and print control to be loaded from punch cards. Sheesh! get one out of place, and it's no-go or don't work right.

I'm so glad that we don't have to use punch cards (or punch tape) to load programs... cassette was slow enough.