1243 lines
58 KiB
C#
1243 lines
58 KiB
C#
using AutoMapper.Internal;
|
|
using CapMachine.Core;
|
|
using CapMachine.Wpf.Dtos;
|
|
using CapMachine.Wpf.Models;
|
|
using CapMachine.Wpf.Models.Tag;
|
|
using CapMachine.Wpf.PrismEvent;
|
|
using HslCommunication;
|
|
using HslCommunication.Profinet.Siemens;
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
using NPOI.HSSF.Record.Chart;
|
|
using NPOI.SS.Formula.Atp;
|
|
using Prism.Events;
|
|
using Prism.Mvvm;
|
|
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Timers;
|
|
using System.Windows;
|
|
using static CapMachine.Wpf.Models.ComEnum;
|
|
|
|
namespace CapMachine.Wpf.Services
|
|
{
|
|
/// <summary>
|
|
/// 机器实时数据服务
|
|
/// </summary>
|
|
public class MachineRtDataService : BindableBase
|
|
{
|
|
/// <summary>
|
|
/// 事件聚合器
|
|
/// </summary>
|
|
private IEventAggregator _EventAggregator { get; set; }
|
|
public AlarmService AlarmService { get; }
|
|
|
|
/// <summary>
|
|
/// PLCScanTask扫描Task
|
|
/// </summary>
|
|
private static Task PLCScanTask { get; set; }
|
|
|
|
/// <summary>
|
|
/// ScanTask扫描Task
|
|
/// </summary>
|
|
private static Task ScanTask { get; set; }
|
|
|
|
/// <summary>
|
|
/// 西门子连接驱动程序
|
|
/// </summary>
|
|
public SiemensS7Net SiemensDrive { get; set; }
|
|
|
|
private bool _LinkState;
|
|
/// <summary>
|
|
/// PLC连接状态
|
|
/// </summary>
|
|
public bool LinkState
|
|
{
|
|
get { return _LinkState; }
|
|
set { _LinkState = value; RaisePropertyChanged(); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 周期定时器
|
|
/// </summary>
|
|
private System.Timers.Timer CycleTimer { get; set; }
|
|
|
|
/// <summary>
|
|
/// 界面更新数据
|
|
/// </summary>
|
|
private bool IsValueShow { get; set; } = true;
|
|
|
|
///// <summary>
|
|
///// 仪表数据集合
|
|
///// </summary>
|
|
//public List<MeterRtDataModel> ListMeterRtData { get; set; }
|
|
|
|
///// <summary>
|
|
///// Tag数据集合
|
|
///// </summary>
|
|
//public List<TagInfo> ListRtDataModel { get; set; }
|
|
|
|
/// <summary>
|
|
/// 标签管理中心
|
|
/// </summary>
|
|
public TagManager TagManger { get; set; } = new TagManager();
|
|
|
|
/// <summary>
|
|
/// 扫描线程使能
|
|
/// </summary>
|
|
public bool ThreadEnable { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 历史数据
|
|
/// </summary>
|
|
public List<RecordInfo> HistoryData { get; set; } = new List<RecordInfo>();
|
|
|
|
/// <summary>
|
|
/// 手自动切换的条件
|
|
/// </summary>
|
|
public AutoHandSwtichCondition AutoHandSwtichConditionState { get; set; } = new AutoHandSwtichCondition();
|
|
|
|
/// <summary>
|
|
/// 实例化函数
|
|
/// </summary>
|
|
/// <param name="eventAggregator"></param>
|
|
public MachineRtDataService(IEventAggregator eventAggregator, AlarmService alarmService)//, AlarmService alarmService
|
|
{
|
|
//ConcurrentDictionary<DateTime, RecordInfo> keyValuePairs = new ConcurrentDictionary<DateTime, RecordInfo>();
|
|
|
|
//Stopwatch stopwatch = new Stopwatch();
|
|
////第一次计时
|
|
//stopwatch.Start(); //启动Stopwatch
|
|
|
|
//stopwatch.Stop(); //停止Stopwatch
|
|
//Console.WriteLine("Add Elapsed output runTime:{0}", stopwatch.Elapsed.ToString());
|
|
|
|
//事件服务
|
|
_EventAggregator = eventAggregator;
|
|
AlarmService = alarmService;
|
|
|
|
//秒触发一次
|
|
CycleTimer = new System.Timers.Timer(500);
|
|
CycleTimer.Elapsed += RecoredCycleAction;
|
|
CycleTimer.AutoReset = true;
|
|
CycleTimer.Enabled = true;
|
|
|
|
|
|
#region 标签管理
|
|
|
|
//【测试】
|
|
//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 });
|
|
//TagManger.AddTag(new Tag<short>("COND1温度", "COND1温度[℃]", "Cond1Temp", "程序", "VW15008", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("润滑油压力", "润滑油压力[BarA]", "LubePress", "程序", "VW15010", 100, 0, 100, "BarA", new ShortTagValue(), true) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("COND2压力", "COND2压力[BarA]", "Cond2Press", "程序", "VW15012", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("OCR", "OCR[%]", "OCR", "程序", "VW15014", 100, 0, 10, "%", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("HV[V]", "HV[V]", "HV", "程序", "VW15016", 100, 0, 10, "V", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("HV[A]", "HV[A]", "HVCur", "程序", "VW15018", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("HV[W]", "HV[W]", "HVPw", "程序", "VW15020", 100, 0, 1, "W", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("LV[V]", "LV[V]", "LV", "程序", "VW15022", 100, 0, 10, "V", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
////TagManger.AddTag(new Tag<short>("LV[A]", "LV[A]", "LVCur", "程序", "VW15024", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("LV[A]", "LV[A]", "LVCur", "程序", "VW15024", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("环境温度", "环境温度[℃]", "EnvTemp", "程序", "VW15026", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
////TagManger.AddTag(new Tag<short>("环境湿度", "环境湿度[%]", "EnvRH", "程序", "VW15028", 100, 0, 10, "%", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("环境湿度", "环境湿度[%]", "EnvRH", "程序", "VW15028", 100, 0, 1, "%", new ShortTagValue(), true) { DecimalPoint = 0 });
|
|
//TagManger.AddTag(new Tag<short>("OS1温度", "OS1温度[℃]", "OS1Temp", "程序", "VW15030", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("OS2温度", "OS2温度[℃]", "OS2Temp", "程序", "VW15032", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("COND2温度", "COND2温度[℃]", "Cond2Temp", "程序", "VW15034", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("EVAP出口温度", "EVAP出口温度[℃]", "EVAPExpTemp", "程序", "VW15036", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
////TagManger.AddTag(new Tag<short>("冷媒流量", "冷媒流量[L/min]", "VRV", "程序", "VW15038", 100, 0, 1, "L/min", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("冷媒流量", "冷媒流量[L/min]", "VRV", "程序", "VW15038", 100, 0, 10, "L/min", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("润滑油流量", "润滑油流量[L/min]", "LubeFlow", "程序", "VW15040", 100, 0, 1, "L/min", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("排气温度", "排气温度[℃]", "ExTemp", "程序", "VW15042", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("膨胀阀前压力", "膨胀阀前压力[BarA]", "TxvFrPress", "程序", "VW15044", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("膨胀阀前温度", "膨胀阀前温度[℃]", "TxvFrTemp", "程序", "VW15046", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("EVAP出口压力", "EVAP出口压力[BarA]", "EVAPExpPress", "程序", "VW15048", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("腔内压力", "腔内压力[BarA]", "IntrplPress", "程序", "VW15050", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("压缩机表面温度", "压缩机表面温度[℃]", "CapSurfTemp", "程序", "VW15052", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("PTC流量", "PTC流量[L/min]", "PTCFlow", "程序", "VW15054", 100, 0, 1, "L/min", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("PTC入水温度", "PTC入水温度[℃]", "PTCEntTemp", "程序", "VW15056", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("PTC出水温度", "PTC出水温度[℃]", "PTCExpTemp", "程序", "VW15058", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp母线电流", "通讯Cmp母线电流[A]", "ComCapBusCur", "程序", "VW15060", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp母线电压", "通讯Cmp母线电压[V]", "ComCapBusVol", "程序", "VW15062", 100, 0, 10, "V", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp逆变器温度", "通讯Cmp逆变器温度[℃]", "ComCapInvTemp", "程序", "VW15064", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp相电流", "通讯Cmp相电流[A]", "ComCapPhCur", "程序", "VW15066", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp功率", "通讯Cmp功率[W]", "ComCapPw", "程序", "VW15068", 100, 0, 1, "W", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp芯片温度", "通讯Cmp芯片温度[℃]", "ComCapChipTemp", "程序", "VW15070", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC入水温度", "通讯PTC入水温度[℃]", "ComPTCEntTemp", "程序", "VW15072", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC出水温度", "通讯PTC出水温度[℃]", "ComPTCExpTemp", "程序", "VW15074", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC峰值电流", "通讯PTC峰值电流[A]", "ComPTCPeakCur", "程序", "VW15076", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC母线电流", "通讯PTC母线电流[A]", "ComPTCBusCur", "程序", "VW15078", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC膜温", "通讯PTC膜温[℃]", "ComPTCFlmTemp", "程序", "VW15080", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC模块温度", "通讯PTC模块温度[℃]", "ComPTCMdTemp", "程序", "VW15082", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
|
|
//【SongZhi】
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "转速[rpm]",//名称带单位
|
|
NameNoUnit = "转速",//无单位名称
|
|
EnName = "Speed",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "rpm",
|
|
PVAddress = "VW100",//地址信息
|
|
SVAddress = "VW200",
|
|
MVAddress = "VW242",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "VW240",
|
|
Precision = 1,
|
|
DecimalPoint = 0,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "排气压力[MpaA]",//名称带单位
|
|
NameNoUnit = "排气压力",//无单位名称
|
|
EnName = "ExPress",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "MpaA",
|
|
PVAddress = "VW102",//地址信息
|
|
SVAddress = "VW202",
|
|
MVAddress = "VW242",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "VW240",
|
|
Precision = 1000,
|
|
DecimalPoint = 3,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "吸气压力[MpaA]",//名称带单位
|
|
NameNoUnit = "吸气压力",//无单位名称
|
|
EnName = "InhPress",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "MpaA",
|
|
PVAddress = "VW104",//地址信息
|
|
SVAddress = "VW204",
|
|
MVAddress = "VW246",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "VW244",
|
|
Precision = 1000,
|
|
DecimalPoint = 3,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "吸气温度[℃]",//名称带单位
|
|
NameNoUnit = "吸气温度",//无单位名称
|
|
EnName = "InhTemp",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW106",//地址信息
|
|
SVAddress = "VW206",
|
|
MVAddress = "VW250",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "VW248",
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "冷凝器出口水温[℃]",//名称带单位 COND1水温
|
|
NameNoUnit = "冷凝器出口水温",//无单位名称
|
|
EnName = "Cond1Temp",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW108",//地址信息
|
|
SVAddress = "VW208",
|
|
MVAddress = "VW254",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "VW252",
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "吸气混合器温度[℃]",//名称带单位 OS2温度
|
|
NameNoUnit = "吸气混合器温度",//无单位名称 OS2温度
|
|
EnName = "OS2Temp",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW110",//地址信息
|
|
SVAddress = "VW210",
|
|
MVAddress = "VW258",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "VW256",
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "HV_V[V]",//名称带单位
|
|
NameNoUnit = "HV_V",//无单位名称
|
|
EnName = "HV_V",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "V",
|
|
PVAddress = "VW112",//地址信息
|
|
SVAddress = "VW212",
|
|
MVAddress = "VW262",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "VW260",
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "HV_A[A]",//名称带单位
|
|
NameNoUnit = "HV_A",//无单位名称
|
|
EnName = "HV_A",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "A",
|
|
PVAddress = "VW114",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 100,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "HV_W[W]",//名称带单位
|
|
NameNoUnit = "HV_W",//无单位名称
|
|
EnName = "HV_W",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "W",
|
|
PVAddress = "VW116",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 1,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "LV_V[V]",//名称带单位
|
|
NameNoUnit = "LV_V",//无单位名称
|
|
EnName = "LV_V",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "V",
|
|
PVAddress = "VW118",//地址信息
|
|
SVAddress = "VW214",
|
|
MVAddress = "",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "",
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "LV_A[A]",//名称带单位
|
|
NameNoUnit = "LV_A",//无单位名称
|
|
EnName = "LV_A",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "A",
|
|
PVAddress = "VW120",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 100,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "试验箱温度[℃]",//名称带单位
|
|
NameNoUnit = "试验箱温度",//无单位名称
|
|
EnName = "EnvTemp",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW122",//地址信息
|
|
SVAddress = "VW216",
|
|
MVAddress = "",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "",
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "试验箱湿度[℃]",//名称带单位
|
|
NameNoUnit = "试验箱湿度",//无单位名称
|
|
EnName = "EnvRH",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "%",
|
|
PVAddress = "VW124",//地址信息
|
|
SVAddress = "VW218",
|
|
MVAddress = "",
|
|
IsMeter = true,
|
|
AutoHandSwitchAddress = "",
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "排气温度[℃]",//名称带单位
|
|
NameNoUnit = "排气温度",//无单位名称
|
|
EnName = "ExTemp",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW126",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "膨胀阀前温度[℃]",//名称带单位
|
|
NameNoUnit = "膨胀阀前温度",//无单位名称
|
|
EnName = "TxvFrTemp",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW128",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "膨胀阀前压力[MpaA]",//名称带单位
|
|
NameNoUnit = "膨胀阀前压力",//无单位名称
|
|
EnName = "TxvFrPress",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "MpaA",
|
|
PVAddress = "VW130",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 1000,
|
|
DecimalPoint = 3,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "冷凝器进口温度[℃]",//名称带单位
|
|
NameNoUnit = "冷凝器进口温度",//无单位名称
|
|
EnName = "CondInTemp",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW132",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "冷凝器进口压力[MpaA]",//名称带单位
|
|
NameNoUnit = "冷凝器进口压力",//无单位名称
|
|
EnName = "CondInPress",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "MpaA",
|
|
PVAddress = "VW134",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 1000,
|
|
DecimalPoint = 3,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "水箱进水温度[℃]",//名称带单位
|
|
NameNoUnit = "水箱进水温度",//无单位名称
|
|
EnName = "WaterTankInTemp",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
Unit = "℃",
|
|
MaxValue = 100,
|
|
PVAddress = "VW136",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "水加热温度H1[℃]",//名称带单位
|
|
NameNoUnit = "水加热温度H1",//无单位名称
|
|
EnName = "WaterHeatTempH1",//英文名称
|
|
Group = "程序",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW138",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "压缩机表面温度1[℃]",//名称带单位
|
|
NameNoUnit = "压缩机表面温度1",//无单位名称
|
|
EnName = "CapSurfTemp1",//英文名称
|
|
Group = "CAN",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW140",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "压缩机表面温度2[℃]",//名称带单位
|
|
NameNoUnit = "压缩机表面温度2",//无单位名称
|
|
EnName = "CapSurfTemp2",//英文名称
|
|
Group = "CAN",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW142",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "压缩机表面温度3[℃]",//名称带单位
|
|
NameNoUnit = "压缩机表面温度3",//无单位名称
|
|
EnName = "CapSurfTemp3",//英文名称
|
|
Group = "CAN",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW144",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "通讯母线电压[V]",//名称带单位
|
|
NameNoUnit = "通讯母线电压",//无单位名称
|
|
EnName = "ComCapBusVol",//英文名称
|
|
Group = "CAN",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "V",
|
|
PVAddress = "VW146",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "通讯母线电流[A]",//名称带单位
|
|
NameNoUnit = "通讯母线电流",//无单位名称
|
|
EnName = "ComCapBusCur",//英文名称
|
|
Group = "CAN",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "A",
|
|
PVAddress = "VW148",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 100,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "通讯相电流[A]",//名称带单位
|
|
NameNoUnit = "通讯相电流",//无单位名称
|
|
EnName = "ComCapPhCur",//英文名称
|
|
Group = "CAN",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "A",
|
|
PVAddress = "VW150",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 100,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "通讯功率[W]",//名称带单位
|
|
NameNoUnit = "通讯功率",//无单位名称
|
|
EnName = "ComCapPw",//英文名称
|
|
Group = "CAN",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "W",
|
|
PVAddress = "VW152",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 1,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "通讯芯片温度[℃]",//名称带单位
|
|
NameNoUnit = "通讯芯片温度",//无单位名称
|
|
EnName = "ComCapChipTemp",//英文名称
|
|
Group = "CAN",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "℃",
|
|
PVAddress = "VW154",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "过冷度[K]",//名称带单位
|
|
NameNoUnit = "过冷度",//无单位名称
|
|
EnName = "Subcooling",//英文名称
|
|
Group = "计算",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "K",
|
|
PVAddress = "",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
TagManger.AddTag(new Tag<short>(new ShortTagValue())
|
|
{
|
|
Name = "过热度[K]",//名称带单位
|
|
NameNoUnit = "过热度",//无单位名称
|
|
EnName = "Superheat",//英文名称
|
|
Group = "计算",//分组
|
|
MinValue = 0,
|
|
MaxValue = 100,
|
|
Unit = "K",
|
|
PVAddress = "",//地址信息
|
|
SVAddress = "",
|
|
MVAddress = "",
|
|
IsMeter = false,
|
|
Precision = 10,
|
|
DecimalPoint = 1,
|
|
Samp = 1,
|
|
ValueType = typeof(short),
|
|
Index = "",
|
|
});
|
|
|
|
//TagManger.AddTag(new Tag<short>("OCR", "OCR[%]", "OCR", "程序", "VW15014", 100, 0, 10, "%", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("HV[V]", "HV[V]", "HV", "程序", "VW15016", 100, 0, 10, "V", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("HV[A]", "HV[A]", "HVCur", "程序", "VW15018", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("HV[W]", "HV[W]", "HVPw", "程序", "VW15020", 100, 0, 1, "W", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("LV[V]", "LV[V]", "LV", "程序", "VW15022", 100, 0, 10, "V", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
////TagManger.AddTag(new Tag<short>("LV[A]", "LV[A]", "LVCur", "程序", "VW15024", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("LV[A]", "LV[A]", "LVCur", "程序", "VW15024", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("环境温度", "环境温度[℃]", "EnvTemp", "程序", "VW15026", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
////TagManger.AddTag(new Tag<short>("环境湿度", "环境湿度[%]", "EnvRH", "程序", "VW15028", 100, 0, 10, "%", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("环境湿度", "环境湿度[%]", "EnvRH", "程序", "VW15028", 100, 0, 1, "%", new ShortTagValue(), true) { DecimalPoint = 0 });
|
|
//TagManger.AddTag(new Tag<short>("OS1温度", "OS1温度[℃]", "OS1Temp", "程序", "VW15030", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("OS2温度", "OS2温度[℃]", "OS2Temp", "程序", "VW15032", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("COND2温度", "COND2温度[℃]", "Cond2Temp", "程序", "VW15034", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("EVAP出口温度", "EVAP出口温度[℃]", "EVAPExpTemp", "程序", "VW15036", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
////TagManger.AddTag(new Tag<short>("冷媒流量", "冷媒流量[L/min]", "VRV", "程序", "VW15038", 100, 0, 1, "L/min", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("冷媒流量", "冷媒流量[L/min]", "VRV", "程序", "VW15038", 100, 0, 10, "L/min", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("润滑油流量", "润滑油流量[L/min]", "LubeFlow", "程序", "VW15040", 100, 0, 1, "L/min", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("排气温度", "排气温度[℃]", "ExTemp", "程序", "VW15042", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("膨胀阀前压力", "膨胀阀前压力[BarA]", "TxvFrPress", "程序", "VW15044", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("膨胀阀前温度", "膨胀阀前温度[℃]", "TxvFrTemp", "程序", "VW15046", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("EVAP出口压力", "EVAP出口压力[BarA]", "EVAPExpPress", "程序", "VW15048", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("腔内压力", "腔内压力[BarA]", "IntrplPress", "程序", "VW15050", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2 });
|
|
//TagManger.AddTag(new Tag<short>("压缩机表面温度", "压缩机表面温度[℃]", "CapSurfTemp", "程序", "VW15052", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("PTC流量", "PTC流量[L/min]", "PTCFlow", "程序", "VW15054", 100, 0, 1, "L/min", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("PTC入水温度", "PTC入水温度[℃]", "PTCEntTemp", "程序", "VW15056", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("PTC出水温度", "PTC出水温度[℃]", "PTCExpTemp", "程序", "VW15058", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp母线电流", "通讯Cmp母线电流[A]", "ComCapBusCur", "程序", "VW15060", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp母线电压", "通讯Cmp母线电压[V]", "ComCapBusVol", "程序", "VW15062", 100, 0, 10, "V", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp逆变器温度", "通讯Cmp逆变器温度[℃]", "ComCapInvTemp", "程序", "VW15064", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp相电流", "通讯Cmp相电流[A]", "ComCapPhCur", "程序", "VW15066", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp功率", "通讯Cmp功率[W]", "ComCapPw", "程序", "VW15068", 100, 0, 1, "W", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯Cmp芯片温度", "通讯Cmp芯片温度[℃]", "ComCapChipTemp", "程序", "VW15070", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC入水温度", "通讯PTC入水温度[℃]", "ComPTCEntTemp", "程序", "VW15072", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC出水温度", "通讯PTC出水温度[℃]", "ComPTCExpTemp", "程序", "VW15074", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC峰值电流", "通讯PTC峰值电流[A]", "ComPTCPeakCur", "程序", "VW15076", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC母线电流", "通讯PTC母线电流[A]", "ComPTCBusCur", "程序", "VW15078", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC膜温", "通讯PTC膜温[℃]", "ComPTCFlmTemp", "程序", "VW15080", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
//TagManger.AddTag(new Tag<short>("通讯PTC模块温度", "通讯PTC模块温度[℃]", "ComPTCMdTemp", "程序", "VW15082", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
ListHandSwitchData = new List<HandSwitchData>()
|
|
{
|
|
new HandSwitchData(){Name="自动",ActionAddress="M0.0",StateAddress="M0.0" },
|
|
new HandSwitchData(){Name="抽真空",ActionAddress="M0.1",StateAddress="M0.1" },
|
|
new HandSwitchData(){Name="复位",ActionAddress="M0.2",StateAddress="M0.2" },
|
|
new HandSwitchData(){Name="消音",ActionAddress="M0.3",StateAddress="M0.3" },
|
|
new HandSwitchData(){Name="HV电源",ActionAddress="M1.1",StateAddress="Q0.1" },
|
|
new HandSwitchData(){Name="HV启动",ActionAddress="M1.2",StateAddress="Q0.6" },
|
|
new HandSwitchData(){Name="LV电源",ActionAddress="M1.3",StateAddress="Q0.2" },
|
|
new HandSwitchData(){Name="水泵",ActionAddress="M1.4",StateAddress="Q0.3" },
|
|
new HandSwitchData(){Name="冷凝器电加热",ActionAddress="M1.5",StateAddress="Q0.4" },
|
|
new HandSwitchData(){Name="吸气混合器电加热",ActionAddress="M1.6",StateAddress="Q0.5" },
|
|
new HandSwitchData(){Name="吸排气球阀",ActionAddress="M1.7",StateAddress="Q0.7" },
|
|
new HandSwitchData(){Name="试验箱",ActionAddress="M2.0",StateAddress="V15.0" },
|
|
new HandSwitchData(){Name="水SEV1",ActionAddress="M2.1",StateAddress="Q1.0" },
|
|
new HandSwitchData(){Name="水SEV2",ActionAddress="M2.2",StateAddress="Q1.1" },
|
|
new HandSwitchData(){Name="HCV1",ActionAddress="M2.3",StateAddress="Q1.2" },
|
|
new HandSwitchData(){Name="HCV2",ActionAddress="M2.4",StateAddress="Q1.3" },
|
|
new HandSwitchData(){Name="ECV1",ActionAddress="M2.5",StateAddress="Q1.4" },
|
|
new HandSwitchData(){Name="ECV2",ActionAddress="M2.6",StateAddress="Q1.5" },
|
|
new HandSwitchData(){Name="使能",ActionAddress="M2.7",StateAddress="V15.1" },
|
|
};
|
|
|
|
//TagManger.ListTag[0].Name = "new TestType() { byteValue=12}";
|
|
//TagManger.ListTag[0].Name = "new TestType() { byteValue=12}";
|
|
|
|
//Type genericType = typeof(Tag<>).MakeGenericType(typeof(short));
|
|
//Activator.CreateInstance(genericType, 42);
|
|
|
|
//var DATA = TagManger.GetTagValueByName<short>("转速");
|
|
//var data1 = TagManger.GetTagByName<short>("转速");
|
|
|
|
//var data2 = TagManger.GetTagByName<short>("转速5888");
|
|
|
|
//data1.TagValue.Value = 12;
|
|
|
|
//TagInfo = data1;
|
|
|
|
//var TagInfo1= data1.RtValue.Value;
|
|
|
|
//var Data = DATA.Value;
|
|
|
|
//dynamic dad=10;
|
|
|
|
|
|
InitialPLCCom();
|
|
|
|
PubRtDataStart();
|
|
}
|
|
|
|
|
|
#region 手自动的操作
|
|
|
|
//// <summary>
|
|
///// 手自动切换集合数据
|
|
///// </summary>
|
|
public List<HandSwitchData> ListHandSwitchData { get; set; }
|
|
|
|
/// <summary>
|
|
/// 程序复位
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool SysReset()
|
|
{
|
|
var FindData = ListHandSwitchData.Where(a => a.Name == "复位");
|
|
if (FindData.Count() > 0)
|
|
{
|
|
var Result = SiemensDrive.Write(FindData.First().ActionAddress, true);
|
|
if (Result.IsSuccess)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 程序消音
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool SysMute()
|
|
{
|
|
var FindData = ListHandSwitchData.Where(a => a.Name == "消音");
|
|
if (FindData.Count() > 0)
|
|
{
|
|
var Result = SiemensDrive.Write(FindData.First().ActionAddress, true);
|
|
if (Result.IsSuccess)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 程序Start
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool SysStart()
|
|
{
|
|
var Result = SiemensDrive.Write("M0.4", true);
|
|
if (Result.IsSuccess)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 程序结束
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool SysEnd()
|
|
{
|
|
var Result = SiemensDrive.Write("M0.7", true);
|
|
if (Result.IsSuccess)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 程序暂停
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool SysPause()
|
|
{
|
|
var Result = SiemensDrive.Write("M0.6", true);
|
|
if (Result.IsSuccess)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// UI更新
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
private void RecoredCycleAction(object? sender, ElapsedEventArgs e)
|
|
{
|
|
//IsValueShow = !IsValueShow;
|
|
}
|
|
|
|
private Tag<short> _TagInfo;
|
|
|
|
public Tag<short> TagInfo
|
|
{
|
|
get { return _TagInfo; }
|
|
set { _TagInfo = value; RaisePropertyChanged(); }
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 初始化PLC通信
|
|
/// </summary>
|
|
private void InitialPLCCom()
|
|
{
|
|
var IPInfo = ConfigHelper.GetValue("PLCIP");
|
|
|
|
SiemensDrive = new SiemensS7Net(SiemensPLCS.S200Smart, IPInfo);
|
|
// 连接对象
|
|
OperateResult connect = SiemensDrive.ConnectServer();
|
|
if (!connect.IsSuccess)//连接失败
|
|
{
|
|
LinkState = false;
|
|
Console.WriteLine("connect failed:" + connect.Message);
|
|
MessageBox.Show($"PLC连接失败:{IPInfo}");
|
|
//return;
|
|
}
|
|
else//连接成功
|
|
{
|
|
LinkState = true;
|
|
}
|
|
|
|
//扫描线程成功
|
|
RtScanDeviceStart();
|
|
|
|
}
|
|
|
|
public const string ConstShortType = "Int16";
|
|
public const string ConstUShortType = "UInt16";
|
|
|
|
public const string ConstIntType = "Int32";
|
|
public const string ConstUIntType = "UInt32";
|
|
|
|
public const string ConstLongType = "Int64";
|
|
public const string ConstULongType = "UInt64";
|
|
|
|
public const string ConstByteType = "Byte";
|
|
|
|
public const string ConstCharType = "Char";
|
|
|
|
public const string ConstFloatType = "Single";
|
|
|
|
public const string ConstDoubleType = "Double";
|
|
|
|
public const string ConstDecimalType = "Decimal";
|
|
|
|
public const string ConstBoolType = "Boolean";
|
|
|
|
//private Random random = new Random();
|
|
|
|
private int IsShowCount = 0;
|
|
|
|
private OperateResult<short> OperateResultShort { get; set; }
|
|
|
|
/// <summary>
|
|
/// SV数据
|
|
/// </summary>
|
|
private OperateResult<short> OperateResultSVShort { get; set; }
|
|
|
|
/// <summary>
|
|
/// MV数据
|
|
/// </summary>
|
|
private OperateResult<short> OperateResultMVShort { get; set; }
|
|
|
|
private Random Random { get; set; } = new Random();
|
|
|
|
/// <summary>
|
|
/// 报警结果集合
|
|
/// </summary>
|
|
private OperateResult<bool[]> OperateResultAlarm { get; set; }
|
|
|
|
/// <summary>
|
|
/// PLC扫描线程
|
|
/// </summary>
|
|
private void RtScanDeviceStart()
|
|
{
|
|
PLCScanTask = Task.Run(async () =>
|
|
{
|
|
Stopwatch stopwatch = new Stopwatch();
|
|
|
|
while (ThreadEnable)
|
|
{
|
|
await Task.Delay(10);
|
|
|
|
//DiagnosticsTime.Reset();
|
|
//DiagnosticsTime.Start();
|
|
try
|
|
{
|
|
//TagInfo.RtValue.Value++;
|
|
|
|
//var data = TagManger.DicTags["转速"].ValueType.Name;
|
|
|
|
////第一次计时
|
|
//stopwatch.Start(); //启动Stopwatch
|
|
//IsShowCount++;
|
|
//IsValueShow = false;
|
|
//if (IsShowCount >= 20)
|
|
//{
|
|
// IsShowCount = 0;
|
|
// IsValueShow = true;
|
|
//}
|
|
foreach (var itemTag in TagManger.DicTags)
|
|
{
|
|
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)random.Next(0, 100);
|
|
|
|
//if (itemTag.Key== "转速[rpm]")
|
|
//{
|
|
// var DS= SiemensDrive.ReadInt16(itemTag.Value.Address);
|
|
// if (DS.IsSuccess)
|
|
// {
|
|
// var dd= DS.Content;
|
|
// }
|
|
//}
|
|
|
|
switch (itemTag.Value.ValueType.Name)
|
|
{
|
|
//case ConstShortType:
|
|
// //TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = SiemensDrive.ReadInt16(itemTag.Value.Address).Content;
|
|
// TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
|
// break;
|
|
case ConstShortType:
|
|
|
|
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.IsShow = IsValueShow;
|
|
|
|
////仿真数据
|
|
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = (short)Random.Next(1, 100);
|
|
//TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = (short)Random.Next(1, 100) * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
|
//LinkState = false;
|
|
|
|
//PLC 数据
|
|
if (!string.IsNullOrEmpty(itemTag.Value.PVAddress))
|
|
{
|
|
OperateResultShort = SiemensDrive.ReadInt16(itemTag.Value.PVAddress);
|
|
if (OperateResultShort.IsSuccess)
|
|
{
|
|
TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = SiemensDrive.ReadInt16(itemTag.Value.PVAddress).Content;
|
|
TagManger.GetTagByName<short>(itemTag.Value.Name).EngPvValue = TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
|
LinkState = true;
|
|
}
|
|
else
|
|
{
|
|
LinkState = false;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(itemTag.Value.SVAddress))
|
|
{
|
|
OperateResultSVShort = SiemensDrive.ReadInt16(itemTag.Value.SVAddress);
|
|
if (OperateResultSVShort.IsSuccess)
|
|
{
|
|
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = OperateResultSVShort.Content;
|
|
TagManger.GetTagByName<short>(itemTag.Value.Name).EngSvValue = OperateResultSVShort.Content * 1.0 / TagManger.GetTagByName<short>(itemTag.Value.Name)!.Precision;
|
|
LinkState = true;
|
|
}
|
|
else
|
|
{
|
|
LinkState = false;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(itemTag.Value.MVAddress))
|
|
{
|
|
OperateResultMVShort = SiemensDrive.ReadInt16(itemTag.Value.MVAddress);
|
|
if (OperateResultMVShort.IsSuccess)
|
|
{
|
|
//TagManger.GetTagInfoValueByName<short>(itemTag.Value.Name)!.Value = OperateResultMVShort.Content;
|
|
TagManger.GetTagByName<short>(itemTag.Value.Name).EngMvValue = OperateResultMVShort.Content*1.0/10;
|
|
LinkState = true;
|
|
}
|
|
else
|
|
{
|
|
LinkState = false;
|
|
}
|
|
}
|
|
|
|
//手自动切换按钮条件
|
|
AutoHandSwtichConditionState.AlarmStateResult= SiemensDrive.ReadBool(AutoHandSwtichConditionState.AlarmAddress);
|
|
AutoHandSwtichConditionState.HandStateResult= SiemensDrive.ReadBool(AutoHandSwtichConditionState.HandStateAddress);
|
|
AutoHandSwtichConditionState.SumResult();
|
|
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
//stopwatch.Stop(); //停止Stopwatch
|
|
//Console.WriteLine("Add Elapsed output runTime:{0}", stopwatch.Elapsed.TotalSeconds.ToString());
|
|
//stopwatch.Reset();
|
|
|
|
OperateResultAlarm = SiemensDrive.ReadBool("V0.0", 15);
|
|
if (OperateResultAlarm.IsSuccess)
|
|
{
|
|
foreach (var item in AlarmService.ListAlarmRunCell)
|
|
{
|
|
item.UpdateBoolValue(OperateResultAlarm.Content[item.Index]);
|
|
}
|
|
}
|
|
|
|
|
|
//循环读取手自动切换
|
|
foreach (var item in ListHandSwitchData)
|
|
{
|
|
item.StateOperateResult = SiemensDrive.ReadBool(item.StateAddress);
|
|
if (item.StateOperateResult.IsSuccess)
|
|
{
|
|
item.State = item.StateOperateResult.Content;
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//LogService.Info($"时间:{DateTime.Now.ToString()}-【Meter】-{ex.Message}");
|
|
|
|
}
|
|
|
|
|
|
//DiagnosticsTime.Stop();
|
|
//ScanRtTimeinfo = $"电表:{DiagnosticsTime.Elapsed.TotalMilliseconds.ToString()}";
|
|
}
|
|
});
|
|
}
|
|
|
|
private Random random = new Random();
|
|
|
|
/// <summary>
|
|
///发布实时数据
|
|
/// </summary>
|
|
private void PubRtDataStart()
|
|
{
|
|
ScanTask = Task.Run(async () =>
|
|
{
|
|
while (ThreadEnable)
|
|
{
|
|
try
|
|
{
|
|
await Task.Delay(1000);
|
|
_EventAggregator.GetEvent<ChartRtEvent>().Publish(new List<Models.ChartRtValue>()
|
|
{
|
|
new Models.ChartRtValue(){Name="EVA风量",Value=random.NextDouble()*100,Unit="℃"},
|
|
new Models.ChartRtValue(){Name="中间轴转速",Value=random.NextDouble()*100,Unit="℃"},
|
|
new Models.ChartRtValue(){Name="加热电力",Value=random.NextDouble()*100,Unit="℃"},
|
|
new Models.ChartRtValue(){Name="加湿电力",Value=random.NextDouble()*100,Unit="℃"},
|
|
new Models.ChartRtValue(){Name="EMPCV电流",Value=random.NextDouble()*100,Unit="℃"},
|
|
new Models.ChartRtValue(){Name="INJ压力",Value=random.NextDouble()*100,Unit="℃"},
|
|
new Models.ChartRtValue(){Name="冷媒流量",Value=random.NextDouble()*100,Unit="℃"},
|
|
});
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
var dd = 1;
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
}
|
|
}
|