StandardHotReservoirInitializeRoutine.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using MECF.Framework.Common.Persistent.Reservoirs;
  6. using MECF.Framework.Common.RecipeCenter;
  7. using MECF.Framework.Common.Routine;
  8. using System;
  9. using System.Collections.Generic;
  10. using MECF.Framework.Common.Alarm;
  11. using CyberX8_Core;
  12. using CyberX8_RT.Devices.Facilities;
  13. using CyberX8_RT.Devices.Metal;
  14. using CyberX8_RT.Devices.PowerSupplier;
  15. using CyberX8_RT.Devices.Reservoir;
  16. using CyberX8_RT.Devices.Temperature;
  17. namespace CyberX8_RT.Modules.Reservoir
  18. {
  19. public class StandardHotReservoirInitializeRoutine : RoutineBase, IRoutine
  20. {
  21. private enum InitializeStep
  22. {
  23. AutoDiReplen,
  24. CellPump,
  25. WaitCellPump,
  26. CheckCellFlow,
  27. ManualCellByPass,
  28. AutoCellManual,
  29. AutoEnableCMM,
  30. AutoEnableCMMWait,
  31. AutoCMMFlowDelay,
  32. AutoCMMFlowCheck,
  33. AutoPHDetect,
  34. AutoCellAutoFlow,
  35. AutoCellAutoFlowDelay,
  36. AutoCellAutoFlowCheck,
  37. AutoCellAutoEnableHED,
  38. AutoCellAutoEnableHEDDelay,
  39. AutoCellAutoEnableHEDCheck,
  40. AutoCellAutoCheckPowerSupplier,
  41. AutoCellAutoLinmotReset,
  42. AutoCellAutoLinmotResetCheck,
  43. CellWSUnclamp,
  44. End
  45. }
  46. #region 常量
  47. private const string AUTO = "Auto";
  48. private const string MANUAL = "Manual";
  49. private const int ENABLE = 5;
  50. #endregion
  51. #region 内部变量
  52. List<StandardHotMetalDevice> _metalDevices = new List<StandardHotMetalDevice>();
  53. private double _hedFlowLowLimit;
  54. private StandardHotReservoirDevice _reservoirDevice;
  55. private ResRecipe _recipe;
  56. private CellPowerSupplier _cellPowerSupplier;
  57. private TemperatureController _temperatureController;
  58. private int _autoHedDelay = 0;
  59. /// <summary>
  60. /// CMM Check Flow延时
  61. /// </summary>
  62. private int _cmmFlowCheckDelay = 6;
  63. /// <summary>
  64. /// CMM Flow High Fault
  65. /// </summary>
  66. private double _cmmFlowHighFault;
  67. /// <summary>
  68. /// CMM Flow High Warning
  69. /// </summary>
  70. private double _cmmFlowHighWarning;
  71. /// <summary>
  72. /// CMM Flow High Warning
  73. /// </summary>
  74. private double _cmmFlowLowFault;
  75. /// <summary>
  76. /// CMM Flow High Warning
  77. /// </summary>
  78. private double _cmmFlowLowWarning;
  79. /// <summary>
  80. /// Reservoir Persistent
  81. /// </summary>
  82. private ReservoirsPersistentValue _persistentValue;
  83. #endregion
  84. /// <summary>
  85. /// 构造函数
  86. /// </summary>
  87. /// <param name="module"></param>
  88. public StandardHotReservoirInitializeRoutine(string module) : base(module)
  89. {
  90. }
  91. /// <summary>
  92. /// 中止
  93. /// </summary>
  94. public void Abort()
  95. {
  96. Runner.Stop("Manual Abort");
  97. }
  98. /// <summary>
  99. /// 监控
  100. /// </summary>
  101. /// <returns></returns>
  102. public RState Monitor()
  103. {
  104. //Cell Pump
  105. Runner.RunIf(InitializeStep.AutoDiReplen, _recipe.DIReplenEnable, CheckFacilitiesDiReplenStatus, _delay_1ms)
  106. .Run(InitializeStep.CellPump, CellsPumpOn, _delay_1ms)
  107. .WaitWithStopCondition(InitializeStep.WaitCellPump, CheckPumpOnEndStatus, CheckPumpOnStopStatus)
  108. .Run(InitializeStep.CheckCellFlow, CheckCellFlow, _delay_1ms)
  109. //Manual cell Bypass同时disable HED
  110. .RunIf(InitializeStep.ManualCellByPass, _reservoirDevice.OperationMode == MANUAL, CellsByPassEnableHed, _delay_1ms)
  111. //Auto 所有metal 处于Manual, cell Bypass,Enable HED,设置温度
  112. .RunIf(InitializeStep.AutoCellManual, CheckAutoAndAllMetalManual(), AutoCellManualByPassEnableHed, CheckCellManualByPassAndTemperature, _delay_2s)
  113. //Auto 同时recipe enable cmm,并检测CMM Flow
  114. .RunIf(InitializeStep.AutoEnableCMM, CheckAutoEnableCMM(), AutoEnableCMM, _delay_1ms)
  115. .WaitWithStopConditionIf(InitializeStep.AutoEnableCMMWait, CheckAutoEnableCMM(), () => { return _cellPowerSupplier.Status == RState.End; }
  116. , () => { return _cellPowerSupplier.Status == RState.Failed; }, _delay_5s)
  117. .DelayIf(InitializeStep.AutoCMMFlowDelay, CheckAutoEnableCMM(), _cmmFlowCheckDelay * 1000)
  118. .RunIf(InitializeStep.AutoCMMFlowCheck, CheckAutoEnableCMM(), CheckCMMTargetFlow, _delay_1ms)
  119. //Auto 启动PH检测
  120. .RunIf(InitializeStep.AutoPHDetect, _reservoirDevice.OperationMode == AUTO, StartAutoPHDetect, _delay_1ms)
  121. //Auto Cell Flow
  122. .Run(InitializeStep.AutoCellAutoFlow, AllMetalSwitchFlow, _delay_1ms)
  123. .Delay(InitializeStep.AutoCellAutoFlowDelay, 500)
  124. .Run(InitializeStep.AutoCellAutoFlowCheck, AllMetalCheckFlow, _delay_1ms)
  125. //Auto HED
  126. .Run(InitializeStep.AutoCellAutoEnableHED, AutoHedOn, _delay_1ms)
  127. .Delay(InitializeStep.AutoCellAutoEnableHEDDelay, _autoHedDelay)
  128. .Run(InitializeStep.AutoCellAutoEnableHEDCheck, AutoHedSuccess, _delay_1ms)
  129. //检验PowerSupplier通信
  130. .Run(InitializeStep.AutoCellAutoCheckPowerSupplier, AutoMetalsPowerSupplierCommuncationStatus, _delay_1ms)
  131. //Cell Linmot Reset
  132. .RunIf(InitializeStep.AutoCellAutoLinmotReset, _reservoirDevice.OperationMode == AUTO, AutoMetalResetLinmot, _delay_1ms)
  133. .WaitWithStopCondition(InitializeStep.AutoCellAutoLinmotResetCheck, CheckAutoMetalResetStatus, CheckAutoMetalResetStopStatus)
  134. //Cell Unclamp
  135. .Run(InitializeStep.CellWSUnclamp, MetalsWHUnclampOn, _delay_1ms)
  136. .End(InitializeStep.End, ClearAlarmDataError, _delay_1ms);
  137. return Runner.Status;
  138. }
  139. /// <summary>
  140. /// 检验总Di有没有开
  141. /// </summary>
  142. /// <returns></returns>
  143. private bool CheckFacilitiesDiReplenStatus()
  144. {
  145. SystemFacilities systemFacilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
  146. if (systemFacilities != null)
  147. {
  148. bool result = systemFacilities.DIReplenEnable;
  149. if (!result)
  150. {
  151. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Facilities DiReplen is disable");
  152. }
  153. return result;
  154. }
  155. return false;
  156. }
  157. /// <summary>
  158. /// Metals Pump On
  159. /// </summary>
  160. /// <returns></returns>
  161. private bool CellsPumpOn()
  162. {
  163. for (int i = 0; i < _metalDevices.Count; i++)
  164. {
  165. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  166. hotMetalDevice.PumpOnOperation("", null);
  167. }
  168. return true;
  169. }
  170. /// <summary>
  171. /// Cell ByPass
  172. /// </summary>
  173. /// <returns></returns>
  174. private bool CellsByPassEnableHed()
  175. {
  176. for (int i = 0; i < _metalDevices.Count; i++)
  177. {
  178. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  179. hotMetalDevice.SwitchToBypass("", null);
  180. }
  181. _temperatureController.EnableOperation("", null);
  182. return true;
  183. }
  184. /// <summary>
  185. /// 检验metal Pump
  186. /// </summary>
  187. /// <returns></returns>
  188. private bool CheckPumpOnEndStatus()
  189. {
  190. int totalCount = 0;
  191. for (int i = 0; i < _metalDevices.Count; i++)
  192. {
  193. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  194. if (hotMetalDevice.Status == RState.End)
  195. {
  196. totalCount++;
  197. }
  198. }
  199. if (totalCount >= _metalDevices.Count)
  200. {
  201. return true;
  202. }
  203. else
  204. {
  205. return false;
  206. }
  207. }
  208. /// <summary>
  209. /// 检验metal Pump停止状态
  210. /// </summary>
  211. /// <returns></returns>
  212. private bool CheckPumpOnStopStatus()
  213. {
  214. for (int i = 0; i < _metalDevices.Count; i++)
  215. {
  216. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  217. if (hotMetalDevice.Status == RState.Failed)
  218. {
  219. PumpOffMetals();
  220. return true;
  221. }
  222. }
  223. return false;
  224. }
  225. /// <summary>
  226. /// Pump Off All Metals
  227. /// </summary>
  228. private void PumpOffMetals()
  229. {
  230. for (int i = 0; i < _metalDevices.Count; i++)
  231. {
  232. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  233. hotMetalDevice.PumpOff();
  234. }
  235. }
  236. /// <summary>
  237. /// 检验HED Flow
  238. /// </summary>
  239. /// <returns></returns>
  240. private bool CheckCellFlow()
  241. {
  242. return true;
  243. }
  244. /// <summary>
  245. /// 检验所有Metal处于Manual
  246. /// </summary>
  247. /// <returns></returns>
  248. private bool CheckAutoAndAllMetalManual()
  249. {
  250. if (_reservoirDevice.OperationMode != AUTO)
  251. {
  252. return false;
  253. }
  254. for (int i = 0; i < _metalDevices.Count; i++)
  255. {
  256. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  257. if (hotMetalDevice.OperationMode != MANUAL)
  258. {
  259. return false;
  260. }
  261. }
  262. return true;
  263. }
  264. /// <summary>
  265. /// Auto 同时Metal均为Manual,Bypass metal,enable HED,设置温度
  266. /// </summary>
  267. /// <returns></returns>
  268. private bool AutoCellManualByPassEnableHed()
  269. {
  270. for (int i = 0; i < _metalDevices.Count; i++)
  271. {
  272. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  273. hotMetalDevice.SwitchToBypass("", null);
  274. }
  275. _temperatureController.EnableOperation("", null);
  276. _temperatureController.SetTargetTemperatureOperation("", new object[] { _recipe.TemperatureSetPoint });
  277. return true;
  278. }
  279. /// <summary>
  280. /// 检验cell By Pass和温度
  281. /// </summary>
  282. /// <returns></returns>
  283. private bool CheckCellManualByPassAndTemperature()
  284. {
  285. for (int i = 0; i < _metalDevices.Count; i++)
  286. {
  287. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  288. if (hotMetalDevice.MetalDeviceData.Circulation)
  289. {
  290. return false;
  291. }
  292. }
  293. if (_temperatureController.TemperatureData.ControlOperationModel == 0)
  294. {
  295. return false;
  296. }
  297. if (Math.Abs(_recipe.TemperatureSetPoint - _temperatureController.TemperatureData.TargetTemperature) >= 0.1 * _recipe.TemperatureSetPoint)
  298. {
  299. return false;
  300. }
  301. return true;
  302. }
  303. /// <summary>
  304. /// 检验 Auto ,同时Enable CMM
  305. /// </summary>
  306. /// <returns></returns>
  307. private bool CheckAutoEnableCMM()
  308. {
  309. if (_reservoirDevice.OperationMode != AUTO)
  310. {
  311. return false;
  312. }
  313. return _recipe.CMMEnable;
  314. }
  315. /// <summary>
  316. /// 自动Enable CMM
  317. /// </summary>
  318. /// <returns></returns>
  319. private bool AutoEnableCMM()
  320. {
  321. return _cellPowerSupplier.SetCurrentAndOutput(_recipe.CMMCurrentSetPoint);
  322. }
  323. /// <summary>
  324. /// 检验目标Flow是否到达设定值
  325. /// </summary>
  326. /// <returns></returns>
  327. private bool CheckCMMTargetFlow()
  328. {
  329. double flow = _reservoirDevice.ReservoirData.Flow;
  330. if (flow < _cmmFlowLowFault)
  331. {
  332. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{Module} CMM flow:{flow} is less than config item CMMFlowLowFault:{_cmmFlowLowFault}");
  333. if (_cellPowerSupplier.PowerSupplierData.Enabled) _cellPowerSupplier.DisableOperation("", null);
  334. return false;
  335. }
  336. else if (flow < _cmmFlowLowWarning)
  337. {
  338. LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} CMM flow:{flow} is less than config item CMMFlowLowWarning:{_cmmFlowLowWarning}");
  339. }
  340. else if (flow > _cmmFlowHighFault)
  341. {
  342. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{Module} CMM flow:{flow} is over config item CMMFlowHighFault:{_cmmFlowLowFault}");
  343. if (_cellPowerSupplier.PowerSupplierData.Enabled) _cellPowerSupplier.DisableOperation("", null);
  344. return false;
  345. }
  346. else if (flow > _cmmFlowHighWarning)
  347. {
  348. LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} CMM flow:{flow} is over config item CMMFlowHighWarning:{_cmmFlowLowWarning}");
  349. }
  350. return true;
  351. }
  352. /// <summary>
  353. /// 启动自动检测
  354. /// </summary>
  355. /// <returns></returns>
  356. private bool StartAutoPHDetect()
  357. {
  358. return _reservoirDevice.StartDetectPHValve();
  359. }
  360. /// <summary>
  361. /// 检验所有Metal处于Manual
  362. /// </summary>
  363. /// <returns></returns>
  364. private bool CheckAutoAndAllMetalAuto()
  365. {
  366. if (_reservoirDevice.OperationMode != AUTO)
  367. {
  368. return false;
  369. }
  370. for (int i = 0; i < _metalDevices.Count; i++)
  371. {
  372. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  373. if (hotMetalDevice.OperationMode != AUTO)
  374. {
  375. return false;
  376. }
  377. }
  378. return true;
  379. }
  380. /// <summary>
  381. /// 所有Metal切换Flow
  382. /// </summary>
  383. /// <returns></returns>
  384. private bool AllMetalSwitchFlow()
  385. {
  386. for (int i = 0; i < _metalDevices.Count; i++)
  387. {
  388. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  389. if (hotMetalDevice != null && !hotMetalDevice.IsDisable && hotMetalDevice.IsAuto)
  390. {
  391. bool result = hotMetalDevice.SwitchToFlow("", null);
  392. if (!result)
  393. {
  394. return false;
  395. }
  396. }
  397. }
  398. return true;
  399. }
  400. /// <summary>
  401. /// 检验所有Metal Flow检验
  402. /// </summary>
  403. /// <returns></returns>
  404. private bool AllMetalCheckFlow()
  405. {
  406. for (int i = 0; i < _metalDevices.Count; i++)
  407. {
  408. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  409. if (hotMetalDevice != null && !hotMetalDevice.IsDisable && hotMetalDevice.IsAuto)
  410. {
  411. double cellFlow = hotMetalDevice.MetalDeviceData.CellFlow;
  412. if (cellFlow <= _recipe.CAFlowRateErrorLow)
  413. {
  414. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"cell {hotMetalDevice.Name} flow {cellFlow} is less than {_recipe.CAFlowRateErrorLow}");
  415. return false;
  416. }
  417. else if (cellFlow <= _recipe.CAFlowRateWarningLow)
  418. {
  419. LOG.WriteLog(eEvent.WARN_METAL, Module, $"cell {hotMetalDevice.Name} flow {cellFlow} is less than {_recipe.CAFlowRateWarningLow}");
  420. }
  421. }
  422. }
  423. return true;
  424. }
  425. /// <summary>
  426. /// 自动HED On
  427. /// </summary>
  428. /// <returns></returns>
  429. private bool AutoHedOn()
  430. {
  431. //double hedFlow = _reservoirDevice.ReservoirData.HedFlow;
  432. //bool result = hedFlow > _hedFlowLowLimit;
  433. //if (!result)
  434. //{
  435. // LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"HED Flow {hedFlow} is less than {_hedFlowLowLimit}");
  436. // return false;
  437. //}
  438. _autoHedDelay = _delay_2s;
  439. _temperatureController.EnableOperation("", null);
  440. _temperatureController.SetTargetTemperatureOperation("", new object[] { _recipe.TemperatureSetPoint });
  441. return true;
  442. }
  443. /// <summary>
  444. /// 检验Hed是否成功
  445. /// </summary>
  446. /// <returns></returns>
  447. private bool AutoHedSuccess()
  448. {
  449. if (_temperatureController.TemperatureData.ControlOperationModel == 0)
  450. {
  451. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Temperature control is disable");
  452. return false;
  453. }
  454. if (Math.Abs(_recipe.TemperatureSetPoint - _temperatureController.TemperatureData.TargetTemperature) >= 0.1 * _recipe.TemperatureSetPoint)
  455. {
  456. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"recipe temperature {_recipe.TemperatureSetPoint} is not match temperature target point {_temperatureController.TemperatureData.TargetTemperature}");
  457. return false;
  458. }
  459. return true;
  460. }
  461. /// <summary>
  462. /// 检验Metal A/B PowerSupplier通信状态
  463. /// </summary>
  464. /// <returns></returns>
  465. private bool AutoMetalsPowerSupplierCommuncationStatus()
  466. {
  467. for (int i = 0; i < _metalDevices.Count; i++)
  468. {
  469. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  470. if (!hotMetalDevice.IsDisable && hotMetalDevice.IsAuto)
  471. {
  472. if (hotMetalDevice.SideAPowerSupplier == null)
  473. {
  474. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Side A PowerSupplier is null");
  475. return false;
  476. }
  477. if (hotMetalDevice.SideBPowerSupplier == null)
  478. {
  479. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Side B PowerSupplier is null");
  480. return false;
  481. }
  482. if (!hotMetalDevice.SideAPowerSupplier.IsConnected)
  483. {
  484. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Side A PowerSupplier {hotMetalDevice.SideAPowerSupplier.Name} is not connected");
  485. return false;
  486. }
  487. if (!hotMetalDevice.SideBPowerSupplier.IsConnected)
  488. {
  489. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Side B PowerSupplier {hotMetalDevice.SideBPowerSupplier.Name} is not connected");
  490. return false;
  491. }
  492. }
  493. }
  494. return true;
  495. }
  496. /// <summary>
  497. /// Auto Metal reset linmot
  498. /// </summary>
  499. /// <returns></returns>
  500. private bool AutoMetalResetLinmot()
  501. {
  502. for (int i = 0; i < _metalDevices.Count; i++)
  503. {
  504. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  505. if (hotMetalDevice.OperationMode == AUTO)
  506. {
  507. bool result = hotMetalDevice.ResetLinmot();
  508. if (!result)
  509. {
  510. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Reset linmot error");
  511. return false;
  512. }
  513. }
  514. }
  515. return true;
  516. }
  517. /// <summary>
  518. /// Auto Metal reset linmot
  519. /// </summary>
  520. /// <returns></returns>
  521. private bool CheckAutoMetalResetStatus()
  522. {
  523. if (_reservoirDevice.OperationMode == MANUAL)
  524. {
  525. return true;
  526. }
  527. for (int i = 0; i < _metalDevices.Count; i++)
  528. {
  529. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  530. if (hotMetalDevice.OperationMode == AUTO)
  531. {
  532. bool result = hotMetalDevice.CheckLinmotRoutineEnd();
  533. if (!result)
  534. {
  535. return false;
  536. }
  537. }
  538. }
  539. return true;
  540. }
  541. /// <summary>
  542. /// Auto Metal reset linmot
  543. /// </summary>
  544. /// <returns></returns>
  545. private bool CheckAutoMetalResetStopStatus()
  546. {
  547. if (_reservoirDevice.OperationMode == MANUAL)
  548. {
  549. return false;
  550. }
  551. for (int i = 0; i < _metalDevices.Count; i++)
  552. {
  553. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  554. if (hotMetalDevice.OperationMode == AUTO)
  555. {
  556. bool result = hotMetalDevice.CheckLinmotRoutineError();
  557. if (result)
  558. {
  559. return true;
  560. }
  561. }
  562. }
  563. return false;
  564. }
  565. /// Metal WS Unclamp
  566. /// </summary>
  567. /// <returns></returns>
  568. private bool MetalsWHUnclampOn()
  569. {
  570. for (int i = 0; i < _metalDevices.Count; i++)
  571. {
  572. StandardHotMetalDevice hotMetalDevice = _metalDevices[i];
  573. bool result = hotMetalDevice.WaferHolderClampOff("", null);
  574. if (!result)
  575. {
  576. return false;
  577. }
  578. }
  579. return true;
  580. }
  581. /// <summary>
  582. /// 清除alarm界面相关的dataerror
  583. /// </summary>
  584. private bool ClearAlarmDataError()
  585. {
  586. AlarmListManager.Instance.RemoveDataError(Module);
  587. _reservoirDevice.ClearErrorLogSet(Module); //清除device里面的ErrorLogSet
  588. return true;
  589. }
  590. /// <summary>
  591. /// 启动
  592. /// </summary>
  593. /// <param name="objs"></param>
  594. /// <returns></returns>
  595. public RState Start(params object[] objs)
  596. {
  597. List<MetalCellDevice> lstDevice = (List<MetalCellDevice>)objs[0];
  598. _metalDevices.Clear();
  599. for (int i = 0; i < lstDevice.Count; i++)
  600. {
  601. _metalDevices.Add((StandardHotMetalDevice)lstDevice[i]);
  602. }
  603. _reservoirDevice = DEVICE.GetDevice<StandardHotReservoirDevice>(Module.ToString());
  604. _recipe = _reservoirDevice.Recipe;
  605. if (!(objs[1] is null))
  606. {
  607. _cellPowerSupplier = (CellPowerSupplier)objs[1];
  608. }
  609. _temperatureController = (TemperatureController)objs[2];
  610. _hedFlowLowLimit = SC.GetValue<double>($"Reservoir.{Module}.HEDFlowLowLimit");
  611. if (!CheckPreCondition())
  612. {
  613. return RState.Failed;
  614. }
  615. _cmmFlowHighFault = SC.GetValue<double>($"Reservoir.{Module}.CMMFlowHighFault");
  616. _cmmFlowHighWarning = SC.GetValue<double>($"Reservoir.{Module}.CMMFlowHighWarning");
  617. _cmmFlowLowFault = SC.GetValue<double>($"Reservoir.{Module}.CMMFlowLowFault");
  618. _cmmFlowLowWarning = SC.GetValue<double>($"Reservoir.{Module}.CMMFlowLowWarning");
  619. _cmmFlowCheckDelay = SC.GetValue<int>($"Reservoir.{Module}.CMMFlowCheckDelaySeconds");
  620. if (_recipe.CMMEnable)
  621. {
  622. _persistentValue = ReservoirsPersistentManager.Instance.GetReservoirsPersistentValue(Module);
  623. }
  624. return Runner.Start(Module, "Start Initialize");
  625. }
  626. /// <summary>
  627. /// 检验前置条件
  628. /// </summary>
  629. /// <returns></returns>
  630. private bool CheckPreCondition()
  631. {
  632. if (_recipe == null)
  633. {
  634. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "recipe is null");
  635. return false;
  636. }
  637. if (_recipe.CMMEnable && !_cellPowerSupplier.IsConnected)
  638. {
  639. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "PowerSupplier is not connected");
  640. return false;
  641. }
  642. if (!_temperatureController.IsConnected)
  643. {
  644. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Temperature is not connected");
  645. return false;
  646. }
  647. return true;
  648. }
  649. }
  650. }