Commit 2b97e90d authored by 潘栩锋's avatar 潘栩锋 🚴

修复 风环自动控制 输出 块状的加热

修复 风环 数据平滑 为0时,没有数据
parent b3feab20
......@@ -19,6 +19,7 @@ using System.ComponentModel;
using Unity;
using GalaSoft.MvvmLight.Command;
using System.Collections.ObjectModel;
using FLY.Thick.RemoteHistory;
namespace FLY.FeedbackRenZiJia.UI.Client
{
......@@ -111,6 +112,11 @@ namespace FLY.FeedbackRenZiJia.UI.Client
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
public int ThickSmoothRange { get; set; }
/// <summary>
/// 启动打断功能,会把长块打断
/// </summary>
public bool CanBreakIn { get; set; }
#endregion
#region Command
......@@ -171,7 +177,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client
}
});
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.ThickSmoothRange), this, nameof(ThickSmoothRange));
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.CanBreakIn), this, nameof(CanBreakIn));
Misc.BindingOperations.SetBinding(this.Feedback, nameof(IFeedbackHeatService.Step), this, nameof(Step));
Misc.BindingOperations.SetBinding(this.Feedback, nameof(IFeedbackHeatService.HasCheck), this, nameof(HasCheck));
......@@ -273,7 +279,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client
HeatCell.LvCtrlLines = null;
}
HeatCell.ThickSmoothRange = ThickSmoothRange;
HeatCell.CanBreakIn = this.CanBreakIn;
Feedback.Step=this.Step;
Feedback.HasCheckFilmVelocity=this.HasCheckFilmVelocity;
......
......@@ -13,6 +13,8 @@ using System.IO;
using Newtonsoft.Json;
using FLY.Thick.Blowing.IService;
using Misc;
using System.Reflection;
using MathNet.Numerics.Distributions;
namespace FLY.FeedbackRenZiJia.Server
{
......@@ -68,10 +70,21 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
public LvCtrlLine[] LvCtrlLines { get; set; }
private int thickSmoothRange = 5;
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
public int ThickSmoothRange { get; set; } = 5;
public int ThickSmoothRange
{
get { return thickSmoothRange; }
set {
if (value < 1)
value = 1;
if (thickSmoothRange != value) {
thickSmoothRange = value;
}
}
}
/// <summary>
/// 启动打断功能,会把长块打断
......@@ -296,22 +309,33 @@ namespace FLY.FeedbackRenZiJia.Server
var thickPercents = ThickPercents;//肯定没有 double.NaN
double ctrlLine = getCtrlLine(CurrMix);
offsets = new int[ChannelCnt];
double[] deltas = new double[ChannelCnt];
//获取偏差
if (CanBreakIn)//启动打断功能
{
//获取目标线。 正常全部都是0
//有同向长块的,也需要中间打断。 长块中间的目标值是 反向的ctrlLine
var targets = getTargets(thickPercents, ctrlLine);
int range5 = 5;
for (int i = 0; i < ChannelCnt; i++)
{
double delta;
if (CanBreakIn)//启动打断功能
delta = (thickPercents[i] - targets[i]);
deltas[i] = (thickPercents[i] - targets[i]);
}
}
else
delta = thickPercents[i];//普通使用0%为目标值
{
for (int i = 0; i < ChannelCnt; i++)
{
deltas[i] = thickPercents[i];
}
}
if (Math.Abs(delta) > ctrlLine)
//计算输出增量
for (int i = 0; i < ChannelCnt; i++)
{
int range5 = 5;
if (Math.Abs(deltas[i]) > ctrlLine)
{
//这个点,及附近,都需要调节, 附近为±2
for (int j = 0; j < range5; j++)
......@@ -319,7 +343,8 @@ namespace FLY.FeedbackRenZiJia.Server
int index = i - range5 / 2 + j;
if (index < 0) index += ChannelCnt;
else if (index >= ChannelCnt) index -= ChannelCnt;
offsets[index] = (int)calOffset(delta, ctrlLine, Kp);
offsets[index] = (int)calOffset(deltas[index], ctrlLine, Kp);
}
}
}
......@@ -418,7 +443,7 @@ namespace FLY.FeedbackRenZiJia.Server
double[] getTargets(double[] thickPercents, double ctrlLine)
{
int range6 = 6;
//int range3 = 3;
int range3 = 3;
var signList = getSignList(thickPercents, 1);//以1%为盲区,获取同符号的厚度段。
......@@ -433,15 +458,13 @@ namespace FLY.FeedbackRenZiJia.Server
if (thickPercents[i] > 0)//这个块 大于正数
{
//把长块,中间的位置目标值 设为反向符号的 ctrlLine。 这样实现了打断功能
//setTargets(targets, -ctrlLine, i, range3);
targets[i] = -ctrlLine;
setTargets(targets, -ctrlLine, i, range3);
}
else
{
//这个块负数
//setTargets(targets, ctrlLine, i, range3);
targets[i] = ctrlLine;
setTargets(targets, ctrlLine, i, range3);
}
}
return targets;
......
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