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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
using System;
using System.Collections.Generic;
using System.Text;
using Misc;
using System.Net;
using System.IO;
using System.ComponentModel;
using System.Xml.Linq;
using FLY.Thick.Base.Common;
using FLY.Thick.Base.IService;
namespace FLY.Thick.Base.Server
{
//硬件配置参数
public class InitParam: IInitParamService, INotifyPropertyChanged, Misc.ISaveToXml
{
#region 属性,成员变量的代理
private int poslen = 8900;//扫描架长
/// <summary>
/// 扫描架长
/// </summary>
public int PosLength
{
get { return poslen; }
set
{
poslen = value;
NotifyPropertyChanged("PosLength");
}
}
private int posofgrid = 10;
/// <summary>
/// 从 flyad7 获取的
/// </summary>
public int PosOfGrid
{
get { return posofgrid; }
set
{
if (posofgrid != value)
{
posofgrid = value;
NotifyPropertyChanged("PosOfGrid");
}
}
}
private int adlag = 0;
/// <summary>
/// ad 滞后量 ms
/// </summary>
public int ADLag
{
get { return adlag; }
set
{
if (adlag != value)
{
adlag = value;
NotifyPropertyChanged("ADLag");
}
}
}
private int autoOriginInterval=10;//自动归原点的间隔
/// <summary>
/// 自动归原点间距
/// </summary>
public int AutoOrgInterval
{
get { return autoOriginInterval; }
set
{
if (autoOriginInterval != value)
{
autoOriginInterval = value;
NotifyPropertyChanged("AutoOrgInterval");
}
}
}
private FilmVSRC filmVSrc = FilmVSRC.ROUND;
/// <summary>
/// 线速度来源
/// </summary>
public FilmVSRC FilmVSrc
{
get {
return filmVSrc;
}
set {
if (filmVSrc != value)
{
filmVSrc = value;
NotifyPropertyChanged("FilmVSrc");
}
}
}
private int filmVThreshold = 5;
/// <summary>
/// 最小线速度 m/min
/// </summary>
public int FilmVThreshold
{
get {
return filmVThreshold;
}
set {
if (filmVThreshold != value)
{
filmVThreshold = value;
NotifyPropertyChanged("FilmVThreshold");
}
}
}
private double _encoder2_mmpp=0.1;
/// <summary>
/// 编码器2 mm/pulse
/// </summary>
public double Encoder2_mmpp
{
get { return _encoder2_mmpp; }
set
{
if (_encoder2_mmpp != value)
{
_encoder2_mmpp = value;
NotifyPropertyChanged("Encoder2_mmpp");
}
}
}
private float _encoder2_comp = 1;
/// <summary>
/// 编码器2 放大
/// </summary>
public float Encoder2_comp
{
get { return _encoder2_comp; }
set
{
if (_encoder2_comp != value)
{
_encoder2_comp = value;
NotifyPropertyChanged("Encoder2_comp");
}
}
}
private double mmOfR=314;
/// <summary>
/// //1圈多少mm
/// </summary>
public double MmOfR {
get
{
return mmOfR;
}
set
{
if (mmOfR != value)
{
mmOfR = value;
NotifyPropertyChanged("MmOfR");
}
}
}
private double _encoder1_mmpp=0.1;
/// <summary>
/// 编码器1 mm/pulse
/// </summary>
public double Encoder1_mmpp
{
get { return _encoder1_mmpp; }
set
{
if (_encoder1_mmpp != value)
{
_encoder1_mmpp = value;
NotifyPropertyChanged("Encoder1_mmpp");
}
}
}
private double speed1Scale=1;
/// <summary>
/// 设置的速度,与 实际速度比例
/// </summary>
public double Speed1Scale
{
get { return speed1Scale; }
set
{
if (speed1Scale != value)
{
speed1Scale = value;
NotifyPropertyChanged("Speed1Scale");
}
}
}
private UInt32 velocity_scan = 8000;
/// <summary>
/// 扫描时速度
/// </summary>
public UInt32 VScan
{
get { return velocity_scan; }
set
{
if (velocity_scan != value)
{
velocity_scan = value;
NotifyPropertyChanged("VScan");
}
}
}
private UInt32 velocity_jog = 5000;
/// <summary>
/// 调试时速度,向前走,向后走
/// </summary>
public UInt32 VJOG
{
get { return velocity_jog; }
set
{
if (velocity_jog != value)
{
velocity_jog = value;
NotifyPropertyChanged("VJOG");
}
}
}
private UInt32 velocity_accuracy = 3000;
/// <summary>
/// 精确速度 Velocity Of Accuracy 如: 机架修正, 样品取样, 机架信息获取
/// </summary>
public UInt32 VAccuracy
{
get {
return velocity_accuracy;
}
set {
if (velocity_accuracy != value)
{
velocity_accuracy = value;
NotifyPropertyChanged("VAccuracy");
}
}
}
private UInt32 sv=500;
/// <summary>
/// 开始速度 Start Velocity
/// </summary>
public UInt32 SVelocity
{
get { return sv; }
set
{
if (sv != value)
{
sv = value;
NotifyPropertyChanged("SVelocity");
}
}
}
private UInt32 atime=200;
/// <summary>
/// 加速时间
/// </summary>
public UInt32 ATime
{
get { return atime; }
set
{
if (atime != value)
{
atime = value;
NotifyPropertyChanged("ATime");
}
}
}
private UInt32 dtime=200;
/// <summary>
/// 减速时间
/// </summary>
public UInt32 DTime
{
get { return dtime; }
set
{
if (dtime != value)
{
dtime = value;
NotifyPropertyChanged("DTime");
}
}
}
private UInt32 hv1=5000;
/// <summary>
/// 归0速度1
/// </summary>
public UInt32 HVelocity1
{
get { return hv1; }
set
{
if (hv1 != value)
{
hv1 = value;
NotifyPropertyChanged("HVelocity1");
}
}
}
private UInt32 hv2=1000;
/// <summary>
/// 归0速度2
/// </summary>
public UInt32 HVelocity2
{
get { return hv2; }
set
{
if (hv2 != value)
{
hv2 = value;
NotifyPropertyChanged("HVelocity2");
}
}
}
private DATAVALIDSRC dataValidSrc= DATAVALIDSRC.VALID;
/// <summary>
/// 数据有效源
/// </summary>
public DATAVALIDSRC DataValidSrc
{
get { return dataValidSrc; }
set
{
if (dataValidSrc != value)
{
dataValidSrc = value;
NotifyPropertyChanged("DataValidSrc");
}
}
}
private bool autof1f3 = false;
/// <summary>
/// 当数据有效状态改变,自动按F1,F3
/// </summary>
public bool AutoF1F3
{
get { return autof1f3; }
set
{
if (autof1f3 != value)
{
autof1f3 = value;
NotifyPropertyChanged("AutoF1F3");
}
}
}
private int restartdelay = 5;
/// <summary>
/// 当数据有效状态 无效->有效 ,等待多久重新扫描 ,单位s
/// </summary>
public int ReStartDelay
{
get { return restartdelay; }
set
{
if (restartdelay != value)
{
restartdelay = value;
NotifyPropertyChanged("ReStartDelay");
}
}
}
private bool hasProfileSample = false;
/// <summary>
/// 有按样标定硬件
/// </summary>
public bool HasProfileSample
{
get {
return hasProfileSample;
}
set {
if (hasProfileSample != value)
{
hasProfileSample = value;
NotifyPropertyChanged("HasProfileSample");
}
}
}
private bool hashold = true;
/// <summary>
/// 有小托辊
/// </summary>
public bool HasHold
{
get
{
return hashold;
}
set
{
if (hashold != value)
{
hashold = value;
NotifyPropertyChanged("HasHold");
}
}
}
#endregion
private string param_path = "initparam.xml";
public InitParam()
{
}
public InitParam(string param_path)
{
if (!string.IsNullOrEmpty(param_path))
this.param_path = param_path;
Load();
}
public bool Load()
{
return Misc.SaveToXmlHepler.Load(param_path, this);
}
public bool Save()
{
return Misc.SaveToXmlHepler.Save(param_path, this);
}
#region INotifyPropertyChanged 成员
protected void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
#region ISaveToXml 成员
public string[] GetSavePropertyNames()
{
return new string[]{
"PosLength",
"AutoOrgInterval",
"VScan",
"VJOG",
"VAccuracy",
"SVelocity","ATime","DTime","HVelocity1","HVelocity2",
"Encoder1_mmpp",
"FilmVSrc",
"FilmVThreshold",
"Encoder2_mmpp",
"Encoder2_comp",
"MmOfR",
"DataValidSrc",
"AutoF1F3",
"ReStartDelay",
"HasProfileSample",
"HasHold"
};
}
#endregion
public void Apply()
{
Save();
}
}
}