---
title: "Project: thermal design of a power stage"
heading: Heat-sink sizing, self-heating feedback and junction temperature under pulsed load
eyebrow: "B11 · Lesson 53 · Project: thermal design of a power stage"
xp: 80
---

::: hook
A MOSFET switching a motor or a power supply has three thermal questions to answer before it ships. How good a heat sink does it need? Will it settle at a safe junction temperature, given that its on-resistance rises as it heats, which raises its loss, which heats it further? And how hot does the junction get during the load's pulses, which the steady numbers don't tell you? In this project you'll write the tools to answer all three: a heat-sink calculation, a self-consistent operating point that detects **thermal runaway**, and a junction-temperature simulator that takes any power waveform through a Foster thermal network.
:::

::: predict
## A MOSFET's on-resistance rises 0.7% per °C. Its conduction loss heats it through 4 K/W. As the load current rises, what happens to the junction temperature?

- [ ] It rises in proportion to I²
- [x] It rises faster than I², and beyond a critical current there's no steady state at all
- [ ] It levels off
- [ ] It falls, because the resistance limits the current

::: reveal
The loss $I^2R(T_j)$ grows with $T_j$, and $T_j$ grows with the loss: a positive feedback loop with gain $\theta I^2R_{25}\alpha$. While that gain is below 1 the loop settles, at $T_j = \frac{T_a + \theta I^2R_{25}(1 - 25\alpha)}{1 - \theta I^2R_{25}\alpha}$, which climbs steeply as the gain approaches 1. At gain 1 (here near 60 A for 10 mΩ) there's no solution: thermal runaway. The same loop, with leakage current in place of resistance, is why bipolar transistors need emitter resistors.
:::
:::

::: nameit
## What you'll write

1. `max_theta_sa(P, Ta, Tjmax, theta_jc, theta_cs)`: the largest heat-sink resistance that keeps the junction at or below $T_{j,max}$ at power P in ambient $T_a$.
2. `operating_point(I, R25, alpha, theta, Ta, iters=200)`: iterate $P = I^2R_{25}(1 + \alpha(T_j - 25))$, $T_j = T_a + \theta P$ from $T_j = T_a$; return `(Tj, P)`, or `None` if the temperature passes 1000 °C (runaway).
3. `tj_waveform(P, dt, stages, Ta=0.0)`: the junction temperature for a power array P sampled every dt, through a Foster network given as a list of (R, τ) stages. Each stage obeys $\tau\frac{dT_i}{dt} = PR_i - T_i$; with P constant over a step, the exact update is $T_i \leftarrow PR_i + (T_i - PR_i)e^{-dt/\tau_i}$. Return $T_a + \sum T_i$ after each step.

## Checks you can do by hand

- Self-heating closed form, above, and the runaway current $I_c = 1/\sqrt{\theta R_{25}\alpha}$.
- A single stage driven by pulses of power P, on for $t_{on}$ in every period $T_p$, settles to a peak rise
$$\Delta T_{peak} = PR\frac{1 - e^{-t_{on}/\tau}}{1 - e^{-T_p/\tau}}$$
which lies between the average, $PR\frac{t_{on}}{T_p}$, and the steady value PR.
:::

::: example
## A part must dissipate 20 W in 40 °C air with $T_{j,max}$ = 150 °C, θ_jc = 0.8 K/W and θ_cs = 0.3 K/W. What heat sink does it need?

::: solution
1. **Total allowed resistance.** The whole path can be at most
   $$\begin{aligned} \theta_{ja} &= \frac{150 - 40}{20} \\ &= 5.5\ \text{K/W} \end{aligned}$$
2. **Subtract the part's own resistances.** The sink must be this or better:
   $$5.5 - 0.8 - 0.3 = 4.4\ \text{K/W}$$
3. **Derate.** Designers then derate: picking 3 K/W keeps the junction near 122 °C, which by the Arrhenius law of lesson 3 extends its life several times.

**Answer:** the part needs a heat sink of 4.4 K/W or better, and 3 K/W gives a comfortable margin.
:::
:::

::: example
## 50 W pulses, 1 ms on in every 4 ms, drive a stage with R = 0.5 K/W and τ = 2 ms. What's the steady peak rise?

::: solution
1. **Steady peak rise.**
   $$\begin{aligned} \Delta T_{peak} &= 25\frac{1 - e^{-0.5}}{1 - e^{-2}} \\ &= 11.4\ \text{K} \end{aligned}$$
2. **Compare with the limits.** That's between the average rise, 25 × 0.25 = 6.25 K, and the 25 K a continuous 50 W would cause.
3. **For the simulation.** The simulation in step 3 must reproduce it exactly, because the exponential update is exact for piecewise-constant power.

**Answer:** the steady peak rise is 11.4 K.
:::
:::

::: check
kind: python

