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
ce2de262
Commit
ce2de262
authored
Aug 21, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修复 线速度长时间后 1秒变得很小,1秒又变为正常很大,怀疑线速度智能添加信号 那段出错,直接简化,只用上升沿信号。
parent
8e5b98a8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
73 deletions
+104
-73
BlowingDetect.cs
...Y.Thick.Blowing/FLY.Thick.Blowing/Server/BlowingDetect.cs
+104
-73
No files found.
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/BlowingDetect.cs
View file @
ce2de262
...
@@ -257,7 +257,7 @@ namespace FLY.Thick.Blowing.Server
...
@@ -257,7 +257,7 @@ namespace FLY.Thick.Blowing.Server
Angle
=
0
;
//°
Angle
=
0
;
//°
Direction
=
Misc
.
DIRECTION
.
FORWARD
;
Direction
=
Misc
.
DIRECTION
.
FORWARD
;
FilmVelocity
=
0
;
//m/min
mRollList
=
new
Misc
.
RList
<
RollCell
>(
4000
);
//以50m/min 线速度,储存大于 30min数据
mRollList
=
new
Misc
.
RList
<
RollCell
>(
4000
);
//以50m/min 线速度,储存大于 30min数据
mLimitList
=
new
Misc
.
RList
<
LimitCell
>(
20
);
//人字架转10次的信号
mLimitList
=
new
Misc
.
RList
<
LimitCell
>(
20
);
//人字架转10次的信号
...
@@ -1018,6 +1018,97 @@ namespace FLY.Thick.Blowing.Server
...
@@ -1018,6 +1018,97 @@ namespace FLY.Thick.Blowing.Server
RotationCnt
++;
RotationCnt
++;
}
}
}
}
//void update_roll(FlyADBase.IStatusChangedEventArgs e)
//{
// //----------------------------------------------------------------------
// //更新辊信号
// if (!Misc.MyBase.CHECKBIT(e.IChanged, Roll_bit - 1))
// return;//没有信号更新
// //信号的状态
// bool status = !Misc.MyBase.CHECKBIT(e.IStatus, Roll_bit - 1);
// DateTime dt = e.Time;//信号更新发生的时间
// DateTime dtmid;
// if (mbcRoll.Update(dt, status, out dtmid))
// if (status)//1->0 触发!!!
// {
// mRollList.RAdd(
// new RollCell()
// {
// dt = dtmid
// });
// //更新当前线速度
// if (mRollList.Count > 1)
// {
// DateTime dt1 = mRollList[mRollList.Count - 1].dt;
// DateTime dt2 = mRollList[mRollList.Count - 2].dt;
// TimeSpan ts = dt1 - dt2;
// FilmVelocity = RollPerimeter / 1000.0 / ts.TotalMinutes;
// if (mRollList.Count > 100)
// {
// DateTime dtn = mRollList[mRollList.Count - 101].dt;
// TimeSpan tsn = dt1 - dtn;
// double avg_filmvelocity = RollPerimeter / 10.0 / tsn.TotalMinutes;
// DateTime dt3 = mRollList[mRollList.Count - 3].dt;
// TimeSpan ts3 = dt2 - dt3;
// double last_filmvelocity = RollPerimeter / 1000.0 / ts3.TotalMinutes;
// //异常检测
// if (FilmVelocity > 10)
// {
// if (Math.Abs(avg_filmvelocity - FilmVelocity) / FilmVelocity > 0.1)
// {
// //异常
// //可能少了信号!!!
// if (Math.Abs(last_filmvelocity - FilmVelocity * 2) < 0.3)
// {
// TimeSpan ts12 = TimeSpan.FromTicks((dt1 - dt2).Ticks / 2);
// //肯定少了一个
// mRollList.Insert(
// mRollList.Count - 1,
// new RollCell()
// {
// dt = dt2 + ts12
// });
// }
// else if (Math.Abs(last_filmvelocity - FilmVelocity * 3) < 0.3)
// {
// TimeSpan ts12 = TimeSpan.FromTicks((dt1 - dt2).Ticks / 3);
// //肯定少了两个
// mRollList.Insert(
// mRollList.Count - 1,
// new RollCell()
// {
// dt = dt2 + ts12
// });
// mRollList.Insert(
// mRollList.Count - 1,
// new RollCell()
// {
// dt = dt2 + ts12 + ts12
// });
// }
// else
// {
// }
// }
// }
// }
// }
// //触发修正事件!!!!!
// TouchFilmInfoChanged();
// }
//}
void
update_roll
(
FlyADBase
.
IStatusChangedEventArgs
e
)
void
update_roll
(
FlyADBase
.
IStatusChangedEventArgs
e
)
{
{
//----------------------------------------------------------------------
//----------------------------------------------------------------------
...
@@ -1030,79 +1121,15 @@ namespace FLY.Thick.Blowing.Server
...
@@ -1030,79 +1121,15 @@ namespace FLY.Thick.Blowing.Server
DateTime
dt
=
e
.
Time
;
//信号更新发生的时间
DateTime
dt
=
e
.
Time
;
//信号更新发生的时间
DateTime
dtmid
;
if
(
status
)
//1->0 触发!!!
if
(
mbcRoll
.
Update
(
dt
,
status
,
out
dtmid
))
{
{
mRollList
.
RAdd
(
mRollList
.
RAdd
(
new
RollCell
()
new
RollCell
()
{
{
dt
=
dt
mid
dt
=
dt
});
});
//更新当前线速度
if
(
mRollList
.
Count
>
1
)
{
DateTime
dt1
=
mRollList
[
mRollList
.
Count
-
1
].
dt
;
DateTime
dt2
=
mRollList
[
mRollList
.
Count
-
2
].
dt
;
TimeSpan
ts
=
dt1
-
dt2
;
FilmVelocity
=
RollPerimeter
/
1000.0
/
ts
.
TotalMinutes
;
if
(
mRollList
.
Count
>
100
)
{
DateTime
dtn
=
mRollList
[
mRollList
.
Count
-
101
].
dt
;
TimeSpan
tsn
=
dt1
-
dtn
;
double
avg_filmvelocity
=
RollPerimeter
/
10.0
/
tsn
.
TotalMinutes
;
DateTime
dt3
=
mRollList
[
mRollList
.
Count
-
3
].
dt
;
TimeSpan
ts3
=
dt2
-
dt3
;
double
last_filmvelocity
=
RollPerimeter
/
1000.0
/
ts3
.
TotalMinutes
;
//异常检测
if
(
FilmVelocity
>
10
)
{
if
(
Math
.
Abs
(
avg_filmvelocity
-
FilmVelocity
)
/
FilmVelocity
>
0.1
)
{
//异常
//可能少了信号!!!
if
(
Math
.
Abs
(
last_filmvelocity
-
FilmVelocity
*
2
)
<
0.3
)
{
TimeSpan
ts12
=
TimeSpan
.
FromTicks
((
dt1
-
dt2
).
Ticks
/
2
);
//肯定少了一个
mRollList
.
Insert
(
mRollList
.
Count
-
1
,
new
RollCell
()
{
dt
=
dt2
+
ts12
});
}
else
if
(
Math
.
Abs
(
last_filmvelocity
-
FilmVelocity
*
3
)
<
0.3
)
{
TimeSpan
ts12
=
TimeSpan
.
FromTicks
((
dt1
-
dt2
).
Ticks
/
3
);
//肯定少了两个
mRollList
.
Insert
(
mRollList
.
Count
-
1
,
new
RollCell
()
{
dt
=
dt2
+
ts12
});
mRollList
.
Insert
(
mRollList
.
Count
-
1
,
new
RollCell
()
{
dt
=
dt2
+
ts12
+
ts12
});
}
else
{
}
}
}
}
}
//触发修正事件!!!!!
//触发修正事件!!!!!
TouchFilmInfoChanged
();
TouchFilmInfoChanged
();
}
}
...
@@ -1159,13 +1186,17 @@ namespace FLY.Thick.Blowing.Server
...
@@ -1159,13 +1186,17 @@ namespace FLY.Thick.Blowing.Server
if
(
mRollList
.
Count
>
1
)
if
(
mRollList
.
Count
>
1
)
{
{
DateTime
dt1
=
mRollList
[
mRollList
.
Count
-
1
].
dt
;
DateTime
dt1
=
mRollList
[
mRollList
.
Count
-
1
].
dt
;
DateTime
dt2
=
mRollList
[
mRollList
.
Count
-
2
].
dt
;
int
cnt
=
5
;
TimeSpan
ts_last
=
dt1
-
dt2
;
if
(
cnt
>
mRollList
.
Count
)
cnt
=
mRollList
.
Count
;
DateTime
dt2
=
mRollList
[
mRollList
.
Count
-
cnt
].
dt
;
TimeSpan
ts_last
=
TimeSpan
.
FromTicks
((
dt1
-
dt2
).
Ticks
/
(
cnt
-
1
));
//5次的平均滤波
TimeSpan
ts_now
=
DateTime
.
Now
-
dt1
;
TimeSpan
ts_now
=
DateTime
.
Now
-
dt1
;
if
(
ts_now
>
(
ts_last
+
ts_last
))
TimeSpan
ts_max
=
(
ts_now
>
(
ts_last
+
ts_last
))
?
ts_now
:
ts_last
;
{
FilmVelocity
=
RollPerimeter
/
1000.0
/
ts_max
.
TotalMinutes
;
FilmVelocity
=
RollPerimeter
/
1000.0
/
ts_now
.
TotalMinutes
;
}
BufTotalTime
=
DateTime
.
Now
-
mRollList
[
0
].
dt
;
BufTotalTime
=
DateTime
.
Now
-
mRollList
[
0
].
dt
;
}
}
}
}
...
...
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