JetKepler2200APM.cs 39 KB

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