123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- 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 PufSwitchOffRoutine : ModuleRoutineBase, IRoutine
- {
- private enum LoadStep
- {
- Rotation,
- RotationWait,
- Flip,
- FlipWait,
- End
- }
- #region 内部变量
- private JetAxisBase _flipAxis;
- private JetAxisBase _rotationAxis;
- #endregion
- public PufSwitchOffRoutine(ModuleName module) : base(module)
- {
- _flipAxis = DEVICE.GetDevice<JetAxisBase>($"{module.ToString()}.Flip");
- _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{module.ToString()}.Rotation");
- Name = "SwitchOff";
- }
- public void Abort()
- {
- Runner.Stop("Manual Abort");
- }
- public RState Monitor()
- {
- Runner.Run(LoadStep.Rotation, RotationAxisSwitchOff, _delay_1ms)
- .WaitWithStopCondition(LoadStep.RotationWait, () => { return _rotationAxis.Status == RState.End; }, () => { return _rotationAxis.Status == RState.Failed; })
- .Run(LoadStep.Flip, FlipAxisSwitchOff, _delay_1ms)
- .WaitWithStopCondition(LoadStep.FlipWait, () => { return _flipAxis.Status == RState.End; }, () => { return _flipAxis.Status == RState.Failed; })
- .End(LoadStep.End,NullFun);
- return Runner.Status;
- }
- private bool FlipAxisSwitchOff()
- {
- _flipAxis.SwitchOff();
- return true;
- }
- private bool CheckFlipSwitchOff()
- {
- return !_flipAxis.IsSwitchOn;
- }
- private bool RotationAxisSwitchOff()
- {
- _rotationAxis.SwitchOff();
- return true;
- }
- private bool CheckRotationSwitchOff()
- {
- return !_rotationAxis.IsSwitchOn;
- }
- public RState Start(params object[] objs)
- {
- Runner.Start(Module, Name);
- return RState.Running;
- }
- }
- }
|