Commit 8593d013 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 修复 AD盒 脉冲速度异常巨大。

2. 优化 AD盒 数据缓存池扩展到2分钟
parent 3c4e414f
......@@ -91,20 +91,6 @@ namespace FlyADBase
this.PropertyChanged += FlyAD7_PropertyChanged1;
//更新线速度
PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD,
() =>
{
if (calSpeed.Cal(Now, out int speed1, out int speed2))
{
Speed = speed1;
Speed2 = speed2;
}
}, TimeSpan.FromSeconds(1));
//轮询事件触发
PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, OnPoll);
}
......@@ -361,7 +347,8 @@ namespace FlyADBase
//数据滞后
if (!TimeGridAdvHelperExt.AdLagCorr(dataList, ref endTime, ADLag, AD2Lag))
{
throw new Exception("数据量太少,无法滞后修正");
//throw new Exception("数据量太少,无法滞后修正");
return;
}
//获取grid图
......@@ -461,22 +448,42 @@ namespace FlyADBase
if (now - last_now < TimeSpan.FromSeconds(0.5))
return false;
bool isInvalid = false;
if (pos1_changed_time != last_pos1_changed_time && last_pos1_changed_time != DateTime.MinValue)
{
speed1 = (int)((pos1 - last_pos1) / (pos1_changed_time - last_pos1_changed_time).TotalSeconds);
var spd = (int)((pos1 - last_pos1) / (pos1_changed_time - last_pos1_changed_time).TotalSeconds);
if (Math.Abs(spd) > 100000)
{
//肯定是溢出了,
isInvalid = true;
}
else
{
speed1 = spd;
}
}
else
{
//停了
speed1 = 0;
}
if (pos2_changed_time != last_pos2_changed_time && last_pos2_changed_time != DateTime.MinValue)
{
speed2 = (int)((pos2 - last_pos2) / (pos2_changed_time - last_pos2_changed_time).TotalSeconds);
var spd= (int)((pos2 - last_pos2) / (pos2_changed_time - last_pos2_changed_time).TotalSeconds);
if (Math.Abs(spd) > 100000)
{
//肯定是溢出了,
isInvalid = true;
}
else {
speed2 = spd;
}
}
else
{
//停了
speed2 = 0;
}
last_now = now;
......@@ -485,7 +492,10 @@ namespace FlyADBase
last_pos1 = pos1;
last_pos2 = pos2;
return true;
if (isInvalid)
return false;
else
return true;
}
......
......@@ -40,7 +40,7 @@ namespace FlyADBase
NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
#region 一分钟数据缓存池, 目标每个AD数据(1ms 都有对应的其它数据
public const int POOL_SIZE_SECOND = 120;
/// <summary>
/// AD数据池时间间隔为1ms,数据是肯定是连续的。Add数据时,非连续,填充数据直到连续
/// </summary>
......@@ -276,19 +276,19 @@ namespace FlyADBase
return;
if (DataPool.Count() < (60 * 1.2) * 1000)
if (DataPool.Count() < (POOL_SIZE_SECOND + 30) * 1000)
{
//比限定的多了0.2min 才会动作
//比限定的多了30秒 才会动作
return;
}
//只保持1分钟数据
int remove_cnt = DataPool.Count() - 60 * 1000;
int remove_cnt = DataPool.Count() - POOL_SIZE_SECOND * 1000;
DataPool.RemoveRange(0, remove_cnt);
//限制的时间
var limitTime_other = NewestTime - TimeSpan.FromMinutes(1.5);
var limitTime_other = NewestTime - TimeSpan.FromSeconds(POOL_SIZE_SECOND + 30);
LimitSimplePool(DriveStatusPool, limitTime_other);
}
......
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