using System; using Aitex.Core.RT.Device.Unit; using Aitex.Core.RT.Event; using Aitex.Core.RT.Log; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using Aitex.RT.Properties; using Aitex.Triton160.Common; using Aitex.Triton160.RT.Device; namespace Aitex.Triton160.RT.Routine.PM { public class RfPowerRoutine : CommonRoutine { private enum RoutineStep { RFPowerOn, End, }; private double _rfAlarmRange; private double _rfAlarmTime; private double _rfPowerOnTime; public RfPowerRoutine(string module, string name) { Module = module; Name = name; Display = name; bUINotify = true; } public bool Initialize() { InitCommon(); return true; } public void Terminate() { } public Result Start(params object[] objs) { if (!DeviceModel.ValveChamberPumping.Status ) { EV.PostMessage(ModuleNameString.System, EventEnum.GeneralInfo, string.Format(Resources.GasFlowRoutine_Start_PumpingValveNotOpenOpenPumpValveFirst)); return Result.FAIL; } bool isGasFlowing = !( (DeviceModel.ValveProcessGasFinal!= null && !DeviceModel.ValveProcessGasFinal.Status)); if (isGasFlowing) { IoValve[] valves ={ DeviceModel.ValveMfc1, DeviceModel.ValveMfc2, DeviceModel.ValveMfc3 , DeviceModel.ValveMfc4 , DeviceModel.ValveMfc5 }; if (!Array.Exists(valves, v =>v!=null && v.Status)) isGasFlowing = false; IoMfc[] mfcs = { DeviceModel.MfcGas1, DeviceModel.MfcGas2, DeviceModel.MfcGas3, DeviceModel.MfcGas4, DeviceModel.MfcGas5 }; if (!Array.Exists(mfcs, m =>m!=null && m.FeedBack > 0.1)) isGasFlowing = false; } if (!isGasFlowing) { EV.PostMessage(ModuleNameString.System, EventEnum.GeneralInfo, string.Format("No gas flowing for RF power on")); return Result.FAIL; } Reset(); UpdateSCValue(); _rfPowerOnTime = Convert.ToDouble(objs[0]); _rfAlarmRange = SC.GetValue(SCName.System_RfPowerAlarmRange); _rfAlarmTime = SC.GetValue(SCName.System_RfPowerAlarmTime); return Result.RUN; } public Result Monitor() { try { RFPowerOn((int)RoutineStep.RFPowerOn, Resources.RfPowerRoutine_Monitor_RFPowerOn, (int)_rfPowerOnTime, (float)_rfAlarmRange, (float)_rfAlarmTime, Notify, Stop); End((int)RoutineStep.End, Resources.RfPowerRoutine_Monitor_RfPowerCompleted, Notify, Stop); } catch (RoutineBreakException) { return Result.RUN; } catch (RoutineFaildException) { return Result.FAIL; } return Result.DONE; } public void AbortRf() { try { string reason = string.Empty; if (DeviceModel.Rf!= null && !DeviceModel.Rf.SetPowerOnOff(false, out reason)) { LOG.Error(reason + Resources.RfPowerRoutine_AbortRf_StopRFError); } } catch (Exception ex) { LOG.Write(ex); } } } }