using Aitex.Core.RT.Device;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using CyberX8_Core;
using MECF.Framework.Common.Beckhoff.ModuleIO;
using MECF.Framework.Common.IOCore;
using MECF.Framework.Common.Routine;
namespace CyberX8_RT.Devices.SRD
{
public class SrdCommonChuckATMRoutine : RoutineBase, IRoutine
{
#region 常量
private const string CHUCK_ATM_ON = "ChuckATMOn";
#endregion
private enum ChuckATMStep
{
ChuckATMOn,
Delay,
ChuckATMOff,
End
}
#region 内部变量
///
/// Srd Device
///
private SrdCommonDevice _srdCommon;
///
/// 破真空持续时间
///
private int _duration= 100;
#endregion
///
/// 构造函数
///
///
public SrdCommonChuckATMRoutine(string module) : base(module)
{
}
public void Abort()
{
Runner.Stop("Manual Abort");
}
public RState Monitor()
{
Runner.Run(ChuckATMStep.ChuckATMOn, ChuckATMOn, _delay_1ms)
.Delay(ChuckATMStep.Delay, _duration)
.Run(ChuckATMStep.ChuckATMOff, ChuckATMOff, _delay_1ms)
.End(ChuckATMStep.End, NullFun, 100);
return Runner.Status;
}
public RState Start(params object[] objs)
{
_srdCommon = DEVICE.GetDevice($"{Module}.Common");
return Runner.Start(Module, "Chuck ATM Click");
}
///
/// Chuck ATM On
///
///
private bool ChuckATMOn()
{
return _srdCommon.ChuckATMOnAction("", null);
}
///
/// Chuck ATM Off
///
///
private bool ChuckATMOff()
{
return _srdCommon.ChuckATMOffAction("", null);
}
}
}