Commit caed97dd authored by 潘栩锋's avatar 潘栩锋 🚴

发现问题 AD盒.B2 当网络很慢,ADLag 操作会异常

parent 53387cb3
......@@ -254,7 +254,10 @@ namespace FlyADBase
}
//数据滞后
TimeGridAdvHelperExt.AdLagCorr(dataList, ref endTime, ADLag, AD2Lag);
if(!TimeGridAdvHelperExt.AdLagCorr(dataList, ref endTime, ADLag, AD2Lag))
{
throw new Exception("数据量太少,无法滞后修正");
}
......@@ -354,9 +357,12 @@ namespace FlyADBase
var dataList = mTimeGridAdvHelper.GetData(lastGridTime);
var endTime = mTimeGridAdvHelper.NewestTime;
//滞后修正
TimeGridAdvHelperExt.AdLagCorr(dataList, ref endTime, ADLag, AD2Lag);
//数据滞后
if (!TimeGridAdvHelperExt.AdLagCorr(dataList, ref endTime, ADLag, AD2Lag))
{
throw new Exception("数据量太少,无法滞后修正");
}
//获取grid图
TimeGridAdvHelperExt.ToGrid(dataList, PosOfGrid, GridLen,
......
......@@ -591,13 +591,16 @@ namespace FlyADBase
/// <param name="dataPool"></param>
/// <param name="ad1Lag"></param>
/// <param name="ad2Lag"></param>
public static void AdLagCorr(List<DateTimeUnit5> dataPool, ref DateTime endTime, int ad1Lag, int ad2Lag)
public static bool AdLagCorr(List<DateTimeUnit5> dataPool, ref DateTime endTime, int ad1Lag, int ad2Lag)
{
int lag = Math.Max(ad1Lag, ad2Lag);
if (lag == 0)
return;
return true;
int endIdx = dataPool.Count() - 1 - lag;
if (endIdx < 0)
return false;
int removeCnt = lag;
for (int i = 0; i <endIdx; i++)
{
......@@ -624,6 +627,7 @@ namespace FlyADBase
dataPool.RemoveRange(endIdx + 1, removeCnt);
endTime -= TimeSpan.FromMilliseconds(removeCnt);
}
return true;
}
/// <summary>
/// 获取平均速度, 单位 脉冲/min
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment