Spice simulation

www.hifisonix.com
Joined 2003
Paid Member
re MCU coding etc, I have done a bit and its great fun.

PIC is very popular and they have some great tools.

A great site for some practical PIC applied to audio is

http://www.mhennessy.f9.co.uk/index.htm

I happen to use NXP (formally Philips) LPC uC - great mix of peripherals and use the same architecture as the Intel 8051 which I am comfortable with.

If you go onto the Keil website, there are some good forums where you can pick up a lot of tips and code.

If you are in need of quite a bit more power, have a look at the NXP ARM products - built in USB ports, CAN bus etc and up to 500K flash memory. There are some great ARM forums on the web as well.



:)
 
www.hifisonix.com
Joined 2003
Paid Member
I don't know if its been mentioned, but the 'Basic Stamp' modules are also great if you want something really simple and programable in Basic.

I code in C by the way, but would class myself as a 'longterm novice'. I just love being permanently attached to the steepest part of the learning curve.
 
www.hifisonix.com
Joined 2003
Paid Member
Trawling thru this thread, I see there are strong views either side of the divide.

I doubt that spice is a 'great' tool for analyzing audio circuits. However, where is does help is to provide some feedback to 'what . . . if' questions and in that sense it is useful. It will never give a really accurate set of results for a complete amp. For small sections of a circuit it definitely can be beneficial.

I worked with a bunch of people designing switch mode power chips in the semiconductor industry and they were simulating 1 or 2 cycles (at 500Khz) on simple driver and mosfet power switch stages. They spent many man hours optimizing the models, but ended up with very accurate results - e.g. simulation of efficiency witihn 0.5% of practical chip measurements. In cases like these, where every iteration of silicon takes 3 months and a mask set costs minimum $50k, spice (and derivatives or similar tools) play an important role. Despite the views of the Natsemi guru, I'll bet they used simulation extensively in their product development.

Does SPICE work and is it a great tool? You bet, but be prepared to put the effort into your models and use it at device level or at systems level - but don't expect to put an amp circuit in with generic models and get anything out that resembles the physical amp measurements.
 
Bonsai said:
Trawling thru this thread, I see there are strong views either side of the divide.
I doubt that spice is a 'great' tool for analyzing audio circuits. However, where is does help is to provide some feedback to 'what . . . if' questions and in that sense it is useful. It will never give a really accurate set of results for a complete amp. For small sections of a circuit it definitely can be beneficial.
......................

Hi Bonsai,

This makes no sense: it does work or it don't work, no matter how large a section is. The real problem is that some people misuse simulators, for example, by using the wrong models or ignoring the limitations of them.
As for audio, it's not enough using only standard transistor models, without some additions to mimic for example the Early effect or the influence of a stray capacitance or inductance. Of course, without such additions, much chance of garbage in garbage out.
Also, some people (no names) have based their opinion on totally obsolete knowledge about this subject. My advice: just ignore them.
As for accuracy, read my post:
http://www.diyaudio.com/forums/showthread.php?s=&threadid=101810&perpage=10&pagenumber=4 #35

Cheers,
 
PB2 said:



You should understand that your statements are based on how you think real world engineering is done.

The fact is that many people can hack together a design on a bench and make it work, but most professionals know that a production design has to work over process, voltage, and temperature (PVT). Why is this so important in industry? Money and reliability ... If you do a design that makes it to production, ships, and a large percentage of the units are returned due to marginal failures, then that product might cause the company losses rather than profits. Big problem.

Small designs, and reprogrammable designs such as FPGAs can be built and tested in the lab, but this is not practical for large designs or chips being custom or semi-custom fabricated.

Simulation of complete systems, or even often subsystems was not practical years ago due to time constraints, however today in the last 10 to 15 years it is.

I worked in the semiconductor industry where we guaranteed chips (complex often more than 100,000 transistors) to behave the same as in simulation for both functional and (analog) timing behavior over process, voltage, and temperature. We used a variety of simulators, probably many that you never heard of, some for functional verification, and others for timing verification. Cells in libraries are characterized with SPICE, but SPICE is just part of the solution.

Designs were not accepted from a customer that had not been simulated since the simulation was part of the contract to fab (expensive) the part. If the part performed as simulated but did not work in the system then it was a customer's error, if the part did not behave as simulated then it was our issue. Test vectors were captured from a simulation run, and run against the real part on a tester.

We made mistakes from time to time, and it was usually an error in the model, or a bug in the simulator but most often the better tools did work well. Obvioulsy, one had to choose a quality tool set since bugs could mean failure/delays for a project. I did designs also as a customer and saw poor quality tools that nearly sunk several projects.

My point here is that people who claim that SPICE and simulation are useless as a blanket statement would be proven wrong by major segments of the engineering industry.

I have used SPICE for probably more than 20 years, and obviously if you do not have a validated set of models for your semis you cannot blame the simulator. You should also become familiar with the limitations of the models.

