diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1992e5c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "unistd.h": "c" + } +} \ No newline at end of file diff --git a/cal_mod.h b/cal_mod.h index aaa13d8..32900d1 100644 --- a/cal_mod.h +++ b/cal_mod.h @@ -129,7 +129,8 @@ pobs_head obs_h, pstation station, ppos_t pos_t, pblh blh, penu enu, prah rah, int o_epochnum, int gps_satnum) - { + { int progress = 0; + int count = 0; for (int i = 0; i < o_epochnum; i++)//第i个历元 { result_file = fopen(".\\Pos_out\\LLA_result_for_read.txt", "a+"); @@ -250,8 +251,26 @@ result_file = fopen(".\\Observation_Station_Site-Solving_by_Matlab\\LLA_result_for_Matlab.txt", "a+"); fprintf(result_file, "\n"); fclose(result_file); + + /* -------------------------------------------------------------------------- */ + //const char * progressstr = "[----------------------------------------------------]100%%"; + + int progress_now = (int)(((i+1)*100/2880)); + if ((progress_now - progress)>=2) + { + printf("-"); + count++; + progress = progress_now; + printf("-]%3d%%", progress); + for(int countb = 0; countb < (5); countb++) + { + printf("\b"); + } + } + + /* -------------------------------------------------------------------------- */ } - + result_file = fopen(".\\Observation_Station_Site-Solving_by_Matlab\\LLA_result_for_Matlab.txt", "a+"); fprintf(result_file, "\nEND"); fclose(result_file); diff --git a/main.c b/main.c index 9740c05..ff3e66a 100644 --- a/main.c +++ b/main.c @@ -4,6 +4,7 @@ #include #include #include +#include #include"read.h" #include"cal_mod.h" @@ -36,36 +37,37 @@ while(over == 0) char obs_flie[20]; 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("|**************SPP-pseudorange-positioning*****************************************|\n"); + printf("**@Author: KenanZhu\n**@Date: 2024/09/21\n**@Make by: C & Python & Matlab\n"); + printf("**@INTRO: \n**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("**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"); + printf("|>>> 请选择您的语言:/Please choose your language <<<|\n--------------------\n[1 | ENG][0 | 中文]\n--------------------\n"); scanf("%d",&langop); + if (langop == 0) - { printf("本程序只支持 ver3.04 RINEX文件的读取\n"); - printf("请输入观测数据文件的文件名(包含拓展名):\n"); + { printf("|>>> 本程序只支持 ver3.04 RINEX文件的读取 <<<|\n\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"); + { printf("|>>> This program only supports reading ver3.04 RINEX files <<<|\n\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;} + {printf("|>> 观测文件%s读取失败,请检查文件名或者确认文件是否被移动\n", obs_flie);} else if (langop == 0 && fp_obs != NULL) - {printf("观测文件%s读取成功,正在处理数据\n", obs_flie);} + {printf("|>> 观测文件%s读取成功,正在处理数据...\n\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;} + {printf("|>> Observation file %s failed to be read. Please check the file name or confirm whether the file has been moved\n\n", obs_flie);} else if (langop == 1 && fp_obs != NULL) - {printf("The observation file %s has been read successfully and data is being processed\n", obs_flie);} + {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); @@ -80,26 +82,26 @@ while(over == 0) fclose(fp_obs);//关闭O文件 if (langop == 0 && fp_obs != NULL) - { printf("观测文件读取完成!\n"); - printf("请输入导航文件的文件名(包含拓展名):\n"); + { printf("|>>> 观测文件读取完成! <<<|\n\n\n"); + printf("|>> 请输入导航文件的文件名(包含拓展名):\n"); scanf("%s", &nav_file);} if (langop == 1 && fp_obs != NULL) - { 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"); + { printf("|>>> Observation file read complete! <<<|\n\n\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 == 0 && fp_obs != NULL && fp_nav == NULL) + {printf("|>> 导航文件%s读取失败,请检查文件名或者确认文件是否被移动\n", nav_file);} + else if (langop == 0 && fp_obs != NULL && fp_nav != NULL) + {printf("|>> 观测文件%s读取成功,正在处理数据...\n\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);} + if (langop == 1 && fp_obs != NULL && 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);} + else if (langop == 1 && fp_obs != NULL && fp_nav != NULL) + {printf("|>> The Navigation file %s has been read successfully and data is being processed...\n\n", nav_file);} int gps_satnum = getgpssatnum(fp_nav);//获取导航文件GPS卫星数据块数 rewind(fp_nav);//将文件指针返回值起始位置 @@ -112,10 +114,10 @@ while(over == 0) } 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 (langop == 0 && fp_obs != NULL && fp_nav != NULL) + {printf("|>>> 导航文件读取完成! <<<|\n\n");printf("|>> 正在计算数据:[-");} + if (langop == 1 && fp_obs != NULL && fp_nav != NULL) + {printf("|>>> Navigation file read complete! <<<|\n\n");printf("|>> Calculating data:[-");} /* -------------------------------------------------------------------------- */ if (fp_obs != NULL && fp_nav != NULL) @@ -123,16 +125,16 @@ while(over == 0) 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); } /* -------------------------------------------------------------------------- */ - if (langop == 0) + if (langop == 0 && fp_nav != NULL && fp_obs != NULL) { if (over == 1) - {printf("数据生成完毕!");} + {printf("\n数据生成完毕!");} if (over != 1) - {printf("数据处理发生错误!");break;}} - if (langop == 1) + {printf("\n数据处理发生错误!");}} + if (langop == 1 && fp_nav != NULL && fp_obs != NULL) { if (over == 1) - {printf("Data generation completed!");} + {printf("\nData generation completed!");} if (over != 1) - {printf("Data processing error!");break;}} + {printf("\nData processing error!");}} } return 0; } \ No newline at end of file