IoMFC.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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.RT.Tolerance;
  10. using Aitex.Core.Util;
  11. using Aitex.Core.Utilities;
  12. using MECF.Framework.Common.Event;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.MFCs;
  14. using System;
  15. using System.Collections;
  16. using System.Collections.Generic;
  17. using System.Diagnostics;
  18. using System.Xml;
  19. namespace FurnaceRT.Equipments.PMs.Devices
  20. {
  21. public class IoMFC : BaseDevice, IDevice, IMfc
  22. {
  23. public string Unit
  24. {
  25. get; set;
  26. }
  27. public double Scale
  28. {
  29. get
  30. {
  31. if (_scN2Scale == null || _scScaleFactor == null)
  32. return 0;
  33. return _scN2Scale.DoubleValue * _scScaleFactor.DoubleValue;
  34. }
  35. }
  36. private double _setpoint;
  37. public double SetPoint
  38. {
  39. get
  40. {
  41. return _setpoint;
  42. }
  43. set
  44. {
  45. _setpoint = value;
  46. if (_aoFlow != null)
  47. {
  48. //var setpoint = Scale != 0 ? (float)(value * _maxScale / Scale) : value;
  49. if (_isFloatAioType)
  50. _aoFlow.FloatValue = (float)value;
  51. else
  52. _aoFlow.Value = (short)value;
  53. }
  54. }
  55. }
  56. public double DefaultSetPoint
  57. {
  58. get
  59. {
  60. if (_scDefaultSetPoint != null)
  61. return _scDefaultSetPoint.DoubleValue;
  62. return 0;
  63. }
  64. }
  65. public double FeedBack
  66. {
  67. get
  68. {
  69. if (_aiFlow != null)
  70. {
  71. return _isFloatAioType ? _aiFlow.FloatValue : _aiFlow.Value;
  72. //var phy = _aiFlow == null ? 0 : (_isFloatAioType ? _aiFlow.FloatValue : _aiFlow.Value);
  73. //return Converter.Phy2Logic(phy, 0, Scale, 0, _phyScale);
  74. //return _maxScale != 0 ? aiValue * Scale / _maxScale : aiValue;
  75. }
  76. return 0;
  77. }
  78. }
  79. public bool EnableAlarm
  80. {
  81. get
  82. {
  83. if (_scEnableAlarm != null)
  84. return _scEnableAlarm.BoolValue;
  85. return false;
  86. }
  87. }
  88. public bool IsStable
  89. {
  90. get
  91. {
  92. if (!_stableDelayTimer.IsIdle() && _stableDelayTimer.GetElapseTime() >= _stableDelayTime * 1000)
  93. {
  94. if (_stableJudgmentTimer.IsRunning)
  95. {
  96. if (FeedBack < SetPoint * (100 - _stableMinValue) / 100 ||
  97. FeedBack > SetPoint * (100 + _stableMaxValue) / 100)
  98. {
  99. _stableJudgmentTimer.Restart();
  100. }
  101. if (_stableJudgmentTimer.ElapsedMilliseconds >= _stableJudgmentTime * 1000)
  102. {
  103. return true;
  104. }
  105. }
  106. else
  107. {
  108. _stableJudgmentTimer.Restart();
  109. }
  110. }
  111. return false;
  112. }
  113. }
  114. public AITMfcData DeviceData
  115. {
  116. get
  117. {
  118. AITMfcData data = new AITMfcData()
  119. {
  120. UniqueName = $"{Module}.{Name}",
  121. Type = "MFC",
  122. Module = Module,
  123. DeviceName = Name,
  124. DeviceSchematicId = DeviceID,
  125. DisplayName = DisplayName,
  126. FeedBack = FeedBack < 0 ? 0 : FeedBack,
  127. SetPoint = SetPoint,
  128. Ramping = _ramping,
  129. AlarmWatchTable = AlarmWatchTable,
  130. Scale = Scale,
  131. //IsWarning = !AlarmToleranceWarning.IsAcknowledged,
  132. //IsError = !AlarmToleranceAlarm.IsAcknowledged,
  133. Unit = Unit,
  134. VirtualSetPoint = (float)VirtualSetPoint,
  135. VirtualFeedBack = (float)VirtualFeedBack,
  136. VirtualAlarmWatchTable = VirtualAlarmWatchTable,
  137. VirtualRamping = VirtualRamping,
  138. IsInstalled= IsMFCInstalled
  139. };
  140. return data;
  141. }
  142. }
  143. public string DisplayName
  144. {
  145. get
  146. {
  147. if (_scGasName != null)
  148. return _scGasName.StringValue;
  149. return Display;
  150. }
  151. }
  152. public string AlarmWatchTable
  153. {
  154. get;
  155. set;
  156. }
  157. public double VirtualSetPoint;
  158. public double VirtualFeedBack;
  159. public string VirtualAlarmWatchTable;
  160. public float VirtualRamping;
  161. private DeviceTimer _rampTimer = new DeviceTimer();
  162. private double _rampTarget;
  163. private double _rampInitValue;
  164. private int _rampTime;
  165. private float _ramping;
  166. private double _phyScale;
  167. private ToleranceChecker _toleranceCheckerWarning = new ToleranceChecker();
  168. private ToleranceChecker _toleranceCheckerAlarm = new ToleranceChecker();
  169. private AIAccessor _aiFlow;
  170. private AOAccessor _aoFlow;
  171. private AOAccessor _aoRamp;
  172. private bool _isErrorStatus;
  173. private bool _isMFCInstalled;
  174. private int _mfcIndex;
  175. public bool IsMFCInstalled
  176. {
  177. get { return _isMFCInstalled; }
  178. }
  179. public int MFCIndex
  180. {
  181. get { return _mfcIndex; }
  182. }
  183. protected SCConfigItem _scGasName;
  184. protected SCConfigItem _scEnable;
  185. private SCConfigItem _scN2Scale;
  186. private SCConfigItem _scScaleFactor;
  187. private SCConfigItem _scEnableAlarm;
  188. private SCConfigItem _scDefaultSetPoint;
  189. private SCConfigItem _scRegulationFactor;
  190. //tolerance check
  191. private float _alarmJudgmentRange;
  192. private float _warningJudgmentRange;
  193. private float _alarmJudgmentTime;
  194. private float _warningJudgmentTime;
  195. private float _toleranceJudgmentDelayTime;
  196. private DeviceTimer _toleranceJudgmentDelayTimer = new DeviceTimer();
  197. //stable check
  198. private DeviceTimer _stableDelayTimer = new DeviceTimer();
  199. private float _stableDelayTime;
  200. private Stopwatch _stableJudgmentTimer = new Stopwatch();
  201. private float _stableJudgmentTime = 1;
  202. private float _stableMinValue;
  203. private float _stableMaxValue;
  204. public AlarmEventItem AlarmToleranceWarning { get; set; }
  205. public AlarmEventItem AlarmToleranceAlarm { get; set; }
  206. private bool _isFloatAioType = false;
  207. private bool _isWait;
  208. private float _waitHigh;
  209. private float _waitLow;
  210. private string _writeLog = "";
  211. public IoMFC(string module, XmlElement node, string ioModule = "")
  212. {
  213. Unit = node.GetAttribute("unit");
  214. base.Module = string.IsNullOrEmpty(node.GetAttribute("module")) ? module : node.GetAttribute("module");
  215. base.Name = node.GetAttribute("id");
  216. base.Display = node.GetAttribute("display");
  217. base.DeviceID = node.GetAttribute("schematicId");
  218. _aiFlow = ParseAiNode("aiFlow", node, ioModule);
  219. _aoFlow = ParseAoNode("aoFlow", node, ioModule);
  220. _aoRamp = ParseAoNode("aoRamp", node, ioModule);
  221. _isFloatAioType = !string.IsNullOrEmpty(node.GetAttribute("aioType")) && (node.GetAttribute("aioType") == "float");
  222. string scBasePath = node.GetAttribute("scBasePath");
  223. if (string.IsNullOrEmpty(scBasePath))
  224. scBasePath = $"{Module}.MFC.{Name}";
  225. else
  226. {
  227. scBasePath = scBasePath.Replace("{module}", Module);
  228. }
  229. _scGasName = SC.GetConfigItem($"{scBasePath}.{Name}.GasName");
  230. _scEnable = SC.GetConfigItem($"{scBasePath}.{Name}.Enable");
  231. _isMFCInstalled = SC.GetConfigItem($"{scBasePath}.{Name}.IsMFCInstalled").BoolValue;
  232. _scN2Scale = ParseScNode("scN2Scale", node, ioModule, $"{scBasePath}.{Name}.N2Scale");
  233. _scScaleFactor = ParseScNode("scScaleFactor", node, ioModule, $"{scBasePath}.{Name}.ScaleFactor");
  234. _scEnableAlarm = ParseScNode("scEnableAlarm", node, ioModule, $"{scBasePath}.{Name}.EnableAlarm");
  235. _scDefaultSetPoint = ParseScNode("scDefaultSetPoint", node, ioModule, $"{scBasePath}.{Name}.DefaultSetPoint");
  236. _scRegulationFactor = ParseScNode("scFlowRegulationFactor", node, ioModule, $"{scBasePath}.{Name}.RegulationFactor");
  237. if (SC.ContainsItem($"{scBasePath}.{Name}.FlowUnit"))
  238. Unit = SC.GetStringValue($"{scBasePath}.{Name}.FlowUnit");
  239. }
  240. public bool Initialize()
  241. {
  242. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  243. DATA.Subscribe($"{Module}.{Name}.Feedback", () => FeedBack);
  244. DATA.Subscribe($"{Module}.{Name}.SetPoint", () => SetPoint);
  245. // DATA.Subscribe($"{Module}.{Name}.ForceOpen", () => _doOpen.Value);
  246. // DATA.Subscribe($"{Module}.{Name}.ForceClose", () => _doClose.Value);
  247. OP.Subscribe($"{Module}.{Name}.Ramp", (out string reason, int time, object[] param) =>
  248. {
  249. double target = Convert.ToDouble(param[0].ToString());
  250. if (target < 0 || target > Scale)
  251. {
  252. reason = $"set {Display} value {target} out of range [0, {Scale}] {Unit}";
  253. return false;
  254. }
  255. Ramp(target, time);
  256. if (time > 0)
  257. {
  258. reason = $"{Display} ramp to {target} {Unit} in {time} seconds";
  259. }
  260. else
  261. {
  262. reason = $"{Display} ramp to {target} {Unit}";
  263. }
  264. return true;
  265. });
  266. OP.Subscribe($"{Module}.{Name}.SetParameters", SetParameters);
  267. OP.Subscribe($"{Module}.{Name}.SetMfcValue", SetMfcValue);
  268. OP.Subscribe($"{Module}.{Name}.SetMfcVirtualValue", SetMfcVirtualValue);
  269. //_phyScale = SC.GetValue<double>($"{Module}.MFC.{Name}.PhyScale");
  270. return true;
  271. }
  272. public void Monitor()
  273. {
  274. if(!string.IsNullOrEmpty(_writeLog))
  275. {
  276. LOG.Write(_writeLog);
  277. _writeLog = "";
  278. }
  279. //MonitorRamping();
  280. //MonitorTolerance();
  281. }
  282. public bool ResetWarningChecker()
  283. {
  284. _toleranceCheckerWarning.Reset(_warningJudgmentTime);
  285. return true;
  286. }
  287. public bool ResetAlarmChecker()
  288. {
  289. _toleranceCheckerAlarm.Reset(_alarmJudgmentTime);
  290. return true;
  291. }
  292. public void Reset()
  293. {
  294. _toleranceCheckerWarning.Reset(_warningJudgmentTime);
  295. _toleranceCheckerAlarm.Reset(_alarmJudgmentTime);
  296. //AlarmToleranceWarning.Reset();
  297. //AlarmToleranceAlarm.Reset();
  298. }
  299. public void Terminate()
  300. {
  301. Ramp(DefaultSetPoint, 0);
  302. }
  303. private bool SetParameters(out string reason, int time, object[] param)
  304. {
  305. reason = string.Empty;
  306. var paras = param[0].ToString().Split(';');//flow;rampTime
  307. _isWait = false;
  308. float setpoint = 0.0f;
  309. if (paras[0].ToString() == "Continue")
  310. {
  311. EV.PostInfoLog(Module, $"Set {DisplayName} flow to Continue");
  312. return true;
  313. }
  314. else
  315. {
  316. if (System.Text.RegularExpressions.Regex.Match(paras[0].ToString(), @"[a-zA-Z]").Success)
  317. {
  318. var table = paras[0].ToString().Split(':')[0];
  319. if (SC.ContainsItem($"{Module}.RecipeEditParameter.FlowSetting.{Name}.{table}"))
  320. setpoint = (float)SC.GetValue<double>($"{Module}.RecipeEditParameter.FlowSetting.{Name}.{table}");
  321. }
  322. else
  323. {
  324. float.TryParse(paras[0].ToString(), out setpoint);
  325. }
  326. }
  327. float ramp = 0;
  328. if (paras.Length > 1)
  329. float.TryParse(paras[1].ToString(), out ramp);
  330. if (paras.Length >= 8)
  331. {
  332. var setUnit = paras[2].ToString();
  333. var ramprateUnit = paras[3].ToString();
  334. bool.TryParse(paras[4].ToString(), out _isWait);
  335. float.TryParse(paras[5].ToString(), out float waitHigh);
  336. float.TryParse(paras[6].ToString(), out float waitLow);
  337. var waitUnit = paras[7].ToString();
  338. if(waitUnit.ToLower() == "%sv")
  339. {
  340. _waitHigh = setpoint * waitHigh;
  341. _waitLow = setpoint * waitLow;
  342. }
  343. else if(waitUnit.ToLower() == "%fs")
  344. {
  345. _waitHigh = (float)_scN2Scale.DoubleValue * waitHigh;
  346. _waitLow = (float)_scN2Scale.DoubleValue * waitLow;
  347. }
  348. else
  349. {
  350. _waitHigh = waitHigh;
  351. _waitLow = waitLow;
  352. }
  353. _stableJudgmentTimer.Stop();
  354. if (ramprateUnit.ToLower() == "time")
  355. {
  356. if (ramp > 0)
  357. ramp = (float)(setpoint - FeedBack) / ramp;
  358. }
  359. else if (ramprateUnit.ToLower() == "%")
  360. {
  361. ramp = (float)_scN2Scale.DoubleValue * ramp;
  362. }
  363. }
  364. SetPoint = setpoint;
  365. if (_aoRamp != null)
  366. {
  367. _aoRamp.FloatValue = ramp;
  368. }
  369. if (SC.ContainsItem($"PM1.MFC.{Name}.SetLastPoint"))
  370. {
  371. SC.SetItemValue($"PM1.MFC.{Name}.SetLastPoint", setpoint);
  372. }
  373. //LOG.Write($"{Name} setpoint={setpoint}, ramp={ramp} wait={_isWait} waitHigh={_waitHigh} waitLow={_waitLow}");
  374. _writeLog = $"{Name} setpoint={setpoint}, ramp={ramp} wait={_isWait} waitHigh={_waitHigh} waitLow={_waitLow}";
  375. return true;
  376. }
  377. public bool SetMfcValue(out string reason, int time, object[] param)
  378. {
  379. reason = string.Empty;
  380. float setpoint = 0.0f;
  381. var paras = param[0].ToString().Split(';'); // setpoint;ramping;alarmWatchTable
  382. if (System.Text.RegularExpressions.Regex.Match(paras[0].ToString(), @"[a-zA-Z]").Success)
  383. {
  384. var table = paras[0].ToString().Split(':')[0];
  385. if (SC.ContainsItem($"{Module}.RecipeEditParameter.FlowSetting.{Name}.{table}"))
  386. setpoint = (float)SC.GetValue<double>($"{Module}.RecipeEditParameter.FlowSetting.{Name}.{table}");
  387. }
  388. else
  389. {
  390. float.TryParse(paras[0].ToString(), out setpoint);
  391. }
  392. float ramp = 0;
  393. if (paras.Length > 1)
  394. float.TryParse(paras[1].ToString(), out ramp);
  395. if (paras.Length > 2)
  396. {
  397. }
  398. SetPoint = setpoint;
  399. _ramping = ramp;
  400. if(_aoRamp!=null)
  401. _aoRamp.FloatValue = ramp;
  402. LOG.Write($"{Name} setpoint={setpoint}, ramp={ramp}");
  403. return true;
  404. }
  405. public bool SetMfcSetPoint(out string reason, int time, object[] param)
  406. {
  407. reason = string.Empty;
  408. float setpoint = 0.0f;
  409. var paras = param[0].ToString().Split(';'); // setpoint;ramping;alarmWatchTable
  410. if (System.Text.RegularExpressions.Regex.Match(paras[0].ToString(), @"[a-zA-Z]").Success)
  411. {
  412. var table = paras[0].ToString().Split(':')[0];
  413. if (SC.ContainsItem($"{Module}.RecipeEditParameter.FlowSetting.{Name}.{table}"))
  414. setpoint = (float)SC.GetValue<double>($"{Module}.RecipeEditParameter.FlowSetting.{Name}.{table}");
  415. }
  416. else
  417. {
  418. float.TryParse(paras[0].ToString(), out setpoint);
  419. }
  420. float ramp = 0;
  421. if (paras.Length > 1)
  422. float.TryParse(paras[1].ToString(), out ramp);
  423. _setpoint = setpoint;
  424. _ramping = ramp;
  425. if(_aoRamp!=null)
  426. _aoRamp.FloatValue = ramp;
  427. LOG.Write($"{Name} setpoint={setpoint}, ramp={ramp}");
  428. return true;
  429. }
  430. public bool SetMfcVirtualValue(out string reason, int time, object[] param)
  431. {
  432. reason = string.Empty;
  433. float setpoint = 0.0f;
  434. var paras = param[0].ToString().Split(';'); // setpoint;ramping;alarmWatchTable
  435. if (System.Text.RegularExpressions.Regex.Match(paras[0].ToString(), @"[a-zA-Z]").Success)
  436. {
  437. var table = paras[0].ToString().Split(':')[0];
  438. if (SC.ContainsItem($"{Module}.RecipeEditParameter.FlowSetting.{Name}.{table}"))
  439. setpoint = (float)SC.GetValue<double>($"{Module}.RecipeEditParameter.FlowSetting.{Name}.{table}");
  440. }
  441. else
  442. {
  443. float.TryParse(paras[0].ToString(), out setpoint);
  444. }
  445. VirtualSetPoint = setpoint;
  446. VirtualFeedBack = setpoint;
  447. if (paras.Length > 1)
  448. {
  449. float.TryParse(paras[1].ToString(), out _ramping);
  450. VirtualRamping = _ramping;
  451. }
  452. return true;
  453. }
  454. public bool Ramp(double flowSetPoint, int time, out string reason)
  455. {
  456. if (HasAlarm)
  457. {
  458. reason = $"{DisplayName} in error status, can not flow";
  459. return false;
  460. }
  461. if (flowSetPoint < 0 || flowSetPoint > Scale)
  462. {
  463. reason = $"{DisplayName} range is [0, {Scale}], can not flow {flowSetPoint}";
  464. return false;
  465. }
  466. if (time > 0)
  467. {
  468. EV.PostInfoLog(Module, $"Set {DisplayName} flow to {flowSetPoint} {Unit} in {time / 1000:F0} seconds");
  469. }
  470. else
  471. {
  472. EV.PostInfoLog(Module, $"Set {DisplayName} flow to {flowSetPoint} {Unit}");
  473. }
  474. Ramp(flowSetPoint, time);
  475. reason = string.Empty;
  476. return true;
  477. }
  478. public void Ramp(int time)
  479. {
  480. Ramp(DefaultSetPoint, time);
  481. }
  482. public void Ramp(double target, int time)
  483. {
  484. target = Math.Max(0, target);
  485. target = Math.Min(Scale, target);
  486. _rampInitValue = FeedBack; //ramp 初始值取当前设定值,而非实际读取值.零漂问题
  487. _rampTime = time;
  488. _rampTarget = target;
  489. _rampTimer.Start(time);
  490. }
  491. public void StopRamp()
  492. {
  493. Ramp(SetPoint, 0);
  494. }
  495. private void MonitorRamping()
  496. {
  497. if (!_rampTimer.IsIdle())
  498. {
  499. if (_rampTimer.IsTimeout() || _rampTime == 0)
  500. {
  501. _rampTimer.Stop();
  502. SetPoint = _rampTarget;
  503. }
  504. else
  505. {
  506. SetPoint = _rampInitValue + (_rampTarget - _rampInitValue) * _rampTimer.GetElapseTime() / _rampTime;
  507. }
  508. }
  509. }
  510. private void MonitorTolerance()
  511. {
  512. if (!EnableAlarm || SetPoint < 0.01 ||
  513. _toleranceJudgmentDelayTimer.IsIdle() ||
  514. _toleranceJudgmentDelayTimer.GetElapseTime() < _toleranceJudgmentDelayTime * 1000)
  515. {
  516. _toleranceCheckerWarning.RST = true;
  517. _toleranceCheckerAlarm.RST = true;
  518. return;
  519. }
  520. if (_warningJudgmentRange != 0 && _warningJudgmentTime > 0)
  521. {
  522. _toleranceCheckerWarning.Monitor(FeedBack, (SetPoint - Math.Abs(_warningJudgmentRange)), (SetPoint + Math.Abs(_warningJudgmentRange)), _warningJudgmentTime);
  523. if (_toleranceCheckerWarning.Trig)
  524. {
  525. //AlarmToleranceWarning.Description = $"{Display} flow out of range {_warningJudgmentRange} {Unit} in {_warningJudgmentTime:F0} seconds";
  526. AlarmToleranceWarning.Set($"{Display} flow out of range {_warningJudgmentRange} {Unit} in {_warningJudgmentTime:F0} seconds");
  527. }
  528. }
  529. if (_alarmJudgmentRange != 0 && _alarmJudgmentTime > 0)
  530. {
  531. _toleranceCheckerAlarm.Monitor(FeedBack, (SetPoint - Math.Abs(_alarmJudgmentRange)), (SetPoint + Math.Abs(_alarmJudgmentRange)), _alarmJudgmentTime);
  532. if (_toleranceCheckerAlarm.Trig)
  533. {
  534. //AlarmToleranceAlarm.Description = $"{Display} flow out of range {_alarmJudgmentRange} {Unit} in {_alarmJudgmentTime:F0} seconds";
  535. AlarmToleranceAlarm.Set($"{Display} flow out of range {_alarmJudgmentRange} {Unit} in {_alarmJudgmentTime:F0} seconds");
  536. }
  537. }
  538. }
  539. public bool CheckWaitCondition(out string reason)
  540. {
  541. reason = "";
  542. if (!_isWait || _waitHigh == 0 || _waitLow == 0)
  543. return true;
  544. if (_stableJudgmentTimer.IsRunning)
  545. {
  546. if (FeedBack < SetPoint - _waitLow ||
  547. FeedBack > SetPoint + _waitHigh)
  548. {
  549. _stableJudgmentTimer.Restart();
  550. }
  551. if (_stableJudgmentTimer.ElapsedMilliseconds >= _stableJudgmentTime * 1000)
  552. {
  553. return true;
  554. }
  555. }
  556. else
  557. {
  558. _stableJudgmentTimer.Restart();
  559. }
  560. reason = $"{Name} feedback={FeedBack}, wait limit is ({SetPoint - _waitLow}, {SetPoint + _waitHigh})";
  561. return false;
  562. }
  563. }
  564. }