Skip to main content

Module cpm

Module cpm 

Source
Expand description

Continuous-phase modulation (CPM): CPFSK, MSK and GMSK, their coherent maximum-likelihood sequence detector, two simple detectors for MSK and GMSK, and the closed forms of the MSK spectrum and of the Gaussian pulse.

§Model

An $M$-ary symbol sequence $a_{k} \in \{\pm 1, \pm 3, \dots, \pm (M - 1)\}$ is carried by the phase of a constant-envelope signal,

$$ s(t) = e^{j \varphi(t)}, \qquad \varphi(t) = 2 \pi h \sum_{k} a_{k} \, q(t - kT), $$

where $h = p/q$ is the modulation index (a rational number in lowest terms) and $q(t) = \int_{-\infty}^{t} g(\tau) \, d\tau$ the phase response, the integral of a frequency pulse $g$ of duration $LT$ and area $q(LT) = 1/2$ (Proakis & Salehi, ch. 3, §3.3-3). The pulses of FrequencyPulse (Proakis & Salehi, Table 3.3-1):

Pulse$g(t)$ on $0 \le t \le LT$
$L$REC (rectangular; 1REC is CPFSK, MSK is 1REC with $h = 1/2$)$1/(2LT)$
$L$RC (raised cosine)$\frac{1}{2LT}\left(1 - \cos \frac{2 \pi t}{LT}\right)$
GMSK (Gaussian, $BT$ the normalised bandwidth of the Gaussian filter)$\frac{1}{2T}\left[Q\left(2 \pi B \frac{t - LT/2 - T/2}{\sqrt{\ln 2}}\right) - Q\left(2 \pi B \frac{t - LT/2 + T/2}{\sqrt{\ln 2}}\right)\right]$, truncated to $L$ symbols and scaled to the area $1/2$

The Gaussian pulse is the response of the Gaussian low-pass filter of Murota & Hirade (1981, §II) to a rectangular pulse of one symbol (gmsk_pulse).

§Phase state

During the interval $nT \le t < (n + 1)T$ the phase splits into a terminal phase, which the symbols that have left the pulse window fix, and the partial response of the last $L$ symbols:

$$ \varphi(t) = \underbrace{\pi h \sum_{k \le n - L} a_{k}}{\theta{n}} + 2 \pi h \sum_{k = n - L + 1}^{n} a_{k} \, q(t - kT). $$

The modulator keeps $\theta_{n}$ as an integer multiple of $\pi / q$ modulo $2 \pi$, so a signal of millions of symbols has no numerical drift of its phase. The state of the trellis is $(\theta_{n}, a_{n-1}, \dots, a_{n-L+1})$: $2q$ terminal phases (only $q$ of them are visited when $p$ is even) times $M^{L-1}$ past symbols. The signal starts in the state $\theta_{0} = 0$ with the past symbols equal to $+1$.

§Receivers

  • Cpm::ml_detect: the coherent maximum-likelihood sequence detector, the Viterbi algorithm over the trellis above with the correlation $\operatorname{Re} \int_{nT}^{(n+1)T} r(t) \, s^{\ast}(t; \text{branch}) \, dt$ as branch metric (a constant envelope makes it equivalent to the Euclidean distance; Proakis & Salehi, ch. 4, “Optimum receiver for CPM signals”);
  • Cpm::msk_detect: the quadrature (OQPSK-type) detector of MSK, which decides the in-phase component at even symbol boundaries and the quadrature component at odd ones after a half-sinusoid matched filter (Proakis & Salehi, §3.3-2, MSK as OQPSK with sinusoidal pulses). It decides the boundary signs $d_{n}$ with $e^{j \theta_{n}} = j^{n} d_{n}$, which a differential precoder (msk_precode) maps to the CPM symbols, $a_{n} = d_{n} d_{n+1}$; the bit error rate of the precoded bits is that of antipodal signalling, $Q(\sqrt{2 E_{b}/N_{0}})$, that of the raw CPM symbols twice as much;
  • Cpm::differential_detect: the one-symbol differential phase detector of binary CPM (Simon & Wang, 1984), $\hat{a}{n} = \operatorname{sign} \operatorname{Im} (r{n} r_{n-1}^{\ast})$ on samples spaced by $T$, after an optional Gaussian predetection filter.

§Closed forms

  • msk_psd: the power spectral density of MSK (Proakis & Salehi, §3.4-3), $S(f) = \frac{16 T}{\pi^{2}} \left[\frac{\cos 2 \pi f T}{1 - 16 f^{2} T^{2}}\right]^{2}$, whose first nulls are at $f T = 3/4$ and whose two-sided 3 dB bandwidth is $0.59/T$;
  • gmsk_pulse and gmsk_phase: the Gaussian frequency pulse and its integral in closed form, $\int Q(x) \, dx = x Q(x) - \phi(x)$ with $\phi$ the normal density;
  • Cpm::min_distance2: the normalised minimum squared Euclidean distance over the merges of a few symbols, $d^{2} = \frac{\log_{2} M}{T} \int [1 - \cos \Delta \varphi(t)] \, dt$ (Anderson, Aulin & Sundberg, 1986, ch. 3), 2 for MSK.

