1. be able to calculate the sat pos of BDS & Galileo
2. be able to Single postiting by GPS & Galileo
This commit is contained in:
KenanZhu111 committed 2024-10-14 21:24:01 +08:00
1 parent f29614d834
commit aba6c009ab
13 files changed
+1830 -947

No files matched your search

+40 -22
View File
@@ -4,37 +4,55 @@
#include<math.h>
#include"public.h"
/* -------------------------------------------------------------------------- */
/// @brief 寻找与观测历元最近的卫星广播历元
/// @param SecofWeek 计算得到的观测历元的周内秒
/// @param sPRN 需要匹配的该历元卫星号
/// @param nav_b 导航文件数据块结构体,与卫星号匹配
/// @param satnum 广播星历卫星数量
/// @param syscode 卫星系统代码,详情见PPUBLIC.H
/// @return 返回最佳历元的绝对历元序号
/// @brief find the nearest obs epoch with boardcast
/// @param SecofWeek second of week of obs epoch time
/// @param sPRN the satellite PRN which need to match
/// @param nav_b nav data file structure
/// @param satnum total number of boardcast satellite
/// @param syscode GNSS code, more on PPUBLIC.H
/// @return Return the absolute epoch number of the best epoch
/// When there is no matching satellite number, the function returns -1
/* -------------------------------------------------------------------------- */
extern int select_epoch(double SecofWeek, int sPRN, pnav_body nav_b, int satnum, int syscode)
{
int best_epoch = 0;
double min = 10000;//初始化最小值
int best_epoch = -1;
double min = 10000;//Initialize the minimum value
double Min;
if (syscode == GPS)
{
for (int i = 0; i < satnum; i++)
{
if (sPRN == nav_b[i].sPRN_GPS)
{
Min = fabs(SecofWeek - nav_b[i].TOE);
if (syscode == GPS)//Be judged as GPS
{ for (int i = 0; i < satnum; i++)
{ if (sPRN == nav_b[i].sPRN_GPS)
{ Min = fabs(SecofWeek - nav_b[i].TOE);
if (Min <= min)
{
best_epoch = i;
min = Min;
}
}
}
}
}}}
return best_epoch;}
if (syscode == BDS)//Be judged as BeiDou
{ for (int i = 0; i < satnum; i++)
{ if (sPRN == nav_b[i].sPRN_BDS)
{ Min = fabs(SecofWeek - nav_b[i].TOE);
if (Min <= min)
{
best_epoch = i;
min = Min;
}}}
return best_epoch;}
if (syscode == GAL)//Be judged as Galileo
{for (int i = 0; i < satnum; i++)
{ if (sPRN == nav_b[i].sPRN_GAL)
{ Min = fabs(SecofWeek - nav_b[i].TOE);
if (Min <= min)
{
best_epoch = i;
min = Min;
}}}
return best_epoch;}
return best_epoch;
}
/* --------------------------- END OF SELECT_EPO_H -------------------------- */
#endif