| | |
| | | namespace Bro.Device.GTSCard |
| | | { |
| | | [Device("GTSCard", "固高板卡", EnumHelper.DeviceAttributeType.Device)] |
| | | public class GTSCardDriver : DeviceBase, IMonitor, IMotion |
| | | public class GTSCardDriver : MotionCardBase |
| | | { |
| | | // 异常事件 |
| | | public Action<Exception> OnExceptionRaised; |
| | | |
| | | public GTSCardInitialConfig IConfig |
| | | public GTSCardInitialConfig IIConfig |
| | | { |
| | | get |
| | | { |
| | |
| | | _isResetting = isReset; |
| | | } |
| | | |
| | | public List<AxisInfo> GetCurrentAxisInfo(params string[] axisName) |
| | | public override List<AxisInfo> GetCurrentAxisInfo(params string[] axisName) |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | |
| | | AllMoveStop(); |
| | | AllAxisOff(); |
| | | } |
| | | |
| | | public override ResponseMessage Run(IOperationConfig config) |
| | | { |
| | | ResponseMessage responseMessage = new ResponseMessage(); |
| | | |
| | | |
| | | return responseMessage; |
| | | } |
| | | #endregion |
| | | |
| | | #region GTSCard |
| | |
| | | throw new Exception("板卡载入配置文件异常,错误码:" + res); |
| | | } |
| | | } |
| | | |
| | | |
| | | public bool AllAxisOn() |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="item">运动对象</param> |
| | | /// <returns>运动控制+停止判断</returns> |
| | | public bool MoveToPoint(IOperationConfig opConfig) |
| | | public override ResponseMessage MoveToPoint(IOperationConfig opConfig) |
| | | { |
| | | bool resultOK = false; |
| | | var gtsOperationConfig = opConfig as GTSCardOperationConfig; |
| | |
| | | Task.WaitAll(taskList.ToArray()); |
| | | resultOK = taskList.All(u => u.GetAwaiter().GetResult()); |
| | | |
| | | return resultOK; |
| | | //return resultOK; |
| | | throw new NotImplementedException(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | #endregion |
| | | |
| | | #region IMonitor |
| | | public event Action<DateTime, string, IDevice, IMonitorSet> OnMonitorInvoke; |
| | | public event Action<DateTime, IDevice, IWarningSet> OnMonitorAlarm; |
| | | |
| | | public List<IOItem> MonitorValues { get; set; } = new List<IOItem>(); |
| | | |
| | |
| | | { |
| | | IONum = index, |
| | | Value = (inValue & (1 << index)) == 0 ? 1 : 0, |
| | | Model = IOModel.In |
| | | IOType = IOType.In |
| | | }; |
| | | IOItem outItem = new IOItem() |
| | | { |
| | | IONum = index, |
| | | Value = (outValue & (1 << index)) == 0 ? 1 : 0, |
| | | Model = IOModel.Out |
| | | IOType = IOType.Out |
| | | }; |
| | | result.Add(inItem); |
| | | result.Add(outItem); |
| | |
| | | return result; |
| | | } |
| | | |
| | | public async void Monitor() |
| | | public async override void Monitor() |
| | | { |
| | | await Task.Run(() => |
| | | { |
| | |
| | | foreach (var replyIOData in monitorSet.ReplyIODatas) |
| | | { |
| | | //写入IO输出 |
| | | if (replyIOData.Model == IOModel.Out) |
| | | if (replyIOData.IOType == IOType.Out) |
| | | { |
| | | GTSCardAPI.GT_SetDoBit((short)IConfig.CardNum, GTSCardAPI.MC_GPI, (short)replyIOData.IONum, (short)replyIOData.Value); |
| | | } |
| | |
| | | { |
| | | MotionCardWarningSet warningSet = wSet as MotionCardWarningSet; |
| | | |
| | | bool isOn = ((tempNew.FirstOrDefault(u => u.IONum == warningSet.TriggerIndex && u.Model == warningSet.WarningIOModel)?.Value >> warningSet.TriggerIndex) & 1) == (warningSet.TriggerValue ? 1 : 0); |
| | | bool isOn = ((tempNew.FirstOrDefault(u => u.IONum == warningSet.TriggerIndex && u.IOType == warningSet.WarningIOModel)?.Value >> warningSet.TriggerIndex) & 1) == (warningSet.TriggerValue ? 1 : 0); |
| | | |
| | | if (warningSet.CurrentStatus != isOn) |
| | | { |
| | |
| | | warningSet.TriggerTime = DateTime.Now; |
| | | warningSet.WarningDescription = $"警报:{warningSet.Name}-触发索引:{warningSet.TriggerIndex}-{warningSet.WarningIOModel.GetEnumDescription()}:{warningSet.WarningCode}"; |
| | | SaveAlarmCSVAsync(DateTime.Now, this.Name, warningSet); |
| | | OnMonitorAlarm?.BeginInvoke(DateTime.Now, this, warningSet, null, null); |
| | | ExcuteMonitorAlarm(DateTime.Now, this, warningSet); |
| | | } |
| | | }); |
| | | #endregion |
| | |
| | | // return tempNew[index].Value; |
| | | //}).ToList(); |
| | | |
| | | OnMonitorInvoke?.BeginInvoke(DateTime.Now, monitorSet.InvokeDevice, this, monitorSet, OnMethodInvoked, monitorSet); |
| | | ExcuteMonitorInvok(DateTime.Now, monitorSet.InvokeDevice, this, monitorSet, OnMethodInvoked); |
| | | } |
| | | } |
| | | }); |
| | | #endregion |
| | | } |
| | | |
| | | public void ResetAlarm() |
| | | public override void ResetAlarm() |
| | | { |
| | | int axis_sts; |
| | | uint clk; |