Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hemei
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
潘栩锋
hemei
Commits
52a2953f
Commit
52a2953f
authored
May 03, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 BlowingDetect 的线速度均值,写错减法方向,导致永远都是从列表的头开始算速度均值
parent
e783d927
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
26 deletions
+23
-26
BlowingDetect.cs
...Y.Thick.Blowing/FLY.Thick.Blowing/Server/BlowingDetect.cs
+23
-26
No files found.
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/BlowingDetect.cs
View file @
52a2953f
...
...
@@ -952,42 +952,39 @@ namespace FLY.Thick.Blowing.Server
{
if
(
mRollList
.
Count
>
1
)
{
DateTime
sysTime1
=
mRollList
[
mRollList
.
Count
-
1
].
SysTime
;
//最后一次的sysTime
int
cnt
=
5
;
//5次均值
if
(
cnt
>
mRollList
.
Count
)
cnt
=
mRollList
.
Count
;
//最少2秒
int
i_end
=
mRollList
.
Count
()
-
1
;
DateTime
sysTime2
=
mRollList
[
mRollList
.
Count
-
cnt
].
SysTime
;
//5次前的sysTime
if
(
sysTime2
-
sysTime1
<
TimeSpan
.
FromSeconds
(
2
))
DateTime
time1
=
mRollList
[
i_end
].
Time
;
//最后一次的time
int
i_begin
=
i_end
-
1
;
//最少2秒
while
(
time1
-
mRollList
[
i_begin
].
Time
<
TimeSpan
.
FromSeconds
(
2
))
{
cnt
++;
for
(;
cnt
<=
mRollList
.
Count
;
cnt
++)
{
sysTime2
=
mRollList
[
mRollList
.
Count
-
cnt
].
SysTime
;
if
(
sysTime2
-
sysTime1
>=
TimeSpan
.
FromSeconds
(
2
))
{
break
;
}
i_begin
--;
if
(
i_begin
<
0
)
{
///超范围了
break
;
}
if
(
cnt
>
mRollList
.
Count
)
cnt
=
mRollList
.
Count
;
sysTime2
=
mRollList
[
mRollList
.
Count
-
cnt
].
SysTime
;
}
if
(
i_begin
<
0
)
i_begin
=
0
;
//超范围了限制它
var
sysTime1
=
mRollList
[
i_begin
].
SysTime
;
var
sysTime2
=
mRollList
[
i_end
].
SysTime
;
TimeSpan
ts_last
=
TimeSpan
.
FromTicks
((
sysTime1
-
sysTime2
).
Ticks
/
(
cnt
-
1
));
//5次的平均滤波, 使用AD盒的时间算出来的时间差,最准
TimeSpan
ts_last
=
TimeSpan
.
FromTicks
((
sysTime2
-
sysTime1
).
Ticks
/
(
i_end
-
i_begin
));
//5次的平均滤波, 使用AD盒的时间算出来的时间差,最准
DateTime
dt11
=
mRollList
[
mRollList
.
Count
-
(
cnt
-
1
)].
Time
;
//4次前的PC时间
//因为没有使用AD盒的时间,所以可以用DateTime.Now 比较
TimeSpan
ts_now
=
TimeSpan
.
FromTicks
((
DateTime
.
Now
-
dt11
).
Ticks
/
(
cnt
-
1
))
;
//使用 电脑的时间,算出来的时间差,大概而已
TimeSpan
ts_max
;
TimeSpan
ts_now
=
DateTime
.
Now
-
time1
;
//使用 电脑的时间,算出来的时间差,大概而已
TimeSpan
ts_max
=
ts_last
;
if
(
ts_now
>
(
ts_last
+
ts_last
))
//超过了2倍的时间,肯定是慢下来了
{
ts_max
=
ts_now
;
}
else
{
ts_max
=
ts_last
;
}
FilmVelocity
=
MofR
/
ts_max
.
TotalMinutes
;
...
...
@@ -1980,7 +1977,7 @@ namespace FLY.Thick.Blowing.Server
/// </summary>
public
void
Dispose
()
{
Clear
();
Clear
Buf
();
}
#
region
INotifyPropertyChanged
成员
...
...
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