mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-04 01:37:03 +00:00
added scaling_factor. Removed unnecessary code.
This commit is contained in:
parent
c05fbe293b
commit
9bfe37877e
@ -76,7 +76,7 @@ struct DMA_handler_args_galileo_e1_pcps_ambiguous_acq_test
|
||||
std::string file;
|
||||
int32_t nsamples_tx;
|
||||
int32_t skip_used_samples;
|
||||
unsigned int freq_band; // 0 for GPS L1/ Galileo E1, 1 for GPS L5/Galileo E5
|
||||
float scaling_factor;
|
||||
};
|
||||
|
||||
struct acquisition_handler_args_galileo_e1_pcps_ambiguous_acq_test
|
||||
@ -93,6 +93,9 @@ public:
|
||||
|
||||
static const int32_t TEST_ACQ_SKIP_SAMPLES = 1024;
|
||||
static const int BASEBAND_SAMPLING_FREQ = 4000000;
|
||||
static constexpr float MAX_SAMPLE_VALUE = 0.096257761120796;
|
||||
static const int DMA_BITS_PER_SAMPLE = 8;
|
||||
static constexpr float DMA_SIGNAL_SCALING_FACTOR = (pow(2, DMA_BITS_PER_SAMPLE - 1) - 1) / MAX_SAMPLE_VALUE;
|
||||
|
||||
protected:
|
||||
|
||||
@ -122,9 +125,6 @@ GalileoE1PcpsAmbiguousAcquisitionTestFpga::GalileoE1PcpsAmbiguousAcquisitionTest
|
||||
|
||||
void* handler_DMA_galileo_e1_pcps_ambiguous_acq_test(void* arguments)
|
||||
{
|
||||
const float MAX_SAMPLE_VALUE = 0.096257761120796;
|
||||
const int DMA_BITS_PER_SAMPLE = 8;
|
||||
const float DMA_SCALING_FACTOR = (pow(2, DMA_BITS_PER_SAMPLE - 1) - 1) / MAX_SAMPLE_VALUE;
|
||||
const int MAX_INPUT_SAMPLES_TOTAL = 16384;
|
||||
|
||||
auto* args = (struct DMA_handler_args_galileo_e1_pcps_ambiguous_acq_test*)arguments;
|
||||
@ -212,24 +212,12 @@ void* handler_DMA_galileo_e1_pcps_ambiguous_acq_test(void* arguments)
|
||||
for (int index0 = 0; index0 < (nsamples_block_size * 2); index0 += 2)
|
||||
{
|
||||
|
||||
if (args->freq_band == 0)
|
||||
{
|
||||
// channel 1 (queue 1) -> E5/L5
|
||||
input_samples_dma[dma_index] = 0;
|
||||
input_samples_dma[dma_index + 1] = 0;
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = static_cast<int8_t>(input_samples[index0]*DMA_SCALING_FACTOR);
|
||||
input_samples_dma[dma_index + 3] = static_cast<int8_t>(input_samples[index0 + 1]*DMA_SCALING_FACTOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// channel 1 (queue 1) -> E5/L5
|
||||
input_samples_dma[dma_index] = static_cast<int8_t>(input_samples[index0]*DMA_SCALING_FACTOR);
|
||||
input_samples_dma[dma_index + 1] = static_cast<int8_t>(input_samples[index0 + 1]*DMA_SCALING_FACTOR);
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = 0;
|
||||
input_samples_dma[dma_index + 3] = 0;
|
||||
}
|
||||
// channel 1 (queue 1) -> E5/L5
|
||||
input_samples_dma[dma_index] = static_cast<int8_t>(input_samples[index0]*args->scaling_factor);
|
||||
input_samples_dma[dma_index + 1] = static_cast<int8_t>(input_samples[index0 + 1]*args->scaling_factor);
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = 0;
|
||||
input_samples_dma[dma_index + 3] = 0;
|
||||
|
||||
dma_index += 4;
|
||||
|
||||
@ -360,6 +348,9 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal()
|
||||
struct DMA_handler_args_galileo_e1_pcps_ambiguous_acq_test args;
|
||||
struct acquisition_handler_args_galileo_e1_pcps_ambiguous_acq_test args_acq;
|
||||
|
||||
// set the scaling factor
|
||||
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
||||
|
||||
std::string file = "data/Galileo_E1_ID_1_Fs_4Msps_8ms.dat";
|
||||
args.file = file; // DMA file configuration
|
||||
|
||||
@ -375,12 +366,9 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal()
|
||||
const char* str = signal.c_str(); // get a C style null terminated string
|
||||
std::memcpy(static_cast<void*>(tmp_gnss_synchro.Signal), str, 2); // copy string into synchro char array: 2 char + null
|
||||
tmp_gnss_synchro.PRN = SV_ID;
|
||||
// System_and_Signal = "GPS L1 CA";
|
||||
const std::string& role = "Acquisition";
|
||||
acquisition = std::make_shared<GalileoE1PcpsAmbiguousAcquisitionFpga>(config.get(), "Acquisition", 0, 0);
|
||||
|
||||
args.freq_band = 1; // frequency band on which the DMA has to transfer the samples
|
||||
|
||||
acquisition->set_gnss_synchro(&tmp_gnss_synchro);
|
||||
acquisition->set_channel_fsm(channel_fsm_);
|
||||
acquisition->set_channel(1);
|
||||
|
@ -74,7 +74,7 @@ struct DMA_handler_args_gps_l1_acq_test
|
||||
std::string file;
|
||||
int32_t nsamples_tx;
|
||||
int32_t skip_used_samples;
|
||||
unsigned int freq_band; // 0 for GPS L1/ Galileo E1, 1 for GPS L5/Galileo E5
|
||||
float scaling_factor;
|
||||
};
|
||||
|
||||
struct acquisition_handler_args_gps_l1_acq_test
|
||||
@ -91,6 +91,9 @@ public:
|
||||
|
||||
static const int32_t TEST_ACQ_SKIP_SAMPLES = 1024;
|
||||
static const int BASEBAND_SAMPLING_FREQ = 4000000;
|
||||
static constexpr float MAX_SAMPLE_VALUE = 0.096257761120796;
|
||||
static const int DMA_BITS_PER_SAMPLE = 8;
|
||||
static constexpr float DMA_SIGNAL_SCALING_FACTOR = (pow(2, DMA_BITS_PER_SAMPLE - 1) - 1) / MAX_SAMPLE_VALUE;
|
||||
|
||||
protected:
|
||||
|
||||
@ -120,9 +123,6 @@ GpsL1CaPcpsAcquisitionTestFpga::GpsL1CaPcpsAcquisitionTestFpga()
|
||||
|
||||
void* handler_DMA_gps_l1_acq_test(void* arguments)
|
||||
{
|
||||
const float MAX_SAMPLE_VALUE = 0.097781330347061;
|
||||
const int DMA_BITS_PER_SAMPLE = 8;
|
||||
const float DMA_SCALING_FACTOR = (pow(2, DMA_BITS_PER_SAMPLE - 1) - 1) / MAX_SAMPLE_VALUE;
|
||||
const int MAX_INPUT_SAMPLES_TOTAL = 16384;
|
||||
|
||||
auto* args = (struct DMA_handler_args_gps_l1_acq_test*)arguments;
|
||||
@ -210,24 +210,12 @@ void* handler_DMA_gps_l1_acq_test(void* arguments)
|
||||
for (int index0 = 0; index0 < (nsamples_block_size * 2); index0 += 2)
|
||||
{
|
||||
|
||||
if (args->freq_band == 0)
|
||||
{
|
||||
// channel 1 (queue 1) -> E5/L5
|
||||
input_samples_dma[dma_index] = 0;
|
||||
input_samples_dma[dma_index + 1] = 0;
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = static_cast<int8_t>(input_samples[index0]*DMA_SCALING_FACTOR);
|
||||
input_samples_dma[dma_index + 3] = static_cast<int8_t>(input_samples[index0 + 1]*DMA_SCALING_FACTOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// channel 1 (queue 1) -> E5/L5
|
||||
input_samples_dma[dma_index] = static_cast<int8_t>(input_samples[index0]*DMA_SCALING_FACTOR);
|
||||
input_samples_dma[dma_index + 1] = static_cast<int8_t>(input_samples[index0 + 1]*DMA_SCALING_FACTOR);
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = 0;
|
||||
input_samples_dma[dma_index + 3] = 0;
|
||||
}
|
||||
// channel 1 (queue 1) -> E5/L5
|
||||
input_samples_dma[dma_index] = static_cast<int8_t>(input_samples[index0]*args->scaling_factor);
|
||||
input_samples_dma[dma_index + 1] = static_cast<int8_t>(input_samples[index0 + 1]*args->scaling_factor);
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = 0;
|
||||
input_samples_dma[dma_index + 3] = 0;
|
||||
|
||||
dma_index += 4;
|
||||
|
||||
@ -358,6 +346,9 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal()
|
||||
struct DMA_handler_args_gps_l1_acq_test args;
|
||||
struct acquisition_handler_args_gps_l1_acq_test args_acq;
|
||||
|
||||
// set the scaling factor
|
||||
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
||||
|
||||
std::string file = "data/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||
args.file = file; // DMA file configuration
|
||||
|
||||
@ -376,8 +367,6 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal()
|
||||
const std::string& role = "Acquisition";
|
||||
acquisition = std::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 0);
|
||||
|
||||
args.freq_band = 1; // frequency band on which the DMA has to transfer the samples
|
||||
|
||||
acquisition->set_gnss_synchro(&tmp_gnss_synchro);
|
||||
acquisition->set_channel_fsm(channel_fsm_);
|
||||
acquisition->set_channel(1);
|
||||
|
@ -270,8 +270,8 @@ public:
|
||||
size_t item_size;
|
||||
pthread_mutex_t mutex_obs_test = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
private:
|
||||
static const int32_t TEST_OBS_SKIP_SAMPLES = 1024;
|
||||
static constexpr float DMA_SIGNAL_SCALING_FACTOR = 8.0;
|
||||
|
||||
};
|
||||
|
||||
@ -326,6 +326,7 @@ struct DMA_handler_args_obs_test
|
||||
int32_t nsamples_tx;
|
||||
int32_t skip_used_samples;
|
||||
unsigned int freq_band; // 0 for GPS L1/ Galileo E1, 1 for GPS L5/Galileo E5
|
||||
float scaling_factor;
|
||||
};
|
||||
|
||||
struct acquisition_handler_args_obs_test
|
||||
@ -437,14 +438,15 @@ void* handler_DMA_obs_test(void* arguments)
|
||||
input_samples_dma[dma_index] = 0;
|
||||
input_samples_dma[dma_index + 1] = 0;
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = input_samples[index0] << 3;
|
||||
input_samples_dma[dma_index + 3] = input_samples[index0 + 1] << 3;
|
||||
input_samples_dma[dma_index + 2] = static_cast<int8_t>(input_samples[index0]*args->scaling_factor);
|
||||
input_samples_dma[dma_index + 3] = static_cast<int8_t>(input_samples[index0 + 1]*args->scaling_factor);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// channel 1 (queue 1) -> E5/L5
|
||||
input_samples_dma[dma_index] = input_samples[index0] << 3;
|
||||
input_samples_dma[dma_index + 1] = input_samples[index0 + 1] << 3;
|
||||
input_samples_dma[dma_index] = static_cast<int8_t>(input_samples[index0]*args->scaling_factor);
|
||||
input_samples_dma[dma_index + 1] = static_cast<int8_t>(input_samples[index0 + 1]*args->scaling_factor);
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = 0;
|
||||
input_samples_dma[dma_index + 3] = 0;
|
||||
@ -689,6 +691,9 @@ bool HybridObservablesTestFpga::acquire_signal()
|
||||
nsamples_to_transfer = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L5I_CODE_RATE_CPS / GPS_L5I_CODE_LENGTH_CHIPS)));
|
||||
}
|
||||
|
||||
// set the scaling factor
|
||||
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
||||
|
||||
for (unsigned int PRN = 1; PRN < MAX_PRN_IDX; PRN++)
|
||||
{
|
||||
|
||||
@ -1879,6 +1884,8 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
|
||||
// In order to send the reset command to the HW we instantiate the acquisition module.
|
||||
std::shared_ptr<AcquisitionInterface> acquisition;
|
||||
|
||||
// set the scaling factor
|
||||
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
||||
|
||||
// reset the HW to clear the sample counters: the acquisition constructor generates a reset
|
||||
if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga")
|
||||
|
@ -144,6 +144,7 @@ struct DMA_handler_args_trk_pull_in_test
|
||||
int32_t nsamples_tx;
|
||||
int32_t skip_used_samples;
|
||||
unsigned int freq_band; // 0 for GPS L1/ Galileo E1, 1 for GPS L5/Galileo E5
|
||||
float scaling_factor;
|
||||
};
|
||||
|
||||
struct acquisition_handler_args_trk_pull_in_test
|
||||
@ -255,14 +256,18 @@ void* handler_DMA_trk_pull_in_test(void* arguments)
|
||||
input_samples_dma[dma_index] = 0;
|
||||
input_samples_dma[dma_index + 1] = 0;
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = input_samples[index0];
|
||||
input_samples_dma[dma_index + 3] = input_samples[index0 + 1];
|
||||
// input_samples_dma[dma_index + 2] = input_samples[index0];
|
||||
// input_samples_dma[dma_index + 3] = input_samples[index0 + 1];
|
||||
input_samples_dma[dma_index + 2] = static_cast<int8_t>(input_samples[index0]*args->scaling_factor);
|
||||
input_samples_dma[dma_index + 3] = static_cast<int8_t>(input_samples[index0 + 1]*args->scaling_factor);
|
||||
}
|
||||
else
|
||||
{
|
||||
// channel 1 (queue 1) -> E5/L5
|
||||
input_samples_dma[dma_index] = input_samples[index0];
|
||||
input_samples_dma[dma_index + 1] = input_samples[index0 + 1];
|
||||
// input_samples_dma[dma_index] = input_samples[index0];
|
||||
// input_samples_dma[dma_index + 1] = input_samples[index0 + 1];
|
||||
input_samples_dma[dma_index] = static_cast<int8_t>(input_samples[index0]*args->scaling_factor);
|
||||
input_samples_dma[dma_index + 1] = static_cast<int8_t>(input_samples[index0 + 1]*args->scaling_factor);
|
||||
// channel 0 (queue 0) -> E1/L1
|
||||
input_samples_dma[dma_index + 2] = 0;
|
||||
input_samples_dma[dma_index + 3] = 0;
|
||||
@ -390,6 +395,7 @@ public:
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
||||
|
||||
static const int32_t TEST_TRK_PULL_IN_TEST_SKIP_SAMPLES = 1024; //48
|
||||
static constexpr float DMA_SIGNAL_SCALING_FACTOR = 8.0;
|
||||
|
||||
};
|
||||
|
||||
@ -717,6 +723,9 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
|
||||
nsamples_to_transfer = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L5I_CODE_RATE_CPS / GPS_L5I_CODE_LENGTH_CHIPS)));
|
||||
}
|
||||
|
||||
// set the scaling factor
|
||||
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
||||
|
||||
for (unsigned int PRN = 1; PRN < MAX_PRN_IDX; PRN++)
|
||||
{
|
||||
|
||||
@ -945,6 +954,8 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults)
|
||||
|
||||
long long int acq_to_trk_delay_samples = ceil(static_cast<double>(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s);
|
||||
|
||||
// set the scaling factor
|
||||
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
||||
|
||||
// CN0 LOOP
|
||||
std::vector<std::vector<double>> pull_in_results_v_v;
|
||||
|
Loading…
x
Reference in New Issue
Block a user