Conceptadvanced
Cycle slip
Also called PLL cycle slip.
A jump of a tracking loop by a full period of its phase ambiguity under noise, which shifts all later decisions.
A cycle slip is a jump of a phase tracking loop from one stable lock point to the next, caused by noise. A phase-locked loop on a pure carrier has lock points apart. A loop that removes the data, such as the Costas loop, the squaring loop or decision-directed carrier recovery, has lock points apart for an -fold symmetric constellation, so it can slip by . After a slip, the loop is again locked and its phase error is small, but the phase reference is rotated by a symmetry of the constellation, so all later decisions are rotated until something resolves the ambiguity again. Slips are the main failure of carrier recovery at low SNR. Feedforward estimators such as Viterbi and Viterbi phase estimation slip too, when the unwrapping of successive block estimates picks the wrong multiple of .
In plain words
A tracking loop keeps its guess of the carrier near one of several correct-looking positions. Noise pushes the guess back and forth. Most pushes are small, and the loop pulls the guess back. Now and then, many pushes in the same direction carry the guess over the hill between two positions, and the loop then settles at the next position. Nothing looks wrong after that: the loop is locked again. But the receiver now reads every symbol turned by one step, so all later data is wrong until a known pattern or a special code puts it right.
The idea
Where slips come from. The S-curve of a phase detector is periodic, with stable zeros (lock points) and unstable zeros between them. For the PLL, the S-curve is , stable at and unstable at . In the linear model the error is Gaussian and never leaves the lock point, but the true error is a nonlinear random process. Noise can carry it over an unstable point, and the loop then pulls it on to the next stable point. A slip is this passage, from one lock point to a neighbor.
The first-order loop (theorem). For the continuous-time first-order PLL with a sinusoidal detector in white Gaussian noise, Viterbi solved the Fokker-Planck equation of the phase error in 1963. The density of the error modulo is the Tikhonov density
where is the loop SNR, the inverse of the linear-model variance, and is the modified Bessel function. The mean time to the first slip is
where is the one-sided noise bandwidth of the loop. For large , , and . The mean time grows exponentially with the loop SNR: each 1 dB of loop SNR at high multiplies it by a large factor.
Other loops (rules and measurements). For second-order loops, loops with an -fold ambiguity, and sampled loops, exact results are rare, and the first-order formula is used as an approximation, with these rules:
- A loop with lock points apart behaves, for slips, like a PLL with the error , so the relevant loop SNR is about . A QPSK loop slips at a far higher SNR than a BPSK loop of the same bandwidth.
- The squaring loss of non-data-aided loops lowers the effective further at low SNR.
- A narrower loop bandwidth raises and lowers the slip rate exponentially, but it tracks phase noise and frequency changes less well.
- A residual frequency offset makes the error sit off zero, closer to one unstable point, so slips become more frequent and go mainly in one direction.
Effect on the data. After a slip by , every symbol is decided rotated by . With absolute (coherent) encoding, all bits that depend on the rotation are wrong from the slip on, until a known word or a pilot detects it. Differential encoding turns this into a short burst of errors at the slip, at the price of about twice the symbol error rate. In coded systems, a slip inside a codeword can make the decoder fail for the whole block, so slip-resilient receivers use pilot symbols, rotation-invariant codes or per-block ambiguity resolution.
Counting slips. Counting every crossing of an unstable point counts too many, because the error can cross and come back. A practical counter uses hysteresis: it counts a slip only when the error has gone well past the unstable point, for example away from the current lock point for a PLL, and then moves its reference to the new lock point.
Examples
A first-order sampled PLL (measurement). The loop on an unmodulated carrier has the noise bandwidth and the linear variance . Simulations of 150000 samples (seed 7), with the counter above, gave these mean numbers of samples between slips, against :
| slips | measured | formula | ||
|---|---|---|---|---|
| 0.05 | 1.5 | 89 | 1685 | 1566 |
| 0.05 | 2.0 | 33 | 4545 | 4000 |
| 0.10 | 2.0 | 58 | 2586 | 1949 |
| 0.02 | 1.5 | 37 | 4054 | 3974 |
| 0.05 | 3.0 | 5 | 30000 | 27508 |
The continuous-time formula fits the sampled loop well for small , and less well for , where the sampling matters. From to , the slip rate falls by a factor of about 18. The measured mean of was at , against the Tikhonov value .
A QPSK squaring loop. On the squaring loop page, a fourth-power loop with ran over 40000 QPSK symbols (seed 5). At dB the error crossed between quarter-turn lock points 52 times with a net drift of quarter turns; at 4 dB there were 12 crossings, and at 5 dB none (measurements). A change this steep over 2 dB is what the exponential growth of with the loop SNR leads one to expect.
Feedforward unwrapping. A Viterbi and Viterbi estimator on blocks of 32 QPSK symbols, followed by unwrapping, slips when two consecutive block estimates differ by more than because of noise. At 10 dB per symbol this is rare; at low SNR, or with long blocks and a fast phase drift, it becomes common.
Where it is used
- Receiver design. The loop bandwidth of a carrier loop is chosen so that the mean time between slips is long compared with a frame, for example hours at the operating SNR, while it still tracks the phase noise of the oscillators.
- Code and frame design. Pilot symbols, unique words, differential encoding and rotation-invariant trellis codes are chosen to detect or tolerate slips. Deep space and satellite links count slips as a key measure.
- Coherent optical receivers. Carrier phase estimation of QPSK and QAM in optical links uses feedforward estimators with unwrapping, and cycle slips there cause long error bursts; differential coding or pilots are used against them.
- GNSS. In carrier-phase positioning, a slip of the carrier tracking loop changes the integer ambiguity of the phase measurement, and receivers detect and repair such slips.
- Timing recovery. A symbol timing recovery loop can slip by one symbol period, which drops or repeats a symbol.
Code
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/cycle-slip/. The authors are listed in prov/4GQF6S.jsonl.
"""Cycle slips of a first-order phase-locked loop: a closed form and a slip counter.
The first-order loop tracks an unmodulated carrier r[k] = e^(j theta) + w[k],
w[k] ~ CN(0, N0), with phi <- phi + K Im(r[k] e^(-j phi)). Its noise
bandwidth is B_L T = K / (2 (2 - K)), and its linear-model phase error
variance is B_L T / SNR = 1/rho, where rho is the loop SNR.
Viterbi's nonlinear analysis of the continuous-time first-order loop gives the
Tikhonov density exp(rho cos x) / (2 pi I0(rho)) for the phase error modulo
2 pi, and the mean time between slips
T_slip = pi^2 rho I0(rho)^2 / (2 B_L) (in seconds; divide by T for samples).
For the sampled loop with a small K this is a closed form under assumptions.
count_slips() measures the slips of the sampled loop by simulation.
"""
import cmath
import math
import random
def bessel_i0(x: float) -> float:
"""The modified Bessel function I0(x) = sum_k (x/2)^(2k) / (k!)^2."""
term, total, k = 1.0, 1.0, 0
while term > 1e-17 * total:
k += 1
term *= (x / 2.0) ** 2 / (k * k)
total += term
return total
def bessel_i1(x: float) -> float:
"""The modified Bessel function I1(x) = sum_k (x/2)^(2k+1) / (k! (k+1)!)."""
term = x / 2.0
total, k = term, 0
while abs(term) > 1e-17 * abs(total) and term != 0.0:
k += 1
term *= (x / 2.0) ** 2 / (k * (k + 1))
total += term
return total
def first_order_bandwidth(k: float) -> float:
"""B_L T = K / (2 (2 - K)) of the loop phi <- phi + K e, for 0 < K < 2."""
return k / (2.0 * (2.0 - k))
def mean_samples_between_slips(rho: float, bl_t: float) -> float:
"""Viterbi's closed form pi^2 rho I0(rho)^2 / (2 B_L T), in samples."""
return math.pi**2 * rho * bessel_i0(rho) ** 2 / (2.0 * bl_t)
def simulate_errors(k: float, snr: float, n: int, seed: int) -> list[float]:
"""The unwrapped phase error theta - phi of the first-order loop over n samples, theta = 0."""
rng = random.Random(seed)
sd = math.sqrt(0.5 / snr)
phi, out = 0.0, []
for _ in range(n):
r = complex(1.0 + rng.gauss(0, sd), rng.gauss(0, sd))
e = (r * cmath.exp(-1j * phi)).imag
phi += k * e
out.append(-phi)
return out
def count_slips(errors: list[float]) -> int:
"""Count slips with hysteresis: the loop must pass 3 pi/2 beyond its current lock point."""
n, slips = 0, 0
for x in errors:
while x > 2.0 * math.pi * n + 1.5 * math.pi:
n += 1
slips += 1
while x < 2.0 * math.pi * n - 1.5 * math.pi:
n -= 1
slips += 1
return slips
test_cycle_slip.py 73 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/cycle-slip/. The authors are listed in prov/4GQF6S.jsonl.
import math
from cycle_slip import (
bessel_i0,
bessel_i1,
count_slips,
first_order_bandwidth,
mean_samples_between_slips,
simulate_errors,
)
def simpson(f, a, b, n=2000):
h = (b - a) / n
s = f(a) + f(b) + sum((4 if i % 2 else 2) * f(a + i * h) for i in range(1, n))
return s * h / 3
def test_bessel_against_the_integral() -> None:
# Reference: I_n(x) = (1/pi) integral_0^pi e^(x cos t) cos(n t) dt.
for x in (0.0, 0.5, 1.5, 3.0, 10.0):
i0 = simpson(lambda t: math.exp(x * math.cos(t)), 0, math.pi) / math.pi
i1 = simpson(lambda t: math.exp(x * math.cos(t)) * math.cos(t), 0, math.pi) / math.pi
assert abs(bessel_i0(x) - i0) < 1e-9 * i0
assert abs(bessel_i1(x) - i1) < 1e-9 * max(i1, 1.0)
def test_bandwidth_of_the_first_order_loop() -> None:
# B_L T = (1/2) sum h_k^2 with the impulse response h_k = K (1 - K)^k.
for k in (0.01, 0.05, 0.3, 1.0, 1.5):
s = 0.5 * sum((k * (1 - k) ** i) ** 2 for i in range(20000))
assert abs(first_order_bandwidth(k) - s) < 1e-12
def test_closed_form_and_its_high_snr_limit() -> None:
bl = first_order_bandwidth(0.05)
assert abs(mean_samples_between_slips(1.5, bl) - 1565.6) < 0.5
assert abs(mean_samples_between_slips(2.0, bl) - 4000.5) < 0.5
# pi^2 rho I0(rho)^2 / (2 B_L) ~ pi e^(2 rho) / (4 B_L) (1 + 1/(8 rho))^2 as rho grows.
for rho in (20.0, 40.0):
approx = math.pi * math.exp(2 * rho) / (4 * bl) * (1 + 1 / (8 * rho)) ** 2
assert abs(mean_samples_between_slips(rho, bl) / approx - 1) < 2e-3
def test_linear_regime_has_no_slips() -> None:
# rho = 20: variance close to 1/rho, and no slip in 20000 samples.
k = 0.05
bl = first_order_bandwidth(k)
e = simulate_errors(k, 20 * bl, 20000, 1)
tail = e[1000:]
var = sum(x * x for x in tail) / len(tail)
assert 0.8 < var * 20 < 1.3
assert count_slips(e) == 0
def test_slip_rate_against_the_closed_form() -> None:
# Measurement: K = 0.05, 80000 samples per loop SNR, seed 7.
k, n = 0.05, 80000
bl = first_order_bandwidth(k)
counts = {}
for rho in (1.5, 2.0):
e = simulate_errors(k, rho * bl, n, 7)
counts[rho] = count_slips(e)
measured = n / counts[rho]
assert 0.6 < measured / mean_samples_between_slips(rho, bl) < 1.7
if rho == 1.5:
# The phase error modulo 2 pi follows the Tikhonov density: E cos = I1/I0.
c = sum(math.cos(x) for x in e[2000:]) / (n - 2000)
assert abs(c - bessel_i1(rho) / bessel_i0(rho)) < 0.05
assert counts[1.5] > 2 * counts[2.0]
References
- A. J. Viterbi, Phase-locked loop dynamics in the presence of noise by Fokker-Planck techniques, Proceedings of the IEEE 51(12), 1963, pages 1737 to 1753, the stationary density of the phase error of the first-order loop and the mean time to the first slip
- Heinrich Meyr, Marc Moeneclaey and Stefan A. Fechtel, Digital Communication Receivers, Wiley, 1998, Section 6.4 (cycle slipping, pages 385 to 399: effect on symbol detection, slips in feedback and feedforward synchronizers)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag 4GQF6S Edit this page History Report an error Markdown