HUGE UPDATES:

1. Realize the full gui program
2. Complete the plot function
This commit is contained in:
KenanZhu111 committed 2024-10-05 18:20:41 +08:00
1 parent 37473233c2
commit b013a7fa02
16 files changed
+214 -307622

No files matched your search

-3
View File
@@ -1,3 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
-1
View File
@@ -1 +0,0 @@
pyGMT.py
-15
View File
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8 (pygmt)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="py.test" />
</component>
</module>
@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (pygmt)" project-jdk-type="Python SDK" />
</project>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/GMT4SAT.iml" filepath="$PROJECT_DIR$/.idea/GMT4SAT.iml" />
</modules>
</component>
</project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
Binary file not shown.
-98
View File
@@ -1,98 +0,0 @@
import os
from pygmt import project
os.environ["GMT_LIBRARY_PATH"] = "C:/programs/gmt6/bin"
import pygmt
fig = pygmt.Figure()
fig.coast(region="d",projection="Cyl_stere/12c",land="white",water="#C6E2FF",borders="1/0.2p",shorelines="1/0.2p",frame="ag")
f = open("LLA_result.txt","r")
f.readline()
string = f.readline()
epoch = 0
while epoch < 2880:
flag = string[0:1]
epoch = int(string[1:5])
if flag == ">":
gpsnum = 0
while gpsnum != 36:
string = f.readline()
flag = string[0:1]
if flag =="G":
gpsnum = gpsnum + 1
sPRN = int(string[1:3])
B = float(string[10:20])
L = float(string[21:31])
if sPRN == 1:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 2:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 3:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 4:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 5:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 6:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 7:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 8:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 9:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 10:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 11:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 12:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 13:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 14:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 15:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 16:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 17:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 18:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 19:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 20:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 21:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 22:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 23:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 24:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 25:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 26:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 27:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 28:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 29:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 30:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 31:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if sPRN == 32:
fig.plot(x = L,y = B,style = "c0.015c",fill = "blue",pen = "blue")
if flag !="G":
break
elif flag != ">":
break
fig.show()
-203
View File
@@ -1,203 +0,0 @@
function [ENU] = Station_Site_Solving()
% 打开坐标文件
file=fopen('111.sp');
sPRN = [];
satX = [];
satY = [];
satZ = [];
P_t1 = [];
P_t2 = [];
H = [];
TGD = [];
Dt = [];
sat_num = [];
C_V = 299792458;
f1 = 1575.42;
f2 = 1227.60;
satnum = 0;
eponum = 0;
% 设置测站粗略坐标和精确的经纬高数据
apX = -4052052.8310;
apY = 4212835.9820;
apZ = -2545104.4760;
apB = -0.4131213;%纬度
apL = 2.3367431;%经度
apH = 603.235;
% 逐行读取文件
while ~feof(file)
line = fgets(file);
flag_epo = extractBetween(line,1 ,1 );
% 判断历元标识
if strcmp(flag_epo, ">") == 1
eponum = str2double(extractBetween(line,2 ,5 ));
while eponum <= 2880
flag_sat = extractBetween(line,1 ,1);
% 判断卫星标识,读取卫星PRN号和XYZ坐标
if strcmp(flag_sat, "G") == 1
satnum = satnum + 1;
P_t1(eponum, satnum) = str2double(extractBetween(line,11 + 16 + 16 + 16 ,25 + 16 + 16 + 16 ));
if P_t1(eponum, satnum) ~= 0
prnnum = str2double(extractBetween(line,2 ,3 ));
sPRN(eponum, prnnum) = str2double(extractBetween(line,2 ,3 ));
satX(eponum, satnum) = str2double(extractBetween(line,11 ,25 ));
satY(eponum, satnum) = str2double(extractBetween(line,11 + 16 ,25 + 16 ));
satZ(eponum, satnum) = str2double(extractBetween(line,11 + 16 + 16 ,25 + 16 + 16 ));
P_t1(eponum, satnum) = str2double(extractBetween(line,11 + 16 + 16 + 16 ,25 + 16 + 16 + 16 ));
P_t2(eponum, satnum) = str2double(extractBetween(line,11 + 16 + 16 + 16 + 16 ,25 + 16 + 16 + 16 + 16));
H(eponum, satnum) = str2double(extractBetween(line,11 + 16 + 16 + 16 + 16 + 16 ,25 + 16 + 16 + 16 + 16 + 16));
TGD(eponum, satnum) = str2double(extractBetween(line,11 + 16 + 16 + 16 + 16 + 16 + 16 ,25 + 16 + 16 + 16 + 16 + 16 + 16));
Dt(eponum, satnum) = str2double(extractBetween(line,11 + 16 + 16 + 16 + 16 + 16 + 16 + 16,25 + 16 + 16 + 16 + 16 + 16 + 16 + 16));
line = fgets(file);
end
if P_t1(eponum, satnum) == 0
satnum = satnum - 1;
line = fgets(file);
end
end
% 开头字符不是G,但是是>,判断为一个历元的起点,进行数据读取
if strcmp(flag_sat, "G") == 0 && strcmp(flag_sat, ">") == 1
satnum = 0;
line = fgets(file);
continue;
end
% 开头字符既不是G,也不是>,判断为历元结束标志,跳出循环
if strcmp(flag_sat, "G") == 0 && strcmp(flag_sat, ">") == 0 && ~feof(file)
sat_num(eponum) = satnum;
satnum = 0;
break;
end
end
end
if strcmp(flag_epo, ">") == 0
continue;
end
end
fclose(file);
% 平差计算测站位置和接收机钟差解算
for i = 1:1:eponum
if sat_num(i) >= 4
X = zeros(4, 1);
P = zeros(sat_num(i), sat_num(i));
B = zeros(sat_num(i), 4);
l = zeros(sat_num(i), 1);
X_R = zeros(3, 1);
DeltaXYZ = zeros(3, 1);
% 每个历元构成系数矩阵
for j = 1:1:sat_num(i)
R = sqrt((satX(i, j)-apX)^2+(satY(i, j)-apY)^2+(satZ(i, j)-apZ)^2);
B(j, 1) = -((satX(i, j) - apX) / R);
B(j, 2) = -((satY(i, j) - apY) / R);
B(j, 3) = -((satZ(i, j) - apZ) / R);
B(j, 4) = 1;
% % 简化的Hopfield模型
% dtrop = 2.47/sind(H(i, j))+0.0121;
% % % % % %
P0 = 1013.25; e0 = 11.69; T0 = 288.15;
% 求大气压强
p = P0 * (1.0 - 0.0068 / T0 / apH)^5;
% 求开尔文温度
T = 288.15 - 0.0068 * apH;
% 水汽压计算
if apH > 11000
e = 0;
end
if apH <= 11000
e = e0 * (1.0 - 0.0068 * apH / T0)^4;
end
deltaSd = 0.00001552 * p / T * (40136 + 148.72 * (T - 273.16) - apH);
deltaSw = 0.0746512 * e / T^2 * (11000 - apH);
% 对流层延迟干分量
dtropd = deltaSd / sqrt(sind( rad2deg(deg2rad(H(i, j)) ^ 2) + 6.25 ) );
% 对流层延迟湿分量
dtropw = deltaSw / sqrt(sind( rad2deg(deg2rad(H(i, j)) ^ 2) + 6.25 ) );
dtrop = 0.1 * dtropw + 0.9 * dtropd;
% % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % 理想化的Saastamoinen模型/对流层改正
% P0 = 1013.25; e0 = 11.69; T0 = 288.15;
% % 求大气压强
% p = P0 * (1.0 - 0.0068 / T0 / apH)^5;
% % 求开尔文温度
% T = 288.15 - 0.0068 * apH;
% % 水汽压计算
% if apH > 11000
% e = 0;
% end
% if apH <= 11000
% e = e0 * (1.0 - 0.0068 * apH / T0)^4;
% end
% % 静力学延迟
% dtrop = 0.002277 * p / (1.0 - 0.00266 * cosd(2 * H(i, j)) - 0.00028 * apH * 1e-3) ;
% % % % % % % % % % % % % % % % % % % % % % % % %
if P_t2(i, j) ~= 0
% 双频组合消除电离层延迟
P_t = (f1^2) / (f1^2 - f2^2) * P_t1(i, j) - (f2^2) / (f1^2 - f2^2) * P_t2(i, j);
end
if P_t2(i, j) == 0
P_t = P_t1(i, j);
end
l(j, 1) = P_t - R + C_V * Dt(i,j) - dtrop;
P(j, j) = sind(H(i, j))^2;
end
apX_R = apX;%迭代坐标传参
apY_R = apY;
apZ_R = apZ;
% 平差计算得到改正数并进行迭代计算
while abs(apX_R - X_R(1,1)) > 0.0001 && abs(apY_R - X_R(2,1)) > 0.0001 && abs(apZ_R - X_R(3,1)) > 0.0001
apX_R = X(1,1);
apY_R = X(2,1);
apZ_R = X(3,1);
Q=inv(B.'*P*B);
D_X=Q*B.'*P*l;%坐标改正数
X(1,1) = apX + D_X(1,1);
X(2,1) = apY + D_X(2,1);
X(3,1) = apZ + D_X(3,1);%改正后测站坐标
X_R(1,1) = X(1,1);
X_R(2,1) = X(2,1);
X_R(3,1) = X(3,1);
end
GDOP(1,i) = sqrt(trace(Q));
StationCLK(1,i) = D_X(4, 1);
DeltaXYZ(1,1) = X(1,1) - apX;
DeltaXYZ(2,1) = X(2,1) - apY;
DeltaXYZ(3,1) = X(3,1) - apZ;
S = [
-sin(apL), cos(apL), 0;
-sin(apB)*cos(apL), -sin(apB)*sin(apL), cos(apB);
cos(apB)*cos(apL), cos(apB)*sin(apL), sin(apB)
];
ENU_R = S * DeltaXYZ;
ENU(1,i) = ENU_R(1,1);
ENU(2,i) = ENU_R(2,1);
ENU(3,i) = ENU_R(3,1);
end
end
%绘制结果图
figure("Position",[200, 700,1000,200],"Name", "East component deviation","NumberTitle","off")
plot(ENU(1,:));%E
box off
figure("Position",[200, 400,1000,200],"Name","North component deviation","NumberTitle","off")
plot(ENU(2,:));%N
box off
figure("Position",[200, 100,1000,200],"Name", "Up component deviation","NumberTitle","off")
plot(ENU(3,:));%U
box off
+165 -49
View File
@@ -4,7 +4,10 @@
#include<string.h>
#include<windows.h>
#include<Commdlg.h>
#include<commctrl.h>
#pragma comment(lib, "comctl32")
#include"resource.h"
#include"headers/public.h"
#include"headers/read.h"
#include"headers/cal_mod.h"
@@ -14,10 +17,10 @@ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
//FILE SELECT DIALOGS
#define FILEEXOP TEXT("Obs Files(*.o*)\0*.20o;*.21o;*.22o;*.23o;*.24o\0"\
#define FILEEXOP TEXT("RINEX OBS(*.o*.*.*obs.*.*d)\0*.*o;*.*obs;*.*d\0"\
"All Files(*.*)\0*.*\0\0");
#define FILEEXNP TEXT("Nav Files(*.p*)\0*.20p;*.21p;*.22p;*.23p;*.24p\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"\
@@ -30,7 +33,10 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#define OPTBUTTON 3304
#define PLOBUTTON 3305
#define OBSCLEAR 3306
#define NAVCLEAR 3307
#define OBSRELOD 3307
#define NAVCLEAR 3308
#define NAVRELOD 3309
#define PROGRESS 3310
//DEF MAIN WINDOW GNSS NUTTONS
#define GPSCHECK 5500
#define GLOCHECK 5501
@@ -43,7 +49,7 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#define OPTDFTRO 7002
#define OPTCONFI 7003
HWND hwndb[13];//BUTTON HANDLE
HWND hwndb[15];//BUTTON HANDLE
HWND hwndopt;//OPTIONS HANDLE
HWND hwndopt_def_ion;//DEFAULT ION COR
HWND hwndopt_def_tro;//DEFAULT TRO COR
@@ -69,23 +75,8 @@ int bds_satnum = 0;
static int ionoption = 0;
static int trooption = 0;
/* ------------- */
char obs_f[MAX_PATH] = { 0 };
char nav_f[MAX_PATH] = { 0 };
static int FileSelobsDialog(const wchar_t* path)//FILEDIALOG FOR OBS
{
@@ -127,6 +118,7 @@ static int FileSaveDialog(const wchar_t* path)//FILEDIALOG FOR SAVE
return GetSaveFileName(&ofn);
}
DWORD WINAPI PBThreadProc(LPVOID lpParameter);//PROGRESS BAR WINDOW
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);//MAIN WINDOW
LRESULT CALLBACK OptWndProc(HWND, UINT, WPARAM, LPARAM);//OPTION WINDOW
@@ -138,7 +130,7 @@ 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_ICON1));
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2));
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass.lpszMenuName = NULL;
@@ -147,7 +139,7 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
RegisterClass(&wndclass);
wndclass.lpfnWndProc = OptWndProc;
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2));
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON3));
wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = TEXT("OPT");
@@ -159,8 +151,8 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
TEXT("SPP"),
TEXT("SPP Calculate"),
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
650,
300,
0,
0,
0,
0,
NULL,
@@ -168,6 +160,7 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
hInstance,
NULL);
HICON Delico,Relico;
HFONT hbFont;
hbFont = CreateFont(
15,
@@ -191,6 +184,12 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
{
SendMessage(hwndb[i], WM_SETFONT, (WPARAM)hbFont, 1);
}
Delico = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
Relico = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON4));
SendMessage(hwndb[11], BM_SETIMAGE, IMAGE_ICON, (LPARAM)Delico);
SendMessage(hwndb[12], BM_SETIMAGE, IMAGE_ICON, (LPARAM)Relico);
SendMessage(hwndb[13], BM_SETIMAGE, IMAGE_ICON, (LPARAM)Delico);
SendMessage(hwndb[14], BM_SETIMAGE, IMAGE_ICON, (LPARAM)Relico);
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
@@ -212,9 +211,12 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
char nav_file[MAX_PATH] = { 0 };
char res_file[MAX_PATH] = { 0 };//BE COMPATIBLE WITH MSVC
char path[MAX_PATH];
getcwd(path, sizeof(path));//GET THE PROGRAM'S FOLDER
RECT rect;
HBITMAP Delico;
TCHAR* SATSYS[5] = { TEXT("GPS"),TEXT("GLO"),TEXT("BeiDou"),TEXT("Galileo"),TEXT("SBAS") };
static HWND hwndPB;
static int cxchar, cychar;
switch (msg) {
@@ -223,26 +225,35 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
cxchar = LOWORD(GetDialogBaseUnits());
cychar = HIWORD(GetDialogBaseUnits());//GET THE SYS FONT SIZE
GetWindowRect(hwnd, &rect);
MoveWindow(hwnd, rect.left, rect.bottom, 50 * cxchar, 15 * cychar, TRUE);//REPAINT THE MAIN WINDOW
MoveWindow(hwnd, (GetSystemMetrics(SM_CXSCREEN) - 50 * cxchar) / 2, (GetSystemMetrics(SM_CYSCREEN) - 16 * cychar) / 2, 50 * cxchar, 16 * cychar, TRUE);//REPAINT THE MAIN WINDOW
InitCommonControls();
hwndPB = CreateWindowEx(0, PROGRESS_CLASS, NULL, WS_CHILD | WS_VISIBLE,
0,12 * cychar,
50 * cxchar, 1 * cychar,
hwnd, (HMENU)PROGRESS,((LPCREATESTRUCT)lParam)->hInstance, NULL);
//CREATE THE BUTTONS
hwndb[0] = CreateWindow(TEXT("Button"), TEXT("Open Obs Data"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
cxchar, 5 * cychar,
14 * cxchar, 2 * cychar,
hwnd, (HMENU)OBSBUTTON, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndb[1] = CreateWindow(TEXT("Button"), TEXT("Open Nav Data"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
17 * cxchar, 5 * cychar,
14 * cxchar, 2 * cychar,
hwnd, (HMENU)NAVBUTTON, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndb[2] = CreateWindow(TEXT("Button"), TEXT("Sat-Position Calculate"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
cxchar, 7 * cychar,
32 * cxchar, 2 * cychar,
hwnd, (HMENU)CALBUTTON, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndb[3] = CreateWindow(TEXT("Button"), TEXT("Options..."), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
36 * cxchar, 7 * cychar,
10 * cxchar, 2 * cychar,
hwnd, (HMENU)OPTBUTTON, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndb[4] = CreateWindow(TEXT("Button"), TEXT("Plot"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
36 * cxchar, 5 * cychar,
10 * cxchar, 2 * cychar,
@@ -260,15 +271,28 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
1 * cxchar/2, 19 * cychar/2,
47 * cxchar, 6 * cychar/2,
hwnd, (HMENU)SYSGROUP, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndb[11] = CreateWindow(TEXT("Button"), NULL, WS_VISIBLE | WS_CHILD | BS_BITMAP | BS_PUSHBUTTON,
hwndb[11] = CreateWindow(TEXT("Button"), NULL, WS_VISIBLE | WS_CHILD | BS_ICON | BS_PUSHBUTTON,
15 * cxchar, 5 * cychar,
2 * cxchar, 2 * cychar,
2 * cxchar, 1 * cychar,
hwnd, (HMENU)OBSCLEAR, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndb[12] = CreateWindow(TEXT("Button"), NULL, WS_VISIBLE | WS_CHILD | BS_BITMAP | BS_PUSHBUTTON,
hwndb[12] = CreateWindow(TEXT("Button"), NULL, WS_VISIBLE | WS_CHILD | BS_ICON | BS_PUSHBUTTON,
15 * cxchar, 6 * cychar,
2 * cxchar, 1 * cychar,
hwnd, (HMENU)OBSRELOD, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndb[13] = CreateWindow(TEXT("Button"), NULL, WS_VISIBLE | WS_CHILD | BS_ICON | BS_PUSHBUTTON,
31 * cxchar, 5 * cychar,
2 * cxchar, 2 * cychar,
2 * cxchar, 1 * cychar,
hwnd, (HMENU)NAVCLEAR, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndb[14] = CreateWindow(TEXT("Button"), NULL, WS_VISIBLE | WS_CHILD | BS_ICON | BS_PUSHBUTTON,
31 * cxchar, 6 * cychar,
2 * cxchar, 1 * cychar,
hwnd, (HMENU)NAVRELOD, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
return 0;
case WM_COMMAND:
@@ -276,11 +300,14 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
{
/* -------------------------- LOAD OBS DATA BUTTON -------------------------- */
case OBSBUTTON:
if (fp_obs == NULL)
{
FileSelobsDialog(wobs_file);
wcstombs(obs_file, wobs_file, MAX_PATH);
fp_obs = fopen(obs_file, TEXT("r"));
if (fp_obs != NULL)
{
strcpy(obs_f, obs_file);
o_epochnum = get_epochnum(fp_obs);
rewind(fp_obs);
obs_h = (pobs_head)malloc(sizeof(obs_head));
@@ -295,18 +322,25 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
if (o_epochnum > 0)
{
MessageBox(hwnd, TEXT("File of Obs load complete!"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
break;
}
}
}
else
{
MessageBox(hwnd, TEXT("File of Obs has already been loaded ! \nTo load new data file of Obs, \nPlease clear the existing data first"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
}
break;
return 0;
/* -------------------------- LOAD NAV DATA BUTTON -------------------------- */
case NAVBUTTON:
if (fp_nav == NULL)
{
FileSelnavDialog(wnav_file);
wcstombs(nav_file, wnav_file, MAX_PATH);
fp_nav = fopen(nav_file, TEXT("r"));
if (fp_nav != NULL)
{
strcpy(nav_f, nav_file);
gps_satnum = getgpssatnum(fp_nav);
rewind(fp_nav);
bds_satnum = getbdssatnum(fp_nav);
@@ -321,7 +355,61 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
fclose(fp_nav);
if (gps_satnum > 0)
{
MessageBox(hwnd, TEXT("File of Nav load complete!"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
MessageBox(hwnd, TEXT("File of Nav load complete !"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
}
}
}
else
{
MessageBox(hwnd, TEXT("File of Nav has already been loaded ! \nTo load new data file of Nav, \nPlease clear the existing data first"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
}
break;
return 0;
/* -------------------------- CLEAR OBS DATA BUTTON ------------------------- */
case OBSCLEAR:
while (fp_obs != NULL)
{
free(obs_h); free(obs_e); free(obs_b);
fp_obs = NULL; obs_e = NULL; obs_b = NULL;
while (MessageBox(hwnd, TEXT("File of Obs has been cleared."), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK) == IDOK)
{
break;
}
}
break;
return 0;
case OBSRELOD:
if (fp_obs != NULL)
{
if (o_epochnum > 0)
{
MessageBox(hwnd, TEXT("File of Obs Reload complete !"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
break;
}
}
break;
return 0;
/* -------------------------- CLEAR NAV DATA BUTTON ------------------------- */
case NAVCLEAR:
while(fp_nav != NULL)
{
free(nav_h); free(nav_b);
fp_nav = NULL;nav_h = NULL; nav_b = NULL;
while (MessageBox(hwnd, TEXT("File of Nav has been cleared."), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK) == IDOK)
{
break;
}
}
break;
return 0;
case NAVRELOD:
if (fp_nav != NULL)
{
if (gps_satnum > 0)
{
MessageBox(hwnd, TEXT("File of Nav Reload complete !"), TEXT("NOTICE"), MB_ICONASTERISK | MB_OK);
break;
}
}
@@ -331,15 +419,15 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
case CALBUTTON:
if (fp_obs == NULL && fp_nav == NULL)
{
MessageBox(hwnd, TEXT("No Data File!"), TEXT("STOP"), MB_ICONERROR | MB_OKCANCEL | MB_DEFBUTTON1);
MessageBox(hwnd, TEXT("No Data File !"), TEXT("STOP"), MB_ICONERROR | MB_OKCANCEL | MB_DEFBUTTON1);
}
else if (fp_obs == NULL && fp_nav != NULL)
{
MessageBox(hwnd, TEXT("No Obs Data File!"), TEXT("STOP"), MB_ICONERROR | MB_OKCANCEL | MB_DEFBUTTON1);
MessageBox(hwnd, TEXT("No Obs Data File !"), TEXT("STOP"), MB_ICONERROR | MB_OKCANCEL | MB_DEFBUTTON1);
}
else if (fp_obs != NULL && fp_nav == NULL)
{
MessageBox(hwnd, TEXT("No Nav Data File!"), TEXT("STOP"), MB_ICONERROR | MB_OKCANCEL | MB_DEFBUTTON1);
MessageBox(hwnd, TEXT("No Nav Data File !"), TEXT("STOP"), MB_ICONERROR | MB_OKCANCEL | MB_DEFBUTTON1);
}
else if (fp_obs != NULL && fp_nav != NULL)
{
@@ -347,13 +435,11 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
for (int i = 0; i < 5; i++){ALLSTATE += SendMessage(hwndb[i + 5], BM_GETCHECK, wParam, lParam);}
if (ALLSTATE == 0x0000)
{
while (1)
{
if (MessageBox(hwnd, TEXT("No GNSS is choosen\nPlease Retry"), TEXT("NOTICE"), MB_ICONERROR | MB_RETRYCANCEL) == IDRETRY)
while (MessageBox(hwnd, TEXT("No GNSS is choosen\nPlease Retry"), TEXT("STOP"), MB_ICONERROR | MB_RETRYCANCEL) == IDRETRY)
{
break;
}
}
}
else
{
@@ -361,7 +447,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
wcstombs(res_file, wres_file, MAX_PATH);
if (res_file[0] == '\0')
{
while (MessageBox(hwnd, TEXT("Failed to select a save path.\nThe data has been cleared!"), TEXT("WARNING"), MB_ICONWARNING | MB_OK) == IDOK)
while (MessageBox(hwnd, TEXT("Failed to select a save path.\nThe data has been cleared !"), TEXT("WARNING"), MB_ICONWARNING | MB_OK) == IDOK)
{
break;
}
@@ -370,7 +456,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
{
if (SendMessage(hwndb[5], BM_GETCHECK, wParam, lParam) == BST_CHECKED)
{
sat_gps_pos_clac(result_file, nav_b, obs_e, obs_b, obs_h, o_epochnum, gps_satnum, res_file);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)PBThreadProc, hwndPB, 0, 0);
sat_gps_pos_clac(result_file, nav_b, obs_e, obs_b, obs_h, o_epochnum, gps_satnum, res_file, obs_f, nav_f, ionoption, trooption);
}
}
free(obs_h); free(obs_e); free(obs_b); free(nav_h); free(nav_b);
@@ -384,7 +471,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
case OPTBUTTON:
DestroyWindow(hwndopt);
hwndopt = CreateWindow(TEXT("OPT"), TEXT("Options"), WS_CAPTION | WS_SYSMENU,
650, 300,
0, 0,
0, 0,
NULL, NULL, GetWindowLongPtr(hwndopt, GWLP_HINSTANCE), NULL);
HFONT hbFont;
@@ -404,19 +491,28 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
break;
return 0;
/* ------------------------------- PLOT BUTTON ------------------------------ */
case PLOBUTTON:
case PLOBUTTON: {
const char plot[] = "SPP_plot.exe";
const wchar_t wpath[MAX_PATH];
sprintf(path, "%s\\%s", path, plot);
mbstowcs(wpath, path, MAX_PATH);
if (ShellExecute(NULL, TEXT("open"), wpath, NULL, NULL, SW_SHOW) <= 32)
{
MessageBox(hwnd, TEXT("Failed to open Plot module !\nThe file may be removed or be damaged.\n "), TEXT("ERROR"), MB_ICONERROR | MB_OK);
}
break;
return 0;
}
/* ------------------------------- DEFAULT MSG ------------------------------ */
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
case WM_CLOSE:
if(MessageBox(hwnd, TEXT("You're shutting the program"), TEXT("NOTICE"), MB_OKCANCEL | MB_ICONASTERISK) == IDOK )
DestroyWindow(hwnd);
else
return 0;
case WM_DESTROY:
PostQuitMessage(0);
@@ -434,8 +530,8 @@ LRESULT CALLBACK OptWndProc(HWND hwndopt, UINT msg, WPARAM wParam, LPARAM lParam
case WM_CREATE:
cxchar = LOWORD(GetDialogBaseUnits());
cychar = HIWORD(GetDialogBaseUnits());
GetWindowRect(hwndopt, &rect);
MoveWindow(hwndopt, rect.left, rect.bottom, 30 * cxchar, 7 * cychar, TRUE);
MoveWindow(hwndopt, (GetSystemMetrics(SM_CXSCREEN) - 30 * cxchar) / 2, (GetSystemMetrics(SM_CYSCREEN) - 7 * cychar) / 2, 30 * cxchar, 7 * cychar, TRUE);
ShowWindow(hwndopt, SW_SHOWDEFAULT);
UpdateWindow(hwndopt);
hwndopt_def_ion = CreateWindow(TEXT("BUTTON"), TEXT("Use Default ION_COR"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
@@ -483,3 +579,23 @@ LRESULT CALLBACK OptWndProc(HWND hwndopt, UINT msg, WPARAM wParam, LPARAM lParam
}
return 0;
}
DWORD WINAPI PBThreadProc(LPVOID lpParameter) {
HWND hwndPB = (HWND)lpParameter;
PBRANGE range;
SendMessage(hwndPB, PBM_SETRANGE, (WPARAM)FALSE, (LPARAM)(MAKELPARAM(0, 100)));
SendMessage(hwndPB, PBM_GETRANGE, (WPARAM)TRUE, (LPARAM)&range);
while (TRUE)
{
SendMessage(hwndPB, PBM_DELTAPOS, (WPARAM)((range.iHigh - range.iLow) / 20), (LPARAM)0);
if (SendMessage(hwndPB, PBM_GETPOS, (WPARAM)0, (LPARAM)0) == range.iHigh)
{
break;
}
Sleep(100);
}
Sleep(2000);
SendMessage(hwndPB, PBM_SETPOS, (WPARAM)range.iLow, (LPARAM)0);
}
-209828
View File
File diff suppressed because it is too large. Load diff
-97388
View File
File diff suppressed because it is too large. Load diff
+30 -10
View File
@@ -3,6 +3,7 @@
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>
#include"public.h"
@@ -68,8 +69,35 @@ pos_ts gps_pos(int sPRN, int best_epoch, double GPSsec,
void sat_gps_pos_clac(FILE * result_file,
pnav_body nav_b, pobs_epoch obs_e, pobs_body obs_b,
pobs_head obs_h,
int o_epochnum, int gps_satnum, char res_file[MAX_PATH])
int o_epochnum, int gps_satnum,
char res_file[MAX_PATH], char obs_file[MAX_PATH], char nav_file[MAX_PATH],
int ionosopt, int tropoopt)
{
time_t gen_time;
time(&gen_time);
stations station = { 0 };
xyz2blh tem2 = { 0 };
tem2 = XYZ2BLH(tem2, obs_h->apX, obs_h->apY, obs_h->apZ);
station.B = tem2.B;
station.L = tem2.L;
station.H = tem2.H;
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 TYPE : Satellite Position\n" );
fprintf(result_file, "@ GENERATE TIME : %s", ctime(&gen_time));
fprintf(result_file, "@ OBS FILE PATH : %s\n", obs_file);
fprintf(result_file, "@ NAV FILE PATH : %s\n", nav_file);
fprintf(result_file, "@ APPROX POSITION XYZ: %13.04f%13.04f%13.04f\n@ APPROX POSITION BLH: %12.07f %12.07f %12.07f\n"
,obs_h->apX ,obs_h->apY ,obs_h->apZ
,station.B ,station.L,station.H);
if (ionosopt == 0) { fprintf(result_file, "@ IONOS OPT : NULL\n"); }
if (ionosopt == 1) { fprintf(result_file, "@ IONOS OPT : DEFAULT\n"); }
if (tropoopt == 0) { fprintf(result_file, "@ TROPO OPT : NULL\n@\n\n"); }
if (tropoopt == 1) { fprintf(result_file, "@ TROPO OPT : DEFAULT\n@\n\n"); }
fclose(result_file);
for (int i = 0; i < o_epochnum; i++)//第i个历元
{
result_file = fopen(res_file, "a+");
@@ -84,7 +112,6 @@ void sat_gps_pos_clac(FILE * result_file,
double sec = obs_e[i].sec;
xyz2blh tem1 = { 0 };
xyz2blh tem2 = { 0 };
blh2enu tem3 = { 0 };
rahcal tem4 = { 0 };
deg2dms temb = { 0 };
@@ -94,14 +121,12 @@ void sat_gps_pos_clac(FILE * result_file,
enus enu = { 0 };
rahs rah = { 0 };
pos_ts pos_t = { 0 };
stations station = { 0 };
for (int j = 0; j < obs_e[i].gps_num; j++)//第j颗GPS卫星
{
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卫星数据块,寻找最佳历元
double detat_toc = GPSsec - nav_b[best_epoch].TOE;//观测时刻 - 参考时刻
station.delta_TR == 0.0;
//计算近似的信号传播时间,接收机钟差已初始化为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);
pos_t.deltat[sPRN] = 0.0;//判断收敛
@@ -115,11 +140,6 @@ void sat_gps_pos_clac(FILE * result_file,
blh.B = rad2deg(tem1.B);
blh.L = rad2deg(tem1.L);
blh.H = tem1.H;
tem2 = XYZ2BLH( tem2, obs_h->apX, obs_h->apY, obs_h->apZ);
station.B = tem2.B;
station.L = tem2.L;
station.H = tem2.H;
/* -------------------------------------------------------------------------- */
/* ----------------------------- 经纬大地高坐标系转站心坐标系 ----------------------------- */
@@ -156,7 +176,7 @@ void sat_gps_pos_clac(FILE * result_file,
blh.L_s = teml.S;
result_file = fopen(res_file, "a+");
fprintf(result_file, "\nG%02d[sPRN] %15.05f %15.05f %15.05f %15.05f %15.05f %15.05f %15.12f %16.13f"
fprintf(result_file, "\nG%02d | %15.05f %15.05f %15.05f %15.05f %15.05f %15.05f %15.12f %16.13f"
,sPRN, pos_t.X[sPRN], pos_t.Y[sPRN], pos_t.Z[sPRN]
,obs_b[i].obs_gps[j][Code2Type(C1C, obs_h->obstypenum_gps, obs_h->obscode_gps)]
,obs_b[i].obs_gps[j][Code2Type(C2L, obs_h->obstypenum_gps, obs_h->obscode_gps)]
+19
View File
@@ -0,0 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ 生成的包含文件。
// 供 SPP_Calculate.rc 使用
//
#define IDI_ICON1 101
#define IDI_ICON2 102
#define IDI_ICON3 103
#define IDI_ICON4 104
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif