更改了变量的信息

This commit is contained in:
2025-06-11 23:20:27 +08:00
parent e77f944a16
commit 0857eb9f59
5 changed files with 507 additions and 87 deletions

View File

@@ -97,6 +97,27 @@ namespace CapMachine.Wpf.Services
/// </summary> /// </summary>
private CanCmdData EnableCanCmdData { get; set; } private CanCmdData EnableCanCmdData { get; set; }
/// <summary>
/// PTC使能 指令数据 实例
/// </summary>
private CanCmdData PTCEnableCanCmdData { get; set; }
/// <summary>
/// PTC功率 指令数据 实例
/// </summary>
private CanCmdData PTCPwCanCmdData { get; set; }
/// <summary>
/// PTC水流量 指令数据 实例
/// </summary>
private CanCmdData PTCFlowCanCmdData { get; set; }
/// <summary>
/// PTC水温 指令数据 实例
/// </summary>
private CanCmdData PTCWaterTempCanCmdData { get; set; }
/// <summary> /// <summary>
/// 要发送的CAN指令数据 /// 要发送的CAN指令数据
/// 在程序配置好后就确定要发送哪些数据 /// 在程序配置好后就确定要发送哪些数据
@@ -124,6 +145,18 @@ namespace CapMachine.Wpf.Services
case "Anti_Sleep": case "Anti_Sleep":
//SpeedCanCmdData = SendCanCmdData; //SpeedCanCmdData = SendCanCmdData;
break; break;
case "PTC使能":
PTCEnableCanCmdData = SendCanCmdData;
break;
case "PTC功率":
PTCPwCanCmdData = SendCanCmdData;
break;
case "PTC水流量":
PTCFlowCanCmdData = SendCanCmdData;
break;
case "PTC水温":
PTCWaterTempCanCmdData = SendCanCmdData;
break;
default: default:
break; break;
} }
@@ -162,6 +195,67 @@ namespace CapMachine.Wpf.Services
} }
/// <summary>
/// 更新压缩机的功率限制
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPwLimitCmdData(double PwLimit)
{
if (PwLimitCanCmdData != null)
{
PwLimitCanCmdData.SignalCmdValue = PwLimit;
}
}
/// <summary>
/// 更新 PTC使能信号
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPTCEnableCmdData(bool IsEnable)
{
if (PTCEnableCanCmdData != null)
{
PTCEnableCanCmdData.SignalCmdValue = IsEnable ? 1 : 0;
}
}
/// <summary>
/// 更新 PTC功率 信号
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPTCPwCmdData(double PTCPw)
{
if (PTCPwCanCmdData != null)
{
PTCPwCanCmdData.SignalCmdValue = PTCPw;
}
}
/// <summary>
/// 更新 PTC水流量 信号
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPTCFlowCmdData(double Flow)
{
if (PTCFlowCanCmdData != null)
{
PTCFlowCanCmdData.SignalCmdValue = Flow;
}
}
/// <summary>
/// 更新 PTC水温 信号
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPTCWaterTempCmdData(double WaterTemp)
{
if (PTCWaterTempCanCmdData != null)
{
PTCWaterTempCanCmdData.SignalCmdValue = WaterTemp;
}
}
/// <summary> /// <summary>
/// 发送消息给CAN 驱动 /// 发送消息给CAN 驱动
/// </summary> /// </summary>

View File

@@ -1,4 +1,5 @@
using CapMachine.Model.CANLIN; using CapMachine.Model.CANLIN;
using CapMachine.Wpf.CanDrive;
using CapMachine.Wpf.LinDrive; using CapMachine.Wpf.LinDrive;
using ImTools; using ImTools;
using Prism.Ioc; using Prism.Ioc;
@@ -95,6 +96,27 @@ namespace CapMachine.Wpf.Services
/// </summary> /// </summary>
private LinCmdData EnableLinCmdData { get; set; } private LinCmdData EnableLinCmdData { get; set; }
/// <summary>
/// PTC使能 指令数据 实例
/// </summary>
private LinCmdData PTCEnableCanCmdData { get; set; }
/// <summary>
/// PTC功率 指令数据 实例
/// </summary>
private LinCmdData PTCPwCanCmdData { get; set; }
/// <summary>
/// PTC水流量 指令数据 实例
/// </summary>
private LinCmdData PTCFlowCanCmdData { get; set; }
/// <summary>
/// PTC水温 指令数据 实例
/// </summary>
private LinCmdData PTCWaterTempCanCmdData { get; set; }
/// <summary> /// <summary>
/// 要发送的CAN指令数据 /// 要发送的CAN指令数据
/// 在程序配置好后就确定要发送哪些数据 /// 在程序配置好后就确定要发送哪些数据
@@ -122,6 +144,18 @@ namespace CapMachine.Wpf.Services
case "Anti_Sleep": case "Anti_Sleep":
//SpeedLinCmdData = SendLinCmdData; //SpeedLinCmdData = SendLinCmdData;
break; break;
case "PTC使能":
PTCEnableCanCmdData = SendLinCmdData;
break;
case "PTC功率":
PTCPwCanCmdData = SendLinCmdData;
break;
case "PTC水流量":
PTCFlowCanCmdData = SendLinCmdData;
break;
case "PTC水温":
PTCWaterTempCanCmdData = SendLinCmdData;
break;
default: default:
break; break;
} }
@@ -161,6 +195,66 @@ namespace CapMachine.Wpf.Services
} }
/// <summary>
/// 更新压缩机的功率限制
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPwLimitCmdData(double PwLimit)
{
if (PwLimitLinCmdData != null)
{
PwLimitLinCmdData.SignalCmdValue = PwLimit;
}
}
/// <summary>
/// 更新 PTC使能信号
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPTCEnableCmdData(bool IsEnable)
{
if (PTCEnableCanCmdData != null)
{
PTCEnableCanCmdData.SignalCmdValue = IsEnable ? 1 : 0;
}
}
/// <summary>
/// 更新 PTC功率 信号
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPTCPwCmdData(double PTCPw)
{
if (PTCPwCanCmdData != null)
{
PTCPwCanCmdData.SignalCmdValue = PTCPw;
}
}
/// <summary>
/// 更新 PTC水流量 信号
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPTCFlowCmdData(double Flow)
{
if (PTCFlowCanCmdData != null)
{
PTCFlowCanCmdData.SignalCmdValue = Flow;
}
}
/// <summary>
/// 更新 PTC水温 信号
/// </summary>
/// <param name="IsEnable"></param>
public void UpdateCapPTCWaterTempCmdData(double WaterTemp)
{
if (PTCWaterTempCanCmdData != null)
{
PTCWaterTempCanCmdData.SignalCmdValue = WaterTemp;
}
}
/// <summary> /// <summary>
/// 发送消息给CAN 驱动 /// 发送消息给CAN 驱动
/// </summary> /// </summary>

View File

@@ -148,7 +148,7 @@ namespace CapMachine.Wpf.Services
#region #region
////三电 Sample ////三电 Sample
TagManger.AddTag(new Tag<short>("转速", "转速[rpm]", "Speed", "程序", "VW15000", 100, 0, 1, "rpm", new ShortTagValue(), true) { DecimalPoint = 0 }); TagManger.AddTag(new Tag<short>("转速", "转速[rpm]", "Speed", "程序", "VW15000", 100, 0, 1, "rpm", new ShortTagValue(), true) { DecimalPoint = 0,SVAddress= "VW14002" });
TagManger.AddTag(new Tag<short>("排气压力", "排气压力[BarA]", "ExPress", "程序", "VW15002", 100, 0, 100, "BarA", new ShortTagValue(), true) { DecimalPoint = 2 }); TagManger.AddTag(new Tag<short>("排气压力", "排气压力[BarA]", "ExPress", "程序", "VW15002", 100, 0, 100, "BarA", new ShortTagValue(), true) { DecimalPoint = 2 });
TagManger.AddTag(new Tag<short>("吸气压力", "吸气压力[BarA]", "InhPress", "程序", "VW15004", 100, 0, 100, "BarA", new ShortTagValue(), true) { DecimalPoint = 2 }); TagManger.AddTag(new Tag<short>("吸气压力", "吸气压力[BarA]", "InhPress", "程序", "VW15004", 100, 0, 100, "BarA", new ShortTagValue(), true) { DecimalPoint = 2 });
TagManger.AddTag(new Tag<short>("吸气温度", "吸气温度[℃]", "InhTemp", "程序", "VW15006", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1 }); TagManger.AddTag(new Tag<short>("吸气温度", "吸气温度[℃]", "InhTemp", "程序", "VW15006", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1 });
@@ -185,18 +185,19 @@ namespace CapMachine.Wpf.Services
TagManger.AddTag(new Tag<short>("AT04_01", "AT04_01[℃]", "AT04_01Temp", "程序", "VW70", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 }); TagManger.AddTag(new Tag<short>("AT04_01", "AT04_01[℃]", "AT04_01Temp", "程序", "VW70", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
TagManger.AddTag(new Tag<short>("AT04_02", "AT04_02[℃]", "AT04_02Temp", "程序", "VW72", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 }); TagManger.AddTag(new Tag<short>("AT04_02", "AT04_02[℃]", "AT04_02Temp", "程序", "VW72", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
TagManger.AddTag(new Tag<short>("通讯Cmp母线电流", "通讯Cmp母线电流[A]", "ComCapBusCur", "程序", "VW15060", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 }); TagManger.AddTag(new Tag<short>("通讯Cmp母线电流", "通讯Cmp母线电流[A]", "ComCapBusCur", "程序", "VW14102", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 });
TagManger.AddTag(new Tag<short>("通讯Cmp母线电压", "通讯Cmp母线电压[V]", "ComCapBusVol", "程序", "VW15062", 100, 0, 1, "V", new ShortTagValue(), false) { DecimalPoint = 0 }); TagManger.AddTag(new Tag<short>("通讯Cmp母线电压", "通讯Cmp母线电压[V]", "ComCapBusVol", "程序", "VW14104", 100, 0, 1, "V", new ShortTagValue(), false) { DecimalPoint = 0 });
TagManger.AddTag(new Tag<short>("通讯Cmp逆变器温度", "通讯Cmp逆变器温度[℃]", "ComCapInvTemp", "程序", "VW15064", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 }); TagManger.AddTag(new Tag<short>("通讯Cmp逆变器温度", "通讯Cmp逆变器温度[℃]", "ComCapInvTemp", "程序", "VW14106", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 });
TagManger.AddTag(new Tag<short>("通讯Cmp相电流", "通讯Cmp相电流[A]", "ComCapPhCur", "程序", "VW15066", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 }); TagManger.AddTag(new Tag<short>("通讯Cmp相电流", "通讯Cmp相电流[A]", "ComCapPhCur", "程序", "VW14108", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 });
TagManger.AddTag(new Tag<short>("通讯Cmp功率", "通讯Cmp功率[W]", "ComCapPw", "程序", "VW15068", 100, 0, 1, "W", new ShortTagValue(), false) { DecimalPoint = 1 }); TagManger.AddTag(new Tag<short>("通讯Cmp功率", "通讯Cmp功率[W]", "ComCapPw", "程序", "VW14110", 100, 0, 1, "W", new ShortTagValue(), false) { DecimalPoint = 1 });
TagManger.AddTag(new Tag<short>("通讯Cmp芯片温度", "通讯Cmp芯片温度[℃]", "ComCapChipTemp", "程序", "VW15070", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 }); TagManger.AddTag(new Tag<short>("通讯Cmp芯片温度", "通讯Cmp芯片温度[℃]", "ComCapChipTemp", "程序", "VW14112", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 });
TagManger.AddTag(new Tag<short>("通讯PTC入水温度", "通讯PTC入水温度[℃]", "ComPTCEntTemp", "程序", "VW15072", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
TagManger.AddTag(new Tag<short>("通讯PTC水温度", "通讯PTC水温度[℃]", "ComPTCExpTemp", "程序", "VW15074", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 }); TagManger.AddTag(new Tag<short>("通讯PTC水温度", "通讯PTC水温度[℃]", "ComPTCEntTemp", "程序", "VW14120", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
TagManger.AddTag(new Tag<short>("通讯PTC峰值电流", "通讯PTC峰值电流[A]", "ComPTCPeakCur", "程序", "VW15076", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 }); TagManger.AddTag(new Tag<short>("通讯PTC出水温度", "通讯PTC出水温度[℃]", "ComPTCExpTemp", "程序", "VW14122", 100, 0, 10, "", new ShortTagValue(), false) { DecimalPoint = 1 });
TagManger.AddTag(new Tag<short>("通讯PTC母线电流", "通讯PTC母线电流[A]", "ComPTCBusCur", "程序", "VW15078", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 }); TagManger.AddTag(new Tag<short>("通讯PTC峰值电流", "通讯PTC峰值电流[A]", "ComPTCPeakCur", "程序", "VW14124", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
TagManger.AddTag(new Tag<short>("通讯PTC膜温", "通讯PTC膜温[℃]", "ComPTCFlmTemp", "程序", "VW15080", 100, 0, 1, "", new ShortTagValue(), false) { DecimalPoint = 0 }); TagManger.AddTag(new Tag<short>("通讯PTC母线电流", "通讯PTC母线电流[A]", "ComPTCBusCur", "程序", "VW14126", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 });
TagManger.AddTag(new Tag<short>("通讯PTC模块温度", "通讯PTC模块温度[℃]", "ComPTCMdTemp", "程序", "VW15082", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 }); TagManger.AddTag(new Tag<short>("通讯PTC膜温", "通讯PTC膜温[℃]", "ComPTCFlmTemp", "程序", "VW14128", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 });
TagManger.AddTag(new Tag<short>("通讯PTC模块温度", "通讯PTC模块温度[℃]", "ComPTCMdTemp", "程序", "VW14130", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 });
#endregion #endregion
@@ -852,28 +853,6 @@ namespace CapMachine.Wpf.Services
new HandSwitchData(){Name="使能",ActionAddress="M2.7",StateAddress="V15.1" }, new HandSwitchData(){Name="使能",ActionAddress="M2.7",StateAddress="V15.1" },
}; };
//TagManger.ListTag[0].Name = "new TestType() { byteValue=12}";
//TagManger.ListTag[0].Name = "new TestType() { byteValue=12}";
//Type genericType = typeof(Tag<>).MakeGenericType(typeof(short));
//Activator.CreateInstance(genericType, 42);
//var DATA = TagManger.GetTagValueByName<short>("转速");
//var data1 = TagManger.GetTagByName<short>("转速");
//var data2 = TagManger.GetTagByName<short>("转速5888");
//data1.TagValue.Value = 12;
//TagInfo = data1;
//var TagInfo1= data1.RtValue.Value;
//var Data = DATA.Value;
//dynamic dad=10;
InitialPLCCom(); InitialPLCCom();
//拓展的参数信息 //拓展的参数信息
@@ -1120,6 +1099,18 @@ namespace CapMachine.Wpf.Services
/// </summary> /// </summary>
private OperateResult<bool[]> OperateResultAlarm { get; set; } private OperateResult<bool[]> OperateResultAlarm { get; set; }
/// <summary>
/// 压缩机使能信号
/// 压缩机使能信号
/// 压缩机速度控制
/// 压缩机功率限制
/// 加热器使能信号
///加热器功率给定
///水流量信号给定
///加热器目标水温
/// </summary>
private OperateResult<short[]> OperateResultValue { get; set; }
/// <summary> /// <summary>
/// CAP的使能状态 /// CAP的使能状态
/// </summary> /// </summary>
@@ -1156,11 +1147,7 @@ namespace CapMachine.Wpf.Services
//stopwatch.Start(); //启动Stopwatch //stopwatch.Start(); //启动Stopwatch
//IsShowCount++; //IsShowCount++;
//IsValueShow = false; //IsValueShow = false;
//if (IsShowCount >= 20)
//{
// IsShowCount = 0;
// IsValueShow = true;
//}
foreach (var itemTag in TagManger.DicTags) foreach (var itemTag in TagManger.DicTags)
{ {
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)random.Next(0, 100); //TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)random.Next(0, 100);
@@ -1198,103 +1185,229 @@ namespace CapMachine.Wpf.Services
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{ {
case CanLinEnum.Can: case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯转速")); SiemensDrive.Write(itemTag.Value.PVAddress, (short)CanDriveService.GetDbcSpeedValueBySpeedName("通讯Cmp转速"));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
case CanLinEnum.Lin: case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯转速")); SiemensDrive.Write(itemTag.Value.PVAddress, (short)LinDriveService.GetLdfSpeedValueBySpeedName("通讯Cmp转速"));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
default: default:
break; break;
} }
} }
else if (itemTag.Value.NameNoUnit == "通讯母线电压") else if (itemTag.Value.NameNoUnit == "通讯Cmp母线电压")
{ {
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{ {
case CanLinEnum.Can: case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯母线电压") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯Cmp母线电压") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
case CanLinEnum.Lin: case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯母线电压") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯Cmp母线电压") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
default: default:
break; break;
} }
} }
else if (itemTag.Value.NameNoUnit == "通讯母线电流") else if (itemTag.Value.NameNoUnit == "通讯Cmp母线电流")
{ {
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{ {
case CanLinEnum.Can: case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯母线电流") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯Cmp母线电流") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
case CanLinEnum.Lin: case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯母线电流") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯Cmp母线电流") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
default: default:
break; break;
} }
} }
else if (itemTag.Value.NameNoUnit == "通讯相电流") else if (itemTag.Value.NameNoUnit == "通讯Cmp相电流")
{ {
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{ {
case CanLinEnum.Can: case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯相电流") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯Cmp相电流") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
case CanLinEnum.Lin: case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯相电流") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯Cmp相电流") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
default: default:
break; break;
} }
} }
else if (itemTag.Value.NameNoUnit == "通讯功率") else if (itemTag.Value.NameNoUnit == "通讯Cmp功率")
{ {
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{ {
case CanLinEnum.Can: case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯功率") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯Cmp功率") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
case CanLinEnum.Lin: case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯功率") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯Cmp功率") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
default: default:
break; break;
} }
} }
else if (itemTag.Value.NameNoUnit == "通讯芯片温度") else if (itemTag.Value.NameNoUnit == "通讯Cmp芯片温度")
{ {
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin) switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{ {
case CanLinEnum.Can: case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯芯片温度") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯Cmp芯片温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
case CanLinEnum.Lin: case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX //通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
//SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯芯片温度") * itemTag.Value.Precision)); SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯Cmp芯片温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
default:
break;
}
}
else if (itemTag.Value.NameNoUnit == "通讯Cmp逆变器温度")
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯Cmp逆变器温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯Cmp逆变器温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
default:
break;
}
}
else if (itemTag.Value.NameNoUnit == "通讯PTC入水温度")
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯PTC入水温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯PTC入水温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
default:
break;
}
}
else if (itemTag.Value.NameNoUnit == "通讯PTC出水温度")
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯PTC出水温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯PTC出水温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
default:
break;
}
}
else if (itemTag.Value.NameNoUnit == "通讯PTC峰值电流")
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯PTC峰值电流") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯PTC峰值电流") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
default:
break;
}
}
else if (itemTag.Value.NameNoUnit == "通讯PTC母线电流")
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯PTC母线电流") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯PTC母线电流") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
default:
break;
}
}
else if (itemTag.Value.NameNoUnit == "通讯PTC膜温")
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯PTC膜温") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯PTC膜温") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
default:
break;
}
}
else if (itemTag.Value.NameNoUnit == "通讯PTC模块温度")
{
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(CanDriveService.GetDbcValueByName("通讯PTC模块温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC
SiemensDrive.Write(itemTag.Value.PVAddress, (short)(LinDriveService.GetLdfValueByName("通讯PTC模块温度") * itemTag.Value.Precision));
//itemTag.Value.EngPvValue = 0; //itemTag.Value.EngPvValue = 0;
break; break;
default: default:
@@ -1344,6 +1457,7 @@ namespace CapMachine.Wpf.Services
} }
//SV值的写入 转速和PTC的写入
if (!string.IsNullOrEmpty(itemTag.Value.SVAddress)) if (!string.IsNullOrEmpty(itemTag.Value.SVAddress))
{ {
OperateResultSVShort = SiemensDrive.ReadInt16(itemTag.Value.SVAddress); OperateResultSVShort = SiemensDrive.ReadInt16(itemTag.Value.SVAddress);
@@ -1421,7 +1535,104 @@ namespace CapMachine.Wpf.Services
// } // }
//} //}
////循环读取手自动切换 取消XXX
//压缩机使能信号实时赋值
OperateResultValue = SiemensDrive.ReadInt16("VW14000", 30);
if (OperateResultValue.IsSuccess)
{
//压缩机使能信号实时赋值
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//获取PLC的使能状态更新到CAN的使能状态
CanDriveService.UpdateCapEnableCmdData(OperateResultValue.Content[0] == 0 ? false : true);
break;
case CanLinEnum.Lin:
//获取PLC的使能状态更新到LIN的使能状态
LinDriveService.UpdateCapEnableCmdData(OperateResultValue.Content[0] == 0 ? false : true);
break;
default:
break;
}
//压缩机压缩机功率限制实时赋值
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//获取PLC的功率限制更新到CAN的功率限制
CanDriveService.UpdateCapPwLimitCmdData(OperateResultValue.Content[0]);
break;
case CanLinEnum.Lin:
//获取PLC的功率限制更新到LIN的功率限制
LinDriveService.UpdateCapPwLimitCmdData(OperateResultValue.Content[0]);
break;
default:
break;
}
//压缩机 PTC使能 实时赋值
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//获取PLC的 PTC使能更新到CAN的 PTC使能
CanDriveService.UpdateCapPTCEnableCmdData(OperateResultValue.Content[20] == 0 ? false : true);
break;
case CanLinEnum.Lin:
//获取PLC的 PTC使能更新到LIN的 PTC使能
LinDriveService.UpdateCapPTCEnableCmdData(OperateResultValue.Content[20] == 0 ? false : true);
break;
default:
break;
}
//压缩机 PTC功率 实时赋值
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//获取PLC的 PTC功率更新到CAN的 PTC功率
CanDriveService.UpdateCapPTCPwCmdData(OperateResultValue.Content[22]);
break;
case CanLinEnum.Lin:
//获取PLC的 PTC功率更新到LIN的 PTC功率
LinDriveService.UpdateCapPTCPwCmdData(OperateResultValue.Content[22]);
break;
default:
break;
}
//压缩机 PTC水流量信号 实时赋值
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//获取PLC的 PTC水流量信号更新到CAN的 PTC水流量信号
CanDriveService.UpdateCapPTCFlowCmdData(OperateResultValue.Content[24]);
break;
case CanLinEnum.Lin:
//获取PLC的 PTC水流量信号更新到LIN的 PTC水流量信号
LinDriveService.UpdateCapPTCFlowCmdData(OperateResultValue.Content[24]);
break;
default:
break;
}
//压缩机 PTC水温 实时赋值
switch (ConfigService.CanLinRunStateModel.CurSysSelectedCanLin)
{
case CanLinEnum.Can:
//获取PLC的 PTC水温更新到CAN的 PTC水温
CanDriveService.UpdateCapPTCWaterTempCmdData(OperateResultValue.Content[26]);
break;
case CanLinEnum.Lin:
//获取PLC的 PTC水温更新到LIN的 PTC水温
LinDriveService.UpdateCapPTCWaterTempCmdData(OperateResultValue.Content[26]);
break;
default:
break;
}
}
//循环读取手自动切换
//foreach (var item in ListHandSwitchData) //foreach (var item in ListHandSwitchData)
//{ //{
// item.StateOperateResult = SiemensDrive.ReadBool(item.StateAddress); // item.StateOperateResult = SiemensDrive.ReadBool(item.StateAddress);
@@ -1436,12 +1647,10 @@ namespace CapMachine.Wpf.Services
// case CanLinEnum.Can: // case CanLinEnum.Can:
// //获取PLC的使能状态更新到CAN的使能状态 // //获取PLC的使能状态更新到CAN的使能状态
// CanDriveService.UpdateCapEnableCmdData(item.State); // CanDriveService.UpdateCapEnableCmdData(item.State);
// //itemTag.Value.EngPvValue = 0;
// break; // break;
// case CanLinEnum.Lin: // case CanLinEnum.Lin:
// //获取PLC的使能状态更新到LIN的使能状态 // //获取PLC的使能状态更新到LIN的使能状态
// LinDriveService.UpdateCapEnableCmdData(item.State); // LinDriveService.UpdateCapEnableCmdData(item.State);
// //itemTag.Value.EngPvValue = 0;
// break; // break;
// default: // default:
// break; // break;

View File

@@ -61,16 +61,28 @@ namespace CapMachine.Wpf.ViewModels
new CbxItems(){ Key="功率限制",Text="功率限制"}, new CbxItems(){ Key="功率限制",Text="功率限制"},
new CbxItems(){ Key="使能",Text="使能"}, new CbxItems(){ Key="使能",Text="使能"},
new CbxItems(){ Key="Anti_Sleep",Text="Anti_Sleep"}, new CbxItems(){ Key="Anti_Sleep",Text="Anti_Sleep"},
new CbxItems(){ Key="PTC使能",Text="PTC使能"},
new CbxItems(){ Key="PTC功率",Text="PTC功率"},
new CbxItems(){ Key="PTC水流量",Text="PTC水流量"},
new CbxItems(){ Key="PTC水温",Text="PTC水温"},
}; };
ReadNameCbxItems = new ObservableCollection<CbxItems>() ReadNameCbxItems = new ObservableCollection<CbxItems>()
{ {
new CbxItems(){ Key="通讯转速",Text="通讯转速"}, new CbxItems(){ Key="通讯Cmp转速",Text="通讯Cmp转速"},
new CbxItems(){ Key="通讯母线电压",Text="通讯母线电压"}, new CbxItems(){ Key="通讯Cmp母线电压",Text="通讯Cmp母线电压"},
new CbxItems(){ Key="通讯母线电流",Text="通讯母线电流"}, new CbxItems(){ Key="通讯Cmp母线电流",Text="通讯Cmp母线电流"},
new CbxItems(){ Key="通讯相电流",Text="通讯相电流"}, new CbxItems(){ Key="通讯Cmp相电流",Text="通讯Cmp相电流"},
new CbxItems(){ Key="通讯功率",Text="通讯功率"}, new CbxItems(){ Key="通讯Cmp功率",Text="通讯Cmp功率"},
new CbxItems(){ Key="通讯芯片温度",Text="通讯芯片温度"}, new CbxItems(){ Key="通讯Cmp芯片温度",Text="通讯Cmp芯片温度"},
new CbxItems(){ Key="通讯PTC入水温度",Text="通讯PTC入水温度"},
new CbxItems(){ Key="通讯PTC出水温度",Text="通讯PTC出水温度"},
new CbxItems(){ Key="通讯PTC峰值电流",Text="通讯PTC峰值电流"},
new CbxItems(){ Key="通讯PTC母线电流",Text="通讯PTC母线电流"},
new CbxItems(){ Key="通讯PTC膜温",Text="通讯PTC膜温"},
new CbxItems(){ Key="通讯PTC模块温度",Text="通讯PTC模块温度"},
}; };
InitLoadCanConfigPro(); InitLoadCanConfigPro();

