資源簡介
包括
讀取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? {
if(i1%4?==?0?&&?i1%400?!=?0)
z++;????????????????????//記閏年數
}
if(year%4?==?0?&&?year%100?!=?0)
{
for(int?i2?=?0;?i2? day?+=?ry[i2];
}
else
{
for(int?i3=0;?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? {
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? 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\ba
?????文件??????15962??2015-06-09?16:33??mix\mix\ba
?????文件???15247584??2015-06-09?16:33??mix\mix\ba
?????文件?????114458??2015-06-09?16:33??mix\mix\ba
?????文件???????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\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件??????????2??2015-06-12?15:26??mix\mix\Debug\li
?????文件???????1490??2015-06-12?15:26??mix\mix\Debug\li
?????文件???????3158??2015-06-12?15:26??mix\mix\Debug\li
?????文件????????722??2015-06-12?15:26??mix\mix\Debug\li
?????文件????????406??2015-06-12?14:56??mix\mix\Debug\mix.exe.em
?????文件????????472??2015-06-12?14:56??mix\mix\Debug\mix.exe.em
?????文件????????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個文件信息
評論
共有 條評論