Example 06 - Simulation with channel model output

This example explains the simulation with the channel impulse response (CIR) file which was generated in Example05.

We can use the same SNACS configuration file structure as in Example 04. We have to provide the correct CIR file name for the "snChannel" module :

                {       Type = "snChannel";
                        file = "../../examples/example_05/snacs-cir-file_DLRLMS_example-05.h5";
                        interpolation_type = "SINC";
                        interpolation_bandwidth = 10.23e6;
                },              

The same signal is defined for both signal generation and tracking.

The complete SNACS configuration file for this example is given below. The noise module is commented out to see the isolated multipath effect caused by the channel.

You can start it by running

cd snacs/trunk/release
./SNACS-release -f ../../examples/example_06/example_06_gps.cfg 

This is a screenshot of the running simulation:

example-06-screenshot.png
SNACS screenshot of Example 06

You can use the MATLAB script plot_snacs_results_example06.m to plot the results:

snacs-result_example06.png
SNACS simulation result of Example 06

The MATLAB script plot_snacs_results_with_cir_file_example06.m displays the CIR, the reference ranges and the SNACS pseudorange result into one plot:

snacs-result-and-cir_example06.png
CIR, the reference ranges and the SNACS pseudorange result

The file plot_snacs_results_with_cir_file_example06.m:

1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Supporting script for
4 %
5 % SNACS - The Satellite Navigation Radio Channel Simulator
6 %
7 % plot_snacs_results_example06.m
8 %
9 % MATLAB script for displaying results of SNACS Example 02 simulation.
10 %
11 % Copyright (C) 2010 F. M. Schubert
12 %
13 % This program is free software: you can redistribute it and/or modify
14 % it under the terms of the GNU General Public License as published by
15 % the Free Software Foundation, either version 3 of the License, or
16 % (at your option) any later version.
17 %
18 % This program is distributed in the hope that it will be useful,
19 % but WITHOUT ANY WARRANTY; without even the implied warranty of
20 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 % GNU General Public License for more details.
22 %
23 % You should have received a copy of the GNU General Public License
24 % along with this program. If not, see <http://www.gnu.org/licenses/>.
25 %
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 
28 clear all
29 close all
30 clc
31 
32 addpath('../helper_functions');
33 
34 cir_file = '../example_05/snacs-cir-file_DLRLMS_example-05.h5';
35 snacs_result_file = '/tmp/snacs-result_example06/result.h5';
36 
37 %% set interpolation parameters:
38 interp.skip_amount = 1; % interpolate only every interp.skip_amount-th CIR.
39 interp.bandwidth = 100e6; % in Hz, defines the interpolation resolution
40 interp.max_length = 400e-9; % in s, the length up to which the cirs will be plotted
41 interp.move_to_delay0 = false;
42 interp.add_delay_offset = 43e-9; % in s, this is added to the reference range for better visualization
43 
44 %% set plotting parameters:
45 plotting.length = 5.8; % s, total length of plot
46 plotting.range_dB = [-60, 0]; % 2x in dB, plots values within this dB range
47 plotting.show_title = 0; % print title into figure?
48 plotting.line_width = 3;
49 plotting.font_size = 14;
50 plotting.save = 1; % save plot?
51 plotting.width = 1024;
52 plotting.height = 768;
53 plotting.save_name = [ '../../documentation/doxygen-sources/graphic/snacs-result-and-cir_example06.png' ];
54 
55 %% plot the CIR first and get the reference ranges:
56 [ reference_ranges, delay_axis, sim_params ] = plot_snacs_cir_file(cir_file, interp, plotting);
57 
58 %% get the pseudoranges:
59 pseudoranges = hdf5read(snacs_result_file, '/snSDRGPS/output/pr');
60 
61 %% plot the reference range:
62 
63 % calculate correct axis values first
64 ref_y_axis = 0:1/sim_params.cir_rate:plotting.length-1/sim_params.cir_rate;
65 % trim the number of reference_ranges to the plot length:
66 reference_ranges = reference_ranges(1:numel(ref_y_axis));
67 % reference_ranges are in m. transform to seconds:
68 reference_ranges = reference_ranges / sim_params.c0;
69 
70 plot(reference_ranges/1e-9, ref_y_axis, 'k', 'LineWidth', plotting.line_width);
71 
72 %% plot the pseudorange:
73 
74 % calculate correct axis values first
75 pr_y_axis = 0:1/sim_params.cir_rate:plotting.length-1/sim_params.cir_rate;
76 % trim the number of reference_ranges to the plot length:
77 pseudoranges = pseudoranges(1:numel(ref_y_axis));
78 % reference_ranges are in m. transform to seconds:
79 pseudoranges = pseudoranges / sim_params.c0;
80 
81 plot(pseudoranges/1e-9, pr_y_axis, 'm', 'LineWidth', plotting.line_width);
82 
83 legend('channel model output', 'reference range', 'SNACS pseudorange result');
84 
85 % save the figure:
86 if plotting.save
87  save_figure_as_png(plotting.save_name, 1024, 768);
88 end

