Extending the Gnss_Satellite class to the acquisition interfaces

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@131 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-01-19 17:42:33 +00:00
parent d9aff36247
commit c03042059c
19 changed files with 57 additions and 57 deletions

View File

@ -62,7 +62,7 @@ GpsL1CaGpsSdrAcquisition::GpsL1CaGpsSdrAcquisition(
default_item_type);
//vector_length_ = configuration->property(role + ".vector_length", 2048);
satellite_ = 0;
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);
@ -113,17 +113,17 @@ GpsL1CaGpsSdrAcquisition::~GpsL1CaGpsSdrAcquisition()
{}
// Set satellite
void GpsL1CaGpsSdrAcquisition::set_satellite(unsigned int satellite)
void GpsL1CaGpsSdrAcquisition::set_satellite(Gnss_Satellite satellite)
{
satellite_ = satellite;
gnss_satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
if (item_type_.compare("gr_complex") == 0)
{
acquisition_cc_->set_satellite(satellite_);
acquisition_cc_->set_satellite(gnss_satellite_);
}
else
{
acquisition_ss_->set_satellite(satellite_);
acquisition_ss_->set_satellite(gnss_satellite_);
}
}

View File

@ -78,7 +78,7 @@ public:
gr_basic_block_sptr get_left_block();
gr_basic_block_sptr get_right_block();
void set_satellite(unsigned int satellite);
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);
@ -103,7 +103,7 @@ private:
size_t item_size_;
std::string item_type_;
unsigned int vector_length_;
unsigned int satellite_;
Gnss_Satellite gnss_satellite_;
unsigned int channel_;
float threshold_;
unsigned int doppler_max_;

View File

@ -59,7 +59,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
item_type_ = configuration->property(role + ".item_type",
default_item_type);
satellite_ = 0;
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);
@ -94,13 +94,13 @@ GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition()
{
}
void GpsL1CaPcpsAcquisition::set_satellite(unsigned int satellite)
void GpsL1CaPcpsAcquisition::set_satellite(Gnss_Satellite satellite)
{
satellite_ = satellite;
gnss_satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
if (item_type_.compare("gr_complex") == 0)
{
acquisition_cc_->set_satellite(satellite_);
acquisition_cc_->set_satellite(gnss_satellite_);
}
}

View File

@ -69,7 +69,7 @@ public:
gr_basic_block_sptr get_left_block();
gr_basic_block_sptr get_right_block();
void set_satellite(unsigned int satellite);
void set_satellite(Gnss_Satellite satellite);
void set_channel(unsigned int channel);
void set_threshold(float threshold);
void set_doppler_max(unsigned int doppler_max);
@ -92,7 +92,8 @@ private:
size_t item_size_;
std::string item_type_;
unsigned int vector_length_;
unsigned int satellite_;
Gnss_Satellite gnss_satellite_;
//unsigned int satellite_;
unsigned int channel_;
float threshold_;
unsigned int doppler_max_;

View File

