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
561c75a3
Commit
561c75a3
authored
Jun 03, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小修补
parent
e65227a2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
216 additions
and
130 deletions
+216
-130
CalFilmLen.cs
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/CalFilmLen.cs
+16
-9
PgBlowingExt.xaml
....Blowing/FLY.Thick.Blowing.UI/PgBlowing/PgBlowingExt.xaml
+6
-4
PgBlowingExtVm.cs
....Blowing/FLY.Thick.Blowing.UI/PgBlowing/PgBlowingExtVm.cs
+82
-46
PgBlowingExtVmUt.cs
...lowing/FLY.Thick.Blowing.UI/PgBlowing/PgBlowingExtVmUt.cs
+54
-40
IBlowingDetectService.cs
...owing/FLY.Thick.Blowing/IService/IBlowingDetectService.cs
+2
-11
BlowingDetect.cs
...Y.Thick.Blowing/FLY.Thick.Blowing/Server/BlowingDetect.cs
+56
-20
No files found.
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/CalFilmLen.cs
View file @
561c75a3
...
@@ -141,12 +141,12 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -141,12 +141,12 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
this
.
FilmLength
=
mRDetect
.
FilmLength
;
this
.
FilmLength
=
mRDetect
.
FilmLength
;
Misc
.
BindingOperations
.
SetBinding
(
mCurrRDetect
,
"BufTotalTime"
,
()
=>
Misc
.
BindingOperations
.
SetBinding
(
mCurrRDetect
,
nameof
(
mCurrRDetect
.
BufTotalTime
)
,
()
=>
{
{
DataMaxMinute
=
(
int
)(
mCurrRDetect
.
BufTotalTime
.
TotalMinutes
);
DataMaxMinute
=
(
int
)(
mCurrRDetect
.
BufTotalTime
.
TotalMinutes
);
});
});
Misc
.
BindingOperations
.
SetBinding
(
mCurrRDetect
,
"RotationCnt"
,
()
=>
Misc
.
BindingOperations
.
SetBinding
(
mCurrRDetect
,
nameof
(
mCurrRDetect
.
RotationCnt
)
,
()
=>
{
{
if
(
mRDetect
.
RotationCnt
<
minRotationCnt
)
if
(
mRDetect
.
RotationCnt
<
minRotationCnt
)
{
{
...
@@ -158,7 +158,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -158,7 +158,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
}
}
});
});
Misc
.
BindingOperations
.
SetBinding
(
mCurrRDetect
,
"RenZiJiaPeriod"
,
()
=>
Misc
.
BindingOperations
.
SetBinding
(
mCurrRDetect
,
nameof
(
mCurrRDetect
.
RenZiJiaPeriod
)
,
()
=>
{
{
DataMinMinute
=
(
int
)(
mRDetect
.
RenZiJiaPeriod
.
TotalMinutes
*
(
minRotationCnt
-
1
));
DataMinMinute
=
(
int
)(
mRDetect
.
RenZiJiaPeriod
.
TotalMinutes
*
(
minRotationCnt
-
1
));
DataBestMinute
=
(
int
)
Math
.
Round
((
mRDetect
.
RenZiJiaPeriod
.
TotalMinutes
*
3
));
DataBestMinute
=
(
int
)
Math
.
Round
((
mRDetect
.
RenZiJiaPeriod
.
TotalMinutes
*
3
));
...
@@ -178,10 +178,17 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -178,10 +178,17 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
if
(
IsCaling
)
if
(
IsCaling
)
return
false
;
return
false
;
TimeSpan
getBufTime
=
TimeSpan
.
FromMinutes
(
getDataMinute
);
TimeSpan
getBufTime
=
TimeSpan
.
FromMinutes
(
getDataMinute
);
if
(
getBufTime
>
mCurrRDetect
.
BufTotalTime
)
if
(
getBufTime
>
mCurrRDetect
.
BufTotalTime
)
//return false;
{
getBufTime
=
mCurrRDetect
.
BufTotalTime
;
}
if
(
getBufTime
<
TimeSpan
.
FromMinutes
(
DataMinMinute
))
{
return
false
;
return
false
;
}
dataBegin
=
DateTime
.
Now
-
getBufTime
;
dataBegin
=
DateTime
.
Now
-
getBufTime
;
IsDownloading
=
true
;
IsDownloading
=
true
;
IsDataReady
=
false
;
IsDataReady
=
false
;
...
@@ -193,9 +200,9 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -193,9 +200,9 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
void
DownloadData_limit
()
void
DownloadData_limit
()
{
{
Msg
=
$"下载 转向信号数据 [
{
dataBegin
}
- Now]...."
;
Msg
=
$"下载 转向信号数据 [
{
dataBegin
}
- Now]...."
;
mCurrRDetect
.
GetLimitList
(
dataBegin
,
(
object
AsyncState
,
object
retData
)
=>
mCurrRDetect
.
GetLimitList
(
dataBegin
,
(
object
asyncContext
,
object
retData
)
=>
{
{
Action
act
=
AsyncState
as
Action
;
Action
act
=
asyncContext
as
Action
;
var
p
=
retData
as
GetLimitListReponse
;
var
p
=
retData
as
GetLimitListReponse
;
if
((
p
.
datas
==
null
)
||
p
.
datas
.
Count
()
<
2
)
if
((
p
.
datas
==
null
)
||
p
.
datas
.
Count
()
<
2
)
{
{
...
@@ -350,7 +357,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -350,7 +357,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
Value
=
v
Value
=
v
});
});
}
}
OnPropertyChanged
(
"VelocityValues"
);
OnPropertyChanged
(
nameof
(
VelocityValues
)
);
Velocity1
=
VelocityValues
.
Average
(
tv
=>
tv
.
Value
);
Velocity1
=
VelocityValues
.
Average
(
tv
=>
tv
.
Value
);
if
(
mCurrRDetect
.
Is3D
)
if
(
mCurrRDetect
.
Is3D
)
...
@@ -386,7 +393,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -386,7 +393,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
foreach
(
var
tv
in
FilmLength3DValues
)
foreach
(
var
tv
in
FilmLength3DValues
)
tv
.
Value
-=
min_f
;
tv
.
Value
-=
min_f
;
OnPropertyChanged
(
"FilmLength3DValues"
);
OnPropertyChanged
(
nameof
(
FilmLength3DValues
)
);
UpdateNewFilmLength3D
();
UpdateNewFilmLength3D
();
}
}
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/PgBlowing/PgBlowingExt.xaml
View file @
561c75a3
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
<TextBlock Text="旋转次数不足2次
,
不能下载数据" Style="{StaticResource TextBlockStyle_FieldContent}" Foreground="Red" VerticalAlignment="Center"
<TextBlock Text="旋转次数不足2次
,
不能下载数据" Style="{StaticResource TextBlockStyle_FieldContent}" Foreground="Red" VerticalAlignment="Center"
Visibility="{Binding Cfl.IsCanDownload,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}"
Visibility="{Binding Cfl.IsCanDownload,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}"
/>
/>
</Grid>
</Grid>
...
@@ -101,13 +101,15 @@
...
@@ -101,13 +101,15 @@
<TextBlock Style="{StaticResource CardTitleStyle}" Text="厚度趋势"/>
<TextBlock Style="{StaticResource CardTitleStyle}" Text="厚度趋势"/>
<lvc:CartesianChart Height="150" DisableAnimations="True" Margin="5" Hoverable="False" DataTooltip="{x:Null}" >
<lvc:CartesianChart Height="150" DisableAnimations="True" Margin="5" Hoverable="False" DataTooltip="{x:Null}" >
<lvc:CartesianChart.Series>
<lvc:CartesianChart.Series>
<lvc:LineSeries Values="{Binding ThicknessValues}" Configuration="{Binding MapperTv}" />
<lvc:LineSeries Values="{Binding ThicknessValues}"
PointGeometry="{x:Null}"
Configuration="{Binding MapperTv}" />
</lvc:CartesianChart.Series>
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}"
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}"
x:Name="axisXAD"
x:Name="axisXAD"
Foreground="DarkSlateBlue"
Foreground="DarkSlateBlue"
Sections="{Binding Limit
Values,Converter={StaticResource limit2SectionsConv}
}"
Sections="{Binding Limit
Sections
}"
/>
/>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisY>
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/PgBlowing/PgBlowingExtVm.cs
View file @
561c75a3
...
@@ -10,7 +10,7 @@ using System.ComponentModel;
...
@@ -10,7 +10,7 @@ using System.ComponentModel;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Media
;
namespace
FLY.Thick.Blowing.UI.Fix.Client
namespace
FLY.Thick.Blowing.UI.Fix.Client
{
{
...
@@ -22,8 +22,8 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -22,8 +22,8 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
/// <summary>
/// <summary>
/// 画在图上的 限位信号
/// 画在图上的 限位信号
/// </summary>
/// </summary>
[
PropertyChanged
.
DoNotCheckEquality
]
public
ChartValues
<
TimeValue
>
LimitValues
{
get
;
}
=
new
ChartValues
<
TimeValue
>();
public
List
<
TimeValue
>
LimitValues
{
get
;
private
set
;
}
/// <summary>
/// <summary>
/// 画在图上的 速度曲线,限制最多100个数据
/// 画在图上的 速度曲线,限制最多100个数据
/// </summary>
/// </summary>
...
@@ -51,6 +51,8 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -51,6 +51,8 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
/// 转换为分区号单位的 每幅图
/// 转换为分区号单位的 每幅图
/// </summary>
/// </summary>
public
SeriesCollection
FrameSeries
{
get
;
}
=
new
SeriesCollection
();
public
SeriesCollection
FrameSeries
{
get
;
}
=
new
SeriesCollection
();
public
SectionsCollection
LimitSections
{
get
;
}
=
new
SectionsCollection
();
#
endregion
#
endregion
#
region
参数
#
region
参数
...
@@ -153,13 +155,13 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -153,13 +155,13 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
Misc
.
BindingOperations
.
SetBinding
(
rdetect
,
"Is3D"
,
this
,
"Is3D"
);
Misc
.
BindingOperations
.
SetBinding
(
rdetect
,
nameof
(
rdetect
.
Is3D
),
this
,
nameof
(
Is3D
)
);
Misc
.
BindingOperations
.
SetBinding
(
Cfl
,
"FilmLength"
,
this
,
"FilmLength"
);
Misc
.
BindingOperations
.
SetBinding
(
Cfl
,
nameof
(
Cfl
.
FilmLength
),
this
,
nameof
(
FilmLength
)
);
Misc
.
BindingOperations
.
SetBinding
(
Cfl
,
"VelocityFilter"
,
this
,
"VelocityFilter"
);
Misc
.
BindingOperations
.
SetBinding
(
Cfl
,
nameof
(
Cfl
.
VelocityFilter
),
this
,
nameof
(
VelocityFilter
)
);
Misc
.
BindingOperations
.
SetBinding
(
Cfl
,
"Velocity1"
,
this
,
"Velocity1"
);
Misc
.
BindingOperations
.
SetBinding
(
Cfl
,
nameof
(
Cfl
.
Velocity1
),
this
,
nameof
(
Velocity1
)
);
Misc
.
BindingOperations
.
SetBinding
(
Cfl
,
Misc
.
BindingOperations
.
SetBinding
(
Cfl
,
new
string
[]
{
"DataMaxMinute"
,
"DataMinMinute"
,
"DataBestMinute"
},
new
string
[]
{
nameof
(
Cfl
.
DataMaxMinute
),
nameof
(
Cfl
.
DataMinMinute
),
nameof
(
Cfl
.
DataBestMinute
)
},
()
=>
{
()
=>
{
if
(
GetDataMinute
<
Cfl
.
DataMinMinute
)
if
(
GetDataMinute
<
Cfl
.
DataMinMinute
)
GetDataMinute
=
Cfl
.
DataBestMinute
;
GetDataMinute
=
Cfl
.
DataBestMinute
;
...
@@ -188,65 +190,77 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -188,65 +190,77 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
private
void
CalFilmLen_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
private
void
CalFilmLen_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
{
if
(
e
.
PropertyName
==
"LimitValues"
)
if
(
e
.
PropertyName
==
nameof
(
Cfl
.
LimitValues
))
{
LimitValues
=
Cfl
.
LimitValues
;
}
else
if
(
e
.
PropertyName
==
"VelocityValues"
)
{
{
var
vList
=
Cfl
.
LimitValues
;
VelocityValues
.
Clear
();
//var newList = GetLimitedList(vList, 100);
var
vList
=
Cfl
.
VelocityValues
;
LimitSections
.
Clear
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
for
(
int
i
=
0
;
i
<
vList
.
Count
();
i
++)
{
var
value
=
vList
[
i
];
var
axisSection
=
new
AxisSection
()
{
{
int
idx
=
vList
.
Count
()
*
i
/
100
;
StrokeThickness
=
1
,
if
(
idx
>=
vList
.
Count
())
idx
=
vList
.
Count
()
-
1
;
DataLabel
=
true
,
VelocityValues
.
Add
(
vList
[
idx
]);
DisableAnimations
=
true
,
DataLabelForeground
=
new
SolidColorBrush
(
Colors
.
White
),
Opacity
=
1
,
Stroke
=
new
SolidColorBrush
(
Colors
.
Orange
),
};
if
(
value
.
Value
==
1
)
axisSection
.
Stroke
=
new
SolidColorBrush
(
Colors
.
DarkBlue
);
axisSection
.
Value
=
value
.
Time
.
Ticks
;
LimitSections
.
Add
(
axisSection
);
}
//LimitValues.Clear();
//LimitValues.AddRange(newList);
}
}
else
if
(
e
.
PropertyName
==
nameof
(
Cfl
.
VelocityValues
))
{
var
vList
=
Cfl
.
VelocityValues
;
VAvg
=
vList
.
Average
(
tv
=>
tv
.
Value
);
VAvg
=
vList
.
Average
(
tv
=>
tv
.
Value
);
VMax
=
vList
.
Max
(
tv
=>
tv
.
Value
);
VMax
=
vList
.
Max
(
tv
=>
tv
.
Value
);
VMin
=
vList
.
Min
(
tv
=>
tv
.
Value
);
VMin
=
vList
.
Min
(
tv
=>
tv
.
Value
);
var
newList
=
GetLimitedList
(
vList
,
100
);
VelocityValues
.
Clear
();
VelocityValues
.
AddRange
(
newList
);
}
}
else
if
(
e
.
PropertyName
==
"ThicknessValues"
)
else
if
(
e
.
PropertyName
==
nameof
(
Cfl
.
ThicknessValues
)
)
{
{
var
vList
=
Cfl
.
ThicknessValues
;
var
newList
=
GetLimitedList
(
vList
,
100
);
ThicknessValues
.
Clear
();
ThicknessValues
.
Clear
();
var
tList
=
Cfl
.
ThicknessValues
;
ThicknessValues
.
AddRange
(
newList
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
int
idx
=
tList
.
Count
()
*
i
/
100
;
if
(
idx
>=
tList
.
Count
())
idx
=
tList
.
Count
()
-
1
;
ThicknessValues
.
Add
(
tList
[
idx
]);
}
}
}
else
if
(
e
.
PropertyName
==
nameof
(
Cfl
.
FilmLength3DValues
))
else
if
(
e
.
PropertyName
==
"FilmLength3DValues"
)
{
FilmLength3DValues
.
Clear
();
var
tList
=
Cfl
.
FilmLength3DValues
;
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
{
int
idx
=
tList
.
Count
()
*
i
/
100
;
var
vList
=
Cfl
.
FilmLength3DValues
;
if
(
idx
>=
tList
.
Count
())
idx
=
tList
.
Count
()
-
1
;
var
newList
=
GetLimitedList
(
vList
,
100
);
FilmLength3DValues
.
Add
(
tList
[
idx
]);
}
FAvg
=
tList
.
Average
(
tv
=>
tv
.
Value
);
FAvg
=
vList
.
Average
(
tv
=>
tv
.
Value
);
FMax
=
tList
.
Max
(
tv
=>
tv
.
Value
);
FMax
=
vList
.
Max
(
tv
=>
tv
.
Value
);
FMin
=
tList
.
Min
(
tv
=>
tv
.
Value
);
FMin
=
vList
.
Min
(
tv
=>
tv
.
Value
);
FilmLength3DValues
.
Clear
();
FilmLength3DValues
.
AddRange
(
newList
);
}
}
else
if
(
e
.
PropertyName
==
"CurrFilmLength3D"
)
else
if
(
e
.
PropertyName
==
nameof
(
Cfl
.
CurrFilmLength3D
)
)
{
{
CurrFilmLength3D
.
Clear
();
CurrFilmLength3D
.
Clear
();
foreach
(
var
d
in
Cfl
.
CurrFilmLength3D
)
CurrFilmLength3D
.
AddRange
(
Cfl
.
CurrFilmLength3D
);
CurrFilmLength3D
.
Add
(
d
);
}
}
else
if
(
e
.
PropertyName
==
"NewFilmLength3D"
)
else
if
(
e
.
PropertyName
==
nameof
(
Cfl
.
NewFilmLength3D
)
)
{
{
NewFilmLength3D
.
Clear
();
NewFilmLength3D
.
Clear
();
foreach
(
var
d
in
Cfl
.
NewFilmLength3D
)
NewFilmLength3D
.
AddRange
(
Cfl
.
NewFilmLength3D
);
NewFilmLength3D
.
Add
(
d
);
}
}
else
if
(
e
.
PropertyName
==
"Frames"
)
else
if
(
e
.
PropertyName
==
nameof
(
Cfl
.
Frames
)
)
{
{
FrameSeries
.
Clear
();
FrameSeries
.
Clear
();
for
(
int
i
=
0
;
i
<
Cfl
.
Frames
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
Cfl
.
Frames
.
Count
();
i
++)
...
@@ -270,6 +284,28 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -270,6 +284,28 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
}
}
}
}
/// <summary>
/// 从原始数据队列平均获取100个数据
/// </summary>
/// <param name="orgList"></param>
/// <returns></returns>
List
<
T
>
GetLimitedList
<
T
>(
List
<
T
>
orgList
,
int
limitCnt
)
{
var
tList
=
orgList
;
var
newList
=
new
List
<
T
>();
if
(
tList
.
Count
<
limitCnt
)
{
limitCnt
=
tList
.
Count
;
}
for
(
int
i
=
0
;
i
<
limitCnt
;
i
++)
{
int
idx
=
tList
.
Count
()
*
i
/
limitCnt
;
if
(
idx
>=
tList
.
Count
())
idx
=
tList
.
Count
()
-
1
;
newList
.
Add
(
tList
[
idx
]);
}
return
newList
;
}
void
Init1
()
void
Init1
()
{
{
#
region
界面配置
#
region
界面配置
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/PgBlowing/PgBlowingExtVmUt.cs
View file @
561c75a3
...
@@ -8,6 +8,7 @@ using System.ComponentModel;
...
@@ -8,6 +8,7 @@ using System.ComponentModel;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Media
;
namespace
FLY.Thick.Blowing.UI.Fix.Client
namespace
FLY.Thick.Blowing.UI.Fix.Client
{
{
...
@@ -18,7 +19,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -18,7 +19,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
/// <summary>
/// <summary>
/// 画在图上的 限位信号
/// 画在图上的 限位信号
/// </summary>
/// </summary>
public
List
<
TimeValue
>
LimitValues
{
get
;
}
=
new
List
<
TimeValue
>();
public
ChartValues
<
TimeValue
>
LimitValues
{
get
;
}
=
new
ChartValues
<
TimeValue
>();
/// <summary>
/// <summary>
/// 画在图上的 速度曲线,限制最多100个数据
/// 画在图上的 速度曲线,限制最多100个数据
/// </summary>
/// </summary>
...
@@ -46,6 +47,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -46,6 +47,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
/// 转换为分区号单位的 每幅图
/// 转换为分区号单位的 每幅图
/// </summary>
/// </summary>
public
SeriesCollection
FrameSeries
{
get
;
}
=
new
SeriesCollection
();
public
SeriesCollection
FrameSeries
{
get
;
}
=
new
SeriesCollection
();
public
SectionsCollection
LimitSections
{
get
;
}
=
new
SectionsCollection
();
#
endregion
#
endregion
#
region
参数
#
region
参数
...
@@ -150,6 +152,30 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -150,6 +152,30 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
#
endregion
#
endregion
}
}
/// <summary>
/// 从原始数据队列平均获取100个数据
/// </summary>
/// <param name="orgList"></param>
/// <returns></returns>
List
<
T
>
GetLimitedList
<
T
>(
List
<
T
>
orgList
,
int
limitCnt
)
{
var
tList
=
orgList
;
var
newList
=
new
List
<
T
>();
if
(
tList
.
Count
<
limitCnt
)
{
limitCnt
=
tList
.
Count
;
}
for
(
int
i
=
0
;
i
<
limitCnt
;
i
++)
{
int
idx
=
tList
.
Count
()
*
i
/
limitCnt
;
if
(
idx
>=
tList
.
Count
())
idx
=
tList
.
Count
()
-
1
;
newList
.
Add
(
tList
[
idx
]);
}
return
newList
;
}
/// <summary>
/// <summary>
/// 产生虚拟数据
/// 产生虚拟数据
/// </summary>
/// </summary>
...
@@ -291,24 +317,24 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -291,24 +317,24 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
double
thick
;
double
thick
;
if
(
n
==
0
)
if
(
n
==
0
)
thick
=
thicks
[
idx
];
thick
=
thicks
[
idx
]
/
100.0
;
else
else
thick
=
thicks
[
thicks
.
Count
()
-
1
-
idx
];
thick
=
thicks
[
thicks
.
Count
()
-
1
-
idx
]
/
100.0
;
tList
.
Add
(
new
TimeValue
()
tList
.
Add
(
new
TimeValue
()
{
{
Time
=
dt
,
Time
=
dt
,
Value
=
thick
/
100.0
Value
=
thick
});
})
;
if
(
lList
.
Count
()
==
0
)
if
(
lList
.
Count
()
==
0
)
{
{
lList
.
Add
(
new
TimeValue
()
{
Time
=
dt_begin
+
RInterval
,
Value
=
n
});
lList
.
Add
(
new
TimeValue
()
{
Time
=
dt_begin
+
RInterval
,
Value
=
thick
});
}
}
else
if
(
dt
>=
lList
.
Last
().
Time
)
else
if
(
dt
>=
lList
.
Last
().
Time
)
{
{
lList
.
Add
(
new
TimeValue
()
{
Time
=
lList
.
Last
().
Time
+
RInterval
,
Value
=
n
});
lList
.
Add
(
new
TimeValue
()
{
Time
=
lList
.
Last
().
Time
+
RInterval
,
Value
=
thick
});
}
}
}
}
...
@@ -360,46 +386,34 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
...
@@ -360,46 +386,34 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
#
endregion
#
endregion
foreach
(
var
tv
in
lList
)
{
LimitValues
.
Add
(
tv
);
}
PropertyChanged
?.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
"LimitValues"
));
for
(
int
i
=
0
;
i
<
100
;
i
++)
// LimitValues.AddRange(lList);
{
int
idx
=
vList
.
Count
()
*
i
/
100
;
if
(
idx
>=
vList
.
Count
())
idx
=
vList
.
Count
()
-
1
;
VelocityValues
.
Add
(
vList
[
idx
]);
}
for
(
int
i
=
0
;
i
<
100
;
i
++)
for
(
int
i
=
0
;
i
<
lList
.
Count
()
;
i
++)
{
{
int
idx
=
tList
.
Count
()
*
i
/
100
;
if
(
idx
>=
tList
.
Count
())
idx
=
tList
.
Count
()
-
1
;
ThicknessValues
.
Add
(
tList
[
idx
]);
}
for
(
int
i
=
0
;
i
<
100
;
i
++)
var
value
=
lList
[
i
];
var
axisSection
=
new
AxisSection
()
{
{
int
idx
=
fList
.
Count
()
*
i
/
100
;
StrokeThickness
=
1
,
if
(
idx
>=
fList
.
Count
())
idx
=
fList
.
Count
()
-
1
;
DataLabel
=
true
,
FilmLength3DValues
.
Add
(
fList
[
idx
]);
DisableAnimations
=
true
,
DataLabelForeground
=
new
SolidColorBrush
(
Colors
.
White
),
Opacity
=
1
,
Stroke
=
new
SolidColorBrush
(
Colors
.
Orange
),
};
if
(
value
.
Value
==
1
)
axisSection
.
Stroke
=
new
SolidColorBrush
(
Colors
.
DarkBlue
);
axisSection
.
Value
=
value
.
Time
.
Ticks
;
LimitSections
.
Add
(
axisSection
);
}
}
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
int
idx
=
currFilmLength
.
Count
()
*
i
/
100
;
if
(
idx
>=
currFilmLength
.
Count
())
idx
=
currFilmLength
.
Count
()
-
1
;
CurrFilmLength3D
.
Add
(
currFilmLength
[
idx
]);
}
for
(
int
i
=
0
;
i
<
100
;
i
++)
VelocityValues
.
AddRange
(
GetLimitedList
(
vList
,
100
));
{
ThicknessValues
.
AddRange
(
GetLimitedList
(
tList
,
100
));
int
idx
=
setFilmLength
.
Count
()
*
i
/
100
;
FilmLength3DValues
.
AddRange
(
GetLimitedList
(
fList
,
100
));
if
(
idx
>=
setFilmLength
.
Count
())
idx
=
setFilmLength
.
Count
()
-
1
;
CurrFilmLength3D
.
AddRange
(
GetLimitedList
(
currFilmLength
,
100
));
NewFilmLength3D
.
Add
(
setFilmLength
[
idx
]);
NewFilmLength3D
.
AddRange
(
GetLimitedList
(
setFilmLength
,
100
));
}
for
(
int
i
=
0
;
i
<
frames
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
frames
.
Count
();
i
++)
{
{
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/IService/IBlowingDetectService.cs
View file @
561c75a3
...
@@ -225,20 +225,11 @@ namespace FLY.Thick.Blowing.IService
...
@@ -225,20 +225,11 @@ namespace FLY.Thick.Blowing.IService
/// </summary>
/// </summary>
public
class
RollCell
public
class
RollCell
{
{
/// <summary>
/// 创建副本
/// </summary>
/// <returns></returns>
public
RollCell
Clone
()
{
RollCell
r
=
new
RollCell
();
r
.
dt
=
dt
;
return
r
;
}
public
DateTime
dt
;
public
DateTime
dt
;
public
DateTime
sysTime
;
public
override
string
ToString
()
public
override
string
ToString
()
{
{
return
dt
.
ToString
()
;
return
$"
{
sysTime
}
"
;
}
}
}
}
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/BlowingDetect.cs
View file @
561c75a3
...
@@ -225,6 +225,7 @@ namespace FLY.Thick.Blowing.Server
...
@@ -225,6 +225,7 @@ namespace FLY.Thick.Blowing.Server
List
<
double
>
mFilmLength3D
=
new
List
<
double
>();
List
<
double
>
mFilmLength3D
=
new
List
<
double
>();
#
endregion
#
endregion
FlyADBase
.
IFlyAD
flyad
;
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
...
@@ -410,7 +411,8 @@ namespace FLY.Thick.Blowing.Server
...
@@ -410,7 +411,8 @@ namespace FLY.Thick.Blowing.Server
/// <param name="flyad"></param>
/// <param name="flyad"></param>
public
void
Init
(
FlyADBase
.
IFlyAD
flyad
)
public
void
Init
(
FlyADBase
.
IFlyAD
flyad
)
{
{
flyad
.
IStatusChangedEvent
+=
new
FlyADBase
.
IStatusChangedEventHandler
(
flyad_IStatusChangedEvent
);
this
.
flyad
=
flyad
;
this
.
flyad
.
IStatusChangedEvent
+=
new
FlyADBase
.
IStatusChangedEventHandler
(
flyad_IStatusChangedEvent
);
FObjBase
.
PollModule
.
Current
.
Poll_Config
(
FObjBase
.
PollModule
.
POLL_CONFIG
.
ADD
,
new
FObjBase
.
PollModule
.
PollHandler
(
OnPoll
));
FObjBase
.
PollModule
.
Current
.
Poll_Config
(
FObjBase
.
PollModule
.
POLL_CONFIG
.
ADD
,
new
FObjBase
.
PollModule
.
PollHandler
(
OnPoll
));
}
}
...
@@ -914,17 +916,13 @@ namespace FLY.Thick.Blowing.Server
...
@@ -914,17 +916,13 @@ namespace FLY.Thick.Blowing.Server
//信号的状态
//信号的状态
bool
status
=
!
Misc
.
MyBase
.
CHECKBIT
(
e
.
IStatus
,
Roll_bit
-
1
);
bool
status
=
!
Misc
.
MyBase
.
CHECKBIT
(
e
.
IStatus
,
Roll_bit
-
1
);
//TODO,不使用AD盒的时间
//DateTime dt = e.Time;//信号更新发生的时间
DateTime
dt
=
DateTime
.
Now
;
if
(
status
)
//1->0 触发!!!
if
(
status
)
//1->0 触发!!!
{
{
mRollList
.
RAdd
(
mRollList
.
RAdd
(
new
RollCell
()
new
RollCell
()
{
{
dt
=
dt
dt
=
DateTime
.
Now
,
//用于时间定位
sysTime
=
e
.
Time
,
//用于算速度
});
});
...
@@ -932,6 +930,7 @@ namespace FLY.Thick.Blowing.Server
...
@@ -932,6 +930,7 @@ namespace FLY.Thick.Blowing.Server
TouchFilmInfoChanged
();
TouchFilmInfoChanged
();
}
}
}
}
void
flyad_IStatusChangedEvent
(
object
sender
,
FlyADBase
.
IStatusChangedEventArgs
e
)
void
flyad_IStatusChangedEvent
(
object
sender
,
FlyADBase
.
IStatusChangedEventArgs
e
)
{
{
update_limit
(
e
);
update_limit
(
e
);
...
@@ -1075,22 +1074,21 @@ namespace FLY.Thick.Blowing.Server
...
@@ -1075,22 +1074,21 @@ namespace FLY.Thick.Blowing.Server
{
{
if
(
mRollList
.
Count
>
1
)
if
(
mRollList
.
Count
>
1
)
{
{
DateTime
dt1
=
mRollList
[
mRollList
.
Count
-
1
].
dt
;
DateTime
sysTime0
=
flyad
.
Now
;
DateTime
sysTime1
=
mRollList
[
mRollList
.
Count
-
1
].
sysTime
;
int
cnt
=
5
;
int
cnt
=
5
;
if
(
cnt
>
mRollList
.
Count
)
if
(
cnt
>
mRollList
.
Count
)
cnt
=
mRollList
.
Count
;
cnt
=
mRollList
.
Count
;
DateTime
sysTime4
=
mRollList
[
mRollList
.
Count
-
(
cnt
-
1
)].
dt
;
DateTime
sysTime5
=
mRollList
[
mRollList
.
Count
-
cnt
].
sysTime
;
DateTime
dt2
=
mRollList
[
mRollList
.
Count
-
cnt
].
dt
;
TimeSpan
ts_last
=
TimeSpan
.
FromTicks
((
sysTime1
-
sysTime5
).
Ticks
/
(
cnt
-
1
));
//5次的平均滤波
DateTime
dt11
=
mRollList
[
mRollList
.
Count
-
(
cnt
-
1
)].
dt
;
//未来的 5次的平均滤波 时间差
TimeSpan
ts_now
=
TimeSpan
.
FromTicks
((
sysTime0
-
sysTime4
).
Ticks
/
(
cnt
-
1
));
TimeSpan
ts_last
=
TimeSpan
.
FromTicks
((
dt1
-
dt2
).
Ticks
/
(
cnt
-
1
));
//5次的平均滤波
//因为没有使用AD盒的时间,所以可以用DateTime.Now 比较
TimeSpan
ts_now
=
TimeSpan
.
FromTicks
((
DateTime
.
Now
-
dt11
).
Ticks
/
(
cnt
-
1
));
TimeSpan
ts_max
;
TimeSpan
ts_max
;
if
(
ts_now
>
(
ts_last
+
ts_last
))
if
(
ts_now
>
(
ts_last
+
ts_last
))
//超过了2倍的时间,肯定是慢下来了
{
{
ts_max
=
ts_now
;
ts_max
=
ts_now
;
}
}
...
@@ -1101,7 +1099,7 @@ namespace FLY.Thick.Blowing.Server
...
@@ -1101,7 +1099,7 @@ namespace FLY.Thick.Blowing.Server
FilmVelocity
=
RollPerimeter
/
1000.0
/
ts_max
.
TotalMinutes
;
FilmVelocity
=
RollPerimeter
/
1000.0
/
ts_max
.
TotalMinutes
;
BufTotalTime
=
DateTime
.
Now
-
mRollList
[
0
].
dt
;
BufTotalTime
=
DateTime
.
Now
-
mRollList
[
0
].
dt
;
//这里用回电脑的时间
}
}
}
}
/// <summary>
/// <summary>
...
@@ -1111,12 +1109,13 @@ namespace FLY.Thick.Blowing.Server
...
@@ -1111,12 +1109,13 @@ namespace FLY.Thick.Blowing.Server
{
{
if
(
mRollList
.
Count
>
0
)
if
(
mRollList
.
Count
>
0
)
{
{
DateTime
dt
=
mRollList
[
mRollList
.
Count
-
1
]
.
dt
;
DateTime
dt
=
mRollList
.
Last
()
.
dt
;
//因为没有使用AD盒的时间,所以可以用DateTime.Now 比较
//因为没有使用AD盒的时间,所以可以用DateTime.Now 比较
TimeSpan
ts
=
DateTime
.
Now
-
dt
;
TimeSpan
ts
=
DateTime
.
Now
-
dt
;
if
(
ts
.
TotalMinutes
>
1
)
//1min
if
(
ts
.
TotalMinutes
>
0.5
)
{
{
//大于1分钟,也没有一个信号,复位
//大于0.5分钟,也没有一个信号,复位
//辊周长314mm, 0.5min = 0.6m/min, 太慢了
Clear
();
Clear
();
}
}
}
}
...
@@ -1536,6 +1535,9 @@ namespace FLY.Thick.Blowing.Server
...
@@ -1536,6 +1535,9 @@ namespace FLY.Thick.Blowing.Server
/// <returns></returns>
/// <returns></returns>
double
RollList_GetPosition
(
int
idx
,
DateTime
dt
)
double
RollList_GetPosition
(
int
idx
,
DateTime
dt
)
{
{
DateTime
dt1
=
mRollList
[
idx
+
1
].
dt
;
DateTime
dt1
=
mRollList
[
idx
+
1
].
dt
;
double
position1
=
(
idx
+
1
)
*
RollPerimeter
;
double
position1
=
(
idx
+
1
)
*
RollPerimeter
;
DateTime
dt2
=
mRollList
[
idx
].
dt
;
DateTime
dt2
=
mRollList
[
idx
].
dt
;
...
@@ -1550,6 +1552,40 @@ namespace FLY.Thick.Blowing.Server
...
@@ -1550,6 +1552,40 @@ namespace FLY.Thick.Blowing.Server
/// <returns></returns>
/// <returns></returns>
double
RollList_GetVelocity
(
int
idx
)
double
RollList_GetVelocity
(
int
idx
)
{
{
//TODO
//速度是准的
//if (idx>5)
//{
// DateTime sysTime0 = flyad.Now;
// DateTime sysTime1 = mRollList[mRollList.Count - 1].sysTime;
// int cnt = 5;
// if (cnt > mRollList.Count)
// cnt = mRollList.Count;
// DateTime sysTime4 = mRollList[mRollList.Count - (cnt - 1)].dt;
// DateTime sysTime5 = mRollList[mRollList.Count - cnt].sysTime;
// TimeSpan ts_last = TimeSpan.FromTicks((sysTime1 - sysTime5).Ticks / (cnt - 1));//5次的平均滤波
// //未来的 5次的平均滤波 时间差
// TimeSpan ts_now = TimeSpan.FromTicks((sysTime0 - sysTime4).Ticks / (cnt - 1));
// TimeSpan ts_max;
// if (ts_now > (ts_last + ts_last))//超过了2倍的时间,肯定是慢下来了
// {
// ts_max = ts_now;
// }
// else
// {
// ts_max = ts_last;
// }
// FilmVelocity = RollPerimeter / 1000.0 / ts_max.TotalMinutes;
// BufTotalTime = DateTime.Now - mRollList[0].dt;//这里用回电脑的时间
//}
DateTime
dt1
=
mRollList
[
idx
+
1
].
dt
;
DateTime
dt1
=
mRollList
[
idx
+
1
].
dt
;
DateTime
dt2
=
mRollList
[
idx
].
dt
;
DateTime
dt2
=
mRollList
[
idx
].
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