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

修复 对位失败问题

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