2017-12-04 16:07:54 +00:00
|
|
|
/*!
|
2017-12-04 17:39:07 +00:00
|
|
|
* \file gps_l5_signal.cc
|
|
|
|
* \brief This class implements signal generators for the GPS L5 signals
|
|
|
|
* \author Javier Arribas, 2017. jarribas(at)cttc.es
|
2017-12-04 16:07:54 +00:00
|
|
|
*
|
|
|
|
* Detailed description of the file here if needed.
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2018-05-13 20:49:11 +00:00
|
|
|
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
2017-12-04 16:07:54 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-05-13 20:49:11 +00:00
|
|
|
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
2017-12-04 16:07:54 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2018-02-26 02:15:53 +00:00
|
|
|
#include "gps_l5_signal.h"
|
|
|
|
#include "GPS_L5.h"
|
2017-12-04 16:07:54 +00:00
|
|
|
#include <cinttypes>
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <cmath>
|
2017-12-04 16:07:54 +00:00
|
|
|
#include <complex>
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <deque>
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
std::deque<bool> l5i_xa_shift(std::deque<bool> xa)
|
|
|
|
{
|
2018-12-11 11:08:54 +00:00
|
|
|
if (xa == std::deque<bool>{true, true, true, true, true, true, true, true, true, true, true, false, true})
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
2018-12-11 11:08:54 +00:00
|
|
|
return std::deque<bool>{true, true, true, true, true, true, true, true, true, true, true, true, true};
|
2017-12-04 17:39:07 +00:00
|
|
|
}
|
2018-12-03 21:08:19 +00:00
|
|
|
std::deque<bool> out(xa.begin(), xa.end() - 1);
|
|
|
|
out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]);
|
|
|
|
return out;
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
std::deque<bool> l5q_xa_shift(std::deque<bool> xa)
|
|
|
|
{
|
2018-12-11 11:08:54 +00:00
|
|
|
if (xa == std::deque<bool>{true, true, true, true, true, true, true, true, true, true, true, false, true})
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
2018-12-11 11:08:54 +00:00
|
|
|
return std::deque<bool>{true, true, true, true, true, true, true, true, true, true, true, true, true};
|
2017-12-04 17:39:07 +00:00
|
|
|
}
|
2018-12-03 21:08:19 +00:00
|
|
|
std::deque<bool> out(xa.begin(), xa.end() - 1);
|
|
|
|
out.push_front(xa[12] xor xa[11] xor xa[9] xor xa[8]);
|
|
|
|
return out;
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
std::deque<bool> l5i_xb_shift(std::deque<bool> xb)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
|
|
|
std::deque<bool> out(xb.begin(), xb.end() - 1);
|
|
|
|
out.push_front(xb[12] xor xb[11] xor xb[7] xor xb[6] xor xb[5] xor xb[3] xor xb[2] xor xb[0]);
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
std::deque<bool> l5q_xb_shift(std::deque<bool> xb)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
std::deque<bool> out(xb.begin(), xb.end() - 1);
|
2017-12-04 17:39:07 +00:00
|
|
|
out.push_front(xb[12] xor xb[11] xor xb[7] xor xb[6] xor xb[5] xor xb[3] xor xb[2] xor xb[0]);
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
std::deque<bool> make_l5i_xa()
|
|
|
|
{
|
2018-12-11 11:08:54 +00:00
|
|
|
std::deque<bool> xa = {true, true, true, true, true, true, true, true, true, true, true, true, true};
|
2019-02-22 09:47:24 +00:00
|
|
|
std::deque<bool> y(GPS_L5I_CODE_LENGTH_CHIPS, false);
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t i = 0; i < GPS_L5I_CODE_LENGTH_CHIPS; i++)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
|
|
|
y[i] = xa[12];
|
|
|
|
xa = l5i_xa_shift(xa);
|
|
|
|
}
|
|
|
|
return y;
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
std::deque<bool> make_l5i_xb()
|
|
|
|
{
|
2018-12-11 11:08:54 +00:00
|
|
|
std::deque<bool> xb = {true, true, true, true, true, true, true, true, true, true, true, true, true};
|
2019-02-22 09:47:24 +00:00
|
|
|
std::deque<bool> y(GPS_L5I_CODE_LENGTH_CHIPS, false);
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t i = 0; i < GPS_L5I_CODE_LENGTH_CHIPS; i++)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
|
|
|
y[i] = xb[12];
|
|
|
|
xb = l5i_xb_shift(xb);
|
|
|
|
}
|
|
|
|
return y;
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
std::deque<bool> make_l5q_xa()
|
|
|
|
{
|
2018-12-11 11:08:54 +00:00
|
|
|
std::deque<bool> xa = {true, true, true, true, true, true, true, true, true, true, true, true, true};
|
2019-02-22 09:47:24 +00:00
|
|
|
std::deque<bool> y(GPS_L5Q_CODE_LENGTH_CHIPS, false);
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t i = 0; i < GPS_L5Q_CODE_LENGTH_CHIPS; i++)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
|
|
|
y[i] = xa[12];
|
|
|
|
xa = l5q_xa_shift(xa);
|
|
|
|
}
|
|
|
|
return y;
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
std::deque<bool> make_l5q_xb()
|
|
|
|
{
|
2018-12-11 11:08:54 +00:00
|
|
|
std::deque<bool> xb = {true, true, true, true, true, true, true, true, true, true, true, true, true};
|
2019-02-22 09:47:24 +00:00
|
|
|
std::deque<bool> y(GPS_L5Q_CODE_LENGTH_CHIPS, false);
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t i = 0; i < GPS_L5Q_CODE_LENGTH_CHIPS; i++)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
|
|
|
y[i] = xb[12];
|
|
|
|
xb = l5q_xb_shift(xb);
|
|
|
|
}
|
|
|
|
return y;
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
void make_l5i(int32_t* _dest, int32_t prn)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
int32_t xb_offset = GPS_L5I_INIT_REG[prn];
|
2017-12-04 17:39:07 +00:00
|
|
|
|
|
|
|
std::deque<bool> xb = make_l5i_xb();
|
|
|
|
std::deque<bool> xa = make_l5i_xa();
|
2019-02-22 09:47:24 +00:00
|
|
|
std::deque<bool> xb_shift(GPS_L5I_CODE_LENGTH_CHIPS, false);
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t n = 0; n < GPS_L5I_CODE_LENGTH_CHIPS; n++)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
xb_shift[n] = xb[(xb_offset + n) % GPS_L5I_CODE_LENGTH_CHIPS];
|
2017-12-04 17:39:07 +00:00
|
|
|
}
|
2019-02-22 09:47:24 +00:00
|
|
|
std::deque<bool> out_code(GPS_L5I_CODE_LENGTH_CHIPS, false);
|
|
|
|
for (int32_t n = 0; n < GPS_L5I_CODE_LENGTH_CHIPS; n++)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
|
|
|
_dest[n] = xa[n] xor xb_shift[n];
|
|
|
|
}
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
void make_l5q(int32_t* _dest, int32_t prn)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
int32_t xb_offset = GPS_L5Q_INIT_REG[prn];
|
2017-12-04 17:39:07 +00:00
|
|
|
|
|
|
|
std::deque<bool> xb = make_l5q_xb();
|
|
|
|
std::deque<bool> xa = make_l5q_xa();
|
2019-02-22 09:47:24 +00:00
|
|
|
std::deque<bool> xb_shift(GPS_L5Q_CODE_LENGTH_CHIPS, false);
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t n = 0; n < GPS_L5Q_CODE_LENGTH_CHIPS; n++)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
xb_shift[n] = xb[(xb_offset + n) % GPS_L5Q_CODE_LENGTH_CHIPS];
|
2017-12-04 17:39:07 +00:00
|
|
|
}
|
2019-02-22 09:47:24 +00:00
|
|
|
std::deque<bool> out_code(GPS_L5Q_CODE_LENGTH_CHIPS, false);
|
|
|
|
for (int32_t n = 0; n < GPS_L5Q_CODE_LENGTH_CHIPS; n++)
|
2017-12-04 17:39:07 +00:00
|
|
|
{
|
|
|
|
_dest[n] = xa[n] xor xb_shift[n];
|
|
|
|
}
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 17:39:07 +00:00
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
void gps_l5i_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
auto* _code = new int32_t[GPS_L5I_CODE_LENGTH_CHIPS];
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
if (_prn > 0 and _prn < 51)
|
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
make_l5i(_code, _prn - 1);
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t i = 0; i < GPS_L5I_CODE_LENGTH_CHIPS; i++)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
|
|
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] _code;
|
|
|
|
}
|
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
|
|
|
|
void gps_l5i_code_gen_float(float* _dest, uint32_t _prn)
|
2018-03-13 11:38:33 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
auto* _code = new int32_t[GPS_L5I_CODE_LENGTH_CHIPS];
|
2018-03-13 11:38:33 +00:00
|
|
|
|
|
|
|
if (_prn > 0 and _prn < 51)
|
|
|
|
{
|
|
|
|
make_l5i(_code, _prn - 1);
|
|
|
|
}
|
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t i = 0; i < GPS_L5I_CODE_LENGTH_CHIPS; i++)
|
2018-03-13 11:38:33 +00:00
|
|
|
{
|
|
|
|
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] _code;
|
|
|
|
}
|
2017-12-04 16:07:54 +00:00
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
/*
|
|
|
|
* Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency
|
|
|
|
*/
|
2018-08-13 08:18:05 +00:00
|
|
|
void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
auto* _code = new int32_t[GPS_L5I_CODE_LENGTH_CHIPS];
|
2017-12-04 16:07:54 +00:00
|
|
|
if (_prn > 0 and _prn < 51)
|
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
make_l5i(_code, _prn - 1);
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
int32_t _samplesPerCode, _codeValueIndex;
|
2017-12-04 16:07:54 +00:00
|
|
|
float _ts;
|
|
|
|
float _tc;
|
2019-02-22 09:47:24 +00:00
|
|
|
const int32_t _codeLength = GPS_L5I_CODE_LENGTH_CHIPS;
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
//--- Find number of samples per spreading code ----------------------------
|
2019-02-22 09:47:24 +00:00
|
|
|
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(GPS_L5I_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
//--- Find time constants --------------------------------------------------
|
2018-03-03 01:03:39 +00:00
|
|
|
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
2019-02-22 09:47:24 +00:00
|
|
|
_tc = 1.0 / static_cast<float>(GPS_L5I_CODE_RATE_HZ); // C/A chip period in sec
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
//float aux;
|
2018-08-13 08:18:05 +00:00
|
|
|
for (int32_t i = 0; i < _samplesPerCode; i++)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
|
|
|
//=== Digitizing =======================================================
|
|
|
|
|
|
|
|
//--- Make index array to read L5 code values -------------------------
|
|
|
|
//TODO: Check this formula! Seems to start with an extra sample
|
2019-02-21 11:09:18 +00:00
|
|
|
_codeValueIndex = std::ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
|
2017-12-04 16:07:54 +00:00
|
|
|
//aux = (_ts * (i + 1)) / _tc;
|
2018-08-13 08:18:05 +00:00
|
|
|
//_codeValueIndex = static_cast<int32_t> (static_cast<long>(aux)) - 1;
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
//--- Make the digitized version of the L2C code -----------------------
|
|
|
|
if (i == _samplesPerCode - 1)
|
|
|
|
{
|
|
|
|
//--- Correct the last index (due to number rounding issues) -----------
|
|
|
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeLength - 1], 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0); //repeat the chip -> upsample
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
delete[] _code;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
void gps_l5q_code_gen_complex(std::complex<float>* _dest, uint32_t _prn)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
auto* _code = new int32_t[GPS_L5Q_CODE_LENGTH_CHIPS];
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
if (_prn > 0 and _prn < 51)
|
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
make_l5q(_code, _prn - 1);
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t i = 0; i < GPS_L5Q_CODE_LENGTH_CHIPS; i++)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
|
|
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[i], 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] _code;
|
|
|
|
}
|
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
|
|
|
|
void gps_l5q_code_gen_float(float* _dest, uint32_t _prn)
|
2018-03-13 11:38:33 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
auto* _code = new int32_t[GPS_L5Q_CODE_LENGTH_CHIPS];
|
2018-03-13 11:38:33 +00:00
|
|
|
|
|
|
|
if (_prn > 0 and _prn < 51)
|
|
|
|
{
|
|
|
|
make_l5q(_code, _prn - 1);
|
|
|
|
}
|
2017-12-04 16:07:54 +00:00
|
|
|
|
2019-02-22 09:47:24 +00:00
|
|
|
for (int32_t i = 0; i < GPS_L5Q_CODE_LENGTH_CHIPS; i++)
|
2018-03-13 11:38:33 +00:00
|
|
|
{
|
|
|
|
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] _code;
|
|
|
|
}
|
2018-08-13 08:18:05 +00:00
|
|
|
|
|
|
|
|
2017-12-04 16:07:54 +00:00
|
|
|
/*
|
|
|
|
* Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency
|
|
|
|
*/
|
2018-08-13 08:18:05 +00:00
|
|
|
void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
2019-02-22 09:47:24 +00:00
|
|
|
auto* _code = new int32_t[GPS_L5Q_CODE_LENGTH_CHIPS];
|
2017-12-04 16:07:54 +00:00
|
|
|
if (_prn > 0 and _prn < 51)
|
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
make_l5q(_code, _prn - 1);
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
|
2018-08-13 08:18:05 +00:00
|
|
|
int32_t _samplesPerCode, _codeValueIndex;
|
2017-12-04 16:07:54 +00:00
|
|
|
float _ts;
|
|
|
|
float _tc;
|
2019-02-22 09:47:24 +00:00
|
|
|
const int32_t _codeLength = GPS_L5Q_CODE_LENGTH_CHIPS;
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
//--- Find number of samples per spreading code ----------------------------
|
2019-02-22 09:47:24 +00:00
|
|
|
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(GPS_L5Q_CODE_RATE_HZ) / static_cast<double>(_codeLength)));
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
//--- Find time constants --------------------------------------------------
|
2018-03-03 01:03:39 +00:00
|
|
|
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
2019-02-22 09:47:24 +00:00
|
|
|
_tc = 1.0 / static_cast<float>(GPS_L5Q_CODE_RATE_HZ); // C/A chip period in sec
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
//float aux;
|
2018-08-13 08:18:05 +00:00
|
|
|
for (int32_t i = 0; i < _samplesPerCode; i++)
|
2017-12-04 16:07:54 +00:00
|
|
|
{
|
|
|
|
//=== Digitizing =======================================================
|
|
|
|
|
|
|
|
//--- Make index array to read L5 code values -------------------------
|
|
|
|
//TODO: Check this formula! Seems to start with an extra sample
|
2019-02-21 11:09:18 +00:00
|
|
|
_codeValueIndex = std::ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
|
2017-12-04 16:07:54 +00:00
|
|
|
//aux = (_ts * (i + 1)) / _tc;
|
2018-08-13 08:18:05 +00:00
|
|
|
//_codeValueIndex = static_cast<int32_t> (static_cast<long>(aux)) - 1;
|
2017-12-04 16:07:54 +00:00
|
|
|
|
|
|
|
//--- Make the digitized version of the L2C code -----------------------
|
|
|
|
if (i == _samplesPerCode - 1)
|
|
|
|
{
|
|
|
|
//--- Correct the last index (due to number rounding issues) -----------
|
|
|
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeLength - 1], 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-03-03 01:03:39 +00:00
|
|
|
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0); //repeat the chip -> upsample
|
2017-12-04 16:07:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
delete[] _code;
|
|
|
|
}
|