HY_Coveryor.cs
5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class HY_Coveryor:HYEquipBase
{
public HY_Coveryor(string cid, HYEquip_Config config) : base(cid, config)
{
Name = ("_接驳台HY" + (DeviceID % 100).ToString().PadLeft(2, '0') + "_").ToUpper();
}
public override bool StartRun(bool isDebug = false)
{
if (CanStartRun().Equals(false))
{
return false;
}
if (!RunAxis(true, UpdownAxis))
{
return false;
}
mainTimer.Enabled = false;
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
runStatus = LineRunStatus.HomeMoving;
LogInfo("开始 原点返回 ");
MoveInfo.NewMove(LineMoveType.ReturnHome);
StartReset();
if (isDebug)
{
mainTimer.Enabled = true;
}
return true;
}
public override bool Reset()
{
StopMove();
if (!RunAxis(true, UpdownAxis))
{
return false;
}
LogInfo("开始重置: 升降轴回原点,阻挡气缸上升 ");
runStatus = LineRunStatus.Reset;
SecondMoveInfo.EndMove();
MoveInfo.NewMove(LineMoveType.Reset);
StartReset();
return true;
}
private void StartReset()
{
ResetClearData();
MoveInfo.NextMoveStep(LineMoveStep.HY_R_01StopMove);
if (IsDebug)
{
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.HIGH);
IOMove(IO_Type.HY_StopDown, IO_VALUE.HIGH);
}
else
{
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.LOW);
IOMove(IO_Type.HY_StopDown, IO_VALUE.LOW);
}
LineStop();
CylinderMove(MoveInfo, IO_Type.HY_TopCylinder_Up, IO_Type.HY_TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.HY_LocationCylinder_Up, IO_Type.HY_LocationCylinder_Down);
CylinderMove(MoveInfo, IO_Type.HY_StopCylinder_Down, IO_Type.HY_StopCylinder_Up);
isInPro = false;
}
protected override void ResetProcess()
{
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (!MoveInfo.IsInWait )
{
//流水线各装置复原位,夹料气缸状态不变
//阻挡气缸全部=0
//上下气缸上升,、
//上升到位,顶升气缸下降,前后气缸回退
//复位时夹紧气缸需要发送,不然后面出入库会有问题
switch (MoveInfo.MoveStep)
{
case LineMoveStep.HY_R_01StopMove:
LogInfo(MoveInfo.MoveType + " 完成!");
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
break;
default: break;
}
}
}
/// <summary>
/// 停止运动
/// </summary>
internal override void StopMove()
{
//trayCheck2LowWait.Stop();
//trayCheckWait.Stop();
//如果正在出库中,需要减去托盘号
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
DebugInfo("停止运动时出库执行中,减去托盘数;");
//减去需要的盘数
// TrayManager.DelNeedEmptyTrayNum();
MoveInfo.EndMove();
}
runStatus = LineRunStatus.Busy;
SecondMoveInfo.EndMove();
LogInfo("停止运动:上下气缸上升端,阻挡气缸上升 ");
//UpdownUpMove();
CylinderMove(MoveInfo, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
IOMove(IO_Type.StopDown1, IO_VALUE.LOW);
IOMove(IO_Type.StopDown2, IO_VALUE.LOW);
}
public override void StopRun()
{
if (mainTimer != null)
{
mainTimer.Enabled = false;
}
StopMove();
//停止运行时,把所有IO 置零
CheckAndMove(IO_Type.StopDown1, IO_VALUE.LOW);
CheckAndMove(IO_Type.StopDown2, IO_VALUE.LOW);
CheckAndMove(IO_Type.TopCylinder_Up, IO_VALUE.LOW);
CheckAndMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW);
CheckAndMove(IO_Type.BeforeAfterCylinder_Before, IO_VALUE.LOW);
CheckAndMove(IO_Type.BeforeAfterCylinder_After, IO_VALUE.LOW);
if (UseAxis.Equals(false))
{
CheckAndMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW);
CheckAndMove(IO_Type.UpDownCylinder_Down, IO_VALUE.LOW);
}
CheckAndMove(IO_Type.ClampCylinder_Work, IO_VALUE.LOW);
CheckAndMove(IO_Type.ClampCylinder_Relax, IO_VALUE.LOW);
runStatus = LineRunStatus.Wait;
}
protected override void BaseTimerProcess()
{
if (isInSuddenDown || isNoAirCheck)
{
return;
}
IOTimeOutProcess();
if (MoveInfo.MoveType.Equals(LineMoveType.None))
{
if (LineManager.Line.CanProcessLine())
{
StartCheckFixture();
}
}
}
private void StartCheckFixture()
{
}
protected override void CheckFixtureProcess()
{
}
}
}