Help Putting XFormers In Spice Please

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
diyAudio Moderator Emeritus
Joined 2001
I just started Spice a couple of days ago, because I have a vague idea for a XFormer circuit and wanted to work it out. I have a deadline of sorts for the prototype of this project, (not a work deadline, I'm not in the field), and would greatly appreciate help on how to put these X formers into Spice and get them mutually coupled so I can proceed with my simming. Most everything else I am doing seems to be coming naturally, just getting these X Formers entered is giving me problems.

I am interested in audio Xformers, and here the primary is 25H, and the secondary has 4 times the voltage as the primary.

Any help is appreciated.

First, a center tapped X former.
 

Attachments

  • center tapped transformer.gif
    center tapped transformer.gif
    3.5 KB · Views: 267
diyAudio Moderator Emeritus
Joined 2001
Next is two different unconnected secondary windings, except that they can be hooked up at will.

The entire two secondary windings add up to 4 times the voltage as the primary. Again, the primary is 25H. The bottom secondary has a 1: voltage ratio with the primary, the top secndary has a 3:1 voltage ratio to the primary.

I greatly appreciate whatever help I can get. I am finding the LT program somewhat intuitve once you get past the first steps, but I have a deadline on this XFormer prototype. :)
 

Attachments

  • transformers 1.gif
    transformers 1.gif
    3.5 KB · Views: 242
When you use the inductors in LTSpice/SWCAD use the parasitic parameters for winding resistance and capacitance for each L. This minimizes the number of nodes in your circuit and makes the simulations run faster. It doesn't matter much for small circuits, but if they start getting complex, it can help a lot.

I_F
 
Yahoo Groups LtSpice is the best resource, you have to join since its members only

in the LtSpice Group: Files > Lib > Linear Transformers

there are examples with subcircuits and symbols:

xfmr.png


but such elaboration is unnecessary (you have to add .asy to your lib\sym\misc folder, the subcircuit .txt to lib\sub folder)

just put your 3 inductors on the schematic with the turns ratio determining the inductance ratios - if pri L1 = 25 H and secondary L2 is supposed to have 2x pri truns ratio then L2 = (2)^2 * 25 H = 100 H, with L3 = 100 H also you have your "center tapped 4:1 secondary"

to complete the association of L1, L2, L3 as a transformer you need to add the spice directive for the coupling factor to your schematic (far right on tool bar ".op" button)

open <.op> edit box, add text:

K123 L1 L2 L3 0.999

put it on shcematic page with L1, L2, L3
 
diyAudio Moderator Emeritus
Joined 2001
So far, I am making musch, much progress on this project, thanks to the extremely helpful answers on this and other threads on diyaudio.

I have a circuit which might work, but I have been using an 8 ohm resistor as a load. I am interested primarily in vented boxes, some closed boxes too.

I have taken a netlist from Microcap for a vented box speaker, and would like to use the vented box as a load for my circuit.

Here is the Netlist. How do I put this into LT Spice to use as a load?

