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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using FObjBase;
using FLY.Thick.Blowing.OBJ_INTERFACE;
using FLY.Thick.Blowing.IService;
using Misc;
namespace FLY.Thick.Blowing.Client
{
public class BlowingFixServiceClient : BlowingServiceClient, IBlowingFixService
{
#region IRenZiJiaService 成员
#region 膜长 计算
/// <summary>
/// 膜长查找范围, 以FilmLength为目标值,两边查找,单位m
/// </summary>
public double FLRange { get; set; }
/// <summary>
/// 计算的状态,因为是一个很漫长的过程!!!
/// </summary>
public string CalState { get; set; }
#region 计算结果
/// <summary>
/// 最大相识度
/// </summary>
public double MaxR { get; set; }
/// <summary>
/// 最大相识度对应速度
/// </summary>
public double MaxRFilmLength { get; set; }
#endregion
#endregion
#region 温修
private bool isBtnSelfHold = true;
/// <summary>
/// 追边开始按钮自锁
/// </summary>
public bool IsBtnSelfHold { get; set; }
public RenZiJiaFixEPCType EPCType { get; set; }
/// <summary>
/// 采样时间, 默认2s
/// </summary>
public TimeSpan SampleConsume { get; set; } = TimeSpan.FromSeconds(2);
/// <summary>
/// 温修间隔,默认45分钟
/// </summary>
public TimeSpan SampleInterval { get; set; } = TimeSpan.FromMinutes(45);
/// <summary>
/// 当前温修计时,大于温修间隔就会去温修
/// </summary>
public TimeSpan SampleTimer { get; protected set; } = TimeSpan.Zero;
/// <summary>
/// 回到边界后,再等待一段时间,那就肯定找到边界了。 默认5s
/// </summary>
public TimeSpan BackEdgeWait { get; set; } = TimeSpan.FromSeconds(5);
/// <summary>
/// 采样得到的样品AD
/// </summary>
public int SampleAD { get; protected set; } = -1;
/// <summary>
/// 追边运行中!
/// </summary>
public bool EPCIsRunning { get; set; }
#endregion
#endregion
public BlowingFixServiceClient():base()
{
}
#region 功能
public override void Apply()
{
base.Apply();
CurrObjSys.SetValueEx(
mConn, mServerID, ID,
BLOWINGFIX_OBJ_INTERFACE.SET_PARAMSEXT,
new BLOWINGFIX_OBJ_INTERFACE.Pack_ParamsExt()
{
filmLenRange = FLRange
}.ToBytes());
CurrObjSys.SetValueEx(
mConn, mServerID, ID,
BLOWINGFIX_OBJ_INTERFACE.SET_EPC,
new BLOWINGFIX_OBJ_INTERFACE.Pack_EPC()
{
epctype = EPCType,
sampleconsume = SampleConsume,
sampleinterval = SampleInterval,
backedgewait = BackEdgeWait,
isBtnSelfHold = IsBtnSelfHold
}.ToBytes());
}
public void CalFilmLength()
{
BLOWINGFIX_OBJ_INTERFACE.Pack_CalR p = new BLOWINGFIX_OBJ_INTERFACE.Pack_CalR();
p.filmLenRange = FLRange;
CurrObjSys.CallFunctionEx(
mConn, mServerID, ID,
BLOWINGFIX_OBJ_INTERFACE.CALL_CALR, p.ToBytes());
}
public void EPCStart()
{
CurrObjSys.CallFunctionEx(
mConn, mServerID, ID,
BLOWINGFIX_OBJ_INTERFACE.CALL_EPCSTART, null);
}
public void EPCStop()
{
CurrObjSys.CallFunctionEx(
mConn, mServerID, ID,
BLOWINGFIX_OBJ_INTERFACE.CALL_EPCSTOP, null);
}
#endregion
public override void ConnectNotify(IFConn from)
{
base.ConnectNotify(from);
if (from.IsConnected)
{
//获取所有数据,设置推送
CurrObjSys.GetValueEx(
mConn,mServerID,ID,
BLOWINGFIX_OBJ_INTERFACE.GET_PARAMSEXT);
CurrObjSys.GetValueEx(
mConn,mServerID,ID,
BLOWINGFIX_OBJ_INTERFACE.GET_R);
CurrObjSys.GetValueEx(
mConn, mServerID, ID,
BLOWINGFIX_OBJ_INTERFACE.GET_EPC);
CurrObjSys.GetValueEx(
mConn, mServerID, ID,
BLOWINGFIX_OBJ_INTERFACE.GET_EPCSTATE);
}
}
public override void PushGetValue(IFConn from, uint srcid, ushort memid, byte[] infodata)
{
base.PushGetValue(from, srcid, memid, infodata);
switch (memid)
{
case BLOWINGFIX_OBJ_INTERFACE.GET_PARAMSEXT:
{
BLOWINGFIX_OBJ_INTERFACE.Pack_ParamsExt p = new BLOWINGFIX_OBJ_INTERFACE.Pack_ParamsExt();
if (!p.TryParse(infodata))
break;
FLRange = p.filmLenRange;
}break;
case BLOWINGFIX_OBJ_INTERFACE.GET_R:
{
BLOWINGFIX_OBJ_INTERFACE.Pack_Relevency p = new BLOWINGFIX_OBJ_INTERFACE.Pack_Relevency();
if (!p.TryParse(infodata))
break;
MaxR = p.max_relevency;
MaxRFilmLength = p.max_filmLength;
CalState = p.calstate;
}break;
case BLOWINGFIX_OBJ_INTERFACE.GET_EPC:
{
BLOWINGFIX_OBJ_INTERFACE.Pack_EPC p = new BLOWINGFIX_OBJ_INTERFACE.Pack_EPC();
if (!p.TryParse(infodata))
break;
EPCType = p.epctype;
SampleConsume = p.sampleconsume;
SampleInterval = p.sampleinterval;
BackEdgeWait = p.backedgewait;
IsBtnSelfHold = p.isBtnSelfHold;
}break;
case BLOWINGFIX_OBJ_INTERFACE.GET_EPCSTATE:
{
BLOWINGFIX_OBJ_INTERFACE.Pack_EPCState p = new BLOWINGFIX_OBJ_INTERFACE.Pack_EPCState();
if (!p.TryParse(infodata))
break;
SampleTimer = p.sampletimer;
EPCIsRunning = p.isrunning;
SampleAD = p.samplead;
}break;
}
}
}
}