当前位置:网站首页>Code example of MATLAB reading GNSS observation value o file
Code example of MATLAB reading GNSS observation value o file
2022-07-06 12:53:00 【Proletarians】
One 、 preparation
Observation data reading is the premise of data processing , Usually , The data formats of observations are rtcm、ubx、rinex, Manufacturers also have custom formats . Data reading is the simplest job , Mastering the data organization format means mastering the data reading strategy , in short , We do a series of operations on strings . I think that's right. o The following preparations should be made for file reading , Namely :
(1) install Matlab Of PC;
(2) Study rinex.pdf Information ;
(3)o Document preparation ;
(4) Pseudocoding , Clear the data flow ;
(5) Code testing
We are using location methods SPP/PPP/RTK when , It is to read the observation value of the satellite according to the epoch (PR/CP),Doppler,SNR Etc , The subsequent processing is to cycle through all the satellites , Do different things .
Two 、 Problems to be solved
The problem is : To achieve the use of Matlab Draw the pseudo range observation value sequence diagram of satellites with different satellite systems in the observation arc .
In the above problem analysis , Easy to know satellite PRN The number is the only one , Can be used as key; The satellite corresponds to the observed value (PC/CP/Doppler), Can be used as value. In other words ,key and value have access to map As a data structure , among ,value You can use a structure to save . The most important link has been determined , That is to use map and struct.
Next , Let's take the pseudo range value in the observation arc of a satellite , There are several possible situations :
(1) In the observation arc , The satellite has been captured , namely 100% There is a pseudo range value ;
(2) In the observation arc , The satellite was not captured at the beginning of the epoch , Then they were captured ;
(3) stay (2) There are still uncapped , Capture , Not captured , Capture, etc ;
The observed value is 0, meanwhile , We should also pay attention to , If there is a pseudo range, there is not necessarily a carrier , There must be no pseudo range without carrier . Our pseudo code mainly judges the above three situations .
3、 ... and 、 Code implementation
Specific analysis of specific problems , Solve the problems mentioned above , The specific code is as follows :
% function: read the body of rinex obs file
clear all
close all
clc
fid=fopen(' example.obs');
if fid==-1
disp('fail to open obs file!');
end
% Create structure obs, Use Map mapping ,prn As the key (char),sv Value (table)
obs=containers.Map;
record_counter=0;
% Read body Record
while feof(fid)==0
line=fgets(fid);
if strcmp(line(1),'>')
sv_sum=str2double(line(34:35));
time=line(3:29);
if sv_sum>0
for i=1:sv_sum
line=fgets(fid);
% key -> prn
key=line(1:3);
% value -> sv(pr cp dop)
sv.pr=str2double(line(6:17));
cp=line(21:33);
if isnan(cp)
sv.cp=0;
else
sv.cp=str2double(line(21:33));
end
sv.dop=str2double(line(41:49));
% Value logic judgment
if isKey(obs,key)
jump_sec=record_counter-length(obs(key));
if jump_sec~=0 % Solve the problem of relocking after losing the star
temp.pr=0;
temp.cp=0;
temp.dop=0;
tmp_strcut=repmat(temp,1,jump_sec);
value=[obs(key) tmp_strcut sv];
else % The satellite has been locked , Add directly
if strcmp(key,'C18')==1
if length(obs(key))>5713
disp(time);
end
end
value=[repmat(obs(key),1) repmat(sv,1)]; % mark
end
else % The satellite is locked for the first time
if record_counter~=0 % The first second is unlocked
temp.pr=0;
temp.cp=0;
temp.dop=0;
tmp_strcut=repmat(temp,1,record_counter);
value=[tmp_strcut sv];
else % First second lock
value=sv;
end
end
obs(key)=value;
end
end
record_counter=record_counter+1;
end
end
disp('create struct obs(body) successfully!');
% mapping
sv_sum=obs.Count; % The number of visual satellites
keySet=keys(obs); % Visual satellite name
disp(keySet);
v=299792458.0;
bf1=1.561098E9; % bds L1 frequency
gf1=1.57542E9; % gps L1 frequency
gps_sum=0;bds_sum=0;
for i=1:sv_sum
prn=char(keySet(i));
if strcmp(prn(1),'G')==1 % GPS
gps_sum=gps_sum+1;
else if strcmp(prn(1),'C')==1 % BDS
bds_sum=bds_sum+1;
end
end
end
subfig1=ceil(sqrt(bds_sum));
subfig2=ceil(sqrt(gps_sum));
x=1:record_counter;
for i=1:sv_sum
prn=char(keySet(i));
info=obs(prn);
pr=zeros(1,record_counter);cp=pr;
for j=1:length(info)
pr(j)=info(j).pr;
cp(j)=info(j).cp;
end
if i==1 || i==bds_sum+1
figure;
end
subplot(n,n,pos);
plot(x,pr,'r',x,cp*f,'g');
title(char(prn));
end
Four 、 Sample results
I only focus on the problems encountered in my work rinex Version data processing ,gps/bds Dual system , Single frequency data , The results are as follows :
The sample code is simple , There are also corresponding notes .
边栏推荐
- rtklib单点定位spp使用抗差估计遇到的问题及解决
- The service robots that have been hyped by capital and the Winter Olympics are not just a flash in the pan
- [算法] 剑指offer2 golang 面试题13:二维子矩阵的数字之和
- 3月15号 Go 1.18 正式版发布 了解最新特色以及使用方法
- Theoretical derivation of support vector machine
- NovAtel 板卡OEM617D配置步骤记录
- [算法] 剑指offer2 golang 面试题9:乘积小于k的子数组
- Special palindromes of daily practice of Blue Bridge Cup
- 地球围绕太阳转
- KF UD分解之UD分解基础篇【1】
猜你喜欢
Idea problem record
Prove the time complexity of heap sorting
FairyGUI增益BUFF数值改变的显示
[algorithm] sword finger offer2 golang interview question 13: sum of numbers of two-dimensional submatrix
服务未正常关闭导致端口被占用
Derivation of logistic regression theory
Halcon knowledge: gray_ Tophat transform and bottom cap transform
Fairygui character status Popup
2022国赛Re1 baby_tree
Lock wait timeout exceeded try restarting transaction
随机推荐
堆排序【手写小根堆】
[algorithm] sword finger offer2 golang interview question 12: the sum of the left and right sub arrays is equal
NovAtel 板卡OEM617D配置步骤记录
idea中好用的快捷键
Conditional probability
FGUI工程打包发布&导入Unity&将UI显示出来的方式
基于rtklib源码进行片上移植的思路分享
Unity scene jump and exit
平衡二叉树详解 通俗易懂
[算法] 剑指offer2 golang 面试题6:排序数组中的两个数字之和
[offer78]合并多个有序链表
Fairygui character status Popup
Database table splitting strategy
Meanings and differences of PV, UV, IP, VV, CV
[算法] 剑指offer2 golang 面试题2:二进制加法
Unity场景跳转及退出
闇の連鎖(LCA+树上差分)
rtklib单点定位spp使用抗差估计遇到的问题及解决
Derivation of logistic regression theory
[算法] 剑指offer2 golang 面试题9:乘积小于k的子数组