Commit f3f9babb authored by 潘栩锋's avatar 潘栩锋 🚴

修复 修复一系列bug

parent cc0ba723
...@@ -38,11 +38,11 @@ ...@@ -38,11 +38,11 @@
<TextBlock Style="{StaticResource Styles.TitleBar.Text}" Text="对位分析"/> <TextBlock Style="{StaticResource Styles.TitleBar.Text}" Text="对位分析"/>
<StackPanel> <StackPanel>
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="有效数据" Foreground="LightGray"/> <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="有效数据" Foreground="LightGray"/>
<ToggleButton Style="{StaticResource CheckStyle}" HorizontalAlignment="Left" IsChecked="{Binding IsMoveByTakeEffect}" Width="30" Height="auto" Foreground="White" Background="#02FFFFFF" /> <ToggleButton Style="{StaticResource CheckStyle}" HorizontalAlignment="Left" IsChecked="{Binding IsMoveByTakeEffect}" Width="30" Height="auto" Foreground="White" Background="#02FFFFFF" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="模头改变" Foreground="LightGray"/> <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="模头改变" Foreground="LightGray"/>
<ToggleButton Style="{StaticResource CheckStyle}" HorizontalAlignment="Left" IsChecked="{Binding IsMoveByDiffCTime}" Width="30" Height="auto" Foreground="White" Background="#02FFFFFF" /> <ToggleButton Style="{StaticResource CheckStyle}" HorizontalAlignment="Left" IsChecked="{Binding IsMoveByDiffCTime}" Width="30" Height="auto" Foreground="White" Background="#02FFFFFF" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
......
...@@ -30,7 +30,7 @@ namespace FLY.FilmCasting.AutoDie.IService ...@@ -30,7 +30,7 @@ namespace FLY.FilmCasting.AutoDie.IService
int StableRange { get; set; } int StableRange { get; set; }
/// <summary> /// <summary>
/// 对位模式, 加热与厚度相关性阀值, 相关性 >=0.7 /// 加热与厚度相关性阀值, 相关性 >=0.8
/// </summary> /// </summary>
double ThresholdR { get; set; } double ThresholdR { get; set; }
......
...@@ -39,7 +39,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -39,7 +39,7 @@ namespace FLY.FilmCasting.AutoDie.Server
#endregion #endregion
#region 状态 #region 状态
bool IsConected { get; } bool IsConnected { get; }
#endregion #endregion
} }
......
...@@ -163,9 +163,6 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -163,9 +163,6 @@ namespace FLY.FilmCasting.AutoDie.Server
{ {
if (!Load()) if (!Load())
Save(); Save();
} }
......
...@@ -35,7 +35,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -35,7 +35,7 @@ namespace FLY.FilmCasting.AutoDie.Server
/// <summary> /// <summary>
/// 加热生效曲线,允许为空,则不生效 /// 加热生效曲线,允许为空,则不生效
/// </summary> /// </summary>
public int[] HeatEffectCurve { get; set; } = new int[] { 3, 4, 5, 6, 5, 4, 3 }; public int[] HeatEffectCurve { get; set; } = new int[] { 3, 4, 7, 4, 3 };
/// <summary> /// <summary>
......
...@@ -30,6 +30,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -30,6 +30,7 @@ namespace FLY.FilmCasting.AutoDie.Server
/// 测厚仪厚度数据混合数 /// 测厚仪厚度数据混合数
/// </summary> /// </summary>
public int Mix { get; set; } = 3; public int Mix { get; set; } = 3;
/// <summary> /// <summary>
/// 平滑的阀值,只有超出阀值,才平滑 /// 平滑的阀值,只有超出阀值,才平滑
/// </summary> /// </summary>
...@@ -220,9 +221,11 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -220,9 +221,11 @@ namespace FLY.FilmCasting.AutoDie.Server
} }
void create_thickPercentTargets(double centerTarget, int dataBegin, int dataEnd) void create_thickPercentTargets(double centerTarget, int dataBegin, int dataEnd)
{ {
if (this.centerTarget == centerTarget && this.dataBegin == dataBegin && this.dataEnd == dataEnd)
return;
if (centerTarget == 0) if (centerTarget == 0)
{ {
thickPercentTargets = new double[ChannelCnt]; this.thickPercentTargets = new double[ChannelCnt];
this.centerTarget = 0; this.centerTarget = 0;
this.dataBegin = 0; this.dataBegin = 0;
this.dataEnd = ChannelCnt - 1; this.dataEnd = ChannelCnt - 1;
...@@ -263,19 +266,8 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -263,19 +266,8 @@ namespace FLY.FilmCasting.AutoDie.Server
if (mHeatBuf.Stability != STABILITY.OK_CORREL)//稳定 与 待定时 加热 if (mHeatBuf.Stability != STABILITY.OK_CORREL)//稳定 与 待定时 加热
return; return;
double ctrlLine = CtrlLine;
if (IsLvCtrlLinesValid()) double ctrlLine = getCtrlLine(thickPercentsCollection.Count());
{
for (int i = 0; i < LvCtrlLines.Count(); i++)
{
int index = LvCtrlLines.Count() - 1 - i;
if( thickPercentsCollection.Count() >= LvCtrlLines[index].Mix)
{
ctrlLine = LvCtrlLines[index].CtrlLine;
break;
}
}
}
//转为 加热棒数量 //转为 加热棒数量
var thickPercents = ThickPercents; var thickPercents = ThickPercents;
...@@ -286,6 +278,21 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -286,6 +278,21 @@ namespace FLY.FilmCasting.AutoDie.Server
if (!double.IsNaN(thickPercents[i]) && !double.IsNaN(thickPercentTargets[i])) if (!double.IsNaN(thickPercents[i]) && !double.IsNaN(thickPercentTargets[i]))
{ {
double delta = (thickPercents[i] - thickPercentTargets[i]); double delta = (thickPercents[i] - thickPercentTargets[i]);
offsets[i] = calOffset(delta, ctrlLine, Kp);
}
}
Offsets = offsets;
UpdatePreHeats();//这句一定要加!!!! 不然没法平滑,没法加热
if (!IsForbidUpDown)//禁止整体上移下降
ModifyBase();//自动整体上移下降
Smooth();//平滑,它会导致Offset被修改,<0的都被删除掉
HeatApply();//执行加热
}
double calOffset(double delta, double ctrlLine, double kp)
{
double d = Math.Abs(delta); double d = Math.Abs(delta);
if (d >= ctrlLine) if (d >= ctrlLine)
...@@ -304,22 +311,26 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -304,22 +311,26 @@ namespace FLY.FilmCasting.AutoDie.Server
{ {
d = 0; d = 0;
} }
double offset = d * Kp; double offset = d * kp;
offsets[i] = delta >= 0 ? offset : -offset; return delta >= 0 ? offset : -offset;
}
double getCtrlLine(int currMix)
{
double ctrlLine = CtrlLine;
if (IsLvCtrlLinesValid())
{
for (int i = 0; i < LvCtrlLines.Count(); i++)
{
int index = LvCtrlLines.Count() - 1 - i;
if (currMix >= LvCtrlLines[index].Mix)
{
ctrlLine = LvCtrlLines[index].CtrlLine;
break;
}
} }
} }
Offsets = offsets; return ctrlLine;
UpdatePreHeats();//这句一定要加!!!! 不然没法平滑,没法加热
if (!IsForbidUpDown)//禁止整体上移下降
ModifyBase();//自动整体上移下降
Smooth();//平滑,它会导致Offset被修改,<0的都被删除掉
HeatApply();//执行加热
} }
public void SetThickPercents(double[] thkpercents) public void SetThickPercents(double[] thkpercents)
{ {
var thkPercents = thkpercents.ToArray(); var thkPercents = thkpercents.ToArray();
......
...@@ -54,7 +54,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -54,7 +54,7 @@ namespace FLY.FilmCasting.AutoDie.Server
/// </summary> /// </summary>
public UInt16 HeatUpdate_R { get; private set; } public UInt16 HeatUpdate_R { get; private set; }
public bool IsConected { get; private set; } public bool IsConnected { get; private set; }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
...@@ -91,7 +91,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -91,7 +91,7 @@ namespace FLY.FilmCasting.AutoDie.Server
public void SetChannelCnt(UInt16 channelCnt) public void SetChannelCnt(UInt16 channelCnt)
{ {
if (!IsConected) if (!IsConnected)
return; return;
//D200 4x201 通道数量 //D200 4x201 通道数量
...@@ -103,7 +103,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -103,7 +103,7 @@ namespace FLY.FilmCasting.AutoDie.Server
} }
public void SetHeatUpdate(UInt16 heatUpdate) public void SetHeatUpdate(UInt16 heatUpdate)
{ {
if (!IsConected) if (!IsConnected)
return; return;
//D201 4x202 设置值 更新 //D201 4x202 设置值 更新
...@@ -184,7 +184,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -184,7 +184,7 @@ namespace FLY.FilmCasting.AutoDie.Server
goto _error;//连接断开,终止更新线程 goto _error;//连接断开,终止更新线程
} }
IsConected = true; IsConnected = true;
} }
//输出写入数据 //输出写入数据
...@@ -200,13 +200,13 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -200,13 +200,13 @@ namespace FLY.FilmCasting.AutoDie.Server
} }
_error: _error:
IsConected = false; IsConnected = false;
ErrorCnt++; ErrorCnt++;
goto _connect; goto _connect;
_end: _end:
mclient.Close(); mclient.Close();
IsConected = true; IsConnected = true;
IsRunning = false; IsRunning = false;
} }
...@@ -258,7 +258,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -258,7 +258,7 @@ namespace FLY.FilmCasting.AutoDie.Server
/// <param name="values"></param> /// <param name="values"></param>
public void SetHeat(IEnumerable<UInt16> values) public void SetHeat(IEnumerable<UInt16> values)
{ {
if (!IsConected) if (!IsConnected)
return; return;
UInt16[] buf = values.ToArray(); UInt16[] buf = values.ToArray();
......
...@@ -54,7 +54,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -54,7 +54,7 @@ namespace FLY.FilmCasting.AutoDie.Server
{ {
this.plcLink = plcLink; this.plcLink = plcLink;
Misc.BindingOperations.SetBinding(plcLink, nameof(plcLink.IsConected), this, nameof(IsConected)); Misc.BindingOperations.SetBinding(plcLink, nameof(plcLink.IsConnected), this, nameof(IsConected));
Misc.BindingOperations.SetBinding(plcLink, nameof(plcLink.HasElectricity), this, nameof(HasElectricity)); Misc.BindingOperations.SetBinding(plcLink, nameof(plcLink.HasElectricity), this, nameof(HasElectricity));
Misc.BindingOperations.SetBinding(plcLink, nameof(plcLink.HasFan), this, nameof(HasFan)); Misc.BindingOperations.SetBinding(plcLink, nameof(plcLink.HasFan), this, nameof(HasFan));
...@@ -67,7 +67,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -67,7 +67,7 @@ namespace FLY.FilmCasting.AutoDie.Server
stopwatch = new Stopwatch(); stopwatch = new Stopwatch();
if (plcLink.IsConected) if (plcLink.IsConnected)
{ {
//刚连上,把 之前的数据都重新发给它。 //刚连上,把 之前的数据都重新发给它。
plcLink.SetChannelCnt((UInt16)channelCnt); plcLink.SetChannelCnt((UInt16)channelCnt);
...@@ -89,7 +89,7 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -89,7 +89,7 @@ namespace FLY.FilmCasting.AutoDie.Server
} }
void setHeats() void setHeats()
{ {
if (!plcLink.IsConected) if (!plcLink.IsConnected)
return; return;
UInt16[] plcHeats = heats.Select(h => { UInt16[] plcHeats = heats.Select(h => {
...@@ -129,9 +129,9 @@ namespace FLY.FilmCasting.AutoDie.Server ...@@ -129,9 +129,9 @@ namespace FLY.FilmCasting.AutoDie.Server
private void PlcLinkExt_PropertyChanged(object sender, PropertyChangedEventArgs e) private void PlcLinkExt_PropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
if (e.PropertyName == nameof(plcLink.IsConected)) if (e.PropertyName == nameof(plcLink.IsConnected))
{ {
if (plcLink.IsConected) if (plcLink.IsConnected)
{ {
//刚连上,把 之前的数据都重新发给它。 //刚连上,把 之前的数据都重新发给它。
plcLink.SetChannelCnt((UInt16)channelCnt); plcLink.SetChannelCnt((UInt16)channelCnt);
......
...@@ -51,6 +51,6 @@ using System.Windows; ...@@ -51,6 +51,6 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.5.7.0")] [assembly: AssemblyVersion("7.5.8.0")]
[assembly: AssemblyFileVersion("7.5.7.0")] [assembly: AssemblyFileVersion("7.5.8.0")]
[assembly: Guid("BD20A921-953E-44CA-8FAB-4619D3CBCD06")] [assembly: Guid("BD20A921-953E-44CA-8FAB-4619D3CBCD06")]
...@@ -51,6 +51,6 @@ using System.Windows; ...@@ -51,6 +51,6 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.3.6")] [assembly: AssemblyVersion("7.3.7")]
[assembly: AssemblyFileVersion("7.3.6")] [assembly: AssemblyFileVersion("7.3.7")]
[assembly: Guid("E7D930E0-C871-4001-A31A-DC748ED5817C")] [assembly: Guid("E7D930E0-C871-4001-A31A-DC748ED5817C")]
...@@ -51,11 +51,15 @@ namespace FLY.Thick.FilmCasting.Server ...@@ -51,11 +51,15 @@ namespace FLY.Thick.FilmCasting.Server
Idle, Idle,
Warning Warning
} }
public CheckResult Check(double[] data) public CheckResult Check(double[] data, int dataBeginIdx, int dataEndIdx)
{ {
int cnt = 0; int cnt = 0;
for (int i = 0; i < data.Length; i++) for (int i = dataBeginIdx; i < dataEndIdx; i++)
{ {
if (i >= data.Count())
break;
if (i < 0)
continue;
double d = data[i]; double d = data[i];
if (double.IsNaN(d)) if (double.IsNaN(d))
{ {
...@@ -141,7 +145,7 @@ namespace FLY.Thick.FilmCasting.Server ...@@ -141,7 +145,7 @@ namespace FLY.Thick.FilmCasting.Server
if (reponse.scanData != null && reponse.scanData.Thicks.Count() > 0) if (reponse.scanData != null && reponse.scanData.Thicks.Count() > 0)
{ {
lc_ScanData = reponse.scanData; lc_ScanData = reponse.scanData;
result = Check(lc_ScanData.Thicks); result = Check(lc_ScanData.Thicks,lc_ScanData.DataBegin, lc_ScanData.DataEnd);
} }
else else
{ {
......
...@@ -74,7 +74,8 @@ src_dir="../Project.FLY.Thick.FilmCasting/FLY.Thick.FilmCasting.UI.Client" ...@@ -74,7 +74,8 @@ src_dir="../Project.FLY.Thick.FilmCasting/FLY.Thick.FilmCasting.UI.Client"
dest_dir="FLY.Thick.FilmCasting.UI.Client" dest_dir="FLY.Thick.FilmCasting.UI.Client"
files=(\ files=(\
"FLY.Thick.FilmCasting.UI.Client.exe" \ "FLY.Thick.FilmCasting.UI.Client.exe" \
"default" "unity" "layout" "music" "update"\ "default" "unity" "layout" "music" "update" \
"paramDict.json" \
"nlog.config" \ "nlog.config" \
) )
copy_to2 $src_dir $dest_dir $files copy_to2 $src_dir $dest_dir $files
......
{ {
"InstallZipVersion":"7.5.7", "InstallZipVersion":"7.5.9",
"InstallZipUrl":"http://server.flyautomation.net:8889/download/流延测厚仪安装包_v7.5.7_20220510.7z" "InstallZipUrl":"http://server.flyautomation.net:8889/download/流延测厚仪安装包_v7.5.9_20220624.7z"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment