diff --git a/CapMachine.Wpf/CanDrive/ToomossCan.cs b/CapMachine.Wpf/CanDrive/ToomossCan.cs
index 29f9e07..5dcef68 100644
--- a/CapMachine.Wpf/CanDrive/ToomossCan.cs
+++ b/CapMachine.Wpf/CanDrive/ToomossCan.cs
@@ -522,16 +522,16 @@ namespace CapMachine.Wpf.CanDrive
//释放申请的临时缓冲区
Marshal.FreeHGlobal(msgPtSend);
- Console.WriteLine("");
+ //Console.WriteLine("");
//发送CAN数据
int SendedNum = USB2CAN.CAN_SendMsg(DevHandle, WriteCANIndex, CanMsg, (uint)CanMsg.Length);
if (SendedNum >= 0)
{
- Console.WriteLine("Success send frames:{0}", SendedNum);
+ //Console.WriteLine("Success send frames:{0}", SendedNum);
}
else
{
- Console.WriteLine("Send CAN data failed! {0}", SendedNum);
+ //Console.WriteLine("Send CAN data failed! {0}", SendedNum);
}
}
catch (Exception ex)
@@ -562,20 +562,20 @@ namespace CapMachine.Wpf.CanDrive
int CanNum = USB2CAN.CAN_GetMsgWithSize(DevHandle, ReadCANIndex, msgPtRead, CanMsgBuffer.Length);
if (CanNum > 0)
{
- Console.WriteLine("Read CanMsgNum = {0}", CanNum);
+ //Console.WriteLine("Read CanMsgNum = {0}", CanNum);
for (int i = 0; i < CanNum; i++)
{
//CanMsgBuffer[i] = (USB2CAN.CAN_MSG)Marshal.PtrToStructure((IntPtr)((UInt32)msgPtRead + i * Marshal.SizeOf(typeof(USB2CAN.CAN_MSG))), typeof(USB2CAN.CAN_MSG)); //有溢出报错
CanMsgBuffer[i] = (USB2CAN.CAN_MSG)Marshal.PtrToStructure((IntPtr)(msgPtRead + i * Marshal.SizeOf(typeof(USB2CAN.CAN_MSG))), typeof(USB2CAN.CAN_MSG));
- Console.WriteLine("CanMsg[{0}].ID = 0x{1}", i, CanMsgBuffer[i].ID.ToString("X8"));
- Console.WriteLine("CanMsg[{0}].TimeStamp = {1}", i, CanMsgBuffer[i].TimeStamp);
- Console.Write("CanMsg[{0}].Data = ", i);
+ //Console.WriteLine("CanMsg[{0}].ID = 0x{1}", i, CanMsgBuffer[i].ID.ToString("X8"));
+ //Console.WriteLine("CanMsg[{0}].TimeStamp = {1}", i, CanMsgBuffer[i].TimeStamp);
+ //Console.Write("CanMsg[{0}].Data = ", i);
for (int j = 0; j < CanMsgBuffer[i].DataLen; j++)
{
- Console.Write("{0} ", CanMsgBuffer[i].Data[j].ToString("X2"));
+ //Console.Write("{0} ", CanMsgBuffer[i].Data[j].ToString("X2"));
}
- Console.WriteLine("");
+ //Console.WriteLine("");
//报文给高速记录的服务
HighSpeedDataService.AppendOrUpdateMsg(new Models.HighSpeed.CommMsg()
@@ -589,13 +589,13 @@ namespace CapMachine.Wpf.CanDrive
}
else if (CanNum == 0)
{
- Console.WriteLine("No CAN data!");
+ //Console.WriteLine("No CAN data!");
}
else
{
- Console.WriteLine("Get CAN data error!");
+ //Console.WriteLine("Get CAN data error!");
}
- Console.WriteLine("");
+ //Console.WriteLine("");
//将CAN消息数据填充到信号里面,用DBC解析数据
CAN_DBCParser.DBC_SyncCANMsgToValue(DBCHandle, msgPtRead, CanNum);
@@ -608,7 +608,7 @@ namespace CapMachine.Wpf.CanDrive
//{
CAN_DBCParser.DBC_GetSignalValueStr(DBCHandle, new StringBuilder(item.MsgName), new StringBuilder(item.SignalName), ValueSb);
item.SignalRtValueSb = ValueSb;
- Console.Write(ValueSb.ToString());
+ //Console.Write(ValueSb.ToString());
//}
}
diff --git a/CapMachine.Wpf/ChannelModel/ProRunChannelData.cs b/CapMachine.Wpf/ChannelModel/ProRunChannelData.cs
index 3a9805d..8f4086b 100644
--- a/CapMachine.Wpf/ChannelModel/ProRunChannelData.cs
+++ b/CapMachine.Wpf/ChannelModel/ProRunChannelData.cs
@@ -53,6 +53,12 @@ namespace CapMachine.Wpf.ChannelModel
///
public Limit? CurLoadLimit { get; set; }
+ ///
+ /// 是否是速度仪表参数
+ /// 这个模型是通用的,但是发送后的速度参数需要特殊处理(给压缩机),所以要标记
+ ///
+ public bool IsSpeed { get; set; } = false;
+
///
/// 拓展参数集合
/// 比如:速度参数拓展的输出锁定、吸排气阀,压缩机使能等这些拓展参数
diff --git a/CapMachine.Wpf/Models/ProModelPars/ProExModel.cs b/CapMachine.Wpf/Models/ProModelPars/ProExModel.cs
index f92dd49..97e1ae8 100644
--- a/CapMachine.Wpf/Models/ProModelPars/ProExModel.cs
+++ b/CapMachine.Wpf/Models/ProModelPars/ProExModel.cs
@@ -208,6 +208,7 @@ namespace CapMachine.Wpf.Models.ProModelPars
CurLoadLimit = LimitResult == true ? new Limit() { Up = (short)NextProStepExe.CurConfigLimitDto.Up, Down = (short)NextProStepExe.CurConfigLimitDto.Down } : new Limit(),
CurLoadPID = PidResult == true ? new PID() { P = (short)NextProStepExe.CurConfigPIDDto.P, I = (short)NextProStepExe.CurConfigPIDDto.I, D = (short)NextProStepExe.CurConfigPIDDto.D } : new PID(),
RunStepType = GetRunStepType(PidResult, LimitResult, false),
+ IsSpeed=IsSpeed,
ListStepExd = GetStepExds(NextProStepExe),//拓展参数
@@ -264,6 +265,7 @@ namespace CapMachine.Wpf.Models.ProModelPars
CurLoadLimit = LimitResult == true ? new Limit() { Up = (short)NextProStepExe.CurConfigLimitDto.Up, Down = (short)NextProStepExe.CurConfigLimitDto.Down } : new Limit(),
CurLoadPID = PidResult == true ? new PID() { P = (short)NextProStepExe.CurConfigPIDDto.P, I = (short)NextProStepExe.CurConfigPIDDto.I, D = (short)NextProStepExe.CurConfigPIDDto.D } : new PID(),
RunStepType = GetRunStepType(PidResult, LimitResult, true),
+ IsSpeed = IsSpeed,
ListStepExd = GetStepExds(NextProStepExe),//拓展参数
});
@@ -444,6 +446,7 @@ namespace CapMachine.Wpf.Models.ProModelPars
{
MeterName = MeterName,
SV = NoExData.First().SV,
+ IsSpeed = IsSpeed,
ProSegName = CurProStepExe.ProSegName,
MeterStep = CurProStepExe.MeterStep,
diff --git a/CapMachine.Wpf/Models/ProModelPars/ProStepExe.cs b/CapMachine.Wpf/Models/ProModelPars/ProStepExe.cs
index 03bc87d..b512194 100644
--- a/CapMachine.Wpf/Models/ProModelPars/ProStepExe.cs
+++ b/CapMachine.Wpf/Models/ProModelPars/ProStepExe.cs
@@ -63,10 +63,20 @@ namespace CapMachine.Wpf.Models.ProModelPars
///
public int MeterStep { get; set; }
+ private string? _ProStepInfo;
///
/// 这个步骤是打开具体设置步骤界面的那个层面的信息,例如:2-3,代表是程序2里面的仪表步骤3,方便调试和给液击使用
///
- public string? ProStepInfo { get; set; }
+ public string? ProStepInfo
+ {
+ get { return _ProStepInfo; }
+ set { _ProStepInfo = value;RaisePropertyChanged(); }
+ }
+
+ ///////
+ /////// 这个步骤是打开具体设置步骤界面的那个层面的信息,例如:2-3,代表是程序2里面的仪表步骤3,方便调试和给液击使用
+ ///////
+ ////public string? ProStepInfo { get; set; }
/////
///// 启用状态-没有启用就是什么数据都没有
diff --git a/CapMachine.Wpf/Services/CanDriveService.cs b/CapMachine.Wpf/Services/CanDriveService.cs
index f07cf22..22ea787 100644
--- a/CapMachine.Wpf/Services/CanDriveService.cs
+++ b/CapMachine.Wpf/Services/CanDriveService.cs
@@ -7,6 +7,7 @@ using SharpDX;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -152,6 +153,7 @@ namespace CapMachine.Wpf.Services
{
//LogicRuleService.ApplyExpressionFast(SpeedData, SpeedCanCmdData.LogicRuleDto);
SpeedCanCmdData.SignalCmdValue = LogicRuleService.ApplyExpressionFast(SpeedData, SpeedCanCmdData.LogicRuleDto);
+ Console.WriteLine($"实时转换后转速值:{SpeedCanCmdData.SignalCmdValue}-SV值:{SpeedData}" );
}
}
diff --git a/CapMachine.Wpf/Services/MachineRtDataService.cs b/CapMachine.Wpf/Services/MachineRtDataService.cs
index 806f459..6deb045 100644
--- a/CapMachine.Wpf/Services/MachineRtDataService.cs
+++ b/CapMachine.Wpf/Services/MachineRtDataService.cs
@@ -2706,8 +2706,8 @@ namespace CapMachine.Wpf.Services
//程序步骤的写入
ProRunStepWrite();
- TestValue = TestValue + 0.001;
- Console.WriteLine($"结果:{LogicRuleService.ApplyExpressionFast(TestValue, LogicRuleService.LogicRuleDtos[1])}");
+ //TestValue = TestValue + 0.001;
+ //Console.WriteLine($"结果:{LogicRuleService.ApplyExpressionFast(TestValue, LogicRuleService.LogicRuleDtos[1])}");
//stopwatch.Stop(); //停止Stopwatch
//Console.WriteLine("Add Elapsed output runTime:{0}", stopwatch.Elapsed.TotalSeconds.ToString());
@@ -2893,7 +2893,8 @@ namespace CapMachine.Wpf.Services
var SvResult = SiemensDrive.Write(CurMeterInfo!.SvAddress, (short)ProRunChannelData.SV!);
if (!SvResult.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败");
//速度SV到压缩机
- SendSpeedSvToCap(ProRunChannelData.SV);
+ if (ProRunChannelData.IsSpeed) SendSpeedSvToCap(ProRunChannelData.SV);
+
//Pid
if (!string.IsNullOrEmpty(CurMeterInfo.Pid_PAddress))
@@ -2923,7 +2924,7 @@ namespace CapMachine.Wpf.Services
var SvResult = SiemensDrive.Write(CurMeterInfo!.SvAddress, (short)ProRunChannelData.SV!);
if (!SvResult.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败");
//速度SV到压缩机
- SendSpeedSvToCap(ProRunChannelData.SV);
+ if (ProRunChannelData.IsSpeed) SendSpeedSvToCap(ProRunChannelData.SV);
//Pid
if (!string.IsNullOrEmpty(CurMeterInfo.Pid_PAddress))
@@ -2944,7 +2945,7 @@ namespace CapMachine.Wpf.Services
var SvResult = SiemensDrive.Write(CurMeterInfo!.SvAddress, (short)ProRunChannelData.SV!);
if (!SvResult.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败");
//速度SV到压缩机
- SendSpeedSvToCap(ProRunChannelData.SV);
+ if (ProRunChannelData.IsSpeed) SendSpeedSvToCap(ProRunChannelData.SV);
//Limit
if (!string.IsNullOrEmpty(CurMeterInfo.Limit_UpAddress))
@@ -2964,7 +2965,7 @@ namespace CapMachine.Wpf.Services
var SvResult = SiemensDrive.Write(CurMeterInfo!.SvAddress, (short)ProRunChannelData.SV!);
if (!SvResult.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败");
//速度SV到压缩机
- SendSpeedSvToCap(ProRunChannelData.SV);
+ if (ProRunChannelData.IsSpeed) SendSpeedSvToCap(ProRunChannelData.SV);
}
break;
@@ -3031,7 +3032,7 @@ namespace CapMachine.Wpf.Services
var SvResult = SiemensDrive.Write(CurMeterInfo!.SvAddress, (short)ProRunChannelData.SV!);
if (!SvResult.IsSuccess) Console.WriteLine($"{ProRunChannelData.MeterName}:SV写入失败");
//速度SV到压缩机
- SendSpeedSvToCap(ProRunChannelData.SV);
+ if (ProRunChannelData.IsSpeed) SendSpeedSvToCap(ProRunChannelData.SV);
}
break;
@@ -3121,6 +3122,7 @@ namespace CapMachine.Wpf.Services
//itemTag.Value.EngPvValue = 0;
break;
default:
+ //CanDriveService.UpdateSpeedCmdData(SpeedSv);
break;
}
}
diff --git a/CapMachine.Wpf/Services/ProRuntimeService.cs b/CapMachine.Wpf/Services/ProRuntimeService.cs
index af8a046..0654758 100644
--- a/CapMachine.Wpf/Services/ProRuntimeService.cs
+++ b/CapMachine.Wpf/Services/ProRuntimeService.cs
@@ -54,106 +54,6 @@ namespace CapMachine.Wpf.Services
//实例化函数
ListProExModel = new List();
- #region 初始化程序执行模型
- //{
- // new ProExModel(ProRunChannel){
- // MeterName="转速",
- // ListProStepExe=new List(),
- // IsSpeed=true,
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="COND1温度",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="COND2温度",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="COND2压力",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="EVAP出口温度",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="排气压力",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="HV[V]",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="吸气压力",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="吸气温度",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="润滑油压力",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="LV[V]",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="OCR",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="OS1温度",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="OS2温度",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="PTC入口温度",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="PTC流量",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="PTC功率",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="环境湿度",
- // ListProStepExe=new List(),
-
- // },
- // new ProExModel(ProRunChannel){
- // MeterName="环境温度",
- // ListProStepExe=new List(),
-
- // }
- //};
-
- #endregion
//从变量集合中加载PLC转制的配置数据
ListPlcLoadConfigCell = new List();
@@ -184,6 +84,8 @@ namespace CapMachine.Wpf.Services
}
}
+ SpeedProExModel= ListProExModel.FindFirst(a => a.MeterName.Contains("转速"));//转速执行模型
+
//SpeedRunEndEvent
ListProExModel.FindFirst(a => a.MeterName.Contains("转速")).SpeedRunEndEvent += ProRuntimeService_SpeedRunEndEvent;
@@ -229,6 +131,12 @@ namespace CapMachine.Wpf.Services
///
public List ListProExModel { get; set; }
+ ///
+ /// 转速执行模型
+ /// 摘出来给界面展示用,因为速度的时间和步骤代表整个程序的时间和步骤
+ ///
+ public ProExModel SpeedProExModel { get; set; }
+
///
/// PLC加载配置数据集合
///
diff --git a/CapMachine.Wpf/ViewModels/DialogHistoryChartRtConfigViewModel.cs b/CapMachine.Wpf/ViewModels/DialogHistoryChartRtConfigViewModel.cs
index 1202fe7..0f5abb1 100644
--- a/CapMachine.Wpf/ViewModels/DialogHistoryChartRtConfigViewModel.cs
+++ b/CapMachine.Wpf/ViewModels/DialogHistoryChartRtConfigViewModel.cs
@@ -82,7 +82,7 @@ namespace CapMachine.Wpf.ViewModels
///
private void LoadChartSourceData()
{
- foreach (var item in MachineRtDataService.TagManger.DicTags)
+ foreach (var item in MachineRtDataService.TagManger.DicTags.OrderBy(a=>a.Value.Id))
{
ChartSrcDataListViewItems.Add(new ChartSrcData()
{
diff --git a/CapMachine.Wpf/Views/MonitorView.xaml b/CapMachine.Wpf/Views/MonitorView.xaml
index 462e2d9..3bf3f83 100644
--- a/CapMachine.Wpf/Views/MonitorView.xaml
+++ b/CapMachine.Wpf/Views/MonitorView.xaml
@@ -259,7 +259,7 @@
-
+