mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 19:50:34 +00:00
Fixing signal generator
This commit is contained in:
parent
6d1a76ba1d
commit
31b23c0fae
@ -29,6 +29,9 @@
|
||||
*/
|
||||
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdlib.h>
|
||||
#include <volk/volk.h>
|
||||
#include "signal_generator_c.h"
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
@ -36,8 +39,7 @@
|
||||
#include "nco_lib.h"
|
||||
#include "galileo_e5_signal_processing.h"
|
||||
#include "Galileo_E5a.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
/*
|
||||
* Create a new instance of signal_generator_c and return
|
||||
* a boost shared_ptr. This is effectively the public constructor.
|
||||
@ -84,7 +86,7 @@ void signal_generator_c::init()
|
||||
{
|
||||
work_counter_ = 0;
|
||||
|
||||
if (posix_memalign((void**)&complex_phase_, 16, vector_length_ * sizeof(gr_complex)) == 0){};
|
||||
complex_phase_ = (gr_complex*)volk_malloc(vector_length_ * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
// True if Galileo satellites are present
|
||||
bool gallileo_signal = std::find(system_.begin(), system_.end(), "E") != system_.end();
|
||||
@ -130,26 +132,6 @@ void signal_generator_c::init()
|
||||
}
|
||||
|
||||
random_ = new gr::random();
|
||||
|
||||
// std::cout << "fs_in: " << fs_in_ << std::endl;
|
||||
// std::cout << "data_flag: " << data_flag_ << std::endl;
|
||||
// std::cout << "noise_flag_: " << noise_flag_ << std::endl;
|
||||
// std::cout << "num_sats_: " << num_sats_ << std::endl;
|
||||
// std::cout << "vector_length_: " << vector_length_ << std::endl;
|
||||
// std::cout << "BW_BB_: " << BW_BB_ << std::endl;
|
||||
|
||||
// for (unsigned int i = 0; i < num_sats_; i++)
|
||||
// {
|
||||
// std::cout << "Sat " << i << ": " << std::endl;
|
||||
// std::cout << " System " << system_[i] << ": " << std::endl;
|
||||
// std::cout << " PRN: " << PRN_[i] << std::endl;
|
||||
// std::cout << " CN0: " << CN0_dB_[i] << std::endl;
|
||||
// std::cout << " Doppler: " << doppler_Hz_[i] << std::endl;
|
||||
// std::cout << " Delay: " << delay_chips_[i] << std::endl;
|
||||
// std::cout << " Samples per code = " << samples_per_code_[i] << std::endl;
|
||||
// std::cout << " codes per vector = " << num_of_codes_per_vector_[i] << std::endl;
|
||||
// std::cout << " data_bit_duration = " << data_bit_duration_ms_[i] << std::endl;
|
||||
// }
|
||||
}
|
||||
|
||||
void signal_generator_c::generate_codes()
|
||||
@ -159,8 +141,9 @@ void signal_generator_c::generate_codes()
|
||||
|
||||
for (unsigned int sat = 0; sat < num_sats_; sat++)
|
||||
{
|
||||
if (posix_memalign((void**)&(sampled_code_data_[sat]), 16,
|
||||
vector_length_ * sizeof(gr_complex)) == 0){};
|
||||
//if (posix_memalign((void**)&(sampled_code_data_[sat]), 16,
|
||||
// vector_length_ * sizeof(gr_complex)) == 0){};
|
||||
sampled_code_data_[sat] = (gr_complex*)std::malloc(vector_length_ * sizeof(gr_complex));
|
||||
|
||||
gr_complex code[64000];//[samples_per_code_[sat]];
|
||||
|
||||
@ -193,14 +176,8 @@ void signal_generator_c::generate_codes()
|
||||
char signal[3];
|
||||
strcpy(signal,"5X");
|
||||
|
||||
if (posix_memalign((void**)&(sampled_code_data_[sat]), 16,
|
||||
vector_length_ * sizeof(gr_complex)) == 0){};
|
||||
|
||||
|
||||
galileo_e5_a_code_gen_complex_sampled(sampled_code_data_[sat] , signal, PRN_[sat], fs_in_,
|
||||
(int)Galileo_E5a_CODE_LENGTH_CHIPS-delay_chips_[sat]);
|
||||
|
||||
|
||||
//noise
|
||||
if (noise_flag_)
|
||||
{
|
||||
@ -209,7 +186,6 @@ void signal_generator_c::generate_codes()
|
||||
sampled_code_data_[sat][i] *= sqrt(pow(10, CN0_dB_[sat] / 10) / BW_BB_ / 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -238,8 +214,7 @@ void signal_generator_c::generate_codes()
|
||||
}
|
||||
|
||||
// Generate E1C signal (25 code-periods, with secondary code)
|
||||
if (posix_memalign((void**)&(sampled_code_pilot_[sat]), 16,
|
||||
vector_length_ * sizeof(gr_complex)) == 0){};
|
||||
sampled_code_pilot_[sat] = (gr_complex*)std::malloc(vector_length_ * sizeof(gr_complex));
|
||||
|
||||
strcpy(signal, "1C");
|
||||
|
||||
@ -260,20 +235,18 @@ void signal_generator_c::generate_codes()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Our virtual destructor.
|
||||
*/
|
||||
|
||||
signal_generator_c::~signal_generator_c()
|
||||
{
|
||||
for (unsigned int sat = 0; sat < num_sats_; sat++)
|
||||
/* for (unsigned int sat = 0; sat < num_sats_; sat++)
|
||||
{
|
||||
free(sampled_code_data_[sat]);
|
||||
if (system_[sat] == "E" && signal_[sat].at(0)!='5')
|
||||
std::free(sampled_code_data_[sat]);
|
||||
if (system_[sat] == "E" && signal_[sat].at(0) != '5')
|
||||
{
|
||||
free(sampled_code_pilot_[sat]);
|
||||
std::free(sampled_code_pilot_[sat]);
|
||||
}
|
||||
}
|
||||
|
||||
} */
|
||||
volk_free(complex_phase_);
|
||||
delete random_;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user