Commit ba7860dd gujlg

Merge branch 'AutoInOutStore' of https://gitee.com/ln0816/RC30-AutoInOutStore into AutoInOutStore

2 个父辈 7e98e23f 5d47e39a
......@@ -47,9 +47,9 @@ namespace Asa.IOModule
private Thread tLogOut; //日志输出
private Thread tReconn; //断开重连
private const int SEND_SLEEP = 30; //发送命令间隔
private const int NET_SLEEP = 30; //接收网络间隔
private const int TRIG_SLEEP = 30; //触发事件间隔
private const int SEND_SLEEP = 15; //发送命令间隔
private const int NET_SLEEP = 15; //接收网络间隔
private const int TRIG_SLEEP = 20; //触发事件间隔
/// <summary>
/// 自动读取DI委托
......
......@@ -165,7 +165,16 @@ namespace OnlineStore.DeviceLibrary
{
timeOutMs = 650000;
}
if (!wait.IsEnd && span.TotalSeconds > 2 && wait.IoType.Equals(IO_Type.SuckingDisc_Air))
{
string ioType = IO_Type.SuckingDisc_Work;
IO_VALUE doValue = IOManager.DOValue(ioType);
if (!doValue.Equals(wait.IoValue))
{
LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + ioType + "=" + wait.IoValue + ")");
IOManager.IOMove(ioType, wait.IoValue);
}
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
......@@ -193,7 +202,7 @@ namespace OnlineStore.DeviceLibrary
{
if (!wait.IsEnd)
{
wait.IsEnd = AutomaticBaiting.BatchAxisIsEnd(wait);
wait.IsEnd = AutomaticBaiting.BatchAxisIsEnd(wait,span);
}
if (!wait.IsEnd)
{
......
......@@ -107,22 +107,34 @@ namespace OnlineStore.DeviceLibrary
// ConfigIO io = StoreManager.Config.getWaitIO(wait.IoType);
// WarnMsg = "[" + StoreMove.MoveStep + "] 等待[" + io.ElectricalDefinition + "_" + io.Explain + "=" + wait.IoValue + "]超时";
// StoreManager.Store.Alarm(StoreAlarmType.BatchIoTimeOut, io.ElectricalDefinition, WarnMsg, StoreMove.MoveType);
// LogUtil.error(WarnMsg,101);
// LogUtil.error(WarnMsg, 101);
// isOk = false;
// break;
//}
//如果是气缸动作,若Do未输出,重新写一遍
if (!wait.IsEnd && span.TotalSeconds > 1 && (wait.IoType.Equals(IO_Type.SuckingDisc_Down) || wait.IoType.Equals(IO_Type.SuckingDisc_Up)))
if (!wait.IsEnd && span.TotalSeconds > 2)
{
IO_VALUE doValue = IOManager.DOValue(wait.IoType);
if (!doValue.Equals(wait.IoValue))
if (wait.IoType.Equals(IO_Type.SuckingDisc_Down) || wait.IoType.Equals(IO_Type.SuckingDisc_Up))
{
LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + wait.IoType + "=" + wait.IoValue + ")");
IOManager.IOMove(wait.IoType, wait.IoValue);
string ioType = wait.IoType.Equals(IO_Type.SuckingDisc_Down) ? IO_Type.SuckingDisc_Up : IO_Type.SuckingDisc_Down;
IO_VALUE ioValue = wait.IoValue.Equals(IO_VALUE.LOW) ? IO_VALUE.HIGH : IO_VALUE.LOW;
LogUtil.error("等待[" + wait.ToStr() + "],重写气缸DO(" + ioType + "=" + ioValue + ")");
IOManager.IOMove(ioType, ioValue);
IO_VALUE doValue = IOManager.DOValue(wait.IoType);
if (!doValue.Equals(wait.IoValue))
{
LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + wait.IoType + "=" + wait.IoValue + ")");
IOManager.IOMove(wait.IoType, wait.IoValue);
string ioType = wait.IoType.Equals(IO_Type.SuckingDisc_Down) ? IO_Type.SuckingDisc_Up : IO_Type.SuckingDisc_Down;
IO_VALUE ioValue = wait.IoValue.Equals(IO_VALUE.LOW) ? IO_VALUE.HIGH : IO_VALUE.LOW;
LogUtil.error("等待[" + wait.ToStr() + "],重写气缸DO(" + ioType + "=" + ioValue + ")");
IOManager.IOMove(ioType, ioValue);
}
}else if (wait.IoType.Equals(IO_Type.SuckingDisc_Air))
{
string ioType = IO_Type.SuckingDisc_Work;
IO_VALUE doValue = IOManager.DOValue(ioType);
if (!doValue.Equals(wait.IoValue))
{
LogUtil.error("等待[" + NotOkMsg + "],重写DO(" + ioType + "=" + wait.IoValue + ")");
IOManager.IOMove(ioType, wait.IoValue);
}
}
}
}
......@@ -141,7 +153,7 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType == (int)Wait_Type.BatchAxisMove_10)
{
wait.IsEnd = BatchAxisIsEnd(wait);
wait.IsEnd = BatchAxisIsEnd(wait,span);
if (wait.IsEnd)
{
BatchAxisController.StopCheck();
......@@ -247,7 +259,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// <param name="wait"></param>
/// <returns></returns>
public static bool BatchAxisIsEnd(WaitResultInfo wait)
public static bool BatchAxisIsEnd(WaitResultInfo wait,TimeSpan startSpan)
{
bool result = false;
if (IOManager.IOValue(wait.IoType).Equals(IO_VALUE.HIGH))
......@@ -265,7 +277,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(wait.ToStr() + " 停止运动");
ACServerManager.SuddenStop(wait.AxisInfo);
}
else
else if(startSpan.TotalSeconds>2)
{
TimeSpan span = DateTime.Now - AxisResetMoveTime;
if ((AutoBaitingStatus.Equals(StoreRunStatus.Busy)||AutoBaitingStatus.Equals(StoreRunStatus.Reset)) && span.TotalSeconds > 10)
......@@ -278,7 +290,7 @@ namespace OnlineStore.DeviceLibrary
{ //判断是否需要重新运动
StoreMove.CanWhileCount--;
LogUtil.error(wait.ToStr() + " 未收到信号且停止运动,重新匀速" + StoreManager.Config.BatchAxis_SlowSpeed + "运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SuddenStop(wait.AxisInfo);
ACServerManager.SuddenStop(wait.AxisInfo.DeviceName,wait.AxisInfo.GetAxisValue());
Thread.Sleep(2000);
ACServerManager.SpeedMove(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue(), StoreManager.Config.BatchAxis_SlowSpeed);
}
......
......@@ -375,7 +375,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(LOGGER, moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SuddenStop(moveAxis);
ACServerManager.SuddenStop(moveAxis.DeviceName,moveAxis.GetAxisValue());
Thread.Sleep(2000);
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!