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
582acd98
Commit
582acd98
authored
Jun 15, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加 flyad7 吹膜模拟器 显示更多信息。
parent
adf9d9be
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
266 additions
and
89 deletions
+266
-89
Blowing.cs
Project.FLY.FlyADBase/FLY.Simulation.Blowing/Blowing.cs
+78
-39
GageAD.cs
Project.FLY.FlyADBase/FLY.Simulation.Blowing/GageAD.cs
+15
-8
WindowBlowing.xaml
...ct.FLY.FlyADBase/FLYAD7_Simulation_Wpf/WindowBlowing.xaml
+164
-37
WindowBlowing.xaml.cs
...FLY.FlyADBase/FLYAD7_Simulation_Wpf/WindowBlowing.xaml.cs
+9
-5
No files found.
Project.FLY.FlyADBase/FLY.Simulation.Blowing/Blowing.cs
View file @
582acd98
...
...
@@ -4,14 +4,13 @@ using System.Linq;
using
System.Text
;
using
System.ComponentModel
;
using
System.Collections.ObjectModel
;
using
System.IO
;
using
Newtonsoft.Json
;
namespace
FLY.Simulation.Blowing
{
/// <summary>
/// 吹膜模拟
/// 1.加载数据
/// </summary>
[
JsonObject
(
MemberSerialization
.
OptIn
)]
public
class
Blowing
:
INotifyPropertyChanged
{
#
region
参数
...
...
@@ -20,82 +19,89 @@ namespace FLY.Simulation.Blowing
/// <summary>
/// 两个限位间的角度范围 != 旋转的总角度,限位值 °
/// </summary>
public
double
AngleRange
;
[
JsonProperty
]
public
double
AngleRange
{
get
;
set
;
}
/// <summary>
/// 旋转的速度, min/R 1R = 360°
/// </summary>
[
JsonProperty
]
public
double
AngleVelocity
{
get
;
set
;
}
/// <summary>
/// 加速时间 单位 s
/// </summary>
public
double
AngleAccTime
;
[
JsonProperty
]
public
double
AngleAccTime
{
get
;
set
;
}
/// <summary>
/// 减速时间 单位 s
/// </summary>
public
double
AngleDecTime
;
[
JsonProperty
]
public
double
AngleDecTime
{
get
;
set
;
}
/// <summary>
/// 换方向冷却时间 单位s
/// </summary>
public
double
AngleCoolTime
;
[
JsonProperty
]
public
double
AngleCoolTime
{
get
;
set
;
}
#
endregion
#
region
膜
private
double
filmwidth
;
/// <summary>
/// 膜泡压扁后总宽度,单位
m
/// 膜泡压扁后总宽度,单位
脉冲
/// </summary>
public
double
FilmWidth
{
get
;
set
;
}
/// <summary>
/// 膜走带速度, m/min
/// </summary>
[
JsonProperty
]
public
double
FilmVelocity
{
get
;
set
;
}
/// <summary>
/// 人字架到测厚仪的距离 23m
/// </summary>
public
double
FilmDistance
;
[
JsonProperty
]
public
double
FilmDistance
{
get
;
set
;
}
/// <summary>
/// 辊轴承,单位mm
/// </summary>
public
double
RollPerimeter
;
[
JsonProperty
]
public
double
RollPerimeter
{
get
;
set
;
}
/// <summary>
/// 测辊信号,信号长,单位mm
/// </summary>
public
double
RollSignLength
;
[
JsonProperty
]
public
double
RollSignLength
{
get
;
set
;
}
#
endregion
//#region 风环
///// <summary>
///// 加热棒数量
///// </summary>
//public int ChannelCnt;
#
region
风环
/// <summary>
/// 加热棒数量
/// </summary>
[
JsonProperty
]
public
int
ChannelCnt
{
get
;
set
;
}
///// <summary>
///// 加热功率, 1~100
///// </summary>
//public int[] Heats;
///// <summary>
///// 第1根加热棒对应角度
///// </summary>
//public int Channel1stAngle;
/// <summary>
/// 第1根加热棒对应角度
/// </summary>
[
JsonProperty
]
public
double
Channel1stAngle
{
get
;
set
;
}
///// <summary>
///// 温度影响厚度变化比例, 1厚度,对应多少加热
///// </summary>
//public int Factor;//
//
#endregion
#
endregion
public
bool
IsShieldI9
{
get
;
set
;
}
...
...
@@ -105,21 +111,21 @@ namespace FLY.Simulation.Blowing
/// <summary>
/// 当前人字架角度 °
/// </summary>
public
double
CurrAngle
{
get
;
set
;
}
public
double
CurrAngle
{
get
;
private
set
;
}
/// <summary>
/// 当前速度,单位 °/s
/// </summary>
public
double
CurrAngleVelocity
;
public
double
CurrAngleVelocity
{
get
;
private
set
;
}
/// <summary>
/// 当前加速度, 单位 °/s^2
/// </summary>
public
double
CurrAngleAccV
;
public
double
CurrAngleAccV
{
get
;
private
set
;
}
/// <summary>
/// 当前已经走到长度, 通过编码器获取 单位 m
/// </summary>
public
double
CurrFilmLength
;
public
double
CurrFilmLength
{
get
;
private
set
;
}
#
endregion
public
HMI
mHMI
;
...
...
@@ -177,6 +183,13 @@ namespace FLY.Simulation.Blowing
RollPerimeter
=
314
;
//辊周长mm
RollSignLength
=
30
;
//辊信号长度mm
ChannelCnt
=
88
;
//加热棒数量
Channel1stAngle
=
100
;
//第1根加热棒对应角度
if
(!
Load
())
Save
();
//整个膜片1000个数据
int
[]
datas
=
OrgData
.
GetData
(
1000
);
for
(
int
i
=
0
;
i
<
1000
;
i
++)
...
...
@@ -186,12 +199,12 @@ namespace FLY.Simulation.Blowing
AfterDatas
.
Add
(
datas
[
i
]);
//系统扰动后 再 加热数据
}
mAirRing
=
new
AirRing
(
88
);
//44
支加热棒
mAirRing
=
new
AirRing
(
ChannelCnt
);
//88
支加热棒
mAirRing
.
Init
(
BeforeDatas
,
BeforeDatas2
,
0
);
mAirRing2
=
new
AirRing
(
88
);
//44
支加热棒;
mAirRing2
.
Init
(
BeforeDatas2
,
AfterDatas
,
400
);
//加热偏移了 400个数据, 总数是1000
mAirRing2
=
new
AirRing
(
ChannelCnt
);
//88
支加热棒;
mAirRing2
.
Init
(
BeforeDatas2
,
AfterDatas
,
(
int
)(
1000
*
Channel1stAngle
/
360
));
//加热偏移了
mAirRing2
.
AfterDatasUpdateEvent
+=
new
Action
<
ObservableCollection
<
int
>>(
mAirRing2_AfterDatasUpdateEvent
);
Avg
=
(
int
)(
BeforeDatas
.
Average
());
//原始平均值
...
...
@@ -208,7 +221,7 @@ namespace FLY.Simulation.Blowing
void
mAirRing2_AfterDatasUpdateEvent
(
ObservableCollection
<
int
>
obj
)
{
NotifyPropertyChanged
(
"AfterDatas"
);
NotifyPropertyChanged
(
nameof
(
AfterDatas
)
);
}
...
...
@@ -377,7 +390,7 @@ namespace FLY.Simulation.Blowing
void
Blowing_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
"Avg"
)
if
(
e
.
PropertyName
==
nameof
(
Avg
)
)
{
int
avg
=
(
int
)(
BeforeDatas
.
Average
());
int
offset
=
Avg
-
avg
;
...
...
@@ -389,7 +402,7 @@ namespace FLY.Simulation.Blowing
}
}
}
else
if
(
e
.
PropertyName
==
"TestPos"
)
else
if
(
e
.
PropertyName
==
nameof
(
TestPos
)
)
{
UpdateTestHeat
();
}
...
...
@@ -661,6 +674,30 @@ namespace FLY.Simulation.Blowing
}
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
private
string
param_path
=
"simulation_blowing.json"
;
public
void
Save
()
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
this
,
Formatting
.
Indented
);
File
.
WriteAllText
(
param_path
,
json
);
}
bool
Load
()
{
if
(!
File
.
Exists
(
param_path
))
return
false
;
try
{
string
json
=
File
.
ReadAllText
(
param_path
);
Newtonsoft
.
Json
.
JsonConvert
.
PopulateObject
(
json
,
this
);
return
true
;
}
catch
{
return
false
;
}
}
}
public
class
FilmData
{
...
...
@@ -669,4 +706,6 @@ namespace FLY.Simulation.Blowing
public
int
data1
;
public
int
data2
;
}
}
Project.FLY.FlyADBase/FLY.Simulation.Blowing/GageAD.cs
View file @
582acd98
...
...
@@ -35,30 +35,35 @@ namespace FLY.Simulation.Blowing
public
int
FilmBegin
;
/// <summary>
/// 传感器直径
/// 传感器直径
,单位脉冲
/// </summary>
public
int
SenserWidth
;
public
int
[]
AirDatas
;
CurveCollection
curve
;
double
ppmm
;
public
GageAD
()
{
curve
=
new
CurveCollection
();
double
mm_gagelen
=
3000
;
//设备总长3m
double
mm_filmwidth
=
2300
;
//膜宽2.3m
mBlowing
=
new
Blowing
();
double
m_filmwidth
=
mBlowing
.
FilmWidth
;
//膜宽2.3m
double
m_gagelen
=
3
;
//设备总长3m
double
mm_senserwidth
=
15
;
//传感器15mm
double
mm_filmbegin
=
300
;
//mm
PosLen
=
8030
;
double
ppmm
=
PosLen
/
mm_gagelen
;
ppmm
=
PosLen
/
(
m_gagelen
*
1000
)
;
FilmWidth
=
(
int
)(
m
m_filmwidth
*
ppmm
);
FilmWidth
=
(
int
)(
m
_filmwidth
*
1000
*
ppmm
);
FilmBegin
=
(
int
)(
mm_filmbegin
*
ppmm
);
SenserWidth
=
(
int
)(
mm_senserwidth
*
ppmm
);
mBlowing
=
new
Blowing
();
mBlowing
.
FilmWidth
=
FilmWidth
;
AirDatas
=
new
int
[
PosLen
];
NewAirDatas
();
...
...
@@ -96,7 +101,9 @@ namespace FLY.Simulation.Blowing
if
((
idx
>=
FilmBegin
)
&&
(
idx
<(
FilmBegin
+
FilmWidth
)))
{
FilmData
fd
=
mBlowing
.
GetData
(
idx
-
FilmBegin
);
int
position
=
idx
-
FilmBegin
;
double
pos_m
=
position
/
ppmm
/
1000.0
;
FilmData
fd
=
mBlowing
.
GetData
(
pos_m
);
if
(
fd
!=
null
)
{
data
+=
fd
.
data1
+
fd
.
data2
;
...
...
Project.FLY.FlyADBase/FLYAD7_Simulation_Wpf/WindowBlowing.xaml
View file @
582acd98
This diff is collapsed.
Click to expand it.
Project.FLY.FlyADBase/FLYAD7_Simulation_Wpf/WindowBlowing.xaml.cs
View file @
582acd98
...
...
@@ -147,23 +147,22 @@ namespace FLYAD7_Simulation_Wpf
private
void
Window_Loaded
(
object
sender
,
RoutedEventArgs
e
)
{
this
.
DataContext
=
mBlowing
;
this
.
groupBox1
.
DataContext
=
mBlowing
.
mHMI
;
this
.
spPlc
.
DataContext
=
mBlowing
.
mHMI
;
mBlowing
.
PropertyChanged
+=
new
System
.
ComponentModel
.
PropertyChangedEventHandler
(
mBlowing_PropertyChanged
);
DataBindAll
();
chart1
.
ChartAreas
[
"Default"
].
CursorX
.
Position
=
mBlowing
.
TestPos
;
DataBindAll_chart2
();
this
.
checkbox_isShieldI9
.
DataContext
=
mBlowing
;
}
void
mBlowing_PropertyChanged
(
object
sender
,
System
.
ComponentModel
.
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
"TestPos"
)
if
(
e
.
PropertyName
==
nameof
(
mBlowing
.
TestPos
)
)
{
chart1
.
ChartAreas
[
"Default"
].
CursorX
.
Position
=
mBlowing
.
TestPos
;
}
else
if
(
e
.
PropertyName
==
"AfterDatas"
)
else
if
(
e
.
PropertyName
==
nameof
(
mBlowing
.
AfterDatas
)
)
{
this
.
Dispatcher
.
Invoke
(
new
Action
(
DataBindAll2_chart2
));
this
.
Dispatcher
.
Invoke
(
new
Action
(
DataBindAll2
));
...
...
@@ -220,6 +219,11 @@ namespace FLYAD7_Simulation_Wpf
{
mBlowing
.
Test
();
}
private
void
btnSaveClick
(
object
sender
,
RoutedEventArgs
e
)
{
mBlowing
.
Save
();
MessageBox
.
Show
(
"已经保存数据,请重启"
);
}
}
}
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