1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 20:50:33 +00:00

Add Glonass signal for tests

This commit is contained in:
Gastd 2017-07-18 18:21:30 -03:00
parent df2496491b
commit 36a4edda1f

View File

@ -35,11 +35,13 @@
#include <gnuradio/io_signature.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include "gps_sdr_signal_processing.h"
#include "glonass_l1_signal_processing.h"
#include "galileo_e1_signal_processing.h"
#include "galileo_e5_signal_processing.h"
#include "Galileo_E1.h"
#include "Galileo_E5a.h"
#include "GPS_L1_CA.h"
#include "Glonass_L1_CA.h"
/*
* Create a new instance of signal_generator_c and return
@ -108,6 +110,14 @@ void signal_generator_c::init()
num_of_codes_per_vector_.push_back(galileo_signal ? 4 * static_cast<int>(Galileo_E1_C_SECONDARY_CODE_LENGTH) : 1);
data_bit_duration_ms_.push_back(1e3 / GPS_CA_TELEMETRY_RATE_BITS_SECOND);
}
else if (system_[sat] == "R")
{
samples_per_code_.push_back(round(static_cast<float>(fs_in_)
/ (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS)));
num_of_codes_per_vector_.push_back(galileo_signal ? 4 * static_cast<int>(Galileo_E1_C_SECONDARY_CODE_LENGTH) : 1);
data_bit_duration_ms_.push_back(1e3 / GLONASS_CA_TELEMETRY_RATE_BITS_SECOND);
}
else if (system_[sat] == "E")
{
if (signal_[sat].at(0) == '5')
@ -161,6 +171,28 @@ void signal_generator_c::generate_codes()
}
}
// Concatenate "num_of_codes_per_vector_" codes
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{
memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]),
code, sizeof(gr_complex) * samples_per_code_[sat]);
}
}
else if (system_[sat] == "R")
{
// Generate one code-period of 1G signal
glonass_l1_ca_code_gen_complex_sampled(code, /*PRN_[sat],*/ fs_in_,
static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) - delay_chips_[sat]);
// Obtain the desired CN0 assuming that Pn = 1.
if (noise_flag_)
{
for (unsigned int i = 0; i < samples_per_code_[sat]; i++)
{
code[i] *= sqrt(pow(10,CN0_dB_[sat] / 10) / BW_BB_);
}
}
// Concatenate "num_of_codes_per_vector_" codes
for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++)
{
@ -262,6 +294,8 @@ int signal_generator_c::general_work (int noutput_items __attribute__((unused)),
unsigned int out_idx = 0;
unsigned int i = 0;
unsigned int k = 0;
// the intermediate frequency must set by the user
unsigned int freq = 9540000;
for (out_idx = 0; out_idx < vector_length_; out_idx++)
{
@ -312,6 +346,45 @@ int signal_generator_c::general_work (int noutput_items __attribute__((unused)),
}
}
else if (system_[sat] == "R")
{
phase_step_rad = -static_cast<float>(GPS_TWO_PI) * (freq + (DFRQ1_GLO * GLONASS_PRN.at(PRN_[sat])) + doppler_Hz_[sat]) / static_cast<float>(fs_in_);
// std::cout << "sat " << PRN_[sat] << " SG - Freq = " << (freq + (DFRQ1_GLO * GLONASS_PRN.at(PRN_[sat]))) << " Doppler = " << doppler_Hz_[sat] << std::endl;
_phase[0] = -start_phase_rad_[sat];
volk_gnsssdr_s32f_sincos_32fc(complex_phase_, -phase_step_rad, _phase, vector_length_);
unsigned int delay_samples = (delay_chips_[sat] % static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS))
* samples_per_code_[sat] / GLONASS_L1_CA_CODE_LENGTH_CHIPS;
for (i = 0; i < num_of_codes_per_vector_[sat]; i++)
{
for (k = 0; k < delay_samples; k++)
{
out[out_idx] += sampled_code_data_[sat][out_idx]
* current_data_bits_[sat]
* complex_phase_[out_idx];
out_idx++;
}
if (ms_counter_[sat] == 0 && data_flag_)
{
// New random data bit
current_data_bits_[sat] = gr_complex((uniform_dist(e1) % 2) == 0 ? 1 : -1, 0);
}
for (k = delay_samples; k < samples_per_code_[sat]; k++)
{
out[out_idx] += sampled_code_data_[sat][out_idx]
* current_data_bits_[sat]
* complex_phase_[out_idx];
out_idx++;
}
ms_counter_[sat] = (ms_counter_[sat] + static_cast<int>(round(1e3*GLONASS_L1_CA_CODE_PERIOD)))
% data_bit_duration_ms_[sat];
}
}
else if (system_[sat] == "E")
{
if(signal_[sat].at(0)=='5')