配置参数下载和解析的开发-未完成
This commit is contained in:
@@ -5,6 +5,7 @@ using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.Models.Tag;
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
using HslCommunication;
|
||||
using HslCommunication.Profinet.Melsec;
|
||||
using HslCommunication.Profinet.Siemens;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
@@ -52,6 +53,11 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
public SiemensS7Net SiemensDrive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 三菱连接驱动程序
|
||||
/// </summary>
|
||||
public MelsecMcNet MelsecMcNetDrive { get; set; }
|
||||
|
||||
private bool _LinkState;
|
||||
/// <summary>
|
||||
/// PLC连接状态
|
||||
@@ -123,6 +129,8 @@ namespace CapMachine.Wpf.Services
|
||||
//stopwatch.Stop(); //停止Stopwatch
|
||||
//Console.WriteLine("Add Elapsed output runTime:{0}", stopwatch.Elapsed.ToString());
|
||||
|
||||
//MelsecMcNetDrive.
|
||||
|
||||
//事件服务
|
||||
_EventAggregator = eventAggregator;
|
||||
AlarmService = alarmService;
|
||||
@@ -149,7 +157,7 @@ namespace CapMachine.Wpf.Services
|
||||
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[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>("LV[A]", "LV[A]", "LVCur", "程序", "VW15024", 100, 0, 1, "A", new ShortTagValue(), false) { DecimalPoint = 1 });
|
||||
@@ -163,7 +171,7 @@ namespace CapMachine.Wpf.Services
|
||||
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>("润滑油流量", "润滑油流量[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 });
|
||||
@@ -173,18 +181,18 @@ namespace CapMachine.Wpf.Services
|
||||
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母线电流[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, 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逆变器温度[℃]", "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, 10, "℃", 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, 10, "℃", new ShortTagValue(), false) { DecimalPoint = 1 });
|
||||
TagManger.AddTag(new Tag<short>("通讯PTC模块温度", "通讯PTC模块温度[℃]", "ComPTCMdTemp", "程序", "VW15082", 100, 0, 10, "℃", 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 });
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1042,6 +1050,7 @@ namespace CapMachine.Wpf.Services
|
||||
private void InitialPLCCom()
|
||||
{
|
||||
var IPInfo = ConfigHelper.GetValue("PLCIP");
|
||||
|
||||
|
||||
SiemensDrive = new SiemensS7Net(SiemensPLCS.S200Smart, IPInfo);
|
||||
// 连接对象
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
using System;
|
||||
using AutoMapper;
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Shared.Controls;
|
||||
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 CapMachine.Wpf.ProPars;
|
||||
using CapMachine.Wpf.Tool;
|
||||
using ImTools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
using System.Windows.Forms;
|
||||
using HslCommunication.Profinet.Siemens;
|
||||
using Masuit.Tools.Hardware;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
@@ -15,11 +34,665 @@ namespace CapMachine.Wpf.Services
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
public ProRuntimeService()
|
||||
public ProRuntimeService(IFreeSql freeSql, IMapper mapper, MachineRtDataService machineRtDataService, ILogService logService)
|
||||
{
|
||||
|
||||
FreeSql = freeSql;
|
||||
Mapper = mapper;
|
||||
MachineRtDataService = machineRtDataService;
|
||||
LogService = logService;
|
||||
|
||||
//实例化函数
|
||||
ListProExModel = new List<ProExModel>()
|
||||
{
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="速度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="COND1温度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="COND2温度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="COND2压力",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="EVAP出口温度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="排气压力",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="HV电压",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="吸气压力",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="吸气温度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="润滑油压力",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="LV电压",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="OCR",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="OS1温度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="OS2温度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="PTC入口温度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="PTC流量",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="PTC功率",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="压缩机环境湿度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
},
|
||||
new ProExModel(ProRunChannel){
|
||||
MeterName="压缩机环境温度",
|
||||
ListProStepExe=new List<ProStepExe>(),
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//驱动实例
|
||||
SiemensDrive = MachineRtDataService.SiemensDrive;
|
||||
|
||||
//程序运行实时管道数据监听
|
||||
Task.Run(() => ListenProRunChannelAction());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中的程序运行集合
|
||||
/// </summary>
|
||||
public List<ProSegRun> SelectedListProSegRun { get; set; }
|
||||
public IFreeSql FreeSql { get; }
|
||||
public IMapper Mapper { get; }
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
public ILogService LogService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 西门子连接驱动程序
|
||||
/// </summary>
|
||||
public SiemensS7Net SiemensDrive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Task扫描 程序运行时间扫描任务
|
||||
/// </summary>
|
||||
private static Task ProRunTimeScanTask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序运行集合
|
||||
/// </summary>
|
||||
public List<ProExModel> ListProExModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PLC加载配置数据集合
|
||||
/// </summary>
|
||||
public List<PlcLoadConfigCell> ListPlcLoadConfigCell { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 加载选中的程序运行集合
|
||||
/// </summary>
|
||||
public void LoadProSegRun(List<ProSegRun> SelectedListProSegRun)
|
||||
{
|
||||
if (SelectedListProSegRun == null || SelectedListProSegRun.Count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//先清空之前的步骤数据
|
||||
foreach (var itemProExModel in ListProExModel)
|
||||
{
|
||||
itemProExModel.ListProStepExe.Clear();
|
||||
}
|
||||
|
||||
//多个选中的程序块循环
|
||||
foreach (var itemProSegRun in SelectedListProSegRun)
|
||||
{
|
||||
//获取当前程序块
|
||||
//逐个对应的程序
|
||||
var CurProgramSeg = FreeSql.Select<ProgramSeg>(itemProSegRun.ProgramSegId)
|
||||
.IncludeMany(a => a.ProSteps,
|
||||
then => then.IncludeMany(b => b.MeterSpeeds)
|
||||
.IncludeMany(b => b.MeterCond1Temps)
|
||||
.IncludeMany(b => b.MeterCond2Temps)
|
||||
.IncludeMany(b => b.MeterCond2Presss)
|
||||
.IncludeMany(b => b.MeterEVAPExpTemps)
|
||||
.IncludeMany(b => b.MeterExPresss)
|
||||
.IncludeMany(b => b.MeterHVVols)
|
||||
.IncludeMany(b => b.MeterInhPresss)
|
||||
.IncludeMany(b => b.MeterInhTemps)
|
||||
.IncludeMany(b => b.MeterLubePresss)
|
||||
.IncludeMany(b => b.MeterLVVols)
|
||||
.IncludeMany(b => b.MeterOCRs)
|
||||
.IncludeMany(b => b.MeterOS1Temps)
|
||||
.IncludeMany(b => b.MeterOS2Temps)
|
||||
.IncludeMany(b => b.MeterPTCEntTemps)
|
||||
.IncludeMany(b => b.MeterPTCFlows)
|
||||
.IncludeMany(b => b.MeterPTCPws)
|
||||
.IncludeMany(b => b.MeterEnvRHs)
|
||||
.IncludeMany(b => b.MeterEnvTemps)
|
||||
).ToList().FirstOrDefault();
|
||||
|
||||
//获取当前的程序
|
||||
if (CurProgramSeg != null && CurProgramSeg.ProSteps != null && CurProgramSeg.ProSteps.Any())
|
||||
{
|
||||
//CurProgramSeg有重复运行的次数
|
||||
for (int SegIndex = 0; SegIndex < CurProgramSeg.ProRepeat; SegIndex++)
|
||||
{
|
||||
//解析程序的多行步骤,表格中的行步骤数据,牟定速度
|
||||
foreach (var itemStep in CurProgramSeg.ProSteps.OrderBy(a => a.StepNo))
|
||||
{
|
||||
//单行步骤中包含多个仪表参数的配置,需要逐个仪表参数手动操作解析
|
||||
|
||||
//********* 单个速度步骤信息的解析 *********
|
||||
var CurMeterName = "速度";
|
||||
if (itemStep.MeterSpeeds != null && itemStep.MeterSpeeds.Any())
|
||||
{
|
||||
switch (itemStep.MeterSpeeds.FirstOrDefault()!.ValueType)
|
||||
{
|
||||
case ConfigValueType.Constant: //常值
|
||||
//常值的话就一个数据,循环执行一次
|
||||
foreach (var itemMeterValueCell in itemStep.MeterSpeeds)
|
||||
{
|
||||
var Pid = new ConfigPID();
|
||||
if (FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.ParNo).Any())
|
||||
{
|
||||
Pid = FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.ParNo).First();
|
||||
}
|
||||
var Limit = new ConfigLimit();
|
||||
if (FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.Ev).Any())
|
||||
{
|
||||
Limit = FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.Ev).First();
|
||||
}
|
||||
var Alarm = new ConfigAlarm();
|
||||
if (FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.Ev).Any())
|
||||
{
|
||||
Alarm = FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.Ev).First();
|
||||
}
|
||||
|
||||
ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Add(new ProStepExe()
|
||||
{
|
||||
//程序块
|
||||
ProSegName = CurProgramSeg.Name,
|
||||
ProSegStep = SegIndex,
|
||||
ProSegRepeat = CurProgramSeg.ProRepeat,
|
||||
ProSegIsExeing = false,//配置阶段默认不执行 false
|
||||
|
||||
//程序步骤数据
|
||||
StartSV = GetSVByProcess(itemMeterValueCell.Constant, CurMeterName),
|
||||
EndSV = GetSVByProcess(itemMeterValueCell.Constant, CurMeterName),
|
||||
KeepTime = itemMeterValueCell.KeepTime,
|
||||
MeterStepIsExeing = false,//配置阶段默认不执行 false
|
||||
MeterStepIsOK = false,//配置阶段默认不完成 false
|
||||
ExistSlop = false,//常值没有斜率 //开始和结束不一样则存在斜率
|
||||
|
||||
MeterStep = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Count + 1,
|
||||
MeterName = CurMeterName,
|
||||
|
||||
LimitNo = itemMeterValueCell.ParNo,
|
||||
AlarmNo = itemMeterValueCell.Ev,
|
||||
PIDNo = itemMeterValueCell.Ev,
|
||||
|
||||
CurConfigPIDDto = Mapper.Map<ConfigPIDDto>(Pid),
|
||||
CurConfigLimitDto = Mapper.Map<ConfigLimitDto>(Limit),
|
||||
|
||||
ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case ConfigValueType.Slope: //斜率
|
||||
//根据循环次数确定
|
||||
for (int StepIndex = 0; StepIndex < itemStep.SpeedCycle; StepIndex++)
|
||||
{
|
||||
//根据循环次数执行
|
||||
foreach (var itemMeterValueCell in itemStep.MeterSpeeds)
|
||||
{
|
||||
var Pid = new ConfigPID();
|
||||
if (FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.ParNo).Any())
|
||||
{
|
||||
Pid = FreeSql.Select<ConfigPID>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.ParNo).First();
|
||||
}
|
||||
var Limit = new ConfigLimit();
|
||||
if (FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.Ev).Any())
|
||||
{
|
||||
Limit = FreeSql.Select<ConfigLimit>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.Ev).First();
|
||||
}
|
||||
var Alarm = new ConfigAlarm();
|
||||
if (FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.Ev).Any())
|
||||
{
|
||||
Alarm = FreeSql.Select<ConfigAlarm>().Where(a => a.MeterName == CurMeterName && a.IndexNo == itemMeterValueCell.Ev).First();
|
||||
}
|
||||
|
||||
ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Add(new ProStepExe()
|
||||
{
|
||||
//程序块
|
||||
ProSegName = CurProgramSeg.Name,
|
||||
ProSegStep = SegIndex,
|
||||
ProSegRepeat = CurProgramSeg.ProRepeat,
|
||||
ProSegIsExeing = false,//配置阶段默认不执行 false
|
||||
|
||||
//程序步骤数据
|
||||
//SV = CALCHelper.GetQuickSV(itemMeterValueCell.Constant, 1),
|
||||
StartSV = GetSVByProcess(itemMeterValueCell.StartValue, CurMeterName),
|
||||
EndSV = GetSVByProcess(itemMeterValueCell.EndValue, CurMeterName),
|
||||
KeepTime = itemMeterValueCell.KeepTime,
|
||||
MeterStepIsExeing = false,//配置阶段默认不执行 false
|
||||
MeterStepIsOK = false,//配置阶段默认不完成 false
|
||||
ExistSlop = itemMeterValueCell.StartValue == itemMeterValueCell.EndValue ? false : true,//开始和结束不一样则存在斜率
|
||||
|
||||
MeterStep = ListProExModel.FindFirst(a => a.MeterName == CurMeterName).ListProStepExe.Count + 1,
|
||||
|
||||
LimitNo = itemMeterValueCell.ParNo,
|
||||
AlarmNo = itemMeterValueCell.ParNo,
|
||||
PIDNo = itemMeterValueCell.Ev,
|
||||
|
||||
CurConfigPIDDto = Mapper.Map<ConfigPIDDto>(Pid),
|
||||
CurConfigLimitDto = Mapper.Map<ConfigLimitDto>(Limit),
|
||||
|
||||
ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}",
|
||||
MeterName = CurMeterName,
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
StartProRun();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 处理后获取SV的数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int GetSVByProcess(double SV, string Name)
|
||||
{
|
||||
var Data = ListPlcLoadConfigCell.Where(a => a.Name == Name);
|
||||
if (Data.Any())
|
||||
{
|
||||
return (int)(SV / (Data.FirstOrDefault()!.Precision));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogService.Warn($"【名称】: {Name} - 未找到对应的参数配置,数据转换格式失败");
|
||||
//未找到的话,则直接返回
|
||||
return (int)SV;
|
||||
}
|
||||
}
|
||||
|
||||
#region 程序调度执行
|
||||
|
||||
/// <summary>
|
||||
/// 开始程序调度运行
|
||||
/// </summary>
|
||||
public void StartProRun()
|
||||
{
|
||||
//开始运行前的需要进行一些设置和数据初始化
|
||||
foreach (var itemProExModel in ListProExModel)
|
||||
{
|
||||
//被启用和有步骤时才进行运行设置
|
||||
if (itemProExModel == null && itemProExModel.Enable && itemProExModel!.ListProStepExe.Count() > 0) continue;
|
||||
itemProExModel.RunEnable = true;
|
||||
|
||||
//设置下一步数据是第一步数据,然后设置时间
|
||||
itemProExModel.NextProStepExe = itemProExModel!.ListProStepExe.OrderBy(a => a.MeterStep).FirstOrDefault()!;
|
||||
itemProExModel.CurProStepExe = new ProStepExe();
|
||||
itemProExModel.StepEndDt = DateTime.Now;
|
||||
}
|
||||
|
||||
//运行扫描任务
|
||||
ProRunTimeScan();
|
||||
}
|
||||
|
||||
private bool ProRunTaskEnable = true;
|
||||
|
||||
/// <summary>
|
||||
/// 运行时间扫描
|
||||
/// </summary>
|
||||
private void ProRunTimeScan()
|
||||
{
|
||||
ProRunTimeScanTask = Task.Run(async () =>
|
||||
{
|
||||
while (ProRunTaskEnable)
|
||||
{
|
||||
try
|
||||
{
|
||||
//循环给模型的当前时间赋值,驱动步骤执行
|
||||
foreach (var itemProExModel in ListProExModel)
|
||||
{
|
||||
if (itemProExModel.RunEnable)
|
||||
{
|
||||
itemProExModel.CurrentDateTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//LogService.Info($"时间:{DateTime.Now.ToString()}-【Meter】-{ex.Message}");
|
||||
}
|
||||
//Console.WriteLine($"扫描时间:{DiagnosticsTime.Elapsed.TotalMilliseconds.ToString()}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <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>
|
||||
///// 下载PID 信息
|
||||
///// </summary>
|
||||
//private void DownLoadPID(ProExModel ProExecuteModel)
|
||||
//{
|
||||
// //上一次PID信息不为空的话则进行比较后再下载
|
||||
// if (ProExecuteModel != null && ProExecuteModel.CurProStepExe != null && ProExecuteModel.LastProStepExe != null)
|
||||
// {
|
||||
// //判断是否比较PID信息
|
||||
// if (ProExecuteModel.CurProStepExe.PIDNo != ProExecuteModel.LastProStepExe.PIDNo)
|
||||
// {
|
||||
// //进行比较跟上一个是否相同
|
||||
// if (ProExecuteModel.CurProStepExe != ProExecuteModel.LastProStepExe)
|
||||
// {
|
||||
// var PlcLoadConfigCell_P = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "P")!;
|
||||
// var PlcLoadConfigCell_I = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "I")!;
|
||||
// var PlcLoadConfigCell_D = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "D")!;
|
||||
// //下载PID信息的P
|
||||
// var ResultP = SiemensDrive.Write(PlcLoadConfigCell_P!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigPIDDto!.P * 1.0 / PlcLoadConfigCell_P.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:PID-P " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigPIDDto!.P}" +
|
||||
// $"【Msg】:{ResultP.Message} ");
|
||||
|
||||
// //下载PID信息的I
|
||||
// var ResultI = SiemensDrive.Write(PlcLoadConfigCell_I!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigPIDDto!.I * 1.0 / PlcLoadConfigCell_I.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:PID-I " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigPIDDto!.I}" +
|
||||
// $"【Msg】:{ResultI.Message} ");
|
||||
|
||||
// //下载PID信息的D
|
||||
// var ResultD = SiemensDrive.Write(PlcLoadConfigCell_D!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigPIDDto!.D * 1.0 / PlcLoadConfigCell_D.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:PID-D " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigPIDDto!.D}" +
|
||||
// $"【Msg】:{ResultD.Message} ");
|
||||
// return;
|
||||
// }
|
||||
// //相同的则不需要下载,直接使用上一个的配置
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else//Pid为空的话直接下载,可能是第一个步骤
|
||||
// {
|
||||
// var PlcLoadConfigCell_P = ProExecuteModel!.ListPlcLoadConfigCell.First(a => a.Name == "P")!;
|
||||
// var PlcLoadConfigCell_I = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "I")!;
|
||||
// var PlcLoadConfigCell_D = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "D")!;
|
||||
// //下载PID信息的P
|
||||
// var ResultP = SiemensDrive.Write(PlcLoadConfigCell_P!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigPIDDto!.P * 1.0 / PlcLoadConfigCell_P.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:PID-P " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigPIDDto!.P}" +
|
||||
// $"【Msg】:{ResultP.Message} ");
|
||||
|
||||
// //下载PID信息的I
|
||||
// var ResultI = SiemensDrive.Write(PlcLoadConfigCell_I!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigPIDDto!.I * 1.0 / PlcLoadConfigCell_I.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:PID-I " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigPIDDto!.I}" +
|
||||
// $"【Msg】:{ResultI.Message} ");
|
||||
|
||||
// //下载PID信息的D
|
||||
// var ResultD = SiemensDrive.Write(PlcLoadConfigCell_D!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigPIDDto!.D * 1.0 / PlcLoadConfigCell_D.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:PID-D " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigPIDDto!.D}" +
|
||||
// $"【Msg】:{ResultD.Message} ");
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 下载Limit 信息
|
||||
///// </summary>
|
||||
//private void DownLoadLimit(ProExModel ProExecuteModel)
|
||||
//{
|
||||
// //上一次Limit信息不为空的话则进行比较后再下载
|
||||
// if (ProExecuteModel != null && ProExecuteModel.CurProStepExe != null && ProExecuteModel.LastProStepExe != null)
|
||||
// {
|
||||
// //判断是否比较Limit信息
|
||||
// if (ProExecuteModel.CurProStepExe.LimitNo != ProExecuteModel.LastProStepExe.LimitNo)
|
||||
// {
|
||||
// //进行比较跟上一个是否相同
|
||||
// if (ProExecuteModel.CurProStepExe != ProExecuteModel.LastProStepExe)
|
||||
// {
|
||||
// var PlcLoadConfigCell_Up = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "Up")!;
|
||||
// var PlcLoadConfigCell_Down = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "Down")!;
|
||||
// //下载Limit信息的Up
|
||||
// var ResultUp = SiemensDrive.Write(PlcLoadConfigCell_Up!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Up * 1.0 / PlcLoadConfigCell_Up.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:Limit-Up " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Up}" +
|
||||
// $"【Msg】:{ResultUp.Message} ");
|
||||
|
||||
// //下载Limit信息的Down
|
||||
// var ResultDown = SiemensDrive.Write(PlcLoadConfigCell_Down!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Down * 1.0 / PlcLoadConfigCell_Down.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:Limit-Down " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Down}" +
|
||||
// $"【Msg】:{ResultUp.Message} ");
|
||||
// return;
|
||||
// }
|
||||
// //相同的则不需要下载,直接使用上一个的配置
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else//Pid为空的话直接下载,可能是第一个步骤
|
||||
// {
|
||||
// var PlcLoadConfigCell_Up = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "Up")!;
|
||||
// var PlcLoadConfigCell_Down = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "Down")!;
|
||||
// //下载Limit信息的Up
|
||||
// var ResultUp = SiemensDrive.Write(PlcLoadConfigCell_Up!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Up * 1.0 / PlcLoadConfigCell_Up.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:Limit-Up " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Up}" +
|
||||
// $"【Msg】:{ResultUp.Message} ");
|
||||
|
||||
// //下载Limit信息的Down
|
||||
// var ResultDown = SiemensDrive.Write(PlcLoadConfigCell_Down!.Address, (double)ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Down * 1.0 / PlcLoadConfigCell_Down.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:Limit-Down " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Down}" +
|
||||
// $"【Msg】:{ResultUp.Message} ");
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 下载SV 信息
|
||||
///// </summary>
|
||||
///// <param name="ProExecuteModel"></param>
|
||||
//private void DownLoadSV(ProExModel ProExecuteModel)
|
||||
//{
|
||||
// //上一次SV信息不为空的话则进行比较后再下载
|
||||
// if (ProExecuteModel != null && ProExecuteModel.CurProStepExe != null && ProExecuteModel.LastProStepExe != null)
|
||||
// {
|
||||
// //判断比较SV信息
|
||||
// if (ProExecuteModel.CurProStepExe.EndSV != ProExecuteModel.LastProStepExe.EndSV)
|
||||
// {
|
||||
// //SV配置
|
||||
// var PlcLoadConfigCell_SV = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "SV")!;
|
||||
// //下载SV信息的
|
||||
// var ResultSV = SiemensDrive.Write(PlcLoadConfigCell_SV!.Address, (double)ProExecuteModel.CurProStepExe.EndSV * 1.0 / PlcLoadConfigCell_SV.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:SV " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Up}" +
|
||||
// $"【Msg】:{ResultSV.Message} ");
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //跟上一次的一样,不需要下载了
|
||||
// }
|
||||
// }
|
||||
// else//Pid为空的话直接下载,可能是第一个步骤
|
||||
// {
|
||||
// //SV配置
|
||||
// var PlcLoadConfigCell_SV = ProExecuteModel.ListPlcLoadConfigCell.First(a => a.Name == "SV")!;
|
||||
// //下载SV信息的
|
||||
// var ResultSV = SiemensDrive.Write(PlcLoadConfigCell_SV!.Address, (double)ProExecuteModel.CurProStepExe.EndSV * 1.0 / PlcLoadConfigCell_SV.Precision);
|
||||
// Console.WriteLine($"【时间】{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")} 【参数名称】:{ProExecuteModel.MeterName} " +
|
||||
// $"【程序Seg】{ProExecuteModel.CurProStepExe.ProSegName} " +
|
||||
// $"【程序步骤】{ProExecuteModel.CurProStepExe.MeterStep} " +
|
||||
// $"【类型】:{ProExecuteModel.CurProStepExe.ExistSlop.ToString()} " +
|
||||
// $"【参数】:SV " +
|
||||
// $"【值】:{ProExecuteModel.CurProStepExe.CurConfigLimitDto!.Up}" +
|
||||
// $"【Msg】:{ResultSV.Message} ");
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user