diyAudio (
-   Everything Else (
-   -   Free Spice Or Cheap Spice Simulator-Where To Start? (

kelticwizard 11th February 2007 11:24 AM

Free Spice Or Cheap Spice Simulator-Where To Start?
I have in mind a couple of very simple circuits with transformers I would like to mess around with in simulation before trying. I would prefer if the spice simulator contained a loudspeaker to sim, but this is not entirely necessary. The ability to simulate a transformer would be, however.

The demo version of LSPCAD for Adire drivers allows you to simulate passive crossover networks, but lacks the ability to use transformers. Hence my turning to circuit simulators.

Any suggestions where to look? I never used a spice simulator before.

jan.didden 11th February 2007 11:27 AM

Have you searched???

Jan Didden

Pjotr 11th February 2007 12:10 PM

Hmm Jan,

Me think there is something more to say about PSpice in the context of LS simulation. PSpice by itself is nothing more then a numeric solver for differential equations.

The syntax of it is kind of a programming language. You have to understand this syntax to be able to really know what you are doing and to model the things you want to simulate, like loudspeakers..

Nowadays the are a lot of Pspice simulators which have an integrated schematic capture front end that automatically generates the Pspice listing in the background for you and are easy to use.

Kelticwizard, to get your feet wet, here you can download a free student/evaluation version of Microcap: It is limited to 50 components but that is more than sufficient to simulate what you intend. Besides this software get a good introductory textbook about PSpice.

I myself used this software some 10 years ago to simulate a PR loudspeaker box, when no ready made LSsim-software for that was available. BUT to be able to build a model you have to fully understand the mathematics behind it. I have posted some years ago an electro-mechanical model for LS simulation on this board. For that use the search function :D

PSpice is not easy to get started with but at least it is great fun. Good luck!

Cheers ;)

kelticwizard 11th February 2007 01:17 PM


Originally posted by janneman
Have you searched???

Jan Didden

I have searched both Google and this board. In fact, over the years I have paid attention to various threads where people were starting out in Spice, since I had in the back of my mind the idea that I would like to try it someday.

However, there seemed to be so many demos and programs to get started, I thought I would throw it out to the board what I was primarily interested in finding and see which would be the best choice to go.

Just like there are many free/cheap speaker simulation programs, the desirability of which depends on what the user is primarily interested in finding. :)

kelticwizard 11th February 2007 01:19 PM


Thanks. I will take a look at site and see what develops. (Stay tuned, I might need help, lol).

I_Forgot 11th February 2007 08:28 PM

2 Attachment(s)
You can simulate transformers in any spice program, including SwitcherCAD, free from Linear Technology. SWCAD has no limitations and there are a bunch of example circuits that show how to do things like implement transformers.

You use two inductors and add a spice directive that contains the coupling coefficient between the two. Of course, the inductors are ideal, so you will need to figure out a good model for your transformer and add the necessary parasitic elements either as properties of the inductors or connected to them. THAT is ALWAYS the hardest part when using spice.

A lot of people have tried modeling transformers before you so do a web search and see what is out there. You might get lucky and find a decent model that you can tailor to your specific part by making a few simple measurements.


I_Forgot 11th February 2007 09:06 PM

The image in the previous post shows how a transformer is created in SWCAD (and any other spice, as far as I know). The blue trace is the input voltage. The K1 statement contains the coupling coefficient between the two inductors. What you can't see on the schematic is the parasitic series R and parallel C and R for each of the inductors.

A tapped transformer coil would simply have a coupling coefficient statement like K1 L1 L2 L3 .99999

The 1 G resistor to ground on L2 is necessary because each loop in a circuit has to have a DC connection to ground in order for spice's solver to work. Using 1 Gohm ensures that the connection has no effect on the circuit behavior.

You can model core nonlinearities also. The help file that comes in SWCAD has this to say:

There are two forms of non-linear inductors available in LTspice. One is a behavioral inductance specified with an expression for the flux. The inductor's current is referred to by the keyword "x" in the expression. Below is an example in a netlist.

L1 N001 0 Flux=1m*tanh(5*x)
I1 0 N001 PWL(0 0 1 1)
.tran 1

In the above example, I1 supplies a unity dI/dT so that the inductance can be read off as the voltage on node N001.

There other non-linear inductor available in LTspice is a hysteretic core model based on a model first proposed in by John Chan et la. in IEEE Transactions On Computer-Aided Design, Vol. 10. No. 4, April 1991. This model defines the hysteresis loop with only three parameters:

name | parameter | units
Hc | Coercive force | Amp-turns/meter
Br | Remnant Flux Density | Tesla
Bs | Saturation Flux Density | Tesla

The upper and lower branches of the hysteresis major loop are given by

H + Hc
Bup(H) = Bs --------------------- + 0H
|H+Hc| + Hc(Bs/Br-1)


H - Hc
Bdn(H) = Bs --------------------- + 0H
|H-Hc| + Hc(Bs/Br-1)

These functions are plotted in following figure. Hc and Br are the intersections of the major hysteresis loop with the H- and B-axes. Bs is the B-axis intersection of the asymptotic line, Bsat(H) = Bs + 0H, approached as H goes to infinity.

The initial magnetization curve is given by

Bmag(H) = .5 (Bup(H) + Bdn(H))

Minor loops are obtained by various translations of the above equations per the cited reference. The core's absolute and differential permeabilities are a function of H and the history of values of H. The plot below shows the path taken by an asymmetrical minor loop for a typical power ferrite(Hc=16 A-turns/m, Bs=.44T, Br= .10T).

In addition to the core property parameters Hc, Br, and Bs, mechanical dimensions of the core are required:

name | parameter | units
Lm | Magnetic Length(excl. gap) | meter
Lg | Length of gap | meter
A | cross sectional area | meter**2
N | number of turns | --

Note that if specifying a non-zero gap the magnetic field, H, is not proportional to the current in the windings. LTspice solves for the magnetic fields in the core and gap under the assumption of uniform cross sectional area and thin or uniformly distributed gap.

Below is an example that shows inductance vs. current for L1, an inductor wound on a gapped core. You can read out the inductance as V(n001) since current source I1 supplies a unity dI/dt. The core follows the initial magnetization curve, so you can see that the permeability first increases from the initial value as the current is ramped and then drops as it saturates. Since the gap makes the inductance insensitive to the exact permeability of the core, you have to really zoom in on V(n001) to see that it does increase. The peak is when H inside the core is equal to its Hc.

L1 N001 0 Hc=16. Bs=.44 Br=.10 A=0.0000251
+ Lm=0.0198 Lg=0.0006858 N=1000
I1 0 N001 PWL(0 0 1 1)
.tran .5
.options maxstep=10u

You'll find that using spice is the easy part. Modeling components accurately is the hard part.


Pjotr 12th February 2007 06:21 PM


LTspice, or better Swichcad what it is actually named, is also an option. But Microcap has a much better user interface and is easier to get on the run IMO.

But whatever you choose, a good textbook about PSpice is mandatory to stay on the road.

Cheers ;)

