Skip to content

Decoding Algorithm

WuPeicong edited this page Apr 29, 2022 · 7 revisions

Correlation

Correlation is to calculate the similarity between 2 signals by convolution. In ground station program, the prns correlate against the signal to determine that in a given time, the signal represents 1 or 0.

Following are prn 0/1 and an example signal. The signal contains 3 prns. prn1 prn0 Signal

A more efficient way to do convolution than directly calculate the convolution is to convert all related signal to frequency domain, then simply multiplys them. There is another reason making this necessary: considering that this chipsat is a moving object on the low earth orbit, the doppler effect must be taken into account. The signal in frequency domain has to try different frequency shift by simply rolling shift itself.

At this time, we simply set a center frequency offset(doppler_center, which is 0, meaning that the center is the default frequency 915 MHz) and a doppler_range, the program will search the best correlation magnitude in the range [doppler_center - doppler_range, doppler_center + doppler_range). In order to achieve better performance, the range should be as narrow as possible. Given the fact that the relative velocity between chipsat and ground station doesn't change a lot, dynamically tracking the center frequency could be a good way to improve the performance.

Applying IFFF to the product of signal and prn in the frequency domain converts it back to time domain, the program only choose the best magnitude.

In order to determine the bits for each prn, the magnitude needs to be compared. So the difference between two magnitude is the key array for decoding(and the diffference between preamble correlation magnitude and prn0 correlation magnitude is also needed for preamble detection).

The correlation results should looks like this, the auxiliary vertical lines are used to devide different bits. Corr_poster

Data extraction

As the image above shows, each prn is segemented. The way to detemine 1 or 0 is simply adding up all magnitude in each segement and checking its sign. The segmentation is reletively easy once the begining of the first prn is found, since each prn has a fixed length.

The deocder uses Scipy's peak finding algorithm to find all possible preamble position. To find the begining of the first prn, the decoder compares the sliding average of (Magnitue(preamble) - Magnitue(prn0)) and abs(Magnitue(prn1) - Magnitue(prn0)). Starting at the peak position, once the later is greater than the former, the point is considered as the begining of the first prn. we chose 1 as the averaging radius.

f1

Forward Error Correction

Clone this wiki locally