ZR轴回原失败增加超时机制,超时未回原成功则报警

develop
lhiven 4 months ago
parent 6323d1b047
commit dac1114c0b

@ -433,6 +433,11 @@ namespace Rs.MotionPlat.Flow
/// </summary> /// </summary>
public const int = 1098; public const int = 1098;
/// <summary>
/// 轴回原失败
/// </summary>
public const int = 1099;

@ -589,31 +589,40 @@ namespace Rs.MotionPlat.Flow
} }
else else
{ {
if (reFetchNum == 0) try
{ {
//这个时候Z&R回原一次然后再重新取料 logInfo = GetClassName() + $"排料吸嘴{curNozzle.NozzleIndex}号真空检测NG,num={reFetchNum}";
ZRHomeFlow.Instance.GoHome(curNozzle.NozzleIndex); MessageQueue.Instance.Insert(logInfo);
} if (reFetchNum == 0)
reFetchNum++;
if (reFetchNum >= GlobalVar.DischargeRetakeNum)
{
DischargeDumpFlow.Instance.Start(curTask.FromType, curNozzle.NozzleIndex, curNozzle.FromIndex);
//alarmInfo = $"排料{curNozzle.NozzleIndex}号吸嘴取{curNozzle.FromIndex+1}号穴位产品{reFetchNum}次失败";
if (curTask.FromType == TurnoverType.ToBeTested)
{ {
//alarmInfo = string.Format(AlarmCollection.GetAlarm(AlarmConstID.料仓tray盘取料报警), curNozzle.NozzleIndex, curNozzle.FromIndex + 1); //这个时候Z&R回原一次然后再重新取料
alarmEntity = AlarmCollection.Get(AlarmConstID.tray).Transform(curNozzle.NozzleIndex, (curNozzle.FromIndex + 1)); ZRHomeFlow.Instance.GoHome(curNozzle.NozzleIndex);
} }
else if (curTask.FromType == TurnoverType.Turnover) reFetchNum++;
if (reFetchNum >= GlobalVar.DischargeRetakeNum)
{ {
//alarmInfo = string.Format(AlarmCollection.GetAlarm(AlarmConstID.排料头在周转盘取料失败报警), curNozzle.NozzleIndex, curNozzle.FromIndex + 1); DischargeDumpFlow.Instance.Start(curTask.FromType, curNozzle.NozzleIndex, curNozzle.FromIndex);
alarmEntity = AlarmCollection.Get(AlarmConstID.).Transform(curNozzle.NozzleIndex, curNozzle.FromIndex + 1); //alarmInfo = $"排料{curNozzle.NozzleIndex}号吸嘴取{curNozzle.FromIndex+1}号穴位产品{reFetchNum}次失败";
if (curTask.FromType == TurnoverType.ToBeTested)
{
//alarmInfo = string.Format(AlarmCollection.GetAlarm(AlarmConstID.料仓tray盘取料报警), curNozzle.NozzleIndex, curNozzle.FromIndex + 1);
alarmEntity = AlarmCollection.Get(AlarmConstID.tray).Transform(curNozzle.NozzleIndex, (curNozzle.FromIndex + 1));
}
else if (curTask.FromType == TurnoverType.Turnover)
{
//alarmInfo = string.Format(AlarmCollection.GetAlarm(AlarmConstID.排料头在周转盘取料失败报警), curNozzle.NozzleIndex, curNozzle.FromIndex + 1);
alarmEntity = AlarmCollection.Get(AlarmConstID.).Transform(curNozzle.NozzleIndex, curNozzle.FromIndex + 1);
}
flowStep = EDischargeFlowStep.;
}
else
{
flowStep = EDischargeFlowStep.;
} }
flowStep = EDischargeFlowStep.;
} }
else catch (Exception ex)
{ {
flowStep = EDischargeFlowStep.;
} }
} }
break; break;

