变量的更改
This commit is contained in:
@@ -55,5 +55,14 @@ namespace CapMachine.Core
|
|||||||
ConfigurationManager.AppSettings.Remove(key);
|
ConfigurationManager.AppSettings.Remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断Key是否存在
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsExist(string key)
|
||||||
|
{
|
||||||
|
return ConfigurationManager.AppSettings[key] != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,6 @@
|
|||||||
<add key="FluidsPath" value="C:\Program Files (x86)\REFPROP\fluids"/>
|
<add key="FluidsPath" value="C:\Program Files (x86)\REFPROP\fluids"/>
|
||||||
<add key="Cryogen" value="R134a"/>
|
<add key="Cryogen" value="R134a"/>
|
||||||
<add key="LocalDBPath" value="D:\MSDB\LocalDb\CapMachineDb"/>
|
<add key="LocalDBPath" value="D:\MSDB\LocalDb\CapMachineDb"/>
|
||||||
|
<add key="CsvFilePath" value="D:\TestData"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -744,6 +744,9 @@
|
|||||||
<None Update="Key\PublicKey.xml">
|
<None Update="Key\PublicKey.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="TagConfig\SysTags.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
102
CapMachine.Wpf/Models/Tag/BaseTag.cs
Normal file
102
CapMachine.Wpf/Models/Tag/BaseTag.cs
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
using Prism.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag
|
||||||
|
{
|
||||||
|
public abstract class BaseTag<T> : BindableBase, ITag
|
||||||
|
{
|
||||||
|
|
||||||
|
#region 公共属性
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Id
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称 中文
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称 英文
|
||||||
|
/// </summary>
|
||||||
|
public string EnName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称 无单位中文名称
|
||||||
|
/// </summary>
|
||||||
|
public string NameNoUnit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标签组
|
||||||
|
/// </summary>
|
||||||
|
public string Group { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据类型信息
|
||||||
|
/// </summary>
|
||||||
|
public TagDataType DataType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读写信息
|
||||||
|
/// </summary>
|
||||||
|
public RWInfo RWInfo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最大值
|
||||||
|
/// </summary>
|
||||||
|
public double MaxValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最小值
|
||||||
|
/// </summary>
|
||||||
|
public double MinValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 精度 到PLC的转换精度/分辨率
|
||||||
|
/// </summary>
|
||||||
|
public short Precision { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 小数点 展示时用的小数点
|
||||||
|
/// </summary>
|
||||||
|
public short DecimalPoint { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位
|
||||||
|
/// </summary>
|
||||||
|
public string? Unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为仪表参数
|
||||||
|
/// </summary>
|
||||||
|
public bool IsMeter { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PV 工程值 字符串
|
||||||
|
/// </summary>
|
||||||
|
public string? PVEngValueStr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 手自动切换地址 ++
|
||||||
|
/// </summary>
|
||||||
|
public string AutoHandSwitchAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址 ++
|
||||||
|
/// </summary>
|
||||||
|
public string MVAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址 ++
|
||||||
|
/// </summary>
|
||||||
|
public string SVAddress { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
20
CapMachine.Wpf/Models/Tag/CalcTag.cs
Normal file
20
CapMachine.Wpf/Models/Tag/CalcTag.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using CapMachine.Wpf.Models.Tag.Cell;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 计算得到的标签
|
||||||
|
/// </summary>
|
||||||
|
public class CalcTag : BaseTag<double>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PV Value Model
|
||||||
|
/// </summary>
|
||||||
|
public QuickAttrCell? PVModel { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
20
CapMachine.Wpf/Models/Tag/CapTag.cs
Normal file
20
CapMachine.Wpf/Models/Tag/CapTag.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using CapMachine.Wpf.Models.Tag.Cell;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 压缩机通信标签
|
||||||
|
/// </summary>
|
||||||
|
public class CapTag : BaseTag<double>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PV Value Model
|
||||||
|
/// </summary>
|
||||||
|
public QuickAttrCell? PVModel { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
62
CapMachine.Wpf/Models/Tag/Cell/MeterExdAttrCell.cs
Normal file
62
CapMachine.Wpf/Models/Tag/Cell/MeterExdAttrCell.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using Prism.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag.Cell
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 标签信息仪表值拓展属性单元
|
||||||
|
/// 比如 PID Limit ALARM的值信息
|
||||||
|
/// </summary>
|
||||||
|
public class MeterExdAttrCell : BindableBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 地址
|
||||||
|
/// </summary>
|
||||||
|
public string? Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用
|
||||||
|
/// </summary>
|
||||||
|
public bool? Enable { get; set; } = true;
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 读取的块信息
|
||||||
|
///// 人工确认
|
||||||
|
///// </summary>
|
||||||
|
//public string? Block { get; set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 读取的块信息的Index
|
||||||
|
///// </summary>
|
||||||
|
//public short BlockIndex { get; set; }
|
||||||
|
|
||||||
|
private double _EngValue;
|
||||||
|
/// <summary>
|
||||||
|
/// 工程值 SV
|
||||||
|
/// </summary>
|
||||||
|
public double EngValue
|
||||||
|
{
|
||||||
|
get { return _EngValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_EngValue = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
//EngValueStr = Math.Round(value, DecimalPoint).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _EngValueStr;
|
||||||
|
/// <summary>
|
||||||
|
/// 工程值的字符串 MV
|
||||||
|
/// </summary>
|
||||||
|
public string? EngValueStr
|
||||||
|
{
|
||||||
|
get { return _EngValueStr; }
|
||||||
|
set { _EngValueStr = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
107
CapMachine.Wpf/Models/Tag/Cell/MeterValueAttrCell.cs
Normal file
107
CapMachine.Wpf/Models/Tag/Cell/MeterValueAttrCell.cs
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
using Prism.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag.Cell
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 标签信息的主要仪表值的属性单元
|
||||||
|
/// 比如SV PV MV等主要数据的属性单元
|
||||||
|
/// </summary>
|
||||||
|
public class MeterValueAttrCell : BindableBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 实例化构造函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Precision"></param>
|
||||||
|
/// <param name="DecimalPoint"></param>
|
||||||
|
public MeterValueAttrCell()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址
|
||||||
|
/// </summary>
|
||||||
|
public string? Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用
|
||||||
|
/// </summary>
|
||||||
|
public bool? Enable { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取的块信息
|
||||||
|
/// 人工确认
|
||||||
|
/// </summary>
|
||||||
|
public string? Block { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取的块信息的Index
|
||||||
|
/// </summary>
|
||||||
|
public short BlockIndex { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 精度 到PLC的转换精度/分辨率
|
||||||
|
/// 引用的属性信息
|
||||||
|
/// </summary>
|
||||||
|
public short Precision { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 小数点 展示时用的小数点
|
||||||
|
/// 引用的属性信息
|
||||||
|
/// </summary>
|
||||||
|
public short DecimalPoint { get; set; }
|
||||||
|
|
||||||
|
private short _EngSrcValue = -1;
|
||||||
|
/// <summary>
|
||||||
|
/// PLC的原始值 SV
|
||||||
|
/// </summary>
|
||||||
|
public short EngSrcValue
|
||||||
|
{
|
||||||
|
get { return _EngSrcValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
//有改动的话则更新
|
||||||
|
if (value != _EngSrcValue)
|
||||||
|
{
|
||||||
|
_EngSrcValue = value;
|
||||||
|
//原始数据转换成工程值
|
||||||
|
EngValue = _EngSrcValue * 1.0 / Precision;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double _EngValue;
|
||||||
|
/// <summary>
|
||||||
|
/// 工程值 SV
|
||||||
|
/// </summary>
|
||||||
|
public double EngValue
|
||||||
|
{
|
||||||
|
get { return _EngValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != _EngValue)
|
||||||
|
{
|
||||||
|
_EngValue = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
//工程值转换成字符串,可以灵活显示
|
||||||
|
EngValueStr = Math.Round(value, DecimalPoint).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _EngValueStr;
|
||||||
|
/// <summary>
|
||||||
|
/// 工程值的字符串 MV
|
||||||
|
/// </summary>
|
||||||
|
public string? EngValueStr
|
||||||
|
{
|
||||||
|
get { return _EngValueStr; }
|
||||||
|
set { _EngValueStr = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
66
CapMachine.Wpf/Models/Tag/Cell/MvAmAttrCell.cs
Normal file
66
CapMachine.Wpf/Models/Tag/Cell/MvAmAttrCell.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using Prism.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag.Cell
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// MV的手自动的值的属性
|
||||||
|
/// </summary>
|
||||||
|
public class MvAmAttrCell : BindableBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 地址
|
||||||
|
/// </summary>
|
||||||
|
public string? Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用
|
||||||
|
/// </summary>
|
||||||
|
public bool? Enable { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取的块信息
|
||||||
|
/// 人工确认
|
||||||
|
/// </summary>
|
||||||
|
public string? Block { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取的块信息的Index
|
||||||
|
/// </summary>
|
||||||
|
public short BlockIndex { get; set; }
|
||||||
|
|
||||||
|
private short _EngSrcValue = -1;
|
||||||
|
/// <summary>
|
||||||
|
/// PLC的原始值
|
||||||
|
/// 手自动的切换应该没有转换,直接0和1的区别,直接使用工程的原值
|
||||||
|
/// </summary>
|
||||||
|
public short EngSrcValue
|
||||||
|
{
|
||||||
|
get { return _EngSrcValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
//有改动的话则更新
|
||||||
|
if (value != _EngSrcValue)
|
||||||
|
{
|
||||||
|
_EngSrcValue = value;
|
||||||
|
//原始数据转换成工程值
|
||||||
|
EngValueStr = _EngSrcValue.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _EngValueStr;
|
||||||
|
/// <summary>
|
||||||
|
/// 工程值的字符串 MV
|
||||||
|
/// </summary>
|
||||||
|
public string? EngValueStr
|
||||||
|
{
|
||||||
|
get { return _EngValueStr; }
|
||||||
|
set { _EngValueStr = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
52
CapMachine.Wpf/Models/Tag/Cell/QuickAttrCell.cs
Normal file
52
CapMachine.Wpf/Models/Tag/Cell/QuickAttrCell.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using Prism.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag.Cell
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 快速属性标签
|
||||||
|
/// </summary>
|
||||||
|
public class QuickAttrCell : BindableBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 地址 PLC分配的地址
|
||||||
|
/// 可能分配给PLC展示用,也可能不使用
|
||||||
|
/// </summary>
|
||||||
|
public string? Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用
|
||||||
|
/// </summary>
|
||||||
|
public bool? Enable { get; set; } = true;
|
||||||
|
|
||||||
|
private double _EngValue;
|
||||||
|
/// <summary>
|
||||||
|
/// 工程值 SV
|
||||||
|
/// </summary>
|
||||||
|
public double EngValue
|
||||||
|
{
|
||||||
|
get { return _EngValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_EngValue = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
//EngValueStr = Math.Round(value, DecimalPoint).ToString();
|
||||||
|
EngValueStr = value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _EngValueStr;
|
||||||
|
/// <summary>
|
||||||
|
/// 工程值的字符串
|
||||||
|
/// </summary>
|
||||||
|
public string? EngValueStr
|
||||||
|
{
|
||||||
|
get { return _EngValueStr; }
|
||||||
|
set { _EngValueStr = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,11 @@ namespace CapMachine.Wpf.Models.Tag
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ITag
|
public interface ITag
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id
|
||||||
|
/// </summary>
|
||||||
|
long Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 中文名称
|
/// 中文名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -31,42 +36,6 @@ namespace CapMachine.Wpf.Models.Tag
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
string? Unit { get; set; }
|
string? Unit { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值 PV
|
|
||||||
/// </summary>
|
|
||||||
double EngPvValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值的字符串 PV
|
|
||||||
/// </summary>
|
|
||||||
string EngPvValueStr { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值 Sv
|
|
||||||
/// </summary>
|
|
||||||
double EngSvValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值的字符串 Sv
|
|
||||||
/// </summary>
|
|
||||||
string EngSvValueStr { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值 Mv
|
|
||||||
/// </summary>
|
|
||||||
double EngMvValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值的字符串 Mv
|
|
||||||
/// </summary>
|
|
||||||
string EngMvValueStr { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MV
|
|
||||||
/// </summary>
|
|
||||||
double MVValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大值
|
/// 最大值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -78,29 +47,14 @@ namespace CapMachine.Wpf.Models.Tag
|
|||||||
double MinValue { get; set; }
|
double MinValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 值类型
|
/// 标签值类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Type ValueType { get; set; }
|
TagDataType DataType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 地址
|
/// 标签读写信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string PVAddress { get; set; }
|
RWInfo RWInfo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地址
|
|
||||||
/// </summary>
|
|
||||||
string SVAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地址
|
|
||||||
/// </summary>
|
|
||||||
string MVAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Index
|
|
||||||
/// </summary>
|
|
||||||
string Index { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 精度
|
/// 精度
|
||||||
@@ -116,6 +70,25 @@ namespace CapMachine.Wpf.Models.Tag
|
|||||||
/// 是否为仪表参数
|
/// 是否为仪表参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsMeter { get; set; }
|
bool IsMeter { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PV 工程值 字符串
|
||||||
|
/// UI展示用
|
||||||
|
/// </summary>
|
||||||
|
string? PVEngValueStr { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// ++
|
||||||
|
/// </summary>
|
||||||
string AutoHandSwitchAddress { get; set; }
|
string AutoHandSwitchAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址 ++
|
||||||
|
/// </summary>
|
||||||
|
string MVAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址 ++
|
||||||
|
/// </summary>
|
||||||
|
string SVAddress { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
CapMachine.Wpf/Models/Tag/RWInfo.cs
Normal file
35
CapMachine.Wpf/Models/Tag/RWInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 读写信息
|
||||||
|
/// </summary>
|
||||||
|
public enum RWInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 控制
|
||||||
|
/// </summary>
|
||||||
|
Control = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从PLC读取
|
||||||
|
/// </summary>
|
||||||
|
PLCRead = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从压缩机读取
|
||||||
|
/// </summary>
|
||||||
|
CapRead = 5,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计算
|
||||||
|
/// </summary>
|
||||||
|
PCCalcu = 8,
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
122
CapMachine.Wpf/Models/Tag/ShortControlTag.cs
Normal file
122
CapMachine.Wpf/Models/Tag/ShortControlTag.cs
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
using CapMachine.Wpf.Models.Tag.Cell;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Short类型 步序控制 标签数据
|
||||||
|
/// 当前的数据无论是整型、浮点数等其他数据都是用Short表示,然后根据精度运算成所需数据
|
||||||
|
/// 如果后期其他项目不是这样处理,则新建其他类对应
|
||||||
|
/// </summary>
|
||||||
|
public class ShortControlTag : BaseTag<short>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
public ShortControlTag()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化数据
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateInit()
|
||||||
|
{
|
||||||
|
PVModel!.DecimalPoint = this.DecimalPoint;
|
||||||
|
PVModel!.Precision = this.Precision;
|
||||||
|
|
||||||
|
SVModel!.DecimalPoint = this.DecimalPoint;
|
||||||
|
SVModel!.Precision = this.Precision;
|
||||||
|
|
||||||
|
//MV的值是固定到0-100,不需要转换
|
||||||
|
MVModel!.DecimalPoint = 0;
|
||||||
|
MVModel!.Precision = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PV Model
|
||||||
|
/// </summary>
|
||||||
|
public MeterValueAttrCell PVModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SV Model
|
||||||
|
/// </summary>
|
||||||
|
public MeterValueAttrCell SVModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MV Model
|
||||||
|
/// </summary>
|
||||||
|
public MeterValueAttrCell MVModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AutoHand Model
|
||||||
|
/// 仪表的MV手动和自动 模型
|
||||||
|
/// </summary>
|
||||||
|
public MvAmAttrCell MVAutoHandModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pid-P
|
||||||
|
/// </summary>
|
||||||
|
public MeterExdAttrCell Pid_PModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pid-I
|
||||||
|
/// </summary>
|
||||||
|
public MeterExdAttrCell Pid_IModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pid-D
|
||||||
|
/// </summary>
|
||||||
|
public MeterExdAttrCell Pid_DModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Limit-Up
|
||||||
|
/// </summary>
|
||||||
|
public MeterExdAttrCell Limit_UpModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Limit-Down
|
||||||
|
/// </summary>
|
||||||
|
public MeterExdAttrCell Limit_DownModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Alarm
|
||||||
|
/// </summary>
|
||||||
|
public MeterExdAttrCell AlarmModel { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
private bool _AutoHandState;
|
||||||
|
/// <summary>
|
||||||
|
/// 手自动状态
|
||||||
|
/// </summary>
|
||||||
|
public bool AutoHandState
|
||||||
|
{
|
||||||
|
get { return _AutoHandState; }
|
||||||
|
set { _AutoHandState = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _StepExeInfo = "--";
|
||||||
|
/// <summary>
|
||||||
|
/// 步骤执行的信息
|
||||||
|
/// 作为主界面的Meter当前步骤的数据的信息
|
||||||
|
/// </summary>
|
||||||
|
public string StepExeInfo
|
||||||
|
{
|
||||||
|
get { return _StepExeInfo; }
|
||||||
|
set { _StepExeInfo = value; RaisePropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 手自动切换地址
|
||||||
|
///// </summary>
|
||||||
|
//public string AutoHandSwitchAddress { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
30
CapMachine.Wpf/Models/Tag/ShortValueTag.cs
Normal file
30
CapMachine.Wpf/Models/Tag/ShortValueTag.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using CapMachine.Wpf.Models.Tag.Cell;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Short类型 标签数据
|
||||||
|
/// 这个版本的标签数据取代控制参数,因为当前版本是PLC下发步骤数据,不需要程序操作进行,那么跟北厂的那个就不一样了,把ShortValueTag拓展整合了数据。
|
||||||
|
/// </summary>
|
||||||
|
public class ShortValueTag : BaseTag<short>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PV Model
|
||||||
|
/// </summary>
|
||||||
|
public MeterValueAttrCell PVModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化数据
|
||||||
|
/// </summary>
|
||||||
|
public void UpdateInit()
|
||||||
|
{
|
||||||
|
PVModel!.DecimalPoint = this.DecimalPoint;
|
||||||
|
PVModel!.Precision = this.Precision;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,288 +0,0 @@
|
|||||||
using HslCommunication;
|
|
||||||
using Prism.Mvvm;
|
|
||||||
|
|
||||||
namespace CapMachine.Wpf.Models.Tag
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 基础模型
|
|
||||||
/// </summary>
|
|
||||||
public class Tag<T> : BindableBase, ITag
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 实例化函数
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
/// <param name="enName"></param>
|
|
||||||
/// <param name="tagType"></param>
|
|
||||||
public Tag(string nameNoUnit, string name, string enName, string group, string PVaddress, double maxValue, double minValue, short precision, string unit, ITagValue<T> tagValue, bool isMeter)
|
|
||||||
{
|
|
||||||
Group = group;
|
|
||||||
Name = name;
|
|
||||||
Unit = unit;
|
|
||||||
EnName = enName;
|
|
||||||
PVAddress = PVaddress;
|
|
||||||
MaxValue = maxValue;
|
|
||||||
MinValue = minValue;
|
|
||||||
Precision = precision;
|
|
||||||
|
|
||||||
IsMeter = isMeter;
|
|
||||||
|
|
||||||
NameNoUnit = nameNoUnit;
|
|
||||||
|
|
||||||
//实例化
|
|
||||||
TagValue = tagValue;
|
|
||||||
ValueType = typeof(T);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 实例化函数
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
/// <param name="enName"></param>
|
|
||||||
/// <param name="tagType"></param>
|
|
||||||
public Tag(ITagValue<T> tagValue)
|
|
||||||
{
|
|
||||||
//实例化
|
|
||||||
TagValue = tagValue;
|
|
||||||
ValueType = typeof(T);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 实例化函数
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
/// <param name="enName"></param>
|
|
||||||
/// <param name="tagType"></param>
|
|
||||||
public Tag()
|
|
||||||
{
|
|
||||||
//实例化
|
|
||||||
ValueType = typeof(T);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 名称 中文
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 名称 英文
|
|
||||||
/// </summary>
|
|
||||||
public string EnName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 名称 无单位中文名称
|
|
||||||
/// </summary>
|
|
||||||
public string NameNoUnit { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 标签组
|
|
||||||
/// </summary>
|
|
||||||
public string Group { get; set; }
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// 实时值
|
|
||||||
///// </summary>
|
|
||||||
//public abstract IRegisterValue<short> RtValue { get; set; }
|
|
||||||
|
|
||||||
private ITagValue<T> _TagValue;
|
|
||||||
/// <summary>
|
|
||||||
/// 实时值
|
|
||||||
/// </summary>
|
|
||||||
public ITagValue<T> TagValue
|
|
||||||
{
|
|
||||||
get { return _TagValue; }
|
|
||||||
set { _TagValue = value; RaisePropertyChanged(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 原始值实时值
|
|
||||||
/// </summary>
|
|
||||||
public OperateResult<T> OperateResultSource { get; set; } //
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 数据类型信息
|
|
||||||
/// </summary>
|
|
||||||
public Type ValueType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地址信息 PV
|
|
||||||
/// </summary>
|
|
||||||
public string PVAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地址信息 SV
|
|
||||||
/// </summary>
|
|
||||||
public string SVAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地址信息 MV
|
|
||||||
/// </summary>
|
|
||||||
public string MVAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 地址信息 Index
|
|
||||||
/// </summary>
|
|
||||||
public string Index { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 最大值
|
|
||||||
/// </summary>
|
|
||||||
public double MaxValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 最小值
|
|
||||||
/// </summary>
|
|
||||||
public double MinValue { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 精度 到PLC的转换精度/分辨率
|
|
||||||
/// </summary>
|
|
||||||
public short Precision { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 小数点 展示时用的小数点
|
|
||||||
/// </summary>
|
|
||||||
public short DecimalPoint { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 单位
|
|
||||||
/// </summary>
|
|
||||||
public string? Unit { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 采样周期
|
|
||||||
/// </summary>
|
|
||||||
public int Samp { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否为仪表参数
|
|
||||||
/// </summary>
|
|
||||||
public bool IsMeter { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 手自动切换地址
|
|
||||||
/// </summary>
|
|
||||||
public string AutoHandSwitchAddress { get; set; }
|
|
||||||
|
|
||||||
private bool _AutoHandState;
|
|
||||||
/// <summary>
|
|
||||||
/// 手自动状态
|
|
||||||
/// </summary>
|
|
||||||
public bool AutoHandState
|
|
||||||
{
|
|
||||||
get { return _AutoHandState; }
|
|
||||||
set { _AutoHandState = value; RaisePropertyChanged(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
private double _EngSvValue;
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值 SV
|
|
||||||
/// </summary>
|
|
||||||
public double EngSvValue
|
|
||||||
{
|
|
||||||
get { return _EngSvValue; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_EngSvValue = value;
|
|
||||||
if (TagValue.IsShow)
|
|
||||||
{
|
|
||||||
RaisePropertyChanged();
|
|
||||||
}
|
|
||||||
EngSvValueStr = Math.Round(value, DecimalPoint).ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _EngSvValueStr;
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值的字符串 SV
|
|
||||||
/// </summary>
|
|
||||||
public string EngSvValueStr
|
|
||||||
{
|
|
||||||
get { return _EngSvValueStr; }
|
|
||||||
set { _EngSvValueStr = value; RaisePropertyChanged(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private double _EngPvValue;
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值 PV
|
|
||||||
/// </summary>
|
|
||||||
public double EngPvValue
|
|
||||||
{
|
|
||||||
get { return _EngPvValue; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_EngPvValue = value;
|
|
||||||
if (TagValue.IsShow)
|
|
||||||
{
|
|
||||||
RaisePropertyChanged();
|
|
||||||
}
|
|
||||||
EngPvValueStr = Math.Round(value, DecimalPoint).ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _EngPvValueStr;
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值的字符串
|
|
||||||
/// </summary>
|
|
||||||
public string EngPvValueStr
|
|
||||||
{
|
|
||||||
get { return _EngPvValueStr; }
|
|
||||||
set { _EngPvValueStr = value; RaisePropertyChanged(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private double _EngMvValue;
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值 MV
|
|
||||||
/// </summary>
|
|
||||||
public double EngMvValue
|
|
||||||
{
|
|
||||||
get { return _EngMvValue; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_EngMvValue = value;
|
|
||||||
if (TagValue.IsShow)
|
|
||||||
{
|
|
||||||
RaisePropertyChanged();
|
|
||||||
}
|
|
||||||
EngMvValueStr = value.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _EngMvValueStr;
|
|
||||||
/// <summary>
|
|
||||||
/// 工程值的字符串 MV
|
|
||||||
/// </summary>
|
|
||||||
public string EngMvValueStr
|
|
||||||
{
|
|
||||||
get { return _EngMvValueStr; }
|
|
||||||
set { _EngMvValueStr = value; RaisePropertyChanged(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private double _MVValue = 20;
|
|
||||||
/// <summary>
|
|
||||||
/// MV值
|
|
||||||
/// 不是所有的数据都有MV值,只有仪表参数设置的有
|
|
||||||
/// </summary>
|
|
||||||
public double MVValue
|
|
||||||
{
|
|
||||||
get { return _MVValue; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_MVValue = value;
|
|
||||||
if (TagValue.IsShow)
|
|
||||||
{
|
|
||||||
RaisePropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
28
CapMachine.Wpf/Models/Tag/TagDataType.cs
Normal file
28
CapMachine.Wpf/Models/Tag/TagDataType.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 标签的数据类型
|
||||||
|
/// </summary>
|
||||||
|
public enum TagDataType
|
||||||
|
{
|
||||||
|
Short,
|
||||||
|
Int,
|
||||||
|
Long,
|
||||||
|
Float,
|
||||||
|
Double,
|
||||||
|
String,
|
||||||
|
Bool,
|
||||||
|
DateTime,
|
||||||
|
Byte,
|
||||||
|
UShort,
|
||||||
|
UInt,
|
||||||
|
ULong,
|
||||||
|
UByte
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
namespace CapMachine.Wpf.Models.Tag
|
using CapMachine.Wpf.Models.Tag.Cell;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.Tag
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标签管理中心
|
/// 标签管理中心
|
||||||
@@ -17,23 +22,649 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标签集合数据
|
/// 标签集合数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, ITag> DicTags { get; set; } = new Dictionary<string, ITag>();
|
//public Dictionary<string, ITag> DicTags { get; set; } = new Dictionary<string, ITag>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标签集合数据
|
||||||
|
/// 线程安全
|
||||||
|
/// </summary>
|
||||||
|
public readonly ConcurrentDictionary<string, ITag> DicTags = new ConcurrentDictionary<string, ITag>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 增加标签
|
/// 增加标签
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddTag<T>(Tag<T> baseTag)
|
public void AddTag<T>(BaseTag<T> baseTag)
|
||||||
{
|
{
|
||||||
DicTags[baseTag.Name] = baseTag;
|
DicTags[baseTag.Name] = baseTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取标签信息
|
/// PV锁
|
||||||
|
/// </summary>
|
||||||
|
private static readonly object PvLock = new object();
|
||||||
|
|
||||||
|
|
||||||
|
#region 获取标签的PVModel SVModel MVModel
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的PVModel模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <param name="pVModel">输出的pVModel模型,如果获取失败则为null</param>
|
||||||
|
/// <returns>是否成功获取PV模型</returns>
|
||||||
|
public bool TryGetPVModel(string tagName, out MeterValueAttrCell? pVModel)
|
||||||
|
{
|
||||||
|
lock (PvLock)
|
||||||
|
{
|
||||||
|
pVModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
pVModel = controlTag.PVModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (tag is ShortValueTag shortTag)
|
||||||
|
{
|
||||||
|
pVModel = shortTag.PVModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 需要提前知道这个标签是CapTag标签,否则为空
|
||||||
|
/// 尝试获取CapTag标签的PVModel模型
|
||||||
|
/// 压缩机通信的标签
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <param name="pVModel">输出的pVModel模型,如果获取失败则为null</param>
|
||||||
|
/// <returns>是否成功获取PV模型</returns>
|
||||||
|
public bool TryGetCapPVModel(string tagName, out QuickAttrCell? pVModel)
|
||||||
|
{
|
||||||
|
lock (PvLock)
|
||||||
|
{
|
||||||
|
pVModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is CapTag capTag)
|
||||||
|
{
|
||||||
|
pVModel = capTag.PVModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的PVModel模型
|
||||||
|
/// 给数据记录使用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <param name="pVModel">输出的pVModel模型,如果获取失败则为null</param>
|
||||||
|
/// <returns>是否成功获取PV模型</returns>
|
||||||
|
public MeterValueAttrCell TryGetRecordPVModel(string tagName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
return controlTag.PVModel;
|
||||||
|
}
|
||||||
|
else if (tag is ShortValueTag shortTag)
|
||||||
|
{
|
||||||
|
return shortTag.PVModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的PVModel模型的数据
|
||||||
|
/// 给数据记录使用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <param name="pVModel">输出的pVModel模型,如果获取失败则为null</param>
|
||||||
|
/// <returns>是否成功获取PV模型</returns>
|
||||||
|
public double TryGetRecordPVValue(string tagName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
return controlTag.PVModel.EngValue;
|
||||||
|
}
|
||||||
|
else if (tag is ShortValueTag shortTag)
|
||||||
|
{
|
||||||
|
return shortTag.PVModel.EngValue;
|
||||||
|
}
|
||||||
|
else if (tag is CalcTag calcTag)
|
||||||
|
{
|
||||||
|
return calcTag.PVModel!.EngValue;
|
||||||
|
}
|
||||||
|
else if (tag is CapTag capTag)
|
||||||
|
{
|
||||||
|
return capTag.PVModel!.EngValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的SVModel模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <param name="SVModel">输出的sVModel模型,如果获取失败则为null</param>
|
||||||
|
/// <returns>是否成功获取SV模型</returns>
|
||||||
|
public bool TryGetSVModel(string tagName, out MeterValueAttrCell? sVModel)
|
||||||
|
{
|
||||||
|
sVModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
sVModel = controlTag.SVModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的MVModel模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <param name="mVModel">输出的MVModel模型,如果获取失败则为null</param>
|
||||||
|
/// <returns>是否成功获取MV模型</returns>
|
||||||
|
public bool TryGetMVModel(string tagName, out MeterValueAttrCell? mVModel)
|
||||||
|
{
|
||||||
|
mVModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
mVModel = controlTag.MVModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的MVAm模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <param name="MVAm">输出的MVAmModel模型,如果获取失败则为null</param>
|
||||||
|
/// <returns>是否成功获取MV模型</returns>
|
||||||
|
public bool TryGetMVAmModel(string tagName, out MvAmAttrCell? mVAmModel)
|
||||||
|
{
|
||||||
|
mVAmModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
mVAmModel = controlTag.MVAutoHandModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 获取控制属性的PID LIMIT ALARM
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的PID_P模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName"></param>
|
||||||
|
/// <param name="pidPModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetPidPModel(string tagName, out MeterExdAttrCell? pidPModel)
|
||||||
|
{
|
||||||
|
pidPModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
pidPModel = controlTag.Pid_PModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的PID_I模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName"></param>
|
||||||
|
/// <param name="pidIModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetPidIModel(string tagName, out MeterExdAttrCell? pidIModel)
|
||||||
|
{
|
||||||
|
pidIModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
pidIModel = controlTag.Pid_IModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的PID_D模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <param name="pidDModel">输出的PID_D模型,如果获取失败则为null</param>
|
||||||
|
/// <returns>是否成功获取PID_D模型</returns>
|
||||||
|
public bool TryGetPidDModel(string tagName, out MeterExdAttrCell? pidDModel)
|
||||||
|
{
|
||||||
|
pidDModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
pidDModel = controlTag.Pid_DModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的limitUpModel模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName"></param>
|
||||||
|
/// <param name="limitUpModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetLimitUpModel(string tagName, out MeterExdAttrCell? limitUpModel)
|
||||||
|
{
|
||||||
|
limitUpModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
limitUpModel = controlTag.Limit_UpModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的limitDownModel模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName"></param>
|
||||||
|
/// <param name="limitDownModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetLimitDownModel(string tagName, out MeterExdAttrCell? limitDownModel)
|
||||||
|
{
|
||||||
|
limitDownModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
limitDownModel = controlTag.Limit_DownModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的Alarm模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName"></param>
|
||||||
|
/// <param name="alarmModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetAlarmModel(string tagName, out MeterExdAttrCell? alarmModel)
|
||||||
|
{
|
||||||
|
alarmModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
alarmModel = controlTag.AlarmModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的MvAmAttrCelll模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName"></param>
|
||||||
|
/// <param name="mvAmModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetMvAmModel(string tagName, out MvAmAttrCell? mvAmModel)
|
||||||
|
{
|
||||||
|
mvAmModel = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
mvAmModel = controlTag.MVAutoHandModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取标签的MvAmAttrCelll模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName"></param>
|
||||||
|
/// <param name="limitModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetQuickAttrModel(string tagName, out QuickAttrCell? quickAttrCell)
|
||||||
|
{
|
||||||
|
quickAttrCell = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tagName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is CapTag capTag)
|
||||||
|
{
|
||||||
|
quickAttrCell = capTag.PVModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (tag is CalcTag calcTag)
|
||||||
|
{
|
||||||
|
quickAttrCell = calcTag.PVModel;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 获取标签
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取ShortControlTag变量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="shortControlTag"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetShortControlTagByName(string name, out ShortControlTag? shortControlTag)
|
||||||
|
{
|
||||||
|
shortControlTag = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(name, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortControlTag controlTag)
|
||||||
|
{
|
||||||
|
shortControlTag = controlTag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取ShortTag变量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="shortTag"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetShortTagByName(string name, out ShortValueTag? shortTag)
|
||||||
|
{
|
||||||
|
shortTag = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(name, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is ShortValueTag getshortTag)
|
||||||
|
{
|
||||||
|
shortTag = getshortTag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取CapTag变量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="shortTag"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetCapTagByName(string name, out CapTag? capTag)
|
||||||
|
{
|
||||||
|
capTag = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(name, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is CapTag getshortTag)
|
||||||
|
{
|
||||||
|
capTag = getshortTag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 尝试获取CalcTag变量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="shortTag"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool TryGetCalcTagByName(string name, out CalcTag? calcTag)
|
||||||
|
{
|
||||||
|
calcTag = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(name, out var tag))
|
||||||
|
{
|
||||||
|
// 尝试将标签转换为ShortControlTag
|
||||||
|
if (tag is CalcTag getshortTag)
|
||||||
|
{
|
||||||
|
calcTag = getshortTag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查标签是否为ShortControlTag标签类型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <returns>如果是ShortControlTag类型返回true,否则返回false</returns>
|
||||||
|
public bool IsShortControlTag(string tagName)
|
||||||
|
{
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
return tag is ShortControlTag;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查标签是否为ShortTag标签类型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <returns>如果是ShortValueTag类型返回true,否则返回false</returns>
|
||||||
|
public bool IsShortTag(string tagName)
|
||||||
|
{
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
return tag is ShortValueTag;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查标签是否为CapTag标签类型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <returns>如果是CapTag类型返回true,否则返回false</returns>
|
||||||
|
public bool IsCapTag(string tagName)
|
||||||
|
{
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
return tag is CapTag;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查标签是否为CalcTag标签类型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tagName">标签名称</param>
|
||||||
|
/// <returns>如果是CalcTag类型返回true,否则返回false</returns>
|
||||||
|
public bool IsCalcTag(string tagName)
|
||||||
|
{
|
||||||
|
if (DicTags.TryGetValue(tagName, out var tag))
|
||||||
|
{
|
||||||
|
return tag is CalcTag;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取原始标签信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Tag<T>? GetTagByName<T>(string name)
|
public BaseTag<T>? GetBaseTagByName<T>(string name)
|
||||||
{
|
{
|
||||||
//return ListTag.OfType<BaseTag<T>>()
|
//return ListTag.OfType<BaseTag<T>>()
|
||||||
// .FirstOrDefault(t => t.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
|
// .FirstOrDefault(t => t.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
|
||||||
@@ -41,47 +672,90 @@
|
|||||||
// 尝试从字典中获取标签,并使用 as 关键字避免类型转换失败抛出异常
|
// 尝试从字典中获取标签,并使用 as 关键字避免类型转换失败抛出异常
|
||||||
if (DicTags.TryGetValue(name, out var FindTag))
|
if (DicTags.TryGetValue(name, out var FindTag))
|
||||||
{
|
{
|
||||||
return FindTag as Tag<T>;// 成功转换返回具体类型的标签,失败返回 null
|
return FindTag as BaseTag<T>;// 成功转换返回具体类型的标签,失败返回 null
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通过标签名称获取 ShortControlTag 信息 无返回是否为空
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Name">标签名称</param>
|
||||||
|
/// <returns>找到则返回ShortControlTag,否则返回null</returns>
|
||||||
|
public ShortControlTag? GetShortControlTagByName(string Name)
|
||||||
|
{
|
||||||
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(Name, out var findTag))
|
||||||
|
{
|
||||||
|
// 尝试转换为 ShortControlTag
|
||||||
|
return findTag as ShortControlTag;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取标签的值
|
/// 通过标签名称获取 ShortTag 信息 无返回是否为空
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public T? GetTagValueByName<T>(string name)
|
public ShortValueTag GetShortTagByName(string name)
|
||||||
{
|
{
|
||||||
var FindTag = GetTagByName<T>(name);
|
// 尝试从字典中获取标签
|
||||||
|
if (DicTags.TryGetValue(name, out var findTag))
|
||||||
// 如果找到标签,则返回其值,否则返回默认值
|
|
||||||
if (FindTag != null)
|
|
||||||
{
|
{
|
||||||
return FindTag!.TagValue.Value;
|
// 尝试转换为 ShortControlTag
|
||||||
|
return findTag as ShortValueTag;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
return default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 标签文件加载
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取标签的值信息
|
/// 从JSON配置文件加载标签
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <param name="configFilePath">配置文件路径</param>
|
||||||
/// <param name="name"></param>
|
public void LoadTagsFromConfig(string configFilePath)
|
||||||
/// <returns></returns>
|
|
||||||
public ITagValue<T>? GetTagInfoValueByName<T>(string name)
|
|
||||||
{
|
{
|
||||||
var FindTag = GetTagByName<T>(name);
|
try
|
||||||
|
|
||||||
// 如果找到标签,则返回其值,否则返回默认值
|
|
||||||
if (FindTag != null)
|
|
||||||
{
|
{
|
||||||
return FindTag!.TagValue;
|
if (!File.Exists(configFilePath))
|
||||||
}
|
{
|
||||||
|
throw new FileNotFoundException($"标签配置文件不存在: {configFilePath}");
|
||||||
|
}
|
||||||
|
|
||||||
return default;
|
// 读取JSON文件
|
||||||
|
string jsonContent = File.ReadAllText(configFilePath);
|
||||||
|
|
||||||
|
// 反序列化JSON直接为ShortValueTag列表
|
||||||
|
var tagList = JsonConvert.DeserializeObject<List<ShortValueTag>>(jsonContent);
|
||||||
|
|
||||||
|
if (tagList == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("标签配置文件格式不正确或为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 遍历标签并添加到TagManager
|
||||||
|
foreach (var tag in tagList)
|
||||||
|
{
|
||||||
|
// 初始化标签数据
|
||||||
|
tag.UpdateInit();
|
||||||
|
|
||||||
|
// 添加标签到管理器
|
||||||
|
AddTag(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 处理异常,记录日志或抛出更详细的异常
|
||||||
|
throw new Exception($"加载标签配置文件时发生错误: {ex.Message}", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
CapMachine.Wpf/Models/TagJsonConfig/TagConfigRoot.cs
Normal file
15
CapMachine.Wpf/Models/TagJsonConfig/TagConfigRoot.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using CapMachine.Wpf.Models.Tag;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CapMachine.Wpf.Models.TagJsonConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
public class TagConfigRoot
|
||||||
|
{
|
||||||
|
public List<ShortValueTag> Tags { get; set; } = new List<ShortValueTag>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using CapMachine.Model;
|
using CapMachine.Core;
|
||||||
|
using CapMachine.Model;
|
||||||
using CapMachine.Model.CANLIN;
|
using CapMachine.Model.CANLIN;
|
||||||
using CapMachine.Wpf.Dtos;
|
using CapMachine.Wpf.Dtos;
|
||||||
using CapMachine.Wpf.Models;
|
using CapMachine.Wpf.Models;
|
||||||
@@ -23,6 +24,14 @@ namespace CapMachine.Wpf.Services
|
|||||||
EventAggregator = eventAggregator;
|
EventAggregator = eventAggregator;
|
||||||
|
|
||||||
DialogService = dialogService;
|
DialogService = dialogService;
|
||||||
|
|
||||||
|
if (ConfigHelper.IsExist("CsvFilePath"))
|
||||||
|
{
|
||||||
|
SaveCsvRootPath = ConfigHelper.GetValue("CsvFilePath");
|
||||||
|
HighSpeedMsgSaveCsvRootPath = ConfigHelper.GetValue("CsvFilePath");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ namespace CapMachine.Wpf.Services
|
|||||||
//CycleTimer.Stop(); //先关闭定时器
|
//CycleTimer.Stop(); //先关闭定时器
|
||||||
|
|
||||||
var DataInfo = MachineRtDataService.TagManger.DicTags
|
var DataInfo = MachineRtDataService.TagManger.DicTags
|
||||||
.ToDictionary(kvp => kvp.Key, kvp => (object)kvp.Value.EngPvValue);
|
.ToDictionary(kvp => kvp.Key, kvp => (object)MachineRtDataService.TagManger.TryGetRecordPVValue(kvp.Value.Name));
|
||||||
DataInfo.Add("创建时间", DateTime.Now);
|
DataInfo.Add("创建时间", DateTime.Now);
|
||||||
|
|
||||||
var RecordData = new RecordChannelData()
|
var RecordData = new RecordChannelData()
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -56,21 +56,48 @@ namespace CapMachine.Wpf.Services
|
|||||||
//SpeedTag = TagManager.DicTags.GetValueOrDefault("转速[rpm]");
|
//SpeedTag = TagManager.DicTags.GetValueOrDefault("转速[rpm]");
|
||||||
//ExPressTag = TagManager.DicTags.GetValueOrDefault("排气压力[BarA]");
|
//ExPressTag = TagManager.DicTags.GetValueOrDefault("排气压力[BarA]");
|
||||||
//ExTempTag = TagManager.DicTags.GetValueOrDefault("排气温度[℃]");
|
//ExTempTag = TagManager.DicTags.GetValueOrDefault("排气温度[℃]");
|
||||||
InhPressTag = TagManager.DicTags.GetValueOrDefault("吸气压力[BarA]")!;
|
if (TagManager.TryGetShortControlTagByName("吸气压力[BarA]", out ShortControlTag? InhPressShortControlTag))
|
||||||
InhTempTag = TagManager.DicTags.GetValueOrDefault("吸气温度[℃]")!;
|
{
|
||||||
|
InhPressTag = InhPressShortControlTag!;
|
||||||
|
}
|
||||||
|
if (TagManager.TryGetShortControlTagByName("吸气温度[℃]", out ShortControlTag? InhTempShortControlTag))
|
||||||
|
{
|
||||||
|
InhTempTag = InhTempShortControlTag!;
|
||||||
|
}
|
||||||
|
|
||||||
|
//InhTempTag = TagManager.DicTags.GetValueOrDefault("吸气温度[℃]")!;
|
||||||
//ComCapBusVolTag = TagManager.DicTags.GetValueOrDefault("通讯母线电压[V]");
|
//ComCapBusVolTag = TagManager.DicTags.GetValueOrDefault("通讯母线电压[V]");
|
||||||
//ComCapBusCurTag = TagManager.DicTags.GetValueOrDefault("通讯母线电流[A]");
|
//ComCapBusCurTag = TagManager.DicTags.GetValueOrDefault("通讯母线电流[A]");
|
||||||
//ComCapPwTag = TagManager.DicTags.GetValueOrDefault("通讯功率[W]");
|
//ComCapPwTag = TagManager.DicTags.GetValueOrDefault("通讯功率[W]");
|
||||||
//OS2TempTag = TagManager.DicTags.GetValueOrDefault("吸气混合器温度[℃]");
|
//OS2TempTag = TagManager.DicTags.GetValueOrDefault("吸气混合器温度[℃]");
|
||||||
TxvFrTempTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前温度[℃]")!;
|
|
||||||
TxvFrPressTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前压力[BarA]")!;
|
//TxvFrTempTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前温度[℃]")!;
|
||||||
|
//TxvFrPressTag = TagManager.DicTags.GetValueOrDefault("膨胀阀前压力[BarA]")!;
|
||||||
|
|
||||||
|
if (TagManager.TryGetShortTagByName("膨胀阀前温度[℃]", out ShortValueTag? TxvFrTempShortTag))
|
||||||
|
{
|
||||||
|
TxvFrTempTag = TxvFrTempShortTag!;
|
||||||
|
}
|
||||||
|
if (TagManager.TryGetShortTagByName("膨胀阀前压力[BarA]", out ShortValueTag? TxvFrPressShortTag))
|
||||||
|
{
|
||||||
|
TxvFrPressTag = TxvFrPressShortTag!;
|
||||||
|
}
|
||||||
|
|
||||||
//Cond1TempTag = TagManager.DicTags.GetValueOrDefault("冷凝器出口水温[℃]");
|
//Cond1TempTag = TagManager.DicTags.GetValueOrDefault("冷凝器出口水温[℃]");
|
||||||
//CondInTempTag = TagManager.DicTags.GetValueOrDefault("冷凝器进口温度[℃]");
|
//CondInTempTag = TagManager.DicTags.GetValueOrDefault("冷凝器进口温度[℃]");
|
||||||
|
|
||||||
Superheat = TagManager.DicTags.GetValueOrDefault("过热度[K]");
|
//Superheat = TagManager.DicTags.GetValueOrDefault("过热度[K]");
|
||||||
Subcool = TagManager.DicTags.GetValueOrDefault("过冷度[K]");
|
//Subcool = TagManager.DicTags.GetValueOrDefault("过冷度[K]");
|
||||||
|
|
||||||
|
if (TagManager.TryGetShortTagByName("过热度[K]", out ShortValueTag? SuperheatShortTag))
|
||||||
|
{
|
||||||
|
Superheat = SuperheatShortTag!;
|
||||||
|
}
|
||||||
|
if (TagManager.TryGetShortTagByName("过冷度[K]", out ShortValueTag? SubcoolShortTag))
|
||||||
|
{
|
||||||
|
Subcool = SubcoolShortTag!;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SuperHeatCoolConfig.FluidsPath = ConfigHelper.GetValue("FluidsPath");
|
SuperHeatCoolConfig.FluidsPath = ConfigHelper.GetValue("FluidsPath");
|
||||||
SuperHeatCoolConfig.Cryogen = ConfigHelper.GetValue("Cryogen");
|
SuperHeatCoolConfig.Cryogen = ConfigHelper.GetValue("Cryogen");
|
||||||
|
|
||||||
@@ -95,34 +122,34 @@ namespace CapMachine.Wpf.Services
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 吸气压力
|
/// 吸气压力
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ITag InhPressTag { get; set; }
|
public ShortControlTag InhPressTag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 吸气温度
|
/// 吸气温度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ITag InhTempTag { get; set; }
|
public ShortControlTag InhTempTag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 膨胀阀前温度
|
/// 膨胀阀前温度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ITag TxvFrTempTag { get; set; }
|
public ShortValueTag TxvFrTempTag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 膨胀阀前压力
|
/// 膨胀阀前压力
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ITag TxvFrPressTag { get; set; }
|
public ShortValueTag TxvFrPressTag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 过热度
|
/// 过热度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ITag Superheat { get; set; }
|
public ShortValueTag Superheat { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 过冷度
|
/// 过冷度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ITag Subcool { get; set; }
|
public ShortValueTag Subcool { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///// <summary>
|
///// <summary>
|
||||||
///// 过热度
|
///// 过热度
|
||||||
///// </summary>
|
///// </summary>
|
||||||
@@ -229,25 +256,25 @@ namespace CapMachine.Wpf.Services
|
|||||||
IRefProp64.WMOLdll(x, ref wm);
|
IRefProp64.WMOLdll(x, ref wm);
|
||||||
|
|
||||||
//p = Convert.ToDouble(textBox2.Text) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
//p = Convert.ToDouble(textBox2.Text) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
||||||
p = (InhPressTag.EngPvValue) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
p = (InhPressTag.PVModel.EngValue) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
||||||
kph = 1;
|
kph = 1;
|
||||||
|
|
||||||
p1 = (TxvFrPressTag.EngPvValue) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
p1 = (TxvFrPressTag.PVModel.EngValue) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
||||||
//p1 = Convert.ToDouble(textBox3.Text) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
//p1 = Convert.ToDouble(textBox3.Text) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
||||||
IRefProp64.SATPdll(ref p, x, ref kph, ref te, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
IRefProp64.SATPdll(ref p, x, ref kph, ref te, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
||||||
|
|
||||||
if (iErr == 0)
|
if (iErr == 0)
|
||||||
Superheat.EngPvValue = InhTempTag.EngPvValue - (te - 273.15);
|
Superheat.PVModel.EngValue = InhTempTag.PVModel.EngValue - (te - 273.15);
|
||||||
//textBox5.Text = String.Format("{0:n4}", Convert.ToDouble(textBox1.Text) - (te - 273.15));//textBox1 Comp.吸气温度(℃)
|
//textBox5.Text = String.Format("{0:n4}", Convert.ToDouble(textBox1.Text) - (te - 273.15));//textBox1 Comp.吸气温度(℃)
|
||||||
else
|
else
|
||||||
Superheat.EngPvValue = 0;
|
Superheat.PVModel.EngValue = 0;
|
||||||
IRefProp64.SATPdll(ref p1, x, ref kph, ref te1, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
IRefProp64.SATPdll(ref p1, x, ref kph, ref te1, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
||||||
if (iErr == 0)
|
if (iErr == 0)
|
||||||
Subcool.EngPvValue = TxvFrTempTag.EngPvValue - (te1 - 273.15);//textBox4 Evap.膨胀阀前温度(℃)
|
Subcool.PVModel.EngValue = TxvFrTempTag.PVModel.EngValue - (te1 - 273.15);//textBox4 Evap.膨胀阀前温度(℃)
|
||||||
//GuoLengDu = (te1 - 273.15) - ListKRLogCellValue.Find(a => a.Name == "膨胀阀前温度").Value;//textBox4 Evap.膨胀阀前温度(℃)
|
//GuoLengDu = (te1 - 273.15) - ListKRLogCellValue.Find(a => a.Name == "膨胀阀前温度").Value;//textBox4 Evap.膨胀阀前温度(℃)
|
||||||
//textBox6.Text = String.Format("{0:n4}", Convert.ToDouble(textBox4.Text) - (te1 - 273.15));//textBox4 Evap.膨胀阀前温度(℃)
|
//textBox6.Text = String.Format("{0:n4}", Convert.ToDouble(textBox4.Text) - (te1 - 273.15));//textBox4 Evap.膨胀阀前温度(℃)
|
||||||
else
|
else
|
||||||
Subcool.EngPvValue = 0;
|
Subcool.PVModel.EngValue = 0;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -328,12 +355,12 @@ namespace CapMachine.Wpf.Services
|
|||||||
|
|
||||||
//p = Convert.ToDouble(textBox2.Text) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
//p = Convert.ToDouble(textBox2.Text) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
||||||
//p = (ListRtKPMeter.Find(a => a.MeterName == "吸入压力").RtPV) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
//p = (ListRtKPMeter.Find(a => a.MeterName == "吸入压力").RtPV) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
||||||
p = (InhPressTag.EngPvValue) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
p = (InhPressTag.PVModel.EngValue) * 1000.0;//textBox2 Comp.吸气压力(Mpa)
|
||||||
kph = 1;
|
kph = 1;
|
||||||
|
|
||||||
//p1 = (ListKRLogCellValue.Find(a => a.Name == "膨胀阀前压力").Value) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
//p1 = (ListKRLogCellValue.Find(a => a.Name == "膨胀阀前压力").Value) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
||||||
p1 = (TxvFrPressTag.EngPvValue) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
p1 = (TxvFrPressTag.PVModel.EngValue) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
||||||
//p1 = Convert.ToDouble(textBox3.Text) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
//p1 = Convert.ToDouble(textBox3.Text) * 1000.0;//textBox3 Evap.膨胀阀前压力(Mpa)
|
||||||
|
|
||||||
|
|
||||||
IRefProp64.SATPdll(ref p, x, ref kph, ref te, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
IRefProp64.SATPdll(ref p, x, ref kph, ref te, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
||||||
@@ -341,20 +368,20 @@ namespace CapMachine.Wpf.Services
|
|||||||
if (iErr == 0)
|
if (iErr == 0)
|
||||||
|
|
||||||
//GuoReDu = ListRtKPMeter.Find(a => a.MeterName == "吸入温度").RtPV - (te - 273.15);
|
//GuoReDu = ListRtKPMeter.Find(a => a.MeterName == "吸入温度").RtPV - (te - 273.15);
|
||||||
Superheat.EngPvValue = InhTempTag.EngPvValue - (te - 273.15);
|
Superheat.PVModel.EngValue = InhTempTag.PVModel.EngValue - (te - 273.15);
|
||||||
//textBox5.Text = String.Format("{0:n4}", Convert.ToDouble(textBox1.Text) - (te - 273.15));//textBox1 Comp.吸气温度(℃)
|
//textBox5.Text = String.Format("{0:n4}", Convert.ToDouble(textBox1.Text) - (te - 273.15));//textBox1 Comp.吸气温度(℃)
|
||||||
else
|
else
|
||||||
Superheat.EngPvValue = 0;
|
Superheat.PVModel.EngValue = 0;
|
||||||
|
|
||||||
IRefProp64.SATPdll(ref p1, x, ref kph, ref te1, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
IRefProp64.SATPdll(ref p1, x, ref kph, ref te1, ref Dl, ref Dv, xliq, xvap, ref iErr, ref herr, ref herrLen);
|
||||||
if (iErr == 0)
|
if (iErr == 0)
|
||||||
//GuoLengDu = ListKRLogCellValue.Find(a => a.Name == "膨胀阀前温度").Value - (te1 - 273.15);//textBox4 Evap.膨胀阀前温度(℃)
|
//GuoLengDu = ListKRLogCellValue.Find(a => a.Name == "膨胀阀前温度").Value - (te1 - 273.15);//textBox4 Evap.膨胀阀前温度(℃)
|
||||||
Subcool.EngPvValue = TxvFrTempTag.EngPvValue - (te1 - 273.15);//textBox4 Evap.膨胀阀前温度(℃)
|
Subcool.PVModel.EngValue = TxvFrTempTag.PVModel.EngValue - (te1 - 273.15);//textBox4 Evap.膨胀阀前温度(℃)
|
||||||
|
|
||||||
//textBox6.Text = String.Format("{0:n4}", Convert.ToDouble(textBox4.Text) - (te1 - 273.15));//textBox4 Evap.膨胀阀前温度(℃)
|
//textBox6.Text = String.Format("{0:n4}", Convert.ToDouble(textBox4.Text) - (te1 - 273.15));//textBox4 Evap.膨胀阀前温度(℃)
|
||||||
|
|
||||||
else
|
else
|
||||||
Subcool.EngPvValue = 0;
|
Subcool.PVModel.EngValue = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
1103
CapMachine.Wpf/TagConfig/SysTags.json
Normal file
1103
CapMachine.Wpf/TagConfig/SysTags.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -84,7 +84,7 @@ namespace CapMachine.Wpf.ViewModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void LoadChartSourceData()
|
private void LoadChartSourceData()
|
||||||
{
|
{
|
||||||
foreach (var item in MachineRtDataService.TagManger.DicTags)
|
foreach (var item in MachineRtDataService.TagManger.DicTags.OrderBy(a => a.Value.Id))
|
||||||
{
|
{
|
||||||
ChartSrcDataListViewItems.Add(new ChartSrcData()
|
ChartSrcDataListViewItems.Add(new ChartSrcData()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace CapMachine.Wpf.ViewModels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void LoadChartSourceData()
|
private void LoadChartSourceData()
|
||||||
{
|
{
|
||||||
foreach (var item in MachineRtDataService.TagManger.DicTags)
|
foreach (var item in MachineRtDataService.TagManger.DicTags.OrderBy(a => a.Value.Id))
|
||||||
{
|
{
|
||||||
ChartSrcDataListViewItems.Add(new ChartSrcData()
|
ChartSrcDataListViewItems.Add(new ChartSrcData()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ namespace CapMachine.Wpf.ViewModels
|
|||||||
//赋值实例化
|
//赋值实例化
|
||||||
ListHandSwitchData = MachineRtDataService.ListHandSwitchData;
|
ListHandSwitchData = MachineRtDataService.ListHandSwitchData;
|
||||||
|
|
||||||
ListTag = new ObservableCollection<ITag>(TagManager.DicTags.Values.ToList());
|
ListTag = new ObservableCollection<ITag>(TagManager.DicTags.Values.OrderBy(a => a.Id).ToList());
|
||||||
ListMeterTag = TagManager.DicTags.Values.Where(a => a.IsMeter == true).ToList();
|
ListMeterTag = TagManager.DicTags.Values.OrderBy(a=>a.Id).Take(11).ToList();
|
||||||
|
|
||||||
SpeedTag = TagManager.DicTags.GetValueOrDefault("转速[rpm]");
|
SpeedTag = TagManager.DicTags.GetValueOrDefault("转速[rpm]");
|
||||||
ExPressTag = TagManager.DicTags.GetValueOrDefault("排气压力[BarA]");
|
ExPressTag = TagManager.DicTags.GetValueOrDefault("排气压力[BarA]");
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<Border>
|
<Border Width="220">
|
||||||
<Border.Style>
|
<Border.Style>
|
||||||
<Style BasedOn="{StaticResource BoardStyle}" TargetType="Border">
|
<Style BasedOn="{StaticResource BoardStyle}" TargetType="Border">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
@@ -143,34 +143,44 @@
|
|||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</Border.Style>
|
</Border.Style>
|
||||||
<StackPanel Style="{StaticResource StackPanelStyle}">
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Style="{StaticResource StackPanelStyle}">
|
||||||
|
<TextBlock
|
||||||
|
Margin="5,0,5,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontFamily="/Assets/Fonts/#iconfont"
|
||||||
|
FontSize="16"
|
||||||
|
Foreground="White"
|
||||||
|
Text="" />
|
||||||
|
<TextBlock
|
||||||
|
FontSize="16"
|
||||||
|
Foreground="White"
|
||||||
|
Text="PLC通信:" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="5,0"
|
||||||
|
FontSize="16"
|
||||||
|
Foreground="White"
|
||||||
|
Text="{Binding MachineRtDataService.LinkState, Converter={StaticResource BoolOkStrConvert}}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="2,0"
|
||||||
|
FontSize="16"
|
||||||
|
Foreground="White"
|
||||||
|
Text="|" />
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="5,0,5,0"
|
Grid.Column="1"
|
||||||
|
Margin="5,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontFamily="/Assets/Fonts/#iconfont"
|
|
||||||
FontSize="16"
|
|
||||||
Foreground="White"
|
|
||||||
Text="" />
|
|
||||||
<TextBlock
|
|
||||||
FontSize="16"
|
|
||||||
Foreground="White"
|
|
||||||
Text="PLC通信:" />
|
|
||||||
<TextBlock
|
|
||||||
Margin="5,0"
|
|
||||||
FontSize="16"
|
|
||||||
Foreground="White"
|
|
||||||
Text="{Binding MachineRtDataService.LinkState, Converter={StaticResource BoolOkStrConvert}}" />
|
|
||||||
<TextBlock
|
|
||||||
Margin="2,0"
|
|
||||||
FontSize="16"
|
|
||||||
Foreground="White"
|
|
||||||
Text="|" />
|
|
||||||
<TextBlock
|
|
||||||
Margin="5,0"
|
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
Foreground="White"
|
Foreground="White"
|
||||||
Text="{Binding ConfigService.PlcCycleTime}" />
|
Text="{Binding ConfigService.PlcCycleTime}" />
|
||||||
</StackPanel>
|
</Grid>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
<Border>
|
<Border>
|
||||||
<Border.Style>
|
<Border.Style>
|
||||||
|
|||||||
@@ -172,7 +172,7 @@
|
|||||||
HandValueSVParameter="{Binding EngSvValue}"
|
HandValueSVParameter="{Binding EngSvValue}"
|
||||||
IsEnabled="False"
|
IsEnabled="False"
|
||||||
MeterName="{Binding NameNoUnit}"
|
MeterName="{Binding NameNoUnit}"
|
||||||
PVValue="{Binding EngPvValue}"
|
PVValue="{Binding PVModel.EngValueStr}"
|
||||||
SVValue="{Binding EngSvValue}"
|
SVValue="{Binding EngSvValue}"
|
||||||
Unit="{Binding Unit}" />
|
Unit="{Binding Unit}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@@ -945,7 +945,7 @@
|
|||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
CellTitle="转速"
|
CellTitle="转速"
|
||||||
CellUnit="{Binding SpeedTag.Unit}"
|
CellUnit="{Binding SpeedTag.Unit}"
|
||||||
CellValue="{Binding SpeedTag.EngPvValueStr}" />
|
CellValue="{Binding SpeedTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="301"
|
Canvas.Left="301"
|
||||||
Canvas.Top="120"
|
Canvas.Top="120"
|
||||||
@@ -953,7 +953,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="电压"
|
CellTitle="电压"
|
||||||
CellUnit="{Binding ComCapBusVolTag.Unit}"
|
CellUnit="{Binding ComCapBusVolTag.Unit}"
|
||||||
CellValue="{Binding ComCapBusVolTag.EngPvValueStr}" />
|
CellValue="{Binding ComCapBusVolTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="301"
|
Canvas.Left="301"
|
||||||
Canvas.Top="170"
|
Canvas.Top="170"
|
||||||
@@ -961,7 +961,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="电流"
|
CellTitle="电流"
|
||||||
CellUnit="{Binding ComCapBusCurTag.Unit}"
|
CellUnit="{Binding ComCapBusCurTag.Unit}"
|
||||||
CellValue="{Binding ComCapBusCurTag.EngPvValueStr}" />
|
CellValue="{Binding ComCapBusCurTag.PVModel.EngValueStr}" />
|
||||||
<!-- CellUnit="{Binding ComCapPwTag.Unit}" -->
|
<!-- CellUnit="{Binding ComCapPwTag.Unit}" -->
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="301"
|
Canvas.Left="301"
|
||||||
@@ -970,7 +970,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="功率"
|
CellTitle="功率"
|
||||||
CellUnit="{Binding ComCapPwTag.Unit}"
|
CellUnit="{Binding ComCapPwTag.Unit}"
|
||||||
CellValue="{Binding ComCapPwTag.EngPvValueStr}" />
|
CellValue="{Binding ComCapPwTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="105"
|
Canvas.Left="105"
|
||||||
Canvas.Top="147"
|
Canvas.Top="147"
|
||||||
@@ -978,7 +978,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="排气口压力"
|
CellTitle="排气口压力"
|
||||||
CellUnit="{Binding ExPressTag.Unit}"
|
CellUnit="{Binding ExPressTag.Unit}"
|
||||||
CellValue="{Binding ExPressTag.EngPvValueStr}" />
|
CellValue="{Binding ExPressTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="106"
|
Canvas.Left="106"
|
||||||
Canvas.Top="193"
|
Canvas.Top="193"
|
||||||
@@ -986,7 +986,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="排气口温度"
|
CellTitle="排气口温度"
|
||||||
CellUnit="{Binding ExTempTag.Unit}"
|
CellUnit="{Binding ExTempTag.Unit}"
|
||||||
CellValue="{Binding ExTempTag.EngPvValueStr}" />
|
CellValue="{Binding ExTempTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="105"
|
Canvas.Left="105"
|
||||||
Canvas.Top="292"
|
Canvas.Top="292"
|
||||||
@@ -994,7 +994,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="吸气口压力"
|
CellTitle="吸气口压力"
|
||||||
CellUnit="{Binding InhPressTag.Unit}"
|
CellUnit="{Binding InhPressTag.Unit}"
|
||||||
CellValue="{Binding InhPressTag.EngPvValueStr}" />
|
CellValue="{Binding InhPressTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="106"
|
Canvas.Left="106"
|
||||||
Canvas.Top="338"
|
Canvas.Top="338"
|
||||||
@@ -1002,7 +1002,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="吸气口温度"
|
CellTitle="吸气口温度"
|
||||||
CellUnit="{Binding InhTempTag.Unit}"
|
CellUnit="{Binding InhTempTag.Unit}"
|
||||||
CellValue="{Binding InhTempTag.EngPvValueStr}" />
|
CellValue="{Binding InhTempTag.PVModel.EngValueStr}" />
|
||||||
<!--<Controls:ValueShow
|
<!--<Controls:ValueShow
|
||||||
Canvas.Left="551"
|
Canvas.Left="551"
|
||||||
Canvas.Top="272"
|
Canvas.Top="272"
|
||||||
@@ -1018,7 +1018,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="阀前温度"
|
CellTitle="阀前温度"
|
||||||
CellUnit="{Binding TxvFrTempTag.Unit}"
|
CellUnit="{Binding TxvFrTempTag.Unit}"
|
||||||
CellValue="{Binding TxvFrTempTag.EngPvValueStr}" />
|
CellValue="{Binding TxvFrTempTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="1003"
|
Canvas.Left="1003"
|
||||||
Canvas.Top="239"
|
Canvas.Top="239"
|
||||||
@@ -1026,7 +1026,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
CellTitle="阀前压力"
|
CellTitle="阀前压力"
|
||||||
CellUnit="{Binding TxvFrPressTag.Unit}"
|
CellUnit="{Binding TxvFrPressTag.Unit}"
|
||||||
CellValue="{Binding TxvFrPressTag.EngPvValueStr}" />
|
CellValue="{Binding TxvFrPressTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="635"
|
Canvas.Left="635"
|
||||||
Canvas.Top="420"
|
Canvas.Top="420"
|
||||||
@@ -1034,7 +1034,7 @@
|
|||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
CellTitle="吸气混合器温度"
|
CellTitle="吸气混合器温度"
|
||||||
CellUnit="{Binding OS2TempTag.Unit}"
|
CellUnit="{Binding OS2TempTag.Unit}"
|
||||||
CellValue="{Binding OS2TempTag.EngPvValueStr}" />
|
CellValue="{Binding OS2TempTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="1076"
|
Canvas.Left="1076"
|
||||||
Canvas.Top="360"
|
Canvas.Top="360"
|
||||||
@@ -1042,7 +1042,7 @@
|
|||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
CellTitle="冷凝器进水温"
|
CellTitle="冷凝器进水温"
|
||||||
CellUnit="{Binding CondInTempTag.Unit}"
|
CellUnit="{Binding CondInTempTag.Unit}"
|
||||||
CellValue="{Binding CondInTempTag.EngPvValueStr}" />
|
CellValue="{Binding CondInTempTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="1194"
|
Canvas.Left="1194"
|
||||||
Canvas.Top="360"
|
Canvas.Top="360"
|
||||||
@@ -1050,7 +1050,7 @@
|
|||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
CellTitle="冷凝器出水温"
|
CellTitle="冷凝器出水温"
|
||||||
CellUnit="{Binding Cond1TempTag.Unit}"
|
CellUnit="{Binding Cond1TempTag.Unit}"
|
||||||
CellValue="{Binding Cond1TempTag.EngPvValueStr}" />
|
CellValue="{Binding Cond1TempTag.PVModel.EngValueStr}" />
|
||||||
<Controls:ValueShow
|
<Controls:ValueShow
|
||||||
Canvas.Left="1217"
|
Canvas.Left="1217"
|
||||||
Canvas.Top="136"
|
Canvas.Top="136"
|
||||||
@@ -1105,11 +1105,11 @@
|
|||||||
Margin="0,2,2,2"
|
Margin="0,2,2,2"
|
||||||
BorderBrush="Gray"
|
BorderBrush="Gray"
|
||||||
BorderThickness="2">
|
BorderThickness="2">
|
||||||
<ListView FontSize="16" ItemsSource="{Binding ListTag}">
|
<ListView FontSize="14" ItemsSource="{Binding ListTag}">
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||||
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="名称" />
|
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="名称" />
|
||||||
<GridViewColumn DisplayMemberBinding="{Binding EngPvValueStr}" Header="实时值" />
|
<GridViewColumn DisplayMemberBinding="{Binding PVModel.EngValueStr}" Header="实时值" />
|
||||||
<!-- DisplayMemberBinding="{Binding EngPvValue, Converter={StaticResource ValuePrecisionConverter}, ConverterParameter={Binding Path=DecimalPoint}}" -->
|
<!-- DisplayMemberBinding="{Binding EngPvValue, Converter={StaticResource ValuePrecisionConverter}, ConverterParameter={Binding Path=DecimalPoint}}" -->
|
||||||
<!--<GridViewColumn Header="实时值">
|
<!--<GridViewColumn Header="实时值">
|
||||||
<GridViewColumn.DisplayMemberBinding>
|
<GridViewColumn.DisplayMemberBinding>
|
||||||
@@ -1124,7 +1124,8 @@
|
|||||||
<ListView.ItemContainerStyle>
|
<ListView.ItemContainerStyle>
|
||||||
<Style TargetType="ListViewItem">
|
<Style TargetType="ListViewItem">
|
||||||
<!--<Setter Property="Background" Value="Transparent" />-->
|
<!--<Setter Property="Background" Value="Transparent" />-->
|
||||||
<Setter Property="Height" Value="20" />
|
<Setter Property="Height" Value="15.5" />
|
||||||
|
<Setter Property="FontSize" Value="12" />
|
||||||
</Style>
|
</Style>
|
||||||
</ListView.ItemContainerStyle>
|
</ListView.ItemContainerStyle>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|||||||
Reference in New Issue
Block a user