Commit 279e5762 renym1968

同步

1 个父辈 122c4d64
......@@ -39,7 +39,8 @@
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<Reference Include="halcondotnet, Version=12.0.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
......
......@@ -90,7 +90,7 @@ namespace OnlineStore.DeviceLibrary
string nameStr = ConfigAppSettings.GetValue(Setting_Init.CameraName);
string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType);
CodeManager.LoadConfig(nameStr,codeStr);
//初始化 //连接设备
KNDManager.ConnectionKND(Config.DIODeviceNameList);
KNDAIManager.ConnectionIP(Config.AIDevice_IP);
......@@ -128,28 +128,32 @@ namespace OnlineStore.DeviceLibrary
}
}
else
{
{
//光栅处理
SafetyLightProcess();
}
}
}
}
/// <summary>
/// 配置速度,加减速时间
/// </summary>
public void MoveAxisConfig()
{
AC_SA_Config.ConfigAxis( Config);
AC_SA_Config.ConfigAxis( Config);
moveAxisList = new List<ConfigMoveAxis>();
moveAxisList.Add(Config.Middle_Axis);
moveAxisList.Add(Config.UpDown_Axis);
moveAxisList.Add(Config.InOut_Axis);
//2018-11-22
moveAxisList.Add(Config.Charging_Axis);
this.AxisAlarmCodeMap = new Dictionary<string , AxisAlarmInfo>();
this.AxisAlarmCodeMap.Add(Config.UpDown_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(Config.InOut_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(this.Config.Middle_Axis.DeviceName, new AxisAlarmInfo());
//add 2018-11-22
if (this.Config.Charging_Axis != null)
this.AxisAlarmCodeMap.Add(this.Config.Charging_Axis.DeviceName, new AxisAlarmInfo());
}
/// <summary>
......@@ -216,7 +220,7 @@ namespace OnlineStore.DeviceLibrary
}
}
#region 原点返回和复位处理
private void ReturnHome()
{
......@@ -256,7 +260,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NewMove(StoreMoveType.StoreReset);
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_InOutToP1);
LogUtil.info(LOGGER, StoreName + "到待机状态,进出轴到P1,判断叉子没有料盘");
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));
}
......@@ -273,9 +277,9 @@ namespace OnlineStore.DeviceLibrary
CurrInOutCount = 0;
CurrInOutACount = 0;
KNDIOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
KNDIOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
KNDIOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
KNDIOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
KNDIOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
KNDIOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
//复位之前先停止运行
if (isNeedClearAuto)
{
......@@ -297,7 +301,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NewMove(StoreMoveType.StoreReset);
WarnMsg = "";
if (!RunAxis(true ))
if (!RunAxis(true))
////打开四个轴
//if (!OpenAllAxis())
{
......@@ -306,9 +310,9 @@ namespace OnlineStore.DeviceLibrary
}
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
{
InoutStartReset();
InoutStartReset();
//硕科压紧轴回原点
SetShuokeSpeed();
SetShuokeSpeed();
}
else
{
......@@ -316,7 +320,7 @@ namespace OnlineStore.DeviceLibrary
// 复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack);
LocationDownAndWait();
}
}
isInPro = false;
}
private void InoutStartReset()
......@@ -373,7 +377,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutToP1);
LogUtil.info(LOGGER, StoreName + "复位中:进出轴到待机点P1,关闭舱门");
//进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear(Config.InOut_Axis);
AxisCountClear(Config.InOut_Axis);
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
//判断叉子没有料盘
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW));
......@@ -397,7 +401,7 @@ namespace OnlineStore.DeviceLibrary
ACAxisHomeMove(Config.UpDown_Axis);
break;
case StoreMoveStep.BOX_H_OtherAxisBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
LogUtil.info(LOGGER, StoreName + "复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!");
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
......@@ -431,7 +435,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!");
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position);
ComMoveToPosition(Config.CompressAxis_P1_Position);
break;
case StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1:
LogUtil.info(LOGGER, StoreName + "到待机状态完成");
......@@ -443,7 +447,7 @@ namespace OnlineStore.DeviceLibrary
WarnMsg = "";
}
break;
default: break;
}
}
......@@ -452,7 +456,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IsHasCompress_Axis)
{
LogUtil.debug("压紧轴绝对运动目标位置:"+targetPosition);
LogUtil.debug("压紧轴绝对运动目标位置:" + targetPosition);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, targetPosition, false));
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, targetPosition);
Thread.Sleep(100);
......@@ -501,7 +505,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutToP1);
LogUtil.info(LOGGER, StoreName + "原点返回中,进出轴退回P1点,关闭仓门,检测叉子没有料盘");
//进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear(Config.InOut_Axis);
AxisCountClear(Config.InOut_Axis);
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
//判断叉子没有料盘
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW));
......@@ -527,7 +531,7 @@ namespace OnlineStore.DeviceLibrary
ACAxisHomeMove(Config.UpDown_Axis);
break;
case StoreMoveStep.BOX_H_OtherAxisBack:
case StoreMoveStep.BOX_H_OtherAxisBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
LogUtil.info(LOGGER, StoreName + "回原点:旋转轴运动到P1,上下轴到P1,压紧轴到P1!");
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
......@@ -566,7 +570,7 @@ namespace OnlineStore.DeviceLibrary
}
ACServerManager.AlarmClear(portName, slvAddr);
Thread.Sleep(50);
ACServerManager.ServoOn(portName, slvAddr);
ACServerManager.ServoOn(portName, slvAddr);
}
Thread.Sleep(1000);
//打开所有轴
......@@ -586,10 +590,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// <returns></returns>
private bool OpenAllAxis()
{
{
//判断轴是否正常
foreach (ConfigMoveAxis axis in moveAxisList)
{
{
if (ACServerManager.ServerOnStatus(axis.DeviceName, axis.GetAxisValue()))
{
LogUtil.info(LOGGER, StoreName + "成功打开轴:" + axis.Explain);
......@@ -600,7 +604,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "第一次打开轴" + axis.Explain + "失败,先清理一下报警,再重新打开一次");
ACServerManager.AlarmClear(axis.DeviceName, axis.GetAxisValue());
System.Threading.Thread.Sleep(1200);
ACServerManager.ServoOn(axis.DeviceName, axis.GetAxisValue());
ACServerManager.ServoOn(axis.DeviceName, axis.GetAxisValue());
System.Threading.Thread.Sleep(100);
if (ACServerManager.ServerOnStatus(axis.DeviceName, axis.GetAxisValue()))
{
......@@ -622,7 +626,7 @@ namespace OnlineStore.DeviceLibrary
public void CloseAllAxis()
{
LogUtil.info(StoreName+"关闭刹车,关闭伺服");
LogUtil.info(StoreName + "关闭刹车,关闭伺服");
KNDIOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
foreach (ConfigMoveAxis axis in moveAxisList)
{
......@@ -633,7 +637,7 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(100);
KNDIOMove(IO_Type.Run_Sign, IO_VALUE.LOW);
}
private int GetAlarmCodeByAxis(ConfigMoveAxis axis)
{
int alarmCode = LineAlarm.InOutAxisAlarm;
......@@ -669,7 +673,7 @@ namespace OnlineStore.DeviceLibrary
StopMove(true);
storeRunStatus = StoreRunStatus.Wait;
mainTimer.Enabled = false;
mainTimer.Enabled = false;
TimeSpan span = DateTime.Now - StartTime;
IsRun = false;
......@@ -677,7 +681,7 @@ namespace OnlineStore.DeviceLibrary
if (IsHasCompress_Axis)
{
ShuoKeControls.ClosePort();
}
}
//HDevelopExport.CloseAllCamera();
HumitureServer.StopTemperateServer();
......@@ -694,13 +698,13 @@ namespace OnlineStore.DeviceLibrary
return;
}
LogUtil.error(LOGGER, StoreName + " 报警,报警类型:" + alarmType);
this.alarmType = alarmType;
if (alarmType.Equals(StoreAlarmType.AxisAlarm) | alarmType.Equals(StoreAlarmType.AxisMoveError))
{
LogUtil.error(LOGGER, StoreName + "轴报警,关闭刹车,停止运动,关闭轴,打开报警灯");
KNDIOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StopMove(true );
StopMove(true);
}
else if (alarmType == StoreAlarmType.SuddenStop)
{
......@@ -708,7 +712,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, StoreName + "收到急停信号,关闭刹车,停止运动,关闭轴,打开报警灯 ");
KNDIOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StoreMove.EndMove();
StopMove(true);
StopMove(true);
storeStatus = StoreStatus.SuddenStop;
}
else if (alarmType.Equals(StoreAlarmType.NoAirCheck))
......@@ -716,8 +720,8 @@ namespace OnlineStore.DeviceLibrary
isNoAirCheck = true;
LogUtil.error(LOGGER, StoreName + " 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 ");
KNDIOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StoreMove.EndMove();
StopMove(true );
StoreMove.EndMove();
StopMove(true);
storeStatus = StoreStatus.SuddenStop;
}
//if (alarmType != StoreAlarmType.IoSingleTimeOut)
......@@ -750,11 +754,11 @@ namespace OnlineStore.DeviceLibrary
//preProcessTime = DateTime.Now;
stopwatch.Restart();
IoCheckProcess();
ShowTimeLog("IoCheckProcess");
TimerProcess();
ShowTimeLog("IoCheckProcess");
TimerProcess();
ShowTimeLog("TimerProcess");
//检查运动轴报警
if (storeRunStatus > StoreRunStatus.Wait && (!isInSuddenDown)&&(!isNoAirCheck))
if (storeRunStatus > StoreRunStatus.Wait && (!isInSuddenDown) && (!isNoAirCheck))
{
ShowTimeLog("开始检测轴报警");
CheckAxisAlarm();
......@@ -928,7 +932,7 @@ namespace OnlineStore.DeviceLibrary
{
//取新的Io状态
IO_VALUE autoSingle = KNDIOValue(IO_Type.AutoRun_Single);
if (ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) .Equals( 1))
if (ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun).Equals(1))
{
if (autoSingle.Equals(IO_VALUE.HIGH) && lastAutoRun.Equals(IO_VALUE.LOW))
{
......@@ -959,7 +963,7 @@ namespace OnlineStore.DeviceLibrary
//急停按钮
if (suddenBtn.Equals(IO_VALUE.LOW))
{
{
}
else if (resetBtn.Equals(IO_VALUE.HIGH))
{
......@@ -982,7 +986,7 @@ namespace OnlineStore.DeviceLibrary
//判断已经在复位中并且没有报警,不需要重新复位
if (StoreMove.MoveType.Equals(StoreMoveType.StoreReset) && alarmType.Equals(StoreAlarmType.None))
{
LogUtil.error(LOGGER, "收到复位信号:已经在复位中且没有报警,不需要重新复位!");
LogUtil.error(LOGGER, "收到复位信号:已经在复位中且没有报警,不需要重新复位!");
}
else
{
......@@ -1004,20 +1008,21 @@ namespace OnlineStore.DeviceLibrary
// ShowTimeLog("轴报警检测完成");
//}
}
private object safetyInProcess="";
private object safetyInProcess = "";
/// <summary>
/// 光栅处理
/// </summary>
private void SafetyLightProcess()
{
if (Monitor.TryEnter(safetyInProcess))
{
{
try
{
//遮挡光栅信号
if (KNDIOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.LOW))
{
if (NeedCheckSafetyLight.Equals(1))
{
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor))
......@@ -1036,6 +1041,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if (NeedCheckSafetyLight.Equals(2))
{
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor))
......@@ -1051,6 +1057,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
catch (Exception ex)
{
LogUtil.error("光栅处理出错:" + ex.ToString());
......@@ -1059,7 +1066,9 @@ namespace OnlineStore.DeviceLibrary
{
Monitor.Exit(safetyInProcess);
}
}
}
}
public void TimerProcess()
{
......@@ -1497,9 +1506,13 @@ namespace OnlineStore.DeviceLibrary
//}
List<string> codeList = CodeManager.CameraScan();
foreach (string str in codeList)
{
message = message + "=1+0x0-7x" + height + " =" + str + spiltStr;
}
if (!outMsg.Equals(""))
{
......@@ -1507,7 +1520,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("盘尺寸错误,清理二维码【" + message + "】");
message = "";
}
KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
onCodeReceived(message);
}
......
......@@ -190,8 +190,9 @@ namespace OnlineStore.DeviceLibrary
} else
{
NotOkMsg += "" +info.ToShowStr();
NotOkMsg += "" +info.ToShowStr();
}
ShuoKeControls.GetStatus(wait.SlvAddr);
}
}
......@@ -511,7 +512,7 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 出库
private DateTime startOutStoreTime = DateTime.Now;
/// <summary>
......@@ -774,6 +775,28 @@ namespace OnlineStore.DeviceLibrary
}
}
#endregion
#region 自动上料上料机构处理
public void ChargingLoad()
{
//1、上料门是否关闭
if (KNDIOValue(IO_Type.Load_DoorClose).Equals(IO_VALUE.HIGH)) //上料门关闭
{
//2、 进/料轴是否退回
//3、吸盘在最高端
if (KNDIOValue(IO_Type.Chuck_Up).Equals(IO_VALUE.HIGH))
{
}
//if (KNDIOValue(IO_Type.Load_DoorClose).Equals(IO_VALUE.HIGH))
//通过读伺服线圈信息,判断伺服在最高位置还是在最低位置
int value=ACServerManager.GetNotStatus(Config.Charging_Axis.DeviceName, Config.Charging_Axis.GetAxisValue());
//4、判断上料机构是否在最高点? 是---》无料盘 TrayCheck_Door
//5、是否检测到料盘?检测到,不运行;检测不到伺服运行
//电机运动 ACAxisMove(Config.Charging_Axis, ??, Config.Charging_Axis.TargetSpeed);
}
}
#endregion
public List<FixtureCodeInfo> waitOutStoreList = new List<FixtureCodeInfo>();
public object waitOutListLock = "";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!