# TRANS F4 Transformer simulation

Please I need assistance with the model library of TRANSF4 Primary Center tap transformer.
How can I get it?
Thank you.

You will not get a model, you will have to make a model. TRANSF4 is just a symbol without a specific brand and footprint in mind.

Create a spice subcircuit
Fill it with three inductors
Couple the inductors

Optionally you may add leakage inductance and coil series resistance.

When you place the symbol on the Eeschema canvas and enable showing the pin numbers, you see pins 1 to 5.

So lets create a subcircuit with 5 pins:

``````.subckt TransF4 1 2 3 4 5
.ends
``````

That’s the subcircuit shell. Now fill it with 3 inductors. According to the symbol there is one inductor from pin 1 to 2. Lets give it the inductance 1mH.

``````.subckt TransF4 1 2 3 4 5
L1 1 2 1m
.ends
``````

``````.subckt TransF4 1 2 3 4 5
L1 1 2 1m
L2 2 3 1m
L3 4 5 1m
.ends
``````

To obtain a transformer, the inductors need to be coupled.

``````.subckt TransF4 1 2 3 4 5
L1 1 2 1m
L2 2 3 1m
L3 5 4 1m
K1 L1 L2 1
K2 L1 L3 1
K3 L2 L3 1
.ends
``````

That’s our simple transformer model. The inductance values have to be determined according to the type of the transformer and the winding ratios. That’s an electrical engineering problem, not a KiCad/ngspice problem, and you will have to solve it.

Also you will need to determine if you want to have the polarity of the secondary coil as `L3 5 4 1m` or `L3 4 5 1m`.

Put this model into a file transformers.lib, and attach it to the symbol.

1 Like

Thanks very much for the prompt response.
Does turns ratio apply to this model?

Indirectly via the inductance. When you consider Lp/Ls ~ Np^2/Ns^2 you can work out the turns ratio from the inductance

1 Like

I am trying to simulate this push-pull converter, but I’m getting this “error during netlist generation”

to help others to help you, i suggest (if possible) to attach the kicad project to the post so that others can replicate and understand what you are doing…

They said new users can upload attachment, but the picture above is all about the schematic

Try again, you are 1 level higher now… (I suppose you meant “can’t upload”, not “can upload”)

1 Like

Obviously here is a problem with attaching the model to the symbol. Unfortunately the screenshot does not give any information about that issue.

May I suggest that you start with a very simple circuit (only the transformer and a VSIN voltage source) to study the basics how to set up such things?

An improved transformer model adds some series resistance (1 Ohm to each coil), as otherwise the operating point calculation (a dc calculation) might become more complex.

``````* coupled inductors plus series resistance
.subckt TransF4 1 2 3 4 5
L1 1 22 1m
R1 22 2 1
L2 2 33 1m
R2 33 3 1
L3 5 44 1m
R3 44 4 1
K1 L1 L2 1
K2 L1 L3 1
K3 L2 L3 1
.ends
``````

Information on how to attach a subcircuit model (written for KiCad 6) is available here: KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation .

In Version 7 it is:
Double click onto the symbol → Simulation Model… → Spice model from file → choose file → choose model (here TransF4) → OK → OK.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.