Merge branch 'next' of git+ssh://github.com/carlesfernandez/gnss-sdr

into next

# Conflicts:
#	src/core/system_parameters/rtcm.cc
#	src/core/system_parameters/rtcm.h
#	src/tests/formats/rtcm_test.cc
This commit is contained in:
Carles Fernandez 2015-11-24 00:44:19 +01:00
commit 0e8663a1fc
5 changed files with 57 additions and 14 deletions

View File

@ -118,7 +118,7 @@ InputFilter.number_of_bands=2
;#The number of band_begin and band_end elements must match the number of bands
InputFilter.band1_begin=0.0
InputFilter.band1_end=0.45
InputFilter.band1_end=0.44
InputFilter.band2_begin=0.55
InputFilter.band2_end=1.0
@ -159,6 +159,7 @@ InputFilter.IF=0
;Resampler.implementation=Direct_Resampler
Resampler.implementation=Pass_Through
;#dump: Dump the resamplered data to a file.
Resampler.dump=false
;#dump_filename: Log path and filename.
@ -169,10 +170,10 @@ Resampler.item_type=gr_complex
;Resampler.item_type=cbyte
;#sample_freq_in: the sample frequency of the input signal
Resampler.sample_freq_in=8000000
Resampler.sample_freq_in=4000000
;#sample_freq_out: the desired sample frequency of the output signal
Resampler.sample_freq_out=4000000
Resampler.sample_freq_out=2000000
;######### CHANNELS GLOBAL CONFIG ############
@ -289,9 +290,9 @@ PVT.output_rate_ms=10
;#display_rate_ms: Position console print (std::out) interval [ms]. Notice that output_rate_ms<=display_rate_ms.
PVT.display_rate_ms=500
;# RINEX, KML, and NMEA output configuration
;# KML, GeoJSON and NMEA output configuration
;#dump_filename: Log path and filename without extension. Notice that PVT will add ".dat" to the binary dump and ".kml" to GoogleEarth dump.
;#dump_filename: Log path and filename without extension. Notice that PVT will add ".dat" to the binary dump, ".kml" and ".geojson" to GIS-friendly formats.
PVT.dump_filename=./PVT
;#nmea_dump_filename: NMEA log path and filename

View File

@ -73,16 +73,20 @@ float cn0_svn_estimator(gr_complex* Prompt_buffer, int length, long fs_in, doubl
float SNR_dB_Hz = 0;
float Psig = 0;
float Ptot = 0;
float Psig2, Ptot2, SNR_dB_Hz2; Psig2=0; Ptot2=0;
for (int i=0; i<length; i++)
{
Psig += std::abs(Prompt_buffer[i].real());
Psig += Prompt_buffer[i].real() * Prompt_buffer[i].real(); //std::abs(Prompt_buffer[i].real());
Psig2 += std::abs(Prompt_buffer[i].real());
Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real();
}
Psig = Psig / (float)length;
Psig = Psig * Psig;
Ptot = Ptot / (float)length;
Psig2 = Psig2 / (float)length;//
Psig2 = Psig2 * Psig2;//
Ptot2 = Ptot / (float)length;//
SNR = Psig / (Ptot - Psig);
SNR_dB_Hz = 10 * log10(SNR) + 10 * log10(fs_in/2) - 10 * log10((float)code_length);
SNR_dB_Hz = 10 * log10(Psig2 / (Ptot2 - Psig2)) + 10 * log10(fs_in/2) - 10 * log10((float)code_length * 1023000 /fs_in ); // 10 * log10(SNR) + 10 * log10(fs_in/2) - 10 * log10((float)code_length);
SNR_dB_Hz2 = 10 * log10(Psig2 / (Ptot2 - Psig2)) + 10 * log10(fs_in/2) - 10 * log10((float)code_length);
//std::cout << "CNO = " << SNR_dB_Hz << " old: " << SNR_dB_Hz2 << " code_length: " << code_length << std::endl;
return SNR_dB_Hz;
}

View File

@ -134,7 +134,6 @@ std::string Rtcm::bin_to_hex(const std::string& s)
unsigned n = bs.to_ulong();
ss << std::hex << n;
}
return boost::to_upper_copy(ss.str());
}
@ -335,7 +334,6 @@ std::bitset<58> Rtcm::get_MT1001_sat_content(const Gnss_Synchro & gnss_synchro)
}
std::string Rtcm::print_MT1001(const Gps_Ephemeris & gps_eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges)
{
unsigned int ref_id = static_cast<unsigned int>(FLAGS_RTCM_Ref_Station_ID);
@ -351,8 +349,7 @@ std::string Rtcm::print_MT1001(const Gps_Ephemeris & gps_eph, double obs_time, c
pseudoranges_iter != pseudoranges.end();
pseudoranges_iter++)
{
std::bitset<58> content = Rtcm::get_MT1001_sat_content(pseudoranges_iter->second);
std::bitset<58> content = Rtcm::get_M1001_sat_content(pseudoranges_iter->second);
data += content.to_string();
}
@ -420,6 +417,42 @@ std::bitset<152> Rtcm::get_MT1005_test ()
return test_msg;
}
std::string Rtcm::print_M1005( unsigned int ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, unsigned int quarter_cycle_indicator)
{
unsigned int msg_number = 1005;
std::bitset<1> DF001_;
Rtcm::set_DF002(msg_number);
Rtcm::set_DF003(ref_id);
Rtcm::set_DF021();
Rtcm::set_DF022(gps);
Rtcm::set_DF023(glonass);
Rtcm::set_DF024(galileo);
DF141 = std::bitset<1>(non_physical);
DF001_ = std::bitset<1>("0");
Rtcm::set_DF025(ecef_x);
DF142 = std::bitset<1>(single_oscillator);
Rtcm::set_DF026(ecef_y);
DF364 = std::bitset<2>(quarter_cycle_indicator);
Rtcm::set_DF027(ecef_z);
std::string data = DF002.to_string() +
DF003.to_string() +
DF021.to_string() +
DF022.to_string() +
DF023.to_string() +
DF024.to_string() +
DF141.to_string() +
DF025.to_string() +
DF142.to_string() +
DF001_.to_string() +
DF026.to_string() +
DF364.to_string() +
DF027.to_string() ;
std::string message = build_message(data);
return message;
}
std::string Rtcm::print_MT1005( unsigned int ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, unsigned int quarter_cycle_indicator)
{

View File

@ -97,6 +97,7 @@ public:
std::string print_MT1005_test(); //<! For testing purposes
bool check_CRC(const std::string & message); //<! Checks that the CRC of a RTCM package is correct
private:
//
// Messages

View File

@ -173,6 +173,10 @@ TEST(Rtcm_Test, Test_MT1005)
EXPECT_EQ(0, reference_msg.compare(reference_msg2));
std::string reference_msg2 = rtcm->print_M1005(2003, 1114104.5999, -4850729.7108, 3975521.4643, true, false, false, false, false, 0);
EXPECT_EQ(0, reference_msg.compare(reference_msg2));
unsigned int ref_id;
double ecef_x;
double ecef_y;