VENTED-BOX NETLIST
*DISPLAY VM(1)/IM(VD1) FOR INPUT IMPEDANCE
*DISPLAY VM(21) FOR DIAPHRAGM DISPLACEMENT
*DISPLAY VM(22) FOR PORT DISPLACEMENT
*DISPLAY 20*LOG10(VM(23)) FOR ON-AXIS PRESSURE
*DISPLAY 20*LOG10(VM(24)) FOR DIAPHRAGM PRESSURE
*DISPLAY 20*LOG10(VM(25)) FOR PORT PRESSURE
*ELECTRICAL CIRCUIT
VEG 1 0 AC 1V
REW 1 2 ?
*LOSSY VOICE-COIL INDUCTANCE
GRA 2 3 LAPLACE {V(2,3)}={1/(?*PWR(S,?))}
HBLUW 3 4 V2W ?
V1W 4 0 AC 0V
HBLIW 5 0 V1W ?
LMMDW 5 6 ?
RMSW 6 7 ?
CMSW 7 8 ?
ESDPW 8 9 17 10 ?
V2W 9 0 AC 0V
FSDUW 10 17 V2W ?
LMABW 10 11 ?
CABW 11 12 ?
V3W 0 12 AC 0
RALW 11 0 ?
LMAP 11 13 ?
FKP 15 13 V6W ?
LMA1P 13 15 ?
RA1P 13 14 ?
CA1P 13 14 ?
RA2P 14 16 ?
V4W 15 16 AC 0V
V5W 16 0 AC 0V
FKWUP 19 17 V4W ?
LMA1W 17 19 ?
RA1W 17 18 ?
CA1W 17 18 ?
RA2W 18 20 ?
V6W 19 20 AC 0V
V7W 20 0 AC 0V
*DIAPHRAGM DISPLACEMENT SOURCE
EXD 21 0 LAPLACE {I(V2W)}={1/S}
*PORT DISPLACEMENT SOURCE
EXP 22 0 LAPLACE {I(V5W)}={1/(?*S)}
*ON-AXIS PRESSURE SOURCE
EPSUM 23 0 LAPLACE {I(V3W)}={9390*S}
*DIAPHRAGM PRESSURE SOURCE
EPD 24 0 LAPLACE {I(V7W)}={9390*S}
*VENT PRESSURE SOURCE
EPV 25 0 LAPLACE {I(V5W)}={9390*S}
.AC DEC 100 10 10K
.PROBE
.END
 
diyAudio Moderator Emeritus
Joined 2001
For good measure, here is the closed box netlist. How do I put this into LT Spice so I can recall it and use the loudspeaker part for my load?

I got both netlists from this Georgia Tech website, courtesy the famous Marshall Leach. :)

CLOSED-BOX NETLIST
*DISPLAY VM(1)/IM(VD1) FOR INPUT IMPEDANCE
*DISPLAY 20*LOG10(16) FOR ON-AXIS PRESSURE
*DISPLAY VM(17) FOR DIAPHRAGM DISPLACEMENT
*ELECTRICAL CIRCUIT
VEG 1 0 AC 1V
RE 1 2 ?
*LOSSY VOICE-COIL INDUCTANCE
GZE 2 3 LAPLACE {V(2,3)}={1/(?*PWR(S,?))}
HBLUD 3 4 VD2 ?
VD1 4 0 AC 0
*MECHANICAL CIRCUIT
HBLI 5 0 VD1 ?
LMMD 5 6 ?
RMS 6 7 ?
CMS 7 8 ?
ESDPD 8 9 10 13 ?
VD2 9 0 AC 0
*ACOUSTICAL CIRCUIT
FSDUD 13 10 VD2 ?
LMA1 10 12 ?
RA1 10 11 ?
RA2 11 12 ?
CA1 10 11 ?
VD3 12 0 AC 0
LMAB 13 14 ?
RAB 14 15 ?
CAB 15 0 ?
RAL 15 0 ?
*ON-AXIS PRESSURE DISPLAYS IN PROBE WITH 20*LOG10(VM(16))
EXP 16 0 LAPLACE {I(VD3)}={59E3*S}
*DIAPHRAGM DISPLACEMENT DISPLAYS IN PROBE WITH VM(17)
EXD 17 0 LAPLACE {I(VD2)}={1/S}
.AC DEC 50 10 10K
.PROBE
.END
 
kelticwizard said:
So far, I am making musch, much progress on this project, thanks to the extremely helpful answers on this and other threads on diyaudio.

I have a circuit which might work, but I have been using an 8 ohm resistor as a load. I am interested primarily in vented boxes, some closed boxes too.

I have taken a netlist from Microcap for a vented box speaker, and would like to use the vented box as a load for my circuit.

Here is the Netlist. How do I put this into LT Spice to use as a load?

.END

It is a very good idea that you have had, to try to use a spice model of a speaker/box as your load, for simulations. It doesn't make much sense, to me, to use an 8 Ohm resistor as the model, when the responses can be (and usually are) QUITE different, when a loudspeaker model is used instead of a simple resistor.

About the only time I use a resistor as the spice model for an audio amplifier's load, nowadays, is when I want to check my squarewave response into 2.2uF || 8 Ohms.

