This example is interactive. Click the play button on any cell to execute it, or run all cells in sequence.

Transformer with a thermal model in PathSim (NetlistCircuit)

Note: the component values used in this notebook are not representative of a real transformer; they are chosen for illustration only (visible losses, short simulation time).

  1. Part 1 - a two-winding transformer, simulated with pathsim_rf.NetlistCircuit.
  2. Part 2 - a second-order thermal model (3 R, 2 C), also a NetlistCircuit, heated by the winding losses.
Python
Loading...

Part 1 - the transformer

    in   ┌───────────────┐   a                            b    ┌───────────────┐    c
     ┌───┤ R1 = 0.1 ohm  ├───●                            ●────┤ R2 = 0.5 ohm  ├────●
     │   └───────────────┘   │          k = 0.9           │    └───────────────┘    │
 ╭───┴───╮              ┌────┴────┐     ◄─ K1 ─►     ┌────┴────┐               ┌────┴────┐
(   V1    )             │  L1  ●  │                  │  L2  ●  │               │   R3    │
( ~ 100 V )             │  60 mH  │                  │  30 mH  │               │ 50 ohm  │
(  50 Hz  )             └─────────┘                  └─────────┘               └─────────┘
 ╰───┬───╯                   │                            │                         │
     │                       │                            │                         │
     └───────────────────────┴────────────────────────────┴─────────────────────────┘ GND (0)

V1 is a 50 Hz sine source, R1 / R2 are the winding resistances, L1 / L2 the coupled inductances (K1, coefficient 0.9; ● = polarity dot, at the top of both inductors) and R3 the load. GND (0) is the reference node.

The schematic is written as a SPICE netlist, one line per element:

Netlist line Meaning
V1 in 0 voltage source between node in and ground 0
R1 in a {R1} primary winding resistance
L1 a 0 {L1} / L2 b 0 {L2} the two inductors (dot = first node)
K1 L1 L2 0.9 coupling coefficient between L1 and L2
R2 b c {R2}, R3 c 0 {Rload} secondary winding resistance and load

How it plugs into PathSim:

  • NetlistCircuit is a normal block. Its inputs are the sources of the netlist (here V1), driven by a SinusoidalSource; its outputs are the signals asked for with output_voltages / output_currents.
  • Only the used outputs are requested. Exporting every node and current can create direct feedthrough, which PathSim treats as an algebraic loop and makes the run much slower (see the Performance section of 3phase_pathsim_walkthrough.ipynb).
  • The simulation covers 3 cycles of the 50 Hz source (60 ms).
Python
Loading...
Output

Part 2 - add the thermal model

The thermal network is the electrical analogy, written as a second NetlistCircuit: temperature rise above ambient = node voltage, heat flow = current, thermal resistance = resistor, heat capacity = capacitor, ambient = ground.

             w (winding)                         ┌───────────────┐   c (core)
       ┌───────────●───────────●───────────●─────┤ Rwc = 7.0 K/W ├───────────●───────────┐
       ▲           ▲           │           │     └───────────────┘           │           │
   ╭───┴───╮   ╭───┴───╮  ─────┴───── ┌────┴────┐                       ─────┴───── ┌────┴────┐
  (   Ip1   ) (   Ip2   )     Cw      │   Rwa   │                           Cc      │   Rca   │
  (  = P1   ) (  = P2   )   0.2 J/K   │ 40 K/W  │                         0.8 J/K   │ 5.5 K/W │
   ╰───────╯   ╰───────╯  ─────┬───── └─────────┘                       ─────┬───── └─────────┘
       │           │           │           │                                 │           │
       │           │           │           │                                 │           │
       │           │           │           │                                 │           │
       └───────────┴───────────┴───────────┴─────────────────────────────────┴───────────┘ ambient (0 K)
  • w = windings, c = core / housing; Cw, Cc make it second order; Rwc, Rca, Rwa are the 3 thermal resistances.
  • Ip1 and Ip2 are current sources (heat flow in W) injecting the winding losses P1 = R1 i1^2 and P2 = R2 i2^2 into the winding node w. They are computed by Function blocks from the currents I(R1) and I(R2) of the transformer block.

Small heat capacities. A real transformer heats up over minutes to hours, whereas the electrical side needs 20 ms steps per cycle. To keep the run short, Cw and Cc are about 1000 times smaller than realistic values (about 200 and 800 J/K): the thermal time constants are about 1 s and 5 s instead of about 17 min and 83 min. The steady-state temperatures depend only on the thermal resistances and the losses, so they are not affected; only the thermal transient is compressed (20 s simulated ~ 5.6 h real).

Python
Loading...
Output
Output