• 大小: 9.56MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-22
  • 语言: 其他
  • 标签: GPS  

资源简介

包括 读取RENIX观测、导航文件 GPS,GLONASS,COMPASS的卫星位置计算程序 三种星座的联合差分定位 (代码附有详细注释)

资源截图

代码片段和文件信息

// mix.cpp : 定义控制台应用程序的入口点。
//

#include “stdafx.h“
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include   
using namespace Eigen;  
using namespace std;
const double c=299792458; //light speed
const double GM=3.9860044e14;
const double we=7.292115e-5; //地球自转速度
const double ae=6.378136e6; //PZ-90下地球长半轴
const double J2=1.0826257e-3;//重力第二谐系数
//-------------------------------------------------------------------


//民用时转化为GPS时
void gpstime(int yearint monthint dayint hour int minute double second int &week double &secofweek)
{
int ry[12]={312931303130313130313031}fry[12]={312831303130313130313031};
if(year > 80) 
year = 1900 + year;
else 
year = 2000 + year;
int z=0;
for(int i1=1980; i1 < year+1; i1++)
{
if(i1%4 == 0 && i1%400 != 0)
z++;                    //记闰年数
}
if(year%4 == 0 && year%100 != 0)
{
for(int i2 = 0; i2 < month-1; i2++)
day += ry[i2];

}
else
{
for(int i3=0; i3 < month-1; i3++)
day += fry[i3];

}
day += (year-1980)*365 + z - 5;
week = day/7;
secofweek= day%7*24*3600 + hour*3600 + minute*60 + second ;
}

//GPSBeidou星历文件类 .15N  .15R
class ReadNavFile //星历文件类
{
public:
int svNum;//星历中的卫星个数
vector > ephlist;
ReadNavFile(string nfile) //构造函数
{
//--------------------------------------------------------------------
//用文件流读文件
ifstream in_n(nfile.c_str());
if(in_n)
cout<<“打开N文件成功“< else
cerr<<“未找到N文件“< string str;
//--------------------------------------------------------------------
//定位到数据头
while(str.find(“END OF HEADER“) == string::npos)
{
getline(in_nstr);
}
//计算文件的行数和段数
int count = 0;
while(in_n) 
{
getline(in_n str);//从文件中读取一行
remove(str.begin() str.end() ‘ ‘);//这个算法函数在algorithm头文件中,删除一行中的空格
remove(str.begin() str.end() ‘\t‘);//删除一行中的制表符,因为制表符和空格都是空的
if (str.length() > 0) 
{
//如果删除制表符和空格之后的一行数据还有其他字符就算有效行
count ++;
}
}
svNum =count/8;//卫星个数每个卫星8行数据
ephlist.resize(svNum);//用卫星个数定义星历的行数

//定位到文件头
ifstream in_n1(nfile.c_str());
//定位到数据头
while(str.find(“END OF HEADER“) == string::npos)
{
getline(in_n1str);
}
for(int i=0; i < svNum; i++)
{
ephlist[i].resize(38);//星历的列数=38
getline(in_n1str);
ephlist[i][0] = atoi(str.substr(02).c_str());
ephlist[i][1] = atoi(str.substr(32).c_str());
ephlist[i][2] = atoi(str.substr(71).c_str());
ephlist[i][3] = atoi(str.substr(101).c_str());
ephlist[i][4] = atoi(str.substr(131).c_str());
ephlist[i][5] = atoi(str.substr(152).c_str());
ephlist[i][6] = atof(str.substr(194).c_str());
ephlist[i][7] = atof(str.substr(2219).c_str());
ephlist[i][8] = atof(str.substr(4119).c_str());
ephlist[i][9] = atof(str.substr(6019).c_str());
for(int k = 0; k < svNum; k++)
sw

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     415744  2015-06-12 15:26  mix\Debug\mix.exe

     文件    1558208  2015-06-12 15:26  mix\Debug\mix.ilk

     文件    6228992  2015-06-12 15:26  mix\Debug\mix.pdb

     文件      42418  2015-06-12 15:46  mix\GPSGLONASSCOMPASS联合.docx

     文件    2359296  2015-06-12 14:40  mix\ipch\mix-858ddd72\mix-c13f649a.ipch

     文件      45282  2015-06-09 16:33  mix\mix\base.15G

     文件      15962  2015-06-09 16:33  mix\mix\base.15N

     文件   15247584  2015-06-09 16:33  mix\mix\base.15O

     文件     114458  2015-06-09 16:33  mix\mix\base.15R

     文件       1498  2015-06-12 15:26  mix\mix\Debug\cl.command.1.tlog

     文件      35698  2015-06-12 15:26  mix\mix\Debug\CL.read.1.tlog

     文件        660  2015-06-12 15:26  mix\mix\Debug\CL.write.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link-cvtres.read.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link-cvtres.write.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link.1440-cvtres.read.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link.1440-cvtres.write.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link.1440.read.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link.1440.write.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link.6920-cvtres.read.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link.6920-cvtres.write.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link.6920.read.1.tlog

     文件          2  2015-06-12 15:26  mix\mix\Debug\link.6920.write.1.tlog

     文件       1490  2015-06-12 15:26  mix\mix\Debug\link.command.1.tlog

     文件       3158  2015-06-12 15:26  mix\mix\Debug\link.read.1.tlog

     文件        722  2015-06-12 15:26  mix\mix\Debug\link.write.1.tlog

     文件        406  2015-06-12 14:56  mix\mix\Debug\mix.exe.embed.manifest

     文件        472  2015-06-12 14:56  mix\mix\Debug\mix.exe.embed.manifest.res

     文件        381  2015-06-12 15:26  mix\mix\Debug\mix.exe.intermediate.manifest

     文件         55  2015-06-12 15:26  mix\mix\Debug\mix.lastbuildstate

     文件       2163  2015-06-12 15:26  mix\mix\Debug\mix.log

............此处省略40个文件信息

评论

共有 条评论