Changeset 5664 in ntrip for trunk/clock_and_orbit/readcoold.c
- Timestamp:
- May 26, 2014, 5:09:28 PM (10 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/clock_and_orbit/readcoold.c
- Property svn:executable deleted
r5661 r5664 3 3 4 4 #include <stdio.h> 5 #include <stdlib.h> 5 6 6 7 /* prototype, don't use any of this code in a final application */ … … 11 12 int main(void) 12 13 { 13 char buffer[4096]; 14 char * buffer = 0; 15 size_t len = 0; 14 16 char obuffer[CLOCKORBIT_BUFFERSIZE]; 15 17 16 while(get s(buffer))18 while(getline(&buffer, &len, stdin) > 0) 17 19 { 18 20 char type; … … 28 30 if(lasttow >= 0) 29 31 { 32 FILE *f; 30 33 int l = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer)); 31 34 if(!l) fprintf(stderr, "BUILD ERROR\n"); … … 35 38 struct ClockOrbit c; 36 39 37 // fwrite(obuffer, l, 1, stdout); 40 if((f = fopen("outfile.raw", "ab+"))) 41 { 42 fwrite(obuffer, l, 1, f); 43 fclose(f); 44 } 45 else fprintf(stderr, "SAVE ERROR\n"); 46 //fwrite(obuffer, l, 1, stdout); 38 47 memset(&c, 0, sizeof(c)); 39 nl = Get ClockOrbitBias(&c, 0, obuffer, l, &ns);48 nl = GetSSR(&c, 0, 0, 0, obuffer, l, &ns); 40 49 if(nl < 0) fprintf(stderr, "EXTRACT ERROR %d\n", nl); 41 50 else if(nl > 0) fprintf(stderr, "MULTIBLOCK UNSUPPORTED IN TEST\n"); … … 44 53 { 45 54 int i; 46 for(i = 0; i < c.NumberOf GPSSat; ++i)55 for(i = 0; i < c.NumberOfSat[CLOCKORBIT_SATGPS]; ++i) 47 56 { 48 printf("%d G% d %d %f %f %f %f\n", c.GPSEpochTime,57 printf("%d G%02d %d %f %f %f %f\n", c.EpochTime[CLOCKORBIT_SATGPS], 49 58 c.Sat[i].ID, co.Sat[i].IOD, c.Sat[i].Clock.DeltaA0, 50 59 c.Sat[i].Orbit.DeltaRadial, c.Sat[i].Orbit.DeltaAlongTrack, … … 56 65 memset(&co, 0, sizeof(co)); 57 66 lasttow = tow; 58 co. GPSEpochTime= (int)tow;67 co.EpochTime[CLOCKORBIT_SATGPS] = (int)tow; 59 68 /* co.GLONASSEpochTime = 0; */ 60 co. ClockDataSupplied= 1;61 co. OrbitDataSupplied= 1;69 co.Supplied[COBOFS_CLOCK] = 1; 70 co.Supplied[COBOFS_ORBIT] = 1; 62 71 co.SatRefDatum = DATUM_ITRF; 63 72 } 64 73 65 sd = co.Sat + co.NumberOf GPSSat;74 sd = co.Sat + co.NumberOfSat[CLOCKORBIT_SATGPS]; 66 75 sd->ID = prn; 67 76 sd->IOD = iode; … … 70 79 sd->Orbit.DeltaAlongTrack = along; 71 80 sd->Orbit.DeltaCrossTrack = outofplane; 72 printf("%d %d/%f %c %d %d %d %f %f %f %f\n",num, week, tow, type, prn,81 printf("%d %d/%f %c%02d %d %d %f %f %f %f\n",num, week, tow, type, prn, 73 82 iodc, iode, clock, radial, along, outofplane); 74 ++co.NumberOf GPSSat;83 ++co.NumberOfSat[CLOCKORBIT_SATGPS]; 75 84 } 76 85 } 86 { 87 struct VTEC v; 88 memset(&v, 0, sizeof(v)); 89 v.EpochTime = 218764; 90 v.NumLayers = 1; 91 v.UpdateInterval = 1; 92 v.Layers[0].Height = 450000; 93 v.Layers[0].Degree = 4; 94 v.Layers[0].Order = 4; 95 v.Layers[0].Cosinus[0][0] = 24.435; 96 v.Layers[0].Cosinus[1][0] = 4.495; 97 v.Layers[0].Cosinus[2][0] = -7.805; 98 v.Layers[0].Cosinus[3][0] = -1.900; 99 v.Layers[0].Cosinus[4][0] = 2.045; 100 v.Layers[0].Cosinus[1][1] = -9.960; 101 v.Layers[0].Cosinus[2][1] = 0.845; 102 v.Layers[0].Cosinus[3][1] = 2.260; 103 v.Layers[0].Cosinus[4][1] = -0.315; 104 v.Layers[0].Cosinus[2][2] = 3.730; 105 v.Layers[0].Cosinus[3][2] = -0.780; 106 v.Layers[0].Cosinus[4][2] = -0.055; 107 v.Layers[0].Cosinus[3][3] = -0.020; 108 v.Layers[0].Cosinus[4][3] = 1.150; 109 v.Layers[0].Cosinus[4][4] = 0.990; 110 111 v.Layers[0].Sinus[1][1] = -6.070; 112 v.Layers[0].Sinus[2][1] = -3.105; 113 v.Layers[0].Sinus[3][1] = 1.310; 114 v.Layers[0].Sinus[4][1] = 1.545; 115 v.Layers[0].Sinus[2][2] = 0.325; 116 v.Layers[0].Sinus[3][2] = -1.050; 117 v.Layers[0].Sinus[4][2] = -0.750; 118 v.Layers[0].Sinus[3][3] = 0.170; 119 v.Layers[0].Sinus[4][3] = -0.690; 120 v.Layers[0].Sinus[4][4] = -0.705; 121 FILE *f; 122 int l = MakeVTEC(&v, 0, obuffer, sizeof(obuffer)); 123 if(!l) fprintf(stderr, "BUILD ERROR\n"); 124 else 125 { 126 int nl, ns; 127 struct VTEC vv; 128 129 if((f = fopen("outfile.raw", "ab+"))) 130 { 131 fwrite(obuffer, l, 1, f); 132 fclose(f); 133 } 134 else fprintf(stderr, "SAVE ERROR\n"); 135 //fwrite(obuffer, l, 1, stdout); 136 memset(&vv, 0, sizeof(vv)); 137 nl = GetSSR(0, 0, &vv, 0, obuffer, l, &ns); 138 if(nl < 0) fprintf(stderr, "EXTRACT ERROR %d\n", nl); 139 else if(nl > 0) fprintf(stderr, "MULTIBLOCK UNSUPPORTED IN TEST\n"); 140 else if(ns != l) fprintf(stderr, "SIZE MISMATCH (%d/%d)\n", ns,l); 141 else 142 { 143 int i, j, k; 144 for(i = 0; i < vv.NumLayers; ++i) 145 { 146 printf("%d layer %d height %f degree %d order %d\n", vv.EpochTime, 147 i, vv.Layers[i].Height, vv.Layers[i].Degree, vv.Layers[i].Order); 148 for(j = 0; j <= vv.Layers[i].Degree; ++j) 149 { 150 printf("Cn%d ",j); 151 for(k = 0; k <= vv.Layers[i].Order; ++k) 152 { 153 printf(" %7.3f",vv.Layers[i].Cosinus[k][j]); 154 } 155 printf("\n"); 156 } 157 for(j = 0; j <= vv.Layers[i].Degree; ++j) 158 { 159 printf("Sn%d ",j); 160 for(k = 0; k <= vv.Layers[i].Order; ++k) 161 { 162 printf(" %7.3f",vv.Layers[i].Sinus[k][j]); 163 } 164 printf("\n"); 165 } 166 } 167 } 168 } 169 } 170 free(buffer); 77 171 return 0; 78 172 }
Note:
See TracChangeset
for help on using the changeset viewer.