Changeset 5669 in ntrip for trunk/clock_and_orbit
- Timestamp:
- Jun 5, 2014, 11:02:03 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/clock_and_orbit/readco.c
r5668 r5669 18 18 19 19 void printClockOrbit(const char* filename, struct ClockOrbit* clockOrb, 20 20 char* flag, int ind, char satSys, int offsetGnss); 21 21 void printClockOrbitDiff(const char* filename, struct ClockOrbit* clockOrb1, 22 22 struct ClockOrbit* clockOrb2, char* flag, int ind, char satSys, int offsetGnss); 23 23 void printCodeBias(const char* filename, struct CodeBias* codeBias, 24 24 char* flag,int ind, char satSys, int offsetGnss); 25 25 void printCodeBiasDiff(const char* filename, struct CodeBias* codeBias1, 26 27 26 struct CodeBias* codeBias2, char* flag, int ind, char satSys, 27 int offsetGnss); 28 28 29 29 int main(void) { 30 enum COR_SATSYSTEM sys; 31 char* inputFile = "ssr1_cocb_data/CLK801330.14C"; 32 for (sys = GPS; sys <= BDS; ++sys) { 33 char *outFilenameRaw, *outFilenameDbg; 34 enum COR_SATSYSTEM CLOCKORBIT_SATGNSS = sys; 35 enum COR_OFFSETS CLOCKORBIT_OFFSETGNSS; 36 switch (sys) { 37 case GPS: 38 outFilenameRaw = "ssr1_cocb_data/outfile_G.raw"; 39 outFilenameDbg = "ssr1_cocb_data/outfile_G.dbg"; 40 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETGPS; 41 break; 42 case GLO: 43 outFilenameRaw = "ssr1_cocb_data/outfile_R.raw"; 44 outFilenameDbg = "ssr1_cocb_data/outfile_R.dbg"; 45 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETGLONASS; 46 break; 47 case GAL: 48 outFilenameRaw = "ssr1_cocb_data/outfile_E.raw"; 49 outFilenameDbg = "ssr1_cocb_data/outfile_E.dbg"; 50 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETGALILEO; 51 break; 52 case QZSS: 53 outFilenameRaw = "ssr1_cocb_data/outfile_J.raw"; 54 outFilenameDbg = "ssr1_cocb_data/outfile_J.dbg"; 55 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETQZSS; 56 break; 57 case SBAS: 58 outFilenameRaw = "ssr1_cocb_data/outfile_S.raw"; 59 outFilenameDbg = "ssr1_cocb_data/outfile_S.dbg"; 60 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETSBAS; 61 break; 62 case BDS: 63 outFilenameRaw = "ssr1_cocb_data/outfile_C.raw"; 64 outFilenameDbg = "ssr1_cocb_data/outfile_C.dbg"; 65 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETBDS; 66 break; 67 } 68 unlink(outFilenameRaw); 69 unlink(outFilenameDbg); 70 FILE *asciiSsr, *f; 71 size_t len = 0; 72 char *buffer = 0, type = satSYS[sys]; 73 asciiSsr = fopen(inputFile, "r"); 74 if (asciiSsr == NULL) { 75 fprintf(stderr, "ERROR: open file %s\n", inputFile); 76 return 0; 77 } 78 while (getline(&buffer, &len, asciiSsr) > 0) { //fprintf(stderr, "line: %s", buffer); 79 char coBuffer[CLOCKORBIT_BUFFERSIZE]; 80 char cbBuffer[CLOCKORBIT_BUFFERSIZE]; 81 int MT = 0, messageType = 0, ui = 0, week = 0, prn = 0, iode = 0, ncb = 0; 82 double cbValue[3] = { 0.0 }, clock_a0 = 0.0, clock_a1 = 0.0, clock_a2 = 0.0, d_radial = 0.0; 83 double d_along = 0.0, d_outofplane = 0.0, dd_radial = 0.0, dd_along = 0.0, dd_outofplane = 0.0; 84 enum CodeType cbType[3] = { 0 }; 85 static double tow_co, tow_cb; 86 int num = sscanf(buffer, "%d ", &messageType); 87 if (messageType == messageTypeCo[GPS]) { 88 sscanf(buffer, 89 "%d %d %d %lf %c%d %d %lf %lf %lf %lf %lf %lf %lf %lf %lf\n", 90 &messageType, &ui, &week, &tow_co, &type, &prn, &iode, 91 &clock_a0, &d_radial, &d_along, &d_outofplane, 92 &clock_a1, &dd_radial, &dd_along, &dd_outofplane, 93 &clock_a2); 94 type = satSYS[sys]; 95 MT = messageTypeCo[sys]; 96 switch (sys) { 97 case GPS:case GAL:case SBAS:case BDS: 98 break; 99 case GLO: 100 if (prn > 24) 101 continue; 102 break; 103 case QZSS: 104 if (prn > 10) 105 continue; 106 break; 107 } 108 if ((lasttow_co != tow_co)) { // create block 109 int nl = 0, ns = 0, l = 0; 110 struct ClockOrbit coOut; 111 if (lasttow_co >= 0) { 112 if (sys == GLO) { 113 coIn.EpochTime[CLOCKORBIT_SATGLONASS] = 114 (fmod((double)coIn.EpochTime[CLOCKORBIT_SATGLONASS] 115 + (3 * 3600 - GPSUTCdiff), 86400.0)); 116 } 117 printClockOrbit(outFilenameDbg, &coIn, "INPUT", 118 CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 119 l = MakeClockOrbit(&coIn, COTYPE_AUTO, 0, coBuffer, 120 sizeof(coBuffer)); 121 if (!l) 122 fprintf(stderr, "BUILD ERROR\n"); 123 else { 124 if ((f = fopen(outFilenameRaw, "ab+"))) { 125 fwrite(coBuffer, l, 1, f); 126 fclose(f); 127 } else 128 fprintf(stderr, "SAVE ERROR %s\n", 129 outFilenameRaw); 130 } 131 memset(&coOut, 0, sizeof(coOut)); 132 nl = GetSSR(&coOut, 0, 0, 0, coBuffer, l, &ns); 133 if (nl < 0) 134 fprintf(stderr, "CLKORB EXTRACT ERROR %d\n", nl); 135 else if (nl > 0) 136 fprintf(stderr, "CLKORB MULTIBLOCK UNSUPPORTED IN TEST\n"); 137 else if (ns != l) 138 fprintf(stderr, "CLKORB SIZE MISMATCH (%d/%d)\n", ns, l); 139 else { 140 printClockOrbit(outFilenameDbg, &coOut, "OUTPUT", 141 CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 142 printClockOrbitDiff(outFilenameDbg, &coIn, &coOut, 143 "DIFF", CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 144 } 145 } 146 memset(&coIn, 0, sizeof(coIn)); 147 lasttow_co = tow_co; 148 coIn.messageType = MT; 149 coIn.EpochTime[CLOCKORBIT_SATGNSS] = (int) tow_co; 150 coIn.UpdateInterval = (int) ui; 151 coIn.Supplied[COBOFS_COMBINED] = 1; 152 coIn.SatRefDatum = DATUM_ITRF; 153 } 154 struct SatData *sd; 155 sd = coIn.Sat 156 + CLOCKORBIT_OFFSETGNSS 157 + coIn.NumberOfSat[CLOCKORBIT_SATGNSS]; 158 sd->ID = prn; 159 sd->IOD = iode; 160 sd->Clock.DeltaA0 = clock_a0; 161 sd->Clock.DeltaA1 = clock_a1; 162 sd->Clock.DeltaA2 = clock_a2; 163 sd->Orbit.DeltaRadial = d_radial; 164 sd->Orbit.DeltaAlongTrack = d_along; 165 sd->Orbit.DeltaCrossTrack = d_outofplane; 166 sd->Orbit.DotDeltaRadial = dd_radial; 167 sd->Orbit.DotDeltaAlongTrack = dd_along; 168 sd->Orbit.DotDeltaCrossTrack = dd_outofplane; 169 ++coIn.NumberOfSat[CLOCKORBIT_SATGNSS]; 170 } 171 if (messageType == messageTypeCb[GPS]) { 172 sscanf(buffer, "%d %d %d %lf %c%d %d %d %lf %d %lf %d %lf\n", 173 &messageType, &ui, &week, &tow_cb, &type, &prn, &ncb, 174 &cbType[0], &cbValue[0], &cbType[1], &cbValue[1], 175 &cbType[2], &cbValue[2]); 176 type = satSYS[sys]; 177 MT = messageTypeCb[sys]; 178 switch (sys) { 179 case GPS: 180 break; 181 case GLO: 182 if (prn > 24) 183 continue; 184 cbType[0] = CODETYPEGLONASS_L1_CA; 185 cbType[1] = CODETYPEGLONASS_L1_P; 186 cbType[2] = CODETYPEGLONASS_L2_CA; 187 break; 188 case GAL: 189 cbType[0] = CODETYPEGALILEO_E1_A; 190 cbType[1] = CODETYPEGALILEO_E5_I; 191 cbType[2] = CODETYPEGALILEO_E6_A; 192 break; 193 case QZSS: 194 if (prn > 10) 195 continue; 196 cbType[0] = CODETYPEQZSS_L1_CA; 197 cbType[1] = CODETYPEQZSS_L2_CM; 198 cbType[2] = CODETYPEQZSS_L5_I; 199 break; 200 case SBAS: 201 cbType[0] = CODETYPE_SBAS_L1_CA; 202 cbType[1] = CODETYPE_SBAS_L5_I; 203 cbType[2] = CODETYPE_SBAS_L5_Q; 204 break; 205 case BDS: 206 cbType[0] = CODETYPE_BDS_B1_I; 207 cbType[1] = CODETYPE_BDS_B3_I; 208 cbType[2] = CODETYPE_BDS_B2_I; 209 break; 210 } 211 if (lasttow_cb != tow_cb) { // create block 212 int nl, ns, l; 213 struct CodeBias cbOut; 214 if (lasttow_cb >= 0) { 215 if (sys == GLO) { 216 cbIn.EpochTime[CLOCKORBIT_SATGLONASS] = 217 (fmod((double)cbIn.EpochTime[CLOCKORBIT_SATGLONASS] 218 + (3 * 3600 - GPSUTCdiff), 86400.0)); 219 } 220 printCodeBias(outFilenameDbg, &cbIn, "INPUT", 221 CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 222 l = MakeCodeBias(&cbIn, BTYPE_AUTO, 0, cbBuffer, 223 sizeof(cbBuffer)); 224 if (!l) 225 fprintf(stderr, "BUILD ERROR\n"); 226 else { 227 if ((f = fopen(outFilenameRaw, "ab+"))) { 228 fwrite(cbBuffer, l, 1, f); 229 fclose(f); 230 } else 231 fprintf(stderr, "SAVE ERROR %s\n", outFilenameRaw); 232 } 233 memset(&cbOut, 0, sizeof(cbOut)); 234 nl = GetSSR(NULL, &cbOut, NULL, 0, cbBuffer, l, &ns); 235 if (nl < 0) 236 fprintf(stderr, "CBIAS EXTRACT ERROR %d\n", nl); 237 else if (nl > 0) 238 fprintf(stderr, "CBIAS MULTIBLOCK UNSUPPORTED IN TEST\n"); 239 else if (ns != l) 240 fprintf(stderr, "CBIAS SIZE MISMATCH (%d/%d)\n", ns, l); 241 else { 242 printCodeBias(outFilenameDbg, &cbOut, "OUTPUT", 243 CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 244 printCodeBiasDiff(outFilenameDbg, &cbIn, &cbOut, 245 "DIFF", CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 246 } 247 } 248 memset(&cbIn, 0, sizeof(cbIn)); 249 lasttow_cb = tow_cb; 250 cbIn.messageType = MT; 251 cbIn.EpochTime[CLOCKORBIT_SATGNSS] = (int) tow_cb; 252 cbIn.UpdateInterval = ui; 253 coIn.Supplied[COBOFS_BIAS] = 1; 254 } 255 struct BiasSat *bs; 256 bs = cbIn.Sat 257 + CLOCKORBIT_OFFSETGNSS 258 + cbIn.NumberOfSat[CLOCKORBIT_SATGNSS]; 259 bs->ID = prn; 260 bs->NumberOfCodeBiases = ncb; 261 int k = 0; 262 for (k = 0; k < bs->NumberOfCodeBiases; k++) { 263 bs->Biases[k].Type = cbType[k]; 264 bs->Biases[k].Bias = cbValue[k]; 265 } 266 ++cbIn.NumberOfSat[CLOCKORBIT_SATGNSS]; 267 } 268 } 269 free(buffer); 270 close(asciiSsr); 271 } 272 return 0; 30 enum COR_SATSYSTEM sys; 31 char* inputFile = "ssr1_cocb_data/CLK801330.14C"; 32 for (sys = GPS; sys <= BDS; ++sys) { 33 char *outFilenameRaw, *outFilenameDbg; 34 enum COR_SATSYSTEM CLOCKORBIT_SATGNSS = sys; 35 enum COR_OFFSETS CLOCKORBIT_OFFSETGNSS; 36 lasttow_co = -1.0; 37 lasttow_cb = -1.0; 38 switch (sys) { 39 case GPS: 40 outFilenameRaw = "ssr1_cocb_data/outfile_G.raw"; 41 outFilenameDbg = "ssr1_cocb_data/outfile_G.dbg"; 42 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETGPS; 43 break; 44 case GLO: 45 outFilenameRaw = "ssr1_cocb_data/outfile_R.raw"; 46 outFilenameDbg = "ssr1_cocb_data/outfile_R.dbg"; 47 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETGLONASS; 48 break; 49 case GAL: 50 outFilenameRaw = "ssr1_cocb_data/outfile_E.raw"; 51 outFilenameDbg = "ssr1_cocb_data/outfile_E.dbg"; 52 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETGALILEO; 53 break; 54 case QZSS: 55 outFilenameRaw = "ssr1_cocb_data/outfile_J.raw"; 56 outFilenameDbg = "ssr1_cocb_data/outfile_J.dbg"; 57 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETQZSS; 58 break; 59 case SBAS: 60 outFilenameRaw = "ssr1_cocb_data/outfile_S.raw"; 61 outFilenameDbg = "ssr1_cocb_data/outfile_S.dbg"; 62 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETSBAS; 63 break; 64 case BDS: 65 outFilenameRaw = "ssr1_cocb_data/outfile_C.raw"; 66 outFilenameDbg = "ssr1_cocb_data/outfile_C.dbg"; 67 CLOCKORBIT_OFFSETGNSS = CLOCKORBIT_OFFSETBDS; 68 break; 69 } 70 unlink(outFilenameRaw); 71 unlink(outFilenameDbg); 72 FILE *asciiSsr, *f; 73 size_t len = 0; 74 char *buffer = 0, type = satSYS[sys]; 75 asciiSsr = fopen(inputFile, "r"); 76 if (asciiSsr == NULL) { 77 fprintf(stderr, "ERROR: open file %s\n", inputFile); 78 return 0; 79 } 80 while (getline(&buffer, &len, asciiSsr) > 0) { //fprintf(stderr, "line: %s", buffer); 81 char coBuffer[CLOCKORBIT_BUFFERSIZE]; 82 char cbBuffer[CLOCKORBIT_BUFFERSIZE]; 83 int MT = 0, messageType = 0, ui = 0, week = 0, prn = 0, iode = 0, ncb = 0; 84 double cbValue[3] = { 0.0 }, clock_a0 = 0.0, clock_a1 = 0.0, clock_a2 = 0.0, d_radial = 0.0; 85 double d_along = 0.0, d_outofplane = 0.0, dd_radial = 0.0, dd_along = 0.0, dd_outofplane = 0.0; 86 enum CodeType cbType[3] = { 0 }; 87 static double tow_co, tow_cb; 88 int num = sscanf(buffer, "%d ", &messageType); 89 if (messageType == messageTypeCo[GPS]) { 90 sscanf(buffer, 91 "%d %d %d %lf %c%d %d %lf %lf %lf %lf %lf %lf %lf %lf %lf\n", 92 &messageType, &ui, &week, &tow_co, &type, &prn, &iode, 93 &clock_a0, &d_radial, &d_along, &d_outofplane, 94 &clock_a1, &dd_radial, &dd_along, &dd_outofplane, 95 &clock_a2); 96 type = satSYS[sys]; 97 MT = messageTypeCo[sys]; 98 switch (sys) { 99 case GPS:case GAL:case SBAS:case BDS: 100 break; 101 case GLO: 102 if (prn > 24) 103 continue; 104 break; 105 case QZSS: 106 if (prn > 10) 107 continue; 108 break; 109 } 110 if ((lasttow_co != tow_co)) { // create block 111 int nl = 0, ns = 0, l = 0; 112 struct ClockOrbit coOut; 113 if (lasttow_co >= 0) { 114 if (sys == GLO) { 115 coIn.EpochTime[CLOCKORBIT_SATGLONASS] = 116 (fmod((double)coIn.EpochTime[CLOCKORBIT_SATGLONASS] 117 + (3 * 3600 - GPSUTCdiff), 86400.0)); 118 } 119 printClockOrbit(outFilenameDbg, &coIn, "INPUT", 120 CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 121 l = MakeClockOrbit(&coIn, COTYPE_AUTO, 0, coBuffer, 122 sizeof(coBuffer)); 123 if (!l) 124 fprintf(stderr, "BUILD ERROR\n"); 125 else { 126 if ((f = fopen(outFilenameRaw, "ab+"))) { 127 fwrite(coBuffer, l, 1, f); 128 fclose(f); 129 } else 130 fprintf(stderr, "SAVE ERROR %s\n", 131 outFilenameRaw); 132 } 133 memset(&coOut, 0, sizeof(coOut)); 134 nl = GetSSR(&coOut, 0, 0, 0, coBuffer, l, &ns); 135 if (nl < 0) 136 fprintf(stderr, "CLKORB EXTRACT ERROR %d\n", nl); 137 else if (nl > 0) 138 fprintf(stderr, "CLKORB MULTIBLOCK UNSUPPORTED IN TEST\n"); 139 else if (ns != l) 140 fprintf(stderr, "CLKORB SIZE MISMATCH (%d/%d)\n", ns, l); 141 else { 142 printClockOrbit(outFilenameDbg, &coOut, "OUTPUT", 143 CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 144 printClockOrbitDiff(outFilenameDbg, &coIn, &coOut, 145 "DIFF", CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 146 } 147 } 148 memset(&coIn, 0, sizeof(coIn)); 149 lasttow_co = tow_co; 150 coIn.messageType = MT; 151 coIn.EpochTime[CLOCKORBIT_SATGNSS] = (int) tow_co; 152 coIn.UpdateInterval = (int) ui; 153 coIn.Supplied[COBOFS_COMBINED] = 1; 154 coIn.SatRefDatum = DATUM_ITRF; 155 } 156 struct SatData *sd; 157 sd = coIn.Sat 158 + CLOCKORBIT_OFFSETGNSS 159 + coIn.NumberOfSat[CLOCKORBIT_SATGNSS]; 160 sd->ID = prn; 161 sd->IOD = iode; 162 sd->Clock.DeltaA0 = clock_a0; 163 sd->Clock.DeltaA1 = clock_a1; 164 sd->Clock.DeltaA2 = clock_a2; 165 sd->Orbit.DeltaRadial = d_radial; 166 sd->Orbit.DeltaAlongTrack = d_along; 167 sd->Orbit.DeltaCrossTrack = d_outofplane; 168 sd->Orbit.DotDeltaRadial = dd_radial; 169 sd->Orbit.DotDeltaAlongTrack = dd_along; 170 sd->Orbit.DotDeltaCrossTrack = dd_outofplane; 171 ++coIn.NumberOfSat[CLOCKORBIT_SATGNSS]; 172 } 173 if (messageType == messageTypeCb[GPS]) { 174 sscanf(buffer, "%d %d %d %lf %c%d %d %d %lf %d %lf %d %lf\n", 175 &messageType, &ui, &week, &tow_cb, &type, &prn, &ncb, 176 &cbType[0], &cbValue[0], &cbType[1], &cbValue[1], 177 &cbType[2], &cbValue[2]); 178 type = satSYS[sys]; 179 MT = messageTypeCb[sys]; 180 switch (sys) { 181 case GPS: 182 break; 183 case GLO: 184 if (prn > 24) 185 continue; 186 cbType[0] = CODETYPEGLONASS_L1_CA; 187 cbType[1] = CODETYPEGLONASS_L1_P; 188 cbType[2] = CODETYPEGLONASS_L2_CA; 189 break; 190 case GAL: 191 cbType[0] = CODETYPEGALILEO_E1_A; 192 cbType[1] = CODETYPEGALILEO_E5_I; 193 cbType[2] = CODETYPEGALILEO_E6_A; 194 break; 195 case QZSS: 196 if (prn > 10) 197 continue; 198 cbType[0] = CODETYPEQZSS_L1_CA; 199 cbType[1] = CODETYPEQZSS_L2_CM; 200 cbType[2] = CODETYPEQZSS_L5_I; 201 break; 202 case SBAS: 203 cbType[0] = CODETYPE_SBAS_L1_CA; 204 cbType[1] = CODETYPE_SBAS_L5_I; 205 cbType[2] = CODETYPE_SBAS_L5_Q; 206 break; 207 case BDS: 208 cbType[0] = CODETYPE_BDS_B1_I; 209 cbType[1] = CODETYPE_BDS_B3_I; 210 cbType[2] = CODETYPE_BDS_B2_I; 211 break; 212 } 213 if (lasttow_cb != tow_cb) { // create block 214 int nl, ns, l; 215 struct CodeBias cbOut; 216 if (lasttow_cb >= 0) { 217 if (sys == GLO) { 218 cbIn.EpochTime[CLOCKORBIT_SATGLONASS] = 219 (fmod((double)cbIn.EpochTime[CLOCKORBIT_SATGLONASS] 220 + (3 * 3600 - GPSUTCdiff), 86400.0)); 221 } 222 printCodeBias(outFilenameDbg, &cbIn, "INPUT", 223 CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 224 l = MakeCodeBias(&cbIn, BTYPE_AUTO, 0, cbBuffer, 225 sizeof(cbBuffer)); 226 if (!l) 227 fprintf(stderr, "BUILD ERROR\n"); 228 else { 229 if ((f = fopen(outFilenameRaw, "ab+"))) { 230 fwrite(cbBuffer, l, 1, f); 231 fclose(f); 232 } else 233 fprintf(stderr, "SAVE ERROR %s\n", outFilenameRaw); 234 } 235 memset(&cbOut, 0, sizeof(cbOut)); 236 nl = GetSSR(NULL, &cbOut, NULL, 0, cbBuffer, l, &ns); 237 if (nl < 0) 238 fprintf(stderr, "CBIAS EXTRACT ERROR %d\n", nl); 239 else if (nl > 0) 240 fprintf(stderr, "CBIAS MULTIBLOCK UNSUPPORTED IN TEST\n"); 241 else if (ns != l) 242 fprintf(stderr, "CBIAS SIZE MISMATCH (%d/%d)\n", ns, l); 243 else { 244 printCodeBias(outFilenameDbg, &cbOut, "OUTPUT", 245 CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 246 printCodeBiasDiff(outFilenameDbg, &cbIn, &cbOut, 247 "DIFF", CLOCKORBIT_SATGNSS, type, CLOCKORBIT_OFFSETGNSS); 248 } 249 } 250 memset(&cbIn, 0, sizeof(cbIn)); 251 lasttow_cb = tow_cb; 252 cbIn.messageType = MT; 253 cbIn.EpochTime[CLOCKORBIT_SATGNSS] = (int) tow_cb; 254 cbIn.UpdateInterval = ui; 255 coIn.Supplied[COBOFS_BIAS] = 1; 256 } 257 struct BiasSat *bs; 258 bs = cbIn.Sat 259 + CLOCKORBIT_OFFSETGNSS 260 + cbIn.NumberOfSat[CLOCKORBIT_SATGNSS]; 261 bs->ID = prn; 262 bs->NumberOfCodeBiases = ncb; 263 int k = 0; 264 for (k = 0; k < bs->NumberOfCodeBiases; k++) { 265 bs->Biases[k].Type = cbType[k]; 266 bs->Biases[k].Bias = cbValue[k]; 267 } 268 ++cbIn.NumberOfSat[CLOCKORBIT_SATGNSS]; 269 } 270 } 271 free(buffer); 272 close(asciiSsr); 273 } 274 return 0; 273 275 } 274 276 275 277 void printClockOrbit(const char* filename, struct ClockOrbit* clockOrb, 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 278 char* flag, int ind, char satSys, int offsetGnss) { 279 int i = 0; 280 FILE *filestream = fopen(filename, "ab+"); 281 if (!clockOrb->NumberOfSat[ind]) 282 return; 283 if (filestream == NULL) { 284 fprintf(stderr, "ERROR: open file %s\n", filename); 285 return; 286 } 287 fprintf(filestream, "CLKORB_%s\n", flag); 288 for (i = offsetGnss; i < offsetGnss + clockOrb->NumberOfSat[ind]; ++i) { 289 fprintf(filestream, 290 "%10d %d %c%02d %5d %12.3f %12.3f %12.3f %12.3f %12.3f %12f %12f %12f %12.3f\n", 291 clockOrb->EpochTime[ind], clockOrb->UpdateInterval, satSys, 292 clockOrb->Sat[i].ID, 293 clockOrb->Sat[i].IOD, 294 clockOrb->Sat[i].Clock.DeltaA0, 295 clockOrb->Sat[i].Orbit.DeltaRadial, 296 clockOrb->Sat[i].Orbit.DeltaAlongTrack, 297 clockOrb->Sat[i].Orbit.DeltaCrossTrack, 298 clockOrb->Sat[i].Clock.DeltaA1, 299 clockOrb->Sat[i].Orbit.DotDeltaRadial, 300 clockOrb->Sat[i].Orbit.DotDeltaAlongTrack, 301 clockOrb->Sat[i].Orbit.DotDeltaCrossTrack, 302 clockOrb->Sat[i].Clock.DeltaA2); 303 } 304 fclose(filestream); 303 305 } 304 306 305 307 void printClockOrbitDiff(const char* filename, struct ClockOrbit* clockOrb1, 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 308 struct ClockOrbit* clockOrb2, char* flag, int ind, char satSys, 309 int offsetGnss) { 310 int i = 0; 311 FILE *filestream = fopen(filename, "ab+"); 312 if (!clockOrb1->NumberOfSat[ind]) 313 return; 314 if (filestream == NULL) { 315 fprintf(stderr, "ERROR: open file %s\n", filename); 316 return; 317 } 318 fprintf(filestream, "CLKORB_%s\n", flag); 319 for (i = offsetGnss; i < offsetGnss + clockOrb1->NumberOfSat[ind]; ++i) { 320 fprintf(filestream, 321 "%10d %d %c%02d %5d %12.3f %12.3f %12.3f %12.3f %12.3f %12f %12f %12f %12.3f\n", 322 clockOrb1->EpochTime[ind] 323 - clockOrb2->EpochTime[ind], 324 clockOrb1->UpdateInterval 325 - clockOrb2->UpdateInterval, satSys, 326 clockOrb1->Sat[i].ID 327 - clockOrb2->Sat[i].ID, 328 clockOrb1->Sat[i].IOD - clockOrb2->Sat[i].IOD, 329 clockOrb1->Sat[i].Clock.DeltaA0 330 - clockOrb2->Sat[i].Clock.DeltaA0, 331 clockOrb1->Sat[i].Orbit.DeltaRadial 332 - clockOrb2->Sat[i].Orbit.DeltaRadial, 333 clockOrb1->Sat[i].Orbit.DeltaAlongTrack 334 - clockOrb2->Sat[i].Orbit.DeltaAlongTrack, 335 clockOrb1->Sat[i].Orbit.DeltaCrossTrack 336 - clockOrb2->Sat[i].Orbit.DeltaCrossTrack, 337 clockOrb1->Sat[i].Clock.DeltaA1 338 - clockOrb2->Sat[i].Clock.DeltaA1, 339 clockOrb1->Sat[i].Orbit.DotDeltaRadial 340 - clockOrb2->Sat[i].Orbit.DotDeltaRadial, 341 clockOrb1->Sat[i].Orbit.DotDeltaAlongTrack 342 - clockOrb2->Sat[i].Orbit.DotDeltaAlongTrack, 343 clockOrb1->Sat[i].Orbit.DotDeltaCrossTrack 344 - clockOrb2->Sat[i].Orbit.DotDeltaCrossTrack, 345 clockOrb1->Sat[i].Clock.DeltaA2 346 - clockOrb2->Sat[i].Clock.DeltaA2); 347 } 348 fclose(filestream); 347 349 } 348 350 349 351 void printCodeBias(const char* filename, struct CodeBias* codeBias, char* flag, 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 352 int ind, char satSys, int offsetGnss) { 353 int i = 0; 354 FILE *filestream = fopen(filename, "ab+"); 355 if (!codeBias->NumberOfSat[ind]) 356 return; 357 if (filestream == NULL) { 358 fprintf(stderr, "ERROR: open file %s\n", filename); 359 return; 360 } 361 fprintf(filestream, "CBIAS_%s\n", flag); 362 for (i = offsetGnss; i < offsetGnss + codeBias->NumberOfSat[ind]; ++i) { 363 fprintf(filestream, "%10d %d %c%02d %2d ", 364 codeBias->EpochTime[ind], codeBias->UpdateInterval, satSys, 365 codeBias->Sat[i].ID, codeBias->Sat[i].NumberOfCodeBiases); 366 int j; 367 for (j = 0; j < codeBias->Sat[i].NumberOfCodeBiases; j++) { 368 fprintf(filestream, "%4d %12.3f", codeBias->Sat[i].Biases[j].Type, 369 codeBias->Sat[i].Biases[j].Bias); 370 } 371 fprintf(filestream, "\n"); 372 } 373 fclose(filestream); 372 374 } 373 375 374 376 void printCodeBiasDiff(const char* filename, struct CodeBias* codeBias1, 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 377 struct CodeBias* codeBias2, char* flag, int ind, char satSys, 378 int offsetGnss) { 379 int i = 0; 380 FILE *filestream = fopen(filename, "ab+"); 381 if (!codeBias1->NumberOfSat[ind]) 382 return; 383 if (filestream == NULL) { 384 fprintf(stderr, "ERROR: open file %s\n", filename); 385 return; 386 } 387 fprintf(filestream, "CBIAS_%s\n", flag); 388 for (i = offsetGnss; i < offsetGnss + codeBias1->NumberOfSat[ind]; ++i) { 389 fprintf(filestream, "%10d %d %c%02d %2d ", 390 codeBias1->EpochTime[ind] 391 - codeBias2->EpochTime[ind], 392 codeBias1->UpdateInterval 393 - codeBias2->UpdateInterval, satSys, 394 codeBias1->Sat[i].ID 395 - codeBias2->Sat[i].ID, 396 codeBias1->Sat[i].NumberOfCodeBiases 397 - codeBias2->Sat[i].NumberOfCodeBiases); 398 int j; 399 for (j = 0; j < codeBias1->Sat[i].NumberOfCodeBiases; j++) { 400 fprintf(filestream, "%4d %12.3f", 401 codeBias1->Sat[i].Biases[j].Type 402 - codeBias2->Sat[i].Biases[j].Type, 403 codeBias1->Sat[i].Biases[j].Bias 404 - codeBias2->Sat[i].Biases[j].Bias); 405 } 406 fprintf(filestream, "\n"); 407 } 408 fclose(filestream); 407 409 }
Note:
See TracChangeset
for help on using the changeset viewer.