Inserting coupled inductors into NG-Spice’s netlists graphically.

I have spent quite a few postings, describing how the Open-Source circuit simulation programs “NG-Spice”, belonging to the “gEDA” suite, can be used. And one of the facts about them which I’ve recognized, is that they essentially come as three programs: The (non-GUI) engine which simulates Netlists; ‘gschem’, a graphical program which allows schematics and custom symbols to be edited; a third (GUI-based) program, ‘GSpiceUI’, that can import the schematic and export the netlist of a simulation to be run, as well as run the simulations.

What the first two programs do, isn’t always well-matched. ‘gschem’ can create schematics, with no regard for the fact that the Spice engine can’t simulate all the components.

But, One capability which NG-Spice has at the level of Netlists is, to simulate “coupled inductors”, which are denoted by a ‘RefDes’ which begins with the letter ‘K’.

Why is this potentially useful? Because, if the user simply puts the standard, library transformer, what NG-Spice will simulate, is a perfect transformer, which behaves as well at 60Hz, as it does at 60MHz. The user would have no way to specify any of that transformer’s parameters, then. It’s often more useful to simulate components, with built-in parasitic flaws, such as, coupling constants that are 0.99 or 0.9 instead of 1.0…

It would be nice, just to be able to drop such a coupling into a ‘gschem’ schematic, and have ‘GSpiceUI’ create its simulation ‘the easy way, via the GUI’.

Well, that can be prepared. And, the way to prepare it is, using ‘gschem’ in order to define a custom symbol…




(Updated 6/09/2021, 16h35… )

(As of 6/03/2021, 21h45: )

The idea is to copy the symbol ‘transformer-1.sym’ from the system-wide install folder, into whichever folder one is using for one’s custom symbols, and rename it appropriately… I renamed mine to ‘coupled-inductors-1.sym’. Then, opening this file within ‘gschem’, one is allowed to delete all its pins! Next, its value can be set to a line of default parameters, separated by spaces, as shown above. The inductors which will later be entered as existing instances within the schematic, should preferably be of the dotted variety, just so that no confusion sets in, about which way each of them is facing.

Once that has been prepared, a half-cooked attempt can be made, to simulate a typical Transmission Line Transformer, such as the Unbalanced-to-Unbalanced Voltage Doubler / Impedance Quadrupler. The following is the schematic:


This is the netlist of the simulation:

And this is the frequency-response curve of the resulting transformer:


Not surprisingly, the response curve is close to flat, because neither of the coupled inductors has in fact been simulated as a Transmission Line. But, if ‘RG174′ 50Ω subminiature coax is used, that will propagate signals at ⅔ the speed of light, a mere 1cm length of it must be looped through a ferrite bead once, which should have a permeability close to 850, in order for the circuit to be operable up to 100MHz.

The suitable type of ferrite bead, would be the one of ‘Composition 28‘ according to This Advertisement. (:2)

If the resulting inductances are greater than 5μH, or, the coupling constant of the pair of inductors reduced to 0.9, this is already enough to ruin the properties of the circuit, so that the circuit will become inoperative above a frequency of a few Megahertz.

I had to add estimations of total capacitance, explicitly.


(Update 6/04/2021, 1h35: )

In order to make the preceding exercise more meaningful, I should link to my (machine-readable) version of what the properties of 1cm of that subminiature coax cable are: (:1)

One fact which I can picture is, that to try to solder in 1cm of subminiature coax, might just be a bit difficult for most hobbyists to attempt. So, one thing they can do, is to use a 2cm length instead. In order for the simulation to predict what will happen, the values of C1, C2, L1 and L2 need to be doubled. And, as the following screen-shots show, not much goes wrong:






In fact, the software allows me to plot the (relative) voltage across R1 as a function of frequency, and the value of R1 is 1Ω. This can tell me at a glance, whether the impedance connected to the output of the step-up network (R2 = 200Ω), has in fact been quartered:




Because (VR1) approaches 20mV at operating frequencies, I can see that the circuit does in fact present a 50Ω load to its input.