## Step 1. Write `max_theta_sa(P, Ta, Tjmax, theta_jc, theta_cs)`.

```python starter
def max_theta_sa(P, Ta, Tjmax, theta_jc, theta_cs):
    return 0.0

print(max_theta_sa(20, 40, 150, 0.8, 0.3))
```

```python solution
def max_theta_sa(P, Ta, Tjmax, theta_jc, theta_cs):
    return (Tjmax - Ta) / P - theta_jc - theta_cs

print(max_theta_sa(20, 40, 150, 0.8, 0.3))
```

```python tests
assert abs(max_theta_sa(20, 40, 150, 0.8, 0.3) - 4.4) < 1e-9, "20 W, 40 °C air, 150 °C limit, 1.1 K/W already used: the sink may be 4.4 K/W."
assert abs(max_theta_sa(5, 70, 125, 2.0, 0.5) - 8.5) < 1e-9, "5 W in 70 °C air to 125 °C with 2.5 K/W used leaves 8.5 K/W."
assert max_theta_sa(100, 50, 150, 0.5, 0.6) < 0, "At 100 W the package alone is too much: the answer should be negative (no sink can work)."
```

::: right
Right. A negative answer is a real result: no heat sink can save a part whose own package resistance already exceeds the budget.
:::
:::

::: check
kind: python

## Step 2. Write `operating_point(I, R25, alpha, theta, Ta, iters=200)`.

```python starter
def operating_point(I, R25, alpha, theta, Ta, iters=200):
    Tj = Ta
    # iterate: loss from Tj, new Tj from loss; return None past 1000 °C
    return Tj, 0.0

print(operating_point(20, 0.01, 0.007, 4.0, 40))
```

```python solution
def operating_point(I, R25, alpha, theta, Ta, iters=200):
    Tj = Ta
    for _ in range(iters):
        P = I**2 * R25 * (1 + alpha * (Tj - 25))
        Tnew = Ta + theta * P
        if Tnew > 1000:
            return None
        Tj = Tnew
    return Tj, I**2 * R25 * (1 + alpha * (Tj - 25))

print(operating_point(20, 0.01, 0.007, 4.0, 40))
```

```python tests
for I in (10, 20, 30, 45):
    g = 4.0 * I**2 * 0.01
    want = (40 + g * (1 - 25 * 0.007)) / (1 - g * 0.007)
    r = operating_point(I, 0.01, 0.007, 4.0, 40)
    assert r is not None, f"At {I} A the loop gain is {g * 0.007:.2f} < 1: there's a steady state."
    Tj, P = r
    assert abs(Tj - want) < 1e-3, f"At {I} A the junction settles at {want:.2f} °C; got {Tj:.2f}."
    assert abs(Tj - (40 + 4.0 * P)) < 1e-3, "Return the loss that goes with the final temperature."
assert operating_point(70, 0.01, 0.007, 4.0, 40) is None, "At 70 A the loop gain exceeds 1: thermal runaway, return None."
```

::: right
Right. The iteration converges whenever the loop gain $\theta I^2R_{25}\alpha$ is below 1, and diverges, correctly flagged as runaway, above it.
:::
:::

::: check
kind: python

## Step 3. Write `tj_waveform(P, dt, stages, Ta=0.0)`.

```python starter
import numpy as np

def tj_waveform(P, dt, stages, Ta=0.0):
    out = np.zeros(len(P))
    # one temperature per stage, exact exponential update each step
    return out + Ta

dt = 1e-4
print(tj_waveform(np.full(100, 10.0), dt, [(0.5, 0.01), (2.0, 30.0)])[-1])
```

```python solution
import numpy as np

def tj_waveform(P, dt, stages, Ta=0.0):
    T = np.zeros(len(stages))
    out = np.empty(len(P))
    decay = np.array([np.exp(-dt / tau) for R, tau in stages])
    Rs = np.array([R for R, tau in stages])
    for i, p in enumerate(P):
        T = p * Rs + (T - p * Rs) * decay
        out[i] = Ta + T.sum()
    return out

dt = 1e-4
print(tj_waveform(np.full(100, 10.0), dt, [(0.5, 0.01), (2.0, 30.0)])[-1])
```

```python tests
import numpy as np
dt = 1e-4
t = np.arange(1, 2001) * dt
st = [(0.5, 0.01), (2.0, 30.0)]
step = tj_waveform(np.full(2000, 10.0), dt, st, Ta=25.0)
Z = 25 + 10 * sum(R * (1 - np.exp(-t / tau)) for R, tau in st)
assert np.max(np.abs(step - Z)) < 1e-9, "A power step must reproduce Ta + P·Z_th(t) exactly."
n = np.arange(400 * 40)
P = np.where((n % 40) < 10, 50.0, 0.0)
w = tj_waveform(P, dt, [(0.5, 2e-3)])
peak = w[-40:].max()
want = 25 * (1 - np.exp(-0.5)) / (1 - np.exp(-2))
assert abs(peak - want) < 1e-6, f"Pulses of 50 W, 1 ms in 4 ms, settle to a peak rise of {want:.4f} K; got {peak:.4f}."
```

