1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Routine;
- using MECF.Framework.Common.Equipment;
- using CyberX8_Core;
- using CyberX8_RT.Devices.AXIS;
- using CyberX8_RT.Devices.PUF;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CyberX8_RT.Modules.PUF
- {
- public class PufSwitchOnRoutine : ModuleRoutineBase, IRoutine
- {
- private enum LoadStep
- {
- Rotation,
- RotationWait,
- Flip,
- FlipWait,
- End
- }
- #region 内部变量
- private JetAxisBase _flipAxis;
- private JetAxisBase _rotationAxis;
- #endregion
- public PufSwitchOnRoutine(ModuleName module) : base(module)
- {
- _flipAxis = DEVICE.GetDevice<JetAxisBase>($"{module.ToString()}.Flip");
- _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{module.ToString()}.Rotation");
- Name = "SwitchOn";
- }
- public void Abort()
- {
- Runner.Stop("Manual Abort");
- }
- public RState Monitor()
- {
- Runner.Run(LoadStep.Rotation, RotationAxisSwitchOn, _delay_1ms)
- .WaitWithStopCondition(LoadStep.RotationWait, () => { return _rotationAxis.Status == RState.End; }, () => { return _rotationAxis.Status == RState.Failed; })
- .Run(LoadStep.Flip, FlipAxisSwitchOn, _delay_1ms)
- .WaitWithStopCondition(LoadStep.FlipWait, () => { return _flipAxis.Status == RState.End; }, () => { return _flipAxis.Status== RState.Failed; })
- .End(LoadStep.End,NullFun);
- return Runner.Status;
- }
- private bool FlipAxisSwitchOn()
- {
- _flipAxis.SwitchOn();
- return true;
- }
- private bool CheckFlipSwitchOn()
- {
- return _flipAxis.IsSwitchOn;
- }
- private bool RotationAxisSwitchOn()
- {
- _rotationAxis.SwitchOn();
- return true;
- }
- private bool CheckRotationSwitchOn()
- {
- return _rotationAxis.IsSwitchOn;
- }
- public RState Start(params object[] objs)
- {
- Runner.Start(Module, Name);
- return RState.Running;
- }
- }
- }
|