I_Forgot 12th February 2007 11:58 PM


Originally posted by Pjotr

LTspice, or better Swichcad what it is actually named, is also an option. But Microcap has a much better user interface and is easier to get on the run IMO.

But whatever you choose, a good textbook about PSpice is mandatory to stay on the road.

Cheers ;)

Last time I looked, Microcap cost money... SWCAD is FREE! A good feature for audio maniacs is the ability to use .wav files for input and output.

Tuinenga's book is good, but somewhat dated by the lack of schematic capture. It does a good job of pointing out some pitfalls and shows how to do some things that can be tricky if you don't know a lot about spice.


kelticwizard 14th February 2007 03:21 PM

2 Attachment(s)
I appreciate your help so far, but I am having some trouble getting started.

So far, I have found out from others that a netlist is sort of a word description of a circuit that a computer can understand. I'm not sure if I need a netlist, or how to make one.

This is supposed to be schematic capture software, but I did not see any provision to capture the schematic just posted. Nor did I see any provision just to import the AC source for use in a different circuit, at least not easily.

You open up this program, see a blank screen, click new schematic, then what? The help files are less than helpful, especially when they illustrate taking something from a "boost" file which does not exist on the program.

This program looks like something that can help a great deal if I can just figure out how to get my feet wet. I don't mind experimenting around once I can start making things happen on the xreen, which I don't seem to be able to do right now.

The entire purpose of this project is to develop a simple tuned circuit to attach to an output transformer to make it behave in certain ways. Given the fact that series LC circuits develop nulls, (short circuits ) at resonance, I thought a little work on the computer would be helpful before i started. If I cannot simulate a loudspeaker on the schematic, even just using an 8 ohm resistor and then fine-tuning by experimentation would suit my purposes on this project.

If it is not asking too much, I crudely drew up a simple circuit in MSPaint and wonder how you can go about putting this into SwitcherCAD and measuring the voltage and amperage from the open side of the transformer. Would that be at all possible?

All times are GMT. The time now is 10:32 PM.

vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2