Commit 5dc3d2f7 ke.sun

新增一个线程检测急停

1 个父辈 fee72540
...@@ -209,28 +209,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -209,28 +209,9 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
//string strSend = "";
//for (int i = 0; i < data.Length; i++)
//{
// strSend += string.Format("{0:X2} ", data[i]);
//}
//if (strSend.Equals(""))
//{
// return;
//}
//if (IsShowMsg)
//{
// LogUtil.info( " 写入数据:" + strSend + "");
//}
//AcSerialBean bean = GetSerialBean(portName);
//if (bean == null)
//{
// LogUtil.debug("ACServerManager SendData 试图向未打开串口【" + portName + "】写入数据:" + strSend + "。");
// return;
//}
//bean.SendData(data, 0, data.Length);
byte[] returnData = SendCommand(portName, data, 50, 8); byte[] returnData = SendCommand(portName, data, 50, 8);
if (returnData!=null)
{
string strSend = ""; string strSend = "";
for (int i = 0; i < returnData.Length; i++) for (int i = 0; i < returnData.Length; i++)
{ {
...@@ -238,7 +219,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -238,7 +219,8 @@ namespace OnlineStore.DeviceLibrary
} }
if (IsShowMsg) if (IsShowMsg)
{ {
LogUtil.info( "串口" + portName + " 收到数据:" + strSend + ""); LogUtil.info("串口" + portName + " 收到数据:" + strSend + "");
}
} }
} }
/// <summary> /// <summary>
......
...@@ -40,6 +40,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -40,6 +40,7 @@ namespace OnlineStore.DeviceLibrary
public bool IsHasCompress_Axis = true; public bool IsHasCompress_Axis = true;
public ScanSocket scanSocket = new ScanSocket(); public ScanSocket scanSocket = new ScanSocket();
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer(); private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
private System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
public AC_SA_BoxBean(AC_SA_Config config) public AC_SA_BoxBean(AC_SA_Config config)
{ {
Init(); Init();
...@@ -48,6 +49,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -48,6 +49,11 @@ namespace OnlineStore.DeviceLibrary
serverConnectTimer.AutoReset = true; serverConnectTimer.AutoReset = true;
serverConnectTimer.Enabled = false; serverConnectTimer.Enabled = false;
serverConnectTimer.Elapsed += server_connect_timer_Tick; serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 200;
IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false;
IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
//添加调试 //添加调试
if (config.IsInDebug == 1) if (config.IsInDebug == 1)
{ {
...@@ -92,6 +98,26 @@ namespace OnlineStore.DeviceLibrary ...@@ -92,6 +98,26 @@ namespace OnlineStore.DeviceLibrary
KNDIOMove(IO_Type.RunSign_HddLed, IO_VALUE.HIGH); KNDIOMove(IO_Type.RunSign_HddLed, IO_VALUE.HIGH);
} }
private void IoCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//判断急停
if (storeRunStatus >= StoreRunStatus.HomeMoving)
{
if (KNDIOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
if (isInSuddenDown.Equals(false))
{
isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停");
WarnMsg = StoreName + "收到急停信号,报警急停";
//报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None);
}
}
}
}
private void CheckPositionLimit(ACStorePosition position) private void CheckPositionLimit(ACStorePosition position)
{ {
try try
...@@ -232,14 +258,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -232,14 +258,14 @@ namespace OnlineStore.DeviceLibrary
//急停按钮和气压检测需要一起判断 //急停按钮和气压检测需要一起判断
IO_VALUE suddenBtn = KNDIOValue(IO_Type.SuddenStop_BTN); IO_VALUE suddenBtn = KNDIOValue(IO_Type.SuddenStop_BTN);
//IO_VALUE airCheck = KNDIOValue(IO_Type.Airpressure_Check); IO_VALUE airCheck = KNDIOValue(IO_Type.Airpressure_Check);
if (suddenBtn == IO_VALUE.HIGH ) //if (suddenBtn == IO_VALUE.HIGH)
//if (suddenBtn == IO_VALUE.HIGH && airCheck == IO_VALUE.HIGH) if (suddenBtn == IO_VALUE.HIGH && airCheck == IO_VALUE.HIGH)
{ {
//lastAirValue = airCheck; //lastAirValue = airCheck;
lastAirCloseTime = DateTime.Now; lastAirCloseTime = DateTime.Now;
if (!RunAxis(true )) if (!RunAxis(true))
{ {
return false; return false;
} }
...@@ -249,10 +275,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -249,10 +275,11 @@ namespace OnlineStore.DeviceLibrary
//启动温湿度服务器 //启动温湿度服务器
//HumitureServer.StartTemperateServer(Config.TemperateServer_Port); //HumitureServer.StartTemperateServer(Config.TemperateServer_Port);
scanSocket.ConnectScanner(Config.Scanner_Ip,Config.Scanner_Port ); scanSocket.ConnectScanner(Config.Scanner_Ip, Config.Scanner_Port);
ReturnHome(); ReturnHome();
StartTime = DateTime.Now; StartTime = DateTime.Now;
timersTimer.Enabled = true; timersTimer.Enabled = true;
IoCheckTimer.Enabled = true;
serverConnectTimer.Enabled = true; serverConnectTimer.Enabled = true;
IsRun = true; IsRun = true;
return true; return true;
...@@ -307,7 +334,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -307,7 +334,6 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed ); ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed );
//判断叉子没有料盘 //判断叉子没有料盘
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW)); StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW));
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_4, IO_VALUE.LOW));
} }
public override void Reset() public override void Reset()
{ {
...@@ -366,6 +392,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -366,6 +392,8 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack);
LocationDownAndWait(); LocationDownAndWait();
} }
InProcess = false;
isInPro = false;
} }
/// <summary> /// <summary>
...@@ -669,6 +697,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -669,6 +697,7 @@ namespace OnlineStore.DeviceLibrary
{ {
WarnMsg = ""; WarnMsg = "";
autoNext = false; autoNext = false;
IoCheckTimer.Enabled = false;
serverConnectTimer.Enabled = false; serverConnectTimer.Enabled = false;
StopMove(); StopMove();
...@@ -699,10 +728,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -699,10 +728,7 @@ namespace OnlineStore.DeviceLibrary
return; return;
} }
LogUtil.error(LOGGER, StoreName + " 报警,报警类型:" + alarmType); LogUtil.error(LOGGER, StoreName + " 报警,报警类型:" + alarmType);
if (alarmType != StoreAlarmType.IoSingleTimeOut)
{
StopMove();
}
this.alarmType = alarmType; this.alarmType = alarmType;
if (alarmType == StoreAlarmType.AxisAlarm) if (alarmType == StoreAlarmType.AxisAlarm)
{ {
...@@ -714,7 +740,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -714,7 +740,6 @@ namespace OnlineStore.DeviceLibrary
isInSuddenDown = true; isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,关闭所有轴卡,关闭所有IO,停止所有运动"); LogUtil.error(LOGGER, StoreName + "收到急停信号,关闭所有轴卡,关闭所有IO,停止所有运动");
CloseAllAxis(); CloseAllAxis();
StoreMove.EndMove(); StoreMove.EndMove();
storeStatus = StoreStatus.SuddenStop; storeStatus = StoreStatus.SuddenStop;
} }
...@@ -727,6 +752,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -727,6 +752,10 @@ namespace OnlineStore.DeviceLibrary
StoreMove.EndMove(); StoreMove.EndMove();
storeStatus = StoreStatus.SuddenStop; storeStatus = StoreStatus.SuddenStop;
} }
if (alarmType != StoreAlarmType.IoSingleTimeOut)
{
StopMove();
}
} }
private bool InProcess = false; private bool InProcess = false;
protected override void timersTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) protected override void timersTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
...@@ -854,14 +883,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -854,14 +883,15 @@ namespace OnlineStore.DeviceLibrary
//急停按钮 //急停按钮
if (suddenBtn.Equals(IO_VALUE.LOW)) if (suddenBtn.Equals(IO_VALUE.LOW))
{ {
if (isInSuddenDown.Equals(false)) //if (isInSuddenDown.Equals(false))
{ //{
isInSuddenDown = true; // isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停"); // LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停");
WarnMsg = StoreName + "收到急停信号,报警急停"; // WarnMsg = StoreName + "收到急停信号,报警急停";
//报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None); // //报警时会关闭所有轴
} // Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None);
//}
} }
else if (resetBtn.Equals(IO_VALUE.HIGH)) else if (resetBtn.Equals(IO_VALUE.HIGH))
{ {
...@@ -1167,7 +1197,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1167,7 +1197,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
if (Config.IsHasLocationCylinder) if (Config.IsHasLocationCylinder>=1)
{ {
//定位气缸停止 //定位气缸停止
KNDIOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW); KNDIOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
...@@ -1177,6 +1207,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1177,6 +1207,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "StopMove"); LogUtil.info(LOGGER, StoreName + "StopMove");
KNDIOMove(IO_Type.Door_Down, IO_VALUE.LOW); KNDIOMove(IO_Type.Door_Down, IO_VALUE.LOW);
KNDIOMove(IO_Type.Door_Up, IO_VALUE.LOW); KNDIOMove(IO_Type.Door_Up, IO_VALUE.LOW);
isInPro = false;
} }
......
...@@ -620,6 +620,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -620,6 +620,8 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed); ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//此处需要等待box门口没有盘 //此处需要等待box门口没有盘
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW)); StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Door, IO_VALUE.LOW));
//打开舱门
OpenDoorAndWait();
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_2, IO_VALUE.LOW)); //StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_2, IO_VALUE.LOW));
} }
...@@ -689,7 +691,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -689,7 +691,7 @@ namespace OnlineStore.DeviceLibrary
private void LocationUpAndWait() private void LocationUpAndWait()
{ {
if (Config.IsHasLocationCylinder) if (Config.IsHasLocationCylinder>=1)
{ {
KNDIOMove(IO_Type.LocationCylinder_Up, IO_VALUE.HIGH); KNDIOMove(IO_Type.LocationCylinder_Up, IO_VALUE.HIGH);
KNDIOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW); KNDIOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
...@@ -699,7 +701,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -699,7 +701,7 @@ namespace OnlineStore.DeviceLibrary
} }
private void LocationDownAndWait() private void LocationDownAndWait()
{ {
if (Config.IsHasLocationCylinder) if (Config.IsHasLocationCylinder>=1)
{ {
KNDIOMove(IO_Type.LocationCylinder_Down, IO_VALUE.HIGH); KNDIOMove(IO_Type.LocationCylinder_Down, IO_VALUE.HIGH);
KNDIOMove(IO_Type.LocationCylinder_Up, IO_VALUE.LOW); KNDIOMove(IO_Type.LocationCylinder_Up, IO_VALUE.LOW);
......
...@@ -143,8 +143,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -143,8 +143,6 @@ namespace OnlineStore.DeviceLibrary
return; return;
} }
isInPro = true; isInPro = true;
switch (StoreMove.MoveType) switch (StoreMove.MoveType)
{ {
case StoreMoveType.InStore: case StoreMoveType.InStore:
......
...@@ -51,7 +51,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -51,7 +51,7 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO 是否使用定位气缸 IsHasLocationCylinder 0 /// PRO 是否使用定位气缸 IsHasLocationCylinder 0
/// </summary> /// </summary>
[ConfigProAttribute("IsHasLocationCylinder")] [ConfigProAttribute("IsHasLocationCylinder")]
public bool IsHasLocationCylinder { get; set; } public int IsHasLocationCylinder { get; set; }
/// <summary> /// <summary>
/// PRO 扫码枪IP Scanner_Ip 192.168.200.13 /// PRO 扫码枪IP Scanner_Ip 192.168.200.13
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!