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

修复 修复一系列bug

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