Commit 5c918f29 authored by 潘栩锋's avatar 潘栩锋 🚴

修复 对位失败问题

parent cf55d925
......@@ -391,21 +391,29 @@ namespace FLY.FeedbackRenZiJia.Server
goto _error;
}
if ((d.ThickAvg <= 0)
|| (Math.Abs(((double)(d_last.ThickAvg - d.ThickAvg)) / d.ThickAvg) > 0.1))
if (d.ThickAvg <= 0)
{
//厚度变化10%, 不能比较
//厚度为负数异常
Stability = STABILITY.ERROR_THICK_CHANGED;
goto _error;
}
double thk_diff = Math.Abs((double)(d_last.ThickAvg - d.ThickAvg));
if (thk_diff > 10)
{
if (thk_diff / d.ThickAvg > 0.15) {
//厚度变化15%, 不能比较
Stability = STABILITY.ERROR_THICK_CHANGED;
goto _error;
}
}
//获取 厚度%偏差,与 加热%偏差,大小都为 ChannelCnt
//thickpercents_diff = d.ThickPercents - d_last.ThickPercents
//heatpercents_diff = d_last.ThickPercents - d.ThickPercents
GetPercentDatas3(d, d_last,
out double[] thickpercents_diff, out double[] heatpercents_diff);
//通过简单的范围比较计算相关性
//通过简单的范围比较计算稳定性
//当Kp, 错位,就会另 稳定性的值很低
CalR(thickpercents_diff, heatpercents_diff, out bool[] isStables);
double currR = 1.0 * isStables.Count(b => b) / isStables.Count();
CurrR = currR;
......@@ -442,6 +450,7 @@ namespace FLY.FeedbackRenZiJia.Server
if (d.thickHeat.Time - d_last.thickHeat.Time > TimeSpan.FromMinutes(120))
{
mData.RemoveRange(0, index);
//因为是从尾到前找, 所以这个超时的,已经是最前一个,可以结束了
break;
}
......@@ -450,6 +459,7 @@ namespace FLY.FeedbackRenZiJia.Server
if (d_last.thickHeat.HTime == last_h_t)
{
//认为加热一样的,厚度也是一样,不比较了
//加热一样,只用最新的那幅数据
continue;
}
}
......
......@@ -213,24 +213,28 @@ namespace FLY.FeedbackRenZiJia.Server
AutoONoId1 = 0;
}
void AutoONoOnPoll()
{
void checkResetAuto() {
if (mHeatBuf.Stability != STABILITY.OK_CORREL)
return;
if (Heats.All(h => h == 0))
if (Heats.All(h => h == 0))
{
//加热全部为0
//复位状态
ResetAuto();
}
}
void AutoONoOnPoll()
{
checkResetAuto();
switch (AutoONoStatus)
{
case AutoONoStatusEnum.Init:
{
//if (mHeatBuf.Stability != STABILITY.OK_CORREL)
// break;
if (mHeatBuf.Stability != STABILITY.OK_CORREL)
break;
if (Heats.All(h => h == 0))
{
......@@ -302,6 +306,7 @@ namespace FLY.FeedbackRenZiJia.Server
break;
case AutoONoStatusEnum.Step2:
{
//不需要等 STABILITY.OK_CORREL
if (mHeatBuf.MaxR_Id1 == mHeatBuf.mData.Last().thickHeat.ID)//算出结果
{
string msg = "对位完成";
......@@ -337,6 +342,7 @@ namespace FLY.FeedbackRenZiJia.Server
//对位完成
AutoONoStatus = AutoONoStatusEnum.Success;
AutoONoMsg = msg;
AutoONoId0 = mHeatBuf.MaxR_Id0;
AutoONoId1 = mHeatBuf.MaxR_Id1;
return;
}
......
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