@ -2,8 +2,10 @@
using Rs.Framework; using Rs.Framework;
using Rs.Motion; using Rs.Motion;
using Rs.MotionPlat.Commom; using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Entitys;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
@ -16,7 +18,8 @@ namespace Rs.MotionPlat.Flow.SubFlow
StartHome, StartHome,
WaitHomed, WaitHomed,
GoStartPos, GoStartPos,
WaitArrivedStartPos WaitArrivedStartPos,
HomeWarning
} }
public class ZRHomeFlow public class ZRHomeFlow
{ {
@ -34,6 +37,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
} }
private EZRHomeFlowStep step = EZRHomeFlowStep.StartHome; private EZRHomeFlowStep step = EZRHomeFlowStep.StartHome;
bool finished = false; bool finished = false;
Stopwatch stopwatch = new Stopwatch();
public void GoHome(int homeIndex) public void GoHome(int homeIndex)
{ {
@ -45,6 +49,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
{ {
case EZRHomeFlowStep.StartHome: case EZRHomeFlowStep.StartHome:
//获取Z轴 //获取Z轴
MessageQueue.Instance.Insert($"{GetClassName()} NozzleZ{homeIndex},NozzleR{homeIndex} start home");
AxisControl.GetAxis($"NozzleZ{homeIndex}").Home(); AxisControl.GetAxis($"NozzleZ{homeIndex}").Home();
AxisControl.GetAxis($"NozzleR{homeIndex}").Home(); AxisControl.GetAxis($"NozzleR{homeIndex}").Home();
//AxisControl.NozzleZ1.Home(); //AxisControl.NozzleZ1.Home();
@ -65,6 +70,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
//AxisControl.NozzleR7.Home(); //AxisControl.NozzleR7.Home();
//AxisControl.NozzleR8.Home(); //AxisControl.NozzleR8.Home();
step = EZRHomeFlowStep.WaitHomed; step = EZRHomeFlowStep.WaitHomed;
stopwatch.Restart();
Thread.Sleep(1000); Thread.Sleep(1000);
break; break;
case EZRHomeFlowStep.WaitHomed: case EZRHomeFlowStep.WaitHomed:
@ -84,10 +90,18 @@ namespace Rs.MotionPlat.Flow.SubFlow
// && AxisControl.NozzleR6.HomeStatus == EHomeStatus.Finished // && AxisControl.NozzleR6.HomeStatus == EHomeStatus.Finished
// && AxisControl.NozzleR7.HomeStatus == EHomeStatus.Finished // && AxisControl.NozzleR7.HomeStatus == EHomeStatus.Finished
// && AxisControl.NozzleR8.HomeStatus == EHomeStatus.Finished) // && AxisControl.NozzleR8.HomeStatus == EHomeStatus.Finished)
if (AxisControl.GetAxis($"NozzleZ{homeIndex}").HomeStatus == EHomeStatus.Finished if(stopwatch.ElapsedMilliseconds<1000*60*3)
{
if (AxisControl.GetAxis($"NozzleZ{homeIndex}").HomeStatus == EHomeStatus.Finished
&& AxisControl.GetAxis($"NozzleR{homeIndex}").HomeStatus == EHomeStatus.Finished) && AxisControl.GetAxis($"NozzleR{homeIndex}").HomeStatus == EHomeStatus.Finished)
{
MessageQueue.Instance.Insert($"{GetClassName()} NozzleZ{homeIndex},NozzleR{homeIndex} homed finished");
step = EZRHomeFlowStep.GoStartPos;
}
}
else
{ {
step = EZRHomeFlowStep.GoStartPos; step = EZRHomeFlowStep.HomeWarning;
} }
break; break;
case EZRHomeFlowStep.GoStartPos: case EZRHomeFlowStep.GoStartPos:
@ -98,6 +112,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
//} //}
double targetPos = SysConfigParam.GetValue<Double>($"NozzleR{homeIndex}StartPos"); double targetPos = SysConfigParam.GetValue<Double>($"NozzleR{homeIndex}StartPos");
AxisControl.GetAxis($"NozzleR{homeIndex}").MovePos(targetPos, GlobalVar.WholeSpeed); AxisControl.GetAxis($"NozzleR{homeIndex}").MovePos(targetPos, GlobalVar.WholeSpeed);
MessageQueue.Instance.Insert($"{GetClassName()} NozzleR{homeIndex} go to pos:{targetPos}");
step = EZRHomeFlowStep.WaitArrivedStartPos; step = EZRHomeFlowStep.WaitArrivedStartPos;
Thread.Sleep(100); Thread.Sleep(100);
break; break;
@ -112,12 +127,33 @@ namespace Rs.MotionPlat.Flow.SubFlow
// && Ops.IsStop("NozzleR8")) // && Ops.IsStop("NozzleR8"))
if (Ops.IsStop($"NozzleR{homeIndex}")) if (Ops.IsStop($"NozzleR{homeIndex}"))
{ {
string axisname = $"NozzleR{homeIndex}";
MessageQueue.Instance.Insert($"{GetClassName()} NozzleR{homeIndex} arrived pos:{Ops.GetCurPosition(axisname)}");
finished = true; finished = true;
} }
break; break;
case EZRHomeFlowStep.HomeWarning:
stopwatch.Stop();
if (AxisControl.GetAxis($"NozzleZ{homeIndex}").HomeStatus != EHomeStatus.Finished)
{
AlarmEntity alarm = AlarmCollection.Get(AlarmConstID.).Transform($"NozzleZ{homeIndex}");
AlarmMessageBox.ShowDialog(alarm, SchedulingMessageBox.ETipButton.Retry, null, true);
}
else if (AxisControl.GetAxis($"NozzleR{homeIndex}").HomeStatus != EHomeStatus.Finished)
{
AlarmEntity alarm = AlarmCollection.Get(AlarmConstID.).Transform($"NozzleR{homeIndex}");
AlarmMessageBox.ShowDialog(alarm, SchedulingMessageBox.ETipButton.Retry, null, true);
}
step = EZRHomeFlowStep.StartHome;
break;
} }
Thread.Sleep(10); Thread.Sleep(10);
} }
} }
private string GetClassName()
{
return $"{nameof(ZRHomeFlow)}-";
}
} }
} }

@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
// //
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
[assembly: AssemblyVersion("3.20.25.01")] [assembly: AssemblyVersion("3.20.25.03")]
//[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]

Loading…
Cancel
Save