当前位置:网站首页>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 .
边栏推荐
- FairyGUI按钮动效的混用
- Devops' future: six trends in 2022 and beyond
- Programming homework: educational administration management system (C language)
- [算法] 剑指offer2 golang 面试题9:乘积小于k的子数组
- Implementation of Excel import and export functions
- Mysql database reports an error: row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT=DY
- SVN更新后不出现红色感叹号
- MySQL performance tuning - dirty page refresh
- 地球围绕太阳转
- Comparative analysis of the execution efficiency of MySQL 5.7 statistical table records
猜你喜欢

Mysql database reports an error: row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT=DY

Liste des boucles de l'interface graphique de défaillance

dosbox第一次使用

FGUI工程打包发布&导入Unity&将UI显示出来的方式

Office提示您的许可证不是正版弹框解决

【GNSS数据处理】赫尔默特(helmert)方差分量估计解析及代码实现
![[algorithm] sword finger offer2 golang interview question 1: integer division](/img/e6/f17135207b3540ec58e5a9eed54220.png)
[algorithm] sword finger offer2 golang interview question 1: integer division

第一人称视角的角色移动

平衡二叉树详解 通俗易懂
![[算法] 剑指offer2 golang 面试题4:只出现一次的数字](/img/f7/23ffc81ec8e9161c15d863c1a67916.png)
[算法] 剑指offer2 golang 面试题4:只出现一次的数字
随机推荐
[offer9] implement queues with two stacks
[算法] 剑指offer2 golang 面试题6:排序数组中的两个数字之和
Solution to the problem of automatic login in Yanshan University Campus Network
Combination of fairygui check box and progress bar
基于rtklib源码进行片上移植的思路分享
抗差估计在rtklib的pntpos函数(标准单点定位spp)中的c代码实现
MySQL performance tuning - dirty page refresh
[algorithm] sword finger offer2 golang interview question 2: binary addition
使用rtknavi进行RT-PPP测试
Fabrication of fairygui simple Backpack
[offer18] delete the node of the linked list
Fabrication d'un sac à dos simple fairygui
Unity3D摄像机,键盘控制前后左右上下移动,鼠标控制旋转、放缩
Meanings and differences of PV, UV, IP, VV, CV
It has been solved by personal practice: MySQL row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT
[algorithme] swordfinger offer2 golang question d'entrevue 2: addition binaire
Guided package method in idea
染色法判定二分图
堆排序【手写小根堆】
Fairygui joystick