当前位置:网站首页>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 .
边栏推荐
- [offer18] delete the node of the linked list
- 【RTKLIB 2.4.3 b34 】版本更新简介一
- 染色法判定二分图
- MySQL shutdown is slow
- Easy to use shortcut keys in idea
- The master of double non planning left the real estate company and became a programmer with an annual salary of 25W. There are too many life choices at the age of 25
- WSL common commands
- Unity scene jump and exit
- 【rtklib】在rtk下使用抗差自适应卡尔曼滤波初步实践
- 341. Flatten nested list iterator
猜你喜欢
Lock wait timeout exceeded try restarting transaction
FairyGUI簡單背包的制作
闇の連鎖(LCA+树上差分)
[algorithm] sword finger offer2 golang interview question 13: sum of numbers of two-dimensional submatrix
【干货】提升RTK模糊度固定率的建议之周跳探测
dosbox第一次使用
[algorithm] sword finger offer2 golang interview question 8: the shortest subarray with a sum greater than or equal to K
Prove the time complexity of heap sorting
Mixed use of fairygui button dynamics
抗差估计在rtklib的pntpos函数(标准单点定位spp)中的c代码实现
随机推荐
FGUI工程打包发布&导入Unity&将UI显示出来的方式
Fairygui loop list
Unity3d makes the registration login interface and realizes the scene jump
染色法判定二分图
[算法] 剑指offer2 golang 面试题4:只出现一次的数字
[算法] 剑指offer2 golang 面试题3:前n个数字二进制形式中1的个数
地球围绕太阳转
[算法] 剑指offer2 golang 面试题5:单词长度的最大乘积
Naive Bayesian theory derivation
Comparative analysis of the execution efficiency of MySQL 5.7 statistical table records
Special palindromes of daily practice of Blue Bridge Cup
1041 be unique (20 points (s)) (hash: find the first number that occurs once)
IText 7 generate PDF summary
Compilation principle: preprocessing of source program and design and implementation of lexical analysis program (including code)
GNSS定位精度指标计算
On March 15, the official version of go 1.18 was released to learn about the latest features and usage
FairyGUI复选框与进度条的组合使用
FairyGUI摇杆
[算法] 剑指offer2 golang 面试题2:二进制加法
How to improve the deletion speed of sequential class containers?