JetKepler2200APM.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.SCCore;
  5. using Aitex.Core.RT.Log;
  6. using MECF.Framework.Common.Device.Bases;
  7. using MECF.Framework.Common.Equipment;
  8. using System;
  9. using Venus_Core;
  10. using Venus_RT.Devices.IODevices;
  11. using IoMfc = Venus_RT.Devices.IODevices.IoMfc;
  12. using System.Threading.Tasks;
  13. using System.Diagnostics;
  14. using Aitex.Core.Util;
  15. namespace Venus_RT.Devices
  16. {
  17. class JetKepler2200APM : JetPMBase
  18. {
  19. private readonly IoLid _Lid;
  20. //private readonly IoLid _LidLoadlock;
  21. private readonly IoCylinder _slitDoor;
  22. //private readonly IoCylinder _LiftPin;
  23. //private readonly IoCylinder _LoadLockArm;
  24. private readonly IoValve _PVN21Valve;
  25. private readonly IoValve _PVN22Valve;
  26. private readonly IoValve _PV11Valve;
  27. private readonly IoValve _PV12Valve;
  28. private readonly IoValve _PV21Valve;
  29. private readonly IoValve _PV22Valve;
  30. private readonly IoValve _PV31Valve;
  31. private readonly IoValve _PV32Valve;
  32. private readonly IoValve _PV41Valve;
  33. private readonly IoValve _PV42Valve;
  34. private readonly IoValve _N2Valve;
  35. private readonly IoValve _PurgeValve;
  36. private readonly IoValve _Mfc1Valve;
  37. private readonly IoValve _Mfc2Valve;
  38. private readonly IoValve _Mfc3Valve;
  39. private readonly IoValve _Mfc4Valve;
  40. private readonly IoValve _Mfc5Valve;
  41. private readonly IoValve _Mfc6Valve;
  42. //private readonly IoValve _Mfc7Valve;
  43. //private readonly IoValve _Mfc8Valve;
  44. //private readonly IoValve _PVHe1Valve;
  45. //private readonly IoValve _PVHe2Valve;
  46. private readonly IoValve _GasFinalValve;
  47. private readonly IoValve _SoftPumpValve;
  48. private readonly IoValve _FastPumpValve;
  49. private readonly IoValve _TurboPumpPumpingValve;
  50. private readonly IoValve _TurboPumpPurgeValve;
  51. private readonly IoValve _GuageValve;
  52. //private readonly IoValve _LoadlockVentValve;
  53. //private readonly IoValve _LoadlockPumpingValve;
  54. private readonly IoSensor _ATM_sw;
  55. private readonly IoSensor _CDAPressure;
  56. //private readonly IoSensor _ATM_Loadlock_sw;
  57. private readonly IoSensor _N2Pressure_sw;
  58. private readonly IoSensor _VAC_sw;
  59. private readonly IoSensor _WLK_sw;
  60. private readonly IoSensor _Water_Flow;
  61. private readonly IoSensor _RFG_Interlock;
  62. private readonly IoSensor _PM_Lid_Closed;
  63. private readonly IoSensor _Source_RF_Match_Interlock;
  64. //private readonly IoSensor _PM_SlitDoor_Closed;
  65. private readonly IoSensor _TurboPumpInterlock;
  66. private readonly IoSensor _GasBoxDoor;
  67. private readonly IoSensor _GasBoxPressure;
  68. private readonly IoSensor _GasBoxN2Flow_sw;
  69. private readonly IoHighTemperatureHeater _highTemperatureHeater;
  70. private readonly F_TRIG _GasBoxN2FlowSwitchTrigger = new F_TRIG();
  71. private readonly Stopwatch _GasBoxN2FlowSwitchStopWatch = new Stopwatch();
  72. private readonly PumpBase _MainPump;
  73. private readonly AdixenTurboPump _TurboPump;
  74. private readonly PendulumValve _pendulumValve;
  75. private readonly RfPowerBase _Generator;//srf=>AdTecGenerator
  76. private readonly RfMatchBase _Match;
  77. //private readonly RfPowerBase _GeneratorBias;//brf=>CometRF
  78. //private readonly RfMatchBase _BiasMatch;
  79. //private readonly IoSignalTower _SignalTower;
  80. //private readonly IoHeater _ForelineTC;
  81. private readonly IoHeater _WallTC;
  82. private readonly IoPressureControl _pressureController;
  83. private readonly IoGasStick[] _gasLines;
  84. private readonly IoGasStick _gasLineN2;
  85. //private readonly IoBacksideHe _backsideHe;
  86. private readonly double _foreline_interlock_pressure = 750;
  87. private Stopwatch _GasRFStopWatch = new Stopwatch();
  88. private bool _GasFlag = false;
  89. //private PressureType _PressureType;
  90. private double processPressureLimit;
  91. // 盖子的状态
  92. public override bool IsLidClosed => _Lid.OFFFeedback;
  93. //public override bool IsLidLoadlockClosed => _LidLoadlock.OFFFeedback;
  94. public override bool IsSlitDoorClosed => _slitDoor.State == CylinderState.Close;
  95. public override bool IsPumpRunning => _MainPump.IsRunning;
  96. public override bool IsISOOpen => _TurboPumpPumpingValve.Status;
  97. public override bool IsTurboPumpRunning => _TurboPump.IsRunning;
  98. public override bool IsTurboPumpAtSpeed => _TurboPump.AtSpeed;
  99. public override float TurboPumpSpeed => _TurboPump.Speed;
  100. public override bool HasPumpError => _MainPump.IsError || !_MainPump.IsRunning;
  101. public override bool HasTurboPumpError => _TurboPump.IsError || !_TurboPump.IsRunning;
  102. public override bool IsCDA_OK => _CDAPressure.Value;
  103. public override bool IsFastPumpOpened => _FastPumpValve.Status;
  104. public override bool IsSoftPumpOpened => _SoftPumpValve.Status;
  105. public override bool IsMfc1ValveOpened => _Mfc1Valve.Status;
  106. public override bool IsMfc2ValveOpened => _Mfc2Valve.Status;
  107. public override bool IsMfc3ValveOpened => _Mfc3Valve.Status;
  108. public override bool IsMfc4ValveOpened => _Mfc4Valve.Status;
  109. public override bool IsMfc5ValveOpened => _Mfc5Valve.Status;
  110. public override bool IsMfc6ValveOpened => _Mfc6Valve.Status;
  111. public override bool IsMfc7ValveOpened => false;
  112. public override bool IsMfc8ValveOpened => false;
  113. public override bool IsGuageValveOpened => _GuageValve.Status;
  114. // 压力信号
  115. public override bool IsATM => _ATM_sw.Value;
  116. public override bool PVN22ValveIsOpen => _PVN22Valve.Status;
  117. public override bool LiftPinIsDown => false;
  118. public override bool LiftPinIsUp => false;
  119. //public override bool IsATMLoadlock => _ATM_Loadlock_sw.Value;
  120. //public override bool IsVACLoadLock => LoadlockPressure <= 1000;
  121. public override bool IsVAC => _VAC_sw.Value;
  122. public override bool IsWaterFlowOk => true;
  123. public override bool IsWLK => _WLK_sw.Value;
  124. public override bool IsRFGInterlockOn => _RFG_Interlock.Value;
  125. public override bool PMLidClosed => _PM_Lid_Closed.Value;
  126. public override bool TurboPumpInterlock => _TurboPumpInterlock.Value;
  127. public override bool SourceRFMatchInterlock => _Source_RF_Match_Interlock.Value;
  128. //public override bool SlitDoorClosed => _PM_SlitDoor_Closed.Value;
  129. public override double CalculationPressure
  130. {
  131. get
  132. {
  133. if (ProcessPressure < processPressureLimit)
  134. {
  135. return ProcessPressure;
  136. }
  137. else
  138. {
  139. return ChamberPressure;
  140. }
  141. }
  142. }
  143. public override double ProcessPressure => _pendulumValve.Pressure;
  144. public override double ChamberPressure => _pressureController.PressureGauge.Value;
  145. public override double ForelinePressure => _pressureController.ForelineGauge.Value;
  146. public override double TargetPressure => ChamberPressure;
  147. public override float ReflectPower => _Generator.ReflectPower;
  148. public override float ForwardPower => _Generator.ForwardPower;
  149. public override float RFMatchC1 => _Match != null ? _Match.TunePosition1 : 0;
  150. public override float RFMatchC2 => _Match != null ? _Match.TunePosition2 : 0;
  151. public override double MFC1FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas1").FeedBack;
  152. public override double MFC2FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas2").FeedBack;
  153. public override double MFC3FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas3").FeedBack;
  154. public override double MFC4FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas4").FeedBack;
  155. public override double MFC5FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas5").FeedBack;
  156. public override double MFC6FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas6").FeedBack;
  157. public override float ChamberTemperature => _highTemperatureHeater.HighTemperatureHighHeaterTemperature;
  158. public override float PendulumPressure => _pendulumValve.Pressure;
  159. public override float PendulumPosition => _pendulumValve.Position;
  160. public new ModuleName Module { get; }
  161. public override bool CheckAtm()
  162. {
  163. return _ATM_sw.Value && ChamberPressure > 700000;
  164. }
  165. public override bool CheckSlitDoorOpen()
  166. {
  167. return _slitDoor.State == CylinderState.Open;
  168. }
  169. public override bool CheckSlitDoorClose()
  170. {
  171. return _slitDoor.State == CylinderState.Close;
  172. }
  173. public override double TotalGasSetpoint
  174. {
  175. get
  176. {
  177. double sum = 0;
  178. foreach (var gas in _gasLines)
  179. {
  180. sum += gas.FlowSP;
  181. }
  182. return sum;
  183. }
  184. }
  185. public override bool HasGasOutOfRange
  186. {
  187. get
  188. {
  189. foreach (var gas in _gasLines)
  190. {
  191. if (!gas.IsOutOfRange)
  192. return false;
  193. }
  194. return true;
  195. }
  196. }
  197. public override bool PendulumValveIsOpen()
  198. {
  199. return _pendulumValve.IsOpen;
  200. }
  201. public override bool IsBiasRFAble()
  202. {
  203. return false;
  204. }
  205. #region 构造函数
  206. public JetKepler2200APM(ModuleName moduleName) : base(moduleName)
  207. {
  208. Module = moduleName;
  209. _Lid = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.Lid}");
  210. //_LidLoadlock = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.LidLoadlock}");
  211. _slitDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.SlitDoor}");
  212. //_LiftPin = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LiftPin}");
  213. //_LoadLockArm = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LoadLockArm}");
  214. _PVN21Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVN21}");
  215. _PVN22Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVN22}");
  216. _PV11Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV11}");
  217. _PV12Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV12}");
  218. _PV21Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV21}");
  219. _PV22Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV22}");
  220. _PV31Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV31}");
  221. _PV32Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV32}");
  222. _PV41Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV41}");
  223. _PV42Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV42}");
  224. _N2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveN2}");
  225. _PurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePurge}");
  226. _Mfc1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc1}");
  227. _Mfc2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  228. _Mfc3Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc3}");
  229. _Mfc4Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc4}");
  230. _Mfc5Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc5}");
  231. _Mfc6Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc6}");
  232. //_Mfc7Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc7}");
  233. //_Mfc8Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc8}");
  234. //_PVHe1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe1}");
  235. //_PVHe2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe2}");
  236. _GasFinalValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGasFinal}");
  237. _SoftPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveSoftPump}");
  238. _FastPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveFastPump}");
  239. _TurboPumpPumpingValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveTurboPumpPumping}");
  240. _TurboPumpPurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveTurboPumpPurge}");
  241. _GuageValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGuage}");
  242. //_LoadlockVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveLoadlockVent}");
  243. //_LoadlockPumpingValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveLoadlockPumping}");
  244. _ATM_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorATMSwitch");
  245. //_ATM_Loadlock_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorLoadlockATMSwitch");
  246. _N2Pressure_sw = DEVICE.GetDevice<IoSensor>($"{Module}.N2PressureOk");
  247. _VAC_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorVacSwitch");
  248. _Water_Flow = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterFlowOk");
  249. _WLK_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterLeakOk");
  250. _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
  251. _RFG_Interlock = DEVICE.GetDevice<IoSensor>($"{Module}.GeneratorInterlock");
  252. _PM_Lid_Closed = DEVICE.GetDevice<IoSensor>($"{Module}.SensorPMLidClosed");
  253. _Source_RF_Match_Interlock = DEVICE.GetDevice<IoSensor>($"{Module}.RFMatchInterlock");
  254. //_PM_SlitDoor_Closed = DEVICE.GetDevice<IoSensor>($"{Module}.SensorSlitDoorClosed");
  255. _TurboPumpInterlock = DEVICE.GetDevice<IoSensor>($"{Module}.TurboPumpInterlock");
  256. _GasBoxDoor = DEVICE.GetDevice<IoSensor>($"{Module}.GasBoxDoorSW");
  257. _GasBoxPressure = DEVICE.GetDevice<IoSensor>($"{Module}.GasBoxPressureSW");
  258. _GasBoxN2Flow_sw = DEVICE.GetDevice<IoSensor>($"{Module}.GasBoxN2FlowSwitch");
  259. //_ForelineTC = DEVICE.GetDevice<IoHeater>($"{Module}.ForelineHeater");
  260. _WallTC = DEVICE.GetDevice<IoHeater>($"{Module}.WallHeater");
  261. //_SignalTower = DEVICE.GetDevice<IoSignalTower>($"{Module}.SignalTower");
  262. _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
  263. _pressureController = DEVICE.GetDevice<IoPressureControl>($"{Module}.{VenusDevice.PressureControl}");
  264. _gasLines = new IoGasStick[8];
  265. for (int index = 0; index < 8; index++)
  266. {
  267. _gasLines[index] = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStick{index + 1}");
  268. }
  269. _gasLineN2 = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStickN2");
  270. //_backsideHe = DEVICE.GetDevice<IoBacksideHe>($"{Module}.BacksideHelium");
  271. _highTemperatureHeater = DEVICE.GetDevice<IoHighTemperatureHeater>($"{Module}.HighTemperatureHeater");
  272. _MainPump = DEVICE.GetDevice<PumpBase>($"{Module}.{VenusDevice.MainPump}");
  273. // RS232 Dry pump, SKY
  274. if (SC.GetValue<int>($"{Module}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  275. {
  276. if (SC.GetValue<int>($"{Module}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  277. {
  278. _MainPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VenusDevice.MainPump}");
  279. }
  280. else if (SC.GetValue<int>($"{Module}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  281. {
  282. _MainPump = DEVICE.GetDevice<EdwardsPump>($"{Module}.{VenusDevice.MainPump}");
  283. }
  284. }
  285. //_ESCHV = DEVICE.GetDevice<ESC5HighVoltage>($"{Module}.{VenusDevice.ESCHV}");
  286. _TurboPump = DEVICE.GetDevice<AdixenTurboPump>($"{Module}.{VenusDevice.TurboPump}");
  287. _pendulumValve = DEVICE.GetDevice<PendulumValve>($"{Module}.{VenusDevice.PendulumValve}");
  288. //if (SC.GetValue<bool>($"{Module}.Chiller.EnableChiller") &&
  289. // SC.GetValue<int>($"{Module}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  290. //{
  291. // if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.SMC)
  292. // {
  293. // _Chiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VenusDevice.Chiller}");
  294. // }
  295. // else if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  296. // {
  297. // _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");
  298. // }
  299. //}
  300. // RS223 AdTec Generator
  301. if (SC.GetValue<int>($"{Module}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  302. SC.GetValue<int>($"{Module}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  303. {
  304. _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.Rf}");
  305. }
  306. // Ethernet Comet Generator Bias
  307. //if (SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF"))
  308. //{
  309. // if (SC.GetValue<int>($"{Module}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  310. // SC.GetValue<int>($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  311. // {
  312. // _GeneratorBias = DEVICE.GetDevice<CometRF>($"{Module}.{VenusDevice.BiasRf}");
  313. // }
  314. // else if (SC.GetValue<int>($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  315. // {
  316. // _GeneratorBias = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.BiasRf}");
  317. // }
  318. //}
  319. if (SC.GetValue<int>($"{Module}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  320. SC.GetValue<int>($"{Module}.Match.MFG") == (int)MatchMFG.AdTec)
  321. {
  322. _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.Match}");
  323. }
  324. else if (
  325. SC.GetValue<int>($"{Module}.Match.MFG") == (int)MatchMFG.Revtech)
  326. {
  327. _Match = DEVICE.GetDevice<RevtechMatch>($"{Module}.{VenusDevice.Match}");
  328. }
  329. //if (SC.GetValue<bool>($"{Module}.BiasMatch.EnableBiasMatch") &&
  330. // SC.GetValue<int>($"{Module}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  331. // SC.GetValue<int>($"{Module}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  332. //{
  333. // _BiasMatch = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.BiasMatch}");
  334. //}
  335. //else if (SC.GetValue<bool>($"{Module}.BiasMatch.EnableBiasMatch") &&
  336. // SC.GetValue<int>($"{Module}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  337. //{
  338. // _BiasMatch = DEVICE.GetDevice<RevtechMatch>($"{Module}.{VenusDevice.BiasMatch}");
  339. //}
  340. _foreline_interlock_pressure = SC.GetValue<int>($"{Module}.PendulumValve.ForelinePressureLimit");
  341. _GasRFStopWatch.Stop();
  342. processPressureLimit = ConvertPressureUnit.ConvertmTorrToPa(1950);
  343. _GasBoxN2FlowSwitchStopWatch.Start();
  344. //_PressureType = (PressureType)SC.GetValue<int>("System.PressureUnitType");
  345. //DATA.Subscribe($"{Name}.SCR1", () => GetAiValue($"{Module}.AI_CHB_M-HT_SCR1_PWR_OUT"));
  346. //DATA.Subscribe($"{Name}.SCR2", () => GetAiValue($"{Module}.AI_CHB_M-HT_SCR2_PWR_OUT"));
  347. //DATA.Subscribe($"{Name}.AI_CHB_M-HT_Reference_Power_Output", () => GetAiValue($"{Module}.AI_CHB_M-HT_Reference_Power_Output"));
  348. //DATA.Subscribe($"{Name}.AI_CHB_M-HT_Max_Power", () => GetAiValue($"{Module}.AI_CHB_M-HT_Max_Power"));
  349. //DATA.Subscribe($"{Name}.AI_CHB_M-HT_Min_Power", () => GetAiValue($"{Module}.AI_CHB_M-HT_Min_Power"));
  350. //DATA.Subscribe($"{Name}.AI_CHB_M-HT_Current_Speed", () => GetAiValue($"{Module}.AI_CHB_M-HT_Current_Speed"));
  351. }
  352. #endregion
  353. public async override void CloseValves(int? delayTime = null)
  354. {
  355. _PVN21Valve.TurnValve(false, out _);
  356. // _PVN22Valve.TurnValve(false, out _);
  357. _PV11Valve.TurnValve(false, out _);
  358. _PV12Valve.TurnValve(false, out _);
  359. _PV21Valve.TurnValve(false, out _);
  360. _PV22Valve.TurnValve(false, out _);
  361. _PV31Valve.TurnValve(false, out _);
  362. _PV32Valve.TurnValve(false, out _);
  363. _PV41Valve.TurnValve(false, out _);
  364. _PV42Valve.TurnValve(false, out _);
  365. //_PVHe1Valve.TurnValve(false, out _);
  366. //_PVHe2Valve.TurnValve(false, out _);
  367. _SoftPumpValve.TurnValve(false, out _);
  368. _FastPumpValve.TurnValve(false, out _);
  369. _TurboPumpPumpingValve.TurnValve(false, out _);
  370. _TurboPumpPurgeValve.TurnValve(false, out _);
  371. _GuageValve.TurnValve(false, out _);
  372. _N2Valve.TurnValve(false, out _);
  373. _FastPumpValve.TurnValve(false, out _);
  374. _Mfc1Valve.TurnValve(false, out _);
  375. _Mfc2Valve.TurnValve(false, out _);
  376. _Mfc3Valve.TurnValve(false, out _);
  377. _Mfc4Valve.TurnValve(false, out _);
  378. _Mfc5Valve.TurnValve(false, out _);
  379. _Mfc6Valve.TurnValve(false, out _);
  380. //_Mfc7Valve.TurnValve(false, out _);
  381. //_Mfc8Valve.TurnValve(false, out _);
  382. foreach (var stick in _gasLines)
  383. {
  384. stick.Stop();
  385. }
  386. if (delayTime != null)
  387. {
  388. await Task.Delay((int)delayTime);
  389. }
  390. _GasFinalValve.TurnValve(false, out _);
  391. _PurgeValve.TurnValve(false, out _);
  392. }
  393. public override void TurnDryPump(bool on)
  394. {
  395. //_pressureController.StartPump(on);
  396. _MainPump?.SetPumpOnOff(on);
  397. }
  398. public override void TurnTurboPump(bool on)
  399. {
  400. _TurboPump?.SetPumpOnOff(on);
  401. }
  402. public override void OpenValve(ValveType vlvType, bool on)
  403. {
  404. switch (vlvType)
  405. {
  406. case ValveType.PVN21:
  407. _PVN21Valve.TurnValve(on, out _);
  408. break;
  409. case ValveType.PVN22:
  410. _PVN22Valve.TurnValve(on, out _);
  411. break;
  412. case ValveType.PV11:
  413. _PV11Valve.TurnValve(on, out _);
  414. break;
  415. case ValveType.PV12:
  416. _PV12Valve.TurnValve(on, out _);
  417. break;
  418. case ValveType.PV21:
  419. _PV21Valve.TurnValve(on, out _);
  420. break;
  421. case ValveType.PV22:
  422. _PV22Valve.TurnValve(on, out _);
  423. break;
  424. case ValveType.PV31:
  425. _PV31Valve.TurnValve(on, out _);
  426. break;
  427. case ValveType.PV32:
  428. _PV32Valve.TurnValve(on, out _);
  429. break;
  430. case ValveType.PV41:
  431. _PV41Valve.TurnValve(on, out _);
  432. break;
  433. case ValveType.PV42:
  434. _PV42Valve.TurnValve(on, out _);
  435. break;
  436. case ValveType.N2:
  437. _N2Valve.TurnValve(on, out _);
  438. break;
  439. case ValveType.Purge:
  440. _PurgeValve.TurnValve(on, out _);
  441. break;
  442. case ValveType.GasFinal:
  443. _GasFinalValve.TurnValve(on, out _);
  444. break;
  445. case ValveType.SoftPump:
  446. _SoftPumpValve.TurnValve(on, out _);
  447. break;
  448. case ValveType.FastPump:
  449. _FastPumpValve.TurnValve(on, out _);
  450. break;
  451. case ValveType.TurboPumpPumping:
  452. _TurboPumpPumpingValve.TurnValve(on, out _);
  453. break;
  454. case ValveType.TurboPumpPurge:
  455. _TurboPumpPurgeValve.TurnValve(on, out _);
  456. break;
  457. case ValveType.Guage:
  458. _GuageValve.TurnValve(on, out _);
  459. break;
  460. //case ValveType.LoadlockVent:
  461. // _LoadlockVentValve.TurnValve(on, out _);
  462. // break;
  463. //case ValveType.LoadlockPumping:
  464. // _LoadlockPumpingValve.TurnValve(on, out _);
  465. // break;
  466. case ValveType.Mfc1:
  467. _Mfc1Valve.TurnValve(on, out _);
  468. break;
  469. case ValveType.Mfc2:
  470. _Mfc2Valve.TurnValve(on, out _);
  471. break;
  472. case ValveType.Mfc3:
  473. _Mfc3Valve.TurnValve(on, out _);
  474. break;
  475. case ValveType.Mfc4:
  476. _Mfc4Valve.TurnValve(on, out _);
  477. break;
  478. case ValveType.Mfc5:
  479. _Mfc5Valve.TurnValve(on, out _);
  480. break;
  481. case ValveType.Mfc6:
  482. _Mfc6Valve.TurnValve(on, out _);
  483. break;
  484. //case ValveType.Mfc7:
  485. // _Mfc7Valve.TurnValve(on, out _);
  486. // break;
  487. //case ValveType.Mfc8:
  488. // _Mfc8Valve.TurnValve(on, out _);
  489. // break;
  490. //default:
  491. // throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}");
  492. }
  493. }
  494. public override void Monitor()
  495. {
  496. foreach (var gas in _gasLines)
  497. {
  498. gas.Monitor();
  499. }
  500. CheckPermanentInterlock();
  501. if (_GasBoxN2FlowSwitchStopWatch.ElapsedMilliseconds > 10 * 1000)
  502. {
  503. _GasBoxN2FlowSwitchStopWatch.Stop();
  504. CheckHighTemperatureHeaterInterlock();
  505. }
  506. }
  507. private void CheckHighTemperatureHeaterInterlock()
  508. {
  509. _GasBoxN2FlowSwitchTrigger.CLK = _GasBoxN2Flow_sw.Value;
  510. if (_GasBoxN2FlowSwitchTrigger.Q)
  511. {
  512. var limitTemperature = SC.GetValue<double>($"{Module}.HighTemperatureHeater.N2WarningTemperatureLimit");
  513. SetHighTemperatureHeaterTemperature((int)limitTemperature);
  514. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Gas Box N2 Flow Trigger Warning,HighTemperatureHeater Cool Down to {limitTemperature} ℃");
  515. }
  516. }
  517. protected override void CheckPermanentInterlock()
  518. {
  519. if (ChamberPressure >= processPressureLimit && _GuageValve.SetPoint)
  520. {
  521. _GuageValve.TurnValve(false, out _);
  522. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ChamberPressure} exceed {processPressureLimit} Pa, Guage Valve (DO-31) closed automaticlly.");
  523. }
  524. if (ChamberPressure < processPressureLimit && !_GuageValve.SetPoint)
  525. {
  526. _GuageValve.TurnValve(true, out _);
  527. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ChamberPressure} less than {processPressureLimit} Pa, Guage Valve (DO-31) open automaticlly.");
  528. }
  529. }
  530. public override void CheckIdleInterlock()
  531. {
  532. if (ForelinePressure > _foreline_interlock_pressure)
  533. {
  534. if (_TurboPumpPumpingValve.SetPoint || _TurboPumpPurgeValve.SetPoint || _pendulumValve.IsOpen)
  535. {
  536. _pendulumValve.TurnValve(false);
  537. _TurboPumpPurgeValve.TurnValve(false, out _);
  538. _TurboPumpPumpingValve.TurnValve(false, out _);
  539. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Foreline pressure:{ForelinePressure} exceed {_foreline_interlock_pressure} Pa, Pendulum valve & PV6 & PV7 closed automaticlly.");
  540. }
  541. }
  542. }
  543. public override void Home()
  544. {
  545. //2023/03/08添加
  546. OpenValve(ValveType.PVN22, true);
  547. _Generator?.ReConnect();
  548. _Match?.ReConnect();
  549. _MainPump?.ReConnect();
  550. _TurboPump?.ReConnect();
  551. _pendulumValve?.ReConnect();
  552. }
  553. public override bool FlowGas(int gasNum, double val)
  554. {
  555. if (_gasLines.Length <= gasNum)
  556. return false;
  557. //double value = (val / _gasLines[gasNum]._mfc.Scale) * 100;
  558. //double setPoint =Math.Round( value / 8000 * _gasLines[gasNum]._mfc.Scale,2);
  559. _gasLines[gasNum].Flow(val);
  560. return true;
  561. }
  562. public override bool StopGas(int gasNum)
  563. {
  564. if (_gasLines.Length <= gasNum)
  565. return false;
  566. _gasLines[gasNum].Stop();
  567. return true;
  568. }
  569. public override bool FlowN2(double val)
  570. {
  571. _gasLineN2.Flow(val);
  572. return true;
  573. }
  574. public override bool StopN2()
  575. {
  576. _gasLineN2.Stop();
  577. return true;
  578. }
  579. public override void StopAllGases()
  580. {
  581. foreach (var line in _gasLines)
  582. {
  583. line.Stop();
  584. }
  585. }
  586. public override bool TurnPendulumValve(bool on)
  587. {
  588. return _pendulumValve.TurnValve(on);
  589. }
  590. public override bool SetPVPressure(float pressure)
  591. {
  592. return _pendulumValve.SetPressure(pressure);
  593. }
  594. public override bool SetPVPostion(float position)
  595. {
  596. return _pendulumValve.SetPosition(position);
  597. }
  598. public override float GetPVPosition()
  599. {
  600. return _pendulumValve.Position;
  601. }
  602. public override void SetGeneratorCommunicationMode(int mode)
  603. {
  604. _Generator?.SetCommunicationMode(mode);
  605. }
  606. public override bool GeneratorPowerOn(bool on)
  607. {
  608. if (_Generator == null) return false;
  609. if (on && !IsRFGInterlockOn)
  610. {
  611. LOG.Write(eEvent.ERR_RF, Module, "射频电源 Interlock条件不满足");
  612. return false;
  613. }
  614. return _Generator.SetPowerOnOff(on, out _);
  615. }
  616. public override bool GeneratorSetpower(float val)
  617. {
  618. if (_Generator == null) return false;
  619. if (Math.Abs(val) > 0.01)
  620. _Generator.SetPower((ushort)val);
  621. return true;
  622. }
  623. public override bool SetWallTCTemperature(float value)
  624. {
  625. return _WallTC.RampTemp(value);
  626. }
  627. public override bool SetMatchPosition(float c1, float c2)
  628. {
  629. if (_Match == null) return false;
  630. string reason = string.Empty;
  631. _Match.SetMatchPosition(c1, c2, out reason);
  632. return true;
  633. }
  634. public override bool SetMatchWorkMode(MatchWorkMode matchWorkMode)
  635. {
  636. if (_Match == null) return false;
  637. if (matchWorkMode == MatchWorkMode.Auto)
  638. {
  639. return _Match.SetMatchMode(EnumRfMatchTuneMode.Auto, out _);
  640. }
  641. else if (matchWorkMode == MatchWorkMode.Manual)
  642. {
  643. return _Match.SetMatchMode(EnumRfMatchTuneMode.Manual, out _);
  644. }
  645. return false;
  646. }
  647. public override bool CheckGeneratorAndHVInterlock(VenusDevice device)
  648. {
  649. eEvent evt = device == VenusDevice.Rf ? eEvent.ERR_RF : eEvent.ERR_ESC_HV;
  650. if (!PMLidClosed)
  651. {
  652. LOG.Write(evt, Module, $"Cannot Power ON {device} as PM Lid is Open.");
  653. return false;
  654. }
  655. if (!IsVAC)
  656. {
  657. LOG.Write(evt, Module, $"Cannot Power ON {device} as PM is not Vacuum.");
  658. return false;
  659. }
  660. if (!IsWaterFlowOk)
  661. {
  662. LOG.Write(evt, Module, $"Cannot Power ON {device} as Water Flow is OFF.");
  663. return false;
  664. }
  665. if (!IsRFGInterlockOn)
  666. {
  667. LOG.Write(evt, Module, $"Cannot Power ON {device} as Generator Interlock is OFF.");
  668. return false;
  669. }
  670. if (!SlitDoorClosed)
  671. {
  672. LOG.Write(evt, Module, $"Cannot Power ON {device} as Slit Door is open.");
  673. return false;
  674. }
  675. return true;
  676. }
  677. public override bool StartControlPressure(int pressureSetpoint, int flowSetpoint)
  678. {
  679. OpenValve(ValveType.Purge, true);
  680. OpenValve(ValveType.N2, true);
  681. OpenValve(ValveType.PVN22, true);
  682. OpenValve(ValveType.GasFinal, false);
  683. OpenValve(ValveType.TurboPumpPumping, true);
  684. TurnPendulumValve(true);
  685. SetPVPressure(pressureSetpoint);
  686. return true;
  687. }
  688. public async override void AbortControlPressure()
  689. {
  690. OpenValve(ValveType.N2, false);
  691. //OpenValve(ValveType.PVN22, false);
  692. //SetPVPressure(0);
  693. SetPVPostion(1000);
  694. await Task.Delay(500);
  695. OpenValve(ValveType.Purge, false);
  696. //return true;
  697. }
  698. public override bool HighTemperatureHeaterGotoPosition(HighTemperatureHeaterPosition highTemperatureHeaterPosition)
  699. {
  700. return _highTemperatureHeater.GotoPosition(highTemperatureHeaterPosition);
  701. }
  702. public override bool SetHighTemperatureHeaterTemperature(int temperature)
  703. {
  704. _highTemperatureHeater.HighTemperatureHighHeaterTemperature = temperature;
  705. return true;
  706. }
  707. public override bool SetHighTemperatureHeaterRatio(int ratio)
  708. {
  709. _highTemperatureHeater.HighTemperatureHeaterRatio = ratio;
  710. return true;
  711. }
  712. public override bool PreparePlace()
  713. {
  714. //if (!SetSlitDoor(true, out string reason))
  715. //{
  716. // LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
  717. // return false;
  718. //}
  719. return _highTemperatureHeater.GotoPosition(HighTemperatureHeaterPosition.Position1);
  720. }
  721. public override bool PreparePick()
  722. {
  723. //if (!SetSlitDoor(true, out string reason))
  724. //{
  725. // LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
  726. // return false;
  727. //}
  728. return _highTemperatureHeater.GotoPosition(HighTemperatureHeaterPosition.Position1);
  729. }
  730. public override bool PreparePlaceIsOK()
  731. {
  732. return _highTemperatureHeater.CurrentPosition == HighTemperatureHeaterPosition.Position1;
  733. }
  734. public override bool PreparePickIsOK()
  735. {
  736. return _highTemperatureHeater.CurrentPosition == HighTemperatureHeaterPosition.Position1;
  737. }
  738. public override bool EndPlace()
  739. {
  740. //if (!SetSlitDoor(false, out string reason))
  741. //{
  742. // LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  743. // return false;
  744. //}
  745. if (!_highTemperatureHeater.GotoPosition(HighTemperatureHeaterPosition.Position2))
  746. {
  747. LOG.Write(eEvent.ERR_PM, Module, $"Set High Temperature Heater To Posotion2 failed");
  748. return false;
  749. }
  750. return true;
  751. }
  752. public override bool EndPick()
  753. {
  754. //if (!SetSlitDoor(false, out string reason))
  755. //{
  756. // LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  757. // return false;
  758. //}
  759. return true;
  760. }
  761. public override bool EndPlaceIsOK()
  762. {
  763. return _highTemperatureHeater.CurrentPosition == HighTemperatureHeaterPosition.Position2;
  764. }
  765. public override bool EndPickIsOK()
  766. {
  767. return CheckSlitDoorClose();
  768. }
  769. public override void RTCloseEvent()
  770. {
  771. if (_Generator.IsPowerOn)
  772. {
  773. GeneratorPowerOn(false);
  774. }
  775. if (PendulumValveIsOpen())
  776. {
  777. TurnPendulumValve(false);
  778. }
  779. }
  780. public override bool RFInterlock(VenusDevice device)
  781. {
  782. eEvent evt = eEvent.ERR_RF;
  783. if (!IsWaterFlowOk)
  784. {
  785. LOG.Write(evt, Module, $"Cannot Power ON {device} as Water Flow is OFF.");
  786. return false;
  787. }
  788. if (!IsRFGInterlockOn)
  789. {
  790. LOG.Write(evt, Module, $"Cannot Power ON {device} as Generator Interlock is OFF.");
  791. return false;
  792. }
  793. if (GasIsOff())
  794. {
  795. LOG.Write(evt, Module, $"Cannot Power ON {device} as Gas is OFF.");
  796. return false;
  797. }
  798. return true;
  799. }
  800. private bool GasIsOff()
  801. {
  802. if ((IsMfc1ValveOpened == false && IsMfc2ValveOpened == false && IsMfc3ValveOpened == false && IsMfc4ValveOpened == false && IsMfc5ValveOpened == false && IsMfc6ValveOpened == false && _GasFlag == false) || (MFC1FeedBack < 1 && MFC2FeedBack < 1 && MFC3FeedBack < 1 && MFC4FeedBack < 1 && MFC5FeedBack < 1 && MFC6FeedBack < 1 && _GasFlag == false))
  803. {
  804. if (_GasRFStopWatch.IsRunning == false)
  805. {
  806. _GasRFStopWatch.Start();
  807. }
  808. if (_GasRFStopWatch.ElapsedMilliseconds > 1500 && _GasRFStopWatch.ElapsedMilliseconds < 2500)
  809. {
  810. //var item = _GasRFStopWatch.ElapsedMilliseconds;
  811. _GasRFStopWatch.Reset();
  812. _GasFlag = true;
  813. return true;
  814. }
  815. }
  816. else
  817. {
  818. _GasRFStopWatch.Reset();
  819. _GasFlag = false;
  820. }
  821. return false;
  822. }
  823. public override void PMInError()
  824. {
  825. CloseValves();
  826. GeneratorPowerOn(false);
  827. GeneratorBiasPowerOn(false);
  828. OpenValve(ValveType.TurboPumpPumping, true);
  829. OpenValve(ValveType.TurboPumpPurge, true);
  830. }
  831. }
  832. }