This is the complete SNACS configuration file for this example:

1 /*
2  * Example configuration file for
3  *
4  * SNACS - The Satellite Navigation Radio Channel Simulator
5  *
6  * example_06_gps.cfg
7  *
8  * Demonstration of a SNACS simulation with GPS signal generation
9  * and the channel impulse response file which was generated in Example 03.
10  *
11  * Copyright (C) 2010 F. M. Schubert
12  *
13  */
14 
15 Simulation:
16 {
17  sampling_frequency = 40e6; // Hz
18  c0 = 2.99e8;
19  length = 6.0; // s
20 
21  conc_buf_length = 0.001; // in s
22  buffers_per_concbuf = 2;
23 
24  result_directory = "/tmp/snacs-result_example06";
25  append_date_to_outdir = false;
26 
27  SNBlocks = (
28  { Type = "snSignalGenerate";
29  start = 0.0001;
30  signal = {
31  inphase = {
32  code = "C/A";
33  prn = 1;
34  modulation = "BPSK(n)";
35  n = 1.0;
36  data_type = "none";
37  };
38  };
39  },
40 /*
41  { Type = "snNoise";
42  seed_type = "time";
43  snr_db = 50.0;
44  start_sec = .9;
45  },
46 */
47  { Type = "snChannel";
48  file = "../../examples/example_05/snacs-cir-file_DLRLMS_example-05.h5";
49  interpolation_type = "SINC";
50  interpolation_bandwidth = 10.23e6;
51  },
52 
53  { Type = "snADC";
54  intermediate_frequency = 15e6; // Hz
55  adc_enable = true;
56  adc_bits = 4;
57  vga_enable = true;
58  vga_lowest_amplification_dB = -6.0;
59  vga_highest_amplification_dB = 42.5;
60  },
61 
62  { Type = "snSDRStandard";
63 
64  signal = {
65  inphase = {
66  code = "C/A";
67  prn = 1;
68  modulation = "BPSK(n)";
69  n = 1.0;
70  data_type = "none";
71  };
72  };
73 
74  intermediate_frequency = 15e6; // Hz
75  aquisition_enable = true;
76 
77  Aquisition:
78  {
79  plot_3d = true;
80  length = 1e-3;
81  aq_freq_band = 10000.0; // Hz
82  aq_freq_step = 250.0; // Hz
83  threshold = 2.5;
84  };
85 
86  tracking_enable = true;
87  Tracking:
88  {
89  DLL:
90  {
91  discriminator_type = "EML";
92  correlation_length = 0.001;
93  early_late_spacing = 1.0;
94  damping_ratio = 0.707;
95  noise_bandwidth = 5.0;
96 
97  corr_func_samples = 13; // amount of additional samples on correlation function
98  corr_func_start = -1.5; // start here with additional corr func samples in chips
99  corr_func_dist = 0.25; // distance between corr func samples in chips
100 
101  write_corr_func = false;
102  };
103  PLL:
104  {
105  damping_ratio = 0.707;
106  noise_bandwidth = 25.0;
107  };
108  };
109  }
110 
111  ); // end SNBlocks
112 }; // end Simulation
113 
114 Plotting:
115 {
116  UpdateInterval = 500; // ms
117  PlotXSize = 300L; // pixel to be plottet. format: long (L)
118  plot_buffer_length = 0.0001; // s
119 };
120