StandardHotReservoirInitializeRoutine.cs 25 KB

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