StandardHotReservoirInitializeRoutine.cs 26 KB

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