CAN FD增加

This commit is contained in:
2025-07-11 23:47:23 +08:00
parent 735c42f909
commit 169ea7b93d
20 changed files with 4250 additions and 513 deletions

View File

@@ -42,6 +42,7 @@ namespace CapMachine.Wpf.Services
public ConfigService ConfigService { get; }
public LogicRuleService LogicRuleService { get; }
public CanDriveService CanDriveService { get; }
public CanFdDriveService CanFdDriveService { get; }
public LinDriveService LinDriveService { get; }
public SysRunService SysRunService { get; }
@@ -135,7 +136,7 @@ namespace CapMachine.Wpf.Services
/// </summary>
/// <param name="eventAggregator"></param>
public MachineRtDataService(IEventAggregator eventAggregator, AlarmService alarmService, ConfigService configService, LogicRuleService logicRuleService,
CanDriveService canDriveService, LinDriveService linDriveService, SysRunService sysRunService)//, AlarmService alarmService
CanDriveService canDriveService, CanFdDriveService canFdDriveService, LinDriveService linDriveService, SysRunService sysRunService)//, AlarmService alarmService
{
//ConcurrentDictionary<DateTime, RecordInfo> keyValuePairs = new ConcurrentDictionary<DateTime, RecordInfo>();
@@ -153,6 +154,7 @@ namespace CapMachine.Wpf.Services
ConfigService = configService;
LogicRuleService = logicRuleService;
CanDriveService = canDriveService;
CanFdDriveService = canFdDriveService;
LinDriveService = linDriveService;
SysRunService = sysRunService;
@@ -2604,6 +2606,15 @@ namespace CapMachine.Wpf.Services
//pVModel.EngSrcValue = 0;
}
break;
case CanLinEnum.CANFD:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX
if (TagManger.TryGetPVModel(itemCanLinGroup.Key, out MeterValueAttrCell? CanpFDVModel))
{
CanpFDVModel!.EngValue = CanDriveService.GetDbcSpeedValueBySpeedName("通讯转速");
SiemensDrive.Write(CanpFDVModel!.Address!.Replace("W", ""), (short)CanFdDriveService.GetDbcSpeedValueBySpeedName("通讯转速"));
//pVModel.EngSrcValue = 0;
}
break;
case CanLinEnum.Lin:
//通信转速 Dbc中间配置名称的转速数据读取出来 给PLC 取消XXX
if (TagManger.TryGetPVModel(itemCanLinGroup.Key, out MeterValueAttrCell? LinpVModel))
@@ -2633,6 +2644,12 @@ namespace CapMachine.Wpf.Services
//写入到PLC中
SiemensDrive.Write(pVModel!.Address!.Replace("W", ""), (short)(CanDriveService.GetDbcValueByName(itemCanLinGroup.Value.NameNoUnit) * itemCanLinGroup.Value.Precision));
break;
case CanLinEnum.CANFD:
//取得压缩机的CANLIN数据到数据集合中
pVModel!.EngValue = CanDriveService.GetDbcValueByName(itemCanLinGroup.Value.NameNoUnit);
//写入到PLC中
SiemensDrive.Write(pVModel!.Address!.Replace("W", ""), (short)(CanFdDriveService.GetDbcValueByName(itemCanLinGroup.Value.NameNoUnit) * itemCanLinGroup.Value.Precision));
break;
case CanLinEnum.Lin:
//取得压缩机的CANLIN数据
pVModel!.EngValue = LinDriveService.GetLdfValueByName(itemCanLinGroup.Value.NameNoUnit);
@@ -3100,6 +3117,9 @@ namespace CapMachine.Wpf.Services
case CanLinEnum.Can:
CanDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
break;
case CanLinEnum.CANFD:
CanFdDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
break;
case CanLinEnum.Lin:
LinDriveService.UpdateCapEnableCmdData((bool)itemStepExd.Value!);
break;
@@ -3183,6 +3203,15 @@ namespace CapMachine.Wpf.Services
CanDriveService.UpdateSpeedCmdData(SpeedSv);
}
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.CANFD:
//获取PLC的SV数据 更新SV的速度值到压缩机
if (CanDriveService.CanAutoHand)//自动时步骤的数据可以赋值数据
{
CanFdDriveService.UpdateSpeedCmdData(SpeedSv);
}
//itemTag.Value.EngPvValue = 0;
break;
case CanLinEnum.Lin: