@@ -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 = 33 4 } ,
SVModel = new MeterValueAttrCell ( ) { Address = "" , EngValue = 0 , EngValueStr = "" , Block = "SV" , BlockIndex = 3 4 } ,
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 = 3 4 } ,
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 . UpdateCapPTC EnableCmdData ( ( bool ) itemStepExd . Value ! ) ;
break ;
case CanLinEnum . CANFD :
CanFdDriveService . UpdateCapEnableCmdData ( ( bool ) itemStepExd . Value ! ) ;
CanFdDriveService . UpdateCapPTC EnableCmdData ( ( bool ) itemStepExd . Value ! ) ;
break ;
case CanLinEnum . Lin :
LinDriveService. UpdateCapEnableCmdData( ( bool ) itemStepExd . Value ! ) ;
// LinDriveService. UpdateCapPTC EnableCmdData((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 )
{