JetKepler2200APM.cs 41 KB

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