Commit 447c419f LN

原点返回时,如果原点信号持续亮5秒以上,伺服报警。

1 个父辈 4042e400
...@@ -160,6 +160,26 @@ namespace OnlineStore.DeviceLibrary ...@@ -160,6 +160,26 @@ namespace OnlineStore.DeviceLibrary
if (wait.IsHomeMove) if (wait.IsHomeMove)
{ {
wait.IsEnd = ACHomeMoveIsEnd(wait.AxisInfo, out msg); wait.IsEnd = ACHomeMoveIsEnd(wait.AxisInfo, out msg);
if (!wait.IsEnd && (String.IsNullOrEmpty(msg)))
{
//如果原点没完成,且原点亮超过5秒,需要报警
int org = AxisManager.instance.GetHomeSingle(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
if (org.Equals(1) && wait.AxisOrgValue.Equals(1))
{
TimeSpan orgSpan = DateTime.Now - wait.LastHasOrgTime;
if (orgSpan.TotalSeconds > 5)
{
msg = Name + " " + MoveInfo.MoveStep + " " + wait.AxisInfo.DisplayStr + "原点返回,原点信号已持续亮" + orgSpan.ToString() + "秒,需要报警";
LogUtil.error(msg);
}
}
else
{
wait.AxisOrgValue = org;
wait.LastHasOrgTime = DateTime.Now;
}
}
} }
else else
{ {
......
...@@ -214,8 +214,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -214,8 +214,9 @@ namespace OnlineStore.DeviceLibrary
protected void ACAxisHomeMove(ConfigMoveAxis moveAxis) protected void ACAxisHomeMove(ConfigMoveAxis moveAxis)
{ {
moveAxis.TargetPosition = 0; moveAxis.TargetPosition = 0;
LogUtil.debug (moveAxis.DisplayStr + "speed[" + moveAxis.HomeHighSpeed + "]开始原点返回"); LogUtil.debug(moveAxis.DisplayStr + "speed[" + moveAxis.HomeHighSpeed + "]开始原点返回");
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true)); int org = ACServerManager.instance.GetHomeSingle(moveAxis.DeviceName, moveAxis.GetAxisValue());
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxisHome(moveAxis, org));
AxisManager.instance.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, moveAxis.HomeLowSpeed, moveAxis.HomeAddSpeed); AxisManager.instance.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, moveAxis.HomeLowSpeed, moveAxis.HomeAddSpeed);
} }
......
...@@ -183,7 +183,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -183,7 +183,7 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false; wait.IsEnd = false;
return wait; return wait;
} }
public static WaitResultInfo WaitAxis(ConfigMoveAxis axis, bool isHomeMove) public static WaitResultInfo WaitAxisHome(ConfigMoveAxis axis, int AxisOrgValue)
{ {
WaitResultInfo wait = new WaitResultInfo(); WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0; wait.CanWhileMoveCount = 0;
...@@ -191,40 +191,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -191,40 +191,8 @@ namespace OnlineStore.DeviceLibrary
wait.AxisInfo = axis; wait.AxisInfo = axis;
wait.IsHomeMove = true; wait.IsHomeMove = true;
wait.IsEnd = false; wait.IsEnd = false;
return wait; wait.AxisOrgValue = AxisOrgValue;
} wait.LastHasOrgTime = DateTime.Now;
public static WaitResultInfo WaitStell(byte slvAddr, int targetPosition, int speed)
{
WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount =10;
wait.WaitType = 4;
wait.SlvAddr = slvAddr;
wait.IsHomeMove = false;
wait.TargetPosition = targetPosition;
wait.TargetSpeed = speed;
wait.IsEnd = false;
return wait;
}
public static WaitResultInfo WaitStellHome(byte slvAddr, int targetPosition, int speed)
{
WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 10;
wait.WaitType = 4;
wait.SlvAddr = slvAddr;
wait.IsHomeMove = true;
wait.TargetPosition = 0;
wait.TargetSpeed = speed;
wait.IsEnd = false;
return wait;
}
public static WaitResultInfo WaitShuoKe(int slvAddr, int targetPosition, bool isHome)
{
WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0;
wait.WaitType = 5;
wait.SlvAddr =(byte) slvAddr;
wait.TargetPosition = targetPosition;
wait.IsHomeMove = isHome;
return wait; return wait;
} }
public static WaitResultInfo WaitTime(int MScends) public static WaitResultInfo WaitTime(int MScends)
...@@ -346,6 +314,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -346,6 +314,11 @@ namespace OnlineStore.DeviceLibrary
/// 高度 /// 高度
/// </summary> /// </summary>
public int HeightValue { get; set; } public int HeightValue { get; set; }
public int AxisOrgValue = 0;
public DateTime LastHasOrgTime = DateTime.Now;
} }
public enum StoreMoveType public enum StoreMoveType
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!