Frequency Lock Loop using band-edge filters.
The frequency lock loop derives a band-edge filter that covers the upper and lower bandwidths of a digitally-modulated signal. The bandwidth range is determined by the excess bandwidth (e.g., rolloff factor) of the modulated signal. The placement in frequency of the band-edges is determined by the oversampling ratio (number of samples per symbol) and the excess bandwidth. The size of the filters should be fairly large so as to average over a number of symbols.
The FLL works by filtering the upper and lower band edges into x_u(t) and x_l(t), respectively. These are combined to form cc(t) = x_u(t) + x_l(t) and ss(t) = x_u(t) - x_l(t). Combining these to form the signal e(t) = Re{cc(t) imes ss(t)^*} (where ^* is the complex conjugate) provides an error signal at the DC term that is directly proportional to the carrier frequency. We then make a second-order loop using the error signal that is the running average of e(t).
In practice, the above equation can be simplified by just comparing the absolute value squared of the output of both filters: abs(x_l(t))^2 - abs(x_u(t))^2 = norm(x_l(t)) - norm(x_u(t)).
In theory, the band-edge filter is the derivative of the matched filter in frequency, (H_be(f) = frac{H(f)}{df}). In practice, this comes down to a quarter sine wave at the point of the matched filter’s rolloff (if it’s a raised-cosine, the derivative of a cosine is a sine). Extend this sine by another quarter wave to make a half wave around the band-edges is equivalent in time to the sum of two sinc functions. The baseband filter fot the band edges is therefore derived from this sum of sincs. The band edge filters are then just the baseband signal modulated to the correct place in frequency. All of these calculations are done in the ‘design_filter’ function.
Note
We use FIR filters here because the filters have to have a flat phase response over the entire frequency range to allow their comparisons to be valid.
It is very important that the band edge filters be the derivatives of the pulse shaping filter, and that they be linear phase. Otherwise, the variance of the error will be very large.
Build the FLL
Returns the number of taps of the filter.
Returns the rolloff factor used for the filter.
Returns the number of sampler per symbol used for the filter.
Print the taps to screen.
Set the number of taps in the filter.
This sets the number of taps in the band-edge filters. Setting this will force a recalculation of the filter taps.
This should be about the same number of taps used in the transmitter’s shaping filter and also not very large. A large number of taps will result in a large delay between input and frequency estimation, and so will not be as accurate. Between 30 and 70 taps is usual.
Set the rolloff factor of the shaping filter.
This sets the rolloff factor that is used in the pulse shaping filter and is used to calculate the filter taps. Changing this will force a recalculation of the filter taps.
This should be the same value that is used in the transmitter’s pulse shaping filter. It must be between 0 and 1 and is usually between 0.2 and 0.5 (where 0.22 and 0.35 are commonly used values).
Set the number of samples per symbol.
Set’s the number of samples per symbol the system should use. This value is uesd to calculate the filter taps and will force a recalculation.
Implements a kurtosis-based adaptive equalizer on complex stream
Least-Mean-Square Decision Directed Equalizer (complex in/out)
This block implements an LMS-based decision-directed equalizer. It uses a set of weights, w, to correlate against the inputs, u, and a decisions is then made from this output. The error in the decision is used to update teh weight vector.
y[n] = conj(w[n]) u[n] d[n] = decision(y[n]) e[n] = d[n] - y[n] w[n+1] = w[n] + mu u[n] conj(e[n])
Where mu is a gain value (between 0 and 1 and usualy small, around 0.001 - 0.01.
This block uses the digital_constellation object for making the decision from y[n]. Create the constellation object for whatever constellation is to be used and pass in the object. In Python, you can use something like: self.constellation = digital.constellation_qpsk() To create a QPSK constellation (see the digital_constellation block for more details as to what constellations are available or how to create your own). You then pass the object to this block as an sptr, or using “self.constellation.base()”.
The theory for this algorithm can be found in Chapter 9 of: S. Haykin, Adaptive Filter Theory, Upper Saddle River, NJ: Prentice Hall, 1996.
This block takes care of receiving M-PSK modulated signals through phase, frequency, and symbol synchronization.
This block takes care of receiving M-PSK modulated signals through phase, frequency, and symbol synchronization. It performs carrier frequency and phase locking as well as symbol timing recovery. It works with (D)BPSK, (D)QPSK, and (D)8PSK as tested currently. It should also work for OQPSK and PI/4 DQPSK.
The phase and frequency synchronization are based on a Costas loop that finds the error of the incoming signal point compared to its nearest constellation point. The frequency and phase of the NCO are updated according to this error. There are optimized phase error detectors for BPSK and QPSK, but 8PSK is done using a brute-force computation of the constellation points to find the minimum.
The symbol synchronization is done using a modified Mueller and Muller circuit from the paper:
This circuit interpolates the downconverted sample (using the NCO developed by the Costas loop) every mu samples, then it finds the sampling error based on this and the past symbols and the decision made on the samples. Like the phase error detector, there are optimized decision algorithms for BPSK and QPKS, but 8PSK uses another brute force computation against all possible symbols. The modifications to the M&M used here reduce self-noise.
Returns mu gain factor.
Returns omega gain factor.
Returns the relative omega limit.
Returns the modulation order (M) currently set.
Returns current value of mu.
Returns current value of omega.
Sets value for mu gain factor.
Sets value for omega gain factor.
Sets the relative omega limit and resets omega min/max values.
Sets the modulation order (M) currently.
Sets value of mu.
Sets value of omega and its min and max values.
Sets value of theta.
A block for computing SNR of a signal.
This block can be used to monitor and retrieve estimations of the signal SNR. It is designed to work in a flowgraph and passes all incoming data along to its output.
The block is designed for use with M-PSK signals especially. The type of estimator is specified as the parameter in the constructor. The estimators tend to trade off performance for accuracy, although experimentation should be done to figure out the right approach for a given implementation. Further, the current set of estimators are designed and proven theoretically under AWGN conditions; some amount of error should be assumed and/or estimated for real channel conditions.
Factory function returning shared pointer of this class
Parameters:
Get the running-average coefficient.
Set the running-average coefficient.
Set the number of samples between SNR tags.
Set type of estimator to use.
Return the estimated signal-to-noise ratio in decibels.
Return how many samples between SNR tags.
Return the type of estimator in use.
Mueller and M?ller (M&M) based clock recovery block with complex input, complex output.
This implements the Mueller and M?ller (M&M) discrete-time error-tracking synchronizer.
Mueller and M?ller (M&M) based clock recovery block with float input, float output.
This implements the Mueller and M?ller (M&M) discrete-time error-tracking synchronizer.
Constellation Decoder.
This block takes care of receiving generic modulated signals through phase, frequency, and symbol synchronization.
This block takes care of receiving generic modulated signals through phase, frequency, and symbol synchronization. It performs carrier frequency and phase locking as well as symbol timing recovery.
The phase and frequency synchronization are based on a Costas loop that finds the error of the incoming signal point compared to its nearest constellation point. The frequency and phase of the NCO are updated according to this error.
The symbol synchronization is done using a modified Mueller and Muller circuit from the paper:
This circuit interpolates the downconverted sample (using the NCO developed by the Costas loop) every mu samples, then it finds the sampling error based on this and the past symbols and the decision made on the samples. Like the phase error detector, there are optimized decision algorithms for BPSK and QPKS, but 8PSK uses another brute force computation against all possible symbols. The modifications to the M&M used here reduce self-noise.
Examine input for specified access code, one bit at a time.
input: stream of bits, 1 bit per input byte (data in LSB) output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit)
Each output byte contains two valid bits, the data bit, and the flag bit. The LSB (bit 0) is the data bit, and is the original input data, delayed 64 bits. Bit 1 is the flag bit and is 1 if the corresponding data bit is the first data bit following the access code. Otherwise the flag bit is 0.
Carrier tracking PLL for QPSK
input: complex; output: complex The Costas loop can have two output streams: stream 1 is the baseband I and Q; stream 2 is the normalized frequency of the loop.
must be 2, 4, or 8.
Implements constant modulus adaptive filter on complex stream
The error value and tap update equations (for p=2) can be found in:
slice float binary symbol outputting 1 bit output
x < 0 –> 0 x >= 0 –> 1
GMSK modulator.
The input of this block are symbols from an M-ary alphabet +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the valid inputs are +/-1. The modulator will silently accept any other inputs, though. The output is the phase-modulated signal.
Parameters: |
|
---|
primitive_connect(self, gr_basic_block_sptr src, int src_port, gr_basic_block_sptr dst, int dst_port)
primitive_disconnect(self, gr_basic_block_sptr src, int src_port, gr_basic_block_sptr dst, int dst_port)
A probe for computing SNR of a signal.
This is a probe block (a sink) that can be used to monitor and retrieve estimations of the signal SNR. This probe is designed for use with M-PSK signals especially. The type of estimator is specified as the parameter in the constructor. The estimators tend to trade off performance for accuracy, although experimentation should be done to figure out the right approach for a given implementation. Further, the current set of estimators are designed and proven theoretically under AWGN conditions; some amount of error should be assumed and/or estimated for real channel conditions.
Factory function returning shared pointer of this class
Parameters:
Get the running-average coefficient.
Return how many samples between SNR messages.
Set the running-average coefficient.
Set the number of samples between SNR messages.
Set type of estimator to use.
Return the estimated signal-to-noise ratio in decibels.
Return the type of estimator in use.
Generic CPM modulator.
Examples:
The input of this block are symbols from an M-ary alphabet +/-1, +/-3, ..., +/-(M-1). Usually, M = 2 and therefore, the valid inputs are +/-1. The modulator will silently accept any other inputs, though. The output is the phase-modulated signal.
Parameters: |
|
---|
Return the phase response FIR taps.
primitive_connect(self, gr_basic_block_sptr src, int src_port, gr_basic_block_sptr dst, int dst_port)
primitive_disconnect(self, gr_basic_block_sptr src, int src_port, gr_basic_block_sptr dst, int dst_port)
Adds generic demodulation options to the standard parser
Given command line options, create dictionary suitable for passing to __init__
Adds generic modulation options to the standard parser
Given command line options, create dictionary suitable for passing to __init__
Adds GMSK demodulation-specific options to the standard parser
Given command line options, create dictionary suitable for passing to __init__
Adds GMSK modulation-specific options to the standard parser
Given command line options, create dictionary suitable for passing to __init__
Adds CPM modulation-specific options to the standard parser
Given command line options, create dictionary suitable for passing to __init__
Wrap an arbitrary digital modulator in our packet handling framework.
Send packets by calling send_pkt
Send the payload.
@param payload: data to send @type payload: string
Wrap an arbitrary digital demodulator in our packet handling framework.
The input is complex baseband. When packets are demodulated, they are passed to the app via the callback.
adds a cyclic prefix vector to an input size long ofdm symbol(vector) and converts vector to a stream output_size long.
take a vector of complex constellation points in from an FFT and performs a correlation and equalization.
This block takes the output of an FFT of a received OFDM symbol and finds the start of a frame based on two known symbols. It also looks at the surrounding bins in the FFT output for the correlation in case there is a large frequency shift in the data. This block assumes that the fine frequency shift has already been corrected and that the samples fall in the middle of one FFT bin.
It then uses one of those known symbols to estimate the channel response over all subcarriers and does a simple 1-tap equalization on all subcarriers. This corrects for the phase and amplitude distortion caused by the channel.
Takes an OFDM symbol in, demaps it into bits of 0’s and 1’s, packs them into packets, and sends to to a message queue sink.
NOTE: The mod input parameter simply chooses a pre-defined demapper/slicer. Eventually, we want to be able to pass in a reference to an object to do the demapping and slicing for a given modulation type.
insert “pre-modulated” preamble symbols before each payload.
Parameters: |
|
---|
take a stream of bytes in and map to a vector of complex constellation points suitable for IFFT input to be used in an ofdm modulator. Abstract class must be subclassed with specific mapping.
Modulates an OFDM stream. Based on the options fft_length, occupied_tones, and cp_length, this block creates OFDM symbols using a specified modulation option.
Send packets by calling send_pkt
Adds OFDM-specific options to the Options Parser
Send the payload.
@param payload: data to send @type payload: string
Demodulates a received OFDM stream. Based on the options fft_length, occupied_tones, and cp_length, this block performs synchronization, FFT, and demodulation of incoming OFDM symbols and passes packets up the a higher layer.
The input is complex baseband. When packets are demodulated, they are passed to the app via the callback.
Adds OFDM-specific options to the Options Parser
Performs receiver synchronization on OFDM symbols.
The receiver performs channel filtering as well as symbol, frequency, and phase synchronization. The synchronization routines are available in three flavors: preamble correlator (Schmidl and Cox), modifid preamble correlator with autocorrelation (not yet working), and cyclic prefix correlator (Van de Beeks).
does the rest of the OFDM stuff