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
7fad816d
Commit
7fad816d
authored
Dec 01, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 AD盒2021.B2 导出grid数据带有每个grid的时间
parent
b29fe1ad
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
733 additions
and
81 deletions
+733
-81
MiniGridEventArgs.cs
...FLY.FlyADBase/FlyAd2021.B2/EventArgs/MiniGridEventArgs.cs
+1
-0
FlyAd2021B2Adv.cs
Project.FLY.FlyADBase/FlyAd2021.B2/FlyAd2021B2Adv.cs
+669
-71
IFlyADClientAdv.cs
Project.FLY.FlyADBase/FlyAd2021.B2/Inc/IFlyADClientAdv.cs
+27
-0
TimeGridAdvHelper.cs
Project.FLY.FlyADBase/FlyAd2021.B2/TimeGridAdvHelper.cs
+36
-10
No files found.
Project.FLY.FlyADBase/FlyAd2021.B2/EventArgs/MiniGridEventArgs.cs
View file @
7fad816d
...
...
@@ -13,6 +13,7 @@ namespace FlyADBase
public
int
grid_start
;
public
int
[]
buf
;
public
int
[]
buf2
;
public
DateTime
[]
times
;
}
public
delegate
void
MiniGridEventHandler
(
object
sender
,
MiniGridEventArgs
e
);
}
Project.FLY.FlyADBase/FlyAd2021.B2/FlyAd2021B2Adv.cs
View file @
7fad816d
This diff is collapsed.
Click to expand it.
Project.FLY.FlyADBase/FlyAd2021.B2/Inc/IFlyADClientAdv.cs
View file @
7fad816d
...
...
@@ -98,12 +98,39 @@ namespace FlyADBase
/// </summary>
bool
IsTimeToPushTimeGridAdv
{
get
;
}
/// <summary>
/// 停下来了,且数据已经可以获取了
/// </summary>
/// <returns></returns>
bool
IsTimeToGetGridAfterStop
();
/// <summary>
/// 正向 Grid数组 更新时间
/// </summary>
DateTime
GridFrameUpdateTime_Forw
{
get
;
}
/// <summary>
/// 反向 Grid数组 更新时间
/// </summary>
DateTime
GridFrameUpdateTime_Backw
{
get
;
}
/// <summary>
/// 以timegrid 为单位,推送数据
/// </summary>
event
TimeGridAdv2EventHandler
TimeGridAdv2Event
;
TimeGridAdv2EventArgs
GetTimeGridAdv2Event
(
DateTime
beginTime
);
TimeGridAdv2EventArgs
GetTimeGridAdv2Event
(
int
dataCnt
);
/// <summary>
/// 从正反缓存区, 获取grid数据
/// </summary>
/// <param name="direction">方向, 只有 正,反</param>
/// <param name="grid_start">grid 开始位置</param>
/// <param name="grid_len">grid 长度</param>
/// <param name="dat">grid 数据</param>
void
GetGrid
(
Misc
.
DIRECTION
direction
,
out
int
[]
buf0
,
out
int
[]
buf1
,
out
DateTime
[]
times
);
void
Save
();
bool
Load
();
...
...
Project.FLY.FlyADBase/FlyAd2021.B2/TimeGridAdvHelper.cs
View file @
7fad816d
...
...
@@ -74,6 +74,18 @@ namespace FlyADBase
{
Clear
();
}
public
int
Time2Index
(
DateTime
time
)
{
if
(
time
==
DateTime
.
MinValue
)
return
-
1
;
return
TimeGridAdvHelperExt
.
Time2Index
(
DataPool
.
Count
(),
NewestTime
,
time
);
}
public
DateTime
Index2Time
(
int
index
)
{
return
TimeGridAdvHelperExt
.
Index2Time
(
DataPool
.
Count
(),
NewestTime
,
index
);
}
public
class
AddDataResponse
{
public
bool
isChanged
=>
isPosChanged
||
isPos2Changed
||
isIstatusChanged
;
...
...
@@ -103,10 +115,9 @@ namespace FlyADBase
if
(
DataPool
.
Count
()==
0
)
{
//第1次添加
DataPool
.
Add
(
new
DateTimeUnit5
()
{
ad
=
ad
,
ad2
=
ad2
,
pos
=
postion
,
pos2
=
postion2
,
istatus
=
istatus
});
NewestTime
=
dt
;
DataPool
.
Add
(
new
DateTimeUnit5
()
{
ad
=
ad
,
ad2
=
ad2
,
pos
=
postion
,
pos2
=
postion2
,
istatus
=
istatus
});
//记录脉冲改变点
positionChangedTime
=
NewestTime
;
position2ChangedTime
=
NewestTime
;
...
...
@@ -116,11 +127,11 @@ namespace FlyADBase
if
(
dt
<
NewestTime
&&
NewestTime
-
dt
>
TimeSpan
.
FromMilliseconds
(
2
))
//时间异常,居然早2秒了,数据全部删除
{
//TODO, 不能没有状态
Clear
();
NewestTime
=
dt
;
DataPool
.
Add
(
new
DateTimeUnit5
()
{
ad
=
ad
,
ad2
=
ad2
,
pos
=
postion
,
pos2
=
postion2
,
istatus
=
istatus
});
NewestTime
=
dt
;
//记录脉冲改变点
positionChangedTime
=
NewestTime
;
...
...
@@ -131,11 +142,11 @@ namespace FlyADBase
if
(
dt
>
NewestTime
&&
(
dt
-
NewestTime
>
TimeSpan
.
FromSeconds
(
0.5
)))
//超过0.5s没放数据,异常
{
//TODO, 不能没有状态
Clear
();
NewestTime
=
dt
;
DataPool
.
Add
(
new
DateTimeUnit5
()
{
ad
=
ad
,
ad2
=
ad2
,
pos
=
postion
,
pos2
=
postion2
,
istatus
=
istatus
});
NewestTime
=
dt
;
//记录脉冲改变点
positionChangedTime
=
NewestTime
;
...
...
@@ -150,7 +161,6 @@ namespace FlyADBase
DataPool
.
RemoveAt
(
DataPool
.
Count
()
-
1
);
DataPool
.
Add
(
new
DateTimeUnit5
()
{
ad
=
ad
,
ad2
=
ad2
,
pos
=
postion
,
pos2
=
postion2
,
istatus
=
istatus
});
NewestTime
=
dt
;
}
else
...
...
@@ -169,6 +179,7 @@ namespace FlyADBase
//填充完了,放入新的数据
DataPool
.
Add
(
new
DateTimeUnit5
()
{
ad
=
ad
,
ad2
=
ad2
,
pos
=
postion
,
pos2
=
postion2
,
istatus
=
istatus
});
NewestTime
=
last_dt
;
break
;
}
}
...
...
@@ -535,6 +546,17 @@ namespace FlyADBase
public
static
class
TimeGridAdvHelperExt
{
public
static
int
Time2Index
(
int
dataCount
,
DateTime
newestTime
,
DateTime
time
)
{
//TODO .TotalMilliseconds 是double,有机会出现0.99999问题
int
index
=
dataCount
-
1
-
(
int
)(
newestTime
-
time
).
TotalMilliseconds
;
return
index
;
}
public
static
DateTime
Index2Time
(
int
dataCount
,
DateTime
newestTime
,
int
index
)
{
return
newestTime
-
TimeSpan
.
FromMilliseconds
(
dataCount
-
1
-
index
);
}
/// <summary>
/// 导出的数据间隔是1ms 一个
/// </summary>
...
...
@@ -543,8 +565,10 @@ namespace FlyADBase
/// <returns></returns>
public
static
List
<
DateTimeUnit5
>
GetData
(
List
<
DateTimeUnit5
>
dataPool
,
DateTime
newestTime
,
DateTime
begin
)
{
int
begin_idx
=
dataPool
.
Count
()
-
(
int
)((
newestTime
-
begin
).
TotalMilliseconds
);
//时间转为序号
int
begin_idx
=
Time2Index
(
dataPool
.
Count
(),
newestTime
,
begin
)
+
1
;
//限制序号位置
if
(
begin_idx
<
0
)
begin_idx
=
0
;
if
(
begin_idx
>
dataPool
.
Count
()
-
1
)
...
...
@@ -566,8 +590,10 @@ namespace FlyADBase
/// <returns></returns>
public
static
List
<
DateTimeUnit5
>
GetData
(
List
<
DateTimeUnit5
>
dataPool
,
DateTime
newestTime
,
DateTime
begin
,
DateTime
end
,
out
DateTime
response_endTime
)
{
int
begin_idx
=
dataPool
.
Count
()
-
(
int
)((
newestTime
-
begin
).
TotalMilliseconds
);
//时间转为序号
int
begin_idx
=
Time2Index
(
dataPool
.
Count
(),
newestTime
,
begin
)
+
1
;
//限制序号位置
if
(
begin_idx
<
0
)
begin_idx
=
0
;
if
(
begin_idx
>
dataPool
.
Count
()
-
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