Commit 3057f45c authored by 潘栩锋's avatar 潘栩锋 🚴

修复 程序刚开机,HeatThickDetector 不会显示上一次的计算结果

parent 0a9653b5
...@@ -48,7 +48,7 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -48,7 +48,7 @@ namespace FLY.HeatingHelper.UI.UiModule
NavigationService ns = Application.Current.Properties["NavigationService"] as NavigationService; NavigationService ns = Application.Current.Properties["NavigationService"] as NavigationService;
if (ns != null) if (ns != null)
{ {
if(vm._dat.BeginUse()) if(vm.dat.BeginUse())
{ {
Page_HeatDetector page = new Page_HeatDetector(); Page_HeatDetector page = new Page_HeatDetector();
container.BuildUp(page); container.BuildUp(page);
......
...@@ -10,28 +10,35 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -10,28 +10,35 @@ namespace FLY.HeatingHelper.UI.UiModule
{ {
public class ViewModel_HeatThickDetector : INotifyPropertyChanged public class ViewModel_HeatThickDetector : INotifyPropertyChanged
{ {
public IThickHeatData _dat; public IThickHeatData dat;
public IThickHeatData Dat public IThickHeatData Dat
{ {
get get
{ {
return _dat; return dat;
} }
set set
{ {
_dat = value; dat = value;
} }
} }
public ViewModel_HeatThickDetector(FLY.Thick.Blowing.IService.IBlowingService blowing, IThickHeatData dat) public ViewModel_HeatThickDetector(FLY.Thick.Blowing.IService.IBlowingService blowing, IThickHeatData dat)
{ {
_dat = dat; this.dat = dat;
Misc.BindingOperations.SetBinding(dat, "NewResetBolt", this, "NewResetBolt"); Misc.BindingOperations.SetBinding(dat, "NewResetBolt", this, "NewResetBolt");
Misc.BindingOperations.SetBinding(blowing, "OrgBoltNo", () => Misc.BindingOperations.SetBinding(blowing, "OrgBoltNo", () =>
{ {
CurrentResetBolt = blowing.OrgBoltNo; CurrentResetBolt = blowing.OrgBoltNo;
if (this.dat.OldResetBolt == 0)
{
//刚开机
NewResetBolt = CurrentResetBolt; NewResetBolt = CurrentResetBolt;
}
else if (CurrentResetBolt != this.dat.OldResetBolt)
{
NewResetBolt = CurrentResetBolt;
}
}); });
IsDifferent = (CurrentResetBolt != NewResetBolt); IsDifferent = (CurrentResetBolt != NewResetBolt);
...@@ -55,8 +62,8 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -55,8 +62,8 @@ namespace FLY.HeatingHelper.UI.UiModule
{ {
get get
{ {
if (_dat == null) return false; if (dat == null) return false;
if (_dat.TotalDataFrom != DateTime.MinValue) return true; if (dat.TotalDataFrom != DateTime.MinValue) return true;
return false; return false;
} }
} }
......
...@@ -62,9 +62,13 @@ namespace FLY.HeatingHelper ...@@ -62,9 +62,13 @@ namespace FLY.HeatingHelper
/// <summary> /// <summary>
/// 风环偏差值 /// 新计算得到的风环复位区号
/// </summary> /// </summary>
int NewResetBolt { get; } int NewResetBolt { get; }
/// <summary>
/// 原始风环复位区号
/// </summary>
int OldResetBolt { get; }
StateCode State { get; } StateCode State { get; }
...@@ -214,11 +218,33 @@ namespace FLY.HeatingHelper ...@@ -214,11 +218,33 @@ namespace FLY.HeatingHelper
public class MaxSimilarityResult public class MaxSimilarityResult
{ {
/// <summary>
/// 第一幅图
/// </summary>
public int frameIdx1; public int frameIdx1;
/// <summary>
/// 第二幅图
/// </summary>
public int frameIdx2; public int frameIdx2;
/// <summary>
/// 正确的复位区号
/// </summary>
public int frameShift; public int frameShift;
/// <summary>
/// 原始的复位区号
/// </summary>
public int oldOrgBolt;
/// <summary>
/// 相关性
/// </summary>
public double similarity; public double similarity;
/// <summary>
/// 正确的旋转角度
/// </summary>
public double deltaAngle; public double deltaAngle;
/// <summary>
/// 正确的Kp
/// </summary>
public double ThickToHeatFactor; public double ThickToHeatFactor;
} }
......
...@@ -186,6 +186,7 @@ namespace FLY.HeatingHelper ...@@ -186,6 +186,7 @@ namespace FLY.HeatingHelper
#endregion #endregion
public int NewResetBolt { get; internal set; } = 0; public int NewResetBolt { get; internal set; } = 0;
public int OldResetBolt { get; private set; } = 0;
public bool BeginUse(bool isAsync = true) public bool BeginUse(bool isAsync = true)
{ {
...@@ -214,6 +215,7 @@ namespace FLY.HeatingHelper ...@@ -214,6 +215,7 @@ namespace FLY.HeatingHelper
if (ms.similarity > 0.7) if (ms.similarity > 0.7)
{ {
NewResetBolt = ms.frameShift; NewResetBolt = ms.frameShift;
OldResetBolt = ms.oldOrgBolt;
} }
} }
...@@ -1354,6 +1356,7 @@ namespace FLY.HeatingHelper ...@@ -1354,6 +1356,7 @@ namespace FLY.HeatingHelper
} }
result.frameIdx1 = idx1; result.frameIdx1 = idx1;
result.frameIdx2 = idx2; result.frameIdx2 = idx2;
result.oldOrgBolt = GetResetBoltByIndex(idx2);
result.frameShift = theshift; result.frameShift = theshift;
result.similarity = maxcorel; result.similarity = maxcorel;
result.deltaAngle = deltaAngle; result.deltaAngle = deltaAngle;
......
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