Archived
Update: 2024/10/28
1. KNZ_GeoTrackLab: Fix some bug. 2. KNZ_GeoTrackLab: Optimize code structure.
This commit is contained in:
1 parent
f895b31a8e
commit
8d22576a73
2 files changed
+8
-13
No files matched your search
+1
-8
@@ -218,12 +218,6 @@ static double strtonum(const char* buff, int i, int n)
|
||||
*p = '\0';
|
||||
return sscanf(str, "%lf", &value) == 1 ? value : 0.0;
|
||||
}
|
||||
/*Allocate the memory of observation structure*/
|
||||
void initobs_e(pobs_epoch obs_e, pobs_body obs_b)
|
||||
{
|
||||
obs_e = (pobs_epoch)malloc(sizeof(obs_epoch));
|
||||
obs_b = (pobs_body)malloc(sizeof(obs_body));
|
||||
}
|
||||
/*Free the memory of observation structure*/
|
||||
void freeobs_e(pobs_epoch obs_e, pobs_body obs_b)
|
||||
{
|
||||
@@ -664,7 +658,7 @@ void read_o_h(FILE* fp_obs, pobs_head obs_h)
|
||||
obs_h->obstypenum_gps = (int)strtonum(buff, 4, 2);
|
||||
if (obs_h->obstypenum_gps <= 13) {
|
||||
for (i = 0; i < obs_h->obstypenum_gps; i++) {
|
||||
obs_h->obscode_gps[i + 1] = Type2Code(i, buff);
|
||||
obs_h->obscode_gps[i] = Type2Code(i, buff);
|
||||
}
|
||||
}
|
||||
else if (obs_h->obstypenum_gps > 13) {
|
||||
@@ -760,7 +754,6 @@ void read_o_h(FILE* fp_obs, pobs_head obs_h)
|
||||
/*Read the body data of file of obs*/
|
||||
void read_o_eb(FILE* fp_obs, pobs_head obs_h, pobs_epoch obs_e, pobs_body obs_b)
|
||||
{
|
||||
initobs_e(obs_e, obs_b);
|
||||
char buff[MAXRINEX] = { 0 };
|
||||
char flag = { 0 };
|
||||
while (fgets(buff, MAXRINEX, fp_obs)) {
|
||||
|
||||
+7
-5
@@ -368,9 +368,7 @@ double brdm2pos(char nav_path[260], char obs_path[260], char res_path[260], int
|
||||
|
||||
rewind(fp_obs);
|
||||
obs_h = (pobs_head)malloc(sizeof(obs_head));
|
||||
obs_e = (pobs_epoch)malloc(sizeof(obs_epoch));
|
||||
obs_b = (pobs_body)malloc(sizeof(obs_body));
|
||||
if (obs_h && obs_e && obs_b) {
|
||||
if (obs_h) {
|
||||
read_o_h(fp_obs, obs_h);
|
||||
|
||||
tem2 = XYZ2BLH(tem2, obs_h->apX, obs_h->apY, obs_h->apZ);
|
||||
@@ -396,14 +394,18 @@ double brdm2pos(char nav_path[260], char obs_path[260], char res_path[260], int
|
||||
|
||||
//Begin to calculate
|
||||
for (int i = 0; i < epochunum; i++) {
|
||||
//Allocate memory for obs epoch and body data
|
||||
obs_e = (pobs_epoch)malloc(sizeof(obs_epoch));
|
||||
obs_b = (pobs_body)malloc(sizeof(obs_body));
|
||||
|
||||
read_o_eb(fp_obs, obs_h, obs_e, obs_b);
|
||||
result += sat_pos_cal(obs_h, obs_e, obs_b, nav_b,
|
||||
result_file, station,
|
||||
gnsscode, satnum);
|
||||
fprintf(result_file, "\n");
|
||||
}
|
||||
|
||||
fprintf(result_file, "\n");
|
||||
freeobs_e(obs_e, obs_b);
|
||||
}
|
||||
free(obs_h); free(nav_h); free(nav_b);
|
||||
fprintf(result_file, "\nEND"); fclose(result_file);
|
||||
if (epochunum == result) return 0;
|
||||
|
||||
Reference in new issue
Block a user