postProcessing.m ( File view )

  • By jevei01 2015-06-02
  • View(s):13
  • Download(s):2
  • Point(s): 1
			% Script postProcessing.m processes the raw signal from the specified data
% file (in settings) operating on blocks of 37 seconds of data.
% First it runs acquisition code identifying the satellites in the file,
% then the code and carrier for each of the satellites are tracked, storing
% the 1msec accumulations.  After processing all satellites in the 37 sec
% data block, then postNavigation is called. It calculates pseudoranges
% and attempts a position solutions. At the end plots are made for that
% block of data.

%                           SoftGNSS v3.0
% Copyright (C) Darius Plausinaitis
% Written by Darius Plausinaitis, Dennis M. Akos
% Some ideas by Dennis M. Akos
%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
%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,

%                         THE SCRIPT "RECIPE"
% The purpose of this script is to combine all parts of the software
% receiver.
% 1.1) Open the data file for the processing and seek to desired point.
% 2.1) Acquire satellites
% 3.1) Initialize channels (preRun.m).
% 3.2) Pass the channel structure and the file identifier to the tracking
% function. It will read and process the data. The tracking results are
% stored in the trackResults structure. The results can be accessed this
% way (the results are stored each millisecond):
% trackResults(channelNumber).XXX(fromMillisecond : toMillisecond), where
% XXX is a field name of the result (e.g. I_P, codePhase etc.)
% 4) Pass tracking results to the navigation solution function. It will
% decode navigation messages, find satellite positions, measure
% pseudoranges and find receiver position.
% 5) Plot the results.

%% Initialization =========================================================
disp ('Starting processing...');

[fid, message] = fopen(settings.fileName, 'rb');

%If success, then process the data
if (fid > 0)
    % Move the starting point of processing. Can be used to start the
    % signal processing at any point in the data record (e.g. good for long
    % records or for signal processing in blocks).
    fseek(fid, settings.skipNumberOfBytes, 'bof');

%% Acquisition ============================================================

    % Do acquisition if it is not disabled in settings or if the variable
    % acqResults does not exist.
    if ((settings.skipAcquisition == 0) || ~exist('acqResults', 'var'))
        % Find number of samples per spreading code
        samplesPerCode = round(settings.samplingFreq / ...
                           (settings.codeFreqBasis / settings.codeLength));
        % Read data for acquisition. 11ms of signal are needed for the fine
        % frequency estimation
        data = fread(fid, 11*samplesPerCode, settings.dataType)';

        %--- Do the acquisition -------------------------------------------
        disp ('   Acquiring satellites...');
        acqResults = acquisition(data, settings);


%% Initialize channels and prepare for the run ============================

    % Start further processing only if a GNSS signal was acquired (the
    % field FREQUENCY will be set to 0 for all not acquired signals)
    if (any(acqResults.carrFreq))
        channel = preRun(acqResults, settings);
        showChannelStatus(channel, settings);
        % No satellites to track, exit
        disp('No GNSS signals detected, signal processing finished.');
        trackResults = [];

%% Track the signal =======================================================
    startTime = now;
    disp (['   Tracking started at ', datestr(startTime)]);

    % Process all channels for given data block
    [trackResults, channel] = tracking(fid, channel, settings);

    % Close the data file
    disp(['   Tracking is over (elapsed time ', ...
                                        datestr(now - startTime, 13), ')'])     

    % Auto save the acquisition & tracking results to a file to allow
    % running the positioning solution afterwards.
    disp('   Saving Acq & Tracking results to file "trackingResults.mat"')
    save('trackingResults', ...
                      'trackResults', 'settings', 'acqResults', 'channel');                  

%% Calculate navigation solutions =========================================
    disp('   Calculating navigation solutions...');
    navSolutions = postNavigation(trackResults, settings);

    disp('   Processing is complete for this data block');

%% Plot all results ===================================================
    disp ('   Ploting results...');
    if settings.plotTracking
        plotTracking(1:settings.numberOfChannels, trackResults, settings);

    plotNavigation(navSolutions, settings);

    disp('Post processing of the signal is over.');

    % Error while opening the data file.
    error('Unable to read file %s: %s.', settings.fileName, message);
end % if (fid > 0)
Expand> <Close

Want complete source code? Download it here

Point(s): 1

0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
2011-7-9.fig29.84 kB09-07-11 11:53
acq.fig7.29 kB09-07-11 11:54
acquisition.m9.21 kB23-06-10 11:25
calculatePseudoranges.m3.29 kB23-06-10 11:25
findPreambles.m6.57 kB23-06-10 11:25
cart2geo.m1.68 kB23-06-10 11:26
cart2utm.m4.94 kB23-06-10 11:26
check_t.m679.00 B23-06-10 11:26
clksin.m945.00 B23-06-10 11:26
clsin.m619.00 B23-06-10 11:27
e_r_corr.m1.11 kB23-06-10 11:27
findUtmZone.m2.59 kB23-06-10 11:27
geo2cart.m1.51 kB23-06-10 11:27
leastSquarePos.m4.36 kB23-06-10 11:27
satpos.m5.08 kB23-06-10 11:27
togeod.m2.82 kB23-06-10 11:27
topocent.m1.38 kB23-06-10 11:27
tropo.m2.83 kB23-06-10 11:27
calcLoopCoef.m1.67 kB23-06-10 11:26
checkPhase.m1.87 kB23-06-10 11:26
ephemeris.m7.12 kB23-06-10 11:26
generateCAcode.m3.48 kB23-06-10 11:26
invert.m1.39 kB23-06-10 11:26
makeCaTable.m3.20 kB23-06-10 11:26
navPartyChk.m4.54 kB23-06-10 11:26
preRun.m3.29 kB23-06-10 11:26
showChannelStatus.m2.49 kB23-06-10 11:26
skyPlot.m6.54 kB23-06-10 11:26
twosComp2dec.m1.80 kB23-06-10 11:26
init.m3.16 kB23-06-10 11:25
initSettings.asv4.85 kB12-07-11 14:20
initSettings.m4.88 kB11-01-12 18:51
length.txt7.00 B11-01-12 09:45
length.txt.bak6.00 B25-12-11 16:08
license.txt17.90 kB23-06-10 11:25
plotAcquisition.m2.18 kB23-06-10 11:25
plotNavigation.m6.33 kB23-06-10 11:25
plotTracking.m6.58 kB23-06-10 11:25
postNavigation.m11.93 kB23-06-10 11:25
postProcessing.m5.81 kB23-06-10 11:26
probeData.asv4.19 kB09-01-11 23:49
probeData.m4.22 kB10-01-11 13:01
setSettings.fig14.08 kB23-06-10 11:26
setSettings.m15.88 kB23-06-10 11:26
tracking.m13.18 kB23-06-10 11:26
trackingResults.mat271.00 kB14-01-12 22:56
<geoFunctions>0.00 B05-06-13 09:57
<include>0.00 B05-06-13 09:57
<work>0.00 B02-06-15 17:06
Sponsored links

postProcessing.m (389.51 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point


Don't have an account? Register now
Need any help?
Mail to:


CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D