mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-10 12:13:07 +00:00
Major update:
1) Galileo E1 Acquisition adapter block added (Gnuradio block modification to use the same block with the 2 systems with 2 adapters) 2) Tests and signal samples for Galileo E1 Acquisition signal block 3) Library for Galileo E1 signal processing 4) Galileo_E1.h with constant variables for this system git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@209 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_tong_pcps_acquisition.cc
|
||||
* \brief Brief description of the file here
|
||||
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
* \file galileo_e1_pcps_ambiguous_acquisition.cc
|
||||
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
|
||||
* Galileo E1 Signals
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
@@ -30,85 +29,81 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gps_l1_ca_tong_pcps_acquisition.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "galileo_e1_pcps_ambiguous_acquisition.h"
|
||||
#include "galileo_e1_signal_processing.h"
|
||||
#include "Galileo_E1.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <gnuradio/gr_stream_to_vector.h>
|
||||
#include <gnuradio/gr_vector_to_stream.h>
|
||||
#include <gnuradio/gr_complex_to_interleaved_short.h>
|
||||
#include <gnuradio/gr_interleaved_short_to_complex.h>
|
||||
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
GpsL1CaTongPcpsAcquisition::GpsL1CaTongPcpsAcquisition(
|
||||
GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
gr_msg_queue_sptr queue) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
|
||||
queue)
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
|
||||
{
|
||||
|
||||
configuration_ = configuration;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./data/acquisition.dat";
|
||||
std::string default_dump_filename = "../data/acquisition.dat";
|
||||
|
||||
DLOG(INFO) << "role " << role;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type",
|
||||
default_item_type);
|
||||
|
||||
std::cout << "item type " << item_type_ << std::endl;
|
||||
|
||||
satellite_ = Gnss_Satellite();
|
||||
fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||
if_ = configuration->property(role + ".ifreq", 0);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
doppler_max_ = configuration->property(role + ".doppler_max", 10);
|
||||
sampled_ms_ = configuration->property(role + ".sampled_ms", 1);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000);
|
||||
if_ = configuration_->property(role + ".ifreq", 0);
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
shift_resolution_ = configuration_->property(role + ".doppler_max", 15);
|
||||
sampled_ms_ = configuration_->property(role + ".sampled_ms", 4);
|
||||
dump_filename_ = configuration_->property(role + ".dump_filename",
|
||||
default_dump_filename);
|
||||
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
//--- Find number of samples per spreading code (4 ms) ----------------------------
|
||||
|
||||
vector_length_ = round(fs_in_ / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS));
|
||||
int samples_per_ms = vector_length_/4;
|
||||
|
||||
code_= new gr_complex[vector_length_];
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
acquisition_cc_ = gps_l1_ca_tong_pcps_make_acquisition_cc(
|
||||
sampled_ms_, doppler_max_, if_, fs_in_, vector_length_,
|
||||
queue_, dump_, dump_filename_);
|
||||
acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_,
|
||||
shift_resolution_, if_, fs_in_, samples_per_ms, queue_,
|
||||
dump_, dump_filename_);
|
||||
stream_to_vector_ = gr_make_stream_to_vector(item_size_,
|
||||
vector_length_);
|
||||
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id()
|
||||
<< ")";
|
||||
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id()
|
||||
<< ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING) << item_type_
|
||||
<< " unknown acquisition item type";
|
||||
}
|
||||
|
||||
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id()
|
||||
<< ")";
|
||||
}
|
||||
|
||||
GpsL1CaTongPcpsAcquisition::~GpsL1CaTongPcpsAcquisition()
|
||||
GalileoE1PcpsAmbiguousAcquisition::~GalileoE1PcpsAmbiguousAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
|
||||
void GpsL1CaTongPcpsAcquisition::set_satellite(Gnss_Satellite satellite)
|
||||
{
|
||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_satellite(satellite_);
|
||||
}
|
||||
}
|
||||
|
||||
void GpsL1CaTongPcpsAcquisition::set_channel(unsigned int channel)
|
||||
void GalileoE1PcpsAmbiguousAcquisition::set_channel(unsigned int channel)
|
||||
{
|
||||
channel_ = channel;
|
||||
|
||||
@@ -118,7 +113,17 @@ void GpsL1CaTongPcpsAcquisition::set_channel(unsigned int channel)
|
||||
}
|
||||
}
|
||||
|
||||
void GpsL1CaTongPcpsAcquisition::set_doppler_max(unsigned int doppler_max)
|
||||
void GalileoE1PcpsAmbiguousAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
threshold_ = threshold;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_threshold(threshold_);
|
||||
}
|
||||
}
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisition::set_doppler_max(unsigned int doppler_max)
|
||||
{
|
||||
doppler_max_ = doppler_max;
|
||||
|
||||
@@ -129,7 +134,7 @@ void GpsL1CaTongPcpsAcquisition::set_doppler_max(unsigned int doppler_max)
|
||||
|
||||
}
|
||||
|
||||
void GpsL1CaTongPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
|
||||
void GalileoE1PcpsAmbiguousAcquisition::set_doppler_step(unsigned int doppler_step)
|
||||
{
|
||||
doppler_step_ = doppler_step;
|
||||
|
||||
@@ -140,7 +145,7 @@ void GpsL1CaTongPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
|
||||
|
||||
}
|
||||
|
||||
void GpsL1CaTongPcpsAcquisition::set_channel_queue(
|
||||
void GalileoE1PcpsAmbiguousAcquisition::set_channel_queue(
|
||||
concurrent_queue<int> *channel_internal_queue)
|
||||
{
|
||||
channel_internal_queue_ = channel_internal_queue;
|
||||
@@ -151,44 +156,17 @@ void GpsL1CaTongPcpsAcquisition::set_channel_queue(
|
||||
}
|
||||
}
|
||||
|
||||
signed int GpsL1CaTongPcpsAcquisition::prn_code_phase()
|
||||
void GalileoE1PcpsAmbiguousAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
|
||||
{
|
||||
gnss_synchro_ = gnss_synchro;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
return acquisition_cc_->prn_code_phase();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long int GpsL1CaTongPcpsAcquisition::get_sample_stamp()
|
||||
{
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
return acquisition_cc_->get_sample_stamp();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
float GpsL1CaTongPcpsAcquisition::doppler_freq_shift()
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
return acquisition_cc_->doppler_freq();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
signed int GpsL1CaTongPcpsAcquisition::mag()
|
||||
signed int GalileoE1PcpsAmbiguousAcquisition::mag()
|
||||
{
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
@@ -200,17 +178,27 @@ signed int GpsL1CaTongPcpsAcquisition::mag()
|
||||
}
|
||||
}
|
||||
|
||||
void GpsL1CaTongPcpsAcquisition::reset()
|
||||
void GalileoE1PcpsAmbiguousAcquisition::init(){
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
bool cboc = configuration_->property("Acquisition"
|
||||
+ boost::lexical_cast<std::string>(channel_) + ".cboc", false);;
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(code_, gnss_synchro_->Signal, cboc, gnss_synchro_->PRN, fs_in_, 0);
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
acquisition_cc_->init();
|
||||
}
|
||||
}
|
||||
void GalileoE1PcpsAmbiguousAcquisition::reset()
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_active(true);
|
||||
acquisition_cc_->set_dwells(0);
|
||||
acquisition_cc_->set_doppler(0);
|
||||
}
|
||||
}
|
||||
|
||||
void GpsL1CaTongPcpsAcquisition::connect(gr_top_block_sptr top_block)
|
||||
void GalileoE1PcpsAmbiguousAcquisition::connect(gr_top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
@@ -220,7 +208,7 @@ void GpsL1CaTongPcpsAcquisition::connect(gr_top_block_sptr top_block)
|
||||
|
||||
}
|
||||
|
||||
void GpsL1CaTongPcpsAcquisition::disconnect(gr_top_block_sptr top_block)
|
||||
void GalileoE1PcpsAmbiguousAcquisition::disconnect(gr_top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
@@ -229,12 +217,12 @@ void GpsL1CaTongPcpsAcquisition::disconnect(gr_top_block_sptr top_block)
|
||||
}
|
||||
}
|
||||
|
||||
gr_basic_block_sptr GpsL1CaTongPcpsAcquisition::get_left_block()
|
||||
gr_basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_left_block()
|
||||
{
|
||||
return stream_to_vector_;
|
||||
}
|
||||
|
||||
gr_basic_block_sptr GpsL1CaTongPcpsAcquisition::get_right_block()
|
||||
gr_basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_right_block()
|
||||
{
|
||||
return acquisition_cc_;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_tong_pcps_acquisition.h
|
||||
* \brief Brief description of the file here
|
||||
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
* \file galileo_e1_pcps_ambiguous_acquisition.h
|
||||
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for Galileo E1 Signals
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
@@ -30,25 +30,26 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_L1_CA_TONG_PCPS_ACQUISITION_H_
|
||||
#define GNSS_SDR_L1_CA_TONG_PCPS_ACQUISITION_H_
|
||||
#ifndef GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_
|
||||
#define GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_
|
||||
|
||||
#include "gnss_synchro.h"
|
||||
#include "acquisition_interface.h"
|
||||
#include "gps_l1_ca_tong_pcps_acquisition_cc.h"
|
||||
#include "pcps_acquisition_cc.h"
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
class GpsL1CaTongPcpsAcquisition: public AcquisitionInterface
|
||||
class GalileoE1PcpsAmbiguousAcquisition: public AcquisitionInterface
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
GpsL1CaTongPcpsAcquisition(ConfigurationInterface* configuration,
|
||||
GalileoE1PcpsAmbiguousAcquisition(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams,
|
||||
unsigned int out_streams, gr_msg_queue_sptr queue);
|
||||
|
||||
virtual ~GpsL1CaTongPcpsAcquisition();
|
||||
virtual ~GalileoE1PcpsAmbiguousAcquisition();
|
||||
|
||||
std::string role()
|
||||
{
|
||||
@@ -56,7 +57,7 @@ public:
|
||||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "Acquisition";
|
||||
return "Galileo_E1_PCPS_Ambiguous_Acquisition";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
@@ -68,30 +69,29 @@ public:
|
||||
gr_basic_block_sptr get_left_block();
|
||||
gr_basic_block_sptr get_right_block();
|
||||
|
||||
void set_satellite(Gnss_Satellite satellite);
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
|
||||
void set_channel(unsigned int channel);
|
||||
void set_threshold(float threshold){};
|
||||
void set_threshold(float threshold);
|
||||
void set_doppler_max(unsigned int doppler_max);
|
||||
void set_doppler_step(unsigned int doppler_step);
|
||||
void set_channel_queue(concurrent_queue<int> *channel_internal_queue);
|
||||
signed int prn_code_phase();
|
||||
float doppler_freq_shift();
|
||||
|
||||
unsigned long int get_sample_stamp();
|
||||
|
||||
void init();
|
||||
signed int mag();
|
||||
void reset();
|
||||
|
||||
private:
|
||||
|
||||
gps_l1_ca_tong_pcps_acquisition_cc_sptr acquisition_cc_;
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_acquisition_cc_sptr acquisition_cc_;
|
||||
gr_block_sptr stream_to_vector_;
|
||||
gr_block_sptr complex_to_short_;
|
||||
gr_block_sptr short_to_complex_;
|
||||
size_t item_size_;
|
||||
std::string item_type_;
|
||||
unsigned int vector_length_;
|
||||
Gnss_Satellite satellite_;
|
||||
|
||||
//unsigned int satellite_;
|
||||
unsigned int channel_;
|
||||
float threshold_;
|
||||
unsigned int doppler_max_;
|
||||
@@ -102,6 +102,9 @@ private:
|
||||
long if_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float> * code_;
|
||||
Gnss_Synchro * gnss_synchro_;
|
||||
|
||||
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
@@ -111,4 +114,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_L1_CA_TONG_PCPS_ACQUISITION_H_ */
|
||||
#endif /* GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_H_ */
|
||||
@@ -1,241 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_gps_sdr_acquisition.cc
|
||||
* \brief Implementation of an adapter of an acquisition module based
|
||||
* on the method in Gregory Heckler's GPS-SDR (see http://github.com/gps-sdr/gps-sdr)
|
||||
* to an AcquisitionInterface
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gps_l1_ca_gps_sdr_acquisition.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <gnuradio/gr_stream_to_vector.h>
|
||||
#include <gnuradio/gr_vector_to_stream.h>
|
||||
#include <gnuradio/gr_complex_to_interleaved_short.h>
|
||||
#include <gnuradio/gr_interleaved_short_to_complex.h>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
// Constructor
|
||||
GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
gr_msg_queue_sptr queue) :
|
||||
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(
|
||||
queue)
|
||||
{
|
||||
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./data/acquisition_";
|
||||
|
||||
DLOG(INFO) << "role " << role;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type",
|
||||
default_item_type);
|
||||
//vector_length_ = configuration->property(role + ".vector_length", 2048);
|
||||
|
||||
gnss_satellite_ = Gnss_Satellite();
|
||||
fs_in_ = configuration->property("GNSS-SDR.internal_fs_hz", 2048000);
|
||||
if_ = configuration->property(role + ".ifreq", 0);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
doppler_max_ = 0;
|
||||
acquisition_ms_ = configuration->property(role + ".sampled_ms", 1);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||
default_dump_filename);
|
||||
|
||||
//vector_length_=ceil((float)fs_in_*((float)acquisition_ms_/1000));
|
||||
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
printf("vector_length_ %i\n\r", vector_length_);
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
acquisition_cc_ = gps_l1_ca_gps_sdr_make_acquisition_cc(
|
||||
acquisition_ms_, if_, fs_in_, vector_length_, queue_, dump_,
|
||||
dump_filename_);
|
||||
stream_to_vector_ = gr_make_stream_to_vector(item_size_,
|
||||
vector_length_);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING) << item_type_ << " unknown item type.";
|
||||
}
|
||||
|
||||
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id()
|
||||
<< ")";
|
||||
|
||||
}
|
||||
|
||||
// Destructor
|
||||
GpsL1CaGpsSdrAcquisition::~GpsL1CaGpsSdrAcquisition()
|
||||
{}
|
||||
|
||||
// Set satellite
|
||||
void GpsL1CaGpsSdrAcquisition::set_satellite(Gnss_Satellite satellite)
|
||||
{
|
||||
gnss_satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_satellite(gnss_satellite_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set channel
|
||||
void GpsL1CaGpsSdrAcquisition::set_channel(unsigned int channel)
|
||||
{
|
||||
channel_ = channel;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_channel(channel_);
|
||||
}
|
||||
}
|
||||
|
||||
// Set acquisition threshold
|
||||
void GpsL1CaGpsSdrAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
threshold_ = threshold;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_threshold(threshold_);
|
||||
}
|
||||
}
|
||||
|
||||
// Set maximum Doppler shift
|
||||
void GpsL1CaGpsSdrAcquisition::set_doppler_max(unsigned int doppler_max)
|
||||
{
|
||||
doppler_max_ = doppler_max;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_doppler_max(doppler_max_);
|
||||
}
|
||||
}
|
||||
|
||||
// Set Channel Queue
|
||||
void GpsL1CaGpsSdrAcquisition::set_channel_queue(
|
||||
concurrent_queue<int> *channel_internal_queue)
|
||||
{
|
||||
channel_internal_queue_ = channel_internal_queue;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_channel_queue(channel_internal_queue_);
|
||||
}
|
||||
}
|
||||
|
||||
signed int GpsL1CaGpsSdrAcquisition::prn_code_phase()
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
return acquisition_cc_->prn_code_phase();
|
||||
}
|
||||
}
|
||||
|
||||
float GpsL1CaGpsSdrAcquisition::doppler_freq_shift()
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
return acquisition_cc_->doppler_freq_phase();
|
||||
}
|
||||
}
|
||||
|
||||
signed int GpsL1CaGpsSdrAcquisition::mag()
|
||||
{
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
return acquisition_cc_->mag();
|
||||
}
|
||||
}
|
||||
|
||||
void GpsL1CaGpsSdrAcquisition::reset()
|
||||
{
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_active(true);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long int GpsL1CaGpsSdrAcquisition::get_sample_stamp()
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
return acquisition_cc_->get_sample_stamp();
|
||||
}
|
||||
}
|
||||
|
||||
void GpsL1CaGpsSdrAcquisition::connect(gr_top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
//top_block->connect(stream_to_vector_, 0, vector_to_stream_,0);
|
||||
|
||||
top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
|
||||
//top_block->connect(acquisition_cc_, 0, vector_to_stream_, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GpsL1CaGpsSdrAcquisition::disconnect(gr_top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
|
||||
//top_block->disconnect(acquisition_cc_, 0, vector_to_stream_, 0);
|
||||
}
|
||||
}
|
||||
|
||||
gr_basic_block_sptr GpsL1CaGpsSdrAcquisition::get_left_block()
|
||||
{
|
||||
return stream_to_vector_;
|
||||
}
|
||||
|
||||
gr_basic_block_sptr GpsL1CaGpsSdrAcquisition::get_right_block()
|
||||
{
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
return acquisition_cc_;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_gps_sdr_acquisition.h
|
||||
* \brief Interface of an adapter of an acquisition module based
|
||||
* on the method in Gregory Heckler's GPS-SDR (see http://github.com/gps-sdr/gps-sdr)
|
||||
* to an AcquisitionInterface
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_GPS_L1_CA_GPS_SDR_ACQUISITION_H_
|
||||
#define GNSS_SDR_GPS_L1_CA_GPS_SDR_ACQUISITION_H_
|
||||
|
||||
#include "acquisition_interface.h"
|
||||
#include "gps_l1_ca_gps_sdr_acquisition_cc.h"
|
||||
//#include "gps_l1_ca_gps_sdr_acquisition_ss.h"
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
/*!
|
||||
* \brief Adapts the GPS-SDR acquisition implementation to
|
||||
* an Acquisition Interface
|
||||
*
|
||||
* Derived from AcquisitionInterface, this class wraps the implementation
|
||||
* of the acquisition algorithm proposed by Gregory Heckler at https://github.com/gps-sdr/gps-sdr
|
||||
*
|
||||
*/
|
||||
class GpsL1CaGpsSdrAcquisition: public AcquisitionInterface
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
GpsL1CaGpsSdrAcquisition(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams,
|
||||
unsigned int out_streams, gr_msg_queue_sptr queue);
|
||||
|
||||
virtual ~GpsL1CaGpsSdrAcquisition();
|
||||
|
||||
std::string role()
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "Acquisition";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
return item_size_;
|
||||
}
|
||||
|
||||
void connect(gr_top_block_sptr top_block);
|
||||
void disconnect(gr_top_block_sptr top_block);
|
||||
gr_basic_block_sptr get_left_block();
|
||||
gr_basic_block_sptr get_right_block();
|
||||
|
||||
void set_satellite(Gnss_Satellite gnss_satellite);
|
||||
void set_channel(unsigned int channel);
|
||||
void set_threshold(float threshold);
|
||||
void set_doppler_max(unsigned int doppler_max);
|
||||
void set_channel_queue(concurrent_queue<int> *channel_internal_queue);
|
||||
signed int prn_code_phase();
|
||||
float doppler_freq_shift();
|
||||
signed int mag();
|
||||
void reset();
|
||||
unsigned long int get_sample_stamp();
|
||||
|
||||
//Not used in this implementation
|
||||
void set_doppler_step(unsigned int doppler_step)
|
||||
{};
|
||||
|
||||
private:
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_cc_sptr acquisition_cc_;
|
||||
//gps_l1_ca_gps_sdr_acquisition_ss_sptr acquisition_ss_;
|
||||
gr_block_sptr stream_to_vector_;
|
||||
gr_block_sptr complex_to_short_;
|
||||
gr_block_sptr short_to_complex_;
|
||||
size_t item_size_;
|
||||
std::string item_type_;
|
||||
unsigned int vector_length_;
|
||||
Gnss_Satellite gnss_satellite_;
|
||||
unsigned int channel_;
|
||||
float threshold_;
|
||||
unsigned int doppler_max_;
|
||||
unsigned int acquisition_ms_;
|
||||
long fs_in_;
|
||||
long if_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
gr_msg_queue_sptr queue_;
|
||||
concurrent_queue<int> *channel_internal_queue_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,9 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_pcps_acquisition.cc
|
||||
* \brief Adapts a PCPS acquisition block for GPS L1 C/A to an AcquisitionInterface
|
||||
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
|
||||
* GPS L1 C/A Signals
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
* Luis Esteve, 2011-2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
@@ -30,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "gps_l1_ca_pcps_acquisition.h"
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <iostream>
|
||||
@@ -70,10 +72,12 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
code_= new gr_complex[vector_length_];
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
acquisition_cc_ = gps_l1_ca_pcps_make_acquisition_cc(sampled_ms_,
|
||||
acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_,
|
||||
shift_resolution_, if_, fs_in_, vector_length_, queue_,
|
||||
dump_, dump_filename_);
|
||||
stream_to_vector_ = gr_make_stream_to_vector(item_size_,
|
||||
@@ -94,6 +98,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
|
||||
GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,9 +157,10 @@ void GpsL1CaPcpsAcquisition::set_channel_queue(
|
||||
|
||||
void GpsL1CaPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
|
||||
{
|
||||
gnss_synchro_ = gnss_synchro;
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
acquisition_cc_->set_gnss_synchro(gnss_synchro);
|
||||
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +179,8 @@ signed int GpsL1CaPcpsAcquisition::mag()
|
||||
void GpsL1CaPcpsAcquisition::init(){
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0);
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
acquisition_cc_->init();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_pcps_acquisition.h
|
||||
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for GPS L1 C/A
|
||||
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
|
||||
* GPS L1 C/A signals
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
* Luis Esteve, 2011-2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
@@ -36,7 +37,7 @@
|
||||
|
||||
#include "gnss_synchro.h"
|
||||
#include "acquisition_interface.h"
|
||||
#include "gps_l1_ca_pcps_acquisition_cc.h"
|
||||
#include "pcps_acquisition_cc.h"
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -83,7 +84,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
gps_l1_ca_pcps_acquisition_cc_sptr acquisition_cc_;
|
||||
pcps_acquisition_cc_sptr acquisition_cc_;
|
||||
gr_block_sptr stream_to_vector_;
|
||||
gr_block_sptr complex_to_short_;
|
||||
gr_block_sptr short_to_complex_;
|
||||
@@ -102,6 +103,9 @@ private:
|
||||
long if_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float> * code_;
|
||||
Gnss_Synchro * gnss_synchro_;
|
||||
|
||||
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
project : build-dir ../../../../build ;
|
||||
|
||||
#obj gps_l1_ca_gps_sdr_acquisition : gps_l1_ca_gps_sdr_acquisition.cc ;
|
||||
obj gps_l1_ca_pcps_acquisition : gps_l1_ca_pcps_acquisition.cc ;
|
||||
#obj gps_l1_ca_tong_pcps_acquisition : gps_l1_ca_tong_pcps_acquisition.cc ;
|
||||
obj galileo_e1_pcps_ambiguous_acquisition : galileo_e1_pcps_ambiguous_acquisition.cc ;
|
||||
|
||||
@@ -1,327 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_gps_sdr_acquisition_cc.cc
|
||||
* \brief Brief description of the file here
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "gps_l1_ca_gps_sdr_acquisition_cc.h"
|
||||
#include "control_message_factory.h"
|
||||
#include "gps_sdr_x86.h"
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <sstream>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
#include <iostream>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_cc_sptr gps_l1_ca_gps_sdr_make_acquisition_cc(
|
||||
unsigned int sampled_ms, long freq, long fs_in, int samples_per_ms,
|
||||
gr_msg_queue_sptr queue, bool dump, std::string dump_filename)
|
||||
{
|
||||
|
||||
return gps_l1_ca_gps_sdr_acquisition_cc_sptr(
|
||||
new gps_l1_ca_gps_sdr_acquisition_cc(sampled_ms, freq, fs_in,
|
||||
samples_per_ms, queue, dump, dump_filename));
|
||||
}
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_cc::gps_l1_ca_gps_sdr_acquisition_cc(
|
||||
unsigned int sampled_ms, long freq, long fs_in, int samples_per_ms,
|
||||
gr_msg_queue_sptr queue, bool dump, std::string dump_filename) :
|
||||
gr_block("gps_l1_ca_gps_sdr_acquisition_cc", gr_make_io_signature(1, 1,
|
||||
sizeof(gr_complex) * samples_per_ms), gr_make_io_signature(0, 0,
|
||||
sizeof(gr_complex) * samples_per_ms))
|
||||
{
|
||||
|
||||
// SAMPLE COUNTER
|
||||
d_sample_counter = 0;
|
||||
|
||||
d_active = false;
|
||||
d_dump = dump;
|
||||
d_queue = queue;
|
||||
d_dump_filename = dump_filename;
|
||||
|
||||
d_freq = freq;
|
||||
d_fs_in = fs_in;
|
||||
|
||||
d_samples_per_ms = samples_per_ms;
|
||||
d_sampled_ms = sampled_ms;
|
||||
|
||||
d_doppler_max = 0;
|
||||
|
||||
d_satellite = Gnss_Satellite();
|
||||
|
||||
d_fft_size = d_sampled_ms * d_samples_per_ms;
|
||||
|
||||
d_doppler_freq_phase = 0.0;
|
||||
d_prn_code_phase = 0;
|
||||
d_mag = 0;
|
||||
d_mean = 0.0;
|
||||
|
||||
d_count = 0;
|
||||
|
||||
d_sine_if = new gr_complex[d_fft_size];
|
||||
d_sine_250 = new gr_complex[d_fft_size];
|
||||
d_sine_500 = new gr_complex[d_fft_size];
|
||||
d_sine_750 = new gr_complex[d_fft_size];
|
||||
|
||||
d_fft_codes = (gr_complex*)malloc(sizeof(gr_complex) * d_samples_per_ms);
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gri_fft_complex(d_fft_size, true);
|
||||
d_fft_250 = new gri_fft_complex(d_fft_size, true);
|
||||
d_fft_500 = new gri_fft_complex(d_fft_size, true);
|
||||
d_fft_750 = new gri_fft_complex(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gri_fft_complex(d_fft_size, false);
|
||||
|
||||
d_best_magnitudes = new float[d_fft_size];
|
||||
|
||||
sine_gen_complex(d_sine_if, -d_freq, d_fs_in, d_fft_size);
|
||||
sine_gen_complex(d_sine_250, -d_freq - 250, d_fs_in, d_fft_size);
|
||||
sine_gen_complex(d_sine_500, -d_freq - 500, d_fs_in, d_fft_size);
|
||||
sine_gen_complex(d_sine_750, -d_freq - 750, d_fs_in, d_fft_size);
|
||||
|
||||
DLOG(INFO) << "fs in " << d_fs_in;
|
||||
DLOG(INFO) << "Doppler max " << d_doppler_max;
|
||||
DLOG(INFO) << "IF " << d_freq;
|
||||
DLOG(INFO) << "Satellite " << d_satellite;
|
||||
DLOG(INFO) << "Sampled_ms " << d_sampled_ms;
|
||||
DLOG(INFO) << "FFT_size " << d_fft_size;
|
||||
DLOG(INFO) << "dump filename " << d_dump_filename;
|
||||
DLOG(INFO) << "dump " << d_dump;
|
||||
}
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_cc::~gps_l1_ca_gps_sdr_acquisition_cc()
|
||||
{
|
||||
delete[] d_sine_if;
|
||||
delete[] d_sine_250;
|
||||
delete[] d_sine_500;
|
||||
delete[] d_sine_750;
|
||||
delete[] d_fft_codes;
|
||||
delete[] d_fft_if;
|
||||
delete[] d_fft_250;
|
||||
delete[] d_fft_500;
|
||||
delete[] d_fft_750;
|
||||
|
||||
if (d_dump)
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void gps_l1_ca_gps_sdr_acquisition_cc::set_satellite(Gnss_Satellite satellite)
|
||||
{
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
d_prn_code_phase = 0;
|
||||
d_doppler_freq_phase = 0;
|
||||
d_mag = 0;
|
||||
// Now the GPS codes are generated on the fly using a custom version of the GPS code generator
|
||||
code_gen_complex_sampled(d_fft_if->get_inbuf(), satellite.get_PRN(), d_fs_in, 0);
|
||||
d_fft_if->execute(); // We need the FFT of GPS C/A code
|
||||
memcpy(d_fft_codes, d_fft_if->get_outbuf(), sizeof(gr_complex)
|
||||
* d_samples_per_ms);
|
||||
}
|
||||
|
||||
signed int gps_l1_ca_gps_sdr_acquisition_cc::prn_code_phase()
|
||||
{
|
||||
return d_prn_code_phase;
|
||||
}
|
||||
|
||||
int gps_l1_ca_gps_sdr_acquisition_cc::general_work(int noutput_items,
|
||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
if (!d_active)
|
||||
{
|
||||
d_sample_counter += d_fft_size * noutput_items; // sample counter
|
||||
consume_each(noutput_items);
|
||||
return 0;
|
||||
}
|
||||
|
||||
d_sample_counter += d_fft_size; // sample counter
|
||||
bool positive_acquisition = false;
|
||||
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Channel: " << d_channel
|
||||
<< " , doing acquisition of satellite: " << d_satellite
|
||||
<< " ,at sample stamp: " << d_sample_counter;
|
||||
|
||||
const gr_complex *in = (const gr_complex *)input_items[0];
|
||||
|
||||
//Perform the carrier wipe-off
|
||||
for (unsigned int j = 0; j < d_fft_size; j++)
|
||||
{
|
||||
d_fft_if->get_inbuf()[j] = in[j] * d_sine_if[j];
|
||||
d_fft_250->get_inbuf()[j] = in[j] * d_sine_250[j];
|
||||
d_fft_500->get_inbuf()[j] = in[j] * d_sine_500[j];
|
||||
d_fft_750->get_inbuf()[j] = in[j] * d_sine_750[j];
|
||||
}
|
||||
// Perform the FFT of the resulting signal
|
||||
d_fft_if->execute();
|
||||
d_fft_250->execute();
|
||||
d_fft_500->execute();
|
||||
d_fft_750->execute();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
//---Calculate cross-correlation magnitudes using:
|
||||
//----> the circular convolution property of FFT:
|
||||
//----> the frequency-shift property of the FFT: y(t)=exp(jw0t)x(t) -> Y(w)=X(w-w0)
|
||||
for (int j = (int)-(d_doppler_max / 1000); j < (int)d_doppler_max / 1000; j++)
|
||||
{ // doppler search steps
|
||||
calculate_magnitudes(d_fft_if->get_outbuf(), j, 0);
|
||||
calculate_magnitudes(d_fft_250->get_outbuf(), j, 1);
|
||||
calculate_magnitudes(d_fft_500->get_outbuf(), j, 2);
|
||||
calculate_magnitudes(d_fft_750->get_outbuf(), j, 3);
|
||||
}
|
||||
|
||||
if (d_dump)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "./data/acquisition_" << d_channel << "_" << d_satellite << "_"
|
||||
<< d_count << ".dat";
|
||||
d_dump_file.open(ss.str().c_str(), std::ios::out | std::ios::binary);
|
||||
std::streamsize n = sizeof(float) * (d_fft_size);
|
||||
d_dump_file.write((char*)d_best_magnitudes, n);
|
||||
d_dump_file.close();
|
||||
}
|
||||
|
||||
if (d_test_statistics > d_threshold)
|
||||
{ //TODO: Include in configuration parameters and check value!!
|
||||
|
||||
positive_acquisition = true;
|
||||
d_acq_sample_stamp = d_sample_counter;
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "POSITIVE ACQUISITION of channel " << d_channel;
|
||||
LOG_AT_LEVEL(INFO) << "Satellite " << d_satellite;
|
||||
LOG_AT_LEVEL(INFO) << "Code Phase " << d_prn_code_phase;
|
||||
LOG_AT_LEVEL(INFO) << "Doppler " << d_doppler_freq_phase;
|
||||
LOG_AT_LEVEL(INFO) << "Magnitude " << d_mag;
|
||||
LOG_AT_LEVEL(INFO) << "Mean " << d_mean;
|
||||
LOG_AT_LEVEL(INFO) << "Test statistics value " << d_test_statistics;
|
||||
LOG_AT_LEVEL(INFO) << "Test statistics threshold " << d_threshold;
|
||||
LOG_AT_LEVEL(INFO) << "Acq sample stamp " << d_acq_sample_stamp;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_AT_LEVEL(INFO) << "NEGATIVE ACQUISITION of channel " << d_channel;
|
||||
LOG_AT_LEVEL(INFO) << "Satellite " << d_satellite;
|
||||
LOG_AT_LEVEL(INFO) << "Test statistics value " << d_test_statistics;
|
||||
LOG_AT_LEVEL(INFO) << "Test statistics threshold " << d_threshold;
|
||||
LOG_AT_LEVEL(INFO) << "Acq sample stamp " << d_acq_sample_stamp;
|
||||
}
|
||||
d_active = false;
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "d_count " << d_count;
|
||||
|
||||
if (positive_acquisition)
|
||||
{
|
||||
acquisition_message = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
acquisition_message = 2;
|
||||
}
|
||||
|
||||
d_channel_internal_queue->push(acquisition_message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gps_l1_ca_gps_sdr_acquisition_cc::calculate_magnitudes(
|
||||
gr_complex* fft_signal, int doppler_shift, int doppler_offset)
|
||||
{
|
||||
|
||||
unsigned int indext = 0;
|
||||
float magt = 0.0;
|
||||
std::complex<float> tmp_cpx;
|
||||
|
||||
// FFT frequency-shift property
|
||||
if (doppler_shift != 0)
|
||||
{
|
||||
for (unsigned int i = 0; i < d_fft_size; i++)
|
||||
{
|
||||
//complex conjugate (optimize me!)
|
||||
tmp_cpx = std::complex<float>(d_fft_codes[i].real(),
|
||||
-d_fft_codes[i].imag());
|
||||
d_ifft->get_inbuf()[i] = fft_signal[(doppler_shift + i
|
||||
+ d_fft_size) % d_fft_size] * tmp_cpx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i < d_fft_size; i++)
|
||||
{
|
||||
//complex conjugate (optimize me!)
|
||||
tmp_cpx = std::complex<float>(d_fft_codes[i].real(),
|
||||
-d_fft_codes[i].imag());
|
||||
d_ifft->get_inbuf()[i] = fft_signal[i] * tmp_cpx;
|
||||
}
|
||||
}
|
||||
|
||||
d_ifft->execute(); // inverse FFT of the result = convolution in time
|
||||
|
||||
x86_gr_complex_mag(d_ifft->get_outbuf(), d_fft_size); // d_ifft->get_outbuf()=|abs(·)|^2
|
||||
x86_float_max((float*)d_ifft->get_outbuf(), &indext, &magt, d_fft_size); // find max of |abs(<28>)|^2 -> index and magt
|
||||
|
||||
if (magt > d_mag)
|
||||
{ // if the magnitude is > threshold
|
||||
|
||||
// save the synchronization parameters
|
||||
d_mag = magt;
|
||||
d_prn_code_phase = indext;
|
||||
d_doppler_freq_phase = -((doppler_shift * 1000.0) + (doppler_offset
|
||||
* 250.0));
|
||||
// save the circular correlation of this Doppler shift
|
||||
memcpy(d_best_magnitudes, d_ifft->get_outbuf(), sizeof(float)
|
||||
* d_fft_size);
|
||||
|
||||
// Remove the maximum and its neighbors to calculate the mean
|
||||
((float*)d_ifft->get_outbuf())[indext] = 0.0;
|
||||
if (indext != 0)
|
||||
{
|
||||
((float*)d_ifft->get_outbuf())[indext - 1] = 0.0;
|
||||
}
|
||||
if (indext != d_fft_size - 1)
|
||||
{
|
||||
((float*)d_ifft->get_outbuf())[indext + 1] = 0.0;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < d_fft_size; i++)
|
||||
{
|
||||
d_mean += ((float*)d_ifft->get_outbuf())[i];
|
||||
}
|
||||
d_mean = d_mean / d_fft_size;
|
||||
d_test_statistics = d_mag / d_mean;
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_gps_sdr_acquisition_cc.h
|
||||
* \brief Brief description of the file here
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_GPS_L1_CA_GPS_SDR_ACQUISITION_CC_H
|
||||
#define GNSS_SDR_GPS_L1_CA_GPS_SDR_ACQUISITION_CC_H
|
||||
|
||||
#include <fstream>
|
||||
#include <gnuradio/gr_block.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <gnuradio/gri_fft.h>
|
||||
#include <queue>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_satellite.h"
|
||||
|
||||
class gps_l1_ca_gps_sdr_acquisition_cc;
|
||||
typedef boost::shared_ptr<gps_l1_ca_gps_sdr_acquisition_cc>
|
||||
gps_l1_ca_gps_sdr_acquisition_cc_sptr;
|
||||
gps_l1_ca_gps_sdr_acquisition_cc_sptr
|
||||
gps_l1_ca_gps_sdr_make_acquisition_cc(unsigned int sampled_ms, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
class gps_l1_ca_gps_sdr_acquisition_cc: public gr_block
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
friend gps_l1_ca_gps_sdr_acquisition_cc_sptr
|
||||
gps_l1_ca_gps_sdr_make_acquisition_cc(unsigned int sampled_ms, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_cc(unsigned int sampled_ms, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
||||
int doppler_offset);
|
||||
|
||||
long d_fs_in;
|
||||
long d_freq;
|
||||
int d_samples_per_ms;
|
||||
Gnss_Satellite d_satellite;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
unsigned int d_doppler_max;
|
||||
unsigned int d_sampled_ms;
|
||||
unsigned int d_fft_size;
|
||||
unsigned long int d_sample_counter;
|
||||
unsigned long int d_acq_sample_stamp;
|
||||
|
||||
gr_complex* d_baseband_signal;
|
||||
gr_complex* d_sine_if;
|
||||
gr_complex* d_sine_250;
|
||||
gr_complex* d_sine_500;
|
||||
gr_complex* d_sine_750;
|
||||
gr_complex* d_fft_codes;
|
||||
|
||||
gri_fft_complex* d_fft_if;
|
||||
gri_fft_complex* d_fft_250;
|
||||
gri_fft_complex* d_fft_500;
|
||||
gri_fft_complex* d_fft_750;
|
||||
gri_fft_complex* d_ifft;
|
||||
|
||||
float* d_best_magnitudes;
|
||||
|
||||
unsigned int d_prn_code_phase;
|
||||
float d_doppler_freq_phase;
|
||||
float d_mag;
|
||||
float d_mean;
|
||||
float d_test_statistics;
|
||||
|
||||
gr_msg_queue_sptr d_queue;
|
||||
concurrent_queue<int> *d_channel_internal_queue;
|
||||
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
unsigned int d_count;
|
||||
|
||||
bool d_active;
|
||||
bool d_dump;
|
||||
unsigned int d_channel;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
|
||||
~gps_l1_ca_gps_sdr_acquisition_cc();
|
||||
|
||||
signed int prn_code_phase();
|
||||
float doppler_freq_phase()
|
||||
{
|
||||
return d_doppler_freq_phase;
|
||||
}
|
||||
unsigned int mag()
|
||||
{
|
||||
return d_mag;
|
||||
}
|
||||
|
||||
unsigned long int get_sample_stamp()
|
||||
{
|
||||
return d_acq_sample_stamp;
|
||||
}
|
||||
|
||||
void set_satellite(Gnss_Satellite satellite);
|
||||
void set_active(bool active)
|
||||
{
|
||||
d_active = active;
|
||||
}
|
||||
void set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
}
|
||||
void set_threshold(float threshold)
|
||||
{
|
||||
d_threshold = threshold;
|
||||
}
|
||||
void set_doppler_max(unsigned int doppler_max)
|
||||
{
|
||||
d_doppler_max = doppler_max;
|
||||
}
|
||||
|
||||
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||
{
|
||||
d_channel_internal_queue = channel_internal_queue;
|
||||
}
|
||||
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GPS_L1_CA_GPS_SDR_ACQUISITION_CC_H */
|
||||
@@ -1,284 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_gps_sdr_acquisition_ss.cc
|
||||
* \brief Brief description of the file here
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
#include "gps_l1_ca_gps_sdr_acquisition_ss.h"
|
||||
#include "gps_sdr_fft.h"
|
||||
#include "gps_sdr_prn_codes_short.h"
|
||||
#include "control_message_factory.h"
|
||||
#include "gps_sdr_x86.h"
|
||||
#ifndef NO_SIMD
|
||||
#include "gps_sdr_simd.h"
|
||||
#endif
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <sstream>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_ss_sptr gps_l1_ca_gps_sdr_make_acquisition_ss(
|
||||
unsigned int sampled_ms, long freq, long fs_in, int samples_per_ms,
|
||||
gr_msg_queue_sptr queue, bool dump, std::string dump_filename)
|
||||
{
|
||||
|
||||
return gps_l1_ca_gps_sdr_acquisition_ss_sptr(
|
||||
new gps_l1_ca_gps_sdr_acquisition_ss(sampled_ms, freq, fs_in,
|
||||
samples_per_ms, queue, dump, dump_filename));
|
||||
}
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_ss::gps_l1_ca_gps_sdr_acquisition_ss(
|
||||
unsigned int sampled_ms, long freq, long fs_in, int samples_per_ms,
|
||||
gr_msg_queue_sptr queue, bool dump, std::string dump_filename) :
|
||||
gr_block("gps_l1_ca_gps_sdr_acquisition_ss", gr_make_io_signature(1, 1,
|
||||
sizeof(short) * 2 * samples_per_ms), gr_make_io_signature(0, 0,
|
||||
sizeof(short) * 2 * samples_per_ms))
|
||||
{
|
||||
|
||||
// SAMPLE COUNTER
|
||||
d_sample_counter = 0;
|
||||
|
||||
d_active = false;
|
||||
d_dump = dump;
|
||||
d_queue = queue;
|
||||
d_dump_filename = dump_filename;
|
||||
|
||||
d_fs_in = fs_in;
|
||||
d_samples_per_ms = samples_per_ms;
|
||||
d_doppler_resolution = 4;
|
||||
d_freq = freq;
|
||||
d_satellite = Gnss_Satellite();
|
||||
d_doppler_max = 0;
|
||||
d_sampled_ms = sampled_ms;
|
||||
d_fft_size = d_sampled_ms * d_samples_per_ms;
|
||||
|
||||
d_doppler_freq_shift = 0.0;
|
||||
d_prn_code_phase = 0;
|
||||
d_mag = 0;
|
||||
|
||||
d_sine_if = new CPX[d_fft_size];
|
||||
d_sine_250 = new CPX[d_fft_size];
|
||||
d_sine_500 = new CPX[d_fft_size];
|
||||
d_sine_750 = new CPX[d_fft_size];
|
||||
|
||||
d_baseband_signal = new CPX[d_doppler_resolution * d_fft_size];
|
||||
d_baseband_signal_shift = new CPX[d_doppler_resolution * (d_fft_size
|
||||
+ 201)];
|
||||
|
||||
signed int R1[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
d_pFFT = new FFT(d_fft_size, R1);
|
||||
|
||||
signed int R2[16] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1 };
|
||||
d_piFFT = new FFT(d_fft_size, R2);
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
d_fft_codes[i] = (CPX *)&PRN_Codes_Short[sizeof(short) * i
|
||||
* d_samples_per_ms];
|
||||
}
|
||||
|
||||
sine_gen(d_sine_if, -d_freq, d_fs_in, d_fft_size);
|
||||
sine_gen(d_sine_250, -d_freq - 250, d_fs_in, d_fft_size);
|
||||
sine_gen(d_sine_500, -d_freq - 500, d_fs_in, d_fft_size);
|
||||
sine_gen(d_sine_750, -d_freq - 750, d_fs_in, d_fft_size);
|
||||
|
||||
DLOG(INFO) << "fs in " << d_fs_in;
|
||||
DLOG(INFO) << "samples per ms " << d_samples_per_ms;
|
||||
DLOG(INFO) << "doppler resolution " << d_doppler_resolution;
|
||||
DLOG(INFO) << "freq " << d_freq;
|
||||
DLOG(INFO) << "satellite " << d_satellite;
|
||||
DLOG(INFO) << "sampled_ms " << d_sampled_ms;
|
||||
DLOG(INFO) << "fft_size " << d_fft_size;
|
||||
DLOG(INFO) << "dump filename " << d_dump_filename;
|
||||
DLOG(INFO) << "dump " << d_dump;
|
||||
}
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_ss::~gps_l1_ca_gps_sdr_acquisition_ss()
|
||||
{
|
||||
delete[] d_baseband_signal;
|
||||
delete[] d_baseband_signal_shift;
|
||||
delete[] d_sine_if;
|
||||
delete[] d_sine_250;
|
||||
delete[] d_sine_500;
|
||||
delete[] d_sine_750;
|
||||
delete d_pFFT;
|
||||
delete d_piFFT;
|
||||
|
||||
if (d_dump)
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void gps_l1_ca_gps_sdr_acquisition_ss::set_satellite(Gnss_Satellite satellite)
|
||||
{
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
d_prn_code_phase = 0;
|
||||
d_doppler_freq_shift = 0;
|
||||
d_mag = 0;
|
||||
DLOG(INFO) << "satellite set to " << d_satellite;
|
||||
}
|
||||
|
||||
signed int gps_l1_ca_gps_sdr_acquisition_ss::prn_code_phase()
|
||||
{
|
||||
return d_prn_code_phase;
|
||||
}
|
||||
|
||||
int gps_l1_ca_gps_sdr_acquisition_ss::general_work(int noutput_items,
|
||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
|
||||
if (!d_active)
|
||||
{
|
||||
d_sample_counter += d_fft_size * noutput_items; // sample counter
|
||||
consume_each(noutput_items);
|
||||
}
|
||||
else
|
||||
{
|
||||
d_sample_counter += d_fft_size; // sample counter
|
||||
|
||||
const CPX *in = (const CPX *)input_items[0];
|
||||
|
||||
CPX* buffer = new CPX[d_fft_size];
|
||||
|
||||
signed int index = 0;
|
||||
unsigned int indext = 0;
|
||||
unsigned int magt = 0;
|
||||
|
||||
DLOG(INFO) << "copied " << (d_fft_size * sizeof(CPX))
|
||||
<< " bytes into buffer (" << d_fft_size << " samples)";
|
||||
memcpy(d_baseband_signal, in, d_fft_size * sizeof(CPX));
|
||||
#ifdef NO_SIMD
|
||||
x86_cmulsc(d_baseband_signal, d_sine_250,
|
||||
&d_baseband_signal[d_fft_size], d_fft_size, 14);
|
||||
x86_cmulsc(d_baseband_signal, d_sine_500, &d_baseband_signal[2
|
||||
* d_fft_size], d_fft_size, 14);
|
||||
x86_cmulsc(d_baseband_signal, d_sine_750, &d_baseband_signal[3
|
||||
* d_fft_size], d_fft_size, 14);
|
||||
x86_cmuls(d_baseband_signal, d_sine_if, d_fft_size, 14);
|
||||
#else
|
||||
sse_cmulsc(d_baseband_signal, d_sine_250,
|
||||
&d_baseband_signal[d_fft_size], d_fft_size, 14);
|
||||
sse_cmulsc(d_baseband_signal, d_sine_500, &d_baseband_signal[2
|
||||
* d_fft_size], d_fft_size, 14);
|
||||
sse_cmulsc(d_baseband_signal, d_sine_750, &d_baseband_signal[3
|
||||
* d_fft_size], d_fft_size, 14);
|
||||
sse_cmuls(d_baseband_signal, d_sine_if, d_fft_size, 14);
|
||||
#endif
|
||||
for (unsigned int i = 0; i < d_doppler_resolution; i++)
|
||||
{
|
||||
d_pFFT->doFFT(&d_baseband_signal[i * d_fft_size], true);
|
||||
memcpy(&d_baseband_signal_shift[i * (d_fft_size + 201)],
|
||||
&d_baseband_signal[(i + 1) * d_fft_size - 100], 100
|
||||
* sizeof(CPX));
|
||||
memcpy(&d_baseband_signal_shift[(i * (d_fft_size + 201)) + 100],
|
||||
&d_baseband_signal[i * d_fft_size], d_fft_size
|
||||
* sizeof(CPX));
|
||||
memcpy(&d_baseband_signal_shift[(i * (d_fft_size + 201)) + 100
|
||||
+ d_fft_size], &d_baseband_signal[i * d_fft_size], 100
|
||||
* sizeof(CPX));
|
||||
}
|
||||
|
||||
// Here begins the actual acquisition process.
|
||||
|
||||
for (int i = -d_doppler_max / 1000; i < (int)d_doppler_max / 1000; i++)
|
||||
{
|
||||
for (unsigned int j = 0; j < d_doppler_resolution; j++)
|
||||
{
|
||||
|
||||
#ifdef NO_SIMD
|
||||
x86_cmulsc(&d_baseband_signal_shift[(j * (d_fft_size + 201))
|
||||
+ 100 + i], d_fft_codes[d_satellite.get_PRN()], buffer,
|
||||
d_fft_size, 10);
|
||||
#else
|
||||
sse_cmulsc(&d_baseband_signal_shift[(j * (d_fft_size + 201))
|
||||
+ 100 + i], d_fft_codes[d_satellite.get_PRN()], buffer,
|
||||
d_fft_size, 10);
|
||||
#endif
|
||||
d_piFFT->doiFFT(buffer, true);
|
||||
x86_cmag(buffer, d_fft_size);
|
||||
x86_max((unsigned int *)buffer, &indext, &magt, d_fft_size);
|
||||
|
||||
if (magt > d_mag)
|
||||
{
|
||||
d_mag = magt;
|
||||
index = indext;
|
||||
d_prn_code_phase = ceil((index * d_samples_per_ms)
|
||||
/ d_fft_size);
|
||||
d_doppler_freq_shift = (i * 1000.0) + (j * 250.0);
|
||||
|
||||
if (d_dump)
|
||||
{
|
||||
d_dump_file.open(d_dump_filename.c_str(),
|
||||
std::ios::out | std::ios::binary);
|
||||
std::streamsize n = sizeof(unsigned int) * d_fft_size;
|
||||
d_dump_file.write((char*)buffer, n);
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DLOG(INFO) << "satellite " << d_satellite;
|
||||
//result->code_phase = 2048 - index;
|
||||
DLOG(INFO) << "code phase " << d_prn_code_phase;
|
||||
//result->doppler = (lcv*1000) + (float)lcv2*250;
|
||||
DLOG(INFO) << "doppler " << d_doppler_freq_shift;
|
||||
//result->magnitude = mag;
|
||||
DLOG(INFO) << "magnitude " << d_mag;
|
||||
|
||||
d_active = false;
|
||||
|
||||
delete buffer;
|
||||
|
||||
DLOG(INFO) << "Acquisition done";
|
||||
|
||||
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||
|
||||
if (d_mag > d_threshold)
|
||||
{
|
||||
d_acq_sample_stamp = d_sample_counter;
|
||||
acquisition_message = 1; //ACQ_SUCCES
|
||||
}
|
||||
else
|
||||
{
|
||||
acquisition_message = 2; //ACQ_FAIL
|
||||
|
||||
}
|
||||
|
||||
d_channel_internal_queue->push(acquisition_message);
|
||||
|
||||
consume_each(1);
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_gps_sdr_acquisition_ss.h
|
||||
* \brief Brief description of the file here
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_GPS_L1_CA_GPS_SDR_ACQUISITION_SS_H
|
||||
#define GNSS_SDR_GPS_L1_CA_GPS_SDR_ACQUISITION_SS_H
|
||||
|
||||
#include <fstream>
|
||||
#include <gnuradio/gr_block.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include <queue>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_satellite.h"
|
||||
|
||||
class FFT;
|
||||
|
||||
class gps_l1_ca_gps_sdr_acquisition_ss;
|
||||
typedef boost::shared_ptr<gps_l1_ca_gps_sdr_acquisition_ss>
|
||||
gps_l1_ca_gps_sdr_acquisition_ss_sptr;
|
||||
gps_l1_ca_gps_sdr_acquisition_ss_sptr
|
||||
gps_l1_ca_gps_sdr_make_acquisition_ss(unsigned int sampled_ms, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
class gps_l1_ca_gps_sdr_acquisition_ss: public gr_block
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
friend gps_l1_ca_gps_sdr_acquisition_ss_sptr
|
||||
gps_l1_ca_gps_sdr_make_acquisition_ss(unsigned int sampled_ms, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
gps_l1_ca_gps_sdr_acquisition_ss(unsigned int sampled_ms, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
long d_fs_in;
|
||||
long d_freq;
|
||||
int d_samples_per_ms;
|
||||
Gnss_Satellite d_satellite;
|
||||
float d_threshold;
|
||||
unsigned int d_doppler_max;
|
||||
unsigned int d_doppler_resolution;
|
||||
unsigned int d_sampled_ms;
|
||||
unsigned int d_fft_size;
|
||||
unsigned long int d_sample_counter;
|
||||
unsigned long int d_acq_sample_stamp;
|
||||
|
||||
CPX* d_baseband_signal;
|
||||
CPX* d_baseband_signal_shift;
|
||||
CPX* d_sine_if;
|
||||
CPX* d_sine_250;
|
||||
CPX* d_sine_500;
|
||||
CPX* d_sine_750;
|
||||
FFT* d_pFFT;
|
||||
FFT* d_piFFT;
|
||||
CPX* d_fft_codes[32];
|
||||
|
||||
signed int d_prn_code_phase;
|
||||
float d_doppler_freq_shift;
|
||||
unsigned int d_mag;
|
||||
|
||||
gr_msg_queue_sptr d_queue;
|
||||
concurrent_queue<int> *d_channel_internal_queue;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
bool d_active;
|
||||
bool d_dump;
|
||||
unsigned int d_channel;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
|
||||
~gps_l1_ca_gps_sdr_acquisition_ss();
|
||||
|
||||
signed int prn_code_phase();
|
||||
float doppler_freq_phase()
|
||||
{
|
||||
return d_doppler_freq_shift;
|
||||
}
|
||||
unsigned int mag()
|
||||
{
|
||||
return d_mag;
|
||||
}
|
||||
|
||||
unsigned long int get_sample_stamp()
|
||||
{
|
||||
return d_acq_sample_stamp;
|
||||
}
|
||||
|
||||
void set_satellite(Gnss_Satellite satellite);
|
||||
void set_active(bool active)
|
||||
{
|
||||
d_active = active;
|
||||
}
|
||||
void set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
}
|
||||
void set_threshold(float threshold)
|
||||
{
|
||||
d_threshold = threshold;
|
||||
}
|
||||
void set_doppler_max(unsigned int doppler_max)
|
||||
{
|
||||
d_doppler_max = doppler_max;
|
||||
}
|
||||
|
||||
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||
{
|
||||
d_channel_internal_queue = channel_internal_queue;
|
||||
}
|
||||
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GPS_L1_CA_GPS_SDR_ACQUISITION_SS_H */
|
||||
@@ -1,164 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_pcps_acquisition_cc.h
|
||||
* \brief Brief description of the file here
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_A_CC_H
|
||||
#define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_A_CC_H
|
||||
|
||||
#include <fstream>
|
||||
#include <gnuradio/gr_block.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <gnuradio/gri_fft.h>
|
||||
#include <queue>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_synchro.h"
|
||||
|
||||
class gps_l1_ca_pcps_acquisition_cc;
|
||||
typedef boost::shared_ptr<gps_l1_ca_pcps_acquisition_cc>
|
||||
gps_l1_ca_pcps_acquisition_cc_sptr;
|
||||
gps_l1_ca_pcps_acquisition_cc_sptr
|
||||
gps_l1_ca_pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in, int samples_per_ms,
|
||||
gr_msg_queue_sptr queue, bool dump, std::string dump_filename);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a PCPS acquisition block for GPS L1 C/A
|
||||
*/
|
||||
class gps_l1_ca_pcps_acquisition_cc: public gr_block
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
friend gps_l1_ca_pcps_acquisition_cc_sptr
|
||||
gps_l1_ca_pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in,
|
||||
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
gps_l1_ca_pcps_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in,
|
||||
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
||||
int doppler_offset);
|
||||
|
||||
long d_fs_in;
|
||||
long d_freq;
|
||||
int d_samples_per_ms;
|
||||
unsigned int d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
unsigned int d_doppler_max;
|
||||
unsigned int d_doppler_step;
|
||||
unsigned int d_sampled_ms;
|
||||
unsigned int d_fft_size;
|
||||
unsigned long int d_sample_counter;
|
||||
gr_complex* d_sine_if;
|
||||
|
||||
gr_complex* d_fft_codes;
|
||||
|
||||
gri_fft_complex* d_fft_if;
|
||||
|
||||
gri_fft_complex* d_ifft;
|
||||
|
||||
Gnss_Synchro *d_gnss_synchro;
|
||||
unsigned int d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
|
||||
gr_msg_queue_sptr d_queue;
|
||||
concurrent_queue<int> *d_channel_internal_queue;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
bool d_active;
|
||||
bool d_dump;
|
||||
unsigned int d_channel;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
|
||||
~gps_l1_ca_pcps_acquisition_cc();
|
||||
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
{
|
||||
d_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
unsigned int mag()
|
||||
{
|
||||
return d_mag;
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
void set_active(bool active)
|
||||
{
|
||||
d_active = active;
|
||||
}
|
||||
|
||||
void set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
}
|
||||
|
||||
void set_threshold(float threshold)
|
||||
{
|
||||
d_threshold = threshold;
|
||||
}
|
||||
|
||||
void set_doppler_max(unsigned int doppler_max)
|
||||
{
|
||||
d_doppler_max = doppler_max;
|
||||
}
|
||||
|
||||
void set_doppler_step(unsigned int doppler_step)
|
||||
{
|
||||
d_doppler_step = doppler_step;
|
||||
}
|
||||
|
||||
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||
{
|
||||
d_channel_internal_queue = channel_internal_queue;
|
||||
}
|
||||
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_CC_H*/
|
||||
@@ -1,360 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_tong_pcps_acquisition_cc.cc
|
||||
* \brief Brief description of the file here
|
||||
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gps_l1_ca_tong_pcps_acquisition_cc.h"
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include "control_message_factory.h"
|
||||
#include "gps_sdr_x86.h"
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <sstream>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
gps_l1_ca_tong_pcps_acquisition_cc_sptr gps_l1_ca_tong_pcps_make_acquisition_cc(
|
||||
unsigned int sampled_ms, unsigned int doppler_max, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename)
|
||||
{
|
||||
|
||||
return gps_l1_ca_tong_pcps_acquisition_cc_sptr(
|
||||
new gps_l1_ca_tong_pcps_acquisition_cc(sampled_ms, doppler_max,
|
||||
freq, fs_in, samples_per_ms, queue, dump, dump_filename));
|
||||
}
|
||||
|
||||
gps_l1_ca_tong_pcps_acquisition_cc::gps_l1_ca_tong_pcps_acquisition_cc(
|
||||
unsigned int sampled_ms, unsigned int doppler_max, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename) :
|
||||
gr_block("gps_l1_ca_tong_pcps_acquisition_cc", gr_make_io_signature(1, 1,
|
||||
sizeof(gr_complex) * samples_per_ms), gr_make_io_signature(0, 0,
|
||||
sizeof(gr_complex) * samples_per_ms))
|
||||
{
|
||||
|
||||
// SAMPLE COUNTER
|
||||
d_sample_counter = 0;
|
||||
|
||||
d_active = false;
|
||||
d_dump = dump;
|
||||
d_queue = queue;
|
||||
d_dump_filename = dump_filename;
|
||||
|
||||
d_freq = freq;
|
||||
d_fs_in = fs_in;
|
||||
|
||||
d_samples_per_ms = samples_per_ms;
|
||||
d_sampled_ms = sampled_ms;
|
||||
|
||||
d_doppler_max = doppler_max;
|
||||
|
||||
d_satellite = Gnss_Satellite();
|
||||
|
||||
d_samples = d_sampled_ms * d_samples_per_ms;
|
||||
|
||||
d_doppler_freq = 0.0;
|
||||
d_code_phase = 0;
|
||||
d_mag = 0.0;
|
||||
d_noise_power = 0.0;
|
||||
d_fbins = 0;
|
||||
d_doppler = 0;
|
||||
d_pfa = 0.2;
|
||||
d_A = 8;
|
||||
d_B = 1;
|
||||
d_max_dwells = 15;
|
||||
d_K = d_B;
|
||||
|
||||
d_if_sin = new gr_complex[d_samples];
|
||||
|
||||
d_fft_codes = (gr_complex*)malloc(sizeof(gr_complex) * d_samples_per_ms);
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gri_fft_complex(d_samples, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gri_fft_complex(d_samples, false);
|
||||
|
||||
d_ca_codes = new gr_complex[d_samples];
|
||||
|
||||
d_aux_ca_code = new gr_complex[d_samples];
|
||||
|
||||
//generates a unused PRN code to calculate the noise envelope
|
||||
code_gen_complex_sampled(d_aux_ca_code, 33, d_fs_in, 0);
|
||||
|
||||
DLOG(INFO) << "fs in " << d_fs_in;
|
||||
DLOG(INFO) << "samples per ms " << d_samples_per_ms;
|
||||
DLOG(INFO) << "doppler max " << d_doppler_max;
|
||||
DLOG(INFO) << "freq " << d_freq;
|
||||
DLOG(INFO) << "satellite " << d_satellite;
|
||||
DLOG(INFO) << "sampled_ms " << d_sampled_ms;
|
||||
DLOG(INFO) << "Samples_for_processing " << d_samples;
|
||||
DLOG(INFO) << "dump filename " << d_dump_filename;
|
||||
DLOG(INFO) << "dump " << d_dump;
|
||||
}
|
||||
|
||||
gps_l1_ca_tong_pcps_acquisition_cc::~gps_l1_ca_tong_pcps_acquisition_cc()
|
||||
{
|
||||
delete[] d_if_sin;
|
||||
delete[] d_ca_codes;
|
||||
delete[] d_aux_ca_code;
|
||||
delete d_fft_if;
|
||||
delete d_ifft;
|
||||
|
||||
if (d_dump)
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void gps_l1_ca_tong_pcps_acquisition_cc::set_satellite(Gnss_Satellite satellite)
|
||||
{
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
d_code_phase = 0;
|
||||
d_doppler_freq = 0;
|
||||
d_mag = 0.0;
|
||||
d_noise_power = 0.0;
|
||||
|
||||
// The GPS codes are generated on the fly using a custom version of the GPS code generator
|
||||
//! \TODO In-memory codes instead of generated on the fly
|
||||
code_gen_complex_sampled(d_fft_if->get_inbuf(), satellite.get_PRN(), d_fs_in, 0);
|
||||
|
||||
d_fft_if->execute(); // We need the FFT of GPS C/A code
|
||||
//Conjugate the local code
|
||||
//! \TODO Optimize it ! Try conj() or Armadillo
|
||||
for (unsigned int i = 0; i < d_samples; i++)
|
||||
{
|
||||
d_fft_codes[i] = std::complex<float>(
|
||||
d_fft_if->get_outbuf()[i].real(),
|
||||
-d_fft_if->get_outbuf()[i].imag());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
signed int gps_l1_ca_tong_pcps_acquisition_cc::prn_code_phase()
|
||||
{
|
||||
return d_code_phase;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int gps_l1_ca_tong_pcps_acquisition_cc::general_work(int noutput_items,
|
||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
|
||||
if (!d_active)
|
||||
{
|
||||
// sample counter
|
||||
d_sample_counter += d_samples * noutput_items;
|
||||
consume_each(noutput_items);
|
||||
}
|
||||
else
|
||||
{
|
||||
d_sample_counter += d_samples;
|
||||
|
||||
// initialize acquisition algorithm
|
||||
|
||||
bool positive_acquisition = false;
|
||||
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||
|
||||
//float noise_envelope = 0.0;
|
||||
float vt = 20000;
|
||||
//float peak = 0.0;
|
||||
float magt = 0.0;
|
||||
unsigned int max_freq_step = 2 * (unsigned int)(d_doppler_max
|
||||
/ d_doppler_step);
|
||||
unsigned int indext = 0;
|
||||
|
||||
// Get the input samples pointer
|
||||
const gr_complex *in = (const gr_complex *)input_items[0];
|
||||
|
||||
// aux vars
|
||||
std::stringstream filename;
|
||||
//unsigned int consume_items = 1;
|
||||
|
||||
// complex file write
|
||||
// std::streamsize n = 2 * sizeof(float) * (d_samples);
|
||||
|
||||
// 1 - Compute the input noise envelope estimation and the threshold vt
|
||||
|
||||
// sine_gen_complex( d_if_sin, d_freq + doppler, d_fs_in, d_samples );
|
||||
//
|
||||
// noise_envelope = calculate_envelope( in, d_aux_ca_code, d_if_sin );
|
||||
// vt = noise_envelope * sqrt( -2 * log( d_pfa ) );
|
||||
|
||||
|
||||
// 1- Compute the input signal power estimation
|
||||
for (unsigned int i = 0; i < d_samples; i++)
|
||||
{
|
||||
d_noise_power += std::abs(in[i]);
|
||||
}
|
||||
d_noise_power = sqrt(d_noise_power / (float)d_samples);
|
||||
|
||||
//2. Perform the carrier wipe-off
|
||||
sine_gen_complex(d_if_sin, d_freq + d_doppler, d_fs_in, d_samples);
|
||||
for (unsigned int i = 0; i < d_samples; i++)
|
||||
{
|
||||
d_fft_if->get_inbuf()[i] = in[i] * d_if_sin[i];
|
||||
}
|
||||
|
||||
//3- Perform the FFT-based circular convolution (parallel time search)
|
||||
d_fft_if->execute();
|
||||
|
||||
//TODO Optimize me: use Armadillo!
|
||||
for (unsigned int i = 0; i < d_samples; i++)
|
||||
{
|
||||
d_ifft->get_inbuf()[i] = d_fft_if->get_outbuf()[i]
|
||||
* d_fft_codes[i];
|
||||
}
|
||||
|
||||
d_ifft->execute();
|
||||
|
||||
x86_gr_complex_mag(d_ifft->get_outbuf(), d_samples); // d_ifft->get_outbuf()=|abs(·)|^2 and the array is converted from CPX->Float
|
||||
x86_float_max((float*)d_ifft->get_outbuf(), &d_indext, &magt,
|
||||
d_samples); // find max of |abs(·)|^2 -> index and magt
|
||||
magt = sqrt(magt) / (float)d_samples;
|
||||
d_test_statistics = magt / d_noise_power;
|
||||
|
||||
LOG_AT_LEVEL(INFO) << "Channel: " << d_channel
|
||||
<< ", doing Tong PCSS acquisition of satellite: "
|
||||
<< d_satellite << ", sample stamp: " << d_sample_counter
|
||||
<< ", bin_freq " << d_doppler << ", doppler_max: "
|
||||
<< d_doppler_max << ", K " << d_K << ", sigma: "
|
||||
<< d_noise_power << ", mag: " << d_test_statistics
|
||||
<< ", vt: " << vt;
|
||||
|
||||
if ((d_test_statistics > vt) && (indext = d_indext))
|
||||
{
|
||||
d_K++;
|
||||
if (d_K == d_A)
|
||||
{
|
||||
d_code_phase = d_indext;
|
||||
positive_acquisition = true;
|
||||
d_doppler_freq = d_doppler;
|
||||
d_acq_sample_stamp = d_sample_counter;
|
||||
LOG_AT_LEVEL(INFO) << "positive acquisition";
|
||||
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
|
||||
LOG_AT_LEVEL(INFO) << "sample_stamp " << d_sample_counter;
|
||||
LOG_AT_LEVEL(INFO) << "test statistics value "
|
||||
<< d_test_statistics;
|
||||
LOG_AT_LEVEL(INFO) << "test statistics threshold " << vt;
|
||||
LOG_AT_LEVEL(INFO) << "code phase " << d_code_phase;
|
||||
LOG_AT_LEVEL(INFO) << "doppler " << d_doppler_freq;
|
||||
LOG_AT_LEVEL(INFO) << "magnitude " << magt;
|
||||
LOG_AT_LEVEL(INFO) << "input signal power " << d_noise_power;
|
||||
d_dwells = 0;
|
||||
d_active = false;
|
||||
}
|
||||
else d_dwells++;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_K--;
|
||||
if ((d_K == 0) || (d_dwells > d_max_dwells))
|
||||
{
|
||||
d_K = d_B;
|
||||
d_dwells = 0;
|
||||
d_fbins++;
|
||||
if (d_fbins > max_freq_step)
|
||||
{
|
||||
d_fbins = 0;
|
||||
LOG_AT_LEVEL(INFO) << "negative acquisition";
|
||||
LOG_AT_LEVEL(INFO) << "satellite " << d_satellite;
|
||||
LOG_AT_LEVEL(INFO) << "sample_stamp" << d_sample_counter;
|
||||
LOG_AT_LEVEL(INFO) << "test statistics value "
|
||||
<< d_test_statistics;
|
||||
LOG_AT_LEVEL(INFO) << "test statistics threshold " << vt;
|
||||
LOG_AT_LEVEL(INFO) << "input signal power "
|
||||
<< d_noise_power;
|
||||
d_active = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_doppler = d_doppler + pow(-1, d_fbins + 1) * d_fbins
|
||||
* d_doppler_step;
|
||||
}
|
||||
}
|
||||
else d_dwells++;
|
||||
}
|
||||
|
||||
// Record results to files
|
||||
// if( d_dump )
|
||||
// {
|
||||
// filename.str( "" );
|
||||
// filename << "./data/fft_" << doppler << "_.dat";
|
||||
// std::cout << filename.str().c_str();
|
||||
// std::cout << ".\n";
|
||||
// d_dump_file.open( filename.str().c_str(), std::ios::out
|
||||
// | std::ios::binary );
|
||||
// d_dump_file.write( (char*) d_ifft->get_outbuf(), n ); //write directly |abs(·)|^2 in this Doppler bin
|
||||
// d_dump_file.close();
|
||||
// }
|
||||
|
||||
|
||||
if (d_active == false)
|
||||
{
|
||||
if (positive_acquisition)
|
||||
{
|
||||
acquisition_message = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
acquisition_message = 2;
|
||||
}
|
||||
|
||||
d_channel_internal_queue->push(acquisition_message);
|
||||
}
|
||||
|
||||
consume_each(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
float gps_l1_ca_tong_pcps_acquisition_cc::calculate_envelope(
|
||||
const gr_complex* _input_signal, std::complex<float>* _local_code,
|
||||
std::complex<float>* _local_if_sin)
|
||||
{
|
||||
float mag = 0.0;
|
||||
std::complex<float> tmp_cpx = 0.0;
|
||||
//std::cout << "tmp_cpx " << tmp_cpx << std::endl;
|
||||
|
||||
for (unsigned int i = 0; i < d_samples; i++)
|
||||
{
|
||||
tmp_cpx = tmp_cpx + _input_signal[i] * _local_code[i]
|
||||
* _local_if_sin[i];
|
||||
}
|
||||
//std::cout << "tmp_cpx " << tmp_cpx << std::endl;
|
||||
|
||||
mag = abs(tmp_cpx);
|
||||
return mag;
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_tong_pcps_acquisition_cc.h
|
||||
* \brief Brief description of the file here
|
||||
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_GPS_L1_CA_TONG_PCPS_ACQUISITION_CC_H
|
||||
#define GNSS_SDR_GPS_L1_CA_TONG_PCPS_ACQUISITION_CC_H
|
||||
|
||||
#include <fstream>
|
||||
#include <gnuradio/gr_block.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <gnuradio/gri_fft.h>
|
||||
#include <queue>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_satellite.h"
|
||||
|
||||
class gps_l1_ca_tong_pcps_acquisition_cc;
|
||||
|
||||
typedef boost::shared_ptr<gps_l1_ca_tong_pcps_acquisition_cc>
|
||||
gps_l1_ca_tong_pcps_acquisition_cc_sptr;
|
||||
|
||||
gps_l1_ca_tong_pcps_acquisition_cc_sptr
|
||||
gps_l1_ca_tong_pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in, int samples_per_ms,
|
||||
gr_msg_queue_sptr queue, bool dump, std::string dump_filename);
|
||||
|
||||
class gps_l1_ca_tong_pcps_acquisition_cc: public gr_block
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
friend gps_l1_ca_tong_pcps_acquisition_cc_sptr
|
||||
gps_l1_ca_tong_pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in,
|
||||
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
gps_l1_ca_tong_pcps_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in,
|
||||
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
long d_fs_in;
|
||||
long d_freq;
|
||||
long d_doppler;
|
||||
int d_samples_per_ms;
|
||||
unsigned int d_doppler_resolution;
|
||||
Gnss_Satellite d_satellite;
|
||||
std::string d_satellite_str;
|
||||
unsigned int d_doppler_max;
|
||||
unsigned int d_doppler_step;
|
||||
unsigned int d_sampled_ms;
|
||||
unsigned int d_samples;
|
||||
unsigned long int d_sample_counter;
|
||||
unsigned long int d_acq_sample_stamp;
|
||||
unsigned int d_fbins;
|
||||
unsigned int d_indext;
|
||||
unsigned d_dwells;
|
||||
float d_pfa;
|
||||
unsigned int d_A;
|
||||
unsigned int d_B;
|
||||
unsigned int d_max_dwells;
|
||||
unsigned int d_K;
|
||||
|
||||
gr_complex* d_if_sin;
|
||||
|
||||
gr_complex* d_fft_codes;
|
||||
|
||||
gri_fft_complex* d_fft_if;
|
||||
|
||||
gri_fft_complex* d_ifft;
|
||||
|
||||
gr_complex* d_ca_codes;
|
||||
|
||||
gr_complex* d_aux_ca_code;
|
||||
|
||||
unsigned int d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float d_noise_power;
|
||||
float d_test_statistics;
|
||||
|
||||
gr_msg_queue_sptr d_queue;
|
||||
concurrent_queue<int> *d_channel_internal_queue;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
bool d_active;
|
||||
bool d_dump;
|
||||
unsigned int d_channel;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
|
||||
~gps_l1_ca_tong_pcps_acquisition_cc();
|
||||
|
||||
signed int prn_code_phase();
|
||||
|
||||
float doppler_freq()
|
||||
{
|
||||
return d_doppler_freq;
|
||||
}
|
||||
unsigned int mag()
|
||||
{
|
||||
return d_mag;
|
||||
}
|
||||
|
||||
unsigned long int get_sample_stamp()
|
||||
{
|
||||
return d_acq_sample_stamp;
|
||||
}
|
||||
|
||||
void set_satellite(Gnss_Satellite satellite);
|
||||
|
||||
void set_active(bool active)
|
||||
{
|
||||
d_active = active;
|
||||
}
|
||||
|
||||
void set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
}
|
||||
|
||||
void set_doppler_max(unsigned int doppler_max)
|
||||
{
|
||||
d_doppler_max = doppler_max;
|
||||
}
|
||||
|
||||
void set_doppler_step(unsigned int doppler_step)
|
||||
{
|
||||
d_doppler_step = doppler_step;
|
||||
}
|
||||
|
||||
void set_doppler(unsigned int doppler)
|
||||
{
|
||||
d_doppler = doppler;
|
||||
}
|
||||
|
||||
void set_dwells(unsigned int dwells)
|
||||
{
|
||||
d_dwells = dwells;
|
||||
}
|
||||
|
||||
float calculate_envelope(const gr_complex* _input_signal, std::complex<
|
||||
float>* _local_code, std::complex<float>* _local_if_sin);
|
||||
|
||||
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||
{
|
||||
d_channel_internal_queue = channel_internal_queue;
|
||||
}
|
||||
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GPS_L1_CA_TONG_PCPS_ACQUISITION_CC_H*/
|
||||
@@ -1,6 +1,3 @@
|
||||
project : build-dir ../../../../build ;
|
||||
|
||||
#obj gps_l1_ca_gps_sdr_acquisition_cc : gps_l1_ca_gps_sdr_acquisition_cc.cc ;
|
||||
#obj gps_l1_ca_gps_sdr_acquisition_ss : gps_l1_ca_gps_sdr_acquisition_ss.cc : <toolset>darwin:<define>NO_SIMD <toolset>gcc:<define>USE_SIMD ;
|
||||
obj gps_l1_ca_pcps_acquisition_cc : gps_l1_ca_pcps_acquisition_cc.cc ;
|
||||
#obj gps_l1_ca_tong_pcps_acquisition_cc : gps_l1_ca_tong_pcps_acquisition_cc.cc ;
|
||||
obj pcps_acquisition_cc : pcps_acquisition_cc.cc ;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_pcps_acquisition_cc.h
|
||||
* \brief Brief description of the file here
|
||||
* \file pcps_acquisition_cc.cc
|
||||
* \brief This class implements a Parallell Code Phase Search Acquisition
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
@@ -31,8 +31,8 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gps_l1_ca_pcps_acquisition_cc.h"
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include "pcps_acquisition_cc.h"
|
||||
#include "gnss_signal_processing.h"
|
||||
#include "control_message_factory.h"
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <sstream>
|
||||
@@ -41,24 +41,24 @@
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
gps_l1_ca_pcps_acquisition_cc_sptr gps_l1_ca_pcps_make_acquisition_cc(
|
||||
pcps_acquisition_cc_sptr pcps_make_acquisition_cc(
|
||||
unsigned int sampled_ms, unsigned int doppler_max, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename)
|
||||
{
|
||||
|
||||
return gps_l1_ca_pcps_acquisition_cc_sptr(
|
||||
new gps_l1_ca_pcps_acquisition_cc(sampled_ms, doppler_max, freq,
|
||||
return pcps_acquisition_cc_sptr(
|
||||
new pcps_acquisition_cc(sampled_ms, doppler_max, freq,
|
||||
fs_in, samples_per_ms, queue, dump, dump_filename));
|
||||
}
|
||||
|
||||
gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc(
|
||||
pcps_acquisition_cc::pcps_acquisition_cc(
|
||||
unsigned int sampled_ms, unsigned int doppler_max, long freq,
|
||||
long fs_in, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename) :
|
||||
gr_block("gps_l1_ca_pcps_acquisition_cc", gr_make_io_signature(1, 1,
|
||||
sizeof(gr_complex) * samples_per_ms), gr_make_io_signature(0, 0,
|
||||
sizeof(gr_complex) * samples_per_ms))
|
||||
gr_block("pcps_acquisition_cc", gr_make_io_signature(1, 1,
|
||||
sizeof(gr_complex) * sampled_ms *samples_per_ms), gr_make_io_signature(0, 0,
|
||||
sizeof(gr_complex) * sampled_ms *samples_per_ms))
|
||||
{
|
||||
d_sample_counter = 0; // SAMPLE COUNTER
|
||||
d_active = false;
|
||||
@@ -69,15 +69,12 @@ gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc(
|
||||
d_sampled_ms = sampled_ms;
|
||||
d_doppler_max = doppler_max;
|
||||
d_fft_size = d_sampled_ms * d_samples_per_ms;
|
||||
//d_doppler_freq = 0.0;
|
||||
//d_code_phase = 0;
|
||||
d_mag = 0;
|
||||
d_input_power = 0.0;
|
||||
|
||||
|
||||
d_sine_if = new gr_complex[d_fft_size];
|
||||
|
||||
d_fft_codes = (gr_complex*)malloc(sizeof(gr_complex) * d_samples_per_ms);
|
||||
d_fft_codes = (gr_complex*)malloc(sizeof(gr_complex) * d_fft_size);
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gri_fft_complex(d_fft_size, true);
|
||||
@@ -90,72 +87,57 @@ gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc(
|
||||
|
||||
}
|
||||
|
||||
gps_l1_ca_pcps_acquisition_cc::~gps_l1_ca_pcps_acquisition_cc()
|
||||
pcps_acquisition_cc::~pcps_acquisition_cc()
|
||||
{
|
||||
delete[] d_sine_if;
|
||||
delete[] d_fft_codes;
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
delete[] d_sine_if;
|
||||
delete[] d_fft_codes;
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
|
||||
|
||||
if (d_dump)
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void pcps_acquisition_cc::set_local_code(std::complex<float> * code)
|
||||
{
|
||||
memcpy(d_fft_if->get_inbuf(),code,sizeof(gr_complex)*d_fft_size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void gps_l1_ca_pcps_acquisition_cc::init()
|
||||
void pcps_acquisition_cc::init()
|
||||
{
|
||||
|
||||
d_gnss_synchro->Acq_delay_samples = 0.0;
|
||||
d_gnss_synchro->Acq_doppler_hz = 0.0;
|
||||
d_gnss_synchro->Acq_samplestamp_samples = 0;
|
||||
d_gnss_synchro->Acq_delay_samples=0.0;
|
||||
d_gnss_synchro->Acq_doppler_hz=0.0;
|
||||
d_gnss_synchro->Acq_samplestamp_samples=0;
|
||||
|
||||
|
||||
//d_code_phase = 0;
|
||||
//d_doppler_freq = 0;
|
||||
d_mag = 0.0;
|
||||
d_input_power = 0.0;
|
||||
|
||||
// Now the GPS codes are generated on the fly using a custom version of the GPS code generator
|
||||
code_gen_complex_sampled(d_fft_if->get_inbuf(), d_gnss_synchro->PRN, d_fs_in, 0);
|
||||
d_fft_if->execute(); // We need the FFT of local code
|
||||
|
||||
d_fft_if->execute(); // We need the FFT of GPS C/A code
|
||||
//Conjugate the local code
|
||||
//TODO Optimize it !
|
||||
for (unsigned int i = 0; i < d_fft_size; i++)
|
||||
{
|
||||
d_fft_codes[i] = std::complex<float>(conj(d_fft_if->get_outbuf()[i]));
|
||||
d_fft_codes[i] = d_fft_codes[i] / (float)d_fft_size; //to correct the scale factor introduced by FFTW
|
||||
}
|
||||
|
||||
//memcpy(d_fft_codes,d_fft_if->get_outbuf(),sizeof(gr_complex)*d_samples_per_ms);
|
||||
|
||||
// std::stringstream filename;
|
||||
// std::streamsize n = 2*sizeof(float)*(d_fft_size); // complex file write
|
||||
// filename.str("");
|
||||
// filename << "./data/code.dat";
|
||||
// std::cout<<filename.str().c_str();
|
||||
// std::cout<<".\n";
|
||||
// d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary);
|
||||
//
|
||||
//
|
||||
// d_dump_file.write((char*)d_ifft->get_inbuf(), n); //write directly |abs(·)|^2 in this Doppler bin
|
||||
// //d_dump_file.write((char*)d_sine_if, n); //to be read with read_complex_binary() -> test OK
|
||||
// d_dump_file.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
|
||||
int pcps_acquisition_cc::general_work(int noutput_items,
|
||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
|
||||
/*
|
||||
* By J.Arribas
|
||||
* By J.Arribas and L.Esteve
|
||||
* Acquisition strategy (Kay Borre book + CFAR threshold):
|
||||
* 1. Compute the input signal power estimation
|
||||
* 2. Doppler serial search loop
|
||||
@@ -175,16 +157,12 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
|
||||
d_sample_counter += d_fft_size; // sample counter
|
||||
|
||||
//restart acquisition variables
|
||||
|
||||
d_gnss_synchro->Acq_delay_samples = 0.0;
|
||||
d_gnss_synchro->Acq_doppler_hz = 0.0;
|
||||
//d_code_phase = 0;
|
||||
//d_doppler_freq = 0;
|
||||
d_gnss_synchro->Acq_delay_samples=0.0;
|
||||
d_gnss_synchro->Acq_doppler_hz=0.0;
|
||||
d_mag = 0.0;
|
||||
d_input_power = 0.0;
|
||||
|
||||
// initialize acquisition algorithm
|
||||
|
||||
int doppler;
|
||||
unsigned int indext = 0;
|
||||
float magt = 0.0;
|
||||
@@ -195,6 +173,7 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
|
||||
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||
|
||||
//aux vars
|
||||
|
||||
unsigned int i;
|
||||
|
||||
DLOG(INFO) << "Channel: " << d_channel
|
||||
@@ -214,9 +193,9 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
|
||||
// 2- Doppler frequency search loop
|
||||
for (doppler = (int)(-d_doppler_max); doppler < (int)d_doppler_max; doppler += d_doppler_step)
|
||||
{
|
||||
// doppler search steps
|
||||
//doppler search steps
|
||||
//Perform the carrier wipe-off
|
||||
sine_gen_complex(d_sine_if, d_freq + doppler, d_fs_in, d_fft_size);
|
||||
complex_exp_gen(d_sine_if, d_freq + doppler, d_fs_in, d_fft_size);
|
||||
for (i = 0; i < d_fft_size; i++)
|
||||
{
|
||||
d_fft_if->get_inbuf()[i] = in[i] * d_sine_if[i];
|
||||
@@ -250,12 +229,12 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
|
||||
std::stringstream filename;
|
||||
std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write
|
||||
filename.str("");
|
||||
filename << "./data/fft_" << doppler << "_.dat";
|
||||
std::cout << filename.str().c_str();
|
||||
std::cout << ".\n";
|
||||
filename << "../data/fft_galileo_e1_sat_" << d_gnss_synchro->PRN << "_doppler_"<< doppler << ".dat";
|
||||
//std::cout << filename.str().c_str();
|
||||
//std::cout << ".\n";
|
||||
d_dump_file.open(filename.str().c_str(), std::ios::out
|
||||
| std::ios::binary);
|
||||
d_dump_file.write((char*)d_ifft->get_outbuf(), n); //write directly |abs(<EFBFBD>)|^2 in this Doppler bin?
|
||||
d_dump_file.write((char*)d_ifft->get_outbuf(), n); //write directly |abs(x)|^2 in this Doppler bin?
|
||||
d_dump_file.close();
|
||||
}
|
||||
|
||||
@@ -263,8 +242,10 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
|
||||
if (d_mag < magt)
|
||||
{
|
||||
d_mag = magt;
|
||||
d_gnss_synchro->Acq_delay_samples = (double)indext;
|
||||
d_gnss_synchro->Acq_doppler_hz = (double)doppler;
|
||||
d_gnss_synchro->Acq_delay_samples= (double)indext;
|
||||
d_gnss_synchro->Acq_doppler_hz= (double)doppler;
|
||||
//d_code_phase = indext;
|
||||
//d_doppler_freq = doppler;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +254,6 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
|
||||
|
||||
|
||||
// 6- Declare positive or negative acquisition using a message queue
|
||||
|
||||
if (d_test_statistics > d_threshold)
|
||||
{
|
||||
positive_acquisition = true;
|
||||
169
src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h
Normal file
169
src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/*!
|
||||
* \file pcps_acquisition_cc.h
|
||||
* \brief This class implements a Parallell Code Phase Search Acquisition
|
||||
*
|
||||
* Acquisition strategy (Kay Borre book + CFAR threshold):
|
||||
* 1. Compute the input signal power estimation
|
||||
* 2. Doppler serial search loop
|
||||
* 3. Perform the FFT-based circular convolution (parallel time search)
|
||||
* 4. Record the maximum peak and the associated synchronization parameters
|
||||
* 5. Compute the test statistics and compare to the threshold
|
||||
* 6. Declare positive or negative acquisition using a message queue
|
||||
*
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef PCPS_ACQUISITION_CC_H_
|
||||
#define PCPS_ACQUISITION_CC_H_
|
||||
|
||||
#include <fstream>
|
||||
#include <gnuradio/gr_block.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <gnuradio/gri_fft.h>
|
||||
#include <queue>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_synchro.h"
|
||||
|
||||
class pcps_acquisition_cc;
|
||||
typedef boost::shared_ptr<pcps_acquisition_cc>
|
||||
pcps_acquisition_cc_sptr;
|
||||
pcps_acquisition_cc_sptr
|
||||
pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in, int samples_per_ms,
|
||||
gr_msg_queue_sptr queue, bool dump, std::string dump_filename);
|
||||
|
||||
class pcps_acquisition_cc: public gr_block {
|
||||
|
||||
private:
|
||||
|
||||
friend pcps_acquisition_cc_sptr
|
||||
pcps_make_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in,
|
||||
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
pcps_acquisition_cc(unsigned int sampled_ms,
|
||||
unsigned int doppler_max, long freq, long fs_in,
|
||||
int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
||||
int doppler_offset);
|
||||
|
||||
long d_fs_in;
|
||||
long d_freq;
|
||||
int d_samples_per_ms;
|
||||
unsigned int d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
unsigned int d_doppler_max;
|
||||
unsigned int d_doppler_step;
|
||||
unsigned int d_sampled_ms;
|
||||
unsigned int d_fft_size;
|
||||
unsigned long int d_sample_counter;
|
||||
gr_complex* d_sine_if;
|
||||
|
||||
gr_complex* d_fft_codes;
|
||||
|
||||
gri_fft_complex* d_fft_if;
|
||||
|
||||
gri_fft_complex* d_ifft;
|
||||
|
||||
Gnss_Synchro *d_gnss_synchro;
|
||||
unsigned int d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
|
||||
gr_msg_queue_sptr d_queue;
|
||||
concurrent_queue<int> *d_channel_internal_queue;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
bool d_active;
|
||||
bool d_dump;
|
||||
unsigned int d_channel;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
|
||||
~pcps_acquisition_cc();
|
||||
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
{
|
||||
d_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
unsigned int mag()
|
||||
{
|
||||
return d_mag;
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
void set_local_code(std::complex<float> * code);
|
||||
|
||||
void set_active(bool active)
|
||||
{
|
||||
d_active = active;
|
||||
}
|
||||
|
||||
void set_channel(unsigned int channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
}
|
||||
|
||||
void set_threshold(float threshold)
|
||||
{
|
||||
d_threshold = threshold;
|
||||
}
|
||||
|
||||
void set_doppler_max(unsigned int doppler_max)
|
||||
{
|
||||
d_doppler_max = doppler_max;
|
||||
}
|
||||
|
||||
void set_doppler_step(unsigned int doppler_step)
|
||||
{
|
||||
d_doppler_step = doppler_step;
|
||||
}
|
||||
|
||||
void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
|
||||
{
|
||||
d_channel_internal_queue = channel_internal_queue;
|
||||
}
|
||||
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* PCPS_ACQUISITION_CC_H_*/
|
||||
@@ -49,7 +49,6 @@ class ConfigurationInterface;
|
||||
class AcquisitionInterface;
|
||||
class TrackingInterface;
|
||||
class TelemetryDecoderInterface;
|
||||
//class GpsL1CaChannelFsm;
|
||||
|
||||
/*!
|
||||
* \brief This class represents a GNSS channel.
|
||||
|
||||
189
src/algorithms/libs/galileo_e1_signal_processing.cc
Normal file
189
src/algorithms/libs/galileo_e1_signal_processing.cc
Normal file
@@ -0,0 +1,189 @@
|
||||
/*!
|
||||
* \file galileo_e1_signal_processing.cc
|
||||
* \brief This library implements various functions for Galileo E1 signals
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "galileo_e1_signal_processing.h"
|
||||
|
||||
void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn,
|
||||
unsigned int _chip_shift)
|
||||
{
|
||||
std::string _galileo_signal = _Signal;
|
||||
signed int prn = _prn - 1;
|
||||
int* dest = _dest;
|
||||
|
||||
/* A simple error check */
|
||||
if ((_prn < 1) || (_prn > 50))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_galileo_signal.compare("1B") == 0)
|
||||
{
|
||||
for (size_t i = 0; i < Galileo_E1_B_PRIMARY_CODE[prn].length(); i++)
|
||||
{
|
||||
hex_to_binary_converter(dest,
|
||||
Galileo_E1_B_PRIMARY_CODE[prn].at(i));
|
||||
dest = dest + 4;
|
||||
}
|
||||
|
||||
}
|
||||
else if (_galileo_signal.compare("1C") == 0)
|
||||
{
|
||||
for (size_t i = 0; i < Galileo_E1_C_PRIMARY_CODE[prn].length(); i++)
|
||||
{
|
||||
hex_to_binary_converter(dest,
|
||||
Galileo_E1_C_PRIMARY_CODE[prn].at(i));
|
||||
dest = dest + 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void galileo_e1_sinboc_11_gen(std::complex<float>* _dest, int* _prn,
|
||||
unsigned int _length_out)
|
||||
{
|
||||
const unsigned int _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||
unsigned int _period = (unsigned int) (_length_out / _length_in);
|
||||
|
||||
for (unsigned int i = 0; i < _length_in; i++)
|
||||
{
|
||||
|
||||
for (unsigned int j = 0; j < (_period / 2); j++)
|
||||
_dest[i * _period + j] = std::complex<float>((float) _prn[i],
|
||||
0.0);
|
||||
|
||||
for (unsigned int j = (_period / 2); j < _period; j++)
|
||||
_dest[i * _period + j] = std::complex<float>((float) (-_prn[i]),
|
||||
0.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void galileo_e1_sinboc_61_gen(std::complex<float>* _dest, int* _prn,
|
||||
unsigned int _length_out)
|
||||
{
|
||||
const unsigned int _length_in = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||
unsigned int _period = (unsigned int) (_length_out / _length_in);
|
||||
|
||||
for (unsigned int i = 0; i < _length_in; i++)
|
||||
{
|
||||
|
||||
for (unsigned int j = 0; j < _period; j += 2)
|
||||
_dest[i * _period + j] = std::complex<float>((float) _prn[i],
|
||||
0.0);
|
||||
|
||||
for (unsigned int j = 1; j < _period; j += 2)
|
||||
_dest[i * _period + j] = std::complex<float>((float) (-_prn[i]),
|
||||
0.0);
|
||||
}
|
||||
|
||||
}
|
||||
void galileo_e1_gen(std::complex<float>* _dest, int* _prn, char _Signal[3])
|
||||
{
|
||||
std::string _galileo_signal = _Signal;
|
||||
const unsigned int _codeLength = 12 * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||
const float alpha = sqrt(10.0 / 11.0);
|
||||
const float beta = sqrt(1.0 / 11.0);
|
||||
|
||||
std::complex<float> sinboc_11[_codeLength];
|
||||
std::complex<float> sinboc_61[_codeLength];
|
||||
|
||||
galileo_e1_sinboc_11_gen(sinboc_11, _prn, _codeLength); //generate sinboc(1,1) 12 samples per chip
|
||||
|
||||
galileo_e1_sinboc_61_gen(sinboc_61, _prn, _codeLength); //generate sinboc(6,1) 12 samples per chip
|
||||
|
||||
if (_galileo_signal.compare("1B") == 0)
|
||||
{
|
||||
for (unsigned int i = 0; i < _codeLength; i++)
|
||||
{
|
||||
_dest[i] = alpha * sinboc_11[i] + beta * sinboc_61[i];
|
||||
}
|
||||
}
|
||||
else if (_galileo_signal.compare("1C") == 0)
|
||||
{
|
||||
for (unsigned int i = 0; i < _codeLength; i++)
|
||||
{
|
||||
_dest[i] = alpha * sinboc_11[i] - beta * sinboc_61[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest,
|
||||
char _Signal[3], bool _cboc, unsigned int _prn, signed int _fs,
|
||||
unsigned int _chip_shift)
|
||||
{
|
||||
|
||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||
|
||||
unsigned int _samplesPerCode;
|
||||
const unsigned int _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz
|
||||
unsigned int _codeLength = Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||
int primary_code_E1_chips[_codeLength];
|
||||
_samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength));
|
||||
|
||||
galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn, 0); //generate Galileo E1 code, 1 sample per chip
|
||||
|
||||
if (_cboc == true)
|
||||
{
|
||||
|
||||
_codeLength = 12 * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||
|
||||
std::complex<float> _signal_E1[_codeLength];
|
||||
|
||||
galileo_e1_gen(_signal_E1, primary_code_E1_chips, _Signal); //generate cboc 12 samples per chip
|
||||
|
||||
resampler(_signal_E1, _dest, 12 * _codeFreqBasis, _fs, _codeLength,
|
||||
_samplesPerCode); //resamples code to fs
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//--- Find number of samples per spreading code ----------------------------
|
||||
|
||||
_codeLength = 2 * Galileo_E1_B_CODE_LENGTH_CHIPS;
|
||||
|
||||
std::complex<float> _signal_E1[_codeLength];
|
||||
|
||||
galileo_e1_sinboc_11_gen(_signal_E1, primary_code_E1_chips,
|
||||
_codeLength); //generate sinboc(1,1) 2 samples per chip
|
||||
|
||||
resampler(_signal_E1, _dest, 2 * _codeFreqBasis, _fs, _codeLength,
|
||||
_samplesPerCode); //resamples code to fs
|
||||
|
||||
}
|
||||
}
|
||||
75
src/algorithms/libs/galileo_e1_signal_processing.h
Normal file
75
src/algorithms/libs/galileo_e1_signal_processing.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*!
|
||||
* \file galileo_e1_signal_processing.h
|
||||
* \brief This library implements various functions for Galileo E1 signals
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GALILEO_E1_SIGNAL_PROCESSING_H_
|
||||
#define GALILEO_E1_SIGNAL_PROCESSING_H_
|
||||
|
||||
#include <complex>
|
||||
#include <iostream>
|
||||
#include "Galileo_E1.h"
|
||||
#include "gnss_signal_processing.h"
|
||||
|
||||
/*!
|
||||
* \brief This function generates Galileo E1 code (one sample per chip).
|
||||
*
|
||||
*/
|
||||
void galileo_e1_code_gen_int(int* _dest, char _Signal[3], signed int _prn,
|
||||
unsigned int _chip_shift);
|
||||
/*!
|
||||
* \brief This function generates Galileo E1 sinboc(1,1) code (minimum 2 samples per chip),
|
||||
* the _codeLength variable must be a multiple of 2*4092.
|
||||
*
|
||||
*/
|
||||
void galileo_e1_sinboc_11_gen(std::complex<float>* _dest, int* _prn,
|
||||
unsigned int _codeLength);
|
||||
/*!
|
||||
* \brief This function generates Galileo E1 sinboc(6,1) code (minimum 12 samples per chip),
|
||||
* the _codeLength variable must be a multiple of 12*4092.
|
||||
*
|
||||
*/
|
||||
void galileo_e1_sinboc_61_gen(std::complex<float>* _dest, int* _prn,
|
||||
unsigned int _codeLength);
|
||||
/*!
|
||||
* \brief This function generates Galileo E1 cboc code (12 samples per chip).
|
||||
*
|
||||
*/
|
||||
void galileo_e1_cboc_gen(std::complex<float>* _dest, int* _prn, char _Signal[3]);
|
||||
/*!
|
||||
* \brief This function generates Galileo E1 code (can select E1B or E1C, cboc or sinboc
|
||||
* and the sample frequency _fs).
|
||||
*
|
||||
*/
|
||||
void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signal[3],
|
||||
bool _cboc, unsigned int _prn, signed int _fs,
|
||||
unsigned int _chip_shift);
|
||||
|
||||
#endif /* GALILEO_E1_SIGNAL_PROCESSING_H_ */
|
||||
187
src/algorithms/libs/gnss_signal_processing.cc
Normal file
187
src/algorithms/libs/gnss_signal_processing.cc
Normal file
@@ -0,0 +1,187 @@
|
||||
/*!
|
||||
* \file gnss_signal_processing.cc
|
||||
* \brief This library gathers a few functions used by the algorithms of gnss-sdr,
|
||||
* regardless of system used
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gnss_signal_processing.h"
|
||||
|
||||
|
||||
|
||||
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps) {
|
||||
|
||||
double phase, phase_step;
|
||||
|
||||
phase_step = (GPS_TWO_PI*_f)/_fs;
|
||||
|
||||
for(unsigned int i = 0; i < _samps; i++) {
|
||||
|
||||
_dest[i] = std::complex<float>(cos(phase),sin(phase));
|
||||
|
||||
phase += phase_step;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void hex_to_binary_converter(int * _dest, char _from)
|
||||
{
|
||||
switch(_from)
|
||||
{
|
||||
case '0':
|
||||
*(_dest)=1;
|
||||
*(_dest+1)=1;
|
||||
*(_dest+2)=1;
|
||||
*(_dest+3)=1;
|
||||
break;
|
||||
case '1':
|
||||
*(_dest)=1;
|
||||
*(_dest+1)=1;
|
||||
*(_dest+2)=1;
|
||||
*(_dest+3)=-1;
|
||||
break;
|
||||
case '2':
|
||||
*(_dest)=1;
|
||||
*(_dest+1)=1;
|
||||
*(_dest+2)=-1;
|
||||
*(_dest+3)=1;
|
||||
break;
|
||||
case '3':
|
||||
*(_dest)=1;
|
||||
*(_dest+1)=1;
|
||||
*(_dest+2)=-1;
|
||||
*(_dest+3)=-1;
|
||||
break;
|
||||
case '4':
|
||||
*(_dest)=1;
|
||||
*(_dest+1)=-1;
|
||||
*(_dest+2)=1;
|
||||
*(_dest+3)=1;
|
||||
break;
|
||||
case '5':
|
||||
*(_dest)=1;
|
||||
*(_dest+1)=-1;
|
||||
*(_dest+2)=1;
|
||||
*(_dest+3)=-1;
|
||||
break;
|
||||
case '6':
|
||||
*(_dest)=1;
|
||||
*(_dest+1)=-1;
|
||||
*(_dest+2)=-1;
|
||||
*(_dest+3)=1;
|
||||
break;
|
||||
case '7':
|
||||
*(_dest)=1;
|
||||
*(_dest+1)=-1;
|
||||
*(_dest+2)=-1;
|
||||
*(_dest+3)=-1;
|
||||
break;
|
||||
case '8':
|
||||
*(_dest)=-1;
|
||||
*(_dest+1)=1;
|
||||
*(_dest+2)=1;
|
||||
*(_dest+3)=1;
|
||||
break;
|
||||
case '9':
|
||||
*(_dest)=-1;
|
||||
*(_dest+1)=1;
|
||||
*(_dest+2)=1;
|
||||
*(_dest+3)=-1;
|
||||
break;
|
||||
case 'A':
|
||||
*(_dest)=-1;
|
||||
*(_dest+1)=1;
|
||||
*(_dest+2)=-1;
|
||||
*(_dest+3)=1;
|
||||
break;
|
||||
case 'B':
|
||||
*(_dest)=-1;
|
||||
*(_dest+1)=1;
|
||||
*(_dest+2)=-1;
|
||||
*(_dest+3)=-1;
|
||||
break;
|
||||
case 'C':
|
||||
*(_dest)=-1;
|
||||
*(_dest+1)=-1;
|
||||
*(_dest+2)=1;
|
||||
*(_dest+3)=1;
|
||||
break;
|
||||
case 'D':
|
||||
*(_dest)=-1;
|
||||
*(_dest+1)=-1;
|
||||
*(_dest+2)=1;
|
||||
*(_dest+3)=-1;
|
||||
break;
|
||||
case 'E':
|
||||
*(_dest)=-1;
|
||||
*(_dest+1)=-1;
|
||||
*(_dest+2)=-1;
|
||||
*(_dest+3)=1;
|
||||
break;
|
||||
case 'F':
|
||||
*(_dest)=-1;
|
||||
*(_dest+1)=-1;
|
||||
*(_dest+2)=-1;
|
||||
*(_dest+3)=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void resampler(std::complex<float>* _from, std::complex<float>* _dest, float _fs_in,
|
||||
float _fs_out, unsigned int _length_in, unsigned int _length_out)
|
||||
{
|
||||
|
||||
unsigned int _codeValueIndex;
|
||||
//--- Find time constants --------------------------------------------------
|
||||
float _t_in = 1/_fs_in; // Incoming sampling period in sec
|
||||
float _t_out = 1/_fs_out; // Out sampling period in sec
|
||||
|
||||
for (unsigned int i=0; i<_length_out; i++)
|
||||
{
|
||||
//=== Digitizing =======================================================
|
||||
|
||||
//--- Make index array to read sampled values -------------------------
|
||||
|
||||
_codeValueIndex = ceil((_t_out * ((float)i + 1)) / _t_in) - 1;
|
||||
|
||||
if (i == _length_out - 1)
|
||||
{
|
||||
//--- Correct the last index (due to number rounding issues) -----------
|
||||
_dest[i] = _from[_length_in - 1];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//if repeat the chip -> upsample by nearest neighbourhood interpolation
|
||||
_dest[i] = _from[_codeValueIndex];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
65
src/algorithms/libs/gnss_signal_processing.h
Normal file
65
src/algorithms/libs/gnss_signal_processing.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*!
|
||||
* \file gnss_signal_processing.h
|
||||
* \brief This library gathers a few functions used by the algorithms of gnss-sdr,
|
||||
* regardless of system used
|
||||
*
|
||||
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SIGNAL_PROCESSING_H_
|
||||
#define GNSS_SIGNAL_PROCESSING_H_
|
||||
|
||||
#include <complex>
|
||||
#include <iostream>
|
||||
#include "GPS_L1_CA.h"
|
||||
|
||||
/*!
|
||||
* \brief This function generates a complex exponential in _dest.
|
||||
*
|
||||
*/
|
||||
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs,
|
||||
unsigned int _samps);
|
||||
|
||||
/*!
|
||||
* \brief This function makes a conversion from hex (the input is a char)
|
||||
* to binary (the output are 4 ints with +1 or -1 values).
|
||||
*
|
||||
*/
|
||||
|
||||
void hex_to_binary_converter(int * _dest, char _from);
|
||||
|
||||
/*!
|
||||
* \brief This function resamples a sequence of complex values.
|
||||
*
|
||||
*/
|
||||
void resampler(std::complex<float>* _from, std::complex<float>* _dest,
|
||||
float _fs_in, float _fs_out, unsigned int _length_in,
|
||||
unsigned int _length_out);
|
||||
|
||||
#endif /* GNSS_SIGNAL_PROCESSING_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,43 @@
|
||||
/*!
|
||||
* \file gps_sdr_signal_processing.cc
|
||||
* \brief This class implements various functions for GPS L1 CA signals
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
|
||||
/*!
|
||||
* The SV ID is _prn=ID -1
|
||||
*/
|
||||
void code_gen_conplex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift)
|
||||
|
||||
void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift)
|
||||
{
|
||||
|
||||
unsigned int G1[1023];
|
||||
@@ -72,82 +102,14 @@ void code_gen_conplex(std::complex<float>* _dest, signed int _prn, unsigned int
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
/*!
|
||||
* code_gen, generate the given prn code
|
||||
* */
|
||||
|
||||
//signed int code_gen(CPX *_dest, signed int _prn)
|
||||
//{
|
||||
//
|
||||
// unsigned int G1[1023];
|
||||
// unsigned int G2[1023];
|
||||
// unsigned int G1_register[10], G2_register[10];
|
||||
// unsigned int feedback1, feedback2;
|
||||
// unsigned int lcv, lcv2;
|
||||
// unsigned int delay;
|
||||
// signed int prn = _prn-1; //Move the PRN code to fit an array indices
|
||||
//
|
||||
// /* G2 Delays as defined in GPS-ISD-200D */
|
||||
// signed int delays[51] = {5, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254 ,255, 256, 257, 258, 469, 470, 471, 472,
|
||||
// 473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862, 145, 175, 52, 21, 237, 235, 886, 657, 634, 762,
|
||||
// 355, 1012, 176, 603, 130, 359, 595, 68, 386};
|
||||
//
|
||||
// /* A simple error check */
|
||||
// if((prn < 0) || (prn > 51))
|
||||
// return(0);
|
||||
//
|
||||
// for(lcv = 0; lcv < 10; lcv++)
|
||||
// {
|
||||
// G1_register[lcv] = 1;
|
||||
// G2_register[lcv] = 1;
|
||||
// }
|
||||
//
|
||||
// /* Generate G1 & G2 Register */
|
||||
// for(lcv = 0; lcv < 1023; lcv++)
|
||||
// {
|
||||
// G1[lcv] = G1_register[0];
|
||||
// G2[lcv] = G2_register[0];
|
||||
//
|
||||
// feedback1 = G1_register[7]^G1_register[0];
|
||||
// feedback2 = (G2_register[8] + G2_register[7] + G2_register[4] + G2_register[2] + G2_register[1] + G2_register[0]) & 0x1;
|
||||
//
|
||||
// for(lcv2 = 0; lcv2 < 9; lcv2++)
|
||||
// {
|
||||
// G1_register[lcv2] = G1_register[lcv2+1];
|
||||
// G2_register[lcv2] = G2_register[lcv2+1];
|
||||
// }
|
||||
//
|
||||
// G1_register[9] = feedback1;
|
||||
// G2_register[9] = feedback2;
|
||||
// }
|
||||
//
|
||||
// /* Set the delay */
|
||||
// delay = 1023 - delays[prn];
|
||||
//
|
||||
// /* Generate PRN from G1 and G2 Registers */
|
||||
// for(lcv = 0; lcv < 1023; lcv++)
|
||||
// {
|
||||
// _dest[lcv].i = G1[lcv]^G2[delay];
|
||||
// _dest[lcv].q = 0;
|
||||
//
|
||||
// delay++;
|
||||
// delay %= 1023;
|
||||
// }
|
||||
//
|
||||
// return(1);
|
||||
//
|
||||
//}
|
||||
///*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \
|
||||
* code_gen_complex_sampled, generate GPS L1 C/A code complex for the desired SV ID and sampled to specific sampling frequency
|
||||
* \
|
||||
*/
|
||||
void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift)
|
||||
void gps_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift)
|
||||
{
|
||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
|
||||
std::complex<float> _code[1023];
|
||||
signed int _samplesPerCode, _codeValueIndex;
|
||||
float _ts;
|
||||
@@ -161,7 +123,7 @@ void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, sig
|
||||
//--- Find time constants --------------------------------------------------
|
||||
_ts = 1/(float)_fs; // Sampling period in sec
|
||||
_tc = 1/(float)_codeFreqBasis; // C/A chip period in sec
|
||||
code_gen_conplex(_code,_prn, _chip_shift); //generate C/A code 1 sample per chip
|
||||
gps_l1_ca_code_gen_complex(_code,_prn, _chip_shift); //generate C/A code 1 sample per chip
|
||||
//std::cout<<"ts="<<_ts<<std::endl;
|
||||
//std::cout<<"tc="<<_tc<<std::endl;
|
||||
//std::cout<<"sv="<<_prn<<std::endl;
|
||||
@@ -195,195 +157,4 @@ void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, sig
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
/*!
|
||||
* sine_gen, generate a full scale sinusoid of frequency f with sampling frequency fs for _samps samps and put it into _dest
|
||||
* */
|
||||
//void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps) {
|
||||
//
|
||||
// signed int lcv;
|
||||
// signed short c, s;
|
||||
// float phase, phase_step;
|
||||
//
|
||||
// phase = 0;
|
||||
// phase_step = (float)TWO_PI*_f/_fs;
|
||||
//
|
||||
// for(lcv = 0; lcv < _samps; lcv++) {
|
||||
// c = (signed short)floor(16383.0*cos(phase));
|
||||
// s = (signed short)floor(16383.0*sin(phase));
|
||||
// _dest[lcv].i = c;
|
||||
// _dest[lcv].q = s;
|
||||
//
|
||||
// phase += phase_step;
|
||||
// }
|
||||
//}
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
void sine_gen_complex(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps) {
|
||||
|
||||
double phase, phase_step;
|
||||
|
||||
phase_step = (GPS_TWO_PI*_f)/_fs;
|
||||
|
||||
for(unsigned int i = 0; i < _samps; i++) {
|
||||
|
||||
//_dest[i] = std::complex<float>(16383.0*cos(phase), 16383.0*sin(phase));
|
||||
_dest[i] = std::complex<float>(cos(phase),sin(phase));
|
||||
|
||||
phase += phase_step;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
//void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps, double _p)
|
||||
//{
|
||||
//
|
||||
// signed int lcv;
|
||||
// int16 c, s;
|
||||
// double phase, phase_step;
|
||||
//
|
||||
// phase = _p;
|
||||
// phase_step = (double)TWO_PI*_f/_fs;
|
||||
//
|
||||
// for(lcv = 0; lcv < _samps; lcv++)
|
||||
// {
|
||||
// c = (int16)floor(16383.0*cos(phase));
|
||||
// s = (int16)floor(16383.0*sin(phase));
|
||||
// _dest[lcv].i = c;
|
||||
// _dest[lcv].q = s;
|
||||
//
|
||||
// phase += phase_step;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
/*!
|
||||
* wipeoff_gen, generate a full scale sinusoid of frequency f with sampling frequency fs for _samps samps and put it into _dest
|
||||
* */
|
||||
//void wipeoff_gen(MIX *_dest, double _f, double _fs, signed int _samps)
|
||||
//{
|
||||
//
|
||||
// signed int lcv;
|
||||
// int16 c, s;
|
||||
// double phase, phase_step;
|
||||
//
|
||||
// phase = 0;
|
||||
// phase_step = (double)TWO_PI*_f/_fs;
|
||||
//
|
||||
// for(lcv = 0; lcv < _samps; lcv++)
|
||||
// {
|
||||
// c = (int16)floor(16383.0*cos(phase));
|
||||
// s = (int16)floor(16383.0*sin(phase));
|
||||
// _dest[lcv].i = _dest[lcv].ni = c;
|
||||
// _dest[lcv].q = s;
|
||||
// _dest[lcv].nq = -s;
|
||||
//
|
||||
// phase += phase_step;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
//void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, signed int _samps)
|
||||
//{
|
||||
//
|
||||
// signed int lcv, k;
|
||||
// unsigned int phase_step;
|
||||
// unsigned int lphase, phase;
|
||||
//
|
||||
// phase_step = (unsigned int)floor((double)4294967296.0*_fdest/_fsource);
|
||||
//
|
||||
// k = lphase = phase = 0;
|
||||
//
|
||||
// for(lcv = 0; lcv < _samps; lcv++)
|
||||
// {
|
||||
// if(phase <= lphase)
|
||||
// {
|
||||
// _dest[k] = _source[lcv];
|
||||
// k++;
|
||||
// }
|
||||
//
|
||||
// lphase = phase;
|
||||
// phase += phase_step;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
/*!
|
||||
* Gather statistics and run AGC
|
||||
* */
|
||||
//signed int run_agc(CPX *_buff, signed int _samps, signed int _bits, signed int _scale)
|
||||
//{
|
||||
// signed int lcv, num;
|
||||
// int16 max, *p;
|
||||
// int16 val;
|
||||
//
|
||||
// p = (int16 *)&_buff[0];
|
||||
//
|
||||
// val = (1 << (_scale - 1));
|
||||
// max = 1 << _bits;
|
||||
// num = 0;
|
||||
//
|
||||
// if(_scale)
|
||||
// {
|
||||
// for(lcv = 0; lcv < 2*_samps; lcv++)
|
||||
// {
|
||||
// p[lcv] += val;
|
||||
// p[lcv] >>= _scale;
|
||||
// if(abs(p[lcv]) > max)
|
||||
// num++;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// for(lcv = 0; lcv < 2*_samps; lcv++)
|
||||
// {
|
||||
// if(abs(p[lcv]) > max)
|
||||
// num++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return(num);
|
||||
//
|
||||
//}
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
/*!
|
||||
* Get a rough first guess of scale value to quickly initialize agc
|
||||
* */
|
||||
//void init_agc(CPX *_buff, signed int _samps, signed int bits, signed int *scale)
|
||||
//{
|
||||
// signed int lcv;
|
||||
// int16 *p;
|
||||
// signed int max;
|
||||
//
|
||||
// p = (int16 *)&_buff[0];
|
||||
//
|
||||
// max = 0;
|
||||
// for(lcv = 0; lcv < 2*_samps; lcv++)
|
||||
// {
|
||||
// if(p[lcv] > max)
|
||||
// max = p[lcv];
|
||||
// }
|
||||
//
|
||||
// scale[0] = (1 << 14) / max;
|
||||
//
|
||||
//}
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -1,58 +1,44 @@
|
||||
/*!
|
||||
* \file gps_sdr_signal_processing.h
|
||||
* \brief This class implements various functions for GPS L1 CA signals
|
||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* 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
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GPS_SDR_SIGNAL_PROCESSING_H_
|
||||
#define GPS_SDR_SIGNAL_PROCESSING_H_
|
||||
|
||||
//#include "gps_sdr_defines.h"
|
||||
|
||||
#include "GPS_L1_CA.h"
|
||||
|
||||
#include <complex>
|
||||
#include <iostream>
|
||||
#include "GPS_L1_CA.h"
|
||||
|
||||
///*
|
||||
// * Signal processing functions from gps-sdr.
|
||||
// */
|
||||
//
|
||||
///*----------------------------------------------------------------------------------------------*/
|
||||
///*! @ingroup STRUCTS
|
||||
// * @brief Define the CPX structure, used in the Fine_Acquisition FFT */
|
||||
//typedef struct CPX
|
||||
//{
|
||||
// int16 i; //!< Real value
|
||||
// int16 q; //!< Imaginary value
|
||||
//} CPX;
|
||||
//
|
||||
///*! \ingroup STRUCTS
|
||||
// * @brief Format of complex accumulations */
|
||||
//typedef struct CPX_ACCUM {
|
||||
//
|
||||
// int32 i; //!< Inphase (real)
|
||||
// int32 q; //!< Quadrature (imaginary)
|
||||
//
|
||||
//} CPX_ACCUM;
|
||||
//
|
||||
//
|
||||
///*! \ingroup STRUCTS
|
||||
// *
|
||||
// */
|
||||
//typedef struct MIX {
|
||||
//
|
||||
// int16 i; //!< Inphase (real)
|
||||
// int16 nq; //!< Quadrature (imaginary)
|
||||
// int16 q; //!< Quadrature (imaginary)
|
||||
// int16 ni; //!< Inphase (real)
|
||||
//
|
||||
//} MIX;
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
|
||||
void code_gen_conplex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift);
|
||||
void code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift);
|
||||
//signed int code_gen(CPX *_dest, signed int _prn);
|
||||
//void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps);
|
||||
void sine_gen_complex(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps);
|
||||
//void sine_gen(CPX *_dest, double _f, double _fs, signed int _samps, double _p);
|
||||
//void wipeoff_gen(MIX *_dest, double _f, double _fs, signed int _samps);
|
||||
//void downsample(CPX *_dest, CPX *_source, double _fdest, double _fsource, signed int _samps);
|
||||
//void init_agc(CPX *_buff, signed int _samps, signed int bits, signed int *scale);
|
||||
//signed int run_agc(CPX *_buff, signed int _samps, signed int bits, signed int scale);
|
||||
void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift);
|
||||
void gps_l1_ca_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, signed int _fs, unsigned int _chip_shift);
|
||||
|
||||
#endif /* GPS_SDR_SIGNAL_PROCESSING_H_ */
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
project : build-dir ../../../build ;
|
||||
|
||||
obj gnss_signal_processing : gnss_signal_processing.cc ;
|
||||
obj gps_sdr_signal_processing : gps_sdr_signal_processing.cc ;
|
||||
obj galileo_e1_signal_processing : galileo_e1_signal_processing.cc ;
|
||||
obj gnss_sdr_valve : gnss_sdr_valve.cc ;
|
||||
obj pass_through : pass_through.cc ;
|
||||
#obj gps_sdr_fft : gps_sdr_fft.cc : <toolset>darwin:<define>NO_SIMD <toolset>gcc:<define>USE_SIMD ;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "gnss_synchro.h"
|
||||
#include "gps_l1_ca_dll_fll_pll_tracking_cc.h"
|
||||
//#include "gnss_signal_processing.h"
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "tracking_discriminators.h"
|
||||
@@ -221,7 +222,7 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking()
|
||||
d_FLL_wait = 1;
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
code_gen_conplex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);
|
||||
gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);
|
||||
|
||||
d_ca_code[0] = d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS];
|
||||
d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 1] = d_ca_code[1];
|
||||
|
||||
@@ -230,7 +230,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
|
||||
d_code_loop_filter.initialize(d_acq_code_phase_samples); //initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
code_gen_conplex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);
|
||||
gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);
|
||||
d_ca_code[0] = d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS];
|
||||
d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 1] = d_ca_code[1];
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
||||
d_code_loop_filter.initialize(d_acq_code_phase_samples); //initialize the code filter
|
||||
|
||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||
code_gen_conplex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);
|
||||
gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);
|
||||
d_ca_code[0] = d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS];
|
||||
d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 1] = d_ca_code[1];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user