::: right
Right. The exact update reproduces the step response and the periodic-pulse peak to rounding error, so it can be trusted for any measured power waveform.
:::
:::

::: check
given: I = 15 | 30 | 40; R = 5 | 10; t = 2 | 4; let g = t*I^2*R/1000
answer: (40 + g*(1 - 25*0.007))/(1 - g*0.007)
unit: °C
tolerance: 0.5%

## A MOSFET with $R_{25}$ = {R} mΩ (α = 0.007/°C) carries {I} A through {t} K/W from 40 °C air. Where does its junction settle?

::: right
Right. $\frac{T_a + \theta I^2R_{25}(1 - 25\alpha)}{1 - \theta I^2R_{25}\alpha}$ = {answer} °C.
:::

::: misses
- [40 + g] That ignores the rise in resistance with temperature.
- [any] Not yet. Solve $T_j = T_a + \theta I^2R_{25}(1 + \alpha(T_j - 25))$.
:::
:::

::: check
given: R = 3 | 10 | 25; t = 1 | 4; a = 0.005 | 0.007
answer: 1/sqrt(t*R/1000*a)
unit: A
tolerance: 0.5%

## Above what current does a MOSFET with $R_{25}$ = {R} mΩ, temperature coefficient {a}/°C and {t} K/W of thermal resistance run away?

::: right
Right. $I_c = 1/\sqrt{\theta R_{25}\alpha}$ = {answer} A.
:::

::: misses
- [1/(t*R/1000*a)] The loop gain goes as I², so take the square root.
- [any] Not yet. Loop gain $\theta I^2R_{25}\alpha$ = 1.
:::
:::

::: check
given: P = 20 | 100; R = 0.3 | 1; n = 0.5 | 2; p = 4 | 8; u = 3 | 6
answer: P*R*(1 - exp(-n/u))/(1 - exp(-p/u))
unit: K
tolerance: 0.5%

## Pulses of {P} W, on for {n} ms in every {p} ms, drive a stage with R = {R} K/W and τ = {u} ms. What's the settled peak rise?

::: right
Right. $PR\frac{1 - e^{-t_{on}/\tau}}{1 - e^{-T_p/\tau}}$ = {answer} K.
:::

::: misses
- [P*R*n/p] That's the average rise; the peak is higher.
- [P*R*(1 - exp(-n/u))] That's the first pulse; later pulses start from a warmer floor.
- [any] Not yet. Steady periodic state of a single RC stage.
:::
:::

::: explain
## Why does the self-heating loop in a MOSFET settle at a temperature higher than a fixed-resistance estimate, and why can it fail to settle at all?

::: model
A fixed-resistance estimate computes the loss once, at 25 °C, and multiplies by the thermal resistance. But the on-resistance rises with temperature, so at the higher junction temperature the loss is larger, which raises the temperature further, which raises the resistance again. Each round adds a fraction of the previous increase, the fraction being the loop gain $\theta I^2R_{25}\alpha$. If that gain is below 1 the increments shrink geometrically and the temperature settles, at the estimate divided by roughly (1 − gain). If the gain reaches 1, each round adds at least as much as the last, the series diverges, and the temperature climbs until something fails. That's thermal runaway, and the design rule is to keep the loop gain well below 1 at the worst-case current and ambient temperature.
:::
:::

::: practice

::: check
given: I = 10 | 35; R = 4 | 12; t = 1.5 | 3; let g = t*I^2*R/1000
answer: (40 + g*(1 - 25*0.007))/(1 - g*0.007)
unit: °C
tolerance: 0.5%

## Settled junction: {I} A, {R} mΩ, {t} K/W, 40 °C air?

::: misses
- [any] Solve the self-heating loop.
:::
:::

::: check
given: R = 2 | 30; t = 0.5 | 6; a = 0.004 | 0.008
answer: 1/sqrt(t*R/1000*a)
unit: A
tolerance: 0.5%

## Runaway current: {R} mΩ, {t} K/W, α = {a}/°C?

::: misses
- [any] $1/\sqrt{\theta R_{25}\alpha}$.
:::
:::

::: check
given: P = 10 | 200; R = 0.2 | 1.5; n = 0.2 | 3; p = 5 | 20; u = 0.5 | 8
answer: P*R*(1 - exp(-n/u))/(1 - exp(-p/u))
unit: K
tolerance: 0.5%

## Peak rise: {P} W, {n} of every {p} ms, R = {R} K/W, τ = {u} ms?

::: misses
- [any] $PR\frac{1 - e^{-t_{on}/\tau}}{1 - e^{-T_p/\tau}}$.
:::
:::
:::
