Supply
def Supply(
voltage:float, frequency:float
)->None:Sinusoidal supply.
Purpose: Analyse a single-phase, core-type transformer from its geometry and materials.
What it does: Computes the peak flux density, the no-load current waveform (with optional hysteresis and dynamic loop widening), core loss, the magnetising branch, winding resistances, leakage inductance and the load performance (voltage regulation, losses, efficiency). The equivalent circuit can also be built from open- and short-circuit test data and solved directly; that solver is checked against published worked examples.
The no-load current of a transformer is set by the non-linear core. With an analytical chain from B(t) to i₀(t), the open-circuit characteristic, the magnetising current harmonics and the efficiency follow from datasheet-level data without FEA.
Inputs: TransformerCore (limb, stack, window, stacking factor, joint gap), two TransformerWindings, CoreMaterial (Takács loop and Bertotti coefficients), Supply (V₁, f).
Outputs: dictionaries of currents, waveforms, losses and circuit parameters.
Upstream: emachines.magnetics — TakacsModel and DynamicLoopModel (hysteresis), bertotti (core loss).
Downstream: design decisions; a future transformer design (sizing) module.
| Symbol | Meaning | Where it is set |
|---|---|---|
| \(a\) | limb width, also the yoke width | TransformerCore.limb_width |
| \(d\) | stack depth | TransformerCore.stack_depth |
| \(w\), \(h\) | window width and height | TransformerCore.window_width, window_height |
| \(k_s\) | stacking factor (iron fraction of the stack) | TransformerCore.stacking_factor |
| \(g\) | total equivalent air gap of the joints along \(l_c\) (not drawn) | TransformerCore.joint_gap_total |
| \(N_1\), \(N_2\) | primary (inner) and secondary (outer) turns | TransformerWinding.turns |
| \(a_1\), \(a_2\) | radial builds of the primary and secondary | TransformerWinding.radial_build |
| \(l_{mt}\) | mean turn length of each winding | TransformerWinding.mean_turn_length |
| \(\delta\) | radial gap between the windings | gap argument of leakage_inductance, load_performance |
| \(h_w\) | winding height | winding_height argument of leakage_inductance, load_performance |
The core is described by its limb width \(a\), stack depth \(d\), window width \(w\) and height \(h\) and stacking factor \(k_s\):
\[A_{fe} = k_s\,a\,d, \qquad l_c = 2(w + a) + 2(h + a), \qquad V_{fe} = A_{fe}\,l_c\]
\(l_c\) is the mean flux path round one window, assuming limbs and yokes of equal width \(a\). joint_gap_total is the total equivalent air gap of the joints in that path; it depends on how the core is built (butt, mitred, step-lap) and is not on a steel datasheet, so it defaults to 0.
CoreMaterial holds the static Takács loop and the Bertotti coefficients of the same steel; the dynamic loop is built from them (DynamicLoopModel.from_bertotti).
Core steel: static Takács loop plus Bertotti loss coefficients of the same steel.
One winding (SI units).
Core geometry of a single-phase core-type transformer (SI units).
# Example transformer used below: about 1 kVA, 230 V / 115 V, 50 Hz.
# Illustrative dimensions and material values only — not a real or validated design.
core = TransformerCore(limb_width=40e-3, stack_depth=50e-3, window_width=40e-3, window_height=100e-3)
primary = TransformerWinding(turns=385, conductor_area=1.45e-6, mean_turn_length=0.22, radial_build=8e-3)
secondary = TransformerWinding(turns=193, conductor_area=2.9e-6, mean_turn_length=0.28, radial_build=8e-3)
supply = Supply(voltage=230.0, frequency=50.0)
steel = TakacsModel(B_s=1.6, h0=50.0, a0=0.8) # illustrative Takács parameters
rho = 7650.0
# k_h chosen so that the Bertotti hysteresis term equals the Takács loop energy at 1.4 T;
# in practice both come from fitting the same datasheet (fit_takacs, fit_bertotti).
k_h = steel.loop_energy(steel.tip_H(1.4)) / (rho * 1.4 ** 2)
material = CoreMaterial(static=steel, k_h=k_h, k_e=5e-5, k_a=5e-4, density=rho)
assert np.isclose(core.area, 0.96 * 0.04 * 0.05)
assert np.isclose(core.path_length, 2 * 0.08 + 2 * 0.14)
print(f"A_fe = {core.area * 1e4:.2f} cm², l_c = {core.path_length * 100:.1f} cm, "
f"iron mass = {core.volume * rho:.2f} kg, k_h = {k_h:.4f} W/(kg·Hz·T²)")A_fe = 19.20 cm², l_c = 44.0 cm, iron mass = 6.46 kg, k_h = 0.0114 W/(kg·Hz·T²)
The magnetic circuit is drawn on the front view of a U-I core (see Core construction and joints below), with reluctances \(\mathcal{R} = l/(\mu A)\) as resistors and the winding MMFs \(N i\) as sources. Fluxes play the part of currents. Between nodes A, B and C there are three branches:
Each loop encloses exactly the windings it should: limb + duct encloses the primary only, duct + return the secondary only, and limb + return both. With the fluxes as drawn, \(\Phi_m = \Phi_1 + \Phi_\sigma\).
| Reluctance | Expression | Path |
|---|---|---|
| \(\mathcal{R}_{limb,1} = \mathcal{R}_{limb,2}\) | \(\dfrac{h + a}{\mu\,A_{fe}}\) | one limb of the mean path |
| \(\mathcal{R}_{yoke}\) | \(\dfrac{w + a}{\mu\,A_{fe}}\) | one yoke of the mean path |
| \(\mathcal{R}_g\) | \(\dfrac{g}{\mu_0\,A_{fe}}\) | all joints together, \(g\) = joint_gap_total (U-I core: two joints of \(\mathcal{R}_g/2\) each) |
| \(\mathcal{R}_\sigma\) | \(\dfrac{h_w}{\mu_0\,k_R\,l_{mt}\,(\delta + a_1/3 + a_2/3)}\) | duct between the windings |
The four iron reluctances add up to \(l_c/(\mu A_{fe})\). Since the steel is non-linear, \(\mu = B/H\) is taken from the B–H loop.
How the steps below use it: - No load (\(i_2 = 0\), Steps 2–4): the duct branch is neglected, and the series loop gives \(N_1 i_0 = H\,l_c + B\,g/\mu_0\). - Leakage (Step 7): \(\mathcal{R}_\sigma\) gives \(L_\sigma = N_1^2/\mathcal{R}_\sigma\).
The module models only the shape: a rectangular core-type core with two limbs and two yokes of the same width \(a\). Several common constructions give that shape. They differ in how many joints the flux crosses:
| Construction | Pieces | Joints in the flux path |
|---|---|---|
| U-I (or C-I) laminations | a U (both limbs and the top yoke) and an I (bottom yoke) | 2, where the U’s legs stand on the I |
| Strip laminations | 4 straight strips: 2 limbs and 2 yokes, butt, interleaved or mitred at 45° | 4, one at each corner |
| Cut C-core | wound steel tape, cut into two C halves | 2, one through each limb |
| Uncut wound core | continuous wound tape | 0 |
At each joint the flux crosses a thin non-magnetic layer: the lamination coating, burrs and imperfectly flat cut edges. That layer acts as an air gap. How big it is depends on how the joint is made:
joint_gap_total is the sum of the equivalent gaps of all joints. For example, a U-I core with two butt joints of about 25 µm each gives joint_gap_total ≈ 50e-6. These are typical orders of magnitude, not measured values.
The gap matters despite its size. With a relative permeability of about 5000, a 50 µm gap needs as many ampere-turns as 0.25 m of steel, while the example’s whole mean path \(l_c\) is 0.44 m. It raises the magnetising current but barely changes the core loss.
E-I laminations are shell-type: the windings sit on a centre limb, and the flux divides between two outer limbs. That is a different magnetic circuit, and this module does not model it.
The primary equation is \(v_1 = R_1 i_1 + L_{\sigma 1}\,di_1/dt + N_1 A_{fe}\,dB/dt\). At no load the drop across \(R_1\) and \(L_{\sigma1}\) is about the product of two small per-unit values (for example 2 % resistive drop at rated current × 5 % no-load current ≈ 0.1 % of \(V_1\)), so it is neglected. For \(v_1 = \sqrt2 V_1 \sin\omega t\) in steady state (no DC offset):
\[B(t) = -\hat B\cos\omega t, \qquad \hat B = \frac{\sqrt2\,V_1}{\omega N_1 A_{fe}}\]
Under load the voltage across the core is \(E_1\) rather than \(V_1\); load_performance handles that.
Peak core flux density B̂ = √2 V / (ω N₁ A_fe) [T] for an rms voltage across the core.
The field in the core comes from the hysteresis module, \(H(t)\) = material.loop.field_waveform(B(t), dt, hysteresis, dynamic), and Ampère’s law round the mean path, including the joints, gives
\[N_1\,i_0(t) = H(t)\,l_c + \frac{B(t)\,g_j}{\mu_0}\]
From \(i_0(t)\): - rms and peak value, crest factor and the odd harmonics (half-wave symmetry removes the even ones); - the fundamental split against \(v_1\): the in-phase part \(I_{c1}\) carries the loop loss, the quadrature part \(I_{m1}\) magnetises.
With a sinusoidal voltage only the fundamental carries power, so the mean of \(v_1 i_0\) equals \(V_1 I_{c1}\) and equals the loop energy \(f\,V_{fe}\oint H\,dB\). The switches hysteresis and dynamic change the waveform only; core loss is always taken from the Bertotti formula (next step).
No-load current waveform and its components, for sinusoidal supply voltage.
Returns a dict with the waveforms (‘t’, ‘v’, ‘B’, ‘H’, ‘i0’), ‘B_peak’, ‘I0_rms’, ‘I0_peak’, ‘crest_factor’, ‘I_c1’ and ‘I_m1’ (rms in-phase and quadrature parts of the fundamental), ‘harmonics_rms’ (orders 1..n_harmonics) and ‘P_loop’ [W], the power drawn by the loop (mean of v·i0).
# Examples
nl = no_load_current(core, primary, material, supply)
# energy check: power drawn = V·I_c1 = loop energy f·V_fe·∮H dB
assert np.isclose(nl["P_loop"], supply.voltage * nl["I_c1"], rtol=1e-3)
W_cycle = material.loop.cycle_energy(nl["B"], nl["t"][1])
assert np.isclose(nl["P_loop"], supply.frequency * core.volume * W_cycle, rtol=1e-3)
# half-wave symmetry: no even harmonics
assert np.all(nl["harmonics_rms"][1::2] < 1e-9 * nl["I0_rms"])
print(f"I0 = {nl['I0_rms'] * 1e3:.1f} mA rms, crest factor {nl['crest_factor']:.2f}, "
f"I_c1 = {nl['I_c1'] * 1e3:.1f} mA, I_m1 = {nl['I_m1'] * 1e3:.1f} mA")
print("odd harmonics, % of fundamental:",
{k: round(float(100 * nl['harmonics_rms'][k - 1] / nl['harmonics_rms'][0]), 1) for k in (3, 5, 7, 9)})I0 = 72.5 mA rms, crest factor 1.48, I_c1 = 46.6 mA, I_m1 = 54.1 mA
odd harmonics, % of fundamental: {3: 16.0, 5: 5.7, 7: 2.7, 9: 1.5}
fig, ax = plt.subplots(figsize=(7, 3.8))
deg = np.degrees(2 * np.pi * supply.frequency * nl["t"])
for (h, d), style, label in [((False, False), "k:", "plain B–H"), ((True, False), "C1--", "static loop"),
((True, True), "C0", "static loop + 50 Hz widening")]:
r = no_load_current(core, primary, material, supply, hysteresis=h, dynamic=d)
ax.plot(deg, r["i0"] * 1e3, style, lw=1.4, label=label)
ax2 = ax.twinx(); ax2.plot(deg, nl["v"], color="0.6", lw=0.8); ax2.set_ylabel("v₁ (V)", color="0.5")
ax.set_xlabel("ωt (deg)"); ax.set_ylabel("i₀ (mA)")
ax.set_title("No-load current, illustrative transformer"); ax.grid(True, alpha=0.4); ax.legend(fontsize=8)
plt.show()
Core loss is always taken from the Bertotti formula, \(P_{fe} = p(f, \hat B)\,\rho\,V_{fe}\), whatever the switches. With both switches on and a loop fitted to the same steel the two agree (the loop area equals the Bertotti loss per cycle); with a switch off the waveform no longer carries all of the loss, but the loss is still counted.
The magnetising branch at that voltage:
\[R_c = \frac{V_1^2}{P_{fe}}, \qquad X_m = \frac{V_1}{I_{m1}}\]
Both depend on \(V_1\) because the iron is non-linear; evaluating them over a range of voltages gives the open-circuit characteristic.
Shunt branch at the supply voltage: ‘R_c’ and ‘X_m’ [Ω] (primary side), ‘P_fe’ [W], ‘I_m1’ [A].
R_c = V²/P_fe with P_fe from the Bertotti formula; X_m = V/I_m1 with I_m1 the quadrature fundamental of the no-load current.
Core loss [W] from the Bertotti formula over the iron volume.
# Examples
mb = magnetising_branch(core, primary, material, supply)
P_fe = core_loss(core, material, 50.0, mb["B_peak"])
assert np.isclose(mb["R_c"], 230 ** 2 / P_fe)
# at 1.4 T k_h was matched to the loop, so the loop power equals the Bertotti loss there
V_14 = supply.voltage * 1.4 / B_hat # voltage giving B̂ = 1.4 T
nl14 = no_load_current(core, primary, material, Supply(V_14, 50.0))
assert np.isclose(nl14["P_loop"], core_loss(core, material, 50.0, 1.4), rtol=2e-3)
print(f"P_fe = {mb['P_fe']:.2f} W, loop power = {nl['P_loop']:.2f} W at {B_hat:.3f} T; "
f"R_c = {mb['R_c']:.0f} Ω, X_m = {mb['X_m']:.0f} Ω")P_fe = 10.70 W, loop power = 10.71 W at 1.401 T; R_c = 4942 Ω, X_m = 4249 Ω
V_sweep = np.linspace(0.4, 1.1, 15) * supply.voltage
occ = [no_load_current(core, primary, material, Supply(V, 50.0)) for V in V_sweep]
fig, ax = plt.subplots(figsize=(7, 3.8))
ax.plot([r["I0_rms"] * 1e3 for r in occ], V_sweep, "o-", ms=3, label="I₀ rms")
ax.plot([r["I_m1"] * 1e3 for r in occ], V_sweep, "s--", ms=3, label="I_m1 (fundamental, magnetising)")
ax.set_xlabel("current (mA)"); ax.set_ylabel("V₁ (V)")
ax.set_title("Open-circuit characteristic, illustrative transformer"); ax.grid(True, alpha=0.4); ax.legend(fontsize=8)
plt.show()
Resistance of a winding with \(N\) turns of copper area \(A_{cu}\) and mean turn length \(l_{mt}\), at temperature \(T\):
\[R = \rho_{20}\,[1 + \alpha_{20}(T - 20)]\,\frac{N\,l_{mt}}{A_{cu}}\]
with annealed copper \(\rho_{20} = 1.7241\cdot10^{-8}\ \Omega\)m and \(\alpha_{20} = 0.00393\) /K (IEC 60028). DC resistance: skin and proximity effects are not included.
Leakage inductance of two concentric windings, referred to the primary (Rogowski):
\[L_\sigma = \frac{\mu_0 N_1^2\,l_{mt}}{h_w}\left(\frac{a_1}{3} + \frac{a_2}{3} + \delta\right)k_R, \qquad k_R = 1 - \frac{1 - e^{-\pi h_w/\lambda}}{\pi h_w/\lambda}, \quad \lambda = a_1 + a_2 + \delta\]
\(a_1, a_2\) are the radial builds, \(\delta\) the gap between the windings and \(h_w\) the winding height; \(l_{mt}\) is taken as the mean of the two windings’ mean turn lengths. \(k_R\) corrects for the fringing of the leakage flux at the winding ends.
Total leakage inductance [H] of two concentric windings, referred to the primary.
Rogowski factor k_R for a leakage channel of total radial width λ = a1 + a2 + δ.
DC resistance [Ω] of a winding at temperature_C (annealed copper defaults, IEC 60028).
# Examples
R1, R2 = winding_resistance(primary), winding_resistance(secondary)
assert np.isclose(R1, 1.7241e-8 * (1 + 3.93e-3 * 55) * 385 * 0.22 / 1.45e-6)
assert np.isclose(winding_resistance(primary, 20.0) / winding_resistance(primary, 75.0), 1 / (1 + 3.93e-3 * 55))
assert 0 < rogowski_factor(90e-3, 18e-3) < 1 and rogowski_factor(10.0, 18e-3) > 0.999 # → 1 for tall windings
L_s = leakage_inductance(primary, secondary, gap=2e-3, winding_height=90e-3)
print(f"R1 = {R1:.3f} Ω, R2 = {R2:.3f} Ω at 75 °C; L_σ = {L_s * 1e3:.2f} mH "
f"(X_σ = {2 * np.pi * 50 * L_s:.2f} Ω) referred to the primary")R1 = 1.225 Ω, R2 = 0.391 Ω at 75 °C; L_σ = 3.55 mH (X_σ = 1.12 Ω) referred to the primary
EquivalentCircuit holds the T circuit with every value referred to one side: the series halves \(R_1 + jX_1\) and \(R_2' + jX_2'\) and the shunt branch \(R_c \parallel jX_m\).
From tests. The open-circuit test gives the shunt branch and the short-circuit test the series impedance, each on the side where it was measured:
\[R_c = \frac{V_{oc}^2}{P_{oc}}, \quad X_m = \frac{V_{oc}^2}{Q_{oc}}, \qquad R_{eq} = \frac{P_{sc}}{I_{sc}^2}, \quad X_{eq} = \frac{Q_{sc}}{I_{sc}^2}, \qquad Q = \sqrt{(VI)^2 - P^2}\]
EquivalentCircuit.from_series splits \(R_{eq}\) and \(X_{eq}\) between the windings (equally by default).
Solving for a load. Given the load voltage \(V_2\), current \(I_2\) and power factor (all referred to the circuit’s side, \(V_2\) as the phase reference), solve_equivalent_circuit works back to the source:
| Model | Equations |
|---|---|
"T" (exact for the circuit) |
\(E = V_2 + I_2 Z_2\), \(I_1 = I_2 + E\,Y_m\), \(V_1 = E + I_1 Z_1\), \(P_{core} = |E|^2/R_c\), \(P_{cu} = |I_1|^2R_1 + |I_2|^2R_2\) |
"cantilever" (shunt at the source terminals, the usual textbook approximation) |
\(V_1 = V_2 + I_2 Z_{eq}\), \(I_1 = I_2 + V_1 Y_m\), \(P_{core} = |V_1|^2/R_c\), \(P_{cu} = |I_2|^2 R_{eq}\) |
with \(Y_m = 1/R_c - j/X_m\).
Voltage regulation follows the standard definition (IEEE C57.12.80, Chapman): the rise of the output voltage from full load to no load at the same source voltage, as a fraction of the full-load voltage,
\[\text{VR} = \frac{V_{2,nl} - V_2}{V_2}, \qquad V_{2,nl} = \left|\frac{V_1}{1 + Z_1 Y_m}\right| \ (\text{T}), \qquad V_{2,nl} = |V_1| \ (\text{cantilever})\]
Source-side quantities for a load V2 [V], I2 [A] at power_factor, all referred to the circuit’s side.
model “T” solves the T circuit exactly; “cantilever” puts the shunt branch at the source terminals. Returns ‘V1’, ‘V1_angle_deg’, ‘I1’, ‘I1_angle_deg’, ‘regulation’ (standard definition, (V2_nl - V2)/V2), ‘P_out’, ‘P_cu’, ‘P_core’, ‘P_in’, ‘efficiency’.
(R_eq, X_eq) [Ω] from a short-circuit test (rms V, A and W), on the side the test was made.
(R_c, X_m) [Ω] from an open-circuit test (rms V, A and W), on the side the test was made.
T equivalent circuit of a two-winding transformer, every value referred to one side [Ω].
# Examples
ec = EquivalentCircuit.from_series(R_eq=2.0, X_eq=4.0, R_c=2000.0, X_m=800.0)
assert (ec.R1, ec.X2, ec.R_eq) == (1.0, 2.0, 2.0)
for model in ("T", "cantilever"):
s = solve_equivalent_circuit(ec, V2=220.0, I2=4.0, power_factor=0.8, model=model)
assert np.isclose(s["P_in"], s["P_out"] + s["P_cu"] + s["P_core"]) # power balance
print(f"{model:>10}: V1 = {s['V1']:.2f} V, regulation {100 * s['regulation']:.2f} %, "
f"η = {100 * s['efficiency']:.2f} %") T: V1 = 236.82 V, regulation 7.32 %, η = 92.12 %
cantilever: V1 = 236.14 V, regulation 7.33 %, η = 92.16 %
The load is given as an apparent power \(S\) at power factor \(\cos\varphi\) on the rated secondary voltage \(V_{2n} = V_1 N_2/N_1\), which fixes a constant load impedance \(Z_L = (V_{2n}^2/S)\,e^{\pm j\varphi}\) (+ lagging). Everything is referred to the primary with \(k = N_1/N_2\):
\(Y_m\) depends on \(|E_1|\), so the circuit is solved by fixed-point iteration from \(E_1 = V_1\):
\[E_1 = \frac{V_1}{1 + Z_1\left[Y_m(E_1) + 1/(Z_2' + Z_L')\right]}\]
Then \(I_2' = E_1/(Z_2' + Z_L')\), \(I_1 = E_1[Y_m + 1/(Z_2' + Z_L')]\), the core flux density is \(\hat B(|E_1|)\), and
\[\eta = \frac{P_{out}}{P_{out} + P_{cu} + P_{fe}}, \qquad \text{regulation} = \frac{V_{2,nl} - V_2}{V_2}\]
with \(V_{2,nl} = |E_{1,nl}|\,N_2/N_1\) the no-load output voltage at the same \(V_1\), found by the same iteration with the load removed (standard definition, as in Step 8). The circuit solved at load is returned as an EquivalentCircuit in 'circuit'.
The magnetising branch uses only the fundamental of the no-load current.
def load_performance(
core:TransformerCore, primary:TransformerWinding, secondary:TransformerWinding, material:CoreMaterial,
supply:Supply, load_va:float, power_factor:float, gap:float, winding_height:float, lagging:bool=True,
temperature_C:float=75.0, hysteresis:bool=True, dynamic:bool=True, tol:float=1e-09, max_iter:int=50
)->dict:Steady-state load performance from the T equivalent circuit, referred to the primary.
The load is load_va [VA] at power_factor on the rated secondary voltage V1·N2/N1 (a constant impedance). The magnetising branch is evaluated at the core voltage E1 by fixed-point iteration. Returns currents, voltages, losses, efficiency, regulation (standard definition, (V2_nl - V2)/V2) and the solved ‘circuit’ (EquivalentCircuit, referred to the primary, shunt branch at the load point).
# Examples
lp = load_performance(core, primary, secondary, material, supply, load_va=1000.0, power_factor=0.8,
gap=2e-3, winding_height=90e-3)
assert np.isclose(lp["P_in"], lp["P_out"] + lp["P_cu"] + lp["P_fe"], rtol=1e-9) # power balance
assert lp["E1"] < supply.voltage and lp["B_peak"] < B_hat # core sees E1 < V1
print(f"1 kVA, pf 0.8 lagging: V2 = {lp['V2']:.1f} V (regulation {100 * lp['regulation']:.2f} %), "
f"I1 = {lp['I1']:.2f} A, P_cu = {lp['P_cu']:.1f} W, P_fe = {lp['P_fe']:.2f} W, η = {100 * lp['efficiency']:.2f} %, "
f"B̂ = {lp['B_peak']:.3f} T")1 kVA, pf 0.8 lagging: V2 = 109.3 V (regulation 5.48 %), I1 = 4.19 A, P_cu = 47.9 W, P_fe = 10.22 W, η = 92.52 %, B̂ = 1.367 T
These checks compare shunt_from_open_circuit, series_from_short_circuit and solve_equivalent_circuit with published solutions. They validate the circuit arithmetic and the test-data formulas, not the magnetic chain from geometry to circuit parameters (Steps 1–7), for which no published case with complete data was found.
The textbook solutions use the cantilever approximation, so they are compared with model="cantilever"; the exact T result is printed beside them to show the size of the approximation. Each published value is matched to the precision it is printed with.
| Case | Source | Compared |
|---|---|---|
| Chapman, Electric Machinery Fundamentals, Problem 2-6: 1000 VA, 230/115 V | worked solution by D. Winkler, notebook.community | \(R_c, X_m, R_{eq}, X_{eq}\) from tests; regulation at 0.8 lag, 1.0, 0.8 lead; copper and core loss; efficiency |
| Chapman, Problem 2-2: 20 kVA, 8000/277 V | uOttawa ELG3311 Tutorial 2, PDF | input voltage and angle, regulation, copper and core loss, efficiency |
| uOttawa Tutorial 2, Problem 2-3: 2000 VA, 230/115 V | same PDF | \(R_c, X_m, X_T\) from tests; \(R_T\) (see note) |
| Measured 1150 VA, 230/115 V, 50 Hz transformer | Olayinka et al., Confirmatory Test on a Single-Phase Transformer, Appropedia | \(R_c, X_m, R_{eq}, X_{eq}\) from measured OC/SC data |
Note on Problem 2-3. The tutorial prints \(R_T = 0.588\ \Omega\), but its own data give \(P_{sc}/I_{sc}^2 = 20.1/6^2 = 0.558\ \Omega\); its secondary-side value \(0.140\ \Omega = 0.558/2^2\) confirms 0.558, so 0.588 is a typo. The check uses the secondary-side value.
# Chapman Problem 2-6 (OC on the LV side, SC on the HV side; I_sc = 8.7 A as given in the problem)
R_c, X_m = shunt_from_open_circuit(115.0, 0.11, 3.9)
R_eq, X_eq = series_from_short_circuit(17.1, 8.7, 38.1)
assert np.isclose(R_c, 3391.0256, atol=5e-5) and np.isclose(X_m, 1098.9873, atol=5e-5)
assert np.isclose(R_eq, 0.5034, atol=5e-5) and np.isclose(X_eq, 1.9000, atol=5e-5)
a = 230 / 115
c26 = EquivalentCircuit.from_series(R_eq / a ** 2, X_eq / a ** 2, R_c, X_m) # referred to the LV side
I_n = 1000 / 115
for (pf, lag), vr_pub in {(0.8, True): 2.94, (1.0, True): 1.02, (0.8, False): -1.33}.items():
s = solve_equivalent_circuit(c26, 115.0, I_n, pf, lagging=lag, model="cantilever")
t = solve_equivalent_circuit(c26, 115.0, I_n, pf, lagging=lag, model="T")
assert np.isclose(100 * s["regulation"], vr_pub, atol=0.005), (pf, lag)
print(f"2-6 pf {pf} {'lag' if lag else 'lead'}: VR published {vr_pub:+.2f} %, "
f"cantilever {100 * s['regulation']:+.3f} %, T {100 * t['regulation']:+.3f} %")
s = solve_equivalent_circuit(c26, 115.0, I_n, 0.8, model="cantilever")
assert np.isclose(s["P_cu"], 9.5155, atol=5e-5) and np.isclose(s["P_core"], 4.1328, atol=5e-5)
assert np.isclose(100 * s["efficiency"], 98.3, atol=0.05)
print(f"2-6 0.8 lag: P_cu {s['P_cu']:.4f} W (9.5155), P_core {s['P_core']:.4f} W (4.1328), "
f"η {100 * s['efficiency']:.2f} % (98.3)")
# Chapman Problem 2-2, all values referred to the 8000 V side
a = 8000 / 277
c22 = EquivalentCircuit(32.0, 45.0, a ** 2 * 0.05, a ** 2 * 0.06, 250e3, 30e3)
s = solve_equivalent_circuit(c22, 8000.0, 20e3 / 8000, 0.8, model="cantilever")
t = solve_equivalent_circuit(c22, 8000.0, 20e3 / 8000, 0.8, model="T")
assert np.isclose(s["V1"], 8290, atol=1) and np.isclose(s["V1_angle_deg"], 0.55, atol=0.005)
assert np.isclose(100 * s["regulation"], 3.63, atol=0.005)
assert np.isclose(s["P_cu"], 461, atol=0.5) and np.isclose(s["P_core"], 275, atol=0.5)
assert np.isclose(100 * s["efficiency"], 95.6, atol=0.05)
print(f"2-2 V1 {s['V1']:.1f} V ∠{s['V1_angle_deg']:.3f}° (8290 ∠0.55°), VR {100 * s['regulation']:.3f} % (3.63), "
f"P_cu {s['P_cu']:.1f} W (461), P_core {s['P_core']:.1f} W (275), η {100 * s['efficiency']:.2f} % (95.6); "
f"T model: V1 {t['V1']:.1f} V, VR {100 * t['regulation']:.3f} %, η {100 * t['efficiency']:.2f} %")
# uOttawa Problem 2-3 (both tests on the 230 V side)
R_c, X_m = shunt_from_open_circuit(230.0, 0.45, 30.0)
R_T, X_T = series_from_short_circuit(13.2, 6.0, 20.1)
assert np.isclose(R_c, 1763, atol=0.5) and np.isclose(X_m, 534, atol=0.5) and np.isclose(X_T, 2.128, atol=5e-4)
assert np.isclose(R_T / 2 ** 2, 0.140, atol=5e-4) and np.isclose(X_T / 2 ** 2, 0.532, atol=5e-4)
print(f"2-3 R_c {R_c:.1f} Ω (1763), X_m {X_m:.1f} Ω (534), R_T {R_T:.4f} Ω (printed 0.588, typo), "
f"X_T {X_T:.4f} Ω (2.128)")
# Measured transformer (Appropedia): OC on the LV side, SC on the HV side
R_c, X_m = shunt_from_open_circuit(115.1, 0.435, 11.9)
R_eq, X_eq = series_from_short_circuit(13.4, 5.0, 63.7)
assert np.isclose(R_c, 1113.28, atol=5e-3) and np.isclose(X_m, 272.4, atol=0.05)
assert np.isclose(R_eq, 2.548, atol=5e-4) and np.isclose(X_eq, 0.8307, atol=5e-5)
print(f"meas R_c {R_c:.2f} Ω (1113.28), X_m {X_m:.2f} Ω (272.4), R_eq {R_eq:.4f} Ω (2.548), X_eq {X_eq:.4f} Ω (0.8307)")
print("✓ All published values reproduced")2-6 pf 0.8 lag: VR published +2.94 %, cantilever +2.942 %, T +2.942 %
2-6 pf 1.0 lag: VR published +1.02 %, cantilever +1.015 %, T +1.015 %
2-6 pf 0.8 lead: VR published -1.33 %, cantilever -1.334 %, T -1.333 %
2-6 0.8 lag: P_cu 9.5155 W (9.5155), P_core 4.1328 W (4.1328), η 98.32 % (98.3)
2-2 V1 8290.4 V ∠0.550° (8290 ∠0.55°), VR 3.630 % (3.63), P_cu 460.7 W (461), P_core 274.9 W (275), η 95.60 % (95.6); T model: V1 8303.6 V, VR 3.626 %, η 95.47 %
2-3 R_c 1763.3 Ω (1763), X_m 534.0 Ω (534), R_T 0.5583 Ω (printed 0.588, typo), X_T 2.1280 Ω (2.128)
meas R_c 1113.28 Ω (1113.28), X_m 272.40 Ω (272.4), R_eq 2.5480 Ω (2.548), X_eq 0.8307 Ω (0.8307)
✓ All published values reproduced
# switches: plain B–H draws no loop power; static loop draws less than the dynamic loop
r_off = no_load_current(core, primary, material, supply, hysteresis=False, dynamic=False)
r_static = no_load_current(core, primary, material, supply, dynamic=False)
assert abs(r_off["P_loop"]) < 1e-9 and abs(r_off["I_c1"]) < 1e-9
assert 0 < r_static["P_loop"] < nl["P_loop"]
# core loss does not depend on the switches
assert magnetising_branch(core, primary, material, supply, False, False)["P_fe"] == mb["P_fe"]
# joints: add B g_j / (μ0 N1) to the current, raising the magnetising current
core_j = replace(core, joint_gap_total=80e-6)
nl_j = no_load_current(core_j, primary, material, supply)
assert np.allclose(nl_j["i0"] - nl["i0"], nl["B"] * 80e-6 / MU0 / primary.turns)
assert nl_j["I_m1"] > nl["I_m1"] and np.isclose(nl_j["P_loop"], nl["P_loop"], rtol=1e-6)
# B̂ scales as V / (f N)
assert np.isclose(peak_flux_density(core, primary, 115, 50), B_hat / 2)
assert np.isclose(peak_flux_density(core, primary, 230, 60), B_hat * 50 / 60)
# load: unity pf and a lighter load give smaller regulation; efficiency below 1
lp_light = load_performance(core, primary, secondary, material, supply, 250.0, 1.0, 2e-3, 90e-3)
assert lp_light["regulation"] < lp["regulation"] and 0 < lp_light["efficiency"] < 1
assert np.isclose(lp_light["P_in"], lp_light["P_out"] + lp_light["P_cu"] + lp_light["P_fe"], rtol=1e-9)
# the two solvers agree: the circuit solved by load_performance, loaded with its own V2 and I2,
# gives back the supply voltage and primary current
kr = primary.turns / secondary.turns
s = solve_equivalent_circuit(lp["circuit"], lp["V2"] * kr, lp["I2"] / kr, 0.8, model="T")
assert np.isclose(s["V1"], supply.voltage, rtol=1e-6) and np.isclose(s["I1"], lp["I1"], rtol=1e-6)
assert np.isclose(s["P_core"], lp["P_fe"], rtol=1e-6) and np.isclose(s["P_cu"], lp["P_cu"], rtol=1e-6)
# regulation is referred to the full-load voltage, from the no-load voltage at the same V1
assert np.isclose(lp["regulation"], (lp["V2_no_load"] - lp["V2"]) / lp["V2"])
assert lp["V2_no_load"] < supply.voltage / kr # no-load current drops a little across Z1
# T and cantilever agree when the shunt branch is very large; no load gives zero regulation in the cantilever model
big = EquivalentCircuit.from_series(2.0, 4.0, 1e12, 1e12)
sT, sC = (solve_equivalent_circuit(big, 220.0, 4.0, 0.8, model=m) for m in ("T", "cantilever"))
assert np.isclose(sT["V1"], sC["V1"]) and np.isclose(sT["regulation"], sC["regulation"])
assert solve_equivalent_circuit(ec, 220.0, 0.0, 1.0, model="cantilever")["regulation"] == 0.0
for bad in [lambda: peak_flux_density(core, primary, 0, 50), lambda: rogowski_factor(0, 1e-2),
lambda: shunt_from_open_circuit(115, 0.1, 20), lambda: series_from_short_circuit(10, 0, 1),
lambda: solve_equivalent_circuit(ec, 220, 4, 0.8, model="pi"),
lambda: solve_equivalent_circuit(ec, 0, 4, 0.8), lambda: EquivalentCircuit.from_series(1, 1, 1, 1, 1.5),
lambda: leakage_inductance(primary, secondary, -1e-3, 0.09),
lambda: load_performance(core, primary, secondary, material, supply, 1000, 1.2, 2e-3, 0.09)]:
try:
bad()
except ValueError:
pass
else:
raise AssertionError("no ValueError")
print("✓ Transformer tests passed")✓ Transformer tests passed