更新了Tag的字段属性和Can配置的修复

This commit is contained in:
2025-01-06 10:06:36 +08:00
parent 3a5674054d
commit e5ebd9113a
11 changed files with 166 additions and 54 deletions

View File

@@ -143,7 +143,7 @@ namespace CapMachine.Wpf.Services
{
if (ToomossCanDrive.IsCycleRevice == false)
{
if (CmdData.Count > 0)
if (ListCanDbcModel.Count > 0)
{
ToomossCanDrive.IsCycleRevice = true;
ToomossCanDrive.StartCycleReviceCanMsg();

View File

@@ -96,6 +96,11 @@ namespace CapMachine.Wpf.Services
/// </summary>
public List<RecordInfo> HistoryData { get; set; } = new List<RecordInfo>();
/// <summary>
/// 手自动切换的条件
/// </summary>
public AutoHandSwtichCondition AutoHandSwtichConditionState { get; set; } = new AutoHandSwtichCondition();
/// <summary>
/// 实例化函数
/// </summary>
@@ -125,7 +130,7 @@ namespace CapMachine.Wpf.Services
#region
//【测试】
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 });
//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>("吸气温度", "吸气温度[℃]", "InhTemp", "程序", "VW15006", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1 });
@@ -203,9 +208,9 @@ namespace CapMachine.Wpf.Services
Unit = "MpaA",
PVAddress = "VW102",//地址信息
SVAddress = "VW202",
MVAddress = "VW246",
MVAddress = "VW242",
IsMeter = true,
AutoHandSwitchAddress = "VW244",
AutoHandSwitchAddress = "VW240",
Precision = 1000,
DecimalPoint = 3,
Samp = 1,
@@ -223,9 +228,9 @@ namespace CapMachine.Wpf.Services
Unit = "MpaA",
PVAddress = "VW104",//地址信息
SVAddress = "VW204",
MVAddress = "VW250",
MVAddress = "VW246",
IsMeter = true,
AutoHandSwitchAddress = "VW248",
AutoHandSwitchAddress = "VW244",
Precision = 1000,
DecimalPoint = 3,
Samp = 1,
@@ -243,9 +248,9 @@ namespace CapMachine.Wpf.Services
Unit = "℃",
PVAddress = "VW106",//地址信息
SVAddress = "VW206",
MVAddress = "VW254",
MVAddress = "VW250",
IsMeter = true,
AutoHandSwitchAddress = "VW252",
AutoHandSwitchAddress = "VW248",
Precision = 10,
DecimalPoint = 1,
Samp = 1,
@@ -263,9 +268,9 @@ namespace CapMachine.Wpf.Services
Unit = "℃",
PVAddress = "VW108",//地址信息
SVAddress = "VW208",
MVAddress = "VW258",
MVAddress = "VW254",
IsMeter = true,
AutoHandSwitchAddress = "VW256",
AutoHandSwitchAddress = "VW252",
Precision = 10,
DecimalPoint = 1,
Samp = 1,
@@ -283,9 +288,9 @@ namespace CapMachine.Wpf.Services
Unit = "℃",
PVAddress = "VW110",//地址信息
SVAddress = "VW210",
MVAddress = "VW262",
MVAddress = "VW258",
IsMeter = true,
AutoHandSwitchAddress = "VW260",
AutoHandSwitchAddress = "VW256",
Precision = 10,
DecimalPoint = 1,
Samp = 1,
@@ -303,9 +308,9 @@ namespace CapMachine.Wpf.Services
Unit = "V",
PVAddress = "VW112",//地址信息
SVAddress = "VW212",
MVAddress = "",
MVAddress = "VW262",
IsMeter = true,
AutoHandSwitchAddress = "",
AutoHandSwitchAddress = "VW260",
Precision = 10,
DecimalPoint = 1,
Samp = 1,
@@ -1097,26 +1102,26 @@ namespace CapMachine.Wpf.Services
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.IsShow = IsValueShow;
//仿真数据
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)Random.Next(1, 100);
TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = (short)Random.Next(1, 100) * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
LinkState = false;
////仿真数据
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)Random.Next(1, 100);
//TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = (short)Random.Next(1, 100) * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
//LinkState = false;
////PLC 数据
//if (!string.IsNullOrEmpty(itemTag.Value.PVAddress))
//{
// OperateResultShort = SiemensDrive.ReadInt16(itemTag.Value.PVAddress);
// if (OperateResultShort.IsSuccess)
// {
// TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = SiemensDrive.ReadInt16(itemTag.Value.PVAddress).Content;
// TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
// LinkState = true;
// }
// else
// {
// LinkState = false;
// }
//}
//PLC 数据
if (!string.IsNullOrEmpty(itemTag.Value.PVAddress))
{
OperateResultShort = SiemensDrive.ReadInt16(itemTag.Value.PVAddress);
if (OperateResultShort.IsSuccess)
{
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = SiemensDrive.ReadInt16(itemTag.Value.PVAddress).Content;
TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
LinkState = true;
}
else
{
LinkState = false;
}
}
if (!string.IsNullOrEmpty(itemTag.Value.SVAddress))
{
@@ -1139,7 +1144,7 @@ namespace CapMachine.Wpf.Services
if (OperateResultMVShort.IsSuccess)
{
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = OperateResultMVShort.Content;
TagManger.GetTagByName<short>(itemTag.Value.Name).EngMvValue = OperateResultMVShort.Content;
TagManger.GetTagByName<short>(itemTag.Value.Name).EngMvValue = OperateResultMVShort.Content*1.0/10;
LinkState = true;
}
else
@@ -1148,6 +1153,11 @@ namespace CapMachine.Wpf.Services
}
}
//手自动切换按钮条件
AutoHandSwtichConditionState.AlarmStateResult= SiemensDrive.ReadBool(AutoHandSwtichConditionState.AlarmAddress);
AutoHandSwtichConditionState.HandStateResult= SiemensDrive.ReadBool(AutoHandSwtichConditionState.HandStateAddress);
AutoHandSwtichConditionState.SumResult();
break;
default:
break;