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
488d9865
Commit
488d9865
authored
Oct 25, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 优化查加热棒坏的逻辑
parent
dce5e262
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
191 additions
and
70 deletions
+191
-70
FeedbackHeat.cs
...dbackRenZiJia/FLY.FeedbackRenZiJia/Server/FeedbackHeat.cs
+11
-3
HeatCell.cs
....FeedbackRenZiJia/FLY.FeedbackRenZiJia/Server/HeatCell.cs
+1
-1
HeatCheck.cs
...FeedbackRenZiJia/FLY.FeedbackRenZiJia/Server/HeatCheck.cs
+179
-66
No files found.
Project.FLY.FeedbackRenZiJia/FLY.FeedbackRenZiJia/Server/FeedbackHeat.cs
View file @
488d9865
...
...
@@ -130,7 +130,10 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
public
bool
CheckEnable
{
get
;
set
;
}
=
false
;
/// <summary>
/// 1块加热控制板 接多少路加热
/// </summary>
public
int
HeatsOfGroup
{
get
;
set
;
}
=
12
;
#
endregion
...
...
@@ -255,7 +258,7 @@ namespace FLY.FeedbackRenZiJia.Server
Misc
.
BindingOperations
.
SetBinding
(
mHeatCheck
,
nameof
(
mHeatCheck
.
Enable
),
this
,
nameof
(
CheckEnable
),
Misc
.
BindingOperations
.
BindingMode
.
TwoWay
);
Misc
.
BindingOperations
.
SetBinding
(
mHeatCheck
,
nameof
(
mHeatCheck
.
CheckNo
),
this
,
nameof
(
CheckNo
));
Misc
.
BindingOperations
.
SetBinding
(
mHeatCheck
,
nameof
(
mHeatCheck
.
Bads
),
this
,
nameof
(
Bads
));
Misc
.
BindingOperations
.
SetBinding
(
this
,
nameof
(
HeatsOfGroup
),
mHeatCheck
,
nameof
(
mHeatCheck
.
HeatsOfGroup
));
if
(
plc
is
PLCLink
)
{
((
PLCLink
)
plc
).
Start
();
...
...
@@ -994,6 +997,11 @@ namespace FLY.FeedbackRenZiJia.Server
/// 检测线速度 使能
/// </summary>
public
bool
HasCheckFilmVelocity
;
/// <summary>
/// 1块加热控制板 接多少路加热
/// </summary>
public
int
HeatsOfGroup
=
12
;
#
endregion
}
...
...
Project.FLY.FeedbackRenZiJia/FLY.FeedbackRenZiJia/Server/HeatCell.cs
View file @
488d9865
...
...
@@ -635,7 +635,7 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
public
void
Cal
()
{
var
thickpercents
=
Common
.
MyMath
.
ZoomOut
(
ThickPercents
,
BoltCnt
/
ChannelCnt
);
var
thickpercents
=
ThickPercents
;
//
Common.MyMath.ZoomOut(ThickPercents, BoltCnt / ChannelCnt);
int
[]
offsets
=
new
int
[
ChannelCnt
];
for
(
int
i
=
0
;
i
<
ChannelCnt
;
i
++)
{
...
...
Project.FLY.FeedbackRenZiJia/FLY.FeedbackRenZiJia/Server/HeatCheck.cs
View file @
488d9865
...
...
@@ -40,7 +40,7 @@ namespace FLY.FeedbackRenZiJia.Server
CHECK_MODE
checkMode
=
CHECK_MODE
.
IDLE
;
int
counter
=
0
;
#
region
IHeatCheck
public
int
HeatsOfGroup
{
get
;
set
;
}
=
12
;
/// <summary>
/// 有这个功能
/// </summary>
...
...
@@ -67,12 +67,102 @@ namespace FLY.FeedbackRenZiJia.Server
#
region
根据电流判断的加热棒状态
/// <summary>
/// 加热棒是好的,但电流小,必须两条同时加热才可以。
/// 加热棒是好的,但电流小,必须两条同时加热才可以;
/// 加热棒分组
/// </summary>
private
int
groupIdx
;
private
List
<
GroupBad
>
groupBads
=
new
List
<
GroupBad
>();
class
GroupBad
{
/// <summary>
/// 分组号
/// </summary>
public
int
group
;
/// <summary>
/// 在 好的 maybe序号
/// </summary>
public
int
goodIdx
=
-
1
;
/// <summary>
/// 全部待测的加热棒序号
/// </summary>
List
<
int
>
maybe
=
new
List
<
int
>();
/// <summary>
/// 已经测试过的 maybe序号
/// </summary>
List
<
int
>
hasCheck
=
new
List
<
int
>();
/// <summary>
/// 获取下一个 需要检查的 序号
/// </summary>
/// <returns></returns>
public
bool
GetNextIdx
()
{
for
(
int
i
=
0
;
i
<
maybe
.
Count
();
i
++)
{
if
(!
hasCheck
.
Contains
(
i
))
{
//这个没检查过,可以
checkIdx1
=
i
;
return
true
;
}
}
return
false
;
}
/// <summary>
/// 同时加热的加热棒0
/// </summary>
int
checkIdx0
;
/// <summary>
/// 同时加热的加热棒1
/// </summary>
private
int
HalfIdx
;
private
List
<
int
>
maybeIdx
=
new
List
<
int
>();
int
checkIdx1
;
public
int
NextCheckIdx
{
get
{
return
checkIdx1
+
1
;
}
}
public
int
HeatIdx0
{
get
{
return
maybe
[
checkIdx0
];
}
}
public
int
HeatIdx1
{
get
{
return
maybe
[
checkIdx1
];
}
}
public
bool
GetCheckIdx
(
int
startIdx
)
{
if
(
startIdx
>=
maybe
.
Count
()
-
1
)
return
false
;
//不够数
//同一个组可以一起加热测试
checkIdx0
=
startIdx
;
checkIdx1
=
startIdx
+
1
;
return
true
;
}
public
void
PushToHasCheck
()
{
if
(!
hasCheck
.
Contains
(
checkIdx0
))
hasCheck
.
Add
(
checkIdx0
);
if
(!
hasCheck
.
Contains
(
checkIdx1
))
hasCheck
.
Add
(
checkIdx1
);
}
public
void
MarkGoodIdx
()
{
goodIdx
=
checkIdx0
;
}
public
bool
HasGood
{
get
{
return
goodIdx
!=
-
1
;
}
}
public
void
Add
(
int
heatIdx
)
{
maybe
.
Add
(
heatIdx
);
}
}
/// <summary>
/// 坏的加热棒
/// </summary>
...
...
@@ -259,6 +349,23 @@ namespace FLY.FeedbackRenZiJia.Server
}
}
bool
GetCheckIdx_2_loop
(
int
grougIdx_start
,
int
startIdx
)
{
for
(
int
i
=
grougIdx_start
;
i
<
groupBads
.
Count
();
i
++)
{
if
(
groupBads
[
i
].
GetCheckIdx
(
startIdx
))
{
groupIdx
=
i
;
return
true
;
}
startIdx
=
0
;
}
return
false
;
}
/// <summary>
/// 加热棒检测周期
/// </summary>
...
...
@@ -337,7 +444,7 @@ namespace FLY.FeedbackRenZiJia.Server
{
Bads
[
CheckNo
-
1
]
=
true
;
NotifyPropertyChanged
(
"Bads"
);
NotifyPropertyChanged
(
nameof
(
Bads
)
);
OpenCircuit
=
true
;
}
...
...
@@ -373,20 +480,37 @@ namespace FLY.FeedbackRenZiJia.Server
{
if
(
counter
==
0
)
//刚进入!!!
{
HalfIdx
=
-
1
;
//可能坏的加热棒中,还没有一条是好的
for
(
int
i
=
0
;
i
<
Bads
.
Count
();
i
++)
//登记全部坏的加热棒
groupIdx
=
-
1
;
groupBads
.
Clear
();
for
(
int
i
=
0
;
i
<
Bads
.
Count
();
i
++)
//分组登记全部坏的加热棒
{
int
group
=
i
/
HeatsOfGroup
;
if
(
Bads
[
i
])
{
maybeIdx
.
Add
(
i
);
if
(
groupBads
.
Count
()
==
0
)
groupBads
.
Add
(
new
GroupBad
()
{
group
=
group
});
else
{
if
(
groupBads
.
Last
().
group
!=
group
)
{
groupBads
.
Add
(
new
GroupBad
()
{
group
=
group
});
}
}
groupBads
.
Last
().
Add
(
i
);
}
CheckNo
=
maybeIdx
.
First
()
+
1
;
//当前检测的位置,现在没用!!!
}
//肯定有2条加热棒是坏了,不用检测maybeIdx.Count()
if
(!
GetCheckIdx_2_loop
(
0
,
0
))
{
//没有两条同一组,测试结束
Enable
=
false
;
//停止检测
return
;
}
var
groupBad
=
groupBads
[
groupIdx
];
CheckNo
=
groupBad
.
HeatIdx1
+
1
;
//当前检测的位置,现在没用!!!
mHeatCell
.
ModifyPreHeats
(
getSingleHeat_100
(
mHeatCell
.
ChannelCnt
,
maybeIdx
[
0
]
,
maybeIdx
[
1
]
));
groupBad
.
HeatIdx0
,
groupBad
.
HeatIdx1
));
mHeatCell
.
HeatApply
();
counter
=
1
;
...
...
@@ -397,80 +521,69 @@ namespace FLY.FeedbackRenZiJia.Server
}
else
//3秒后
{
var
groupBad
=
groupBads
[
groupIdx
];
if
(!
HasElectricity
)
//没电流,肯定是坏了
{
if
(
HalfIdx
<
0
)
//还没有一个 "肯定是好的,只是电流不够的加热棒"
if
(
!
groupBad
.
HasGood
)
//还没找到好的加热棒
{
maybeIdx
.
RemoveRange
(
0
,
2
);
//之前测试的两条肯定是坏的,不用再查了(这个有bug的)
if
(
maybeIdx
.
Count
()
<=
1
)
//继续
if
(!
GetCheckIdx_2_loop
(
groupIdx
,
groupBad
.
NextCheckIdx
))
{
//
只剩下一个,没法检测
结束
//
没有两条同一组,测试
结束
Enable
=
false
;
//停止检测
return
;
}
}
else
else
{
//checkIdx1是坏的
groupBad
.
PushToHasCheck
();
//获取下一个需要测试的
if
(!
groupBad
.
GetNextIdx
())
{
//已经有 好的!!!, 刚才测的那条肯定是坏的
maybeIdx
.
RemoveAt
(
0
);
if
(
maybeIdx
.
Count
()
==
0
)
//这个分组已经查完,下一个分组
groupIdx
++;
if
(!
GetCheckIdx_2_loop
(
groupIdx
,
0
))
{
//全部检测完了
//没有两条同一组,测试结束
Enable
=
false
;
//停止检测
return
;
}
}
CheckNo
=
maybeIdx
[
0
]
+
1
;
int
idx1
=
(
HalfIdx
>=
0
)
?
HalfIdx
:
maybeIdx
[
1
];
mHeatCell
.
ModifyPreHeats
(
getSingleHeat_100
(
mHeatCell
.
ChannelCnt
,
maybeIdx
[
0
],
idx1
));
mHeatCell
.
HeatApply
();
counter
=
1
;
}
else
{
//刚才测量的是好的!!!!!
if
(
HalfIdx
<
0
)
//还没有一个 "肯定是好的,只是电流不够的加热棒"
{
Bads
[
maybeIdx
[
0
]]
=
false
;
//清除坏的记录
Bads
[
maybeIdx
[
1
]]
=
false
;
HalfIdx
=
maybeIdx
[
0
];
//登记其中一条好的加热棒
maybeIdx
.
RemoveRange
(
0
,
2
);
}
else
{
Bads
[
maybeIdx
[
0
]]
=
false
;
//清除坏的记录
maybeIdx
.
RemoveAt
(
0
);
}
NotifyPropertyChanged
(
"Bads"
);
//刚才测量的是好的!!!!!只是电流不够的加热棒
groupBad
.
MarkGoodIdx
();
//找到好的加热棒了,这个组的加热棒全部测试一次
groupBad
.
PushToHasCheck
();
Bads
[
groupBad
.
HeatIdx0
]
=
false
;
//清除坏的记录
Bads
[
groupBad
.
HeatIdx1
]
=
false
;
NotifyPropertyChanged
(
nameof
(
Bads
));
OpenCircuit
=
Bads
.
Any
(
b
=>
b
);
if
(
maybeIdx
.
Count
()
<=
0
)
//获取下一个需要测试的
if
(!
groupBad
.
GetNextIdx
())
{
//一个都不剩,完成
//这个分组已经查完,下一个分组
groupIdx
++;
if
(!
GetCheckIdx_2_loop
(
groupIdx
,
0
))
{
//没有两条同一组,测试结束
Enable
=
false
;
//停止检测
return
;
}
}
}
CheckNo
=
maybeIdx
[
0
]
+
1
;
groupBad
=
groupBads
[
groupIdx
]
;
CheckNo
=
groupBad
.
HeatIdx1
+
1
;
mHeatCell
.
ModifyPreHeats
(
getSingleHeat_100
(
mHeatCell
.
ChannelCnt
,
maybeIdx
[
0
]
,
HalfIdx
));
groupBad
.
HeatIdx0
,
groupBad
.
HeatIdx1
));
mHeatCell
.
HeatApply
();
counter
=
1
;
}
}
}
break
;
}
...
...
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