Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
7158c9a0
Commit
7158c9a0
authored
Jan 30, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
8832b605
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
647 additions
and
0 deletions
+647
-0
BorderSearchServiceClient.cs
...k.Base/FLY.Thick.Base/Client/BorderSearchServiceClient.cs
+363
-0
InitParamServiceClient.cs
...hick.Base/FLY.Thick.Base/Client/InitParamServiceClient.cs
+284
-0
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base/Client/BorderSearchServiceClient.cs
0 → 100644
View file @
7158c9a0
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.ComponentModel
;
using
Misc
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
using
FLY.Thick.Base.Common
;
namespace
FLY.Thick.Base.Client
{
public
class
BorderSearchServiceClient
:
FObj
,
IBorderSearchService
{
IFConn
mConn
;
UInt32
mServerID
;
public
BorderSearchServiceClient
(
UInt32
id
)
{
mServerID
=
id
;
}
#
region
IBorderSearchService
成员
private
bool
enable
;
public
bool
Enable
{
get
{
return
enable
;
}
set
{
if
(
enable
!=
value
)
{
enable
=
value
;
NotifyPropertyChanged
(
"Enable"
);
}
}
}
bool
isbreakdetect
=
true
;
/// <summary>
/// 边界拐点检测,找到的边界更加精确
/// </summary>
public
bool
IsBreakDetect
{
get
{
return
isbreakdetect
;
}
set
{
if
(
isbreakdetect
!=
value
)
{
isbreakdetect
=
value
;
NotifyPropertyChanged
(
"IsBreakDetect"
);
}
}
}
private
Range
valid
=
new
Range
();
public
Range
Valid
{
get
{
return
valid
;
}
}
private
Range
border_backw
=
new
Range
();
public
Range
Border_Backw
{
get
{
return
border_backw
;
}
}
private
Range
border_forw
=
new
Range
();
public
Range
Border_Forw
{
get
{
return
border_forw
;
}
}
private
int
width
;
/// <summary>
/// 当前膜宽,测量出来的,单位是 脉冲
/// </summary>
public
int
Width
{
get
{
return
width
;
}
protected
set
{
if
(
width
!=
value
)
{
width
=
value
;
NotifyPropertyChanged
(
"Width"
);
}
}
}
private
int
mid
;
/// <summary>
/// 膜中间位置 单位 脉冲
/// </summary>
public
int
Mid
{
get
{
return
mid
;
}
protected
set
{
if
(
mid
!=
value
)
{
mid
=
value
;
NotifyPropertyChanged
(
"Mid"
);
}
}
}
bool
tempADBySet
=
false
;
/// <summary>
/// 手动设置温修AD值
/// </summary>
public
bool
TempADBySet
{
get
{
return
tempADBySet
;
}
set
{
if
(
tempADBySet
!=
value
)
{
tempADBySet
=
value
;
NotifyPropertyChanged
(
"TempADBySet"
);
}
}
}
private
int
tempad
;
public
int
TempAD
{
get
{
return
tempad
;
}
set
{
if
(
tempad
!=
value
)
{
tempad
=
value
;
NotifyPropertyChanged
(
"TempAD"
);
}
}
}
private
int
temprange
;
public
int
TempRange
{
get
{
return
temprange
;
}
set
{
if
(
temprange
!=
value
)
{
temprange
=
value
;
NotifyPropertyChanged
(
"TempRange"
);
}
}
}
private
int
n
;
public
int
N
{
get
{
return
n
;
}
set
{
if
(
n
!=
value
)
{
n
=
value
;
NotifyPropertyChanged
(
"N"
);
}
}
}
private
int
sensorwidth
;
/// <summary>
/// 探头直径,单位脉冲, 膜宽 = 边界范围 - 探头直径
/// </summary>
public
int
SensorWidth
{
get
{
return
sensorwidth
;
}
set
{
if
(
sensorwidth
!=
value
)
{
sensorwidth
=
value
;
NotifyPropertyChanged
(
"SensorWidth"
);
}
}
}
private
int
n2
;
public
int
N2
{
get
{
return
n2
;
}
set
{
if
(
n2
!=
value
)
{
n2
=
value
;
NotifyPropertyChanged
(
"N2"
);
}
}
}
private
int
n3
;
public
int
N3
{
get
{
return
n3
;
}
set
{
if
(
n3
!=
value
)
{
n3
=
value
;
NotifyPropertyChanged
(
"N3"
);
}
}
}
private
int
[]
datas
=
null
;
/// <summary>
/// 用于调试, 进入到边界查找的数据
/// </summary>
public
int
[]
Datas
{
get
{
return
datas
;
}
protected
set
{
datas
=
value
;
NotifyPropertyChanged
(
"Datas"
);
}
}
#
endregion
#
region
INotifyPropertyChanged
成员
public
event
PropertyChangedEventHandler
PropertyChanged
;
protected
void
NotifyPropertyChanged
(
string
propertyname
)
{
if
(
PropertyChanged
!=
null
)
{
PropertyChanged
.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
propertyname
));
}
}
#
endregion
public
void
Apply
()
{
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
p
=
new
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
();
p
.
enable
=
Enable
;
p
.
tempADBySet
=
TempADBySet
;
p
.
tempad
=
TempAD
;
p
.
temprange
=
TempRange
;
p
.
n
=
N
;
p
.
n2
=
N2
;
p
.
n3
=
N3
;
p
.
valid
=
Valid
;
p
.
sensorwidth
=
SensorWidth
;
p
.
isBreakDetect
=
IsBreakDetect
;
//获取所有数据,设置推送
CurrObjSys
.
SetValueEx
(
mConn
,
mServerID
,
ID
,
BORDERSEARCH_OBJ_INTERFACE
.
SET_PARAMS
,
p
.
ToBytes
());
}
public
override
void
Dispose
()
{
CurrObjSys
.
ObjRemove
(
this
,
mConn
);
}
public
override
void
ConnectNotify
(
IFConn
from
)
{
mConn
=
from
;
if
(
from
.
IsConnected
)
{
//获取所有数据,设置推送
CurrObjSys
.
GetValueEx
(
mConn
,
mServerID
,
ID
,
BORDERSEARCH_OBJ_INTERFACE
.
GET_PARAMS
);
CurrObjSys
.
GetValueEx
(
mConn
,
mServerID
,
ID
,
BORDERSEARCH_OBJ_INTERFACE
.
GET_RESULT
);
CurrObjSys
.
GetValueEx
(
mConn
,
mServerID
,
ID
,
BORDERSEARCH_OBJ_INTERFACE
.
GET_DATAS
);
CurrObjSys
.
SenseConfigEx
(
mConn
,
mServerID
,
ID
,
0xffffffff
,
SENSE_CONFIG
.
ADD
);
}
}
public
override
void
PushGetValue
(
IFConn
from
,
uint
srcid
,
ushort
memid
,
byte
[]
infodata
)
{
switch
(
memid
)
{
case
BORDERSEARCH_OBJ_INTERFACE
.
GET_PARAMS
:
{
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
p
=
new
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Params
();
if
(!
p
.
TryParse
(
infodata
))
return
;
Enable
=
p
.
enable
;
Valid
.
Begin
=
p
.
valid
.
Begin
;
Valid
.
End
=
p
.
valid
.
End
;
TempADBySet
=
p
.
tempADBySet
;
TempAD
=
p
.
tempad
;
TempRange
=
p
.
temprange
;
N
=
p
.
n
;
SensorWidth
=
p
.
sensorwidth
;
N2
=
p
.
n2
;
N3
=
p
.
n3
;
IsBreakDetect
=
p
.
isBreakDetect
;
}
break
;
case
BORDERSEARCH_OBJ_INTERFACE
.
GET_RESULT
:
{
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Result
p
=
new
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Result
();
if
(!
p
.
TryParse
(
infodata
))
return
;
Border_Forw
.
Begin
=
p
.
borderForw
.
Begin
;
Border_Forw
.
End
=
p
.
borderForw
.
End
;
Border_Backw
.
Begin
=
p
.
borderBackw
.
Begin
;
Border_Backw
.
End
=
p
.
borderBackw
.
End
;
Width
=
p
.
width
;
Mid
=
p
.
mid
;
}
break
;
case
BORDERSEARCH_OBJ_INTERFACE
.
GET_DATAS
:
{
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Data
p
=
new
BORDERSEARCH_OBJ_INTERFACE
.
Pack_Data
();
if
(!
p
.
TryParse
(
infodata
))
return
;
Datas
=
p
.
data
;
}
break
;
}
}
public
override
void
PushInfo
(
IFConn
from
,
uint
srcid
,
ushort
infoid
,
byte
[]
infodata
)
{
PushGetValue
(
from
,
srcid
,
infoid
,
infodata
);
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/Client/InitParamServiceClient.cs
0 → 100644
View file @
7158c9a0
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.ComponentModel
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
using
FLY.Thick.Base.Common
;
namespace
FLY.Thick.Base.Client
{
public
class
InitParamServiceClient
:
FObj
,
IInitParamService
{
IFConn
mConn
;
UInt32
mServerID
;
public
InitParamServiceClient
(
UInt32
id
)
{
mServerID
=
id
;
}
#
region
属性,成员变量的代理
/// <summary>
/// 扫描架长
/// </summary>
public
int
PosLength
{
get
;
set
;
}
=
8900
;
/// <summary>
/// 自动归原点间距
/// </summary>
public
int
AutoOrgInterval
{
get
;
set
;
}
=
30
;
/// <summary>
/// 从 flyad7 获取的
/// </summary>
public
int
PosOfGrid
{
get
;
set
;
}
=
10
;
/// <summary>
/// ad 滞后量 ms
/// </summary>
public
int
ADLag
{
get
;
set
;
}
=
0
;
/// <summary>
/// 编码器1 mm/pulse
/// </summary>
public
double
Encoder1_mmpp
{
get
;
set
;
}
=
0.1
;
/// <summary>
/// 设置的速度,与 实际速度比例
/// </summary>
public
double
Speed1Scale
{
get
;
set
;
}
=
1
;
/// <summary>
/// 线速度来源
/// </summary>
public
FilmVSRC
FilmVSrc
{
get
;
set
;
}
=
FilmVSRC
.
ROUND
;
/// <summary>
/// 最小线速度 m/min
/// </summary>
public
int
FilmVThreshold
{
get
;
set
;
}
=
5
;
/// <summary>
/// 编码器2 mm/pulse
/// </summary>
public
double
Encoder2_mmpp
{
get
;
set
;
}
=
0.1
;
/// <summary>
/// 编码器2 放大
/// </summary>
public
float
Encoder2_comp
{
get
;
set
;
}
=
1
;
/// <summary>
/// //1圈多少mm
/// </summary>
public
double
MmOfR
{
get
;
set
;
}
=
314
;
/// <summary>
/// 数据有效源
/// </summary>
public
DATAVALIDSRC
DataValidSrc
{
get
;
set
;
}
=
DATAVALIDSRC
.
VALID
;
/// <summary>
/// 当数据有效状态改变,自动按F1,F3
/// </summary>
public
bool
AutoF1F3
{
get
;
set
;
}
/// <summary>
/// 当数据有效状态 无效->有效 ,等待多久重新扫描 ,单位s
/// </summary>
public
int
ReStartDelay
{
get
;
set
;
}
=
5
;
#
region
速度
/// <summary>
/// 扫描时速度
/// </summary>
public
UInt32
VScan
{
get
;
set
;
}
=
8000
;
/// <summary>
/// 调试时速度,向前走,向后走
/// </summary>
public
UInt32
VJOG
{
get
;
set
;
}
=
5000
;
/// <summary>
/// 精确速度 Velocity Of Accuracy 如: 机架修正, 样品取样, 机架信息获取
/// </summary>
public
UInt32
VAccuracy
{
get
;
set
;
}
=
3000
;
/// <summary>
/// 开始速度 Start Velocity
/// </summary>
public
UInt32
SVelocity
{
get
;
set
;
}
=
500
;
/// <summary>
/// 加速时间
/// </summary>
public
UInt32
ATime
{
get
;
set
;
}
=
200
;
/// <summary>
/// 减速时间
/// </summary>
public
UInt32
DTime
{
get
;
set
;
}
=
200
;
/// <summary>
/// 归0速度1
/// </summary>
public
UInt32
HVelocity1
{
get
;
set
;
}
=
5000
;
/// <summary>
/// 归0速度2
/// </summary>
public
UInt32
HVelocity2
{
get
;
set
;
}
=
1000
;
#
endregion
/// <summary>
/// 有按样标定硬件
/// </summary>
public
bool
HasProfileSample
{
get
;
set
;
}
/// <summary>
/// 有小托辊
/// </summary>
public
bool
HasHold
{
get
;
set
;
}
#
endregion
#
region
INotifyPropertyChanged
成员
public
event
PropertyChangedEventHandler
PropertyChanged
;
#
endregion
public
void
Apply
()
{
INITPARAM_OBJ_INTERFACE
.
Pack_Params
p
=
new
INITPARAM_OBJ_INTERFACE
.
Pack_Params
()
{
poslength
=
PosLength
,
auto_org_interval
=
AutoOrgInterval
,
adlag
=
ADLag
,
encoder1_mmpp
=
Encoder1_mmpp
,
speed1scale
=
Speed1Scale
,
filmVSrc
=
FilmVSrc
,
filmVThreshold
=
FilmVThreshold
,
encoder2_mmpp
=
Encoder2_mmpp
,
mmOfR
=
MmOfR
,
encoder2_comp
=
Encoder2_comp
,
data_valid_src
=
DataValidSrc
,
autof1f3
=
AutoF1F3
,
restartDelay
=
ReStartDelay
,
vscan
=
VScan
,
vjog
=
VJOG
,
vaccuracy
=
VAccuracy
,
svelocity
=
SVelocity
,
atime
=
ATime
,
dtime
=
DTime
,
hvelocity1
=
HVelocity1
,
hvelocity2
=
HVelocity2
,
hasProfileSample
=
HasProfileSample
,
hasHold
=
HasHold
};
//获取所有数据,设置推送
CurrObjSys
.
SetValueEx
(
mConn
,
mServerID
,
ID
,
INITPARAM_OBJ_INTERFACE
.
SET_PARAMS
,
p
.
ToBytes
());
}
public
override
void
Dispose
()
{
CurrObjSys
.
ObjRemove
(
this
,
mConn
);
}
public
override
void
ConnectNotify
(
IFConn
from
)
{
mConn
=
from
;
if
(
from
.
IsConnected
)
{
//获取所有数据,设置推送
CurrObjSys
.
GetValueEx
(
mConn
,
mServerID
,
ID
,
BORDERSEARCH_OBJ_INTERFACE
.
GET_PARAMS
);
CurrObjSys
.
SenseConfigEx
(
mConn
,
mServerID
,
ID
,
0xffffffff
,
SENSE_CONFIG
.
ADD
);
}
}
public
override
void
PushGetValue
(
IFConn
from
,
uint
srcid
,
ushort
memid
,
byte
[]
infodata
)
{
switch
(
memid
)
{
case
INITPARAM_OBJ_INTERFACE
.
GET_PARAMS
:
{
INITPARAM_OBJ_INTERFACE
.
Pack_Params
p
=
new
INITPARAM_OBJ_INTERFACE
.
Pack_Params
();
if
(!
p
.
TryParse
(
infodata
))
return
;
PosLength
=
p
.
poslength
;
AutoOrgInterval
=
p
.
auto_org_interval
;
PosOfGrid
=
p
.
posOfGrid
;
ADLag
=
p
.
adlag
;
Encoder1_mmpp
=
p
.
encoder1_mmpp
;
Speed1Scale
=
p
.
speed1scale
;
FilmVSrc
=
p
.
filmVSrc
;
FilmVThreshold
=
p
.
filmVThreshold
;
Encoder2_mmpp
=
p
.
encoder2_mmpp
;
Encoder2_comp
=
p
.
encoder2_comp
;
MmOfR
=
p
.
mmOfR
;
DataValidSrc
=
p
.
data_valid_src
;
AutoF1F3
=
p
.
autof1f3
;
ReStartDelay
=
p
.
restartDelay
;
VScan
=
p
.
vscan
;
VJOG
=
p
.
vjog
;
VAccuracy
=
p
.
vaccuracy
;
SVelocity
=
p
.
svelocity
;
ATime
=
p
.
atime
;
DTime
=
p
.
dtime
;
HVelocity1
=
p
.
hvelocity1
;
HVelocity2
=
p
.
hvelocity2
;
HasProfileSample
=
p
.
hasProfileSample
;
HasHold
=
p
.
hasHold
;
}
break
;
}
}
public
override
void
PushInfo
(
IFConn
from
,
uint
srcid
,
ushort
infoid
,
byte
[]
infodata
)
{
PushGetValue
(
from
,
srcid
,
infoid
,
infodata
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment