| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 | 
							- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.RT.SCCore;
 
- using MECF.Framework.Common.Equipment;
 
- using MECF.Framework.Common.Schedulers;
 
- using FurnaceRT.Equipments.PMs;
 
- using FurnaceRT.Equipments.PMs.Routines;
 
- using System;
 
- namespace FurnaceRT.Modules.PMs
 
- {
 
-     public class PMPrepareTransferRoutine : PMBaseRoutine
 
-     {
 
-         enum RoutineStep
 
-         {
 
-             Vent,
 
-             MovePinUp,
 
-             OpenDoor,
 
-             Delay1,
 
-             Delay2,
 
-         }
 
-         private EnumTransferType _paramTransferType;
 
-         private int _timeout;
 
-         private bool _needVent;
 
-         public PMPrepareTransferRoutine(string module, PMModule pm) : base(ModuleHelper.Converter(module), pm)
 
-         {
 
-             Module = module;
 
-             Name = "Prepare transfer";
 
-         }
 
-         public Result Init(EnumTransferType type)
 
-         {
 
-             _paramTransferType = type;
 
-             return Result.DONE;
 
-         }
 
-         public override Result Start(params object[] objs)
 
-         {
 
-             Reset();
 
-             _timeout = SC.GetValue<int>("PM.PrepareTransferTimeout");
 
-             double basePressure = SC.GetValue<double>($"PM.AtmPressureBase");
 
-             //_needVent = PMModule.ChamberDoor.IsClose &&
 
-             //            PMModule.ChamberPressure < basePressure;
 
-             Notify("Start");
 
-             return Result.RUN;
 
-         }
 
-         public override Result Monitor()
 
-         {
 
-             try
 
-             {             
 
-                 //先开门,再升pin,避免升起来之后,气流导致的偏移
 
-                 OpenDoor((int)RoutineStep.OpenDoor, PMModule, _paramTransferType, _timeout);
 
-                 
 
-                 Delay((int)RoutineStep.Delay1, 1);
 
-                 
 
-                 MovePinUp((int)RoutineStep.MovePinUp, PMModule, _paramTransferType, _timeout);
 
-                 //Delay((int)RoutineStep.Delay2, 2);
 
-             }
 
-             catch (RoutineBreakException)
 
-             {
 
-                 return Result.RUN;
 
-             }
 
-             catch (RoutineFaildException)
 
-             {
 
-                 return Result.FAIL;
 
-             }
 
-             Notify("Finished");
 
-             return Result.DONE;
 
-         }
 
-         public override void Abort()
 
-         {
 
-         }
 
-         public void MovePinUp(int id, PMModule pm, EnumTransferType type, int timeout)
 
-         {
 
-             Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
 
-                 {
 
-                     Notify($"{pm.Name} lift pin up ");
 
-                     //if (!pm.ChamberLiftPin.MoveUp(out string reason))
 
-                     //{
 
-                     //    Stop(reason);
 
-                     //    return false;
 
-                     //}
 
-                     return true;
 
-                 }, () =>
 
-                 {
 
-                     return true/*pm.ChamberLiftPin.IsUp*/;
 
-                 }, timeout * 1000);
 
-             if (ret.Item1)
 
-             {
 
-                 if (ret.Item2 == Result.FAIL)
 
-                 {
 
-                     throw (new RoutineFaildException());
 
-                 }
 
-                 else if (ret.Item2 == Result.TIMEOUT) //timeout
 
-                 {
 
-                     Stop($"{pm.Name} move lift pin up timeout, over {timeout} seconds");
 
-                     throw (new RoutineFaildException());
 
-                 }
 
-                 else
 
-                     throw (new RoutineBreakException());
 
-             }
 
-         }
 
-         public void OpenDoor(int id, PMModule pm, EnumTransferType type, int timeout)
 
-         {
 
-             Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
 
-             {
 
-                 Notify($"{pm.Name} open door");
 
-                 //if (!pm.ChamberDoor.Open(out string reason))
 
-                 //{
 
-                 //    Stop(reason);
 
-                 //    return false;
 
-                 //}
 
-                 return true;
 
-             }, () =>
 
-             {
 
-                 return true/*pm.ChamberDoor.IsOpen*/;
 
-             }, timeout * 1000);
 
-             if (ret.Item1)
 
-             {
 
-                 if (ret.Item2 == Result.FAIL)
 
-                 {
 
-                     throw (new RoutineFaildException());
 
-                 }
 
-                 else if (ret.Item2 == Result.TIMEOUT) //timeout
 
-                 {
 
-                     Stop($"{pm.Name} open door timeout, over {timeout} seconds");
 
-                     throw (new RoutineFaildException());
 
-                 }
 
-                 else
 
-                     throw (new RoutineBreakException());
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |