I am struggling to understand Spice model coding. I understand the first line sets the name and pin count...I think. +PARAMS: sets parameters to be used in calculations. In this example of a transformer, what do the numbers mean after RS1, LP1, RP1...etc? At first, I thought it might be pin numbers saying that this calculation happens between this and that pin. But then I see the numbers 12 and 45, which are not pin numbers. I have tried to find info on the subject, without success. I think I need a very elementary explanation. I'm just trying to figure out how to adjust this transformer to whatever my design calls for. For instance, a Blackface Bassman transformer with only a 4 ohm output, or a Marshall 100W transformer with 16-, 8-, and 4-ohm outputs. I am unsure why there are 9 pins needed in this example. It is an output transformer with 16-, 8-, and 4-ohm taps. I would think only 7 pins would be needed. I would really like to know more about the subject and be able to adjust the code properly, draw my own symbol in Multisim, and assign the pins.
It seems I also don't know how to add code properly here...?
It seems I also don't know how to add code properly here...?
[I].SUBCKT DYNA_OUTPUT_XFRMR 1 2 3 4 5 6 7 8 9 ; PARAMETERS FOR MARK 3:
+PARAMS: LPRIM=60 LLKG=.040 RPRIM=125 CPRIM=1.04NF LRATIO={4/4300}
* ERIC BARBOUR ARTICLE: ~233H TOTAL PRIMARY L FOR MARK 3.
* MARK 3: LPRIM=60 LLKG=.040 RPRIM=125 CPRIM=1.04NF LRATIO={4/4300}
* LPRIM IS THE TOTAL PRIMARY L (VARIES WITH MEASUREMENT).
* LLKG IS THE LEAKAGE L (MEASURABLE: CONSISTENT).
* RPRIM IS THE TOTAL PRIMARY R.
* CPRIM IS THE MEASURED PRIMARY CAPACITANCE.
* LRATIO IS THE INDUCTANCE RATIO: (4 OHMS)/(PRIMARY Z).
.PARAM QFCTR={LPRIM/LLKG} ; Q-FACTOR.
CS1 1 5 {CPRIM} ; PRIMARY CAPACITANCE
RS1 1 5 300K ; SHUNT R FOR HIGH FREQUENCY EFFECTS.
LP1 1 12 {LPRIM*.09} ; .7164H ; PRIMARY
RP1 12 2 {RPRIM*.5}
LP2 2 3 {LPRIM*.04} ; .3184H
LP3 3 4 {LPRIM*.04}
LP4 4 45 {LPRIM*.09}
RP4 45 5 {RPRIM*.5}
LP5 7 6 {.34315*LPRIM*LRATIO} ; 8-16 OHM WINDING: (2-SQRT(2))^2
LP6 8 7 {.17157*LPRIM*LRATIO} ; 4-8 OHM WINDING: (SQRT(2)-1)^2
LP7 9 8 {LPRIM*LRATIO} ; COM-4 OHM WINDING
KALL LP1 LP2 LP3 LP4 LP5 LP6 LP7 {1-1/(2*QFCTR)} ; COUPLING
.ENDS[/I]
This model is a difficult one to decipher if you're not familiar with the syntax of a SPICE model. This Eric Barbour model for the Dynaco A431 output transformer is based upon the schematic contained in the attached ZIP archive.
The first (non-commented) line of the SPICE model will contain the name of the model and the pin order (not pin numbers), which must match the pin order of the symbol used. I've also included in the ZIP file a transformer symbol which has the correct pin order for this particular model. There are 9 "pins" because there are 9 external connections (wires) for this transformer. I use this combination in some of my own designs so it is known to work in LTspice.
This model contains parameters in the second line of text; the parameter names are then used as values for some of the components that make up the schematic. The individual components are defined by their schematic name, the nodes to which they connect, and then the component value. For example, RS1 is connected between nodes 1 and 5 and has a value of 300k, so this is represented by the line
RS1 1 5 300k
(Resistors will always begin with an "R," capacitors with a "C," and inductors with an "L.")
All of the components are specified in the same way except that some of them have a parameter instead of a constant for their value, enclosed in curly braces. Note that the junction of LP1 and RP1 constitutes a node (arbitrarily numbered 12), as does the junction between LP4 and RP4 (arbitrarily numbered 45). These were the node names that the model used so I duplicated them in the schematic.
Using this technique, it's fairly easy to create a SPICE model from a schematic if all of the component values are known (or can be estimated). In this particular case, though, I did the reverse: creating the equivalent schematic from the published SPICE model. This is a bit more tedious, but not particularly difficult once you get the hang of it.
I don't use Multisim so the attached files were created in LTspice. You probably can't open the LTspice files but the screen shots show what they look like in LTspice.
I hope this helps at least a little.
The first (non-commented) line of the SPICE model will contain the name of the model and the pin order (not pin numbers), which must match the pin order of the symbol used. I've also included in the ZIP file a transformer symbol which has the correct pin order for this particular model. There are 9 "pins" because there are 9 external connections (wires) for this transformer. I use this combination in some of my own designs so it is known to work in LTspice.
This model contains parameters in the second line of text; the parameter names are then used as values for some of the components that make up the schematic. The individual components are defined by their schematic name, the nodes to which they connect, and then the component value. For example, RS1 is connected between nodes 1 and 5 and has a value of 300k, so this is represented by the line
RS1 1 5 300k
(Resistors will always begin with an "R," capacitors with a "C," and inductors with an "L.")
All of the components are specified in the same way except that some of them have a parameter instead of a constant for their value, enclosed in curly braces. Note that the junction of LP1 and RP1 constitutes a node (arbitrarily numbered 12), as does the junction between LP4 and RP4 (arbitrarily numbered 45). These were the node names that the model used so I duplicated them in the schematic.
Using this technique, it's fairly easy to create a SPICE model from a schematic if all of the component values are known (or can be estimated). In this particular case, though, I did the reverse: creating the equivalent schematic from the published SPICE model. This is a bit more tedious, but not particularly difficult once you get the hang of it.
I don't use Multisim so the attached files were created in LTspice. You probably can't open the LTspice files but the screen shots show what they look like in LTspice.
I hope this helps at least a little.
Attachments
Last edited:
Thank you for the reply, Ray. The schematic of the transformer alongside the spice code is very helpful. I feel I might actually be able to understand what is going on after studying it for a couple days. I found a transformer in Multisim's database that allows me to change some values, but I'm not sure I have it set properly. I have to enter the turns ratio instead of the primary and secondary impedance. So, math is involved in figuring out the correct values. It then has options for an ideal transformer or the ability to enter the inductance and dc resistance of the windings. The codes that we are using allows us to enter the information directly from Hammond datasheets. In order to use this code in Multisim I have to create a new part, select a schematic symbol, enter the spice code text, and assign the pins. I wasn't really sure what schematic symbol to use by looking at the spice code alone. What I am getting from the transformer in Multisim's database is about 35W at the output just as it starts to clip. This is a Blackface Bassman AB Push-Pull amp using 2 EL34s biased at 60%. Does that seem right to you?
I'm not familiar with Multisim so I can't be of much help here. The files I provided work in LTspice but probably not in another simulator. But regardless of which simulator you use, the SPICE model and its symbol have to be compatible; that is, they have to have the same number of pins and the pin order has to be the same.
The transformer model (especially its primary impedance / turns ratio) is going to affect the output power you will see. Without knowing more about that transformer I can't really offer an opinion about whether 35 watts at clipping is reasonable for your particular amplifier. But 35 watts isn't an unusual figure for a pair of push-pull EL34s in class AB1.
Maybe if you share your Multisim transformer model and your SPICE file someone here will be able to help.
The transformer model (especially its primary impedance / turns ratio) is going to affect the output power you will see. Without knowing more about that transformer I can't really offer an opinion about whether 35 watts at clipping is reasonable for your particular amplifier. But 35 watts isn't an unusual figure for a pair of push-pull EL34s in class AB1.
Maybe if you share your Multisim transformer model and your SPICE file someone here will be able to help.
The information you provided was very helpful. The only spice-based software I am familiar with is Multisim. I messed around with a couple other programs, but none of them seemed as intuitive or didn't have the same workflow that I am used to. But that's probably just because I already know Multisim and have gotten used to its own strengths and weaknesses. One of its weaknesses being a lack of, what I consider to be, common components. Like logarithmic pots for a very basic example. It doesn't like certain varieties of code either. I still can't figure out how to run Ayumi tube models without getting errors or it running very slow. The best I have been able to find for tubes is Koren-type models. But even then I get the error "log() is ambiguous" and it changes it to Linear. Which I'm sure affects the outcome, but it runs smoothly and seems to provide decent results. So, I try "log(10)" instead and results don't seem right.
Anyway...I seem to have gotten off on a tangent. The LtSpice files you provided don't work in Multisim as far as I am aware. All I know how to do is enter the subckt./.model code and figure out how to assign the pins to the symbol. So that picture was very helpful and a good starting point. I can create my own symbol based off that schematic. Although I'm not familiar with that type of transformer with multiple primary taps. Are those extra taps for ultra-linear configurations? I am assuming I can ignore them and just treat the entire primary as a 4300 ohm center tapped transformer...or change that value as desired.
Anyway...I seem to have gotten off on a tangent. The LtSpice files you provided don't work in Multisim as far as I am aware. All I know how to do is enter the subckt./.model code and figure out how to assign the pins to the symbol. So that picture was very helpful and a good starting point. I can create my own symbol based off that schematic. Although I'm not familiar with that type of transformer with multiple primary taps. Are those extra taps for ultra-linear configurations? I am assuming I can ignore them and just treat the entire primary as a 4300 ohm center tapped transformer...or change that value as desired.
The Dynaco A431 is a push-pull ultra-linear output transformer designed for use with the Dynaco Mark III power amplifier. The Eric Barbour model does seem to be a good representation based on my own experience.
I suppose you could just leave the ultra-linear taps unconnected and operate the output stage in pentode mode. Similarly, you can use only the output taps that are appropriate for your speaker. I don't see any reason why that would not simulate properly. But there are probably other transformer models out there that are a better representation of the one you are using. Here is a set of output transformer models developed by Robert McLean. One of these might be worth a try.
https://www.diyaudio.com/community/threads/spice-transformer-model-spreadsheet.181578/post-2441274
I suppose you could just leave the ultra-linear taps unconnected and operate the output stage in pentode mode. Similarly, you can use only the output taps that are appropriate for your speaker. I don't see any reason why that would not simulate properly. But there are probably other transformer models out there that are a better representation of the one you are using. Here is a set of output transformer models developed by Robert McLean. One of these might be worth a try.
https://www.diyaudio.com/community/threads/spice-transformer-model-spreadsheet.181578/post-2441274
Once again, Ray, a very helpful link. I think I should have all the info I need to build my own transformers from scratch to suit my needs. I'll play around with it while I'm bored at work today 🙂 Thank you for sharing.
- Home
- Design & Build
- Software Tools
- Understanding Spice Models