PMAux.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.Event;
  5. using Aitex.Core.RT.IOCore;
  6. using Aitex.Core.RT.Log;
  7. using Aitex.Core.RT.OperationCenter;
  8. using Aitex.Core.RT.SCCore;
  9. using Aitex.Core.Util;
  10. using Aitex.Core.Utilities;
  11. using FurnaceRT.Devices;
  12. using MECF.Framework.Common.DataCenter;
  13. using MECF.Framework.Common.Event;
  14. using MECF.Framework.Common.OperationCenter;
  15. using System;
  16. using System.Collections;
  17. using System.Collections.Generic;
  18. using System.Diagnostics;
  19. using System.Linq;
  20. namespace FurnaceRT.Equipments.PMs
  21. {
  22. public partial class PMModule
  23. {
  24. private Dictionary<int, List<AITAuxData>> _auxDic;
  25. private int _currentAuxTable = 1;
  26. private bool _isF2ClnOn;
  27. private bool _isHFClnOn;
  28. private bool _isDEPOOn;
  29. private bool _isHTR1Enable;
  30. private bool _isHTR2Enable;
  31. private bool _isHTR3Enable;
  32. private bool _isCEXHOn;
  33. private string _toolType;
  34. private Dictionary<string, float> _auxScaleDic;
  35. private Stopwatch _initTimer = new Stopwatch();
  36. private List<string> _auxNames = new List<string>();
  37. public bool IsHTR1Enable
  38. {
  39. get
  40. {
  41. return _isHTR1Enable;
  42. }
  43. set
  44. {
  45. _isHTR1Enable = value;
  46. SC.SetItemValue($"PM1.IsHTR1Enable", value);
  47. TrigHTR1SWON?.SetTrigger(value, out _);
  48. //_HTR1Group.ForEach(x => x.SetEnable(value));
  49. }
  50. }
  51. public bool IsHTR2Enable
  52. {
  53. get
  54. {
  55. return _isHTR2Enable;
  56. }
  57. set
  58. {
  59. _isHTR2Enable = value;
  60. SC.SetItemValue($"PM1.IsHTR2Enable", value);
  61. TrigHTR2SWON?.SetTrigger(value, out _);
  62. _HTR2Group.ForEach(x => x.SetEnable(value));
  63. }
  64. }
  65. public bool IsHTR3Enable
  66. {
  67. get
  68. {
  69. return _isHTR3Enable;
  70. }
  71. set
  72. {
  73. _isHTR3Enable = value;
  74. SC.SetItemValue($"PM1.IsHTR3Enable", value);
  75. TrigHTR3SWON?.SetTrigger(value, out _);
  76. TrigForlineHeaterOn.SetTrigger(value, out _);
  77. }
  78. }
  79. public bool IsF2ClnOn
  80. {
  81. get
  82. {
  83. return _isF2ClnOn;
  84. }
  85. set
  86. {
  87. _isF2ClnOn = value;
  88. SC.SetItemValue($"PM1.IsF2ClnOn", value);
  89. TrigF2CleanSwitchB?.SetTrigger(value, out _);
  90. }
  91. }
  92. public bool IsHFClnOn
  93. {
  94. get
  95. {
  96. return _isHFClnOn;
  97. }
  98. set
  99. {
  100. _isHFClnOn = value;
  101. SC.SetItemValue($"PM1.IsHFClnOn", value);
  102. TrigHFCleanSwitchB?.SetTrigger(value, out _);
  103. }
  104. }
  105. public bool IsDEPOOn
  106. {
  107. get
  108. {
  109. return _isDEPOOn;
  110. }
  111. set
  112. {
  113. _isDEPOOn = value;
  114. SC.SetItemValue($"PM1.IsDEPOOn", value);
  115. TrigDEPOSW?.SetTrigger(value, out _);
  116. }
  117. }
  118. public bool IsCREFOn
  119. {
  120. get
  121. {
  122. return _isCREFOn;
  123. }
  124. set
  125. {
  126. _isCREFOn = value;
  127. TrigCREFON?.SetTrigger(value, out _);
  128. }
  129. }
  130. private bool _isCREFOn;
  131. public bool IsSIREFOn
  132. {
  133. get
  134. {
  135. return _isSIREFOn;
  136. }
  137. set
  138. {
  139. _isSIREFOn = value;
  140. TrigSIREFON?.SetTrigger(value, out _);
  141. }
  142. }
  143. private bool _isSIREFOn;
  144. private void InitAUX()
  145. {
  146. GetAuxNames();
  147. IsHFClnOn = SC.GetValue<bool>($"PM1.IsHFClnOn");
  148. IsF2ClnOn = SC.GetValue<bool>($"PM1.IsF2ClnOn");
  149. _toolType = (string)SC.GetStringValue("System.SetUp.ToolType");
  150. _auxDic = new Dictionary<int, List<AITAuxData>>();
  151. for (int table = 1; table < 5; table++)
  152. {
  153. List<AITAuxData> auxs = new List<AITAuxData>();
  154. for (int index = 1; index < 256; index++)
  155. {
  156. if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.Set"))
  157. continue;
  158. if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningLowLimit"))
  159. continue;
  160. if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningHighLimit"))
  161. continue;
  162. if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmLowLimit"))
  163. continue;
  164. if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmHighLimit"))
  165. continue;
  166. if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.{index}.Display"))
  167. continue;
  168. if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.{index}.AI"))
  169. continue;
  170. if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.{index}.Unit"))
  171. continue;
  172. AITAuxData aux = new AITAuxData()
  173. {
  174. DisplayName = SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display"),
  175. DisplayNameConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.{index}.Display"),
  176. IOName = SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI"),
  177. AO = IO.AO[$"{Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO")}"],
  178. AISV = IO.AI[$"{Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI").Replace("PV", "SV")}"],
  179. AOAlarmHigher = IO.AO[$"{Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO").Replace("SV", "AlarmHigher")}"],
  180. AOAlarmLower = IO.AO[$"{Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO").Replace("SV", "AlarmLower")}"],
  181. Unit = SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Unit"),
  182. UnitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.{index}.Unit"),
  183. SetPoint = (float)SC.GetValue<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.Set"),
  184. SetPointConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.Set"),
  185. WarningLowLimit = (float)SC.GetValue<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningLowLimit"),
  186. WarningLowLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningLowLimit"),
  187. WarningHighLimit = (float)SC.GetValue<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningHighLimit"),
  188. WarningHighLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningHighLimit"),
  189. AlarmLowLimit = (float)SC.GetValue<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmLowLimit"),
  190. AlarmLowLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmLowLimit"),
  191. AlarmHighLimit = (float)SC.GetValue<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmHighLimit"),
  192. AlarmHighLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmHighLimit"),
  193. WarningLowLimitTrig = new R_TRIG(),
  194. WarningHighLimitTrig = new R_TRIG(),
  195. AlarmLowLimitTrig = new R_TRIG(),
  196. AlarmHighLimitTrig = new R_TRIG(),
  197. Index = index,
  198. WarningLowLimitEvent = SubscribeAlarm(new AlarmEventItem()
  199. {
  200. EventEnum = $"{Name}.WarningLowLimit.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}",
  201. Description = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display")} Low Limit",
  202. Solution = "No information available. Press[Clear] to delete alarm message.",
  203. Explaination = "No information available.",
  204. AutoRecovery = false,
  205. Level = EventLevel.Warning,
  206. Action = EventAction.Clear,
  207. Category = "TubeAlarm",
  208. }, () => { ResetAUXTrig(); return true; }),
  209. WarningHighLimitEvent = SubscribeAlarm(new AlarmEventItem()
  210. {
  211. EventEnum = $"{Name}.WarningHighLimit.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}",
  212. Description = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display")} High Limit",
  213. Solution = "No information available. Press[Clear] to delete alarm message.",
  214. Explaination = "No information available.",
  215. AutoRecovery = false,
  216. Level = EventLevel.Warning,
  217. Action = EventAction.Clear,
  218. Category = "TubeAlarm",
  219. }, () => { ResetAUXTrig(); return true; }),
  220. AlarmLowLimitEvent = SubscribeAlarm(new AlarmEventItem()
  221. {
  222. EventEnum = $"{Name}.AlarmLowLimit.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}",
  223. Description = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display")} Low Limit",
  224. Solution = "No information available. Press[Clear] to delete alarm message.",
  225. Explaination = "No information available.",
  226. AutoRecovery = false,
  227. Level = EventLevel.Alarm,
  228. Action = EventAction.Clear,
  229. Category = "TubeAlarm",
  230. }, () => { ResetAUXTrig(); return true; }),
  231. AlarmHighLimitEvent = SubscribeAlarm(new AlarmEventItem()
  232. {
  233. EventEnum = $"{Name}.AlarmHighLimit.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}",
  234. Description = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display")} High Limit",
  235. Solution = "No information available. Press[Clear] to delete alarm message.",
  236. Explaination = "No information available.",
  237. AutoRecovery = false,
  238. Level = EventLevel.Alarm,
  239. Action = EventAction.Clear,
  240. Category = "TubeAlarm",
  241. }, () => { ResetAUXTrig(); return true; }),
  242. };
  243. if (SC.GetStringValue("System.SetUp.ToolType") == "ELK")
  244. {
  245. if (index <= 96)
  246. {
  247. if (aux.DisplayName.Length > 5)
  248. aux.Module = aux.DisplayName.Substring(0, 5).Replace("Unit", "GasLine");
  249. aux.IOName = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}";
  250. aux.AO = IO.AO[$"{aux.Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO")}"];
  251. aux.AISV = null;
  252. aux.AOAlarmHigher = IO.AO[$"{aux.Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO").Replace("SV", "AlarmHigherPoint")}"];
  253. aux.AOAlarmLower = IO.AO[$"{aux.Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO").Replace("SV", "AlarmLowerPoint")}"];
  254. }
  255. }
  256. else
  257. {
  258. //需求: aux只需要gasline heater,Foline heater的alarm 不需要报警(序号68之后都是Foline heater)
  259. if (index >= 68)
  260. {
  261. aux.WarningLowLimitEvent = new AlarmEventItem();
  262. aux.WarningHighLimitEvent = new AlarmEventItem();
  263. aux.AlarmLowLimitEvent = new AlarmEventItem();
  264. aux.AlarmHighLimitEvent = new AlarmEventItem();
  265. }
  266. }
  267. auxs.Add(aux);
  268. }
  269. if (auxs.Any())
  270. _auxDic.Add(table, auxs);
  271. }
  272. _auxScaleDic = new Dictionary<string, float>()
  273. {
  274. { "AI_ForelineHeater1TempPV", 1},
  275. { "AI_ForelineHeater2TempPV", 1},
  276. { "AI_ForelineHeater3TempPV", 1},
  277. { "AI_ForelineHeater4TempPV", 1},
  278. { "AI_ForelineHeater5TempPV", 1},
  279. { "AI_ForelineHeater6TempPV", 1},
  280. { "AI_ForelineHeater7TempPV", 1},
  281. { "AI_ForelineHeater8TempPV", 1},
  282. { "AI_ForelineHeater9TempPV", 1},
  283. { "AI_ForelineHeater10TempPV", 1},
  284. { "AI_ForelineHeater11TempPV", 1},
  285. { "AI_ForelineHeater12TempPV", 1},
  286. { "AI_CapHeaterTempPV", 1},
  287. { "AI_APCExternalHeaterTempPV", 1},
  288. { "AI_APCRingHeaterTempPV", 1},
  289. { "AI_GaslineHeater1PV", 1},
  290. { "AI_GaslineHeater2PV", 1},
  291. { "AI_GaslineHeater3PV", 1},
  292. { "AI_GaslineHeater4PV", 1},
  293. { "AI_GaslineHeater5PV", 1},
  294. { "AI_GaslineHeater6PV", 1},
  295. { "AI_GaslineHeater7PV", 1},
  296. { "AI_GaslineHeater8PV", 1},
  297. { "AI_GaslineHeater9PV", 1},
  298. { "AI_GaslineHeater10PV", 1},
  299. { "AI_GaslineHeater11PV", 1},
  300. { "AI_GaslineHeater12PV", 1},
  301. { "AI_GaslineHeater13PV", 1},
  302. { "AI_GaslineHeater14PV", 1},
  303. { "AI_GaslineHeater15PV", 1},
  304. { "AI_GaslineHeater16PV", 1},
  305. { "AI_GaslineHeater17PV", 1},
  306. { "AI_GaslineHeater18PV", 1},
  307. { "AI_GaslineHeater19PV", 1},
  308. { "AI_GaslineHeater20PV", 1},
  309. { "AI_GaslineHeater21PV", 1},
  310. { "AI_GaslineHeater22PV", 1},
  311. { "AI_GaslineHeater23PV", 1},
  312. { "AI_GaslineHeater24PV", 1},
  313. { "AI_GaslineHeater25PV", 1},
  314. { "AI_GaslineHeater26PV", 1},
  315. { "AI_GaslineHeater27PV", 1},
  316. { "AI_GaslineHeater28PV", 1},
  317. { "AI_GaslineHeater29PV", 1},
  318. { "AI_GaslineHeater30PV", 1},
  319. { "AI_GaslineHeater31PV", 1},
  320. { "AI_GaslineHeater32PV", 1},
  321. { "AI_GaslineHeater33PV", 1},
  322. { "AI_GaslineHeater34PV", 1},
  323. { "AI_GaslineHeater35PV", 1},
  324. { "AI_GaslineHeater36PV", 1},
  325. { "AI_GaslineHeater37PV", 1},
  326. { "AI_GaslineHeater38PV", 1},
  327. { "AI_GaslineHeater39PV", 1},
  328. { "AI_GaslineHeater40PV", 1},
  329. { "AI_GaslineHeater44PV", 1},
  330. { "AI_GaslineHeater45PV", 1},
  331. { "AI_GaslineHeater49PV", 1},
  332. { "AI_GaslineHeater50PV", 1},
  333. { "AI_GaslineHeater51PV", 1},
  334. { "AI_GaslineHeater52PV", 1},
  335. { "AI_GaslineHeater53PV", 1},
  336. { "AI_GaslineHeater54PV", 1},
  337. { "AI_GaslineHeater55PV", 1},
  338. { "AI_GaslineHeater56PV", 1},
  339. { "AI_GaslineHeater57PV", 1},
  340. { "AI_GaslineHeater58PV", 1},
  341. { "AI_GaslineHeater59PV", 1},
  342. { "AI_GaslineHeater60PV", 1},
  343. { "AI_GaslineHeater61PV", 1},
  344. { "AI_GaslineHeater62PV", 1},
  345. { "AI_GaslineHeater63PV", 1},
  346. { "AI_GaslineHeater64PV", 1},
  347. };
  348. DATA.Subscribe($"{Module}.CurrentAuxData", () => GetCurrentAuxData());
  349. _initTimer.Start();
  350. }
  351. private void GetAuxNames()
  352. {
  353. for (int i = 52; i < 63; i++)
  354. {
  355. _auxNames.Add($"Gasline heater{i} PV");
  356. }
  357. }
  358. private void ResetAUXTrig()
  359. {
  360. if (_auxDic != null && _auxDic.ContainsKey(_currentAuxTable))
  361. {
  362. foreach (var item in _auxDic[_currentAuxTable])
  363. {
  364. if (item == null)
  365. continue;
  366. item.WarningLowLimitTrig.RST = true;
  367. item.WarningHighLimitTrig.RST = true;
  368. item.AlarmLowLimitTrig.RST = true;
  369. item.AlarmHighLimitTrig.RST = true;
  370. }
  371. }
  372. }
  373. private List<AITAuxData> GetCurrentAuxData()
  374. {
  375. var datas = new List<AITAuxData>();
  376. if (_auxDic != null && _auxDic.ContainsKey(_currentAuxTable))
  377. {
  378. foreach (var item in _auxDic[_currentAuxTable])
  379. {
  380. if (item == null)
  381. continue;
  382. var data = new AITAuxData();
  383. data.AlarmHighLimit = item.AlarmHighLimit;
  384. data.AlarmLowLimit = item.AlarmLowLimit;
  385. data.WarningLowLimit = item.WarningLowLimit;
  386. data.WarningHighLimit = item.WarningHighLimit;
  387. data.SetPoint = item.AISV != null ? item.AISV.FloatValue : item.SetPoint;
  388. data.DisplayName = item.DisplayName;
  389. data.IOName = item.IOName;
  390. data.Unit = item.Unit;
  391. data.Feedback = item.Feedback;
  392. data.Index = item.Index;
  393. datas.Add(data);
  394. }
  395. }
  396. return datas;
  397. }
  398. private void MonitorFfu()
  399. {
  400. _isCEXHOn = _fFUs != null && !_fFUs.Any(x => !x.IsEnable);
  401. }
  402. private void MonitorAux()
  403. {
  404. if (_initTimer.IsRunning && _initTimer.ElapsedMilliseconds < 3000)
  405. {
  406. _initTimer.Stop();
  407. return;
  408. }
  409. if (IsHTR1Enable != SC.GetValue<bool>("PM1.IsHTR1Enable"))
  410. IsHTR1Enable = SC.GetValue<bool>("PM1.IsHTR1Enable");
  411. if (IsHTR2Enable != SC.GetValue<bool>("PM1.IsHTR2Enable"))
  412. IsHTR2Enable = SC.GetValue<bool>("PM1.IsHTR2Enable");
  413. if (IsHTR3Enable != SC.GetValue<bool>("PM1.IsHTR3Enable"))
  414. IsHTR3Enable = SC.GetValue<bool>("PM1.IsHTR3Enable");
  415. if (IsHTR1Enable && IsHTR2Enable && IsF2ClnOn)
  416. {
  417. if (_currentAuxTable != 2)
  418. {
  419. _currentAuxTable = 2;
  420. LOG.Write($"AUC table switch to {_currentAuxTable}");
  421. }
  422. }
  423. else if (IsHTR1Enable && IsHTR2Enable && IsHFClnOn)
  424. {
  425. if (_currentAuxTable != 3)
  426. {
  427. _currentAuxTable = 3;
  428. LOG.Write($"AUC table switch to {_currentAuxTable}");
  429. }
  430. }
  431. else if (IsHTR1Enable)
  432. {
  433. if (_currentAuxTable != 1)
  434. {
  435. _currentAuxTable = 1;
  436. LOG.Write($"AUC table switch to {_currentAuxTable}");
  437. }
  438. }
  439. if (TrigGasLine1PowerOn != null && IsHTR1Enable!= TrigGasLine1PowerOn.Value)
  440. {
  441. TrigGasLine1PowerOn?.SetTrigger(IsHTR1Enable, out _);
  442. }
  443. if (TrigGasLine2PowerOn != null && IsHTR1Enable != TrigGasLine2PowerOn.Value)
  444. {
  445. TrigGasLine2PowerOn?.SetTrigger(IsHTR1Enable, out _);
  446. }
  447. if (TrigGasLine3PowerOn != null && IsHTR1Enable != TrigGasLine3PowerOn.Value)
  448. {
  449. TrigGasLine3PowerOn?.SetTrigger(IsHTR1Enable, out _);
  450. }
  451. if (TrigGasLine4PowerOn != null && IsHTR2Enable != TrigGasLine4PowerOn.Value)
  452. {
  453. TrigGasLine4PowerOn?.SetTrigger(IsHTR2Enable, out _);
  454. }
  455. if (TrigGasLine6PowerOn != null && IsHTR2Enable != TrigGasLine6PowerOn.Value)
  456. {
  457. TrigGasLine6PowerOn?.SetTrigger(IsHTR2Enable, out _);
  458. }
  459. if (TrigGasLine7PowerOn != null && IsHTR2Enable != TrigGasLine7PowerOn.Value)
  460. {
  461. TrigGasLine7PowerOn?.SetTrigger(IsHTR2Enable, out _);
  462. }
  463. if (IsHTR1Enable && IsHTR2Enable && IsF2ClnOn)
  464. {
  465. if (TrigGasLineHeaterMemoryChange != null && TrigGasLineHeaterMemoryChange.AOValue != 2)
  466. TrigGasLineHeaterMemoryChange.SetAOTrigger(2, out _);
  467. if (TrigGasLine1RecipeChange != null && TrigGasLine1RecipeChange.AOValue != 2)
  468. TrigGasLine1RecipeChange.SetAOTrigger(2, out _);
  469. if (TrigGasLine2RecipeChange != null && TrigGasLine2RecipeChange.AOValue != 2)
  470. TrigGasLine2RecipeChange.SetAOTrigger(2, out _);
  471. if (TrigGasLine3RecipeChange != null && TrigGasLine3RecipeChange.AOValue != 2)
  472. TrigGasLine3RecipeChange.SetAOTrigger(2, out _);
  473. if (TrigGasLine4RecipeChange != null && TrigGasLine4RecipeChange.AOValue != 2)
  474. TrigGasLine4RecipeChange.SetAOTrigger(2, out _);
  475. if (TrigGasLine6RecipeChange != null && TrigGasLine6RecipeChange.AOValue != 2)
  476. TrigGasLine6RecipeChange.SetAOTrigger(2, out _);
  477. if (TrigGasLine7RecipeChange != null && TrigGasLine7RecipeChange.AOValue != 2)
  478. TrigGasLine7RecipeChange.SetAOTrigger(2, out _);
  479. }
  480. else if (IsHTR1Enable || IsHTR2Enable)
  481. {
  482. if (IsHTR1Enable)
  483. {
  484. if (TrigGasLineHeaterMemoryChange != null && TrigGasLineHeaterMemoryChange.AOValue != 1)
  485. {
  486. TrigGasLineHeaterMemoryChange.SetAOTrigger(1, out _);
  487. }
  488. if (TrigGasLine1RecipeChange != null && TrigGasLine1RecipeChange.AOValue != 1)
  489. {
  490. TrigGasLine1RecipeChange?.SetAOTrigger(1, out _);
  491. }
  492. if (TrigGasLine2RecipeChange != null && TrigGasLine2RecipeChange.AOValue != 1)
  493. {
  494. TrigGasLine2RecipeChange?.SetAOTrigger(1, out _);
  495. }
  496. if (TrigGasLine3RecipeChange != null && TrigGasLine3RecipeChange.AOValue != 1)
  497. {
  498. TrigGasLine3RecipeChange?.SetAOTrigger(1, out _);
  499. }
  500. }
  501. else
  502. {
  503. if (TrigGasLineHeaterMemoryChange != null && TrigGasLineHeaterMemoryChange.AOValue != 0)
  504. {
  505. TrigGasLineHeaterMemoryChange.SetAOTrigger(0, out _);
  506. }
  507. if (TrigGasLine1RecipeChange != null && TrigGasLine1RecipeChange.AOValue != 0)
  508. {
  509. TrigGasLine1RecipeChange?.SetAOTrigger(0, out _);
  510. }
  511. if (TrigGasLine2RecipeChange != null && TrigGasLine2RecipeChange.AOValue != 0)
  512. {
  513. TrigGasLine2RecipeChange?.SetAOTrigger(0, out _);
  514. }
  515. if (TrigGasLine3RecipeChange != null && TrigGasLine3RecipeChange.AOValue != 0)
  516. {
  517. TrigGasLine3RecipeChange?.SetAOTrigger(0, out _);
  518. }
  519. }
  520. if (IsHTR2Enable)
  521. {
  522. if (TrigGasLine4RecipeChange != null && TrigGasLine4RecipeChange.AOValue != 1)
  523. {
  524. TrigGasLine4RecipeChange?.SetAOTrigger(1, out _);
  525. }
  526. if (TrigGasLine6RecipeChange != null && TrigGasLine6RecipeChange.AOValue != 1)
  527. {
  528. TrigGasLine6RecipeChange?.SetAOTrigger(1, out _);
  529. }
  530. if (TrigGasLine7RecipeChange != null && TrigGasLine7RecipeChange.AOValue != 1)
  531. {
  532. TrigGasLine7RecipeChange?.SetAOTrigger(1, out _);
  533. }
  534. }
  535. else
  536. {
  537. if (TrigGasLine4RecipeChange != null && TrigGasLine4RecipeChange.AOValue != 0)
  538. {
  539. TrigGasLine4RecipeChange?.SetAOTrigger(0, out _);
  540. }
  541. if (TrigGasLine6RecipeChange != null && TrigGasLine6RecipeChange.AOValue != 0)
  542. {
  543. TrigGasLine6RecipeChange?.SetAOTrigger(0, out _);
  544. }
  545. if (TrigGasLine7RecipeChange != null && TrigGasLine7RecipeChange.AOValue != 0)
  546. {
  547. TrigGasLine7RecipeChange?.SetAOTrigger(0, out _);
  548. }
  549. }
  550. }
  551. else
  552. {
  553. if (TrigGasLineHeaterMemoryChange != null && TrigGasLineHeaterMemoryChange.AOValue != 0)
  554. TrigGasLineHeaterMemoryChange.SetAOTrigger(0, out _);
  555. if (TrigGasLine1RecipeChange != null && TrigGasLine1RecipeChange.AOValue != 0)
  556. TrigGasLine1RecipeChange.SetAOTrigger(0, out _);
  557. if (TrigGasLine2RecipeChange != null && TrigGasLine2RecipeChange.AOValue != 0)
  558. TrigGasLine2RecipeChange.SetAOTrigger(0, out _);
  559. if (TrigGasLine3RecipeChange != null && TrigGasLine3RecipeChange.AOValue != 0)
  560. TrigGasLine3RecipeChange.SetAOTrigger(0, out _);
  561. if (TrigGasLine4RecipeChange != null && TrigGasLine4RecipeChange.AOValue != 0)
  562. TrigGasLine4RecipeChange.SetAOTrigger(0, out _);
  563. if (TrigGasLine6RecipeChange != null && TrigGasLine6RecipeChange.AOValue != 0)
  564. TrigGasLine6RecipeChange.SetAOTrigger(0, out _);
  565. if (TrigGasLine7RecipeChange != null && TrigGasLine7RecipeChange.AOValue != 0)
  566. TrigGasLine7RecipeChange.SetAOTrigger(0, out _);
  567. }
  568. if (_auxDic != null && _auxDic.ContainsKey(_currentAuxTable))
  569. {
  570. if (IsProcessing)
  571. {
  572. foreach (var item in _auxDic[_currentAuxTable])
  573. {
  574. if (item == null)
  575. continue;
  576. item.AlarmHighLimit = (float)item.AlarmHighLimitConfig.DoubleValue;
  577. item.AlarmLowLimit = (float)item.AlarmLowLimitConfig.DoubleValue;
  578. item.WarningHighLimit = (float)item.WarningHighLimitConfig.DoubleValue;
  579. item.WarningLowLimit = (float)item.WarningLowLimitConfig.DoubleValue;
  580. //item.SetPoint = (float)item.SetPointConfig.DoubleValue;
  581. item.Unit = item.UnitConfig.StringValue;
  582. item.DisplayName = item.DisplayNameConfig.StringValue;
  583. if (SC.GetStringValue("System.SetUp.ToolType") == "ELK" && item.Index <= 96)
  584. {
  585. item.Feedback = IO.AI[$"{item.Module}.{item.IOName}"] != null ? IO.AI[$"{item.Module}.{item.IOName}"].FloatValue : 0;
  586. item.SetPoint = item.AO != null ? item.AO.FloatValue : 0;
  587. }
  588. else
  589. {
  590. item.Feedback = IO.AI[$"{Module}.{item.IOName}"] != null ? IO.AI[$"{Module}.{item.IOName}"].FloatValue : 0;
  591. }
  592. if (item.AO != null && Math.Abs(item.AO.FloatValue - item.SetPoint) > 0.0001 && item.SetPoint > 0 && (item.IOName.Contains("ForelineHeater") || item.IOName.Contains("SiSource") || item.IOName.Contains("CSource")))//只有ForelineHeater需要写,GasLine heater之类不写
  593. {
  594. item.AO.FloatValue = item.SetPoint;//process 过程中,不写ao
  595. }
  596. if (item.AOAlarmHigher != null && Math.Abs(item.AOAlarmHigher.FloatValue - item.AlarmHighLimit) > 0.0001)
  597. {
  598. item.AOAlarmHigher.FloatValue = item.AlarmHighLimit;//process 过程中,不写ao
  599. }
  600. if (item.AOAlarmLower != null && Math.Abs(item.AOAlarmLower.FloatValue - item.AlarmLowLimit) > 0.0001)
  601. {
  602. item.AOAlarmLower.FloatValue = item.AlarmLowLimit;//process 过程中,不写ao
  603. }
  604. }
  605. }
  606. else
  607. {
  608. foreach (var item in _auxDic[_currentAuxTable])
  609. {
  610. if (item == null)
  611. continue;
  612. item.WarningHighLimit = (float)item.WarningHighLimitConfig.DoubleValue;
  613. item.WarningLowLimit = (float)item.WarningLowLimitConfig.DoubleValue;
  614. item.SetPoint = (float)item.SetPointConfig.DoubleValue;
  615. item.Unit = item.UnitConfig.StringValue;
  616. item.DisplayName = item.DisplayNameConfig.StringValue;
  617. item.AlarmHighLimit = (float)item.AlarmHighLimitConfig.DoubleValue;
  618. item.AlarmLowLimit = (float)item.AlarmLowLimitConfig.DoubleValue;
  619. if (SC.GetStringValue("System.SetUp.ToolType") == "ELK" && item.Index <= 96)
  620. {
  621. item.Feedback = IO.AI[$"{item.Module}.{item.IOName}"] != null ? IO.AI[$"{item.Module}.{item.IOName}"].FloatValue : 0;
  622. item.SetPoint = item.AO != null ? item.AO.FloatValue : 0;
  623. }
  624. else
  625. {
  626. item.Feedback = IO.AI[$"{Module}.{item.IOName}"] != null ? IO.AI[$"{Module}.{item.IOName}"].FloatValue : 0;
  627. }
  628. //item.Feedback = IO.AI[$"{Module}.{item.IOName}"] != null ? IO.AI[$"{Module}.{item.IOName}"].FloatValue : 0;
  629. if (item.AO != null && Math.Abs(item.AO.FloatValue - (float)item.SetPointConfig.DoubleValue) > 0.0001 && item.SetPoint > 0 && (item.IOName.Contains("ForelineHeater") || item.IOName.Contains("SiSource") || item.IOName.Contains("CSource")))//只有ForelineHeater需要写,GasLine heater之类不写 ELK除了GasLine需要设置
  630. {
  631. item.AO.FloatValue = (float)item.SetPointConfig.DoubleValue;
  632. }
  633. if (item.AOAlarmHigher != null && Math.Abs(item.AOAlarmHigher.FloatValue - item.AlarmHighLimit) > 0.0001)
  634. {
  635. item.AOAlarmHigher.FloatValue = item.AlarmHighLimit;
  636. }
  637. if (item.AOAlarmLower != null && Math.Abs(item.AOAlarmLower.FloatValue - item.AlarmLowLimit) > 0.0001)
  638. {
  639. item.AOAlarmLower.FloatValue = item.AlarmLowLimit;
  640. }
  641. if (item.Feedback > item.SetPoint + item.AlarmHighLimit)
  642. {
  643. //注释AUX报警
  644. //item.AlarmHighLimitTrig.CLK = true;
  645. //if (item.AlarmHighLimitTrig.Q)
  646. //{
  647. // var reason = $"{item.DisplayName} feedback={item.Feedback}, alarm high limit is {item.SetPoint + item.AlarmHighLimit}";
  648. // item.AlarmHighLimitEvent.Set(reason);
  649. //}
  650. }
  651. else if (item.Feedback < item.SetPoint - item.AlarmLowLimit)
  652. {
  653. //注释AUX报警
  654. //item.AlarmLowLimitTrig.CLK = true;
  655. //if (item.AlarmLowLimitTrig.Q)
  656. //{
  657. // var reason = $"{item.DisplayName} feedback={item.Feedback}, alarm low limit is {item.SetPoint - item.AlarmLowLimit}";
  658. // item.AlarmLowLimitEvent.Set(reason);
  659. //}
  660. }
  661. else if (item.Feedback > item.SetPoint + item.WarningHighLimit)
  662. {
  663. //注释AUX报警
  664. //item.WarningHighLimitTrig.CLK = true;
  665. //if (item.WarningHighLimitTrig.Q)
  666. //{
  667. // var reason = $"{item.DisplayName} feedback={item.Feedback}, warning high limit is {item.SetPoint + item.WarningHighLimit}";
  668. // item.AlarmHighLimitEvent.Set(reason);
  669. //}
  670. }
  671. else if (item.Feedback < item.SetPoint - item.WarningLowLimit)
  672. {
  673. //注释AUX报警
  674. //item.WarningLowLimitTrig.CLK = true;
  675. //if (item.WarningLowLimitTrig.Q)
  676. //{
  677. // var reason = $"{item.DisplayName} feedback={item.Feedback}, warning low limit is {item.SetPoint - item.WarningLowLimit}";
  678. // item.AlarmLowLimitEvent.Set(reason);
  679. //}
  680. }
  681. }
  682. }
  683. }
  684. }
  685. private void SetAUXParameters(object[] param)
  686. {
  687. if (param != null && param.Length > 0 &&
  688. _auxDic != null && _auxDic.ContainsKey(_currentAuxTable))
  689. {
  690. var array = param[0].ToString().Split(';');
  691. if (array != null && array.Length > 0)
  692. {
  693. for (int i = 0; i < array.Length; i++)
  694. {
  695. var auxItems = array[i].Split(',');
  696. if (auxItems == null || auxItems.Length < 6)
  697. continue;
  698. int.TryParse(auxItems[0], out int index);
  699. float.TryParse(auxItems[1], out float set);
  700. bool.TryParse(auxItems[2], out bool isCheck);
  701. float.TryParse(auxItems[3], out float checkHigh);
  702. float.TryParse(auxItems[4], out float checkLow);
  703. var checkUnit = auxItems[5];
  704. var aux = _auxDic[_currentAuxTable].SingleOrDefault(x => x.Index == index);
  705. if (aux != null)
  706. {
  707. if (checkUnit.ToLower() == "%sv")
  708. {
  709. checkHigh = set * checkHigh;
  710. checkLow = set * checkLow;
  711. }
  712. else if (checkUnit.ToLower() == "%fs")
  713. {
  714. checkHigh = (_auxScaleDic.ContainsKey(aux.IOName) ? _auxScaleDic[aux.IOName] : 1) * checkHigh;
  715. checkLow = (_auxScaleDic.ContainsKey(aux.IOName) ? _auxScaleDic[aux.IOName] : 1) * checkLow;
  716. }
  717. if (set > 0)
  718. aux.SetPoint = set;
  719. aux.IsWait = isCheck;
  720. aux.WaitHigh = checkHigh;
  721. aux.WaitLow = checkLow;
  722. }
  723. }
  724. }
  725. }
  726. }
  727. public bool CheckAUXWaitCondition(out string reason)
  728. {
  729. reason = "";
  730. bool allFinish = true;
  731. if (_auxDic != null && _auxDic.ContainsKey(_currentAuxTable))
  732. {
  733. foreach (var item in _auxDic[_currentAuxTable])
  734. {
  735. if (item == null)
  736. continue;
  737. if (!item.IsWait || item.WaitHigh == 0 || item.WaitLow == 0)
  738. continue;
  739. if (item.Feedback < item.SetPoint - item.WaitLow || item.Feedback > item.SetPoint + item.WaitHigh)
  740. {
  741. allFinish = false;
  742. reason += $"{item.DisplayName} feedback={item.Feedback}, limit is ({item.SetPoint - item.WaitLow}, {item.SetPoint + item.WaitHigh}) \n";
  743. }
  744. }
  745. }
  746. return allFinish;
  747. }
  748. private bool SetF2ClnEnable(object[] param)
  749. {
  750. if (param != null && param.Length > 0)
  751. {
  752. bool.TryParse(param[0].ToString(), out bool isEnable);
  753. IsF2ClnOn = isEnable;
  754. }
  755. return true;
  756. }
  757. private bool SetHFClnEnable(object[] param)
  758. {
  759. if (param != null && param.Length > 0)
  760. {
  761. bool.TryParse(param[0].ToString(), out bool isEnable);
  762. IsHFClnOn = isEnable;
  763. }
  764. return true;
  765. }
  766. private bool SetDEPOEnable(object[] param)
  767. {
  768. if (param != null && param.Length > 0)
  769. {
  770. bool.TryParse(param[0].ToString(), out bool isEnable);
  771. IsDEPOOn = isEnable;
  772. }
  773. return true;
  774. }
  775. private bool SetCREFEnable(object[] param)
  776. {
  777. if (param != null && param.Length > 0)
  778. {
  779. bool.TryParse(param[0].ToString(), out bool isEnable);
  780. IsCREFOn = isEnable;
  781. }
  782. return true;
  783. }
  784. private bool SetSIREFEnable(object[] param)
  785. {
  786. if (param != null && param.Length > 0)
  787. {
  788. bool.TryParse(param[0].ToString(), out bool isEnable);
  789. IsSIREFOn = isEnable;
  790. }
  791. return true;
  792. }
  793. }
  794. }