|
@@ -54,12 +54,14 @@ void lct_coordcal_init(LCT_COORDCAL_PARAM_T stLctCoordcalParam)
|
|
|
}
|
|
|
|
|
|
// 计算定位点坐标
|
|
|
+// pstLctBtsList:定位基站队列
|
|
|
+// pstLctDataList:定位数据队列
|
|
|
// pstFirstPathList:第一径数据队列
|
|
|
// pbyPredictionFlag:预测标识符,0:预测失败,1:预测成功
|
|
|
// pstPredictionCoord:预测坐标
|
|
|
// pstMinimumValueGroup:极小值数据组(返回参数)
|
|
|
// pwMinmumValueNum:极小值数量
|
|
|
-void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T *pstFirstPathList, uint8 *pbyPredictionFlag, COORD_T *pstPredictionCoord, LCT_MINIMUM_VALUE_GROUP_T *pstMinimumValueGroup, uint16 *pwMinmumValueNum)
|
|
|
+void lct_coordcal_main(PUB_LCT_BTS_LIST_T *pstLctBtsList, PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T *pstFirstPathList, uint8 *pbyPredictionFlag, COORD_T *pstPredictionCoord, LCT_MINIMUM_VALUE_GROUP_T *pstMinimumValueGroup, uint16 *pwMinmumValueNum)
|
|
|
{
|
|
|
LCT_FIRSTPATH_T *pstFirstPathDataList = pstFirstPathList->astFirstPath; // 第一径队列
|
|
|
uint8 byFirstPathDataListLen = pstFirstPathList->byBtsNum; // 第一径队列长度
|
|
@@ -76,18 +78,19 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
uint8 byPredictionFlag = 0; // 预测成功标识符
|
|
|
COORD_T stPredictionCoord = {0};
|
|
|
COORD_T stAheadPointCoord = {0};
|
|
|
+ uint8 byChangeXY = 0; // 在XY轴上变化大小趋势,1:X轴变化大,2:Y轴变化大
|
|
|
|
|
|
LCT_MINIMUM_VALUE_GROUP_T stMinmumValueGroup = {0}; // 极小值点组
|
|
|
uint16 wMinmumValueNum = 0; // 极小值个数
|
|
|
|
|
|
- // 选择有效基站(过滤第一径跳变和信噪比差的基站)
|
|
|
- lct_coordcal_sel_valid_bts(pstLctDataList, pstFirstPathDataList, byFirstPathDataListLen, astValidCalPathBtsList, &byValidCalPathBtsListLen, astValidTrackPathBtsList, &byValidTrackPathBtsListLen, &dwBuildId, &dwLayerId);
|
|
|
+ // 根据第一径和幅度选择有效基站(过滤第一径跳变和信噪比差的基站)
|
|
|
+ lct_coordcal_select_valid_bts_by_fp_and_ampl(pstLctDataList, pstFirstPathDataList, byFirstPathDataListLen, astValidCalPathBtsList, &byValidCalPathBtsListLen, astValidTrackPathBtsList, &byValidTrackPathBtsListLen, &dwBuildId, &dwLayerId);
|
|
|
|
|
|
// 预测定位坐标
|
|
|
gLct_dwSpeedX = 0; // x轴移动速度
|
|
|
gLct_dwSpeedY = 0; // y轴移动速度
|
|
|
// lct_coordcal_prediction_coord(&stPredictionCoord, &byPredictionFlag, &stAheadPointCoord, dwBuildId, dwLayerId);
|
|
|
- lct_prediction_current_coord_by_history(dwBuildId, dwLayerId, &stPredictionCoord, &byPredictionFlag, &stAheadPointCoord, &gLct_dwSpeedX, &gLct_dwSpeedY);
|
|
|
+ lct_prediction_current_coord_by_history(dwBuildId, dwLayerId, &stPredictionCoord, &byPredictionFlag, &stAheadPointCoord, &gLct_dwSpeedX, &gLct_dwSpeedY, &byChangeXY);
|
|
|
|
|
|
// // 修正预测坐标
|
|
|
// if (byPredictionFlag)
|
|
@@ -97,8 +100,8 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
// *pstPredictionCoord = stPredictionCoord;
|
|
|
// }
|
|
|
|
|
|
- // TODO 预测手机相对于基站的运动趋势(未调试成功)
|
|
|
- // lct_prediction_prediction_phone_move_tendency(gLct_astPredictionDirectionDataList);
|
|
|
+ // 预测手机相对于基站的移动趋势,1:靠近趋势,2:远离趋势,0:趋势不确定
|
|
|
+ lct_prediction_prediction_phone_move_tendency(gLct_astPredictionDirectionDataList);
|
|
|
|
|
|
// 预测定位坐标失败
|
|
|
if (!byPredictionFlag)
|
|
@@ -111,9 +114,9 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
|
|
|
////2维定位
|
|
|
// 计算径
|
|
|
- lct_coordcal_two_dimension_location(astValidCalPathBtsList, byValidCalPathBtsListLen, byPredictionFlag, stPredictionCoord, CAL_PATH, &stMinmumValueGroup);
|
|
|
+ lct_coordcal_two_dimension_location(pstLctBtsList, astValidCalPathBtsList, byValidCalPathBtsListLen, byPredictionFlag, stPredictionCoord, CAL_PATH, &stMinmumValueGroup);
|
|
|
// 跟踪径
|
|
|
- lct_coordcal_two_dimension_location(astValidTrackPathBtsList, byValidTrackPathBtsListLen, byPredictionFlag, stPredictionCoord, TRACK_PATH, &stMinmumValueGroup);
|
|
|
+ lct_coordcal_two_dimension_location(pstLctBtsList, astValidTrackPathBtsList, byValidTrackPathBtsListLen, byPredictionFlag, stPredictionCoord, TRACK_PATH, &stMinmumValueGroup);
|
|
|
}
|
|
|
// 预测定位坐标成功
|
|
|
else
|
|
@@ -127,7 +130,7 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
// 预测手机分别在x轴和y轴上的移动方向
|
|
|
gLct_byDirectionX = 0; // x轴移动方向,1:向右移动,-1向左移动
|
|
|
gLct_byDirectionY = 0; // y轴移动方向,1:向上移动,-1向下移动
|
|
|
- lct_coordcal_prediction_x_y_move_direction(pstFirstPathDataList, byFirstPathDataListLen, gLct_astPredictionDirectionDataList, &gLct_byDirectionX, &gLct_byDirectionY);
|
|
|
+ lct_coordcal_prediction_x_y_move_direction(pstFirstPathDataList, byFirstPathDataListLen, gLct_astPredictionDirectionDataList, &stAheadPointCoord, byChangeXY, &gLct_byDirectionX, &gLct_byDirectionY);
|
|
|
// lct_prediction_prediction_phone_x_y_move_direction(gLct_astPredictionDirectionDataList, stAheadPointCoord, &gLct_byDirectionX, &gLct_byDirectionY);
|
|
|
|
|
|
// 根据手机移动方向修正预测坐标
|
|
@@ -141,12 +144,14 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
|
|
|
////二维定位
|
|
|
// 计算径
|
|
|
- lct_coordcal_two_dimension_location(astValidCalPathBtsList, byValidCalPathBtsListLen, byPredictionFlag, stPredictionCoord, 0, &stMinmumValueGroup);
|
|
|
+ lct_coordcal_check_valid_bts_by_move_direction(CAL_PATH, astValidCalPathBtsList, byValidCalPathBtsListLen, pstLctDataList, &stAheadPointCoord, byChangeXY, gLct_byDirectionX, gLct_byDirectionY, &byValidCalPathBtsListLen);
|
|
|
+ lct_coordcal_two_dimension_location(pstLctBtsList, astValidCalPathBtsList, byValidCalPathBtsListLen, byPredictionFlag, stPredictionCoord, 0, &stMinmumValueGroup);
|
|
|
// 跟踪径
|
|
|
- lct_coordcal_two_dimension_location(astValidTrackPathBtsList, byValidTrackPathBtsListLen, byPredictionFlag, stPredictionCoord, 1, &stMinmumValueGroup);
|
|
|
+ lct_coordcal_check_valid_bts_by_move_direction(TRACK_PATH, astValidTrackPathBtsList, byValidTrackPathBtsListLen, pstLctDataList, &stAheadPointCoord, byChangeXY, gLct_byDirectionX, gLct_byDirectionY, &byValidTrackPathBtsListLen);
|
|
|
+ lct_coordcal_two_dimension_location(pstLctBtsList, astValidTrackPathBtsList, byValidTrackPathBtsListLen, byPredictionFlag, stPredictionCoord, 1, &stMinmumValueGroup);
|
|
|
|
|
|
- // 校验二维定位的极小值
|
|
|
- lct_coordcal_two_dimension_check(&stMinmumValueGroup, &stPredictionCoord, &stAheadPointCoord, gLct_byDirectionX, gLct_byDirectionY);
|
|
|
+ // TODO 校验二维定位的极小值
|
|
|
+ lct_coordcal_two_dimension_check(&stMinmumValueGroup, &stPredictionCoord, &stAheadPointCoord, byChangeXY, gLct_byDirectionX, gLct_byDirectionY);
|
|
|
}
|
|
|
|
|
|
// 没有极小值,则使用预测坐标
|
|
@@ -167,13 +172,13 @@ void lct_coordcal_main(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_LIST_T
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-// 生成基站可用列表(去除第一径有跳变情况的基站,前后两次第一径索引差超过跳变门限即为跳变,该基站不可用)
|
|
|
+// 根据第一径和幅度选择有效基站列表(去除第一径有跳变情况的基站,前后两次第一径索引差超过跳变门限即为跳变,该基站不可用)
|
|
|
// pstFirstPathList:第一径参数列表
|
|
|
// byFirstPathListLen:第一径参数列表长度
|
|
|
// pstValidBtsList:有效基站第一径参数列表(返回参数)
|
|
|
// pbyValidBtsListLen:有效基站参数列表长度(返回参数)
|
|
|
// 返回值,1:成功,0:失败
|
|
|
-void lct_coordcal_sel_valid_bts(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_T *pstValidCalBtsList, uint8 *pbyValidCalBtsListLen, LCT_FIRSTPATH_T *pstValidTrackBtsList, uint8 *pbyValidTrackBtsListLen, int32 *pdwBulidId, int32 *pdwLayerId)
|
|
|
+void lct_coordcal_select_valid_bts_by_fp_and_ampl(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_T *pstValidCalBtsList, uint8 *pbyValidCalBtsListLen, LCT_FIRSTPATH_T *pstValidTrackBtsList, uint8 *pbyValidTrackBtsListLen, int32 *pdwBulidId, int32 *pdwLayerId)
|
|
|
{
|
|
|
LCT_FIRSTPATH_T stBtsFirstPath = {0};
|
|
|
LCT_FIRSTPATH_T *pststBtsFirstPath = NULL;
|
|
@@ -357,6 +362,311 @@ void lct_coordcal_sel_valid_bts(PUB_LOCATION_DATA_T *pstLctDataList, LCT_FIRSTPA
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+// 根据移动方向校验有效绩效
|
|
|
+// byFirstPathType:第一径类型
|
|
|
+// pstValidBtsList:有效基站队列
|
|
|
+// byValidBtsListLen:有效基站队列长度
|
|
|
+// pstAheadCoord:前一点定位坐标
|
|
|
+// byChangeXY:在XY轴上变化大小趋势,1:X轴变化大,2:Y轴变化大
|
|
|
+// byDirectionX:在X轴上的移动方向,1:向右,-1:向左
|
|
|
+// byDirectionY:在Y轴上的移动方向,1:向上,-1:向下
|
|
|
+// pbyValidBtsListLen:返回值,有效基站队列长度
|
|
|
+void lct_coordcal_check_valid_bts_by_move_direction(uint8 byFirstPathType, LCT_FIRSTPATH_T *pstValidBtsList, uint8 byValidBtsListLen, PUB_LOCATION_DATA_T *pstLctDataList, COORD_T *pstAheadCoord, uint8 byChangeXY, int8 byDirectionX, int8 byDirectionY, uint8 *pbyValidBtsListLen)
|
|
|
+{
|
|
|
+ LCT_FIRSTPATH_T *pstBtsFirstPath = NULL;
|
|
|
+ uint8 byFreqIndex = 0;
|
|
|
+ PUB_LOCATION_DATA_T *pstBtsLctData = NULL;
|
|
|
+ int32 dwGap = 0;
|
|
|
+
|
|
|
+ if (byDirectionX != 0 || byDirectionY != 0)
|
|
|
+ {
|
|
|
+ for (uint8 i = 0; i < byValidBtsListLen; i++)
|
|
|
+ {
|
|
|
+ pstBtsFirstPath = &pstValidBtsList[i]; // 第一径数据
|
|
|
+ byFreqIndex = pstBtsFirstPath->byFreqIndex; // 基站频率
|
|
|
+ pstBtsLctData = &pstLctDataList[byFreqIndex]; // 定位数据
|
|
|
+
|
|
|
+ // 在X轴上变化趋势较大
|
|
|
+ if (byChangeXY == 1)
|
|
|
+ {
|
|
|
+ // 定位点在基站右侧
|
|
|
+ if (pstAheadCoord->dwX > pstBtsFirstPath->dwCoordX)
|
|
|
+ {
|
|
|
+ // 向右移动,远离基站
|
|
|
+ if (byDirectionX == 1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ // 100点,表示有70cm的变动
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 向左移动,靠近基站
|
|
|
+ else if (byDirectionX == -1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 定位点在基站左侧
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 向右移动,靠近基站
|
|
|
+ if (byDirectionX == 1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 向左移动,远离基站
|
|
|
+ else if (byDirectionX == -1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 在Y轴上变化趋势较大
|
|
|
+ else if (byChangeXY == 2)
|
|
|
+ {
|
|
|
+ // 定位点在基站上方
|
|
|
+ if (pstAheadCoord->dwY > pstBtsFirstPath->dwCoordY)
|
|
|
+ {
|
|
|
+ // 向上移动,远离基站
|
|
|
+ if (byDirectionY == 1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 向下移动,靠近基站
|
|
|
+ else if (byDirectionY == -1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 定位点在基站下方
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 向上移动,靠近基站
|
|
|
+ if (byDirectionY == 1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex > pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex -= dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex - dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 向下移动,远离基站
|
|
|
+ else if (byDirectionY == -1)
|
|
|
+ {
|
|
|
+ if (byFirstPathType == CAL_PATH)
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameCalIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameCalIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwCalPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameCalIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pstBtsLctData->wAheadFrameTrackPathIndex && pstBtsFirstPath->wFrameTrackIndex < pstBtsLctData->wAheadFrameTrackPathIndex)
|
|
|
+ {
|
|
|
+ dwGap = pstBtsFirstPath->wFrameTrackIndex - pstBtsLctData->wAheadFrameTrackPathIndex;
|
|
|
+ dwGap = abs(dwGap);
|
|
|
+ if (dwGap > LCT_COORDCAL_FIRSTPATH_ADJUST_THRES)
|
|
|
+ {
|
|
|
+ dwGap = LCT_COORDCAL_FIRSTPATH_ADJUST_VALUE;
|
|
|
+ pstBtsFirstPath->dwTrackPathIndex += dwGap;
|
|
|
+ pstBtsFirstPath->wFrameTrackIndex = pstBtsLctData->wAheadFrameTrackPathIndex + dwGap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ *pbyValidBtsListLen = byValidBtsListLen; // 有效基站数量
|
|
|
+
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
// 预测坐标
|
|
|
// pstPredictionCoord:预测坐标
|
|
|
// pbyPredictionFlag:预测标识,0:预测失败,1:预测成功
|
|
@@ -458,7 +768,7 @@ void lct_coordcal_check_move_tendency(LCT_FIRSTPATH_T *pstFirstPathList, uint8 b
|
|
|
fDistancP = util_distance_cal_p2p_distance(pstFirstPathData->dwCoordX, pstFirstPathData->dwCoordY, pstPredictionCoord->dwX, pstPredictionCoord->dwY);
|
|
|
fDistancA = util_distance_cal_p2p_distance(pstFirstPathData->dwCoordX, pstFirstPathData->dwCoordY, pstAheadCoord->dwX, pstAheadCoord->dwY);
|
|
|
|
|
|
- // 预测点接近基站
|
|
|
+ // 预测点更接近基站
|
|
|
if (fDistancP < fDistancA)
|
|
|
{
|
|
|
if (pstBtsDirectionData->byDirectionTendency != 1)
|
|
@@ -481,18 +791,363 @@ void lct_coordcal_check_move_tendency(LCT_FIRSTPATH_T *pstFirstPathList, uint8 b
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// // 预测XY轴移动方向
|
|
|
+// // pstFirstPathList:第一径数据队列
|
|
|
+// // byFirstPathListLen:第一径数据队列长度
|
|
|
+// // pstPredictionDirectionDataList:预测移动方向的数据队列
|
|
|
+// // pbyDirectionX:X轴预测方向,返回参数,1:向右,-1:向左
|
|
|
+// // pbyDirectionY:Y轴预测方向,返回参数,1:向上,-1:向下
|
|
|
+// void lct_coordcal_prediction_x_y_move_direction(LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstPredictionDirectionDataList, int8 *pbyDirectionX, int8 *pbyDirectionY)
|
|
|
+// {
|
|
|
+// LCT_COORDSEL_MEAN_COORD_T *pstMeanLctCoordList = &gLct_stMeanLctCoordList;
|
|
|
+// uint8 byListLen = pstMeanLctCoordList->byListLen;
|
|
|
+// COORD_T stAheadCoord = {0};
|
|
|
+
|
|
|
+// LCT_FIRSTPATH_T *pstFirstPathData = NULL;
|
|
|
+// uint8 byFreqIndex = 0;
|
|
|
+// LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstCurrentBtsDirectionData = NULL; // 当前基站方向预测数据
|
|
|
+
|
|
|
+// LCT_FIRSTPATH_T *pstOtherFirstPathData = NULL;
|
|
|
+// uint8 byOtherFreqIndex = 0;
|
|
|
+// LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstOtherBtstDirectionData = NULL; // 其它基站方向预测数据
|
|
|
+
|
|
|
+// int32 dwCurrentX = 0;
|
|
|
+// int32 dwCurrentY = 0;
|
|
|
+// uint32 dwCurrentIndex = 0;
|
|
|
+
|
|
|
+// int32 dwOtherX = 0;
|
|
|
+// int32 dwOtherY = 0;
|
|
|
+// uint32 dwOtherIndex = 0;
|
|
|
+
|
|
|
+// int8 byDirectionX = 0; // X轴预测标识符
|
|
|
+// int8 byDirectionY = 0; // Y轴预测标识符
|
|
|
+
|
|
|
+// // 方向预测次数
|
|
|
+// uint8 byCounterPlusX = 0;
|
|
|
+// uint8 byCounterMinusX = 0;
|
|
|
+// uint8 byCounterPlusY = 0;
|
|
|
+// uint8 byCounterMinusY = 0;
|
|
|
+
|
|
|
+// // 参数容错
|
|
|
+// if (byListLen < 1)
|
|
|
+// {
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// stAheadCoord = pstMeanLctCoordList->astCoordList[byListLen - 1];
|
|
|
+
|
|
|
+// // 预测方向
|
|
|
+// for (uint8 i = 0; i < byFirstPathListLen; i++)
|
|
|
+// {
|
|
|
+// pstFirstPathData = &pstFirstPathList[i];
|
|
|
+// byFreqIndex = pstFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
+
|
|
|
+// // 当前基站预测数据
|
|
|
+// pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+// dwCurrentX = pstCurrentBtsDirectionData->dwCoordX;
|
|
|
+// dwCurrentY = pstCurrentBtsDirectionData->dwCoordY;
|
|
|
+// dwCurrentIndex = pstCurrentBtsDirectionData->dwCalPathIndex;
|
|
|
+
|
|
|
+// // 当前站方向趋势有效
|
|
|
+// if (pstCurrentBtsDirectionData->byValidFlag == 1)
|
|
|
+// {
|
|
|
+// for (uint8 j = i + 1; j < byFirstPathListLen; j++)
|
|
|
+// {
|
|
|
+// // 其它基站预测数据
|
|
|
+// pstOtherFirstPathData = &pstFirstPathList[j];
|
|
|
+// byOtherFreqIndex = pstOtherFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
+// pstOtherBtstDirectionData = &pstPredictionDirectionDataList[byOtherFreqIndex];
|
|
|
+
|
|
|
+// // 其它站方向趋势有效
|
|
|
+// if (pstOtherBtstDirectionData->byValidFlag == 1)
|
|
|
+// {
|
|
|
+// dwOtherX = pstOtherBtstDirectionData->dwCoordX;
|
|
|
+// dwOtherY = pstOtherBtstDirectionData->dwCoordY;
|
|
|
+// dwOtherIndex = pstOtherBtstDirectionData->dwCalPathIndex;
|
|
|
+
|
|
|
+// // 靠近当前站
|
|
|
+// if (pstCurrentBtsDirectionData->byDirectionTendency == 1)
|
|
|
+// {
|
|
|
+// // 靠近当前站,同时也靠近其它基站
|
|
|
+// if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
+// {
|
|
|
+// // 其它基站在当前基站右侧
|
|
|
+// if (dwOtherX > dwCurrentX)
|
|
|
+// {
|
|
|
+// if (dwOtherIndex > dwCurrentIndex)
|
|
|
+// {
|
|
|
+// byCounterPlusX++;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byCounterMinusX++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 其它基站在当前基站左侧
|
|
|
+// else if (dwOtherX < dwCurrentX)
|
|
|
+// {
|
|
|
+// if (dwOtherIndex > dwCurrentIndex)
|
|
|
+// {
|
|
|
+// byCounterMinusX++;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byCounterPlusX++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// // 其它基站在当前基站上方
|
|
|
+// if (dwOtherY > dwCurrentY)
|
|
|
+// {
|
|
|
+// if (dwOtherIndex > dwCurrentIndex)
|
|
|
+// {
|
|
|
+// byCounterPlusY++;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byCounterMinusY++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 其它基站在当前基站下方
|
|
|
+// else if (dwOtherY < dwCurrentY)
|
|
|
+// {
|
|
|
+// if (dwOtherIndex > dwCurrentIndex)
|
|
|
+// {
|
|
|
+// byCounterMinusY++;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byCounterPlusY++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 其它基站与当前基站Y坐标相同
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionY = 0; // 错误
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 靠近当前站,远离其它基站
|
|
|
+// else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
+// {
|
|
|
+// // 其它基站在当前基站右侧
|
|
|
+// if (dwOtherX > dwCurrentX)
|
|
|
+// {
|
|
|
+// byCounterMinusX++;
|
|
|
+// }
|
|
|
+// // 其它基站在当前基站左侧
|
|
|
+// else if (dwOtherX < dwCurrentX)
|
|
|
+// {
|
|
|
+// byDirectionX = 1;
|
|
|
+// }
|
|
|
+// // 其它基站与当前基站X坐标相同
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionX = 0; // 错误
|
|
|
+// }
|
|
|
+
|
|
|
+// // 其它基站在当前基站上方
|
|
|
+// if (dwOtherY > dwCurrentY)
|
|
|
+// {
|
|
|
+// byCounterMinusY++;
|
|
|
+// }
|
|
|
+// // 其它基站在当前基站下方
|
|
|
+// else if (dwOtherY < dwCurrentY)
|
|
|
+// {
|
|
|
+// byCounterPlusY++;
|
|
|
+// }
|
|
|
+// // 其它基站与当前基站Y坐标相同
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionY = 0; // 错误
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 远离当前站
|
|
|
+// else if (pstCurrentBtsDirectionData->byDirectionTendency == 2)
|
|
|
+// {
|
|
|
+// // 远离当前站,靠近其它基站
|
|
|
+// if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
+// {
|
|
|
+// // 其它基站在当前基站右侧
|
|
|
+// if (dwOtherX > dwCurrentX)
|
|
|
+// {
|
|
|
+// byCounterPlusX++;
|
|
|
+// }
|
|
|
+// // 其它基站在当前基站左侧
|
|
|
+// else if (dwOtherX < dwCurrentX)
|
|
|
+// {
|
|
|
+// byCounterMinusX++;
|
|
|
+// }
|
|
|
+// // 其它基站与当前基站X坐标相同
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionX = 0; // 错误
|
|
|
+// }
|
|
|
+
|
|
|
+// // 其它基站在当前基站上方
|
|
|
+// if (dwOtherY > dwCurrentY)
|
|
|
+// {
|
|
|
+// byCounterPlusY++;
|
|
|
+// }
|
|
|
+// // 其它基站在当前基站下方
|
|
|
+// else if (dwOtherY < dwCurrentY)
|
|
|
+// {
|
|
|
+// byCounterMinusY++;
|
|
|
+// }
|
|
|
+// // 其它基站与当前基站Y坐标相同
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionY = 0; // 错误
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 远离当前站,同时远离其它基站
|
|
|
+// else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
+// {
|
|
|
+// // 其它基站在当前基站右侧
|
|
|
+// if (dwOtherX > dwCurrentX)
|
|
|
+// {
|
|
|
+// if (dwOtherIndex > dwCurrentIndex)
|
|
|
+// {
|
|
|
+// byCounterMinusX++;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byCounterPlusX++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 其它基站在当前基站左侧
|
|
|
+// else if (dwOtherX < dwCurrentX)
|
|
|
+// {
|
|
|
+// if (dwOtherIndex > dwCurrentIndex)
|
|
|
+// {
|
|
|
+// byCounterPlusX++;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byCounterMinusX++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 其它基站与当前基站X坐标相同
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionX = 0; // 错误
|
|
|
+// }
|
|
|
+
|
|
|
+// // 其它基站在当前基站上方
|
|
|
+// if (dwOtherY > dwCurrentY)
|
|
|
+// {
|
|
|
+// if (dwOtherIndex > dwCurrentIndex)
|
|
|
+// {
|
|
|
+// byCounterMinusY++;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byCounterPlusY++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 其它基站在当前基站下方
|
|
|
+// else if (dwOtherY < dwCurrentY)
|
|
|
+// {
|
|
|
+// if (dwOtherIndex > dwCurrentIndex)
|
|
|
+// {
|
|
|
+// byCounterPlusY++;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byCounterMinusY++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 其它基站与当前基站Y坐标相同
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionY = 0; // 错误
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// if (byCounterPlusX != 0 || byCounterMinusX != 0 || byCounterPlusY != 0 || byCounterMinusY != 0)
|
|
|
+// {
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// // 方向预测失败
|
|
|
+// if (byCounterPlusX == 0 && byCounterMinusX == 0 && byCounterPlusY == 0 && byCounterMinusY == 0)
|
|
|
+// {
|
|
|
+// *pbyDirectionX = 0;
|
|
|
+// *pbyDirectionY = 0;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// if (byCounterPlusX > byCounterMinusX)
|
|
|
+// {
|
|
|
+// byDirectionX = 1;
|
|
|
+// }
|
|
|
+// else if (byCounterPlusX < byCounterMinusX)
|
|
|
+// {
|
|
|
+// byDirectionX = -1;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionX = 0; // 不成功
|
|
|
+// }
|
|
|
+
|
|
|
+// if (byCounterPlusY > byCounterMinusY)
|
|
|
+// {
|
|
|
+// byDirectionY = 1;
|
|
|
+// }
|
|
|
+// else if (byCounterPlusY < byCounterMinusY)
|
|
|
+// {
|
|
|
+// byDirectionY = -1;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// byDirectionY = 0; // 不成功
|
|
|
+// }
|
|
|
+
|
|
|
+// *pbyDirectionX = byDirectionX;
|
|
|
+// *pbyDirectionY = byDirectionY;
|
|
|
+// }
|
|
|
+
|
|
|
+// // // 修正移动方向
|
|
|
+// // if (byDirectionX == 0 && byDirectionY == 0)
|
|
|
+// // {
|
|
|
+// // if (gLct_dwSpeedX < 0)
|
|
|
+// // {
|
|
|
+// // byDirectionX = -1;
|
|
|
+// // }
|
|
|
+// // else if (gLct_dwSpeedX > 0)
|
|
|
+// // {
|
|
|
+// // byDirectionX = 1;
|
|
|
+// // }
|
|
|
+
|
|
|
+// // if (gLct_dwSpeedY < 0)
|
|
|
+// // {
|
|
|
+// // byDirectionY = -1;
|
|
|
+// // }
|
|
|
+// // else if (gLct_dwSpeedY > 0)
|
|
|
+// // {
|
|
|
+// // byDirectionY = 1;
|
|
|
+// // }
|
|
|
+
|
|
|
+// // *pbyDirectionX = byDirectionX;
|
|
|
+// // *pbyDirectionY = byDirectionY;
|
|
|
+// // }
|
|
|
+
|
|
|
+// return;
|
|
|
+// }
|
|
|
+
|
|
|
// 预测XY轴移动方向
|
|
|
// pstFirstPathList:第一径数据队列
|
|
|
// byFirstPathListLen:第一径数据队列长度
|
|
|
// pstPredictionDirectionDataList:预测移动方向的数据队列
|
|
|
+// byChangeXY:在XY轴上变化大小趋势,1:X轴变化大,2:Y轴变化大
|
|
|
// pbyDirectionX:X轴预测方向,返回参数,1:向右,-1:向左
|
|
|
// pbyDirectionY:Y轴预测方向,返回参数,1:向上,-1:向下
|
|
|
-void lct_coordcal_prediction_x_y_move_direction(LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstPredictionDirectionDataList, int8 *pbyDirectionX, int8 *pbyDirectionY)
|
|
|
+void lct_coordcal_prediction_x_y_move_direction(LCT_FIRSTPATH_T *pstFirstPathList, uint8 byFirstPathListLen, LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstPredictionDirectionDataList, COORD_T *pstAheadCoord, uint8 byChangeXY, int8 *pbyDirectionX, int8 *pbyDirectionY)
|
|
|
{
|
|
|
- LCT_COORDSEL_MEAN_COORD_T *pstMeanLctCoordList = &gLct_stMeanLctCoordList;
|
|
|
- uint8 byListLen = pstMeanLctCoordList->byListLen;
|
|
|
- COORD_T stAheadCoord = {0};
|
|
|
-
|
|
|
LCT_FIRSTPATH_T *pstFirstPathData = NULL;
|
|
|
uint8 byFreqIndex = 0;
|
|
|
LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstCurrentBtsDirectionData = NULL; // 当前基站方向预测数据
|
|
@@ -501,306 +1156,297 @@ void lct_coordcal_prediction_x_y_move_direction(LCT_FIRSTPATH_T *pstFirstPathLis
|
|
|
uint8 byOtherFreqIndex = 0;
|
|
|
LCT_FIRSTPATH_PREDICTION_DIRECTION_DATA_T *pstOtherBtstDirectionData = NULL; // 其它基站方向预测数据
|
|
|
|
|
|
+ // 主站
|
|
|
int32 dwCurrentX = 0;
|
|
|
int32 dwCurrentY = 0;
|
|
|
- uint32 dwCurrentIndex = 0;
|
|
|
-
|
|
|
+ int8 byMainDirectionX = 0; // 主站X轴预测标识符,-1:向左,1:向右,0:不确定
|
|
|
+ int8 byMainDirectionY = 0; // 主站Y轴预测标识符,-1:向下,1:向上,0:不确定
|
|
|
+ uint8 byMainDirectionXCounter = 0; // 主站方向预测正确计数器
|
|
|
+ uint8 byMainDirectionYCounter = 0; // 主站方向预测正确计数器
|
|
|
+ uint8 byFirstPathIndexX = 0;
|
|
|
+ uint8 byFirstPathIndexY = 0;
|
|
|
+
|
|
|
+ // 从站
|
|
|
int32 dwOtherX = 0;
|
|
|
int32 dwOtherY = 0;
|
|
|
- uint32 dwOtherIndex = 0;
|
|
|
-
|
|
|
- int8 byDirectionX = 0; // X轴预测标识符
|
|
|
- int8 byDirectionY = 0; // Y轴预测标识符
|
|
|
-
|
|
|
- // 方向预测次数
|
|
|
- uint8 byCounterPlusX = 0;
|
|
|
- uint8 byCounterMinusX = 0;
|
|
|
- uint8 byCounterPlusY = 0;
|
|
|
- uint8 byCounterMinusY = 0;
|
|
|
-
|
|
|
- // 参数容错
|
|
|
- if (byListLen < 1)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- stAheadCoord = pstMeanLctCoordList->astCoordList[byListLen - 1];
|
|
|
|
|
|
// 预测方向
|
|
|
for (uint8 i = 0; i < byFirstPathListLen; i++)
|
|
|
{
|
|
|
- pstFirstPathData = &pstFirstPathList[i];
|
|
|
+ pstFirstPathData = &pstFirstPathList[i]; // 第一径数据
|
|
|
byFreqIndex = pstFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
|
|
|
// 当前基站预测数据
|
|
|
pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ pstCurrentBtsDirectionData->byDirectionX = 0;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionY = 0;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionXCounter = 0;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionYCounter = 0;
|
|
|
dwCurrentX = pstCurrentBtsDirectionData->dwCoordX;
|
|
|
dwCurrentY = pstCurrentBtsDirectionData->dwCoordY;
|
|
|
- dwCurrentIndex = pstCurrentBtsDirectionData->dwCalPathIndex;
|
|
|
|
|
|
// 当前站方向趋势有效
|
|
|
if (pstCurrentBtsDirectionData->byValidFlag == 1)
|
|
|
{
|
|
|
- for (uint8 j = i + 1; j < byFirstPathListLen; j++)
|
|
|
- {
|
|
|
- // 其它基站预测数据
|
|
|
- pstOtherFirstPathData = &pstFirstPathList[j];
|
|
|
- byOtherFreqIndex = pstOtherFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
- pstOtherBtstDirectionData = &pstPredictionDirectionDataList[byOtherFreqIndex];
|
|
|
+ // 基站手机相对于主站在x和y轴上的移动方向
|
|
|
+ lct_coordcal_cal_bts_move_direction(pstCurrentBtsDirectionData->byDirectionTendency, dwCurrentX, dwCurrentY, pstAheadCoord, &byMainDirectionX, &byMainDirectionY);
|
|
|
|
|
|
- // 其它站方向趋势有效
|
|
|
- if (pstOtherBtstDirectionData->byValidFlag == 1)
|
|
|
+ // 利用从站校验主站的移动方向正确性
|
|
|
+ for (uint8 j = 0; j < byFirstPathListLen; j++)
|
|
|
+ {
|
|
|
+ if (i != j)
|
|
|
{
|
|
|
- dwOtherX = pstOtherBtstDirectionData->dwCoordX;
|
|
|
- dwOtherY = pstOtherBtstDirectionData->dwCoordY;
|
|
|
- dwOtherIndex = pstOtherBtstDirectionData->dwCalPathIndex;
|
|
|
+ // 其它基站预测数据
|
|
|
+ pstOtherFirstPathData = &pstFirstPathList[j];
|
|
|
+ byOtherFreqIndex = pstOtherFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
+ pstOtherBtstDirectionData = &pstPredictionDirectionDataList[byOtherFreqIndex];
|
|
|
|
|
|
- // 靠近当前站
|
|
|
- if (pstCurrentBtsDirectionData->byDirectionTendency == 1)
|
|
|
+ // 其它站方向趋势有效
|
|
|
+ if (pstOtherBtstDirectionData->byValidFlag == 1)
|
|
|
{
|
|
|
- // 靠近当前站,同时也靠近其它基站
|
|
|
- if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
+ dwOtherX = pstOtherBtstDirectionData->dwCoordX;
|
|
|
+ dwOtherY = pstOtherBtstDirectionData->dwCoordY;
|
|
|
+
|
|
|
+ //// 用从站的趋势校验主站的运动方向
|
|
|
+ // 主站X轴向右移动
|
|
|
+ if (byMainDirectionX == 1)
|
|
|
{
|
|
|
- // 其它基站在当前基站右侧
|
|
|
- if (dwOtherX > dwCurrentX)
|
|
|
+ // 手机靠近从站
|
|
|
+ if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterPlusX++;
|
|
|
- }
|
|
|
- else
|
|
|
+ // TODO,条件已经检查过,不需要再修改
|
|
|
+ if ((dwOtherX > dwCurrentX && pstAheadCoord->dwX < dwOtherX) || (dwOtherX <= dwCurrentX && pstAheadCoord->dwX < dwOtherX))
|
|
|
{
|
|
|
- byCounterMinusX++;
|
|
|
+ byMainDirectionXCounter++;
|
|
|
}
|
|
|
}
|
|
|
- // 其它基站在当前基站左侧
|
|
|
- else if (dwOtherX < dwCurrentX)
|
|
|
+ // 手机远离从站
|
|
|
+ else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterMinusX++;
|
|
|
- }
|
|
|
- else
|
|
|
+ // TODO,条件已经检查过,不需要再修改
|
|
|
+ if ((dwOtherX < dwCurrentX && pstAheadCoord->dwX >= dwOtherX) || (dwOtherX >= dwCurrentX && pstAheadCoord->dwX >= dwOtherX))
|
|
|
{
|
|
|
- byCounterPlusX++;
|
|
|
+ byMainDirectionXCounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // 其它基站在当前基站上方
|
|
|
- if (dwOtherY > dwCurrentY)
|
|
|
+ }
|
|
|
+ // 主站X轴向左移动
|
|
|
+ else if (byMainDirectionX == -1)
|
|
|
+ {
|
|
|
+ // 手机靠近从站
|
|
|
+ if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
- else
|
|
|
+ // TODO,条件已经检查过,不需要再修改
|
|
|
+ if ((dwOtherX < dwCurrentX && pstAheadCoord->dwX > dwOtherX) || (dwOtherX >= dwCurrentX && pstAheadCoord->dwX > dwOtherX))
|
|
|
{
|
|
|
- byCounterMinusY++;
|
|
|
+ byMainDirectionXCounter++;
|
|
|
}
|
|
|
}
|
|
|
- // 其它基站在当前基站下方
|
|
|
- else if (dwOtherY < dwCurrentY)
|
|
|
+ // 手机远离从站
|
|
|
+ else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
+ // TODO,条件已经检查过,不需要再修改
|
|
|
+ if ((dwOtherX >= dwCurrentX && pstAheadCoord->dwX <= dwOtherX) || (dwOtherX <= dwCurrentX && pstAheadCoord->dwX <= dwOtherX))
|
|
|
{
|
|
|
- byCounterMinusY++;
|
|
|
+ byMainDirectionXCounter++;
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
- }
|
|
|
- // 其它基站与当前基站Y坐标相同
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionY = 0; // 错误
|
|
|
}
|
|
|
}
|
|
|
- // 靠近当前站,远离其它基站
|
|
|
- else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
- {
|
|
|
- // 其它基站在当前基站右侧
|
|
|
- if (dwOtherX > dwCurrentX)
|
|
|
- {
|
|
|
- byCounterMinusX++;
|
|
|
- }
|
|
|
- // 其它基站在当前基站左侧
|
|
|
- else if (dwOtherX < dwCurrentX)
|
|
|
- {
|
|
|
- byDirectionX = 1;
|
|
|
- }
|
|
|
- // 其它基站与当前基站X坐标相同
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionX = 0; // 错误
|
|
|
- }
|
|
|
-
|
|
|
- // 其它基站在当前基站上方
|
|
|
- if (dwOtherY > dwCurrentY)
|
|
|
- {
|
|
|
- byCounterMinusY++;
|
|
|
- }
|
|
|
- // 其它基站在当前基站下方
|
|
|
- else if (dwOtherY < dwCurrentY)
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
- // 其它基站与当前基站Y坐标相同
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionY = 0; // 错误
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 远离当前站
|
|
|
- else if (pstCurrentBtsDirectionData->byDirectionTendency == 2)
|
|
|
- {
|
|
|
- // 远离当前站,靠近其它基站
|
|
|
- if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
- {
|
|
|
- // 其它基站在当前基站右侧
|
|
|
- if (dwOtherX > dwCurrentX)
|
|
|
- {
|
|
|
- byCounterPlusX++;
|
|
|
- }
|
|
|
- // 其它基站在当前基站左侧
|
|
|
- else if (dwOtherX < dwCurrentX)
|
|
|
- {
|
|
|
- byCounterMinusX++;
|
|
|
- }
|
|
|
- // 其它基站与当前基站X坐标相同
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionX = 0; // 错误
|
|
|
- }
|
|
|
|
|
|
- // 其它基站在当前基站上方
|
|
|
- if (dwOtherY > dwCurrentY)
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
- // 其它基站在当前基站下方
|
|
|
- else if (dwOtherY < dwCurrentY)
|
|
|
- {
|
|
|
- byCounterMinusY++;
|
|
|
- }
|
|
|
- // 其它基站与当前基站Y坐标相同
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionY = 0; // 错误
|
|
|
- }
|
|
|
- }
|
|
|
- // 远离当前站,同时远离其它基站
|
|
|
- else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
+ // 主站Y轴向上移动
|
|
|
+ if (byMainDirectionY == 1)
|
|
|
{
|
|
|
- // 其它基站在当前基站右侧
|
|
|
- if (dwOtherX > dwCurrentX)
|
|
|
+ // 手机靠近从站
|
|
|
+ if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterMinusX++;
|
|
|
- }
|
|
|
- else
|
|
|
+ // TODO,条件已经检查过,不需要再修改
|
|
|
+ if ((dwOtherY > dwCurrentY && pstAheadCoord->dwY < dwOtherY) || (dwOtherY <= dwCurrentY && pstAheadCoord->dwY < dwOtherY))
|
|
|
{
|
|
|
- byCounterPlusX++;
|
|
|
+ byMainDirectionYCounter++;
|
|
|
}
|
|
|
}
|
|
|
- // 其它基站在当前基站左侧
|
|
|
- else if (dwOtherX < dwCurrentX)
|
|
|
+ // 手机远离从站
|
|
|
+ else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterPlusX++;
|
|
|
- }
|
|
|
- else
|
|
|
+ // TODO,条件已经检查过,不需要再修改
|
|
|
+ if ((dwOtherY <= dwCurrentY && pstAheadCoord->dwY >= dwOtherY) || (dwOtherY >= dwCurrentY && pstAheadCoord->dwY >= dwOtherY))
|
|
|
{
|
|
|
- byCounterMinusX++;
|
|
|
+ byMainDirectionYCounter++;
|
|
|
}
|
|
|
}
|
|
|
- // 其它基站与当前基站X坐标相同
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionX = 0; // 错误
|
|
|
- }
|
|
|
-
|
|
|
- // 其它基站在当前基站上方
|
|
|
- if (dwOtherY > dwCurrentY)
|
|
|
+ }
|
|
|
+ // 主站Y轴向下移动
|
|
|
+ else if (byMainDirectionY == -1)
|
|
|
+ {
|
|
|
+ // 手机靠近从站
|
|
|
+ if (pstOtherBtstDirectionData->byDirectionTendency == 1)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
+ // TODO,条件已经检查过,不需要再修改
|
|
|
+ if ((dwOtherY >= dwCurrentY && pstAheadCoord->dwY > dwOtherY) || (dwOtherY < dwCurrentY && pstAheadCoord->dwY > dwOtherY))
|
|
|
{
|
|
|
- byCounterMinusY++;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
+ byMainDirectionYCounter++;
|
|
|
}
|
|
|
}
|
|
|
- // 其它基站在当前基站下方
|
|
|
- else if (dwOtherY < dwCurrentY)
|
|
|
+ // 手机远离从站
|
|
|
+ else if (pstOtherBtstDirectionData->byDirectionTendency == 2)
|
|
|
{
|
|
|
- if (dwOtherIndex > dwCurrentIndex)
|
|
|
- {
|
|
|
- byCounterPlusY++;
|
|
|
- }
|
|
|
- else
|
|
|
+ // TODO,条件已经检查过,不需要再修改
|
|
|
+ if ((dwOtherY > dwCurrentY && pstAheadCoord->dwY <= dwOtherY) || (dwOtherY <= dwCurrentY && pstAheadCoord->dwY <= dwOtherY))
|
|
|
{
|
|
|
- byCounterMinusY++;
|
|
|
+ byMainDirectionYCounter++;
|
|
|
}
|
|
|
}
|
|
|
- // 其它基站与当前基站Y坐标相同
|
|
|
- else
|
|
|
- {
|
|
|
- byDirectionY = 0; // 错误
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (byCounterPlusX != 0 || byCounterMinusX != 0 || byCounterPlusY != 0 || byCounterMinusY != 0)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
+ // 保存主站方向预判信息
|
|
|
+ pstCurrentBtsDirectionData->byDirectionX = byMainDirectionX;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionY = byMainDirectionY;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionXCounter = byMainDirectionXCounter;
|
|
|
+ pstCurrentBtsDirectionData->byDirectionYCounter = byMainDirectionYCounter;
|
|
|
+
|
|
|
+ // 变量复位
|
|
|
+ byMainDirectionX = 0;
|
|
|
+ byMainDirectionY = 0;
|
|
|
+ byMainDirectionXCounter = 0;
|
|
|
+ byMainDirectionYCounter = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 方向预测失败
|
|
|
- if (byCounterPlusX == 0 && byCounterMinusX == 0 && byCounterPlusY == 0 && byCounterMinusY == 0)
|
|
|
+ // 统计XY轴移动方向正确校验最多的方向
|
|
|
+ for (uint8 i = 0; i < byFirstPathListLen; i++)
|
|
|
+ {
|
|
|
+ pstFirstPathData = &pstFirstPathList[i]; // 第一径数据
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ if (pstCurrentBtsDirectionData->byDirectionXCounter > byMainDirectionXCounter)
|
|
|
+ {
|
|
|
+ byMainDirectionXCounter = pstCurrentBtsDirectionData->byDirectionXCounter;
|
|
|
+ byFirstPathIndexX = i;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pstCurrentBtsDirectionData->byDirectionYCounter > byMainDirectionYCounter)
|
|
|
+ {
|
|
|
+ byMainDirectionYCounter = pstCurrentBtsDirectionData->byDirectionYCounter;
|
|
|
+ byFirstPathIndexY = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 选择一个轴向,X轴或者Y轴
|
|
|
+ if (byMainDirectionXCounter > byMainDirectionYCounter)
|
|
|
+ {
|
|
|
+ // X轴
|
|
|
+ pstFirstPathData = &pstFirstPathList[byFirstPathIndexX]; // 第一径数据
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ byMainDirectionX = pstCurrentBtsDirectionData->byDirectionX;
|
|
|
+ }
|
|
|
+ else if (byMainDirectionXCounter < byMainDirectionYCounter)
|
|
|
{
|
|
|
- *pbyDirectionX = 0;
|
|
|
- *pbyDirectionY = 0;
|
|
|
+ // Y轴
|
|
|
+ pstFirstPathData = &pstFirstPathList[byFirstPathIndexY]; // 第一径数据
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ byMainDirectionY = pstCurrentBtsDirectionData->byDirectionY;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (byCounterPlusX > byCounterMinusX)
|
|
|
+ // 在X轴移动较大
|
|
|
+ if (byChangeXY == 1)
|
|
|
{
|
|
|
- byDirectionX = 1;
|
|
|
+ // X轴
|
|
|
+ pstFirstPathData = &pstFirstPathList[byFirstPathIndexX]; // 第一径数据
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ byMainDirectionX = pstCurrentBtsDirectionData->byDirectionX;
|
|
|
}
|
|
|
- else if (byCounterPlusX < byCounterMinusX)
|
|
|
+ // 在Y轴移动较大
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Y轴
|
|
|
+ pstFirstPathData = &pstFirstPathList[byFirstPathIndexY]; // 第一径数据
|
|
|
+ byFreqIndex = pstFirstPathData->byFreqIndex; // 基站频率索引
|
|
|
+ pstCurrentBtsDirectionData = &pstPredictionDirectionDataList[byFreqIndex];
|
|
|
+ byMainDirectionY = pstCurrentBtsDirectionData->byDirectionY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存参数
|
|
|
+ *pbyDirectionX = byMainDirectionX;
|
|
|
+ *pbyDirectionY = byMainDirectionY;
|
|
|
+
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
+// 计算手机相对于基站的移动方向
|
|
|
+// byDirectionTendency:手机相对于基站的运动趋势
|
|
|
+// dwBtsCoordX:基站X坐标
|
|
|
+// dwBtsCoordY:基站Y坐标
|
|
|
+// pstAheadCoord:前一个定位点
|
|
|
+// pbyDirectionX:X轴预测方向,返回参数,1:向右,-1:向左
|
|
|
+// pbyDirectionY:Y轴预测方向,返回参数,1:向上,-1:向下
|
|
|
+void lct_coordcal_cal_bts_move_direction(uint8 byDirectionTendency, int32 dwBtsCoordX, int32 dwBtsCoordY, COORD_T *pstAheadCoord, int8 *pbyDirectionX, int8 *pbyDirectionY)
|
|
|
+{
|
|
|
+ int8 byDirectionX = 0;
|
|
|
+ int8 byDirectionY = 0;
|
|
|
+
|
|
|
+ //// 预判当前手机相对于当前基站在x和y轴上的移动方向
|
|
|
+ // 手机靠近当前站
|
|
|
+ if (byDirectionTendency == 1)
|
|
|
+ {
|
|
|
+ // 从右侧靠近
|
|
|
+ if (pstAheadCoord->dwX > dwBtsCoordX)
|
|
|
{
|
|
|
byDirectionX = -1;
|
|
|
}
|
|
|
- else
|
|
|
+ // 从左侧靠近
|
|
|
+ else if (pstAheadCoord->dwX < dwBtsCoordX)
|
|
|
{
|
|
|
- byDirectionX = 0; // 不成功
|
|
|
+ byDirectionX = 1;
|
|
|
}
|
|
|
|
|
|
- if (byCounterPlusY > byCounterMinusY)
|
|
|
+ // 从上方靠近
|
|
|
+ if (pstAheadCoord->dwY > dwBtsCoordY)
|
|
|
+ {
|
|
|
+ byDirectionY = -1;
|
|
|
+ }
|
|
|
+ // 从下方靠近
|
|
|
+ else if (pstAheadCoord->dwY < dwBtsCoordY)
|
|
|
{
|
|
|
byDirectionY = 1;
|
|
|
}
|
|
|
- else if (byCounterPlusY < byCounterMinusY)
|
|
|
+ }
|
|
|
+ // 手机远离当前站
|
|
|
+ else if (byDirectionTendency == 2)
|
|
|
+ {
|
|
|
+ // 从右侧远离
|
|
|
+ if (pstAheadCoord->dwX > dwBtsCoordX)
|
|
|
{
|
|
|
- byDirectionY = -1;
|
|
|
+ byDirectionX = 1;
|
|
|
}
|
|
|
- else
|
|
|
+ // 从左侧远离
|
|
|
+ else if (pstAheadCoord->dwX < dwBtsCoordX)
|
|
|
{
|
|
|
- byDirectionY = 0; // 不成功
|
|
|
+ byDirectionX = -1;
|
|
|
}
|
|
|
|
|
|
- *pbyDirectionX = byDirectionX;
|
|
|
- *pbyDirectionY = byDirectionY;
|
|
|
+ // 从上方远离
|
|
|
+ if (pstAheadCoord->dwY > dwBtsCoordY)
|
|
|
+ {
|
|
|
+ byDirectionY = 1;
|
|
|
+ }
|
|
|
+ // 从下方远离
|
|
|
+ else if (pstAheadCoord->dwY < dwBtsCoordY)
|
|
|
+ {
|
|
|
+ byDirectionY = -1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ *pbyDirectionX = byDirectionX;
|
|
|
+ *pbyDirectionY = byDirectionY;
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|