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
d242251b
Commit
d242251b
authored
Mar 15, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除 TimeGridAdvHelper 的 ad_ts_ms, 现在缓存区的都是1ms为单位的AD,输出全部数据都是1ms为单位
parent
934ec8fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
48 deletions
+39
-48
FlyAD7.cs
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
+27
-1
FlyADClientAdv.cs
Project.FLY.FlyADBase/FlyADBase/FlyADClientAdv.cs
+1
-0
TimeGridAdvHelper.cs
Project.FLY.FlyADBase/FlyADBase/TimeGridAdvHelper.cs
+11
-47
No files found.
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
View file @
d242251b
...
...
@@ -2,6 +2,7 @@
using
FObjBase
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.ComponentModel
;
using
System.Diagnostics
;
...
...
@@ -1022,9 +1023,34 @@ namespace FlyADBase
Now
=
dt
;
}
data
=
pack
.
data
;
//放入的数据应该是1ms一个,不对就扩展
TimeSpan
curr_ad_ts
=
TimeSpan
.
FromTicks
((
long
)(
1.28
*
TimeSpan
.
TicksPerMillisecond
));
List
<
int
>
data_1ms
=
new
List
<
int
>();
DateTime
idealTime
=
dt
;
DateTime
actTime
=
dt
;
for
(
int
j
=
0
;
j
<
data
.
Count
();
j
++)
{
int
idx2
=
data
.
Count
()
-
1
-
j
;
int
ad
=
data
[
idx2
];
actTime
-=
curr_ad_ts
;
while
(
idealTime
>
actTime
)
{
data_1ms
.
Add
(
ad
);
//导出数据
idealTime
-=
TimeSpan
.
FromMilliseconds
(
1
);
//导出数据时间累加
}
}
data_1ms
.
Reverse
();
data
=
data_1ms
.
ToArray
();
advPushTimeGrid
(
dt
,
data
);
TimeSpan
ts
=
TimeSpan
.
From
Ticks
((
long
)(
1.28
*
TimeSpan
.
TicksPerMillisecond
)
);
TimeSpan
ts
=
TimeSpan
.
From
Milliseconds
(
1
);
if
(
lastTimeGridTime
!=
DateTime
.
MinValue
)
ts
=
TimeSpan
.
FromTicks
((
dt
-
lastTimeGridTime
).
Ticks
/
data
.
Length
);
lastTimeGridTime
=
dt
;
...
...
Project.FLY.FlyADBase/FlyADBase/FlyADClientAdv.cs
View file @
d242251b
...
...
@@ -367,6 +367,7 @@ namespace FlyADBase
{
#
region
高级
timegrid
//TODO
mTimeGridAdvHelper
.
AddAD
(
end_dt
-
TimeSpan
.
FromMilliseconds
(
ADLag
),
datas
);
if
(
IsTimeToPushTimeGridAdv
)
{
...
...
Project.FLY.FlyADBase/FlyADBase/TimeGridAdvHelper.cs
View file @
d242251b
...
...
@@ -37,10 +37,10 @@ namespace FlyADBase
{
NLog
.
Logger
logger
=
NLog
.
LogManager
.
GetCurrentClassLogger
();
#
region
一分钟数据缓存池
,
目标每个
AD
数据(
1
.28
ms
)
都有对应的其它数据
#
region
一分钟数据缓存池
,
目标每个
AD
数据(
1
ms
)
都有对应的其它数据
/// <summary>
/// AD数据池时间间隔为
TimeGridAdvHelperExt.ad_ts_
ms, 肯定最少有一个数据
/// 每个数据包(200个数据)理论间隔是200
*ad_ts_
ms, 但实际上不是。
/// AD数据池时间间隔为
1
ms, 肯定最少有一个数据
/// 每个数据包(200个数据)理论间隔是200ms, 但实际上不是。
/// 数据输出时,输出的每个数据必须是1ms, 需要通过数据包的systick线性填充数据
/// </summary>
public
List
<
DateTimeUnit3
>
ADPool
=
new
List
<
DateTimeUnit3
>();
...
...
@@ -79,7 +79,7 @@ namespace FlyADBase
/// <summary>
/// 添加ad数据,且判断数据量是否够触发事件, 时间间隔为
TimeGridAdvHelperExt.ad_ts_
ms
/// 添加ad数据,且判断数据量是否够触发事件, 时间间隔为
1
ms
/// </summary>
/// <param name="end_dt"></param>
/// <param name="adArray"></param>
...
...
@@ -564,19 +564,10 @@ namespace FlyADBase
public
static
class
TimeGridAdvHelperExt
{
/// <summary>
/// 缓存区每个ad数据的时间间隔 AD盒1.2.3版本都是 1.28ms, AD盒2021 为1ms
/// </summary>
public
static
double
ad_ts_ms
=
1.28
;
/// <summary>
/// ad_ts_ms 的 TimeSpan
/// </summary>
public
static
TimeSpan
ad_ts
=>
TimeSpan
.
FromTicks
((
long
)(
ad_ts_ms
*
TimeSpan
.
TicksPerMillisecond
));
/// <summary>
/// 导出的数据间隔是1ms 一个, 导出的数据量肯定比要求给的更多
/// </summary>
/// <param name="adPool">AD缓存区(每个数据间隔
ad_ts_
ms)</param>
/// <param name="adPool">AD缓存区(每个数据间隔
1
ms)</param>
/// <param name="begin">开始时间点</param>
/// <param name="end">结束时间点</param>
/// <param name="reponse_endTime">实际导出的数据结束时间点</param>
...
...
@@ -596,9 +587,9 @@ namespace FlyADBase
}
/// <summary>
/// 导出的数据间隔是1ms 一个
,原始数据间隔是ad_ts_ms(可能是1ms,或者1.28ms)
/// 导出的数据间隔是1ms 一个
/// </summary>
/// <param name="adPool">AD缓存区(每个数据间隔
ad_ts_
ms)</param>
/// <param name="adPool">AD缓存区(每个数据间隔
1
ms)</param>
/// <returns></returns>
public
static
List
<
int
>
GetAD
(
List
<
DateTimeUnit3
>
adPool
)
{
...
...
@@ -606,7 +597,7 @@ namespace FlyADBase
}
/// <summary>
/// 导出的数据间隔是1ms 一个
,原始数据间隔是ad_ts_ms(可能是1ms,或者1.28ms)
/// 导出的数据间隔是1ms 一个
/// </summary>
/// <param name="adPool">AD缓存区</param>
/// <param name="begin">开始时间点</param>
...
...
@@ -619,48 +610,21 @@ namespace FlyADBase
DateTime
idealTime
=
adPool
.
Last
().
dt
;
//每个ad包的每个数据不是准确的1
.28
ms,肯定比1.28ms大,每次需要准
//每个ad包的每个数据不是准确的1ms,肯定比1.28ms大,每次需要准
for
(
int
i
=
0
;
i
<
adPool
.
Count
();
i
++)
{
int
idx
=
adPool
.
Count
()
-
1
-
i
;
//当前缓存区包,每个数据的时间间隔
TimeSpan
curr_ad_ts
;
//
TimeSpan curr_ad_ts;
//计算这个包每个数据的时间间隔
DateTime
end_dt
=
adPool
[
idx
].
dt
;
if
(
idx
>
0
)
{
//上一个数据包的结束时间,就是这个数据包的开始时间
var
begin_dt
=
adPool
[
idx
-
1
].
dt
;
//数据包总时间
double
total_ms
=
(
end_dt
-
begin_dt
).
Ticks
/
TimeSpan
.
TicksPerMillisecond
;
//当前缓存区包,实际每个数据的时间间隔
var
curr_ad_ts_ms
=
total_ms
/
adPool
[
idx
].
datas
.
Count
();
curr_ad_ts
=
TimeSpan
.
FromTicks
((
long
)(
curr_ad_ts_ms
*
TimeSpan
.
TicksPerMillisecond
));
}
else
if
(
adPool
.
Count
()
>
1
)
{
//缓存区的第0号序号包, 只能通过下一个数据包 推测时间
var
begin_dt
=
adPool
[
idx
].
dt
-
(
adPool
[
idx
+
1
].
dt
-
adPool
[
idx
].
dt
);
double
total_ms
=
(
end_dt
-
begin_dt
).
Ticks
/
TimeSpan
.
TicksPerMillisecond
;
var
curr_ad_ts_ms
=
total_ms
/
adPool
[
idx
].
datas
.
Count
();
curr_ad_ts
=
TimeSpan
.
FromTicks
((
long
)(
curr_ad_ts_ms
*
TimeSpan
.
TicksPerMillisecond
));
}
else
{
//整个缓存就一个数据包,使用默认的时间间隔
curr_ad_ts
=
ad_ts
;
}
DateTime
actTime
=
adPool
[
idx
].
dt
;
//从缓存区获取数据的时间
for
(
int
j
=
0
;
j
<
adPool
[
idx
].
datas
.
Count
();
j
++)
{
int
idx2
=
adPool
[
idx
].
datas
.
Count
()
-
1
-
j
;
int
ad
=
adPool
[
idx
].
datas
[
idx2
];
actTime
-=
curr_ad_ts
;
actTime
-=
TimeSpan
.
FromMilliseconds
(
1
);
//导出数据时间累加
while
(
idealTime
>
actTime
)
{
...
...
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