程序下载的配置
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using AutoMapper.Internal;
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Wpf.ChannelModel;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.Models.ProModelPars;
|
||||
using CapMachine.Wpf.Models.Tag;
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
using HslCommunication;
|
||||
@@ -16,6 +18,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
@@ -148,51 +151,51 @@ namespace CapMachine.Wpf.Services
|
||||
#region 标签管理
|
||||
|
||||
////三电 Sample
|
||||
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, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 });
|
||||
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>("转速", "转速[rpm]", "Speed", "程序", "VW15000", 100, 0, 1, "rpm", new ShortTagValue(), true) { DecimalPoint = 0, IsMeter = true, });
|
||||
TagManger.AddTag(new Tag<short>("排气压力", "排气压力[BarA]", "ExPress", "程序", "VW15002", 100, 0, 100, "BarA", new ShortTagValue(), true) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("吸气压力", "吸气压力[BarA]", "InhPress", "程序", "VW15004", 100, 0, 100, "BarA", new ShortTagValue(), true) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("吸气温度", "吸气温度[℃]", "InhTemp", "程序", "VW15006", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("COND1温度", "COND1温度[℃]", "Cond1Temp", "程序", "VW15008", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("润滑油压力", "润滑油压力[BarA]", "LubePress", "程序", "VW15010", 100, 0, 100, "BarA", new ShortTagValue(), true) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("COND2压力", "COND2压力[BarA]", "Cond2Press", "程序", "VW15012", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("OCR", "OCR[%]", "OCR", "程序", "VW15014", 100, 0, 10, "%", new ShortTagValue(), true) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("HV[V]", "HV[V]", "HV", "程序", "VW15016", 100, 0, 10, "V", new ShortTagValue(), true) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("HV[A]", "HV[A]", "HVCur", "程序", "VW15018", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("HV[W]", "HV[W]", "HVPw", "程序", "VW15020", 100, 0, 1, "W", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("LV[V]", "LV[V]", "LV", "程序", "VW15022", 100, 0, 10, "V", new ShortTagValue(), true) { DecimalPoint = 1, IsMeter = true });
|
||||
//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>("LV[A]", "LV[A]", "LVCur", "程序", "VW15024", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("环境温度", "环境温度[℃]", "EnvTemp", "程序", "VW15026", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1, IsMeter = true });
|
||||
//TagManger.AddTag(new Tag<short>("环境湿度", "环境湿度[%]", "EnvRH", "程序", "VW15028", 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>("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>("环境湿度", "环境湿度[%]", "EnvRH", "程序", "VW15028", 100, 0, 10, "%", new ShortTagValue(), true) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("OS1温度", "OS1温度[℃]", "OS1Temp", "程序", "VW15030", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("OS2温度", "OS2温度[℃]", "OS2Temp", "程序", "VW15032", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("COND2温度", "COND2温度[℃]", "Cond2Temp", "程序", "VW15034", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("EVAP出口温度", "EVAP出口温度[℃]", "EVAPExpTemp", "程序", "VW15036", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
//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, 10, "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, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2 });
|
||||
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, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 });
|
||||
TagManger.AddTag(new Tag<short>("通讯Cmp相电流", "通讯Cmp相电流[A]", "ComCapPhCur", "程序", "VW15066", 100, 0, 100, "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, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC入水温度", "通讯PTC入水温度[℃]", "ComPTCEntTemp", "程序", "VW15072", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC出水温度", "通讯PTC出水温度[℃]", "ComPTCExpTemp", "程序", "VW15074", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC峰值电流", "通讯PTC峰值电流[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, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC模块温度", "通讯PTC模块温度[℃]", "ComPTCMdTemp", "程序", "VW15082", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0 });
|
||||
TagManger.AddTag(new Tag<short>("冷媒流量", "冷媒流量[L/min]", "VRV", "程序", "VW15038", 100, 0, 10, "L/min", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("润滑油流量", "润滑油流量[L/min]", "LubeFlow", "程序", "VW15040", 100, 0, 10, "L/min", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("排气温度", "排气温度[℃]", "ExTemp", "程序", "VW15042", 100, 0, 10, "℃", new ShortTagValue(), true) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("膨胀阀前压力", "膨胀阀前压力[BarA]", "TxvFrPress", "程序", "VW15044", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("膨胀阀前温度", "膨胀阀前温度[℃]", "TxvFrTemp", "程序", "VW15046", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("EVAP出口压力", "EVAP出口压力[BarA]", "EVAPExpPress", "程序", "VW15048", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("腔内压力", "腔内压力[BarA]", "IntrplPress", "程序", "VW15050", 100, 0, 100, "BarA", new ShortTagValue(), false) { DecimalPoint = 2, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("压缩机表面温度", "压缩机表面温度[℃]", "CapSurfTemp", "程序", "VW15052", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("PTC流量", "PTC流量[L/min]", "PTCFlow", "程序", "VW15054", 100, 0, 1, "L/min", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("PTC入水温度", "PTC入水温度[℃]", "PTCEntTemp", "程序", "VW15056", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("PTC出水温度", "PTC出水温度[℃]", "PTCExpTemp", "程序", "VW15058", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = true });
|
||||
TagManger.AddTag(new Tag<short>("通讯Cmp母线电流", "通讯Cmp母线电流[A]", "ComCapBusCur", "程序", "VW15060", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 2, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯Cmp母线电压", "通讯Cmp母线电压[V]", "ComCapBusVol", "程序", "VW15062", 100, 0, 10, "V", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯Cmp逆变器温度", "通讯Cmp逆变器温度[℃]", "ComCapInvTemp", "程序", "VW15064", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯Cmp相电流", "通讯Cmp相电流[A]", "ComCapPhCur", "程序", "VW15066", 100, 0, 100, "A", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯Cmp功率", "通讯Cmp功率[W]", "ComCapPw", "程序", "VW15068", 100, 0, 1, "W", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯Cmp芯片温度", "通讯Cmp芯片温度[℃]", "ComCapChipTemp", "程序", "VW15070", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC入水温度", "通讯PTC入水温度[℃]", "ComPTCEntTemp", "程序", "VW15072", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC出水温度", "通讯PTC出水温度[℃]", "ComPTCExpTemp", "程序", "VW15074", 100, 0, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC峰值电流", "通讯PTC峰值电流[A]", "ComPTCPeakCur", "程序", "VW15076", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC母线电流", "通讯PTC母线电流[A]", "ComPTCBusCur", "程序", "VW15078", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC膜温", "通讯PTC膜温[℃]", "ComPTCFlmTemp", "程序", "VW15080", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0, IsMeter = false });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC模块温度", "通讯PTC模块温度[℃]", "ComPTCMdTemp", "程序", "VW15082", 100, 0, 1, "℃", new ShortTagValue(), false) { DecimalPoint = 0, IsMeter = false });
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1050,7 +1053,7 @@ namespace CapMachine.Wpf.Services
|
||||
private void InitialPLCCom()
|
||||
{
|
||||
var IPInfo = ConfigHelper.GetValue("PLCIP");
|
||||
|
||||
|
||||
|
||||
SiemensDrive = new SiemensS7Net(SiemensPLCS.S200Smart, IPInfo);
|
||||
// 连接对象
|
||||
@@ -1137,11 +1140,14 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
while (ThreadEnable)
|
||||
{
|
||||
//await Task.Delay(5);
|
||||
await Task.CompletedTask;
|
||||
|
||||
//await Task.CompletedTask;
|
||||
|
||||
DiagnosticsTime.Reset();
|
||||
DiagnosticsTime.Start();
|
||||
|
||||
await Task.Delay(200);
|
||||
|
||||
try
|
||||
{
|
||||
//TagInfo.RtValue.Value++;
|
||||
@@ -1403,6 +1409,10 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
}
|
||||
|
||||
//程序步骤的写入
|
||||
ProRunStepWrite();
|
||||
|
||||
|
||||
//stopwatch.Stop(); //停止Stopwatch
|
||||
//Console.WriteLine("Add Elapsed output runTime:{0}", stopwatch.Elapsed.TotalSeconds.ToString());
|
||||
//stopwatch.Reset();
|
||||
@@ -1470,7 +1480,7 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
|
||||
DiagnosticsTime.Stop();
|
||||
ConfigService.PlcCycleTime = (int)DiagnosticsTime.Elapsed.TotalMilliseconds - 300;
|
||||
ConfigService.PlcCycleTime = (int)DiagnosticsTime.Elapsed.TotalMilliseconds;
|
||||
//Console.WriteLine($"扫描时间:{DiagnosticsTime.Elapsed.TotalMilliseconds.ToString()}");
|
||||
}
|
||||
});
|
||||
@@ -1511,5 +1521,105 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 队列数据
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 队列通道
|
||||
/// 当前队列消费触发的数据记录
|
||||
/// </summary>
|
||||
public Channel<ProRunChannelData> ProRunChannel = Channel.CreateUnbounded<ProRunChannelData>(new UnboundedChannelOptions()
|
||||
{
|
||||
SingleWriter = false,//允许一次写入多条数据
|
||||
SingleReader = true //一次只能读取一条消息
|
||||
});
|
||||
|
||||
///// <summary>
|
||||
///// 程序执行管道监听方法
|
||||
///// </summary>
|
||||
///// <exception cref="NotImplementedException"></exception>
|
||||
//private async void ListenProRunChannelAction()
|
||||
//{
|
||||
// while (await ProRunChannel.Reader.WaitToReadAsync())
|
||||
// {
|
||||
// if (ProRunChannel.Reader.TryRead(out var ProRunChannelData))
|
||||
// {
|
||||
// ////第一次计时
|
||||
// //stopwatch.Start(); //启动Stopwatch
|
||||
// if (ProRunChannelData.RunStepType == RunStepType.SlopCell)
|
||||
// {
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} " +
|
||||
// $"【参数名称】:{ProRunChannelData.MeterName} " +
|
||||
// $"【程序Seg】{ProRunChannelData.ProSegName} " +
|
||||
// $"【程序步骤】{ProRunChannelData.MeterStep} " +
|
||||
// $"【斜坡打点步骤】{ProRunChannelData.SlopStepNo} " +
|
||||
// $"【斜坡打点值SV】{ProRunChannelData.SV} " +
|
||||
// $"【Msg】:接受到仿真写入PLC OK ");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} " +
|
||||
// $"【参数名称】:{ProRunChannelData.MeterName} " +
|
||||
// $"【程序Seg】{ProRunChannelData.ProSegName} " +
|
||||
// $"【程序步骤】{ProRunChannelData.MeterStep} " +
|
||||
// $"【步骤SV】{ProRunChannelData.SV} " +
|
||||
// $"【Msg】:接受到步骤仿真写入PLC OK ");
|
||||
// }
|
||||
|
||||
|
||||
// Thread.Sleep(50);
|
||||
// //DownLoadPID();
|
||||
// //stopwatch.Stop(); //停止Stopwatch
|
||||
// //Console.WriteLine("保存数据耗时::{0}", stopwatch.Elapsed.TotalSeconds.ToString());
|
||||
// //stopwatch.Reset();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 运行步骤写入
|
||||
/// </summary>
|
||||
private void ProRunStepWrite()
|
||||
{
|
||||
while (ProRunChannel.Reader.TryRead(out var ProRunChannelData))
|
||||
{
|
||||
////第一次计时
|
||||
//stopwatch.Start(); //启动Stopwatch
|
||||
if (ProRunChannelData.RunStepType == RunStepType.SlopCell)
|
||||
{
|
||||
SiemensDrive.Write("D1", (short)ProRunChannelData.SV);
|
||||
Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} " +
|
||||
$"【参数名称】:{ProRunChannelData.MeterName} " +
|
||||
$"【程序Seg】{ProRunChannelData.ProSegName} " +
|
||||
$"【程序步骤】{ProRunChannelData.MeterStep} " +
|
||||
$"【斜坡打点步骤】{ProRunChannelData.SlopStepNo} " +
|
||||
$"【斜坡打点值SV】{ProRunChannelData.SV} " +
|
||||
$"【Msg】:接受到仿真写入PLC OK ");
|
||||
}
|
||||
else
|
||||
{
|
||||
SiemensDrive.Write("D1", (short)ProRunChannelData.SV);
|
||||
Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} " +
|
||||
$"【参数名称】:{ProRunChannelData.MeterName} " +
|
||||
$"【程序Seg】{ProRunChannelData.ProSegName} " +
|
||||
$"【程序步骤】{ProRunChannelData.MeterStep} " +
|
||||
$"【步骤SV】{ProRunChannelData.SV} " +
|
||||
$"【Msg】:接受到步骤仿真写入PLC OK ");
|
||||
}
|
||||
|
||||
|
||||
Thread.Sleep(50);
|
||||
//DownLoadPID();
|
||||
//stopwatch.Stop(); //停止Stopwatch
|
||||
//Console.WriteLine("保存数据耗时::{0}", stopwatch.Elapsed.TotalSeconds.ToString());
|
||||
//stopwatch.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user