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
018ceb11
Commit
018ceb11
authored
May 23, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加 为了前后机同步 FilmPositionDetect 添加 纵向位置偏移 m
parent
271a7bd3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
148 additions
and
83 deletions
+148
-83
FilmPositionDetectServiceClient.cs
.../FLY.Thick.Base/Client/FilmPositionDetectServiceClient.cs
+28
-16
IFilmPositionDetectService.cs
...ase/FLY.Thick.Base/IService/IFilmPositionDetectService.cs
+21
-12
FILMPOS_OBJ_INTERFACE.cs
...ase/FLY.Thick.Base/OBJ_INTERFACE/FILMPOS_OBJ_INTERFACE.cs
+12
-7
FilmPositionDetect_OBJProxy.cs
...Thick.Base/Server.OBJProxy/FilmPositionDetect_OBJProxy.cs
+19
-7
FilmPositionDetect.cs
...LY.Thick.Base/FLY.Thick.Base/Server/FilmPositionDetect.cs
+68
-41
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base/Client/FilmPositionDetectServiceClient.cs
View file @
018ceb11
...
...
@@ -46,7 +46,10 @@ namespace FLY.Thick.Base.Client
/// 膜位置, m
/// </summary>
public
double
FilmPosition
{
get
;
protected
set
;
}
/// <summary>
/// 纵向位置偏移 m
/// </summary>
public
double
FilmOffset
{
get
;
protected
set
;
}
/// <summary>
/// 工作中
/// </summary>
...
...
@@ -62,10 +65,6 @@ namespace FLY.Thick.Base.Client
/// </summary>
public
double
VSensorOffsetInUsed
{
get
;
protected
set
;
}
/// <summary>
/// 已经重新开始测量
/// </summary>
public
bool
HasReset
{
get
;
protected
set
;
}
#
endregion
#
region
参数
...
...
@@ -110,34 +109,47 @@ namespace FLY.Thick.Base.Client
/// <summary>
/// 设置膜位置为某值
/// </summary>
/// <param name="filmPos">极片位置m</param>
public
void
Reset
(
double
filmPos
)
/// <param name="filmPos
ition
">极片位置m</param>
public
void
Reset
Core
(
double
filmPosition
)
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
filmPos
);
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
filmPos
ition
);
CurrObjSys
.
CallFunctionEx
(
mConn
,
mServerID
,
ID
,
FILMPOS_OBJ_INTERFACE
.
CALL_RESET
,
Misc
.
Converter
.
StringToBytes
(
json
));
FILMPOS_OBJ_INTERFACE
.
CALL_RESET
_CORE
,
Misc
.
Converter
.
StringToBytes
(
json
));
}
/// <summary>
///
把膜位置设置为 -VDistanceWithHeader
///
改变逻辑偏移量,从而设置膜位置为某值
/// </summary>
public
void
Reset
()
/// <param name="filmPosition"></param>
public
void
ResetOffset
(
double
filmPosition
)
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
filmPosition
);
CurrObjSys
.
CallFunctionEx
(
mConn
,
mServerID
,
ID
,
FILMPOS_OBJ_INTERFACE
.
CALL_RESET_
2
,
null
);
FILMPOS_OBJ_INTERFACE
.
CALL_RESET_
OFFSET
,
Misc
.
Converter
.
StringToBytes
(
json
)
);
}
/// <summary>
///
清除 hasReset标志位
///
设置逻辑偏移量
/// </summary>
public
void
ClearResetState
()
/// <param name="filmOffset"></param>
public
void
SetOffset
(
double
filmOffset
)
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
filmOffset
);
CurrObjSys
.
CallFunctionEx
(
mConn
,
mServerID
,
ID
,
FILMPOS_OBJ_INTERFACE
.
CALL_
CLEAR_RESET
,
null
);
FILMPOS_OBJ_INTERFACE
.
CALL_
SET_OFFSET
,
Misc
.
Converter
.
StringToBytes
(
json
)
);
}
/// <summary>
/// 把膜位置设置为 -VDistanceWithHeader
/// </summary>
public
void
Reset
()
{
CurrObjSys
.
CallFunctionEx
(
mConn
,
mServerID
,
ID
,
FILMPOS_OBJ_INTERFACE
.
CALL_RESET
,
null
);
}
/// <summary>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/IService/IFilmPositionDetectService.cs
View file @
018ceb11
...
...
@@ -21,10 +21,14 @@ namespace FLY.Thick.Base.IService
/// </summary>
double
FilmVelocity
{
get
;
}
/// <summary>
///
膜位置,
m
///
纵向位置
m
/// </summary>
double
FilmPosition
{
get
;
}
/// <summary>
/// 纵向位置偏移 m
/// </summary>
double
FilmOffset
{
get
;
}
/// <summary>
/// 工作中
/// </summary>
...
...
@@ -40,10 +44,6 @@ namespace FLY.Thick.Base.IService
/// </summary>
double
VSensorOffsetInUsed
{
get
;
}
/// <summary>
/// 已经重新开始测量
/// </summary>
bool
HasReset
{
get
;
}
#
endregion
#
region
参数
...
...
@@ -86,20 +86,29 @@ namespace FLY.Thick.Base.IService
event
FilmPosAt01EventHandler
FilmPosAt01Event
;
/// <summary>
/// 设置膜位置为某值
///
改变硬件测量值,从而
设置膜位置为某值
/// </summary>
/// <param name="filmPos">极片位置m</param>
void
Reset
(
double
filmPos
);
/// <param name="filmPos
ition
">极片位置m</param>
void
Reset
Core
(
double
filmPosition
);
/// <summary>
///
把膜位置设置为 -VDistanceWithHeader
///
改变逻辑偏移量,从而设置膜位置为某值
/// </summary>
void
Reset
();
/// <param name="filmPosition"></param>
void
ResetOffset
(
double
filmPosition
);
/// <summary>
///
清除 hasReset标志位
///
设置逻辑偏移量
/// </summary>
void
ClearResetState
();
/// <param name="filmOffset"></param>
void
SetOffset
(
double
filmOffset
);
/// <summary>
/// 把膜位置设置为 -VDistanceWithHeader
/// </summary>
void
Reset
();
/// <summary>
/// 服务器 从 机头得到的 0->1 事件,给机尾
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/OBJ_INTERFACE/FILMPOS_OBJ_INTERFACE.cs
View file @
018ceb11
...
...
@@ -64,27 +64,32 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
/// <summary>
/// request double
/// </summary>
public
const
UInt16
CALL_RESET
=
0
;
public
const
UInt16
CALL_RESET
_CORE
=
0
;
/// <summary>
///
/// request double
/// </summary>
public
const
UInt16
CALL_RESET_OFFSET
=
1
;
/// <summary>
/// request double
/// </summary>
public
const
UInt16
CALL_
RESET_2
=
1
;
public
const
UInt16
CALL_
SET_OFFSET
=
2
;
/// <summary>
///
/// </summary>
public
const
UInt16
CALL_CLEAR_RESET
=
2
;
public
const
UInt16
CALL_RESET
=
3
;
/// <summary>
/// request double
/// </summary>
public
const
UInt16
CALL_SET_FILMPOS_AT01
=
3
;
public
const
UInt16
CALL_SET_FILMPOS_AT01
=
4
;
/// <summary>
///
/// </summary>
public
const
UInt16
CALL_STOP
=
4
;
public
const
UInt16
CALL_STOP
=
5
;
/// <summary>
///
/// </summary>
public
const
UInt16
CALL_START
=
5
;
public
const
UInt16
CALL_START
=
6
;
#
endregion
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/Server.OBJProxy/FilmPositionDetect_OBJProxy.cs
View file @
018ceb11
...
...
@@ -36,8 +36,9 @@ namespace FLY.Thick.Base.Server.OBJProxy
"FilmVThreshold"
,
"FilmVSrc"
,
"Encoder2_mmpp"
,
"MmOfR"
,
"VDistanceWithHeader"
,
"VSensorOffset"
};
string
[]
propertyNames_state
=
new
string
[]
{
"FilmOffset"
,
"FilmVelocity"
,
"FilmPosition"
,
"IsRunning"
,
"VDistanceWithHeaderInUsed"
,
"VSensorOffsetInUsed"
,
"HasReset"
"FilmPosition"
,
"IsRunning"
,
"VDistanceWithHeaderInUsed"
,
"VSensorOffsetInUsed"
};
private
void
FilmPositionDetectService_PropertyChanged
(
object
sender
,
System
.
ComponentModel
.
PropertyChangedEventArgs
e
)
{
...
...
@@ -104,21 +105,32 @@ namespace FLY.Thick.Base.Server.OBJProxy
{
switch
(
funcid
)
{
case
FILMPOS_OBJ_INTERFACE
.
CALL_RESET
:
case
FILMPOS_OBJ_INTERFACE
.
CALL_RESET
_CORE
:
{
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
JsonConvert
.
DeserializeObject
<
double
>(
json
);
filmPositionDetectService
.
Reset
(
p
);
filmPositionDetectService
.
Reset
Core
(
p
);
}
break
;
case
FILMPOS_OBJ_INTERFACE
.
CALL_RESET_
2
:
case
FILMPOS_OBJ_INTERFACE
.
CALL_RESET_
OFFSET
:
{
filmPositionDetectService
.
Reset
();
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
JsonConvert
.
DeserializeObject
<
double
>(
json
);
filmPositionDetectService
.
ResetOffset
(
p
);
}
break
;
case
FILMPOS_OBJ_INTERFACE
.
CALL_
CLEAR_RE
SET
:
case
FILMPOS_OBJ_INTERFACE
.
CALL_
SET_OFF
SET
:
{
filmPositionDetectService
.
ClearResetState
();
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
JsonConvert
.
DeserializeObject
<
double
>(
json
);
filmPositionDetectService
.
SetOffset
(
p
);
}
break
;
case
FILMPOS_OBJ_INTERFACE
.
CALL_RESET
:
{
filmPositionDetectService
.
Reset
();
}
break
;
case
FILMPOS_OBJ_INTERFACE
.
CALL_SET_FILMPOS_AT01
:
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/FilmPositionDetect.cs
View file @
018ceb11
...
...
@@ -40,15 +40,20 @@ namespace FLY.Thick.Base.Server
#
region
状态
/// <summary>
///
线
速度 m/min
///
纵向
速度 m/min
/// </summary>
public
double
FilmVelocity
{
get
;
private
set
;
}
/// <summary>
///
膜
位置, m
///
纵向
位置, m
/// </summary>
public
double
FilmPosition
{
get
;
private
set
;
}
/// <summary>
/// 纵向位置偏移 m
/// </summary>
public
double
FilmOffset
{
get
;
private
set
;
}
/// <summary>
/// 工作中
/// </summary>
...
...
@@ -64,10 +69,6 @@ namespace FLY.Thick.Base.Server
/// </summary>
public
double
VSensorOffsetInUsed
{
get
;
private
set
;
}
/// <summary>
/// 已经重新开始测量
/// </summary>
public
bool
HasReset
{
get
;
private
set
;
}
#
endregion
#
region
参数
...
...
@@ -117,6 +118,10 @@ namespace FLY.Thick.Base.Server
FlyAD7
flyAd
;
/// <summary>
///
/// </summary>
...
...
@@ -164,8 +169,10 @@ namespace FLY.Thick.Base.Server
}
else
if
(
e
.
PropertyName
==
"Position2"
)
{
//TODO flyAd.Position2 处理溢出问题!!!!!
double
filmPos
=
Pos2ToFilmPos
(
flyAd
.
Position2
);
FilmPosition
=
filmPos
;
FilmPosition
=
filmPos
+
FilmOffset
;
}
else
if
(
e
.
PropertyName
==
"OStatus"
)
{
...
...
@@ -197,21 +204,40 @@ namespace FLY.Thick.Base.Server
if
(
Misc
.
MyBase
.
CHECKBIT
(
e
.
IStatus
,
InIdxOfVSensor
-
1
))
{
if
(
FilmPosAt01Event
!=
null
)
{
//减去偏移
double
filmPos
=
Pos2ToFilmPos
(
e
.
Position2
);
filmPos
-=
VSensorOffset
;
FilmPosAt01Event
(
this
,
new
FilmPosAt01EventArgs
()
{
filmPos
=
filmPos
});
}
PushFilmPosAt01
(
e
.
Position2
);
}
}
}
void
PushFilmPosAt01
(
int
pos2
)
{
double
filmPos
=
Pos2ToFilmPos
(
pos2
)
+
FilmOffset
;
//减去偏移
filmPos
-=
VSensorOffset
;
FilmPosAt01Event
(
this
,
new
FilmPosAt01EventArgs
()
{
filmPos
=
filmPos
});
}
/// <summary>
/// 服务器 从 机头得到的 0->1 事件,给机尾
/// </summary>
/// <param name="filmPos">极片位置m</param>
public
void
SetFilmPosAt01
(
double
filmPos
)
{
//加上偏移
filmPos
+=
VSensorOffset
;
int
pos2
=
FilmPosToPos2
(
filmPos
-
FilmOffset
);
flyAd
.
SetPos2At01
(
pos2
,
false
);
}
#
region
辊信号生成
线速度
DispatcherTimer
round_t
;
DateTime
dtRound
;
int
RCnt
=
0
;
/// <summary>
/// 使用辊速传感器时的位置基值 m
/// </summary>
double
BaseFilmPosition
=
0
;
void
InitRoundFilmVelocity
()
{
...
...
@@ -249,7 +275,7 @@ namespace FLY.Thick.Base.Server
if
(
v
>
0
)
{
RCnt
++;
FilmPosition
=
RCnt
*
MmOfR
/
1000.0
+
BaseFilmPosition
;
FilmPosition
=
RCnt
*
MmOfR
/
1000.0
+
BaseFilmPosition
+
FilmOffset
;
}
}
...
...
@@ -297,9 +323,9 @@ namespace FLY.Thick.Base.Server
double
p2
=
(
dt
-
dtRound
).
TotalMinutes
*
FilmVelocity
;
if
(
p2
>
MmOfR
/
1000.0
)
p2
=
MmOfR
/
1000.0
;
p1
+=
p2
;
if
(
FilmPosition
<
p1
)
FilmPosition
=
p1
;
double
filmPosition
=
p1
+
p2
+
+
BaseFilmPosition
+
FilmOffset
;
if
(
FilmPosition
<
filmPosition
)
FilmPosition
=
filmPosition
;
if
(
dtRound
==
DateTime
.
MinValue
)
{
...
...
@@ -307,57 +333,58 @@ namespace FLY.Thick.Base.Server
return
;
}
}
#
endregion
/// <summary>
/// 设置膜位置为某值
///
改变硬件测量值,从而
设置膜位置为某值
/// </summary>
/// <param name="filmPos">极片位置m</param>
public
void
Reset
(
double
filmPos
)
/// <param name="filmPos
ition
">极片位置m</param>
public
void
Reset
Core
(
double
filmPosition
)
{
double
filmPosCore
=
filmPosition
-
FilmOffset
;
//TODO
if
(
FilmVSrc
==
FilmVSRC
.
EN2
)
{
int
pos2
=
(
int
)(
filmPos
*
1000.0
/
Encoder2_mmpp
);
int
pos2
=
(
int
)(
filmPos
Core
*
1000.0
/
Encoder2_mmpp
);
flyAd
.
Position2
=
pos2
;
}
else
{
RCnt
=
0
;
BaseFilmPosition
=
filmPos
;
FilmPosition
=
BaseFilmPosition
;
BaseFilmPosition
=
filmPosCore
;
}
HasReset
=
true
;
FilmPosition
=
filmPosition
;
}
/// <summary>
///
把膜位置设置为 -VDistanceWithHeader
///
改变逻辑偏移量,从而设置膜位置为某值
/// </summary>
public
void
Reset
()
/// <param name="filmPosition"></param>
public
void
ResetOffset
(
double
filmPosition
)
{
Reset
(-
VDistanceWithHeader
);
FilmOffset
+=
(
filmPosition
-
FilmPosition
);
}
/// <summary>
///
清除 hasReset标志位
///
把膜位置设置为 -VDistanceWithHeader, 且把逻辑偏移量复位为0
/// </summary>
public
void
ClearResetState
()
public
void
Reset
()
{
HasReset
=
false
;
FilmOffset
=
0
;
ResetCore
(-
VDistanceWithHeader
);
}
/// <summary>
///
服务器 从 机头得到的 0->1 事件,给机尾
///
设置逻辑偏移量
/// </summary>
/// <param name="filmPos">极片位置m</param>
public
void
SetFilmPosAt01
(
double
filmPos
)
{
//加上偏移
filmPos
+=
VSensorOffset
;
int
pos2
=
FilmPosToPos2
(
filmPos
);
flyAd
.
SetPos2At01
(
pos2
,
false
);
/// <param name="filmOffset"></param>
public
void
SetOffset
(
double
filmOffset
)
{
double
offset
=
filmOffset
-
FilmOffset
;
FilmOffset
=
filmOffset
;
FilmPosition
+=
offset
;
}
int
FilmPosToPos2
(
double
filmPos
)
{
return
(
int
)(
filmPos
*
1000.0
/
Encoder2_mmpp
);
...
...
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