Category Archives: Fundamentals

The basic building blocks.

Open Signal Coverage Maps for Pakistan

Open Signal is a mobile application that collects the data about your wireless network (2G/3G/4G) and generates coverage maps and host of other reports. The data is collected in the background while the user is busy in his daily routines. But data can also be collected on the request of the user. This is much better than drive testing since the data is collected in real life scenarios and on thousands of different devices that are in use.

The app works while the user is indoor or outdoor, at rest or in motion, on land or on water, at sea level or on a mountain, in dry weather or in rain. Basically anywhere and anytime there are wireless signals available. There are currently 20 million users of the app (both Android and iOS combined) and this number is increasing. In Pakistan all major networks are supported including Jazz, Telenor, Zong and Ufone (both 2G/3G and 4G networks are supported).

JAZZ Islamabad Coverage Map

Telenor Islamabad Coverage Map

Zong Islamabad Coverage Map

Ufone Islamabad Coverage Map

Rayleigh Fading Envelope Generation – Python

When wireless signals travel from a transmitter to a receiver they do so after reflection, refraction, diffraction and scattering from the environment. Very rarely is there a direct line of sight (LOS) between the transmitter and receiver. Thus multiple time delayed copies of the signal reach the receiver that combine constructively and destructively. In a sense the channel acts as an FIR (finite impulse response) filter. Furthermore since the transmitter or receiver may be in motion the amplitude and phase of these replicas varies with time.

There are several methods to model the amplitude and phase of each of these components. We look at one method called the “Smiths Fading Simulator” which is based on Clark and Gans model. The simulator can be constructed using the following steps.

1. Define N the number of Gaussian RVs to be generated, fm the Doppler frequency in Hz, fs the sampling frequency in Hz, df the frequency spacing which is calculated as df=(2*fm)/(N-1) and M total number of samples in frequency domain which is calculated as M=(fs/df).
2. Generate two sequences of N/2 complex Gaussian random variables. These correspond to the frequency bins up to fm. Take the complex conjugate of these sequences to generate the N/2 complex Gaussian random variables for the negative frequency bins up to -fm.
3. Multiply the above complex Gaussian sequences g1 and g2 with square root of the Doppler Spectrum S generated from -fm to fm. Calculate the spectrum at -fm and +fm by using linear extrapolation.
4. Extend the above generated spectra from -fs/2 to +fs/2 by stuffing zeros from -fs/2 to -fm and fm to fs/2. Take the IFFT of the resulting spectra X and Y resulting in time domain signals x and y.
5. Add the absolute values of the resulting signals x and y in quadrature. Take the absolute value of this complex signal. This is the desired Rayleigh distributed envelope with the required temporal correlation.

The Matlab code for generating Rayleigh random sequence with a Doppler frequency of fm Hz is given below.

Fourier Transform in Python

Fast Fourier Transform or FFT is a powerful tool to visualize a signal in the frequency domain. Shown below is the FFT of a signal (press the play button) composed of four sinusoids at frequencies of 50Hz, 100Hz, 200Hz and 400Hz. The sampling frequency is set at 1000Hz, more than twice the maximum frequency of the composite signal. The amplitude of the sinusoids diminishes with increasing frequency and this is also reflected in the frequency domain. Play with the code, decrease the frequencies, increase the power, visualize the FFT output on logarithmic scale!

Alamouti – Transmit Diversity Scheme – Implemented in Python

We have already seen in previous posts that the BER of BPSK increases significantly when the channel changes from a simple AWGN channel to a fading channel. One solution to this problem, that was proposed by Alamouti, was to use Transmit Diversity i.e. multiple transmit antennas transmit the information over multiple time slots increasing the likelihood of receiving the information. We have considered the simplest case of two transmit antennas and BPSK modulation (QPSK modulation would give the same BER with twice the throughput). Given below is the Python code for this, feel free to modify it and run it from the console given below.

Implementation on Trinket

Implementation on REPL

Run Python Code from the Browser

Here is a piece of Python code that calculates Bit Error Rate (BER) of BPSK. The code is a bit slow at the moment, compared to MATLAB implementation, but this is work in progress and further optimizations would be carried out. We would like to point out that the main reason for this slower implementation is that a bit by bit error calculation is done, insteadĀ of a vectorial implementation. We already pointed out in our previous post that a “for loop” implemented in Python is not that efficient.