Changes in flowgraph and channel_fsm. Now the number of channels in acquisition mode can be controlled from the config file.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@179 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Luis Esteve 2012-03-02 17:17:51 +00:00
parent 756e6fe4e3
commit c428fe21c5
10 changed files with 263 additions and 182 deletions

View File

@ -3,7 +3,7 @@
;######### GLOBAL OPTIONS ##################
;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz].
GNSS-SDR.internal_fs_hz=2046000
GNSS-SDR.internal_fs_hz=2048000
;######### CONTROL_THREAD CONFIG ############
ControlThread.wait_for_flowgraph=false
@ -14,6 +14,7 @@ SignalSource.implementation=File_Signal_Source
;#filename: path to file with the captured GNSS signal samples to be processed
SignalSource.filename=/home/luis/Project/signals/cap2/agilent_cap2.dat
;SignalSource.filename=/media/My Passport/spirent scenario 2/data/sc2_d8.dat
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
SignalSource.item_type=gr_complex
@ -124,12 +125,13 @@ Resampler.item_type=gr_complex
Resampler.sample_freq_in=4000000
;#sample_freq_out: the desired sample frequency of the output signal
Resampler.sample_freq_out=2046000
Resampler.sample_freq_out=2048000
;######### CHANNELS GLOBAL CONFIG ############
;#count: Number of available satellite channels.
Channels.count=4
Channels.in_acquisition=2
;######### CHANNEL 0 CONFIG ############
;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS
@ -242,7 +244,7 @@ Acquisition.sampled_ms=1
Acquisition0.implementation=GPS_L1_CA_PCPS_Acquisition
;#threshold: Acquisition threshold
Acquisition0.threshold=70
Acquisition0.threshold=50
;#doppler_max: Maximum expected Doppler shift [Hz]
Acquisition0.doppler_max=10000
@ -256,28 +258,28 @@ Acquisition0.doppler_step=250
;######### ACQUISITION CH 1 CONFIG ############
Acquisition1.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition1.threshold=70
Acquisition1.threshold=50
Acquisition1.doppler_max=10000
Acquisition1.doppler_step=250
;Acquisition1.repeat_satellite=true
;######### ACQUISITION CH 2 CONFIG ############
Acquisition2.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition2.threshold=70
Acquisition2.threshold=50
Acquisition2.doppler_max=10000
Acquisition2.doppler_step=250
;Acquisition2.repeat_satellite=true
;######### ACQUISITION CH 3 CONFIG ############
Acquisition3.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition3.threshold=70
Acquisition3.threshold=50
Acquisition3.doppler_max=10000
Acquisition3.doppler_step=250
;Acquisition3.repeat_satellite=true
;######### ACQUISITION CH 4 CONFIG ############
Acquisition4.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition4.threshold=70
Acquisition4.threshold=50
Acquisition4.doppler_max=10000
Acquisition4.doppler_step=250
;Acquisition4.repeat_satellite=true

View File