As long as you're modeling the speaker/box, maybe you ought to also model the cables that go to it.

I found a spice speaker model, and several cables' model parameters, at: http://sound.westhost.com/cable-z.htm . It's worth a read.

There are also some spice speaker models at:

http://www.stereophile.com/reference/60/

and

http://www.pcabx.com/product/amplifiers/index.htm (4 Ohms)

There are also discussions within diyAudio.com, about modeling speakers (and speaker cables). You could do some searches and find them. I found the last two models mentiond above, that way.

Also, in the Files section of the LT-Spice discussion group, at http://www.yahoogroups.com (I HIGHLY-recommend joining that discussion group!), there is a spice speaker model, and some comments about its derivation, in a section called Adventures with Analog, by one of the geniuses who frequent that forum (analogspiceman). If I recall correctly, it also had an output in units of sound pressure. However, it's been a long time since I looked at it. And it was still a "work in progress", back then.

I don't know anything much about trying to import a microcap model into LT-SPice. You could ask in the yahoogroups forum.

All of the spice speaker models that I referenced above have been made in circuit schematic form, using inductors, capacitors, and resistors. So the method of using them with LT-SPice is obvious. They are part of the circuit.

Good luck!

- Tom Gootee

http://www.fullnet.com/~tomg/index.html

-
 
diyAudio Moderator Emeritus
Joined 2001
Goatee:

Thanks for the kind words about finally modelling a loudspeaker schematic instead of an 8 ohm load. You see, this is my first Spice project, I am doing this because I have an idea for a circuit using transformers, I didn't start it just to learn to use Spice. So I started out using the 8 ohm load just to get my feet wet that my circuit would actually give a voltage reading close to what i wanted, (it now does), and figured I would now graduate and insert an actual loudspeaker schematic in there to see how it would really work.

I got the pbx loudspeaker copied and put into a separate file. Now, I have my circuit model in one file, without load. I have the pbx loudspeaker schematic in another file, and asc file.

HOW do I get the pbx file-a separate file-into my circuit file as the load? How do I get it to "cross files", so to speak?

I tried using the move feature, but it doesn't allow you to click on the top with your cursor. In short,I am looking to perform the same function that "copy"and "paste" does in a word or image processor. How do I do that?
 
kelticwizard said:
Goatee:

Thanks for the kind words about finally modelling a loudspeaker schematic instead of an 8 ohm load. You see, this is my first Spice project, I am doing this because I have an idea for a circuit using transformers, I didn't start it just to learn to use Spice. So I started out using the 8 ohm load just to get my feet wet that my circuit would actually give a voltage reading close to what i wanted, (it now does), and figured I would now graduate and insert an actual loudspeaker schematic in there to see how it would really work.

I got the pbx loudspeaker copied and put into a separate file. Now, I have my circuit model in one file, without load. I have the pbx loudspeaker schematic in another file, and asc file.

HOW do I get the pbx file-a separate file-into my circuit file as the load? How do I get it to "cross files", so to speak?

I tried using the move feature, but it doesn't allow you to click on the top with your cursor. In short,I am looking to perform the same function that "copy"and "paste" does in a word or image processor. How do I do that?


Yes, you can do "copy and paste". With two .ASC schematic files open, you hit Ctrl-C, or select Edit-->Duplicate, then drag a rectangle around the portion to be copied. Then, click on the tab for the target schematic and click where you want to place the copied portion. If necessary, before clicking to place the copied portion, you can also click on the "-" Magnifier, to make room to temporarily place the copy outside the edges of the current schematic area. Then you can use Drag or Move to do the final placement.

Alternatively, if you assign names to all of the needed inputs and outputs of _any_ .ASC circuit, you can use the Hierarchy-->Create New Symbol option to create a "component" for it! For larger systems, I usually create a symbol/component for each of the subsystems' schematics, and connect them all together in one top-level schematic that looks more like a "block diagram". Then you can, for example, just right-click on any block and select "Open Schematic", as needed.

A few other LT-Spice tips, just "off the top of my head":

It will be very convenient for you, if you go into the Tools menu and set up keyboard shortcuts for all of the common menu operations.

