kopia lustrzana https://github.com/rs1729/RS
remove non-ascii
rodzic
1a87be1a50
commit
3af2f1e474
|
@ -466,7 +466,7 @@ typedef struct {
|
|||
int jahr; int monat; int tag;
|
||||
int wday;
|
||||
int std; int min; float sek;
|
||||
double lat; double lon; double h;
|
||||
double lat; double lon; double alt;
|
||||
double vH; double vD; double vV;
|
||||
double vE; double vN; double vU;
|
||||
//int freq;
|
||||
|
@ -624,7 +624,7 @@ int get_GPSalt() {
|
|||
gpsheight |= gpsheight_bytes[i] << (8*(3-i));
|
||||
}
|
||||
height = gpsheight / 1000.0;
|
||||
gpx.h = height;
|
||||
gpx.alt = height;
|
||||
|
||||
if (height < -100 || height > 60000) return -1;
|
||||
return 0;
|
||||
|
@ -722,14 +722,14 @@ void print_frame(int crc_err, int len) {
|
|||
get_GPSlon();
|
||||
err = get_GPSalt();
|
||||
if (!err) {
|
||||
printf(" lat: %.6f° ", gpx.lat);
|
||||
printf(" lon: %.6f° ", gpx.lon);
|
||||
printf(" alt: %.2fm ", gpx.h);
|
||||
printf(" lat: %.6f ", gpx.lat);
|
||||
printf(" lon: %.6f ", gpx.lon);
|
||||
printf(" alt: %.2fm ", gpx.alt);
|
||||
//if (option_verbose)
|
||||
{
|
||||
get_GPSvel24();
|
||||
//if (option_verbose == 2) printf(" (%.1f ,%.1f,%.1f) ", gpx.vE, gpx.vN, gpx.vU);
|
||||
printf(" vH: %.1fm/s D: %.1f° vV: %.1fm/s ", gpx.vH, gpx.vD, gpx.vV);
|
||||
printf(" vH: %.1fm/s D: %.1f vV: %.1fm/s ", gpx.vH, gpx.vD, gpx.vV);
|
||||
}
|
||||
}
|
||||
if (crc_err==0) printf(" [OK]"); else printf(" [NO]");
|
||||
|
|
|
@ -468,7 +468,7 @@ typedef struct {
|
|||
int jahr; int monat; int tag;
|
||||
int wday;
|
||||
int std; int min; float sek;
|
||||
double lat; double lon; double h;
|
||||
double lat; double lon; double alt;
|
||||
double vH; double vD; double vV;
|
||||
double vE; double vN; double vU;
|
||||
//int freq;
|
||||
|
@ -626,7 +626,7 @@ int get_GPSalt() {
|
|||
gpsheight |= gpsheight_bytes[i] << (8*(3-i));
|
||||
}
|
||||
height = gpsheight / 100.0;
|
||||
gpx.h = height;
|
||||
gpx.alt = height;
|
||||
|
||||
if (height < -100 || height > 60000) return -1;
|
||||
return 0;
|
||||
|
@ -760,13 +760,13 @@ void print_frame(int crc_err, int len) {
|
|||
get_GPSlon();
|
||||
err = get_GPSalt();
|
||||
if (!err) {
|
||||
printf(" lat: %.6f° ", gpx.lat);
|
||||
printf(" lon: %.6f° ", gpx.lon);
|
||||
printf(" alt: %.2fm ", gpx.h);
|
||||
printf(" lat: %.6f ", gpx.lat);
|
||||
printf(" lon: %.6f ", gpx.lon);
|
||||
printf(" alt: %.2fm ", gpx.alt);
|
||||
//if (option_verbose)
|
||||
{
|
||||
get_GPSvel16();
|
||||
printf(" vH: %.1fm/s D: %.1f° vV: %.1fm/s ", gpx.vH, gpx.vD, gpx.vV);
|
||||
printf(" vH: %.1fm/s D: %.1f vV: %.1fm/s ", gpx.vH, gpx.vD, gpx.vV);
|
||||
}
|
||||
}
|
||||
if (crc_err==0) printf(" [OK]"); else printf(" [NO]");
|
||||
|
|
|
@ -647,7 +647,7 @@ int print_pos(int csOK) {
|
|||
err |= get_GPSvel();
|
||||
if (!err) {
|
||||
//if (option_verbose == 2) fprintf(stdout, " "col_GPSvel"(%.1f , %.1f : %.1f)"col_TXT" ", datum.vx, datum.vy, datum.vD2);
|
||||
fprintf(stdout, " vH: "col_GPSvel"%.1f"col_TXT" D: "col_GPSvel"%.1f"col_TXT"° vV: "col_GPSvel"%.1f"col_TXT" ", datum.vH, datum.vD, datum.vV);
|
||||
fprintf(stdout, " vH: "col_GPSvel"%.1f"col_TXT" D: "col_GPSvel"%.1f"col_TXT" vV: "col_GPSvel"%.1f"col_TXT" ", datum.vH, datum.vD, datum.vV);
|
||||
}
|
||||
if (option_verbose >= 2) {
|
||||
get_SN();
|
||||
|
@ -681,8 +681,8 @@ int print_pos(int csOK) {
|
|||
if (option_verbose) {
|
||||
err |= get_GPSvel();
|
||||
if (!err) {
|
||||
//if (option_verbose == 2) fprintf(stdout, " (%.1f , %.1f : %.1f°) ", datum.vx, datum.vy, datum.vD2);
|
||||
fprintf(stdout, " vH: %.1f D: %.1f° vV: %.1f ", datum.vH, datum.vD, datum.vV);
|
||||
//if (option_verbose == 2) fprintf(stdout, " (%.1f , %.1f : %.1f) ", datum.vx, datum.vy, datum.vD2);
|
||||
fprintf(stdout, " vH: %.1f D: %.1f vV: %.1f ", datum.vH, datum.vD, datum.vV);
|
||||
}
|
||||
if (option_verbose >= 2) {
|
||||
get_SN();
|
||||
|
|
|
@ -616,7 +616,7 @@ static void print_frame(gpx_t *gpx, int crc_err, int len) {
|
|||
printf(" alt: %.2fm ", gpx->alt);
|
||||
get_GPSvel24(gpx);
|
||||
//if (gpx->option.vbs == 2) printf(" (%.1f ,%.1f,%.1f) ", gpx->vE, gpx->vN, gpx->vU);
|
||||
printf(" vH: %.1fm/s D: %.1f° vV: %.1fm/s ", gpx->vH, gpx->vD, gpx->vV);
|
||||
printf(" vH: %.1fm/s D: %.1f vV: %.1fm/s ", gpx->vH, gpx->vD, gpx->vV);
|
||||
}
|
||||
|
||||
if (crc_err==0) printf(" [OK]"); else printf(" [NO]");
|
||||
|
|
|
@ -700,7 +700,7 @@ static int print_pos(gpx_t *gpx, int csOK) {
|
|||
fprintf(stdout, " alt: "col_GPSalt"%.2f"col_TXT" ", gpx->alt);
|
||||
if (!err2) {
|
||||
//if (gpx->option.vbs == 2) fprintf(stdout, " "col_GPSvel"(%.1f , %.1f : %.1f)"col_TXT" ", gpx->vx, gpx->vy, gpx->vD2);
|
||||
fprintf(stdout, " vH: "col_GPSvel"%.1f"col_TXT" D: "col_GPSvel"%.1f"col_TXT"° vV: "col_GPSvel"%.1f"col_TXT" ", gpx->vH, gpx->vD, gpx->vV);
|
||||
fprintf(stdout, " vH: "col_GPSvel"%.1f"col_TXT" D: "col_GPSvel"%.1f"col_TXT" vV: "col_GPSvel"%.1f"col_TXT" ", gpx->vH, gpx->vD, gpx->vV);
|
||||
}
|
||||
if (gpx->option.vbs >= 2) {
|
||||
get_SN(gpx);
|
||||
|
@ -731,8 +731,8 @@ static int print_pos(gpx_t *gpx, int csOK) {
|
|||
fprintf(stdout, " lon: %.5f ", gpx->lon);
|
||||
fprintf(stdout, " alt: %.2f ", gpx->alt);
|
||||
if (!err2) {
|
||||
//if (gpx->option.vbs == 2) fprintf(stdout, " (%.1f , %.1f : %.1f°) ", gpx->vx, gpx->vy, gpx->vD2);
|
||||
fprintf(stdout, " vH: %.1f D: %.1f° vV: %.1f ", gpx->vH, gpx->vD, gpx->vV);
|
||||
//if (gpx->option.vbs == 2) fprintf(stdout, " (%.1f , %.1f : %.1f) ", gpx->vx, gpx->vy, gpx->vD2);
|
||||
fprintf(stdout, " vH: %.1f D: %.1f vV: %.1f ", gpx->vH, gpx->vD, gpx->vV);
|
||||
}
|
||||
if (gpx->option.vbs >= 2) {
|
||||
get_SN(gpx);
|
||||
|
|
|
@ -84,7 +84,7 @@ typedef struct {
|
|||
double lat; double lon; double alt;
|
||||
double vN; double vE; double vU;
|
||||
double vH; double vD; double vD2;
|
||||
float T;
|
||||
float T; float RH;
|
||||
ui32_t crc;
|
||||
ui8_t frame[FRAME_LEN];
|
||||
ui8_t calibytes[51*16];
|
||||
|
@ -95,6 +95,7 @@ typedef struct {
|
|||
float ptu_calT1[3]; // calibration T1
|
||||
float ptu_co2[3]; // { -243.911 , 0.187654 , 8.2e-06 }
|
||||
float ptu_calT2[3]; // calibration T2-Hum
|
||||
float ptu_calH[2]; // calibration Hum
|
||||
ui16_t conf_fw; // firmware
|
||||
ui8_t conf_cd; // kill countdown (sec) (kt or bt)
|
||||
ui16_t conf_kt; // kill timer (sec)
|
||||
|
@ -495,6 +496,9 @@ static int get_CalData(gpx_t *gpx) {
|
|||
memcpy(gpx->ptu_calT1+1, gpx->calibytes+93, 4); // 0x05*0x10+13
|
||||
memcpy(gpx->ptu_calT1+2, gpx->calibytes+97, 4); // 0x06*0x10+ 1
|
||||
|
||||
memcpy(gpx->ptu_calH+0, gpx->calibytes+117, 4); // 0x07*0x10+ 5
|
||||
memcpy(gpx->ptu_calH+1, gpx->calibytes+121, 4); // 0x07*0x10+ 9
|
||||
|
||||
memcpy(gpx->ptu_co2+0, gpx->calibytes+293, 4); // 0x12*0x10+ 5
|
||||
memcpy(gpx->ptu_co2+1, gpx->calibytes+297, 4); // 0x12*0x10+ 9
|
||||
memcpy(gpx->ptu_co2+2, gpx->calibytes+301, 4); // 0x12*0x10+13
|
||||
|
@ -506,6 +510,7 @@ static int get_CalData(gpx_t *gpx) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
static float get_Tc0(gpx_t *gpx, ui32_t f, ui32_t f1, ui32_t f2) {
|
||||
// y = (f - f1) / (f2 - f1);
|
||||
// y1 = (f - f1) / f2; // = (1 - f1/f2)*y
|
||||
|
@ -523,6 +528,21 @@ static float get_Tc0(gpx_t *gpx, ui32_t f, ui32_t f1, ui32_t f2) {
|
|||
// R/R0 = 1 + at + bt^2 + c(t-100)t^3 , R0 = 1000 Ohm, t/Celsius
|
||||
return t;
|
||||
}
|
||||
*/
|
||||
// T_RH-sensor
|
||||
static float get_TH(gpx_t *gpx, ui32_t f, ui32_t f1, ui32_t f2) {
|
||||
float *p = gpx->ptu_co2;
|
||||
float *c = gpx->ptu_calT2;
|
||||
float g = (float)(f2-f1)/(gpx->ptu_Rf2-gpx->ptu_Rf1), // gain
|
||||
Rb = (f1*gpx->ptu_Rf2-f2*gpx->ptu_Rf1)/(float)(f2-f1), // ofs
|
||||
Rc = f/g - Rb,
|
||||
//R = (Rc + c[1]) * c[0],
|
||||
//T = p[0] + p[1]*R + p[2]*R*R;
|
||||
R = Rc * c[0],
|
||||
T = (p[0] + p[1]*R + p[2]*R*R + c[1])*(1.0 + c[2]);
|
||||
return T;
|
||||
}
|
||||
// T-sensor, platinum resistor
|
||||
static float get_Tc(gpx_t *gpx, ui32_t f, ui32_t f1, ui32_t f2) {
|
||||
float *p = gpx->ptu_co1;
|
||||
float *c = gpx->ptu_calT1;
|
||||
|
@ -536,13 +556,32 @@ static float get_Tc(gpx_t *gpx, ui32_t f, ui32_t f1, ui32_t f2) {
|
|||
return T;
|
||||
}
|
||||
|
||||
// rel.hum., capacitor
|
||||
// (data:) ftp://ftp-cdc.dwd.de/pub/CDC/observations_germany/radiosondes/
|
||||
// (diffAlt: Ellipsoid-Geoid)
|
||||
static float get_RH(gpx_t *gpx, ui32_t f, ui32_t f1, ui32_t f2, float T) {
|
||||
float b0 = gpx->ptu_calH[0]/46.64; // empirical
|
||||
float b1 = 0.1276; // empirical
|
||||
float fh = (f-f1)/(float)(f2-f1);
|
||||
float rh = 100.0 * (fh-b0)/b1;
|
||||
float T0 = 0.0, T1 = -30.0; // T/C
|
||||
if (T < T0) rh += T0 - T/5.5; // empir. temperature compensation
|
||||
if (T < T1) rh *= 1.0 + (T1-T)/75.0; // empir. temperature compensation
|
||||
if (rh < 0.0) rh = 0.0;
|
||||
if (rh > 100.0) rh = 100.0;
|
||||
if (T < -273.0) rh = -1.0;
|
||||
return rh;
|
||||
}
|
||||
|
||||
static int get_PTU(gpx_t *gpx) {
|
||||
int err=0, i;
|
||||
int bR, bc1, bT1,
|
||||
bc2, bT2;
|
||||
int bH;
|
||||
ui32_t meas[12];
|
||||
float Tc = -273.15;
|
||||
float Tc0 = -273.15;
|
||||
float TH = -273.15;
|
||||
float RH = -1.0;
|
||||
|
||||
get_CalData(gpx);
|
||||
|
||||
|
@ -561,14 +600,25 @@ static int get_PTU(gpx_t *gpx) {
|
|||
bT1 = gpx->calfrchk[0x05] && gpx->calfrchk[0x06];
|
||||
bc2 = gpx->calfrchk[0x12] && gpx->calfrchk[0x13];
|
||||
bT2 = gpx->calfrchk[0x13];
|
||||
bH = gpx->calfrchk[0x07];
|
||||
|
||||
if (bR && bc1 && bT1) {
|
||||
Tc = get_Tc(gpx, meas[0], meas[1], meas[2]);
|
||||
Tc0 = get_Tc0(gpx, meas[0], meas[1], meas[2]);
|
||||
//Tc0 = get_Tc0(gpx, meas[0], meas[1], meas[2]);
|
||||
}
|
||||
gpx->T = Tc;
|
||||
|
||||
if (gpx->option.vbs == 4)
|
||||
if (bR && bc2 && bT2) {
|
||||
TH = get_TH(gpx, meas[6], meas[7], meas[8]);
|
||||
}
|
||||
|
||||
if (bH) {
|
||||
RH = get_RH(gpx, meas[3], meas[4], meas[5], Tc); // TH, TH-Tc (sensorT - T)
|
||||
}
|
||||
gpx->RH = RH;
|
||||
|
||||
|
||||
if (gpx->option.vbs == 4 && (gpx->crc & (crc_PTU | crc_GPS3))==0)
|
||||
{
|
||||
printf(" h: %8.2f # ", gpx->alt); // crc_GPS3 ?
|
||||
|
||||
|
@ -578,17 +628,25 @@ static int get_PTU(gpx_t *gpx) {
|
|||
printf(" # ");
|
||||
printf("3: %8d %8d %8d", meas[6], meas[7], meas[8]);
|
||||
printf(" # ");
|
||||
if (Tc > -273.0) {
|
||||
printf(" T: %8.4f , T0: %8.4f ", Tc, Tc0);
|
||||
|
||||
//if (Tc > -273.0 && RH > -0.5)
|
||||
{
|
||||
printf(" ");
|
||||
printf(" Tc:%.2f ", Tc);
|
||||
printf(" RH:%.1f ", RH);
|
||||
printf(" TH:%.2f ", TH);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (gpx->alt > -100.0) {
|
||||
if (gpx->alt > -400.0)
|
||||
{
|
||||
printf(" %9.2f ; %6.1f ; %6.1f ", gpx->alt, gpx->ptu_Rf1, gpx->ptu_Rf2);
|
||||
printf("; %10.6f ; %10.6f ; %10.6f ;", gpx->ptu_calT1[0], gpx->ptu_calT1[1], gpx->ptu_calT1[2]);
|
||||
printf(" %8d ; %8d ; %8d ", meas[0], meas[1], meas[2]);
|
||||
printf("; %10.6f ; %10.6f ; %10.6f ;", gpx->ptu_calT2[0], gpx->ptu_calT2[1], gpx->ptu_calT2[2]);
|
||||
printf(" %8d ; %8d ; %8d" , meas[6], meas[7], meas[8]);
|
||||
printf("; %10.6f ; %10.6f ; %10.6f ", gpx->ptu_calT1[0], gpx->ptu_calT1[1], gpx->ptu_calT1[2]);
|
||||
//printf("; %8d ; %8d ; %8d ", meas[0], meas[1], meas[2]);
|
||||
printf("; %10.6f ; %10.6f ", gpx->ptu_calH[0], gpx->ptu_calH[1]);
|
||||
//printf("; %8d ; %8d ; %8d ", meas[3], meas[4], meas[5]);
|
||||
printf("; %10.6f ; %10.6f ; %10.6f ", gpx->ptu_calT2[0], gpx->ptu_calT2[1], gpx->ptu_calT2[2]);
|
||||
//printf("; %8d ; %8d ; %8d" , meas[6], meas[7], meas[8]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
@ -1061,12 +1119,14 @@ static int print_position(gpx_t *gpx, int ec) {
|
|||
//if (gpx->option.vbs)
|
||||
{
|
||||
//fprintf(stdout, " (%.1f %.1f %.1f) ", gpx->vN, gpx->vE, gpx->vU);
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f° vV: %3.1f ", gpx->vH, gpx->vD, gpx->vU);
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f vV: %3.1f ", gpx->vH, gpx->vD, gpx->vU);
|
||||
if (gpx->option.vbs == 3) fprintf(stdout," sats: %02d ", gpx->numSV);
|
||||
}
|
||||
}
|
||||
if (gpx->option.ptu && !err0) {
|
||||
printf(" ");
|
||||
if (gpx->T > -273.0) printf(" T=%.1fC ", gpx->T);
|
||||
if (gpx->RH > -0.5) printf(" RH=%.0f%% ", gpx->RH);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1120,6 +1180,9 @@ static int print_position(gpx_t *gpx, int ec) {
|
|||
if (gpx->option.ptu && !err0 && gpx->T > -273.0) {
|
||||
fprintf(stdout, ", \"temp\": %.1f", gpx->T );
|
||||
}
|
||||
if (gpx->option.ptu && !err0 && gpx->RH > -0.5) {
|
||||
fprintf(stdout, ", \"humidity\": %.1f", gpx->RH );
|
||||
}
|
||||
if (gpx->aux) { // <=> gpx->xdata[0]!='\0'
|
||||
fprintf(stdout, ", \"aux\": \"%s\"", gpx->xdata );
|
||||
}
|
||||
|
|
|
@ -876,7 +876,7 @@ static int get_GPSkoord(gpx_t *gpx, int N) {
|
|||
fprintf(stdout, "lat: %.5f , lon: %.5f , alt: %.1f ", lat, lon, alt);
|
||||
fprintf(stdout, " (d:%.1f)", diter);
|
||||
if ( gpx->gps.opt_vel == 4 ) {
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f° vV: %3.1f ", vH, vD, vU);
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f vV: %3.1f ", vH, vD, vU);
|
||||
}
|
||||
fprintf(stdout, " sats: ");
|
||||
fprintf(stdout, "%02d %02d %02d %02d ", gpx->gps.prn[i0], gpx->gps.prn[i1], gpx->gps.prn[i2], gpx->gps.prn[i3]);
|
||||
|
@ -986,7 +986,7 @@ static int get_GPSkoord(gpx_t *gpx, int N) {
|
|||
ecef2elli(pos1s_ecef[0], pos1s_ecef[1], pos1s_ecef[2], &lat1s, &lon1s, &alt1s);
|
||||
if (gpx->gps.opt_vergps == 8) {
|
||||
fprintf(stdout, "\ndeltachips1s lat: %.6f , lon: %.6f , alt: %.2f ", lat1s, lon1s, alt1s);
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f° vV: %3.1f ", vH, vD, vU);
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f vV: %3.1f ", vH, vD, vU);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
}
|
||||
|
@ -1010,7 +1010,7 @@ static int get_GPSkoord(gpx_t *gpx, int N) {
|
|||
fprintf(stdout, "bancroft[%2d] lat: %.6f , lon: %.6f , alt: %.2f ", N, lat, lon, alt);
|
||||
fprintf(stdout, " (d:%.1f)", gpx->diter);
|
||||
if (gpx->gps.opt_vel) {
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f° vV: %3.1f ", vH, vD, vU);
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f vV: %3.1f ", vH, vD, vU);
|
||||
}
|
||||
fprintf(stdout, " DOP[");
|
||||
for (j = 0; j < N; j++) {
|
||||
|
@ -1120,7 +1120,7 @@ static int print_position(gpx_t *gpx, int ec) { // GPS-Hoehe ueber Ellipsoid
|
|||
fprintf(stdout, " (d:%.1f)", gpx->diter);
|
||||
}
|
||||
if (gpx->gps.opt_vel /*&& gpx->gps.opt_vergps >= 2*/) {
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f° vV: %3.1f ", gpx->vH, gpx->vD, gpx->vU);
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f vV: %3.1f ", gpx->vH, gpx->vD, gpx->vU);
|
||||
}
|
||||
if (gpx->option.vbs) {
|
||||
if (gpx->gps.opt_vergps != 2) {
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef struct {
|
|||
double lat; double lon; double alt;
|
||||
double vN; double vE; double vU;
|
||||
double vH; double vD; double vD2;
|
||||
float T;
|
||||
float T; float RH;
|
||||
ui32_t crc;
|
||||
} gpx_t;
|
||||
|
||||
|
@ -354,6 +354,7 @@ float Rf1, // ref-resistor f1 (750 Ohm)
|
|||
calT1[3], // calibration T1
|
||||
co2[3], // { -243.911 , 0.187654 , 8.2e-06 }
|
||||
calT2[3]; // calibration T2-Hum
|
||||
float calH[2]; // calibration Hum
|
||||
|
||||
|
||||
double c = 299.792458e6;
|
||||
|
@ -498,6 +499,9 @@ int get_CalData() {
|
|||
memcpy(calT1+1, calibytes+93, 4); // 0x05*0x10+13
|
||||
memcpy(calT1+2, calibytes+97, 4); // 0x06*0x10+ 1
|
||||
|
||||
memcpy(calH+0, calibytes+117, 4); // 0x07*0x10+ 5
|
||||
memcpy(calH+1, calibytes+121, 4); // 0x07*0x10+ 9
|
||||
|
||||
memcpy(co2+0, calibytes+293, 4); // 0x12*0x10+ 5
|
||||
memcpy(co2+1, calibytes+297, 4); // 0x12*0x10+ 9
|
||||
memcpy(co2+2, calibytes+301, 4); // 0x12*0x10+13
|
||||
|
@ -509,6 +513,7 @@ int get_CalData() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
float get_Tc0(ui32_t f, ui32_t f1, ui32_t f2) {
|
||||
// y = (f - f1) / (f2 - f1);
|
||||
// y1 = (f - f1) / f2; // = (1 - f1/f2)*y
|
||||
|
@ -526,6 +531,21 @@ float get_Tc0(ui32_t f, ui32_t f1, ui32_t f2) {
|
|||
// R/R0 = 1 + at + bt^2 + c(t-100)t^3 , R0 = 1000 Ohm, t/Celsius
|
||||
return t;
|
||||
}
|
||||
*/
|
||||
// T_RH-sensor
|
||||
float get_TH(ui32_t f, ui32_t f1, ui32_t f2) {
|
||||
float *p = co2;
|
||||
float *c = calT2;
|
||||
float g = (float)(f2-f1)/(Rf2-Rf1), // gain
|
||||
Rb = (f1*Rf2-f2*Rf1)/(float)(f2-f1), // ofs
|
||||
Rc = f/g - Rb,
|
||||
//R = (Rc + c[1]) * c[0],
|
||||
//T = p[0] + p[1]*R + p[2]*R*R;
|
||||
R = Rc * c[0],
|
||||
T = (p[0] + p[1]*R + p[2]*R*R + c[1])*(1.0 + c[2]);
|
||||
return T;
|
||||
}
|
||||
// T-sensor, platinum resistor
|
||||
float get_Tc(ui32_t f, ui32_t f1, ui32_t f2) {
|
||||
float *p = co1;
|
||||
float *c = calT1;
|
||||
|
@ -539,13 +559,32 @@ float get_Tc(ui32_t f, ui32_t f1, ui32_t f2) {
|
|||
return T;
|
||||
}
|
||||
|
||||
// rel.hum., capacitor
|
||||
// (data:) ftp://ftp-cdc.dwd.de/pub/CDC/observations_germany/radiosondes/
|
||||
// (diffAlt: Ellipsoid-Geoid)
|
||||
float get_RH(ui32_t f, ui32_t f1, ui32_t f2, float T) {
|
||||
float b0 = calH[0]/46.64; // empirical
|
||||
float b1 = 0.1276; // empirical
|
||||
float fh = (f-f1)/(float)(f2-f1);
|
||||
float rh = 100.0 * (fh-b0)/b1;
|
||||
float T0 = 0.0, T1 = -30.0; // T/C
|
||||
if (T < T0) rh += T0 - T/5.5; // empir. temperature compensation
|
||||
if (T < T1) rh *= 1.0 + (T1-T)/75.0; // empir. temperature compensation
|
||||
if (rh < 0.0) rh = 0.0;
|
||||
if (rh > 100.0) rh = 100.0;
|
||||
if (T < -273.0) rh = -1.0;
|
||||
return rh;
|
||||
}
|
||||
|
||||
int get_PTU() {
|
||||
int err=0, i;
|
||||
int bR, bc1, bT1,
|
||||
bc2, bT2;
|
||||
int bH;
|
||||
ui32_t meas[12];
|
||||
float Tc = -273.15;
|
||||
float Tc0 = -273.15;
|
||||
float TH = -273.15;
|
||||
float RH = -1.0;
|
||||
|
||||
get_CalData();
|
||||
|
||||
|
@ -564,14 +603,25 @@ int get_PTU() {
|
|||
bT1 = calfrchk[0x05] && calfrchk[0x06];
|
||||
bc2 = calfrchk[0x12] && calfrchk[0x13];
|
||||
bT2 = calfrchk[0x13];
|
||||
bH = calfrchk[0x07];
|
||||
|
||||
if (bR && bc1 && bT1) {
|
||||
Tc = get_Tc(meas[0], meas[1], meas[2]);
|
||||
Tc0 = get_Tc0(meas[0], meas[1], meas[2]);
|
||||
//Tc0 = get_Tc0(meas[0], meas[1], meas[2]);
|
||||
}
|
||||
gpx.T = Tc;
|
||||
|
||||
if (option_verbose == 4)
|
||||
if (bR && bc2 && bT2) {
|
||||
TH = get_TH(meas[6], meas[7], meas[8]);
|
||||
}
|
||||
|
||||
if (bH) {
|
||||
RH = get_RH(meas[3], meas[4], meas[5], Tc); // TH, TH-Tc (sensorT - T)
|
||||
}
|
||||
gpx.RH = RH;
|
||||
|
||||
|
||||
if (option_verbose == 4 && (gpx.crc & (crc_PTU | crc_GPS3))==0)
|
||||
{
|
||||
printf(" h: %8.2f # ", gpx.alt); // crc_GPS3 ?
|
||||
|
||||
|
@ -581,17 +631,25 @@ int get_PTU() {
|
|||
printf(" # ");
|
||||
printf("3: %8d %8d %8d", meas[6], meas[7], meas[8]);
|
||||
printf(" # ");
|
||||
if (Tc > -273.0) {
|
||||
printf(" T: %8.4f , T0: %8.4f ", Tc, Tc0);
|
||||
|
||||
//if (Tc > -273.0 && RH > -0.5)
|
||||
{
|
||||
printf(" ");
|
||||
printf(" Tc:%.2f ", Tc);
|
||||
printf(" RH:%.1f ", RH);
|
||||
printf(" TH:%.2f ", TH);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (gpx.alt > -100.0) {
|
||||
//if (gpx.alt > -400.0)
|
||||
{
|
||||
printf(" %9.2f ; %6.1f ; %6.1f ", gpx.alt, Rf1, Rf2);
|
||||
printf("; %10.6f ; %10.6f ; %10.6f ;", calT1[0], calT1[1], calT1[2]);
|
||||
printf(" %8d ; %8d ; %8d ", meas[0], meas[1], meas[2]);
|
||||
printf("; %10.6f ; %10.6f ; %10.6f ;", calT2[0], calT2[1], calT2[2]);
|
||||
printf(" %8d ; %8d ; %8d" , meas[6], meas[7], meas[8]);
|
||||
printf("; %10.6f ; %10.6f ; %10.6f ", calT1[0], calT1[1], calT1[2]);
|
||||
//printf("; %8d ; %8d ; %8d ", meas[0], meas[1], meas[2]);
|
||||
printf("; %10.6f ; %10.6f ", calH[0], calH[1]);
|
||||
//printf("; %8d ; %8d ; %8d" , meas[3], meas[4], meas[5]);
|
||||
printf("; %10.6f ; %10.6f ; %10.6f ", calT2[0], calT2[1], calT2[2]);
|
||||
//printf("; %8d ; %8d ; %8d" , meas[6], meas[7], meas[8]);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
@ -1060,12 +1118,14 @@ int print_position(int ec) {
|
|||
//if (option_verbose)
|
||||
{
|
||||
//fprintf(stdout, " (%.1f %.1f %.1f) ", gpx.vN, gpx.vE, gpx.vU);
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f° vV: %3.1f ", gpx.vH, gpx.vD, gpx.vU);
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f vV: %3.1f ", gpx.vH, gpx.vD, gpx.vU);
|
||||
if (option_verbose == 3) fprintf(stdout," numSV: %02d ", gpx.numSV);
|
||||
}
|
||||
}
|
||||
if (option_ptu && !err0) {
|
||||
printf(" ");
|
||||
if (gpx.T > -273.0) printf(" T=%.1fC ", gpx.T);
|
||||
if (gpx.RH > -0.5) printf(" RH=%.0f%% ", gpx.RH);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -920,7 +920,7 @@ int get_GPSkoord(int N) {
|
|||
fprintf(stdout, "lat: %.5f , lon: %.5f , alt: %.1f ", lat, lon, alt);
|
||||
fprintf(stdout, " (d:%.1f)", diter);
|
||||
if ( option_vel == 4 ) {
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f° vV: %3.1f ", vH, vD, vU);
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f vV: %3.1f ", vH, vD, vU);
|
||||
}
|
||||
fprintf(stdout, " sats: ");
|
||||
fprintf(stdout, "%02d %02d %02d %02d ", prn[i0], prn[i1], prn[i2], prn[i3]);
|
||||
|
@ -1030,7 +1030,7 @@ int get_GPSkoord(int N) {
|
|||
ecef2elli(pos1s_ecef[0], pos1s_ecef[1], pos1s_ecef[2], &lat1s, &lon1s, &alt1s);
|
||||
if (option_vergps == 8) {
|
||||
fprintf(stdout, "\ndeltachips1s lat: %.6f , lon: %.6f , alt: %.2f ", lat1s, lon1s, alt1s);
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f° vV: %3.1f ", vH, vD, vU);
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f vV: %3.1f ", vH, vD, vU);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
}
|
||||
|
@ -1054,7 +1054,7 @@ int get_GPSkoord(int N) {
|
|||
fprintf(stdout, "bancroft[%2d] lat: %.6f , lon: %.6f , alt: %.2f ", N, lat, lon, alt);
|
||||
fprintf(stdout, " (d:%.1f)", gpx.diter);
|
||||
if (option_vel) {
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f° vV: %3.1f ", vH, vD, vU);
|
||||
fprintf(stdout, " vH: %4.1f D: %5.1f vV: %3.1f ", vH, vD, vU);
|
||||
}
|
||||
fprintf(stdout, " DOP[");
|
||||
for (j = 0; j < N; j++) {
|
||||
|
@ -1156,7 +1156,7 @@ int print_position(int ec) { // GPS-Hoehe ueber Ellipsoid
|
|||
fprintf(stdout, " (d:%.1f)", gpx.diter);
|
||||
}
|
||||
if (option_vel /*&& option_vergps >= 2*/) {
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f° vV: %3.1f ", gpx.vH, gpx.vD, gpx.vU);
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f vV: %3.1f ", gpx.vH, gpx.vD, gpx.vU);
|
||||
}
|
||||
if (option_verbose) {
|
||||
if (option_vergps != 2) {
|
||||
|
|
|
@ -983,7 +983,7 @@ float get_TLC555freq(float count) {
|
|||
float get_C_RH(float freq, float T) { // TLC555 astable: R_A=3.65k, R_B=338k
|
||||
float R_B = 338e3;
|
||||
float R_A = 3.65e3;
|
||||
float td = 1e-6;
|
||||
float td = 0;
|
||||
float C_RH = (1/freq - 2*td) / (LN2 * (R_A + 2*R_B));
|
||||
// freq/T compensation ...
|
||||
return C_RH;
|
||||
|
@ -1054,7 +1054,7 @@ int print_pos(int csOK) {
|
|||
err |= get_GPSvel();
|
||||
if (!err) {
|
||||
//if (option_verbose == 2) fprintf(stdout, " "col_GPSvel"(%.1f , %.1f : %.1f)"col_TXT" ", datum.vx, datum.vy, datum.vD2);
|
||||
fprintf(stdout, " vH: "col_GPSvel"%.1f"col_TXT" D: "col_GPSvel"%.1f"col_TXT"° vV: "col_GPSvel"%.1f"col_TXT" ", datum.vH, datum.vD, datum.vV);
|
||||
fprintf(stdout, " vH: "col_GPSvel"%.1f"col_TXT" D: "col_GPSvel"%.1f"col_TXT" vV: "col_GPSvel"%.1f"col_TXT" ", datum.vH, datum.vD, datum.vV);
|
||||
}
|
||||
if (option_verbose >= 2) {
|
||||
get_SN();
|
||||
|
@ -1092,8 +1092,8 @@ int print_pos(int csOK) {
|
|||
if (option_verbose) {
|
||||
err |= get_GPSvel();
|
||||
if (!err) {
|
||||
//if (option_verbose == 2) fprintf(stdout, " (%.1f , %.1f : %.1f°) ", datum.vx, datum.vy, datum.vD2);
|
||||
fprintf(stdout, " vH: %.1f D: %.1f° vV: %.1f ", datum.vH, datum.vD, datum.vV);
|
||||
//if (option_verbose == 2) fprintf(stdout, " (%.1f , %.1f : %.1f) ", datum.vx, datum.vy, datum.vD2);
|
||||
fprintf(stdout, " vH: %.1f D: %.1f vV: %.1f ", datum.vH, datum.vD, datum.vV);
|
||||
}
|
||||
if (option_verbose >= 2) {
|
||||
get_SN();
|
||||
|
|
|
@ -585,7 +585,7 @@ float Rf1, // ref-resistor f1 (750 Ohm)
|
|||
calT1[3], // calibration T1
|
||||
co2[3], // { -243.911 , 0.187654 , 8.2e-06 }
|
||||
calT2[3]; // calibration T2-Hum
|
||||
float calH[2]; // calibration Hum ?
|
||||
float calH[2]; // calibration Hum
|
||||
|
||||
|
||||
double c = 299.792458e6;
|
||||
|
@ -803,6 +803,7 @@ float get_RH(ui32_t f, ui32_t f1, ui32_t f2, float T) {
|
|||
if (T < T1) rh *= 1.0 + (T1-T)/75.0; // empir. temperature compensation
|
||||
if (rh < 0.0) rh = 0.0;
|
||||
if (rh > 100.0) rh = 100.0;
|
||||
if (T < -273.0) rh = -1.0;
|
||||
return rh;
|
||||
}
|
||||
|
||||
|
@ -1348,14 +1349,14 @@ int print_position(int ec) {
|
|||
//if (option_verbose)
|
||||
{
|
||||
//fprintf(stdout, " (%.1f %.1f %.1f) ", gpx.vN, gpx.vE, gpx.vU);
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f° vV: %3.1f ", gpx.vH, gpx.vD, gpx.vU);
|
||||
fprintf(stdout," vH: %4.1f D: %5.1f vV: %3.1f ", gpx.vH, gpx.vD, gpx.vU);
|
||||
if (option_verbose == 3) fprintf(stdout," sats: %02d ", gpx.numSV);
|
||||
}
|
||||
}
|
||||
if (option_ptu && !err0) {
|
||||
printf(" ");
|
||||
if (gpx.T > -273.0) printf(" T=%.1fC ", gpx.T);
|
||||
if (gpx.RH > -0.5) printf(" RH=%.1f%% ", gpx.RH);
|
||||
if (gpx.RH > -0.5) printf(" RH=%.0f%% ", gpx.RH);
|
||||
}
|
||||
|
||||
if (option_crc) {
|
||||
|
|
Ładowanie…
Reference in New Issue