您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 经营企划 > 读取GPS卫星导航文件和观测值文件(C编程)
¶ÁÈ¡GPSÎÀÐǵ¼º½ÎļþºÍ¹Û²âÖµÎļþReadRinex.h:#ifndef__READRINEX_H#define__READRINEX_H/////GetGMN/////typedefstructtagCOMMONTIME{intyear;intmonth;intday;inthour;intminute;doublesecond;}COMMONTIME;typedefstructtagGMNHDR{intver_major;intver_minor;}GMNHDR,*PGMNHDR;typedefstructtagGMNREC{intPRN;COMMONTIMETOC;doubleClkBias;doubleClkDrift;doubleClkDriftRate;doubleIODE;doubleCrs;doubleDetlaN;doubleM0;doubleCuc;doublee;doubleCus;doubleSqrtA;doubleTOE;doubleCic;doubleOmega;doubleCis;doublei0;doubleCrc;doubleomega;doubleOmegaDot;doubleiDot;doublecodesOnL2Channel;doubleGPSWeek;doubleL2PDataFlag;doubleSVAccuracy;doubleSVHealth;doubleTGD;doubleIODC;doubleTransTimeOfMsg;doubleSpare1;doubleSpare2;doubleSpare3;}GMNREC,PGMNREC;typedefstructtagGMN{GMNHDRhdr;GMNRECrecord[1];}GMN,*PGMN;/////////GetGMO/////////typedefstructtagCRDTOPOCENTRIC{doublenorthing;doubleeasting;doubleupping;}CRDTOPOCENTRIC,*PCRDTOPOCENTRIC;typedefstructtagCRDCARTESIAN{doubleX;doubleY;doubleZ;}CRDCARTESIAN,*PCRDCARTESIAN;typedefenumtgaGPSOBSTYPE{GOT_PSEUDO_RANGE=1,//α¾àGOT_CARRIER_PHASE=2,//Ôز¨ÏàλGOT_DOPPLER=3,//¶àÆÕÀÕGOT_SNR=4,//ÐÅÔë±ÈGOT_MISC=5,//ÆäËüGOT_CMBD_CP=6,//Ôز¨ÏàλÏßÐÔ×éºÏ}GPSOBSTYPE,*PGPSOBSTYPE;constintMAX_ROID=3;#defineMAX_OBS_NAME10typedefstructtagGPSOBSPROP{charname[MAX_OBS_NAME];//¹Û²âÖµÃûGPSOBSTYPEtype;//¹Û²âÖµÀàÐÍdoublefrequency;//ƵÂÊunsignedcharwl_fact;//²¨³¤Òò×Ódoubleprecision;//¾«¶Ècharobs_id[MAX_ROID];//ID-RINEXµÄ¹Û²âÖµ±êʾ//unsignedcharwl_pos;//²¨³¤Òò×ÓµÄÐòºÅ}GPSOBSPROP,*PGPSOBSPROP;constdoubleGPS_F0=10.23*1.0e6;constdoubleGPS_F1=GPS_F0*154.0;constdoubleGPS_F2=GPS_F0*120.0;constdoubleGPS_F5=GPS_F0*115.0;constdoubleGPS_FIF=GPS_F1*60-GPS_F2*77;constdoubleGPS_FWL=GPS_F1-GPS_F2;constdoubleGPS_FNL=GPS_F1+GPS_F2;constdoubleGPS_FGF=0.0;GPSOBSPROPGOPDefault[]={{L1_FULL,GOT_CARRIER_PHASE,GPS_F1,1,0.001,L1},//0{L1_HALF,GOT_CARRIER_PHASE,GPS_F1,2,0.002,L1},//1{L2_FULL,GOT_CARRIER_PHASE,GPS_F2,1,0.001,L2},//2{L2_HALF,GOT_CARRIER_PHASE,GPS_F2,2,0.002,L2},//3{L5_FULL,GOT_CARRIER_PHASE,GPS_F5,1,0.001,L5},//4{L5_HALF,GOT_CARRIER_PHASE,GPS_F5,2,0.001,L5},//5{C1,GOT_PSEUDO_RANGE,GPS_F1,0,2.000,C1},//6{C2,GOT_PSEUDO_RANGE,GPS_F2,0,2.000,C2},//7{P1,GOT_PSEUDO_RANGE,GPS_F1,0,0.200,P1},//8{P2,GOT_PSEUDO_RANGE,GPS_F2,0,0.200,P2},//9{D1,GOT_DOPPLER,GPS_F1,0,0,D1},//10{D2,GOT_DOPPLER,GPS_F2,0,0,D2},//11{D5,GOT_DOPPLER,GPS_F5,0,0,D5},//12{S1,GOT_SNR,GPS_F1,0,0,S1},//13{S2,GOT_SNR,GPS_F2,0,0,S2},//14{S5,GOT_SNR,GPS_F5,0,0,S5},//15{I_FREE,GOT_CMBD_CP,GPS_FIF,0,0.002,IF},//16{G_FREE,GOT_CMBD_CP,GPS_FGF,0,0.002,GF},//17{W_LANE,GOT_CMBD_CP,GPS_FWL,0,0.002,WL},//18{N_LANE,GOT_CMBD_CP,GPS_FNL,0,0.002,NL},//19};typedefstructtagLGPSOBSPPROP{intpropnumber;GPSOBSPROPgpsobsprop;structtagLGPSOBSPPROP*next;}LGPSOBSPROP,*PLGPSOBSPROP;#defineMAX_RNX_MARK_NAME61//#defineMAX_RNX_MARK_NUMBER61#defineMAX_RNX_RCVR_SN21#defineMAX_RNX_RCVR_TYPE21#defineMAX_RNX_RCVR_VER21#defineMAX_RNX_ANT_SN21#defineMAX_RNX_ANT_TYPE21#defineMAX_CNT_OBS_TYPE19#defineMAX_OBS_TYPE_NAME3typedefstructtagGMOHDR{intver_major;//Ö÷°æ±¾ºÅintver_minor;//´Î°æ±¾ºÅcharmark_name[MAX_RNX_MARK_NAME];//µãÃû//charmark_number[MAX_RNX_MARK_NUMBER];//µãºÅcharrcvr_sn[MAX_RNX_RCVR_SN];//½ÓÊÕ»úÐòÁкÅcharrcvr_type[MAX_RNX_RCVR_TYPE];//½ÓÊÕ»úÀàÐÍcharrcvr_ver[MAX_RNX_RCVR_VER];//½ÓÊÕ»úÄÚ²¿Èí¼þ°æ±¾ºÅcharant_sn[MAX_RNX_ANT_SN];//ÌìÏßÐòÁкÅcharant_type[MAX_RNX_ANT_TYPE];//ÌìÏßÀàÐÍCRDTOPOCENTRICant_enna;//ÌìÏ߸ÄÕý£¨ÌìÏ߸ߺÍÆ«ÐÄ£©CRDCARTESIANapprox_pos;//½üËÆλÖÃintobs_type_number;//¹Û²âÖµÀàÐÍÊýcharobs_type_list[MAX_CNT_OBS_TYPE][MAX_OBS_TYPE_NAME];//¹Û²âÖµÀàÐÍÁбíLGPSOBSPROPlgop;//ÊôÐÔÁбíCOMMONTIMEstart;//µÚÒ»¸ö¹Û²â¼Ç¼ʱ¿Ìintinterval;//ÀúÔª¼ä¸ôlongepoch_number;//×ÜÀúÔªÊý}GMOHDR,*PGMOHDR;typedefstructtagGMORECHDR{COMMONTIMEepoch;//ÀúԪʱ¿Ìdoublercvr_clk_bias;//½ÓÊÕ»úÖÓÆ«²îintnum_sat;//ÎÀÐÇÊýintprn_list[31];//ÎÀÐÇÁбí}GMORECHDR,*PGMORECHDR;typedefstructtagGPSOBS{doublevalue;unsignedchartag1;//¹Û²âÖµÊôÐÔ±êÖ¾1unsignedchartag2;//unsignedchardisable;//¹Û²âÖµÊÇ·ñ¿ÉÓÃ}GPSOBS,*PGPSOBS;typedefstructtagLGPSOBS{GPSOBSgpsobs;structtagLGPSOBS*next;}LGPSOBS,*PLGPSOBS;typedefstructtagLGMOREC{GMORECHDRrechdr;LGPSOBSlgpsobs;structtagLGMOREC*next;}LGMOREC,*PLGMOREC;typedefstructtagGMO{GMOHDRhdr;LGMOREClgmorec;}GMO,*PGMO;#endifReadRinex.cpp:#includestdio.h#includeReadRinex.h#includestring.h#includestdlib.h#includectype.h#defineMAX_IN_ROW85////////////////////////xstrmid/////////////////voidxstrmid(char*szDest,char*szSrc,intnPos,intnCount){inti;char*str;charc;str=szSrc+nPos;for(i=0;inCount;i++){c=*(str+i);if(c){*(szDest+i)=c;}else{*(szDest+i)='\0';break;}}*(szDest+nCount)='\0';}////////////////////////Trim/////////////////////////char*xRTrim(char*s)//string.hctype.h{intl;for(l=strlen(s);l0&&isspace(s[l-1]);l--)s[l-1]='\0';returns;}char*xLTrim(char*s){char*p;for(p=s;isspace(*p);p++);if(p!=s)strcpy(s,p);returns;}char*xTrimAll(char*s){returnxLTrim(xRTrim(s));}///////////////////////////////searchpos/////////////////////fpos_t*searchpos(FILE*fp,charszBuf[]){fpos_t*oldpos;fpos_t*schpos;oldpos=(fpos_t*)malloc(0);schpos=(fpos_t*)malloc(0);charstr1[
本文标题:读取GPS卫星导航文件和观测值文件(C编程)
链接地址:https://www.777doc.com/doc-4256528 .html