Commit a9d24b1c LN

横移处理修改

1 个父辈 9fea21ae
......@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D5,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D6,,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,1,COM5,0,,,
AXIS,0,轴二提升上料轴,Batch_Axis,1,COM5,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,,
......@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM5,0,,,
AXIS,0,轴一移栽上下轴,UpDown_Axis,2,COM5,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,,
PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,200000,,,,,
......
......@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D3,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D4,,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,3,COM5,0,,,
AXIS,0,轴二提升上料轴,Batch_Axis,3,COM5,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,,
......@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,4,COM5,0,,,
AXIS,0,轴一移栽上下轴,UpDown_Axis,4,COM5,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,,
PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,200000,,,,,
......
......@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,0,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D1,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D2,,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,5,COM5,0,,,
AXIS,0,轴二提升上料轴,Batch_Axis,5,COM5,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20930000,,,,,
......@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,1000,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,6,COM5,0,,,
AXIS,0,轴一移栽上下轴,UpDown_Axis,6,COM5,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=90000,,,,,
PRO,0,移栽上下轴P3取料位置,UpDownAxisP3,268294,,,,,
......
......@@ -7,7 +7,7 @@ PRO,0,是否是用来出料,IsCanOut,1,,,,,
PRO,0,上料流水线入口AGV小车站号名称,AgvInName,D7,,,,,
PRO,0,上料流水线出口AGV小车站号名称,AgvOutName,D8,,,,,
,,,,,,,,,
AXIS,0,提升上料轴,Batch_Axis,7,COM5,0,,,
AXIS,0,轴二提升上料轴,Batch_Axis,7,COM5,0,,,
PRO,0,提升上料轴上升待机点 P1,BatchAxisP1,23400000,,,,,
PRO,0,提升上料轴下降位置P2,BatchAxisP2,0,,,,,
PRO,0,提升上料缓慢上升目标位置P3,BatchAxisP3,20450000,,,,,
......@@ -22,7 +22,7 @@ PRO,0,提升上料轴P2速度,BatchAxis_P2Speed,2800,,,,,
PRO,0,提升上料轴P3速度,BatchAxis_P3Speed,2000,,,,,
PRO,0,提升上料轴高度转换系数(1mm对应的脉冲),Height_ChangeValue,38000,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,8,COM5,0,,,
AXIS,0,轴一移栽上下轴,UpDown_Axis,8,COM5,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴P2移栽机构下降位置,UpDownP2List,0=158000,,,,,
PRO,0,移栽上下轴P3放料位置,UpDownAxisP3,310000,,,,,
......
......@@ -2,6 +2,7 @@
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -46,45 +47,63 @@ namespace OnlineStore.DeviceLibrary
public event TrayProcessEnd TrayPEndEvent;
#region 托盘检测
private InOutParam CheckParam = new InOutParam();
// private DateTime swWaitTime = DateTime.Now;
private DateTime lastStopDown = DateTime.Now;
//private bool swIsWait = false;
private Stopwatch swWaitWatch = new Stopwatch();
private void StartCheckFixture()
{
if (!LineManager.Line.CanProcessLine())
{
swWaitWatch.Stop();
return;
}
if (Config.SidesWayNum > 0)
{
{
bool canProcess = (LineManager.Line.SwNoProcess(Config.SidesWayNum));
if (IOValue(IO_Type.SW_TrayCheck).Equals(IO_VALUE.HIGH) && canProcess)
{
UpdateTrayNum();
// preTrayNum = currTrayNum;
//int num = TrayManager.GetTrayNum(DeviceID);
//currTrayNum = num;
//判断是否是需要的托盘
if (CurrTrayIsNeed(currTrayNum, true))
if (TrayManager.checkWatch(swWaitWatch, TrayManager.SwTrayWaitTime, true))
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
CheckLog("检测到SW_TrayCheck:" + SecondMoveInfo.SLog + "横移顶升气缸上升 )");
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
UpdateTrayNum();
//判断是否是需要的托盘
if (CurrTrayIsNeed(currTrayNum, true))
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
CheckLog("检测到SW_TrayCheck:" + SecondMoveInfo.SLog + "横移顶升气缸上升 )");
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
}
else
{
SMoveEnd();
}
}
else
}
else if (Config.SidesWayNum.Equals(2) && IOValue(IO_Type.SW_StopCheck).Equals(IO_VALUE.HIGH) && canProcess
&& (DateTime.Now - lastStopDown).TotalSeconds > 4)
{
if (TrayManager.checkWatch(swWaitWatch, TrayManager.SwTrayWaitTime, true))
{
// currTrayNum = num;
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
swWaitWatch.Stop();
//SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
//TrayManager.UpdateSWState(Config.SidesWayNum, 2);
//SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_StopCylinder1Down);
//CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,等待" + TrayManager.StopDownWaitTime);
//IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH);
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
lastStopDown = DateTime.Now;
IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime);
}
}
else if (Config.SidesWayNum.Equals(2) && IOValue(IO_Type.SW_StopCheck).Equals(IO_VALUE.HIGH) && canProcess)
else
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_StopCylinder1Down);
CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,等待"+TrayManager.StopDownWaitTime);
IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
swWaitWatch.Stop();
}
}
else
......@@ -355,6 +374,7 @@ namespace OnlineStore.DeviceLibrary
private void SMoveEnd()
{
lastStopDown = DateTime.Now.AddSeconds(-2);
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
SecondMoveInfo.EndMove();
this.TrayPEndEvent?.Invoke(Config.SidesWayNum, currTrayNum);
......
......@@ -2,6 +2,7 @@
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -433,8 +434,8 @@ namespace OnlineStore.DeviceLibrary
private void SideWayStop()
{
SideWay41IsWait = false;
SideWay23IsWait = false;
sw23WaitWatch.Stop();
sw41WaitWatch.Stop();
TrayManager.UpdateSWState(4, 0);
TrayManager.UpdateSWState(1, 0);
TrayManager.UpdateSWState(2, 0);
......@@ -449,10 +450,12 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SW4_MotorRun, IO_VALUE.LOW);
}
private DateTime SideWay41Ntime = DateTime.Now;
private bool SideWay41IsWait = false;
private DateTime SideWay23Ntime = DateTime.Now;
private bool SideWay23IsWait = false;
//private DateTime SideWay41Ntime = DateTime.Now;
//private bool SideWay41IsWait = false;
//private DateTime SideWay23Ntime = DateTime.Now;
//private bool SideWay23IsWait = false;
private Stopwatch sw41WaitWatch = new Stopwatch();
private Stopwatch sw23WaitWatch = new Stopwatch();
private bool sdIsInprocess = false;
private DateTime sdlastProTime = DateTime.Now;
......@@ -472,8 +475,8 @@ namespace OnlineStore.DeviceLibrary
//流水线转动中,并且在忙碌或出入库处理中,需要处理移栽
if (!CanProcessLine())
{
SideWay23IsWait = false;
SideWay41IsWait = false;
sw41WaitWatch.Stop();
sw23WaitWatch.Stop();
sdIsInprocess = false;
return;
}
......@@ -483,8 +486,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.SW4_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.SW1_TrayCheck).Equals(IO_VALUE.LOW) &&
TrayManager.LineCanMoveSW(4) && TrayManager.LineCanMoveSW(1))
{
TimeSpan span41 = DateTime.Now - SideWay41Ntime;
if (SideWay41IsWait && span41.TotalMilliseconds > TrayManager.SwTrayWaitTime)
if (TrayManager.checkWatch(sw41WaitWatch, TrayManager.SwTrayWaitTime, true))
{
SW41_MoveInfo.NewMove(LineMoveType.InStore);
SW41_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck);
......@@ -493,12 +495,7 @@ namespace OnlineStore.DeviceLibrary
SW41_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW4_TrayCheck, IO_VALUE.HIGH));
CylinderMove(SW41_MoveInfo, IO_Type.SW4_LocationCylinder_Up, IO_Type.SW4_LocationCylinder_Down);
CylinderMove(SW41_MoveInfo, IO_Type.SW1_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down);
}
else if (!SideWay41IsWait)
{
SideWay41IsWait = true;
SideWay41Ntime = DateTime.Now;
}
}
}
else if (IOValue(IO_Type.SW4_StopCheck).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.SW4_StopDown).Equals(IO_VALUE.LOW) &&
......@@ -506,9 +503,8 @@ namespace OnlineStore.DeviceLibrary
IOValue(IO_Type.SW1_TrayCheck).Equals(IO_VALUE.LOW) &&
(DateTime.Now- lastSw4StopDownTime).TotalSeconds>4 &&
TrayManager.LineCanMoveSW(4) && TrayManager.LineCanMoveSW(1))
{
TimeSpan span41 = DateTime.Now - SideWay41Ntime;
if (SideWay41IsWait && span41.TotalMilliseconds>TrayManager.SwTrayWaitTime)
{
if (TrayManager.checkWatch(sw41WaitWatch, TrayManager.SwTrayWaitTime,true))
{
//SW41_MoveInfo.NewMove(LineMoveType.InStore);
//SW41_MoveInfo.NextMoveStep(LineMoveStep.SW00_Wait);
......@@ -518,28 +514,17 @@ namespace OnlineStore.DeviceLibrary
//CylinderMove(SW41_MoveInfo, IO_Type.SW1_LocationCylinder_Up, IO_Type.SW1_LocationCylinder_Down);
//阻挡气缸下降500毫秒然后上升
lastSw4StopDownTime = DateTime.Now;
IOMove(IO_Type.SW4_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime);
SideWay41IsWait = false;
}
else if (!SideWay41IsWait)
{
SideWay41IsWait = true;
SideWay41Ntime = DateTime.Now;
}
}
else if (!SideWay41IsWait)
{
SideWay41IsWait = true;
SideWay41Ntime = DateTime.Now;
}
IOMove(IO_Type.SW4_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime);
}
}
else
{
SideWay41IsWait = false;
sw41WaitWatch.Stop();
}
}
else
{
SideWay41IsWait = false;
sw41WaitWatch.Stop();
SideWay41BusyProcess();
}
if (SW23_MoveInfo.MoveType.Equals(LineMoveType.None) && FeedingEquipMap[104].runStatus <= LineRunStatus.Wait)
......@@ -549,8 +534,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.SW2_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.SW3_TrayCheck).Equals(IO_VALUE.LOW) &&
TrayManager.LineCanMoveSW(2) && TrayManager.LineCanMoveSW(3))
{
TimeSpan span34 = DateTime.Now - SideWay23Ntime;
if (SideWay23IsWait && span34.TotalMilliseconds > TrayManager.SwTrayWaitTime)
if (TrayManager.checkWatch(sw23WaitWatch, TrayManager.SwTrayWaitTime, true))
{
SW23_MoveInfo.NewMove(LineMoveType.InStore);
SW23_MoveInfo.NextMoveStep(LineMoveStep.SW02_WaitFixtureCheck);
......@@ -559,12 +543,7 @@ namespace OnlineStore.DeviceLibrary
SW23_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW2_TrayCheck, IO_VALUE.HIGH));
CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down);
CylinderMove(SW23_MoveInfo, IO_Type.SW2_LocationCylinder_Up, IO_Type.SW3_LocationCylinder_Down);
}
else if (!SideWay23IsWait)
{
SideWay23IsWait = true;
SideWay23Ntime = DateTime.Now;
}
}
}
else if (IOValue(IO_Type.SW2_StopCheck).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.SW2_StopDown).Equals(IO_VALUE.LOW) &&
......@@ -573,8 +552,7 @@ namespace OnlineStore.DeviceLibrary
(DateTime.Now - lastSw2StopDownTime).TotalSeconds > 4 &&
TrayManager.LineCanMoveSW(2) && TrayManager.LineCanMoveSW(3))
{
TimeSpan span34 = DateTime.Now - SideWay23Ntime;
if (SideWay23IsWait && span34.TotalMilliseconds > TrayManager.SwTrayWaitTime)
if (TrayManager.checkWatch(sw23WaitWatch, TrayManager.SwTrayWaitTime, true))
{
//SW23_MoveInfo.NewMove(LineMoveType.InStore);
//SW23_MoveInfo.NextMoveStep(LineMoveStep.SW00_Wait);
......@@ -585,22 +563,16 @@ namespace OnlineStore.DeviceLibrary
//阻挡气缸下降500毫秒然后上升
lastSw2StopDownTime = DateTime.Now;
IOMove(IO_Type.SW2_StopDown, IO_VALUE.HIGH, TrayManager.StopDownWaitTime);
SideWay23IsWait = false;
}
else if (!SideWay23IsWait)
{
SideWay23IsWait = true;
SideWay23Ntime = DateTime.Now;
}
}
else
{
SideWay23IsWait = false;
sw23WaitWatch.Stop();
}
}
else
{
SideWay23IsWait = false;
sw23WaitWatch.Stop();
SideWay23BusyProcess();
}
......@@ -745,7 +717,7 @@ namespace OnlineStore.DeviceLibrary
{
TrayManager.UpdateSWState(4, 0);
TrayManager.UpdateSWState(1, 0);
lastSw4StopDownTime = DateTime.Now;
lastSw4StopDownTime = DateTime.Now.AddSeconds(-2);
SW41_MoveInfo.EndMove();
SWLog("横移轨道41:横移结束 ");
}
......@@ -866,7 +838,7 @@ namespace OnlineStore.DeviceLibrary
{
TrayManager.UpdateSWState(2, 0);
TrayManager.UpdateSWState(3, 0);
lastSw2StopDownTime = DateTime.Now;
lastSw2StopDownTime = DateTime.Now.AddSeconds(-2);
SW23_MoveInfo.EndMove();
SWLog("横移轨道23:横移结束 ");
}
......
......@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
......@@ -14,7 +15,7 @@ namespace OnlineStore.DeviceLibrary
{
public static int SwTrayWaitTime = 500;
public static int StopDownWaitTime = 500;
public static RFID RfidReader = new RFID();
public static RFID RfidReader = new RFID();
/// <summary>
/// 托盘集合,key=托盘编号,value=托盘详细信息
/// </summary>
......@@ -36,9 +37,9 @@ namespace OnlineStore.DeviceLibrary
/// 盘错乱的StoreID
/// </summary>
public static int ErrorDeviceId = -1;
static TrayManager()
{
{
}
public static List<TrayInfo> getTrayList()
{
......@@ -181,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public static int GetTrayNum(int subType, bool isClear = false)
{
// return 9;
// return 9;
if (subType.Equals(104))
{
return LineManager.Line.Sw23TrayNum;
......@@ -193,7 +194,7 @@ namespace OnlineStore.DeviceLibrary
string ip = GetRFIP(subType);
//获取盘号
RFIDData data = ReadRFID(ip,isClear);
RFIDData data = ReadRFID(ip, isClear);
if (data != null)
{
if (data.RFType.Equals((byte)'E'))
......@@ -202,29 +203,29 @@ namespace OnlineStore.DeviceLibrary
}
return 0;
}
return 0;
}
public static RFIDData GetShelfData(int subType)
{
string ip = GetRFIP(subType, 1);
return ReadRFID(ip);
return ReadRFID(ip);
}
public static RFIDData ReadRFID(string ip,bool isClear=false)
public static RFIDData ReadRFID(string ip, bool isClear = false)
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false) && LineManager.Line.rfidList.Contains(ip))
{
RFIDData data= new RFIDData(RfidReader.Read(ip));
{
RFIDData data = new RFIDData(RfidReader.Read(ip));
if (isClear)
{
RfidReader.Clear(ip);
}
return data;
}
}
}
catch (Exception ex)
{
......@@ -250,7 +251,7 @@ namespace OnlineStore.DeviceLibrary
#region 横移状态缓存
// internal static ConcurrentDictionary<int, int> SidesWayStateMap = new ConcurrentDictionary<int, int>();
// internal static ConcurrentDictionary<int, int> SidesWayStateMap = new ConcurrentDictionary<int, int>();
internal static int GetSwStatus(int swNum)
{
//if (SidesWayStateMap.ContainsKey(swNum))
......@@ -319,9 +320,22 @@ namespace OnlineStore.DeviceLibrary
//}
}
#endregion
#endregion
public static bool checkWatch(Stopwatch watch, int targetMs, bool isStop = true)
{
if (!watch.IsRunning)
{
watch.Restart();
return false;
}
else if (watch.ElapsedMilliseconds >= targetMs)
{
watch.Stop();
return true;
}
return false;
}
}
public class RFIDData
......@@ -364,6 +378,8 @@ namespace OnlineStore.DeviceLibrary
{
return " [" + RFType + "],[" + Num + "] ";
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!