You are right, you don't know the temperature in the room, but the fact is that you should be testing over the full intended operating conditions to verify that your design is robust.

Pete B.


Hi Pete,

These are all great points.

Were you an IC designer? I was also.

Bob
 
Hi peufeu, and others!

You mentioned about using simulators without having to pay $$$. What is interesting to me is that the basic core of the simulation is really quite simple. You can "do it yourself" with C or Fortran to get started. The difficulty is that the core of the model might take perhaps a couple of page of code. But then you have to get your problem into it. This requires at the basic level a matrix entry which may take several pages to represent the circuit. Life is made easier with software for circuit drawing, schematic capture, netlisting, graphical results to prod internal nodes (although if you have your own code you can get all the node results in a text file, but that's hard going too...).
I've written a basic model which runs transient and ac analysis, but gave up when commercial simulators with the graphical front ends/back ends came out. I started on a netlist reading file which recognises a few components (bipolar, diodes, R & C) but that so far takes more code than the simulator. To give you an example of the situation.

On top of that there is the model itself. (This refers to two parts, the sub-circuit parameters, which most people take as "the model" but also the set of equations behind the parameters such as the classic Gummel-Poon (Level 3 type) and VBIC which have different characteristics.) Some of the contributors who dismiss SPICE more or less out of hand may appreciate just as much as some users clearly do that garbage in gives garbage out. Garbage in may be just the model parameters: I've simulated an amplifier using a commercially available model which gave WORSE results than the measurements! Then I wrote my own "model" (as in parameter set).
Garbage in may also refer to whether the set of equations accurately describes the electrical results. Generally they do not, because of the effects like temperature and so on, so we have to check the results. On the other hand, simulations are excellent at giving a first view of a circuit, and may pick up silly mistakes. My former boss always said
"if the computer says something is not possible, it is probably right; but if it says something works, you check it"

Maybe if enough interested users want to form an open-source syndicate ....


cheers
John
 
PB2 said:


You certainly make numerous assumptions, and you would be wrong about most of them. You don't know anything about what I have designed (you've not asked) or of the thousands of other designs done in this industry. Further, you comment about my comprehension? You tested me? How arrogant. This is where I stop reading you, not worth my time.

Pete B.


I once witnessed an argument between a friend of mine who was a chemist and another chemist. It was one of those red-in-the-face, spittle-flying arguments that went nowhere once the two sides defined their positions. One of my degrees is in geology and they pump you full of chemistry along the way. I could somewhat follow the lines of the argument, and from what I knew it seemed that my friend had the upper hand, in large part because he had more hands-on experience. The other fellow was arguing from a completely theoretical viewpoint, which was fine as far as it went, but he wasn't including some things that my friend said were relevant. (It's been twenty years or more--I don't remember the finer points of the argument--something about solute deposition from an aqueous solution. Temperature was involved. Something about iron ions. I don't remember the rest.)
As for what you've designed...unless it's high end audio, I don't care. John Curl has earned my respect in this manner. Ditto for Nelson Pass and Charles Hansen. Electronics is a vast field. To assume that ability--even perhaps expertise--in another portion of electronics does not ipso facto grant you expertise in audio. There are too many quirky, weird things in audio.
Peufeu's memory distortion concept is one example. Simple, elegant, and quite reasonable, even from a theoretical point of view; doesn't require much, if any, hand-waving to see how it could apply. But does it show up in simulations? That's another matter entirely. I have no doubt that code can be written and spliced into simulation programs to cover this idea, but it hasn't happened yet.
Sooner or later simulators will address the things that matter in audio, but at this time it's still in the future.
Arrogant? No, just truthful.
It's all in attention to details. To take the superficial view that all that matters is reliability when thermal criteria are on the table is not at all helpful.

Grey
 
Bonsai, I have BSpice on the computer in front of me. I prefer MICROCAP which is Spiced based. I have used electronic simulation programs for more than 40 years. Before that, 45 years ago, I ran the biggest computer in the free world, the IBM 7094 for Lockheed Aircraft. Yes, 45 years ago, almost to the day, I was running computer programs to solve difficult problems in design. I was up to my ears in electronic simulation BEFORE SPICE was even developed, and I was THERE in its initial development.
Still, I have alternate skills, that don't need Spice to be useful. Please read up and understand this.
 
Peufeu's memory distortion concept is one example. Simple, elegant, and quite reasonable, even from a theoretical point of view; doesn't require much, if any, hand-waving to see how it could apply. But does it show up in simulations? That's another matter entirely.

Actually it isn't "mine" ; the idea to apply this to audio comes from Gérard Perrot of Lavardin.

And it does not show up in simulations since the SPICE Gummel-Poon models don't handle non-constant temperature. You can add a function voltage source in the emitter and a RC circuit to model thermal inertia, but hFE and other stuff will not move, so it's really partial.

Still, self-heating of the output transistors is a clean and simple explanation of why amplifiers sound better with higher biasing while theory (and testing with sinewaves of constant amplitude) would predict optimal biasing at a much lower current that what your ears like.