@ -63,7 +63,7 @@ GpsL1CaTongPcpsAcquisition::GpsL1CaTongPcpsAcquisition(
std::cout << "item type " << item_type_ << std::endl;
satellite_ = 0;
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);
@ -98,9 +98,9 @@ GpsL1CaTongPcpsAcquisition::~GpsL1CaTongPcpsAcquisition()
{
}
void GpsL1CaTongPcpsAcquisition::set_satellite(unsigned int satellite)
void GpsL1CaTongPcpsAcquisition::set_satellite(Gnss_Satellite satellite)
{
satellite_ = satellite;
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
if (item_type_.compare("gr_complex") == 0)
{

View File

@ -68,7 +68,7 @@ public:
gr_basic_block_sptr get_left_block();
gr_basic_block_sptr get_right_block();
void set_satellite(unsigned int satellite);
void set_satellite(Gnss_Satellite satellite);
void set_channel(unsigned int channel);
void set_threshold(float threshold){};
void set_doppler_max(unsigned int doppler_max);
@ -91,7 +91,7 @@ private:
size_t item_size_;
std::string item_type_;
unsigned int vector_length_;
unsigned int satellite_;
Gnss_Satellite satellite_;
unsigned int channel_;
float threshold_;
unsigned int doppler_max_;

View File

@ -77,7 +77,7 @@ gps_l1_ca_gps_sdr_acquisition_cc::gps_l1_ca_gps_sdr_acquisition_cc(
d_doppler_max = 0;
d_satellite = 0;
d_satellite = Gnss_Satellite();
d_fft_size = d_sampled_ms * d_samples_per_ms;
@ -139,14 +139,14 @@ gps_l1_ca_gps_sdr_acquisition_cc::~gps_l1_ca_gps_sdr_acquisition_cc()
}
}
void gps_l1_ca_gps_sdr_acquisition_cc::set_satellite(unsigned int satellite)
void gps_l1_ca_gps_sdr_acquisition_cc::set_satellite(Gnss_Satellite satellite)
{
d_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, d_fs_in, 0);
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);
@ -292,7 +292,7 @@ void gps_l1_ca_gps_sdr_acquisition_cc::calculate_magnitudes(
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(á)|^2 -> index and magt
x86_float_max((float*)d_ifft->get_outbuf(), &indext, &magt, d_fft_size); // find max of |abs(<EFBFBD>)|^2 -> index and magt
if (magt > d_mag)
{ // if the magnitude is > threshold

View File

@ -43,6 +43,7 @@
#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>
@ -72,7 +73,7 @@ private:
long d_fs_in;
long d_freq;
int d_samples_per_ms;
unsigned int d_satellite;
Gnss_Satellite d_satellite;
float d_threshold;
std::string d_satellite_str;
unsigned int d_doppler_max;
@ -133,7 +134,7 @@ public:
return d_acq_sample_stamp;
}
void set_satellite(unsigned int satellite);
void set_satellite(Gnss_Satellite satellite);
void set_active(bool active)
{
d_active = active;

View File

@ -77,7 +77,7 @@ gps_l1_ca_gps_sdr_acquisition_ss::gps_l1_ca_gps_sdr_acquisition_ss(
d_samples_per_ms = samples_per_ms;
d_doppler_resolution = 4;
d_freq = freq;
d_satellite = 0;
d_satellite = Gnss_Satellite();
d_doppler_max = 0;
d_sampled_ms = sampled_ms;
d_fft_size = d_sampled_ms * d_samples_per_ms;
@ -140,9 +140,9 @@ gps_l1_ca_gps_sdr_acquisition_ss::~gps_l1_ca_gps_sdr_acquisition_ss()
}
}
void gps_l1_ca_gps_sdr_acquisition_ss::set_satellite(unsigned int satellite)
void gps_l1_ca_gps_sdr_acquisition_ss::set_satellite(Gnss_Satellite satellite)
{
d_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;
@ -223,7 +223,7 @@ int gps_l1_ca_gps_sdr_acquisition_ss::general_work(int noutput_items,
d_fft_size, 10);
#else
sse_cmulsc(&d_baseband_signal_shift[(j * (d_fft_size + 201))
+ 100 + i], d_fft_codes[d_satellite], buffer,
+ 100 + i], d_fft_codes[d_satellite.get_PRN()], buffer,
d_fft_size, 10);
#endif
d_piFFT->doiFFT(buffer, true);

View File

@ -42,7 +42,7 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include "concurrent_queue.h"
#include "gnss_satellite.h"
class FFT;
@ -71,7 +71,7 @@ private:
long d_fs_in;
long d_freq;
int d_samples_per_ms;
unsigned int d_satellite;
Gnss_Satellite d_satellite;
float d_threshold;
unsigned int d_doppler_max;
unsigned int d_doppler_resolution;
@ -122,7 +122,7 @@ public:
return d_acq_sample_stamp;
}
void set_satellite(unsigned int satellite);
void set_satellite(Gnss_Satellite satellite);
void set_active(bool active)
{
d_active = active;

View File

@ -69,7 +69,7 @@ gps_l1_ca_pcps_acquisition_cc::gps_l1_ca_pcps_acquisition_cc(
d_samples_per_ms = samples_per_ms;
d_sampled_ms = sampled_ms;
d_doppler_max = doppler_max;
d_satellite = 0;
d_satellite = Gnss_Satellite();
d_fft_size = d_sampled_ms * d_samples_per_ms;
d_doppler_freq = 0.0;
d_code_phase = 0;
@ -116,16 +116,16 @@ gps_l1_ca_pcps_acquisition_cc::~gps_l1_ca_pcps_acquisition_cc()
void gps_l1_ca_pcps_acquisition_cc::set_satellite(unsigned int satellite)
void gps_l1_ca_pcps_acquisition_cc::set_satellite(Gnss_Satellite satellite)
{
d_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_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(), satellite, d_fs_in, 0);
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()
@ -266,7 +266,7 @@ int gps_l1_ca_pcps_acquisition_cc::general_work(int noutput_items,
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.write((char*)d_ifft->get_outbuf(), n); //write directly |abs(<EFBFBD>)|^2 in this Doppler bin?
d_dump_file.close();
}

View File

@ -43,6 +43,8 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include "concurrent_queue.h"
#include "gnss_satellite.h"
class gps_l1_ca_pcps_acquisition_cc;
typedef boost::shared_ptr<gps_l1_ca_pcps_acquisition_cc>
@ -78,7 +80,7 @@ private:
long d_freq;
int d_samples_per_ms;
unsigned int d_doppler_resolution;
unsigned int d_satellite;
Gnss_Satellite d_satellite;
float d_threshold;
std::string d_satellite_str;
unsigned int d_doppler_max;
@ -129,7 +131,7 @@ public:
return d_acq_sample_stamp;
}
void set_satellite(unsigned int satellite);
void set_satellite(Gnss_Satellite satellite);
void set_active(bool active)
{

View File

@ -77,7 +77,7 @@ gps_l1_ca_tong_pcps_acquisition_cc::gps_l1_ca_tong_pcps_acquisition_cc(
d_doppler_max = doppler_max;
d_satellite = 0;
d_satellite = Gnss_Satellite();
d_samples = d_sampled_ms * d_samples_per_ms;
@ -135,9 +135,9 @@ gps_l1_ca_tong_pcps_acquisition_cc::~gps_l1_ca_tong_pcps_acquisition_cc()
}
}
void gps_l1_ca_tong_pcps_acquisition_cc::set_satellite(unsigned int satellite)
void gps_l1_ca_tong_pcps_acquisition_cc::set_satellite(Gnss_Satellite satellite)
{
d_satellite = satellite;
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
d_code_phase = 0;
d_doppler_freq = 0;
d_mag = 0.0;
@ -145,7 +145,7 @@ void gps_l1_ca_tong_pcps_acquisition_cc::set_satellite(unsigned int satellite)
// 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, d_fs_in, 0);
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

View File

@ -42,6 +42,7 @@
#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;
@ -74,7 +75,7 @@ private:
long d_doppler;
int d_samples_per_ms;
unsigned int d_doppler_resolution;
unsigned int d_satellite;
Gnss_Satellite d_satellite;
std::string d_satellite_str;
unsigned int d_doppler_max;
unsigned int d_doppler_step;
@ -138,7 +139,7 @@ public:
return d_acq_sample_stamp;
}
void set_satellite(unsigned int satellite);
void set_satellite(Gnss_Satellite satellite);
void set_active(bool active)
{

View File

@ -171,7 +171,7 @@ gr_basic_block_sptr Channel::get_right_block()
void Channel::set_satellite(Gnss_Satellite satellite)
{
gnss_satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
acq_->set_satellite(satellite.get_PRN());
acq_->set_satellite(gnss_satellite_);
trk_->set_satellite(satellite.get_PRN());
nav_->set_satellite(satellite.get_PRN());
}

View File

@ -78,7 +78,7 @@ public:
size_t item_size(){ return 0; }
Gnss_Satellite satellite() const { return gnss_satellite_; }
Gnss_Satellite get_satellite() const { return gnss_satellite_; }
AcquisitionInterface* acquisition(){ return acq_; }

View File

@ -39,6 +39,7 @@
#define GNSS_SDR_ACQUISITION_INTERFACE_H_
#include "gnss_block_interface.h"
#include "gnss_satellite.h"
template<typename Data>class concurrent_queue;
@ -55,7 +56,7 @@ class AcquisitionInterface: public GNSSBlockInterface
public:
//virtual void set_active(bool active) = 0;
virtual void set_satellite(unsigned int satellite) = 0;
virtual void set_satellite(Gnss_Satellite sat) = 0;
virtual void set_channel(unsigned int channel) = 0;
virtual void set_threshold(float threshold) = 0;
virtual void set_doppler_max(unsigned int doppler_max) = 0;

View File

@ -53,7 +53,7 @@ class ChannelInterface: public GNSSBlockInterface
public:
virtual Gnss_Satellite satellite() const = 0;
virtual Gnss_Satellite get_satellite() const = 0;
virtual void start_acquisition() = 0;
virtual void set_satellite(Gnss_Satellite) = 0;
virtual void start() = 0;

View File

@ -333,9 +333,9 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
case 0:
LOG_AT_LEVEL(INFO) << "Channel " << who
<< " ACQ FAILED satellite " << channel(who)->satellite();
<< " ACQ FAILED satellite " << channel(who)->get_satellite();
available_GPS_satellites_IDs_->push_back(
channel(who)->satellite());
channel(who)->get_satellite());
channel(who)->set_satellite(
available_GPS_satellites_IDs_->front());
available_GPS_satellites_IDs_->pop_front();
@ -464,15 +464,9 @@ void GNSSFlowgraph::set_satellites_list()
available_gps_prn_iter++)
{
sv = Gnss_Satellite(std::string("GPS"), *available_gps_prn_iter);
std::cout << *available_gps_prn_iter << std::endl;
available_GPS_satellites_IDs_->push_back(sv);
}
// for (unsigned int id = 1; id < 33; id++)
// {
// available_GPS_satellites_IDs_->push_back(id);
// }
std::list<Gnss_Satellite>::iterator it =
available_GPS_satellites_IDs_->begin();