Removed redundant state from the receiver

This commit is contained in:
piotr 2014-08-06 15:20:33 +02:00
parent 82c774f772
commit d6d6687691
3 changed files with 11 additions and 33 deletions

View File

@ -72,7 +72,7 @@ receiver_impl::receiver_impl(feval_dd * tuner, int osr, int arfcn)
d_counter(0), d_counter(0),
d_fcch_start_pos(0), d_fcch_start_pos(0),
d_freq_offset_setting(0), d_freq_offset_setting(0),
d_state(first_fcch_search), d_state(fcch_search),
d_burst_nr(osr), d_burst_nr(osr),
d_failed_sch(0), d_failed_sch(0),
d_arfcn((int)(arfcn)), d_arfcn((int)(arfcn)),
@ -135,36 +135,20 @@ receiver_impl::work(int noutput_items,
switch (d_state) switch (d_state)
{ {
//bootstrapping //bootstrapping
case first_fcch_search: case fcch_search: //this state is used because it takes some time (a bunch of buffered samples)
DCOUT("FCCH search");
double freq_offset_tmp;
if (find_fcch_burst(input, noutput_items, freq_offset_tmp)) //find frequency correction burst in the input buffer
{
pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(freq_offset_tmp-d_freq_offset_setting),pmt::mp("first_fcch_search"));
message_port_pub(pmt::mp("measurements"), msg);
d_state = next_fcch_search;
}
else
{
d_state = first_fcch_search;
}
break;
case next_fcch_search: //this state is used because it takes some time (a bunch of buffered samples)
{ {
DCOUT("NEXT FCCH search"); DCOUT("FCCH search");
double freq_offset_tmp; double freq_offset_tmp;
if (find_fcch_burst(input, noutput_items,freq_offset_tmp)) if (find_fcch_burst(input, noutput_items,freq_offset_tmp))
{ {
pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(freq_offset_tmp-d_freq_offset_setting),pmt::mp("next_fcch_search")); pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(freq_offset_tmp-d_freq_offset_setting),pmt::mp("fcch_search"));
message_port_pub(pmt::mp("measurements"), msg); message_port_pub(pmt::mp("measurements"), msg);
d_state = sch_search; d_state = sch_search;
} }
else else
{ {
d_state = next_fcch_search; d_state = fcch_search;
} }
break; break;
} }
@ -193,7 +177,7 @@ receiver_impl::work(int noutput_items,
} }
else else
{ {
d_state = next_fcch_search; //if there is error in the sch burst go back to fcch search phase d_state = fcch_search; //if there is error in the sch burst go back to fcch search phase
} }
} }
else else
@ -239,11 +223,6 @@ receiver_impl::work(int noutput_items,
int t1, t2, t3, d_ncc, d_bcc; int t1, t2, t3, d_ncc, d_bcc;
burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response burst_start = get_sch_chan_imp_resp(input, &channel_imp_resp[0]); //get channel impulse response
if(d_prev_burst_start != burst_start){
d_prev_burst_start = burst_start;
DCOUT("burst start" << burst_start);
}
detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits detect_burst(input, &channel_imp_resp[0], burst_start, output_binary); //MLSE detection of bits
send_burst(d_burst_nr, output_binary, b_type); send_burst(d_burst_nr, output_binary, b_type);
if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //and decode SCH data if (decode_sch(&output_binary[3], &t1, &t2, &t3, &d_ncc, &d_bcc) == 0) //and decode SCH data
@ -260,7 +239,7 @@ receiver_impl::work(int noutput_items,
d_failed_sch++; d_failed_sch++;
if (d_failed_sch >= MAX_SCH_ERRORS) if (d_failed_sch >= MAX_SCH_ERRORS)
{ {
d_state = next_fcch_search; d_state = fcch_search;
pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(0.0),pmt::mp("sync_loss")); pmt::pmt_t msg = pmt::make_tuple(pmt::mp("freq_offset"),pmt::from_double(0.0),pmt::mp("sync_loss"));
message_port_pub(pmt::mp("measurements"), msg); message_port_pub(pmt::mp("measurements"), msg);
DCOUT("Re-Synchronization!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); DCOUT("Re-Synchronization!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
@ -850,7 +829,7 @@ void receiver_impl::set_arfcn(int arfcn) //!!
void receiver_impl::reset() void receiver_impl::reset()
{ {
d_state = first_fcch_search; d_state = fcch_search;
} }
} /* namespace gsm */ } /* namespace gsm */

View File

@ -34,7 +34,6 @@ namespace gr {
class receiver_impl : public receiver class receiver_impl : public receiver
{ {
private: private:
int d_prev_burst_start; //!!
/**@name Configuration of the receiver */ /**@name Configuration of the receiver */
//@{ //@{
const int d_OSR; ///< oversampling ratio const int d_OSR; ///< oversampling ratio
@ -60,7 +59,6 @@ namespace gr {
/**@name Variables used to store result of the find_fcch_burst fuction */ /**@name Variables used to store result of the find_fcch_burst fuction */
//@{ //@{
unsigned d_fcch_start_pos; ///< position of the first sample of the fcch burst unsigned d_fcch_start_pos; ///< position of the first sample of the fcch burst
// float d_freq_offset; ///< frequency offset of the received signal
float d_freq_offset_setting; ///< frequency offset set in frequency shifter located upstream float d_freq_offset_setting; ///< frequency offset set in frequency shifter located upstream
//@} //@}
std::list<double> d_freq_offset_vals; std::list<double> d_freq_offset_vals;
@ -74,7 +72,7 @@ namespace gr {
/**@name Internal state of the gsm receiver */ /**@name Internal state of the gsm receiver */
//@{ //@{
enum states { enum states {
first_fcch_search, next_fcch_search, sch_search, // synchronization search part fcch_search, sch_search, // synchronization search part
synchronized // receiver is synchronized in this state synchronized // receiver is synchronized in this state
} d_state; } d_state;
//@} //@}

View File

@ -50,7 +50,7 @@ class clock_offset_control(gr.basic_block):
ppm = -freq_offset/self.fc*1.0e6 ppm = -freq_offset/self.fc*1.0e6
state = pmt.symbol_to_string(pmt.tuple_ref(msg,2)) state = pmt.symbol_to_string(pmt.tuple_ref(msg,2))
if state == "first_fcch_search" or state == "next_fcch_search": if state == "fcch_search":
msg_ppm = pmt.from_double(ppm) msg_ppm = pmt.from_double(ppm)
self.message_port_pub(pmt.intern("ppm"), msg_ppm) self.message_port_pub(pmt.intern("ppm"), msg_ppm)
@ -74,3 +74,4 @@ class clock_offset_control(gr.basic_block):
self.first_measurement = True self.first_measurement = True
msg_ppm = pmt.from_double(0.0) msg_ppm = pmt.from_double(0.0)
self.message_port_pub(pmt.intern("ppm"), msg_ppm) self.message_port_pub(pmt.intern("ppm"), msg_ppm)