completing the acquisition assistance option from primary frequencies (e.g. L1, E1) to secondary frequencies (e.g. L5, E5)

This commit is contained in:
Javier Arribas 2019-07-23 17:56:02 +02:00
parent 31b6f9defd
commit 27b1baf0b7
18 changed files with 153 additions and 45 deletions

View File

@ -154,6 +154,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
doppler_center_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
@ -211,6 +212,13 @@ void GalileoE1PcpsAmbiguousAcquisition::set_doppler_step(unsigned int doppler_st
acquisition_->set_doppler_step(doppler_step_);
}
void GalileoE1PcpsAmbiguousAcquisition::set_doppler_center(int doppler_center)
{
doppler_center_ = doppler_center;
acquisition_->set_doppler_center(doppler_center_);
}
void GalileoE1PcpsAmbiguousAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{

View File

@ -123,6 +123,11 @@ public:
*/
void set_doppler_step(unsigned int doppler_step) override;
/*!
* \brief Set Doppler center for the grid search
*/
void set_doppler_center(int doppler_center) override;
/*!
* \brief Initializes acquisition algorithm.
*/
@ -176,6 +181,7 @@ private:
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
int doppler_center_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
int64_t fs_in_;

View File

@ -152,6 +152,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
doppler_center_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
@ -208,6 +209,12 @@ void GalileoE5aPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
acquisition_->set_doppler_step(doppler_step_);
}
void GalileoE5aPcpsAcquisition::set_doppler_center(int doppler_center)
{
doppler_center_ = doppler_center;
acquisition_->set_doppler_center(doppler_center_);
}
void GalileoE5aPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{

View File

@ -111,6 +111,11 @@ public:
*/
void set_doppler_step(unsigned int doppler_step) override;
/*!
* \brief Set Doppler center for the grid search
*/
void set_doppler_center(int doppler_center) override;
/*!
* \brief Initializes acquisition algorithm.
*/
@ -169,6 +174,7 @@ private:
std::weak_ptr<ChannelFsm> channel_fsm_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int doppler_center_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
unsigned int in_streams_;

View File

@ -148,6 +148,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
doppler_center_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
@ -200,6 +201,12 @@ void GpsL1CaPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
acquisition_->set_doppler_step(doppler_step_);
}
void GpsL1CaPcpsAcquisition::set_doppler_center(int doppler_center)
{
doppler_center_ = doppler_center;
acquisition_->set_doppler_center(doppler_center_);
}
void GpsL1CaPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{

View File

@ -127,6 +127,11 @@ public:
*/
void set_doppler_step(unsigned int doppler_step) override;
/*!
* \brief Set Doppler center for the grid search
*/
void set_doppler_center(int doppler_center) override;
/*!
* \brief Initializes acquisition algorithm.
*/
@ -179,6 +184,7 @@ private:
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int doppler_center_;
unsigned int sampled_ms_;
unsigned int max_dwells_;
int64_t fs_in_;

View File

@ -151,6 +151,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
doppler_center_ = 0;
gnss_synchro_ = nullptr;
num_codes_ = acq_parameters_.sampled_ms / acq_parameters_.ms_per_code;
@ -210,6 +211,12 @@ void GpsL2MPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
acquisition_->set_doppler_step(doppler_step_);
}
void GpsL2MPcpsAcquisition::set_doppler_center(int doppler_center)
{
doppler_center_ = doppler_center;
acquisition_->set_doppler_center(doppler_center_);
}
void GpsL2MPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{

View File

@ -124,6 +124,11 @@ public:
*/
void set_doppler_step(unsigned int doppler_step) override;
/*!
* \brief Set Doppler center for the grid search
*/
void set_doppler_center(int doppler_center) override;
/*!
* \brief Initializes acquisition algorithm.
*/
@ -176,6 +181,7 @@ private:
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int doppler_center_;
unsigned int max_dwells_;
int64_t fs_in_;
bool dump_;

View File

@ -147,6 +147,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
doppler_center_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
@ -205,6 +206,12 @@ void GpsL5iPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
acquisition_->set_doppler_step(doppler_step_);
}
void GpsL5iPcpsAcquisition::set_doppler_center(int doppler_center)
{
doppler_center_ = doppler_center;
acquisition_->set_doppler_center(doppler_center_);
}
void GpsL5iPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
{

View File

@ -124,6 +124,11 @@ public:
*/
void set_doppler_step(unsigned int doppler_step) override;
/*!
* \brief Set Doppler center for the grid search
*/
void set_doppler_center(int doppler_center) override;
/*!
* \brief Initializes acquisition algorithm.
*/
@ -176,6 +181,7 @@ private:
float threshold_;
unsigned int doppler_max_;
unsigned int doppler_step_;
unsigned int doppler_center_;
unsigned int max_dwells_;
int64_t fs_in_;
bool dump_;

View File

@ -48,7 +48,6 @@
#else
#include <boost/filesystem/path.hpp>
#endif
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
#include <pmt/pmt.h> // for from_long
@ -90,7 +89,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
d_active = false;
d_positive_acq = 0;
d_state = 0;
d_old_freq = 0LL;
d_doppler_bias = 0;
d_num_noncoherent_integrations_counter = 0U;
d_consumed_samples = acq_parameters.sampled_ms * acq_parameters.samples_per_ms * (acq_parameters.bit_transition_flag ? 2 : 1);
if (acq_parameters.sampled_ms == acq_parameters.ms_per_code)
@ -107,6 +106,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
d_num_doppler_bins = 0U;
d_threshold = 0.0;
d_doppler_step = 0U;
d_doppler_center = 0U;
d_doppler_center_step_two = 0.0;
d_test_statistics = 0.0;
d_channel = 0U;
@ -215,8 +215,6 @@ void pcps_acquisition::set_resampler_latency(uint32_t latency_samples)
void pcps_acquisition::set_local_code(std::complex<float>* code)
{
// reset the intermediate frequency
d_old_freq = 0LL;
// This will check if it's fdma, if yes will update the intermediate frequency and the doppler grid
if (is_fdma())
{
@ -253,17 +251,19 @@ void pcps_acquisition::set_local_code(std::complex<float>* code)
bool pcps_acquisition::is_fdma()
{
// reset the intermediate frequency
d_doppler_bias = 0;
// Dealing with FDMA system
if (strcmp(d_gnss_synchro->Signal, "1G") == 0)
{
d_old_freq += DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN);
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
d_doppler_bias = static_cast<int32_t>(DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN));
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_doppler_bias << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
return true;
}
if (strcmp(d_gnss_synchro->Signal, "2G") == 0)
{
d_old_freq += DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN);
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
d_doppler_bias += static_cast<int32_t>(DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN));
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_doppler_bias << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
return true;
}
return false;
@ -318,14 +318,10 @@ void pcps_acquisition::init()
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
for (uint32_t k = 0; k < d_fft_size; k++)
{
d_magnitude_grid[doppler_index][k] = 0.0;
}
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_old_freq + doppler);
std::fill(d_magnitude_grid[doppler_index].begin(), d_magnitude_grid[doppler_index].end(), 0.0);
}
update_grid_doppler_wipeoffs();
d_worker_active = false;
if (d_dump)
@ -341,8 +337,8 @@ void pcps_acquisition::update_grid_doppler_wipeoffs()
{
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_old_freq + doppler);
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_center + d_doppler_step * doppler_index;
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_doppler_bias + doppler);
}
}
@ -394,7 +390,8 @@ void pcps_acquisition::send_positive_acquisition()
<< ", code phase " << d_gnss_synchro->Acq_delay_samples
<< ", doppler " << d_gnss_synchro->Acq_doppler_hz
<< ", magnitude " << d_mag
<< ", input signal power " << d_input_power;
<< ", input signal power " << d_input_power
<< ", Assist doppler_center " << d_doppler_center;
d_positive_acq = 1;
if (!d_channel_fsm.expired())
@ -552,7 +549,7 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t&
indext = index_time;
if (!d_step_two)
{
doppler = -static_cast<int32_t>(doppler_max) + doppler_step * static_cast<int32_t>(index_doppler);
doppler = -static_cast<int32_t>(doppler_max) + d_doppler_center + doppler_step * static_cast<int32_t>(index_doppler);
}
else
{
@ -590,7 +587,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
if (!d_step_two)
{
doppler = -static_cast<int32_t>(doppler_max) + doppler_step * static_cast<int32_t>(index_doppler);
doppler = -static_cast<int32_t>(doppler_max) + d_doppler_center + doppler_step * static_cast<int32_t>(index_doppler);
}
else
{

View File

@ -55,6 +55,7 @@
#include "acq_conf.h"
#include "channel_fsm.h"
#include <armadillo>
#include <glog/logging.h>
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h> // for gr_complex
@ -188,6 +189,21 @@ public:
d_doppler_step = doppler_step;
}
/*!
* \brief Set Doppler center frequency for the grid search. It will refresh the Doppler grid.
* \param doppler_center - Frequency center of the search grid [Hz].
*/
inline void set_doppler_center(int32_t doppler_center)
{
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
if (doppler_center != d_doppler_center)
{
DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]";
d_doppler_center = doppler_center;
update_grid_doppler_wipeoffs();
}
}
void set_resampler_latency(uint32_t latency_samples);
/*!
@ -211,6 +227,8 @@ private:
uint32_t d_channel;
uint32_t d_samplesPerChip;
uint32_t d_doppler_step;
int32_t d_doppler_center;
int32_t d_doppler_bias;
uint32_t d_num_noncoherent_integrations_counter;
uint32_t d_fft_size;
uint32_t d_consumed_samples;
@ -220,7 +238,6 @@ private:
uint32_t d_buffer_count;
uint64_t d_sample_counter;
int64_t d_dump_number;
int64_t d_old_freq;
float d_threshold;
float d_mag;
float d_input_power;

View File

@ -232,6 +232,10 @@ void Channel::stop_channel()
}
void Channel::assist_acquisition_doppler(double Carrier_Doppler_hz)
{
acq_->set_doppler_center(static_cast<int>(Carrier_Doppler_hz));
}
void Channel::start_acquisition()
{
std::lock_guard<std::mutex> lk(mx);

View File

@ -87,6 +87,8 @@ public:
void stop_channel() override; //!< Stop the State Machine
void set_signal(const Gnss_Signal& gnss_signal_) override; //!< Sets the channel GNSS signal
void assist_acquisition_doppler(double Carrier_Doppler_hz) override;
inline std::shared_ptr<AcquisitionInterface> acquisition() { return acq_; }
inline std::shared_ptr<TrackingInterface> tracking() { return trk_; }
inline std::shared_ptr<TelemetryDecoderInterface> telemetry() { return nav_; }

View File

@ -62,6 +62,10 @@ public:
virtual void set_threshold(float threshold) = 0;
virtual void set_doppler_max(unsigned int doppler_max) = 0;
virtual void set_doppler_step(unsigned int doppler_step) = 0;
virtual void set_doppler_center(int doppler_center __attribute__((unused)))
{
return;
}
virtual void init() = 0;
virtual void set_local_code() = 0;
virtual void set_state(int state) = 0;

View File

@ -57,6 +57,7 @@ public:
virtual gr::basic_block_sptr get_right_block() = 0;
virtual Gnss_Signal get_signal() const = 0;
virtual void start_acquisition() = 0;
virtual void assist_acquisition_doppler(double Carrier_Doppler_hz) = 0;
virtual void stop_channel() = 0;
virtual void set_signal(const Gnss_Signal&) = 0;
};

View File

@ -1163,7 +1163,24 @@ void GNSSFlowgraph::remove_signal(const Gnss_Signal& gs)
break;
}
}
//project Doppler from primary frequency to secondary frequency
double GNSSFlowgraph::project_doppler(std::string searched_signal, double primary_freq_doppler_hz)
{
switch (mapStringValues_[searched_signal])
{
case evGPS_L5:
return (primary_freq_doppler_hz / FREQ1) * FREQ5;
break;
case evGAL_5X:
return (primary_freq_doppler_hz / FREQ1) * FREQ5;
break;
case evGPS_2S:
return (primary_freq_doppler_hz / FREQ1) * FREQ2;
break;
default:
return primary_freq_doppler_hz;
}
}
void GNSSFlowgraph::acquisition_manager(unsigned int who)
{
@ -1186,10 +1203,11 @@ void GNSSFlowgraph::acquisition_manager(unsigned int who)
bool assistance_available = false;
bool start_acquisition = false;
Gnss_Signal gnss_signal;
float estimated_doppler;
double RX_time;
if (sat_ == 0)
{
float estimated_doppler;
double RX_time;
gnss_signal = search_next_signal(channels_[current_channel]->get_signal().get_signal_str(),
true,
is_primary_freq,
@ -1198,12 +1216,6 @@ void GNSSFlowgraph::acquisition_manager(unsigned int who)
RX_time);
channels_[current_channel]->set_signal(gnss_signal);
start_acquisition = is_primary_freq or assistance_available or !configuration_->property("GNSS-SDR.assist_dual_frequency_acq", false);
// if (assistance_available)
// {
// std::cout << "Channel " << current_channel
// << " assistance available for " << channels_[current_channel]->get_signal().get_satellite()
// << ", Signal " << channels_[current_channel]->get_signal().get_signal_str() << std::endl;
// }
}
else
{
@ -1217,6 +1229,15 @@ void GNSSFlowgraph::acquisition_manager(unsigned int who)
DLOG(INFO) << "Channel " << current_channel
<< " Starting acquisition " << channels_[current_channel]->get_signal().get_satellite()
<< ", Signal " << channels_[current_channel]->get_signal().get_signal_str();
if (assistance_available == true and configuration_->property("GNSS-SDR.assist_dual_frequency_acq", false))
{
channels_[current_channel]->assist_acquisition_doppler(project_doppler(channels_[current_channel]->get_signal().get_signal_str(), estimated_doppler));
}
else
{
//set Doppler center to 0 Hz
channels_[current_channel]->assist_acquisition_doppler(0);
}
#ifndef ENABLE_FPGA
channels_[current_channel]->start_acquisition();
#else
@ -1232,11 +1253,6 @@ void GNSSFlowgraph::acquisition_manager(unsigned int who)
<< " secondary frequency acquisition assistance not available in "
<< channels_[current_channel]->get_signal().get_satellite()
<< ", Signal " << channels_[current_channel]->get_signal().get_signal_str();
// std::cout << "Channel " << current_channel
// << " secondary frequency acquisition assistance not available in "
// << channels_[current_channel]->get_signal().get_satellite()
// << ", Signal " << channels_[current_channel]->get_signal().get_signal_str() << std::endl;
}
}
DLOG(INFO) << "Channel " << current_channel << " in state " << channels_state_[current_channel];
@ -1272,6 +1288,7 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
std::lock_guard<std::mutex> lock(signal_list_mutex);
DLOG(INFO) << "Received " << what << " from " << who;
Gnss_Signal gs = channels_[who]->get_signal();
unsigned int sat = 0;
if (who < 200)
{
@ -1287,12 +1304,7 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
switch (what)
{
case 0:
DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str();
if (sat == 0)
{
Gnss_Signal gs = channels_[who]->get_signal();
push_back_signal(gs);
}
DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << gs.get_satellite() << ", Signal " << gs.get_signal_str();
channels_state_[who] = 0;
if (acq_channels_count_ > 0)
{
@ -1300,11 +1312,16 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
}
// call the acquisition manager to assign new satellite and start next acquisition (if required)
acquisition_manager(who);
//push back the old signal AFTER assigning a new one to avoid selecting the same signal
if (sat == 0)
{
push_back_signal(gs);
}
break;
case 1:
DLOG(INFO) << "Channel " << who << " ACQ SUCCESS satellite " << channels_[who]->get_signal().get_satellite();
DLOG(INFO) << "Channel " << who << " ACQ SUCCESS satellite " << gs.get_satellite();
// If the satellite is in the list of available ones, remove it.
remove_signal(channels_[who]->get_signal());
remove_signal(gs);
channels_state_[who] = 2;
if (acq_channels_count_ > 0)
@ -1316,13 +1333,13 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
break;
case 2:
DLOG(INFO) << "Channel " << who << " TRK FAILED satellite " << channels_[who]->get_signal().get_satellite();
DLOG(INFO) << "Channel " << who << " TRK FAILED satellite " << gs.get_satellite();
if (acq_channels_count_ < max_acq_channels_)
{
// try to acquire the same satellite
channels_state_[who] = 1;
acq_channels_count_++;
DLOG(INFO) << "Channel " << who << " Starting acquisition " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str();
DLOG(INFO) << "Channel " << who << " Starting acquisition " << gs.get_satellite() << ", Signal " << gs.get_signal_str();
#ifndef ENABLE_FPGA
channels_[who]->start_acquisition();
#else
@ -1917,7 +1934,6 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal
{
estimated_doppler = current_status.second->Carrier_Doppler_hz;
RX_time = current_status.second->RX_time;
// std::cout << " Channel: " << it->first << " => Doppler: " << estimated_doppler << "[Hz] \n";
// 3. return the GPS L2 satellite and remove it from list
result = *it2;
if (pop)

View File

@ -181,6 +181,7 @@ private:
void push_back_signal(const Gnss_Signal& gs);
void remove_signal(const Gnss_Signal& gs);
double project_doppler(std::string searched_signal, double primary_freq_doppler_hz);
bool connected_;
bool running_;
int sources_count_;