You may already know about these, but, if not, they might be quite useful:

To plot the POWER DISSIPATION for any component, you can hold down ALT and left-click on the component.

To calculate the average and the integral of any plot, for the currently-zoomed window portion, you can hold down CTRL and left-click on the plot label. (This only works after the simulation has stopped running.)

You can also right-click on any plot label and then enter an EXPRESSION to plot, which can be very powerful.

If you get a set of plot windows and expressions set up just how you want them, it's handy to select Plot Settings-->Save Plot Settings, and save the setup. That way, the whole plot setup will automatically come back, whenever that .ASC file is run, if there is not already a plot window open for it.

The .STEP operator (.op) can be very handy. In its rudimentary form, you could, for example, right-click on a resistor and enter {RVAL} as its value (WITH the brackets), and then create a .op directive like the following: .step RVAL 100 1100 200, which would automatically run six simulations, while stepping RVAL from 100 to 1100, incrementing it by 200 between runs.

It is also possible to use the "list" form of the .step command, with no increment value, e.g. .step CVAL list 2.2p 3.3p 4.7p .

And, you can nest .step sequences, at least two deep, if I recall correctly.

While we're thinking about parameters that are put inside brackets, e.g. like {RVAL} above, I should mention that they can be used more-generally. You can arbitrarily create (with the .op button) parameter assignments, to place on your schematic, which will then be substituted wherever the parameter name appears inside "curly brackets", even in larger expressions. e.g. Recently, while doing some THD-calculating runs, I needed to make sure that my sine voltage source ran for enough cycles to allow the power supply and other transients to settle down, and also always ended after an integer number of cycles, with enough cycles after the transients, etc. So I created a line with .param freq 20000 (the 20000 can be changed, as needed, later), and then edited my sine source and entered {freq} in the frequency field (and 50 in the Ncycles field, for this example). Then I selected Simulation--> Edit Simulation Command and entered {50/freq} in the Stop Time field. It's a trivial example. But, that way, I always got 50 cycles, regardless of what value was used for the freq parameter. In this case, I also created Fourier commands, so the THD would be reported in the Spice Error Log file, after each run, with a .op command like the following: .four {freq} 9 20 V(AMP_OUT), which uses 9 harmonics, for the last 20 cycles of the voltage at the node named AMP_OUT. (To see the results, you have to select View-->Spice Error Log, after each run (or after each set of .step'd runs).)

This is getting too long. Sorry. But you should also check out the extremely-powerful .MEAS commands. Take a look in the Files section of the LT-Spice users' group, at http://www.yahoogroups.com . There are some GREAT tutorials and examples to be found.

By the way, with LT-SPice, you can also use .WAV files, for both inputs and outputs! So maybe you can actually LISTEN to your spice model! (And there are many other very-intriguing possibilities.) You can find out how, by searching the LT-Spice yahoogroup.

Good luck!

- Tom Gootee

http://www.fullnet.com/~tomg/index.html

-
 
diyAudio Moderator Emeritus
Joined 2001
Goatee:

Thank you very much, I got them hooked up.

Now, I can get V for various places on the schematic, and I, (current) for various places, but how do I get,

A) The output for the system, SPL what have you

B) The impedance, Z, of the system?

Neither are listed on the "Visible Traces".
 
diyAudio Moderator Emeritus
Joined 2001
Okay, forget about those two netlists I listed earlier. The LT Spice forum pointed out the question marks in them were for where info needed to be filled in by the user. So forget them.

I made a schematic of the speaker simulator from pbx. Here is the speaker simulator:

An externally hosted image should be here but it was not working when we last tested it.


And below is that schematic put into lT Spice with a 1 volta AC line source, source resistance 0.1 ohms.

My question is, where do i take the readings from? Do I take the readings from where the input was in the pbx schematic? I am not getting the readings similar to what I expected. Can anyone say where I should put the probes to get the output? :xeye:
 

Attachments

  • pbx plus ac 2.gif
    pbx plus ac 2.gif
    9.6 KB · Views: 157
