Commit 5ef06c8a authored by 潘栩锋's avatar 潘栩锋 🚴

扫描测厚仪,自动对位测试完成

parent 44122ef8
......@@ -86,10 +86,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PgHeatAnalyse\PgHeatAnalyseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PgHeatAnalyse\UcThickHeat.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -118,10 +114,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PgHeatList.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PgMenu.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -149,7 +141,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Converter\IPEPConverter.cs" />
<Compile Include="HeatListHelper.cs" />
<Compile Include="PgHeatAnalyse\PgHeatAnalyse.xaml.cs">
<DependentUpon>PgHeatAnalyse.xaml</DependentUpon>
</Compile>
......@@ -176,9 +167,6 @@
<Compile Include="UiModule\DynAreaAirRing.xaml.cs">
<DependentUpon>DynAreaAirRing.xaml</DependentUpon>
</Compile>
<Compile Include="PgHeatList.xaml.cs">
<DependentUpon>PgHeatList.xaml</DependentUpon>
</Compile>
<Compile Include="PgMenu.xaml.cs">
<DependentUpon>PgMenu.xaml</DependentUpon>
</Compile>
......
......@@ -19,7 +19,7 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.FeedbackRenZiJia.UI.Client;component/PgHeatAnalyse/PgHeatAnalyseStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.FeedbackRenZiJia.UI.Client;component/Themes/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<sys:Boolean x:Key="False">False</sys:Boolean>
<local:HeatEffectConverter x:Key="heconv"/>
......
......@@ -47,5 +47,11 @@ namespace FLY.FeedbackRenZiJia.UI.Client
this.DataContext = viewModel;
}
public void SetNumber(long number0, long number1)
{
viewModel.ucThickHeatVms[0].Number = number0;
viewModel.ucThickHeatVms[1].Number = number1;
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Themes/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.FeedbackRenZiJia.UI.Client;component/Themes/Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="Button.AccentedSquare2" TargetType="Button" BasedOn="{StaticResource AccentedSquareButtonStyle}">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="5"/>
</Style>
<Style x:Key="Button.Square2" TargetType="Button" BasedOn="{StaticResource SquareButtonStyle}">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="5"/>
</Style>
<Style x:Key="Button.HighlightedSquare2" TargetType="Button" BasedOn="{StaticResource HighlightedSquareButtonStyle}">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="5"/>
</Style>
<DropShadowEffect x:Key="Card.Shadow" Color="#303030" Opacity=".25" BlurRadius="5" ShadowDepth="3"/>
<Style x:Key="Card.Title" TargetType="TextBlock">
<Setter Property="Background" Value="#FFC107"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Padding" Value="20 5"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style x:Key="Card.Border" TargetType="Border">
<Setter Property="Margin" Value="5"/>
<Setter Property="Background" Value="White"/>
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#EBEBEB"/>
<Setter Property="Effect" Value="{StaticResource Card.Shadow}"/>
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeader}" x:Key="Text.FieldHeader2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}" x:Key="Text.FieldHeaderEditable2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}" x:Key="Text.FieldHeaderEditable"/>
<Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle_FieldContent}" x:Key="Text.FieldContentInput">
<Setter Property="Background" Value="WhiteSmoke"/>
</Style>
<Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle_FieldContent}" x:Key="Text.FieldContentInput2">
<Setter Property="FontSize" Value="20" />
<Setter Property="Background" Value="WhiteSmoke"/>
<Setter Property="MinWidth" Value="100"/>
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent}" x:Key="Text.FieldContent2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent}" x:Key="Text.FieldContent"/>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent_mm}" x:Key="Text.FieldContentMm"/>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent_mm_interval}" x:Key="Text.FieldContentMmInterval"/>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent_mm}" x:Key="Text.FieldContentMm2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style x:Key="AxisSectionStyle" TargetType="lvc:AxisSection" >
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="DataLabel" Value="True"/>
<Setter Property="DisableAnimations" Value="True"/>
<Setter Property="DataLabelForeground" Value="White"/>
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Panel.ZIndex" Value="1"/>
</Style>
<SolidColorBrush x:Key="Badges.Background">#99FFFFFF</SolidColorBrush>
<Thickness x:Key="Badges.Margin">2.5 0</Thickness>
<SolidColorBrush x:Key="Badges.BlackBackground">#99000000</SolidColorBrush>
<SolidColorBrush x:Key="Badges.BlackForeground">White</SolidColorBrush>
<SolidColorBrush x:Key="Badges.AccentBackground">#99008BE5</SolidColorBrush>
<SolidColorBrush x:Key="Badges.AccentForeground">White</SolidColorBrush>
</ResourceDictionary>
\ No newline at end of file
......@@ -498,20 +498,10 @@ namespace FLY.FeedbackRenZiJia.UI.Client
{
heatBuf.HeatEffectCurve = HeatEffectCurve;
}
if (heatBuf.IsUsedLocalKp)
{
heatBuf.LocalKp = Kp;
}
heatBuf.Apply();
if (!heatBuf.IsUsedLocalKp)
{
heatCell.Kp = Kp;
heatCell.Apply();
}
heatBuf.Apply();
FLY.ControlLibrary.Window_Tip.Show("通知", "应用成功", TimeSpan.FromSeconds(2));
}
......
......@@ -12,7 +12,7 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.FeedbackRenZiJia.UI.Client;component/PgHeatAnalyse/PgHeatAnalyseStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.FeedbackRenZiJia.UI.Client;component/Themes/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="TextBrush" Color="#4C4949" />
<SolidColorBrush x:Key="SemiTransparentGreyBrush" Color="#99F0F0F0"/>
......
using FLY.FeedbackRenZiJia.IService;
using FLY.FeedbackRenZiJia.Server.Model;
using FLY.Thick.Blowing.IService;
using FObjBase;
using GalaSoft.MvvmLight.Command;
using LiveCharts;
using LiveCharts.Configurations;
......@@ -19,6 +20,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
{
public class UcThickHeatVm: INotifyPropertyChanged
{
const int MARKNO_UPDATEFRAME = 1;
public event PropertyChangedEventHandler PropertyChanged;
......@@ -176,6 +179,14 @@ namespace FLY.FeedbackRenZiJia.UI.Client
}
public event Action FrameUpdated;
public void UpdateFrame() {
PollModule.Current.Poll_JustOnce(() => {
_updateFrame();
}, this, MARKNO_UPDATEFRAME);
}
void _updateFrame()
{
bulkDbService.GetFrame(Number, (asyncContext, retData) =>
{
var reponce = retData as GetFrameReponse;
......
......@@ -5,8 +5,94 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Themes/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.FeedbackRenZiJia.UI.Client;component/Themes/Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--扫描图,纵向趋势图Y轴 标签-->
<Style x:Key="Button.AccentedSquare2" TargetType="Button" BasedOn="{StaticResource AccentedSquareButtonStyle}">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="5"/>
</Style>
<Style x:Key="Button.Square2" TargetType="Button" BasedOn="{StaticResource SquareButtonStyle}">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="5"/>
</Style>
<Style x:Key="Button.HighlightedSquare2" TargetType="Button" BasedOn="{StaticResource HighlightedSquareButtonStyle}">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="5"/>
</Style>
<DropShadowEffect x:Key="Card.Shadow" Color="#303030" Opacity=".25" BlurRadius="5" ShadowDepth="3"/>
<Style x:Key="Card.Title" TargetType="TextBlock">
<Setter Property="Background" Value="#FFC107"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Padding" Value="20 5"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style x:Key="Card.Border" TargetType="Border">
<Setter Property="Margin" Value="5"/>
<Setter Property="Background" Value="White"/>
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#EBEBEB"/>
<Setter Property="Effect" Value="{StaticResource Card.Shadow}"/>
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeader}" x:Key="Text.FieldHeader2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}" x:Key="Text.FieldHeaderEditable2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}" x:Key="Text.FieldHeaderEditable"/>
<Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle_FieldContent}" x:Key="Text.FieldContentInput">
<Setter Property="Background" Value="WhiteSmoke"/>
</Style>
<Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle_FieldContent}" x:Key="Text.FieldContentInput2">
<Setter Property="FontSize" Value="20" />
<Setter Property="Background" Value="WhiteSmoke"/>
<Setter Property="MinWidth" Value="100"/>
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent}" x:Key="Text.FieldContent2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent}" x:Key="Text.FieldContent"/>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent_mm}" x:Key="Text.FieldContentMm"/>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent_mm_interval}" x:Key="Text.FieldContentMmInterval"/>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent_mm}" x:Key="Text.FieldContentMm2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style x:Key="AxisSectionStyle" TargetType="lvc:AxisSection" >
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="DataLabel" Value="True"/>
<Setter Property="DisableAnimations" Value="True"/>
<Setter Property="DataLabelForeground" Value="White"/>
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Panel.ZIndex" Value="1"/>
</Style>
<SolidColorBrush x:Key="Badges.Background">#99FFFFFF</SolidColorBrush>
<Thickness x:Key="Badges.Margin">2.5 0</Thickness>
<SolidColorBrush x:Key="Badges.BlackBackground">#99000000</SolidColorBrush>
<SolidColorBrush x:Key="Badges.BlackForeground">White</SolidColorBrush>
<SolidColorBrush x:Key="Badges.AccentBackground">#99008BE5</SolidColorBrush>
<SolidColorBrush x:Key="Badges.AccentForeground">White</SolidColorBrush>
</ResourceDictionary>
\ No newline at end of file
......@@ -42,6 +42,11 @@
<Setter Property="DataLabel" Value="False"/>
</Style>
<local:AirRingGraphVmUt x:Key="viewModel"/>
<Geometry x:Key="Geometry.Close">
M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z
</Geometry>
</ResourceDictionary>
</Page.Resources>
......@@ -274,6 +279,13 @@
Fill="Transparent"
Values="{Binding ThickPercents}"
Configuration="{Binding MapperThickPercents}"/>
<lvc:ScatterSeries
PointGeometry="{StaticResource Geometry.Close}"
StrokeThickness ="1"
Stroke="{StaticResource Brushes.Thick}"
Fill="{StaticResource WhiteBrush}"
Values="{Binding ThickPercents}"
Configuration="{Binding MapperThickPercentsWithIsStable}"/>
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
......
......@@ -3,6 +3,7 @@ using FLY.FeedbackRenZiJia.IService;
using GalaSoft.MvvmLight.Command;
using LiveCharts;
using LiveCharts.Configurations;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using System;
using System.Collections.Generic;
using System.ComponentModel;
......@@ -29,16 +30,21 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
/// <summary>
/// 厚度%
/// </summary>
public ChartValues<int> ThickPercents { get; } = new ChartValues<int>();
public ChartValues<double> ThickPercents { get; } = new ChartValues<double>();
public ChartValues<int> PreHeats { get; } = new ChartValues<int>();
public ChartValues<int> Heats { get; } = new ChartValues<int>();
public ChartValues<int> HeatOffsets { get; } = new ChartValues<int>();
public ChartValues<bool> Bads { get; } = new ChartValues<bool>();
public ChartValues<bool> IsStables { get; } = new ChartValues<bool>();
public object MapperPreHeats { get; private set; }
[PropertyChanged.DependsOn(nameof(Kp))]
public object MapperThickPercents { get; private set; }
[PropertyChanged.DependsOn(nameof(Kp))]
public object MapperThickPercentsWithIsStable { get; private set; }
public object Mapper { get; private set; }
public double Kp { get; private set; } = 3;
......@@ -105,7 +111,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
}
return PreHeatsBrush;
});
MapperThickPercents = Mappers.Xy<int>()
MapperThickPercents = Mappers.Xy<double>()
.X((value, index) =>
{
return index + 1;
......@@ -115,6 +121,24 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
return value * Kp;
});
MapperThickPercentsWithIsStable = Mappers.Xy<double>()
.X((value, index) =>
{
return index + 1;
})
.Y((value,index) =>
{
if (index < IsStables.Count() && index >= 0)
{
if (!IsStables[index])
{
return value * Kp;
}
}
return double.NaN;
});
Mapper = Mappers.Xy<int>()
.X((value, index) =>
{
......@@ -212,10 +236,10 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
private void MHeatBuf_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
//if (e.PropertyName == nameof(mHeatBuf.BoltIsStable))
//{
// DataBindAll_Thicks();
//}
if (e.PropertyName == nameof(mHeatBuf.BoltIsStable))
{
DataBindAll_IsStables();
}
}
private void MHeatCell_PropertyChanged(object sender, PropertyChangedEventArgs e)
......@@ -286,6 +310,13 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
Bads.AddRange(mFeedback.Bads);
NotifyPropertyChanged(nameof(MapperPreHeats));
}
void DataBindAll_IsStables()
{
IsStables.Clear();
if (mHeatBuf.BoltIsStable != null)
IsStables.AddRange(mHeatBuf.BoltIsStable);
NotifyPropertyChanged(nameof(MapperThickPercentsWithIsStable));
}
void UpdateAxisX()
{
XMax = mFeedback.ChannelCnt + 1;
......
......@@ -27,7 +27,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
/// <summary>
/// 经过Kp 转换后的 厚度%
/// </summary>
public ChartValues<int> ThickPercents { get; } = new ChartValues<int>();
public ChartValues<double> ThickPercents { get; } = new ChartValues<double>();
public ChartValues<int> PreHeats { get; } = new ChartValues<int>();
public ChartValues<int> Heats { get; } = new ChartValues<int>();
public ChartValues<int> HeatOffsets { get; } = new ChartValues<int>();
......@@ -91,7 +91,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
}
return PreHeatsBrush;
});
MapperThickPercents = Mappers.Xy<int>()
MapperThickPercents = Mappers.Xy<double>()
.X((value, index) =>
{
return index + 1;
......@@ -124,10 +124,10 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
int kp = 3;
int[] thickpercents = new int[nbolts];
double[] thickpercents = new double[nbolts];
for (int i = 0; i < nbolts; i++)
{
thickpercents[i] = (int)(100 * (datas[i] - avg) / avg);
thickpercents[i] = 100 * (datas[i] - avg) / avg;
}
int[] heatoffsets = new int[nbolts];
for (int i = 0; i < nbolts; i++)
......
......@@ -182,6 +182,20 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
}
}
}
public class DynAreaViewModelParams : INotifyPropertyChanged
{
/// <summary>
/// 有异常
/// </summary>
public bool IsError { get; set; }
/// <summary>
/// 异常消息
/// </summary>
public string Error { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
public class UiModule2_DynAreaAirRing2 : IUiModule2
{
/// <summary>
......
......@@ -27,10 +27,6 @@ namespace FLY.FeedbackRenZiJia.Client
public int StableRange { get; set; } = 2;
/// <summary>
/// 厚度稳定范围 %, 加热量变化为0时,偏差在范围内,都是稳定的
/// </summary>
public int StableRange0 { get; set; } = 2;
/// <summary>
......@@ -58,18 +54,6 @@ namespace FLY.FeedbackRenZiJia.Client
/// </summary>
public double ThresholdSigmaMin { get; set; } = 2;
/// <summary>
/// 使用这里独立的Kp, 与 HeatCell 不一样
/// </summary>
public bool IsUsedLocalKp { get; set; }
/// <summary>
/// 本地Kp, 用于判断稳定性
/// </summary>
public double LocalKp { get; set; } = 3;
#endregion
#region 状态
......@@ -83,15 +67,9 @@ namespace FLY.FeedbackRenZiJia.Client
#region 对位
/// <summary>
/// 进入了对位模式
/// 对位查找范围 默认 ±120°, 最大值 180°,最小值 50°
/// </summary>
public bool IsIntoAutoONo { get; set; }
/// <summary>
/// 对位模式结果
/// </summary>
public EAutoONoResult AutoONoResult { get; set; } = EAutoONoResult.Idle;
public int SearchAngleRange { get; set; } = 120;
/// <summary>
/// 计算的最佳复位区号
/// </summary>
......@@ -112,8 +90,22 @@ namespace FLY.FeedbackRenZiJia.Client
/// <summary>
/// 计算的最佳复位区号 对应的 厚度%变化极差 单位%
/// </summary>
public double MaxMin { get; set; } = -1;
public int MaxMin { get; set; } = -1;
/// <summary>
/// MaxR 对应的 数据幅 Id0
/// </summary>
public long MaxR_Id0 { get; set; }
/// <summary>
/// MaxR 对应的 数据幅 Id1
/// </summary>
public long MaxR_Id1 { get; set; }
/// <summary>
/// MaxR 对应的 数据幅 时间
/// </summary>
public DateTime MaxR_Time { get; set; }
#endregion
#region 稳定性
......@@ -137,41 +129,12 @@ namespace FLY.FeedbackRenZiJia.Client
public double Curr2Sigma { get; set; } = -1;
/// <summary>
/// 当前打散程度。
/// 连续N点都在平均值同一侧为一个块;
/// 这些块的长度平均值/总长度, 为打散度;
/// 打散度越小越好, 最小为 1/NBolts
/// </summary>
public double CurrBreakUp { get; set; } = 50;
/// <summary>
/// 当前检测出来的厚度数据,时间
/// </summary>
public DateTime CurrTime { get; set; } = DateTime.MinValue;
/// <summary>
/// 当前检测出来的厚度数据,方向
/// </summary>
public Misc.DIRECTION CurrDirection { get; set; } = Misc.DIRECTION.FORWARD;
#endregion
#region 列表
/// <summary>
/// 列表最后1个BM
/// </summary>
public int LastBM { get; set; }
/// <summary>
/// 列表第1个BM
/// </summary>
public int FirstBM { get; set; }
#endregion
......@@ -193,25 +156,9 @@ namespace FLY.FeedbackRenZiJia.Client
{
Call(nameof(Apply));
}
public void GetHeatsData(int bookmark, AsyncCBHandler asyncDelegate, object ayncContext)
{
Call(nameof(GetHeatsData),new { bookmark }, asyncDelegate, ayncContext);
}
public void ClearBoltHeat()
{
Call(nameof(ClearBoltHeat));
}
/// <summary>
/// 获取每个分区的加热历史 返回 FlyData_BoltHeatRecord
/// </summary>
/// <param name="no">分区号</param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
public void GetBoltHeatRecord(int no, AsyncCBHandler asyncDelegate, object ayncContext)
{
Call(nameof(GetBoltHeatRecord), new { no }, asyncDelegate, ayncContext);
}
}
}
......@@ -21,19 +21,6 @@ namespace FLY.FeedbackRenZiJia.Client
/// </summary>
public double Kp { get; set; } = 3;
/// <summary>
/// 自动对位
/// </summary>
public bool IsAutoONo { get; set; }
/// <summary>
/// 自动对位的Kp
/// </summary>
public double AutoONoKp { get; set; } = 5;
/// <summary>
/// 平滑的阀值,只有超出阀值,才平滑
/// </summary>
......@@ -52,9 +39,33 @@ namespace FLY.FeedbackRenZiJia.Client
public int CtrlLine { get; set; }
/// <summary>
/// 开启打散模式, 打散模式下,以打散度小为目标,控制2sigma在 控制线内
/// 最大加热量 默认100%
/// </summary>
public int MaxHeat { get; set; }
#endregion
#region 对位
/// <summary>
/// 自动对位
/// </summary>
public bool IsBreakUpMode { get; set; }
public bool IsAutoONo { get; set; }
/// <summary>
/// 当前正在自动对位模式
/// </summary>
public AutoONoStatusEnum AutoONoStatus { get; set; }
/// <summary>
/// 自动对位模式 信息
/// </summary>
public string AutoONoMsg { get; set; }
/// <summary>
/// 自动对位 那幅空的图
/// </summary>
public long AutoONoId0 { get; set; }
/// <summary>
/// 自动对位 加热后生效的图
/// </summary>
public long AutoONoId1 { get; set; }
#endregion
......@@ -63,14 +74,12 @@ namespace FLY.FeedbackRenZiJia.Client
/// <summary>
/// 对应的100% 数据,单位是% 数量是BoltCnt, 数据肯定是完整的!!!!!
/// </summary>
[PropertyChanged.DoNotCheckEquality]
public int[] ThickPercents { get; set; }
public double[] ThickPercents { get; set; }
/// <summary>
/// 当前方向的加热策略,必须保证 0~100
/// </summary>
[PropertyChanged.DoNotCheckEquality]
public int[] Heats { get; set; }
......@@ -81,27 +90,20 @@ namespace FLY.FeedbackRenZiJia.Client
/// <summary>
/// 加热偏移量
/// </summary>
[PropertyChanged.DoNotCheckEquality]
public int[] Offsets { get; protected set; }
public int[] Offsets { get; set; }
/// <summary>
/// Heats+Offsets+Base
/// </summary>
[PropertyChanged.DoNotCheckEquality]
public int[] PreHeats { get; protected set; }
public int[] PreHeats { get; set; }
/// <summary>
/// 加热量 每3个计算的sigma,最大值
/// </summary>
public double MaxHeatSigma { get; private set; }
public double MaxHeatSigma { get; set; }
/// <summary>
/// 当前正在自动对位模式
/// </summary>
public bool IsInAutoONo { get; protected set; }
#endregion
#endregion
......@@ -137,7 +139,7 @@ namespace FLY.FeedbackRenZiJia.Client
public void Cal()
{
Call(nameof(Call));
Call(nameof(Cal));
}
public void Smooth()
......
using FLY.Thick.Blowing.IService;
using FLY.FeedbackRenZiJia.Server.Model;
using FLY.Thick.Blowing.IService;
using System;
using System.Collections.Generic;
......@@ -7,73 +8,27 @@ namespace FLY.FeedbackRenZiJia.Common
public class FlyData_FeedbackHeat
{
/// <summary>
/// 开始测量时间!!!
/// </summary>
public DateTime Time { get; set; }
/// <summary>
/// 结束测量时间
/// </summary>
public DateTime EndTime { get; set; }
/// <summary>
/// 方向
/// </summary>
public Misc.DIRECTION Direction;
public Lc_ThickHeat thickHeat;
/// <summary>
/// 复位区号
/// </summary>
public int OrgBoltNo = 1;
/// <summary>
/// 旋转架旋转角度
/// </summary>
public double RAngle = 350;
/// <summary>
/// 膜距离
/// </summary>
public double FilmLength = 24;
/// <summary>
/// 旋转时间
/// 稳定状态
/// </summary>
public TimeSpan RotatePeriod;
public STABILITY Stability = STABILITY.IDLE;
/// <summary>
/// 旋转次数
/// 厚度均值
/// </summary>
public int RotateCnt;
public double ThickAvg;
/// <summary>
/// 厚度数据, 大小 NBolts
/// 大小 ChannelCnt, 均值为0
/// </summary>
public int[] Thicks;
public double[] ThickPercents;
/// <summary>
/// 分区表
/// </summary>
public List<BoltMapCell> Boltmap;
/// <summary>
/// 开始改变加热时间
/// </summary>
public DateTime HTime;
/// <summary>
/// TODO 删除 加热数据编号,每次加热改变,编号++,这样可以不用比较加热是否相同
/// 大小 ChannelCnt, 均值为0
/// </summary>
public int HNo = -1;
/// <summary>
/// 加热数据,100%, 大小 ChannelCnt
/// </summary>
public int[] Heats;
/// <summary>
/// 稳定状态
/// </summary>
public STABILITY Stability = STABILITY.IDLE;
public double[] HeatPercents;
}
......
......@@ -33,6 +33,36 @@ namespace FLY.FeedbackRenZiJia.Common
}
return percent;
}
/// <summary>
/// 转为 % 数据,单位 %
/// </summary>
/// <param name="datas"></param>
/// <returns></returns>
public static double[] GetPercent(IEnumerable<double> datas)
{
double[] percent = new double[datas.Count()];
double avg = datas.AverageNoNull();
if (double.IsNaN(avg))
{
for (int i = 0; i < percent.Count(); i++) {
percent[i] = double.NaN;
}
return percent;
}
else
{
for (int i = 0; i < datas.Count(); i++)
{
double d = datas.ElementAt(i);
if (double.IsNaN(d))
percent[i] = double.NaN;
else
percent[i] = (int)(100 * (d - avg) / avg);
}
}
return percent;
}
/// <summary>
......@@ -58,6 +88,24 @@ namespace FLY.FeedbackRenZiJia.Common
return diff;
}
/// <summary>
/// 两列数据相减
/// </summary>
/// <param name="data1"></param>
/// <param name="data2"></param>
/// <returns></returns>
public static double[] GetDiff(double[] data1, double[] data2)
{
double[] diff = new double[data1.Count()];
for (int i = 0; i < data1.Count(); i++)
{
if (double.IsNaN(data1[i]) || double.IsNaN(data2[i]))
diff[i] = double.NaN;
else
diff[i] = data1[i] - data2[i];
}
return diff;
}
/// <summary>
/// 两列数据中间值
/// </summary>
/// <param name="data1"></param>
......@@ -102,6 +150,30 @@ namespace FLY.FeedbackRenZiJia.Common
}
return data_out;
}
/// <summary>
/// 上下平移,使平均值为0
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static double[] OffsetAvgBe0(double[] datas)
{
double[] datas_out = new double[datas.Count()];
double avg = datas.AverageNoNull();
if (double.IsNaN(avg)) {
for (int i = 0; i < datas.Count(); i++)
datas_out[i] = double.NaN;
}
for (int i = 0; i < datas.Count(); i++)
{
if (double.IsNaN(datas[i]))
datas_out[i] = double.NaN;
else
datas_out[i] = datas[i] - avg;
}
return datas_out;
}
/// <summary>
/// 放大数量
......@@ -369,6 +441,59 @@ namespace FLY.FeedbackRenZiJia.Common
data2_move = mi;
}
/// <summary>
/// 通过data2 平移,找到与 data1 最相似的位置, data1 与 data2 必须大小一致
/// </summary>
/// <param name="data1"></param>
/// <param name="data2"></param>
/// <param name="range_percent">0~1</param>
/// <param name="offset"></param>
/// <param name="r"></param>
public static void CalBestMove(double[] data1, double[] data2, double range_percent, out int data2_move, out double max_r)
{
if (data1.Length != data2.Length)
{
throw new Exception("CalBestMove() 参数错误 (data1.Length = " + data1.Length.ToString() + ")!=(data2.Length =" + data2.Length.ToString() + ")");
}
if ((range_percent > 1) || (range_percent < 0))
{
throw new Exception("CalBestMove() 参数错误 range_percent = " + range_percent.ToString() + " 异常");
}
int range = (int)(Math.Ceiling(range_percent * data1.Length));
if (range <= 0)
range = 1;
double mr = 0;
int mi = -1;
for (int i = -range; i <= range; i++)
{
var data22 = Move(data2, i);
double r = Misc.MyMath.Correl(data1, data22);
if (mi == -1)
{
mr = r;
mi = i;
}
else
{
if (r > mr)
{
mr = r;
mi = i;
}
}
}
//找到了!!!
max_r = mr;
data2_move = mi;
}
/// <summary>
/// 平移
/// </summary>
......@@ -445,6 +570,16 @@ namespace FLY.FeedbackRenZiJia.Common
return 0;
}
public static double CalMaxMin(double[] data)
{
double max = data.Max();
double min = data.Min();
if (!double.IsNaN(max))
{
return max - min;
}
return 0;
}
/// <summary>
/// X轴反向
/// </summary>
......@@ -601,12 +736,15 @@ namespace FLY.FeedbackRenZiJia.Common
}
else
{
if ((!double.IsNaN(data[d1])) && (!double.IsNaN(data[d2])))
_diff[i] = data[d1] * p1 + data[d2] * p2;
else if (!double.IsNaN(data[d1]))
_diff[i] = data[d1];
else
else if (!double.IsNaN(data[d2]))
_diff[i] = data[d2];
else
_diff[i] = double.NaN;
}
}
}
......
......@@ -23,18 +23,13 @@ namespace FLY.FeedbackRenZiJia.IService
/// </summary>
int StableRange { get; set; }
/// <summary>
/// 厚度稳定范围 %, 加热量变化为0时,偏差在范围内,都是稳定的
/// </summary>
int StableRange0 { get; set; }
/// <summary>
/// 对位模式, 加热与厚度相关性阀值, 相关性 >=0.7
/// </summary>
double ThresholdR { get; set; }
/// <summary>
/// 对位模式 厚度%差 的极差 >= +4%-4%=8%, 单位%
/// 对位模式 加热%差 的极差 >= 20% 才能触发 单位%
/// </summary>
int ThresholdMaxMin { get; set; }
......@@ -44,15 +39,6 @@ namespace FLY.FeedbackRenZiJia.IService
/// </summary>
int ThresholdSigmaMax { get; set; }
/// <summary>
/// 使用这里独立的Kp, 与 HeatCell 不一样
/// </summary>
bool IsUsedLocalKp { get; set; }
/// <summary>
/// 本地Kp, 用于判断稳定性
/// </summary>
double LocalKp { get; set; }
#endregion
#region 状态
......@@ -63,14 +49,9 @@ namespace FLY.FeedbackRenZiJia.IService
#region 对位
/// <summary>
/// 进入了对位模式
/// </summary>
bool IsIntoAutoONo { get; }
/// <summary>
/// 对位模式结果
/// 对位查找范围 默认 ±120°, 最大值 180°,最小值 50°
/// </summary>
EAutoONoResult AutoONoResult { get; }
int SearchAngleRange { get; set; }
/// <summary>
/// 计算的最佳复位区号
/// </summary>
......@@ -87,9 +68,24 @@ namespace FLY.FeedbackRenZiJia.IService
double MaxR { get; }
/// <summary>
/// 计算的最佳复位区号 对应的 厚度%变化极差 单位%
/// 计算的最佳复位区号 对应的 加热%变化极差 单位%
/// </summary>
int MaxMin { get; }
/// <summary>
/// MaxR 对应的 数据幅 Id0
/// </summary>
double MaxMin { get; }
long MaxR_Id0 { get; }
/// <summary>
/// MaxR 对应的 数据幅 Id1
/// </summary>
long MaxR_Id1 { get; }
/// <summary>
/// MaxR 对应的 数据幅 时间
/// </summary>
DateTime MaxR_Time { get; }
#endregion
......@@ -114,32 +110,9 @@ namespace FLY.FeedbackRenZiJia.IService
/// </summary>
DateTime CurrTime { get; }
/// <summary>
/// 当前检测出来的厚度数据,方向
/// </summary>
Misc.DIRECTION CurrDirection { get; }
/// <summary>
/// 当前打散程度。
/// 连续N点都在平均值同一侧为一个块;
/// 这些块的长度平均值/总长度, 为打散度;
/// 打散度越小越好, 最小为 1/NBolts
/// </summary>
double CurrBreakUp { get; }
#endregion
#region 列表
/// <summary>
/// 列表最后1个BM
/// </summary>
int LastBM { get; }
/// <summary>
/// 列表第1个BM
/// </summary>
int FirstBM { get; }
#endregion
#region 每个分区状态
bool[] BoltIsStable { get; }
......@@ -153,56 +126,10 @@ namespace FLY.FeedbackRenZiJia.IService
/// 参数应用
/// </summary>
void Apply();
/// <summary>
/// 获取记录历史 返回类型为 FlyData_FeedbackHeat
/// </summary>
/// <param name="bookmark">记录点</param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(FlyData_FeedbackHeat))]
void GetHeatsData(int bookmark, AsyncCBHandler asyncDelegate, object asyncContext);
/// <summary>
/// 清空每个分区的加热记录
/// </summary>
void ClearBoltHeat();
/// <summary>
/// 获取每个分区的加热历史 返回 FlyData_BoltHeatRecord
/// </summary>
/// <param name="no">分区号</param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(FlyData_BoltHeatRecord))]
void GetBoltHeatRecord(int no, AsyncCBHandler asyncDelegate, object asyncContext);
#endregion
}
/// <summary>
/// 自动对位模式结果
/// </summary>
public enum EAutoONoResult
{
/// <summary>
/// 没开始
/// </summary>
Idle,
/// <summary>
/// 计算成功
/// </summary>
OK,
/// <summary>
/// 失败,厚度变化%极差太小
/// </summary>
Err_MaxMin,
/// <summary>
/// 失败,厚度变化% 与 加热变化 相关性 不够大
/// </summary>
Err_MaxR,
/// <summary>
/// 失败,不稳定,被打断
/// </summary>
Err_Break
}
#endregion
}
}
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
......@@ -7,7 +9,7 @@ using System.Threading.Tasks;
namespace FLY.FeedbackRenZiJia.Server
{
public class SysParam : Misc.ISaveToXml
public class SysParam
{
/// <summary>
/// OBJ服务端口
......@@ -17,7 +19,7 @@ namespace FLY.FeedbackRenZiJia.Server
/// <summary>
/// 远程服务器
/// </summary>
public IPEndPoint ServerIPEP { get; set; } = Misc.StringConverter.ToIPEndPoint("127.0.0.1:20006");
public string BlowingAddr { get; set; } = "127.0.0.1:20006";
/// <summary>
/// 数据库保持时间 默认6个月
......@@ -26,24 +28,42 @@ namespace FLY.FeedbackRenZiJia.Server
public SysParam()
{
Load();
if (!Load())
Save();
}
string file_path = "system.json";
public void Save()
{
Misc.SaveToXmlHepler.Save("system.xml", this);
}
public void Load()
try
{
Misc.SaveToXmlHepler.Load("system.xml", this);
string json = JsonConvert.SerializeObject(this, Formatting.Indented);
File.WriteAllText(file_path, json);
}
catch
{
//异常,没有json 编码失败
public string[] GetSavePropertyNames()
}
}
public bool Load()
{
if (File.Exists(file_path))
{
try
{
return new string[]{
"OBJ_Port",
"ServerIPEP",
"DBKeepMonth"
};
string json = File.ReadAllText(file_path);
JsonConvert.PopulateObject(json, this);
return true;
}
catch
{
//异常,没有json 解码失败
}
return false;
}
return false;
}
}
}
......@@ -28,7 +28,7 @@
<!--MahApps.Brushes.Accent-->
<SolidColorBrush x:Key="Brushes.ChartAxisLabel0" Color="#FF60A917" />
<!--MahApps.Brushes.ValidationSummary5-->
<SolidColorBrush x:Key="Brushes.ChartAxisLabel1" Color="#DDD43940"/>
<SolidColorBrush x:Key="Brushes.ChartAxisLabel1" Color="#FFFD7070"/>
<!--MahApps.Brushes.ValidationSummary2-->
<SolidColorBrush x:Key="Brushes.ChartAxisLabel2" Color="#FFCA000C" />
<SolidColorBrush x:Key="Brushes.ChartAxisLabel3" Color="#FFA59F93" />
......
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