Rename the Project:

1.Update KNZ_Plot
2.Update mpre GUI parts
This commit is contained in:
KenanZhu111 committed 2024-10-08 21:03:30 +08:00
1 parent d5a7fd37ce
commit c6d0e5bb48
11 files changed
+108 -136

No files matched your search

+30 -76
View File
@@ -16,60 +16,25 @@
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
//FILE SELECT DIALOGS
#define FILEEXOP TEXT("RINEX OBS(*.o*.*.*obs.*.*d)\0*.*o;*.*obs;*.*d\0"\
"All Files(*.*)\0*.*\0\0");
#define FILEEXNP TEXT("RINEX NAV(*.*nav.*.hnav.*.gnav.*.qnav.*.*n.*.*g.*.*h.*.*q.*.*p)\0*.*nav;*.hnav;*.gnav;*.qnav;*.*n;*.*g;*.*h;*.*q;*.*p\0"\
"All Files(*.*)\0*.*\0\0")
#define FILEEXSV TEXT("Spos Files(*.sp*)\0*.sp\0"\
"All Files(*.*)\0*.*\0\0");
//DEF MAIN WINDOW BUTTONS
#define OBSBUTTON 3301
#define NAVBUTTON 3302
#define CALBUTTON 3303
#define OPTBUTTON 3304
#define PLOBUTTON 3305
#define OBSCLEAR 3306
#define OBSRELOD 3307
#define NAVCLEAR 3308
#define NAVRELOD 3309
#define PROGRESS 3310
//DEF MAIN WINDOW GNSS NUTTONS
#define GPSCHECK 5500
#define GLOCHECK 5501
#define BEICHECK 5502
#define GALCHECK 5503
#define SBACHECK 5504
#define SYSGROUP 1001
//DEF OPTIONS WINDOW CHECK+BOXS
#define OPTDFION 7001
#define OPTDFTRO 7002
#define OPTCONFI 7003
HWND hwndb[15];//BUTTON HANDLE
HWND hwndopt;//OPTIONS HANDLE
HWND hwndopt_def_ion;//DEFAULT ION COR
HWND hwndopt_def_tro;//DEFAULT TRO COR
HWND hwndopt_confirm;//OPTION CONFIRM
FILE* fp_nav = NULL;
FILE* fp_obs = NULL;
FILE* result_file = NULL;
FILE * fp_nav = NULL;
FILE * fp_obs = NULL;
FILE * result_file = NULL;
pnav_head nav_h = NULL;
pnav_body nav_b = NULL;
pobs_head obs_h = NULL;
pobs_epoch obs_e = NULL;
pobs_body obs_b = NULL;
pnav_head nav_h = NULL;
pnav_body nav_b = NULL;
pobs_head obs_h = NULL;
pobs_epoch obs_e = NULL;
pobs_body obs_b = NULL;
/*INITIAL CONST*/
int o_epochnum = 0;
int gps_satnum = 0;
int bds_satnum = 0;
int satnum = 0;
/*INITIAL SETTINGS*/
static int ionoption = 0;
@@ -81,20 +46,20 @@ char nav_f[MAX_PATH] = { 0 };
char path[MAX_PATH];
const wchar_t wpath[MAX_PATH];//PROGRAM'S FOLDER
static void ProgressBar(HWND hwnd, int msec)
static void ProgressBar(HWND hwnd, int BEG, int DES)
{
PBRANGE range;
SendMessage(hwnd, PBM_SETRANGE, (WPARAM)FALSE, (LPARAM)(MAKELPARAM(0, 100)));
SendMessage(hwnd, PBM_GETRANGE, (WPARAM)TRUE, (LPARAM)&range);
SendMessage(hwnd, PBM_SETPOS, (WPARAM)range.iLow, (LPARAM)0);
while (TRUE) {
SendMessage(hwnd, PBM_DELTAPOS, (WPARAM)((range.iHigh - range.iLow) / 100), (LPARAM)0); Sleep(msec);
if (SendMessage(hwnd, PBM_GETPOS, (WPARAM)0, (LPARAM)0) == range.iHigh)
SendMessage(hwnd, PBM_SETPOS, (WPARAM)BEG, (LPARAM)0);
for (int i = BEG; i < DES; i++) {
SendMessage(hwnd, PBM_SETPOS, (WPARAM)(int)( i / 10), (LPARAM)0);
if (SendMessage(hwnd, PBM_GETPOS, (WPARAM)0, (LPARAM)0) == range.iHigh * DES/PBSTATEFULL)
{
break;
}
}
SendMessage(hwnd, PBM_SETPOS, (WPARAM)range.iHigh, (LPARAM)0);
SendMessage(hwnd, PBM_SETPOS, (WPARAM)DES, (LPARAM)0);
}
static int FileSelobsDialog(const wchar_t* path)//FILEDIALOG FOR OBS
@@ -149,16 +114,16 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2));
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = TEXT("SPP");
wndclass.lpszClassName = TEXT("CAL");
RegisterClass(&wndclass);
wndclass.lpfnWndProc = OptWndProc;
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON3));
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2));
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = TEXT("OPT");
@@ -167,8 +132,8 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
HWND hwnd;
hwnd = CreateWindow(
TEXT("SPP"),
TEXT("SPP Calculate"),
TEXT("CAL"),
TEXT("KNZ_Calculate"),
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
0,
0,
@@ -203,7 +168,7 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
{
SendMessage(hwndb[i], WM_SETFONT, (WPARAM)hbFont, 1);
}
Delico = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
Delico = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON3));
Relico = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON4));
SendMessage(hwndb[11], BM_SETIMAGE, IMAGE_ICON, (LPARAM)Delico);
SendMessage(hwndb[12], BM_SETIMAGE, IMAGE_ICON, (LPARAM)Relico);
@@ -240,7 +205,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
case WM_CREATE:
{
getcwd(path, sizeof(path));//GET THE PROGRAM'S FOLDER
const char plot[] = "SPP_plot.exe";
const char plot[] = "KNZ_Plot.exe";
sprintf(path, "%s\\%s", path, plot);
cxchar = LOWORD(GetDialogBaseUnits());
@@ -338,16 +303,12 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
if (obs_h && obs_e && obs_b)
{
read_o_h(fp_obs, obs_h);
ProgressBar(hwndPB, PBSTATENONE, PBSTATEHALF);
read_o_b(fp_obs, obs_e, obs_b, obs_h->obstypenum_gps, obs_h->obstypenum_bds);
}
fclose(fp_obs);
ProgressBar(hwndPB, 5);
if (o_epochnum > 0)
{
MessageBox(hwnd, TEXT("File of Obs load complete!"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
}
ProgressBar(hwndPB, PBSTATEHALF, PBSTATEFULL);
}
}
else
@@ -366,25 +327,18 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
if (fp_nav != NULL)
{
strcpy(nav_f, nav_file);
gps_satnum = getgpssatnum(fp_nav);
rewind(fp_nav);
bds_satnum = getbdssatnum(fp_nav);
satnum = getsatnum(fp_nav);
rewind(fp_nav);
nav_h = (pnav_head)malloc(sizeof(nav_head));
nav_b = (pnav_body)malloc(sizeof(nav_body) * (gps_satnum + bds_satnum));
nav_b = (pnav_body)malloc(sizeof(nav_body) * (satnum));
if (nav_h && nav_b)
{
read_n_h(fp_nav, nav_h);
ProgressBar(hwndPB, PBSTATENONE, PBSTATEHALF);
read_n_b(fp_nav, nav_b);
}
fclose(fp_nav);
ProgressBar(hwndPB, 1);
if (gps_satnum > 0)
{
MessageBox(hwnd, TEXT("File of Nav load complete !"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
}
ProgressBar(hwndPB, PBSTATEHALF, PBSTATEFULL);
}
}
else
@@ -435,7 +389,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
case NAVRELOD:
if (fp_nav != NULL)
{
if (gps_satnum > 0)
if (satnum > 100)
{
MessageBox(hwnd, TEXT("File of Nav Reload complete !"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
break;
@@ -487,7 +441,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
sat_gps_pos_clac(result_file, hwndPB,
nav_b, obs_e, obs_b, obs_h,
o_epochnum, gps_satnum,
o_epochnum, satnum,
res_file, obs_f, nav_f,
ionoption, trooption);
+3 -3
View File
@@ -69,7 +69,7 @@ pos_ts gps_pos(int sPRN, int best_epoch, double GPSsec,
/* ------------------------------- GPS卫星位置计算&输出 ------------------------------ */
void sat_gps_pos_clac(FILE* result_file,HWND hwndPB,
pnav_body nav_b, pobs_epoch obs_e, pobs_body obs_b,pobs_head obs_h,
int o_epochnum, int gps_satnum,
int o_epochnum, int satnum,
char res_file[MAX_PATH], char obs_file[MAX_PATH], char nav_file[MAX_PATH],
int ionoption, int trooption)
{
@@ -88,7 +88,7 @@ void sat_gps_pos_clac(FILE* result_file,HWND hwndPB,
result_file = fopen(res_file, "w");
fclose(result_file);
result_file = fopen(res_file, "a+");
fprintf(result_file, "@ GENERATE PROGRAM : SPP Calculate v0.4.7\n");
fprintf(result_file, "@ GENERATE PROGRAM : KNZ_Calculate v0.9.7\n");
fprintf(result_file, "@ GENERATE TYPE : Satellite Position\n");
fprintf(result_file, "@ GENERATE TIME : %s", ctime(&gen_time));
fprintf(result_file, "@ OBS FILE PATH : %s\n", obs_file);
@@ -129,7 +129,7 @@ void sat_gps_pos_clac(FILE* result_file,HWND hwndPB,
{
double GPSsec = Time2GPSsec(y, m, d, h, min, sec);//转换为GPS周内秒
int sPRN = obs_e[i].sPRN_GPS[j];
int best_epoch = select_epoch(GPSsec, sPRN, nav_b, gps_satnum); //遍历N文件GPS卫星数据块,寻找最佳历元
int best_epoch = select_epoch(GPSsec, sPRN, nav_b, satnum, GPS); //遍历N文件GPS卫星数据块,寻找最佳历元
double detat_toc = GPSsec - nav_b[best_epoch].TOE;//观测时刻 - 参考时刻
//计算近似的信号传播时间,接收机钟差已初始化为0(伪距/光速-接收机钟差+卫星钟差)
pos_t.delta_t[sPRN] = (obs_b[i].obs_gps[j][Code2Type(C1C, obs_h->obstypenum_gps, obs_h->obscode_gps)] / C_V) - station.delta_TR + nav_b[best_epoch].sa0 + nav_b[best_epoch].sa1 * detat_toc + nav_b[best_epoch].sa2 * pow(detat_toc, 2);
+51
View File
@@ -1,5 +1,44 @@
#ifndef _PUBLIC_H_
#define _PUBLIC_H_
/*---------------------------------- FOR UI ----------------------------------*/
//FILE SELECT DIALOGS
#define FILEEXOP TEXT("RINEX OBS(*.o*.*.*obs.*.*d)\0*.*o;*.*obs;*.*d\0"\
"All Files(*.*)\0*.*\0\0");
#define FILEEXNP TEXT("RINEX NAV(*.*nav.*.hnav.*.gnav.*.qnav.*.*n.*.*g.*.*h.*.*q.*.*p)\0*.*nav;*.hnav;*.gnav;*.qnav;*.*n;*.*g;*.*h;*.*q;*.*p\0"\
"All Files(*.*)\0*.*\0\0")
#define FILEEXSV TEXT("Spos Files(*.sp*)\0*.sp\0"\
"All Files(*.*)\0*.*\0\0");
//DEF MAIN WINDOW BUTTONS
#define OBSBUTTON 3301
#define NAVBUTTON 3302
#define CALBUTTON 3303
#define OPTBUTTON 3304
#define PLOBUTTON 3305
#define OBSCLEAR 3306
#define OBSRELOD 3307
#define NAVCLEAR 3308
#define NAVRELOD 3309
#define PROGRESS 3310
//DEF MAIN WINDOW GNSS NUTTONS
#define GPSCHECK 5500
#define GLOCHECK 5501
#define BEICHECK 5502
#define GALCHECK 5503
#define SBACHECK 5504
#define SYSGROUP 1001
//DEF OPTIONS WINDOW CHECK+BOXS
#define OPTDFION 7001
#define OPTDFTRO 7002
#define OPTCONFI 7003
//DEFINE PROGRESSBAR STATE
#define PBSTATENONE 0
#define PBSTATEHALF 500
#define PBSTATEFULL 1000
/* ------------------------------ WGS-84 CONST ------------------------------ */
#define a 6378137.0
@@ -9,6 +48,8 @@
#define math_e 2.718281828459
#define PI 3.141592653589793
#define Earth_e 7.2921151467e-5
/* ----------------------------- GPS OBSERV TYPE ---------------------------- */
#define C1C 1
#define C1S 2
@@ -31,6 +72,16 @@
#define C5I 17
#define C5Q 18
#define C5X 19
/* ------------------------------- GNSS CODE -------------------------------- */
#define GPS 0
#define BDS 1
#define CAL 2
#define GLO 3
#define SBAS 4
/* ------------------------------ FOR CALMOD.H ------------------------------ */
#define MAXRINEX 1000
//卫星位置结构体
+9 -45
View File
@@ -243,9 +243,9 @@ extern void read_o_b(FILE* fp_obs, pobs_epoch obs_e, pobs_body obs_b, int type_g
/* -------------------------------------------------------------------------- */
/* ---------------------- 获取文件数据块行数,从END OF HEADER后开始起算 --------------------- */
int getgpssatnum(FILE* fp_nav)
int getsatnum(FILE* fp_nav)
{
int gps_satnum = 0;
int satnum = 0;
int flag = 0;
char buff[MAXRINEX];//用来存放读取到的字符串
char satvar;
@@ -263,54 +263,18 @@ int getgpssatnum(FILE* fp_nav)
while (fgets(buff, MAXRINEX, fp_nav))
{
strncpy(&satvar, buff + 0, 1);
if (satvar != 'G')
if (satvar == 'G' || satvar == 'E' || satvar == 'R' || satvar == 'S' || satvar == 'C' || satvar == 'I' || satvar == 'J')
{
satnum++;
}
else
{
continue;
}
else if (satvar == 'G')
{
gps_satnum++;
break;
}
}
}
}
return gps_satnum;
}
int getbdssatnum(FILE* fp_nav)
{
int bds_satnum = 0;
int flag = 0;
char buff[MAXRINEX];//用来存放读取到的字符串
char satvar;
char* lable = buff + 60;
//fgets函数,读取一行,当读取结束后返回NULL指针,格式如下:
//wchar_t * fgets ( wchar_t * str, int num, FILE * stream );
while (fgets(buff, MAXRINEX, fp_nav))
{
if (strstr(lable, "END OF HEADER"))
{
flag = 1;
}
if (flag == 1)
{
while (fgets(buff, MAXRINEX, fp_nav))
{
strncpy(&satvar, buff + 0, 1);
if (satvar != 'C')
{
continue;
}
else if (satvar == 'C')
{
bds_satnum++;
break;
}
}
}
}
return bds_satnum;
return satnum;
}
/* -------------------------------- 读取N文件数据头 -------------------------------- */
@@ -390,7 +354,7 @@ void read_n_h(FILE* fp_nav, pnav_head nav_h)
void read_n_b(FILE* fp_nav, pnav_body nav_b)
{
int i_g = 0;//第i_g个卫星数据
char buff[84] = { 0 };
char buff[MAXRINEX] = { 0 };
char flag = { 0 };//判断符号
while (fgets(buff, MAXRINEX, fp_nav))
{
+12 -9
View File
@@ -10,24 +10,27 @@
/// @param SecofWeek 计算得到的观测历元的周内秒
/// @param sPRN 需要匹配的该历元卫星号
/// @param nav_b 导航文件数据块结构体,与卫星号匹配
/// @param gps_satnum 该历元的GPS卫星数量
/// @param satnum 广播星历卫星数量
/// @param syscode 卫星系统代码,详情见PPUBLIC.H
/// @return 返回最佳历元的绝对历元序号
/* -------------------------------------------------------------------------- */
extern int select_epoch(double SecofWeek, int sPRN, pnav_body nav_b, int gps_satnum)
extern int select_epoch(double SecofWeek, int sPRN, pnav_body nav_b, int satnum, int syscode)
{
int best_epoch = 0;
double min = 10000;//初始化最小值
double Min;
int i;
for (i = 0; i < gps_satnum; i++)
if (syscode == GPS)
{
if (sPRN == nav_b[i].sPRN_GPS)
for (int i = 0; i < satnum; i++)
{
Min = fabs(SecofWeek - nav_b[i].TOE);
if (Min <= min)
if (sPRN == nav_b[i].sPRN_GPS)
{
best_epoch = i;
min = Min;
Min = fabs(SecofWeek - nav_b[i].TOE);
if (Min <= min)
{
best_epoch = i;
min = Min;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

+3 -3
View File
@@ -1,17 +1,17 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ 生成的包含文件。
// 供 SPP_Calculate.rc 使用
// 供 SPP_calculate.rc 使用
//
#define IDI_ICON1 101
#define IDI_ICON2 102
#define IDI_ICON3 103
#define IDI_ICON4 104
#define IDI_ICON4 105
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101