diyAudio Moderator Emeritus
Joined 2001
Okay, I just found out from the LT Spice forum that you can't take a netlist, put it as a file into Spice, then call it up and have Spice deliver a drawn schematic for you automatically. :bawling: Oh well.

However, a new development. I contacted Isaac MCN, a member here who is known as F4ier. He developed the excellent Subwoofer Simulator and Crossover Simulator, and I asked him for some help with this.

He directed me to Marshall Leach's Journal of the Audio Engineering Society paper, Computer-Aided Electroacoustic Design with SPICE, , which is available glorously free of charge through the highlighted site.

Here is the direct link to the specific paper. However, i strongly suggest you ignore this and instead look over Dr. Leach's other papers available for download at his site. They have a wealth of info.

Perusing this paper quickly, it appears to be clearly written and looks like it shows the way to model a closed box or vented loudspeaker. Even better, it appears that I may be able to model specific drivers in specific alignments with this. So I'm off to examine this, it looks like just what I need.

Stay tuned, I may need a little help with some of the things in this paper, though I am already familiar with many of the concepts,both through my own work with Spice and through reading the Thiele-Small papers at Richieboy's site, Read Research. :D

Incidentally, Isaac said that somewhere down the line, he plans to make a new version of Subwoofer Simulator and Crossover Simulator where the schematic will appear on the screen for the user. Sounds nifty. However, that is down the road apiece, he has other projects in front of that.
 
You can make your schematics a little more readable by using the units abbreviations. Spice defaults to Ohms, Farads, and Henries. You can always enter k for kilo, meg for mega-, g for giga-, u for micro-, p for pico-, n for nano-, and m for milli -.

Don't mistakenly try to use M for mega. It will be interpreted as milli with the expected (or unexpected) result.

I_F
 
diyAudio Moderator Emeritus
Joined 2001
Thanks for the tip for the abbreviations Spice takes. Writing 0.002 for a 2 mH inductor was getting hairy. Not to mention microfarads for the capacitors.

Outside of calling up the character map, (windows), and memorizing the Alt+ number, how do I get it to display omega for ohms? Or that squiggly-looking u instead of the regular u for micro?

I'm reading Dr. Leach's article even right now. Just at the beginning, but so far, so good. :)
 
If you're using SWCAD/LTSpice you can enter 100uF and it will be displayed 100 uF and used properly. The same goes for inductors- enter 20mH and it will be displayed as 20mH and will be used that way for calculations. There doesn't appear to be an easy way to get an Omega symbol to display on resistors without using short-cut keys.

I_F
 
diyAudio Moderator Emeritus
Joined 2001
Right you are. And it probably is based in fact-if you are far enough ahead to be using Spice, you surely know the units. But it would have been nice. You can put the F in yourself though. My H for inductors isn't working either, if I put in 4m it will appear as 4m, not 4mH. Easy enough to adjust to, I guess.


The Control Panel does have a check mark for the omega sign for ohms, but it doesn't seem to work, at least on my copy.

I'm willing to use shortcut keys, but I am looking at the shortcut keys in the Control Panel and don't see any. Maybe Windows has them, I'll check.

Thanks for pointing out the marking things. I was thinking of asking a question on the board about them, my schematics were not looking all that readable.

Back to Leach's article....
 
diyAudio Moderator Emeritus
Joined 2001
Yes, I am getting used to inserting the H and F myself for the inductors and capacitors. And that explains the omega mystery.

Well, I am getting a clue as to what is happening with this electro-acoustic modelling.

Apparently, Spice takes three models, the electrical, (voice coil), the mechanical, (suspensions and such), and the acoustical, (weight of air, etc), anc combining all of them all sequentially.

So the electrical model, (voice coil) is from nodes 1 through 4, the mechanical is from nodes 5 through 9, and acoustical is from nodes 10 thru 20.

At some point, I am going to have to make a chart of which Thiele-Small value is expected on each line, which I am piecing together. The values are listed on the lines, but I am trying to ascertain which Thiele-Small parameters those are. Once I copy the nodes line by line and make a model stating which parameter goes on which line to complete it, I can model most any ported box.

The completion of this will have to wait until tomorrow. But much progress has been made.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.