123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.SCCore;
- using Aitex.RT.Properties;
- using Aitex.Triton160.Common;
- using Aitex.Core.RT.IOCore;
- using Aitex.Core.RT.Routine;
- using Aitex.Triton160.RT.Device;
- namespace Aitex.Triton160.RT.Routine.PM
- {
- public class CyclePurgeRoutine : CommonRoutine
- {
- private enum RoutineStep
- {
- CheckRfOff,
- CheckPumping,
- CloseAllValves,
- Loop,
- Pump,
- PumpDelay,
- Vent,
- VentDelay,
- EndLoop,
- PumpDefault,
- End,
- };
- private int _purgeCycleCount;
-
- private int _purgeVentPressure;
- private int _purgePumpPressure;
- private int _purgeVentTimeLimit;
- private int _purgePumpTimeLimit;
- private int _purgeVentStableTime;
- private int _purgePumpStableTime;
- public CyclePurgeRoutine(string module, string name)
- {
- Module = module;
- Name = name;
- Display = Resources.CyclePurgeRoutine_CyclePurgeRoutine_CyclePurge;
- bUINotify = true;
- }
- public bool Initialize()
- {
- InitCommon();
- return true;
- }
- public void Terminate()
- {
- }
- public Result Start(params object[] objs)
- {
- Reset();
- UpdateSCValue();
- _purgeCycleCount = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeCycleCount);
-
- _purgeVentPressure = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentPressure);
- _purgePumpPressure = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpPressure);
- _purgeVentTimeLimit = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentTimeLimit);
- _purgePumpTimeLimit = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpTimeLimit);
- _purgeVentStableTime = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgeVentStableTime);
- _purgePumpStableTime = (int)SC.GetValue<double>(SCName.ProcessConfig_PurgePumpStableTime);
-
- return Result.RUN;
- }
- public Result Monitor()
- {
-
- try
- {
- CheckRfOff((int)RoutineStep.CheckRfOff, Resources.StopPumpRoutine_Monitor_CheckIfTheRfIsOn);
- CheckPumpingOn((int)RoutineStep.CheckPumping, Resources.CyclePurgeRoutine_Monitor_CheckIfThePumpValveOpen);
- //CheckGasFlowStopped((int)RoutineStep.CheckGasFlow, "Check if the gas stopped flowing");
- //关闭所有阀门
- CloseAllValve((int)RoutineStep.CloseAllValves, Resources.PumpDownRoutine_Monitor_CloseAllTheValves, 10, Notify, Stop);
- Loop((int)RoutineStep.Loop, Resources.CyclePurgeRoutine_Monitor_StartCyclePurge, _purgeCycleCount, Notify, Stop);
- CyclePump((int)RoutineStep.Pump, Resources.CyclePurgeRoutine_Monitor_Pumping, _purgePumpPressure, _purgePumpTimeLimit, true, Notify, Stop);
- Delay((int)RoutineStep.PumpDelay, string.Format("pump delay {0} seconds", _purgePumpStableTime), _purgePumpStableTime, Notify, Stop);
- CycleVent((int)RoutineStep.Vent, Resources.CyclePurgeRoutine_Monitor_Venting, _purgeVentPressure, _purgeVentTimeLimit, true, Notify, Stop);
- Delay((int)RoutineStep.VentDelay, string.Format("vent delay {0} seconds", _purgeVentStableTime), _purgeVentStableTime, Notify, Stop);
- EndLoop((int)RoutineStep.EndLoop, Notify, Stop);
- CyclePump((int)RoutineStep.PumpDefault, Resources.CyclePurgeRoutine_Monitor_KeepInPumpingStatus, _purgePumpPressure, _purgePumpTimeLimit, false, Notify, Stop);
- End((int)RoutineStep.End, Resources.CyclePurgeRoutine_Monitor_CyclePurgeFinished, Notify, Stop);
- }
- catch (RoutineBreakException)
- {
- return Result.RUN;
- }
- catch (RoutineFaildException)
- {
- return Result.FAIL;
- }
- return Result.DONE;
- }
- }
- }
|