SoftGNSS/GNSS_SDR_IQ/initSettings_IQ.m

111 lines
5.2 KiB
Mathematica
Raw Permalink Normal View History

2025-10-22 16:08:12 +07:00
function settings = initSettings_IQ()
%Functions initializes and saves settings. Settings can be edited inside of
%the function, updated from the command line or updated using a dedicated
%GUI - "setSettings".
%
%All settings are described inside function code.r
%
%settings = initSettings()
%
% Inputs: none
%
% Outputs:
% settings - Receiver settings (a structure).
%--------------------------------------------------------------------------
% SoftGNSS v3.0
%
% Copyright (C) Darius Plausinaitis
% Written by Darius Plausinaitis
%--------------------------------------------------------------------------
%This program 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 2
%of the License, or (at your option) any later version.
%
%This program 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 this program; if not, write to the Free Software
%Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
%USA.
%--------------------------------------------------------------------------
%% Optional Parameters
% Number of milliseconds to be processed used 36000 + any transients (see
% below - in Nav parameters) to ensure nav subframes are provided
settings.msToProcess = 5*1e3; %[ms]
% Move the starting point of processing.
settings.skipNumberOfBytes = 0*2.046e9; %0*2.046e6; %0*2.046e6;%1.5*4.092e6*2; % settings.samplingFreq;%13169313;%settings.samplingFreq/5*4;%+16e3*50;%16e3*100.;
% The notch bandwidth of filter
settings.Brej = 5e3;
settings.fileName = 'D:\Long\NAVIS\Data\2023-12-20.bin';
%settings.fileName = 'E:\TEXBAT\cleanDynamic_spoofing.bin';
%settings.fileName ='K:\DATA\Projects\SDR\gnss-sdr-sim\vs-gps-sdr-sim\vs-gps-sdr-sim\x64\Debug\gpssim.bin';'D:\test_4093.bin';'D:\RTL2832U_Data\test_1.bin';'D:\test.bin';['C:\rtldata\test_0.bin'];%['C:\Users\thuan\Downloads\sdrsharp-x86\SDRSharp_20151223_155844Z_1575420000Hz_IQ.wav'];%
% settings.fileName = ['D:\IF_DATA\RTL2832\140320_1243_1.dat'];
settings.relativeFreq = 0;
%% Independent parameters
% Number of channels to be used for signal processing
settings.numberOfChannels = 5;
% Intermediate, sampling and code frequencies
settings.IF = 0e3; %[Hz] tn s trung gian
settings.samplingFreq = 2e6; %2.5e7; %2e6; 2.6e6; 8184000; [Hz] tn s ly mu
settings.codeFreqBasis = 1.023e6; %[Hz] tn s mã
% Define number of chips in a code period
settings.codeLength = 1023; % s lưng chip trong 1 chu k mã
settings.samplesPDI = settings.samplingFreq*10e-3;
% Number of samples per spreading code
settings.samplesPerCode = round(settings.samplingFreq / ...
(settings.codeFreqBasis / settings.codeLength));
settings.dataType = 'int16';
if strcmp(settings.dataType,'int8')
settings.dataTypeSize = 1;
else
settings.dataTypeSize = 2;
end;
%% Acquisition settings ===================================================
% Skips acquisition in the script postProcessing.m if set to 1
settings.skipAcquisition = 2e6;
% List of satellites to look for. Some satellites can be excluded to speed
% up acquisition
settings.acqSatelliteList = 1:32; %[PRN numbers]
% Band around IF to search for satellite signal. Depends on max Doppler
settings.acqSearchBand = 10; %[kHz]
% Threshold for the signal presence decision rule
settings.acqThreshold = 2.4;
%% Tracking loops settings ================================================
% Code tracking loop parameters
settings.dllDampingRatio = 0.7;
settings.dllNoiseBandwidth = 2; %[Hz] 2
settings.dllCorrelatorSpacing = 0.5; %[chips]
% Carrier tracking loop parameters
settings.pllDampingRatio = 0.7;
settings.pllNoiseBandwidth = 25; %[Hz] 25
%% Navigation solution settings ===========================================
% Period for calculating pseudoranges and position
settings.navSolPeriod = 100; %[ms]
% Elevation mask to exclude signals from satellites at low elevation
settings.elevationMask = 10; %[degrees 0 - 90]
% Enable/disable use of tropospheric correction
settings.useTropCorr = 1; % 0 - Off
% 1 - On
% True position of the antenna in UTM system (if known). Otherwise enter
% all NaN's and mean position will be used as a reference .
settings.truePosition.E = nan;
settings.truePosition.N = nan;
settings.truePosition.U = nan;
%% Plot settings ==========================================================
% Enable/disable plotting of the tracking results for each channel
settings.plotTracking = 1; % 0 - Off
% 1 - On
settings.plotAcquisition = 1;
%% Constants ==============================================================
settings.c = 299792458; % The speed of light, [m/s]
settings.startOffset = 68.802; %[ms] Initial sign. travel time