mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-03-05 19:18:16 +00:00
Observable unit test updated and upgraded to test both code and carrier phase observables. It requires the latest version of gnss-sim, please update the simulator
This commit is contained in:
parent
d4c9d378c9
commit
365ff3a18b
@ -40,6 +40,7 @@ bool true_observables_reader::read_binary_obs()
|
||||
d_dump_file.read((char *) &doppler_l1_hz, sizeof(double));
|
||||
d_dump_file.read((char *) &acc_carrier_phase_l1_cycles[i], sizeof(double));
|
||||
d_dump_file.read((char *) &dist_m[i], sizeof(double));
|
||||
d_dump_file.read((char *) &true_dist_m[i], sizeof(double));
|
||||
d_dump_file.read((char *) &carrier_phase_l1_cycles[i], sizeof(double));
|
||||
d_dump_file.read((char *) &prn[i], sizeof(double));
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
double doppler_l1_hz[12];
|
||||
double acc_carrier_phase_l1_cycles[12];
|
||||
double dist_m[12];
|
||||
double true_dist_m[12];
|
||||
double carrier_phase_l1_cycles[12];
|
||||
double prn[12];
|
||||
|
||||
|
@ -194,7 +194,14 @@ public:
|
||||
|
||||
int configure_generator();
|
||||
int generate_signal();
|
||||
void check_results(
|
||||
void check_results_carrier_phase(
|
||||
arma::vec & true_ch0_phase_cycles,
|
||||
arma::vec & true_ch1_phase_cycles,
|
||||
arma::vec & true_ch0_tow_s,
|
||||
arma::vec & measuded_ch0_phase_cycles,
|
||||
arma::vec & measuded_ch1_phase_cycles,
|
||||
arma::vec & measuded_ch0_RX_time_s);
|
||||
void check_results_code_psudorange(
|
||||
arma::vec & true_ch0_dist_m, arma::vec & true_ch1_dist_m,
|
||||
arma::vec & true_ch0_tow_s,
|
||||
arma::vec & measuded_ch0_Pseudorange_m,
|
||||
@ -288,21 +295,99 @@ void HybridObservablesTest::configure_receiver()
|
||||
config->set_property("Tracking_1C.if", "0");
|
||||
config->set_property("Tracking_1C.dump", "true");
|
||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", "20.0");
|
||||
config->set_property("Tracking_1C.dll_bw_hz", "1.5");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", "15.0");
|
||||
config->set_property("Tracking_1C.dll_bw_hz", "0.5");
|
||||
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");
|
||||
|
||||
config->set_property("Observables.history_depth","500");
|
||||
config->set_property("Observables.dump","true");
|
||||
|
||||
|
||||
}
|
||||
|
||||
void HybridObservablesTest::check_results(
|
||||
void HybridObservablesTest::check_results_carrier_phase(
|
||||
arma::vec & true_ch0_phase_cycles,
|
||||
arma::vec & true_ch1_phase_cycles,
|
||||
arma::vec & true_ch0_tow_s,
|
||||
arma::vec & measuded_ch0_phase_cycles,
|
||||
arma::vec & measuded_ch1_phase_cycles,
|
||||
arma::vec & measuded_ch0_RX_time_s)
|
||||
{
|
||||
//1. True value interpolation to match the measurement times
|
||||
|
||||
arma::vec true_ch0_phase_interp;
|
||||
arma::vec true_ch1_phase_interp;
|
||||
arma::interp1(true_ch0_tow_s, true_ch0_phase_cycles, measuded_ch0_RX_time_s, true_ch0_phase_interp);
|
||||
arma::interp1(true_ch0_tow_s, true_ch1_phase_cycles, measuded_ch0_RX_time_s, true_ch1_phase_interp);
|
||||
|
||||
//2. RMSE
|
||||
arma::vec err_ch0_cycles;
|
||||
arma::vec err_ch1_cycles;
|
||||
|
||||
//compute error without the accumulated carrier phase offsets (which depends on the receiver starting time)
|
||||
err_ch0_cycles = measuded_ch0_phase_cycles - true_ch0_phase_interp - measuded_ch0_phase_cycles(0) + true_ch0_phase_interp(0);
|
||||
err_ch1_cycles = measuded_ch1_phase_cycles - true_ch1_phase_interp - measuded_ch1_phase_cycles(0) + true_ch1_phase_interp(0);
|
||||
|
||||
arma::vec err2_ch0 = arma::square(err_ch0_cycles);
|
||||
double rmse_ch0 = sqrt(arma::mean(err2_ch0));
|
||||
|
||||
//3. Mean err and variance
|
||||
double error_mean_ch0 = arma::mean(err_ch0_cycles);
|
||||
double error_var_ch0 = arma::var(err_ch0_cycles);
|
||||
|
||||
// 4. Peaks
|
||||
double max_error_ch0 = arma::max(err_ch0_cycles);
|
||||
double min_error_ch0 = arma::min(err_ch0_cycles);
|
||||
|
||||
arma::vec err2_ch1 = arma::square(err_ch1_cycles);
|
||||
double rmse_ch1 = sqrt(arma::mean(err2_ch1));
|
||||
|
||||
//3. Mean err and variance
|
||||
double error_mean_ch1 = arma::mean(err_ch1_cycles);
|
||||
double error_var_ch1 = arma::var(err_ch1_cycles);
|
||||
|
||||
// 4. Peaks
|
||||
double max_error_ch1 = arma::max(err_ch1_cycles);
|
||||
double min_error_ch1 = arma::min(err_ch1_cycles);
|
||||
|
||||
|
||||
//5. report
|
||||
std::streamsize ss = std::cout.precision();
|
||||
std::cout << std::setprecision(10) << "Channel 0 Carrier phase RMSE="
|
||||
<< rmse_ch0 << ", mean=" << error_mean_ch0
|
||||
<< ", stdev=" << sqrt(error_var_ch0)
|
||||
<< " (max,min)=" << max_error_ch0
|
||||
<< "," << min_error_ch0
|
||||
<< " [cycles]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
|
||||
ASSERT_LT(rmse_ch0, 1e-2);
|
||||
ASSERT_LT(error_mean_ch0, 1e-2);
|
||||
ASSERT_GT(error_mean_ch0, -1e-2);
|
||||
ASSERT_LT(error_var_ch0, 1e-2);
|
||||
ASSERT_LT(max_error_ch0, 5e-2);
|
||||
ASSERT_GT(min_error_ch0, -5e-2);
|
||||
|
||||
//5. report
|
||||
ss = std::cout.precision();
|
||||
std::cout << std::setprecision(10) << "Channel 1 Carrier phase RMSE="
|
||||
<< rmse_ch1 << ", mean=" << error_mean_ch1
|
||||
<< ", stdev=" << sqrt(error_var_ch1)
|
||||
<< " (max,min)=" << max_error_ch1
|
||||
<< "," << min_error_ch1
|
||||
<< " [cycles]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
|
||||
ASSERT_LT(rmse_ch1, 1e-2);
|
||||
ASSERT_LT(error_mean_ch1, 1e-2);
|
||||
ASSERT_GT(error_mean_ch1, -1e-2);
|
||||
ASSERT_LT(error_var_ch1, 1e-2);
|
||||
ASSERT_LT(max_error_ch1, 5e-2);
|
||||
ASSERT_GT(min_error_ch1, -5e-2);
|
||||
|
||||
}
|
||||
|
||||
void HybridObservablesTest::check_results_code_psudorange(
|
||||
arma::vec & true_ch0_dist_m,
|
||||
arma::vec & true_ch1_dist_m,
|
||||
arma::vec & true_ch0_tow_s,
|
||||
@ -318,10 +403,6 @@ void HybridObservablesTest::check_results(
|
||||
arma::interp1(true_ch0_tow_s, true_ch1_dist_m, measuded_ch0_RX_time_s, true_ch1_dist_interp);
|
||||
|
||||
// generate delta pseudoranges
|
||||
std::cout<<"s1:"<<true_ch0_dist_m.size()<<std::endl;
|
||||
std::cout<<"s2:"<<true_ch1_dist_m.size()<<std::endl;
|
||||
std::cout<<"s3:"<<measuded_ch0_Pseudorange_m.size()<<std::endl;
|
||||
std::cout<<"s4:"<<measuded_ch1_Pseudorange_m.size()<<std::endl;
|
||||
arma::vec delta_true_dist_m = true_ch0_dist_interp-true_ch1_dist_interp;
|
||||
arma::vec delta_measured_dist_m = measuded_ch0_Pseudorange_m-measuded_ch1_Pseudorange_m;
|
||||
|
||||
@ -352,12 +433,12 @@ void HybridObservablesTest::check_results(
|
||||
<< " [meters]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
|
||||
ASSERT_LT(rmse, 10E-3);
|
||||
ASSERT_LT(error_mean, 10E-3);
|
||||
ASSERT_GT(error_mean, 10E-3);
|
||||
ASSERT_LT(error_var, 10E-3);
|
||||
ASSERT_LT(max_error, 10E-3);
|
||||
ASSERT_GT(min_error, 10E-3);
|
||||
ASSERT_LT(rmse, 0.5);
|
||||
ASSERT_LT(error_mean, 0.5);
|
||||
ASSERT_GT(error_mean, -0.5);
|
||||
ASSERT_LT(error_var, 0.5);
|
||||
ASSERT_LT(max_error, 2);
|
||||
ASSERT_GT(min_error, -2);
|
||||
}
|
||||
|
||||
TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
@ -617,12 +698,40 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
|
||||
measuded_ch0_RX_time_s = measuded_ch0_RX_time_s.subvec(initial_meas_point(0), measuded_ch0_RX_time_s.size() - 1);
|
||||
measuded_ch0_Pseudorange_m = measuded_ch0_Pseudorange_m.subvec(initial_meas_point(0), measuded_ch0_Pseudorange_m.size() - 1);
|
||||
measuded_ch0_Acc_carrier_phase_hz = measuded_ch0_Acc_carrier_phase_hz.subvec(initial_meas_point(0), measuded_ch0_Acc_carrier_phase_hz.size() - 1);
|
||||
|
||||
measuded_ch1_RX_time_s = measuded_ch1_RX_time_s.subvec(initial_meas_point(0), measuded_ch1_RX_time_s.size() - 1);
|
||||
measuded_ch1_Pseudorange_m = measuded_ch1_Pseudorange_m.subvec(initial_meas_point(0), measuded_ch1_Pseudorange_m.size() - 1);
|
||||
measuded_ch1_Acc_carrier_phase_hz = measuded_ch1_Acc_carrier_phase_hz.subvec(initial_meas_point(0), measuded_ch1_Acc_carrier_phase_hz.size() - 1);
|
||||
|
||||
check_results(true_ch0_dist_m, true_ch1_dist_m, true_ch0_tow_s,
|
||||
|
||||
//correct the clock error using true values (it is not possible for a receiver to correct
|
||||
//the receiver clock offset error at the observables level because it is required the
|
||||
//decoding of the ephemeris data and solve the PVT equations)
|
||||
|
||||
//find the reference satellite and compute the receiver time offset at obsevable level
|
||||
arma::vec receiver_time_offset_s;
|
||||
if (measuded_ch0_Pseudorange_m(0)<measuded_ch1_Pseudorange_m(0))
|
||||
{
|
||||
receiver_time_offset_s=true_ch0_dist_m/GPS_C_m_s-GPS_STARTOFFSET_ms/1000.0;
|
||||
}else{
|
||||
receiver_time_offset_s=true_ch1_dist_m/GPS_C_m_s-GPS_STARTOFFSET_ms/1000.0;
|
||||
}
|
||||
arma::vec corrected_reference_TOW_s=true_ch0_tow_s-receiver_time_offset_s;
|
||||
|
||||
std::cout<<"receiver_time_offset_s [0]: "<<receiver_time_offset_s(0)<<std::endl;
|
||||
|
||||
//compare measured observables
|
||||
check_results_code_psudorange(true_ch0_dist_m, true_ch1_dist_m, corrected_reference_TOW_s,
|
||||
measuded_ch0_Pseudorange_m,measuded_ch1_Pseudorange_m, measuded_ch0_RX_time_s);
|
||||
|
||||
check_results_carrier_phase(true_ch0_acc_carrier_phase_cycles,
|
||||
true_ch1_acc_carrier_phase_cycles,
|
||||
corrected_reference_TOW_s,
|
||||
measuded_ch0_Acc_carrier_phase_hz,
|
||||
measuded_ch1_Acc_carrier_phase_hz,
|
||||
measuded_ch0_RX_time_s);
|
||||
|
||||
std::cout << "Test completed in " << (end - begin) << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -35,15 +35,15 @@ if ~exist('gps_l1_ca_dll_pll_read_tracking_dump.m','file')
|
||||
end
|
||||
|
||||
|
||||
samplingFreq = 5000000; %[Hz]
|
||||
channels = 7;
|
||||
samplingFreq = 2600000; %[Hz]
|
||||
channels = 2;
|
||||
first_channel = 0;
|
||||
|
||||
path = '/Users/carlesfernandez/git/cttc/build/'; %% CHANGE THIS PATH
|
||||
path = '/home/javier/git/gnss-sdr/build/'; %% CHANGE THIS PATH
|
||||
|
||||
for N=1:1:channels
|
||||
tracking_log_path = [path 'epl_tracking_ch_' num2str(N+first_channel-1) '.dat']; %% CHANGE epl_tracking_ch_ BY YOUR dump_filename
|
||||
GNSS_tracking(N)= gps_l1_ca_dll_pll_read_tracking_dump(tracking_log_path);
|
||||
tracking_log_path = [path 'tracking_ch_' num2str(N+first_channel-1) '.dat']; %% CHANGE epl_tracking_ch_ BY YOUR dump_filename
|
||||
GNSS_tracking(N)= gps_l1_ca_dll_pll_read_tracking_dump(tracking_log_path);
|
||||
end
|
||||
|
||||
% GNSS-SDR format conversion to MATLAB GPS receiver
|
||||
@ -64,7 +64,7 @@ for N=1:1:channels
|
||||
trackResults(N).I_L = GNSS_tracking(N).L.';
|
||||
trackResults(N).Q_E = zeros(1,length(GNSS_tracking(N).E));
|
||||
trackResults(N).Q_L = zeros(1,length(GNSS_tracking(N).E));
|
||||
trackResults(N).PRN = GNSS_tracking(N).PRN.';
|
||||
trackResults(N).PRN = ones(1,length(GNSS_tracking(N).E));
|
||||
|
||||
% Use original MATLAB tracking plot function
|
||||
settings.numberOfChannels = channels;
|
||||
|
@ -1,7 +1,9 @@
|
||||
% Read observables dump
|
||||
|
||||
%clear all;
|
||||
|
||||
clearvars;
|
||||
close all;
|
||||
addpath('./libs');
|
||||
samplingFreq = 2600000; %[Hz]
|
||||
channels=2;
|
||||
path='/home/javier/git/gnss-sdr/build/';
|
||||
@ -18,6 +20,7 @@ for n=1:1:channels
|
||||
end
|
||||
end
|
||||
|
||||
min_idx=min_idx;
|
||||
%plot observables from that index
|
||||
figure;
|
||||
plot(GNSS_observables.RX_time(1,min_idx+1:end),GNSS_observables.Pseudorange_m(:,min_idx+1:end)');
|
||||
@ -37,3 +40,76 @@ title('Doppler frequency')
|
||||
xlabel('TOW [s]')
|
||||
ylabel('[Hz]');
|
||||
|
||||
|
||||
%read true obs from simulator (optional)
|
||||
GPS_STARTOFFSET_s = 68.802e-3;
|
||||
|
||||
true_observables_log_path='/home/javier/git/gnss-sdr/build/obs_out.bin';
|
||||
GNSS_true_observables= read_true_sim_observables_dump(true_observables_log_path);
|
||||
|
||||
%correct the clock error using true values (it is not possible for a receiver to correct
|
||||
%the receiver clock offset error at the observables level because it is required the
|
||||
%decoding of the ephemeris data and solve the PVT equations)
|
||||
|
||||
SPEED_OF_LIGHT_M_S = 299792458.0;
|
||||
|
||||
%find the reference satellite
|
||||
[~,ref_sat_ch]=min(GNSS_observables.Pseudorange_m(:,min_idx+1));
|
||||
shift_time_s=GNSS_true_observables.Pseudorange_m(ref_sat_ch,:)/SPEED_OF_LIGHT_M_S-GPS_STARTOFFSET_s;
|
||||
|
||||
|
||||
%Compute deltas if required and interpolate to measurement time
|
||||
delta_true_psudorange_m=GNSS_true_observables.Pseudorange_m(1,:)-GNSS_true_observables.Pseudorange_m(2,:);
|
||||
delta_true_interp_psudorange_m=interp1(GNSS_true_observables.RX_time(1,:)-shift_time_s, ...
|
||||
delta_true_psudorange_m,GNSS_observables.RX_time(1,min_idx+1:end),'lineal','extrap');
|
||||
true_interp_acc_carrier_phase_ch1_hz=interp1(GNSS_true_observables.RX_time(1,:)-shift_time_s, ...
|
||||
GNSS_true_observables.Carrier_phase_hz(1,:),GNSS_observables.RX_time(1,min_idx+1:end),'lineal','extrap');
|
||||
true_interp_acc_carrier_phase_ch2_hz=interp1(GNSS_true_observables.RX_time(1,:)-shift_time_s, ...
|
||||
GNSS_true_observables.Carrier_phase_hz(2,:),GNSS_observables.RX_time(2,min_idx+1:end),'lineal','extrap');
|
||||
|
||||
%Compute measurement errors
|
||||
|
||||
delta_measured_psudorange_m=GNSS_observables.Pseudorange_m(1,min_idx+1:end)-GNSS_observables.Pseudorange_m(2,min_idx+1:end);
|
||||
psudorange_error_m=delta_measured_psudorange_m-delta_true_interp_psudorange_m;
|
||||
psudorange_rms_m=sqrt(sum(psudorange_error_m.^2)/length(psudorange_error_m))
|
||||
|
||||
acc_carrier_error_ch1_hz=GNSS_observables.Carrier_phase_hz(1,min_idx+1:end)-true_interp_acc_carrier_phase_ch1_hz...
|
||||
-GNSS_observables.Carrier_phase_hz(1,min_idx+1)+true_interp_acc_carrier_phase_ch1_hz(1);
|
||||
|
||||
acc_phase_rms_ch1_hz=sqrt(sum(acc_carrier_error_ch1_hz.^2)/length(acc_carrier_error_ch1_hz))
|
||||
|
||||
acc_carrier_error_ch2_hz=GNSS_observables.Carrier_phase_hz(2,min_idx+1:end)-true_interp_acc_carrier_phase_ch2_hz...
|
||||
-GNSS_observables.Carrier_phase_hz(2,min_idx+1)+true_interp_acc_carrier_phase_ch2_hz(1);
|
||||
acc_phase_rms_ch2_hz=sqrt(sum(acc_carrier_error_ch2_hz.^2)/length(acc_carrier_error_ch2_hz))
|
||||
|
||||
|
||||
%plot results
|
||||
figure;
|
||||
plot(GNSS_true_observables.RX_time(1,:),delta_true_psudorange_m,'g');
|
||||
hold on;
|
||||
plot(GNSS_observables.RX_time(1,min_idx+1:end),delta_measured_psudorange_m,'b');
|
||||
title('TRUE vs. measured Pseudoranges [m]')
|
||||
xlabel('TOW [s]')
|
||||
ylabel('[m]');
|
||||
|
||||
figure;
|
||||
plot(GNSS_observables.RX_time(1,min_idx+1:end),psudorange_error_m)
|
||||
title('Pseudoranges error [m]')
|
||||
xlabel('TOW [s]')
|
||||
ylabel('[m]');
|
||||
|
||||
figure;
|
||||
plot(GNSS_observables.RX_time(1,min_idx+1:end),acc_carrier_error_ch1_hz)
|
||||
title('Accumulated carrier phase error CH1 [hz]')
|
||||
xlabel('TOW [s]')
|
||||
ylabel('[hz]');
|
||||
|
||||
figure;
|
||||
plot(GNSS_observables.RX_time(1,min_idx+1:end),acc_carrier_error_ch2_hz)
|
||||
title('Accumulated carrier phase error CH2 [hz]')
|
||||
xlabel('TOW [s]')
|
||||
ylabel('[hz]');
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -28,38 +28,33 @@
|
||||
% */
|
||||
function [GNSS_tracking] = gps_l1_ca_dll_pll_read_tracking_dump (filename, count)
|
||||
|
||||
%% usage: gps_l1_ca_dll_pll_read_tracking_dump (filename, [count])
|
||||
%% usage: gps_l1_ca_dll_pll_read_tracking_dump_64bits (filename, [count])
|
||||
%%
|
||||
%% open GNSS-SDR tracking binary log file .dat and return the contents
|
||||
%%
|
||||
|
||||
m = nargchk (1,2,nargin);
|
||||
num_float_vars = 5;
|
||||
num_double_vars = 11;
|
||||
num_ulong_vars = 1;
|
||||
num_uint_vars = 1;
|
||||
num_float_vars=5;
|
||||
num_unsigned_long_int_vars=1;
|
||||
num_double_vars=11;
|
||||
num_unsigned_int_vars=1;
|
||||
double_size_bytes=8;
|
||||
unsigned_long_int_size_bytes=8;
|
||||
float_size_bytes=4;
|
||||
long_int_size_bytes=4;
|
||||
|
||||
if(~isempty(strfind(computer('arch'), '64')))
|
||||
% 64-bit computer
|
||||
double_size_bytes = 8;
|
||||
unsigned_long_int_size_bytes = 8;
|
||||
float_size_bytes = 4;
|
||||
unsigned_int_size_bytes = 4;
|
||||
else
|
||||
double_size_bytes = 8;
|
||||
unsigned_long_int_size_bytes = 4;
|
||||
float_size_bytes = 4;
|
||||
unsigned_int_size_bytes = 4;
|
||||
end
|
||||
|
||||
skip_bytes_each_read = float_size_bytes*num_float_vars + double_size_bytes*num_double_vars + unsigned_int_size_bytes*num_uint_vars + unsigned_long_int_size_bytes*num_ulong_vars;
|
||||
bytes_shift = 0;
|
||||
skip_bytes_each_read=float_size_bytes*num_float_vars+unsigned_long_int_size_bytes*num_unsigned_long_int_vars+double_size_bytes*num_double_vars+long_int_size_bytes*num_unsigned_int_vars;
|
||||
bytes_shift=0;
|
||||
if (m)
|
||||
usage (m);
|
||||
end
|
||||
|
||||
if (nargin < 2)
|
||||
count = Inf;
|
||||
%count = Inf;
|
||||
file_stats = dir(filename);
|
||||
%round num bytes to read to integer number of samples (to protect the script from binary
|
||||
%dump end file transitory)
|
||||
count = (file_stats.bytes - mod(file_stats.bytes,skip_bytes_each_read))/skip_bytes_each_read;
|
||||
end
|
||||
%loops_counter = fread (f, count, 'uint32',4*12);
|
||||
f = fopen (filename, 'rb');
|
||||
@ -67,76 +62,133 @@ function [GNSS_tracking] = gps_l1_ca_dll_pll_read_tracking_dump (filename, count
|
||||
else
|
||||
v1 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved float
|
||||
v2 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved float
|
||||
v3 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved float
|
||||
v4 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved float
|
||||
v5 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next unsigned long int
|
||||
v6 = fread (f, count, 'long',skip_bytes_each_read-unsigned_long_int_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved unsigned_long_int
|
||||
v6 = fread (f, count, 'uint64',skip_bytes_each_read-unsigned_long_int_size_bytes);
|
||||
bytes_shift=bytes_shift+unsigned_long_int_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v7 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v7 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v8 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v8 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v9 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v9 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v10 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v10 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v11 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v11 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v12 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v12 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v13 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v13 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v14 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v14 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v15 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next float
|
||||
v16 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next double
|
||||
v17 = fread (f, count, 'double',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next double
|
||||
v18 = fread (f, count, 'uint', skip_bytes_each_read - unsigned_int_size_bytes);
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v15 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v16 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v17 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v18 = fread (f, count, 'uint32',skip_bytes_each_read-double_size_bytes);
|
||||
fclose (f);
|
||||
|
||||
|
||||
GNSS_tracking.E = v1;
|
||||
GNSS_tracking.P = v2;
|
||||
GNSS_tracking.L = v3;
|
||||
GNSS_tracking.prompt_I = v4;
|
||||
GNSS_tracking.prompt_Q = v5;
|
||||
GNSS_tracking.PRN_start_sample = v6;
|
||||
GNSS_tracking.acc_carrier_phase_rad = v7;
|
||||
GNSS_tracking.carrier_doppler_hz = v8;
|
||||
GNSS_tracking.code_freq_hz = v9;
|
||||
GNSS_tracking.carr_error = v10;
|
||||
GNSS_tracking.carr_nco = v11;
|
||||
GNSS_tracking.code_error = v12;
|
||||
GNSS_tracking.code_nco = v13;
|
||||
GNSS_tracking.CN0_SNV_dB_Hz = v14;
|
||||
GNSS_tracking.carrier_lock_test = v15;
|
||||
GNSS_tracking.var1 = v16;
|
||||
GNSS_tracking.var2 = v17;
|
||||
GNSS_tracking.PRN = v18;
|
||||
|
||||
%%%%%%%% output vars %%%%%%%%
|
||||
|
||||
% // EPR
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
% // PROMPT I and Q (to analyze navigation symbols)
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
% // PRN start sample stamp
|
||||
% //tmp_float=(float)d_sample_counter;
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
% // accumulated carrier phase
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
%
|
||||
% // carrier and code frequency
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
%
|
||||
% //PLL commands
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&carr_phase_error_secs_Ti), sizeof(double));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
%
|
||||
% //DLL commands
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&code_error_chips_Ti), sizeof(double));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
|
||||
%
|
||||
% // CN0 and carrier lock test
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
%
|
||||
% // AUX vars (for debug purposes)
|
||||
% tmp_double = d_rem_code_phase_samples;
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
% tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples);
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
% // PRN
|
||||
% unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
E=v1;
|
||||
P=v2;
|
||||
L=v3;
|
||||
prompt_I=v4;
|
||||
prompt_Q=v5;
|
||||
PRN_start_sample=v6;
|
||||
acc_carrier_phase_rad=v7;
|
||||
carrier_doppler_hz=v8;
|
||||
code_freq_hz=v9;
|
||||
carr_error=v10;
|
||||
carr_nco=v11;
|
||||
code_error=v12;
|
||||
code_nco=v13;
|
||||
CN0_SNV_dB_Hz=v14;
|
||||
carrier_lock_test=v15;
|
||||
var1=v16;
|
||||
var2=v17;
|
||||
PRN=v18;
|
||||
|
||||
GNSS_tracking.E=E;
|
||||
GNSS_tracking.P=P;
|
||||
GNSS_tracking.L=L;
|
||||
GNSS_tracking.prompt_I=prompt_I;
|
||||
GNSS_tracking.prompt_Q=prompt_Q;
|
||||
GNSS_tracking.PRN_start_sample=PRN_start_sample;
|
||||
GNSS_tracking.acc_carrier_phase_rad=acc_carrier_phase_rad;
|
||||
GNSS_tracking.carrier_doppler_hz=carrier_doppler_hz;
|
||||
GNSS_tracking.code_freq_hz=code_freq_hz;
|
||||
GNSS_tracking.carr_error=carr_error;
|
||||
GNSS_tracking.carr_nco=carr_nco;
|
||||
GNSS_tracking.code_error=code_error
|
||||
GNSS_tracking.code_nco=code_nco;
|
||||
GNSS_tracking.CN0_SNV_dB_Hz=CN0_SNV_dB_Hz;
|
||||
GNSS_tracking.carrier_lock_test=carrier_lock_test;
|
||||
GNSS_tracking.d_rem_code_phase_samples=var1;
|
||||
GNSS_tracking.var2=var2;
|
||||
GNSS_tracking.PRN=PRN;
|
||||
end
|
||||
|
||||
|
@ -8,7 +8,7 @@ function [observables] = read_true_sim_observables_dump (filename, count)
|
||||
|
||||
m = nargchk (1,2,nargin);
|
||||
channels=12; %Simulator always use 12 channels
|
||||
num_double_vars=6;
|
||||
num_double_vars=7;
|
||||
double_size_bytes=8;
|
||||
skip_bytes_each_read=double_size_bytes*num_double_vars*channels;
|
||||
bytes_shift=0;
|
||||
@ -37,6 +37,9 @@ function [observables] = read_true_sim_observables_dump (filename, count)
|
||||
observables.Pseudorange_m(N,:) = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
||||
observables.True_range_m(N,:) = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
||||
observables.Carrier_phase_hz_v2(N,:) = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved
|
||||
@ -54,6 +57,7 @@ function [observables] = read_true_sim_observables_dump (filename, count)
|
||||
% d_dump_file.read((char *) &doppler_l1_hz, sizeof(double));
|
||||
% d_dump_file.read((char *) &acc_carrier_phase_l1_cycles[i], sizeof(double));
|
||||
% d_dump_file.read((char *) &dist_m[i], sizeof(double));
|
||||
% d_dump_file.read((char *) &true_dist_m[i], sizeof(double));
|
||||
% d_dump_file.read((char *) &carrier_phase_l1_cycles[i], sizeof(double));
|
||||
% d_dump_file.read((char *) &prn[i], sizeof(double));
|
||||
% }
|
||||
|
Loading…
x
Reference in New Issue
Block a user