1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Fix telemetry test

This commit is contained in:
Carles Fernandez 2017-07-12 21:54:47 +02:00
parent 4ba0dd63cb
commit 196d84aca3
2 changed files with 15 additions and 8 deletions

View File

@ -35,7 +35,7 @@ bool tlm_dump_reader::read_binary_obs()
try
{
d_dump_file.read((char *) &TOW_at_current_symbol, sizeof(double));
d_dump_file.read((char *) &Tracking_sample_counter, sizeof(double));
d_dump_file.read((char *) &Tracking_sample_counter, sizeof(unsigned long int));
d_dump_file.read((char *) &d_TOW_at_Preamble, sizeof(double));
}
catch (const std::ifstream::failure &e)
@ -62,8 +62,8 @@ bool tlm_dump_reader::restart()
long int tlm_dump_reader::num_epochs()
{
std::ifstream::pos_type size;
int number_of_vars_in_epoch = 3;
int epoch_size_bytes = sizeof(double) * number_of_vars_in_epoch;
int number_of_vars_in_epoch = 2;
int epoch_size_bytes = sizeof(double) * number_of_vars_in_epoch + sizeof(unsigned long int);
std::ifstream tmpfile( d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
if (tmpfile.is_open())
{

View File

@ -215,6 +215,7 @@ public:
size_t item_size;
};
int GpsL1CATelemetryDecoderTest::configure_generator()
{
// Configure signal generator
@ -279,24 +280,29 @@ void GpsL1CATelemetryDecoderTest::configure_receiver()
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
config->set_property("TelemetryDecoder_1C.dump","true");
config->set_property("TelemetryDecoder_1C.decimation_factor","1");
}
void GpsL1CATelemetryDecoderTest::check_results(arma::vec & true_time_s,
arma::vec & true_value,
arma::vec & meas_time_s,
arma::vec & meas_value)
{
//1. True value interpolation to match the measurement times
arma::vec true_value_interp;
arma::uvec true_time_s_valid = find(true_time_s > 0);
true_time_s = true_time_s(true_time_s_valid);
true_value = true_value(true_time_s_valid);
arma::uvec meas_time_s_valid = find(meas_time_s > 0);
meas_time_s = meas_time_s(meas_time_s_valid);
meas_value = meas_value(meas_time_s_valid);
arma::interp1(true_time_s, true_value, meas_time_s, true_value_interp);
//2. RMSE
arma::vec err;
err = meas_value - true_value_interp;
err = meas_value - true_value_interp + 0.001;
arma::vec err2 = arma::square(err);
double rmse = sqrt(arma::mean(err2));
@ -326,6 +332,7 @@ void GpsL1CATelemetryDecoderTest::check_results(arma::vec & true_time_s,
ASSERT_GT(min_error, -0.5E-6);
}
TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
{
// Configure the signal generator
@ -468,7 +475,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
//Cut measurement initial transitory of the measurements
arma::uvec initial_meas_point = arma::find(tlm_tow_s >= true_tow_s(0), 1, "first");
ASSERT_EQ(initial_meas_point.is_empty(), false);
tlm_timestamp_s = tlm_timestamp_s.subvec(initial_meas_point(0), tlm_timestamp_s.size() - 1);
tlm_tow_s = tlm_tow_s.subvec(initial_meas_point(0), tlm_tow_s.size() - 1);