Line_Config.cs
13.0 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.LoadCSVLibrary
{
/// <summary>
/// 流水线配置
/// </summary>
public class Line_Config : StoreConfig
{
public Line_Config()
: base()
{
}
/// <summary>
/// 流水线配置
/// </summary>
/// <param name="id">ID</param>
/// <param name="cid">CID</param>
/// <param name="type">类型</param>
/// <param name="filepath">配置文件</param>
public Line_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath)
{
}
/// <summary>
/// 气压检测信号关闭需要持续的时间
/// </summary>
[ConfigProAttribute("AirCheckSeconds")]
public int AirCheckSeconds { get; set; }
/// <summary>
/// 阻挡气缸控制信号(1-4分别对应夹具检测1-4)
/// </summary>
[ConfigProAttribute("StopCylinderIOType")]
public int StopCylinderIOType { get; set; }
/// <summary>
/// PRO,当多久没有出入库操作时,流水线进行休眠(休眠毫秒数),Sleep_MSeconds,120,,,,,
/// </summary>
[ConfigProAttribute("Sleep_MSeconds")]
public int Sleep_MSeconds { get; set; }
/// <summary>
/// PRO 是否使用料盘检测信号 IsUse_Tray_Check 10
/// </summary>
[ConfigProAttribute("IsUse_Tray_Check")]
public int IsUse_Tray_Check { get; set; }
/// <summary>
/// PRO IO信号超时时间(毫秒) IOSingle_TimerOut 5000
/// </summary>
[ConfigProAttribute("IOSingle_TimerOut",false)]
public int IOSingle_TimerOut { get; set; }
/// <summary>
/// PRO IO模块对应的DI数量 IO_DILength 192.168.200.10#16;192.168.200.11#4
/// </summary>
[ConfigProAttribute("IO_DILength")]
public string IO_DILength { get; set; }
/// <summary>
/// PRO 模块对应的DO数量 IO_DOLength 192.168.200.10#16;192.168.200.11#4
/// </summary>
[ConfigProAttribute("IO_DOLength")]
public string IO_DOLength { get; set; }
/// <summary>
/// PRO 模拟量IO模块的IP地址 AIDevice_IP 192.168.200.11
/// </summary>
[ConfigProAttribute("AIDevice_IP", true)]
public string AIDevice_IP { get; set; }
/// <summary>
/// PRO 模拟量测高1mm对应的转换值 AI_ConvertPosition 55
/// </summary>
[ConfigProAttribute("AI_ConvertPosition", true)]
public int AI_ConvertPosition { get; set; }
/// <summary>
/// PRO,模拟信号1默认高度,AIDI1_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI1_DefaultPosition", true)]
public double AIDI1_DefaultPosition { get; set; }
/// <summary>
/// PRO,模拟信号2默认高度,AIDI2_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI2_DefaultPosition", true)]
public double AIDI2_DefaultPosition { get; set; }
/// <summary>
/// PRO,模拟信号3默认高度,AIDI3_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI3_DefaultPosition", true)]
public double AIDI3_DefaultPosition { get; set; }
/// <summary>
/// PRO,模拟信号4默认高度,AIDI4_DefaultPosition,1,,,,,,,
/// </summary>
[ConfigProAttribute("AIDI4_DefaultPosition", true)]
public double AIDI4_DefaultPosition { get; set; }
/// <summary>
/// PRO 模拟信号1的地址 AIDI1_Addr 7
/// </summary>
[ConfigProAttribute("AIDI1_Addr", true)]
public int AIDI1_Addr { get; set; }
/// <summary>
/// PRO 模拟信号2的地址 AIDI2_Addr 8
/// </summary>
[ConfigProAttribute("AIDI2_Addr", true)]
public int AIDI2_Addr { get; set; }
/// <summary>
/// PRO 模拟信号3的地址 AIDI3_Addr 5
/// </summary>
[ConfigProAttribute("AIDI3_Addr", true)]
public int AIDI3_Addr { get; set; }
/// <summary>
/// PRO 模拟信号4的地址 AIDI4_Addr 6
/// </summary>
[ConfigProAttribute("AIDI4_Addr", true)]
public int AIDI4_Addr { get; set; }
private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null;
public ushort GetDILength(string ip)
{
try
{
if (DILengthMap == null)
{
DILengthMap = new Dictionary<string, ushort>();
string[] arrayList = IO_DILength.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
string ioip = arrStr[0];
ushort length = Convert.ToUInt16(arrStr[1]);
DILengthMap.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (DILengthMap.ContainsKey(ip))
{
return DILengthMap[ip];
}
return 16;
}
public ushort GetDOLength(string ip)
{
try
{
if (DOLengthMap == null)
{
DOLengthMap = new Dictionary<string, ushort>();
string[] arrayList = IO_DOLength.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
string ioip = arrStr[0];
ushort length = Convert.ToUInt16(arrStr[1]);
DOLengthMap.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (DOLengthMap.ContainsKey(ip))
{
return DOLengthMap[ip];
}
return 16;
}
protected override void initMustHavePro()
{
MustHaveDIList = new List<string>();
MustHaveDOList = new List<string>();
// DI,0,急停,SuddenStop_BTN,0,192.168.200.11,0,急停,X001,X001
//DI,0,复位,Reset_BTN,1,192.168.200.11,0,复位,X002,X002
//DI,0,联动,Start_BTN,2,192.168.200.11,0,联动,X003,X003
//DI,0,气压检测,Airpressure_Check,3,192.168.200.11,0,气压检测,X004,X004
//DI,0,NG料盘推出气缸前进端,NGCylinder_Before,4,192.168.200.11,0,NG料盘推出气缸前进端,X005,X005
//DI,0,NG料盘推出气缸后退端,NGCylinder_After,5,192.168.200.11,0,NG料盘推出气缸后退端,X006,X006
//DI,0,环形线横移4定位上升端,TopCylinder_UP,6,192.168.200.11,0,环形线横移4定位上升端,X007,X007
//DI,0,环形线横移4定位下降端,TopCylinder_Down,7,192.168.200.11,0,环形线横移4定位下降端,X008,X008
MustHaveDIList.Add(IO_Type.SuddenStop_BTN);
MustHaveDIList.Add(IO_Type.Reset_BTN);
MustHaveDIList.Add(IO_Type.Start_BTN);
MustHaveDIList.Add(IO_Type.Airpressure_Check);
MustHaveDIList.Add(IO_Type.NGCylinder_Before);
MustHaveDIList.Add(IO_Type.NGCylinder_After);
MustHaveDIList.Add(IO_Type.TopCylinder_UP);
MustHaveDIList.Add(IO_Type.TopCylinder_Down);
// DO,0,待机状态(指示灯),AutoRun_HddLed,0,192.168.200.11,0,待机状态(指示灯),Y001,Y001
//DO,0,运行状态(指示灯),RunSign_HddLed,1,192.168.200.11,0,运行状态(指示灯),Y002,Y002
//DO,0,故障状态(指示灯),Alarm_HddLed,2,192.168.200.11,0,故障状态(指示灯),Y003,Y003
//DO,0,故障状态(蜂鸣器),Alarm_Buzzer,3,192.168.200.11,0,故障状态(蜂鸣器),Y004,Y004
//DO,0,驱动电机1正转,DriveMotor_1,4,192.168.200.11,0,驱动电机1正转,Y005,Y005
//DO,0,驱动电机2正转,DriveMotor_2,5,192.168.200.11,0,驱动电机2正转,Y006,Y006
//DO,0,驱动电机3正转,DriveMotor_3,6,192.168.200.11,0,驱动电机3正转,Y007,Y007
//DO,0,驱动电机4正转,DriveMotor_4,7,192.168.200.11,0,驱动电机4正转,Y008,Y008
//DO,0,环形线横移4电机运转,DriveMotor_Run,8,192.168.200.11,0,环形线横移4电机运转,Y009,Y009
//DO,0,NG料盘推出气缸前进SOL,NGCylinder_Before,9,192.168.200.11,0,NG料盘推出气缸前进SOL,Y010,Y010
//DO,0,NG料盘推出气缸后退SOL,NGCylinder_After,10,192.168.200.11,0,NG料盘推出气缸后退SOL,Y011,Y011
//DO,0,环形线横移4定位上升SOL,TopCylinder_UP,11,192.168.200.11,0,环形线横移4定位上升SOL,Y012,Y012
//DO,0,环形线横移4定位下降SOL,TopCylinder_Down,12,192.168.200.11,0,环形线横移4定位下降SOL,Y013,Y013
MustHaveDOList.Add(IO_Type.AutoRun_HddLed);
MustHaveDOList.Add(IO_Type.RunSign_HddLed);
MustHaveDOList.Add(IO_Type.Alarm_HddLed);
MustHaveDOList.Add(IO_Type.Alarm_Buzzer);
MustHaveDOList.Add(IO_Type.DriveMotor_1);
MustHaveDOList.Add(IO_Type.DriveMotor_2);
MustHaveDOList.Add(IO_Type.DriveMotor_3);
MustHaveDOList.Add(IO_Type.DriveMotor_4);
MustHaveDOList.Add(IO_Type.DriveMotor_Run);
MustHaveDOList.Add(IO_Type.NGCylinder_Before);
MustHaveDOList.Add(IO_Type.NGCylinder_After);
MustHaveDOList.Add(IO_Type.TopCylinder_UP);
MustHaveDOList.Add(IO_Type.TopCylinder_Down);
//MustHaveDIList.Add(IO_Type.SuddenStop_BTN);
//MustHaveDIList.Add(IO_Type.Reset_BTN);
//MustHaveDIList.Add(IO_Type.Start_BTN);
//MustHaveDIList.Add(IO_Type.Line_Run);
//MustHaveDIList.Add(IO_Type.Airpressure_Check);
//MustHaveDIList.Add(IO_Type.InStore_TrayCheck1);
//MustHaveDIList.Add(IO_Type.InStore_TrayCheck2);
//MustHaveDIList.Add(IO_Type.StopCylinder_Check);
//MustHaveDIList.Add(IO_Type.Fixture_Check_1);
//MustHaveDIList.Add(IO_Type.Fixture_Check_2);
//MustHaveDIList.Add(IO_Type.Fixture_Check_3);
//MustHaveDIList.Add(IO_Type.Fixture_Check_4);
//MustHaveDIList.Add(IO_Type.InStore_TopCylinder_Up);
//MustHaveDIList.Add(IO_Type.InStore_TopCylinder_Down);
//MustHaveDIList.Add(IO_Type.SidesWay1_StopFixtureCheck);
//MustHaveDIList.Add(IO_Type.SidesWay1_FixtureCheck);
//MustHaveDIList.Add(IO_Type.SidesWay1_TopCylinder_Up);
//MustHaveDIList.Add(IO_Type.SidesWay1_TopCylinder_Down);
//MustHaveDIList.Add(IO_Type.SidesWay2_FixtureCheck);
//MustHaveDIList.Add(IO_Type.SidesWay2_TopCylinder_Up);
//MustHaveDIList.Add(IO_Type.SidesWay2_TopCylinder_Down);
//MustHaveDIList.Add(IO_Type.DriveMotor_INV1);
//MustHaveDIList.Add(IO_Type.DriveMotor_INV2);
//MustHaveDOList.Add(IO_Type.AutoRun_HddLed);
//MustHaveDOList.Add(IO_Type.RunSign_HddLed);
//MustHaveDOList.Add(IO_Type.Alarm_HddLed);
//MustHaveDOList.Add(IO_Type.DriveMotor_Run);
//MustHaveDOList.Add(IO_Type.SidesWay12_DriveMotor);
//MustHaveDOList.Add(IO_Type.SidesWay34_DriveMotor);
//MustHaveDOList.Add(IO_Type.StopCylinder_Down1);
//MustHaveDOList.Add(IO_Type.StopCylinder_Down2);
//MustHaveDOList.Add(IO_Type.SidesWay1_StopCylinderDown);
//MustHaveDOList.Add(IO_Type.InStore_TopCylinder_Up);
//MustHaveDOList.Add(IO_Type.InStore_TopCylinder_Down);
//MustHaveDOList.Add(IO_Type.SidesWay3_StopCylinderDown);
//MustHaveDOList.Add(IO_Type.SidesWay34_TopCylinder_Up);
//MustHaveDOList.Add(IO_Type.SidesWay34_TopCylinder_Down);
//MustHaveDIList.Add(IO_Type.SidesWay3_StopFixtureCheck);
//MustHaveDIList.Add(IO_Type.SidesWay3_FixtureCheck);
//MustHaveDIList.Add(IO_Type.SidesWay3_TopCylinder_Up);
//MustHaveDIList.Add(IO_Type.SidesWay3_TopCylinder_Down);
//MustHaveDIList.Add(IO_Type.SidesWay4_FixtureCheck);
//MustHaveDIList.Add(IO_Type.SidesWay4_TopCylinder_Up);
//MustHaveDIList.Add(IO_Type.SidesWay4_TopCylinder_Down);
//MustHaveDIList.Add(IO_Type.OutStore_FixtureCheck);
//MustHaveDIList.Add(IO_Type.OutStore_TrayCheck);
//MustHaveDOList.Add(IO_Type.SidesWay12_TopCylinder_Up);
//MustHaveDOList.Add(IO_Type.SidesWay12_TopCylinder_Down);
}
}
}