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
9671ddff
Commit
9671ddff
authored
Jul 05, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
还在修改 样品采集,添加很多报警
parent
7e126e15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
404 additions
and
203 deletions
+404
-203
PgGetSample.xaml.cs
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml.cs
+18
-13
GetSampleServiceClient.cs
...hick.Base/FLY.Thick.Base/Client/GetSampleServiceClient.cs
+12
-18
IGetSampleService.cs
...Y.Thick.Base/FLY.Thick.Base/IService/IGetSampleService.cs
+29
-8
GetSample.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs
+282
-144
TempFilter.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/TempFilter.cs
+63
-20
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml.cs
View file @
9671ddff
...
...
@@ -64,16 +64,10 @@ namespace FLY.Thick.Base.UI
/// </summary>
public
bool
Enable
{
get
;
set
;
}
/// <summary>
/// 参数:速度
/// </summary>
public
UInt32
Velocity
{
get
;
set
;
}
/// <summary>
/// 参数:样品点范围
/// </summary>
public
int
Range
{
get
;
set
;
}
public
int
Sample
Range
{
get
;
set
;
}
/// <summary>
/// 参数:移动滤波 ,窗口值
...
...
@@ -92,6 +86,18 @@ namespace FLY.Thick.Base.UI
/// 异常值
/// </summary>
public
int
ErrValue
{
get
;
set
;
}
/// <summary>
/// 当前 样品X_AD/样品0_AD 与 上一次比较 差异比例 单位不是%
/// </summary>
public
double
CrossErrPercent
{
get
;
set
;
}
/// <summary>
/// 异常比较 时间间隔范围;
/// 两次时间点比较, 时间点的间隔最大时长。 大于它无效,不能比较
/// </summary>
public
int
ErrIntervalMin
{
get
;
set
;
}
/// <summary>
/// 参数:样品点参数
/// </summary>
...
...
@@ -99,7 +105,7 @@ namespace FLY.Thick.Base.UI
/// <summary>
/// 参数:特征查找范围
/// </summary>
public
int
Search
{
get
;
set
;
}
public
int
Search
Range
{
get
;
set
;
}
/// <summary>
/// 参数:特征参数
/// </summary>
...
...
@@ -133,13 +139,12 @@ namespace FLY.Thick.Base.UI
this
.
getSampleService
=
getSampleService
;
this
.
gageInfoService
=
gageInfoService
;
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Enable
),
this
,
nameof
(
Enable
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Velocity
),
this
,
nameof
(
Velocity
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Range
),
this
,
nameof
(
Range
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
SampleRange
),
this
,
nameof
(
SampleRange
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Window
),
this
,
nameof
(
Window
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
IsCheckByPercent
),
this
,
nameof
(
IsCheckByPercent
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
ErrPercent
),
this
,
nameof
(
ErrPercent
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
ErrValue
),
this
,
nameof
(
ErrValue
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Search
),
this
,
nameof
(
Search
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Search
Range
),
this
,
nameof
(
SearchRange
));
Samples
=
new
SampleCell
[
this
.
getSampleService
.
Samples
.
Count
()];
Features
=
new
SampleFeature
[
this
.
getSampleService
.
Features
.
Count
()];
...
...
@@ -173,7 +178,7 @@ namespace FLY.Thick.Base.UI
this
.
getSampleService
.
Enable
=
this
.
Enable
;
this
.
getSampleService
.
Range
=
this
.
Range
;
this
.
getSampleService
.
SampleRange
=
this
.
Sample
Range
;
this
.
getSampleService
.
Velocity
=
this
.
Velocity
;
this
.
getSampleService
.
Window
=
this
.
Window
;
this
.
getSampleService
.
IsCheckByPercent
=
this
.
IsCheckByPercent
;
...
...
@@ -190,7 +195,7 @@ namespace FLY.Thick.Base.UI
sample_desp
.
OrgAD
=
sample_src
.
OrgAD
;
sample_desp
.
Position
=
sample_src
.
Position
;
}
this
.
getSampleService
.
Search
=
this
.
Search
;
this
.
getSampleService
.
Search
Range
=
this
.
SearchRange
;
for
(
int
i
=
0
;
i
<
Features
.
Count
();
i
++)
{
var
feature_src
=
this
.
Features
[
i
];
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/GetSampleServiceClient.cs
View file @
9671ddff
...
...
@@ -15,14 +15,14 @@ namespace FLY.Thick.Base.Client
/// 边界查找服务 构造
/// </summary>
/// <param name="id"></param>
public
GetSampleServiceClient
(
UInt32
id
)
:
base
(
id
)
{
init
();
}
public
GetSampleServiceClient
(
UInt32
id
)
:
base
(
id
)
{
}
/// <summary>
/// 边界查找服务 构造
/// </summary>
/// <param name="serviceId">服务id</param>
/// <param name="connName">连接器</param>
public
GetSampleServiceClient
(
UInt32
serviceId
,
string
connName
)
:
base
(
serviceId
,
connName
)
{
init
();
}
public
GetSampleServiceClient
(
UInt32
serviceId
,
string
connName
)
:
base
(
serviceId
,
connName
)
{
}
...
...
@@ -41,7 +41,7 @@ namespace FLY.Thick.Base.Client
/// <summary>
/// 参数:样品点范围
/// </summary>
public
int
Range
{
get
;
set
;
}
public
int
Sample
Range
{
get
;
set
;
}
/// <summary>
...
...
@@ -65,19 +65,23 @@ namespace FLY.Thick.Base.Client
/// <summary>
/// 样品
/// </summary>
public
SampleCell
[]
Samples
{
get
;
set
;
}
=
new
SampleCell
[
3
];
public
SampleCell
[]
Samples
{
get
;
set
;
}
=
new
SampleCell
[]
{
new
SampleCell
(),
new
SampleCell
(),
new
SampleCell
()
};
/// <summary>
/// 查找公差
/// </summary>
public
int
Search
{
get
;
set
;
}
public
int
Search
Range
{
get
;
set
;
}
/// <summary>
/// 特征 相识度 0 正, 1 反
/// </summary>
public
SampleFeature
[]
Features
{
get
;
set
;
}
=
new
SampleFeature
[
2
];
public
SampleFeature
[]
Features
{
get
;
set
;
}
=
new
SampleFeature
[]
{
new
SampleFeature
(),
new
SampleFeature
()
};
public
double
CrossErrPercent
{
get
;
set
;
}
public
int
ErrIntervalMin
{
get
;
set
;
}
/// <summary>
///
...
...
@@ -88,16 +92,6 @@ namespace FLY.Thick.Base.Client
}
#
endregion
void
init
()
{
for
(
int
i
=
0
;
i
<
Samples
.
Count
();
i
++)
Samples
[
i
]
=
new
SampleCell
();
for
(
int
i
=
0
;
i
<
Features
.
Count
();
i
++)
Features
[
i
]
=
new
SampleFeature
();
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/IService/IGetSampleService.cs
View file @
9671ddff
...
...
@@ -24,43 +24,64 @@ namespace FLY.Thick.Base.IService
/// <summary>
/// 参数:速度
/// </summary>
UInt32
Velocity
{
get
;
set
;
}
UInt32
Velocity
{
get
;
}
/// <summary>
/// 参数:样品点范围
/// 参数:样品点范围 单位:脉冲
/// 样品点直径为 Range*2
/// </summary>
int
Range
{
get
;
set
;
}
int
Sample
Range
{
get
;
set
;
}
/// <summary>
/// 参数:移动滤波 ,窗口值
/// 参数:移动滤波 ,窗口值
单位:min
/// </summary>
int
Window
{
get
;
set
;
}
/// <summary>
/// 使用%方式检查异常
/// 1.滤波前AD 与 滤波后AD比较
/// 2.当前样品AD 与 上一次样品AD比较
/// 3.当前 样品X_AD/样品0_AD 与 上一次比较
/// </summary>
bool
IsCheckByPercent
{
get
;
set
;
}
/// <summary>
/// 异常%
/// 异常
比例 单位不是
%
/// </summary>
double
ErrPercent
{
get
;
set
;
}
/// <summary>
/// 异常值
/// </summary>
int
ErrValue
{
get
;
set
;
}
/// <summary>
/// 当前 样品X_AD/样品0_AD 与 上一次比较 差异比例 单位不是%
/// </summary>
double
CrossErrPercent
{
get
;
set
;
}
/// <summary>
/// 异常比较 时间间隔范围;
/// 两次时间点比较, 时间点的间隔最大时长。 大于它无效,不能比较
/// </summary>
int
ErrIntervalMin
{
get
;
set
;
}
/// <summary>
/// 参数:样品点参数
/// </summary>
[
PropertyPush
]
SampleCell
[]
Samples
{
get
;
}
/// <summary>
/// 参数:特征查找范围
/// 参数:特征查找范围 单位:脉冲
/// 取样范围 会扩大为 -SearchRange ~ +SearchRange
/// </summary>
int
Search
{
get
;
set
;
}
int
Search
Range
{
get
;
set
;
}
/// <summary>
/// 参数:特征参数
/// 参数:特征参数
0:正方向, 1:反方向
/// </summary>
[
PropertyPush
]
SampleFeature
[]
Features
{
get
;
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs
View file @
9671ddff
This diff is collapsed.
Click to expand it.
Project.FLY.Thick.Base/FLY.Thick.Base/Server/TempFilter.cs
View file @
9671ddff
...
...
@@ -239,8 +239,10 @@ namespace FLY.Thick.Base.Server
public
class
TempFilter2
{
List
<
TempFilterData
>
Datas
=
new
List
<
TempFilterData
>();
const
int
KeepTimeMin
=
6
;
const
int
KeepCount
=
9
;
TimeSpan
keepTime
=
TimeSpan
.
FromMinutes
(
KeepTimeMin
);
TimeSpan
keepTime
=
TimeSpan
.
FromMinutes
(
6
);
/// <summary>
///
/// </summary>
...
...
@@ -261,35 +263,41 @@ namespace FLY.Thick.Base.Server
{
filterTime
=
TimeSpan
.
Zero
;
}
keepTime
=
TimeSpan
.
FromMinutes
(
Math
.
Max
(
6
,
filterTime
.
TotalMinutes
*
3
));
var
now
=
DateTime
.
Now
;
Datas
.
RemoveAll
(
d
=>
d
.
Time
<
now
-
keepTime
);
keepTime
=
TimeSpan
.
FromMinutes
(
Math
.
Max
(
KeepTimeMin
,
filterTime
.
TotalMinutes
*
3
));
KeepSize
();
Datas
.
Add
(
new
TempFilterData
()
{
Ad
=
ad
,
FilterAd
=
ad
,
Time
=
now
});
double
sum
=
0
;
int
cnt
=
0
;
for
(
int
i
=
0
;
i
<
Datas
.
Count
();
i
++)
{
var
d
=
Datas
[
Datas
.
Count
()-
1
-
i
];
if
(
d
.
Time
>=
(
now
-
filterTime
)
&&
d
.
IsReset
==
false
)
double
sum
=
ad
;
int
cnt
=
1
;
for
(
int
i
=
1
;
i
<
Datas
.
Count
();
i
++)
{
sum
+=
d
.
Ad
;
cnt
++
;
}
else
{
int
index
=
Datas
.
Count
()
-
1
-
i
;
var
d
=
Datas
[
index
]
;
if
(
d
.
IsReset
)
{
//这个是reset 信号,退出
break
;
}
}
if
(
cnt
>
0
)
if
(
d
.
Time
<
(
now
-
filterTime
))
{
Datas
.
Last
().
FilterAd
=
(
int
)
Math
.
Round
(
sum
/
cnt
);
//太久了,退出
break
;
}
return
Datas
.
Last
().
FilterAd
;
sum
+=
d
.
Ad
;
cnt
++;
}
ad
=
(
int
)
Math
.
Round
(
sum
/
cnt
);
Datas
.
Last
().
FilterAd
=
ad
;
return
ad
;
}
/// <summary>
...
...
@@ -297,14 +305,49 @@ namespace FLY.Thick.Base.Server
/// </summary>
public
void
Reset
()
{
var
now
=
DateTime
.
Now
;
Datas
.
RemoveAll
(
d
=>
d
.
Time
<
now
-
keepTime
);
KeepSize
();
if
(
Datas
.
Count
>
0
&&
!
Datas
.
Last
().
IsReset
)
{
//上一次是复位信号,就不需要再添加一个复位信号了
Datas
.
Add
(
new
TempFilterData
()
{
IsReset
=
true
,
Time
=
DateTime
.
Now
});
}
}
void
KeepSize
()
{
var
now
=
DateTime
.
Now
;
int
index
=
Datas
.
FindIndex
(
d
=>
d
.
Time
>=
now
-
keepTime
);
if
(
index
<=
0
)
return
;
//小于index, 都是要删除的
//但必须保证删除后 Datas.Length >=10
int
len
=
Datas
.
Count
()
-
index
;
if
(
len
<
KeepCount
)
index
=
Datas
.
Count
()
-
KeepCount
;
if
(
index
<=
0
)
return
;
Datas
.
RemoveRange
(
0
,
index
);
}
public
List
<
TempFilterData
>
GetDatas
()
{
return
Datas
;
}
public
int
GetLastAd
(
DateTime
time
)
{
for
(
int
i
=
1
;
i
<
Datas
.
Count
;
i
++)
{
int
index
=
Datas
.
Count
()
-
1
-
i
;
var
d
=
Datas
[
index
];
if
(
d
.
Time
<
time
)
return
-
1
;
//时间太早了,没有数据
if
(
Datas
[
index
].
IsReset
)
continue
;
return
d
.
Ad
;
}
return
-
1
;
//没有数据
}
}
}
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