PendulumValve.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using Venus_RT.Modules;
  5. using MECF.Framework.Common.Communications;
  6. using MECF.Framework.Common.Equipment;
  7. using Venus_Core;
  8. using Aitex.Core.RT.SCCore;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Core.RT.Device;
  11. using Aitex.Core.RT.Log;
  12. using System.Threading.Tasks;
  13. using System.Collections.Concurrent;
  14. using Aitex.Core.Common.DeviceData;
  15. using MECF.Framework.Common.CommonData.DeviceData;
  16. using Aitex.Core.RT.DataCenter;
  17. using Venus_RT.Modules.PMs;
  18. using System.Linq;
  19. using System.Security.Claims;
  20. namespace Venus_RT.Devices
  21. {
  22. class PendulumValve : IDevice
  23. {
  24. public enum Operation
  25. {
  26. SetPosition,
  27. GetPositionSP,
  28. Hold,
  29. OpenValve,
  30. CloseValve,
  31. SetPressure,
  32. GetPressureSP,
  33. GetAssembly,
  34. GetPosition,
  35. GetPressure,
  36. GetSensor1Data,
  37. GetSensor2Data,
  38. GetPressureCtrlStatus,
  39. GetDeviceStatus,
  40. GetWarnings,
  41. GetSensorOffset,
  42. GetSensor1Offset,
  43. GetSensor2Offset,
  44. GetLearnStatus,
  45. GetLearnPressureLimit,
  46. GetErrorStatus,
  47. GetFatalErrorStatus,
  48. GetThrottleCycleCounter,
  49. GetIsolationCycleCounter,
  50. GetPowerUpCounter,
  51. GetHardwareConfiguration,
  52. GetFirmwareConfiguration,
  53. GetIdentification,
  54. SetAccessMode,
  55. SetInterfaceConfiguration,
  56. SetValveConfiguration,
  57. SetSensorConfiguration,
  58. SetRangeConfiguration,
  59. SetZero,
  60. SetPressureAlignment,
  61. SetLearn,
  62. DownloadLearnData,
  63. UploadLearnData,
  64. SetPIDConfiguration,
  65. GetPIDConfiguration,
  66. SetValveSpeed,
  67. GetValveSpeed,
  68. Reset,
  69. Invalid,
  70. SetP,
  71. SetI,
  72. GetP,
  73. GetI
  74. }
  75. private readonly Dictionary<Operation, string> _noneParaCommandOp = new Dictionary<Operation, string>
  76. {
  77. {Operation.GetPositionSP, "i:38" },
  78. {Operation.Hold, "H:" },
  79. {Operation.CloseValve, "C:" },
  80. {Operation.OpenValve, "O:" },
  81. {Operation.GetPressureSP, "i:38" },
  82. {Operation.GetAssembly, "i:76" },
  83. {Operation.GetPosition, "A:" },
  84. {Operation.GetPressure, "P:" },
  85. {Operation.GetSensor1Data, "i:64" },
  86. {Operation.GetSensor2Data, "i:65" },
  87. {Operation.GetPressureCtrlStatus, "i:36" },
  88. {Operation.GetDeviceStatus, "i:30" },
  89. {Operation.GetWarnings, "i:35" },
  90. {Operation.GetSensorOffset, "i:62" },
  91. {Operation.GetSensor1Offset, "i:60" },
  92. {Operation.GetSensor2Offset, "i:61" },
  93. {Operation.GetLearnStatus, "i:32" },
  94. {Operation.GetLearnPressureLimit, "i:34" },
  95. {Operation.GetErrorStatus, "i:52" },
  96. {Operation.GetFatalErrorStatus, "i:50" },
  97. {Operation.GetThrottleCycleCounter, "i:70" },
  98. {Operation.GetIsolationCycleCounter, "i:71" },
  99. {Operation.GetPowerUpCounter, "i:72" },
  100. {Operation.GetHardwareConfiguration, "i:80" },
  101. {Operation.GetFirmwareConfiguration, "i:82" },
  102. {Operation.GetIdentification, "i:83" },
  103. {Operation.GetP, "i:02B04" },
  104. {Operation.GetI, "i:02B05" },
  105. };
  106. private readonly Dictionary<Operation, string> _singleParaCommandOp = new Dictionary<Operation, string>
  107. {
  108. {Operation.SetPosition, "R:{0:D6}" },
  109. {Operation.SetPressure, "S:{0:D8}" },
  110. {Operation.SetAccessMode, "c:01{0:D2}" },
  111. {Operation.SetInterfaceConfiguration, "s:20{0:D8}" },
  112. {Operation.SetValveConfiguration, "s:04{0:D2}000000" },
  113. {Operation.SetSensorConfiguration, "s:01{0:D8}" },
  114. {Operation.SetRangeConfiguration, "s:21{0:D8}" },
  115. {Operation.SetPressureAlignment, "c:6002{0:D8}" },
  116. {Operation.SetLearn, "L:{0:D8}" },
  117. {Operation.UploadLearnData, "u:{0:D3}" },
  118. {Operation.SetPIDConfiguration, "s:02{0:D8}" },
  119. {Operation.SetValveSpeed, "V:00{0:D4}" },
  120. {Operation.SetP, "s:02B04{0}" },
  121. {Operation.SetI, "s:02B05{0}" }
  122. };
  123. private readonly Dictionary<Operation, string> _twoParaCommandOp = new Dictionary<Operation, string>
  124. {
  125. {Operation.DownloadLearnData, "d:{0:D3}{1:D8}" }
  126. };
  127. private readonly Dictionary<string, string> _deviceError = new Dictionary<string, string>
  128. {
  129. {"000001", "Parity error" },
  130. {"000002", "Input buffer overflow (to many characters) " },
  131. {"000003", "Framing error (data length, number of stop bits)" },
  132. {"000010", "<CR> or <LF> missing" },
  133. {"000011", ": missing" },
  134. {"000012", "Invalid number of characters (between : and [CR][LF])" },
  135. {"000020", "Unknown command" },
  136. {"000021", "Unknown command" },
  137. {"000022", "Invalid value" },
  138. {"000023", "Invalid value" },
  139. {"000030", "Value out of range" },
  140. {"000041", "Command not applicable for hardware configuration" },
  141. {"000060", "ZERO disabled" },
  142. {"000080", "Command not accepted due to local operation" },
  143. {"000082", "Command not accepted due to synchronization, CLOSED or OPEN by digital input, safety mode or fatal error" },
  144. };
  145. public string Module { get; set; }
  146. public string Name { get; set; }
  147. public float Pressure { get; private set; }
  148. public float Position { get; private set; }
  149. public string Status { get; private set; }
  150. public bool IsOpen { get; private set; }
  151. private readonly string EOF = "\r\n";
  152. private readonly int _readInterval = 100;
  153. private readonly int _position_unit = 100;
  154. private readonly float _pressure_ful_range = 500;
  155. private readonly int _foreLinePressureLimit = 750;
  156. private readonly int _chamberPressureLimit = 600;
  157. private readonly int _turboPumpSpeedLimit = 100;
  158. private int _queryFlag = 0;
  159. private readonly AsyncSerialPort _serial;
  160. private Stopwatch _queryWatch = new Stopwatch();
  161. private string _lastAlarmString = string.Empty;
  162. private string _lastWarningString = string.Empty;
  163. private Operation[] _querys = new Operation[]
  164. {
  165. Operation.GetPressure,
  166. Operation.GetPosition,
  167. Operation.GetDeviceStatus
  168. //Operation.GetP,
  169. //Operation.GetI
  170. };
  171. BlockingCollection<string> blockingCollection = new BlockingCollection<string>();
  172. //private JetChamber m_JetChamber;
  173. private PressureType m_PressureType;
  174. public float PValue;
  175. public float IValue;
  176. private float m_PressureSetPoint;
  177. private float m_PositionSetPoint;
  178. //private ModuleName _mod;
  179. public AITPendulumValveData DeviceData
  180. {
  181. get
  182. {
  183. AITPendulumValveData deviceData = new AITPendulumValveData
  184. {
  185. DeviceName = Name,
  186. Module = Module,
  187. Pressure = Pressure,
  188. IsOpen = IsOpen || Position > 0,
  189. Position = IsOpen ? Position : 0,
  190. PValue = PValue,
  191. IValue = IValue,
  192. PressureSetPoint= IsOpen ? m_PressureSetPoint : 0,
  193. PositionSetPoint= IsOpen ? m_PositionSetPoint : 0
  194. };
  195. return deviceData;
  196. }
  197. }
  198. public PendulumValve(ModuleName mod,PressureType pressureType)
  199. {
  200. Name = VenusDevice.PendulumValve.ToString();
  201. Module = mod.ToString();
  202. var _PortNum = SC.GetStringValue($"{mod}.PendulumValve.Port");
  203. _serial = new AsyncSerialPort(_PortNum, 9600, 8, System.IO.Ports.Parity.None, System.IO.Ports.StopBits.One, EOF);
  204. _pressure_ful_range = SC.GetValue<int>($"{mod}.PendulumValve.PressureFullRange");
  205. _foreLinePressureLimit = SC.GetValue<int>($"{mod}.PendulumValve.ForelinePressureLimit");
  206. _chamberPressureLimit = SC.GetValue<int>($"{mod}.PendulumValve.ChamberPressureLimit");
  207. _turboPumpSpeedLimit = SC.GetValue<int>($"{mod}.PendulumValve.TurboPumpSpeedLimit");
  208. IsOpen = false;
  209. Task.Run(() =>
  210. {
  211. foreach (var data in blockingCollection.GetConsumingEnumerable())
  212. {
  213. _serial?.Write(data);
  214. System.Threading.Thread.Sleep(100);
  215. }
  216. });
  217. m_PressureType = pressureType;
  218. //m_JetChamber = (JetChamber)SC.GetValue<int>($"{mod}.ChamberType");
  219. }
  220. public bool Initialize()
  221. {
  222. DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
  223. DATA.Subscribe($"{Module}.{Name}.Position", () => Position);
  224. DATA.Subscribe($"{Module}.{Name}.Pressure", () => Pressure);
  225. DATA.Subscribe($"{Module}.{Name}.PressureSetPoint", () => m_PressureSetPoint);
  226. DATA.Subscribe($"{Module}.{Name}.PositionSetPoint", () => m_PositionSetPoint);
  227. DATA.Subscribe($"{Module}.{Name}.IsOpen", () => IsOpen);
  228. if (!_serial.Open())
  229. {
  230. _noRepeatAlarm("Pendulum Valve 串口无法打开");
  231. return false;
  232. }
  233. _serial.OnDataChanged += OnPortDataChanged;
  234. _serial.OnErrorHappened += OnErrorOccurred;
  235. _queryWatch.Restart();
  236. return true;
  237. }
  238. public void Monitor()
  239. {
  240. if (_queryWatch.ElapsedMilliseconds > _readInterval && _querys.Length>0)
  241. {
  242. SendCommand(_querys[_queryFlag++ % _querys.Length]);
  243. _queryWatch.Restart();
  244. }
  245. //ClearDeviceValue();
  246. }
  247. public void Reset()
  248. {
  249. }
  250. public void Terminate()
  251. {
  252. if (IsOpen)
  253. {
  254. TurnValve(false);
  255. }
  256. _serial?.Close();
  257. }
  258. private void OnErrorOccurred(string obj)
  259. {
  260. _noRepeatAlarm($"[{Module}] VAT Pendulum Valve error: [{obj}]");
  261. }
  262. private void OnPortDataChanged(string obj)
  263. {
  264. if (string.IsNullOrEmpty(obj))
  265. {
  266. _noRepeatAlarm("VAT Pendulum Valve receive empty message");
  267. return;
  268. }
  269. try
  270. {
  271. var data = obj.TrimEnd().Split(':');
  272. switch (data[0])
  273. {
  274. case "P":
  275. {
  276. Double pressure;
  277. if (Double.TryParse(data[1], out pressure))
  278. {
  279. Pressure = Convert.ToSingle(pressure) * _pressure_ful_range / 1000000;
  280. //LOG.Write(eEvent.EV_DEVICE_INFO, Module, $" Pressure Raw:{Convert.ToSingle(pressure)} Trans:{Pressure}");
  281. //if ((m_JetChamber == JetChamber.Kepler2200A || m_JetChamber == JetChamber.Kepler2200B))
  282. //{
  283. // //Pressure = Convert.ToSingle(ConvertPressureUnit.ConvertmTorrToPa(pressure * _pressure_ful_range / 1000000));
  284. // Pressure = Convert.ToSingle( pressure * _pressure_ful_range / 1000000);
  285. //}
  286. //else if (m_JetChamber == JetChamber.VenusSE)
  287. //{
  288. // Pressure = Convert.ToSingle(pressure) / 100;
  289. //}
  290. //else if (m_JetChamber == JetChamber.VenusDE)
  291. //{
  292. // Pressure = Convert.ToSingle(pressure);
  293. //}
  294. //else
  295. //{
  296. // Pressure = Convert.ToSingle(pressure) * _pressure_ful_range / 1000000;
  297. //}
  298. }
  299. }
  300. break;
  301. case "A":
  302. {
  303. float position;
  304. if (float.TryParse(data[1], out position))
  305. Position = position / _position_unit;
  306. }
  307. break;
  308. case "i":
  309. {
  310. _tryParseInqueryData(obj);
  311. }
  312. break;
  313. case "C":
  314. IsOpen = false;
  315. break;
  316. case "O":
  317. IsOpen = true;
  318. break;
  319. case "H":
  320. case "R":
  321. case "S":
  322. break;
  323. case "E":
  324. {
  325. _noRepeatAlarm($"[{Module}] VAT Pendulum Valve device error: {_deviceError[data[1]]}");
  326. }
  327. break;
  328. default:
  329. {
  330. _noRepeatAlarm($"VAT Pendulum Valve: unrecognized received data: {obj}");
  331. break;
  332. }
  333. }
  334. }
  335. catch (Exception ex)
  336. {
  337. _noRepeatAlarm($"[{Module}] VAT Pendulum Valve error: [{ex.Message}], Data: {obj}");
  338. }
  339. }
  340. private bool SendCommand(Operation op)
  341. {
  342. if (_noneParaCommandOp.ContainsKey(op))
  343. {
  344. blockingCollection.Add(_noneParaCommandOp[op] + EOF);
  345. return true;
  346. }
  347. else
  348. {
  349. return false;
  350. }
  351. }
  352. private bool SendCommand(Operation op, int data)
  353. {
  354. if (_singleParaCommandOp.ContainsKey(op))
  355. {
  356. var cmd = string.Format(_singleParaCommandOp[op], data) + EOF;
  357. return _sendCmd(cmd);
  358. }
  359. else
  360. {
  361. _noRepeatAlarm("This VAT Pendulum Valve command need 1 data");
  362. return false;
  363. }
  364. }
  365. private bool SendCommand(Operation op, float data)
  366. {
  367. if (_singleParaCommandOp.ContainsKey(op))
  368. {
  369. var cmd = string.Format(_singleParaCommandOp[op], data) + EOF;
  370. return _sendCmd(cmd);
  371. }
  372. else
  373. {
  374. _noRepeatAlarm("This VAT Pendulum Valve command need 1 data");
  375. return false;
  376. }
  377. }
  378. private bool _sendCmd(string cmd)
  379. {
  380. blockingCollection.Add(cmd);
  381. return true;
  382. //return _serial.Write(cmd);
  383. }
  384. private void _noRepeatAlarm(string alarm)
  385. {
  386. if (_lastAlarmString != alarm)
  387. {
  388. _lastAlarmString = alarm;
  389. LOG.Write(eEvent.ERR_PENDULUM_VALVE, ModuleHelper.Converter(Module), alarm);
  390. EV.PostAlarmLog(Module, alarm);
  391. }
  392. }
  393. private void _noRepeatWarning(string warning)
  394. {
  395. if (_lastWarningString != warning)
  396. {
  397. _lastWarningString = warning;
  398. LOG.Write(eEvent.WARN_DEVICE_INFO, ModuleHelper.Converter(Module), warning);
  399. EV.PostWarningLog(Module, warning);
  400. }
  401. }
  402. private bool _tryParseInqueryData(string data)
  403. {
  404. var cmdPrix = data.Substring(0, 4);
  405. if (cmdPrix == "i:02")
  406. {
  407. var pi = data.Substring(5, 2);
  408. if (pi == "04")
  409. {
  410. float s;
  411. float.TryParse(data.Substring(7, data.Length - 9), out s);
  412. PValue = s;
  413. }
  414. else if (pi == "05")
  415. {
  416. float s;
  417. float.TryParse(data.Substring(7, data.Length - 9), out s);
  418. IValue = s;
  419. }
  420. }
  421. else
  422. {
  423. Operation oper = Operation.Invalid;
  424. foreach (var item in _noneParaCommandOp)
  425. {
  426. if (item.Value == cmdPrix)
  427. {
  428. oper = item.Key;
  429. break;
  430. }
  431. }
  432. if (oper == Operation.Invalid)
  433. {
  434. return false;
  435. }
  436. switch (oper)
  437. {
  438. case Operation.GetDeviceStatus:
  439. {
  440. Status = data.Substring(4, 8);
  441. if (Status[1] == 'E')
  442. {
  443. // Fatal Error
  444. _noRepeatAlarm($"Device Status error:{Status}");
  445. }
  446. else if (Status[3] == '1')
  447. {
  448. // Warning Present
  449. //_noRepeatAlarm($"Device Warning Present:{Status}");
  450. _noRepeatWarning($"Device Warning Present:{Status}");
  451. }
  452. else if (Status[1] == '3')
  453. {
  454. IsOpen = false;
  455. }
  456. else if (Status[1] == '4')
  457. {
  458. IsOpen = true;
  459. }
  460. }
  461. break;
  462. case Operation.GetPressureSP:
  463. case Operation.GetPositionSP:
  464. {
  465. string Pressure = data.Substring(4, 8);
  466. //LOG.Write(eEvent.EV_DEVICE_INFO, Module, $" PV Pressure SetPoint: {Pressure}");
  467. }
  468. break;
  469. default:
  470. break;
  471. }
  472. }
  473. return true;
  474. }
  475. public bool SetPosition(float postion)
  476. {
  477. if (_CheckStatus(true))
  478. {
  479. //TurnValve(true);
  480. m_PositionSetPoint = postion;
  481. float setPosition = (float)Math.Round(postion, 1);
  482. //LOG.Write(eEvent.ERR_PENDULUM_VALVE,Module,$"Set Position : {(int)(setPosition * _position_unit)}");
  483. return SendCommand(Operation.SetPosition, (int)(setPosition * _position_unit));
  484. }
  485. return false;
  486. }
  487. public bool SetPressure(float pressure)
  488. {
  489. if (_CheckStatus(true))
  490. {
  491. //TurnValve(true);
  492. m_PressureSetPoint = pressure;
  493. return SendCommand(Operation.SetPressure, Convert.ToInt32(pressure * 1000000 / _pressure_ful_range));
  494. //if (m_PressureType == PressureType.Pa)
  495. //{
  496. // //var value = Convert.ToInt32(ConvertPressureUnit.ConvertPaTomtorr(pressure) * 1000000 / (_pressure_ful_range));
  497. // return SendCommand(Operation.SetPressure, Convert.ToInt32(ConvertPressureUnit.ConvertPaTomtorr(pressure) * 1000000 / (_pressure_ful_range)));
  498. //}
  499. //else
  500. //{
  501. // return SendCommand(Operation.SetPressure, Convert.ToInt32(pressure * 1000000 / _pressure_ful_range));
  502. //}
  503. }
  504. return false;
  505. }
  506. public bool Hold()
  507. {
  508. return SendCommand(Operation.Hold);
  509. }
  510. public bool TurnValve(bool on)
  511. {
  512. if (on == false)
  513. {
  514. return SendCommand(on ? Operation.OpenValve : Operation.CloseValve);
  515. }
  516. else
  517. {
  518. if (_CheckStatus(on))
  519. {
  520. return SendCommand(on ? Operation.OpenValve : Operation.CloseValve);
  521. }
  522. }
  523. return false;
  524. }
  525. public bool SetPValue(float pValue)
  526. {
  527. return SendCommand(Operation.SetP, pValue);
  528. }
  529. public bool SetIValue(float pValue)
  530. {
  531. return SendCommand(Operation.SetI, pValue);
  532. }
  533. bool _CheckStatus(bool bTurnOn = false)
  534. {
  535. if (RtInstance.ConfigType==ConfigType.Kepler2200 && SC.GetValue<bool>($"{Module}.{Name}.NoCheck"))
  536. {
  537. return true;
  538. }
  539. if (Status != null && Status[1] == 'E')
  540. {
  541. _noRepeatAlarm($"PendulumValve is error status, can do turn on/off operation.");
  542. return false;
  543. }
  544. var _chamber = DEVICE.GetDevice<JetPMBase>(Module);
  545. // 2024-9-24 09:37:09 支伟星要求在非ATMMode下也可以开启pendulum valve 条件如下
  546. if ((RtInstance.ConfigType == ConfigType.VenusSE || RtInstance.ConfigType == ConfigType.VenusDE) && bTurnOn && _chamber.IsATM && _chamber.TurboPumpSpeed <= 1 && !_chamber.CheckValve(ValveType.TurboPumpPumping) && !_chamber.CheckValve(ValveType.TurboPumpPurge))
  547. {
  548. LOG.Write(eEvent.ERR_PENDULUM_VALVE, "Watch out! The Chamber will Open Pendulum in specific status");
  549. _noRepeatAlarm($"Notify: 1. chamber is ATM 2.TurboPumpPumping && TurboPumpPurge valve had close");
  550. return true;
  551. }
  552. if (bTurnOn && !_chamber.IsTurboPumpAtSpeed)
  553. {
  554. _noRepeatAlarm($"Turbo Pump not at speed, can not turn on pendulum valve.");
  555. return false;
  556. }
  557. if (_chamber.ForelinePressure > _foreLinePressureLimit)
  558. {
  559. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, $"Foreline Pressure:{_chamber.ForelinePressure} is higher than {_foreLinePressureLimit}{m_PressureType}, can not turn on pendulum valve.");
  560. return false;
  561. }
  562. if (_chamber.ChamberPressure > _chamberPressureLimit && _chamber.TurboPumpSpeed > _turboPumpSpeedLimit)
  563. {
  564. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, $"Chamber Pressure:{_chamber.ChamberPressure} is higher than {_chamberPressureLimit}{m_PressureType} and Chamber.TurboPumpSpeed is higher than {_turboPumpSpeedLimit}, can not turn on pendulum valve.");
  565. return false;
  566. }
  567. if (_chamber.IsTurboPumpRunning )
  568. {
  569. if (!_chamber.IsISOOpen && bTurnOn)
  570. {
  571. LOG.Write(eEvent.ERR_PENDULUM_VALVE, Module, $"Chamber TurboPumpingvalve is not open, can not turn on pendulum valve.");
  572. return false;
  573. }
  574. }
  575. return true;
  576. }
  577. public bool ReConnect()
  578. {
  579. return _serial.ReConnect();
  580. }
  581. private void ClearDeviceValue()
  582. {
  583. if (_serial.IsConnected==false)
  584. {
  585. IsOpen = false;
  586. Position = 0;
  587. }
  588. }
  589. }
  590. }