mirror of https://github.com/gnss-sdr/gnss-sdr
Simulink tracking block updated: generation of the Simulink model from a script MATLAB and improvement of the tracking algorithm (both PLL and DLL). Added multi-threading support for MATLAB.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@208 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
fb287c0de3
commit
aab40c963d
|
@ -9,7 +9,7 @@ GNSS-SDR.internal_fs_hz=4000000
|
||||||
ControlThread.wait_for_flowgraph=false
|
ControlThread.wait_for_flowgraph=false
|
||||||
|
|
||||||
;######### SIGNAL_SOURCE CONFIG ############
|
;######### SIGNAL_SOURCE CONFIG ############
|
||||||
;#implementation: Use only File_Signal_Source in this version
|
;#implementation: Use File_Signal_Source or UHD_Signal_Source or GN3S_Signal_Source (experimental)
|
||||||
SignalSource.implementation=File_Signal_Source
|
SignalSource.implementation=File_Signal_Source
|
||||||
|
|
||||||
;#filename: path to file with the captured GNSS signal samples to be processed
|
;#filename: path to file with the captured GNSS signal samples to be processed
|
||||||
|
@ -20,6 +20,7 @@ SignalSource.item_type=gr_complex
|
||||||
|
|
||||||
;#sampling_frequency: Original Signal sampling frequency in [Hz]
|
;#sampling_frequency: Original Signal sampling frequency in [Hz]
|
||||||
SignalSource.sampling_frequency=4000000
|
SignalSource.sampling_frequency=4000000
|
||||||
|
;SignalSource.sampling_frequency=100000000
|
||||||
|
|
||||||
;#freq: RF front-end center frequency in [Hz]
|
;#freq: RF front-end center frequency in [Hz]
|
||||||
SignalSource.freq=1575420000
|
SignalSource.freq=1575420000
|
||||||
|
@ -32,10 +33,6 @@ SignalSource.subdevice=B:0
|
||||||
|
|
||||||
;#samples: Number of samples to be processed. Notice that 0 indicates the entire file.
|
;#samples: Number of samples to be processed. Notice that 0 indicates the entire file.
|
||||||
SignalSource.samples=0
|
SignalSource.samples=0
|
||||||
;SignalSource.samples=80000000
|
|
||||||
;SignalSource.samples=40000000
|
|
||||||
;SignalSource.samples=20000000
|
|
||||||
|
|
||||||
|
|
||||||
;#repeat: Repeat the processing file. Disable this option in this version
|
;#repeat: Repeat the processing file. Disable this option in this version
|
||||||
SignalSource.repeat=false
|
SignalSource.repeat=false
|
||||||
|
@ -43,10 +40,15 @@ SignalSource.repeat=false
|
||||||
;#dump: Dump the Signal source data to a file. Disable this option in this version
|
;#dump: Dump the Signal source data to a file. Disable this option in this version
|
||||||
SignalSource.dump=false
|
SignalSource.dump=false
|
||||||
|
|
||||||
|
SignalSource.dump_filename=../data/signal_source.dat
|
||||||
|
|
||||||
|
SignalSource.dump_filename=../data/SignalSource.dat
|
||||||
|
|
||||||
;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing.
|
;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing.
|
||||||
; it helps to not overload the CPU, but the processing time will be longer.
|
; it helps to not overload the CPU, but the processing time will be longer.
|
||||||
SignalSource.enable_throttle_control=false
|
SignalSource.enable_throttle_control=false
|
||||||
|
|
||||||
|
|
||||||
;######### SIGNAL_CONDITIONER CONFIG ############
|
;######### SIGNAL_CONDITIONER CONFIG ############
|
||||||
;## It holds blocks to change data type, filter and resample input data.
|
;## It holds blocks to change data type, filter and resample input data.
|
||||||
;#implementation: Pass_Through disables this block
|
;#implementation: Pass_Through disables this block
|
||||||
|
@ -68,7 +70,7 @@ InputFilter.implementation=Pass_Through
|
||||||
InputFilter.dump=false
|
InputFilter.dump=false
|
||||||
|
|
||||||
;#dump_filename: Log path and filename.
|
;#dump_filename: Log path and filename.
|
||||||
InputFilter.dump=../data/input_filter.dat
|
InputFilter.dump_filename=../data/input_filter.dat
|
||||||
|
|
||||||
;#The following options are used in the filter design of Fir_Filter implementation.
|
;#The following options are used in the filter design of Fir_Filter implementation.
|
||||||
;#These options are based on parameters of gnuradio's function: gr_remez.
|
;#These options are based on parameters of gnuradio's function: gr_remez.
|
||||||
|
@ -142,8 +144,8 @@ Resampler.sample_freq_out=4000000
|
||||||
|
|
||||||
;######### CHANNELS GLOBAL CONFIG ############
|
;######### CHANNELS GLOBAL CONFIG ############
|
||||||
;#count: Number of available satellite channels.
|
;#count: Number of available satellite channels.
|
||||||
Channels.count=8
|
Channels.count=7
|
||||||
Channels.in_acquisition=8
|
Channels.in_acquisition=7
|
||||||
|
|
||||||
;######### CHANNEL 0 CONFIG ############
|
;######### CHANNEL 0 CONFIG ############
|
||||||
;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS
|
;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS
|
||||||
|
@ -210,42 +212,55 @@ Channel0.system=GPS
|
||||||
Channel0.signal=1C
|
Channel0.signal=1C
|
||||||
|
|
||||||
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
|
;#satellite: Satellite PRN ID for this channel. Disable this option to random search
|
||||||
;Channel0.satellite=2
|
;Channel0.satellite=15
|
||||||
|
;Channel0.repeat_satellite=true
|
||||||
|
|
||||||
;######### CHANNEL 1 CONFIG ############
|
;######### CHANNEL 1 CONFIG ############
|
||||||
|
|
||||||
Channel1.system=GPS
|
Channel1.system=GPS
|
||||||
Channel1.signal=1C
|
Channel1.signal=1C
|
||||||
;Channel1.satellite=14
|
;Channel1.satellite=18
|
||||||
|
;Channel1.repeat_satellite=true
|
||||||
|
|
||||||
;######### CHANNEL 2 CONFIG ############
|
;######### CHANNEL 2 CONFIG ############
|
||||||
|
|
||||||
Channel2.system=GPS
|
Channel2.system=GPS
|
||||||
Channel2.signal=1C
|
Channel2.signal=1C
|
||||||
;Channel2.satellite=21
|
;Channel2.satellite=16
|
||||||
|
;Channel2.repeat_satellite=true
|
||||||
|
|
||||||
;######### CHANNEL 3 CONFIG ############
|
;######### CHANNEL 3 CONFIG ############
|
||||||
|
|
||||||
Channel3.system=GPS
|
Channel3.system=GPS
|
||||||
Channel3.signal=1C
|
Channel3.signal=1C
|
||||||
;Channel3.satellite=13
|
;Channel3.satellite=23
|
||||||
|
;Channel3.repeat_satellite=true
|
||||||
|
|
||||||
|
;######### CHANNEL 4 CONFIG ############
|
||||||
|
|
||||||
|
Channel4.system=GPS
|
||||||
|
Channel4.signal=1C
|
||||||
|
;Channel4.satellite=3
|
||||||
|
;Channel4.repeat_satellite=true
|
||||||
|
|
||||||
|
;######### CHANNEL 3 CONFIG ############
|
||||||
|
|
||||||
|
Channel5.system=GPS
|
||||||
|
Channel5.signal=1C
|
||||||
|
;Channel5.satellite=21
|
||||||
|
;Channel5.repeat_satellite=true
|
||||||
|
|
||||||
|
|
||||||
;######### ACQUISITION GLOBAL CONFIG ############
|
;######### ACQUISITION GLOBAL CONFIG ############
|
||||||
|
|
||||||
;#dump: Enable or disable the acquisition internal data file logging [true] or [false]
|
;#dump: Enable or disable the acquisition internal data file logging [true] or [false]
|
||||||
Acquisition.dump=false
|
Acquisition.dump=false
|
||||||
|
|
||||||
;#filename: Log path and filename
|
;#filename: Log path and filename
|
||||||
Acquisition.dump_filename=./acq_dump.dat
|
Acquisition.dump_filename=./acq_dump.dat
|
||||||
|
|
||||||
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
|
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
|
||||||
Acquisition.item_type=gr_complex
|
Acquisition.item_type=gr_complex
|
||||||
|
|
||||||
|
|
||||||
;#if: Signal intermediate frequency in [Hz]
|
;#if: Signal intermediate frequency in [Hz]
|
||||||
Acquisition.if=0
|
Acquisition.if=0
|
||||||
|
|
||||||
;#sampled_ms: Signal block duration for the acquisition signal detection [ms]
|
;#sampled_ms: Signal block duration for the acquisition signal detection [ms]
|
||||||
Acquisition.sampled_ms=1
|
Acquisition.sampled_ms=1
|
||||||
|
|
||||||
|
@ -254,74 +269,77 @@ Acquisition.sampled_ms=1
|
||||||
;######### ACQUISITION CH 0 CONFIG ############
|
;######### ACQUISITION CH 0 CONFIG ############
|
||||||
;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition]
|
;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition]
|
||||||
Acquisition0.implementation=GPS_L1_CA_PCPS_Acquisition
|
Acquisition0.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
|
|
||||||
;#threshold: Acquisition threshold
|
;#threshold: Acquisition threshold
|
||||||
Acquisition0.threshold=70
|
Acquisition0.threshold=100
|
||||||
|
|
||||||
;#doppler_max: Maximum expected Doppler shift [Hz]
|
;#doppler_max: Maximum expected Doppler shift [Hz]
|
||||||
Acquisition0.doppler_max=10000
|
Acquisition0.doppler_max=10000
|
||||||
|
|
||||||
;#doppler_max: Doppler step in the grid search [Hz]
|
;#doppler_max: Doppler step in the grid search [Hz]
|
||||||
Acquisition0.doppler_step=250
|
Acquisition0.doppler_step=250
|
||||||
|
;#repeat_satellite: Use only jointly with the satellite PRN ID option.
|
||||||
|
|
||||||
;#repeat_satellite: Use only jointly with the satellte PRN ID option.
|
|
||||||
;#Enable repeat_satellite to keep searching the same satellite during the runtime.
|
|
||||||
;Acquisition0.repeat_satellite=true
|
|
||||||
|
|
||||||
;######### ACQUISITION CH 1 CONFIG ############
|
;######### ACQUISITION CH 1 CONFIG ############
|
||||||
Acquisition1.implementation=GPS_L1_CA_PCPS_Acquisition
|
Acquisition1.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
Acquisition1.threshold=70
|
Acquisition1.threshold=100
|
||||||
Acquisition1.doppler_max=10000
|
Acquisition1.doppler_max=10000
|
||||||
Acquisition1.doppler_step=250
|
Acquisition1.doppler_step=250
|
||||||
;Acquisition1.repeat_satellite=true
|
|
||||||
|
|
||||||
;######### ACQUISITION CH 2 CONFIG ############
|
;######### ACQUISITION CH 2 CONFIG ############
|
||||||
Acquisition2.implementation=GPS_L1_CA_PCPS_Acquisition
|
Acquisition2.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
Acquisition2.threshold=70
|
Acquisition2.threshold=100
|
||||||
Acquisition2.doppler_max=10000
|
Acquisition2.doppler_max=10000
|
||||||
Acquisition2.doppler_step=250
|
Acquisition2.doppler_step=250
|
||||||
;Acquisition2.repeat_satellite=true
|
|
||||||
|
|
||||||
;######### ACQUISITION CH 3 CONFIG ############
|
;######### ACQUISITION CH 3 CONFIG ############
|
||||||
Acquisition3.implementation=GPS_L1_CA_PCPS_Acquisition
|
Acquisition3.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
Acquisition3.threshold=70
|
Acquisition3.threshold=100
|
||||||
Acquisition3.doppler_max=10000
|
Acquisition3.doppler_max=10000
|
||||||
Acquisition3.doppler_step=250
|
Acquisition3.doppler_step=250
|
||||||
;Acquisition3.repeat_satellite=true
|
|
||||||
|
|
||||||
;######### ACQUISITION CH 4 CONFIG ############
|
;######### ACQUISITION CH 4 CONFIG ############
|
||||||
Acquisition4.implementation=GPS_L1_CA_PCPS_Acquisition
|
Acquisition4.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
Acquisition4.threshold=70
|
Acquisition4.threshold=100
|
||||||
Acquisition4.doppler_max=10000
|
Acquisition4.doppler_max=10000
|
||||||
Acquisition4.doppler_step=250
|
Acquisition4.doppler_step=250
|
||||||
;Acquisition4.repeat_satellite=true
|
|
||||||
|
|
||||||
;######### ACQUISITION CH 5 CONFIG ############
|
;######### ACQUISITION CH 5 CONFIG ############
|
||||||
Acquisition5.implementation=GPS_L1_CA_PCPS_Acquisition
|
Acquisition5.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
Acquisition5.threshold=70
|
Acquisition5.threshold=100
|
||||||
Acquisition5.doppler_max=10000
|
Acquisition5.doppler_max=10000
|
||||||
Acquisition5.doppler_step=250
|
Acquisition5.doppler_step=250
|
||||||
;Acquisition5.repeat_satellite=true
|
|
||||||
|
|
||||||
;######### ACQUISITION CH 6 CONFIG ############
|
;######### ACQUISITION CH 6 CONFIG ############
|
||||||
Acquisition6.implementation=GPS_L1_CA_PCPS_Acquisition
|
Acquisition6.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
Acquisition6.threshold=70
|
Acquisition6.threshold=100
|
||||||
Acquisition6.doppler_max=10000
|
Acquisition6.doppler_max=10000
|
||||||
Acquisition6.doppler_step=250
|
Acquisition6.doppler_step=250
|
||||||
;Acquisition6.repeat_satellite=true
|
|
||||||
|
|
||||||
;######### ACQUISITION CH 7 CONFIG ############
|
;######### ACQUISITION CH 7 CONFIG ############
|
||||||
Acquisition7.implementation=GPS_L1_CA_PCPS_Acquisition
|
Acquisition7.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
Acquisition7.threshold=70
|
Acquisition7.threshold=100
|
||||||
Acquisition7.doppler_max=10000
|
Acquisition7.doppler_max=10000
|
||||||
Acquisition7.doppler_step=250
|
Acquisition7.doppler_step=250
|
||||||
;Acquisition7.repeat_satellite=true
|
|
||||||
|
|
||||||
|
;######### ACQUISITION CH 8 CONFIG ############
|
||||||
|
Acquisition8.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
|
Acquisition8.threshold=100
|
||||||
|
Acquisition8.doppler_max=10000
|
||||||
|
Acquisition8.doppler_step=250
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;######### TRACKING GLOBAL CONFIG ############
|
;######### TRACKING GLOBAL CONFIG ############
|
||||||
|
|
||||||
;#implementatiion: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking], [GPS_L1_CA_DLL_FLL_PLL_Tracking] or [GPS_L1_CA_TCP_CONNECTOR_Tracking]
|
;#implementatiion: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking], [GPS_L1_CA_DLL_FLL_PLL_Tracking] or [GPS_L1_CA_TCP_CONNECTOR_Tracking]
|
||||||
Tracking.implementation=GPS_L1_CA_TCP_CONNECTOR_Tracking
|
Tracking.implementation= GPS_L1_CA_TCP_CONNECTOR_Tracking
|
||||||
|
;Tracking.implementation=GPS_L1_CA_DLL_FLL_PLL_Tracking
|
||||||
;#item_type: Type and resolution for each of the signal samples. Use only [gr_complex] in this version.
|
;#item_type: Type and resolution for each of the signal samples. Use only [gr_complex] in this version.
|
||||||
Tracking.item_type=gr_complex
|
Tracking.item_type=gr_complex
|
||||||
|
|
||||||
|
@ -341,7 +359,7 @@ Tracking.pll_bw_hz=50.0;
|
||||||
Tracking.dll_bw_hz=2.0;
|
Tracking.dll_bw_hz=2.0;
|
||||||
|
|
||||||
;#fll_bw_hz: FLL loop filter bandwidth [Hz]
|
;#fll_bw_hz: FLL loop filter bandwidth [Hz]
|
||||||
Tracking.fll_bw_hz=20.0;
|
Tracking.fll_bw_hz=10.0;
|
||||||
|
|
||||||
;#order: PLL/DLL loop filter order [2] or [3]
|
;#order: PLL/DLL loop filter order [2] or [3]
|
||||||
Tracking.order=2;
|
Tracking.order=2;
|
||||||
|
@ -350,19 +368,17 @@ Tracking.order=2;
|
||||||
Tracking.early_late_space_chips=0.5;
|
Tracking.early_late_space_chips=0.5;
|
||||||
|
|
||||||
;#port_ch0: local TCP port for channel 0
|
;#port_ch0: local TCP port for channel 0
|
||||||
Tracking.port_ch0=2060;
|
Tracking.port_ch0=2070;
|
||||||
|
|
||||||
;######### TELEMETRY DECODER CONFIG ############
|
;######### TELEMETRY DECODER CONFIG ############
|
||||||
;#implementation: Use [GPS_L1_CA_Telemetry_Decoder] for GPS L1 C/A.
|
;#implementation: Use [GPS_L1_CA_Telemetry_Decoder] for GPS L1 C/A.
|
||||||
TelemetryDecoder.implementation=GPS_L1_CA_Telemetry_Decoder
|
TelemetryDecoder.implementation=GPS_L1_CA_Telemetry_Decoder
|
||||||
|
TelemetryDecoder.dump=false
|
||||||
|
|
||||||
;######### OBSERVABLES CONFIG ############
|
;######### OBSERVABLES CONFIG ############
|
||||||
;#implementation: Use [GPS_L1_CA_Observables] for GPS L1 C/A.
|
;#implementation: Use [GPS_L1_CA_Observables] for GPS L1 C/A.
|
||||||
Observables.implementation=GPS_L1_CA_Observables
|
Observables.implementation=GPS_L1_CA_Observables
|
||||||
|
|
||||||
;#output_rate_ms: Period between two psudoranges outputs. Notice that the minimum period is equal to the tracking integration time (for GPS CA L1 is 1ms) [ms]
|
|
||||||
Observables.output_rate_ms=100
|
|
||||||
|
|
||||||
;#dump: Enable or disable the Observables internal binary data file logging [true] or [false]
|
;#dump: Enable or disable the Observables internal binary data file logging [true] or [false]
|
||||||
Observables.dump=false
|
Observables.dump=false
|
||||||
|
|
||||||
|
@ -375,11 +391,18 @@ Observables.dump_filename=./observables.dat
|
||||||
PVT.implementation=GPS_L1_CA_PVT
|
PVT.implementation=GPS_L1_CA_PVT
|
||||||
|
|
||||||
;#averaging_depth: Number of PVT observations in the moving average algorithm
|
;#averaging_depth: Number of PVT observations in the moving average algorithm
|
||||||
|
;PVT.averaging_depth=100
|
||||||
PVT.averaging_depth=2
|
PVT.averaging_depth=2
|
||||||
|
|
||||||
;#flag_average: Enables the PVT averaging between output intervals (arithmetic mean) [true] or [false]
|
;#flag_average: Enables the PVT averaging between output intervals (arithmetic mean) [true] or [false]
|
||||||
PVT.flag_averaging=true
|
PVT.flag_averaging=true
|
||||||
|
|
||||||
|
;#output_rate_ms: Period between two PVT outputs. Notice that the minimum period is equal to the tracking integration time (for GPS CA L1 is 1ms) [ms]
|
||||||
|
PVT.output_rate_ms=100;
|
||||||
|
|
||||||
|
;#display_rate_ms: Position console print (std::out) interval [ms]. Notice that output_rate_ms<=display_rate_ms.
|
||||||
|
PVT.display_rate_ms=500;
|
||||||
|
|
||||||
;#dump: Enable or disable the PVT internal binary data file logging [true] or [false]
|
;#dump: Enable or disable the PVT internal binary data file logging [true] or [false]
|
||||||
PVT.dump=false
|
PVT.dump=false
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
#define CN0_ESTIMATION_SAMPLES 10
|
#define CN0_ESTIMATION_SAMPLES 10
|
||||||
#define MINIMUM_VALID_CN0 25
|
#define MINIMUM_VALID_CN0 25
|
||||||
#define MAXIMUM_LOCK_FAIL_COUNTER 200
|
#define MAXIMUM_LOCK_FAIL_COUNTER 200
|
||||||
#define NUM_TX_VARIABLES 7
|
#define NUM_TX_VARIABLES 9
|
||||||
#define NUM_RX_VARIABLES 3
|
#define NUM_RX_VARIABLES 4
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
|
@ -190,6 +190,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
|
||||||
systemName["S"] = std::string("SBAS");
|
systemName["S"] = std::string("SBAS");
|
||||||
systemName["E"] = std::string("Galileo");
|
systemName["E"] = std::string("Galileo");
|
||||||
systemName["C"] = std::string("Compass");
|
systemName["C"] = std::string("Compass");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
||||||
|
@ -204,6 +205,15 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
|
||||||
|
|
||||||
unsigned long int acq_trk_diff_samples;
|
unsigned long int acq_trk_diff_samples;
|
||||||
float acq_trk_diff_seconds;
|
float acq_trk_diff_seconds;
|
||||||
|
// jarribas: this patch correct a situation where the tracking sample counter
|
||||||
|
// is equal to 0 (remains in the initial state) at the first acquisition to tracking transition
|
||||||
|
// of the receiver operation when is connecting to simulink server.
|
||||||
|
// if (d_sample_counter<d_acq_sample_stamp)
|
||||||
|
// {
|
||||||
|
// acq_trk_diff_samples=0; //disable the correction
|
||||||
|
// }else{
|
||||||
|
// acq_trk_diff_samples = d_sample_counter - d_acq_sample_stamp;//-d_vector_length;
|
||||||
|
// }
|
||||||
acq_trk_diff_samples = d_sample_counter - d_acq_sample_stamp;//-d_vector_length;
|
acq_trk_diff_samples = d_sample_counter - d_acq_sample_stamp;//-d_vector_length;
|
||||||
std::cout << "acq_trk_diff_samples=" << acq_trk_diff_samples << std::endl;
|
std::cout << "acq_trk_diff_samples=" << acq_trk_diff_samples << std::endl;
|
||||||
acq_trk_diff_seconds = (float)acq_trk_diff_samples / (float)d_fs_in;
|
acq_trk_diff_seconds = (float)acq_trk_diff_samples / (float)d_fs_in;
|
||||||
|
@ -341,6 +351,7 @@ tcp_packet_data::tcp_packet_data() {
|
||||||
|
|
||||||
proc_pack_code_error = 0;
|
proc_pack_code_error = 0;
|
||||||
proc_pack_carr_error = 0;
|
proc_pack_carr_error = 0;
|
||||||
|
proc_pack_carrier_doppler_hz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tcp_packet_data::~tcp_packet_data() {
|
tcp_packet_data::~tcp_packet_data() {
|
||||||
|
@ -363,13 +374,6 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
|
|
||||||
tcp_packet_data tcp_data;
|
tcp_packet_data tcp_data;
|
||||||
|
|
||||||
//! Listen for connections on a TCP port
|
|
||||||
if (d_listen_connection == true)
|
|
||||||
{
|
|
||||||
d_port = d_port_ch0 + d_channel;
|
|
||||||
d_listen_connection = d_tcp_com.listen_tcp_connection(d_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d_enable_tracking == true)
|
if (d_enable_tracking == true)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -448,25 +452,17 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
d_control_id++;
|
d_control_id++;
|
||||||
|
|
||||||
//! Send and receive a TCP packet
|
//! Send and receive a TCP packet
|
||||||
boost::array<float, NUM_TX_VARIABLES> tx_variables_array = {{(*d_Early).imag(),(*d_Early).real(),(*d_Late).imag(),(*d_Late).real(),(*d_Prompt).imag(),(*d_Prompt).real(), d_control_id}};
|
boost::array<float, NUM_TX_VARIABLES> tx_variables_array = {{d_control_id,(*d_Early).imag(),(*d_Early).real(),(*d_Late).imag(),(*d_Late).real(),(*d_Prompt).imag(),(*d_Prompt).real(),d_acq_carrier_doppler_hz,1}};
|
||||||
d_tcp_com.send_receive_tcp_packet(tx_variables_array, &tcp_data);
|
d_tcp_com.send_receive_tcp_packet(tx_variables_array, &tcp_data);
|
||||||
|
|
||||||
//! Recover the data
|
//! Recover the tracking data
|
||||||
code_error = tcp_data.proc_pack_code_error;
|
code_error = tcp_data.proc_pack_code_error;
|
||||||
carr_error = tcp_data.proc_pack_carr_error;
|
carr_error = tcp_data.proc_pack_carr_error;
|
||||||
|
// Modify carrier freq based on NCO command
|
||||||
|
d_carrier_doppler_hz = tcp_data.proc_pack_carrier_doppler_hz;
|
||||||
// Compute PLL error and update carrier NCO -
|
|
||||||
//SIM carr_error = pll_cloop_two_quadrant_atan(*d_Prompt) / (float)GPS_TWO_PI;
|
|
||||||
// Implement carrier loop filter and generate NCO command
|
|
||||||
carr_nco = d_carrier_loop_filter.get_carrier_nco(carr_error);
|
|
||||||
// Modify carrier freq based on NCO command
|
|
||||||
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_nco;
|
|
||||||
|
|
||||||
// Compute DLL error and update code NCO
|
|
||||||
//SIM code_error = dll_nc_e_minus_l_normalized(*d_Early, *d_Late);
|
|
||||||
// Modify code freq based on NCO command
|
// Modify code freq based on NCO command
|
||||||
d_code_freq_hz = 1/(1/GPS_L1_CA_CODE_RATE_HZ - code_nco/GPS_L1_CA_CODE_LENGTH_CHIPS);
|
code_nco=1/(1/GPS_L1_CA_CODE_RATE_HZ-code_error/GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||||
|
d_code_freq_hz = code_nco;
|
||||||
|
|
||||||
// Update the phasestep based on code freq (variable) and
|
// Update the phasestep based on code freq (variable) and
|
||||||
// sampling frequency (fixed)
|
// sampling frequency (fixed)
|
||||||
|
@ -480,7 +476,18 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||||
T_prn_samples = T_prn_seconds * d_fs_in;
|
T_prn_samples = T_prn_seconds * d_fs_in;
|
||||||
d_rem_code_phase_samples = d_next_rem_code_phase_samples;
|
d_rem_code_phase_samples = d_next_rem_code_phase_samples;
|
||||||
K_blk_samples = T_prn_samples + d_rem_code_phase_samples;
|
K_blk_samples = T_prn_samples + d_rem_code_phase_samples;//-code_error*(float)d_fs_in;
|
||||||
|
|
||||||
|
// Update the current PRN delay (code phase in samples)
|
||||||
|
float T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ;
|
||||||
|
float T_prn_true_samples = T_prn_true_seconds * (float)d_fs_in;
|
||||||
|
d_code_phase_samples = d_code_phase_samples + T_prn_samples - T_prn_true_samples;
|
||||||
|
if (d_code_phase_samples < 0)
|
||||||
|
{
|
||||||
|
d_code_phase_samples = T_prn_true_samples + d_code_phase_samples;
|
||||||
|
}
|
||||||
|
|
||||||
|
d_code_phase_samples = fmod(d_code_phase_samples, T_prn_true_samples);
|
||||||
d_next_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
d_next_prn_length_samples = round(K_blk_samples); //round to a discrete samples
|
||||||
d_next_rem_code_phase_samples = K_blk_samples - d_next_prn_length_samples; //rounding error
|
d_next_rem_code_phase_samples = K_blk_samples - d_next_prn_length_samples; //rounding error
|
||||||
|
|
||||||
|
@ -511,8 +518,6 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
|
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
|
||||||
{
|
{
|
||||||
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ;
|
std::cout << "Channel " << d_channel << " loss of lock!" << std::endl ;
|
||||||
// tracking_message = 3; //loss of lock
|
|
||||||
// d_channel_internal_queue->push(tracking_message);
|
|
||||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||||
if (d_queue != gr_msg_queue_sptr()) {
|
if (d_queue != gr_msg_queue_sptr()) {
|
||||||
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
||||||
|
@ -522,9 +527,18 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||||
|
|
||||||
}
|
}
|
||||||
//std::cout<<"d_carrier_lock_fail_counter"<<d_carrier_lock_fail_counter<<"\r\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ########### Output the tracking data to navigation and PVT ##########
|
||||||
|
|
||||||
|
current_synchro_data.Prompt_I = (double)(*d_Prompt).imag();
|
||||||
|
current_synchro_data.Prompt_Q = (double)(*d_Prompt).real();
|
||||||
|
current_synchro_data.Tracking_timestamp_secs = d_sample_counter_seconds;
|
||||||
|
current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad;
|
||||||
|
current_synchro_data.Code_phase_secs = (double)d_code_phase_samples * (1/(float)d_fs_in);
|
||||||
|
current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz;
|
||||||
|
*out[0] = current_synchro_data;
|
||||||
|
|
||||||
// ########## DEBUG OUTPUT
|
// ########## DEBUG OUTPUT
|
||||||
/*!
|
/*!
|
||||||
* \todo The stop timer has to be moved to the signal source!
|
* \todo The stop timer has to be moved to the signal source!
|
||||||
|
@ -538,8 +552,6 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl;
|
std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl;
|
||||||
std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||||
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
|
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
|
||||||
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
|
|
||||||
//if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -549,22 +561,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
d_last_seg = floor(d_sample_counter / d_fs_in);
|
d_last_seg = floor(d_sample_counter / d_fs_in);
|
||||||
std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
|
||||||
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
|
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
|
||||||
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ########### Output the tracking data to navigation and PVT ##########
|
|
||||||
|
|
||||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).imag();
|
|
||||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).real();
|
|
||||||
// Tracking_timestamp_secs is aligned with the PRN start sample
|
|
||||||
current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_next_prn_length_samples+(double)d_next_rem_code_phase_samples)/(double)d_fs_in;
|
|
||||||
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, Code_phase_secs=0
|
|
||||||
current_synchro_data.Code_phase_secs=0;
|
|
||||||
current_synchro_data.Tracking_timestamp_secs = d_sample_counter_seconds;
|
|
||||||
current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad;
|
|
||||||
current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz;
|
|
||||||
*out[0] = current_synchro_data;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -572,13 +570,12 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
*d_Prompt = gr_complex(0,0);
|
*d_Prompt = gr_complex(0,0);
|
||||||
*d_Late = gr_complex(0,0);
|
*d_Late = gr_complex(0,0);
|
||||||
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //block output streams pointer
|
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //block output streams pointer
|
||||||
//std::cout<<output_items.size()<<std::endl;
|
|
||||||
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
|
||||||
Gnss_Synchro current_synchro_data;
|
Gnss_Synchro current_synchro_data;
|
||||||
*out[0] = current_synchro_data;
|
*out[0] = current_synchro_data;
|
||||||
|
|
||||||
//! When tracking is disabled an array of 1's is sent to maintain the TCP connection
|
//! When tracking is disabled an array of 1's is sent to maintain the TCP connection
|
||||||
boost::array<float, NUM_TX_VARIABLES> tx_variables_array = {{1,1,1,1,1,1,1}};
|
boost::array<float, NUM_TX_VARIABLES> tx_variables_array = {{1,1,1,1,1,1,1,1,0}};
|
||||||
d_tcp_com.send_receive_tcp_packet(tx_variables_array, &tcp_data);
|
d_tcp_com.send_receive_tcp_packet(tx_variables_array, &tcp_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,7 +586,6 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
float prompt_Q;
|
float prompt_Q;
|
||||||
float tmp_E, tmp_P, tmp_L;
|
float tmp_E, tmp_P, tmp_L;
|
||||||
float tmp_float;
|
float tmp_float;
|
||||||
double tmp_double;
|
|
||||||
prompt_I = (*d_Prompt).imag();
|
prompt_I = (*d_Prompt).imag();
|
||||||
prompt_Q = (*d_Prompt).real();
|
prompt_Q = (*d_Prompt).real();
|
||||||
tmp_E = std::abs<float>(*d_Early);
|
tmp_E = std::abs<float>(*d_Early);
|
||||||
|
@ -627,10 +623,9 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
d_dump_file.write((char*)&d_carrier_lock_test, sizeof(float));
|
d_dump_file.write((char*)&d_carrier_lock_test, sizeof(float));
|
||||||
|
|
||||||
// AUX vars (for debug purposes)
|
// AUX vars (for debug purposes)
|
||||||
tmp_float = d_rem_code_phase_samples;
|
tmp_float=0;
|
||||||
d_dump_file.write((char*)&tmp_float, sizeof(float));
|
d_dump_file.write((char*)&tmp_float, sizeof(float));
|
||||||
tmp_double=(double)(d_sample_counter+d_current_prn_length_samples);
|
d_dump_file.write((char*)&d_sample_counter_seconds, sizeof(double));
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
}
|
}
|
||||||
catch (std::ifstream::failure e)
|
catch (std::ifstream::failure e)
|
||||||
{
|
{
|
||||||
|
@ -639,7 +634,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||||
}
|
}
|
||||||
|
|
||||||
consume_each(d_current_prn_length_samples); // this is necesary in gr_block derivates
|
consume_each(d_current_prn_length_samples); // this is necesary in gr_block derivates
|
||||||
//d_sample_counter_seconds = d_sample_counter_seconds + ( ((double)d_current_prn_length_samples) / (double)d_fs_in );
|
d_sample_counter_seconds = d_sample_counter_seconds + ( ((double)d_current_prn_length_samples) / (double)d_fs_in );
|
||||||
d_sample_counter += d_current_prn_length_samples; //count for the processed samples
|
d_sample_counter += d_current_prn_length_samples; //count for the processed samples
|
||||||
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
|
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
|
||||||
}
|
}
|
||||||
|
@ -669,6 +664,13 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Listen for connections on a TCP port
|
||||||
|
if (d_listen_connection == true)
|
||||||
|
{
|
||||||
|
d_port = d_port_ch0 + d_channel;
|
||||||
|
d_listen_connection = d_tcp_com.listen_tcp_connection(d_port,d_port_ch0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
#define NUM_TX_VARIABLES 7
|
#define NUM_TX_VARIABLES 9
|
||||||
#define NUM_RX_VARIABLES 3
|
#define NUM_RX_VARIABLES 4
|
||||||
|
|
||||||
|
|
||||||
tcp_communication::tcp_communication() : tcp_socket_(io_service_)
|
tcp_communication::tcp_communication() : tcp_socket_(io_service_)
|
||||||
|
@ -49,7 +49,7 @@ tcp_communication::~tcp_communication()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int tcp_communication::listen_tcp_connection(size_t d_port_)
|
int tcp_communication::listen_tcp_connection(size_t d_port_, size_t d_port_ch0_)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -57,11 +57,14 @@ int tcp_communication::listen_tcp_connection(size_t d_port_)
|
||||||
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), d_port_);
|
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), d_port_);
|
||||||
boost::asio::ip::tcp::acceptor acceptor(io_service_, endpoint);
|
boost::asio::ip::tcp::acceptor acceptor(io_service_, endpoint);
|
||||||
|
|
||||||
|
if (d_port_ == d_port_ch0_)
|
||||||
|
{
|
||||||
|
std::cout << "Server ready. Listening for TCP connections..." << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Reuse the IP address for each connection
|
// Reuse the IP address for each connection
|
||||||
acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
||||||
|
|
||||||
std::cout << "Server ready on port " << d_port_ << std::endl;
|
|
||||||
|
|
||||||
// Listen for a connection and accept it
|
// Listen for a connection and accept it
|
||||||
acceptor.listen(12);
|
acceptor.listen(12);
|
||||||
acceptor.accept(tcp_socket_);
|
acceptor.accept(tcp_socket_);
|
||||||
|
@ -81,9 +84,9 @@ int tcp_communication::listen_tcp_connection(size_t d_port_)
|
||||||
|
|
||||||
void tcp_communication::send_receive_tcp_packet(boost::array<float, NUM_TX_VARIABLES> buf, tcp_packet_data *tcp_data_)
|
void tcp_communication::send_receive_tcp_packet(boost::array<float, NUM_TX_VARIABLES> buf, tcp_packet_data *tcp_data_)
|
||||||
{
|
{
|
||||||
int controlc = 0;
|
int controlc = 0;
|
||||||
boost::array<float, NUM_RX_VARIABLES> readbuf;
|
boost::array<float, NUM_RX_VARIABLES> readbuf;
|
||||||
float d_control_id_ = buf.data()[6];
|
float d_control_id_ = buf.data()[0];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -92,16 +95,17 @@ void tcp_communication::send_receive_tcp_packet(boost::array<float, NUM_TX_VARIA
|
||||||
|
|
||||||
// Read the received TCP packet
|
// Read the received TCP packet
|
||||||
tcp_socket_.read_some(boost::asio::buffer(readbuf));
|
tcp_socket_.read_some(boost::asio::buffer(readbuf));
|
||||||
|
|
||||||
|
//! Control. The GNSS-SDR program ends if an error in a TCP packet is detected.
|
||||||
|
if (d_control_id_ != readbuf.data()[0])
|
||||||
|
{
|
||||||
|
throw "Packet error!";
|
||||||
|
}
|
||||||
|
|
||||||
// Recover the variables received
|
// Recover the variables received
|
||||||
tcp_data_->proc_pack_code_error = readbuf.data()[0];
|
tcp_data_->proc_pack_code_error = readbuf.data()[1];
|
||||||
tcp_data_->proc_pack_carr_error = readbuf.data()[1];
|
tcp_data_->proc_pack_carr_error = readbuf.data()[2];
|
||||||
|
tcp_data_->proc_pack_carrier_doppler_hz = readbuf.data()[3];
|
||||||
// Control. The GNSS-SDR program ends if an error in a TCP packet is detected.
|
|
||||||
if (d_control_id_ != readbuf.data()[2])
|
|
||||||
{
|
|
||||||
throw "Packet error!";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
|
|
|
@ -44,9 +44,9 @@ public:
|
||||||
tcp_communication();
|
tcp_communication();
|
||||||
~tcp_communication();
|
~tcp_communication();
|
||||||
|
|
||||||
int listen_tcp_connection(size_t d_port_);
|
int listen_tcp_connection(size_t d_port_, size_t d_port_ch0_);
|
||||||
void send_receive_tcp_packet(boost::array<float,7> buf, tcp_packet_data *tcp_data_);
|
void send_receive_tcp_packet(boost::array<float, 9> buf, tcp_packet_data *tcp_data_);
|
||||||
void close_tcp_connection(size_t d_port_);
|
void close_tcp_connection(size_t d_port_);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::asio::io_service io_service_;
|
boost::asio::io_service io_service_;
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
~tcp_packet_data();
|
~tcp_packet_data();
|
||||||
float proc_pack_code_error;
|
float proc_pack_code_error;
|
||||||
float proc_pack_carr_error;
|
float proc_pack_carr_error;
|
||||||
|
float proc_pack_carrier_doppler_hz;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
DEFINE_string(config_file, "../conf/gnss-sdr.conf",
|
DEFINE_string(config_file, "../conf/gnss-sdr.conf",
|
||||||
"Path to the file containing the configuration parameters");
|
"Path to the file containing the configuration parameters");
|
||||||
|
|
||||||
ControlThread::ControlThread()
|
ControlThread::ControlThread()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
/*!
|
||||||
|
* \file README.txt
|
||||||
|
* \brief How to add a block to the Simulink Library repository of Matlab,
|
||||||
|
* how to use the "gnss_sdr_tcp_connector_parallel_tracking_start.m" script
|
||||||
|
* and how to replace the tracking block of the library. Parallel Computing
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* \author David Pubill, 2012. dpubill(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
IMPORTANT: Please, to use this tracking check the configuration file called
|
||||||
|
'gnss-sdr_tcp_connector_tracking.conf'. There are two major changes:
|
||||||
|
1.- Choose the [GPS_L1_CA_TCP_CONNECTOR_Tracking] tracking algorithm.
|
||||||
|
2.- Choose a tcp port for channel 0 (e.g. Tracking.port_ch0=2070;)
|
||||||
|
|
||||||
|
|
||||||
|
A) HOW TO add a block to the Simulink Library repository of your Matlab installation
|
||||||
|
---------------------------------------------------------------------------------
|
||||||
|
(These steps should be followed only the first time)
|
||||||
|
|
||||||
|
1.- Copy the content of this folder to a folder accessible from Simulink.
|
||||||
|
|
||||||
|
2.- In the Matlab Command Window type:
|
||||||
|
>> simulink;
|
||||||
|
to open the Simulink Library Browser.
|
||||||
|
|
||||||
|
3.- Right-click on the Simulink/User-Defined Functions of the Simulink
|
||||||
|
Library menu, and click on "Open User-Defined Functions library"
|
||||||
|
(Window_1).
|
||||||
|
|
||||||
|
4.- Open the library model 'gnss_sdr_tcp_connector_tracking_lib.mdl'
|
||||||
|
(Window_2)
|
||||||
|
|
||||||
|
5.- If this is not the first time there should be an existing 'gnss-sdr'
|
||||||
|
block in the 'User-Defined Functions' window that should be deleted
|
||||||
|
before drag and drop the new 'gnss_sdr' block (which includes 3 blocks:
|
||||||
|
- 'gnss_sdr_tcp_connector_tracking_rx' block
|
||||||
|
- 'gnss_sdr_tcp_connector_tracking' block
|
||||||
|
- 'gnss_sdr_tcp_connector_tracking_tx' block)
|
||||||
|
from Window_2 to Window_1. A new message should appear: "This library
|
||||||
|
is locked. The action performed requires it to be unlocked". Then,
|
||||||
|
click on the "Unlock" button (the block will be copied) and close
|
||||||
|
Window_2.
|
||||||
|
|
||||||
|
6.- Right-click on the 'gnss-sdr' block and click on "Link Options -->
|
||||||
|
Disable link", repeat the action but now clicking on "Link Options -->
|
||||||
|
Break link". This action disables and breaks the link with the
|
||||||
|
original library model.
|
||||||
|
|
||||||
|
7.- On Window_1 save the "simulink/User-Defined Functions" library.
|
||||||
|
To do that go to "File > Save". Then, close Window_1.
|
||||||
|
|
||||||
|
8.- From "Simulink Library Browser" window, press F5 to refresh and generate
|
||||||
|
the new Simulink Library repository (it may take a few seconds). This
|
||||||
|
completes the installation of the custom Simulink block.
|
||||||
|
|
||||||
|
|
||||||
|
B) HOW TO use the "gnss_sdr_tcp_connector_parallel_tracking_start.m" script:
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
----------------------- ------------------ -----------------------
|
||||||
|
| | | | | |
|
||||||
|
| gnss_sdr_tcp_ | | gnss_sdr_tcp_ | | gnss_sdr_tcp_ |
|
||||||
|
| connector_tracking_ | --> | connector_ | --> | connector_tracking_ |
|
||||||
|
| rx | | tracking | | tx |
|
||||||
|
| | | | | |
|
||||||
|
----------------------- ------------------ -----------------------
|
||||||
|
|
||||||
|
The 'gnss_sdr_tcp_connector_parallel_tracking_start.m' is the script that
|
||||||
|
builds and configures a Simulink model for interacting with the GNSS-SDR
|
||||||
|
platform through a TCP communication. Some 'User parameters' can be
|
||||||
|
modified but, by default, these are the values assigned:
|
||||||
|
|
||||||
|
%User parameters
|
||||||
|
host = '84.88.61.86'; %Remote IP address (GNSS-SDR computer IP)
|
||||||
|
port = 2070; %Remote port (GNSS-SDR computer port for Ch0)
|
||||||
|
num_vars_rx = 9; %Number of variables expected from GNSS-SDR
|
||||||
|
num_vars_tx = 4; %Number of variable to be transmitted to GNSS-SDR
|
||||||
|
timeout = '40'; %Timeout in seconds
|
||||||
|
|
||||||
|
'host', 'port' and 'timeout' parameters configure both
|
||||||
|
'gnss_sdr_tcp_connector_tracking_rx' and 'gnss_sdr_tcp_connector_tracking_tx'
|
||||||
|
blocks. The 'port' parameter sets the base port number for the first
|
||||||
|
channel (ch0). Each of the subsequent channels increases their port by one
|
||||||
|
unit (e.g. ch0_port=2070, ch1_port=2071,...).
|
||||||
|
|
||||||
|
Also the name of the tracking block can be modified. It must match with
|
||||||
|
the Simulink model name:
|
||||||
|
|
||||||
|
%Name of the tracking block, it must match the Simulink model name
|
||||||
|
tracking_block_name = 'gnss_sdr_tcp_connector_tracking';
|
||||||
|
|
||||||
|
To configure the MATLAB to work in parallel mode (the 'Parallel Computing'
|
||||||
|
Toolbox must be installed in the MATLAB) type in the Matlab Command Window
|
||||||
|
the following:
|
||||||
|
|
||||||
|
>> matlabpool(C)
|
||||||
|
|
||||||
|
where C is the number of cores of the computer to be used.
|
||||||
|
|
||||||
|
Then it should appear a message like this one:
|
||||||
|
|
||||||
|
"Destroying 1 pre-existing parallel job(s) created by matlabpool that were
|
||||||
|
in the finished or failed state.
|
||||||
|
|
||||||
|
Starting matlabpool using the 'local' configuration ... connected to 4
|
||||||
|
labs."
|
||||||
|
|
||||||
|
Once the MATLAB is configured to work in parallel mode, type the following
|
||||||
|
to run the script:
|
||||||
|
|
||||||
|
>> gnss_sdr_tcp_connector_parallel_tracking_start(N,C);
|
||||||
|
|
||||||
|
where N must match the number of channels configured in the GNSS-SDR
|
||||||
|
platform and C is the same as before.
|
||||||
|
|
||||||
|
Note: to stop working with the parallel mode type in the Command Window
|
||||||
|
the following:
|
||||||
|
|
||||||
|
>> matlabpool close
|
||||||
|
|
||||||
|
|
||||||
|
C) HOW TO replace the tracking block of the library
|
||||||
|
------------------------------------------------
|
||||||
|
|
||||||
|
1.- Open the library model 'gnss_sdr_tcp_connector_tracking_lib.mdl'
|
||||||
|
2.- Unlock the library. Click on "Edit > Unlock Library".
|
||||||
|
3.- Open the "gnss-sdr" block and change the "gnss_sdr_tcp_connector_tracking"
|
||||||
|
block by another one. If the name is different it must be updated in
|
||||||
|
the "gnss_sdr_tcp_connector_parallel_tracking_start.m" code (see
|
||||||
|
section B)
|
||||||
|
4.- Save the new library.
|
||||||
|
5.- Go to section A and follow the instructions.
|
||||||
|
|
|
@ -0,0 +1,201 @@
|
||||||
|
% /*!
|
||||||
|
% * \file gnss_sdr_tcp_connector_tracking_start.m
|
||||||
|
% * \brief This MATLAB function builds and configures a Simulink model
|
||||||
|
% * for interacting with the GNSS-SDR platform through a TCP
|
||||||
|
% * communication. Parallel Computing version.
|
||||||
|
% * \author David Pubill, 2012. dpubill(at)cttc.es
|
||||||
|
% *
|
||||||
|
% * ----------------------------------------------------------------------
|
||||||
|
% *
|
||||||
|
% * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||||
|
% *
|
||||||
|
% * GNSS-SDR is a software defined Global Navigation
|
||||||
|
% * Satellite Systems receiver
|
||||||
|
% *
|
||||||
|
% * This file is part of GNSS-SDR.
|
||||||
|
% *
|
||||||
|
% * GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
% * it under the terms of the GNU General Public License as published by
|
||||||
|
% * the Free Software Foundation, either version 3 of the License, or
|
||||||
|
% * at your option) any later version.
|
||||||
|
% *
|
||||||
|
% * GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
% * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
% * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
% * GNU General Public License for more details.
|
||||||
|
% *
|
||||||
|
% * You should have received a copy of the GNU General Public License
|
||||||
|
% * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
% *
|
||||||
|
% * ----------------------------------------------------------------------
|
||||||
|
% */
|
||||||
|
|
||||||
|
function gnss_sdr_tcp_connector_parallel_tracking_start(num_channels, num_cores)
|
||||||
|
|
||||||
|
%The parallel for (parfor) loop allows to build and run a Simulink
|
||||||
|
%model in parallel mode, programming different threads
|
||||||
|
parfor i = 0:num_cores-1;
|
||||||
|
|
||||||
|
%Open and close the Simulink Library
|
||||||
|
simulink('open');
|
||||||
|
simulink('close');
|
||||||
|
|
||||||
|
%User parameters
|
||||||
|
host = '84.88.61.86'; %Remote IP address (GNSS-SDR computer IP)
|
||||||
|
port = 2070; %Remote port (GNSS-SDR computer port for Ch0)
|
||||||
|
num_vars_rx = 9; %Number of variables expected from GNSS-SDR
|
||||||
|
num_vars_tx = 4; %Number of variable to be transmitted to GNSS-SDR
|
||||||
|
timeout = '40'; %Timeout [s]
|
||||||
|
|
||||||
|
%Name of the tracking block, it must match the Simulink model name
|
||||||
|
tracking_block_name = 'gnss_sdr_tcp_connector_tracking';
|
||||||
|
|
||||||
|
% Layout coordinates for the gnss_sdr_tcp_connector_tracking blocks
|
||||||
|
X0 = 20;
|
||||||
|
X1 = 170;
|
||||||
|
Y0 = 20;
|
||||||
|
Y1 = 140;
|
||||||
|
X_offset = 200;
|
||||||
|
Y_offset = 160;
|
||||||
|
|
||||||
|
%Calculate the size of the data received from GNSS-SDR
|
||||||
|
%(float = 4 bytes each variable)
|
||||||
|
datasize_RX = num_vars_rx*4;
|
||||||
|
|
||||||
|
%Create a Simulink model
|
||||||
|
model_name = ['gnss_sdr_tcp_connector_parallel_tracking_aux_', num2str(i)];
|
||||||
|
new_system(model_name);
|
||||||
|
open_system(model_name);
|
||||||
|
|
||||||
|
%Set parameters to avoid warnings in the Command Window
|
||||||
|
set_param(model_name,...
|
||||||
|
'InheritedTsInSrcMsg', 'none');
|
||||||
|
warning('off', 'Simulink:Commands:SetParamLinkChangeWarn');
|
||||||
|
|
||||||
|
%Assign values to the variables used by Simulink in the base workspace
|
||||||
|
assignin('base', 'Ti', 1e-3);
|
||||||
|
assignin('base', 'f0', 1.57542e9);
|
||||||
|
assignin('base', 'SFunSlope', 3.5);
|
||||||
|
assignin('base', 'Tc', 4e-3/4092);
|
||||||
|
assignin('base', 'T', 1e-3);
|
||||||
|
assignin('base', 'B_PLL', 50);
|
||||||
|
assignin('base', 'B_DLL', 2);
|
||||||
|
|
||||||
|
%Calculate some variables to control the number of blocks that
|
||||||
|
%should content each Simulink model in function of the number of
|
||||||
|
%cores specified
|
||||||
|
min_num_blocks_per_model = floor(num_channels/num_cores);
|
||||||
|
id = rem(num_channels,num_cores);
|
||||||
|
|
||||||
|
if(i<id)
|
||||||
|
aux=1;
|
||||||
|
else
|
||||||
|
aux=0;
|
||||||
|
end
|
||||||
|
|
||||||
|
%Build the Simulink model for the core 'i'
|
||||||
|
for m = 0:min_num_blocks_per_model+aux-1
|
||||||
|
|
||||||
|
index = m + min_num_blocks_per_model*i + min(id,i);
|
||||||
|
|
||||||
|
%Add and prepare an empty block to become the TCP connector block
|
||||||
|
tcp_connector_block=[model_name, '/gnss_sdr_tcp_connector_tracking_', num2str(index)];
|
||||||
|
|
||||||
|
add_block('simulink/Ports & Subsystems/Subsystem', tcp_connector_block);
|
||||||
|
delete_line(tcp_connector_block, 'In1/1', 'Out1/1')
|
||||||
|
|
||||||
|
tcp_connector_tracking_i_In1 = [model_name,'/gnss_sdr_tcp_connector_tracking_',num2str(index),'/In1'];
|
||||||
|
tcp_connector_tracking_i_Out1 = [model_name,'/gnss_sdr_tcp_connector_tracking_',num2str(index),'/Out1'];
|
||||||
|
|
||||||
|
delete_block(tcp_connector_tracking_i_In1);
|
||||||
|
delete_block(tcp_connector_tracking_i_Out1);
|
||||||
|
|
||||||
|
%Add to the TCP connector block the receiver, the tracking and the
|
||||||
|
%transmitter blocks
|
||||||
|
tcp_connector_tracking_rx_block = [model_name,'/gnss_sdr_tcp_connector_tracking_',num2str(index),'/gnss_sdr_tcp_connector_tracking_rx'];
|
||||||
|
tcp_connector_tracking_block = [model_name,'/gnss_sdr_tcp_connector_tracking_',num2str(index),'/', tracking_block_name];
|
||||||
|
tcp_connector_tracking_tx_block = [model_name,'/gnss_sdr_tcp_connector_tracking_',num2str(index),'/gnss_sdr_tcp_connector_tracking_tx'];
|
||||||
|
|
||||||
|
add_block('simulink/User-Defined Functions/gnss_sdr/gnss_sdr_tcp_connector_tracking_rx',tcp_connector_tracking_rx_block);
|
||||||
|
|
||||||
|
path_to_tracking_block = ['simulink/User-Defined Functions/gnss_sdr/', tracking_block_name];
|
||||||
|
add_block(path_to_tracking_block, tcp_connector_tracking_block);
|
||||||
|
|
||||||
|
add_block('simulink/User-Defined Functions/gnss_sdr/gnss_sdr_tcp_connector_tracking_tx',tcp_connector_tracking_tx_block);
|
||||||
|
|
||||||
|
%Connect the receiver block to the tracking block
|
||||||
|
for j=1:num_vars_rx;
|
||||||
|
rx_out_ports =['gnss_sdr_tcp_connector_tracking_rx/', num2str(j)];
|
||||||
|
tracking_in_ports =[tracking_block_name, '/', num2str(j)];
|
||||||
|
|
||||||
|
add_line(tcp_connector_block, rx_out_ports, tracking_in_ports)
|
||||||
|
end
|
||||||
|
|
||||||
|
%Connect the tracking block to the transmitter block
|
||||||
|
for k=1:num_vars_tx;
|
||||||
|
tracking_out_ports =[tracking_block_name, '/', num2str(k)];
|
||||||
|
tx_in_ports =['gnss_sdr_tcp_connector_tracking_tx/',num2str(k)];
|
||||||
|
|
||||||
|
add_line(tcp_connector_block, tracking_out_ports, tx_in_ports)
|
||||||
|
end
|
||||||
|
|
||||||
|
%Add, place and connect two scopes in the TCP connector block
|
||||||
|
name_scope_1 = [tcp_connector_block,'/Scope'];
|
||||||
|
add_block('simulink/Sinks/Scope', name_scope_1, 'Position', [500 300 550 350]);
|
||||||
|
set_param(name_scope_1, 'NumInputPorts', '4', 'LimitDataPoints', 'off');
|
||||||
|
add_line(tcp_connector_block, 'gnss_sdr_tcp_connector_tracking_rx/9', 'Scope/1', 'autorouting','on')
|
||||||
|
|
||||||
|
tracking_scope_port2 = [tracking_block_name,'/2'];
|
||||||
|
add_line(tcp_connector_block, tracking_scope_port2, 'Scope/2', 'autorouting','on')
|
||||||
|
tracking_scope_port3 = [tracking_block_name,'/3'];
|
||||||
|
add_line(tcp_connector_block, tracking_scope_port3, 'Scope/3', 'autorouting','on')
|
||||||
|
tracking_scope_port4 = [tracking_block_name,'/4'];
|
||||||
|
add_line(tcp_connector_block, tracking_scope_port4, 'Scope/4', 'autorouting','on')
|
||||||
|
|
||||||
|
name_scope_2 = [tcp_connector_block,'/EPL'];
|
||||||
|
add_block('simulink/Sinks/Scope', name_scope_2, 'Position', [500 400 550 450]);
|
||||||
|
set_param(name_scope_2, 'LimitDataPoints', 'off');
|
||||||
|
tracking_scope2_port5 = [tracking_block_name,'/5'];
|
||||||
|
add_line(tcp_connector_block, tracking_scope2_port5, 'EPL/1', 'autorouting','on')
|
||||||
|
|
||||||
|
num_port = port+index;
|
||||||
|
|
||||||
|
%Set the TCP receiver parameters
|
||||||
|
tcp_receiver = [model_name,'/gnss_sdr_tcp_connector_tracking_',num2str(index),'/gnss_sdr_tcp_connector_tracking_rx/RX'];
|
||||||
|
set_param(tcp_receiver, 'Port', num2str(num_port), 'Host', host, 'DataSize', num2str(datasize_RX), 'Timeout', timeout);
|
||||||
|
|
||||||
|
%Set the TCP transmitter parameters
|
||||||
|
tcp_transmitter = [model_name, '/gnss_sdr_tcp_connector_tracking_',num2str(index),'/gnss_sdr_tcp_connector_tracking_tx/TX'];
|
||||||
|
set_param(tcp_transmitter, 'Port', num2str(num_port), 'Host', host,'Timeout', timeout);
|
||||||
|
|
||||||
|
%New layout coordinates for each block
|
||||||
|
X2 = X0 + floor(m/4)*X_offset;
|
||||||
|
X3 = X1 + floor(m/4)*X_offset;
|
||||||
|
Y2 = Y0 + (m-4*floor(m/4))*Y_offset;
|
||||||
|
Y3 = Y1 + (m-4*floor(m/4))*Y_offset;
|
||||||
|
|
||||||
|
%Place the block in the layout
|
||||||
|
set_param(tcp_connector_block, 'Position', [X2 Y2 X3 Y3]);
|
||||||
|
end
|
||||||
|
|
||||||
|
%Set parameters to configure the model Solver
|
||||||
|
set_param(model_name,...
|
||||||
|
'SolverType', 'Fixed-step', 'Solver', 'FixedStepDiscrete',...
|
||||||
|
'FixedStep', 'auto', 'StopTime', 'inf');
|
||||||
|
|
||||||
|
%Save the model with a definitive name
|
||||||
|
model_name_ready = ['gnss_sdr_tcp_connector_parallel_tracking_ready_', num2str(i)];
|
||||||
|
save_system(model_name, model_name_ready);
|
||||||
|
|
||||||
|
%Pause the thread 'i*5' seconds in function of the number of core.
|
||||||
|
%This allows the system to establish the TCP connections in the
|
||||||
|
%correct order
|
||||||
|
if (aux == 0)
|
||||||
|
pause(i*5);
|
||||||
|
end
|
||||||
|
|
||||||
|
%Run the Simulink model
|
||||||
|
set_param(model_name_ready,'simulationcommand','start');
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,8 @@
|
||||||
/*!
|
/*!
|
||||||
* \file README.txt
|
* \file README.txt
|
||||||
* \brief How to add a block to the Simulink Library repository of Matlab
|
* \brief How to add a block to the Simulink Library repository of Matlab,
|
||||||
* and how to use the "gnss_sdr_tcp_connector_tracking_start.m" script.
|
* how to use the "gnss_sdr_tcp_connector_tracking_start.m" script and how
|
||||||
|
* to replace the tracking block of the library.
|
||||||
*
|
*
|
||||||
* \author David Pubill, 2012. dpubill(at)cttc.es
|
* \author David Pubill, 2012. dpubill(at)cttc.es
|
||||||
*
|
*
|
||||||
|
@ -35,7 +36,7 @@ IMPORTANT: Please, to use this tracking check the configuration file called
|
||||||
'gnss-sdr_tcp_connector_tracking.conf'. There are two major changes:
|
'gnss-sdr_tcp_connector_tracking.conf'. There are two major changes:
|
||||||
1.- Choose the [GPS_L1_CA_TCP_CONNECTOR_Tracking] tracking algorithm.
|
1.- Choose the [GPS_L1_CA_TCP_CONNECTOR_Tracking] tracking algorithm.
|
||||||
2.- Choose a tcp port for channel 0 (e.g. Tracking.port_ch0=2060;)
|
2.- Choose a tcp port for channel 0 (e.g. Tracking.port_ch0=2060;)
|
||||||
|
|
||||||
|
|
||||||
A) HOW TO add a block to the Simulink Library repository of your Matlab installation
|
A) HOW TO add a block to the Simulink Library repository of your Matlab installation
|
||||||
---------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------
|
||||||
|
@ -51,19 +52,31 @@ A) HOW TO add a block to the Simulink Library repository of your Matlab installa
|
||||||
Library menu, and click on "Open User-Defined Functions library"
|
Library menu, and click on "Open User-Defined Functions library"
|
||||||
(Window_1)
|
(Window_1)
|
||||||
|
|
||||||
4.- Open the library model 'gnss_sdr_tcp_connector_tracking_lib.mdl'(Window_2)
|
4.- Open the library model 'gnss_sdr_tcp_connector_tracking_lib.mdl'
|
||||||
|
(Window_2)
|
||||||
|
|
||||||
5.- Drag and drop the gnss_sdr_tcp_connector_tracking block from Window_2
|
5.- If this is not the first time there should be an existing 'gnss-sdr'
|
||||||
to Window_1. A new message should appear: "This library is locked. The
|
block in the 'User-Defined Functions' window that should be deleted
|
||||||
action performed requires it to be unlocked". Then, click on the "Unlock"
|
before drag and drop the new 'gnss_sdr' block (which includes 3 blocks:
|
||||||
button (the block will be copied) and close Window_2.
|
- 'gnss_sdr_tcp_connector_tracking_rx' block
|
||||||
|
- 'gnss_sdr_tcp_connector_tracking' block
|
||||||
|
- 'gnss_sdr_tcp_connector_tracking_tx' block)
|
||||||
|
from Window_2 to Window_1. A new message should appear: "This library
|
||||||
|
is locked. The action performed requires it to be unlocked". Then,
|
||||||
|
click on the "Unlock" button (the block will be copied) and close
|
||||||
|
Window_2.
|
||||||
|
|
||||||
6.- On Window_1 save the "simulink/User-Defined Functions" library.
|
6.- Right-click on the 'gnss-sdr' block and click on "Link Options -->
|
||||||
|
Disable link", repeat the action but now clicking on "Link Options -->
|
||||||
|
Break link". This action disables and breaks the link with the
|
||||||
|
original library model.
|
||||||
|
|
||||||
|
7.- On Window_1 save the "simulink/User-Defined Functions" library.
|
||||||
To do that go to "File > Save". Then, close Window_1.
|
To do that go to "File > Save". Then, close Window_1.
|
||||||
|
|
||||||
7.- From "Simulink Library Browser" window, press F5 to refresh and generate
|
8.- From "Simulink Library Browser" window, press F5 to refresh and generate
|
||||||
the new Simulink Library repository. This may take a few seconds, and
|
the new Simulink Library repository (it may take a few seconds). This
|
||||||
this finish the installation of the custom Simulink block.
|
completes the installation of the custom Simulink block.
|
||||||
|
|
||||||
|
|
||||||
B) HOW TO use the "gnss_sdr_tcp_connector_tracking_start.m" script:
|
B) HOW TO use the "gnss_sdr_tcp_connector_tracking_start.m" script:
|
||||||
|
@ -71,9 +84,9 @@ B) HOW TO use the "gnss_sdr_tcp_connector_tracking_start.m" script:
|
||||||
|
|
||||||
----------------------- ------------------ -----------------------
|
----------------------- ------------------ -----------------------
|
||||||
| | | | | |
|
| | | | | |
|
||||||
| gnss_sdr_tcp_ | | | | gnss_sdr_tcp_ |
|
| gnss_sdr_tcp_ | | gnss_sdr_tcp_ | | gnss_sdr_tcp_ |
|
||||||
| connector_tracking_ | --> | Core | --> | connector_tracking_ |
|
| connector_tracking_ | --> | connector_ | --> | connector_tracking_ |
|
||||||
| receive | | | | send |
|
| rx | | tracking | | tx |
|
||||||
| | | | | |
|
| | | | | |
|
||||||
----------------------- ------------------ -----------------------
|
----------------------- ------------------ -----------------------
|
||||||
|
|
||||||
|
@ -81,22 +94,25 @@ The 'gnss_sdr_tcp_connector_tracking_start.m' is the script that builds and
|
||||||
configures a simulink model for interacting with the GNSS-SDR platform
|
configures a simulink model for interacting with the GNSS-SDR platform
|
||||||
through a TCP communication. 'User parameters' can be modified but, by
|
through a TCP communication. 'User parameters' can be modified but, by
|
||||||
default, these are the values assigned:
|
default, these are the values assigned:
|
||||||
|
|
||||||
%User parameters
|
%User parameters
|
||||||
host = '84.88.61.86'; //Remote IP address (GNSS-SDR computer IP)
|
host = '84.88.61.86'; %Remote IP address (GNSS-SDR computer IP)
|
||||||
port = 2060; //Remote port (GNSS-SDR computer port for Ch0)
|
port = 2070; %Remote port (GNSS-SDR computer port for Ch0)
|
||||||
datasize_RX = '28'; //Data size
|
num_vars_rx = 9; %Number of variables expected from GNSS-SDR
|
||||||
timeout = '10'; //Timeout in seconds
|
num_vars_tx = 4; %Number of variable to be transmitted to GNSS-SDR
|
||||||
|
timeout = '40'; %Timeout in seconds
|
||||||
|
|
||||||
'host', 'port' and 'timeout' parameters configure both 'gnss_sdr_tcp_connector_tracking_receive'
|
'host', 'port' and 'timeout' parameters configure both
|
||||||
and 'gnss_sdr_tcp_connector_tracking_send' blocks. The 'port' parameter
|
'gnss_sdr_tcp_connector_tracking_rx' and 'gnss_sdr_tcp_connector_tracking_tx'
|
||||||
sets the base port number for the first channel (ch0). Each of the
|
blocks. The 'port' parameter sets the base port number for the first
|
||||||
subsequent channels increases their port by one unit (e.g. ch0_port=2060,
|
channel (ch0). Each of the subsequent channels increases their port by one
|
||||||
ch1_port=2061,...)
|
unit (e.g. ch0_port=2070, ch1_port=2071,...).
|
||||||
|
|
||||||
'datasize_RX' is the size (in bytes) of the received TCP packet data field.
|
Also the name of the tracking block can be modified. It must match with
|
||||||
For example, if the number of float (4 bytes) variables to be received from
|
the Simulink model name:
|
||||||
the the GNSS-SDR computer is 7, this parameter must be set to 7*4=28.
|
|
||||||
|
%Name of the tracking block, it must match the Simulink model name
|
||||||
|
tracking_block_name = 'gnss_sdr_tcp_connector_tracking';
|
||||||
|
|
||||||
To run the script just type in the Matlab Command window the following:
|
To run the script just type in the Matlab Command window the following:
|
||||||
|
|
||||||
|
@ -106,8 +122,15 @@ where N must match the number of channels configured in the GNSS-SDR
|
||||||
platform.
|
platform.
|
||||||
|
|
||||||
|
|
||||||
|
C) HOW TO replace the tracking block of the library
|
||||||
|
------------------------------------------------
|
||||||
|
|
||||||
|
1.- Open the library model 'gnss_sdr_tcp_connector_tracking_lib.mdl'
|
||||||
|
2.- Unlock the library. Click on "Edit > Unlock Library".
|
||||||
|
3.- Open the "gnss-sdr" block and change the "gnss_sdr_tcp_connector_tracking"
|
||||||
|
block by another one. If the name is different it must be updated in
|
||||||
|
the "gnss_sdr_tcp_connector_parallel_tracking_start.m" code (see
|
||||||
|
section B)
|
||||||
|
4.- Save the new library.
|
||||||
|
5.- Go to section A and follow the instructions.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,170 @@
|
||||||
|
% /*!
|
||||||
|
% * \file gnss_sdr_tcp_connector_tracking_start.m
|
||||||
|
% * \brief This MATLAB function builds and configures a simulink model
|
||||||
|
% * for interacting with the GNSS-SDR platform through a TCP communication.
|
||||||
|
% * \author David Pubill, 2012. dpubill(at)cttc.es
|
||||||
|
% *
|
||||||
|
% * ----------------------------------------------------------------------
|
||||||
|
% *
|
||||||
|
% * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||||
|
% *
|
||||||
|
% * GNSS-SDR is a software defined Global Navigation
|
||||||
|
% * Satellite Systems receiver
|
||||||
|
% *
|
||||||
|
% * This file is part of GNSS-SDR.
|
||||||
|
% *
|
||||||
|
% * GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
% * it under the terms of the GNU General Public License as published by
|
||||||
|
% * the Free Software Foundation, either version 3 of the License, or
|
||||||
|
% * at your option) any later version.
|
||||||
|
% *
|
||||||
|
% * GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
% * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
% * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
% * GNU General Public License for more details.
|
||||||
|
% *
|
||||||
|
% * You should have received a copy of the GNU General Public License
|
||||||
|
% * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
% *
|
||||||
|
% * ----------------------------------------------------------------------
|
||||||
|
% */
|
||||||
|
|
||||||
|
function gnss_sdr_tcp_connector_tracking_start(num_channels)
|
||||||
|
|
||||||
|
%User parameters
|
||||||
|
host = '84.88.61.86'; %Remote IP address (GNSS-SDR computer IP)
|
||||||
|
port = 2070; %Remote port (GNSS-SDR computer port for Ch0)
|
||||||
|
num_vars_rx = 9; %Number of variables expected from GNSS-SDR
|
||||||
|
num_vars_tx = 4; %Number of variable to be transmitted to GNSS-SDR
|
||||||
|
timeout = '40'; %Timeout [s]
|
||||||
|
|
||||||
|
%name of the tracking block, it must match the name of the Simulink
|
||||||
|
%model
|
||||||
|
tracking_block_name = 'gnss_sdr_tcp_connector_tracking';
|
||||||
|
|
||||||
|
% Layout coordinates for the first gnss_sdr_tcp_connector_tracking
|
||||||
|
% block and offset definitions
|
||||||
|
X0 = 20;
|
||||||
|
X1 = 170;
|
||||||
|
Y0 = 20;
|
||||||
|
Y1 = 140;
|
||||||
|
X_offset = 200;
|
||||||
|
Y_offset = 160;
|
||||||
|
|
||||||
|
%Calculate the size of the data received from GNSS-SDR
|
||||||
|
%(float = 4 bytes each variable)
|
||||||
|
datasize_RX = num_vars_rx*4;
|
||||||
|
|
||||||
|
%Create a Simulink model
|
||||||
|
simulink('open');
|
||||||
|
new_system('gnss_sdr_tcp_connector_tracking_aux');
|
||||||
|
open_system('gnss_sdr_tcp_connector_tracking_aux');
|
||||||
|
|
||||||
|
%Set parameters to avoid warnings in the Command Window
|
||||||
|
set_param('gnss_sdr_tcp_connector_tracking_aux',...
|
||||||
|
'InheritedTsInSrcMsg', 'none');
|
||||||
|
warning('off', 'Simulink:Commands:SetParamLinkChangeWarn');
|
||||||
|
|
||||||
|
%Assign values to the variables used by Simulink in the base workspace
|
||||||
|
assignin('base', 'Ti', 1e-3);
|
||||||
|
assignin('base', 'f0', 1.57542e9);
|
||||||
|
assignin('base', 'SFunSlope', 3.5);
|
||||||
|
assignin('base', 'Tc', 4e-3/4092);
|
||||||
|
assignin('base', 'T', 1e-3);
|
||||||
|
assignin('base', 'B_PLL', 50);
|
||||||
|
assignin('base', 'B_DLL', 2);
|
||||||
|
|
||||||
|
%Block generation from the Simulink Library
|
||||||
|
for i = 0:num_channels-1;
|
||||||
|
|
||||||
|
%Add and prepare an empty block to become the TCP connector block
|
||||||
|
tcp_connector_block=['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_', num2str(i)];
|
||||||
|
|
||||||
|
add_block('simulink/Ports & Subsystems/Subsystem', tcp_connector_block);
|
||||||
|
delete_line(tcp_connector_block,'In1/1', 'Out1/1')
|
||||||
|
|
||||||
|
tcp_connector_tracking_i_In1 = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',num2str(i),'/In1'];
|
||||||
|
tcp_connector_tracking_i_Out1 = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',num2str(i),'/Out1'];
|
||||||
|
|
||||||
|
delete_block(tcp_connector_tracking_i_In1);
|
||||||
|
delete_block(tcp_connector_tracking_i_Out1);
|
||||||
|
|
||||||
|
%Add to the TCP connector block the receiver, the tracking and the
|
||||||
|
%transmitter blocks
|
||||||
|
tcp_connector_tracking_rx_block = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',num2str(i),'/gnss_sdr_tcp_connector_tracking_rx'];
|
||||||
|
tcp_connector_tracking_block = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',num2str(i),'/',tracking_block_name];
|
||||||
|
tcp_connector_tracking_tx_block = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',num2str(i),'/gnss_sdr_tcp_connector_tracking_tx'];
|
||||||
|
|
||||||
|
add_block('simulink/User-Defined Functions/gnss_sdr/gnss_sdr_tcp_connector_tracking_rx',tcp_connector_tracking_rx_block);
|
||||||
|
|
||||||
|
path_to_tracking_block = ['simulink/User-Defined Functions/gnss_sdr/', tracking_block_name];
|
||||||
|
add_block(path_to_tracking_block, tcp_connector_tracking_block);
|
||||||
|
|
||||||
|
add_block('simulink/User-Defined Functions/gnss_sdr/gnss_sdr_tcp_connector_tracking_tx',tcp_connector_tracking_tx_block);
|
||||||
|
|
||||||
|
%Connect the receiver block to the tracking block
|
||||||
|
for j=1:num_vars_rx;
|
||||||
|
rx_out_ports =['gnss_sdr_tcp_connector_tracking_rx/',num2str(j)];
|
||||||
|
tracking_in_ports =[tracking_block_name,'/',num2str(j)];
|
||||||
|
|
||||||
|
add_line(tcp_connector_block, rx_out_ports, tracking_in_ports)
|
||||||
|
end
|
||||||
|
|
||||||
|
%Connect the tracking block to the transmitter block
|
||||||
|
for k=1:num_vars_tx;
|
||||||
|
tracking_out_ports =[tracking_block_name,'/',num2str(k)];
|
||||||
|
tx_in_ports =['gnss_sdr_tcp_connector_tracking_tx/',num2str(k)];
|
||||||
|
|
||||||
|
add_line(tcp_connector_block, tracking_out_ports, tx_in_ports)
|
||||||
|
end
|
||||||
|
|
||||||
|
%Add, place and connect two scopes in the TCP connector block
|
||||||
|
name_scope_1 = [tcp_connector_block,'/Scope'];
|
||||||
|
add_block('simulink/Sinks/Scope', name_scope_1, 'Position', [500 300 550 350]);
|
||||||
|
set_param(name_scope_1, 'NumInputPorts', '4', 'LimitDataPoints', 'off');
|
||||||
|
add_line(tcp_connector_block, 'gnss_sdr_tcp_connector_tracking_rx/9', 'Scope/1', 'autorouting','on')
|
||||||
|
|
||||||
|
tracking_scope_port2 = [tracking_block_name,'/2'];
|
||||||
|
add_line(tcp_connector_block, tracking_scope_port2, 'Scope/2', 'autorouting','on')
|
||||||
|
tracking_scope_port3 = [tracking_block_name,'/3'];
|
||||||
|
add_line(tcp_connector_block, tracking_scope_port3, 'Scope/3', 'autorouting','on')
|
||||||
|
tracking_scope_port4 = [tracking_block_name,'/4'];
|
||||||
|
add_line(tcp_connector_block, tracking_scope_port4, 'Scope/4', 'autorouting','on')
|
||||||
|
|
||||||
|
name_scope_2 = [tcp_connector_block,'/EPL'];
|
||||||
|
add_block('simulink/Sinks/Scope', name_scope_2, 'Position', [500 400 550 450]);
|
||||||
|
set_param(name_scope_2, 'LimitDataPoints', 'off');
|
||||||
|
tracking_scope2_port5 = [tracking_block_name,'/5'];
|
||||||
|
add_line(tcp_connector_block, tracking_scope2_port5, 'EPL/1', 'autorouting','on')
|
||||||
|
|
||||||
|
%Set the TCP receiver parameters
|
||||||
|
tcp_receiver = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',num2str(i),'/gnss_sdr_tcp_connector_tracking_rx/RX'];
|
||||||
|
set_param(tcp_receiver, 'Port', num2str(port+i), 'Host', host, 'DataSize', num2str(datasize_RX), 'Timeout', timeout);
|
||||||
|
|
||||||
|
%Set the TCP transmitter parameters
|
||||||
|
tcp_transmitter = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',num2str(i),'/gnss_sdr_tcp_connector_tracking_tx/TX'];
|
||||||
|
set_param(tcp_transmitter, 'Port', num2str(port+i), 'Host', host,'Timeout', timeout);
|
||||||
|
|
||||||
|
%New layout coordinates for each block
|
||||||
|
X2 = X0 + floor(i/4)*X_offset;
|
||||||
|
X3 = X1 + floor(i/4)*X_offset;
|
||||||
|
Y2 = Y0 + (i-4*floor(i/4))*Y_offset;
|
||||||
|
Y3 = Y1 + (i-4*floor(i/4))*Y_offset;
|
||||||
|
|
||||||
|
%Place the block in the layout
|
||||||
|
set_param(tcp_connector_block, 'Position', [X2 Y2 X3 Y3]);
|
||||||
|
end
|
||||||
|
|
||||||
|
%Set parameters to configure the model Solver
|
||||||
|
set_param('gnss_sdr_tcp_connector_tracking_aux',...
|
||||||
|
'SolverType', 'Fixed-step', 'Solver', 'FixedStepDiscrete',...
|
||||||
|
'FixedStep', 'auto', 'StopTime', 'inf');
|
||||||
|
|
||||||
|
%Save the model with a definitive name
|
||||||
|
save_system('gnss_sdr_tcp_connector_tracking_aux', 'gnss_sdr_tcp_connector_tracking_ready');
|
||||||
|
simulink('close');
|
||||||
|
|
||||||
|
%Run the Simulink model
|
||||||
|
set_param('gnss_sdr_tcp_connector_tracking_ready','simulationcommand','start');
|
||||||
|
|
||||||
|
end
|
|
@ -1,100 +0,0 @@
|
||||||
% /*!
|
|
||||||
% * \file gnss_sdr_tcp_connector_tracking_start.m
|
|
||||||
% * \brief This MATLAB function builds and configures a simulink model
|
|
||||||
% * for interacting with the GNSS-SDR platform through a TCP communication.
|
|
||||||
% * \author David Pubill, 2012. dpubill(at)cttc.es
|
|
||||||
% *
|
|
||||||
% * ----------------------------------------------------------------------
|
|
||||||
% *
|
|
||||||
% * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
|
||||||
% *
|
|
||||||
% * GNSS-SDR is a software defined Global Navigation
|
|
||||||
% * Satellite Systems receiver
|
|
||||||
% *
|
|
||||||
% * This file is part of GNSS-SDR.
|
|
||||||
% *
|
|
||||||
% * GNSS-SDR is free software: you can redistribute it and/or modify
|
|
||||||
% * it under the terms of the GNU General Public License as published by
|
|
||||||
% * the Free Software Foundation, either version 3 of the License, or
|
|
||||||
% * at your option) any later version.
|
|
||||||
% *
|
|
||||||
% * GNSS-SDR is distributed in the hope that it will be useful,
|
|
||||||
% * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
% * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
% * GNU General Public License for more details.
|
|
||||||
% *
|
|
||||||
% * You should have received a copy of the GNU General Public License
|
|
||||||
% * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
% *
|
|
||||||
% * ----------------------------------------------------------------------
|
|
||||||
% */
|
|
||||||
|
|
||||||
function gnss_sdr_tcp_connector_tracking_start(num_channels)
|
|
||||||
|
|
||||||
%User parameters
|
|
||||||
host = '84.88.61.86'; %Remote IP address (GNSS-SDR computer IP)
|
|
||||||
port = 2060; %Remote port (GNSS-SDR computer port for Ch0)
|
|
||||||
datasize_RX = '28'; %Data size
|
|
||||||
timeout = '10'; %Timeout in seconds
|
|
||||||
|
|
||||||
% Layout coordinates for the first gnss_sdr_tcp_connector_tracking
|
|
||||||
% block and offset definitions
|
|
||||||
X0 = 20;
|
|
||||||
X1 = 170;
|
|
||||||
Y0 = 20;
|
|
||||||
Y1 = 140;
|
|
||||||
X_offset = 200;
|
|
||||||
Y_offset = 160;
|
|
||||||
|
|
||||||
%Create a Simulink model
|
|
||||||
simulink('open');
|
|
||||||
new_system('gnss_sdr_tcp_connector_tracking_aux');
|
|
||||||
open_system('gnss_sdr_tcp_connector_tracking_aux');
|
|
||||||
|
|
||||||
%Set parameters to configure the model Solver
|
|
||||||
set_param('gnss_sdr_tcp_connector_tracking_aux',...
|
|
||||||
'SolverType', 'Fixed-step', 'Solver', 'FixedStepDiscrete',...
|
|
||||||
'FixedStep', '100', 'StopTime', 'inf');
|
|
||||||
|
|
||||||
%Set parameters to avoid warnings in the Command Window
|
|
||||||
set_param('gnss_sdr_tcp_connector_tracking_aux',...
|
|
||||||
'InheritedTsInSrcMsg', 'none');
|
|
||||||
warning('off', 'Simulink:Commands:SetParamLinkChangeWarn');
|
|
||||||
|
|
||||||
%Block generation from the Simulink Library
|
|
||||||
for i=0:num_channels-1;
|
|
||||||
|
|
||||||
name_new_block=['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',...
|
|
||||||
num2str(i)];
|
|
||||||
|
|
||||||
add_block('simulink/User-Defined Functions/gnss_sdr_tcp_connector_tracking',...
|
|
||||||
name_new_block);
|
|
||||||
|
|
||||||
name_RX = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',...
|
|
||||||
num2str(i),'/gnss_sdr_tcp_connector_tracking_receive'];
|
|
||||||
|
|
||||||
set_param(name_RX, 'Port', num2str(port+i), 'Host', host,...
|
|
||||||
'DataSize', datasize_RX, 'Timeout', timeout);
|
|
||||||
|
|
||||||
name_TX = ['gnss_sdr_tcp_connector_tracking_aux/gnss_sdr_tcp_connector_tracking_',...
|
|
||||||
num2str(i),'/gnss_sdr_tcp_connector_tracking_send'];
|
|
||||||
|
|
||||||
set_param(name_TX, 'Port', num2str(port+i), 'Host', host,...
|
|
||||||
'Timeout', timeout);
|
|
||||||
|
|
||||||
%New layout coordinates for each block
|
|
||||||
X2 = X0 + floor(i/4)*X_offset;
|
|
||||||
X3 = X1 + floor(i/4)*X_offset;
|
|
||||||
Y2 = Y0 + (i-4*floor(i/4))*Y_offset;
|
|
||||||
Y3 = Y1 + (i-4*floor(i/4))*Y_offset;
|
|
||||||
|
|
||||||
set_param(name_new_block, 'Position', [X2 Y2 X3 Y3]);
|
|
||||||
end
|
|
||||||
|
|
||||||
save_system('gnss_sdr_tcp_connector_tracking_aux', 'gnss_sdr_tcp_connector_tracking_ready');
|
|
||||||
simulink('close');
|
|
||||||
|
|
||||||
%Start Simulink simulation
|
|
||||||
set_param('gnss_sdr_tcp_connector_tracking_ready','simulationcommand','start');
|
|
||||||
|
|
||||||
end
|
|
Loading…
Reference in New Issue