123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.SCCore;
- using Aitex.RT.Properties;
- using Aitex.Triton160.RT.Device;
- using Aitex.Core.RT.IOCore;
- using Aitex.Triton160.Common;
- using Aitex.Core.RT.Routine;
- namespace Aitex.Triton160.RT.Routine.PM
- {
- public class VentRountine : CommonRoutine
- {
- private enum Routine
- {
- CheckPSW,
- ClosePumpValve1,
- ClosePumpValve2,
- CloseALLValve,
- OpenVentValve,
- VentToPrecision,
- VentDelay,
- CloseVentValve,
-
- End,
- }
- private int _ventTime;
- private int _ventTimeDelay = 2; //执行Vent程序时(自动或手动Vent),先关闭PV2,延时2秒后打开PV3。
- public VentRountine(string module, string name)
- {
- Module = module;
- Name = name;
- Display = Resources.VentRountine_VentRountine_Vent;
- bUINotify = true;
- }
- public bool Initialize()
- {
- InitCommon();
- return true;
- }
- public void Terminate()
- {
- }
- public Result Start()
- {
- Reset();
- _ventTime = (int)SC.GetSC<double>(SCName.System_VentTime).Value;
- //_ventTimeLimit = (int)SC.GetSC<double>(SCName.System_VentTimeLimit).Value;
- return Result.RUN;
- }
- public Result Monitor()
- {
-
- try
- {
- //检查PSW通讯
- CheckPSWCommunaction((int)Routine.CheckPSW, Resources.VentRountine_Monitor_CheckSensor, Notify, Stop);
-
- CloseValve((int)Routine.ClosePumpValve2, Resources.VentRountine_Monitor_PumpingOpenValve, DeviceModel.ValveChamberPumping, valveOpenCloseTimeout, Notify, Stop);
-
- CloseAllValve((int)Routine.CloseALLValve, Resources.VentRountine_Monitor_CloseAllTheValve, 10, Notify, Stop);
- Delay((int)Routine.VentDelay, string.Format(Resources.VentRountine_Monitor_VentDelay0SecondsBeforeOpenVentValve, _ventTimeDelay), _ventTimeDelay, Notify, Stop);
- //打开V9
- OpenValve((int)Routine.OpenVentValve, Resources.VentRountine_Monitor_VentValve, DeviceModel.ValveChamberVent, valveOpenCloseTimeout, Notify, Stop);
- VentToPrecision((int)Routine.VentToPrecision, string.Format(Resources.VentRountine_Monitor_Vent0Seconds, _ventTime), _ventTime, Notify, Stop);
- //vent delay
- //Delay((int)Routine.VentDelay, string.Format("vent delay {0} seconds on {1}mTorr", _ventTimeDelay, DeviceModel.PressureMeterChamber.Precision), _ventTimeDelay, Notify, Stop);
- CloseValve((int)Routine.CloseVentValve, Resources.VentRountine_Monitor_VentValve, DeviceModel.ValveChamberVent, valveOpenCloseTimeout, Notify, Stop);
- End((int)Routine.End, Resources.VentRountine_Monitor_VentCompleted, Notify, Stop);
-
- }
- catch (RoutineBreakException)
- {
- return Result.RUN;
- }
- catch (RoutineFaildException)
- {
- return Result.FAIL;
- }
- return Result.DONE;
- }
- public new Result Abort()
- {
- base.Abort();
-
- string reason = string.Empty;
- if (DeviceModel.ValveChamberVent!= null && !DeviceModel.ValveChamberVent.TurnValve(false, out reason))
- {
- Notify(reason);
- return Result.FAIL;
- }
- return Result.DONE;
- }
- }
- }
|