---
title: "Line lab: parameters, long lines and traveling waves"
heading: Computing a line's inductance and capacitance from its geometry, its exact ABCD constants, the sending-end conditions for a load, and the voltages a Bewley lattice predicts as surges bounce between the ends
eyebrow: S10 · Lesson 15 · Line lab
xp: 60
---

::: hook
Lessons 4 to 14 turned a line's geometry into parameters, its parameters into ABCD constants, and its ends into reflection coefficients. In this lab you'll write the code a line-design or switching study runs: parameters from the tower layout, exact long-line constants with complex hyperbolic functions, the sending-end voltage a load demands, and a lattice that follows a switching surge as it bounces between the ends.
:::

::: play
- The curve is the receiving-end voltage of a lossless line energized through a source resistance onto an open end, as a Bewley lattice predicts it, in units of the source voltage, against time in one-way travel times.
- With the source matched to the line (ρ_S = 0), the far end jumps to 1 at t = 1 and stays; with a stiff source (ρ_S = −1) it jumps to 2 and swings between 2 and 0 forever, since nothing absorbs energy.
- In between, the swings decay geometrically, by the factor ρ_S at each round trip.
:::

```sim plot
view: graph
x: t = 0..12
y: v = -0.2..2.2
slider: r = -1..0 = -0.5
plot: step(t - 1)*2*(1 - r)/2 + step(t - 3)*2*r*(1 - r)/2 + step(t - 5)*2*r^2*(1 - r)/2 + step(t - 7)*2*r^3*(1 - r)/2 + step(t - 9)*2*r^4*(1 - r)/2 + step(t - 11)*2*r^5*(1 - r)/2 | label: receiving-end voltage, ρ_S = r
```

::: predict
## A stiff 1 pu source (zero internal impedance) energizes an unloaded line. What does the far end's voltage do in the lossless model?

- [ ] Rises to 1 pu and stays
- [x] Jumps to 2 pu, then alternates between 0 and 2 pu every two travel times
- [ ] Rises slowly to 1 pu
- [ ] Jumps to 1.5 pu

::: reveal
The wave of 1 pu doubles on reflection at the open end, so the far end jumps to 2 pu. The reflected wave returns to the source, which reflects it with ρ = −1, and the cancelling wave reaches the far end two travel times later, doubled again: 2 − 2 = 0. With no loss and no resistance, the far end alternates 2, 0, 2, 0, which is why closing resistors and real losses matter so much in switching studies.
:::
:::

::: nameit
## What the lab computes

- **Parameters**: $D_m = \sqrt[3]{D_{12}D_{23}D_{31}}$, bundle GMR $\sqrt{D_sd}$ and equivalent radius $\sqrt{rd}$ for two conductors; $L = 2 \times 10^{-7}\ln(D_m/D_s)$ and $C = 2\pi\epsilon_0/\ln(D_m/r_\text{eq})$.
- **Long line**: with z and y per kilometer, $\gamma = \sqrt{zy}$, $Z_c = \sqrt{z/y}$, $A = D = \cosh\gamma l$, $B = Z_c\sinh\gamma l$, $C = \sinh(\gamma l)/Z_c$, and AD − BC = 1.
- **Sending end**: with receiving-end line-to-neutral voltage $V_R$ and current $I_R = (S_R/3V_R)^*$, $V_S = AV_R + BI_R$ and $I_S = CV_R + DI_R$.
- **Lattice**: a step V through source resistance $R_S$ launches $V Z_c/(Z_c + R_S)$; each arrival at the far end multiplies by $(1 + \rho_R)$ there and returns with $\rho_R$; each return to the source reflects with $\rho_S$.
:::

::: check
kind: python

## Write `line_LC(D12, D23, D31, Ds, r, d)`: the per-meter L and C of a transposed line with two-conductor bundles (conductor GMR Ds, radius r, bundle spacing d, all in meters).

```python starter
def line_LC(D12, D23, D31, Ds, r, d):
    return 0.0, 0.0
```

```python solution
import math

def line_LC(D12, D23, D31, Ds, r, d):
    Dm = (D12 * D23 * D31) ** (1 / 3)
    gmr = math.sqrt(Ds * d)
    req = math.sqrt(r * d)
    L = 2e-7 * math.log(Dm / gmr)
    C = 2 * math.pi * 8.854e-12 / math.log(Dm / req)
    return L, C
```

```python tests
L, C = line_LC(7, 7, 14, 0.01137, 0.01407, 0.45)
assert abs(L * 1e6 - 0.9629) < 1e-4 and abs(C * 1e12 - 11.816) < 1e-3, "Lesson 4's 345 kV line: 0.963 mH/km and 11.82 nF/km."
assert abs(1 / (L * C) ** 0.5 / 299792458 - 0.989) < 0.001, "Waves travel at about 99% of the speed of light."
```

::: right
Right. The wave speed comes out just under c because the GMR is slightly smaller than the radius: some flux lives inside the conductor.
:::
:::

::: check
kind: python

## Write `abcd_long(z, y, l)`: the exact (A, B, C, D) of a line with complex series impedance z (Ω/km) and shunt admittance y (S/km), l km long.

