| | |
| | | public abstract ResponseMessage MoveToPoint(IOperationConfig opConfig); |
| | | public abstract void ResetAlarm(); |
| | | public abstract ResponseMessage Run(IOperationConfig config); |
| | | |
| | | public void ExcuteMonitorInvok(DateTime dateTime, string invokeDevice, IDevice device, IMonitorSet monitorSet) |
| | | { |
| | | OnMonitorInvoke?.BeginInvoke(dateTime, invokeDevice, device, monitorSet, null, null); |
| | | } |
| | | |
| | | public void ExcuteMonitorAlarm(DateTime dateTime, IDevice device, IWarningSet warningSet) |
| | | { |
| | | OnMonitorAlarm?.BeginInvoke(dateTime, device, warningSet, null, null); |
| | | } |
| | | |
| | | public virtual MotionCardInitialConfigBase IConfig |
| | | { |
| | | get |
| | | { |
| | | return InitialConfig as MotionCardInitialConfigBase; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public class MotionCardInitialConfigBase : InitialConfigBase, IMonitorConfig |
| | |
| | | public class MotionCardOperationConfigBase : OperationConfigBase, IComplexDisplay |
| | | { |
| | | [Category("IO操作配置")] |
| | | [DisplayName("IO预检查定义集合")] |
| | | [Description("IO预检查定义集合")] |
| | | [TypeConverter(typeof(CollectionCountConvert))] |
| | | [Editor(typeof(IORefrenceItemCollectionEditor),typeof(UITypeEditor))] |
| | | [Editor(typeof(IORefrenceItemCollectionEditor), typeof(UITypeEditor))] |
| | | public List<IORefrenceItem> PreCheckIOCollection { get; set; } = new List<IORefrenceItem>(); |
| | | |
| | | [Category("IO操作配置")] |
| | | [DisplayName("IO输出定义集合")] |
| | | [Description("IO输出定义集合")] |
| | | [TypeConverter(typeof(CollectionCountConvert))] |
| | | public List<IORefrenceItem> IOOutputCollection { get; set; } = new List<IORefrenceItem>(); |
| | | |
| | | [Category("IO操作配置")] |
| | | [DisplayName("IO确认定义集合")] |
| | | [Description("IO确认定义集合")] |
| | | [TypeConverter(typeof(CollectionCountConvert))] |
| | | public List<IORefrenceItem> IOConfirmCollection { get; set; } = new List<IORefrenceItem>(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | namespace Bro.Device.GTSCard |
| | | { |
| | | [Device("GTSCard", "固高板卡", EnumHelper.DeviceAttributeType.Device)] |
| | | public class GTSCardDriver : DeviceBase, IMonitor, IMotion |
| | | public class GTSCardDriver : MotionCardBase |
| | | { |
| | | // 异常事件 |
| | | public Action<Exception> OnExceptionRaised; |
| | |
| | | _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) |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | #endregion |
| | | |
| | | #region GTSCard |
| | |
| | | throw new Exception("板卡载入配置文件异常,错误码:" + res); |
| | | } |
| | | } |
| | | |
| | | |
| | | public bool AllAxisOn() |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="item">运动对象</param> |
| | | /// <returns>运动控制+停止判断</returns> |
| | | public ResponseMessage MoveToPoint(IOperationConfig opConfig) |
| | | public override ResponseMessage MoveToPoint(IOperationConfig opConfig) |
| | | { |
| | | bool resultOK = false; |
| | | var gtsOperationConfig = opConfig as GTSCardOperationConfig; |
| | |
| | | #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>(); |
| | | |
| | |
| | | return result; |
| | | } |
| | | |
| | | public async void Monitor() |
| | | public async override void Monitor() |
| | | { |
| | | await Task.Run(() => |
| | | { |
| | |
| | | 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); |
| | | } |
| | | } |
| | | }); |
| | | #endregion |
| | | } |
| | | |
| | | public void ResetAlarm() |
| | | public override void ResetAlarm() |
| | | { |
| | | int axis_sts; |
| | | uint clk; |
| | |
| | | using Bro.Common.Helper; |
| | | using Bro.Common.Base; |
| | | using Bro.Common.Helper; |
| | | using Bro.Common.Interface; |
| | | using Bro.Common.Model; |
| | | using Bro.Device.GTSCard; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Windows.Forms; |
| | | |
| | |
| | | |
| | | public IDevice Device { get; set; } |
| | | |
| | | //protected CameraBase Camera |
| | | //{ |
| | | // get => Device as CameraBase; |
| | | //} |
| | | public MotionCardOperationConfigBase MotionCardOperationConfig { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 当前板卡实例 |
| | | /// </summary> |
| | | protected MotionCardBase MotionCard |
| | | { |
| | | get => Device as MotionCardBase; |
| | | } |
| | | |
| | | |
| | | public CtrlMotionCardOperationBase(IDevice device) |
| | | { |
| | | InitializeComponent(); |
| | | |
| | | Device = device; |
| | | |
| | | MotionCardOperationConfig = new MotionCardOperationConfigBase(); |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | } |
| | | #endregion |
| | | public void DownloadProcess(IProcess process) |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | |
| | | public void OnProcessUpdated() |
| | | { |
| | | if (InvokeRequired) |
| | | { |
| | | Invoke(new Action(() => OnProcessUpdated())); |
| | | } |
| | | else |
| | | { |
| | | if (Process != null) |
| | | { |
| | | //_avaiableMethods = Process.ProcessMethodCollection.Where(u => u.InvokeType == _invokeType).Select(u => u.MethodCode).ToList(); |
| | | |
| | | //LoadDevices(); |
| | | //LoadProcessMethods(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void RadioButton_CheckedChanged(object sender, EventArgs e) |
| | | { |
| | | //加载对应运动的 movingConfig |
| | | if (radioP2P.Checked) |
| | | { |
| | | movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal); |
| | | movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal); |
| | | } |
| | | else if (radioJog.Checked) |
| | | { |
| | | movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog); |
| | | movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog); |
| | | } |
| | | else if (radioGoHome.Checked) |
| | | { |
| | | movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri); |
| | | movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri); |
| | | } |
| | | |
| | | propGrid.SelectedObject = movingConfig; |