2023-06-05 14:39:23 +08:00
|
|
|
|
using Aitex.Core.RT.Device.Devices;
|
|
|
|
|
using Aitex.Core.RT.Device;
|
|
|
|
|
using Aitex.Core.RT.Event;
|
|
|
|
|
using Aitex.Core.RT.Routine;
|
|
|
|
|
using Aitex.Core.RT.SCCore;
|
|
|
|
|
using MECF.Framework.Common.Equipment;
|
|
|
|
|
using SicModules.PMs.Routines.Base;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2023-06-05 17:30:39 +08:00
|
|
|
|
using SicModules.PMs.Utilities;
|
2023-06-05 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
namespace SicModules.PMs.Routines
|
|
|
|
|
{
|
|
|
|
|
public class PMMfcRorRoutine : PMBaseRoutine
|
|
|
|
|
{
|
|
|
|
|
private enum RoutineStep
|
|
|
|
|
{
|
|
|
|
|
TimeDelay1,
|
|
|
|
|
TimeDelay2,
|
|
|
|
|
TimeDelay3,
|
|
|
|
|
TimeDelay4,
|
|
|
|
|
TimeDelay5,
|
|
|
|
|
TimeDelay6,
|
|
|
|
|
TimeDelay7,
|
|
|
|
|
TimeDelay8,
|
|
|
|
|
TimeDelay9,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ModuleName moduleName;
|
|
|
|
|
private PMModule _pmModule;
|
|
|
|
|
|
2023-06-05 17:30:39 +08:00
|
|
|
|
private MfcRorData _mfcRorData;
|
2023-06-05 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
private Stopwatch _swTimer = new Stopwatch();
|
|
|
|
|
public PMMfcRorRoutine(ModuleName module, PMModule pm) : base(module, pm)
|
|
|
|
|
{
|
|
|
|
|
moduleName = module;
|
|
|
|
|
_pmModule = pm;
|
2023-06-05 17:30:39 +08:00
|
|
|
|
Name = "MfcRor";
|
2023-06-05 14:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override Result Start(params object[] objs)
|
|
|
|
|
{
|
|
|
|
|
Reset();
|
|
|
|
|
|
2023-06-05 17:30:39 +08:00
|
|
|
|
_mfcRorData = (MfcRorData)objs[0];
|
2023-06-05 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
_swTimer.Restart();
|
2023-06-05 17:30:39 +08:00
|
|
|
|
Notify($"Start MfcRor");
|
2023-06-05 14:39:23 +08:00
|
|
|
|
return Result.RUN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Result Monitor()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//CheckRoutineTimeOut();
|
|
|
|
|
|
2023-06-05 17:30:39 +08:00
|
|
|
|
|
2023-06-05 14:39:23 +08:00
|
|
|
|
}
|
|
|
|
|
catch (RoutineBreakException)
|
|
|
|
|
{
|
|
|
|
|
return Result.RUN;
|
|
|
|
|
}
|
|
|
|
|
catch (RoutineFaildException)
|
|
|
|
|
{
|
|
|
|
|
return Result.FAIL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
|
|
|
|
|
_swTimer.Stop();
|
2023-06-05 17:30:39 +08:00
|
|
|
|
|
2023-06-05 14:39:23 +08:00
|
|
|
|
return Result.DONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Abort()
|
|
|
|
|
{
|
2023-06-05 17:30:39 +08:00
|
|
|
|
|
2023-06-05 14:39:23 +08:00
|
|
|
|
|
|
|
|
|
base.Abort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//private void CheckRoutineTimeOut()
|
|
|
|
|
//{
|
|
|
|
|
// if (_routineTimeOut > 10)
|
|
|
|
|
// {
|
|
|
|
|
// if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
|
|
|
|
|
// {
|
|
|
|
|
// EV.PostAlarmLog(Module,$"Routine TimeOut! over {_routineTimeOut} s");
|
|
|
|
|
// throw (new RoutineFaildException());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|