JetKepler2200BPM.cs 40 KB

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