PMModuleRecipeExecutor.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Device.Unit;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.Log;
  5. using Aitex.Core.RT.ParameterCenter;
  6. using Aitex.Core.Util;
  7. using FurnaceRT.Devices;
  8. using FurnaceRT.Equipments.Boats;
  9. using FurnaceRT.Equipments.PMs.RecipeExecutions;
  10. using FurnaceRT.Equipments.Systems;
  11. using MECF.Framework.Common.CommonData.EnumData;
  12. using MECF.Framework.Common.Equipment;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Diagnostics;
  16. using System.IO;
  17. using System.Linq;
  18. using System.Xml;
  19. namespace FurnaceRT.Equipments.PMs
  20. {
  21. public partial class PMModule
  22. {
  23. public bool IsMainRecipeComplete { get; set; }
  24. public bool IsHeaterProfile { get; set; }
  25. public bool IsHeaterProfileSuccess { get; set; }
  26. public bool IsBoatMoveToLoadPosition { get; private set; }
  27. public bool IsWaitBoatMoveComplete { get; private set; }
  28. private string _boatTargetPosition;
  29. private R_TRIG _profileTrig = new R_TRIG();
  30. private R_TRIG _autoZeroAlarmTrig = new R_TRIG();
  31. public RecipeRunningInfo RecipeRunningInfo
  32. {
  33. get
  34. {
  35. return _recipeRunningInfo;
  36. }
  37. }
  38. public bool IsPaused { get; set; }//按了hold按键
  39. public bool IsHolded { get; set; }//按了hold按键之后,当前step执行完了
  40. public bool IsWait { get; set; }//等待wait条件的结束
  41. private int _autozeroretryTimes = 3;
  42. private int _autozeroCurrentTimes = 0;
  43. public void ResetToleranceChecker()
  44. {
  45. }
  46. public void OnProcessStart(string v1, string recipeName, bool v2)
  47. {
  48. }
  49. public void PauseRecipe(out string reason)
  50. {
  51. reason = string.Empty;
  52. }
  53. public bool CheckEndPoint()
  54. {
  55. return true;
  56. }
  57. public bool CheckAllDevicesStable(float v1, float v2, float v3, float v4, float v5, float v6, float v7, float v8, float v9)
  58. {
  59. return true;
  60. }
  61. public bool CheckEnableRunProcess(out string reason)
  62. {
  63. reason = string.Empty;
  64. return true;
  65. }
  66. public void AbortRunProcess(out string reason)
  67. {
  68. //GasSticks.ForEach(x => x.SetFlow(out _, 0, 0));
  69. reason = string.Empty;
  70. }
  71. private bool SetBoatManualMotion(object[] param)
  72. {
  73. if (param == null || param.Length < 1)
  74. {
  75. return false;
  76. }
  77. var paramArray = param[0].ToString().Split(';');
  78. var loaderCommand = paramArray[0].ToString();
  79. switch (loaderCommand.ToLower().Replace(" ", ""))
  80. {
  81. case "boatload":
  82. if (paramArray.Length > 3)
  83. {
  84. var boat = Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule;
  85. if (!boat.CheckPrepareMove(out string reason))
  86. {
  87. boat.BoatZAxisMoveFailedForInterlock.Set(reason);
  88. return false;
  89. }
  90. float.TryParse(paramArray[1], out float speed1);
  91. float.TryParse(paramArray[2], out float speed2);
  92. float.TryParse(paramArray[3], out float speed3);
  93. ZAxisDevice.SetServoMoveTo("Position2", out _, speed1);
  94. }
  95. break;
  96. case "boatunload":
  97. if (paramArray.Length > 3)
  98. {
  99. var boat = Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule;
  100. if (!boat.CheckPrepareMove(out string reason))
  101. {
  102. boat.BoatZAxisMoveFailedForInterlock.Set(reason);
  103. return false;
  104. }
  105. float.TryParse(paramArray[1], out float speed1);
  106. float.TryParse(paramArray[2], out float speed2);
  107. float.TryParse(paramArray[3], out float speed3);
  108. ZAxisDevice.SetServoMoveTo("Position3", out _, speed1);
  109. }
  110. break;
  111. case "boatloaderhome":
  112. {
  113. var boat = Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule;
  114. if (!boat.CheckPrepareMove(out string reason))
  115. {
  116. boat.BoatZAxisMoveFailedForInterlock.Set(reason);
  117. return false;
  118. }
  119. }
  120. ZAxisDevice.SetServoMoveTo("HomePosition", out _);
  121. break;
  122. case "boatcap2":
  123. if (paramArray.Length > 1)
  124. {
  125. var boat = Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule;
  126. if (!boat.CheckPrepareMove(out string reason))
  127. {
  128. boat.BoatZAxisMoveFailedForInterlock.Set(reason);
  129. return false;
  130. }
  131. float.TryParse(paramArray[1], out float speed);
  132. ZAxisDevice.SetServoMoveTo("CapPosition", out _, speed);
  133. }
  134. break;
  135. case "boatrotate":
  136. if (paramArray.Length > 1)
  137. {
  138. float.TryParse(paramArray[1], out float speed);
  139. RAxisDevice.SetServoMoveTo("CCW", out _, speed);
  140. }
  141. break;
  142. case "boatrotatestop"://r home
  143. RAxisDevice.ServoStop();
  144. RAxisDevice.SetServoHome();
  145. break;
  146. case "stop(includer-axis)":
  147. RAxisDevice.ServoStop();
  148. break;
  149. }
  150. return true;
  151. }
  152. private bool SetValves(object[] param)
  153. {
  154. var stopwatch = new Stopwatch();
  155. stopwatch.Start();
  156. if (param == null || param.Length < 1)
  157. {
  158. return false;
  159. }
  160. var paramArray = param[0].ToString().Split(';');
  161. for (int i = 0; i < paramArray.Length; i++)
  162. {
  163. var item = paramArray[i];
  164. if (string.IsNullOrEmpty(item))
  165. continue;
  166. var valveDatas = item.Split(',');
  167. if (valveDatas != null && valveDatas.Length > 1)
  168. {
  169. var valveName = valveDatas[0];
  170. var valveSet = valveDatas[1];
  171. if (valveSet == "Continue")
  172. continue;
  173. bool.TryParse(valveSet, out bool set);
  174. switch (valveName.ToUpper())
  175. {
  176. case "F2CLN":
  177. IsF2ClnOn = set;
  178. break;
  179. case "HFCLN":
  180. IsHFClnOn = set;
  181. break;
  182. case "HTR1":
  183. //_HTR1Group.ForEach(x => x.SetEnable(set));
  184. SetHTR1Enable(new object[1] { set });
  185. break;
  186. case "HTR2":
  187. //_HTR2Group.ForEach(x => x.SetEnable(set));
  188. SetHTR2Enable(new object[1] { set });
  189. break;
  190. case "HTR3":
  191. SetHTR3Enable(new object[1] { set });
  192. break;
  193. case "DEPO":
  194. SetDEPOEnable(new object[1] { set });
  195. break;
  196. case "DPR":
  197. valveName = "ValveAV91";
  198. if (_valves.Any(x => x.Name == valveName))
  199. {
  200. var valve = _valves.Find(x => x.Name == valveName);
  201. if (valve != null)
  202. valve.TurnValve(set, out _);
  203. }
  204. break;
  205. case "AGV":
  206. valveName = "AGVPump";
  207. if (_valves.Any(x => x.Name == valveName))
  208. {
  209. var valve = _valves.Find(x => x.Name == valveName);
  210. if (valve != null)
  211. valve.TurnValve(set, out _);
  212. }
  213. break;
  214. case "AGV2":
  215. valveName = "AGV2Pump";
  216. if (_valves.Any(x => x.Name == valveName))
  217. {
  218. var valve = _valves.Find(x => x.Name == valveName);
  219. if (valve != null)
  220. valve.TurnValve(set, out _);
  221. }
  222. break;
  223. case "MBP":
  224. case "MBP1":
  225. case "MBP2":
  226. case "DP":
  227. valveName = "BothPump";
  228. if (_valves.Any(x => x.Name == valveName))
  229. {
  230. var valve = _valves.Find(x => x.Name == valveName);
  231. if (valve != null)
  232. valve.TurnValve(set, out _);
  233. }
  234. break;
  235. case "DP1":
  236. valveName = "BothPump1";
  237. if (_valves.Any(x => x.Name == valveName))
  238. {
  239. var valve = _valves.Find(x => x.Name == valveName);
  240. if (valve != null)
  241. valve.TurnValve(set, out _);
  242. }
  243. break;
  244. case "DP2":
  245. valveName = "BothPump2";
  246. if (_valves.Any(x => x.Name == valveName))
  247. {
  248. var valve = _valves.Find(x => x.Name == valveName);
  249. if (valve != null)
  250. valve.TurnValve(set, out _);
  251. }
  252. break;
  253. case "BWR":
  254. valveName = "ValveBlowerPowerOn";
  255. if (_valves.Any(x => x.Name == valveName))
  256. {
  257. var valve = _valves.Find(x => x.Name == valveName);
  258. if (valve != null)
  259. valve.TurnValve(set, out _);
  260. }
  261. break;
  262. default:
  263. if (_valves.Any(x => x.Name == valveName))
  264. {
  265. var valve = _valves.Find(x => x.Name == valveName);
  266. if (valve != null)
  267. valve.TurnValve(set, out _);
  268. }
  269. break;
  270. }
  271. }
  272. }
  273. LOG.Write($"SetValves exec time {stopwatch.ElapsedMilliseconds}");
  274. return true;
  275. }
  276. private bool SetBoatMotion(object[] param)
  277. {
  278. var boatModule = Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule;
  279. if (param == null || param.Length < 1 || boatModule == null)
  280. {
  281. return false;
  282. }
  283. var paramArray = param[0].ToString().Split(';');
  284. var loaderCommand = paramArray[0].ToString();
  285. IsWaitBoatMoveComplete = false;
  286. IsBoatMoveToLoadPosition = false;
  287. switch (loaderCommand.ToLower().Replace(" ", ""))
  288. {
  289. case "boatload":
  290. if (paramArray.Length > 3)
  291. {
  292. float.TryParse(paramArray[1], out float speed1);
  293. float.TryParse(paramArray[2], out float speed2);
  294. float.TryParse(paramArray[3], out float speed3);
  295. IsWaitBoatMoveComplete = true;
  296. IsBoatMoveToLoadPosition = true;
  297. _boatTargetPosition = "Position2";
  298. //ZAxisDevice.SetServoMoveTo(_boatTargetPosition, out _, speed1);
  299. boatModule.BoatMove("boatload", _boatTargetPosition, speed1);
  300. }
  301. break;
  302. case "boatunload":
  303. if (paramArray.Length > 3)
  304. {
  305. float.TryParse(paramArray[1], out float speed1);
  306. float.TryParse(paramArray[2], out float speed2);
  307. float.TryParse(paramArray[3], out float speed3);
  308. IsWaitBoatMoveComplete = true;
  309. IsBoatMoveToLoadPosition = true;
  310. _boatTargetPosition = "Position3";
  311. //ZAxisDevice.SetServoMoveTo(_boatTargetPosition, out _, speed1);
  312. boatModule.BoatMove("boatunload", _boatTargetPosition, speed1);
  313. }
  314. break;
  315. case "boatloaderhome":
  316. IsWaitBoatMoveComplete = true;
  317. _boatTargetPosition = "HomePosition";
  318. //ZAxisDevice.SetServoMoveTo(_boatTargetPosition, out _);
  319. boatModule.BoatMove("boatloaderhome", _boatTargetPosition, 0);
  320. break;
  321. case "boatcap2":
  322. if (paramArray.Length > 1)
  323. {
  324. float.TryParse(paramArray[1], out float speed);
  325. IsWaitBoatMoveComplete = true;
  326. _boatTargetPosition = "CapPosition";
  327. //ZAxisDevice.SetServoMoveTo(_boatTargetPosition, out _, speed);
  328. boatModule.BoatMove("boatcap2", _boatTargetPosition, speed);
  329. }
  330. break;
  331. case "boatrotate":
  332. if (paramArray.Length > 4)
  333. {
  334. float.TryParse(paramArray[4], out float speed);
  335. //RAxisDevice.SetServoMoveTo("CCW", out _, speed);
  336. //boatModule.BoatMove("boatrotate", "CCW", speed);
  337. boatModule.RAxisDevice.SetServoMoveTo("CCW", out string reason, speed);//旋转直接发
  338. }
  339. break;
  340. case "boatrotatestop"://r home
  341. IsWaitBoatMoveComplete = true;
  342. _boatTargetPosition = "RotateHome";
  343. //RAxisDevice.ServoStop();
  344. //RAxisDevice.SetServoHome();
  345. boatModule.BoatMove("boatrotatestop", _boatTargetPosition, 0);
  346. break;
  347. case "stop(includer-axis)":
  348. //RAxisDevice.ServoStop();
  349. boatModule.BoatMove("stop(includer-axis)", "", 0);
  350. break;
  351. }
  352. return true;
  353. }
  354. public bool CheckBoatWaitCondition(out string reason)
  355. {
  356. reason = "";
  357. if (!IsWaitBoatMoveComplete)
  358. return true;
  359. if (_boatTargetPosition == "RotateHome")
  360. {
  361. if (!RAxisDevice.IsHomeDone)
  362. {
  363. reason = "rotate not home done";
  364. return false;
  365. }
  366. return (Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule).IsReady;
  367. }
  368. else
  369. {
  370. if (!ZAxisDevice.CheckServoAtPosition(_boatTargetPosition))
  371. {
  372. reason = $"elevator not at {_boatTargetPosition}";
  373. return false;
  374. }
  375. return (Singleton<EquipmentManager>.Instance.Modules[ModuleName.Boat] as BoatModule).IsReady;
  376. }
  377. }
  378. public bool CheckAPCWaitCondition(out string reason)
  379. {
  380. return APCDevice.CheckWaitCondition(out reason);
  381. }
  382. public bool CheckMFCWaitCondition(out string reason)
  383. {
  384. reason = "";
  385. var ret = true;
  386. foreach (var mfc in _processMFCs)
  387. {
  388. if (!mfc.CheckWaitCondition(out string info))
  389. {
  390. reason += $"{info} \n";
  391. ret = false;
  392. }
  393. }
  394. return ret;
  395. }
  396. public bool CheckHeaterWaitCondition(out string reason)
  397. {
  398. reason = "";
  399. var ret = true;
  400. foreach (var heater in _heaters)
  401. {
  402. if (!heater.CheckWaitCondition(out string info))
  403. {
  404. reason += $"{info} \n";
  405. ret = false;
  406. }
  407. }
  408. return ret;
  409. }
  410. public void AbortRecipe()
  411. {
  412. _processMFCs.ForEach(x => x.Terminate());
  413. _heaters.ForEach(x => x.Terminate());
  414. _valves.ForEach(x => x.Terminate());
  415. ZAxisDevice.ServoStop();
  416. RAxisDevice.ServoStop();
  417. APC.Terminate();
  418. AbortLeakCheck();
  419. IsWait = false;
  420. }
  421. public void HeaterEnable(bool isEnable)
  422. {
  423. _heaters.ForEach(x => x.SetEnable(isEnable));
  424. }
  425. public bool CheckHeaterProfileFinish(out string reason)
  426. {
  427. reason = "";
  428. if (_heaters.Any(x => x.IsProfileMode))
  429. {
  430. IsHeaterProfile = true;
  431. var ret = true;
  432. foreach (var heater in _heaters)
  433. {
  434. if (!heater.CheckProfileFinish(out string info))
  435. {
  436. reason += $"{info} \n";
  437. ret = false;
  438. }
  439. }
  440. if (!ret)
  441. {
  442. foreach (var heater in _heaters)
  443. {
  444. heater.IsProfileSuccess = false;//有任何一个没结束,所有都要接着判断
  445. }
  446. _profileTrig.CLK = false;
  447. return false;//有任何一个没结束
  448. }
  449. if (HeaterU.IsProfileSuccess &&
  450. HeaterCU.IsProfileSuccess &&
  451. HeaterC.IsProfileSuccess &&
  452. HeaterCL.IsProfileSuccess &&
  453. HeaterL.IsProfileSuccess)
  454. {
  455. IsHeaterProfileSuccess = true;
  456. _profileTrig.CLK = true;
  457. _heaters.ForEach(x => x.DeviceData.ProfileStatus = "Normal End");
  458. _heaters.ForEach(x => x.ProfileFinish());
  459. if (_profileTrig.Q)
  460. SaveHeaterProflieToCorrectTable(_heaters[0].CurrentCorrectFileName, _heaters[0].CurrentCorrectIndex);//更新profile table
  461. }
  462. return true;
  463. }
  464. else
  465. {
  466. _heaters.ForEach(x => x.ProfileFinish());
  467. return true;//不处于profile模式
  468. }
  469. }
  470. private void SaveHeaterProflieToCorrectTable(string correctFileName, int tableIndex)
  471. {
  472. var content = ParameterFileManager.Instance.LoadParameter("Parameter\\TempCorrection", correctFileName, false);
  473. if (string.IsNullOrEmpty(content))
  474. {
  475. EV.PostWarningLog(Module, $"{correctFileName} heater temperature correct file is empty");
  476. return;
  477. }
  478. var doc = new XmlDocument();
  479. doc.LoadXml(content);
  480. XmlNodeList nodeSteps = doc.SelectNodes($"Aitex/TableParameterData/Module[@Name='']/Step");
  481. if (nodeSteps == null)
  482. nodeSteps = doc.SelectNodes($"Aitex/TableParameterData/Step");
  483. if (nodeSteps == null)
  484. {
  485. EV.PostWarningLog(Module, $"Invalid heater temperature correct file {correctFileName}");
  486. return;
  487. }
  488. if (tableIndex < 1 || nodeSteps.Count < tableIndex)
  489. {
  490. EV.PostWarningLog(Module, $"{correctFileName} heater temperature correct file table id={tableIndex} is invalid");
  491. return;
  492. }
  493. XmlElement targetStepNode = nodeSteps[tableIndex - 1] as XmlElement;
  494. if (targetStepNode != null)
  495. {
  496. var correctionDataString = targetStepNode.GetAttribute("CorrectionData");
  497. if (string.IsNullOrEmpty(correctionDataString))
  498. {
  499. EV.PostWarningLog(Module, $"Heater temperature correct file is empty");
  500. return;
  501. }
  502. var correctionDatas = correctionDataString.Split('|');
  503. if (correctionDatas.Length < 5)
  504. {
  505. EV.PostWarningLog(Module, $"Heater temperature correct file data length is invalid");
  506. return;
  507. }
  508. List<string> newCorrectionDatas = new List<string>();
  509. for (int i = 0; i < correctionDatas.Length; i++)
  510. {
  511. var datas = correctionDatas[i];
  512. var dataArry = datas.Split(';');
  513. if (dataArry.Length < 6)
  514. {
  515. EV.PostWarningLog(Module, $"Heater temperature correct file data length is invalid");
  516. return;
  517. }
  518. var correctParameter = new CorrectParameter();
  519. foreach (var item in dataArry)
  520. {
  521. var itemArry = item.Split(':');
  522. if (itemArry.Length < 2)
  523. {
  524. EV.PostWarningLog(Module, $"Heater temperature correct file data length is invalid");
  525. return;
  526. }
  527. switch (itemArry[0].ToLower())
  528. {
  529. case "index":
  530. int.TryParse(itemArry[1], out int no);
  531. correctParameter.No = no;
  532. break;
  533. case "name":
  534. correctParameter.Name = itemArry[1];
  535. break;
  536. case "profiletemp":
  537. float.TryParse(itemArry[1], out float profiletemp);
  538. correctParameter.ProfileTemp = profiletemp;
  539. break;
  540. case "profilecorrect":
  541. float.TryParse(itemArry[1], out float profilecorrect);
  542. correctParameter.ProfileCorrect = profilecorrect;
  543. break;
  544. case "cascadetccorrect":
  545. float.TryParse(itemArry[1], out float cascadetccorrect);
  546. correctParameter.CascadeTCCorrect = cascadetccorrect;
  547. break;
  548. case "profiletccalib":
  549. float.TryParse(itemArry[1], out float profiletccalib);
  550. correctParameter.ProfileTCCalib = profiletccalib;
  551. break;
  552. }
  553. }
  554. FurnaceRT.Devices.IoHeater heater = null;
  555. if (_heaters.Count > i)
  556. {
  557. heater = _heaters[i];
  558. }
  559. if (heater != null)
  560. {
  561. newCorrectionDatas.Add($"Index:{correctParameter.No};Name:{correctParameter.Name};ProfileTemp:{heater.DeviceData.HeaterPV};ProfileCorrect:{(heater.DeviceData.HeaterPV - heater.DeviceData.CascadePV).ToString("f1")};CascadeTCCorrect:{heater.DeviceData.CascadePV};ProfileTCCalib:{correctParameter.ProfileTCCalib}");
  562. heater.DeviceData.ProfileResult = correctParameter.ProfileCorrect;
  563. }
  564. }
  565. if (newCorrectionDatas.Count == correctionDatas.Length)
  566. targetStepNode.SetAttribute("CorrectionData", string.Join("|", newCorrectionDatas.ToArray()));
  567. LOG.Write($"Profile result {correctFileName}:{tableIndex} CorrectionData={string.Join("|", newCorrectionDatas.ToArray())}");
  568. //FileStream fileStream = new FileStream(ParameterFileManager.Instance.GenerateParameterFilePath("Parameter\\TempCorrection", correctFileName), FileMode.Create);
  569. //doc.Save(fileStream);
  570. using (FileStream fileStream = new FileStream(ParameterFileManager.Instance.GenerateParameterFilePath("Parameter\\TempCorrection", correctFileName), FileMode.Create))
  571. {
  572. doc.Save(fileStream);
  573. }
  574. }
  575. }
  576. private bool SetAlarmConditionTable(object[] param)
  577. {
  578. if (param == null || param.Length < 1)
  579. {
  580. return false;
  581. }
  582. var array = param[0].ToString().Split(':');
  583. int.TryParse(array[0], out int index);
  584. lock (_alarmConditionLocker)
  585. {
  586. SetAlarmConditionTableIndex(index);
  587. }
  588. return true;
  589. }
  590. public bool CheckVGAutoZero()
  591. {
  592. if (RecipeRunningInfo.AutoZeroState == EnumAutoZeroState.None) { return true; }
  593. string reason = string.Empty;
  594. #region 检测是否变成running,running后关闭使能
  595. if (_trigVG13AutoZeroControl != null)
  596. {
  597. if (_trigVG13AutoZeroControl.DoTrigger?.Value == true && _trigVG13AutoZeroControl.Value)
  598. {
  599. if (_trigVG13AutoZeroControl.SetTrigger(false, out reason))
  600. RecipeRunningInfo.AutoZeroState = EnumAutoZeroState.Running;
  601. else LOG.Warning($"VG13 Auto Zero Warning:TrigVG13AutoZeroControl SetTrigger [false] fail:{reason}");
  602. }
  603. }
  604. else
  605. {
  606. RecipeRunningInfo.AutoZeroState = EnumAutoZeroState.None;
  607. LOG.Warning($"VG13 Auto Zero Warning: TrigVG13AutoZeroControl is null");
  608. return true;
  609. }
  610. #endregion
  611. //是否收到finish信号,电气确认自行判断时间5s无返回会给alarm信号
  612. if (_trigVG13AutoZeroValue != null)
  613. {
  614. if (_trigVG13AutoZeroValue?.Value == true)
  615. {
  616. RecipeRunningInfo.AutoZeroState = EnumAutoZeroState.Finish;
  617. return true;
  618. }
  619. }
  620. //是否报警,报警后重试,下发使能电气会自动清除alarm报警信号
  621. if (_alarmSignals.Find(r => r.Name == "AlarmSignalVG13AutoZeroAlarm") is IoAlarmSignal vgAlarm && vgAlarm != null)
  622. {
  623. _autoZeroAlarmTrig.CLK = vgAlarm.RrigSignalOn.CLK;
  624. if (_autoZeroAlarmTrig.Q)
  625. {
  626. if (++_autozeroCurrentTimes > _autozeroretryTimes)
  627. {
  628. RecipeRunningInfo.AutoZeroState = EnumAutoZeroState.Alarm;
  629. EV.PostAlarmLog(Module, $"VG13 Auto Zero Failed: retry [{_autozeroretryTimes}] times VG13 Auto Zero Alarm already trigged");
  630. if (_trigVG13AutoZeroControl.DoTrigger?.Value == true)
  631. {
  632. if (!_trigVG13AutoZeroControl.SetTrigger(false, out reason))
  633. {
  634. LOG.Warning($"VG13 Auto Zero Alarm:TrigVG13AutoZeroControl SetTrigger [false] fail:{reason}");
  635. }
  636. }
  637. return true;
  638. }
  639. if (!StartVG13AutoZero(true, out reason))
  640. {
  641. LOG.Warning($"VG13 Auto Zero Alarm:TrigVG13AutoZeroControl SetTrigger [true] fail:{reason},retry [{_autozeroCurrentTimes}] times");
  642. }
  643. else
  644. LOG.Warning($"VG13 Auto Zero Alarm: retry [{_autozeroCurrentTimes}] times");
  645. }
  646. }
  647. return false;
  648. }
  649. }
  650. }