Commit fb400ac6 LN

批量上料轴上升改为绝对运动

1 个父辈 692849d3
......@@ -14,7 +14,7 @@ namespace OnlineStore.Common
private static LogUtil instance = new LogUtil();
public delegate void ShowLog(string msg, Color color);
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOXLog");
// public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOX");
public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>();
public static System.Windows.Forms.RichTextBox logBox = null;
......
......@@ -36,7 +36,8 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.IOModule.AIOBOX">
<Reference Include="Asa.IOModule.AIOBOX, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
......
......@@ -23,7 +23,7 @@ namespace OnlineStore.DeviceLibrary
{
checkTimer = new System.Timers.Timer();
checkTimer.AutoReset = true;
checkTimer.Interval += 20;
checkTimer.Interval += 30;
checkTimer.Elapsed += CheckTimer_Elapsed;
checkTimer.Enabled = false;
}
......@@ -53,11 +53,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info("批量上料轴,检测到 " + TargetIoType + "="+TargetIoValue+",可以停止运动");
result = true;
}
else if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
{
LogUtil.info("批量上料轴,检测到正极限信号,可以停止运动");
result = true;
}
//else if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
//{
// LogUtil.info("批量上料轴,检测到正极限信号,可以停止运动");
// result = true;
//}
if (result)
{
//AutoAxisIsMove = 0;
......
......@@ -148,7 +148,6 @@ PRO,温湿度端口号,Humiture_Port,COM2,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,800,,,,,,,
PRO,(轴五)上料轴慢速匀速上升速度,BatchAxis_SlowSpeed,80,,,,,,,
PRO,(轴五)上料轴加速度,BatchAxis_AddSpeed,300,,,,,,,
PRO,(轴五)上料轴减速度,BatchAxis_DelSpeed,300,,,,,,,
PRO,(轴五)上料轴原点低速,BatchAxis_HomeLowSpeed,20,,,,,,,
......@@ -156,12 +155,14 @@ PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,2000,,,,,, ,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,1700000,,,,,, ,
PRO,(轴五)上料轴P2点(待机点),BatchAxis_P2,30000,,,,,,,
PRO,(轴五)上料轴P2速度,BatchAxis_P2_Speed,2000,,,,,,,
PRO,(轴五)上料轴P3点(上料目标位置),BatchAxis_P3,1700000,,,,,,,
PRO,(轴五)上料轴最小误差脉冲值,BatchAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,,
PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,2000,,,,,,,
PRO,(轴五)上料轴P2速度,BatchAxis_P2_Speed,2000,,,,,,,
PRO,(轴五)上料轴慢速匀速上升速度,BatchAxis_SlowSpeed,80,,,,,,,
PRO,(轴五)上料轴出料时距离检测信号需要下降的高度,BatchAxis_OutDownPosition,30000,,,,,,,
PRO,(轴五)上料轴出料时检测到料盘需要下降的高度,BatchAxis_DownPosition2,150000,,,,,,,
PRO,(轴五)上料轴最最大料盘高度mm,到达后无法批量出库,BatchAxis_MaxHeight,250,,,,,,,
......
......@@ -208,16 +208,16 @@ namespace OnlineStore.DeviceLibrary
{
wait.IsEnd = AutomaticBaiting.BatchAxisIsEnd(wait, span);
}
if (!wait.IsEnd)
{
bool MoveEnd = ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0);
int outCount = ACServerManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
int errorCount = Math.Abs(outCount - wait.TargetPosition);
if (MoveEnd && errorCount < wait.AxisInfo.CanErrorCountMax)
{
wait.IsEnd = true;
}
}
//if (!wait.IsEnd)
//{
// bool MoveEnd = ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0);
// int outCount = ACServerManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
// int errorCount = Math.Abs(outCount - wait.TargetPosition);
// if (MoveEnd && errorCount < wait.AxisInfo.CanErrorCountMax)
// {
// wait.IsEnd = true;
// }
//}
if (wait.IsEnd)
{
BatchAxisController.StopCheck();
......
......@@ -27,15 +27,15 @@ namespace OnlineStore.DeviceLibrary
public static string LastCode = "";
private static string LastPosId = "";
public static int AxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.AxisChangeValue);
// public static string WarnMsg = "";
// public static string WarnMsg = "";
public static string CodeMsg = "";
public static string Name = "批量上下料 ";
public static StoreMoveInfo StoreMove = null;
public static StoreRunStatus AutoBaitingStatus = StoreRunStatus.Wait;
public static bool IsNeedStartInout = false;
public static bool IsNeedAxisHome = true ;
public static bool IsNeedAxisHome = true;
/// <summary>
/// 记录没开门状态下,已经出库的数量
/// </summary>
......@@ -105,9 +105,10 @@ namespace OnlineStore.DeviceLibrary
OutStoreProcess();
}
}
}catch(Exception ex)
}
catch (Exception ex)
{
LogUtil.error(Name+"出错:"+ex.StackTrace);
LogUtil.error(Name + "出错:" + ex.StackTrace);
}
}
......@@ -121,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
//需要判断门关闭
if (!DoorIsClose())
{
// msg = (ResourceControl.GetString(ResourceControl.CloseError, "锁门失败:请先关闭上料机构")); ;
// msg = (ResourceControl.GetString(ResourceControl.CloseError, "锁门失败:请先关闭上料机构")); ;
return ResourceControl.CloseError;
}
......@@ -135,7 +136,7 @@ namespace OnlineStore.DeviceLibrary
BatchInStoreCount = 0;
BatchInStoreHeight = 0;
}
public static void ClearInStoreInfo()
public static void ClearInStoreInfo()
{
LastCode = "";
LastCodeList = new List<string>();
......@@ -146,7 +147,7 @@ namespace OnlineStore.DeviceLibrary
public static void StopRun()
{
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
AutomaticBaiting.CylinderMove(IO_Type.Clamping_Work, IO_Type.Clamping_Relax, null);
ClearInStoreInfo();
ClearOutStoreInfo();
......@@ -156,7 +157,7 @@ namespace OnlineStore.DeviceLibrary
BatchAxisController.StopCheck();
StoreMove.EndMove();
ClearInStoreInfo();
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
AutomaticBaiting.CylinderMove(IO_Type.Clamping_Work, IO_Type.Clamping_Relax, null);
CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, false);
BatchDoorClose(false);
......@@ -165,26 +166,26 @@ namespace OnlineStore.DeviceLibrary
/// 复位过程调用此方法
/// </summary>
/// <returns></returns>
public static bool StartReset()
public static bool StartReset()
{
return Reset(true, false);
}
public static bool Reset(bool isNeedHome, bool isNeedInout)
{
{
string msg = CanStart();
if (!String.IsNullOrEmpty(msg))
{
LogUtil.info(Name + "复位失败:" + msg);
return false;
}
}
if (StoreManager.Store.alarmType.Equals(StoreAlarmType.BatchAlarm) ||
StoreManager.Store.alarmType.Equals(StoreAlarmType.BatchAxisAlarm) || StoreManager.Store.alarmType.Equals(StoreAlarmType.BatchIoTimeOut))
{
LogUtil.info(Name + " 复位前,清理报警【" + StoreManager.Store.alarmType + "】");
StoreManager.Store.alarmType = StoreAlarmType.None;
IOManager.IOMove(IO_Type.Buzzer_Sign, IO_VALUE.LOW);
// WarnMsg = "";
// WarnMsg = "";
SetWarnMsg("");
}
AutomaticBaiting.IsNeedStartInout = isNeedInout;
......@@ -198,10 +199,10 @@ namespace OnlineStore.DeviceLibrary
AutoBaitingStatus = StoreRunStatus.Reset;
StoreMove.NewMove(StoreMoveType.StoreReset);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R00_Start);
LogUtil.info(Name + "开始复位,是否入库【" + AutomaticBaiting.IsNeedStartInout + "】,上料轴回原点【"+AutomaticBaiting.IsNeedAxisHome+"】");
LogUtil.info(Name + "开始复位,是否入库【" + AutomaticBaiting.IsNeedStartInout + "】,上料轴回原点【" + AutomaticBaiting.IsNeedAxisHome + "】");
return true;
}
private static void ResetProcess()
{
......@@ -220,14 +221,14 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R01_CloseDoor);
//关闭门,轴回原点,检测
BatchDoorClose(true);
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
AutomaticBaiting.CylinderMove(IO_Type.Clamping_Work, IO_Type.Clamping_Relax, StoreMove);
CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, true);
LogUtil.info(Name + "复位中:关闭门锁");
break;
case StoreMoveStep.AUTO_R01_CloseDoor:
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R02_AutoAxisHome);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R02_AutoAxisHome);
StoreMove.TimeOutSeconds = 120;
bool isClearAlarm = false;
if (ACServerManager.GetAlarmStatus(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue()).Equals(1))
......@@ -236,11 +237,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(Name + "复位中:批量上下料轴清理报警");
ACServerManager.AlarmClear(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
Thread.Sleep(100);
}
}
if (isClearAlarm || IsNeedAxisHome)
{
LogUtil.info(Name + "复位中:批量上下料轴原点返回");
ACAxisHomeMove(StoreManager.Config.Batch_Axis);
ACAxisHomeMove(StoreManager.Config.Batch_Axis);
}
else
{
......@@ -248,10 +249,10 @@ namespace OnlineStore.DeviceLibrary
}
break;
case StoreMoveStep.AUTO_R02_AutoAxisHome:
IsNeedInstore();
break;
case StoreMoveStep.AUTO_R03_AutoAxisHome:
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
......@@ -271,7 +272,7 @@ namespace OnlineStore.DeviceLibrary
StartInOut();
}
break;
case StoreMoveStep.AUTO_R04_AutoBack:
case StoreMoveStep.AUTO_R04_AutoBack:
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R05_ToP2);
LogUtil.info(Name + "复位中:上料轴移动到p1点【" + StoreManager.Config.BatchAxis_P2 + "】");
ACAxisAbsMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P2, StoreManager.Config.BatchAxis_P2_Speed);
......@@ -280,7 +281,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + "复位完成");
StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing;
// WarnMsg = "";
// WarnMsg = "";
SetWarnMsg("");
IsNeedStartInout = false;
break;
......@@ -294,9 +295,9 @@ namespace OnlineStore.DeviceLibrary
if (IsNeedStartInout)
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_R03_AutoAxisHome);
int speed = StoreManager.Config.BatchAxis_TargetSpeed ;
int speed = StoreManager.Config.BatchAxis_TargetSpeed;
LogUtil.info(Name + "复位中:检测是否有料盘,批量轴匀速上升【" + speed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, speed, IO_Type.TrayCheck_LoadMaterial);
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P3, speed, IO_Type.TrayCheck_LoadMaterial);
}
else
{
......@@ -344,12 +345,12 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_MoveToUp);
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
LogUtil.info(Name + " 入料 ,已检测到料盘,轴不需要上升");
InStoreLog(" 已检测到料盘,轴不需要上升");
}
else
{
LogUtil.info(Name + " 入料 ,轴上升到检测到料盘,速度【" + StoreManager.Config.Batch_Axis.TargetSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed, IO_Type.TrayCheck_LoadMaterial);
InStoreLog(" 轴上升到检测到料盘,速度【" + StoreManager.Config.Batch_Axis.TargetSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P3, StoreManager.Config.Batch_Axis.TargetSpeed, IO_Type.TrayCheck_LoadMaterial);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I02_MoveToUp))
......@@ -359,7 +360,7 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I03_ScanCode))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I04_SuckingDisc_Down);
LogUtil.info(Name + "入料: 扫码结束,二维码【" + LastCode + "】 吸盘开始下降");
InStoreLog(" 扫码结束,二维码【" + LastCode + "】 吸盘开始下降");
CylinderMove(IO_Type.ClampingDisc_Down, IO_Type.ClampingDisc_Up, true);
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I04_SuckingDisc_Down))
......@@ -374,7 +375,7 @@ namespace OnlineStore.DeviceLibrary
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I06_SuckingDisc_Up);
LogUtil.info(Name + "入料: 吸盘上升");
InStoreLog(" 吸盘上升");
CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, false);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampingDisc_Down, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1500));
......@@ -403,8 +404,8 @@ namespace OnlineStore.DeviceLibrary
if ((!needCheck) || IOManager.IOValue(IO_Type.Clamping_Check).Equals(IO_VALUE.HIGH))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I07_BatchAxisUp);
LogUtil.info(Name + "入料: 批量轴匀速上升【" + StoreManager.Config.BatchAxis_SlowSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_SlowSpeed, IO_Type.TrayCheck_LoadMaterial);
InStoreLog(" 批量轴匀速上升【" + StoreManager.Config.BatchAxis_SlowSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P3, StoreManager.Config.BatchAxis_SlowSpeed, IO_Type.TrayCheck_LoadMaterial);
CylinderMove(IO_Type.ClampingDisc_Up, IO_Type.ClampingDisc_Down, true);
if (StoreManager.Config.Default_TrayWidth.Equals(7))
{
......@@ -425,14 +426,14 @@ namespace OnlineStore.DeviceLibrary
{
SetWarnMsg(ResourceControl.NO_Clamping_Check);
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, WarnObj.WarnMsg, WarnObj.WarnMsg, StoreMoveType.InStore);
LogUtil.error(Name + "入料: 吸盘上升后未检测到夹爪气缸料盘信号,吸取料盘失败", 106);
LogUtil.error(Name + StoreMove.MoveStep + "入料: 吸盘上升后未检测到夹爪气缸料盘信号,吸取料盘失败", 106);
}
}
else
{
SetWarnMsg(ResourceControl.XiLiaoError);
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, WarnObj.WarnMsg, WarnObj.WarnMsg, StoreMoveType.InStore);
LogUtil.error(Name + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105);
LogUtil.error(Name + StoreMove.MoveStep + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I07_BatchAxisUp))
......@@ -464,14 +465,14 @@ namespace OnlineStore.DeviceLibrary
if (LastCode.Equals(""))
{
LogUtil.info(Name + "入料: 未扫到二维码尺寸:【" + LastWidth + "*" + LastHeight + "】,将料盘送出,等待料盘拿走");
InStoreLog(" 未扫到二维码尺寸:【" + LastWidth + "*" + LastHeight + "】,将料盘送出,等待料盘拿走");
SendTrayOut();
}
else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I08_GetPosId);
LogUtil.debug(Name + "入料: 从服务器获取入库PosId,尺寸:【" + LastWidth + "*" + LastHeight + "】二维码【" + LastCode + "】");
LogUtil.debug(Name + StoreMove.MoveStep + "入料: 从服务器获取入库PosId,尺寸:【" + LastWidth + "*" + LastHeight + "】二维码【" + LastCode + "】");
GetInStorePosId(ProcessMsg());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(3000));
......@@ -492,7 +493,7 @@ namespace OnlineStore.DeviceLibrary
//WarnMsg = ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败");
SetWarnMsg(ResourceControl.XiLiaoError);
StoreManager.Store.Alarm(StoreAlarmType.BatchAlarm, ResourceControl.GetString(ResourceControl.XiLiaoError, "吸盘吸料失败"), WarnObj.WarnMsg, StoreMoveType.InStore);
LogUtil.error(Name + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105);
LogUtil.error(Name + StoreMove.MoveStep + "入料: 吸盘上升后未检测到吸盘压力信号,吸取料盘失败", 105);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I08_GetPosId))
......@@ -501,14 +502,14 @@ namespace OnlineStore.DeviceLibrary
if (StoreManager.Store.StoreMove.MoveType.Equals(StoreMoveType.InStore) || (!LastPosId.Equals("")))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I09_WaitTrayLeave);
LogUtil.info(Name + "入料: 开始入库【" + LastPosId + "】,等待料盘拿走");
InStoreLog(" 开始入库【" + LastPosId + "】,等待料盘拿走");
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Clamping_Relax, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Clamping_Work, IO_VALUE.LOW));
}
else
{
LogUtil.info(Name + "入料: 入库失败,尺寸:【" + LastWidth + "*" + LastHeight + "】将料盘送出,等待料盘拿走");
InStoreLog(" 入库失败,尺寸:【" + LastWidth + "*" + LastHeight + "】将料盘送出,等待料盘拿走");
SendTrayOut();
}
}
......@@ -530,16 +531,15 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I11_BatchAxisHome))
{
//TODO
LogUtil.info(Name + "入料:已经没有料盘,批量上料结束");
InStoreLog(" 已经没有料盘,批量上料结束");
StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing;
}
else
{
LogUtil.error(Name + "未找到步骤:" + StoreMove.MoveType);
LogUtil.error(Name + StoreMove.MoveStep + "未找到步骤:" + StoreMove.MoveType);
}
}
private static int GetHeight()
{
//计算高度
......@@ -557,36 +557,17 @@ namespace OnlineStore.DeviceLibrary
addHeight = StoreManager.Config.LastTrayAddHeight;
}
LastHeight += addHeight;
string msg = Name + " 计算盘高:脉冲值 [" + EndMovePosition + "-" + StartMovePosition + "]=[" + cha + "] ,补充[" + addHeight + "]计算后[" + LastHeight + "]";
string msg = Name + StoreMove.MoveStep + " 计算盘高:脉冲值 [" + EndMovePosition + "-" + StartMovePosition + "]=[" + cha + "] ,补充[" + addHeight + "]计算后[" + LastHeight + "]";
if (LastHeight < 0)
{
LastHeight = StoreManager.Config.GetDefaultHeight();
}
//if (StoreManager.Config.Default_TrayWidth.Equals(7))
//{
//高度=8的料盘容易被测成12的,判断如果计算的高度<12都认为是8mm,
//if (LastHeight >= 20)
//{
// LastHeight = 24;
//}
//else if (LastHeight >= 12)
//{
// LastHeight = 12;
//}
//else
//{
// LastHeight = 8;
//}
//}
//else
//{
if (LastHeight <= 8) { LastHeight = 8; }
else
{
LastHeight = (int)Math.Floor(1F * LastHeight / 4) * 4;
}
//}
LogUtil.info(msg + ",归类为" + LastHeight);
LogUtil.info(msg + ",归类为" + LastHeight + "【" + LastCode + "】");
return LastHeight;
}
private static List<AutoStorePosition> AllPosList = null;
......@@ -608,7 +589,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.info("未找到盘高>="+LastHeight+"的库位");
LogUtil.info("未找到盘高>=" + LastHeight + "的库位");
}
bool result = StoreManager.Store.StartInStoreMove(new InOutStoreParam(LastCode, posId, LastHeight, LastWidth), true, false);
StoreMove.WaitList.Add(WaitResultInfo.WaitStoreRuning());
......@@ -616,13 +597,13 @@ namespace OnlineStore.DeviceLibrary
private static void SuckingDiscWork()
{
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I05_SuckingDisc_Work);
SuckingDisc_WorkCount++;
LogUtil.info(Name + "入料: 吸盘开始第" + SuckingDisc_WorkCount + "次工作");
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.HIGH);
// StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.HIGH));
InStoreLog(" 吸盘开始第" + SuckingDisc_WorkCount + "次工作");
// IOManager.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.HIGH);
// StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.HIGH));
CylinderMove(IO_Type.Clamping_Relax, IO_Type.Clamping_Work, StoreMove);
StoreMove.OneWaitCanEndStep = true;
......@@ -632,7 +613,7 @@ namespace OnlineStore.DeviceLibrary
{
if (WarnObj.WarnMsg.Contains(TimeOut))
{
SetWarnMsg( "");
SetWarnMsg("");
}
}
......@@ -643,7 +624,7 @@ namespace OnlineStore.DeviceLibrary
//如果有超时异常,需要清理
if (StoreManager.Store.alarmType.Equals(StoreAlarmType.BatchIoTimeOut))
{
LogUtil.info(Name + " 扫码前清理超时报警【" + StoreManager.Store.alarmType + "】");
LogUtil.info(Name + StoreMove.MoveStep + " 扫码前清理超时报警【" + StoreManager.Store.alarmType + "】");
StoreManager.Store.alarmType = StoreAlarmType.None;
IOManager.IOMove(IO_Type.Buzzer_Sign, IO_VALUE.LOW);
ClearTimeOut();
......@@ -652,7 +633,7 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I03_ScanCode);
LogUtil.info(Name + "入料: 开始扫码,最多等待10000 ");
InStoreLog(" 开始扫码,最多等待10000 ");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));
StoreMove.WaitList.Add(WaitResultInfo.WaitCodeOK());
StoreMove.OneWaitCanEndStep = true;
......@@ -660,12 +641,22 @@ namespace OnlineStore.DeviceLibrary
}
else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I11_BatchAxisHome);
LogUtil.info(Name + "入料:已经没有料盘,直接回待机点P2【" + StoreManager.Config.BatchAxis_P2 + "】");
//StoreMove.TimeOutSeconds = 120;
//ACAxisHomeMove(StoreManager.Config.Batch_Axis);
//LogUtil.info(Name + "复位中:上料轴移动到p2点【" + StoreManager.Config.BatchAxis_P2 + "】");
ACAxisAbsMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P2, StoreManager.Config.BatchAxis_P2_Speed);
//判断是否到达目标位置
int targetP = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis);
int cha = Math.Abs(targetP - StoreManager.Config.BatchAxis_P3);
if (cha < StoreManager.Config.Batch_Axis.CanErrorCountMax)
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I11_BatchAxisHome);
InStoreLog(" 批量轴到达P3,已经没有料盘,直接回待机点P2【" + StoreManager.Config.BatchAxis_P2 + "】");
ACAxisAbsMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P2, StoreManager.Config.BatchAxis_P2_Speed);
}
else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_MoveToUp);
InStoreLog(" 轴上升到检测到料盘,速度【" + StoreManager.Config.Batch_Axis.TargetSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P3, StoreManager.Config.Batch_Axis.TargetSpeed, IO_Type.TrayCheck_LoadMaterial);
}
}
}
......@@ -695,7 +686,7 @@ namespace OnlineStore.DeviceLibrary
return "启动出料失败, Status = " + AutoBaitingStatus + ",MoveType = " + StoreMove.MoveType;
}
}
private static void OutStoreProcess()
{
......@@ -713,7 +704,7 @@ namespace OnlineStore.DeviceLibrary
{
if (IOManager.IOValue(IO_Type.OutCheck).Equals(IO_VALUE.LOW) && IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
{
LogUtil.info(Name + "出料: OutCheck=LOW ,直接打开门锁 ");
OutStoreLog("OutCheck=LOW ,直接打开门锁 ");
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O02_WaitDoorOpen);
BatchDoorOpen(true);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
......@@ -721,7 +712,7 @@ namespace OnlineStore.DeviceLibrary
else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O01_BatchAxisDown);
LogUtil.info(Name + "出料: OutCheck=HIGH或TrayCheck_LoadMaterial=High,批量轴先匀速下降到P2 ");
OutStoreLog(": OutCheck=HIGH或TrayCheck_LoadMaterial=High,批量轴先匀速下降到P2 ");
ACAxisAbsMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P2, StoreManager.Config.BatchAxis_P2_Speed);
return;
//批量轴直接走到P2
......@@ -731,23 +722,24 @@ namespace OnlineStore.DeviceLibrary
StoreManager.Config.Batch_Axis.TargetPosition = Config.BatchAxis_P2;
ACServerManager.AbsMove(Config.Batch_Axis.DeviceName, Config.Batch_Axis.GetAxisValue(), Config.BatchAxis_OutMaxValue, Config.BatchAxis_P2_Speed);
}
}else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O01_BatchAxisDown))
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O01_BatchAxisDown))
{
LogUtil.info(Name + "出料: 批量轴已下降到P2 ,打开门锁 ");
OutStoreLog("批量轴已下降到P2 ,打开门锁 ");
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O02_WaitDoorOpen);
BatchDoorOpen(true);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O02_WaitDoorOpen))
{
LogUtil.info(Name + "出料:回到待机点完成,出料结束");
OutStoreLog("回到待机点完成,出料结束");
StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing;
return;
if (IOManager.IOValue(IO_Type.OutCheck).Equals(IO_VALUE.HIGH))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O03_WaitOutSingleLow);
LogUtil.info(Name + " 出料 ,等待出料检测信号关闭");
OutStoreLog("等待出料检测信号关闭");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.OutCheck, IO_VALUE.LOW));
}
else
......@@ -758,7 +750,7 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O03_WaitOutSingleLow))
{
StartSpeedOut();
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O04_SpeedMove))
{
......@@ -768,8 +760,8 @@ namespace OnlineStore.DeviceLibrary
int count = Math.Abs(currValue - StoreManager.Config.BatchAxis_OutMaxValue);
if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH) || count < StoreManager.Config.Batch_Axis.CanErrorCountMax)
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O06_WaitDI12Low);
LogUtil.info(Name + " 出料,当前坐标【"+ currValue + "】已到达高点 ,等待出料检测信号关闭(最多等待10秒)");
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O06_WaitDI12Low);
OutStoreLog("当前坐标【" + currValue + "】已到达高点 ,等待出料检测信号关闭(最多等待10秒)");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.OutCheck, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));
StoreMove.OneWaitCanEndStep = true;
......@@ -778,25 +770,26 @@ namespace OnlineStore.DeviceLibrary
{
//等待出料信号亮
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O03_WaitOutSingleLow);
LogUtil.info(Name + " 出料 ,等待出料检测信号关闭");
OutStoreLog("等待出料检测信号关闭");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.OutCheck, IO_VALUE.LOW));
}
}else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O06_WaitDI12Low))
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O06_WaitDI12Low))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O07_WaitDown);
LogUtil.info(Name + " 出料,等待1秒后批量轴回P2点");
OutStoreLog("等待1秒后批量轴回P2点");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O07_WaitDown))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O08_BackToP2);
LogUtil.info(Name + "出料:上料轴移动到p2点【" + StoreManager.Config.BatchAxis_P2 + "】");
OutStoreLog("上料轴移动到p2点【" + StoreManager.Config.BatchAxis_P2 + "】");
ACAxisAbsMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P2, StoreManager.Config.BatchAxis_P2_Speed);
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O08_BackToP2))
{
//TODO
LogUtil.info(Name + "出料:回到待机点完成,出料结束");
OutStoreLog("回到待机点完成,出料结束");
StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing;
}
......@@ -809,20 +802,20 @@ namespace OnlineStore.DeviceLibrary
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O04_SpeedMove);
AUTO_SA_Config Config = StoreManager.Config;
LogUtil.info(Name + " 出料 ,轴上升到检测到出料信号,速度【" + Config.BatchAxis_SlowSpeed + "】,最大上升高度【" + Config.BatchAxis_OutMaxValue + "】");
OutStoreLog("轴上升到检测到出料信号,速度【" + Config.BatchAxis_SlowSpeed + "】,最大上升高度【" + Config.BatchAxis_OutMaxValue + "】");
//ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_SlowSpeed, IO_Type.OutCheck);
StoreMove.WaitList.Add(WaitResultInfo.WaitBatchAxisStop(Config.Batch_Axis, Config.BatchAxis_OutMaxValue, IO_Type.OutCheck));
BatchAxisController.StartCheck(IO_Type.OutCheck);
StoreManager.Config.Batch_Axis.TargetPosition = Config.BatchAxis_OutMaxValue;
int speed = Config.BatchAxis_SlowSpeed;
ACServerManager.AbsMove(Config.Batch_Axis.DeviceName, Config.Batch_Axis.GetAxisValue(), Config.BatchAxis_OutMaxValue, speed);
}
private static void StopOutProcess()
{
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore))
{
LogUtil.error(Name+"正在出料中,停止出料流程");
LogUtil.error(Name + "正在出料中,停止出料流程");
ACServerManager.SuddenStop(StoreManager.Config.Batch_Axis);
StoreMove.EndMove();
AutoBaitingStatus = StoreRunStatus.Runing;
......@@ -844,7 +837,7 @@ namespace OnlineStore.DeviceLibrary
{
if (DoorIsClose())
{
if (IOManager.IOValue(IO_Type.BatchDoor_Close).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.BatchDoor_Open).Equals(IO_VALUE.LOW)&&
if (IOManager.IOValue(IO_Type.BatchDoor_Close).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.BatchDoor_Open).Equals(IO_VALUE.LOW) &&
IOManager.IOValue(IO_Type.BatchDoor_Close2).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.BatchDoor_Open2).Equals(IO_VALUE.LOW))
{
return true;
......@@ -885,9 +878,9 @@ namespace OnlineStore.DeviceLibrary
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.BatchDoor_Close2, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.BatchDoor_Open2, IO_VALUE.HIGH));
}
}
}
public static bool BatchDoorClose(bool isWait)
public static bool BatchDoorClose(bool isWait)
{
if (!IOManager.IOValue(IO_Type.DoorClose_LoadMaterial).Equals(IO_VALUE.HIGH))
{
......@@ -908,5 +901,16 @@ namespace OnlineStore.DeviceLibrary
return true;
}
private static void InStoreLog(string msg)
{
LogUtil.info(Name + " " + StoreMove.MoveStep + "" + "入料:" + msg);
}
private static void OutStoreLog(string msg)
{
LogUtil.info(Name + " " + StoreMove.MoveStep + "" + "出料:" + msg);
}
}
}
......@@ -15,15 +15,15 @@ namespace OnlineStore.DeviceLibrary
private static int StartMovePosition = 0;
private static int EndMovePosition = 0;
//public static int AutoAxisIsMove = 0;
private static void ACAxisSpeedMove(ConfigMoveAxis moveAxis, int targetSpeed,string targetSingle)
private static void ACAxisSpeedMove(ConfigMoveAxis moveAxis,int targetPosition, int targetSpeed,string targetSingle)
{
//AutoAxisIsMove = 1;
StartMovePosition = ACServerManager.GetActualtPosition(moveAxis.DeviceName, moveAxis.GetAxisValue());
EndMovePosition = StartMovePosition;
LogUtil.debug("当前坐标:"+StartMovePosition+",批量上料轴开始匀速"+targetSpeed+"上升");
StoreMove.WaitList.Add(WaitResultInfo.WaitBatchAxisStop(moveAxis,0, targetSingle));
StoreMove.WaitList.Add(WaitResultInfo.WaitBatchAxisStop(moveAxis,targetPosition, targetSingle));
BatchAxisController.StartCheck(targetSingle);
ACServerManager.SpeedMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetSpeed);
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition,targetSpeed);
}
private static void ACAxisAbsMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
......@@ -58,8 +58,8 @@ namespace OnlineStore.DeviceLibrary
}
else
{
// msg = Name + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
// msg = Name + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
SetWarnMsgAndLog(ResourceControl.AxisHomeMoveAlarm, StoreMove.MoveStep + "", moveAxis.GetNameStr(), outCount + "");
msg = WarnObj.WarnMsg;
LogUtil.error(msg, 100);
......@@ -67,10 +67,11 @@ namespace OnlineStore.DeviceLibrary
}
}
return true;
}else if ( IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
}
else if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
{
LogUtil.error("批量轴原点返回时BatchAxis_Limit=High ,停止运动",30);
ACServerManager.SuddenStop(StoreManager.Config.Batch_Axis);
LogUtil.error("批量轴原点返回时BatchAxis_Limit=High ,停止运动", 30);
ACServerManager.SuddenStop(StoreManager.Config.Batch_Axis);
}
return false;
}
......@@ -281,22 +282,26 @@ namespace OnlineStore.DeviceLibrary
bool result = false;
if (IOManager.IOValue(wait.IoType).Equals(wait.IoValue))
{
LogUtil.debug(wait.ToStr() + " 检测到 " + wait.IoType + "="+wait.IoValue+",可以停止运动");
result = true;
}
else if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
{
LogUtil.debug(wait.ToStr() + " 检测到正极限信号,可以停止运动");
LogUtil.debug(wait.ToStr() + " 检测到 " + wait.IoType + "=" + wait.IoValue + ",可以停止运动");
result = true;
}
//else if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
//{
// LogUtil.debug(wait.ToStr() + " 检测到正极限信号,可以停止运动");
// result = true;
//}
else if (wait.TargetPosition > 0)
{
bool MoveEnd = ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0);
int outCount = ACServerManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
int errorCount = Math.Abs(outCount - wait.TargetPosition);
if (MoveEnd && (errorCount < wait.AxisInfo.CanErrorCountMax))
if (MoveEnd)
{
result = true;
int outCount = ACServerManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
int errorCount = Math.Abs(outCount - wait.TargetPosition);
if ((errorCount < wait.AxisInfo.CanErrorCountMax))
{
result = true;
}
}
}
if (result)
......
......@@ -706,6 +706,12 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("BatchAxis_DownPosition2", false)]
public int BatchAxis_DownPosition2 { get; set; }
/// <summary>
/// PRO,(轴五) 上料轴P3点(上料目标位置),BatchAxis_P3,1700000,,,,,,,
/// </summary>
[ConfigProAttribute("BatchAxis_P3", false)]
public int BatchAxis_P3 { get; set; }
private Dictionary<string, string> CodeSizeMap = null;
private static char codeSpilt = '#';
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!