§Verb traits

Cpm implements Modulate<Labels> (Cpm::modulate) and Demodulate<Labels> (the coherent maximum-likelihood sequence detector Cpm::ml_detect) of comnum-core on one stream of symbol indices, at its Cpm::sample_rate (1 Hz by default, time in samples; Cpm::with_sample_rate), the demodulator refusing an input at another rate. The other detectors and the phase states of the path stay methods.

§Examples

use comnum_waveform::cpm::{Cpm, CpmConfig, FrequencyPulse, msk_precode};
let msk = CpmConfig::msk(8).build()?;
let bits = [1u8, 0, 0, 1, 1, 1, 0, 1, 0, 0];
let a = msk_precode(&bits);
let s = msk.modulate(&a)?;
assert_eq!(s.len(), 80);
assert!(s.iter().all(|v| (v.norm() - 1.0).abs() < 1e-12));        // constant envelope
assert_eq!(msk.ml_detect(&s)?, a);                                 // coherent ML
assert_eq!(msk.msk_detect(&s)?, bits);                             // quadrature detector
assert_eq!(msk.differential_detect(&s, None)?, a);                 // differential detector
let gmsk = CpmConfig::gmsk(0.3, 3, 8).build()?;
assert_eq!(gmsk.config().pulse, FrequencyPulse::Gaussian { bt: 0.3 });
assert_eq!(gmsk.ml_detect(&gmsk.modulate(&a)?)?, a);

§References

  1. J. G. Proakis and M. Salehi, Digital Communications, 5th ed., McGraw-Hill, 2008, §3.3-2 (CPFSK, MSK), §3.3-3 (CPM, Table 3.3-1), §3.4-3 (spectrum of MSK) and ch. 4 (optimum receiver for CPM, minimum distance).
  2. K. Murota and K. Hirade, “GMSK modulation for digital mobile radio telephony,” IEEE Trans. Commun., 29(7), 1044–1050, 1981.
  3. J. B. Anderson, T. Aulin and C.-E. Sundberg, Digital Phase Modulation, Plenum, 1986, ch. 2–3.
  4. T. Aulin and C.-E. Sundberg, “Continuous phase modulation—Part I: Full response signaling,” IEEE Trans. Commun., 29(3), 196–209, 1981.
  5. M. K. Simon and C. C. Wang, “Differential detection of Gaussian MSK in a mobile radio environment,” IEEE Trans. Veh. Technol., 33(4), 307–320, 1984.

Structs§

Cpm
A CPM modulator and its detectors (see the module documentation).
CpmConfig
The parameters of a CPM signal, validated by CpmConfig::build.
MlPath
The survivor path of the maximum-likelihood sequence detector.
ModulationIndex
A rational modulation index $h = p/q$ (CpmConfig::h_num, CpmConfig::h_den), read from the fraction "p/q".

Enums§

FrequencyPulse
The frequency pulse $g(t)$ of a CPM signal (see the module documentation).

Functions§

gmsk_phase
The phase response of the Gaussian pulse, $q(t) = \int_{-\infty}^{t} g(\tau) \, d\tau$ in closed form (0 at $-\infty$, $1/4$ at 0, $1/2$ at $+\infty$).
gmsk_pulse
The Gaussian frequency pulse of GMSK, centred at 0, with $T = 1$ (Murota & Hirade, 1981): the response of the Gaussian low-pass filter of 3 dB bandwidth $B$ to a rectangular pulse of one symbol,
msk_bits
The information bits of MSK from the terminal phase states of a survivor path (MlPath::phase_states, in units of $\pi/2$): $d_{n} = \operatorname{Re} (e^{j \theta_{n}} (-j)^{n})$ for $n = 1 \dots N$, the inverse of msk_precode.
msk_precode
The differential precoder of MSK: the information bits $b_{1} \dots b_{N}$ give the boundary signs $d_{n} = 2 b_{n} - 1$ with $d_{0} = +1$, and the CPM symbols $a_{n} = d_{n} d_{n+1}$ (as indices, $i_{n} = (a_{n} + 1)/2$), so that the signal equals OQPSK with half-sinusoid pulses carrying $d_{n}$ on the in-phase component at even $n$ and on the quadrature component at odd $n$ (Proakis & Salehi, §3.3-2).
msk_psd
The power spectral density of MSK at the normalised frequency ft $= f T$, with $T = 1$ and a unit power (Proakis & Salehi, §3.4-3):