output transistors heat -> Vbe multiplier compensates -> output transistors cool -> you now run in underbiased class B.

See Cordell's paper, for instance, he plots bias versus time after exercising the output stage a bit.

Oh yeah : http://ngspice.sourceforge.net/
 
peufeu said:


Actually it isn't "mine" ; the idea to apply this to audio comes from Gérard Perrot of Lavardin.



Noted. Nonetheless, it's a very nifty concept.
I backed into a related idea with the Aleph-X. I suggested the idea of attaching the front end MOSFETs in that circuit to a block of metal--note: Not a heatsink, just a simple block of metal--to stabilize the temperature of the front end by addition of mass. The devices were operated well within their rated power dissipation, but the DC offset was sensitive to thermal drift. The block of metal was intended to act as a "thermal capacitor" that would minimize the drift.
A partial model is not particularly useful because it tends to lead to false confidence. Assuming that a complete model can be written, that would be a useful step forward.

Grey
 
Bob Cordell said:



Hi Pete,

These are all great points.

Were you an IC designer? I was also.

Bob


Hi Bob,

The short answer would be yes, but I don't really feel like one, more of a systems/design engineer. My emphasis in school was analog design, RF and microwave design, then got pushed into digital on the job, which lead to computer architecture and custom processors.

I did a lot of board level design, then started chip design in the 90s, mostly VHDL and to gates through synthesis. If people don't believe in simulation what will they think of synthesis?

How about you?

Pete B.
 
Sorry for being off-topic here, but I wanted to thank Glen, Pete, Rodolfo, Bonsai and peufeu for their encouragement and suggestions on the microcontroller front.

Regarding the topic, I'd like to mention one thing I like about SPICE.

It has no agenda. It may give wrong answers according to the GIGO principle, but it won't give a wrong answer due to purely political reasons :).
 
I didn't really read this whole thread, but coming from a newbie who knows nothing about electronics, other then what I have read in the past 4 months, I can say this at least...


Simulation or not, chris makes the most sense. He put it accurately when he stated that u use tools of inaccuracy all the time.


Coming from a HIFI diy audience, the only real tool u own is the ear. With that said, tube guys will stand off in another corner telling u distortion of the right kind is better then none at all. Or at least thats how I understand the proverbial argument(don't kill the newb for his POV).

Anyway, there is a difference between those that design for pure listening enjoyment and there is those that design for worse case scenario's under any circumstance that comes to mind. Simulations will work for a good portion of those instances. But as stated, it has its limitations. Those that are not understood by the programmer and engineers designing todays technologies.

Now get back to work!


BTW, I can think of plenty of real world engineering disasters. Those of which that couldn't have been tested in the real world prior to building. At the same time plenty of simulated models have been built in the real world and work flawlessly.

It does prove the final point, nothing can compare to the final end product result. Try it before you buy it!!!!
 
You know what I'd like to see?
I'd like to see some of the guys who do liquid-cooled CCD imaging devices for astronomy show up here. Or SETI. Or perhaps high-sensitivity naval sonar. Something along those lines. I imagine that they run into some of the same it-ain't-in-the-book stuff that we have to deal with. Their insights might be useful, indeed.
I've been in and around computers for over thirty years now and have not learned one single thing of use for audio. Nada. I've got a buddy who knows a fair amount amount about the ignition systems in cars. How much is applicable to audio? Zip, as far as I can tell. There's a place in town that builds motors. Cross pollination with audio? None. But maybe, just maybe, fellas who have to take an analog signal and amplify the ever-living (mumble) out of it--without adding noise, mind you--now, they might be able to tell us something interesting.
Yes, I water cool my amps. No, I'm not willing to go cryogenic on my phono stage just to lower the noise...
...wait a minute...
Just kidding. It'd be a pain in the butt.
Still, I'd like to pick their brains over a beer. Better yet, single malt Scotch or a good wine.

Grey

P.S.: Now I've gone and seriously annoyed myself. A cryogenic phono stage. Oh, bother. Now, I've got to go look up some equations as to temperature vs. noise. Just how cold would it have to be in order to do any good? (Cuz it's for sure it ain't in a simulator...)
Be the first on your block to have a truly quiet phono stage!
Hell, be the first in your nation.
Perhaps hemisphere.
Oh, double bother!
 
[Devil's Advocate] Actually... LTspice let's you do noise analyses, and it does include temperature effects (static only). A .noise line and a .step TEMP line are all you need [/Devil's Advocate]

P.S. I have no idea if it's actually accurate, I use spice, but don't bother with .noise commands.
 
Most phono preamps have 'hiss' levels significantly lower than the surface noise of the vinyl disc that is playing. At loud levels the hiss though slightly audible is immediately masked when the stylus hits the groove.
So do we really need a 'noiseless' phono preamp considering the difficulty in lowering the noise levels significantly using current components ? Ideally yes but practically........ ?