StandardHotReservoirInitializeRoutine.cs 27 KB

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