From 80e29d68c700df2860dd1197ae423486fe3f01ac Mon Sep 17 00:00:00 2001 From: KenanZhu111 <3471685733@qq.com> Date: Tue, 5 Nov 2024 20:05:36 +0800 Subject: [PATCH] see on update notes --- README.md | 8 +++ READMECN.md | 6 +++ app/Config_file.py | 4 ++ app/Func_callback.py | 115 ++++++++++++++++++++++++++++++++----------- app/Ui_main.py | 2 +- app/Ui_options.py | 97 ++++++++++++++++++++++++++++++------ app/Ui_view.py | 69 ++++++++++++++++++++------ src/brdm2pos.h | 5 +- src/rnx2pos.cpp | 75 ++++++++++++++++++++++++++-- src/solutions.cpp | 6 ++- 10 files changed, 322 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index b24f3bb..40669aa 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,14 @@ Support method of orientation * As of October 5, 2024, Matlab project will no longer be considered.[ADIN 2024/10/5] ## Project Update +Update: 2024/11/03: +1. KNZ_GeoTrackLab: Fix some bug, Optimize UI logic。 +2. KNZ_GeoTrackLab: New added function of save and change + file for View. +3. KNZ_GeoTrackLab: Sat track projection plot changed as + Mecator projection and relize the display + by dynamic, sat prn selection, selection of + sample rate/inteval of plot. Update: 2024/11/03: 1. KNZ_GeoTrackLab: Fix some bug, Modify some UI logic. diff --git a/READMECN.md b/READMECN.md index 5b861a2..7c9f33a 100644 --- a/READMECN.md +++ b/READMECN.md @@ -32,6 +32,12 @@ * 自 2024 年 10 月 5 日起,Matlab 项目将不再考虑。[ADIN 2024/10/5] ## 项目更新 +更新:2024/11/05: +1. KNZ_GeoTrackLab: 修复一些bug, 优化UI逻辑。 +2. KNZ_GeoTrackLab: 为View文本编辑器增添保存修改功能。 +3. KNZ_GeoTrackLab: 卫星轨迹投影图更改为墨卡托投影, + 并实现动画显示,卫星号选择,绘 + 制采样频率选择。 更新: 2024/10/31: 1. KNZ_GeoTrackLab: 修复一些bug, 优化UI逻辑。 diff --git a/app/Config_file.py b/app/Config_file.py index 699ede4..e55034b 100644 --- a/app/Config_file.py +++ b/app/Config_file.py @@ -67,6 +67,10 @@ class Configinit: self.config.set('Options_Draw', 'N_Line', '0.80') self.config.set('Options_Draw', 'U_Line', '0.80') self.config.set('Options_Draw', 'Sat_Amount_Color', '#0080FF') + self.config.set('Options_Draw', 'Enable of track', '0') + self.config.set('Options_Draw', 'Track of prn', '01') + self.config.set('Options_Draw', 'Track sample rate','10') + ### Config for input path self.config.add_section('Input_Obs_Path') self.config.set('Input_Obs_Path', '0', '') diff --git a/app/Func_callback.py b/app/Func_callback.py index 08ab96a..cef5f4a 100644 --- a/app/Func_callback.py +++ b/app/Func_callback.py @@ -84,7 +84,8 @@ class CALLBACK: position_y = int((hwnd.winfo_screenheight() - win_y) / 2) hwnd.geometry(f'{win_x}x{win_y}+{position_x}+{position_y}') - def Calcuconfirm(self, cionbox, ctrobox, canglebox, systemv): + def Calcuconfirm(self, cionbox, ctrobox, canglebox, systemv, + trackprn, trackint): # ------------------------------------------------------------------------------- # > # Method: Calcuconfirm @@ -101,6 +102,9 @@ class CALLBACK: self.cfg_get.set('Options_Calc', 'Trop_model', self.trocormode.get(ctrobox.get())) self.cfg_get.set('Options_Calc', 'Elev_angle', canglebox.get()) self.cfg_get.set('Options_Calc', 'Sat_system', str(systemv.get())) + self.cfg_get.set('Options_Draw', 'Track of prn', trackprn.get()) + self.cfg_get.set('Options_Draw', 'Track sample rate', trackint.get()) + self.cfg.save_config() def Colorchoose(self, hwndparent, i, colorlab, mode): @@ -306,6 +310,7 @@ class CALLBACK: # Brief : Execute RINEX file into .ksln. # Author: @KenanZhu All Right Reserved. # ------------------------------------------------------------------------------- + exten = "ksln" statemsg = "" state3 = ["","",""] if not ObsSelectBoxVar.get(): @@ -327,9 +332,12 @@ class CALLBACK: if AskOrNotCheckVar.get(): directory = DirectorySelectBoxVar.get() + directory = self.Dir_or_name_get(directory, 1) syssign = self.system.get(int(self.cfg_get['Options_Calc']['sat_system'])) - resname = syssign + '-' + self.Dir_or_name_get(obspath,0) + 'ksln' + if int(self.cfg_get['Options_Draw']['Enable of track'])==1: + exten="ssln" + resname = syssign + '-' + self.Dir_or_name_get(obspath,0) + exten respath = (directory + resname) ExecuteState.config(text='Processing...... file : %s' %resname) @@ -343,7 +351,8 @@ class CALLBACK: int(self.cfg_get['Options_Calc']['Sat_system']), int(self.cfg_get['Options_Calc']['Elev_angle']), int(self.cfg_get['Options_Calc']['Iono_Model']), - int(self.cfg_get['Options_Calc']['Trop_Model']) + int(self.cfg_get['Options_Calc']['Trop_Model']), + int(self.cfg_get['Options_Draw']['Enable of track']) ): case 0.0: ExecuteState.config(text='Generated successfully ! file : %s' %resname) @@ -385,6 +394,7 @@ class CALLBACK: path = filedialog.askopenfilename(title='Open as Pos Solution', filetypes=[('Solution File(*.ksln)', '*.ksln'), ('All Files', '*.*')]) + if not path: return with open(path,'r')as f: while 1: line = f.readline() @@ -524,56 +534,105 @@ class CALLBACK: # Brief : # Author: @KenanZhu All Right Reserved. # ------------------------------------------------------------------------------- + if self.cfg_get['Options_Draw']['Enable of track']=='0': + plotstate.config(text="Track plot is not avaliable now, Please enable it.") + return + satprn = int(self.cfg_get['Options_Draw']['Track of prn']) + anirat = int(self.cfg_get['Options_Draw']['Track sample rate']) + system = self.system.get(int(self.cfg_get['Options_Calc']['sat_system'])) + path = filedialog.askopenfilename(title='Open as Sat Solution', - filetypes=[('Solution File(*.ksln)', '*.ksln'), + filetypes=[('Solution File(*.ssln)', '*.ssln'), ('All Files', '*.*')]) + if not path: return sattrack.clear() + + sattrack.coastlines(resolution='110m') + sattrack.gridlines() + with open(path,'r') as f: while 1: line = f.readline() + if line.find('APPROX POSITION BLH')>=0: apb = math.degrees( float(line[22:35]) ) apl = math.degrees( float(line[35:48]) ) + plotstate.config(text="Plotting...") + + sattrack.scatter( + apl, + apb, + color='r', + s=35, + transform=ccrs.PlateCarree() + ) + sattrack.text( + apl, + apb, + blank*4+marker, + color='k', + fontsize=10, + fontweight='bold', + transform=ccrs.PlateCarree() + ) + canvas2.draw() + elif line.find('GENERATE SOURCE')>=0: marker = line[22:26] + elif line.find('INTERVAL')>=0: ive = float(line[22:27]) + elif line.find('=0: break + epoch = 0 while 1: line =f.readline() - if line[0:1]=='>': - epoch = int(line[1:6]) - plotstate.config(text="Reading...%5d/%5d Mode: Sat track plot" - %(int(line[1:6]), int(86400/ive))) - elif line[0:1]==blank: + if line[0:1]==blank: pass - elif line[0:1]==self.system.get(int(self.cfg_get['Options_Calc']['sat_system']) - ) and line.find('END')==-1 and line.find('Rec')==-1: - if epoch % 10==0: + + elif line[0:1]==system and line.find('END')==-1 and line.find('Rec')==-1: + epoch = int(line[41:46]) + plotstate.config(text="Reading...%5d/%5d Mode: Sat track plot" + % (int(line[41:46]), int(86400 / ive))) + + if int(line[1:3])==satprn and epoch%anirat==0: b = math.degrees( float(line[ 4:13]) ) l = math.degrees( float(line[14:23]) ) - sattrack.scatter(l,b,color='b',s=2, - transform=ccrs.PlateCarree()) + sattrack.scatter( + l, + b, + color='b', + s=2, + transform=ccrs.PlateCarree() + ) + canvas2.draw() + text = sattrack.text( + l, + b, + 4*blank+system+'%02d'%satprn, + color='k', + fontsize=10, + fontweight='bold', + transform=ccrs.PlateCarree() + ) + point = sattrack.scatter( + l, + b, + color='b', + s=10, + transform=ccrs.PlateCarree() + ) + canvas2.draw() + text.remove() + point.remove() else: pass elif line.find('END')>=0: - plotstate.config(text="Plotting...") - - sattrack.scatter(apl, apb, color='#ff8000', s=35, - transform=ccrs.PlateCarree()) - sattrack.text(apl, apb, blank * 4 + marker, color='#ff8000', - fontsize=12, fontweight='bold' - , transform=ccrs.PlateCarree()) - plotstate.config(text="Reading...") - - sattrack.coastlines(resolution='110m') - sattrack.gridlines() - canvas2.draw() - - plotstate.config(text="Done !") + plotstate.config(text="Done ! Track plot form: sys=%s sat=%2d interval=%2d" + %(system, satprn, anirat)) def _Plot2polar(self, sattrack, plotstate, canvas2): T = threading.Thread( diff --git a/app/Ui_main.py b/app/Ui_main.py index 5ab137b..fc9561a 100644 --- a/app/Ui_main.py +++ b/app/Ui_main.py @@ -389,7 +389,7 @@ class MAINGUI: plt.rc('font', family='Segoe UI') fig = plt.figure() self.sattrack = fig.add_subplot( - projection=ccrs.PlateCarree() + projection=ccrs.Mercator() ) self.sattrack.coastlines(resolution='110m') self.sattrack.gridlines() diff --git a/app/Ui_options.py b/app/Ui_options.py index 2b3f430..aa3959c 100644 --- a/app/Ui_options.py +++ b/app/Ui_options.py @@ -42,6 +42,13 @@ class OPTGUI: self.canglebox = None self.angleentry = None + self.enable = tk.IntVar() + self.trackprn = tk.StringVar() + self.trackint = tk.StringVar() + self.enable.set(int(self.cfg_get['Options_Draw']['Enable of track'])) + self.trackprn.set(self.cfg_get['Options_Draw']['Track of prn']) + self.trackint.set(self.cfg_get['Options_Draw']['Track sample rate']) + self.ulinewidth = None self.nlinewidth = None self.elinewidth = None @@ -59,9 +66,9 @@ class OPTGUI: self.opthwnd = tk.Toplevel(self.hwndparent) self.opthwnd.title("Options") self.opthwnd.resizable(0,0) - self.func.Move_center(self.opthwnd,320,250) - self.opthwnd.minsize(320,250) - self.opthwnd.maxsize(320,250) + self.func.Move_center(self.opthwnd,320,280) + self.opthwnd.minsize(320,280) + self.opthwnd.maxsize(320,280) ### Set icon icon_ico = (b'AAABAAEAICAAAAAAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAADjsAAA47AAAAAA' b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' @@ -184,6 +191,9 @@ class OPTGUI: # Elev option frame # ------------------------------------------------------------------------------- self.HANGOPT() + # Sat track opt frame + # ------------------------------------------------------------------------------- + self.TRACK() # Syst option frame # ------------------------------------------------------------------------------- self.SYSOPT() @@ -252,6 +262,55 @@ class OPTGUI: self.canglebox.current(int(pos)) self.canglebox.pack(side=tk.RIGHT,anchor='e') + def TRACK(self): + # ------------------------------------------------------------------------------- + # > + # Method: TRACK + # Brief : Plot satellite track by dynamic + # Author: @KenanZhu All Right Reserved. + # ------------------------------------------------------------------------------- + SattrackFrm = ttk.LabelFrame(self.CalcuFrame, text='Satellite Track', labelanchor='nw') + SattrackFrm.pack(side=tk.TOP, expand=tk.YES, padx='0px', pady='2px', fill=tk.BOTH) + + Sattrack = ttk.Frame(SattrackFrm) + Sattrack.pack(side=tk.TOP, expand=tk.YES, padx='0px', pady='0px',fill=tk.X) + + SatenableBut = ttk.Checkbutton( + Sattrack, + text='Enable : (s)PRN / Plot Interval', + variable=self.enable, + onvalue=1, + offvalue=0, + command=lambda :self.func.AskOrNotCheck( + self.enable, + RateEntry, + SattprnEntry + ) + ) + SatenableBut.pack(side=tk.LEFT, anchor='w') + # Interval of track plot + # ------------------------------------------------------------------------------- + RateEntry = ttk.Entry( + Sattrack, + width=8, + state=tk.DISABLED, + textvariable=self.trackint, + ) + RateEntry.pack(side=tk.RIGHT, anchor='e') + # SPRN of satellite ploted + # ------------------------------------------------------------------------------- + SattprnEntry = ttk.Entry( + Sattrack, + width=8, + state=tk.DISABLED, + textvariable=self.trackprn + ) + SattprnEntry.pack(side=tk.RIGHT, anchor='e') + + if self.enable.get(): + RateEntry.config(state=tk.NORMAL) + SattprnEntry.config(state=tk.NORMAL) + def SYSOPT(self): # ------------------------------------------------------------------------------- # > @@ -296,7 +355,7 @@ class OPTGUI: LineoptFrame.pack(side=tk.RIGHT, expand=tk.YES, padx='1px', pady='1px', fill=tk.Y) EFrame = tk.Frame(LineoptFrame) - EFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px') + EFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px') elinewopt = tk.Label( EFrame, text='Eline:', @@ -315,7 +374,7 @@ class OPTGUI: self.elinewidth.pack(side=tk.LEFT, expand=tk.YES, padx='1px', pady='0px') NFrame = tk.Frame(LineoptFrame) - NFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px') + NFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px') nlinewopt = tk.Label( NFrame, text='Nline:', @@ -334,7 +393,7 @@ class OPTGUI: self.nlinewidth.pack(side=tk.LEFT, expand=tk.YES, padx='1px', pady='0px') UFrame = tk.Frame(LineoptFrame) - UFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px') + UFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px') ulinewopt = tk.Label( UFrame, text='Uline:', @@ -353,7 +412,7 @@ class OPTGUI: self.ulinewidth.pack(side=tk.LEFT, expand=tk.YES, padx='1px', pady='0px') LineCon = tk.Frame(LineoptFrame) - LineCon.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px') + LineCon.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px') linewre = ttk.Button( LineCon, text='Undo', @@ -375,11 +434,11 @@ class OPTGUI: # Author: @KenanZhu All Right Reserved. # ------------------------------------------------------------------------------- # Satnum plot options# - SatvisFrame = ttk.LabelFrame(self.PlotFrame, text='Satn configs', labelanchor='nw') + SatvisFrame = ttk.LabelFrame(self.PlotFrame, text='SatN configs', labelanchor='nw') SatvisFrame.pack(side=tk.BOTTOM, expand=tk.YES, padx='1px', pady='1px', fill=tk.BOTH) SatnFrame = tk.Frame(SatvisFrame) - SatnFrame.pack(side=tk.LEFT, expand=tk.YES, padx='5px', pady='0px') + SatnFrame.pack(side=tk.LEFT, expand=tk.YES, padx='5px', pady='2px') satncollab = tk.Label( SatnFrame, width=5, @@ -409,7 +468,7 @@ class OPTGUI: LinecolorFrame.pack(side=tk.LEFT, expand=tk.YES, padx='1px', pady='1px', fill=tk.Y) EFrame = tk.Frame(LinecolorFrame) - EFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px') + EFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px') ecollab = tk.Label( EFrame, width=5, @@ -425,7 +484,7 @@ class OPTGUI: ecolopt.pack(side=tk.RIGHT, expand=tk.YES, padx='5px', pady='0px') NFrame = tk.Frame(LinecolorFrame) - NFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px') + NFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px') ncollab = tk.Label( NFrame, width=5, @@ -443,7 +502,7 @@ class OPTGUI: UFrame = tk.Frame(LinecolorFrame) - UFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px') + UFrame.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px') ucollab = tk.Label( UFrame, width=5, @@ -460,7 +519,7 @@ class OPTGUI: ucolopt.pack(side=tk.RIGHT, expand=tk.YES, padx='5px', pady='0px') ColorCon = tk.Frame(LinecolorFrame) - ColorCon.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='0px') + ColorCon.pack(side=tk.TOP, expand=tk.YES, padx='5px', pady='2px') colorcon = ttk.Button( ColorCon, text='Undo', @@ -496,7 +555,10 @@ class OPTGUI: text='Confirm', width=10, command=lambda :[ - self.func.Colorchoose(self.opthwnd, 0, None, 2), + self.func.Colorchoose( + self.opthwnd, + 0, None, 2 + ), self.func.Linewchoose( self.elinewidth, self.nlinewidth, @@ -507,8 +569,13 @@ class OPTGUI: self.cionbox, self.ctrobox, self.canglebox, - self.systemv + self.systemv, + self.trackprn, + self.trackint ), + self.cfg_get.set('Options_Draw', + 'Enable of track', + '%d' % self.enable.get()), self.opthwnd.destroy() ] ) diff --git a/app/Ui_view.py b/app/Ui_view.py index 72a505c..65287e3 100644 --- a/app/Ui_view.py +++ b/app/Ui_view.py @@ -23,10 +23,12 @@ class VIEWGUI: def __init__(self, hwndparent, func): # init # ------------------------------------------------------------------------------- + self.text = None self.func = func self.hwndparent = hwndparent self.view = None + self.f_path="" self.initGUI() @@ -224,8 +226,13 @@ class VIEWGUI: ### File > Oprn File filemenu.add_command( label="Open File", - command=lambda: self.View_windowshow(text, self.view), - accelerator='Ctrl+F' + command=self.View_windowshow, + accelerator='Ctrl+O' + ) + filemenu.add_command( + label="Save File", + command=self.Save_file, + accelerator='Ctrl+S' ) ### File > Exit filemenu.add_command( @@ -242,7 +249,7 @@ class VIEWGUI: xbar = tk.Scrollbar(self.view, orient=tk.HORIZONTAL) xbar.pack(side=tk.BOTTOM, fill=tk.X) - text = tk.Text( + self.text = tk.Text( self.view, xscrollcommand=xbar.set, yscrollcommand=ybar.set, @@ -251,23 +258,57 @@ class VIEWGUI: autoseparators=False, wrap='none' ) - text.pack(side=tk.TOP, fill=tk.BOTH) - ybar.config(command=text.yview) - xbar.config(command=text.xview) + self.text.pack(side=tk.TOP, fill=tk.BOTH) + ybar.config(command=self.text.yview) + xbar.config(command=self.text.xview) - def View_windowshow(self, text, view): + def View_windowshow(self): # ------------------------------------------------------------------------------- # > # Method: # Brief : # Author: @KenanZhu All Right Reserved. # ------------------------------------------------------------------------------- - f_path = filedialog.askopenfilename(parent=view) - if not f_path: + self.f_path = filedialog.askopenfilename(parent=self.view) + if not self.f_path: return 0 - self.view.title('Viewing: %s' % f_path) - text.delete('1.0', 'end') - with open(f_path, 'r') as f: + self.view.title('Viewing: %s' % self.f_path) + self.text.delete('1.0', 'end') + with open(self.f_path,'r',encoding='utf-8') as f: fcon = f.read() - text.insert('insert', fcon) - text.config() \ No newline at end of file + self.text.insert('insert', fcon) + self.text.config() + + def Save_file(self): + filecontent = self.text.get('1.0', 'end') + if self.f_path: + with open(self.f_path,'w',encoding='utf-8') as f: + f.write(filecontent) + else: + if not filecontent=='\n': + fpath = filedialog.asksaveasfilename( + defaultextension='.txt', + parent=self.view, + title='Save As:', + filetypes=[ + ('Text File(*.txt)', '*.txt'), + ('Solution File(*.ksln)', '*.ksln'), + ('Solution File(*.ssln)', '*.ssln'), + ('RINEX NAV File(*.*nav.*.hnav.*.gnav.*.qnav.*.*n.*.*g.*.*h.*.*q.*.*p)', + '*.*nav;*.hnav;*.gnav;*.qnav;*.*n;*.*g;*.*h;*.*q;*.*p'), + ('RINEX OBS File(*.o*.*.*obs.*.*d)', '*.*o;*.*obs;*.*d'), + ('All Files', '*.*')]) + try: + with open(fpath,'w',encoding='utf-8') as f: + f.write(filecontent) + except FileNotFoundError: + self.view.title('Fail to save: %s' % fpath) + return + self.view.title('Viewing : %s' % fpath) + else: + return + + + + + diff --git a/src/brdm2pos.h b/src/brdm2pos.h index 06800bd..550a8db 100644 --- a/src/brdm2pos.h +++ b/src/brdm2pos.h @@ -377,7 +377,7 @@ extern void read_n_b(FILE*, pnav_body); extern void read_o_h(FILE*, pobs_head); extern void read_o_eb(FILE*, pobs_head, pobs_epoch, pobs_body); //Contain in solutionout.cpp -extern FILE* headerout(pobs_head obs_h, char obs_path[MAXPATH], char nav_path[MAXPATH], char res_path[MAXPATH]); +extern FILE* headerout(pobs_head obs_h, int mode, char obs_path[MAXPATH], char nav_path[MAXPATH], char res_path[MAXPATH]); extern void solution(FILE* res_file, pobs_head obs_h, double X, double Y, double Z); extern void outdata(blh blh, FILE* res_file, int sPRN, int GNSS); //Entry function @@ -388,5 +388,6 @@ extern "C" _declspec(dllexport) double brdm2pos( int GNSS, int Hangle, int ionopt, - int tropopt); + int tropopt, + int genmode); diff --git a/src/rnx2pos.cpp b/src/rnx2pos.cpp index 44d8721..86cdafe 100644 --- a/src/rnx2pos.cpp +++ b/src/rnx2pos.cpp @@ -294,7 +294,7 @@ int sat_pos_cal(pobs_head obs_h, pobs_epoch obs_e, pobs_body obs_b, obs.Per2[k] = obs_b->obs_glo[j][code2type(C2, obs_h->obstypenum_glo, obs_h->obscode_glo)]; obs.freq1 = FREQ1_GLO; obs.freq2 = FREQ2_GLO; break;} - + outdata(in_blh, solu, sPRN, GNSS); k++; }; } @@ -332,6 +332,64 @@ int sat_pos_cal(pobs_head obs_h, pobs_epoch obs_e, pobs_body obs_b, free(in_lsq.B); free(in_lsq.P); free(in_lsq.L); return 1; } +/**/ +int sat_cal(pnav_body nav_b, pobs_head obs_h, FILE* solu,int satnum, int GNSS) { + + int ii, i, sPRN=0; + double Min, min, Weeksec=0, Beginsec, STOP; + + pos_ts pos = { 0 }; + blh in_blh = { 0 }; + + Beginsec = time2gpst( + obs_h->f_y, + obs_h->f_m, + obs_h->f_d, + obs_h->f_h, + obs_h->f_min, + obs_h->f_sec + ); + + for (i = 0; i < satnum; i++) { + + switch (GNSS){ + case GPS:if (nav_b[i].sPRN_GPS == -1) { continue; } + Weeksec = + fabs(sPRN - nav_b[i].sPRN_GPS) > 0 ? Beginsec : Weeksec; + sPRN = nav_b[i].sPRN_GPS; + STOP = 3600.0; + break; + case BDS:if (nav_b[i].sPRN_BDS == -1) { continue; } + Weeksec = + fabs(sPRN - nav_b[i].sPRN_BDS) > 0 ? Beginsec : Weeksec; + sPRN = nav_b[i].sPRN_BDS; + STOP = 1800.0; + break; + case GAL:if (nav_b[i].sPRN_GAL == -1) { continue; } + Weeksec = + fabs(sPRN - nav_b[i].sPRN_GAL) > 0 ? Beginsec : Weeksec; + sPRN = nav_b[i].sPRN_GAL; + STOP = 300.0; + break; + case GLO:if (nav_b[i].sPRN_GLO == -1) { continue; } + Weeksec = + fabs(sPRN - nav_b[i].sPRN_GLO) > 0 ? Beginsec : Weeksec; + sPRN = nav_b[i].sPRN_GLO; + STOP = 900.0; + break; + } + + for (Weeksec; fabs(Weeksec-nav_b[i].TOE)<=3600.0; Weeksec += 30.0) { + if (Weeksec - Beginsec == 86400.0) { + break; + } + pos = sat_pos(sPRN, i, Weeksec, GNSS, nav_b, obs_h, pos); + in_blh = xyz2blh(in_blh, pos.X, pos.Y, pos.Z); + outdata(in_blh, solu, sPRN, GNSS); + fprintf(solu, ">>%05d", (int)(Weeksec-Beginsec)/30+1); + } + }return 0; +} /** * The entrance of function. * @@ -339,6 +397,10 @@ int sat_pos_cal(pobs_head obs_h, pobs_epoch obs_e, pobs_body obs_b, * \param obs_path: The RINEX observation file's path * \param res_path: The satellite position solution output path * \param GNSS: GNSS code + * \param Hangle : + * \param ionopt : + * \param troopt : + * \param genmode: * \return * -1 ,Can not open the nav file * -2 ,Can not open the obs file @@ -356,7 +418,8 @@ double brdm2pos( int GNSS, int Hangle, int ionopt, - int tropopt + int tropopt, + int genmode ) { int satnum, epochnum, result = 0; @@ -413,7 +476,13 @@ double brdm2pos( obs_h->apL = apblh.L; obs_h->apH = apblh.H; - FILE* solu = headerout(obs_h, obs_path, nav_path, res_path); + FILE* solu = headerout(obs_h, genmode, obs_path, nav_path, res_path); + if (genmode == 1) { + sat_cal(nav_b, obs_h, solu, satnum, GNSS); + fprintf(solu, "\nEND"); + fclose(solu); + return 0; + } //Begin to calculate for (int i = 0; i < epochnum; i++) { diff --git a/src/solutions.cpp b/src/solutions.cpp index be3a6a6..544759e 100644 --- a/src/solutions.cpp +++ b/src/solutions.cpp @@ -158,7 +158,7 @@ stations designmat(pobs_head obs_h, acct_obs obs, return sta; } /*Output the header data of satllite position solution*/ -FILE* headerout(pobs_head obs_h, +FILE* headerout(pobs_head obs_h, int mode, char obs_path[MAXPATH], char nav_path[MAXPATH], char res_path[MAXPATH]) { time_t gen_time; @@ -169,7 +169,9 @@ FILE* headerout(pobs_head obs_h, FILE* result_file = fopen(res_path, "a+"); fprintf(result_file, ">GENERATE PROGRAM : KNZ_GeoTrackLab ver%s\n", KNZ_GTL_VER); fprintf(result_file, " GENERATE SOURCE : %.10s\n", obs_h->marker); - fprintf(result_file, " GENERATE TYPE : Satellite Position\n"); + + if (mode != 1); fprintf(result_file, " GENERATE TYPE : Position Resolve\n"); + if (mode == 0); 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_path); fprintf(result_file, " NAV FILE PATH : %s\n", nav_path);