IoMfc.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  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.OperationCenter;
  7. using Aitex.Core.RT.SCCore;
  8. using Aitex.Core.RT.Tolerance;
  9. using Aitex.Core.Util;
  10. using MECF.Framework.Common.DBCore;
  11. using SorterRT.Modules;
  12. using System;
  13. using System.Diagnostics;
  14. using System.Xml;
  15. using Aitex.Core.RT.Log;
  16. namespace VirgoRT.Devices.IODevices
  17. {
  18. //will be upgrade later
  19. public class MfcBase1 : BaseDevice, IDevice
  20. {
  21. public virtual double SetPoint { get; set; }
  22. public virtual double FeedBack { get; set; }
  23. public virtual bool IsOutOfTolerance { get; }
  24. public virtual double Scale { set; get; }
  25. public virtual string DisplayName { set; get; }
  26. private float _percent10Calculate;
  27. private float _percent20Calculate;
  28. private float _percent30Calculate;
  29. private float _percent40Calculate;
  30. private float _percent50Calculate;
  31. private float _percent60Calculate;
  32. private float _percent70Calculate;
  33. private float _percent80Calculate;
  34. private float _percent90Calculate;
  35. private float _percent100Calculate;
  36. private float _verificationCalculate;
  37. private float _verificationSetpoint;
  38. private string _verificationResult = "";
  39. public MfcBase1()
  40. {
  41. }
  42. public virtual bool Initialize()
  43. {
  44. DATA.Subscribe($"{Module}.{Name}.VerificationResult", () => _verificationResult);
  45. return true;
  46. }
  47. public virtual void Monitor()
  48. {
  49. }
  50. public virtual void Reset()
  51. {
  52. }
  53. public virtual void Terminate()
  54. {
  55. }
  56. public virtual void Ramp(int time)
  57. {
  58. }
  59. public virtual void Ramp(double target, int time)
  60. {
  61. }
  62. public virtual void StopRamp()
  63. {
  64. }
  65. public virtual void SetVerificationResult(float setpoint, float calculateFlow, bool saveResult, double time, double deviation, bool result)
  66. {
  67. //ten points
  68. var delta = Scale / 10;
  69. _verificationResult += $"{setpoint},{calculateFlow},{time},{deviation},{result};";
  70. if (delta - 0.1 < setpoint && delta + 0.1 > setpoint)
  71. {
  72. _percent10Calculate = calculateFlow;
  73. }
  74. else if (2 * delta - 0.1 < setpoint && 2 * delta + 0.1 > setpoint)
  75. {
  76. _percent20Calculate = calculateFlow;
  77. }
  78. else if (3 * delta - 0.1 < setpoint && 3 * delta + 0.1 > setpoint)
  79. {
  80. _percent30Calculate = calculateFlow;
  81. }
  82. else if (4 * delta - 0.1 < setpoint && 4 * delta + 0.1 > setpoint)
  83. {
  84. _percent40Calculate = calculateFlow;
  85. }
  86. else if (5 * delta - 0.1 < setpoint && 5 * delta + 0.1 > setpoint)
  87. {
  88. _percent50Calculate = calculateFlow;
  89. }
  90. else if (6 * delta - 0.1 < setpoint && 6 * delta + 0.1 > setpoint)
  91. {
  92. _percent60Calculate = calculateFlow;
  93. }
  94. else if (7 * delta - 0.1 < setpoint && 7 * delta + 0.1 > setpoint)
  95. {
  96. _percent70Calculate = calculateFlow;
  97. }
  98. else if (8 * delta - 0.1 < setpoint && 8 * delta + 0.1 > setpoint)
  99. {
  100. _percent80Calculate = calculateFlow;
  101. }
  102. else if (9 * delta - 0.1 < setpoint && 9 * delta + 0.1 > setpoint)
  103. {
  104. _percent90Calculate = calculateFlow;
  105. }
  106. else if (10 * delta - 0.1 < setpoint && 10 * delta + 0.1 > setpoint)
  107. {
  108. _percent100Calculate = calculateFlow;
  109. }
  110. else
  111. {
  112. _verificationCalculate = calculateFlow;
  113. _verificationSetpoint = setpoint;
  114. }
  115. if (saveResult)
  116. {
  117. SaveVerificationData();
  118. }
  119. }
  120. private void SaveVerificationData()
  121. {
  122. var delta = (float)(Scale / 10);
  123. MFCVerificationData data = new MFCVerificationData()
  124. {
  125. Module = Module,
  126. Name = DisplayName,
  127. Percent10Setpoint = delta,
  128. Percent10Calculate = _percent10Calculate,
  129. Percent20Setpoint = delta * 2,
  130. Percent20Calculate = _percent20Calculate,
  131. Percent30Setpoint = delta * 3,
  132. Percent30Calculate = _percent30Calculate,
  133. Percent40Setpoint = delta * 4,
  134. Percent40Calculate = _percent40Calculate,
  135. Percent50Setpoint = delta * 5,
  136. Percent50Calculate = _percent50Calculate,
  137. Percent60Setpoint = delta * 6,
  138. Percent60Calculate = _percent60Calculate,
  139. Percent70Setpoint = delta * 7,
  140. Percent70Calculate = _percent70Calculate,
  141. Percent80Setpoint = delta * 8,
  142. Percent80Calculate = _percent80Calculate,
  143. Percent90Setpoint = delta * 9,
  144. Percent90Calculate = _percent90Calculate,
  145. Percent100Setpoint = delta * 10,
  146. Percent100Calculate = _percent100Calculate,
  147. Setpoint = _verificationSetpoint,
  148. Calculate = _verificationCalculate,
  149. };
  150. MFCVerificationDataRecorder.Add(data);
  151. }
  152. public void ResetVerificationData()
  153. {
  154. _percent10Calculate = 0;
  155. _percent20Calculate = 0;
  156. _percent30Calculate = 0;
  157. _percent40Calculate = 0;
  158. _percent50Calculate = 0;
  159. _percent60Calculate = 0;
  160. _percent70Calculate = 0;
  161. _percent80Calculate = 0;
  162. _percent90Calculate = 0;
  163. _percent100Calculate = 0;
  164. _verificationCalculate = 0;
  165. _verificationSetpoint = 0;
  166. _verificationResult = "";
  167. }
  168. }
  169. public class IoMfc : MfcBase1
  170. {
  171. public string Unit
  172. {
  173. get; set;
  174. }
  175. [Subscription(AITMfcDataPropertyName.Scale)]
  176. public override double Scale
  177. {
  178. get
  179. {
  180. if (_scN2Scale == null || _scScaleFactor == null)
  181. return 0;
  182. return _scN2Scale.IntValue * _scScaleFactor.DoubleValue;
  183. }
  184. }
  185. [Subscription(AITMfcDataPropertyName.SetPoint)]
  186. public override double SetPoint
  187. {
  188. get
  189. {
  190. if (_aoFlow != null)
  191. {
  192. byte[] high = BitConverter.GetBytes(_aoFlow.Buffer[_aoFlow.Index]);
  193. byte[] low = BitConverter.GetBytes(_aoFlow.Buffer[_aoFlow.Index + 1]);
  194. float flow = BitConverter.ToSingle(new[] { high[0], high[1], low[0], low[1] }, 0);
  195. return flow * Scale / RtInstance.ANALOG_TRANS_RANGE;
  196. }
  197. return 0;
  198. }
  199. set
  200. {
  201. if (_aoFlow != null)
  202. {
  203. byte[] flow = BitConverter.GetBytes((float)(value * RtInstance.ANALOG_TRANS_RANGE / Scale));
  204. _aoFlow.Buffer[_aoFlow.Index] = BitConverter.ToInt16(flow, 0);
  205. _aoFlow.Buffer[_aoFlow.Index + 1] = BitConverter.ToInt16(flow, 2);
  206. }
  207. }
  208. }
  209. [Subscription(AITMfcDataPropertyName.DefaultSetPoint)]
  210. public double DefaultSetPoint
  211. {
  212. get
  213. {
  214. if (_scDefaultSetPoint != null)
  215. return _scDefaultSetPoint.IntValue;
  216. return 0;
  217. }
  218. }
  219. [Subscription(AITMfcDataPropertyName.FeedBack)]
  220. public override double FeedBack
  221. {
  222. get
  223. {
  224. if (_aiFlow != null)
  225. {
  226. byte[] high = BitConverter.GetBytes(_aiFlow.Buffer[_aiFlow.Index]);
  227. byte[] low = BitConverter.GetBytes(_aiFlow.Buffer[_aiFlow.Index + 1]);
  228. float flow = BitConverter.ToSingle(new[] { high[0], high[1], low[0], low[1] }, 0);
  229. return (_scRegulationFactor != null && _scRegulationFactor.IntValue > 0) ? flow * Scale / RtInstance.ANALOG_TRANS_RANGE / _scRegulationFactor.IntValue
  230. : flow * Scale / RtInstance.ANALOG_TRANS_RANGE;
  231. }
  232. return 0;
  233. }
  234. }
  235. [Subscription(AITMfcDataPropertyName.IsOutOfTolerance)]
  236. public override bool IsOutOfTolerance
  237. {
  238. get
  239. {
  240. return _alarmChecker.Result;
  241. }
  242. }
  243. [Subscription(AITMfcDataPropertyName.IsEnableAlarm)]
  244. public bool EnableAlarm
  245. {
  246. get
  247. {
  248. if (_scEnableAlarm != null)
  249. return _scEnableAlarm.BoolValue;
  250. return false;
  251. }
  252. }
  253. [Subscription(AITMfcDataPropertyName.AlarmRange)]
  254. public double AlarmRange
  255. {
  256. get
  257. {
  258. if (_scAlarmRange != null)
  259. return _scAlarmRange.IntValue;
  260. return 0;
  261. }
  262. }
  263. [Subscription(AITMfcDataPropertyName.AlarmTime)]
  264. public double AlarmTime
  265. {
  266. get
  267. {
  268. if (_scAlarmTime != null)
  269. return _scAlarmTime.IntValue;
  270. return 0;
  271. }
  272. }
  273. public double WarningRange
  274. {
  275. get
  276. {
  277. if (_scWarningRange != null)
  278. return _scWarningRange.IntValue;
  279. return 0;
  280. }
  281. }
  282. public double WarningTime
  283. {
  284. get
  285. {
  286. if (_scWarningTime != null)
  287. return _scWarningTime.IntValue;
  288. return 0;
  289. }
  290. }
  291. [Subscription(AITMfcDataPropertyName.PressureAlarm)]
  292. public bool PressureAlarm
  293. {
  294. get { return _diPressureAlarm != null ? _diPressureAlarm.Value : true; }
  295. }
  296. [Subscription(AITMfcDataPropertyName.MfcAlarm)]
  297. public bool MfcAlarm
  298. {
  299. get
  300. {
  301. return _bMfcAlarm;
  302. }
  303. }
  304. [Subscription(AITMfcDataPropertyName.IsEnable)]
  305. public bool Enable
  306. {
  307. get
  308. {
  309. if (_scEnable != null)
  310. return _scEnable.BoolValue;
  311. return false;
  312. }
  313. }
  314. [Subscription(AITMfcDataPropertyName.IsOffline)]
  315. public bool IsOffline
  316. {
  317. get
  318. {
  319. if (_diOffline != null)
  320. return _diOffline.Value;
  321. return false;
  322. }
  323. }
  324. public override string DisplayName
  325. {
  326. get
  327. {
  328. if (_scGasName != null)
  329. return _scGasName.StringValue;
  330. return Display;
  331. }
  332. }
  333. private DeviceTimer rampTimer = new DeviceTimer();
  334. private double rampTarget;
  335. private double rampInitValue;
  336. private int rampTime;
  337. private bool _bMfcAlarm = false;
  338. private ToleranceChecker _alarmChecker = new ToleranceChecker();
  339. private ToleranceChecker _warningChecker = new ToleranceChecker();
  340. private AIAccessor _aiFlow;
  341. private AOAccessor _aoFlow;
  342. private AOAccessor _aoRange;
  343. private DIAccessor _diOffline;
  344. private DIAccessor _diPressureAlarm;
  345. private SCConfigItem _scGasName;
  346. private SCConfigItem _scEnable;
  347. private SCConfigItem _scN2Scale;
  348. private SCConfigItem _scScaleFactor;
  349. private SCConfigItem _scAlarmRange;
  350. private SCConfigItem _scEnableAlarm;
  351. private SCConfigItem _scAlarmTime;
  352. private SCConfigItem _scDefaultSetPoint;
  353. private SCConfigItem _scRegulationFactor;
  354. private SCConfigItem _scWarningRange;
  355. private SCConfigItem _scWarningTime;
  356. private R_TRIG _trigOffline = new R_TRIG();
  357. private R_TRIG _trigPressureAlarm = new R_TRIG();
  358. private string _uniqueName;
  359. private string GasFlowOutOfTolerance = "GasFlowOutOfTolerance";
  360. private float _recipeAlarmRange;
  361. private float _recipeWarningRange;
  362. private int _recipeIgnoreTimeMS;
  363. private ToleranceChecker _recipeAlarmChecker = new ToleranceChecker();
  364. private ToleranceChecker _recipeWarningChecker = new ToleranceChecker();
  365. private DeviceTimer _recipeIgnoreTimer = new DeviceTimer();
  366. private object _lockerTolerance = new object();
  367. public IoMfc(string module, XmlElement node, string ioModule = "")
  368. {
  369. Unit = node.GetAttribute("unit");
  370. base.Module = module;
  371. base.Name = node.GetAttribute("id");
  372. base.Display = node.GetAttribute("display");
  373. base.DeviceID = node.GetAttribute("schematicId");
  374. _aoRange = ParseAoNode("aoRange", node, ioModule);
  375. _diOffline = ParseDiNode("diOffline", node, ioModule);
  376. _aiFlow = ParseAiNode("aiFlow", node, ioModule);
  377. _aoFlow = ParseAoNode("aoFlow", node, ioModule);
  378. _diPressureAlarm = ParseDiNode("diPressureAlarm", node, ioModule);
  379. _scGasName = SC.GetConfigItem($"{Module}.{Name}.GasName");
  380. _scEnable = SC.GetConfigItem($"{Module}.{Name}.Enable");
  381. _scN2Scale = SC.GetConfigItem($"{Module}.{Name}.MfcN2Scale");
  382. _scScaleFactor = SC.GetConfigItem($"{Module}.{Name}.MfcScaleFactor");
  383. _scAlarmRange = SC.GetConfigItem($"{Module}.{Name}.MfcAlarmRange");
  384. _scEnableAlarm = SC.GetConfigItem($"{Module}.{Name}.MfcEnableAlarm");
  385. _scAlarmTime = SC.GetConfigItem($"{Module}.{Name}.MfcAlarmTime");
  386. _scDefaultSetPoint = SC.GetConfigItem($"{Module}.{Name}.DefaultSetPoint");
  387. _scRegulationFactor = SC.GetConfigItem($"{Module}.{Name}.FlowRegulationFactor");
  388. _scWarningRange = SC.GetConfigItem($"{Module}.{Name}.MfcWarningRange");
  389. _scWarningTime = SC.GetConfigItem($"{Module}.{Name}.MfcWarningTime");
  390. _uniqueName = $"{Module}.{Name}";
  391. if (_scGasName != null)
  392. Display = _scGasName.StringValue;
  393. #if DEBUG
  394. Debug.Assert(!string.IsNullOrWhiteSpace(_scGasName.StringValue));
  395. Debug.Assert(null != _scN2Scale);
  396. Debug.Assert(null != _aoFlow);
  397. Debug.Assert(null != _aiFlow);
  398. #endif
  399. }
  400. public override bool Initialize()
  401. {
  402. EV.Subscribe(new EventItem("Event", GasFlowOutOfTolerance, "Gas Flow Out Of Tolerance", EventLevel.Alarm, EventType.HostNotification));
  403. DATA.Subscribe($"{Module}.{Name}", () =>
  404. {
  405. AITMfcData data = new AITMfcData
  406. {
  407. Type = "MFC",
  408. UniqueName = _uniqueName,
  409. DeviceName = Name,
  410. DeviceSchematicId = DeviceID,
  411. DisplayName = DisplayName,
  412. FeedBack = FeedBack,
  413. SetPoint = SetPoint,
  414. Scale = Scale,
  415. IsOffline = IsOffline,
  416. };
  417. return data;
  418. }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  419. OP.Subscribe($"{Module}.{Name}.{AITMfcOperation.Ramp}", (name, args) =>
  420. {
  421. double target = (double)args[0];
  422. target = Math.Min(target, Scale);
  423. target = Math.Max(target, 0);
  424. Ramp(target, 0);
  425. EV.PostInfoLog(Module, $"Ramp to {target}{Unit}");
  426. return true;
  427. });
  428. DEVICE.Register($"{Module}.{Name}.{AITMfcOperation.Ramp}", (out string reason, int time, object[] param) =>
  429. {
  430. double target = Convert.ToDouble((string)param[0]);
  431. target = Math.Min(target, Scale);
  432. target = Math.Max(target, 0);
  433. Ramp(target, time);
  434. reason = $"{Display} ramp to {target}{Unit}";
  435. return true;
  436. });
  437. //@AAA use recipe
  438. DEVICE.Register($"{Module}.{Name}", (out string reason, int time, object[] param) =>
  439. {
  440. double target = Convert.ToDouble((string)param[0]);
  441. target = Math.Min(target, Scale);
  442. target = Math.Max(target, 0);
  443. Ramp(target, time);
  444. reason = $"{Display} ramp to {target}{Unit}";
  445. return true;
  446. });
  447. OP.Subscribe($"{Module}.{Name}.SetRecipeTolerance", (out string reason, int time, object[] param) =>
  448. {
  449. reason = string.Empty;
  450. lock (_lockerTolerance)
  451. {
  452. _recipeIgnoreTimer.Stop();
  453. _recipeIgnoreTimeMS = Convert.ToInt32(param[0]) * 1000;
  454. _recipeWarningRange = Convert.ToSingle(param[1]);
  455. _recipeAlarmRange = Convert.ToSingle(param[2]);
  456. _recipeAlarmChecker.RST = true;
  457. _recipeWarningChecker.RST = true;
  458. _alarmChecker.RST = true;
  459. _warningChecker.RST = true;
  460. _recipeIgnoreTimer.Start(0);
  461. }
  462. return true;
  463. });
  464. return base.Initialize();
  465. }
  466. public override void Monitor()
  467. {
  468. if (Enable)
  469. {
  470. Ramping();
  471. CheckTolerance();
  472. if (_aoRange != null)
  473. _aoRange.Value = (short)Scale;
  474. _trigOffline.CLK = IsOffline;
  475. if (_trigOffline.Q)
  476. {
  477. EV.PostAlarmLog(Module, string.Format("{0} is offline", DisplayName));
  478. _bMfcAlarm = true;
  479. }
  480. _trigPressureAlarm.CLK = PressureAlarm == false;
  481. if (_trigPressureAlarm.Q)
  482. EV.PostAlarmLog(Module, $"{Name}, {DisplayName} Pressure Alarm");
  483. if (PressureAlarm)
  484. {
  485. _trigPressureAlarm.RST = true;
  486. }
  487. }
  488. }
  489. public override void Reset()
  490. {
  491. _bMfcAlarm = false;
  492. _trigPressureAlarm.RST = true;
  493. _trigOffline.RST = true;
  494. _alarmChecker.RST = true;
  495. _warningChecker.RST = true;
  496. _recipeWarningChecker.RST = true;
  497. _recipeAlarmChecker.RST = true;
  498. }
  499. public override void Terminate()
  500. {
  501. Ramp(DefaultSetPoint, 0);
  502. }
  503. public override void Ramp(int time)
  504. {
  505. Ramp(DefaultSetPoint, time);
  506. }
  507. public override void Ramp(double target, int time)
  508. {
  509. target = Math.Max(0, target);
  510. target = Math.Min(Scale, target);
  511. rampInitValue = SetPoint; //ramp 初始值取当前设定值,而非实际读取值。零漂问题
  512. rampTime = time;
  513. rampTarget = target;
  514. rampTimer.Start(rampTime);
  515. }
  516. public override void StopRamp()
  517. {
  518. Ramp(SetPoint, 0);
  519. }
  520. private void Ramping()
  521. {
  522. if (rampTimer.IsTimeout() || rampTime == 0)
  523. {
  524. SetPoint = rampTarget;
  525. }
  526. else
  527. {
  528. SetPoint = rampInitValue + (rampTarget - rampInitValue) * rampTimer.GetElapseTime() / rampTime;
  529. }
  530. }
  531. private void CheckTolerance()
  532. {
  533. lock (_lockerTolerance)
  534. {
  535. if (!Enable)
  536. return;
  537. if (Math.Abs(SetPoint) < 0.01)
  538. return;
  539. double alarmRange = _scAlarmRange.IntValue;
  540. double alarmTime = _scAlarmTime.IntValue;
  541. ToleranceChecker alarmChecker = _alarmChecker;
  542. if ((_recipeAlarmRange > 0) && (_recipeAlarmRange / 100.0 * SetPoint < _scAlarmRange.IntValue))
  543. {
  544. alarmRange = _recipeAlarmRange / 100.0 * SetPoint;
  545. alarmChecker = _recipeAlarmChecker;
  546. _alarmChecker.RST = true;
  547. }
  548. else
  549. {
  550. if (!EnableAlarm || Math.Abs(alarmRange) < 0.01)
  551. {
  552. alarmChecker = null;
  553. }
  554. _recipeAlarmChecker.RST = true;
  555. }
  556. if (_recipeIgnoreTimer.GetElapseTime() > _recipeIgnoreTimeMS && alarmChecker != null)
  557. {
  558. alarmChecker.Monitor(FeedBack, SetPoint - Math.Abs(alarmRange), SetPoint + Math.Abs(alarmRange), alarmTime);
  559. if (alarmChecker.Trig)
  560. {
  561. LOG.Write($"_recipeIgnoreTimer Elapse time : {_recipeIgnoreTimer.GetElapseTime()}ms , _recipeIgnoreTimeMS :{_recipeIgnoreTimeMS}ms");
  562. EV.PostAlarmLog(Module, $" flow={FeedBack}, setpoint={SetPoint}, out of tolerance({SetPoint - Math.Abs(alarmRange)},{SetPoint + Math.Abs(alarmRange)}) in {alarmTime:0} seconds");
  563. EV.Notify(GasFlowOutOfTolerance);
  564. }
  565. }
  566. double warningRange = _scWarningRange.IntValue;
  567. double warningTime = _scWarningTime.IntValue;
  568. ToleranceChecker warningChecker = _warningChecker;
  569. if ((_recipeWarningRange > 0) && (_recipeWarningRange / 100.0 * SetPoint < _scWarningRange.IntValue))
  570. {
  571. warningRange = _recipeWarningRange / 100.0 * SetPoint;
  572. warningChecker = _recipeWarningChecker;
  573. _warningChecker.RST = true;
  574. }
  575. else
  576. {
  577. if (!EnableAlarm || Math.Abs(warningRange) < 0.01)
  578. {
  579. warningChecker = null;
  580. }
  581. _recipeWarningChecker.RST = true;
  582. }
  583. if (_recipeIgnoreTimer.GetElapseTime() > _recipeIgnoreTimeMS && warningChecker != null)
  584. {
  585. warningChecker.Monitor(FeedBack, SetPoint - Math.Abs(warningRange), SetPoint + Math.Abs(warningRange), warningTime);
  586. if (warningChecker.Trig)
  587. {
  588. EV.PostWarningLog(Module, $" flow={FeedBack}, setpoint={SetPoint}, out of tolerance({SetPoint - Math.Abs(warningRange)},{SetPoint + Math.Abs(warningRange)}) in {warningTime:0} seconds");
  589. }
  590. }
  591. }
  592. }
  593. }
  594. }