一些优化:CAN和PLC地址的优化
This commit is contained in:
@@ -121,7 +121,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 });
|
||||
@@ -181,7 +181,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW200",
|
||||
MVAddress = "VW250",
|
||||
IsMeter = true,
|
||||
Precision = 0,
|
||||
AutoHandSwitchAddress= "VW240",
|
||||
Precision = 1,
|
||||
DecimalPoint = 0,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -200,8 +201,9 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW202",
|
||||
MVAddress = "VW252",
|
||||
IsMeter = true,
|
||||
Precision = 3,
|
||||
DecimalPoint = 2,
|
||||
AutoHandSwitchAddress = "VW244",
|
||||
Precision = 1000,
|
||||
DecimalPoint = 3,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
Index = "",
|
||||
@@ -219,8 +221,9 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW204",
|
||||
MVAddress = "VW254",
|
||||
IsMeter = true,
|
||||
Precision = 3,
|
||||
DecimalPoint = 2,
|
||||
AutoHandSwitchAddress = "VW248",
|
||||
Precision = 1000,
|
||||
DecimalPoint = 3,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
Index = "",
|
||||
@@ -238,7 +241,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW206",
|
||||
MVAddress = "VW256",
|
||||
IsMeter = true,
|
||||
Precision = 1,
|
||||
AutoHandSwitchAddress = "VW252",
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -246,8 +250,8 @@ namespace CapMachine.Wpf.Services
|
||||
});
|
||||
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
||||
{
|
||||
Name = "COND1水温[℃]",//名称带单位
|
||||
NameNoUnit = "COND1水温",//无单位名称
|
||||
Name = "冷凝器出口水温[℃]",//名称带单位 COND1水温
|
||||
NameNoUnit = "冷凝器出口水温",//无单位名称
|
||||
EnName = "Cond1Temp",//英文名称
|
||||
Group = "程序",//分组
|
||||
MinValue = 0,
|
||||
@@ -257,7 +261,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW208",
|
||||
MVAddress = "VW258",
|
||||
IsMeter = true,
|
||||
Precision = 1,
|
||||
AutoHandSwitchAddress = "VW256",
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -265,8 +270,8 @@ namespace CapMachine.Wpf.Services
|
||||
});
|
||||
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
||||
{
|
||||
Name = "OS2温度[℃]",//名称带单位
|
||||
NameNoUnit = "OS2温度",//无单位名称
|
||||
Name = "吸气混合器温度[℃]",//名称带单位 OS2温度
|
||||
NameNoUnit = "吸气混合器温度",//无单位名称 OS2温度
|
||||
EnName = "OS2Temp",//英文名称
|
||||
Group = "程序",//分组
|
||||
MinValue = 0,
|
||||
@@ -276,7 +281,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW210",
|
||||
MVAddress = "VW260",
|
||||
IsMeter = true,
|
||||
Precision = 1,
|
||||
AutoHandSwitchAddress = "VW260",
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -295,7 +301,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW212",
|
||||
MVAddress = "",
|
||||
IsMeter = true,
|
||||
Precision = 1,
|
||||
AutoHandSwitchAddress = "",
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -314,7 +321,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 2,
|
||||
Precision = 100,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -333,7 +340,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 0,
|
||||
Precision = 1,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -352,7 +359,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW214",
|
||||
MVAddress = "",
|
||||
IsMeter = true,
|
||||
Precision = 1,
|
||||
AutoHandSwitchAddress = "",
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -371,7 +379,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 2,
|
||||
Precision = 100,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -390,7 +398,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW216",
|
||||
MVAddress = "",
|
||||
IsMeter = true,
|
||||
Precision = 1,
|
||||
AutoHandSwitchAddress = "",
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -409,7 +418,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "VW218",
|
||||
MVAddress = "",
|
||||
IsMeter = true,
|
||||
Precision = 1,
|
||||
AutoHandSwitchAddress = "",
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -428,7 +438,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -447,7 +457,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -466,8 +476,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 3,
|
||||
DecimalPoint = 1,
|
||||
Precision = 1000,
|
||||
DecimalPoint = 3,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
Index = "",
|
||||
@@ -485,7 +495,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -504,8 +514,8 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 3,
|
||||
DecimalPoint = 1,
|
||||
Precision = 1000,
|
||||
DecimalPoint = 3,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
Index = "",
|
||||
@@ -517,13 +527,13 @@ namespace CapMachine.Wpf.Services
|
||||
EnName = "WaterTankInTemp",//英文名称
|
||||
Group = "程序",//分组
|
||||
MinValue = 0,
|
||||
MaxValue = 100,
|
||||
Unit = "℃",
|
||||
MaxValue = 100,
|
||||
PVAddress = "VW136",//地址信息
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 0,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -542,7 +552,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -561,7 +571,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -580,7 +590,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -599,7 +609,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -618,7 +628,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -637,7 +647,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 2,
|
||||
Precision = 100,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -656,7 +666,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 2,
|
||||
Precision = 100,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -675,7 +685,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 0,
|
||||
Precision = 1,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -694,7 +704,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -713,7 +723,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -732,7 +742,7 @@ namespace CapMachine.Wpf.Services
|
||||
SVAddress = "",
|
||||
MVAddress = "",
|
||||
IsMeter = false,
|
||||
Precision = 1,
|
||||
Precision = 10,
|
||||
DecimalPoint = 1,
|
||||
Samp = 1,
|
||||
ValueType = typeof(short),
|
||||
@@ -963,18 +973,24 @@ namespace CapMachine.Wpf.Services
|
||||
//TagManger.GetTagByName<short>(itemTag.Value.Name).EngValue = (short)Random.Next(1, 100) * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
//LinkState = false;
|
||||
|
||||
|
||||
//PLC 数据
|
||||
OperateResultShort = SiemensDrive.ReadInt16(itemTag.Value.PVAddress);
|
||||
if (OperateResultShort.IsSuccess)
|
||||
if (!string.IsNullOrEmpty(itemTag.Value.PVAddress))
|
||||
{
|
||||
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = SiemensDrive.ReadInt16(itemTag.Value.PVAddress).Content;
|
||||
TagManger.GetTagByName<short>(itemTag.Value.Name).EngValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
LinkState = true;
|
||||
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).EngValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
||||
LinkState = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkState = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkState = false;
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user