Commit 2a22b26d authored by 潘栩锋's avatar 潘栩锋 :bicyclist:

1. 添加 扫描图添加结束时间

2. 添加 风环调节图添加混合数显示,sigma2 显示
parent fecae39c
No related merge requests found
......@@ -12,8 +12,7 @@
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:lvc1="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Feng.Wpf"
mc:Ignorable="d"
d:DesignWidth="1024"
Background="#E6E6E6" >
d:DesignWidth="1024">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
......@@ -27,7 +26,7 @@
</ResourceDictionary>
</Page.Resources>
<Grid d:DataContext="{StaticResource viewModel}" >
<Grid d:DataContext="{StaticResource viewModel}" Background="{StaticResource Brushes.Card.Background}">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
......@@ -54,7 +53,7 @@
<StackPanel>
<local:UcThickHeat x:Name="ucThickHeat0"/>
<local:UcThickHeat x:Name="ucThickHeat1"/>
<Border Style="{StaticResource Card.Border}" >
<Border Style="{StaticResource Styles.Card.Border}" >
<StackPanel>
<Grid Margin="48,0,0,-20" Panel.ZIndex="10">
......@@ -92,7 +91,7 @@
Visibility="{Binding IsError,Converter={StaticResource visbilityconv}}"/>
</Grid>
<TextBlock Grid.Column="1" Style="{StaticResource Card.Title}" Text="偏差" />
<TextBlock Grid.Column="1" Style="{StaticResource Styles.Card.Title}" Text="偏差" />
</Grid>
<lvc:CartesianChart Height="300" Margin="5,2,2,2"
DisableAnimations="True" Hoverable="False" DataTooltip="{x:Null}" >
......@@ -216,7 +215,7 @@
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding RAngle}" />
<TextBlock Style="{StaticResource Text.FieldContentMm}" Text="°" VerticalAlignment="Top" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="°" VerticalAlignment="Top" />
</StackPanel>
</StackPanel>
<Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding CollapseCmd}" >
......@@ -246,9 +245,9 @@
</StackPanel>
</Border>
<Border Style="{StaticResource Card.Border}" Visibility="{Binding IsUsedMap,Converter={StaticResource visbilityconv}}">
<Border Style="{StaticResource Styles.Card.Border}" Visibility="{Binding IsUsedMap,Converter={StaticResource visbilityconv}}">
<StackPanel>
<TextBlock Grid.Column="1" Style="{StaticResource Card.Title}" Text="分区表"/>
<TextBlock Grid.Column="1" Style="{StaticResource Styles.Card.Title}" Text="分区表"/>
<StackPanel>
<StackPanel Orientation="Horizontal">
......
......@@ -21,7 +21,7 @@
</ResourceDictionary>
</UserControl.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<Border Style="{StaticResource Card.Border}" >
<Border Style="{StaticResource Styles.Card.Border}" >
<StackPanel>
<Grid>
<Grid.RowDefinitions>
......@@ -103,7 +103,7 @@
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Style="{StaticResource Text.FieldHeaderEditable2}" Text="ID:" />
<TextBox Style="{StaticResource Text.FieldContentInput2}" Text="{Binding Number}"/>
<TextBox Style="{StaticResource Text.FieldContentInput2}" Text="{Binding Number}" MinWidth="100"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Visibility="{Binding IsVaild,Converter={StaticResource visbilityconv}}">
<StackPanel Orientation="Horizontal" Margin="{StaticResource Badges.Margin}" VerticalAlignment="Bottom" >
......@@ -169,7 +169,7 @@
</StackPanel>
</StackPanel>
<TextBlock Style="{StaticResource Card.Title}" Text="{Binding Title}"/>
<TextBlock Style="{StaticResource Styles.Card.Title}" Text="{Binding Title}"/>
</StackPanel>
<Grid
Margin="10,0"
......
......@@ -18,6 +18,7 @@ using FLY.FeedbackRenZiJia.IService;
using System.ComponentModel;
using Unity;
using GalaSoft.MvvmLight.Command;
using System.Collections.ObjectModel;
namespace FLY.FeedbackRenZiJia.UI.Client
{
......@@ -100,6 +101,16 @@ namespace FLY.FeedbackRenZiJia.UI.Client
public int MaxHeat { get; set; }
public double OffsetGraphYRangePercent { get; set; }
/// <summary>
/// 分级控制
/// </summary>
public ObservableCollection<LvCtrlLine> LvCtrlLines { get; } = new ObservableCollection<LvCtrlLine>();
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
public int ThickSmoothRange { get; set; }
#endregion
#region Command
......@@ -148,6 +159,20 @@ namespace FLY.FeedbackRenZiJia.UI.Client
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.MaxHeat), this, nameof(MaxHeat));
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.IsAutoONo), this, nameof(IsAutoONo));
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.LvCtrlLines), () => {
LvCtrlLines.Clear();
if (this.HeatCell.LvCtrlLines == null)
return;
if (this.HeatCell.LvCtrlLines.Count() == 0)
return;
foreach (var lvCtrlLine in this.HeatCell.LvCtrlLines)
{
LvCtrlLines.Add(new LvCtrlLine() { CtrlLine = lvCtrlLine.CtrlLine, Mix = lvCtrlLine.Mix });
}
});
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.ThickSmoothRange), this, nameof(ThickSmoothRange));
Misc.BindingOperations.SetBinding(this.Feedback, nameof(IFeedbackHeatService.Step), this, nameof(Step));
Misc.BindingOperations.SetBinding(this.Feedback, nameof(IFeedbackHeatService.HasCheck), this, nameof(HasCheck));
Misc.BindingOperations.SetBinding(this.Feedback, nameof(IFeedbackHeatService.Delay), this, nameof(Delay));
......@@ -232,6 +257,22 @@ namespace FLY.FeedbackRenZiJia.UI.Client
HeatCell.MaxHeat = this.MaxHeat;
HeatCell.IsAutoONo = this.IsAutoONo;
if (LvCtrlLines.Count() > 0)
{
var lvCtrlLines = new LvCtrlLine[LvCtrlLines.Count()];
for (int i = 0; i < LvCtrlLines.Count(); i++)
{
var lvCtrlLine = LvCtrlLines[i];
lvCtrlLines[i] = new LvCtrlLine() { CtrlLine = lvCtrlLine.CtrlLine, Mix = lvCtrlLine.Mix };
}
HeatCell.LvCtrlLines = lvCtrlLines;
}
else
{
HeatCell.LvCtrlLines = null;
}
HeatCell.ThickSmoothRange = ThickSmoothRange;
Feedback.Step=this.Step;
......
......@@ -7,75 +7,26 @@
<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.Thick.Base.UI;component/Themes/GraphStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.FeedbackRenZiJia.UI.Client;component/Themes/Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="Button.AccentedSquare2" TargetType="Button" BasedOn="{StaticResource MahApps.Styles.Button.Square.Accent}">
<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 MahApps.Styles.Button.Square}">
<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 MahApps.Styles.Button.Square.Highlight}">
<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">
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader}" x:Key="Text.FieldHeader2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}" x:Key="Text.FieldHeaderEditable2">
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader.Editable}" 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">
<Style TargetType="TextBox" BasedOn="{StaticResource Styles.Text.FieldContent.Input.Card}" 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">
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.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">
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldContent.Unit}" x:Key="Text.FieldContentMm2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style x:Key="AxisSectionStyle" TargetType="lvc:AxisSection" >
......
......@@ -294,6 +294,66 @@
</lvc:Axis>
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="400*"/>
<ColumnDefinition Width="280*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="2" Grid.RowSpan="2" Panel.ZIndex="1"
Margin="10,0" VerticalAlignment="Top" HorizontalAlignment="Right">
<Viewbox MaxHeight="25">
<StackPanel Margin="{StaticResource ControlMargin}">
<StackPanel.Resources>
<Style TargetType="Viewbox">
<Setter Property="Height" Value="25"/>
<Setter Property="Width" Value="120"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
</StackPanel.Resources>
<StackPanel Orientation="Horizontal">
<Viewbox >
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TitleStyle}"
Foreground="{StaticResource WhiteBrush}"
Background="{StaticResource TextBrush}"
Opacity="0.8"
Text="混合: "
/>
<TextBlock Style="{StaticResource ValueStyle}"
Foreground="{StaticResource WhiteBrush}"
Background="{StaticResource TextBrush}"
Text="{Binding CurrMix,Mode=OneWay}"
/>
</StackPanel>
</Viewbox>
<Viewbox>
<StackPanel Orientation="Horizontal" >
<TextBlock Style="{StaticResource TitleStyle}"
Foreground="{StaticResource WhiteBrush}"
Background="{StaticResource TextBrush}"
Text=" 2σ: "
/>
<TextBlock Style="{StaticResource ValueStyle}"
Foreground="{StaticResource WhiteBrush}"
Background="{StaticResource TextBrush}"
>
<Run Text="{Binding CurrSigma2,Mode=OneWay, StringFormat={}{0:F1}}"/>%
</TextBlock>
</StackPanel>
</Viewbox>
</StackPanel>
</StackPanel>
</Viewbox>
</Grid>
</Grid>
<lvc:CartesianChart Grid.Row="1" Hoverable="False" DisableAnimations="True" DataTooltip="{x:Null}" Margin="5,2,2,2"
MouseMove="UIElement_OnMouseMove" MouseDown="UIElement_MouseDown" MouseUp="UIElement_MouseUp">
<lvc:CartesianChart.Series>
......
......@@ -3,6 +3,7 @@ using FLY.FeedbackRenZiJia.IService;
using GalaSoft.MvvmLight.Command;
using LiveCharts;
using LiveCharts.Configurations;
using Misc;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using System;
using System.Collections.Generic;
......@@ -61,6 +62,10 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
/// 当前选择加热通道数量
/// </summary>
public int SelectBoltNoWidth { get; set; } = 0;
public int CurrMix { get; protected set; } = 1;
public double CurrSigma2 { get; protected set; } = 0;
/// <summary>
/// 长按驱动器
/// </summary>
......@@ -198,6 +203,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.Kp), this, nameof(Kp));
Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.CurrMix), this, nameof(CurrMix));
this.btnClearH = button_clear_h;
......@@ -284,8 +290,15 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
void DataBindAll_Thicks()
{
ThickPercents.Clear();
if(mHeatCell.ThickPercents!=null)
if (mHeatCell.ThickPercents != null)
{
ThickPercents.AddRange(mHeatCell.ThickPercents);
CurrSigma2 = mHeatCell.ThickPercents.Sigma() * 2;
}
else
{
CurrSigma2 = 0;
}
}
void DataBindAll_Heats()
......
......@@ -51,7 +51,7 @@ using System.Windows;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.0.1.0")]
[assembly: AssemblyFileVersion("7.0.1.0")]
[assembly: AssemblyVersion("7.1.0.2")]
[assembly: AssemblyFileVersion("7.1.0.2")]
[assembly: Guid("32104657-86E9-4380-9113-606589E6D812")]
......@@ -53,6 +53,16 @@ namespace FLY.FeedbackRenZiJia.Client
/// 最大加热量 默认100%
/// </summary>
public int MaxHeat { get; set; }
/// <summary>
/// 分级控制线
/// </summary>
public LvCtrlLine[] LvCtrlLines { get; set; }
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
public int ThickSmoothRange { get; set; }
#endregion
#region 对位
/// <summary>
......@@ -69,6 +79,10 @@ namespace FLY.FeedbackRenZiJia.Client
/// </summary>
public double[] ThickPercents { get; set; }
/// <summary>
/// 当前 thickPercents 混合数
/// </summary>
public int CurrMix { get; set; }
/// <summary>
/// 当前方向的加热策略,必须保证 0~100
......
......@@ -2,18 +2,19 @@
using FLY.Thick.Blowing.IService;
using System;
using System.Collections.Generic;
using System.Linq;
namespace FLY.FeedbackRenZiJia.Common
{
public class FlyData_FeedbackHeat
public class ThickHeat2
{
public Lc_ThickHeat thickHeat;
/// <summary>
/// 稳定状态
/// 以前的数据
/// </summary>
public STABILITY Stability = STABILITY.IDLE;
public List<Lc_ThickHeat> thickHeats = new List<Lc_ThickHeat>();
/// <summary>
/// 厚度均值
......@@ -29,6 +30,47 @@ namespace FLY.FeedbackRenZiJia.Common
/// 大小 ChannelCnt, 均值为0
/// </summary>
public double[] HeatPercents;
public void Mix(ThickHeat2 older)
{
thickHeats.AddRange(older.thickHeats);
thickHeats.Add(thickHeat);
//更新ThickPercents
int z = thickHeat.Thicks.Count() / ThickPercents.Count();
double[] thickPercents_last;
//当两幅图复位区号不一致时,移动以前的数据,使之一致
if (older.thickHeat.OrgBoltNo != thickHeat.OrgBoltNo)
{
int move = (thickHeat.OrgBoltNo - older.thickHeat.OrgBoltNo) / z;
thickPercents_last = Common.MyMath.Move(older.ThickPercents, move);
}
else
{
thickPercents_last = older.ThickPercents;
}
for (int i = 0; i < ThickPercents.Count(); i++)
{
double old_v = thickPercents_last[i];
double v = ThickPercents[i];
int cnt = older.MixCnt;
if (!double.IsNaN(old_v))
{
if (!double.IsNaN(v))
{
ThickPercents[i] = (v + old_v * cnt) / (cnt + 1);
}
else
{
ThickPercents[i] = old_v;
}
}
}
}
public int MixCnt => thickHeats.Count() + 1;
}
......
......@@ -44,6 +44,15 @@ namespace FLY.FeedbackRenZiJia.IService
/// </summary>
int MaxHeat { get; set; }
/// <summary>
/// 分级控制线
/// </summary>
LvCtrlLine[] LvCtrlLines { get; set; }
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
int ThickSmoothRange { get; set; }
#endregion
#region 对位
/// <summary>
......@@ -58,6 +67,13 @@ namespace FLY.FeedbackRenZiJia.IService
/// </summary>
double[] ThickPercents { get; }
/// <summary>
/// 当前 thickPercents 混合数
/// </summary>
int CurrMix { get; }
/// <summary>
/// 当前方向的加热策略,必须保证 0~100
/// </summary>
......@@ -78,6 +94,7 @@ namespace FLY.FeedbackRenZiJia.IService
/// </summary>
double MaxHeatSigma { get; }
#endregion
#region 功能
......@@ -125,4 +142,14 @@ namespace FLY.FeedbackRenZiJia.IService
void HeatApply();
#endregion
}
/// <summary>
/// 分级控制线
/// </summary>
public class LvCtrlLine : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public double CtrlLine { get; set; }
public int Mix { get; set; }
}
}
......@@ -739,7 +739,7 @@ namespace FLY.FeedbackRenZiJia.Server
return;
}
mHeatCell.SetThickPercents(mHeatBuf.ThickPercents);
mHeatCell.SetThickPercents(mHeatBuf.ThickPercents, mHeatBuf.MixCnt);
if (IsAuto)//如果自控中!!!
{
......
......@@ -177,13 +177,17 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
int BufSize = 60;
public List<FlyData_FeedbackHeat> mData;
public List<ThickHeat2> mData;
/// <summary>
/// 最后一幅数据,单位 channelcnt, 可以有double.NaN
/// </summary>
public double[] ThickPercents=null;
/// <summary>
/// 最后一幅数据的混合次数
/// </summary>
public int MixCnt = 1;
/// <summary>
/// 最后一幅数据的复位区号
/// </summary>
public int OrgBoltNo = 1;
......@@ -200,7 +204,7 @@ namespace FLY.FeedbackRenZiJia.Server
}
public HeatBuf()
{
mData = new List<FlyData_FeedbackHeat>();
mData = new List<ThickHeat2>();
if (!Load())
Save();
......@@ -308,7 +312,8 @@ namespace FLY.FeedbackRenZiJia.Server
CurrTime = thickHeat.Time;
ThickPercents = thkpercents;
ThickPercents = thkpercents;
MixCnt = 1;
OrgBoltNo = thickHeat.OrgBoltNo;
Curr2Sigma = thkpercents.Sigma() * 2;
......@@ -334,27 +339,25 @@ namespace FLY.FeedbackRenZiJia.Server
return true;
}
FlyData_FeedbackHeat d = new FlyData_FeedbackHeat()
ThickHeat2 d = new ThickHeat2()
{
//thickHeat = thickHeat,
Stability = STABILITY.IDLE,
thickHeat = Lc_ThickHeat_Clone(thickHeat),
ThickAvg = thkavg,//肯定有数据
ThickPercents = thkpercents,
HeatPercents = heatPercents
};
string json = Newtonsoft.Json.JsonConvert.SerializeObject(thickHeat);
d.thickHeat = Newtonsoft.Json.JsonConvert.DeserializeObject<Lc_ThickHeat>(json);
//更新每个分区的稳定状态
UpdateStable3(d);
return true;
}
Lc_ThickHeat Lc_ThickHeat_Clone(Lc_ThickHeat thickHeat)
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(thickHeat);
return Newtonsoft.Json.JsonConvert.DeserializeObject<Lc_ThickHeat>(json);
}
void DataAdd(FlyData_FeedbackHeat d)
void DataAdd(ThickHeat2 d)
{
if (mData.Count == BufSize)
{
......@@ -371,7 +374,7 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
void UpdateStable3(FlyData_FeedbackHeat d)
void UpdateStable3(ThickHeat2 d)
{
if (mData.Count() == 0)//没有以前的数据
{
......@@ -422,29 +425,54 @@ namespace FLY.FeedbackRenZiJia.Server
GetPercentDatas3(d, d_last,
out double[] thickpercents_diff, out double[] heatpercents_diff);
//通过简单的范围比较计算稳定性
//当Kp, 错位,就会另 稳定性的值很低
bool[] isStables = CalStable(thickpercents_diff, heatpercents_diff);
double currR = 1.0 * isStables.Count(b => b) / isStables.Count();
double currR2 = Misc.MyMath.Correl(thickpercents_diff, heatpercents_diff);
if (double.IsNaN(currR2))
currR2 = -1;
CurrR = Math.Max( currR, currR2 );
BoltIsStable = isStables;
LastHeatDiffMaxMin = (int)Common.MyMath.CalMaxMin(heatpercents_diff);
if (CurrR >= ThresholdR)
if (heatpercents_diff.All(h => h == 0))
{
Stability = STABILITY.OK_CORREL;
//加热没有变化,
CurrR = currR;
if (CurrR >= ThresholdR)
{
Stability = STABILITY.OK_CORREL;
//把 d 合并到 d_last
mData.RemoveAt(mData.Count() - 1);
d.Mix(d_last);
//更新图
ThickPercents = d.ThickPercents;
MixCnt = d.MixCnt;
Curr2Sigma = ThickPercents.Sigma() * 2;
}
else
{
Stability = STABILITY.ERROR_CORREL;
}
}
else
{
Stability = STABILITY.ERROR_CORREL;
}
double currR2 = Misc.MyMath.Correl(thickpercents_diff, heatpercents_diff);
if (double.IsNaN(currR2))
currR2 = -1;
CurrR = Math.Max(currR, currR2);
if (CurrR >= ThresholdR)
{
Stability = STABILITY.OK_CORREL;
}
else
{
Stability = STABILITY.ERROR_CORREL;
}
}
LastHeatDiffMaxMin = (int)Common.MyMath.CalMaxMin(heatpercents_diff);
//通过平移 达到最大 加热厚度相关性
......@@ -548,7 +576,7 @@ namespace FLY.FeedbackRenZiJia.Server
return orgBoltNo;
}
void GetPercentDatas3(
FlyData_FeedbackHeat d, FlyData_FeedbackHeat d_last,
ThickHeat2 d, ThickHeat2 d_last,
out double[] thickpercents_diff, out double[] heatpercents_diff)
{
//厚度%偏差
......@@ -556,12 +584,9 @@ namespace FLY.FeedbackRenZiJia.Server
//当两幅图复位区号不一致时,移动以前的数据,使之一致
if (d.thickHeat.OrgBoltNo != d_last.thickHeat.OrgBoltNo)
{
var thks_last = Common.MyMath.Move(d_last.thickHeat.Thicks, d.thickHeat.OrgBoltNo - d_last.thickHeat.OrgBoltNo);
//转为 加热棒数量
thks_last = Common.MyMath.ZoomOut(thks_last, BoltCnt / ChannelCnt);
thickpercents_last = Common.MyMath.GetPercent(thks_last);
int z = d.thickHeat.Thicks.Count() / d.ThickPercents.Count();
int move = (d.thickHeat.OrgBoltNo - d_last.thickHeat.OrgBoltNo) / z;
thickpercents_last = Common.MyMath.Move(d_last.ThickPercents, move);
}
else {
thickpercents_last = d_last.ThickPercents;
......
......@@ -63,6 +63,15 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
public int MaxHeat { get; set; } = 100;
/// <summary>
/// 分级控制线
/// </summary>
public LvCtrlLine[] LvCtrlLines { get; set; }
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
public int ThickSmoothRange { get; set; } = 10;
#endregion
#region 状态
......@@ -74,7 +83,10 @@ namespace FLY.FeedbackRenZiJia.Server
[DoNotCheckEquality]
public double[] ThickPercents { get; set; }
/// <summary>
/// 当前 thickPercents 混合数
/// </summary>
public int CurrMix { get; set; }
/// <summary>
/// 当前方向的加热策略,必须保证 0~100
......@@ -175,7 +187,7 @@ namespace FLY.FeedbackRenZiJia.Server
//当复位区号改变了,同时也修改heatCell 的 thickPercents
if (e.PropertyName == nameof(this.blowingService.OrgBoltNo)) {
if (mHeatBuf.MoveThickPercents(this.blowingService.OrgBoltNo))
SetThickPercents(mHeatBuf.ThickPercents);
SetThickPercents(mHeatBuf.ThickPercents, mHeatBuf.MixCnt);
}
}
......@@ -245,7 +257,7 @@ namespace FLY.FeedbackRenZiJia.Server
this.blowingService.PropertyChanged += BlowingService_PropertyChanged;
mHeatBuf.SetToBestThickPercents();
SetThickPercents(mHeatBuf.ThickPercents);
SetThickPercents(mHeatBuf.ThickPercents, mHeatBuf.MixCnt);
}
......@@ -275,18 +287,29 @@ namespace FLY.FeedbackRenZiJia.Server
toAutoONoHeat = true;
}
else
{
//转为 加热棒数量
var thickPercents = ThickPercents;
{
var thickPercents = ThickPercents;//肯定没有 double.NaN
double ctrlLine = getCtrlLine(CurrMix);
offsets = new int[ChannelCnt];
//获取目标线。 正常全部都是0
var targets = getTargets(thickPercents, ctrlLine);
int range5 = 5;
for (int i = 0; i < ChannelCnt; i++)
{
//if (mHeatBuf.BoltIsStable[i] && //稳定
// (Math.Abs(thickPercents[i]) > CtrlLine))//在控制线已外
if (Math.Abs(thickPercents[i]) > CtrlLine)//在控制线已外
double delta = (thickPercents[i] - targets[i]);
if (Math.Abs(delta) > ctrlLine)
{
offsets[i] = (int)Math.Round(thickPercents[i] * Kp);
//这个点,及附近,都需要调节, 附近为±2
for (int j = 0; j < range5; j++)
{
int index = i - range5 / 2 + j;
if (index < 0) index += ChannelCnt;
else if (index >= ChannelCnt) index -= ChannelCnt;
offsets[index] = (int)calOffset(delta, ctrlLine, Kp);
}
}
}
}
......@@ -309,6 +332,116 @@ namespace FLY.FeedbackRenZiJia.Server
}
}
List<Range> getSignList(double[] thickPercents)
{
List<Range> signList = new List<Range>();
bool sign0 = thickPercents[0] > 0;
bool last_sign = sign0;
signList.Add(new Range() { Begin = 0, End = 0 });
for (int i = 1; i < ChannelCnt; i++)
{
bool sign = thickPercents[i] > 0;
if (sign == last_sign)
signList.Last().End = i;
else
{
signList.Add(new Range() { Begin = i, End = i });
}
last_sign = sign;
}
if (last_sign == sign0)
{
//最后一个,与第1个,可以合体
signList.First().Begin = signList.Last().Begin - ChannelCnt;
signList.RemoveAt(signList.Count() - 1);
}
return signList;
}
void setTargets(double[] targets, double target, int index, int range)
{
for (int j = 0; j < range; j++)
{
int idx = index - range / 2 + j;
if (idx < 0) idx += ChannelCnt;
else if (idx >= ChannelCnt) idx -= ChannelCnt;
targets[idx] = target;
}
}
double[] getTargets(double[] thickPercents, double ctrlLine)
{
int range6 = 6;
int range3 = 3;
var signList = getSignList(thickPercents);
signList = signList.FindAll(s => s.Width >= range6);
double[] targets = new double[ChannelCnt];
foreach (var r in signList)
{
int i = r.Mid;
if (i < 0)//第0段,Begin 为负数。 所以需要判断
i += ChannelCnt;
if (thickPercents[i] > 0)
{
setTargets(targets, -ctrlLine, i, range3);
}
else
{
setTargets(targets, ctrlLine, i, range3);
}
}
return targets;
}
bool IsLvCtrlLinesValid()
{
if (LvCtrlLines != null && LvCtrlLines.Count() > 0 && LvCtrlLines.All(lv => lv != null))
{
return true;
}
return false;
}
double calOffset(double delta, double ctrlLine, double kp)
{
double d = Math.Abs(delta);
if (d >= ctrlLine)
{
}
else if (d >= ctrlLine * 2 / 3)
{
d = (d - ctrlLine * 2 / 3) * 2 + (ctrlLine * 1 / 3);
}
else if (d >= ctrlLine * 1 / 3)
{
d = (d - ctrlLine * 1 / 3) * 1 + (ctrlLine * 0 / 3);
}
else
{
d = 0;
}
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;
}
}
}
return ctrlLine;
}
int[] SetHeatForAutoONo()
{
//转为 加热棒数量
......@@ -360,12 +493,31 @@ namespace FLY.FeedbackRenZiJia.Server
}
return offsets;
}
public void SetThickPercents(double[] thkpercents)
public void SetThickPercents(double[] thkpercents, int mix)
{
CurrMix = mix;
thkpercents = MakeThickPercentsFull(thkpercents);
for (int i = 0; i < thkpercents.Count(); i++)
thkpercents[i] = Math.Round(thkpercents[i], 2);
ThickPercents = thkpercents;
//数据横向平滑
double[] thkpercents2 = new double[ChannelCnt];
for (int i = 0; i < ChannelCnt; i++)
{
double sum = 0;
for (int j = 0; j < ThickSmoothRange; j++)
{
int idx = i - ThickSmoothRange / 2 + j;
if (idx < 0)
idx += ChannelCnt;
else if (idx >= ChannelCnt)
idx -= ChannelCnt;
sum += thkpercents[idx];
}
sum /=ThickSmoothRange;
thkpercents2[i] = Math.Round(sum, 2);
}
ThickPercents = thkpercents2;
}
#region IHeatCell 接口 成员函数
......@@ -740,8 +892,8 @@ namespace FLY.FeedbackRenZiJia.Server
Heats[i] = heat;
}
NotifyPropertyChanged("Offsets");
NotifyPropertyChanged("Heats");
NotifyPropertyChanged(nameof(Offsets));
NotifyPropertyChanged(nameof(Heats));
Base = 0;
AfterHeatApplyEvent?.Invoke(this);
......@@ -856,6 +1008,16 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
public int MaxHeat = 100;
/// <summary>
/// 分级控制线
/// </summary>
public LvCtrlLine[] LvCtrlLines;
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
public int ThickSmoothRange = 10;
/// <summary>
/// 平滑的阀值,只有超出阀值,才平滑
/// </summary>
......
......@@ -102,7 +102,10 @@
<Viewbox MaxHeight="{StaticResource FontSize.Value}" HorizontalAlignment="Left" Margin="2">
<StackPanel Orientation="Horizontal" >
<TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Time,StringFormat={}{0:MM-dd HH:mm:ss}}"/>
<TextBlock Style="{StaticResource ValueStyle}" >
<Run Text="{Binding Time,Mode=OneWay,StringFormat={}{0:MM-dd HH:mm:ss}}"/>~<Run Text="{Binding EndTime,Mode=OneWay,StringFormat={}{0:HH:mm:ss}}"/>
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="{StaticResource TextMargin}">
<TextBlock Style="{StaticResource TitleStyle}" Text="ID:" />
<TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Id}"/>
......
......@@ -88,6 +88,11 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// </summary>
public DateTime Time { get; private set; }
/// <summary>
/// 测量结束时间
/// </summary>
public DateTime EndTime { get; private set; }
/// <summary>
/// 旋转方向 是反向
/// </summary>
......@@ -517,6 +522,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
if (this.scanData == null)
{
Time = DateTime.MinValue;
EndTime = DateTime.MinValue;
Id = -1;
OrgBoltNo = -100;
return;
......@@ -524,6 +530,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
else
{
Time = this.scanData.Time;
EndTime = this.scanData.Time;
Id = this.scanData.ID;
OrgBoltNo = this.scanData.OrgBoltNo;
IsBackw = this.scanData.IsBackw;
......@@ -556,6 +563,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
if (this.scanData == null)
{
Time = DateTime.MinValue;
EndTime = DateTime.MinValue;
Id = -1;
OrgBoltNo = -100;
return;
......@@ -563,6 +571,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
else
{
Time = this.scanData.Time;
EndTime = this.scanData.EndTime;
Id = this.scanData.ID;
OrgBoltNo = this.scanData.OrgBoltNo;
}
......
......@@ -66,6 +66,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// 测量时间
/// </summary>
public DateTime Time { get; set; }
public DateTime EndTime { get; set; }
/// <summary>
/// 数据库中的ID标示
/// </summary>
......
......@@ -107,8 +107,9 @@
<StackPanel>
<Viewbox MaxHeight="{StaticResource FontSize.Value}" HorizontalAlignment="Left" Margin="2">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Time,StringFormat={}{0:MM-dd HH:mm:ss}}"/>
<TextBlock Style="{StaticResource ValueStyle}" >
<Run Text="{Binding Time,Mode=OneWay,StringFormat={}{0:MM-dd HH:mm:ss}}"/>~<Run Text="{Binding EndTime,Mode=OneWay,StringFormat={}{0:HH:mm:ss}}"/>
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="{StaticResource TextMargin}">
<TextBlock Style="{StaticResource TitleStyle}" Text="ID:" />
<TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Id}"/>
......
......@@ -101,7 +101,10 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// 测量时间
/// </summary>
public DateTime Time { get; private set; }
/// <summary>
/// 测量结束时间
/// </summary>
public DateTime EndTime { get; private set; }
/// <summary>
/// 旋转方向 是反向
/// </summary>
......@@ -632,6 +635,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
if (this.scanData == null)
{
Time = DateTime.MinValue;
EndTime = DateTime.MinValue;
Id = -1;
OrgBoltNo = -100;
return;
......@@ -639,6 +643,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
else
{
Time = this.scanData.Time;
EndTime = this.scanData.EndTime;
Id = this.scanData.ID;
OrgBoltNo = this.scanData.OrgBoltNo;
IsBackw = this.scanData.IsBackw;
......
......@@ -75,7 +75,9 @@
<StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" Margin="5">
<TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Time,StringFormat={}{0:MM-dd HH:mm:ss}}"/>
<TextBlock Style="{StaticResource ValueStyle}" >
<Run Text="{Binding Time,Mode=OneWay,StringFormat={}{0:MM-dd HH:mm:ss}}"/>~<Run Text="{Binding EndTime,Mode=OneWay,StringFormat={}{0:HH:mm:ss}}"/>
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Style="{StaticResource TitleStyle}" Text="ID:" />
<TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Id}"/>
......
......@@ -58,7 +58,10 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// 测量时间
/// </summary>
public DateTime Time { get; private set; }
/// <summary>
/// 测量结束时间
/// </summary>
public DateTime EndTime { get; private set; }
/// <summary>
/// 旋转方向 是反向
/// </summary>
......@@ -341,6 +344,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
if (this.scanData == null)
{
Time = DateTime.MinValue;
EndTime = DateTime.MinValue;
Id = -1;
OrgBoltNo = -100;
return;
......@@ -348,6 +352,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
else
{
Time = this.scanData.Time;
EndTime = this.scanData.EndTime;
Id = this.scanData.ID;
OrgBoltNo = this.scanData.OrgBoltNo;
IsBackw = this.scanData.IsBackw;
......
......@@ -51,6 +51,6 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.1.0")]
[assembly: AssemblyFileVersion("7.1.0")]
[assembly: AssemblyVersion("7.3.0.2")]
[assembly: AssemblyFileVersion("7.3.0.2")]
[assembly: Guid("38E0D8EC-4D1C-49FF-AB08-6289294C5BD4")]
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