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
8593d013
Commit
8593d013
authored
Jun 01, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修复 AD盒 脉冲速度异常巨大。
2. 优化 AD盒 数据缓存池扩展到2分钟
parent
3c4e414f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
23 deletions
+33
-23
FlyAd2021B2Adv.cs
Project.FLY.FlyADBase/FlyAd2021.B2/FlyAd2021B2Adv.cs
+28
-18
TimeGridAdvHelper.cs
Project.FLY.FlyADBase/FlyAd2021.B2/TimeGridAdvHelper.cs
+5
-5
No files found.
Project.FLY.FlyADBase/FlyAd2021.B2/FlyAd2021B2Adv.cs
View file @
8593d013
...
@@ -91,20 +91,6 @@ namespace FlyADBase
...
@@ -91,20 +91,6 @@ namespace FlyADBase
this
.
PropertyChanged
+=
FlyAD7_PropertyChanged1
;
this
.
PropertyChanged
+=
FlyAD7_PropertyChanged1
;
//更新线速度
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
()
=>
{
if
(
calSpeed
.
Cal
(
Now
,
out
int
speed1
,
out
int
speed2
))
{
Speed
=
speed1
;
Speed2
=
speed2
;
}
},
TimeSpan
.
FromSeconds
(
1
));
//轮询事件触发
//轮询事件触发
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
OnPoll
);
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
OnPoll
);
}
}
...
@@ -361,7 +347,8 @@ namespace FlyADBase
...
@@ -361,7 +347,8 @@ namespace FlyADBase
//数据滞后
//数据滞后
if
(!
TimeGridAdvHelperExt
.
AdLagCorr
(
dataList
,
ref
endTime
,
ADLag
,
AD2Lag
))
if
(!
TimeGridAdvHelperExt
.
AdLagCorr
(
dataList
,
ref
endTime
,
ADLag
,
AD2Lag
))
{
{
throw
new
Exception
(
"数据量太少,无法滞后修正"
);
//throw new Exception("数据量太少,无法滞后修正");
return
;
}
}
//获取grid图
//获取grid图
...
@@ -461,22 +448,42 @@ namespace FlyADBase
...
@@ -461,22 +448,42 @@ namespace FlyADBase
if
(
now
-
last_now
<
TimeSpan
.
FromSeconds
(
0.5
))
if
(
now
-
last_now
<
TimeSpan
.
FromSeconds
(
0.5
))
return
false
;
return
false
;
bool
isInvalid
=
false
;
if
(
pos1_changed_time
!=
last_pos1_changed_time
&&
last_pos1_changed_time
!=
DateTime
.
MinValue
)
if
(
pos1_changed_time
!=
last_pos1_changed_time
&&
last_pos1_changed_time
!=
DateTime
.
MinValue
)
{
{
speed1
=
(
int
)((
pos1
-
last_pos1
)
/
(
pos1_changed_time
-
last_pos1_changed_time
).
TotalSeconds
);
var
spd
=
(
int
)((
pos1
-
last_pos1
)
/
(
pos1_changed_time
-
last_pos1_changed_time
).
TotalSeconds
);
if
(
Math
.
Abs
(
spd
)
>
100000
)
{
//肯定是溢出了,
isInvalid
=
true
;
}
else
{
speed1
=
spd
;
}
}
}
else
else
{
{
//停了
//停了
speed1
=
0
;
}
}
if
(
pos2_changed_time
!=
last_pos2_changed_time
&&
last_pos2_changed_time
!=
DateTime
.
MinValue
)
if
(
pos2_changed_time
!=
last_pos2_changed_time
&&
last_pos2_changed_time
!=
DateTime
.
MinValue
)
{
{
speed2
=
(
int
)((
pos2
-
last_pos2
)
/
(
pos2_changed_time
-
last_pos2_changed_time
).
TotalSeconds
);
var
spd
=
(
int
)((
pos2
-
last_pos2
)
/
(
pos2_changed_time
-
last_pos2_changed_time
).
TotalSeconds
);
if
(
Math
.
Abs
(
spd
)
>
100000
)
{
//肯定是溢出了,
isInvalid
=
true
;
}
else
{
speed2
=
spd
;
}
}
}
else
else
{
{
//停了
//停了
speed2
=
0
;
}
}
last_now
=
now
;
last_now
=
now
;
...
@@ -485,7 +492,10 @@ namespace FlyADBase
...
@@ -485,7 +492,10 @@ namespace FlyADBase
last_pos1
=
pos1
;
last_pos1
=
pos1
;
last_pos2
=
pos2
;
last_pos2
=
pos2
;
return
true
;
if
(
isInvalid
)
return
false
;
else
return
true
;
}
}
...
...
Project.FLY.FlyADBase/FlyAd2021.B2/TimeGridAdvHelper.cs
View file @
8593d013
...
@@ -40,7 +40,7 @@ namespace FlyADBase
...
@@ -40,7 +40,7 @@ namespace FlyADBase
NLog
.
Logger
logger
=
NLog
.
LogManager
.
GetCurrentClassLogger
();
NLog
.
Logger
logger
=
NLog
.
LogManager
.
GetCurrentClassLogger
();
#
region
一分钟数据缓存池
,
目标每个
AD
数据(
1
ms
)
都有对应的其它数据
#
region
一分钟数据缓存池
,
目标每个
AD
数据(
1
ms
)
都有对应的其它数据
public
const
int
POOL_SIZE_SECOND
=
120
;
/// <summary>
/// <summary>
/// AD数据池时间间隔为1ms,数据是肯定是连续的。Add数据时,非连续,填充数据直到连续
/// AD数据池时间间隔为1ms,数据是肯定是连续的。Add数据时,非连续,填充数据直到连续
/// </summary>
/// </summary>
...
@@ -276,19 +276,19 @@ namespace FlyADBase
...
@@ -276,19 +276,19 @@ namespace FlyADBase
return
;
return
;
if
(
DataPool
.
Count
()
<
(
60
*
1.2
)
*
1000
)
if
(
DataPool
.
Count
()
<
(
POOL_SIZE_SECOND
+
30
)
*
1000
)
{
{
//比限定的多了
0.2min
才会动作
//比限定的多了
30秒
才会动作
return
;
return
;
}
}
//只保持1分钟数据
//只保持1分钟数据
int
remove_cnt
=
DataPool
.
Count
()
-
60
*
1000
;
int
remove_cnt
=
DataPool
.
Count
()
-
POOL_SIZE_SECOND
*
1000
;
DataPool
.
RemoveRange
(
0
,
remove_cnt
);
DataPool
.
RemoveRange
(
0
,
remove_cnt
);
//限制的时间
//限制的时间
var
limitTime_other
=
NewestTime
-
TimeSpan
.
From
Minutes
(
1.5
);
var
limitTime_other
=
NewestTime
-
TimeSpan
.
From
Seconds
(
POOL_SIZE_SECOND
+
30
);
LimitSimplePool
(
DriveStatusPool
,
limitTime_other
);
LimitSimplePool
(
DriveStatusPool
,
limitTime_other
);
}
}
...
...
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