1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-05 09:43:04 +00:00

Galileo E5a acquisition adapter and signal processing

This commit is contained in:
marc-sales
2014-05-20 21:53:12 +02:00
parent 7fc58001ec
commit 54a1417d3d
6 changed files with 806 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
/*
* galileo_e5_signal_processing.cc
*
* Created on: May 20, 2014
* Author: marc
*/
#include "galileo_e5_signal_processing.h"
void galileo_e5_a_code_gen_complex(std::complex<float>* _dest, signed int _prn, bool _pilot)
{
unsigned int prn=_prn-1;
unsigned int index=0;
//int _code_int[(int)Galileo_E5a_CODE_LENGTH_CHIPS];
int a[4];
if ((_prn < 1) || (_prn > 50))
{
return;
}
if (_pilot)
{
for (size_t i = 0; i < Galileo_E5a_Q_PRIMARY_CODE[prn].length(); i++)
{
// hex_to_binary_converter(&_dest[index],
// Galileo_E5a_Q_PRIMARY_CODE[prn].at(i));
// hex_to_binary_converter(&_code_int[index],
// Galileo_E5a_Q_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(&a[0],
Galileo_E5a_Q_PRIMARY_CODE[prn].at(i));
_dest[index]=std::complex<float>(float(a[0]),0.0);
_dest[index+1]=std::complex<float>(float(a[1]),0.0);
_dest[index+2]=std::complex<float>(float(a[2]),0.0);
_dest[index+3]=std::complex<float>(float(a[3]),0.0);
index = index + 4;
}
}
else
{
for (size_t i = 0; i < Galileo_E5a_I_PRIMARY_CODE[prn].length(); i++)
{
// hex_to_binary_converter(&_code_int[index],
// Galileo_E5a_I_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(&a[0],
Galileo_E5a_I_PRIMARY_CODE[prn].at(i));
_dest[index]=std::complex<float>(float(a[0]),0.0);
_dest[index+1]=std::complex<float>(float(a[1]),0.0);
_dest[index+2]=std::complex<float>(float(a[2]),0.0);
_dest[index+3]=std::complex<float>(float(a[3]),0.0);
index = index + 4;
}
}
}
void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, bool _pilot,
unsigned int _prn, signed int _fs, unsigned int _chip_shift,
bool _secondary_flag)
{
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::complex<float> _code[Galileo_E5a_CODE_LENGTH_CHIPS];
signed int _samplesPerCode, _codeValueIndex;
float _ts;
float _tc;
const int _codeFreqBasis = Galileo_E5a_CODE_CHIP_RATE_HZ; //Hz
unsigned int _codeLength = Galileo_E5a_CODE_LENGTH_CHIPS;
std::complex<float> primary_code_E5a_chips[(int)Galileo_E5a_CODE_LENGTH_CHIPS];
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
const unsigned int delay = (((int)Galileo_E5a_CODE_LENGTH_CHIPS - _chip_shift)
% (int)Galileo_E5a_CODE_LENGTH_CHIPS)
* _samplesPerCode / Galileo_E5a_CODE_LENGTH_CHIPS;
galileo_e5_a_code_gen_complex(_code , _prn , _pilot);
if (_fs != _codeFreqBasis)
{
std::complex<float>* _resampled_signal = new std::complex<float>[_codeLength];
resampler(_code, _resampled_signal, _codeFreqBasis, _fs,
_codeLength, _samplesPerCode); //resamples code to fs
delete[] _code;
_code = _resampled_signal;
}
// TODO generar codigo secundario cuando sepamos si se hace aqui o se replica en el tracking
// o en una funcion a parte en esta misma clase
for (unsigned int i = 0; i < _samplesPerCode; i++)
{
_dest[(i+delay)%_samplesPerCode] = _code[i];
}
delete[] _code;
}

View File

@@ -0,0 +1,32 @@
/*
* galileo_e5_signal_processing.h
*
* Created on: May 20, 2014
* Author: marc
*/
#ifndef GALILEO_E5_SIGNAL_PROCESSING_H_
#define GALILEO_E5_SIGNAL_PROCESSING_H_
#include <complex>
#include <iostream>
#include <gnuradio/math.h>
#include "Galileo_E5a.h"
#include "gnss_signal_processing.h"
/*!
* \brief Generates Galileo E5a code at 1 sample/chip
* bool _pilot generates E5aQ code if true and E5aI (data signal) if false.
*/
void galileo_e5_a_code_gen_complex(std::complex<float>* _dest, signed int _prn, bool _pilot);
/*!
* \brief Generates Galileo E5a complex code, shifted to the desired chip and sampled at a frequency fs
* bool _pilot generates E5aQ code if true and E5aI (data signal) if false.
*/
void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest,
bool _pilot, unsigned int _prn, signed int _fs, unsigned int _chip_shift,
bool _secondary_flag);
#endif /* GALILEO_E5_SIGNAL_PROCESSING_H_ */