Major update: Improve the function and operation logic of software input and output

This commit is contained in:
KenanZhu111 committed 2024-09-21 16:07:58 +08:00
1 parent c44c1df50f
commit 2ca57dcb64
4 files changed
+114 -35

No files matched your search

+2
View File
@@ -243,6 +243,8 @@
result_file = fopen(".\\Observation_Station_Site-Solving_by_Matlab\\LLA_result_for_Matlab.txt", "a+"); result_file = fopen(".\\Observation_Station_Site-Solving_by_Matlab\\LLA_result_for_Matlab.txt", "a+");
fprintf(result_file, "\nEND"); fprintf(result_file, "\nEND");
fclose(result_file); fclose(result_file);
return 1;
} }
#endif #endif
+112 -34
View File
@@ -27,41 +27,119 @@ int main(void)
pobs_epoch obs_e = NULL; pobs_epoch obs_e = NULL;
pobs_body obs_b = NULL;//创建结构体指针,并将其初始化为空 pobs_body obs_b = NULL;//创建结构体指针,并将其初始化为空
//O文件读取 int over = 0;
fp_obs = fopen("alic0600.22o", "r");//以只读的方式打开O文件
int o_epochnum = get_epochnum(fp_obs);//O文件历元数 /* -------------------------------------------------------------------------- */
rewind(fp_obs); while(over == 0)
obs_h = (pobs_head)malloc(sizeof(obs_head));//给O文件头开辟空间 {
obs_e = (pobs_epoch)malloc(sizeof(obs_epoch) * o_epochnum); int langop;
obs_b = (pobs_body)malloc(sizeof(obs_body) * o_epochnum); char obs_flie[20];
if (obs_h && obs_e && obs_b) char nav_file[20];
printf("**************SPP-pseudorange-positioning**************\n");
printf("**@Author: KenanZhu\n**@Date: 2024/09/21\n**@Make by: C\n");
printf("**@INTRO: The main functions of the software include:\n");
printf("**read RINEX3.04 files, and output three formats of document files,\n");
printf("**please cooperate with the corresponding tools for processing.\n");
printf("**Specific please see:\n https://github.com/KenanZhu111/SPP_-pseudorange-positioning\n");
printf("*******************************************************\n\n");
printf("请选择您的语言:/Please choose your language\n(1)ENG/(0)中文\n");
scanf("%d",&langop);
if (langop == 0)
{ printf("本程序只支持 ver3.04 RINEX文件的读取\n");
printf("请输入观测数据文件的文件名(包含拓展名):\n");
scanf("%s", &obs_flie);}
if (langop == 1)
{ printf("This program only supports reading ver3.04 RINEX files\n");
printf("Please enter the file name (including the extension) of the observation data file.:\n");
scanf("%s", &obs_flie);}
/* -------------------------------------------------------------------------- */
//O文件读取
fp_obs = fopen(obs_flie, "r");
if (langop == 0 && fp_obs == NULL)
{printf("观测文件%s读取失败,请检查文件名或者确认文件是否被移动\n", obs_flie);break;}
else if (langop == 0 && fp_obs != NULL)
{printf("观测文件%s读取成功,正在处理数据\n", obs_flie);}
if (langop == 1 && fp_obs == NULL)
{printf("Observation file %s failed to be read. Please check the file name or confirm whether the file has been moved\n", obs_flie);break;}
else if (langop == 1 && fp_obs != NULL)
{printf("The observation file %s has been read successfully and data is being processed\n", obs_flie);}
int o_epochnum = get_epochnum(fp_obs);//O文件历元数
rewind(fp_obs);
obs_h = (pobs_head)malloc(sizeof(obs_head));//给O文件头开辟空间
obs_e = (pobs_epoch)malloc(sizeof(obs_epoch) * o_epochnum);
obs_b = (pobs_body)malloc(sizeof(obs_body) * o_epochnum);
if (obs_h && obs_e && obs_b)
{
read_o_h(fp_obs, obs_h);//读取O文件头
read_o_b(fp_obs, obs_e, obs_b, obs_h->obstypenum_gps, obs_h->obstypenum_bds);//读取O数据块
}
fclose(fp_obs);//关闭O文件
if (langop == 0)
{ printf("观测文件读取完成!\n");
printf("请输入导航文件的文件名(包含拓展名):\n");
scanf("%s", &nav_file);}
if (langop == 1)
{ printf("This program only supports reading ver3.04 RINEX files\n");
printf("Please enter the file name (including the extension) of the Navigation data file.:\n");
scanf("%s", &nav_file);}
/* -------------------------------------------------------------------------- */
//N文件读取
fp_nav = fopen(nav_file, "r");
fp_obs = fopen(obs_flie, "r");
if (langop == 0 && fp_nav == NULL)
{printf("导航文件%s读取失败,请检查文件名或者确认文件是否被移动\n", nav_file);break;}
else if (langop == 0 && fp_nav != NULL)
{printf("观测文件%s读取成功,正在处理数据\n", nav_file);}
if (langop == 1 && fp_nav == NULL)
{printf("Navigation file %s failed to be read. Please check the file name or confirm whether the file has been moved\n", nav_file);break;}
else if (langop == 1 && fp_nav != NULL)
{printf("The Navigation file %s has been read successfully and data is being processed\n", nav_file);}
int gps_satnum = getgpssatnum(fp_nav);//获取导航文件GPS卫星数据块数
rewind(fp_nav);//将文件指针返回值起始位置
nav_h = (pnav_head)malloc(sizeof(nav_head));//给N文件头开辟空间
nav_b = (pnav_body)malloc(sizeof(nav_body) * gps_satnum * 20);
if (nav_h && nav_b)
{
read_n_h(fp_nav, nav_h);//读取N头文件
read_n_b(fp_nav, nav_b);//读取N数据块
}
fclose(fp_nav);//关闭N文件
if (langop == 0)
{printf("导航文件读取完成!\n");printf("正在计算数据>\n");}
if (langop == 1)
{printf("Navigation file read complete!\n");printf("Calculating data>\n");}
/* -------------------------------------------------------------------------- */
if (fp_obs != NULL && fp_nav != NULL)
{ {
read_o_h(fp_obs, obs_h);//读取O文件头 blh = (pblh)malloc(sizeof(pblh) * o_epochnum *256);
read_o_b(fp_obs, obs_e, obs_b, obs_h->obstypenum_gps, obs_h->obstypenum_bds);//读取O数据块 enu = (penu)malloc(sizeof(penu) * o_epochnum *256);
rah = (prah)malloc(sizeof(prah) * o_epochnum *256);
pos_t = (ppos_t)malloc(sizeof(ppos_t) * o_epochnum * 256);
station = (pstation)malloc(sizeof(pstation) * o_epochnum * 256);
over = sat_gps_pos_clac(result_file, nav_b, obs_e, obs_b, obs_h, station, pos_t, blh, enu, rah, o_epochnum, gps_satnum);
} }
fclose(fp_obs);//关闭O文件 /* -------------------------------------------------------------------------- */
if (langop == 0)
//N文件读取 { if (over == 1)
fp_nav = fopen("brdm0600.22p", "r");//以只读的方式打开N文件 {printf("数据生成完毕!");}
int gps_satnum = getgpssatnum(fp_nav);//获取导航文件GPS卫星数据块数 if (over != 1)
rewind(fp_nav);//将文件指针返回值起始位置 {printf("数据处理发生错误!");break;}}
nav_h = (pnav_head)malloc(sizeof(nav_head));//给N文件头开辟空间 if (langop == 1)
nav_b = (pnav_body)malloc(sizeof(nav_body) * gps_satnum * 20); { if (over == 1)
if (nav_h && nav_b) {printf("Data generation completed!");}
{ if (over != 1)
read_n_h(fp_nav, nav_h);//读取N头文件 {printf("Data processing error!");break;}}
read_n_b(fp_nav, nav_b);//读取N数据块 }
}
fclose(fp_nav);//关闭N文件
blh = (pblh)malloc(sizeof(pblh) * o_epochnum *256);
enu = (penu)malloc(sizeof(penu) * o_epochnum *256);
rah = (prah)malloc(sizeof(prah) * o_epochnum *256);
pos_t = (ppos_t)malloc(sizeof(ppos_t) * o_epochnum * 256);
station = (pstation)malloc(sizeof(pstation) * o_epochnum * 256);
sat_gps_pos_clac(result_file, nav_b, obs_e, obs_b, obs_h, station, pos_t, blh, enu, rah, o_epochnum, gps_satnum);
return 0; return 0;
} }
BIN
View File
Binary file not shown.
-1
View File
@@ -2,7 +2,6 @@
#define _RAHCAL_H_ #define _RAHCAL_H_
#define PI 3.141592653589793 #define PI 3.141592653589793
#include<stdlib.h> #include<stdlib.h>
#include<math.h> #include<math.h>