JetVenusDEPM.cs 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.Device.Unit;
  5. using Aitex.Core.RT.Log;
  6. using Aitex.Core.RT.OperationCenter;
  7. using Aitex.Core.RT.SCCore;
  8. using Aitex.Core.UI.Control;
  9. using Aitex.Core.Util;
  10. using MECF.Framework.Common.Device.Bases;
  11. using MECF.Framework.Common.Equipment;
  12. using MECF.Framework.Common.SubstrateTrackings;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Threading.Tasks;
  18. using System.Windows.Media;
  19. using Venus_Core;
  20. using Venus_RT.Devices.IODevices;
  21. using Venus_RT.Modules;
  22. using IoMfc = Venus_RT.Devices.IODevices.IoMfc;
  23. namespace Venus_RT.Devices
  24. {
  25. class JetVenusDEPM : JetPMBase
  26. {
  27. #region io变量定义
  28. private readonly IoLid _Lid;
  29. private readonly IoCylinder _linerDoor;
  30. private readonly IoCylinder _LiftPin;
  31. private readonly IoValve _PVN21Valve;
  32. private readonly IoValve _PVN22Valve;
  33. private readonly IoValve _PV11Valve;
  34. private readonly IoValve _PV12Valve;
  35. private readonly IoValve _PV21Valve;
  36. private readonly IoValve _PV22Valve;
  37. private readonly IoValve _PV31Valve;
  38. private readonly IoValve _PV32Valve;
  39. private readonly IoValve _PV41Valve;
  40. private readonly IoValve _PV42Valve;
  41. private readonly IoValve _PV51Valve;//新增
  42. private readonly IoValve _PV52Valve;//新增
  43. private readonly IoValve _PV61Valve;//新增
  44. private readonly IoValve _PV62Valve;//新增
  45. private readonly IoValve _PV71Valve;//新增
  46. private readonly IoValve _PV72Valve;//新增
  47. private readonly IoValve _PV81Valve;//新增
  48. private readonly IoValve _PV82Valve;//新增
  49. private readonly IoValve _PV91Valve;//新增
  50. private readonly IoValve _PV92Valve;//新增
  51. private readonly IoValve _PVA1Valve;//新增
  52. private readonly IoValve _PVA2Valve;//新增
  53. private readonly IoValve _PVB1Valve;//新增
  54. private readonly IoValve _PVB2Valve;//新增
  55. private readonly IoValve _PVC1Valve;//新增
  56. private readonly IoValve _PVC2Valve;//新增
  57. private readonly IoValve _N2Valve;
  58. private readonly IoValve _Mfc1Valve;
  59. private readonly IoValve _Mfc2Valve;
  60. private readonly IoValve _Mfc3Valve;
  61. private readonly IoValve _Mfc4Valve;
  62. private readonly IoValve _Mfc5Valve;
  63. private readonly IoValve _Mfc6Valve;
  64. private readonly IoValve _Mfc7Valve;
  65. private readonly IoValve _Mfc8Valve;
  66. private readonly IoValve _Mfc9Valve; //新增
  67. private readonly IoValve _Mfc10Valve;//新增
  68. private readonly IoValve _Mfc11Valve;//新增 空的
  69. private readonly IoValve _Mfc12Valve;//新增
  70. private readonly IoValve _PVHe1Valve;
  71. private readonly IoValve _PVHe2Valve;
  72. private readonly IoValve _GasFinalValve;
  73. //private readonly IoValve _SoftPumpValve;
  74. private readonly IoValve _FastPumpValve;
  75. private readonly IoValve _TurboPumpPumpingValve;
  76. private readonly IoValve _TurboPumpPurgeValve;
  77. private readonly IoValve _GuageValve;
  78. private readonly IoValve _PVHe3Valve;
  79. private readonly IoValve _HeISOValve;
  80. private readonly IoValve _MainPurgeValve;//新增
  81. private readonly IoValve _SecondPurgeValve;//新增
  82. private readonly IoValve _PurgeValve;
  83. private readonly IoSensor _ATM_sw;
  84. private readonly IoSensor _CDAPressure;
  85. private readonly IoSensor _N2Pressure_sw;
  86. private readonly IoSensor _VAC_sw;
  87. private readonly IoSensor _WLK_sw;
  88. private readonly IoSensor _Water_Flow;
  89. private readonly IoSensor _RFG_Interlock;
  90. private readonly IoSensor _PM_Lid_Closed;
  91. private readonly IoSensor _Source_RF_Fan;
  92. private readonly IoSensor _TurboPumpInterlock;
  93. private readonly IoSensor _GasBoxDoor;
  94. private readonly IoSensor _GasBoxPressure;
  95. private readonly IoSensor _PM_LinerDoor_Closed;
  96. private readonly PumpBase _MainPump;
  97. private readonly ESC5HighVoltage _ESCHV;
  98. private readonly AdixenTurboPump _TurboPump;
  99. private readonly PendulumValve _pendulumValve;
  100. private readonly ChillerBase _Chiller;
  101. private readonly RfPowerBase _Generator;//srf=>AdTecGenerator
  102. private readonly RfPowerBase _GeneratorBias;//brf=>CometRF
  103. private readonly RfMatchBase _Match;
  104. private readonly RfMatchBase _BiasMatch;
  105. private readonly IoHeater _ForelineTC;
  106. private readonly IoHeater _WallTC;
  107. private readonly IoPressureControl _pressureController;
  108. private readonly IoGasStick[] _gasLines;
  109. private readonly IoGasStick _gasLineN2;
  110. private readonly IoBacksideHe _backsideHe;
  111. private readonly IoMagnet _Magnet;
  112. private readonly IoMfc _heMfc;
  113. private readonly double _foreline_interlock_pressure = 750;
  114. private readonly Dictionary<ValveType, IoValve> Valve2IO;
  115. #endregion
  116. #region 构造函数
  117. public JetVenusDEPM(ModuleName moduleName) : base(moduleName)
  118. {
  119. Module = moduleName;
  120. _Lid = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.Lid}");
  121. _LiftPin = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LiftPin}");
  122. _linerDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LinerDoor}");
  123. _PVN21Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVN21}");
  124. _PVN22Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVN22}");
  125. _PV11Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV11}");
  126. _PV12Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV12}");
  127. _PV21Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV21}");
  128. _PV22Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV22}");
  129. _PV31Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV31}");
  130. _PV32Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV32}");
  131. _PV41Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV41}");
  132. _PV42Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV42}");
  133. _PV51Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV51}");
  134. _PV52Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV52}");
  135. _PV61Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV61}");
  136. _PV62Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV62}");
  137. _PV71Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV71}");
  138. _PV72Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV72}");
  139. _PV81Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV81}");
  140. _PV82Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV82}");
  141. _PV91Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV91}");
  142. _PV92Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV92}");
  143. _PVA1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVA1}");
  144. _PVA2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVA2}");
  145. _PVB1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVB1}");
  146. _PVB2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVB2}");
  147. _PVC1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVC1}");
  148. _PVC2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVC2}");
  149. _PM_LinerDoor_Closed = DEVICE.GetDevice<IoSensor>($"{Module}.SensorLinerDoorClosed");
  150. _N2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveN2}");
  151. _Mfc1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc1}");
  152. _Mfc2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  153. _Mfc3Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc3}");
  154. _Mfc4Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc4}");
  155. _Mfc5Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc5}");
  156. _Mfc6Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc6}");
  157. _Mfc7Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc7}");
  158. _Mfc8Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc8}");
  159. _Mfc9Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc9}");
  160. _Mfc10Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc10}");
  161. _Mfc11Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc11}");
  162. _Mfc12Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc12}");
  163. _PVHe1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe1}");
  164. _PVHe2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe2}");
  165. _GasFinalValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGasFinal}");
  166. _PurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePurge}");
  167. //_SoftPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveSoftPump}");
  168. _FastPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveFastPump}");
  169. _TurboPumpPumpingValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveTurboPumpPumping}");
  170. _TurboPumpPurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveTurboPumpPurge}");
  171. _GuageValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGuage}");
  172. _PVHe3Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe3}");
  173. _HeISOValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveHeISO}");
  174. _SecondPurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveSecondPurge}");
  175. _ATM_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorATMSwitch");
  176. _N2Pressure_sw = DEVICE.GetDevice<IoSensor>($"{Module}.N2PressureOk");
  177. _MainPurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMainPurge}");
  178. _VAC_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorVacSwitch");
  179. _Water_Flow = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterFlowOk");
  180. _WLK_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterLeakOk");
  181. _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
  182. _RFG_Interlock = DEVICE.GetDevice<IoSensor>($"{Module}.GeneratorInterlock");
  183. _PM_Lid_Closed = DEVICE.GetDevice<IoSensor>($"{Module}.SensorPMLidClosed");
  184. //_Source_RF_Fan = DEVICE.GetDevice<IoSensor>($"{Module}.SensorSourceRFFan");
  185. _TurboPumpInterlock = DEVICE.GetDevice<IoSensor>($"{Module}.TurboPumpInterlock");
  186. _GasBoxDoor = DEVICE.GetDevice<IoSensor>($"{Module}.GasBoxDoorSW");
  187. _GasBoxPressure = DEVICE.GetDevice<IoSensor>($"{Module}.GasBoxPressureSW");
  188. _ForelineTC = DEVICE.GetDevice<IoHeater>($"{Module}.ForelineHeater");
  189. _WallTC = DEVICE.GetDevice<IoHeater>($"{Module}.WallHeater");
  190. _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
  191. _pressureController = DEVICE.GetDevice<IoPressureControl>($"{Module}.{VenusDevice.PressureControl}");
  192. _gasLines = new IoGasStick[12];
  193. for (int index = 0; index < 12; index++)
  194. {
  195. _gasLines[index] = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStick{index + 1}");
  196. }
  197. _gasLineN2 = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStickN2");
  198. _backsideHe = DEVICE.GetDevice<IoBacksideHe>($"{Module}.BacksideHelium");
  199. _MainPump = DEVICE.GetDevice<PumpBase>($"{Module}.{VenusDevice.MainPump}");
  200. // RS232 Dry pump, SKY
  201. if (SC.GetValue<int>($"{Module}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  202. {
  203. if (SC.GetValue<int>($"{Module}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  204. {
  205. _MainPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VenusDevice.MainPump}");
  206. }
  207. else if (SC.GetValue<int>($"{Module}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  208. {
  209. _MainPump = DEVICE.GetDevice<EdwardsPump>($"{Module}.{VenusDevice.MainPump}");
  210. }
  211. }
  212. _ESCHV = DEVICE.GetDevice<ESC5HighVoltage>($"{Module}.{VenusDevice.ESCHV}");
  213. _TurboPump = DEVICE.GetDevice<AdixenTurboPump>($"{Module}.{VenusDevice.TurboPump}");
  214. _pendulumValve = DEVICE.GetDevice<PendulumValve>($"{Module}.{VenusDevice.PendulumValve}");
  215. if (SC.GetValue<bool>($"{Module}.Chiller.EnableChiller") &&
  216. SC.GetValue<int>($"{Module}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  217. {
  218. if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.SMC)
  219. {
  220. _Chiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VenusDevice.Chiller}");
  221. }
  222. else if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  223. {
  224. _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");
  225. }
  226. }
  227. else
  228. if (SC.GetValue<bool>($"{Module}.Chiller.EnableChiller") &&
  229. SC.GetValue<int>($"{Module}.Chiller.CommunicationType") == (int)CommunicationType.RS485 &&
  230. SC.GetValue<bool>($"{Module}.Chiller.ShareCOM"))
  231. {
  232. if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.SMC)
  233. {
  234. _Chiller = DEVICE.GetDevice<SMCShareChiller>($"{Module}.{VenusDevice.Chiller}");
  235. }
  236. else if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  237. {
  238. _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");
  239. }
  240. }
  241. // RS232 AdTec Generator
  242. if (SC.GetValue<int>($"{Module}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  243. SC.GetValue<int>($"{Module}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  244. {
  245. _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.Rf}");
  246. }
  247. // Ethernet & RS232 Generator Bias
  248. if (SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF"))
  249. {
  250. if (SC.GetValue<int>($"{Module}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  251. SC.GetValue<int>($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  252. {
  253. _GeneratorBias = DEVICE.GetDevice<CometRF>($"{Module}.{VenusDevice.BiasRf}");
  254. }
  255. else if (SC.GetValue<int>($"{Module}.Rf.CommunicationType") == (int)CommunicationType.RS232 && SC.GetValue<int>($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  256. {
  257. _GeneratorBias = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.BiasRf}");
  258. }
  259. else if (SC.GetValue<int>($"{Module}.Rf.CommunicationType") == (int)CommunicationType.RS232 && SC.GetValue<int>($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.Truplasma)
  260. {
  261. _GeneratorBias = DEVICE.GetDevice<TruPlasmaRF>($"{Module}.{VenusDevice.BiasRf}");
  262. }
  263. }
  264. // RS232 AdTec match
  265. if (SC.GetValue<int>($"{Module}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  266. SC.GetValue<int>($"{Module}.Match.MFG") == (int)MatchMFG.AdTec)
  267. {
  268. _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.Match}");
  269. }
  270. else if (SC.GetValue<int>($"{Module}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  271. SC.GetValue<int>($"{Module}.Match.MFG") == (int)MatchMFG.Tru)
  272. {
  273. _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.Match}");
  274. }
  275. // Bias Match
  276. if (SC.GetValue<bool>($"{Module}.BiasMatch.EnableBiasMatch") &&
  277. SC.GetValue<int>($"{Module}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  278. SC.GetValue<int>($"{Module}.BiasMatch.MFG") == (int)MatchMFG.Tru)
  279. {
  280. _BiasMatch = DEVICE.GetDevice<TruPlasmaMatch>($"{Module}.{VenusDevice.BiasMatch}");
  281. }
  282. _foreline_interlock_pressure = SC.GetValue<double>($"{Module}.ForelineInterlockPressure");
  283. _Magnet = DEVICE.GetDevice<IoMagnet>($"{Module}.AIoMagnet");
  284. Valve2IO = new Dictionary<ValveType, IoValve>()
  285. {
  286. { ValveType.PVN21, _PVN21Valve },
  287. { ValveType.PVN22, _PVN22Valve },
  288. { ValveType.PV11, _PV11Valve },
  289. { ValveType.PV12, _PV12Valve },
  290. { ValveType.PV21, _PV21Valve },
  291. { ValveType.PV22, _PV22Valve },
  292. { ValveType.PV31, _PV31Valve },
  293. { ValveType.PV32, _PV32Valve },
  294. { ValveType.PV41, _PV41Valve },
  295. { ValveType.PV42, _PV42Valve },
  296. { ValveType.PV51, _PV51Valve },
  297. { ValveType.PV52, _PV52Valve },
  298. { ValveType.PV61, _PV61Valve },
  299. { ValveType.PV62, _PV62Valve },
  300. { ValveType.PV71, _PV71Valve },
  301. { ValveType.PV72, _PV72Valve },
  302. { ValveType.PV81, _PV81Valve },
  303. { ValveType.PV82, _PV82Valve },
  304. { ValveType.PV91, _PV91Valve },
  305. { ValveType.PV92, _PV92Valve },
  306. { ValveType.PVA1, _PVA1Valve },
  307. { ValveType.PVA2, _PVA2Valve },
  308. { ValveType.PVB1, _PVB1Valve },
  309. { ValveType.PVB2, _PVB2Valve },
  310. { ValveType.PVC1, _PVC1Valve },
  311. { ValveType.PVC2, _PVC2Valve },
  312. { ValveType.N2, _N2Valve },
  313. { ValveType.Mfc1, _Mfc1Valve },
  314. { ValveType.Mfc2, _Mfc2Valve },
  315. { ValveType.Mfc3, _Mfc3Valve },
  316. { ValveType.Mfc4, _Mfc4Valve },
  317. { ValveType.Mfc5, _Mfc5Valve },
  318. { ValveType.Mfc6, _Mfc6Valve },
  319. { ValveType.Mfc7, _Mfc7Valve },
  320. { ValveType.Mfc8, _Mfc8Valve },
  321. { ValveType.Mfc9, _Mfc9Valve },
  322. { ValveType.Mfc10, _Mfc10Valve },
  323. { ValveType.Mfc11, _Mfc11Valve },
  324. { ValveType.Mfc12, _Mfc12Valve },
  325. { ValveType.PVHe1, _PVHe1Valve },
  326. { ValveType.PVHe3, _PVHe3Valve },
  327. { ValveType.PVHe2, _PVHe2Valve },
  328. { ValveType.GasFinal, _GasFinalValve},
  329. { ValveType.Purge, _PurgeValve},
  330. { ValveType.FastPump, _FastPumpValve},
  331. { ValveType.TurboPumpPumping, _TurboPumpPumpingValve},
  332. { ValveType.TurboPumpPurge, _TurboPumpPurgeValve},
  333. { ValveType.Guage, _GuageValve},
  334. { ValveType.HeISO, _HeISOValve},
  335. { ValveType.MainPurge,_MainPurgeValve},
  336. { ValveType.SecondPurge, _SecondPurgeValve},
  337. };
  338. }
  339. #endregion
  340. #region 暴露变量
  341. public override bool IsLidClosed => _Lid.OFFFeedback;
  342. public override bool IsSlitDoorClosed
  343. {
  344. get
  345. {
  346. if (Singleton<RouteManager>.Instance.seTM != null)
  347. {
  348. switch (Module)
  349. {
  350. case ModuleName.PMA:
  351. return Singleton<RouteManager>.Instance.seTM.IsPMASlitDoorClosed;
  352. case ModuleName.PMB:
  353. return Singleton<RouteManager>.Instance.seTM.IsPMBSlitDoorClosed;
  354. case ModuleName.PMC:
  355. return Singleton<RouteManager>.Instance.seTM.IsPMCSlitDoorClosed;
  356. default:
  357. return false;
  358. }
  359. }
  360. else
  361. return false;
  362. }
  363. }
  364. public override bool IsLinerDoorClosed => !_linerDoor.ONFeedback && _linerDoor.OFFFeedback;
  365. public override bool IsPumpRunning => _MainPump.IsRunning;
  366. public override bool IsISOOpen => _TurboPumpPumpingValve.Status;
  367. public override bool IsTurboPumpRunning => _TurboPump.IsRunning;
  368. public override bool IsPenVOpen => _pendulumValve.IsOpen;
  369. public override bool IsTurboPumpAtSpeed => _TurboPump.AtSpeed;
  370. public override float TurboPumpSpeed => _TurboPump.Speed;
  371. public override bool HasPumpError => _MainPump.IsError || !_MainPump.IsRunning;
  372. public override bool HasTurboPumpError => _TurboPump.IsError || !_TurboPump.IsRunning;
  373. public override bool IsCDA_OK => _CDAPressure.Value;
  374. public override bool IsFastPumpOpened => _FastPumpValve.Status;
  375. public override bool IsSoftPumpOpened { get; }//_SoftPumpValve.Status
  376. public override bool IsMfc1ValveOpened => _Mfc1Valve.Status;
  377. public override bool IsMfc2ValveOpened => _Mfc2Valve.Status;
  378. public override bool IsMfc3ValveOpened => _Mfc3Valve.Status;
  379. public override bool IsMfc4ValveOpened => _Mfc4Valve.Status;
  380. public override bool IsMfc5ValveOpened => _Mfc5Valve.Status;
  381. public override bool IsMfc6ValveOpened => _Mfc6Valve.Status;
  382. public override bool IsMfc7ValveOpened => _Mfc7Valve.Status;
  383. public override bool IsMfc8ValveOpened => _Mfc8Valve.Status;
  384. public bool IsMfc9ValveOpened => _Mfc9Valve.Status;
  385. public bool IsMfc10ValveOpened => _Mfc10Valve.Status;
  386. public bool IsMfc11ValveOpened => _Mfc11Valve.Status;
  387. public bool IsMfc12ValveOpened => _Mfc12Valve.Status;
  388. public override bool IsGuageValveOpened => _GuageValve.Status;
  389. public override bool IsATM => _ATM_sw.Value;
  390. public override bool PVN22ValveIsOpen => _PVN22Valve.Status;
  391. public override bool LiftPinIsDown => _LiftPin.OFFFeedback;
  392. public override bool LiftPinIsUp => _LiftPin.ONFeedback;
  393. public override bool IsVAC => _VAC_sw.Value;
  394. //public override bool IsWaterFlowOk => _Water_Flow.Value;
  395. public override bool IsWaterFlowOk => false;
  396. public override bool IsWLK => _WLK_sw.Value;
  397. public override bool IsRFGInterlockOn => _RFG_Interlock.Value;
  398. public override bool PMLidClosed => _PM_Lid_Closed.Value;
  399. public override bool TurboPumpInterlock => _TurboPumpInterlock.Value;
  400. public override bool LinerDoorClosed => _PM_LinerDoor_Closed.Value;
  401. public override bool SlitDoorClosed
  402. {
  403. get
  404. {
  405. switch (Module)
  406. {
  407. case ModuleName.PMA:
  408. return Singleton<RouteManager>.Instance.seTM.IsPMASlitDoorClosed && Singleton<RouteManager>.Instance.PMA.IsSlitDoorClose;
  409. case ModuleName.PMB:
  410. return Singleton<RouteManager>.Instance.seTM.IsPMBSlitDoorClosed && Singleton<RouteManager>.Instance.PMB.IsSlitDoorClose;
  411. case ModuleName.PMC:
  412. return Singleton<RouteManager>.Instance.seTM.IsPMCSlitDoorClosed && Singleton<RouteManager>.Instance.PMC.IsSlitDoorClose;
  413. default:
  414. return true;
  415. }
  416. }
  417. }
  418. //public override double ProcessLowPressure => _pressureController.ProcessLow.Value;
  419. //public override double ProcessHighPressure => _pressureController.ProcessHigh.Value;
  420. public override double ProcessPressure => _pendulumValve.Pressure >= 950 ? 950 : _pendulumValve.Pressure;
  421. public override double ChamberPressure => _pressureController.PressureGauge.Value;
  422. public override double ForelinePressure => _pressureController.ForelineGauge.Value;
  423. public override double TargetPressure => _pressureController.TargetPressure;
  424. public override double ESCHePressure => _pressureController.ESCHeGauge.Value;
  425. public override int ESCOutputVoltage => _ESCHV.OutputVoltage;
  426. public override double ESCPositiveOutputCurrent => _ESCHV.PositiveOutputCurrent;
  427. public override double ESCNegativeOutputCurrent => _ESCHV.NegativeOutputCurrent;
  428. public override bool IsHVOn => _ESCHV.IsOn;
  429. public override float CoolantInletTempFB
  430. {
  431. get
  432. {
  433. switch (SC.GetValue<int>($"{Module}.Chiller.CommunicationType"))
  434. {
  435. case (int)CommunicationType.RS232:
  436. return _Chiller.CoolantInletTcFeedback;
  437. case (int)CommunicationType.RS485:
  438. return _Chiller.Temperature;
  439. default:
  440. return 0;
  441. }
  442. }
  443. }
  444. public override float CoolantOutletTempFB => _Chiller.CoolantOutletTcFeedback;
  445. public override bool ChillerIsRunning => _Chiller.IsRunning;
  446. public override float ReflectPower => _Generator.ReflectPower;
  447. public override float BiasReflectPower => _GeneratorBias.ReflectPower;
  448. public override bool BackSideHeOutOfRange => _backsideHe.OutOfRange;
  449. public override MovementPosition LiftPinPosition
  450. {
  451. get
  452. {
  453. MovementPosition pos = MovementPosition.Unknown;
  454. if (_LiftPin.ONFeedback && !_LiftPin.OFFFeedback)
  455. {
  456. pos = MovementPosition.Up;
  457. }
  458. else if (!_LiftPin.ONFeedback && _LiftPin.OFFFeedback)
  459. {
  460. pos = MovementPosition.Down;
  461. }
  462. return pos;
  463. }
  464. }
  465. public override double TotalGasSetpoint
  466. {
  467. get
  468. {
  469. double sum = 0;
  470. foreach (var gas in _gasLines)
  471. {
  472. sum += gas.FlowSP;
  473. }
  474. return sum;
  475. }
  476. }
  477. public override bool HasGasOutOfRange
  478. {
  479. get
  480. {
  481. foreach (var gas in _gasLines)
  482. {
  483. if (!gas.IsOutOfRange)
  484. return false;
  485. }
  486. return true;
  487. }
  488. }
  489. public override bool IsLidLoadlockClosed
  490. {
  491. get
  492. {
  493. //LOG.Write(eEvent.ERR_PM,Module,"VenusSE PM is not exist Loadlock!");
  494. return false;
  495. }
  496. }
  497. public override bool IsATMLoadlock
  498. {
  499. get
  500. {
  501. //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");
  502. return false;
  503. }
  504. }
  505. public override bool IsVACLoadLock
  506. {
  507. get
  508. {
  509. //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");
  510. return false;
  511. }
  512. }
  513. public override bool IsLoadlockArmRetract
  514. {
  515. get
  516. {
  517. //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");
  518. return false;
  519. }
  520. }
  521. public override bool IsLoadlockArmExtend
  522. {
  523. get
  524. {
  525. //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");
  526. return false;
  527. }
  528. }
  529. public override bool LoadlockArmRetract
  530. {
  531. get
  532. {
  533. //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");
  534. return false;
  535. }
  536. }
  537. public override bool LoadlockArmExtend
  538. {
  539. get
  540. {
  541. //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");
  542. return false;
  543. }
  544. }
  545. public override float RFMatchC1 => _Match != null ? _Match.TunePosition1 : 0;
  546. public override float RFMatchC2 => _Match != null ? _Match.TunePosition1 : 0;
  547. public override float BiasRFMatchC1 => _BiasMatch != null ? _BiasMatch.TunePosition1 : 0;
  548. public override float BiasRFMatchC2 => _BiasMatch != null ? _BiasMatch.TunePosition1 : 0;
  549. public override double LoadlockPressure
  550. {
  551. get
  552. {
  553. //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");
  554. return -100;
  555. }
  556. }
  557. public override void Monitor()
  558. {
  559. CheckPermanentInterlock();
  560. }
  561. public override void BuzzerBlinking(double time)
  562. {
  563. LOG.Write(eEvent.ERR_PM, Module, "VenusDE PM is not exist SignalTower!");
  564. }
  565. #endregion
  566. #region 公共方法
  567. public override bool CheckAtm()
  568. {
  569. //检查是否是ATM模式
  570. return _ATM_sw.Value && ChamberPressure > 700000;
  571. }
  572. public override void RTCloseEvent()
  573. {
  574. if (_GeneratorBias.IsPowerOn)
  575. {
  576. GeneratorBiasPowerOn(false);
  577. }
  578. if (PendulumValveIsOpen())
  579. {
  580. TurnPendulumValve(false);
  581. }
  582. }
  583. public override bool CheckChillerStatus()
  584. {
  585. return _Chiller != null /*&& _Chiller.IsRunning*/ && !_Chiller.IsError;
  586. }
  587. public override bool CheckGeneratorAndHVInterlock(VenusDevice device)
  588. {
  589. eEvent evt = device == VenusDevice.Rf ? eEvent.ERR_RF : eEvent.ERR_ESC_HV;
  590. if (!PMLidClosed)
  591. {
  592. LOG.Write(evt, Module, $"Cannot Power ON {device} as PM Lid is Open.");
  593. return false;
  594. }
  595. if (!IsVAC)
  596. {
  597. LOG.Write(evt, Module, $"Cannot Power ON {device} as PM is not Vacuum.");
  598. return false;
  599. }
  600. //if (!IsWaterFlowOk)
  601. //{
  602. // LOG.Write(evt, Module, $"Cannot Power ON {device} as Water Flow is OFF.");
  603. // return false;
  604. //}
  605. if (!IsRFGInterlockOn)
  606. {
  607. LOG.Write(evt, Module, $"Cannot Power ON {device} as Generator Interlock is OFF.");
  608. return false;
  609. }
  610. //if (!SourceRFFanInterlock)
  611. //{
  612. // LOG.Write(evt, Module, $"Cannot Power ON {device} as Source RF Fan is OFF.");
  613. // return false;
  614. //}
  615. if (!SlitDoorClosed)
  616. {
  617. LOG.Write(evt, Module, $"Cannot Power ON {device} as Slit Door is open.");
  618. return false;
  619. }
  620. if (!LinerDoorClosed)
  621. {
  622. LOG.Write(evt, Module, $"Cannot Power ON {device} as Liner Door is open.");
  623. return false;
  624. }
  625. if ((device == VenusDevice.ESCHV || device == VenusDevice.BiasRf) && WaferManager.Instance.CheckNoWafer(Module, 0))
  626. {
  627. LOG.Write(evt, Module, $"Cannot Power ON {device} as {Module} has no wafer");
  628. return false;
  629. }
  630. return true;
  631. }
  632. public override bool SetBiasMatchWorkMode(MatchWorkMode matchWorkMode)
  633. {
  634. if (_BiasMatch == null) return false;
  635. if (matchWorkMode == MatchWorkMode.Auto)
  636. {
  637. return _BiasMatch.SetMatchMode(EnumRfMatchTuneMode.Auto, out _);
  638. }
  639. else if (matchWorkMode == MatchWorkMode.Manual)
  640. {
  641. return _BiasMatch.SetMatchMode(EnumRfMatchTuneMode.Manual, out _);
  642. }
  643. return false;
  644. }
  645. public override bool StartControlPressure(int pressureSetpoint, int flowSetpoint)
  646. {
  647. OpenValve(ValveType.TurboPumpPumping, true);
  648. if (_TurboPumpPumpingValve.Status)
  649. {
  650. OpenValve(ValveType.Purge, true);
  651. OpenValve(ValveType.GasFinal, false);
  652. //OpenValve(ValveType.N2, true);
  653. OpenValve(ValveType.PVN22, true);
  654. TurnPendulumValve(true);
  655. SetPVPressure(pressureSetpoint);
  656. return true;
  657. }
  658. else
  659. {
  660. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"cannot control pressure,cause Turbo Pump Pumping Valve is Close");
  661. return true;
  662. }
  663. }
  664. public async override Task<bool> AbortControlPressure()
  665. {
  666. OpenValve(ValveType.PVN22, false);
  667. OpenValve(ValveType.N2, false);
  668. await Task.Delay(2000);
  669. OpenValve(ValveType.GasFinal, false);
  670. OpenValve(ValveType.Purge, false);
  671. return true;
  672. }
  673. public override void CheckIdleInterlock()
  674. {
  675. if (ForelinePressure > _foreline_interlock_pressure)
  676. {
  677. if (_TurboPumpPumpingValve.SetPoint || _TurboPumpPurgeValve.SetPoint || _pendulumValve.IsOpen)
  678. {
  679. _pendulumValve.TurnValve(false);
  680. _TurboPumpPurgeValve.TurnValve(false, out _);
  681. _TurboPumpPumpingValve.TurnValve(false, out _);
  682. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Foreline pressure:{ForelinePressure} exceed {_foreline_interlock_pressure} mtorr, Pendulum valve & PV6 & PV7 closed automaticlly.");
  683. }
  684. }
  685. }
  686. public override bool CheckLiftDown()
  687. {
  688. return _LiftPin.State == CylinderState.Close;
  689. }
  690. public override bool CheckLiftUp()
  691. {
  692. return _LiftPin.State == CylinderState.Open;
  693. }
  694. public override bool CheckLinerDoorOpen()
  695. {
  696. return _linerDoor.State == CylinderState.Open;
  697. }
  698. public override bool CheckLinerDoorClose()
  699. {
  700. return _linerDoor.State == CylinderState.Close;
  701. }
  702. public override bool CheckSlitDoorClose()
  703. => IsSlitDoorClosed && IsLinerDoorClosed;
  704. public override bool CheckSlitDoorOpen()
  705. => !IsSlitDoorClosed && !IsLinerDoorClosed;
  706. public override void CloseValves(int? delayTime = null)
  707. {
  708. _PVN21Valve.TurnValve(false, out _);
  709. //_PVN22Valve.TurnValve(false, out _);
  710. _PV11Valve.TurnValve(false, out _);
  711. _PV12Valve.TurnValve(false, out _);
  712. _PV21Valve.TurnValve(false, out _);
  713. _PV22Valve.TurnValve(false, out _);
  714. _PV31Valve.TurnValve(false, out _);
  715. _PV32Valve.TurnValve(false, out _);
  716. _PV41Valve.TurnValve(false, out _);
  717. _PV42Valve.TurnValve(false, out _);
  718. _PVHe1Valve.TurnValve(false, out _);
  719. _PVHe2Valve.TurnValve(false, out _);
  720. _GasFinalValve.TurnValve(false, out _);
  721. //_SoftPumpValve.TurnValve(false, out _);
  722. _FastPumpValve.TurnValve(false, out _);
  723. _TurboPumpPumpingValve.TurnValve(false, out _);
  724. _TurboPumpPurgeValve.TurnValve(false, out _);
  725. _GuageValve.TurnValve(false, out _);
  726. _PurgeValve.TurnValve(false, out _);
  727. _N2Valve.TurnValve(false, out _);
  728. _FastPumpValve.TurnValve(false, out _);
  729. _PVHe3Valve.TurnValve(false, out _);
  730. _HeISOValve.TurnValve(false, out _);
  731. _MainPurgeValve.TurnValve(false, out _);
  732. _SecondPurgeValve.TurnValve(false, out _);
  733. //新增
  734. _Mfc1Valve.TurnValve(false, out _);
  735. _Mfc2Valve.TurnValve(false, out _);
  736. _Mfc3Valve.TurnValve(false, out _);
  737. _Mfc4Valve.TurnValve(false, out _);
  738. _Mfc5Valve.TurnValve(false, out _);
  739. _Mfc6Valve.TurnValve(false, out _);
  740. _Mfc7Valve.TurnValve(false, out _);
  741. _Mfc8Valve.TurnValve(false, out _);
  742. _Mfc9Valve.TurnValve(false, out _);
  743. _Mfc10Valve.TurnValve(false, out _);
  744. _Mfc11Valve.TurnValve(false, out _);
  745. _Mfc12Valve.TurnValve(false, out _);
  746. _PV51Valve.TurnValve(false, out _);
  747. _PV52Valve.TurnValve(false, out _);
  748. _PV61Valve.TurnValve(false, out _);
  749. _PV62Valve.TurnValve(false, out _);
  750. _PV71Valve.TurnValve(false, out _);
  751. _PV72Valve.TurnValve(false, out _);
  752. _PV81Valve.TurnValve(false, out _);
  753. _PV82Valve.TurnValve(false, out _);
  754. _PV91Valve.TurnValve(false, out _);
  755. _PV92Valve.TurnValve(false, out _);
  756. _PVA1Valve.TurnValve(false, out _);
  757. _PVA2Valve.TurnValve(false, out _);
  758. _PVB1Valve.TurnValve(false, out _);
  759. _PVB2Valve.TurnValve(false, out _);
  760. _PVC1Valve.TurnValve(false, out _);
  761. _PVC2Valve.TurnValve(false, out _);
  762. foreach (var stick in _gasLines)
  763. {
  764. stick.Stop();
  765. }
  766. }
  767. public override bool ExtendWafer()
  768. {
  769. throw new NotImplementedException();
  770. }
  771. public override bool FlowGas(int gasNum, double val)
  772. {
  773. if (_gasLines.Length <= gasNum)
  774. return false;
  775. _gasLines[gasNum].Flow(val);
  776. return true;
  777. }
  778. public override bool FlowN2(double val)
  779. {
  780. _gasLineN2.Flow(val);
  781. return true;
  782. }
  783. public override bool GeneratorBiasPowerOn(bool on)
  784. {
  785. if (_GeneratorBias == null) return false;
  786. if (on && !IsRFGInterlockOn)
  787. {
  788. LOG.Write(eEvent.ERR_RF, Module, "Bias射频电源 Interlock条件不满足");
  789. return false;
  790. }
  791. return _GeneratorBias.SetPowerOnOff(on, out _);
  792. }
  793. //public override bool MagnetPowerOn(bool on)
  794. //{
  795. // if (_Magnet == null) return false;
  796. // return _Magnet.SetMagnetOnOff(on, out _);
  797. //}
  798. public override bool GeneratorBiasSetMatchMode(bool val)
  799. {
  800. if (_GeneratorBias == null) return false;
  801. string reason = string.Empty;
  802. _GeneratorBias.SetMatchingAutoMode(val, out reason);
  803. return true;
  804. }
  805. public override bool GeneratorBiasSetpower(float val)
  806. {
  807. if (_GeneratorBias == null) return false;
  808. _GeneratorBias.SetPower((ushort)val);
  809. return true;
  810. }
  811. public override bool GeneratorPowerOn(bool on)
  812. {
  813. if (_Generator == null) return false;
  814. if (on && !IsRFGInterlockOn)
  815. {
  816. LOG.Write(eEvent.ERR_RF, Module, "射频电源 Interlock条件不满足");
  817. return false;
  818. }
  819. return _Generator.SetPowerOnOff(on, out _);
  820. }
  821. public override bool GeneratorSetpower(float val)
  822. {
  823. if (_Generator == null) return false;
  824. if (Math.Abs(val) > 0.01)
  825. _Generator.SetPower((ushort)val);
  826. return true;
  827. }
  828. public override bool MagnetSetpower(float val)
  829. {
  830. if (_Magnet == null) return false;
  831. if (Math.Abs(val) >= 0)
  832. _Magnet.SetMagnetPower(val);
  833. return true;
  834. }
  835. public override bool SetFieldRatio(float val)
  836. {
  837. if (_Magnet == null) return false;
  838. _Magnet.SetFieldRatio(val);
  839. return true;
  840. }
  841. public override bool SetWaveform(int val)
  842. {
  843. if (_Magnet == null) return false;
  844. _Magnet.SetWaveform(val);
  845. return true;
  846. }
  847. public override float GetPVPosition()
  848. {
  849. return _pendulumValve.Position;
  850. }
  851. public override async void HeatChiller(ChillerType chillerType, double value, double offset)
  852. {
  853. _Chiller?.SetChillerTemp((float)value, (float)offset);
  854. await Task.Delay(1000);
  855. _Chiller?.SetChillerOnOff(true);
  856. }
  857. public override void Home()
  858. {
  859. SetLiftPin(MovementPosition.Down, out _);
  860. //转交TM
  861. if (!IsSlitDoorClosed)
  862. {
  863. SetSlitDoor(true, out _);
  864. }
  865. else
  866. {
  867. SetSlitDoor(false, out _);
  868. }
  869. if (_linerDoor.State == CylinderState.Open)
  870. {
  871. SetLinerDoor(true, out _);
  872. }
  873. else
  874. {
  875. SetLinerDoor(false, out _);
  876. }
  877. SetLinerDoor(false, out _);
  878. //SetSlitDoor(false, out _);
  879. OpenValve(ValveType.PVN22, false);
  880. _MainPump?.ReConnect();
  881. _TurboPump?.ReConnect();
  882. _pendulumValve?.ReConnect();
  883. _GeneratorBias.Reset();
  884. _GeneratorBias.ReConnect();
  885. }
  886. public override void OnOffChiller(ChillerType chillerType, bool onoff)
  887. => _Chiller?.SetChillerOnOff(onoff);
  888. public override bool OnOffSetESCHV(bool on)
  889. => _ESCHV.SetPowerOnOff(on);
  890. public override void OpenValve(ValveType vlvType, bool on)
  891. {
  892. if (vlvType != ValveType.SoftPump)
  893. {
  894. if (Valve2IO.ContainsKey(vlvType))
  895. {
  896. if (vlvType == ValveType.TurboPumpPurge && on)
  897. {
  898. if (!IsISOOpen)
  899. {
  900. LOG.Write(eEvent.WARN_DEFAULT_WARN, Module, $"Chamber TurboPumpPumping valve is not open, can not turn on TurboPumpPurge valve.");
  901. return;
  902. }
  903. }
  904. else if (vlvType == ValveType.TurboPumpPumping && !on)
  905. {
  906. if (IsTurboPumpRunning)
  907. {
  908. if (IsPenVOpen)
  909. {
  910. LOG.Write(eEvent.WARN_DEFAULT_WARN, Module, $"Chamber TurboPump is open but Pendulum Valve is open, can not turn off TurboPumpPumping valve.");
  911. return;
  912. }
  913. }
  914. }
  915. if (vlvType == ValveType.TurboPumpPurge && !_TurboPumpPumpingValve.Status && on)
  916. {
  917. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"cannot open Turbo Pump Purge, cause Turbo Pump Valve not open");
  918. return;
  919. }
  920. if (vlvType == ValveType.TurboPumpPumping && on)
  921. {
  922. if (!_MainPump.IsRunning)
  923. {
  924. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"cannot open Turbo Pump Pump, cause Dry Pump Valve is not open");
  925. return;
  926. }
  927. if (ForelinePressure > SC.GetValue<int>($"{Module}.TurboPumpPumpingValveMinForelinePressure"))
  928. {
  929. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"cannot open Turbo Pump Pump, cause forelinePressure:{ForelinePressure}");
  930. return;
  931. }
  932. }
  933. Valve2IO[vlvType].TurnValve(on, out _);
  934. LOG.Write(eEvent.EV_DEVICE_INFO, Module, $"{(on ? "打开" : "关闭")} 阀 {vlvType.ToString()}");
  935. }
  936. else
  937. {
  938. throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}");
  939. }
  940. }
  941. }
  942. public override bool PendulumValveIsOpen()
  943. {
  944. return _pendulumValve.IsOpen;
  945. }
  946. public override bool RetractWafer()
  947. {
  948. throw new NotImplementedException();
  949. }
  950. public override void SetBacksideHeFlow(double flow)
  951. {
  952. if (_backsideHe == null) return;
  953. _backsideHe.Flow(flow);
  954. }
  955. public override bool SetBacksideHePressure(float mTorr)
  956. {
  957. if (_backsideHe == null) return false;
  958. return _backsideHe.SetBacksideHelium(mTorr);
  959. }
  960. public override bool SetBacksideHeThreshold(float nMin, float nMax)
  961. {
  962. if (_backsideHe == null) return false;
  963. return _backsideHe.SetFlowThreshold(nMin, nMax);
  964. }
  965. public override bool SetBiasMatchPosition(float c1, float c2)
  966. {
  967. if (_BiasMatch == null) return false;
  968. string reason = string.Empty;
  969. _BiasMatch.SetMatchPosition(c1, c2, out reason);
  970. return true;
  971. }
  972. public override bool SetBiasPulseMode(bool on)
  973. {
  974. if (_GeneratorBias == null) return false;
  975. _GeneratorBias.SetPulseMode(on);
  976. return true;
  977. }
  978. public override bool SetBiasPulseRateFreq(int nFreq)
  979. {
  980. if (_GeneratorBias == null) return false;
  981. _GeneratorBias.SetPulseRateFreq(nFreq);
  982. return true;
  983. }
  984. public override bool SetDiasPulseDutyCycle(int percentage)
  985. {
  986. if (_GeneratorBias == null) return false;
  987. _GeneratorBias.SetPulseDutyCycle(percentage);
  988. return true;
  989. }
  990. public override bool SetESCClampVoltage(int nVoltage)
  991. {
  992. if (_ESCHV == null) return false;
  993. return _ESCHV.SetOutputVoltage(nVoltage);
  994. }
  995. public override void SetGeneratorCommunicationMode(int mode)
  996. => _Generator?.SetCommunicationMode(mode);
  997. public override bool SetLiftPin(MovementPosition dirt, out string reason)
  998. {
  999. reason = string.Empty;
  1000. switch (dirt)
  1001. {
  1002. case MovementPosition.Down:
  1003. return _LiftPin.SetCylinder(false, out reason);
  1004. case MovementPosition.Up:
  1005. return _LiftPin.SetCylinder(true, out reason);
  1006. case MovementPosition.Left:
  1007. case MovementPosition.Right:
  1008. case MovementPosition.Middle:
  1009. throw new ArgumentException("Movement argument error");
  1010. }
  1011. return true;
  1012. }
  1013. public override bool SetMatchPosition(float c1, float c2)
  1014. {
  1015. if (_Match == null) return false;
  1016. string reason = string.Empty;
  1017. _Match.SetMatchPosition(c1, c2, out reason);
  1018. return true;
  1019. }
  1020. public override bool SetPVPostion(float position)
  1021. => _pendulumValve.SetPosition(position);
  1022. public override bool SetPVPressure(float pressure)
  1023. => _pendulumValve.SetPressure(pressure);
  1024. public override bool SetSlitDoor(bool open, out string reason)
  1025. {
  1026. reason = string.Empty;
  1027. OP.DoOperation($"{ModuleName.SETM}.SetSlitDoor", Module, open);
  1028. return true;
  1029. }
  1030. public override bool SetLinerDoor(bool open, out string reason)
  1031. {
  1032. if (open)
  1033. {
  1034. if (RouteManager.IsATMMode)
  1035. {
  1036. if (!IsATM)
  1037. {
  1038. reason = $"{Module} is not ATM, can not open slit door";
  1039. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  1040. return false;
  1041. }
  1042. }
  1043. //else
  1044. //{
  1045. // double maxPressureDifference = SC.GetValue<double>("System.PMTMMaxPressureDifference");
  1046. // if (Math.Abs(TMPressure - ChamberPressure) > maxPressureDifference)
  1047. // {
  1048. // reason = $"{Module} and TM pressure difference exceeds the max limit {maxPressureDifference}, TMPressure:{TMPressure}, {Module}Pressure:{ChamberPressure}";
  1049. // LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  1050. // return false;
  1051. // }
  1052. //}
  1053. }
  1054. return _linerDoor.SetCylinder(open, out reason);
  1055. }
  1056. public override bool SetWallTCTemperature(float value)
  1057. => _WallTC.RampTemp(value);
  1058. public override void StopAllGases()
  1059. {
  1060. foreach (var line in _gasLines)
  1061. {
  1062. line.Stop();
  1063. }
  1064. }
  1065. public override bool StopGas(int gasNum)
  1066. {
  1067. if (_gasLines.Length <= gasNum)
  1068. return false;
  1069. _gasLines[gasNum].Stop();
  1070. return true;
  1071. }
  1072. public override bool StopN2()
  1073. {
  1074. _gasLineN2.Stop();
  1075. return true;
  1076. }
  1077. public override void SwitchOnBuzzerAndRed()
  1078. {
  1079. throw new NotImplementedException();
  1080. }
  1081. public override void TurnDryPump(bool on)
  1082. => _MainPump?.SetPumpOnOff(on);
  1083. public override bool TurnPendulumValve(bool on)
  1084. {
  1085. if (on && (!TurboPumpInterlock || !IsCDA_OK || !IsTurboPumpAtSpeed || !IsWLK))
  1086. {
  1087. LOG.Write(eEvent.ERR_PENDULUM_VALVE,Module, "Cannot open PendulumValve, as Interlock not arrival");
  1088. return false;
  1089. }
  1090. return _pendulumValve.TurnValve(on);
  1091. }
  1092. public override void TurnTurboPump(bool on)
  1093. {
  1094. _TurboPump?.SetPumpOnOff(on);
  1095. }
  1096. public override bool PreparePlace()
  1097. {
  1098. if (!SetSlitDoor(true, out string reason))
  1099. {
  1100. LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
  1101. return false;
  1102. }
  1103. //
  1104. if (!SetLinerDoor(true, out reason))
  1105. {
  1106. LOG.Write(eEvent.ERR_PM, Module, $"Set Liner Door Open failed:{reason}");
  1107. return false;
  1108. }
  1109. if (!SetLiftPin(MovementPosition.Down, out reason))
  1110. {
  1111. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
  1112. return false;
  1113. }
  1114. return true;
  1115. }
  1116. public override bool PreparePick()
  1117. {
  1118. if (!SetSlitDoor(true, out string reason))
  1119. {
  1120. LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
  1121. return false;
  1122. }
  1123. if (!SetLinerDoor(true, out reason))
  1124. {
  1125. LOG.Write(eEvent.ERR_PM, Module, $"Set Liner Door Open failed:{reason}");
  1126. return false;
  1127. }
  1128. if (!SetLiftPin(MovementPosition.Up, out reason))
  1129. {
  1130. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");
  1131. return false;
  1132. }
  1133. return true;
  1134. }
  1135. public override bool PreparePlaceIsOK()
  1136. {
  1137. return CheckSlitDoorOpen() && LiftPinIsDown && CheckLinerDoorOpen();
  1138. }
  1139. public override bool PreparePickIsOK()
  1140. {
  1141. return CheckSlitDoorOpen() && LiftPinIsUp && CheckLinerDoorOpen();
  1142. }
  1143. public override bool EndPlace()
  1144. {
  1145. if (!SetLiftPin(MovementPosition.Down, out string reason))
  1146. {
  1147. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}");
  1148. return false;
  1149. }
  1150. if (!SetSlitDoor(false, out reason))
  1151. {
  1152. LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  1153. return false;
  1154. }
  1155. if (!SetLinerDoor(false, out reason))
  1156. {
  1157. LOG.Write(eEvent.ERR_PM, Module, $"Set Liner Door Close failed:{reason}");
  1158. return false;
  1159. }
  1160. return true;
  1161. }
  1162. public override bool EndPick()
  1163. {
  1164. if (!SetSlitDoor(false, out string reason))
  1165. {
  1166. LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  1167. return false;
  1168. }
  1169. return true;
  1170. }
  1171. public override bool EndPlaceIsOK()
  1172. {
  1173. return CheckSlitDoorClose() && LiftPinIsDown;
  1174. }
  1175. public override bool EndPickIsOK()
  1176. {
  1177. return CheckSlitDoorClose();
  1178. }
  1179. #endregion
  1180. protected override void CheckPermanentInterlock()
  1181. {
  1182. if (ProcessPressure > 950 && _GuageValve.SetPoint)
  1183. {
  1184. _GuageValve.TurnValve(false, out _);
  1185. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ProcessPressure} exceed 950 mtorr, Guage Valve (DO-31) closed automaticlly.");
  1186. }
  1187. if (ProcessPressure < 950 && !_GuageValve.SetPoint)
  1188. {
  1189. _GuageValve.TurnValve(true, out _);
  1190. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ProcessPressure} exceed 950 mtorr, Guage Valve (DO-31) closed automaticlly.");
  1191. }
  1192. }
  1193. public override void PMInError()
  1194. {
  1195. CloseValves();
  1196. GeneratorPowerOn(false);
  1197. GeneratorBiasPowerOn(false);
  1198. OpenValve(ValveType.TurboPumpPumping, true);
  1199. OpenValve(ValveType.TurboPumpPurge, true);
  1200. OnOffSetESCHV(false);
  1201. }
  1202. }
  1203. }