Commit ab330180 刘韬

更新IO配置

1 个父辈 419a02c5
......@@ -287,7 +287,7 @@ namespace OnlineStore.DUOStore
private void btnStoreOn_Click(object sender, EventArgs e)
{
BtnMove(btnCamerLed, "打开设备电源", "关闭设备电源", IO_Type.Device_Led);
BtnMove(btnCamerLed, "打开设备照明", "关闭设备照明", IO_Type.Device_Led);
}
private void btnCloseCyDo_Click(object sender, EventArgs e)
......@@ -303,12 +303,12 @@ namespace OnlineStore.DUOStore
private void btnClamp_Click(object sender, EventArgs e)
{
StoreManager.Store.CylinderMove(null, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Clamp);
ElectricClamp.Clamp();
}
private void btnRelax_Click(object sender, EventArgs e)
{
StoreManager.Store.CylinderMove(null, IO_Type.ClampCylinder_Clamp, IO_Type.ClampCylinder_Relax);
ElectricClamp.Release();
}
private void btnLDoorUp_Click(object sender, EventArgs e)
......
......@@ -78,6 +78,7 @@
<Compile Include="duoStore\BoxBean_Partial.cs" />
<Compile Include="duoStore\BoxBean_Shelf.cs" />
<Compile Include="duoStore\DUOStoreBean_Partial.cs" />
<Compile Include="duoStore\ElectricClamp.cs" />
<Compile Include="duoStore\EquipBase.cs" />
<Compile Include="duoStore\HoisterCylinder.cs" />
<Compile Include="duoStore\HumitureBean.cs" />
......
......@@ -25,10 +25,12 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 取料提升机构气缸
/// </summary>
public HoisterCylinder hoisterCylinder = new HoisterCylinder(0);
//public HoisterCylinder hoisterCylinder = new HoisterCylinder(0);
public ElectricClamp electricClamp = new ElectricClamp(0);
public AxisBean T1_BatchAxis = null;
public AxisBean T2_MiddleAxis = null;
public AxisBean T3_UpdownAxis = null;
public AxisBean T4_InOut_Axis = null;
#region 初始化
......@@ -67,6 +69,7 @@ namespace OnlineStore.DeviceLibrary
T1_BatchAxis = new AxisBean(Config.T1_Batch_Axis, Name);
T2_MiddleAxis = new AxisBean(Config.T2_Middle_Axis,Name);
T3_UpdownAxis = new AxisBean(Config.T3_Updown_Axis,Name);
T4_InOut_Axis = new AxisBean(Config.T4_InOut_Axis, Name);
IOManager.Init();
CodeManager.LoadConfig();
......@@ -188,13 +191,10 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(600));
IOMove(IO_Type.Line_Stop1_Wait, IO_VALUE.LOW);
IOMove(IO_Type.Line_Stop2_Work, IO_VALUE.LOW);
IOMove(IO_Type.Line_Stop3_Buffer, IO_VALUE.LOW);
IOMove(IO_Type.Line_Stop4_Out, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Stop1_Wait, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Stop2_Work, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Stop3_Buffer, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Stop4_Out, IO_VALUE.LOW));
hoisterCylinder.StartForward(MoveInfo);
}
protected override void ResetProcess()
......@@ -220,7 +220,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.LR_03_BatchAxisHome);
LogUtil.info(Name + "复位 " + MoveInfo.MoveStep + " :夹爪放松,提升轴回原点,上下轴回原点,流水线停止");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Clamp, IO_Type.ClampCylinder_Relax);
ElectricClamp.Release(MoveInfo);
T1_BatchAxis.HomeMove(MoveInfo);
T3_UpdownAxis.HomeMove(MoveInfo);
LineStop(MoveInfo);
......@@ -300,12 +300,11 @@ namespace OnlineStore.DeviceLibrary
equip.StopMove();
}
MoveInfo.EndMove();
hoisterCylinder.Stop();
//轴运动停止
T3_UpdownAxis.SuddenStop();
T2_MiddleAxis.SuddenStop();
T1_BatchAxis.SuddenStop();
T4_InOut_Axis.SuddenStop();
CloseAllAxis();
LineStop();
......@@ -581,10 +580,8 @@ namespace OnlineStore.DeviceLibrary
try
{
if (IOValue(IO_Type.Line_OutCheck).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.Line_BackRun).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.Line_Run).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.Line_BufferCheck).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.Line_Stop3_Buffer).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.Line_Stop4_Out).Equals(IO_VALUE.LOW) &&
LowProcess.Equals(false))
{
......@@ -596,7 +593,7 @@ namespace OnlineStore.DeviceLibrary
LowProcess = true;
LogUtil.info(Name + "从料架堆积处放一个料架到后端");
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH, false, 30000);
IOMove(IO_Type.Line_Stop3_Buffer, IO_VALUE.HIGH, false, 2000);
//IOMove(IO_Type.Line_Stop3_Buffer, IO_VALUE.HIGH, false, 2000);
if (WaitIo(IO_Type.Line_OutCheck, IO_VALUE.HIGH, 30000, "堆积处放料架到后端"))
{
LineStop();
......@@ -619,10 +616,10 @@ namespace OnlineStore.DeviceLibrary
public int GetShelfNum()
{
int ShelfCheck1 = (int)IOValue(IO_Type.ShelfCheck1);
int ShelfCheck2 = (int)IOValue(IO_Type.ShelfCheck2);
int ShelfCheck3 = (int)IOValue(IO_Type.ShelfCheck3);
int ShelfCheck4 = (int)IOValue(IO_Type.ShelfCheck4);
int ShelfCheck1 = 0;// (int)IOValue(IO_Type.ShelfCheck1);
int ShelfCheck2 = 0;//(int)IOValue(IO_Type.ShelfCheck2);
int ShelfCheck3 = 0;//(int)IOValue(IO_Type.ShelfCheck3);
int ShelfCheck4 = 0;//(int)IOValue(IO_Type.ShelfCheck4);
string dStr = ShelfCheck4.ToString()+ShelfCheck3.ToString() + ShelfCheck2.ToString() + ShelfCheck1.ToString();
int num = Convert.ToInt32(dStr, 2);
......@@ -633,10 +630,8 @@ namespace OnlineStore.DeviceLibrary
{
if (move != null)
{
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_BackRun, IO_VALUE.LOW));
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.HIGH));
}
IOMove(IO_Type.Line_BackRun, IO_VALUE.LOW);
IOMove(IO_Type.Line_Run, IO_VALUE.HIGH);
}
......@@ -644,29 +639,26 @@ namespace OnlineStore.DeviceLibrary
{
if (move != null)
{
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_BackRun, IO_VALUE.LOW));
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.LOW));
}
IOMove(IO_Type.Line_BackRun, IO_VALUE.LOW);
IOMove(IO_Type.Line_Run, IO_VALUE.LOW);
}
public bool OpenAllAxis(bool isCheck = true)
{
if (RunMultiAxis(isCheck, new AxisBean []{ T3_UpdownAxis,T2_MiddleAxis}))
if (RunMultiAxis(isCheck, new AxisBean []{ T3_UpdownAxis,T2_MiddleAxis,T4_InOut_Axis, T1_BatchAxis }))
{
if (RunAxis(isCheck, T1_BatchAxis) )
{
return true;
}
return true;
//if (RunAxis(isCheck, T1_BatchAxis) )
// return true;
}
return false;
}
public void CloseAllAxis()
{
CloseMultiAxis(new AxisBean[] { T3_UpdownAxis, T2_MiddleAxis });
CloseAxis(T1_BatchAxis);
CloseMultiAxis(new AxisBean[] { T3_UpdownAxis, T2_MiddleAxis, T4_InOut_Axis, T1_BatchAxis });
//CloseAxis(T1_BatchAxis);
}
}
}
\ No newline at end of file
......@@ -254,7 +254,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_14_CylinderTighten);
InOutStoreLog("取料:夹爪气缸夹紧");
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Clamp);
ElectricClamp.Clamp(MoveInfo);
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_14_CylinderTighten))
{
......@@ -292,7 +292,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_19_CylinderRelax);
InOutStoreLog("料盘移栽: 夹爪气缸放松");
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Clamp, IO_Type.ClampCylinder_Relax);
ElectricClamp.Release(MoveInfo);
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_19_CylinderRelax))
{
......@@ -335,7 +335,6 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog(" 等待料盘出库");
}
}
#endregion
......@@ -610,7 +609,6 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog("入料检测:有料盘:升降轴到料串高点P2["+ Config.UpdownAxis_P2 + "],旋转轴到料串位置P4["+ Config.MiddleAxis_P4 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
}
#endregion
......@@ -625,7 +623,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_13_CylinderTighten);
InOutStoreLog("取料:夹爪气缸夹紧");
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Clamp);
ElectricClamp.Clamp(MoveInfo);
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_13_CylinderTighten))
{
......@@ -741,7 +739,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_24_CylinderRelax);
InOutStoreLog("料盘移栽: 上料气缸放松");
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Clamp, IO_Type.ClampCylinder_Relax);
ElectricClamp.Release(MoveInfo);
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_24_CylinderRelax))
{
......
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class ElectricClamp
{
private static int subType = 0;
public static bool needClamp = false;
public ElectricClamp(int subType)
{
//this.subType = subType;
}
public static void Clamp(StoreMoveInfo moveInfo = null)
{
needClamp = true;
if (!IsBusy)
{
IOManager.IOMove(IO_Type.Clamp_SetPos0, IO_VALUE.LOW, subType);
IOManager.IOMove(IO_Type.Clamp_SetPos1, IO_VALUE.HIGH, subType);
IOManager.IOMove(IO_Type.Clamp_DoAction, IO_VALUE.HIGH, subType);
}
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitElectricClamp());
}
public static bool Release(StoreMoveInfo moveInfo = null)
{
needClamp = false;
if (!IsBusy)
{
IOManager.IOMove(IO_Type.Clamp_SetPos0, IO_VALUE.HIGH, subType);
IOManager.IOMove(IO_Type.Clamp_SetPos1, IO_VALUE.LOW, subType);
IOManager.IOMove(IO_Type.Clamp_DoAction, IO_VALUE.HIGH, subType);
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
return true;
}
else
{
return false;
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitElectricClamp());
}
}
public static bool IsBusy {
get {
return IOManager.IOValue(IO_Type.Clamp_Busy, subType).Equals(IO_VALUE.HIGH);
}
}
public static bool IsClamp {
get
{
return IOManager.IOValue(IO_Type.Clamp_OnPosition, subType).Equals(IO_VALUE.HIGH);
}
}
}
}
......@@ -231,10 +231,14 @@ namespace OnlineStore.DeviceLibrary
int timeOutMs = StoreManager.Config.IOSingle_TimerOut;
if (!wait.IsEnd)
{
if (wait.IoType.Equals(IO_Type.Line_BackRun) || wait.IoType.Equals(IO_Type.Line_Run))
if (wait.IoType.Equals(IO_Type.Line_Run))
{
IOMove(wait.IoType, wait.IoValue);
}
}
else if (wait.IoType.Equals(IO_Type.Clamp_OnPosition))
{
ElectricClamp.Clamp();
}
else if (span.TotalMilliseconds > timeOutMs && NoAlarm())
{
......@@ -253,6 +257,25 @@ namespace OnlineStore.DeviceLibrary
{
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}
else if (wait.WaitType.Equals(WaitEnum.W012_ElectricClampEvent))
{
if (ElectricClamp.IsBusy)
break;
if (ElectricClamp.needClamp)
{
if (ElectricClamp.IsClamp)
wait.IsEnd = true;
else
{
ElectricClamp.Clamp();
break;
}
}
else {
wait.IsEnd = ElectricClamp.Release();
}
}
else
{
wait.IsEnd = CheckWaitResult(MoveInfo, wait);
......
......@@ -94,6 +94,7 @@ namespace OnlineStore.DeviceLibrary
/// 运动处理
/// </summary>
protected bool isInPro = false;
object worklock = new object();
protected virtual void BusyMoveProcess()
{
//if (isInPro)
......@@ -101,32 +102,39 @@ namespace OnlineStore.DeviceLibrary
// return;
//}
isInPro = true;
try
if (Monitor.TryEnter(worklock))
{
switch (MoveInfo.MoveType)
try
{
case MoveType.InStore:
InStoreProcess();
isInPro = false;
break;
case MoveType.OutStore:
OutStoreProcess();
isInPro = false;
break;
case MoveType.ReturnHome:
ResetProcess();
isInPro = false;
break;
case MoveType.Reset:
ResetProcess();
isInPro = false;
break;
default: break;
switch (MoveInfo.MoveType)
{
case MoveType.InStore:
InStoreProcess();
isInPro = false;
break;
case MoveType.OutStore:
OutStoreProcess();
isInPro = false;
break;
case MoveType.ReturnHome:
ResetProcess();
isInPro = false;
break;
case MoveType.Reset:
ResetProcess();
isInPro = false;
break;
default: break;
}
}
catch (Exception ex)
{
LogUtil.error("BusyMoveProcess出错:" + ex.ToString());
}
finally
{
Monitor.Exit(worklock);
}
}
catch (Exception ex)
{
LogUtil.error("BusyMoveProcess出错:" + ex.ToString());
}
isInPro = false;
}
......@@ -497,12 +505,10 @@ namespace OnlineStore.DeviceLibrary
public bool RunAxis(bool isCheck, AxisBean axis)
{
IOMove(axis.Config.ServerOnDO, IO_VALUE.HIGH);
string msg = "";
bool result = axis.Open(isCheck, out msg);
if (result && String.IsNullOrEmpty(msg))
{
IOMove(axis.Config.BreakOnDO, IO_VALUE.HIGH);
return true;
}
SetWarnMsg(Name + msg);
......@@ -513,10 +519,8 @@ namespace OnlineStore.DeviceLibrary
public void CloseAxis(AxisBean axis)
{
IOMove(axis.Config.BreakOnDO, IO_VALUE.LOW);
axis.ServoOff();
Thread.Sleep(100);
IOMove(axis.Config.ServerOnDO, IO_VALUE.LOW);
}
......
......@@ -214,6 +214,12 @@ namespace OnlineStore.DeviceLibrary
wait.WaitType = WaitEnum.W011_DoorCloseEvent;
return wait;
}
public static WaitResultInfo WaitElectricClamp()
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W012_ElectricClampEvent;
return wait;
}
public string ToStr()
{
if (WaitType.Equals(WaitEnum.W001_AxisMove))
......@@ -363,11 +369,14 @@ namespace OnlineStore.DeviceLibrary
/// Agv状态
/// </summary>
internal static int W010_AgvStatus = 10;
/// <summary>
/// 等待agvDoorClose事件
/// </summary>
internal static int W011_DoorCloseEvent = 11;
/// <summary>
/// 等待电夹爪事件
/// </summary>
internal static int W012_ElectricClampEvent = 12;
}
public enum MoveType
{
......
......@@ -61,11 +61,11 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// 伺服ON的Do信号
/// </summary>
public string ServerOnDO = "";
/// <summary>
//public string ServerOnDO = "";
//// <summary>
/// 伺服刹车信号
/// </summary>
public string BreakOnDO = "";
//public string BreakOnDO = "";
[CSVAttribute("设备名称")]
public string DeviceName { get; set; }
......
......@@ -34,6 +34,12 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("T3_Updown_Axis")]
public ConfigMoveAxis T3_Updown_Axis { get; set; }
/// <summary>
/// AXIS,,T4_取料机构进出轴,T4_InOut_Axis,3,COM3,,800,1000,1000,200,500,500,10,1000,0,0
/// </summary>
[ConfigProAttribute("T3_Updown_Axis")]
public ConfigMoveAxis T4_InOut_Axis { get; set; }
/// <summary>
/// PRO,,IO模块对应的DI数量,IO_DILength,192.168.200.21#16;192.168.200.22#16;192.168.200.23#8
/// </summary>
[ConfigProAttribute("IO_DILength")]
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!