Commit 7ee393fd authored by 540597360@qq.com's avatar 540597360@qq.com

用数据ID标识数据

parent 759d1131
......@@ -133,7 +133,8 @@ namespace FLY.HeatingHelper.UI.UIModule
/// </summary>
public void Calculate_From_Class_To_Rxx()
{
int from = _vm.Selected_Idx_From, to = _vm.Selected_Idx_To;
int from = _vm._data.GetIndexFromID(_vm.Selected_Idx_From),
to = _vm._data.GetIndexFromID(_vm.Selected_Idx_To);
_vm.RX = from;
_vm.RY = myChart.AxisY.First().ActualMaxValue;
......@@ -248,7 +249,7 @@ namespace FLY.HeatingHelper.UI.UIModule
public DateTime DataTo { get; set; }
/// <summary>
/// 选择要处理的数据(按Index
/// 选择要处理的数据(按ID
/// </summary>
public int Selected_Idx_From { get; set; }
public int Selected_Idx_To { get; set; }
......@@ -278,9 +279,11 @@ namespace FLY.HeatingHelper.UI.UIModule
{
Selected_Idx_From = from;
Selected_Idx_To = to;
var tmp = _data.GetDateTimeByID(from);
DataFrom = (DateTime)tmp;
tmp = _data.GetDateTimeByID(to);
DataTo = (DateTime)tmp;
Update_Tab1();
DataFrom = Xaxis[Selected_Idx_From];
DataTo = Xaxis[Selected_Idx_To];
}
}
......@@ -296,8 +299,10 @@ namespace FLY.HeatingHelper.UI.UIModule
_selected_class = _sclass;
Selected_Idx_From = from;
Selected_Idx_To = to;
DataFrom = Xaxis[Selected_Idx_From];
DataTo = Xaxis[Selected_Idx_To];
var tmp = _data.GetDateTimeByID(from);
DataFrom = (DateTime)tmp;
tmp = _data.GetDateTimeByID(to);
DataTo = (DateTime)tmp;
return;
}
break;
......
......@@ -71,6 +71,7 @@
<TextBlock Text="锁定设置:"/>
<RadioButton Content="锁定1幅" Grid.Column="1" IsChecked="{Binding LockFrames,Converter={StaticResource lfc},ConverterParameter=1}"/>
<RadioButton Content="锁定2幅" Grid.Column="2" IsChecked="{Binding LockFrames,Converter={StaticResource lfc},ConverterParameter=2}"/>
<RadioButton Content="无锁定" Grid.Column="3" IsChecked="{Binding LockFrames,Converter={StaticResource lfc},ConverterParameter=0}"/>
</Grid>
<Grid DockPanel.Dock="Top">
<ProgressBar Value="{Binding SearchProgressValue}" Width="{Binding ElementName=searchBtn, Path=ActualWidth}"/>
......@@ -94,7 +95,7 @@
<TextBlock Text="{Binding RotAngle,StringFormat={}{0:f1}}" Style="{StaticResource tb_style}"/>
<Button Content="增加" Margin="3,0,0,0" Click="Angle_Add"/>
<Button Content="减少" Margin="3,0,0,0" Click="Angle_Sub"/>
<Button Content="自动试算" Margin="3,0,0,0"/>
<Button Content="搜索旋转角度" Margin="3,0,0,0" Click="Search_Angle"/>
</StackPanel>
<Button Content="应用" DockPanel.Dock="Bottom"/>
</DockPanel>
......
......@@ -88,6 +88,10 @@ namespace FLY.HeatingHelper.UI.UIModule
{
mainVM.Change_Angle(0.5);
}
private void Search_Angle(object sender, RoutedEventArgs e)
{
}
}
public class UC_AirRingShiftViewModel:INotifyPropertyChanged
......@@ -386,6 +390,19 @@ namespace FLY.HeatingHelper.UI.UIModule
}
}
public void SearchAngle()
{
var tmp = _data.SearchMaxSimilarity(_data.GetIndexFromID(vm1.SelectedFrame),
_data.GetIndexFromID(vm2.SelectedFrame), 15, true);
RotAngle = tmp.Item3 + vm1.RotAngle;
TandH_Corel = tmp.Item2;
AirRingShift = tmp.Item1;
int rb = AirRingShift + vm1.ResetBolt;
while (rb >= _data.BoltCnt) rb -= _data.BoltCnt;
while (rb < 0) rb += _data.BoltCnt;
ResetBolt = rb;
}
public void AutoSearchAndCal_Shift()
{
SearchEnabled = false;
......@@ -393,6 +410,12 @@ namespace FLY.HeatingHelper.UI.UIModule
int searchCnt = int.MaxValue;
int start = vm1.MinFrame;
int end = vm1.MaxFrame;
if (LockFrames == 2)
{
SearchAngle();
SearchEnabled = true;
return;
}
if (LockFrames == 1)
{
searchCnt = 1;
......
......@@ -18,7 +18,9 @@ namespace FLY.HeatingHelper.UI.UIModule
public UC_FrameDiffViewModel()
{
}
/// <summary>
/// 两个ID
/// </summary>
public int FrameIdx1 { get; set; } = -1;
public int FrameIdx2 { get; set; } = -1;
public SeriesCollection MySeries { get; set; } = new SeriesCollection();
......
......@@ -266,14 +266,18 @@ namespace FLY.HeatingHelper.UI.UIModule
{
if (SelectedFrame > MinFrame)
{
SelectedFrame--;
var tmp = _data.GetRelativeID(SelectedFrame, -1);
if (tmp >= 0)
SelectedFrame = tmp;
}
});
NxtCmd = new RelayCommand(() =>
{
if (SelectedFrame < MaxFrame)
{
SelectedFrame++;
var tmp = _data.GetRelativeID(SelectedFrame, 1);
if (tmp >= 0)
SelectedFrame = tmp;
}
});
}
......
......@@ -15,11 +15,7 @@ namespace FLY.HeatingHelper
/// </summary>
public interface IThickHeatData : INotifyPropertyChanged
{
bool IsDataReady { get; }
bool BeginUse(bool isAsync = true);
void EndUse();
#region 用于UI的接口
/// <summary>
/// 数据库中存在的数据范围
/// </summary>
......@@ -43,39 +39,17 @@ namespace FLY.HeatingHelper
/// </summary>
int AirRingShift { get; }
/// <summary>
/// MaxHeatVariationIdx1,MaxHeatVariationIdx2指示两幅数据,这两幅数据的加热量变化最大
/// </summary>
int MaxHeatVariationIdx1 { get; }
int MaxHeatVariationIdx2 { get; }
StateCode State { get; }
#endregion
/// <summary>
/// 通知新数据产生
/// </summary>
bool NewDataArrived { set; }
/// <summary>
/// 计算最合适的判断范围,FromTo也可以自行设定,计算DFrom和DTo的值
/// </summary>
//void CalculateFromTo();
/// <summary>
/// 计算加热最大变化量,计算出两个索引值
/// </summary>
int[] CalculateMaxHeatVariation(object _aclass);
int CalculateFromToByClass(int selected_class, ref int from, ref int to);
#region 一些辅助计算的函数
/// <summary>
/// 通过加热变化量和厚度变化量计算加热到厚度的比例系数
/// </summary>
/// <param name="heats">加热变化量</param>
/// <param name="thicks">厚度变化量</param>
/// <returns></returns>
double CalculateHeatToThickFactor(double[] heats, double[] thicks, double thickmean);
/// <summary>
/// 计算两个frame的加热和厚度差的协相关向量。
/// </summary>
double[] CalculateCorrelVector(double[] heats, double[] thicks);
......@@ -84,6 +58,7 @@ namespace FLY.HeatingHelper
#endregion
void SetDB(string dbname);
#region 获取数据接口
/// <summary>
/// 获取厚度和加热的值
/// </summary>
......@@ -100,15 +75,19 @@ namespace FLY.HeatingHelper
List<double> Dat_Sigmas { get; }
List<double> Dat_Means { get; }
int BoltCnt { get; }
int GetIndexFromID(int id);
int GetRelativeID(int id, int relative);
/// <summary>
/// 计算风环偏转值
/// 依据数据ID获取数据时间
/// </summary>
void CalculateAirRingShift();
/// <param name="id"></param>
/// <returns></returns>
DateTime? GetDateTimeByID(int id);
#endregion
int BoltCnt { get; }
double[] HeatEffect { get; set; }
#region 整体分析和局部分析的功能jiekou
List<HeatBoltAnalystItem> SearchFeaturedBoltsItem(int startIdx, int endIdx,
int searchNum, int maxFrameInterval, int heatRating,
int neglectHeatRate, int Separation, int shiftRange);
......@@ -117,6 +96,16 @@ namespace FLY.HeatingHelper
ProgressChangedEventHandler report,
RunWorkerCompletedEventHandler runcomplete,
int midbolt, double searchRange, bool SearchRotAngle, bool isAsync);
/// <summary>
///
/// </summary>
/// <param name="idxL"></param>
/// <param name="idxB"></param>
/// <param name="searchRange"></param>
/// <param name="SearchRotAngle"></param>
/// <returns>返回值:Tuple<偏转数,相关系数,旋转角度变化量></returns>
Tuple<int, double, double> SearchMaxSimilarity(int idxL, int idxB, double searchRange, bool SearchRotAngle);
#endregion
#region 数据库数据变化后自动运行
List<ThickHeatEvent> AutoDetectEvents { get; }
......@@ -129,20 +118,41 @@ namespace FLY.HeatingHelper
/// 搜索旋转角度的范围,例如15,则在当前度数下搜索正负15度
/// </summary>
double SearchingAngle { get; set; }
/// <summary>
/// 该参数设定不参加搜索的数据
/// </summary>
int NotSearchMinFrame { get; set; }
StateCode State { get; }
/// <summary>
/// 检查数据库,当数据库有新数据时,更新DataTo属性,并读取新数据到对象中。该函数可以一定时间间隔执行。
/// </summary>
void RefreshData();
bool IsDataReady { get; }
bool BeginUse(bool isAsync = true);
void EndUse();
#endregion
}
public enum StateCode
{
STC_NODAT, // 没有数据
STC_IDLE, // 空闲
STC_READING, // 读取数据
STC_UPDATING // 检查新数据
}
#region 厚度加热数据自动处理结果事件
public class ThickHeatEvent
{
public ThickHeatEventCode EvtCode;
public object EvtData;
}
public enum ThickHeatEventCode
{
EVC_RingShift,
EVC_HeatBoltItem,
}
public class MaxSimilarityResult
{
public int frameIdx1;
......@@ -153,14 +163,6 @@ namespace FLY.HeatingHelper
public double ThickToHeatFactor;
}
public enum StateCode
{
STC_NODAT, // 没有数据
STC_IDLE, // 空闲
STC_READING, // 读取数据
STC_UPDATING // 检查新数据
}
public class HeatBoltAnalystItem
{
public int FrameIdx1 { get; set; }
......@@ -183,28 +185,6 @@ namespace FLY.HeatingHelper
Similarity = from.Similarity;
}
}
#region 厚度加热数据自动处理结果事件
public enum ThickHeatEventCode
{
EVC_RingShift,
EVC_HeatBoltItem,
}
public class EVTD_RingShift
{
public int frameIdx1;
public int frameIdx2;
public double shifted;
public double degree;
public double similarity;
}
public class ThickHeatEvent
{
public ThickHeatEventCode EvtCode;
public object EvtData;
}
#endregion
#region DataHelper
......
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