```python starter
def abcd_long(z, y, l):
    return 1, z * l, 0, 1
```

```python solution
import cmath

def abcd_long(z, y, l):
    g = cmath.sqrt(z * y)
    Zc = cmath.sqrt(z / y)
    A = cmath.cosh(g * l)
    return A, Zc * cmath.sinh(g * l), cmath.sinh(g * l) / Zc, A
```

```python tests
import cmath, math
A, B, C, D = abcd_long(0.03 + 0.363j, 4.455e-6j, 200)
assert abs(A * D - B * C - 1) < 1e-12, "Reciprocity: AD − BC = 1."
A0, _, _, _ = abcd_long(0.37j, 4.5e-6j, 500)
beta = math.sqrt(0.37 * 4.5e-6)
assert abs(A0 - math.cos(beta * 500)) < 1e-12, "Lossless: A = cos βl."
```

::: right
Right. For a lossless line cosh of an imaginary argument is a cosine: the Ferranti rise is $1/\cos\beta l$.
:::
:::

::: check
kind: python

## Write `sending_end(A, B, C, D, VLL_kV, P_MW, Q_Mvar)`: the sending-end line-to-line voltage magnitude in kV for a receiving end at VLL_kV delivering P + jQ (three-phase).

```python starter
def sending_end(A, B, C, D, VLL_kV, P_MW, Q_Mvar):
    return VLL_kV
```

```python solution
import math

def sending_end(A, B, C, D, VLL_kV, P_MW, Q_Mvar):
    VR = VLL_kV * 1e3 / math.sqrt(3)
    IR = ((P_MW - 1j * Q_Mvar) * 1e6 / 3) / VR
    VS = A * VR + B * IR
    return abs(VS) * math.sqrt(3) / 1e3
```

```python tests
import math
Z = (0.17 + 0.45j) * 30
V = sending_end(1, Z, 0, 1, 69, 20, 20 * math.tan(math.acos(0.9)))
VR = 69e3 / math.sqrt(3)
I = 20e6 / (math.sqrt(3) * 69e3 * 0.9)
want = abs(VR + Z * I * complex(0.9, -math.sin(math.acos(0.9)))) * math.sqrt(3) / 1e3
assert abs(V - want) < 1e-9, "A short line: V_S = V_R + ZI."
assert V > 69, "A lagging load needs a higher sending voltage."
```

::: right
Right. With a lagging load the current's reactive part flows through X and raises the needed sending voltage most.
:::
:::

::: check
kind: python

## Write `lattice(V, Zc, Rs, rho_R, t, T)`: the receiving-end voltage at time t of a lossless line (one-way travel time T) energized at t = 0 by a step V through source resistance Rs, with receiving-end reflection coefficient rho_R. Sum the arrivals at t = T, 3T, 5T, and so on.

```python starter
def lattice(V, Zc, Rs, rho_R, t, T):
    return V
```

```python solution
def lattice(V, Zc, Rs, rho_R, t, T):
    rho_S = (Rs - Zc) / (Rs + Zc)
    wave = V * Zc / (Zc + Rs)
    v = 0.0
    k = 0
    while (2 * k + 1) * T <= t:
        v += wave * (1 + rho_R)
        wave *= rho_R * rho_S
        k += 1
    return v
```

```python tests
assert lattice(1, 400, 400, 1, 0.5, 1) == 0, "Nothing arrives before one travel time."
assert abs(lattice(1, 400, 400, 1, 1.5, 1) - 1) < 1e-12 and abs(lattice(1, 400, 400, 1, 9.5, 1) - 1) < 1e-12, "Matched source, open end: 1 pu and stays."
assert abs(lattice(1, 400, 0, 1, 1.5, 1) - 2) < 1e-12 and abs(lattice(1, 400, 0, 1, 3.5, 1)) < 1e-12, "Stiff source: 2 pu, then 0."
v = [lattice(1, 400, 133.33, 1, t + 0.5, 1) for t in range(1, 40, 2)]
assert abs(v[-1] - 1) < 1e-6, "Any resistive source eventually settles at the source voltage."
```

::: right
Right. The series sums to $V(1 + \rho_R)Z_c/(Z_c + R_S)/(1 - \rho_R\rho_S)$, which is exactly V for an open end, as the DC steady state requires.
:::
:::

::: explain
## Why do switching studies care about the source impedance behind a breaker when energizing a long, unloaded line?

::: model
When a breaker closes onto a line, the wave launched down the line is set by the source voltage divided between the source impedance and the line's surge impedance, and the open far end doubles it. That reflection travels back to the source, which reflects it again with a coefficient set by how the source impedance compares with the surge impedance. A stiff source with almost no impedance reflects with a negative sign and nearly full strength, so the waves keep reinforcing and cancelling at the far end and the overvoltage persists, while a source impedance close to the surge impedance absorbs the returning wave. That's why breakers on long lines use closing resistors briefly inserted at the moment of closing, and why losses and the timing of the closing relative to the voltage wave matter so much.
:::
:::
