Commit 7a872b9d 几米阳光

取出料盘逻辑修改。出库逻辑修改。AIO使用AIOBOX2

1 个父辈 74e65d3d
......@@ -187,6 +187,7 @@ IO模块读取时间改为可配置。
界面上增加按钮。
2.需要修改:出库时不使用极限信号,增加一个最高点配置。
取出料盘逻辑修改。出库逻辑修改。AIO使用AIOBOX2
PRO,(轴五)上料轴出库上升最大高度,BatchAxis_OutMaxValue,1600000,,,,,,,
......
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
//public static uint DefaultDOCount = 16;
public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>();
public Dictionary<string, AIOBOX2> AIOMap = new Dictionary<string, AIOBOX2>();
public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>();
public Dictionary<string, List<Box_Sta>> DOValueMap = new Dictionary<string, List<Box_Sta>>();
......@@ -29,7 +29,7 @@ namespace OnlineStore.DeviceLibrary
private object DOLock = "";
public void ConnectionIP(string ioIp )
{
AIOBOX aioBox = null;
AIOBOX2 aioBox = null;
if (AIOMap.ContainsKey(ioIp))
{
aioBox = AIOMap[ioIp];
......@@ -52,7 +52,7 @@ namespace OnlineStore.DeviceLibrary
try
{
// Create new modbus master and add event functions
aioBox = new AIOBOX();
aioBox = new AIOBOX2();
aioBox.IP = ioIp;
int DIMS = ConfigAppSettings.GetIntValue("DIMS");
if (DIMS < 20)
......@@ -68,7 +68,7 @@ namespace OnlineStore.DeviceLibrary
aioBox.AutoReadDI(true, DIMS);
aioBox.AutoReadDO (true, DOMS);
aioBox.LogOut = true;
aioBox.Reconnect_Event += AioBox_Reconnect_Event;
//aioBox.Reconnect_Event += AioBox_Reconnect_Event;
if (StoreManager.Config.GetDILength(ioIp).Equals(8))
{
......@@ -116,7 +116,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private void AioBox_Reconnect_Event(AIOBOX box, int times, ref bool conn, Dictionary<string, string> dict)
private void AioBox_Reconnect_Event(AIOBOX2 box, int times, ref bool conn, Dictionary<string, string> dict)
{
conn = true;
string msg = "重连AIO块【" + box.IP + "】次数:" + times + "【" + box.ErrInfo + "】,连接信息如下\r\n";
......@@ -129,7 +129,7 @@ namespace OnlineStore.DeviceLibrary
}
private DateTime lastLogTime = DateTime.Now;
//private void AioBox_Log_RxTx_Event(AIOBOX box, string[] s)
//private void AioBox_Log_RxTx_Event(AIOBOX2 box, string[] s)
//{
// TimeSpan span = DateTime.Now - lastLogTime;
// //if (span.TotalMinutes > 1)
......@@ -142,7 +142,7 @@ namespace OnlineStore.DeviceLibrary
// }
//}
private void AioBox_Log_Out_Event(AIOBOX box, string[] s)
private void AioBox_Log_Out_Event(AIOBOX2 box, string[] s)
{
foreach (string str in s)
{
......@@ -150,7 +150,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private void AioBox_DI_Changed_Event(AIOBOX box, Box_Sta[] sta)
private void AioBox_DI_Changed_Event(AIOBOX2 box, Box_Sta[] sta)
{
try
{
......@@ -161,7 +161,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("AioBox_DI_Changed_Event出错:" + ex.ToString());
}
}
private void AioBox_DO_Changed_Event(AIOBOX box, Box_Sta[] sta)
private void AioBox_DO_Changed_Event(AIOBOX2 box, Box_Sta[] sta)
{
try
{
......@@ -256,7 +256,7 @@ namespace OnlineStore.DeviceLibrary
//foreach (string io in list)
//{
// //判断是否连接,如果没有连接自动重连
// AIOBOX client = AIOMap[io];
// AIOBOX2 client = AIOMap[io];
// if (!client.IsConn)
// {
// //重连
......@@ -290,7 +290,7 @@ namespace OnlineStore.DeviceLibrary
//关闭所有的DO
public override void CloseAllDO()
{
foreach (AIOBOX aio in AIOMap.Values)
foreach (AIOBOX2 aio in AIOMap.Values)
{
ushort length = StoreManager.Config.GetDILength(aio.IP);
for (ushort i = 0; i < length; i++)
......@@ -304,7 +304,7 @@ namespace OnlineStore.DeviceLibrary
public override void CloseAllConnection()
{
foreach (AIOBOX aio in AIOMap.Values)
foreach (AIOBOX2 aio in AIOMap.Values)
{
aio.Close();
}
......@@ -317,7 +317,7 @@ namespace OnlineStore.DeviceLibrary
try
{
AIOBOX aioBox = getAIO(ioIp);
AIOBOX2 aioBox = getAIO(ioIp);
if (aioBox != null)
{
Box_Addr add = GetAddr(StartAddress);
......@@ -350,7 +350,7 @@ namespace OnlineStore.DeviceLibrary
try
{
AIOBOX aioBox = getAIO(ioIp);
AIOBOX2 aioBox = getAIO(ioIp);
Box_Sta currBox_Sta = GetBox_Sta(onOff);
if (aioBox != null)
{
......@@ -388,7 +388,7 @@ namespace OnlineStore.DeviceLibrary
{
try
{
AIOBOX aioBox = getAIO(ioIp);
AIOBOX2 aioBox = getAIO(ioIp);
if (aioBox != null)
{
Box_Sta[] allDi = aioBox.ReadDI(Box_Addr.DI_1, StoreManager.Config.GetDILength(ioIp));
......@@ -404,7 +404,7 @@ namespace OnlineStore.DeviceLibrary
{
try
{
AIOBOX aioBox = getAIO(ioIp);
AIOBOX2 aioBox = getAIO(ioIp);
if (aioBox != null)
{
Box_Sta[] allDO = aioBox.ReadDO(Box_Addr.DO_1, StoreManager.Config.GetDOLength(ioIp));
......@@ -421,7 +421,7 @@ namespace OnlineStore.DeviceLibrary
IO_VALUE value = IO_VALUE.LOW;
try
{
AIOBOX aioBox = getAIO(ioIP);
AIOBOX2 aioBox = getAIO(ioIP);
if (aioBox != null)
{
Box_Sta sta = Box_Sta.Off;
......@@ -451,7 +451,7 @@ namespace OnlineStore.DeviceLibrary
IO_VALUE value = IO_VALUE.LOW;
try
{
AIOBOX aioBox = getAIO(ioIP);
AIOBOX2 aioBox = getAIO(ioIP);
if (aioBox != null)
{
Box_Sta sta = Box_Sta.Off;
......@@ -514,9 +514,9 @@ namespace OnlineStore.DeviceLibrary
}
}
private AIOBOX getAIO(string ioIp)
private AIOBOX2 getAIO(string ioIp)
{
AIOBOX aioBox = null;
AIOBOX2 aioBox = null;
if (AIOMap.ContainsKey(ioIp))
{
aioBox = AIOMap[ioIp];
......
......@@ -51,13 +51,13 @@ AXIS,(轴五)批量上下料轴,Batch_Axis,4,COM1,0,,,,,
,,,,,,,,,,
PRO,升降轴 仓门位置P7(人工拿走盘的位置),UpDownAxis_Door_P7,345000,,,,,,,
PRO,升降轴 出库高点P2,UpDownAxis_OutHigh_P2,247000,,,,,,,
PRO,升降轴 出库低点P8,UpDownAxis_OutLow_P8,230000,,,,,,,
PRO,升降轴 出库低点P8,UpDownAxis_OutLow_P8,225000,,,,,,,
PRO,升降轴从吸盘下方接料后下降的高度,UpDownAxis_DownValue,10000,,,,,,,
PRO,升降轴 入库P1点集合,UpDownAxis_P1_List,8#398000;12#398000;16#393000;20#393000;24#390500;28#390500;32#390500;36#390500;40#390500;52#390500;,,,,,,,
PRO,升降轴 入库P1点集合,UpDownAxis_P1_List,8#388000;12#385000;16#380000;20#380000;24#375000;28#370000;32#370000;36#370000;40#370000;52#370000;,,,,,,,
PRO,旋转轴(轴一)P1 待机原位点,MiddleAxis_P1_Position,218900,,,,,,,
PRO,进出轴(轴三)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,-25000,,,,,,,
PRO,压紧轴(轴4)P2压紧点集合,CompressAxis_P2_List,8#-135000;12#-135000;16#-125000;20#-120000;24#-115000;28#-90000;32#-80000;36#-70000;40#-70000;44#-70000;48#-70000;52#-70000;,,,,,,,
PRO,压紧轴(轴4)P2压紧点集合,CompressAxis_P2_List,8#-135000;12#-135000;16#-135000;20#-120000;24#-125000;28#-90000;32#-80000;36#-70000;40#-70000;44#-70000;48#-70000;52#-70000;,,,,,,,
PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,,
PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,
PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,,,,
......@@ -85,20 +85,20 @@ PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,200,,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,200,,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,200,,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,200,,,,,,,
PRO,升降轴(轴二)到仓门速度,UpDownAxis_Door_Speed,300,,,,,,,
PRO,升降轴(轴二)P1速度,UpDownAxis_P1_Speed,2200,,,,,,,
PRO,升降轴(轴二)P2速度,UpDownAxis_P2_Speed,2200,,,,,,,
PRO,升降轴(轴二)P3速度,UpDownAxis_P3_Speed,2200,,,,,,,
PRO,升降轴(轴二)到仓门速度,UpDownAxis_Door_Speed,1000,,,,,,,
PRO,升降轴(轴二)P1速度,UpDownAxis_P1_Speed,2500,,,,,,,
PRO,升降轴(轴二)P2速度,UpDownAxis_P2_Speed,2500,,,,,,,
PRO,升降轴(轴二)P3速度,UpDownAxis_P3_Speed,2500,,,,,,,
PRO,升降轴(轴二)P4速度,UpDownAxis_P4_Speed,400,,,,,,,
PRO,升降轴(轴二)P5速度,UpDownAxis_P5_Speed,2200,,,,,,,
PRO,升降轴(轴二)P5速度,UpDownAxis_P5_Speed,2500,,,,,,,
PRO,升降轴(轴二)P6速度,UpDownAxis_P6_Speed,400,,,,,,,
PRO,升降轴(轴二)到仓门P7速度,UpDownAxis_P7_Speed,2000,,,,,,,
PRO,升降轴(轴二)P8速度,UpDownAxis_P8_Speed,400,,,,,,,
PRO,旋转轴(轴一)P1速度,MiddleAxis_P1_Speed,800,,,,,,,
PRO,旋转轴(轴一)P2速度,MiddleAxis_P2_Speed,800,,,,,,,
PRO,进出轴(轴三)P1速度,InOutAxis_P1_Speed,800,,,,,,,
PRO,进出轴(轴三)P2速度,InOutAxis_P2_Speed,800,,,,,,,
PRO,进出轴(轴三)P3速度,InOutAxis_P3_Speed,800,,,,,,,
PRO,旋转轴(轴一)P1速度,MiddleAxis_P1_Speed,1200,,,,,,,
PRO,旋转轴(轴一)P2速度,MiddleAxis_P2_Speed,1200,,,,,,,
PRO,进出轴(轴三)P1速度,InOutAxis_P1_Speed,1000,,,,,,,
PRO,进出轴(轴三)P2速度,InOutAxis_P2_Speed,1000,,,,,,,
PRO,进出轴(轴三)P3速度,InOutAxis_P3_Speed,1000,,,,,,,
PRO,(轴一)旋转轴最小误差脉冲值,MiddleAxis_ErrorCountMin,10,,,,,, ,
PRO,(轴二)升降轴轴最小误差脉冲值,UpdownAxis_ErrorCountMin,10,,,,,,,
PRO,(轴三)进出轴最小误差脉冲值,InoutAxis_ErrorCountMin,10,,,,,,,
......@@ -140,20 +140,20 @@ PRO,(轴五)上料轴减速度,BatchAxis_DelSpeed,300,,,,,,,
PRO,(轴五)上料轴原点低速,BatchAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,1750000,,,,,, ,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,1700000,,,,,, ,
PRO,(轴五)上料轴P2点(待机点),BatchAxis_P2,30000,,,,,, ,
PRO,(轴五)上料轴P2速度,BatchAxis_P2_Speed,2800,,,,,,,
PRO,(轴五)上料轴P2速度,BatchAxis_P2_Speed,2000,,,,,,,
PRO,(轴五)上料轴最小误差脉冲值,BatchAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,,
PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,2800,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,2000,,,,,,,
PRO,(轴五)上料轴出料时距离检测信号需要下降的高度,BatchAxis_OutDownPosition,100000,,,,,,,
PRO,(轴五)上料轴最最大料盘高度,到达后无法批量出库,BatchAxis_MaxHeight,250,,,,,,,
PRO,最后一盘料需要补充的高度,LastTrayAddHeight,4,,,,,,,
,,,,,,,,,,
PRO,(轴二)升降轴单盘入库抬升料盘的高度,UpdownAxis_UpPosition,3000,,,,,,,
PRO,(轴五)上料轴出库上升最大高度,BatchAxis_OutMaxValue,1600000,,,,,,,
,,,,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.21#16;192.168.200.22#4,,,,,, ,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.21#16;192.168.200.22#4,,,,,,,
PRO,(轴二)升降轴单盘入库抬升料盘的高度,UpdownAxis_UpPosition,3000,,,,,,,
PRO,(轴五)上料轴出库上升最大高度,BatchAxis_OutMaxValue,1500000,,,,,,,
......@@ -800,8 +800,13 @@ namespace OnlineStore.DeviceLibrary
bool BatchNeedMove = false;
int targetValue = -1;
int outDownPosition = StoreMove.MoveParam.MoveP.BatchAxis_DownValue;
if (StoreMove.IsBatchInOutStore)
{
{ //如果料盘检测信号不亮,不需要下降这么多
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW) && outDownPosition > Config.BatchAxis_OutDownPosition)
{
outDownPosition = outDownPosition - Config.BatchAxis_OutDownPosition;
}
//上下料机构下降的距离=料盘最低高度+默认的高度
targetValue = GetBatchTargetValue(outDownPosition);
if (targetValue >= 1000)
......@@ -812,7 +817,7 @@ namespace OnlineStore.DeviceLibrary
{
AutomaticBaiting.BatchOutStoreCount++;
AutomaticBaiting.BatchOutStoreHeight = 1000;
OutStoreLog("出库:SO_03批量上下料轴需下降【" + outDownPosition + "】目标【" + targetValue + "】 ,请检查料盘是否已满");
OutStoreLog("出库:SO_03批量上下料轴需下降【" + outDownPosition + "】目标【" + targetValue + "】 ,请检查料盘是否已满");
//停止出库
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline;
......@@ -830,12 +835,12 @@ namespace OnlineStore.DeviceLibrary
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
Thread.Sleep(100);
if (BatchNeedMove)
{
{
StoreMove.TimeOutSeconds = 120;
Thread.Sleep(1000);
ACAxisMove(Config.Batch_Axis, targetValue, Config.BatchAxis_P1_Speed);
OutStoreLog("出库:SO_03 批量轴下降【" + outDownPosition + "】目标【" + targetValue + "】 ");
Thread.Sleep(100);
Thread.Sleep(100);
}
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_03_ToBagPosition)
......@@ -968,8 +973,15 @@ namespace OnlineStore.DeviceLibrary
InOutBackToP1(StoreMove.MoveParam.MoveP.InOut_P1);
if (StoreMove.IsBatchInOutStore)
{
//如果可以直接下降,则不需要匀速上升
int targetValue = GetBatchTargetValue(StoreMove.MoveParam.MoveP.BatchAxis_DownValue);
if (targetValue >= 300000)
{
OutStoreLog("出库:SO_02 批量上下料轴直接下降后目标位置【" + targetValue + "】不需要匀速上升 ");
}
//如果批量能未检测到料盘,需要把批量轴走到能检测到料盘的位置
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
else if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.LOW))
{
StoreMove.TimeOutSeconds = 120;
//ACAxisMove(Config.Batch_Axis, Config.BatchAxis_P1, Config.BatchAxis_P1_Speed);
......
......@@ -643,8 +643,18 @@ namespace OnlineStore.DeviceLibrary
if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O00_Wait))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O01_WaitDoorOpen);
LogUtil.info(Name + "出料: 等待门锁打开 ");
BatchDoorOpen(true);
if (IOManager.IOValue(IO_Type.OutCheck).Equals(IO_VALUE.LOW))
{
LogUtil.info(Name + "出料: 等待门锁打开, OutCheck=LOW批量轴不需要到P2 ");
}
else
{
LogUtil.info(Name + "出料: 等待门锁打开,批量轴回到P2点 ");
//批量轴直接走到P2
ACAxisAbsMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P2, StoreManager.Config.BatchAxis_P2_Speed);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O01_WaitDoorOpen))
{
......@@ -656,22 +666,21 @@ namespace OnlineStore.DeviceLibrary
}
else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O03_SpeedMove);
LogUtil.info(Name + " 出料 ,轴上升到检测到出料信号,速度【" + StoreManager.Config.BatchAxis_SlowSpeed + "】,最大上升高度【"+StoreManager.Config.BatchAxis_OutMaxValue + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_SlowSpeed, IO_Type.OutCheck);
StartSpeedOut();
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O02_WaitOutSingleLow))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O03_SpeedMove);
LogUtil.info(Name + " 出料 ,轴上升到检测到出料信号,速度【" + StoreManager.Config.BatchAxis_SlowSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed, IO_Type.OutCheck);
StartSpeedOut();
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O03_SpeedMove))
{
//先判断极限是否亮
//int value = ACServerManager.GetLimitPositiveSingle(StoreManager.Config.Batch_Axis);
if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
int currValue = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis);
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_O05_BackToP2);
LogUtil.info(Name + "出料:上料轴移动到p2点【" + StoreManager.Config.BatchAxis_P2 + "】");
......@@ -680,11 +689,11 @@ namespace OnlineStore.DeviceLibrary
else
{
//等待出料信号亮
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O02_WaitOutSingleLow);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O02_WaitOutSingleLow);
LogUtil.info(Name + " 出料 ,等待出料检测信号关闭");
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.OutCheck, IO_VALUE.LOW));
}
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_O05_BackToP2))
{
//TODO
......@@ -697,7 +706,19 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "未找到步骤:" + StoreMove.MoveType);
}
}
private static void StartSpeedOut()
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_O03_SpeedMove);
AUTO_SA_Config Config = StoreManager.Config;
LogUtil.info(Name + " 出料 ,轴上升到检测到出料信号,速度【" + 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))
......
......@@ -260,7 +260,7 @@ namespace OnlineStore.DeviceLibrary
/// <param name="wait"></param>
/// <returns></returns>
public static bool BatchAxisIsEnd(WaitResultInfo wait,TimeSpan startSpan)
{
{
bool result = false;
if (IOManager.IOValue(wait.IoType).Equals(IO_VALUE.HIGH))
{
......@@ -272,27 +272,46 @@ namespace OnlineStore.DeviceLibrary
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)
{
result = true;
}
}
if (result)
{
LogUtil.debug(wait.ToStr() + " 停止运动");
ACServerManager.SuddenStop(wait.AxisInfo);
}
else if(startSpan.TotalSeconds>2)
else if (startSpan.TotalSeconds > 2)
{
TimeSpan span = DateTime.Now - AxisResetMoveTime;
if ((AutoBaitingStatus.Equals(StoreRunStatus.Busy)||AutoBaitingStatus.Equals(StoreRunStatus.Reset)) && span.TotalSeconds > 10)
if ((AutoBaitingStatus.Equals(StoreRunStatus.Busy) || AutoBaitingStatus.Equals(StoreRunStatus.Reset)) && span.TotalSeconds > 10)
//if (AutoBaitingStatus.Equals(StoreRunStatus.Busy) && StoreMove.CanWhileCount > 0)
{
AxisResetMoveTime = DateTime.Now;
//如果批量轴已经停止运动,重新开始
bool isEnd = ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0);
if (isEnd)
{ //判断是否需要重新运动
StoreMove.CanWhileCount--;
LogUtil.error(wait.ToStr() + " 未收到信号且停止运动,重新匀速" + StoreManager.Config.BatchAxis_SlowSpeed + "运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SuddenStop(wait.AxisInfo.DeviceName,wait.AxisInfo.GetAxisValue());
{
ACServerManager.SuddenStop(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
Thread.Sleep(2000);
ACServerManager.SpeedMove(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue(), StoreManager.Config.BatchAxis_SlowSpeed);
if (wait.TargetPosition <= 0)
{
LogUtil.error(wait.ToStr() + " 未收到信号且停止运动,重新匀速" + StoreManager.Config.BatchAxis_SlowSpeed + "运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.SpeedMove(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue(), StoreManager.Config.BatchAxis_SlowSpeed);
}
else
{
LogUtil.error(wait.ToStr() + " 未收到信号且停止运动,绝对运动" + wait.TargetPosition + " ,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.AbsMove(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue(), wait.TargetPosition, StoreManager.Config.BatchAxis_SlowSpeed);
}
//判断是否需要重新运动
StoreMove.CanWhileCount--;
}
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!