synchronization¶
A Digital Communications Synchronization and PLLs Function Module
Copyright (c) March 2017, Mark Wickert All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project.
-
sk_dsp_comm.synchronization.
DD_carrier_sync
(z, M, BnTs, zeta=0.707, type=0)[source]¶ z_prime,a_hat,e_phi = DD_carrier_sync(z,M,BnTs,zeta=0.707,type=0) Decision directed carrier phase tracking
z = complex baseband PSK signal at one sample per symbol M = The PSK modulation order, i.e., 2, 8, or 8.- BnTs = time bandwidth product of loop bandwidth and the symbol period,
- thus the loop bandwidth as a fraction of the symbol rate.
zeta = loop damping factor type = Phase error detector type: 0 <> ML, 1 <> heuristic
- z_prime = phase rotation output (like soft symbol values)
- a_hat = the hard decision symbol values landing at the constellation
- values
e_phi = the phase error e(k) into the loop filter
- Ns = Nominal number of samples per symbol (Ts/T) in the carrier
- phase tracking loop, almost always 1
- Kp = The phase detector gain in the carrier phase tracking loop;
- This value depends upon the algorithm type. For the ML scheme described at the end of notes Chapter 9, A = 1, K 1/sqrt(2), so Kp = sqrt(2).
Mark Wickert July 2014
Motivated by code found in M. Rice, Digital Communications A Discrete-Time Approach, Prentice Hall, New Jersey, 2009. (ISBN 978-0-13-030497-1).
-
sk_dsp_comm.synchronization.
MPSK_bb
(N_symb, Ns, M, pulse='rect', alpha=0.25, MM=6)[source]¶ Generate non-return-to-zero (NRZ) data bits with pulse shaping.
A baseband digital data signal using +/-1 amplitude signal values and including pulse shaping.
Parameters: - N_bits : number of NRZ +/-1 data bits to produce
- Ns : the number of samples per bit,
- pulse_type : ‘rect’ , ‘rc’, ‘src’ (default ‘rect’)
- alpha : excess bandwidth factor(default 0.25)
- M : single sided pulse duration (default = 6)
Returns: - x : ndarray of the NRZ signal values
- b : ndarray of the pulse shape
- data : ndarray of the underlying data bits
Notes
Pulse shapes include ‘rect’ (rectangular), ‘rc’ (raised cosine), ‘src’ (root raised cosine). The actual pulse length is 2*M+1 samples. This function is used by BPSK_tx in the Case Study article.
Examples
>>> x,b,data = NRZ_bits(100,10) >>> t = arange(len(x)) >>> plot(t,x)
-
sk_dsp_comm.synchronization.
NDA_symb_sync
(z, Ns, L, BnTs, zeta=0.707, I_ord=3)[source]¶ - z = complex baseband input signal at nominally Ns samples
- per symbol
- Ns = Nominal number of samples per symbol (Ts/T) in the symbol
- tracking loop, often 4
- BnTs = time bandwidth product of loop bandwidth and the symbol period,
- thus the loop bandwidth as a fraction of the symbol rate.
zeta = loop damping factor
I_ord = interpolator order, 1, 2, or 3
e_tau = the timing error e(k) input to the loop filter
- Kp = The phase detector gain in the symbol tracking loop; for the
- NDA algoithm used here always 1
Mark Wickert July 2014
Motivated by code found in M. Rice, Digital Communications A Discrete-Time Approach, Prentice Hall, New Jersey, 2009. (ISBN 978-0-13-030497-1).
-
sk_dsp_comm.synchronization.
PLL1
(theta, fs, loop_type, Kv, fn, zeta, non_lin)[source]¶ [theta_hat, ev, phi] = PLL1(theta,fs,loop_type,Kv,fn,zeta,non_lin) Baseband Analog PLL Simulation Model ===================================================================
- theta = input phase deviation in radians
- fs = sampling rate in sample per second or Hz
- loop_type = 1, first-order loop filter F(s)=K_LF; 2, integrator
- with lead compensation F(s) = (1 + s tau2)/(s tau1), i.e., a type II, or 3, lowpass with lead compensation F(s) = (1 + s tau2)/(1 + s tau1)
- Kv = VCO gain in Hz/v; note presently assume Kp = 1v/rad
- and K_LF = 1; the user can easily change this
- fn = Loop natural frequency (loops 2 & 3) or cutoff
- frquency (loop 1)
zeta = Damping factor for loops 2 & 3
non_lin = 0, linear phase detector; 1, sinusoidal phase detector
- theta_hat = Output phase estimate of the input theta in radians
- ev = VCO control voltage
phi = phase error = theta - theta_hat
Alternate input in place of natural frequency, fn, in Hz is the noise equivalent bandwidth Bn in Hz. =================================================================== Mark Wickert, April 2007 for ECE 5625/4625 Modified February 2008 and July 2014 for ECE 5675/4675 Python version August 2014
-
sk_dsp_comm.synchronization.
PLL_cbb
(x, fs, loop_type, Kv, fn, zeta)[source]¶ [theta_hat, ev, phi] = PLL_cbb(theta,fs,loop_type,Kv,fn,zeta) Baseband Analog PLL Simulation Model ===================================================================
- theta = input phase deviation in radians
- fs = sampling rate in sample per second or Hz
- loop_type = 1, first-order loop filter F(s)=K_LF; 2, integrator
- with lead compensation F(s) = (1 + s tau2)/(s tau1), i.e., a type II, or 3, lowpass with lead compensation F(s) = (1 + s tau2)/(1 + s tau1)
- Kv = VCO gain in Hz/v; note presently assume Kp = 1v/rad
- and K_LF = 1; the user can easily change this
- fn = Loop natural frequency (loops 2 & 3) or cutoff
- frquency (loop 1)
zeta = Damping factor for loops 2 & 3
- theta_hat = Output phase estimate of the input theta in radians
- ev = VCO control voltage
phi = phase error = theta - theta_hat
Alternate input in place of natural frequency, fn, in Hz is the noise equivalent bandwidth Bn in Hz. =================================================================== Mark Wickert, April 2007 for ECE 5625/4625 Modified February 2008 and July 2014 for ECE 5675/4675 Python version August 2014
-
sk_dsp_comm.synchronization.
phase_step
(z, Ns, theta_step, Nsymb)[source]¶ Create a one sample per symbol signal containing a phase rotation step Nsymb into the waveform.
z = complex baseband signal after matched filterNs = number of sample per symbol
- theta_step = size in radians of the phase step
- Nstep = symbol sample location where the step turns on z_rot = the one sample symbol signal containing the phase step
Mark Wickert July 2014
-
sk_dsp_comm.synchronization.
time_step
(z, Ns, time_step, Nstep)[source]¶ Create a one sample per symbol signal containing a phase rotation step Nsymb into the waveform.
z = complex baseband signal after matched filterNs = number of sample per symbol
- time_step = in samples relative to Ns
- Nstep = symbol sample location where the step turns on
z_step = the one sample per symbol signal containing the phase step
Mark Wickert July 2014