@ -200,7 +200,6 @@ void Channel::start()
void Channel::run()
{
start_acquisition();
while (!stop_)
{
channel_internal_queue_.wait_and_pop(message_);
@ -208,6 +207,9 @@ void Channel::run()
}
}
void Channel::standby(){
channel_fsm_.Event_gps_failed_tracking_standby();
}
/*
* Set stop_ to true and blocks the calling thread until
@ -215,8 +217,8 @@ void Channel::run()
*/
void Channel::stop()
{
stop_ = true;
channel_internal_queue_.push(0); //message to stop channel
stop_ = true;
/* When the boost::thread object that represents a thread of execution
* is destroyed the thread becomes detached. Once a thread is detached,
@ -262,12 +264,7 @@ void Channel::process_channel_messages()
}
break;
case 3:
LOG_AT_LEVEL(INFO) << "Channel " << channel_
<< " TRACKING FAILED satellite " << gnss_synchro_.System << " "<< gnss_synchro_.PRN
<< ", reacquisition.";
channel_fsm_.Event_gps_failed_tracking();
break;
default:
LOG_AT_LEVEL(WARNING) << "Default case, invalid message.";

View File

@ -91,7 +91,7 @@ public:
void start_acquisition();
void set_signal(Gnss_Signal gnss_signal_);
void start();
void standby();
/*!
* \brief Set stop_ to true and blocks the calling thread until
* the thread of the constructor has completed

View File

@ -34,185 +34,164 @@
#include <glog/log_severity.h>
#include <glog/logging.h>
struct Ev_gps_channel_start_acquisition: sc::event<Ev_gps_channel_start_acquisition>
{};
struct Ev_gps_channel_valid_acquisition: sc::event<Ev_gps_channel_valid_acquisition>
{};
struct Ev_gps_channel_failed_acquisition_repeat: sc::event<Ev_gps_channel_failed_acquisition_repeat>
{};
struct Ev_gps_channel_failed_acquisition_no_repeat: sc::event<Ev_gps_channel_failed_acquisition_no_repeat>
{};
struct Ev_gps_channel_failed_tracking: sc::event<Ev_gps_channel_failed_tracking>
{};
struct gps_channel_idle_fsm_S0: public sc::state<gps_channel_idle_fsm_S0,GpsL1CaChannelFsm>
{
public:
// sc::transition(event, next state)
typedef sc::transition<Ev_gps_channel_start_acquisition, gps_channel_acquiring_fsm_S1> reactions;
gps_channel_idle_fsm_S0(my_context ctx) :
my_base(ctx)
{
//std::cout << "Enter Channel_Idle_S0 " << std::endl;
}
struct Ev_gps_channel_start_acquisition: sc::event<
Ev_gps_channel_start_acquisition> {
};
struct gps_channel_acquiring_fsm_S1: public sc::state<gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm>
{
public:
typedef mpl::list<sc::transition<Ev_gps_channel_failed_acquisition_no_repeat, gps_channel_waiting_fsm_S3>,
sc::transition<Ev_gps_channel_failed_acquisition_repeat, gps_channel_acquiring_fsm_S1>,
sc::transition<Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> >reactions;
gps_channel_acquiring_fsm_S1(my_context ctx) : my_base(ctx)
{
//std::cout << "Enter Channel_Acq_S1 " << std::endl;
context<GpsL1CaChannelFsm> ().start_acquisition();
}
struct Ev_gps_channel_valid_acquisition: sc::event<
Ev_gps_channel_valid_acquisition> {
};
struct gps_channel_tracking_fsm_S2: public sc::state<gps_channel_tracking_fsm_S2, GpsL1CaChannelFsm>
{
public:
typedef sc::transition<Ev_gps_channel_failed_tracking, gps_channel_acquiring_fsm_S1> reactions;
gps_channel_tracking_fsm_S2(my_context ctx) : my_base(ctx)
{
//std::cout << "Enter Channel_tracking_S2 " << std::endl;
context<GpsL1CaChannelFsm> ().start_tracking();
}
struct Ev_gps_channel_failed_acquisition_repeat: sc::event<
Ev_gps_channel_failed_acquisition_repeat> {
};
struct gps_channel_waiting_fsm_S3: public sc::state<gps_channel_waiting_fsm_S3, GpsL1CaChannelFsm>
{
public:
typedef sc::transition<Ev_gps_channel_start_acquisition, gps_channel_acquiring_fsm_S1> reactions;
gps_channel_waiting_fsm_S3(my_context ctx) : my_base(ctx)
{
//std::cout << "Enter Channel_waiting_S3 " << std::endl;
context<GpsL1CaChannelFsm> ().request_satellite();
}
struct Ev_gps_channel_failed_acquisition_no_repeat: sc::event<
Ev_gps_channel_failed_acquisition_no_repeat> {
};
struct Ev_gps_channel_failed_tracking_standby: sc::event<Ev_gps_channel_failed_tracking_standby> {
};
//struct Ev_gps_channel_failed_tracking_reacq: sc::event<Ev_gps_channel_failed_tracking_reacq> {
//};
GpsL1CaChannelFsm::GpsL1CaChannelFsm()
{
initiate(); //start the FSM
struct gps_channel_idle_fsm_S0: public sc::state<gps_channel_idle_fsm_S0,
GpsL1CaChannelFsm> {
public:
// sc::transition(event, next state)
typedef sc::transition<Ev_gps_channel_start_acquisition,
gps_channel_acquiring_fsm_S1> reactions;
gps_channel_idle_fsm_S0(my_context ctx) :
my_base(ctx) {
//std::cout << "Enter Channel_Idle_S0 " << std::endl;
}
};
struct gps_channel_acquiring_fsm_S1: public sc::state<
gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm> {
public:
typedef mpl::list<sc::transition<
Ev_gps_channel_failed_acquisition_no_repeat,
gps_channel_waiting_fsm_S3>, sc::transition<
Ev_gps_channel_failed_acquisition_repeat,
gps_channel_acquiring_fsm_S1>, sc::transition<
Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> >
reactions;
gps_channel_acquiring_fsm_S1(my_context ctx) :
my_base(ctx) {
//std::cout << "Enter Channel_Acq_S1 " << std::endl;
context<GpsL1CaChannelFsm> ().start_acquisition();
}
};
struct gps_channel_tracking_fsm_S2: public sc::state<
gps_channel_tracking_fsm_S2, GpsL1CaChannelFsm> {
public:
typedef mpl::list<sc::transition<Ev_gps_channel_failed_tracking_standby,
gps_channel_idle_fsm_S0>, sc::transition<Ev_gps_channel_start_acquisition,
gps_channel_acquiring_fsm_S1>> reactions;
gps_channel_tracking_fsm_S2(my_context ctx) :
my_base(ctx) {
//std::cout << "Enter Channel_tracking_S2 " << std::endl;
context<GpsL1CaChannelFsm> ().start_tracking();
}
};
struct gps_channel_waiting_fsm_S3: public sc::state<gps_channel_waiting_fsm_S3,
GpsL1CaChannelFsm> {
public:
typedef sc::transition<Ev_gps_channel_start_acquisition,
gps_channel_acquiring_fsm_S1> reactions;
gps_channel_waiting_fsm_S3(my_context ctx) :
my_base(ctx) {
//std::cout << "Enter Channel_waiting_S3 " << std::endl;
context<GpsL1CaChannelFsm> ().request_satellite();
}
~gps_channel_waiting_fsm_S3(){}
};
GpsL1CaChannelFsm::GpsL1CaChannelFsm() {
initiate(); //start the FSM
}
GpsL1CaChannelFsm::GpsL1CaChannelFsm(AcquisitionInterface *acquisition) : acq_(acquisition)
{
initiate(); //start the FSM
GpsL1CaChannelFsm::GpsL1CaChannelFsm(AcquisitionInterface *acquisition) :
acq_(acquisition) {
initiate(); //start the FSM
}
void GpsL1CaChannelFsm::Event_gps_start_acquisition()
{
this->process_event(Ev_gps_channel_start_acquisition());
void GpsL1CaChannelFsm::Event_gps_start_acquisition() {
this->process_event(Ev_gps_channel_start_acquisition());
}
void GpsL1CaChannelFsm::Event_gps_valid_acquisition()
{
this->process_event(Ev_gps_channel_valid_acquisition());
void GpsL1CaChannelFsm::Event_gps_valid_acquisition() {
this->process_event(Ev_gps_channel_valid_acquisition());
}
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_repeat()
{
this->process_event(Ev_gps_channel_failed_acquisition_repeat());
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_repeat() {
this->process_event(Ev_gps_channel_failed_acquisition_repeat());
}
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_no_repeat()
{
this->process_event(Ev_gps_channel_failed_acquisition_no_repeat());
void GpsL1CaChannelFsm::Event_gps_failed_acquisition_no_repeat() {
this->process_event(Ev_gps_channel_failed_acquisition_no_repeat());
}
void GpsL1CaChannelFsm::Event_gps_failed_tracking()
{
this->process_event(Ev_gps_channel_failed_tracking());
void GpsL1CaChannelFsm::Event_gps_failed_tracking_standby() {
this->process_event(Ev_gps_channel_failed_tracking_standby());
}
//void GpsL1CaChannelFsm::Event_gps_failed_tracking_reacq() {
// this->process_event(Ev_gps_channel_failed_tracking_reacq());
//}
void GpsL1CaChannelFsm::set_acquisition(AcquisitionInterface *acquisition)
{
acq_ = acquisition;
void GpsL1CaChannelFsm::set_acquisition(AcquisitionInterface *acquisition) {
acq_ = acquisition;
}
void GpsL1CaChannelFsm::set_tracking(TrackingInterface *tracking)
{
trk_ = tracking;
void GpsL1CaChannelFsm::set_tracking(TrackingInterface *tracking) {
trk_ = tracking;
}
void GpsL1CaChannelFsm::set_queue(gr_msg_queue_sptr queue)
{
queue_ = queue;
void GpsL1CaChannelFsm::set_queue(gr_msg_queue_sptr queue) {
queue_ = queue;
}
void GpsL1CaChannelFsm::set_channel(unsigned int channel)
{
channel_ = channel;
void GpsL1CaChannelFsm::set_channel(unsigned int channel) {
channel_ = channel;
}
void GpsL1CaChannelFsm::start_acquisition()
{
acq_->reset();
void GpsL1CaChannelFsm::start_acquisition() {
acq_->reset();
}
void GpsL1CaChannelFsm::start_tracking()
{
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
//<< " passing prn code phase " << acq_->prn_code_phase();
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
//<< " passing doppler freq shift " << acq_->doppler_freq_shift();
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
//<< " passing acquisition sample stamp "
//<< acq_->get_sample_stamp();
//trk_->set_prn_code_phase(acq_->prn_code_phase());
//trk_->set_doppler_freq_shift(acq_->doppler_freq_shift());
//trk_->set_acq_sample_stamp(acq_->get_sample_stamp());
trk_->start_tracking();
void GpsL1CaChannelFsm::start_tracking() {
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
//<< " passing prn code phase " << acq_->prn_code_phase();
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
//<< " passing doppler freq shift " << acq_->doppler_freq_shift();
//LOG_AT_LEVEL(INFO) << "Channel " << channel_
//<< " passing acquisition sample stamp "
//<< acq_->get_sample_stamp();
//trk_->set_prn_code_phase(acq_->prn_code_phase());
//trk_->set_doppler_freq_shift(acq_->doppler_freq_shift());
//trk_->set_acq_sample_stamp(acq_->get_sample_stamp());
trk_->start_tracking();
ControlMessageFactory* cmf = new ControlMessageFactory();
if (queue_ != gr_msg_queue_sptr()) {
queue_->handle(cmf->GetQueueMessage(channel_, 1));
}
delete cmf;
}
void GpsL1CaChannelFsm::request_satellite()
{
ControlMessageFactory* cmf = new ControlMessageFactory();
if (queue_ != gr_msg_queue_sptr())
{
queue_->handle(cmf->GetQueueMessage(channel_, 0));
}
delete cmf;
void GpsL1CaChannelFsm::request_satellite() {
ControlMessageFactory* cmf = new ControlMessageFactory();
if (queue_ != gr_msg_queue_sptr()) {
queue_->handle(cmf->GetQueueMessage(channel_, 0));
}
delete cmf;
}

View File

@ -80,7 +80,8 @@ public:
void Event_gps_valid_acquisition();
void Event_gps_failed_acquisition_repeat();
void Event_gps_failed_acquisition_no_repeat();
void Event_gps_failed_tracking();
//void Event_gps_failed_tracking_reacq();
void Event_gps_failed_tracking_standby();
private:
AcquisitionInterface *acq_;

View File

@ -463,7 +463,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
// ###### TRACKING UNLOCK NOTIFICATION #####
int tracking_message;
//int tracking_message;
if (d_carrier_lock_test < d_carrier_lock_threshold or d_carrier_lock_test > MINIMUM_VALID_CN0)
{
d_carrier_lock_fail_counter++;
@ -475,8 +475,13 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
{
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl;
tracking_message = 3; //loss of lock
d_channel_internal_queue->push(tracking_message);
// tracking_message = 3; //loss of lock
// d_channel_internal_queue->push(tracking_message);
ControlMessageFactory* cmf = new ControlMessageFactory();
if (d_queue != gr_msg_queue_sptr()) {
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
}
delete cmf;
d_carrier_lock_fail_counter = 0;
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
}

View File

@ -471,7 +471,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in);
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
// ###### TRACKING UNLOCK NOTIFICATION #####
int tracking_message;
//int tracking_message;
if (d_carrier_lock_test < d_carrier_lock_threshold or d_carrier_lock_test > MINIMUM_VALID_CN0)
{
d_carrier_lock_fail_counter++;
@ -483,8 +483,13 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
{
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ;
tracking_message = 3; //loss of lock
d_channel_internal_queue->push(tracking_message);
//tracking_message = 3; //loss of lock
//d_channel_internal_queue->push(tracking_message);
ControlMessageFactory* cmf = new ControlMessageFactory();
if (d_queue != gr_msg_queue_sptr()) {
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
}
delete cmf;
d_carrier_lock_fail_counter = 0;
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine

View File

@ -57,6 +57,7 @@ public:
virtual void start_acquisition() = 0;
virtual void set_signal(Gnss_Signal) = 0;
virtual void start() = 0;
virtual void standby() = 0;
virtual void stop() = 0;
};

View File

@ -2,7 +2,7 @@
* \file gnss_flowgraph.cc
* \brief Implementation of a GNSS receiver flowgraph
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
*
* Detailed description of the file here if needed.
*
@ -90,8 +90,15 @@ void GNSSFlowgraph::start() {
void GNSSFlowgraph::stop() {
for (unsigned int i = 0; i < channels_count_; i++) {
// if(channels_state_[i]==2) channel(i)->
channel(i)->stop();
}
for (unsigned int i = 0; i < channels_count_; i++) {
std::cout << "Channel " << i << " in state " << channels_state_[i]
<< std::endl;
}
DLOG(INFO) << "Threads finished. Return to main program.";
top_block_->stop();
running_ = false;
@ -216,10 +223,15 @@ void GNSSFlowgraph::connect() {
<< available_GNSS_signals_.front() << std::endl;
available_GNSS_signals_.pop_front();
channel(i)->start();
//channel(i)->start_acquisition();
if (channels_state_[i] == 1) {
channel(i)->start_acquisition();
DLOG(INFO) << "Channel " << i
<< " connected to observables and ready for acquisition";
} else {
DLOG(INFO) << "Channel " << i
<< " connected to observables in standby mode";
}
DLOG(INFO) << "Channel " << i
<< " connected to observables and ready for acquisition";
}
/*
* Connect the observables output of each channel to the PVT block
@ -285,6 +297,50 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) {
break;
// TODO: Tracking messages
case 1:
LOG_AT_LEVEL(INFO) << "Channel " << who << " ACQ SUCCESS satellite "
<< channel(who)->get_signal().get_satellite();
channels_state_[who] = 2;
acq_channels_count_--;
if (acq_channels_count_ < max_acq_channels_) {
for (unsigned int i = 0; i < channels_count_; i++) {
if (channels_state_[i] == 0) {
channels_state_[i] = 1;
acq_channels_count_++;
channel(i)->start_acquisition();
break;
}
}
}
for (unsigned int i = 0; i < channels_count_; i++) {
std::cout << "Channel " << i << " in state " << channels_state_[i]
<< std::endl;
}
break;
case 2:
LOG_AT_LEVEL(INFO) << "Channel " << who << " TRK FAILED satellite "
<< channel(who)->get_signal().get_satellite();
if (acq_channels_count_ < max_acq_channels_) {
channels_state_[who] = 1;
acq_channels_count_++;
channel(who)->start_acquisition();
}else {
channels_state_[who] = 0;
channel(who)->standby();
}
for (unsigned int i = 0; i < channels_count_; i++) {
std::cout << "Channel " << i << " in state " << channels_state_[i]
<< std::endl;
}
break;
default:
break;
}
@ -360,6 +416,8 @@ void GNSSFlowgraph::init() {
set_signals_list();
set_channels_state();
applied_actions_ = 0;
DLOG(INFO) << "Blocks instantiated. " << channels_count_ << " channels.";
@ -376,7 +434,7 @@ void GNSSFlowgraph::set_signals_list() {
* See http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf (page 5)
*/
std::set<unsigned int> available_gps_prn = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28,
29, 30, 31, 32 };
std::set<unsigned int>::iterator available_gps_prn_iter;
@ -390,12 +448,12 @@ void GNSSFlowgraph::set_signals_list() {
for (available_gps_prn_iter = available_gps_prn.begin(); available_gps_prn_iter
!= available_gps_prn.end(); available_gps_prn_iter++) {
signal_value = Gnss_Signal(Gnss_Satellite(std::string("GPS"), *available_gps_prn_iter),std::string("1C"));
signal_value = Gnss_Signal(Gnss_Satellite(std::string("GPS"),
*available_gps_prn_iter), std::string("1C"));
available_GNSS_signals_.push_back(signal_value);
}
std::list<Gnss_Signal>::iterator gnss_it =
available_GNSS_signals_.begin();
std::list<Gnss_Signal>::iterator gnss_it = available_GNSS_signals_.begin();
for (unsigned int i = 0; i < channels_count_; i++) {
std::string default_system = "GPS";
@ -410,24 +468,54 @@ void GNSSFlowgraph::set_signals_list() {
unsigned int sat = configuration_->property("Channel"
+ boost::lexical_cast<std::string>(i) + ".satellite", 0);
if ((sat == 0) || (sat == gnss_it->get_satellite().get_PRN())) // 0 = not PRN in configuration file
{
gnss_it++;
} else {
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat),gnss_signal);
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat),
gnss_signal);
available_GNSS_signals_.remove(signal_value);
available_GNSS_signals_.insert(gnss_it, signal_value);
}
}
std::cout << "Signal queue: " << std::endl;
for (std::list<Gnss_Signal>::iterator it =
available_GNSS_signals_.begin(); it
!= available_GNSS_signals_.end(); it++) {
std::cout << *it << std::endl;
/* std::cout << "Signal queue: " << std::endl;
for (std::list<Gnss_Signal>::iterator it =
available_GNSS_signals_.begin(); it
!= available_GNSS_signals_.end(); it++) {
std::cout << *it << std::endl;
}*/
}
void GNSSFlowgraph::set_channels_state() {
max_acq_channels_ = (configuration_->property("Channels.in_acquisition",
channels_count_));
if (max_acq_channels_ > channels_count_) {
max_acq_channels_ = channels_count_;
std::cout
<< "Channels_in_acquisition is bigger than number of channels. Variable acq_channels_count_ is set to "
<< channels_count_ << std::endl;
}
channels_state_.reserve(channels_count_);
for (unsigned int i = 0; i < channels_count_; i++) {
if (i < max_acq_channels_) {
channels_state_.push_back(1);
} else
channels_state_.push_back(0);
}
acq_channels_count_ = max_acq_channels_;
DLOG(INFO) << acq_channels_count_ << " channels in acquisition state";
for (unsigned int i = 0; i < channels_count_; i++) {
std::cout << "Channel " << i << " in state " << channels_state_[i]
<< std::endl;
}
}
void GNSSFlowgraph::apply_action(unsigned int what) {

View File

@ -118,10 +118,13 @@ private:
void init();
void apply_action(unsigned int what);
void set_signals_list();
void set_channels_state();
bool connected_;
bool running_;
unsigned int channels_count_;
unsigned int acq_channels_count_;
unsigned int max_acq_channels_;
unsigned int applied_actions_;
std::string config_file_;
@ -135,7 +138,7 @@ private:
gr_msg_queue_sptr queue_;
std::list<Gnss_Signal> available_GNSS_signals_;
std::vector<unsigned int> channels_state_;
};
#endif /*GNSS_SDR_GNSS_FLOWGRAPH_H_*/