Example 08 - SNACS binary signal interface to other software defined receivers

It is possible to use SNACS just for signal generation and the (optional) application of a channel model. Further processing of the tracking could be performed by other software defined receivers. This example shows the example of GPS signal generation, the application of the channel impulse response (CIR) file which was generated in Example 04 and the subsequent output to a binary data file.

You can start it by running

cd snacs/trunk/release
./SNACS-release -f ../../examples/example_08/example_08_gps.cfg 

This is a screenshot of the running simulation:

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

The signal can easily be read into a MATLAB variable using the fread command:

signal = fread(fileID, samples, data_type);

Of course, the parameters have to correspond to the SNACS configuration file.

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

snacs-result_example08.png
Plot of Example 08

This is the complete MATLAB script:

1 % read bin file as generated by snSignalOutputBinary module
2 
3 clear all
4 close all
5 clc
6 
7 addpath('../helper_functions');
8 
9 %% set parameters
10 files = { 'snacs_gps_and_channel_output.bin' };
11 length = 0.00005; % s
12 smpl_freq = 39e6; %Hz
13 data_type = 'schar';
14 
15 %% read file
16 
17 files_n = size(files, 2);
18 
19 samples = length * smpl_freq;
20 
21 signals = zeros(files_n, samples);
22 
23 for i = 1:files_n
24  filename = cell2mat(files(i));
25  signals(i, :) = read_snacs_bin_file(filename, samples, data_type);
26 end
27 
28 %% plot
29 x_ax = 0:1/smpl_freq:length-1/smpl_freq;
30 
31 figure;
32 hold on;
33 for i = 1:files_n
34  switch i
35  case 1
36  color = 'b';
37  case 2
38  color = 'r';
39  case 3
40  color = 'g';
41  end
42  plot(x_ax, signals(i, :), [ color, '.-'] );
43  grid on;
44 end
45 xlabel('Time [s]');
46 ylabel('Amplitude');
47 xlim([0, length]);
48 ylim([-10, 10]);
49 
50 % save the figure:
51 save_figure_as_png('../../documentation/doxygen-sources/graphic/snacs-result_example08.png', 1024, 768);
This class samples and mixes a signal and outputs it to a file for processing with extern software re...
Definition: snSignalOutputBinary.h:34

It is also possible to process the file with the software defined receiver (SDR) by K. Borre, D. Akos et al. The SDR ships with the book "A Software-Defined GPS and Galileo Receiver: A Single-Frequency Approach" (http://www.amazon.com/Software-Defined-GPS-Galileo-Receiver-Single-Frequency/dp/0817643907/ref=sr_1_1?ie=UTF8&s=books&qid=1269958375&sr=8-1)

For this SDR, you have to set the right parameters in the file GNSS_SDR/initSettings.m:

[...]
settings.fileName           = ...
   'snacs/examples/example_08/snacs_gps_and_channel_output.bin';
% Data type used to store one sample
settings.dataType           = 'schar';

% Intermediate, sampling and code frequencies
settings.IF                 = 15e6;      %[Hz]
settings.samplingFreq       = 40e6;     %[Hz]
[...]
SDR-borre-akos-result_example08.png
Tracking result of the SNACS binary output file by the MATLAB SDR by K. Borre, D. Akos et al.

This is the complete SNACS configuration file:

1 /*
2  * Example configuration file for
3  *
4  * SNACS - The Satellite Navigation Radio Channel Simulator
5  *
6  * example_08.cfg
7  *
8  * Example 08 - SNACS binary signal interface to other software defined receivers
9  *
10  * Copyright (C) 2009 F. M. Schubert
11  *
12  */
13 
14 Simulation:
15 {
16  sampling_frequency = 40e6; // Hz
17  c0 = 2.99e8;
18  length = 5.0; // s
19 
20  conc_buf_length = 0.001; // in s
21  buffers_per_concbuf = 8;
22 
23  result_directory = "/tmp/snacs-result_example08";
24  append_date_to_outdir = false;
25 
26  SNBlocks = (
27 
28  { Type = "snSignalGenerate";
29  start = 0.00001;
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 = "snChannel";
42  file = "../../examples/example_05/snacs-cir-file_DLRLMS_example-05.h5";
43  interpolation_type = "SINC";
44  //rrc_rolloff_factor = 1.0;
45  interpolation_bandwidth = 10.23e6;
46  },
47 
48 /*
49  { Type = "snNoise";
50  snr_db = 50.0;
51  start_sec = 0.0;
52  },
53 */
54  { Type = "snADC";
55  intermediate_frequency = 15e6; // Hz
56  adc_enable = true;
57  adc_bits = 4;
58  vga_enable = true;
59  vga_lowest_amplification_dB = -6.0;
60  vga_highest_amplification_dB = 42.5;
61  },
62 
63  { Type = "snSignalOutputBinary";
64  file = "../../examples/example_08/snacs_gps_and_channel_output.bin";
65  data_type = "signed char";
66  }
67 
68  ); // end SNBlocks
69 }; // end Simulation
70 
71 Plotting:
72 {
73  UpdateInterval = 1000; // ms
74  PlotXSize = 300L; // pixel to be plottet. format: long (L)
75  plot_buffer_length = 0.00001;
76 };
77