部分io点修改,添加图片资源,添加注料功能逻辑
This commit is contained in:
commit
53eb3be876
9 files changed
+493
-39
No files matched your search
@@ -137,6 +137,7 @@
|
|||||||
<Compile Include="UserClass\HardwareSN.cs" />
|
<Compile Include="UserClass\HardwareSN.cs" />
|
||||||
<Compile Include="UserClass\IniFile.cs" />
|
<Compile Include="UserClass\IniFile.cs" />
|
||||||
<Compile Include="UserClass\Json.cs" />
|
<Compile Include="UserClass\Json.cs" />
|
||||||
|
<Compile Include="UserClass\LiquidDosingSystem.cs" />
|
||||||
<Compile Include="UserClass\LogDataRead.cs" />
|
<Compile Include="UserClass\LogDataRead.cs" />
|
||||||
<Compile Include="UserClass\ERRinf.cs" />
|
<Compile Include="UserClass\ERRinf.cs" />
|
||||||
<Compile Include="UserClass\LogGing.cs" />
|
<Compile Include="UserClass\LogGing.cs" />
|
||||||
@@ -432,6 +433,10 @@
|
|||||||
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
|
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
|
||||||
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
|
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
|
||||||
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
||||||
|
<Resource Include="Lmage\IconParkExtendY.png" />
|
||||||
|
<Resource Include="Lmage\IconParkExtendR.png" />
|
||||||
|
<Resource Include="Lmage\MdiPh.png" />
|
||||||
|
<Resource Include="Lmage\IconParkExtend.png" />
|
||||||
<Resource Include="Lmage\IconParkInfo.png" />
|
<Resource Include="Lmage\IconParkInfo.png" />
|
||||||
<Resource Include="Lmage\ID051.png" />
|
<Resource Include="Lmage\ID051.png" />
|
||||||
<Resource Include="Lmage\ID050.png" />
|
<Resource Include="Lmage\ID050.png" />
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
+17
-2
@@ -181,11 +181,26 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Image.Style>
|
</Image.Style>
|
||||||
</Image>
|
</Image>
|
||||||
|
<Image Height="40" VerticalAlignment="Center" Width="40" Visibility="{Binding EX_bool}">
|
||||||
|
<Image.Style>
|
||||||
|
<Style TargetType="Image">
|
||||||
|
<Setter Property="Source" Value="/Lmage/IconParkExtend.png"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding EX_str}" Value="309">
|
||||||
|
<Setter Property="Source" Value="/Lmage/IconParkExtendR.png"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding EX_str}" Value="308">
|
||||||
|
<Setter Property="Source" Value="/Lmage/IconParkExtendY.png"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Image.Style>
|
||||||
|
</Image>
|
||||||
|
<Image Height="40" VerticalAlignment="Center" Width="40" Source="/Lmage/link.png"
|
||||||
|
Visibility="{Binding Link_bool}"/>
|
||||||
<Image Height="40" Width="40" Source="/Lmage/IconParkLock.png"
|
<Image Height="40" Width="40" Source="/Lmage/IconParkLock.png"
|
||||||
Visibility="{Binding Lock_bool}" MouseLeftButtonDown="Image_MouseLeftButtonDown"
|
Visibility="{Binding Lock_bool}" MouseLeftButtonDown="Image_MouseLeftButtonDown"
|
||||||
MouseLeftButtonUp="Image_MouseLeftButtonUp" VerticalAlignment="Center"/>
|
MouseLeftButtonUp="Image_MouseLeftButtonUp" VerticalAlignment="Center"/>
|
||||||
<Image Height="40" VerticalAlignment="Center" Width="40" Source="/Lmage/link.png"
|
|
||||||
Visibility="{Binding Link_bool}"/>
|
|
||||||
<Image Height="40" Width="40" VerticalAlignment="Center" FlowDirection="LeftToRight"
|
<Image Height="40" Width="40" VerticalAlignment="Center" FlowDirection="LeftToRight"
|
||||||
MouseLeftButtonDown="Image_MouseLeftButtonDown_1"
|
MouseLeftButtonDown="Image_MouseLeftButtonDown_1"
|
||||||
MouseLeftButtonUp="Image_MouseLeftButtonUp_1">
|
MouseLeftButtonUp="Image_MouseLeftButtonUp_1">
|
||||||
|
|||||||
@@ -0,0 +1,262 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DyeingComputer.UserClass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 加注曲线类型
|
||||||
|
/// </summary>
|
||||||
|
public enum DosingCurveType
|
||||||
|
{
|
||||||
|
Linear, // 线性曲线
|
||||||
|
Parabolic, // 抛物线曲线(开始快,后来慢)
|
||||||
|
Exponential // 指数曲线(开始慢,后来快)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 液体加注PID控制器
|
||||||
|
/// </summary>
|
||||||
|
public class LiquidDosingController
|
||||||
|
{
|
||||||
|
private DateTime _startTime;
|
||||||
|
private DateTime _lastUpdateTime;
|
||||||
|
private double _lastLevel;
|
||||||
|
private bool _isDosingActive;
|
||||||
|
|
||||||
|
// PID控制器参数
|
||||||
|
private double _proportionalGain;
|
||||||
|
private double _integralGain;
|
||||||
|
private double _derivativeGain;
|
||||||
|
private double _integralTerm;
|
||||||
|
private double _lastError;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前比例阀开度 (0-100%)
|
||||||
|
/// </summary>
|
||||||
|
public double CurrentValveOpening { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标完成时间 (秒)
|
||||||
|
/// </summary>
|
||||||
|
public double TargetTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加注曲线类型
|
||||||
|
/// </summary>
|
||||||
|
public DosingCurveType CurveType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 容器最大容量
|
||||||
|
/// </summary>
|
||||||
|
public double MaxCapacity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前液位
|
||||||
|
/// </summary>
|
||||||
|
public double CurrentLevel { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已加注体积
|
||||||
|
/// </summary>
|
||||||
|
public double DosedVolume { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 液体加注事件
|
||||||
|
/// </summary>
|
||||||
|
public event Action<double> OnDosingUpdate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化液体加注控制器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="targetTime">目标加注时间(秒)</param>
|
||||||
|
/// <param name="maxCapacity">容器最大容量</param>
|
||||||
|
/// <param name="curveType">加注曲线类型</param>
|
||||||
|
/// <param name="kP">比例增益</param>
|
||||||
|
/// <param name="kI">积分增益</param>
|
||||||
|
/// <param name="kD">微分增益</param>
|
||||||
|
public LiquidDosingController(double targetTime, double maxCapacity,
|
||||||
|
DosingCurveType curveType = DosingCurveType.Linear,
|
||||||
|
double kP = 1.0, double kI = 0.1, double kD = 0.01)
|
||||||
|
{
|
||||||
|
TargetTime = targetTime;
|
||||||
|
MaxCapacity = maxCapacity;
|
||||||
|
CurveType = curveType;
|
||||||
|
|
||||||
|
_proportionalGain = kP;
|
||||||
|
_integralGain = kI;
|
||||||
|
_derivativeGain = kD;
|
||||||
|
|
||||||
|
_isDosingActive = false;
|
||||||
|
CurrentValveOpening = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始加注过程
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="initialLevel">初始液位</param>
|
||||||
|
public void StartDosing(double initialLevel)
|
||||||
|
{
|
||||||
|
if (_isDosingActive) return;
|
||||||
|
|
||||||
|
_lastLevel = initialLevel;
|
||||||
|
CurrentLevel = initialLevel;
|
||||||
|
DosedVolume = 0;
|
||||||
|
_integralTerm = 0;
|
||||||
|
_lastError = 0;
|
||||||
|
CurrentValveOpening = 0;
|
||||||
|
|
||||||
|
_startTime = DateTime.Now;
|
||||||
|
_lastUpdateTime = _startTime;
|
||||||
|
|
||||||
|
_isDosingActive = true;
|
||||||
|
|
||||||
|
OnDosingUpdate?.Invoke(CurrentValveOpening);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停止加注过程
|
||||||
|
/// </summary>
|
||||||
|
public void StopDosing()
|
||||||
|
{
|
||||||
|
_isDosingActive = false;
|
||||||
|
CurrentValveOpening = 0;
|
||||||
|
OnDosingUpdate?.Invoke(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新当前液位并计算新的阀门开度
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentLevel">当前液位</param>
|
||||||
|
/// <returns>新的阀门开度</returns>
|
||||||
|
public double UpdateLevel(double currentLevel)
|
||||||
|
{
|
||||||
|
if (!_isDosingActive) return 0;
|
||||||
|
|
||||||
|
// 获取当前时间
|
||||||
|
DateTime currentTime = DateTime.Now;
|
||||||
|
|
||||||
|
// 计算时间间隔
|
||||||
|
double timeInterval = (currentTime - _lastUpdateTime).TotalSeconds;
|
||||||
|
|
||||||
|
// 如果时间间隔太小,避免计算过于频繁
|
||||||
|
if (timeInterval < 0.1) return CurrentValveOpening;
|
||||||
|
|
||||||
|
// 更新液位
|
||||||
|
CurrentLevel = currentLevel;
|
||||||
|
|
||||||
|
// 计算这段时间内的液体减少量
|
||||||
|
double volumeDosedInInterval = _lastLevel - currentLevel;
|
||||||
|
DosedVolume += volumeDosedInInterval;
|
||||||
|
_lastLevel = currentLevel;
|
||||||
|
|
||||||
|
// 计算已用时间和剩余时间
|
||||||
|
double elapsedTime = (currentTime - _startTime).TotalSeconds;
|
||||||
|
double remainingTime = TargetTime - elapsedTime;
|
||||||
|
|
||||||
|
// 如果已超过目标时间,完全关闭阀门
|
||||||
|
if (remainingTime <= 0)
|
||||||
|
{
|
||||||
|
StopDosing();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算期望的加注速率(基于所选曲线类型)
|
||||||
|
double desiredDosingRate = CalculateDesiredDosingRate(elapsedTime, remainingTime);
|
||||||
|
|
||||||
|
// 计算实际加注速率(升/秒)
|
||||||
|
double actualDosingRate = volumeDosedInInterval / timeInterval;
|
||||||
|
|
||||||
|
// 计算误差(期望速率与实际速率之差)
|
||||||
|
double error = desiredDosingRate - actualDosingRate;
|
||||||
|
|
||||||
|
// PID计算
|
||||||
|
double proportionalTerm = _proportionalGain * error;
|
||||||
|
|
||||||
|
_integralTerm += _integralGain * error * timeInterval;
|
||||||
|
// 积分项抗饱和
|
||||||
|
_integralTerm = Math.Max(Math.Min(_integralTerm, 100), 0);
|
||||||
|
|
||||||
|
double derivativeTerm = _derivativeGain * (error - _lastError) / timeInterval;
|
||||||
|
_lastError = error;
|
||||||
|
|
||||||
|
// 计算新的阀门开度
|
||||||
|
double newValveOpening = CurrentValveOpening + proportionalTerm + _integralTerm + derivativeTerm;
|
||||||
|
|
||||||
|
// 限制阀门开度在0-100%范围内
|
||||||
|
newValveOpening = Math.Max(Math.Min(newValveOpening, 100), 0);
|
||||||
|
|
||||||
|
CurrentValveOpening = newValveOpening;
|
||||||
|
|
||||||
|
// 更新最后更新时间
|
||||||
|
_lastUpdateTime = currentTime;
|
||||||
|
|
||||||
|
// 触发更新事件
|
||||||
|
OnDosingUpdate?.Invoke(CurrentValveOpening);
|
||||||
|
|
||||||
|
// 检查是否已完成加注
|
||||||
|
if (CurrentLevel <= 0)
|
||||||
|
{
|
||||||
|
StopDosing();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CurrentValveOpening;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据曲线类型计算期望的加注速率
|
||||||
|
/// </summary>
|
||||||
|
private double CalculateDesiredDosingRate(double elapsedTime, double remainingTime)
|
||||||
|
{
|
||||||
|
double remainingVolume = CurrentLevel;
|
||||||
|
|
||||||
|
// 确保不会除零
|
||||||
|
if (remainingTime <= 0) return 0;
|
||||||
|
|
||||||
|
double progress = elapsedTime / TargetTime;
|
||||||
|
|
||||||
|
switch (CurveType)
|
||||||
|
{
|
||||||
|
case DosingCurveType.Linear:
|
||||||
|
// 线性:恒定速率
|
||||||
|
return remainingVolume / remainingTime;
|
||||||
|
|
||||||
|
case DosingCurveType.Parabolic:
|
||||||
|
// 抛物线:开始快,后来慢
|
||||||
|
// 使用二次函数减少速率
|
||||||
|
double parabolicFactor = 1.0 - Math.Pow(progress, 2);
|
||||||
|
return (remainingVolume / remainingTime) * parabolicFactor;
|
||||||
|
|
||||||
|
case DosingCurveType.Exponential:
|
||||||
|
// 指数:开始慢,后来快
|
||||||
|
// 使用指数函数增加速率
|
||||||
|
double exponentialFactor = Math.Exp(progress) / Math.Exp(1);
|
||||||
|
return (remainingVolume / remainingTime) * exponentialFactor;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return remainingVolume / remainingTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置PID参数
|
||||||
|
/// </summary>
|
||||||
|
public void SetPIDParameters(double kP, double kI, double kD)
|
||||||
|
{
|
||||||
|
_proportionalGain = kP;
|
||||||
|
_integralGain = kI;
|
||||||
|
_derivativeGain = kD;
|
||||||
|
|
||||||
|
// 重置积分项和误差
|
||||||
|
_integralTerm = 0;
|
||||||
|
_lastError = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查加注是否正在进行中
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDosingActive => _isDosingActive;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ using static DyeingComputer.UserClass.SqliteHelper;
|
|||||||
using static DyeingComputer.ViewModel.MainWindowViewModel;
|
using static DyeingComputer.ViewModel.MainWindowViewModel;
|
||||||
using static DyeingComputer.Windows.ViewStep;
|
using static DyeingComputer.Windows.ViewStep;
|
||||||
using static System.Net.WebRequestMethods;
|
using static System.Net.WebRequestMethods;
|
||||||
|
using static System.Security.Cryptography.ECCurve;
|
||||||
using static System.Windows.Forms.AxHost;
|
using static System.Windows.Forms.AxHost;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||||
@@ -838,8 +839,8 @@ namespace DyeingComputer.ViewModel
|
|||||||
STEP_P1 = Convert.ToDouble(P1);
|
STEP_P1 = Convert.ToDouble(P1);
|
||||||
STEP_P2 = Convert.ToDouble(P2);
|
STEP_P2 = Convert.ToDouble(P2);
|
||||||
STEP_P3 = Convert.ToDouble(P3);
|
STEP_P3 = Convert.ToDouble(P3);
|
||||||
STEP_P4 = Convert.ToDouble(P4);
|
STEP_P5 = 0;
|
||||||
STEP_P5 = Convert.ToDouble(P5);
|
STEP_TIME = 0;
|
||||||
SETP_runtime = true;
|
SETP_runtime = true;
|
||||||
STEP_finish = false;
|
STEP_finish = false;
|
||||||
break;
|
break;
|
||||||
@@ -943,6 +944,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
STEP_P1 = Convert.ToDouble(P1);
|
STEP_P1 = Convert.ToDouble(P1);
|
||||||
STEP_P2 = Convert.ToDouble(P2);
|
STEP_P2 = Convert.ToDouble(P2);
|
||||||
STEP_P3 = Convert.ToDouble(P3);
|
STEP_P3 = Convert.ToDouble(P3);
|
||||||
|
STEP_P5 = 0;
|
||||||
SETP_runtime = true;
|
SETP_runtime = true;
|
||||||
STEP_finish = false;
|
STEP_finish = false;
|
||||||
break;//药缸加药
|
break;//药缸加药
|
||||||
@@ -1032,8 +1034,6 @@ namespace DyeingComputer.ViewModel
|
|||||||
TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔
|
TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔
|
||||||
private int temp_time10s = 10;//开关周期时间
|
private int temp_time10s = 10;//开关周期时间
|
||||||
private bool PH_start = false;
|
private bool PH_start = false;
|
||||||
private double TANK1_L,TANK2_L,TANK3_L,TANK1_SL,TANK2_SL,TANK3_SL;//实际加料量|每秒加料量
|
|
||||||
private double TANK1_Pt, TANK1_Pc, TANK2_Pt, TANK2_Pc, TANK3_Pt, TANK3_Pc;//加料比例开度与模拟
|
|
||||||
private string TANK1, TANK2, TANK3;//料桶信息
|
private string TANK1, TANK2, TANK3;//料桶信息
|
||||||
public static string TANK1_DYELOT, TANK2_DYELOT, TANK3_DYELOT;//料单号
|
public static string TANK1_DYELOT, TANK2_DYELOT, TANK3_DYELOT;//料单号
|
||||||
private int TANK1_REDYE,TANK1_STEP, TANK2_REDYE, TANK2_STEP, TANK3_REDYE, TANK3_STEP;
|
private int TANK1_REDYE,TANK1_STEP, TANK2_REDYE, TANK2_STEP, TANK3_REDYE, TANK3_STEP;
|
||||||
@@ -1042,6 +1042,8 @@ namespace DyeingComputer.ViewModel
|
|||||||
int TIME_S;
|
int TIME_S;
|
||||||
double TO = 0;
|
double TO = 0;
|
||||||
double T = 0;
|
double T = 0;
|
||||||
|
int LT=0;
|
||||||
|
LiquidDosingController controller;
|
||||||
void STEP_RUN_master()
|
void STEP_RUN_master()
|
||||||
{
|
{
|
||||||
WORK_run = WORK_RUN;
|
WORK_run = WORK_RUN;
|
||||||
@@ -1409,9 +1411,89 @@ namespace DyeingComputer.ViewModel
|
|||||||
else { STEP_finish = true; }
|
else { STEP_finish = true; }
|
||||||
break;//批次水位水洗
|
break;//批次水位水洗
|
||||||
case "015":
|
case "015":
|
||||||
|
if (STEP_P5 == 0)//入水到水位
|
||||||
|
{
|
||||||
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Washing + ":" + Resources.AddWater + "1";
|
||||||
|
|
||||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Washing + "(" + Resources.Overflow + ")";
|
if (STEP_P1.ToString() == "1")
|
||||||
break;//溢流水洗
|
{
|
||||||
|
Updata_dtd("3013", true);
|
||||||
|
}
|
||||||
|
else if (STEP_P1.ToString() == "2")
|
||||||
|
{
|
||||||
|
Updata_dtd("3014", true);
|
||||||
|
}
|
||||||
|
else if (STEP_P1.ToString() == "3")
|
||||||
|
{
|
||||||
|
Updata_dtd("3015", true);
|
||||||
|
}
|
||||||
|
else if (STEP_P1.ToString() == "4")
|
||||||
|
{
|
||||||
|
Updata_dtd("3016", true);
|
||||||
|
}
|
||||||
|
if (Selet_dtm("1015") >= STEP_P2) //到达水位
|
||||||
|
{
|
||||||
|
ERRinf.ERRinf_d(errTabler, "202");//
|
||||||
|
STEP_TIME = 0;
|
||||||
|
STEP_P5 = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (STEP_TIME > MT44)
|
||||||
|
{
|
||||||
|
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Abnormal + "]", "202");//写入
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
STEP_TIME++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (STEP_P5 == 1)//流量水洗
|
||||||
|
{
|
||||||
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Washing + "(" + Resources.Overflow + ")";
|
||||||
|
|
||||||
|
Updata_dtd("3020", true);
|
||||||
|
if (STEP_P1.ToString() == "1")
|
||||||
|
{
|
||||||
|
Updata_dtd("3013", true);
|
||||||
|
}
|
||||||
|
else if (STEP_P1.ToString() == "2")
|
||||||
|
{
|
||||||
|
Updata_dtd("3014", true);
|
||||||
|
}
|
||||||
|
else if (STEP_P1.ToString() == "3")
|
||||||
|
{
|
||||||
|
Updata_dtd("3015", true);
|
||||||
|
}
|
||||||
|
else if (STEP_P1.ToString() == "4")
|
||||||
|
{
|
||||||
|
Updata_dtd("3016", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Selet_dtm("1016") >= STEP_P3) //到达水量
|
||||||
|
{
|
||||||
|
Updata_dtd("3013", false);
|
||||||
|
Updata_dtd("3014", false);
|
||||||
|
Updata_dtd("3015", false);
|
||||||
|
Updata_dtd("3016", false);
|
||||||
|
ERRinf.ERRinf_d(errTabler, "202");//
|
||||||
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.AddWater + ":" + Resources.Finish;
|
||||||
|
STEP_finish = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (STEP_TIME > MT44)
|
||||||
|
{
|
||||||
|
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Abnormal + "]", "202");//写入
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
STEP_TIME++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;//溢流水洗
|
||||||
case "017":
|
case "017":
|
||||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Washing + "(" + Properties.Resources.Cooling + ")";
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Washing + "(" + Properties.Resources.Cooling + ")";
|
||||||
break;//降温水洗
|
break;//降温水洗
|
||||||
@@ -1480,7 +1562,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3";
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Drainage + "3";
|
||||||
}
|
}
|
||||||
|
|
||||||
Updata_dtd("3020", true);//开排水泵
|
Updata_dtd("3075", true);//开排水泵
|
||||||
if (Selet_dtm("1015") <= STEP_P2) //排水状态完成
|
if (Selet_dtm("1015") <= STEP_P2) //排水状态完成
|
||||||
{
|
{
|
||||||
ERRinf.ERRinf_d(errTabler, "203");//
|
ERRinf.ERRinf_d(errTabler, "203");//
|
||||||
@@ -1489,7 +1571,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
Updata_dtd("3017", false);
|
Updata_dtd("3017", false);
|
||||||
Updata_dtd("3018", false);
|
Updata_dtd("3018", false);
|
||||||
Updata_dtd("3019", false);
|
Updata_dtd("3019", false);
|
||||||
Updata_dtd("3020", false);//开排水泵
|
Updata_dtd("3075", false);//开排水泵
|
||||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Finish;
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Drainage + ":" + Resources.Finish;
|
||||||
STEP_finish = true;
|
STEP_finish = true;
|
||||||
}
|
}
|
||||||
@@ -1851,23 +1933,116 @@ namespace DyeingComputer.ViewModel
|
|||||||
case "065":
|
case "065":
|
||||||
if (STEP_P1 == 1)
|
if (STEP_P1 == 1)
|
||||||
{
|
{
|
||||||
if ((TANK1_L - Selet_dtm("1017")) > TANK1_SL) { TANK1_Pc = TANK2_Pc - 3.3; }//计算比例
|
if (STEP_P5 == 0)
|
||||||
else { TANK1_Pc = TANK1_Pc + 3.3; }
|
{
|
||||||
if (((TANK1_Pt - TANK1_Pc) > 5) || ((TANK1_Pt - TANK1_Pc) > -5)) TANK1_Pt = TANK1_Pc;//调整比例
|
DosingCurveType Type;
|
||||||
|
if (STEP_P2 == 1) { Type = DosingCurveType.Parabolic; }
|
||||||
|
else if (STEP_P2 == 2) { Type = DosingCurveType.Exponential; }
|
||||||
|
else { Type = DosingCurveType.Linear; }
|
||||||
|
|
||||||
|
controller = new LiquidDosingController(
|
||||||
|
targetTime: STEP_P3 * 60,
|
||||||
|
maxCapacity: 1000,
|
||||||
|
curveType: Type,
|
||||||
|
kP: 0.8, kI: 0.05, kD: 0.1);
|
||||||
|
controller.StartDosing(Selet_dtm("1017"));
|
||||||
|
STEP_P5 = 1;
|
||||||
|
}
|
||||||
|
else if (STEP_P5 == 1)
|
||||||
|
{
|
||||||
|
int valveOpening = Convert.ToInt16(controller.UpdateLevel(Selet_dtm("1017")));
|
||||||
|
Updata_dta("5005", valveOpening);
|
||||||
|
if (Selet_dtm("1017") >= MS06)
|
||||||
|
{
|
||||||
|
LT = MS07;
|
||||||
|
Updata_dtd("3035",true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LT--;
|
||||||
|
if (LT <= 0)
|
||||||
|
{
|
||||||
|
Updata_dtd("3035", false);
|
||||||
|
STEP_finish = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 1 :" + Resources.AddTheMedicine;
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 1 :" + Resources.AddTheMedicine;
|
||||||
} //药缸1
|
} //药缸1
|
||||||
else if (STEP_P1 == 2)
|
else if (STEP_P1 == 2)
|
||||||
{
|
{
|
||||||
if ((TANK2_L - Selet_dtm("1018")) > TANK2_SL) { TANK2_Pc = TANK2_Pc - 3.3; }//计算比例
|
if (STEP_P5 == 0)
|
||||||
else { TANK2_Pc = TANK2_Pc + 3.3; }
|
{
|
||||||
if (((TANK2_Pt - TANK2_Pc) > 5) || ((TANK2_Pt - TANK2_Pc) > -5)) TANK2_Pt = TANK2_Pc;//调整比例
|
DosingCurveType Type;
|
||||||
|
if (STEP_P2 == 1) { Type = DosingCurveType.Parabolic; }
|
||||||
|
else if (STEP_P2 == 2) { Type = DosingCurveType.Exponential; }
|
||||||
|
else { Type = DosingCurveType.Linear; }
|
||||||
|
|
||||||
|
controller = new LiquidDosingController(
|
||||||
|
targetTime: STEP_P3 * 60,
|
||||||
|
maxCapacity: 1000,
|
||||||
|
curveType: Type,
|
||||||
|
kP: 0.8, kI: 0.05, kD: 0.1);
|
||||||
|
controller.StartDosing(Selet_dtm("1018"));
|
||||||
|
STEP_P5 = 1;
|
||||||
|
}
|
||||||
|
else if (STEP_P5 == 1)
|
||||||
|
{
|
||||||
|
int valveOpening = Convert.ToInt16(controller.UpdateLevel(Selet_dtm("1018")));
|
||||||
|
Updata_dta("5006", valveOpening);
|
||||||
|
if (Selet_dtm("1018") >= MS06)
|
||||||
|
{
|
||||||
|
LT = MS07;
|
||||||
|
Updata_dtd("3045", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LT--;
|
||||||
|
if (LT <= 0)
|
||||||
|
{
|
||||||
|
Updata_dtd("3045", false);
|
||||||
|
STEP_finish = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 2 :" + Resources.AddTheMedicine;
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 2 :" + Resources.AddTheMedicine;
|
||||||
}//药缸2
|
}//药缸2
|
||||||
else if (STEP_P1 == 3)
|
else if (STEP_P1 == 3)
|
||||||
{
|
{
|
||||||
if ((TANK3_L - Selet_dtm("1019")) > TANK3_SL) { TANK3_Pc = TANK3_Pc - 3.3; }//计算比例
|
if (STEP_P5 == 0)
|
||||||
else { TANK3_Pc = TANK3_Pc + 3.3; }
|
{
|
||||||
if (((TANK3_Pt - TANK3_Pc) > 5) || ((TANK3_Pt - TANK3_Pc) > -5)) TANK3_Pt = TANK3_Pc;//调整比例
|
DosingCurveType Type;
|
||||||
|
if (STEP_P2 == 1) { Type = DosingCurveType.Parabolic; }
|
||||||
|
else if (STEP_P2 == 2) { Type = DosingCurveType.Exponential; }
|
||||||
|
else { Type = DosingCurveType.Linear; }
|
||||||
|
|
||||||
|
controller = new LiquidDosingController(
|
||||||
|
targetTime: STEP_P3 * 60,
|
||||||
|
maxCapacity: 1000,
|
||||||
|
curveType: Type,
|
||||||
|
kP: 0.8, kI: 0.05, kD: 0.1);
|
||||||
|
controller.StartDosing(Selet_dtm("1019"));
|
||||||
|
STEP_P5 = 1;
|
||||||
|
}
|
||||||
|
else if (STEP_P5 == 1)
|
||||||
|
{
|
||||||
|
int valveOpening = Convert.ToInt16(controller.UpdateLevel(Selet_dtm("1019")));
|
||||||
|
Updata_dta("5007", valveOpening);
|
||||||
|
if (Selet_dtm("1019") >= MS06)
|
||||||
|
{
|
||||||
|
LT = MS07;
|
||||||
|
Updata_dtd("3035", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LT--;
|
||||||
|
if (LT <= 0)
|
||||||
|
{
|
||||||
|
Updata_dtd("3055", false);
|
||||||
|
STEP_finish = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 3 :" + Resources.AddTheMedicine;
|
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 3 :" + Resources.AddTheMedicine;
|
||||||
}//药缸3
|
}//药缸3
|
||||||
break;//药缸加药
|
break;//药缸加药
|
||||||
@@ -3240,18 +3415,18 @@ namespace DyeingComputer.ViewModel
|
|||||||
if (MT18 >= 11) SYSlog = SYSlog + " | " + "11 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1055")));
|
if (MT18 >= 11) SYSlog = SYSlog + " | " + "11 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1055")));
|
||||||
if (MT18 >= 12) SYSlog = SYSlog + " | " + "12 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1057")));
|
if (MT18 >= 12) SYSlog = SYSlog + " | " + "12 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1057")));
|
||||||
SYSlog = SYSlog + "\n" + Resources.Cycletime + "Sec";
|
SYSlog = SYSlog + "\n" + Resources.Cycletime + "Sec";
|
||||||
SYSlog = SYSlog + "\n" + "1 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1030")));
|
SYSlog = SYSlog + "\n" + "1 : " + string.Format("{0:D3}", Selet_dta("4017"));
|
||||||
if (MT18 >= 2) SYSlog = SYSlog + " | " + "2 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1031")));
|
if (MT18 >= 2) SYSlog = SYSlog + " | " + "2 : " + string.Format("{0:D3}", Selet_dta("4018"));
|
||||||
if (MT18 >= 3) SYSlog = SYSlog + " | " + "3 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1032")));
|
if (MT18 >= 3) SYSlog = SYSlog + " | " + "3 : " + string.Format("{0:D3}", Selet_dta("4019"));
|
||||||
if (MT18 >= 4) SYSlog = SYSlog + "\n" + "4 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1033")));
|
if (MT18 >= 4) SYSlog = SYSlog + "\n" + "4 : " + string.Format("{0:D3}", Selet_dta("4020"));
|
||||||
if (MT18 >= 5) SYSlog = SYSlog + " | " + "5 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1034")));
|
if (MT18 >= 5) SYSlog = SYSlog + " | " + "5 : " + string.Format("{0:D3}", Selet_dta("4021"));
|
||||||
if (MT18 >= 6) SYSlog = SYSlog + " | " + "6 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1036")));
|
if (MT18 >= 6) SYSlog = SYSlog + " | " + "6 : " + string.Format("{0:D3}", Selet_dta("4022"));
|
||||||
if (MT18 >= 7) SYSlog = SYSlog + "\n" + "7 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1038")));
|
if (MT18 >= 7) SYSlog = SYSlog + "\n" + "7 : " + string.Format("{0:D3}", Selet_dta("4023"));
|
||||||
if (MT18 >= 8) SYSlog = SYSlog + " | " + "8 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1040")));
|
if (MT18 >= 8) SYSlog = SYSlog + " | " + "8 : " + string.Format("{0:D3}", Selet_dta("4024"));
|
||||||
if (MT18 >= 9) SYSlog = SYSlog + " | " + "9 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1052")));
|
if (MT18 >= 9) SYSlog = SYSlog + " | " + "9 : " + string.Format("{0:D3}", Selet_dta("4025"));
|
||||||
if (MT18 >= 10) SYSlog = SYSlog + "\n" + "10 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1054")));
|
if (MT18 >= 10) SYSlog = SYSlog + "\n" + "10 : " + string.Format("{0:D3}", Selet_dta("4026"));
|
||||||
if (MT18 >= 11) SYSlog = SYSlog + " | " + "11 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1056")));
|
if (MT18 >= 11) SYSlog = SYSlog + " | " + "11 : " + string.Format("{0:D3}", Selet_dta("4027"));
|
||||||
if (MT18 >= 12) SYSlog = SYSlog + " | " + "12 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1058")));
|
if (MT18 >= 12) SYSlog = SYSlog + " | " + "12 : " + string.Format("{0:D3}", Selet_dta("4028"));
|
||||||
}//布轮信息
|
}//布轮信息
|
||||||
SYSlog = SYSlog + "\n-------------------------------------------------------";
|
SYSlog = SYSlog + "\n-------------------------------------------------------";
|
||||||
if (SM01 == 1)
|
if (SM01 == 1)
|
||||||
@@ -3321,7 +3496,6 @@ namespace DyeingComputer.ViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataTable dt_d = new DataTable("DIO");
|
public static DataTable dt_d = new DataTable("DIO");
|
||||||
|
|||||||
@@ -576,19 +576,17 @@ namespace DyeingComputer.Windows
|
|||||||
case "015":
|
case "015":
|
||||||
P1N.Text = Properties.Resources.Headwaters;
|
P1N.Text = Properties.Resources.Headwaters;
|
||||||
P2N.Text = Properties.Resources.WaterLevel;
|
P2N.Text = Properties.Resources.WaterLevel;
|
||||||
P3N.Text = Properties.Resources.Time;
|
P3N.Text = Properties.Resources.Flowmeter;
|
||||||
P4N.Text = Properties.Resources.Flowmeter;
|
|
||||||
P5N.Text = Properties.Resources.Target + Properties.Resources.Temperature;
|
|
||||||
P1.Visibility = Visibility.Visible;
|
P1.Visibility = Visibility.Visible;
|
||||||
P1N.Visibility = Visibility.Visible;
|
P1N.Visibility = Visibility.Visible;
|
||||||
P2.Visibility = Visibility.Visible;
|
P2.Visibility = Visibility.Visible;
|
||||||
P2N.Visibility = Visibility.Visible;
|
P2N.Visibility = Visibility.Visible;
|
||||||
P3.Visibility = Visibility.Visible;
|
P3.Visibility = Visibility.Visible;
|
||||||
P3N.Visibility = Visibility.Visible;
|
P3N.Visibility = Visibility.Visible;
|
||||||
P4.Visibility = Visibility.Visible;
|
P4.Visibility = Visibility.Collapsed;
|
||||||
P4N.Visibility = Visibility.Visible;
|
P4N.Visibility = Visibility.Collapsed;
|
||||||
P5.Visibility = Visibility.Visible;
|
P5.Visibility = Visibility.Collapsed;
|
||||||
P5N.Visibility = Visibility.Visible;
|
P5N.Visibility = Visibility.Collapsed;
|
||||||
imageP.Source = new BitmapImage(new Uri("/Lmage/ID015.png", UriKind.Relative));
|
imageP.Source = new BitmapImage(new Uri("/Lmage/ID015.png", UriKind.Relative));
|
||||||
break;
|
break;
|
||||||
case "017":
|
case "017":
|
||||||
|
|||||||
Reference in new issue
Block a user