An interesting piece of information, which might sound like trivia, but which really isn’t, is the question of what will happen, if the user defines the two coupled inductors as having two, non-matching inductance values. The ideal behaviour would be, that Spice computes the square root of the ratio, and takes that as the turns ratio, thereby causing a voltage-ratio to appear.

Well, a simple test from me, can reassure the reader that this is in fact what NG-Spice does. I have changed the value (inductance) of L2 to 17.2μH, which is 4 times as high as what I left L1 at. The result was, that the relative signal voltage present across L2 became 1.895, and the relative output voltage of the circuit became 2.851. This effectively means, that the output voltage was tripled successfully, except for the loading of the input, which my simulation predicts.


(Update 6/05/2021, 11h10: )

The question would seem relevant, if one was planning on building an actual circuit, of how its performance is affected, if a 4cm length of transmission line is used, instead of a 2cm length. The following two images show what happens:




In short, the frequency response will really only be ‘good’ then, up to 50MHz, no longer, up to 100MHz.


(Update 6/07/2021, 2h10: )


The way in which the coax cable’s (unused) properties factor in, deserves some more explanation. If a ferrite core actually has windings, there exist complex calculations, as to what the inductance of those windings will be. But, I chose to use a shortcut. What the modelcard states, which I created from on-line reference sheets, is, that 1cm of the transmission line will have an inductance of 2.5nH. It is to be looped through a ferrite bead once, which has a permeability of “850”.

I can simply multiply 2.5nH by 850, to arrive at 2.125μH /cm.

This will even remain accurate, if 2cm of coax are simply being looped through (giving 4.25μH). However, as soon as the length of coax reaches 4cm, the problem with this methodology becomes, that some length of the transmission line will be distant enough from the ferrite bead (and exhibit slack on a PCB), such as not to have its inductance multiplied by as much as 850 anymore.

Yet, I’m still concluding that the circuit will become unsuitable for operation at 100MHz, when the length has become 4cm.


In the case, purely, of coupled inductors, this value describes what one inductor will do, if the other is disconnected – i.e., an open circuit. However, if the other inductor is shorted out, and the coupling constant is indeed 0.99, then 1/100 of this value will still limit, how much current can flow through the first inductor.


(Update 6/09/2021, 15h45: )


What this simulation actually proves is, that the hypothetical circuit may be possible to imagine, but that, because the lengths of Coax cable required would be particularly hard to solder, in fact a ferrite with lower permeability must be used, to work in the frequency range from 10MHz to 100MHz. If ‘Composition 25′ was used, which has a permeability of only “125”, and a 4cm length of Coax, better results will follow.





(Update 6/09/2021, 16h35: )

The subject comprises an interesting question in itself, as to ‘what happens’ with the asymmetry, between the two conductors in this ‘winding’.

According to This external calculator, if a conductor has a diameter of 2mm, then its linear inductance will be ~4.7nH /cm. And, if it has a diameter of 0.5mm, then its linear inductance will be ~7.3nH /cm. According to that, the two conductors in this suggested transformer should also have different voltages, at least, the way Spice would simulate them.

However, this should not really be how it works. The linear inductance is just a measure, of how much ‘reactive resistance‘ each type of wire produces for the circuit, as each type of wire is generating the same amount of magnetic flux, as seen from a distance. That amount of flux should cancel out, as long as the two currents cancel out. And, as long as the main mode in which the transformer is to operate, is, that the currents cancel out, the same amount of inductance should also be entered.

Mind you, if one conductor is 4cm long, but the other 5cm long, because of how the coax cable was stripped, that’s a different story.

It’s no coincidence that the linear inductance, of the transmission line working as such, happens to be ~ 7.3 – 4.7 nH /cm. In this mode, there is an unequal magnetic field intensity between the outer and the inner conductor, but not outside the outer conductor. Theoretically, that amount of linear inductance exists separately somewhere, as though it had not been passed through the ferrite bead.


(Note – As of 6/07/2021, 3h45, most Web-browsers will need to have JavaScript enabled, both from this site, and from ‘’, to view the following work-sheet…)







Print Friendly, PDF & Email

One thought on “Inserting coupled inductors into NG-Spice’s netlists graphically.”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>