1.流程图
(待补充,没人看就不补充了。。。。。。)
2.代码解析
function [navSolutions, eph] = postNavigation(trackResults, settings)
%Function calculates navigation solutions for the receiver (pseudoranges,
%positions). At the end it converts coordinates from the WGS84 system to
%the UTM, geocentric or any additional coordinate system.
%
%[navSolutions, eph] = postNavigation(trackResults, settings)
%
% Inputs:
% trackResults - results from the tracking function (structure
% array).
% settings - receiver settings.
% Outputs:
% navSolutions - contains measured pseudoranges, receiver
% clock error, receiver coordinates in several
% coordinate systems (at least ECEF and UTM).
% eph - received ephemerides of all SV (structure array).
%--------------------------------------------------------------------------
% SoftGNSS v3.0
settings = initSettings();
if (settings.msToProcess < 36000) || (sum([trackResults.status] ~= '-') < 4)
% Show the error message and exit
disp('Record is to short or too few satellites tracked. Exiting!');
navSolutions = [];
eph = [];
return
end
%% 寻找帧起始位置==========================================
[subFrameStart, activeChnList] = findPreambles(trackResults, settings);
%%解码星历 =====================================================
for channelNr = activeChnList
%=== 将跟踪输出的结果转换为导航电文=======================
%--- 从跟踪输出结果复制5个子帧数据---------------
navBitsSamples = trackResults(channelNr).I_P(subFrameStart(channelNr) - 20 : ...
subFrameStart(channelNr) + (1500 * 20) -1)';
navBitsSamples = reshape(navBitsSamples, ...
20, (size(navBitsSamples, 1) / 20));%每20个值合成1列
%--- Sum all samples in the bits to get the best estimate -------------
navBits = sum(navBitsSamples);%对列求和
navBits = (navBits > 0);%转换为逻辑值0/1
navBitsBin = dec2bin(navBits);%以字符矢量形式返回navBits的二进制表示形式
%=== 解调星历表和截短周内时计数(TOW) ================
[eph(trackResults(channelNr).PRN), TOW] = ...
ephemeris(navBitsBin(2:1501)', navBitsBin(1));
%--- 剔除缺少必要导航数据信息的卫星 -----
if (isempty(eph(trackResults(channelNr).PRN).IODC) || ...
isempty(eph(trackResults(channelNr).PRN).IODE_sf2) || ...
isempty(eph(trackResults(channelNr).PRN).IODE_sf3))
activeChnList = setdiff(activeChnList, channelNr);
end
end
%% 检查卫星数量是否超过3=====================
if (isempty(activeChnList) || (size(activeChnList, 2) < 4))
% Show error message and exit
disp('Too few satellites with ephemeris data for postion calculations. Exiting!');
navSolutions = [];
eph = [];
return
end
%% Initialization初始化 ===================================