资源简介
C++;卫星定位;C++卫星定位程序--通过卫星星历确定卫星位置
代码片段和文件信息
#include
#include
#include
#include
void main()
{
FILE*fpn;
if((fpn=fopen(“e:\\08337068melody\\gnss\\51.97n““r“))==NULL)
{
printf(“cannot open this file\n“);
exit(0);
}
FILE*fpo;
if((fpo=fopen(“e:\\08337068melody\\gnss\\51.97o““r“))==NULL)
{
printf(“cannot open this file\n“);
exit(0);
}
/*打开文件*/
struct STL
{
int prnyearmonthdayhourminutenumprn1prn2prn3prn4prn5prn6;
double secondaf0af1af2aodecrsdnM0cucecusrAtoecicomg0cisi0crcwomgdotidotcflgweeknopflgsvaccsvhlthtgdaodcttmphiempty1empty2p1p2p3p4p5p6;
}satellite[6]satellite2[117];
int aabbddprnyearmonthdayhourminutesecond;
char str[100];
double txxyyzzp0wkw=7.292115147e-5toc;
double GM=3.986005e14n0ntkmkek1ek2ekerror=1.0e-12vkphikdudidrukrkikxkyk;
double we=7.292115147e-5c=2.99792458e8;
/*定义变量*/
for(dd=0;dd<4;dd++)fgets(str100fpn);
for(aa=0;aa<6;aa++)
{
fscanf(fpn“%d%d%d%d%d%d%le%le%le%le\n“&satellite[aa].prn&satellite[aa].year&satellite[aa].month&satellite[aa].day&satellite[aa].hour&satellite[aa].minute&satellite[aa].second&satellite[aa].af0&satellite[aa].af1&satellite[aa].af2);
fscanf(fpn“%le%le%le%le\n“&satellite[aa].aode&satellite[aa].crs&satellite[aa].dn&satellite[aa].M0);
fscanf(fpn“%le%le%le%le\n“&satellite[aa].cuc&satellite[aa].e&satellite[aa].cus&satellite[aa].rA);
fscanf(fpn“%le%le%le%le\n“&satellite[aa].toe&satellite[aa].cic&satellite[aa].omg0&satellite[aa].cis);
fscanf(fpn“%le%le%le%le\n“&satellite[aa].i0&satellite[aa].crc&satellite[aa].w&satellite[aa].omgdot);
fscanf(fpn“%le%le%le%le\n“&satellite[aa].idot&satellite[aa].cflg&satellite[aa].weekno&satellite[aa].pflg);
fscanf(fpn“%le%le%le%le\n“&satellite[aa].svacc&satellite[aa].svhlth&satellite[aa].tgd&satellite[aa].aodc);
fscanf(fpn“%le%le%le%le\n“&satellite[aa].ttm&satellite[aa].phi&satellite[aa].empty1&satellite[aa].empty2);
}
/*读N文件*/
for(dd=0;dd<21;dd++)fgets(str100fpo);
for(bb=0;bb<11;bb++)
{
fscanf(fpo“%d%d%d%d%d%lf“&satellite2[bb].year&satellite2[bb].month&satellite2[bb].day&satellite2[bb].hour&satellite2[bb].minute&satellite2[bb].second);
fgets(str6fpo);
fscanf(fpo“%dG“&satellite2[bb].num);
if(satellite2[bb].num==5)
{
fscanf(fpo“%dG“&satellite2[bb].prn1);
fscanf(fpo“%dG“&satellite2[bb].prn2);
fscanf(fpo“%dG“&satellite2[bb].prn3);
fscanf(fpo“%dG“&satellite2[bb].prn4);
fscanf(fpo“%dG“&satellite2[bb].prn5);
fseek(fpo41);
fscanf(fpo“%lf “&satellite2[bb].p1);
fseek(fpo661);
fscanf(fpo“%lf “&satellite2[bb].p2);
fseek(fpo661);
fscanf(fpo“%lf “&satellite2[bb].p3);
fseek(fpo661);
fscanf(fpo“%lf “&satellite2[bb].p4);
fseek(fpo661);
fscanf(fpo“%lf “&satellite2[bb].p5);
fseek(fpo641);
}
if(satellite2[bb].num==6)
{
fscanf(fpo“%dG“&sa
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 229446 2010-11-30 10:19 myGPS-输出伪距\Debug\myGPS.exe
文件 240888 2010-11-30 10:19 myGPS-输出伪距\Debug\myGPS.ilk
文件 36812 2010-11-30 10:19 myGPS-输出伪距\Debug\myGPS.obj
文件 231940 2010-11-30 09:25 myGPS-输出伪距\Debug\myGPS.pch
文件 492544 2010-11-30 10:19 myGPS-输出伪距\Debug\myGPS.pdb
文件 41984 2010-11-30 10:19 myGPS-输出伪距\Debug\vc60.idb
文件 53248 2010-11-30 10:19 myGPS-输出伪距\Debug\vc60.pdb
文件 20354 2010-11-30 10:19 myGPS-输出伪距\myGPS.cpp
文件 3389 2010-11-30 09:25 myGPS-输出伪距\myGPS.dsp
文件 535 2010-11-30 10:32 myGPS-输出伪距\myGPS.dsw
文件 33792 2010-11-30 10:32 myGPS-输出伪距\myGPS.ncb
文件 48640 2010-11-30 10:32 myGPS-输出伪距\myGPS.opt
文件 1233 2010-11-30 10:19 myGPS-输出伪距\myGPS.plg
目录 0 2010-11-30 10:19 myGPS-输出伪距\Debug
目录 0 2010-11-30 10:32 myGPS-输出伪距
----------- --------- ---------- ----- ----
1434805 15
评论
共有 条评论