View File

@@ -61,16 +61,27 @@ namespace CapMachine.Wpf.ViewModels
new CbxItems(){ Key="功率限制",Text="功率限制"}, new CbxItems(){ Key="功率限制",Text="功率限制"},
new CbxItems(){ Key="使能",Text="使能"}, new CbxItems(){ Key="使能",Text="使能"},
new CbxItems(){ Key="Anti_Sleep",Text="Anti_Sleep"}, new CbxItems(){ Key="Anti_Sleep",Text="Anti_Sleep"},
new CbxItems(){ Key="PTC使能",Text="PTC使能"},
new CbxItems(){ Key="PTC功率",Text="PTC功率"},
new CbxItems(){ Key="PTC水流量",Text="PTC水流量"},
new CbxItems(){ Key="PTC水温",Text="PTC水温"},
}; };
ReadNameCbxItems = new ObservableCollection<CbxItems>() ReadNameCbxItems = new ObservableCollection<CbxItems>()
{ {
new CbxItems(){ Key="通讯转速",Text="通讯转速"}, new CbxItems(){ Key="通讯Cmp转速",Text="通讯Cmp转速"},
new CbxItems(){ Key="通讯母线电压",Text="通讯母线电压"}, new CbxItems(){ Key="通讯Cmp母线电压",Text="通讯Cmp母线电压"},
new CbxItems(){ Key="通讯母线电流",Text="通讯母线电流"}, new CbxItems(){ Key="通讯Cmp母线电流",Text="通讯Cmp母线电流"},
new CbxItems(){ Key="通讯相电流",Text="通讯相电流"}, new CbxItems(){ Key="通讯Cmp相电流",Text="通讯Cmp相电流"},
new CbxItems(){ Key="通讯功率",Text="通讯功率"}, new CbxItems(){ Key="通讯Cmp功率",Text="通讯Cmp功率"},
new CbxItems(){ Key="通讯芯片温度",Text="通讯芯片温度"}, new CbxItems(){ Key="通讯Cmp芯片温度",Text="通讯Cmp芯片温度"},
new CbxItems(){ Key="通讯PTC入水温度",Text="通讯PTC入水温度"},
new CbxItems(){ Key="通讯PTC出水温度",Text="通讯PTC出水温度"},
new CbxItems(){ Key="通讯PTC峰值电流",Text="通讯PTC峰值电流"},
new CbxItems(){ Key="通讯PTC母线电流",Text="通讯PTC母线电流"},
new CbxItems(){ Key="通讯PTC膜温",Text="通讯PTC膜温"},
new CbxItems(){ Key="通讯PTC模块温度",Text="通讯PTC模块温度"},
}; };
InitLoadLinConfigPro(); InitLoadLinConfigPro();