Commit bd869878 authored by LiGuohua's avatar LiGuohua

Bugs

parent 9cd5e4f1
...@@ -489,6 +489,8 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -489,6 +489,8 @@ namespace FLY.HeatingHelper.UI.UiModule
int end = vm1.MaxFrame; int end = vm1.MaxFrame;
if (LockFrames == 2) if (LockFrames == 2)
{ {
int idx1 = vm1.SelectedFrame;
int idx2 = vm2.SelectedFrame;
if (!LockAngle) SearchAngle(); if (!LockAngle) SearchAngle();
else else
{ {
...@@ -497,6 +499,15 @@ namespace FLY.HeatingHelper.UI.UiModule ...@@ -497,6 +499,15 @@ namespace FLY.HeatingHelper.UI.UiModule
NewResetBolt = tmp.Item1; NewResetBolt = tmp.Item1;
TandH_Corel = tmp.Item2; TandH_Corel = tmp.Item2;
} }
var heat = DataHelper.VectorSub(_data.GetHeatsByIndex(idx1, -1, -1),
_data.GetHeatsByIndex(idx2, -1, -1));
var t1 = _data.GetThicksByIndex(idx1, NewResetBolt, double.MaxValue);
var th = DataHelper.VectorSub(_data.GetThicksByIndex(idx2, NewResetBolt, double.MaxValue), t1);
Kp = _data.CalculateHeatToThickFactor(heat, th, Misc.MyMath.Avg(t1));
//double b;
//double a;
//Misc.MyMath.Linest(heat, th, out a, out b);
//Kp = a;
SearchEnabled = true; SearchEnabled = true;
UpdateVarChart(); UpdateVarChart();
return; return;
......
...@@ -135,6 +135,8 @@ namespace FLY.HeatingHelper ...@@ -135,6 +135,8 @@ namespace FLY.HeatingHelper
/// <param name="SearchRotAngle"></param> /// <param name="SearchRotAngle"></param>
/// <returns>返回值:Tuple<偏转数,相关系数,旋转角度变化量></returns> /// <returns>返回值:Tuple<偏转数,相关系数,旋转角度变化量></returns>
Tuple<int, double, double> SearchMaxSimilarity(int idxL, int idxB, double searchRange, bool SearchRotAngle); Tuple<int, double, double> SearchMaxSimilarity(int idxL, int idxB, double searchRange, bool SearchRotAngle);
double CalculateHeatToThickFactor(double[] heats, double[] thicks, double thickmean);
#endregion #endregion
#region 数据处理-数据分类接口 #region 数据处理-数据分类接口
......
...@@ -751,7 +751,7 @@ namespace FLY.HeatingHelper ...@@ -751,7 +751,7 @@ namespace FLY.HeatingHelper
/// <param name="thicks">厚度变化量</param> /// <param name="thicks">厚度变化量</param>
/// <param name="thickmean">厚度均值</param> /// <param name="thickmean">厚度均值</param>
/// <returns></returns> /// <returns></returns>
private double CalculateHeatToThickFactor(double[] heats, double[] thicks, double thickmean) public double CalculateHeatToThickFactor(double[] heats, double[] thicks, double thickmean)
{ {
int cnt = thicks.Count(); int cnt = thicks.Count();
if (cnt < 2) return double.NaN; if (cnt < 2) return double.NaN;
...@@ -774,14 +774,15 @@ namespace FLY.HeatingHelper ...@@ -774,14 +774,15 @@ namespace FLY.HeatingHelper
// Step 3 // Step 3
for (i = 0; i < t.Count; i++) for (i = 0; i < t.Count; i++)
{ {
if (h[i] < 5) h[i] = 0; if (Math.Abs(h[i]) < 5) h[i] = 0;
} }
// Step 4 // Step 4
if (h.Count() <= 0) return double.NaN;
var hh = EffectFilter(h.ToArray()); var hh = EffectFilter(h.ToArray());
// step 5 // step 5
for (i = 0; i < hh.Count(); i++) for (i = 0; i < hh.Count(); i++)
{ {
if (hh[i] < 0.001) t[i] = 0; if (Math.Abs(hh[i]) < 0.001) t[i] = 0;
} }
// step 6 // step 6
double sumt = 0, sumh = 0; double sumt = 0, sumh = 0;
...@@ -792,6 +793,7 @@ namespace FLY.HeatingHelper ...@@ -792,6 +793,7 @@ namespace FLY.HeatingHelper
} }
// Step 7 // Step 7
if (sumt < 0.001) return double.NaN;
return sumh / (sumt * 100 / thickmean); return sumh / (sumt * 100 / thickmean);
} }
...@@ -1321,7 +1323,7 @@ namespace FLY.HeatingHelper ...@@ -1321,7 +1323,7 @@ namespace FLY.HeatingHelper
double maxcorel = -100; double maxcorel = -100;
int theshift = 0; int theshift = 0;
int idx1 = fmin, idx2 = fmax; int idx1 = fmin, idx2 = fmax;
double deltaAngle = 0; double deltaAngle = _rotAngles[fmax];
double factor = 1; double factor = 1;
if (midbolt == int.MaxValue) if (midbolt == int.MaxValue)
{ {
...@@ -1355,12 +1357,14 @@ namespace FLY.HeatingHelper ...@@ -1355,12 +1357,14 @@ namespace FLY.HeatingHelper
result.frameShift = theshift; result.frameShift = theshift;
result.similarity = maxcorel; result.similarity = maxcorel;
result.deltaAngle = deltaAngle; result.deltaAngle = deltaAngle;
var angle = GetRotAngleByIndex(idx1) + deltaAngle;
var heat = DataHelper.VectorSub(GetHeatsByIndex(idx1, -1, -1), GetHeatsByIndex(idx2, -1, -1)); var heat = DataHelper.VectorSub(GetHeatsByIndex(idx1, -1, -1), GetHeatsByIndex(idx2, -1, -1));
var t1 = GetThicksByIndex(idx1, 1, angle); var t1 = GetThicksByIndex(idx1, theshift, deltaAngle);
var th = DataHelper.VectorSub(GetThicksByIndex(idx2, 1, angle), t1); var th = DataHelper.VectorSub(GetThicksByIndex(idx2, theshift, deltaAngle), t1);
result.ThickToHeatFactor = CalculateHeatToThickFactor(heat, th, result.ThickToHeatFactor = CalculateHeatToThickFactor(heat, th, Misc.MyMath.Avg(t1));
MathNet.Numerics.Statistics.Statistics.Mean(t1)); //double b;
//double a;
//Misc.MyMath.Linest(heat, th, out a, out b);
//result.ThickToHeatFactor = a;
}); });
if (report != null) if (report != null)
{ {
...@@ -1394,7 +1398,7 @@ namespace FLY.HeatingHelper ...@@ -1394,7 +1398,7 @@ namespace FLY.HeatingHelper
{ {
double maxcorel = double.MinValue; double maxcorel = double.MinValue;
int theshift = 0; int theshift = 0;
double deltaAngle = 0; double deltaAngle = _rotAngles[idxB];
if (idxL > idxB) if (idxL > idxB)
{ {
var tmp = idxL; var tmp = idxL;
......
Subproject commit 3af52b4745114d8237751a4dc1db4d97eac42da2 Subproject commit 78c4f7f65edf7dda0b64ebf5d5cfcca10b6611ab
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