压缩机PTC 功能

参数控制,由跟随速度到单个大参数控制
This commit is contained in:
2025-08-14 17:28:15 +08:00
parent c4be5e0929
commit 06ac590208
16 changed files with 3545 additions and 862 deletions

View File

@@ -9,6 +9,7 @@ namespace CapMachine.Model
{
/// <summary>
/// PTC入口温度(℃) 表设置
/// 给冷水机组
/// </summary>
[Table(Name = "MeterPTCEntTemp")]
public class MeterPTCEntTemp

View File

@@ -9,6 +9,7 @@ namespace CapMachine.Model
{
/// <summary>
/// PTC流量 表设置
/// 给冷水机组
/// </summary>
[Table(Name = "MeterPTCFlow")]
public class MeterPTCFlow

View File

@@ -3,7 +3,8 @@
namespace CapMachine.Model
{
/// <summary>
/// PTC功率 表设置
/// PTC功率 表设置 给压缩机的PTC使用
/// PTC SV1 PTC功率给定
/// </summary>
[Table(Name = "MeterPTCPw")]
public class MeterPTCPw

View File

@@ -3,7 +3,8 @@
namespace CapMachine.Model.MeterConfig
{
/// <summary>
/// PTC功率 表设置
/// PTC功率2 表设置 给压缩机的PTC使用
/// PTC SV2 PTC功率给定
/// </summary>
[Table(Name = "MeterPTCPw2")]
public class MeterPTCPw2

View File

@@ -0,0 +1,85 @@
using FreeSql.DataAnnotations;
namespace CapMachine.Model
{
/// <summary>
/// PTC水流量 表设置 给压缩机的PTC使用
/// PTC水流量
/// </summary>
[Table(Name = "MeterPTCWaterFlow")]
public class MeterPTCWaterFlow
{
/// <summary>
/// 主键
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 程序步骤序号
/// </summary>
[Column(Name = "StepNo")]
public int StepNo { get; set; }
/// <summary>
/// 开始值
/// </summary>
[Column(Name = "StartValue")]
public double StartValue { get; set; }
/// <summary>
/// 结束值
/// </summary>
[Column(Name = "EndValue")]
public double EndValue { get; set; }
/// <summary>
/// 维持时间
/// </summary>
[Column(Name = "KeepTime")]
public int KeepTime { get; set; }
/// <summary>
/// 配置值类型
/// </summary>
[Column(MapType = typeof(int))]
public ConfigValueType ValueType { get; set; }
/// <summary>
/// 常值
/// 在ValueType为常值时会使用
/// </summary>
[Column(Name = "Constant")]
public double Constant { get; set; }
/// <summary>
/// PID No
/// </summary>
[Column(Name = "PIDNo")]
public int PIDNo { get; set; }
/// <summary>
/// 限幅 No
/// </summary>
[Column(Name = "LimitNo")]
public int LimitNo { get; set; }
/// <summary>
/// 报警 No
/// </summary>
[Column(Name = "AlarmNo")]
public int AlarmNo { get; set; }
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
/// <summary>
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
/// </summary>
public long ProStepId { get; set; }
public ProStep? ProStep { get; set; }
}
}

View File

@@ -0,0 +1,85 @@
using FreeSql.DataAnnotations;
namespace CapMachine.Model
{
/// <summary>
/// PTC目标水温 表设置 给压缩机的PTC使用
/// PTC目标水温
/// </summary>
[Table(Name = "MeterPTCWaterTemp")]
public class MeterPTCWaterTemp
{
/// <summary>
/// 主键
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 程序步骤序号
/// </summary>
[Column(Name = "StepNo")]
public int StepNo { get; set; }
/// <summary>
/// 开始值
/// </summary>
[Column(Name = "StartValue")]
public double StartValue { get; set; }
/// <summary>
/// 结束值
/// </summary>
[Column(Name = "EndValue")]
public double EndValue { get; set; }
/// <summary>
/// 维持时间
/// </summary>
[Column(Name = "KeepTime")]
public int KeepTime { get; set; }
/// <summary>
/// 配置值类型
/// </summary>
[Column(MapType = typeof(int))]
public ConfigValueType ValueType { get; set; }
/// <summary>
/// 常值
/// 在ValueType为常值时会使用
/// </summary>
[Column(Name = "Constant")]
public double Constant { get; set; }
/// <summary>
/// PID No
/// </summary>
[Column(Name = "PIDNo")]
public int PIDNo { get; set; }
/// <summary>
/// 限幅 No
/// </summary>
[Column(Name = "LimitNo")]
public int LimitNo { get; set; }
/// <summary>
/// 报警 No
/// </summary>
[Column(Name = "AlarmNo")]
public int AlarmNo { get; set; }
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
/// <summary>
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
/// </summary>
public long ProStepId { get; set; }
public ProStep? ProStep { get; set; }
}
}

View File

@@ -106,33 +106,33 @@ namespace CapMachine.Model
[Column(Name = "PTCEnable")]
public bool PTCEnable { get; set; }
/// <summary>
/// 加热器 PTC功率1
/// 跟随速度步骤的常值数据
/// </summary>
[Column(Name = "PTCPw1")]
public double PTCPw1 { get; set; }
///// <summary>
///// 加热器 PTC功率1
///// 跟随速度步骤的常值数据
///// </summary>
//[Column(Name = "PTCPw1")]
//public double PTCPw1 { get; set; }
/// <summary>
/// 加热器 PTC功率2
/// 跟随速度步骤的常值数据
/// </summary>
[Column(Name = "PTCPw2")]
public double PTCPw2 { get; set; }
///// <summary>
///// 加热器 PTC功率2
///// 跟随速度步骤的常值数据
///// </summary>
//[Column(Name = "PTCPw2")]
//public double PTCPw2 { get; set; }
/// <summary>
/// 加热器 PTC水流量
/// 跟随速度步骤的常值数据
/// </summary>
[Column(Name = "PTCWaterFlow")]
public double PTCWaterFlow { get; set; }
///// <summary>
///// 加热器 PTC水流量
///// 跟随速度步骤的常值数据
///// </summary>
//[Column(Name = "PTCWaterFlow")]
//public double PTCWaterFlow { get; set; }
/// <summary>
/// 加热器 PTC水温
/// 跟随速度步骤的常值数据
/// </summary>
[Column(Name = "PTCWaterTemp")]
public double PTCWaterTemp { get; set; }
///// <summary>
///// 加热器 PTC水温
///// 跟随速度步骤的常值数据
///// </summary>
//[Column(Name = "PTCWaterTemp")]
//public double PTCWaterTemp { get; set; }
///// <summary>

View File

@@ -1,4 +1,5 @@
using FreeSql.DataAnnotations;
using CapMachine.Model.MeterConfig;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
@@ -117,22 +118,47 @@ namespace CapMachine.Model
/// OS2温度/吸气混合器温度
/// </summary>
public List<MeterOS2Temp>? MeterOS2Temps { get; set; } = new List<MeterOS2Temp>();
/// <summary>
/// PTC入口水温
/// 给冷水机组
/// </summary>
public List<MeterPTCEntTemp>? MeterPTCEntTemps { get; set; } = new List<MeterPTCEntTemp>();
/// <summary>
/// PTC流量
/// 给冷水机组
/// </summary>
public List<MeterPTCFlow>? MeterPTCFlows { get; set; } = new List<MeterPTCFlow>();
/// <summary>
/// PTC功率
/// PTC功率SV1
/// 给压缩机PTC使用
/// </summary>
public List<MeterPTCPw>? MeterPTCPws { get; set; } = new List<MeterPTCPw>();
/// <summary>
/// PTC功率SV2
/// 给压缩机PTC使用
/// </summary>
public List<MeterPTCPw2>? MeterPTCPw2s { get; set; } = new List<MeterPTCPw2>();
/// <summary>
/// PTC目标水温
/// 给压缩机PTC使用
/// </summary>
public List<MeterPTCWaterTemp>? MeterPTCWaterTemps { get; set; } = new List<MeterPTCWaterTemp>();
/// <summary>
/// PTC水流量
/// 给压缩机PTC使用
/// </summary>
public List<MeterPTCWaterFlow>? MeterPTCWaterFlows { get; set; } = new List<MeterPTCWaterFlow>();
/// <summary>
/// 试验箱湿度
/// </summary>
public List<MeterEnvRH>? MeterEnvRHs { get; set; } = new List<MeterEnvRH>();
/// <summary>
/// 试验箱温度
/// </summary>

View File

@@ -59,6 +59,12 @@ namespace CapMachine.Wpf.ChannelModel
/// </summary>
public bool IsSpeed { get; set; } = false;
/// <summary>
/// 执行标记信息
/// 特殊的参数控制
/// </summary>
public ProExFlag ProExFlag { get; set; }
/// <summary>
/// 拓展参数集合
/// 比如:速度参数拓展的输出锁定、吸排气阀,压缩机使能等这些拓展参数

View File

@@ -29,7 +29,7 @@ namespace CapMachine.Model
///// </summary>
//public int StepRepeat { get; set; }
private CycleInfoDto? _SpeedCycle=new CycleInfoDto();
private CycleInfoDto? _SpeedCycle = new CycleInfoDto();
/// <summary>
/// 速度循环信息
/// </summary>
@@ -209,6 +209,40 @@ namespace CapMachine.Model
set { _MeterPTCPwInfo = value; RaisePropertyChanged(); }
}
private string? _MeterPTCPw2Info;
/// <summary>
/// MeterPTCPw 2 信息
/// </summary>
public string? MeterPTCPw2Info
{
get { return _MeterPTCPw2Info; }
set { _MeterPTCPw2Info = value; RaisePropertyChanged(); }
}
private string? _MeterPTCWaterTempInfo;
/// <summary>
/// MeterPTCWaterTemp 信息
/// </summary>
public string? MeterPTCWaterTempInfo
{
get { return _MeterPTCWaterTempInfo; }
set { _MeterPTCWaterTempInfo = value; RaisePropertyChanged(); }
}
private string? _MeterPTCWaterFlowInfo;
/// <summary>
/// MeterPTCWaterFlow 信息
/// </summary>
public string? MeterPTCWaterFlowInfo
{
get { return _MeterPTCWaterFlowInfo; }
set { _MeterPTCWaterFlowInfo = value; RaisePropertyChanged(); }
}
private string? _MeterEnvRHInfo;
/// <summary>
/// MeterTestBoxRH 信息

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CapMachine.Wpf.Models.ProModelPars
{
/// <summary>
/// 程序执行的标志信息
/// </summary>
public enum ProExFlag
{
/// <summary>
/// 没有特殊的标记
/// </summary>
None = 0,
/// <summary>
/// 压缩机 转速
/// </summary>
CapSpeed = 100,
/// <summary>
/// 压缩机PTC 功率SV1
/// 像速度一样这个执行不需要写入到PLC发给仪表控制直接发送给压缩机PTC控制
/// </summary>
CapPTCPw = 1,
/// <summary>
/// 压缩机PTC 功率SV2
/// 像速度一样这个执行不需要写入到PLC发给仪表控制直接发送给压缩机PTC控制
/// </summary>
CapPTCPw2 = 2,
/// <summary>
/// 压缩机PTC 目标水温
/// 像速度一样这个执行不需要写入到PLC发给仪表控制直接发送给压缩机PTC控制
/// </summary>
CapPTCWaterTemp = 3,
/// <summary>
/// 压缩机PTC 水流量
/// 像速度一样这个执行不需要写入到PLC发给仪表控制直接发送给压缩机PTC控制
/// </summary>
CapPTCWaterFlow = 4,
}
}

View File

@@ -44,6 +44,12 @@ namespace CapMachine.Wpf.Models.ProModelPars
/// </summary>
public bool IsSpeed { get; set; } = false;
/// <summary>
/// 执行标记信息
/// 特殊的参数控制
/// </summary>
public ProExFlag ProExFlag { get; set; }
/// <summary>
/// 程序执行管道
/// </summary>
@@ -248,6 +254,7 @@ namespace CapMachine.Wpf.Models.ProModelPars
CurLoadPID = PidResult == true ? new PID() { P = (short)NextProStepExe.CurConfigPIDDto.P, I = (short)NextProStepExe.CurConfigPIDDto.I, D = (short)NextProStepExe.CurConfigPIDDto.D } : new PID(),
RunStepType = GetRunStepType(PidResult, LimitResult, false),
IsSpeed = IsSpeed,
ProExFlag= ProExFlag,
ListStepExd = GetStepExds(NextProStepExe),//拓展参数
@@ -305,6 +312,7 @@ namespace CapMachine.Wpf.Models.ProModelPars
CurLoadPID = PidResult == true ? new PID() { P = (short)NextProStepExe.CurConfigPIDDto.P, I = (short)NextProStepExe.CurConfigPIDDto.I, D = (short)NextProStepExe.CurConfigPIDDto.D } : new PID(),
RunStepType = GetRunStepType(PidResult, LimitResult, true),
IsSpeed = IsSpeed,
ProExFlag = ProExFlag,
ListStepExd = GetStepExds(NextProStepExe),//拓展参数
});
@@ -490,6 +498,7 @@ namespace CapMachine.Wpf.Models.ProModelPars
MeterName = MeterName,
SV = NoExData.First().SV,
IsSpeed = IsSpeed,
ProExFlag = ProExFlag,
ProSegName = CurProStepExe.ProSegName,
MeterStep = CurProStepExe.MeterStep,

View File

@@ -797,7 +797,7 @@ namespace CapMachine.Wpf.Services
EnName = "PTCPw",
Group = "程序",
MinValue = 0,
MaxValue = 150,
MaxValue = 5000,
IsMeter = true,
DecimalPoint = 1,
Precision = 1,
@@ -819,36 +819,100 @@ namespace CapMachine.Wpf.Services
RWInfo = RWInfo.Control,
});
//PTC功率2 控制但非仪表控制 -北厂未启用此功能,南厂有此功能
//TagManger.AddTag(new ShortControlTag()
//{
// Id = 201,
// Name = "PTC功率2[W]",
// NameNoUnit = "PTC功率2",
// EnName = "PTCPw2",
// Group = "程序",
// MinValue = 0,
// MaxValue = 10000,
// IsMeter = true,
// DecimalPoint = 1,
// Precision = 1,
// Unit = "W",
// DataType = TagDataType.Short,
// PVModel = new MeterValueAttrCell() { Address = "VW434", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 334},
// SVModel = new MeterValueAttrCell() { Address = "VW434", EngValue = 0, EngValueStr = "", Block = "SV", BlockIndex = 34 },
// MVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "MV", BlockIndex = 1, Enable = false },
// MVAutoHandModel = new MvAmAttrCell() { Address = "", EngValueStr = "", Block = "MVAM", BlockIndex = 1, Enable = false },
//PTC功率2 控制但非仪表控制
TagManger.AddTag(new ShortControlTag()
{
Id = 201,
Name = "PTC功率2[W]",
NameNoUnit = "PTC功率2",
EnName = "PTCPw2",
Group = "程序",
MinValue = 0,
MaxValue = 10000,
IsMeter = true,
DecimalPoint = 1,
Precision = 1,
Unit = "W",
DataType = TagDataType.Short,
PVModel = new MeterValueAttrCell() { Address = "VW14022", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 334 },
SVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "SV", BlockIndex = 34 },
MVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "MV", BlockIndex = 1, Enable = false },
MVAutoHandModel = new MvAmAttrCell() { Address = "", EngValueStr = "", Block = "MVAM", BlockIndex = 1, Enable = false },
// Pid_PModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
// Pid_IModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
// Pid_DModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
// Limit_UpModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
// Limit_DownModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
// AlarmModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
// AutoHandState = false,
Pid_PModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Pid_IModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Pid_DModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Limit_UpModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Limit_DownModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
AlarmModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
AutoHandState = false,
RWInfo = RWInfo.Control,
});
//PTC目标水温 控制但非仪表控制
TagManger.AddTag(new ShortControlTag()
{
Id = 202,
Name = "PTC目标水温[℃]",
NameNoUnit = "PTC目标水温",
EnName = "PTCWaterTemp",
Group = "程序",
MinValue = 0,
MaxValue = 150,
IsMeter = true,
DecimalPoint = 1,
Precision = 1,
Unit = "W",
DataType = TagDataType.Short,
PVModel = new MeterValueAttrCell() { Address = "VW14026", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 334 },
SVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "SV", BlockIndex = 34 },
MVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "MV", BlockIndex = 1, Enable = false },
MVAutoHandModel = new MvAmAttrCell() { Address = "", EngValueStr = "", Block = "MVAM", BlockIndex = 1, Enable = false },
Pid_PModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Pid_IModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Pid_DModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Limit_UpModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Limit_DownModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
AlarmModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
AutoHandState = false,
RWInfo = RWInfo.Control,
});
//PTC水流量 控制但非仪表控制
TagManger.AddTag(new ShortControlTag()
{
Id = 203,
Name = "PTC水流量[L/Min]",
NameNoUnit = "PTC水流量",
EnName = "PTCWaterFlow",
Group = "程序",
MinValue = 0,
MaxValue = 500,
IsMeter = true,
DecimalPoint = 2,
Precision = 1,
Unit = "W",
DataType = TagDataType.Short,
PVModel = new MeterValueAttrCell() { Address = "VW14024", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 334 },
SVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "SV", BlockIndex = 34 },
MVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "MV", BlockIndex = 1, Enable = false },
MVAutoHandModel = new MvAmAttrCell() { Address = "", EngValueStr = "", Block = "MVAM", BlockIndex = 1, Enable = false },
Pid_PModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Pid_IModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Pid_DModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Limit_UpModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
Limit_DownModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
AlarmModel = new MeterExdAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Enable = false },
AutoHandState = false,
RWInfo = RWInfo.Control,
});
// RWInfo = RWInfo.Control,
//});
//PTC流量 控制但非仪表控制
@@ -2939,6 +3003,31 @@ namespace CapMachine.Wpf.Services
{
while (ProRunChannel.Reader.TryRead(out var ProRunChannelData))
{
if (ProRunChannelData.ProExFlag != ProExFlag.None)
{
switch (ProRunChannelData.ProExFlag)
{
case ProExFlag.CapSpeed:
SendSpeedSvToCap(ProRunChannelData.SV);
break;
case ProExFlag.CapPTCPw:
SendPTCPwSvToCap(ProRunChannelData.SV);
break;
case ProExFlag.CapPTCPw2:
SendPTCPwSv2ToCap(ProRunChannelData.SV);
break;
case ProExFlag.CapPTCWaterTemp:
SendPTCWaterTempToCap(ProRunChannelData.SV);
break;
case ProExFlag.CapPTCWaterFlow:
SendPTCWaterFlowToCap(ProRunChannelData.SV);
break;
default:
break;
}
continue;
}
////第一次计时
//stopwatch.Start(); //启动Stopwatch
switch (ProRunChannelData.RunStepType)
@@ -3149,89 +3238,89 @@ namespace CapMachine.Wpf.Services
continue;
}
//压缩机PTC功率1的参数直接给压缩机触发
if (itemStepExd.Name!.Contains("PTC功率1"))
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
CanDriveService.UpdateCapPTCPwCmdData((double)itemStepExd.Value!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapPTCPwCmdData((double)itemStepExd.Value!);
break;
case CanLinEnum.Lin:
LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
break;
default:
break;
}
continue;
}
////压缩机PTC功率1的参数直接给压缩机触发
//if (itemStepExd.Name!.Contains("PTC功率1"))
//{
// switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
// {
// case CanLinEnum.Can:
// CanDriveService.UpdateCapPTCPwCmdData((double)itemStepExd.Value!);
// break;
// case CanLinEnum.CANFD:
// CanFdDriveService.UpdateCapPTCPwCmdData((double)itemStepExd.Value!);
// break;
// case CanLinEnum.Lin:
// LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
// break;
// default:
// break;
// }
// continue;
//}
//压缩机PTC功率2的参数直接给压缩机触发
if (itemStepExd.Name!.Contains("PTC功率2"))
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
CanDriveService.UpdateCapPTCPwCmdData((double)itemStepExd.Value!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapPTCPwCmdData((double)itemStepExd.Value!);
break;
case CanLinEnum.Lin:
//LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
break;
default:
break;
}
continue;
}
////压缩机PTC功率2的参数直接给压缩机触发
//if (itemStepExd.Name!.Contains("PTC功率2"))
//{
// switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
// {
// case CanLinEnum.Can:
// CanDriveService.UpdateCapPTCPwCmdData((double)itemStepExd.Value!);
// break;
// case CanLinEnum.CANFD:
// CanFdDriveService.UpdateCapPTCPwCmdData((double)itemStepExd.Value!);
// break;
// case CanLinEnum.Lin:
// //LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
// break;
// default:
// break;
// }
// continue;
//}
//压缩机PTC水流量的参数直接给压缩机触发
if (itemStepExd.Name!.Contains("PTC水流量"))
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
CanDriveService.UpdateCapPTCFlowCmdData((double)itemStepExd.Value!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapPTCFlowCmdData((double)itemStepExd.Value!);
break;
case CanLinEnum.Lin:
//LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
break;
default:
break;
}
continue;
}
////压缩机PTC水流量的参数直接给压缩机触发
//if (itemStepExd.Name!.Contains("PTC水流量"))
//{
// switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
// {
// case CanLinEnum.Can:
// CanDriveService.UpdateCapPTCFlowCmdData((double)itemStepExd.Value!);
// break;
// case CanLinEnum.CANFD:
// CanFdDriveService.UpdateCapPTCFlowCmdData((double)itemStepExd.Value!);
// break;
// case CanLinEnum.Lin:
// //LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
// break;
// default:
// break;
// }
// continue;
//}
//压缩机PTC水温的参数直接给压缩机触发
if (itemStepExd.Name!.Contains("PTC水温"))
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
CanDriveService.UpdateCapPTCWaterTempCmdData((double)itemStepExd.Value!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapPTCWaterTempCmdData((double)itemStepExd.Value!);
break;
case CanLinEnum.Lin:
//LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
break;
default:
break;
}
continue;
////压缩机PTC水温的参数直接给压缩机触发
//if (itemStepExd.Name!.Contains("PTC水温"))
//{
// switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
// {
// case CanLinEnum.Can:
// CanDriveService.UpdateCapPTCWaterTempCmdData((double)itemStepExd.Value!);
// break;
// case CanLinEnum.CANFD:
// CanFdDriveService.UpdateCapPTCWaterTempCmdData((double)itemStepExd.Value!);
// break;
// case CanLinEnum.Lin:
// //LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
// break;
// default:
// break;
// }
// continue;
//Console.WriteLine($"{ProRunChannelData.MeterName}拓展参数------------:{itemStepExd.Name}:{itemStepExd.Value}");
//continue;
}
// //Console.WriteLine($"{ProRunChannelData.MeterName}拓展参数------------:{itemStepExd.Name}:{itemStepExd.Value}");
// //continue;
//}
var DataAdrees = ListPlcExdConfigCell.FirstOrDefault(a => a.Name == itemStepExd.Name);
if (DataAdrees != null)
@@ -3292,6 +3381,7 @@ namespace CapMachine.Wpf.Services
}
}
/// <summary>
/// 发送速度SV到压缩机
/// 自动步骤数据发送
@@ -3329,6 +3419,98 @@ namespace CapMachine.Wpf.Services
}
}
/// <summary>
/// 发送PTCPw SV到压缩机
/// 自动步骤数据发送
/// </summary>
private void SendPTCPwSvToCap(double Valuve)
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
CanDriveService.UpdateCapPTCPwCmdData(Valuve!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapPTCPwCmdData(Valuve!);
break;
case CanLinEnum.Lin:
//LinDriveService.UpdateCapPTCPwCmdData((bool)ProRunChannelData.SV!);
break;
default:
break;
}
}
/// <summary>
/// 发送PTCPw2 SV到压缩机
/// 自动步骤数据发送
/// </summary>
private void SendPTCPwSv2ToCap(double Valuve)
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
CanDriveService.UpdateCapPTCPwCmdData(Valuve!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapPTCPwCmdData(Valuve!);
break;
case CanLinEnum.Lin:
//LinDriveService.UpdateCapPTCPwCmdData((bool)ProRunChannelData.SV!);
break;
default:
break;
}
}
/// <summary>
/// 发送PTCPw2 SV到压缩机
/// 自动步骤数据发送
/// </summary>
private void SendPTCWaterTempToCap(double Valuve)
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
CanDriveService.UpdateCapPTCWaterTempCmdData(Valuve!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapPTCWaterTempCmdData(Valuve!);
break;
case CanLinEnum.Lin:
//LinDriveService.UpdateCapPTCPwCmdData((bool)ProRunChannelData.SV!);
break;
default:
break;
}
}
/// <summary>
/// 发送PTCPw2 SV到压缩机
/// 自动步骤数据发送
/// </summary>
private void SendPTCWaterFlowToCap(double Valuve)
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
CanDriveService.UpdateCapPTCFlowCmdData(Valuve!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapPTCFlowCmdData(Valuve!);
break;
case CanLinEnum.Lin:
//LinDriveService.UpdateCapPTCPwCmdData((bool)ProRunChannelData.SV!);
break;
default:
break;
}
}
#endregion
}
}

