diff --git a/CapMachine.Wpf/CapMachine.Wpf.csproj b/CapMachine.Wpf/CapMachine.Wpf.csproj index d498c91..b69e6ea 100644 --- a/CapMachine.Wpf/CapMachine.Wpf.csproj +++ b/CapMachine.Wpf/CapMachine.Wpf.csproj @@ -1,7 +1,7 @@  - WinExe + Exe net6.0-windows enable enable diff --git a/CapMachine.Wpf/Services/MachineRtDataService.cs b/CapMachine.Wpf/Services/MachineRtDataService.cs index 693d4ee..42b2645 100644 --- a/CapMachine.Wpf/Services/MachineRtDataService.cs +++ b/CapMachine.Wpf/Services/MachineRtDataService.cs @@ -14,6 +14,7 @@ using HslCommunication.Profinet.Siemens; using MathNet.Numerics; using Prism.Events; using Prism.Mvvm; +using SharpDX; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -834,8 +835,8 @@ namespace CapMachine.Wpf.Services 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 }, + 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 }, @@ -866,8 +867,8 @@ namespace CapMachine.Wpf.Services 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 }, + PVModel = new MeterValueAttrCell() { Address = "VW148", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 48 }, + SVModel = new MeterValueAttrCell() { Address = "VW446", EngValue = 0, EngValueStr = "", Block = "SV", BlockIndex = 46 }, MVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "MV", BlockIndex = 1, Enable = false }, MVAutoHandModel = new MvAmAttrCell() { Address = "", EngValueStr = "", Block = "MVAM", BlockIndex = 1, Enable = false }, @@ -897,8 +898,8 @@ namespace CapMachine.Wpf.Services 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 }, + PVModel = new MeterValueAttrCell() { Address = "VW150", EngValue = 0, EngValueStr = "", Block = "PV", BlockIndex = 50 }, + SVModel = new MeterValueAttrCell() { Address = "VW448", EngValue = 0, EngValueStr = "", Block = "SV", BlockIndex = 48 }, MVModel = new MeterValueAttrCell() { Address = "", EngValue = 0, EngValueStr = "", Block = "MV", BlockIndex = 1, Enable = false }, MVAutoHandModel = new MvAmAttrCell() { Address = "", EngValueStr = "", Block = "MVAM", BlockIndex = 1, Enable = false }, @@ -3003,29 +3004,52 @@ namespace CapMachine.Wpf.Services { while (ProRunChannel.Reader.TryRead(out var ProRunChannelData)) { + //特殊的标记,特别的执行-这些步骤是直接发送给压缩机,不需要经过PLC和仪表控制 if (ProRunChannelData.ProExFlag != ProExFlag.None) { switch (ProRunChannelData.ProExFlag) { case ProExFlag.CapSpeed: SendSpeedSvToCap(ProRunChannelData.SV); + Console.WriteLine($"{ProRunChannelData.MeterName} 转速的值------------:{ProRunChannelData.SV}"); break; case ProExFlag.CapPTCPw: SendPTCPwSvToCap(ProRunChannelData.SV); - break; + var CurMeterCapPTCPwInfo = ListPlcLoadConfigCell.FirstOrDefault(a => a.Name!.Contains(ProRunChannelData.MeterName!)); + //Sv + var SvCapPTCPwResult = SiemensDrive.Write(CurMeterCapPTCPwInfo!.SvAddress, (short)ProRunChannelData.SV!); + if (!SvCapPTCPwResult.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败"); + Console.WriteLine($"{ProRunChannelData.MeterName} PTC的值------------:{ProRunChannelData.SV}"); + continue;//确认是压缩机PTC 控制变量的话,直接给压缩机后就不需要执行后面的步骤了 case ProExFlag.CapPTCPw2: SendPTCPwSv2ToCap(ProRunChannelData.SV); - break; + var CurMeterCapPTCPw2Info = ListPlcLoadConfigCell.FirstOrDefault(a => a.Name!.Contains(ProRunChannelData.MeterName!)); + //Sv + var SvCapPTCPw2Result = SiemensDrive.Write(CurMeterCapPTCPw2Info!.SvAddress, (short)ProRunChannelData.SV!); + if (!SvCapPTCPw2Result.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败"); + Console.WriteLine($"{ProRunChannelData.MeterName} PTC的值------------:{ProRunChannelData.SV}"); + continue;//确认是压缩机PTC 控制变量的话,直接给压缩机后就不需要执行后面的步骤了 case ProExFlag.CapPTCWaterTemp: SendPTCWaterTempToCap(ProRunChannelData.SV); - break; + var CurMeterCapPTCWaterTempInfo = ListPlcLoadConfigCell.FirstOrDefault(a => a.Name!.Contains(ProRunChannelData.MeterName!)); + //Sv + var SvCapPTCWaterTempResult = SiemensDrive.Write(CurMeterCapPTCWaterTempInfo!.SvAddress, (short)ProRunChannelData.SV!); + if (!SvCapPTCWaterTempResult.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败"); + Console.WriteLine($"{ProRunChannelData.MeterName} PTC的值------------:{ProRunChannelData.SV}"); + continue;//确认是压缩机PTC 控制变量的话,直接给压缩机后就不需要执行后面的步骤了 case ProExFlag.CapPTCWaterFlow: SendPTCWaterFlowToCap(ProRunChannelData.SV); - break; + var CurMeterCapPTCWaterFlowInfo = ListPlcLoadConfigCell.FirstOrDefault(a => a.Name!.Contains(ProRunChannelData.MeterName!)); + //Sv + var SvCapPTCWaterFlowResult = SiemensDrive.Write(CurMeterCapPTCWaterFlowInfo!.SvAddress, (short)ProRunChannelData.SV!); + if (!SvCapPTCWaterFlowResult.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败"); + Console.WriteLine($"{ProRunChannelData.MeterName} PTC的值------------:{ProRunChannelData.SV}"); + continue;//确认是压缩机PTC 控制变量的话,直接给压缩机后就不需要执行后面的步骤了 default: break; } - continue; + + //continue; } ////第一次计时 @@ -3221,16 +3245,18 @@ namespace CapMachine.Wpf.Services //压缩机PTC使能的参数直接给压缩机触发 if (itemStepExd.Name!.Contains("PTC使能")) { + Console.WriteLine($"{ProRunChannelData.MeterName} PTC使能的值------------:{ProRunChannelData.SV}"); + switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) { case CanLinEnum.Can: - CanDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!); + CanDriveService.UpdateCapPTCEnableCmdData((bool)itemStepExd.Value!); break; case CanLinEnum.CANFD: - CanFdDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!); + CanFdDriveService.UpdateCapPTCEnableCmdData((bool)itemStepExd.Value!); break; case CanLinEnum.Lin: - LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!); + //LinDriveService.UpdateCapPTCEnableCmdData((bool)itemStepExd.Value!); break; default: break; @@ -3238,6 +3264,8 @@ namespace CapMachine.Wpf.Services continue; } + #region PTC 压缩机作为拓展参数时使用方法 目前被弃用 + ////压缩机PTC功率1的参数直接给压缩机触发 //if (itemStepExd.Name!.Contains("PTC功率1")) //{ @@ -3322,6 +3350,9 @@ namespace CapMachine.Wpf.Services // //continue; //} + #endregion + + var DataAdrees = ListPlcExdConfigCell.FirstOrDefault(a => a.Name == itemStepExd.Name); if (DataAdrees != null) { diff --git a/CapMachine.Wpf/ViewModels/CANConfigViewModel.cs b/CapMachine.Wpf/ViewModels/CANConfigViewModel.cs index 76be4f5..c2b176a 100644 --- a/CapMachine.Wpf/ViewModels/CANConfigViewModel.cs +++ b/CapMachine.Wpf/ViewModels/CANConfigViewModel.cs @@ -69,6 +69,7 @@ namespace CapMachine.Wpf.ViewModels new CbxItems(){ Key="PTC使能",Text="PTC使能"}, new CbxItems(){ Key="PTC功率",Text="PTC功率"}, + new CbxItems(){ Key="PTC功率2",Text="PTC功率2"}, new CbxItems(){ Key="PTC水流量",Text="PTC水流量"}, new CbxItems(){ Key="PTC水温",Text="PTC水温"}, }; diff --git a/CapMachine.Wpf/ViewModels/CANFDConfigViewModel.cs b/CapMachine.Wpf/ViewModels/CANFDConfigViewModel.cs index 86d2cf8..af06a4d 100644 --- a/CapMachine.Wpf/ViewModels/CANFDConfigViewModel.cs +++ b/CapMachine.Wpf/ViewModels/CANFDConfigViewModel.cs @@ -107,6 +107,7 @@ namespace CapMachine.Wpf.ViewModels new CbxItems(){ Key="PTC使能",Text="PTC使能"}, new CbxItems(){ Key="PTC功率",Text="PTC功率"}, + new CbxItems(){ Key="PTC功率2",Text="PTC功率2"}, new CbxItems(){ Key="PTC水流量",Text="PTC水流量"}, new CbxItems(){ Key="PTC水温",Text="PTC水温"}, };