View File

@@ -82,6 +82,7 @@ namespace CapMachine.Wpf.Services
MeterName = itemKeyValue.Value.NameNoUnit,
ListProStepExe = new List<ProStepExe>(),
IsSpeed = itemKeyValue.Value.Name.Contains("转速") == true ? true : false,
ProExFlag = GetProExFlagByName(itemKeyValue.Value.NameNoUnit),
CurShortControlTag = MachineRtDataService.TagManger.GetShortControlTagByName(itemKeyValue.Key)!,
});
}
@@ -166,6 +167,32 @@ namespace CapMachine.Wpf.Services
return $"{hours}:{minutes:D2}:{seconds:D2}";
}
/// <summary>
/// 根据名称获取具体的标记信息
/// </summary>
/// <returns></returns>
private ProExFlag GetProExFlagByName(string Name)
{
//转速的话,直接获取
if (Name.Contains("转速")) return ProExFlag.CapSpeed;
switch (Name)
{
case "PTC功率":
return ProExFlag.CapPTCPw;
case "PTC功率2":
return ProExFlag.CapPTCPw2;
case "PTC目标水温":
return ProExFlag.CapPTCWaterTemp;
case "PTC水流量":
return ProExFlag.CapPTCWaterFlow;
default:
return ProExFlag.None;
}
}
/// <summary>
/// 是否在下载中
/// </summary>
@@ -231,6 +258,9 @@ namespace CapMachine.Wpf.Services
.IncludeMany(b => b.MeterPTCPws)
.IncludeMany(b => b.MeterEnvRHs)
.IncludeMany(b => b.MeterEnvTemps)
.IncludeMany(b => b.MeterPTCPw2s)
.IncludeMany(b => b.MeterPTCWaterFlows)
.IncludeMany(b => b.MeterPTCWaterTemps)
).ToList().FirstOrDefault();
//获取当前的程序
@@ -314,10 +344,10 @@ namespace CapMachine.Wpf.Services
new StepExd(){ Name="压缩机使能",Value=itemMeterValueCell.CapEnable,ValueType=ExdValueType.Bool},
new StepExd(){ Name="PTC使能",Value=itemMeterValueCell.PTCEnable,ValueType=ExdValueType.Bool},
new StepExd(){ Name="PTC功率1",Value=itemMeterValueCell.PTCPw1,ValueType=ExdValueType.Double},
new StepExd(){ Name="PTC功率2",Value=itemMeterValueCell.PTCPw2,ValueType=ExdValueType.Double},
new StepExd(){ Name="PTC水流量",Value=itemMeterValueCell.PTCWaterFlow,ValueType=ExdValueType.Double},
new StepExd(){ Name="PTC水温",Value=itemMeterValueCell.PTCWaterTemp,ValueType=ExdValueType.Double},
//new StepExd(){ Name="PTC功率1",Value=itemMeterValueCell.PTCPw1,ValueType=ExdValueType.Double},
//new StepExd(){ Name="PTC功率2",Value=itemMeterValueCell.PTCPw2,ValueType=ExdValueType.Double},
//new StepExd(){ Name="PTC水流量",Value=itemMeterValueCell.PTCWaterFlow,ValueType=ExdValueType.Double},
//new StepExd(){ Name="PTC水温",Value=itemMeterValueCell.PTCWaterTemp,ValueType=ExdValueType.Double},
},
ProStepInfo = $"{itemStep.StepNo}",
@@ -387,10 +417,10 @@ namespace CapMachine.Wpf.Services
new StepExd(){ Name="压缩机使能",Value=itemMeterValueCell.CapEnable,ValueType=ExdValueType.Bool},
new StepExd(){ Name="PTC使能",Value=itemMeterValueCell.PTCEnable,ValueType=ExdValueType.Bool},
new StepExd(){ Name="PTC功率1",Value=itemMeterValueCell.PTCPw1,ValueType=ExdValueType.Double},
new StepExd(){ Name="PTC功率2",Value=itemMeterValueCell.PTCPw2,ValueType=ExdValueType.Double},
new StepExd(){ Name="PTC水流量",Value=itemMeterValueCell.PTCWaterFlow,ValueType=ExdValueType.Double},
new StepExd(){ Name="PTC水温",Value=itemMeterValueCell.PTCWaterTemp,ValueType=ExdValueType.Double},
//new StepExd(){ Name="PTC功率1",Value=itemMeterValueCell.PTCPw1,ValueType=ExdValueType.Double},
//new StepExd(){ Name="PTC功率2",Value=itemMeterValueCell.PTCPw2,ValueType=ExdValueType.Double},
//new StepExd(){ Name="PTC水流量",Value=itemMeterValueCell.PTCWaterFlow,ValueType=ExdValueType.Double},
//new StepExd(){ Name="PTC水温",Value=itemMeterValueCell.PTCWaterTemp,ValueType=ExdValueType.Double},
},
ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}",
@@ -3167,6 +3197,466 @@ namespace CapMachine.Wpf.Services
}
//********* 单个【PTC功率2】步骤信息的解析 *********
{
var CurMeterName = "PTC功率2";
if (itemStep.MeterPTCPw2s != null && itemStep.MeterPTCPw2s.Any())
{
switch (itemStep.MeterPTCPw2s.FirstOrDefault()!.ValueType)
{
case ConfigValueType.Constant: //常值
//常值的话就一个数据,循环执行一次
foreach (var itemMeterValueCell in itemStep.MeterPTCPw2s)
{
var Pid = new ConfigPID();
if (FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).Any())
{
Pid = FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).First();
}
var Limit = new ConfigLimit();
if (FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).Any())
{
Limit = FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).First();
}
var Alarm = new ConfigAlarm();
if (FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).Any())
{
Alarm = FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).First();
}
ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Add(new ProStepExe()
{
//程序块
ProSegName = CurProgramSeg.Name,
ProSegStep = SegIndex,
ProSegRepeat = CurProgramSeg.ProRepeat,
ProSegIsExeing = false,//配置阶段默认不执行 false
//程序步骤数据
StartSV = GetSVByProcess(itemMeterValueCell.Constant, CurMeterName),
EndSV = GetSVByProcess(itemMeterValueCell.Constant, CurMeterName),
KeepTime = itemMeterValueCell.KeepTime,
MeterStepIsExeing = false,//配置阶段默认不执行 false
MeterStepIsOK = false,//配置阶段默认不完成 false
ExistSlop = false,//常值没有斜率 //开始和结束不一样则存在斜率
MeterStep = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Count + 1,
MeterName = CurMeterName,
LimitNo = itemMeterValueCell.LimitNo,
AlarmNo = itemMeterValueCell.AlarmNo,
PIDNo = itemMeterValueCell.PIDNo,
CurConfigPIDDto = Mapper.Map<ConfigPIDDto>(Pid),
CurConfigLimitDto = Mapper.Map<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(Alarm),
ProStepInfo = $"{itemStep.StepNo}",
ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}",
StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]",
});
}
break;
case ConfigValueType.Slope:
//带斜率
//根据循环次数确定
var Cycle = GetCycleBySpeed(itemStep.MeterSpeeds, itemStep.SpeedCycle, itemStep.MeterPTCPw2s.Select(p => new MeterCom { Constant = p.Constant, KeepTime = p.KeepTime, StepNo = p.StepNo, ValueType = p.ValueType }).ToList());
for (int StepCycleIndex = 1; StepCycleIndex <= Cycle; StepCycleIndex++)
{
//根据循环次数执行
foreach (var itemMeterValueCell in itemStep.MeterPTCPw2s)
{
var Pid = new ConfigPID();
if (FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).Any())
{
Pid = FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).First();
}
var Limit = new ConfigLimit();
if (FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).Any())
{
Limit = FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).First();
}
var Alarm = new ConfigAlarm();
if (FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).Any())
{
Alarm = FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).First();
}
ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Add(new ProStepExe()
{
//程序块
ProSegName = CurProgramSeg.Name,
ProSegStep = SegIndex,
ProSegRepeat = CurProgramSeg.ProRepeat,
ProSegIsExeing = false,//配置阶段默认不执行 false
//程序步骤数据
//SV = CALCHelper.GetQuickSV(itemMeterValueCell.Constant, 1),
StartSV = GetSVByProcess(itemMeterValueCell.StartValue, CurMeterName),
EndSV = GetSVByProcess(itemMeterValueCell.EndValue, CurMeterName),
KeepTime = itemMeterValueCell.KeepTime,
MeterStepIsExeing = false,//配置阶段默认不执行 false
MeterStepIsOK = false,//配置阶段默认不完成 false
ExistSlop = itemMeterValueCell.StartValue == itemMeterValueCell.EndValue ? false : true,//开始和结束不一样则存在斜率
MeterStep = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Count + 1,
LimitNo = itemMeterValueCell.LimitNo,
AlarmNo = itemMeterValueCell.AlarmNo,
PIDNo = itemMeterValueCell.PIDNo,
CurConfigPIDDto = Mapper.Map<ConfigPIDDto>(Pid),
CurConfigLimitDto = Mapper.Map<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(Alarm),
ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}",
ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}",
StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]",
MeterName = CurMeterName,
});
}
}
break;
default:
break;
}
}
else
{
//判断当前的参数是全部都没有设置还是这一步没有设置,如果这个步骤没有设置,则沿用上一个步骤数据
var CurMeterListStepExe = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe;
if (CurMeterListStepExe.Any())
{
//之前有步骤数据的话,则直接使用上一步的数据
//Copy这个步骤的数据
var LastStepData = CurMeterListStepExe.OrderByDescending(a => a.MeterStep).FirstOrDefault().DeepClone();
//处理这个步骤的数据-处理按照常值的恒定的模式运行,就是维持结束的常值数据
LastStepData!.MeterStep = LastStepData.MeterStep + 1;//步骤+1
LastStepData.KeepTime = SpeedStepTotaolTime;//时间是整个时间
LastStepData.ExistSlop = false;
LastStepData.StartSV = LastStepData.EndSV;
LastStepData.ProStepInfo = $"{itemStep.StepNo}-{1}";
//添加
CurMeterListStepExe.Add(LastStepData);
//SpeedStepTotaolTime
}
else
{
//之前步骤没有数据的话,则放弃,不做任何处理
}
LogService.Warn($"【名称】: {CurMeterName} - 未找到步骤信息。步骤为空");
}
}
//********* 单个【PTC目标水温】步骤信息的解析 *********
{
var CurMeterName = "PTC目标水温";
if (itemStep.MeterPTCWaterTemps != null && itemStep.MeterPTCWaterTemps.Any())
{
switch (itemStep.MeterPTCWaterTemps.FirstOrDefault()!.ValueType)
{
case ConfigValueType.Constant: //常值
//常值的话就一个数据,循环执行一次
foreach (var itemMeterValueCell in itemStep.MeterPTCWaterTemps)
{
var Pid = new ConfigPID();
if (FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).Any())
{
Pid = FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).First();
}
var Limit = new ConfigLimit();
if (FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).Any())
{
Limit = FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).First();
}
var Alarm = new ConfigAlarm();
if (FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).Any())
{
Alarm = FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).First();
}
ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Add(new ProStepExe()
{
//程序块
ProSegName = CurProgramSeg.Name,
ProSegStep = SegIndex,
ProSegRepeat = CurProgramSeg.ProRepeat,
ProSegIsExeing = false,//配置阶段默认不执行 false
//程序步骤数据
StartSV = GetSVByProcess(itemMeterValueCell.Constant, CurMeterName),
EndSV = GetSVByProcess(itemMeterValueCell.Constant, CurMeterName),
KeepTime = itemMeterValueCell.KeepTime,
MeterStepIsExeing = false,//配置阶段默认不执行 false
MeterStepIsOK = false,//配置阶段默认不完成 false
ExistSlop = false,//常值没有斜率 //开始和结束不一样则存在斜率
MeterStep = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Count + 1,
MeterName = CurMeterName,
LimitNo = itemMeterValueCell.LimitNo,
AlarmNo = itemMeterValueCell.AlarmNo,
PIDNo = itemMeterValueCell.PIDNo,
CurConfigPIDDto = Mapper.Map<ConfigPIDDto>(Pid),
CurConfigLimitDto = Mapper.Map<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(Alarm),
ProStepInfo = $"{itemStep.StepNo}",
ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}",
StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]",
});
}
break;
case ConfigValueType.Slope:
//带斜率
//根据循环次数确定
var Cycle = GetCycleBySpeed(itemStep.MeterSpeeds, itemStep.SpeedCycle, itemStep.MeterPTCWaterTemps.Select(p => new MeterCom { Constant = p.Constant, KeepTime = p.KeepTime, StepNo = p.StepNo, ValueType = p.ValueType }).ToList());
for (int StepCycleIndex = 1; StepCycleIndex <= Cycle; StepCycleIndex++)
{
//根据循环次数执行
foreach (var itemMeterValueCell in itemStep.MeterPTCWaterTemps)
{
var Pid = new ConfigPID();
if (FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).Any())
{
Pid = FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).First();
}
var Limit = new ConfigLimit();
if (FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).Any())
{
Limit = FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).First();
}
var Alarm = new ConfigAlarm();
if (FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).Any())
{
Alarm = FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).First();
}
ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Add(new ProStepExe()
{
//程序块
ProSegName = CurProgramSeg.Name,
ProSegStep = SegIndex,
ProSegRepeat = CurProgramSeg.ProRepeat,
ProSegIsExeing = false,//配置阶段默认不执行 false
//程序步骤数据
//SV = CALCHelper.GetQuickSV(itemMeterValueCell.Constant, 1),
StartSV = GetSVByProcess(itemMeterValueCell.StartValue, CurMeterName),
EndSV = GetSVByProcess(itemMeterValueCell.EndValue, CurMeterName),
KeepTime = itemMeterValueCell.KeepTime,
MeterStepIsExeing = false,//配置阶段默认不执行 false
MeterStepIsOK = false,//配置阶段默认不完成 false
ExistSlop = itemMeterValueCell.StartValue == itemMeterValueCell.EndValue ? false : true,//开始和结束不一样则存在斜率
MeterStep = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Count + 1,
LimitNo = itemMeterValueCell.LimitNo,
AlarmNo = itemMeterValueCell.AlarmNo,
PIDNo = itemMeterValueCell.PIDNo,
CurConfigPIDDto = Mapper.Map<ConfigPIDDto>(Pid),
CurConfigLimitDto = Mapper.Map<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(Alarm),
ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}",
ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}",
StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]",
MeterName = CurMeterName,
});
}
}
break;
default:
break;
}
}
else
{
//判断当前的参数是全部都没有设置还是这一步没有设置,如果这个步骤没有设置,则沿用上一个步骤数据
var CurMeterListStepExe = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe;
if (CurMeterListStepExe.Any())
{
//之前有步骤数据的话,则直接使用上一步的数据
//Copy这个步骤的数据
var LastStepData = CurMeterListStepExe.OrderByDescending(a => a.MeterStep).FirstOrDefault().DeepClone();
//处理这个步骤的数据-处理按照常值的恒定的模式运行,就是维持结束的常值数据
LastStepData!.MeterStep = LastStepData.MeterStep + 1;//步骤+1
LastStepData.KeepTime = SpeedStepTotaolTime;//时间是整个时间
LastStepData.ExistSlop = false;
LastStepData.StartSV = LastStepData.EndSV;
LastStepData.ProStepInfo = $"{itemStep.StepNo}-{1}";
//添加
CurMeterListStepExe.Add(LastStepData);
//SpeedStepTotaolTime
}
else
{
//之前步骤没有数据的话,则放弃,不做任何处理
}
LogService.Warn($"【名称】: {CurMeterName} - 未找到步骤信息。步骤为空");
}
}
//********* 单个【PTC水流量】步骤信息的解析 *********
{
var CurMeterName = "PTC水流量";
if (itemStep.MeterPTCWaterFlows != null && itemStep.MeterPTCWaterFlows.Any())
{
switch (itemStep.MeterPTCWaterFlows.FirstOrDefault()!.ValueType)
{
case ConfigValueType.Constant: //常值
//常值的话就一个数据,循环执行一次
foreach (var itemMeterValueCell in itemStep.MeterPTCWaterFlows)
{
var Pid = new ConfigPID();
if (FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).Any())
{
Pid = FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).First();
}
var Limit = new ConfigLimit();
if (FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).Any())
{
Limit = FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).First();
}
var Alarm = new ConfigAlarm();
if (FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).Any())
{
Alarm = FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).First();
}
ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Add(new ProStepExe()
{
//程序块
ProSegName = CurProgramSeg.Name,
ProSegStep = SegIndex,
ProSegRepeat = CurProgramSeg.ProRepeat,
ProSegIsExeing = false,//配置阶段默认不执行 false
//程序步骤数据
StartSV = GetSVByProcess(itemMeterValueCell.Constant, CurMeterName),
EndSV = GetSVByProcess(itemMeterValueCell.Constant, CurMeterName),
KeepTime = itemMeterValueCell.KeepTime,
MeterStepIsExeing = false,//配置阶段默认不执行 false
MeterStepIsOK = false,//配置阶段默认不完成 false
ExistSlop = false,//常值没有斜率 //开始和结束不一样则存在斜率
MeterStep = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Count + 1,
MeterName = CurMeterName,
LimitNo = itemMeterValueCell.LimitNo,
AlarmNo = itemMeterValueCell.AlarmNo,
PIDNo = itemMeterValueCell.PIDNo,
CurConfigPIDDto = Mapper.Map<ConfigPIDDto>(Pid),
CurConfigLimitDto = Mapper.Map<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(Alarm),
ProStepInfo = $"{itemStep.StepNo}",
ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}",
StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]",
});
}
break;
case ConfigValueType.Slope:
//带斜率
//根据循环次数确定
var Cycle = GetCycleBySpeed(itemStep.MeterSpeeds, itemStep.SpeedCycle, itemStep.MeterPTCWaterFlows.Select(p => new MeterCom { Constant = p.Constant, KeepTime = p.KeepTime, StepNo = p.StepNo, ValueType = p.ValueType }).ToList());
for (int StepCycleIndex = 1; StepCycleIndex <= Cycle; StepCycleIndex++)
{
//根据循环次数执行
foreach (var itemMeterValueCell in itemStep.MeterPTCWaterFlows)
{
var Pid = new ConfigPID();
if (FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).Any())
{
Pid = FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.PIDNo).First();
}
var Limit = new ConfigLimit();
if (FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).Any())
{
Limit = FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.LimitNo).First();
}
var Alarm = new ConfigAlarm();
if (FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).Any())
{
Alarm = FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.AlarmNo).First();
}
ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Add(new ProStepExe()
{
//程序块
ProSegName = CurProgramSeg.Name,
ProSegStep = SegIndex,
ProSegRepeat = CurProgramSeg.ProRepeat,
ProSegIsExeing = false,//配置阶段默认不执行 false
//程序步骤数据
//SV = CALCHelper.GetQuickSV(itemMeterValueCell.Constant, 1),
StartSV = GetSVByProcess(itemMeterValueCell.StartValue, CurMeterName),
EndSV = GetSVByProcess(itemMeterValueCell.EndValue, CurMeterName),
KeepTime = itemMeterValueCell.KeepTime,
MeterStepIsExeing = false,//配置阶段默认不执行 false
MeterStepIsOK = false,//配置阶段默认不完成 false
ExistSlop = itemMeterValueCell.StartValue == itemMeterValueCell.EndValue ? false : true,//开始和结束不一样则存在斜率
MeterStep = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Count + 1,
LimitNo = itemMeterValueCell.LimitNo,
AlarmNo = itemMeterValueCell.AlarmNo,
PIDNo = itemMeterValueCell.PIDNo,
CurConfigPIDDto = Mapper.Map<ConfigPIDDto>(Pid),
CurConfigLimitDto = Mapper.Map<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(Alarm),
ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}",
ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}",
StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]",
MeterName = CurMeterName,
});
}
}
break;
default:
break;
}
}
else
{
//判断当前的参数是全部都没有设置还是这一步没有设置,如果这个步骤没有设置,则沿用上一个步骤数据
var CurMeterListStepExe = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe;
if (CurMeterListStepExe.Any())
{
//之前有步骤数据的话,则直接使用上一步的数据
//Copy这个步骤的数据
var LastStepData = CurMeterListStepExe.OrderByDescending(a => a.MeterStep).FirstOrDefault().DeepClone();
//处理这个步骤的数据-处理按照常值的恒定的模式运行,就是维持结束的常值数据
LastStepData!.MeterStep = LastStepData.MeterStep + 1;//步骤+1
LastStepData.KeepTime = SpeedStepTotaolTime;//时间是整个时间
LastStepData.ExistSlop = false;
LastStepData.StartSV = LastStepData.EndSV;
LastStepData.ProStepInfo = $"{itemStep.StepNo}-{1}";
//添加
CurMeterListStepExe.Add(LastStepData);
//SpeedStepTotaolTime
}
else
{
//之前步骤没有数据的话,则放弃,不做任何处理
}
LogService.Warn($"【名称】: {CurMeterName} - 未找到步骤信息。步骤为空");
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -843,6 +843,43 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- PTC功率2 -->
<DataGridTemplateColumn>
<DataGridTemplateColumn.Header>
<TextBlock FontWeight="Bold" Text="PTC功率2&#x0A;(W)" />
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding MeterPTCPw2Info}" TextWrapping="Wrap" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- PTC目标水温 -->
<DataGridTemplateColumn>
<DataGridTemplateColumn.Header>
<TextBlock FontWeight="Bold" Text="PTC目标水温&#x0A;(℃)" />
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding MeterPTCWaterTempInfo}" TextWrapping="Wrap" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- PTC水流量 -->
<DataGridTemplateColumn>
<DataGridTemplateColumn.Header>
<TextBlock FontWeight="Bold" Text="PTC水流量&#x0A;(L/min)" />
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding MeterPTCWaterFlowInfo}" TextWrapping="Wrap" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- PTC流量 -->
<DataGridTemplateColumn>
<DataGridTemplateColumn.Header>
@@ -1466,7 +1503,9 @@
Style="{StaticResource MaterialDesignSwitchToggleButton}"
ToolTip="PTC使能" />
</StackPanel>
<StackPanel
<!-- 放到单独的斜率配置中 这里不在跟谁PLC -->
<!--<StackPanel
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Center">
@@ -1493,7 +1532,10 @@
HorizontalAlignment="Center">
<TextBlock FontSize="12" Text="PTC水温(℃)" />
<TextBox Style="{StaticResource txtboxStyle}" Text="{Binding SelectedSlopMeterSpeed.PTCWaterTemp}" />
</StackPanel>
</StackPanel>-->
<!--<StackPanel
Grid.Row="1"
Grid.Column="0"
@@ -2104,7 +2146,7 @@
TotalSlopTime="{Binding MeterEVAPExpTempExDto.SlopTime}" />
</TabItem>
<!-- PTC功率 -->
<!-- PTC功率 SV1 -->
<TabItem>
<TabItem.Header>
<StackPanel
@@ -2139,6 +2181,111 @@
TotalSlopTime="{Binding MeterPTCPwExDto.SlopTime}" />
</TabItem>
<!-- PTC功率 SV2 -->
<TabItem>
<TabItem.Header>
<StackPanel
Width="90"
Margin="-20"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
FontWeight="Bold"
Text="PTC功率2&#10;(W)" />
</StackPanel>
</TabItem.Header>
<Controls:MeterConfig
Margin="5,5,0,5"
AddCommand="{Binding ProStepPTCPw2AddCmd}"
ConstSlopSelectedIndex="{Binding ProStepPTCPw2SwitchConstSlopIndex, Mode=TwoWay}"
ConstantSaveCommand="{Binding ProStepPTCPw2ConstantSaveCmd}"
ConstantValue="{Binding SelectedConstPTCPw2Value, Mode=TwoWay}"
Cycle="{Binding MeterPTCPw2ExDto.SlopCycle}"
DeleteCommand="{Binding ProStepPTCPw2DeleteCmd}"
EditCommand="{Binding ProStepPTCPw2EditCmd}"
IsTimeOk="{Binding MeterPTCPw2ExDto.IsTimeOk}"
ListMeter="{Binding ListSlopMeterPTCPw2Items}"
MeterName="PTC功率2"
MeterSelectedChangedCmd="{Binding MeterPTCPw2SlopSelectedChangedCmd}"
ParConfigCommand="{Binding MeterPTCPw2ParConfigCmd}"
SelectedMeter="{Binding SelectedSlopPTCPw2, Mode=TwoWay}"
SwitchConstSlopCommand="{Binding MeterPTCPw2SwitchConstSlopCmd}"
TotalSlopTime="{Binding MeterPTCPw2ExDto.SlopTime}" />
</TabItem>
<!-- PTC目标水温 -->
<TabItem>
<TabItem.Header>
<StackPanel
Width="90"
Margin="-20"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
FontWeight="Bold"
Text="PTC目标水温&#10;(℃)" />
</StackPanel>
</TabItem.Header>
<Controls:MeterConfig
Margin="5,5,0,5"
AddCommand="{Binding ProStepPTCWaterTempAddCmd}"
ConstSlopSelectedIndex="{Binding ProStepPTCWaterTempSwitchConstSlopIndex, Mode=TwoWay}"
ConstantSaveCommand="{Binding ProStepPTCWaterTempConstantSaveCmd}"
ConstantValue="{Binding SelectedConstPTCWaterTempValue, Mode=TwoWay}"
Cycle="{Binding MeterPTCWaterTempExDto.SlopCycle}"
DeleteCommand="{Binding ProStepPTCWaterTempDeleteCmd}"
EditCommand="{Binding ProStepPTCWaterTempEditCmd}"
IsTimeOk="{Binding MeterPTCWaterTempExDto.IsTimeOk}"
ListMeter="{Binding ListSlopMeterPTCWaterTempItems}"
MeterName="PTC目标水温"
MeterSelectedChangedCmd="{Binding MeterPTCWaterTempSlopSelectedChangedCmd}"
ParConfigCommand="{Binding MeterPTCWaterTempParConfigCmd}"
SelectedMeter="{Binding SelectedSlopPTCWaterTemp, Mode=TwoWay}"
SwitchConstSlopCommand="{Binding MeterPTCWaterTempSwitchConstSlopCmd}"
TotalSlopTime="{Binding MeterPTCWaterTempExDto.SlopTime}" />
</TabItem>
<!-- PTC水流量 -->
<TabItem>
<TabItem.Header>
<StackPanel
Width="90"
Margin="-20"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
FontWeight="Bold"
Text="PTC水流量&#10;(L/Min)" />
</StackPanel>
</TabItem.Header>
<Controls:MeterConfig
Margin="5,5,0,5"
AddCommand="{Binding ProStepPTCWaterFlowAddCmd}"
ConstSlopSelectedIndex="{Binding ProStepPTCWaterFlowSwitchConstSlopIndex, Mode=TwoWay}"
ConstantSaveCommand="{Binding ProStepPTCWaterFlowConstantSaveCmd}"
ConstantValue="{Binding SelectedConstPTCWaterFlowValue, Mode=TwoWay}"
Cycle="{Binding MeterPTCWaterFlowExDto.SlopCycle}"
DeleteCommand="{Binding ProStepPTCWaterFlowDeleteCmd}"
EditCommand="{Binding ProStepPTCWaterFlowEditCmd}"
IsTimeOk="{Binding MeterPTCWaterFlowExDto.IsTimeOk}"
ListMeter="{Binding ListSlopMeterPTCWaterFlowItems}"
MeterName="PTC水流量"
MeterSelectedChangedCmd="{Binding MeterPTCWaterFlowSlopSelectedChangedCmd}"
ParConfigCommand="{Binding MeterPTCWaterFlowParConfigCmd}"
SelectedMeter="{Binding SelectedSlopPTCWaterFlow, Mode=TwoWay}"
SwitchConstSlopCommand="{Binding MeterPTCWaterFlowSwitchConstSlopCmd}"
TotalSlopTime="{Binding MeterPTCWaterFlowExDto.SlopTime}" />
</TabItem>
<!-- PTC流量 -->
<TabItem>
<TabItem.Header>