VpwCellDevice.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Log;
  4. using Aitex.Core.RT.OperationCenter;
  5. using Aitex.Core.RT.SCCore;
  6. using Aitex.Core.Util;
  7. using MECF.Framework.Common.Beckhoff.ModuleIO;
  8. using MECF.Framework.Common.CommonData.Prewet;
  9. using MECF.Framework.Common.CommonData.Vpw;
  10. using MECF.Framework.Common.Equipment;
  11. using MECF.Framework.Common.IOCore;
  12. using MECF.Framework.Common.Persistent.SRD;
  13. using MECF.Framework.Common.Persistent.Temperature;
  14. using MECF.Framework.Common.Persistent.VpwCell;
  15. using MECF.Framework.Common.Persistent.VpwMain;
  16. using MECF.Framework.Common.ToolLayout;
  17. using MECF.Framework.Common.Utilities;
  18. using PunkHPX8_RT.Devices.AXIS;
  19. using PunkHPX8_RT.Devices.Resistivity;
  20. using PunkHPX8_RT.Devices.VpwMain;
  21. using PunkHPX8_RT.Modules;
  22. using PunkHPX8_RT.Modules.VpwMain;
  23. using System;
  24. using System.Collections.Generic;
  25. using System.Linq;
  26. using System.Reflection;
  27. using System.Text;
  28. using System.Threading.Tasks;
  29. namespace PunkHPX8_RT.Devices.VpwCell
  30. {
  31. public class VpwCellDevice : BaseDevice, IDevice
  32. {
  33. #region 常量
  34. private const string COMMON_DATA = "CommonData";
  35. private const string DIW_FLOW = "DiwFlow";
  36. private const string VACUUM_PRESSURE = "VacuumPressure";
  37. private const string FLOW_DRIP = "FlowDrip";
  38. private const string FLOW_SMALL = "FlowSmall";
  39. private const string FLOW_LARGE = "FlowLarge";
  40. private const string VACUUM_VALVE = "VacuumValve";
  41. private const string VENT_VALVE = "VentValve";
  42. private const string DRAIN_VALVE = "DrainValve";
  43. private const string PERSISTENT_VALUE = "PersistentValue";
  44. private const string LOOPDO_VALUE = "LoopDoValue";
  45. #endregion
  46. #region 内部变量
  47. /// <summary>
  48. /// 变量是否初始化字典
  49. /// </summary>
  50. private Dictionary<string, bool> _variableInitializeDic = new Dictionary<string, bool>();
  51. /// <summary>
  52. /// 数据
  53. /// </summary>
  54. private VpwCellCommonData _commonData=new VpwCellCommonData();
  55. /// Vpw main数据
  56. /// </summary>
  57. private VpwMainCommonData _mainCommonData = new VpwMainCommonData();
  58. /// <summary>
  59. /// 持久性数值
  60. /// </summary>
  61. private VpwCellPersistentValue _vpwCellPersistentValue;
  62. /// <summary>
  63. /// 水平电机
  64. /// </summary>
  65. private JetAxisBase _rotationAxis;
  66. /// <summary>
  67. /// 水阻计控制器
  68. /// </summary>
  69. private ResistivityController _resistivityController;
  70. /// <summary>
  71. /// 水阻值
  72. /// </summary>
  73. private double _resistivityValue;
  74. /// <summary>
  75. /// main device
  76. /// </summary>
  77. private VpwMainDevice _vpwMainDevice;
  78. /// <summary>
  79. /// cell flow 初始设定值
  80. /// </summary>
  81. private double _cellFLowSetValue;
  82. /// <summary>
  83. /// cell流量满足初始设定值自动打开排水阀的时间
  84. /// </summary>
  85. private int _dripValveOpenIdlePeriod;
  86. /// <summary>
  87. /// 检测到cell flow 满足设定条件的时间
  88. /// </summary>
  89. private DateTime _cellFlowOkDetectTime;
  90. /// <summary>
  91. /// 检测到cell flow 是否正常
  92. /// </summary>
  93. private bool _cellFlowOK;
  94. #endregion
  95. #region 属性
  96. /// <summary>
  97. /// 数据
  98. /// </summary>
  99. public VpwCellCommonData CommonData { get { return _commonData; } }
  100. /// <summary>
  101. /// vpw main数据
  102. /// </summary>
  103. public VpwMainCommonData MainCommonData { get { return _mainCommonData; } }
  104. /// <summary>
  105. /// 操作模式
  106. /// </summary>
  107. public string OperationMode { get { return _vpwCellPersistentValue.OperatingMode; } }
  108. /// <summary>
  109. /// 工程模式
  110. /// </summary>
  111. public string EngineerMode { get { return _vpwCellPersistentValue.RecipeOperatingMode; } }
  112. /// <summary>
  113. /// LoopDO数值
  114. /// </summary>
  115. public double LoopDOValue { get { return GetLoopDOValue(); } }
  116. #endregion
  117. /// <summary>
  118. /// 构造函数
  119. /// </summary>
  120. /// <param name="moduleName"></param>
  121. public VpwCellDevice(string moduleName) : base(moduleName, moduleName, moduleName, moduleName)
  122. {
  123. }
  124. #region 初始化
  125. /// <summary>
  126. /// 初始化
  127. /// </summary>
  128. /// <returns></returns>
  129. public bool Initialize()
  130. {
  131. InitializeParameter();
  132. InitializeRoutine();
  133. SubscribeData();
  134. SubscribeValueAction();
  135. InitializeOperation();
  136. return true;
  137. }
  138. /// <summary>
  139. /// 初始化参数
  140. /// </summary>
  141. private void InitializeParameter()
  142. {
  143. _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
  144. _vpwCellPersistentValue = VpwCellPersistentManager.Instance.GetPersistentValue(Module);
  145. VpwCellItem vpwCellItem=VpwCellItemManager.Instance.GetVpwItem(Module);
  146. if (vpwCellItem != null)
  147. {
  148. _resistivityController = DEVICE.GetDevice<ResistivityController>(vpwCellItem.ResistivityID);
  149. }
  150. _vpwMainDevice = DEVICE.GetDevice<VpwMainDevice>($"VPWMain1");
  151. if(_vpwMainDevice != null)
  152. {
  153. _mainCommonData = _vpwMainDevice.CommonData;
  154. }
  155. }
  156. /// <summary>
  157. /// 初始化Routine
  158. /// </summary>
  159. private void InitializeRoutine()
  160. {
  161. }
  162. /// <summary>
  163. /// 订阅
  164. /// </summary>
  165. private void SubscribeData()
  166. {
  167. DATA.Subscribe($"{Module}.{COMMON_DATA}", () => CommonData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  168. DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _vpwCellPersistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  169. DATA.Subscribe($"{Module}.DiwCellFlow", () => CommonData.DiwFlow, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  170. DATA.Subscribe($"{Module}.VacuumValve", () => CommonData.VacuumValve, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  171. DATA.Subscribe($"{Module}.{LOOPDO_VALUE}", ()=> { return GetLoopDOValue(); }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  172. }
  173. /// <summary>
  174. /// 获取Loop do数值
  175. /// </summary>
  176. /// <returns></returns>
  177. private double GetLoopDOValue()
  178. {
  179. if (_resistivityController != null)
  180. {
  181. string value = _resistivityController.ResisitivityValue;
  182. if (double.TryParse(value, out _resistivityValue))
  183. {
  184. return _resistivityValue;
  185. }
  186. else
  187. {
  188. _resistivityValue = 0;
  189. return 0;
  190. }
  191. }
  192. else
  193. {
  194. return 0;
  195. }
  196. }
  197. /// <summary>
  198. /// 订阅数据
  199. /// </summary>
  200. private void SubscribeValueAction()
  201. {
  202. IoSubscribeUpdateVariable(DIW_FLOW);
  203. IoSubscribeUpdateVariable(DRAIN_VALVE);
  204. IoSubscribeUpdateVariable(VACUUM_PRESSURE);
  205. IoSubscribeUpdateVariable(VACUUM_VALVE);
  206. IoSubscribeUpdateVariable(VENT_VALVE);
  207. IoSubscribeUpdateVariable(FLOW_DRIP);
  208. IoSubscribeUpdateVariable(FLOW_LARGE);
  209. IoSubscribeUpdateVariable(FLOW_SMALL);
  210. }
  211. /// <summary>
  212. /// 初始化变量
  213. /// </summary>
  214. /// <param name="variable"></param>
  215. private void IoSubscribeUpdateVariable(string variable)
  216. {
  217. _variableInitializeDic[variable] = false;
  218. IOModuleManager.Instance.SubscribeModuleVariable(Module, variable, UpdateVariableValue);
  219. }
  220. /// <summary>
  221. /// 更新变量数值
  222. /// </summary>
  223. /// <param name="variable"></param>
  224. /// <param name="value"></param>
  225. private void UpdateVariableValue(string variable, object value)
  226. {
  227. PropertyInfo property = _commonData.GetType().GetProperty(variable);
  228. if (property != null)
  229. {
  230. property.SetValue(_commonData, value);
  231. if (variable == VACUUM_PRESSURE)
  232. {
  233. double torr = UnitUtil.ConvertToTorr((double)value);
  234. property.SetValue(_commonData, torr);
  235. }
  236. }
  237. if (_variableInitializeDic.ContainsKey(variable) && !_variableInitializeDic[variable])
  238. {
  239. _variableInitializeDic[variable] = true;
  240. }
  241. }
  242. /// <summary>
  243. /// 初始化OP
  244. /// </summary>
  245. private void InitializeOperation()
  246. {
  247. OP.Subscribe($"{Module}.FlowDripOn", (cmd,para)=> { return FlowDripOn(); });
  248. OP.Subscribe($"{Module}.FlowDripOff", (cmd, para) => { return FlowDripOff(); });
  249. OP.Subscribe($"{Module}.FlowSmallOn", (cmd, para) => { return FlowSmallOn(); });
  250. OP.Subscribe($"{Module}.FlowSmallOff", (cmd, para) => { return FlowSmallOff(); });
  251. OP.Subscribe($"{Module}.FlowLargeOn", (cmd, para) => { return FlowLargeOn(); });
  252. OP.Subscribe($"{Module}.FlowLargeOff", (cmd, para) => { return FlowLargeOff(); });
  253. OP.Subscribe($"{Module}.VentValveOn", (cmd, para) => { return VentValveOn(); });
  254. OP.Subscribe($"{Module}.VentValveOff", (cmd, para) => { return VentValveOff(); });
  255. OP.Subscribe($"{Module}.DrainValveOn", (cmd, para) => { return DrainValveOn(); });
  256. OP.Subscribe($"{Module}.DrainValveOff", (cmd, para) => { return DrainValveOff(); });
  257. OP.Subscribe($"{Module}.VacuumValveOn", (cmd, para) => { return VacuumValveOn(); });
  258. OP.Subscribe($"{Module}.VacuumValveOff", (cmd, para) => { return VacuumValveOff(); });
  259. OP.Subscribe($"{Module}.DisabledAction", DisabledOperation);
  260. OP.Subscribe($"{Module}.ManualAction", ManualOperation);
  261. OP.Subscribe($"{Module}.AutoAction", AutoOperation);
  262. OP.Subscribe($"{Module}.EngineeringModeAction", EngineeringModeOperation);
  263. OP.Subscribe($"{Module}.ProductionModeAction", ProductionModeOperation);
  264. OP.Subscribe($"{Module}.StartRotation", StartRotationAction);
  265. OP.Subscribe($"{Module}.StopRotation", StopRotationAction);
  266. }
  267. #endregion
  268. #region Action
  269. private bool StartRotationAction(string cmd, object[] args)
  270. {
  271. if (args.Length < 2 && (int)args[0] < 0 && (int)args[1] < 0)
  272. {
  273. LOG.WriteLog(eEvent.ERR_VPW, Module, $"Start rotation paramater is wrong");
  274. return false;
  275. }
  276. double targetPostion = (int)args[0] * 6 * (int)args[1];
  277. object[] param = new object[] { "",targetPostion };
  278. int degSpeed = (int)args[0] * 6;
  279. SetRotationSpeed(degSpeed);
  280. //return _rotationAxis.JogUpPosition("", param);
  281. double AfterChangetargetPostion = (int)args[0] * 6 * (int)args[1];
  282. return RotationProfilePosition(AfterChangetargetPostion);
  283. }
  284. private bool StopRotationAction(string cmd, object[] args)
  285. {
  286. return _rotationAxis.StopPositionOperation();
  287. }
  288. #region Flow
  289. /// <summary>
  290. /// Flow Drip on
  291. /// </summary>
  292. /// <returns></returns>
  293. public bool FlowDripOn()
  294. {
  295. return WriteVariableValue(FLOW_DRIP, true);
  296. }
  297. /// <summary>
  298. /// Flow Drip Off
  299. /// </summary>
  300. /// <returns></returns>
  301. public bool FlowDripOff()
  302. {
  303. return WriteVariableValue(FLOW_DRIP, false);
  304. }
  305. /// <summary>
  306. /// Flow Small On
  307. /// </summary>
  308. /// <returns></returns>
  309. public bool FlowSmallOn()
  310. {
  311. return WriteVariableValue(FLOW_SMALL, true);
  312. }
  313. /// <summary>
  314. /// Flow Small Off
  315. /// </summary>
  316. /// <returns></returns>
  317. public bool FlowSmallOff()
  318. {
  319. return WriteVariableValue(FLOW_SMALL, false);
  320. }
  321. /// <summary>
  322. /// Flow Large On
  323. /// </summary>
  324. /// <returns></returns>
  325. public bool FlowLargeOn()
  326. {
  327. return WriteVariableValue(FLOW_LARGE, true);
  328. }
  329. /// <summary>
  330. /// Flow Large Off
  331. /// </summary>
  332. /// <returns></returns>
  333. public bool FlowLargeOff()
  334. {
  335. return WriteVariableValue(FLOW_LARGE, false);
  336. }
  337. #endregion
  338. #region Mode Switch
  339. /// <summary>
  340. /// DisabledAction
  341. /// </summary>
  342. /// <param name="cmd"></param>
  343. /// <param name="param"></param>
  344. /// <returns></returns>
  345. private bool DisabledOperation(string cmd, object[] args)
  346. {
  347. string currentOperation = "Disabled";
  348. VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
  349. if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
  350. {
  351. string preOperation = _vpwCellPersistentValue.OperatingMode;
  352. if (vpwCellEntity.IsBusy)
  353. {
  354. LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Disabled mode");
  355. return false;
  356. }
  357. vpwCellEntity.EnterInit();
  358. _vpwCellPersistentValue.OperatingMode = currentOperation;
  359. LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
  360. }
  361. VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
  362. return true;
  363. }
  364. /// <summary>
  365. /// ManualAction
  366. /// </summary>
  367. /// <param name="cmd"></param>
  368. /// <param name="param"></param>
  369. /// <returns></returns>
  370. private bool ManualOperation(string cmd, object[] args)
  371. {
  372. string currentOperation = "Manual";
  373. VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
  374. if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
  375. {
  376. string preOperation = _vpwCellPersistentValue.OperatingMode;
  377. if (vpwCellEntity.IsBusy)
  378. {
  379. LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Manual mode");
  380. return false;
  381. }
  382. vpwCellEntity.EnterInit();
  383. _vpwCellPersistentValue.OperatingMode = currentOperation;
  384. LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
  385. }
  386. VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
  387. return true;
  388. }
  389. /// <summary>
  390. /// AutoAction
  391. /// </summary>
  392. /// <param name="cmd"></param>
  393. /// <param name="param"></param>
  394. /// <returns></returns>
  395. private bool AutoOperation(string cmd, object[] args)
  396. {
  397. string currentOperation = "Auto";
  398. VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
  399. if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
  400. {
  401. string preOperation = _vpwCellPersistentValue.OperatingMode;
  402. if (vpwCellEntity.IsBusy)
  403. {
  404. LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Auto mode");
  405. return false;
  406. }
  407. vpwCellEntity.EnterInit();
  408. _vpwCellPersistentValue.OperatingMode = currentOperation;
  409. LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
  410. }
  411. VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
  412. return true;
  413. }
  414. /// <summary>
  415. /// EngineeringModeAction
  416. /// </summary>
  417. /// <param name="cmd"></param>
  418. /// <param name="param"></param>
  419. /// <returns></returns>
  420. private bool EngineeringModeOperation(string cmd, object[] args)
  421. {
  422. string currentRecipeOperation = "Engineering";
  423. if (_vpwCellPersistentValue != null)
  424. {
  425. _vpwCellPersistentValue.RecipeOperatingMode = currentRecipeOperation;
  426. }
  427. VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
  428. return true;
  429. }
  430. /// <summary>
  431. /// ProductionAction
  432. /// </summary>
  433. /// <param name="cmd"></param>
  434. /// <param name="param"></param>
  435. /// <returns></returns>
  436. private bool ProductionModeOperation(string cmd, object[] args)
  437. {
  438. string currentRecipeOperation = "Production";
  439. if (_vpwCellPersistentValue != null)
  440. {
  441. _vpwCellPersistentValue.RecipeOperatingMode = currentRecipeOperation;
  442. }
  443. VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
  444. return true;
  445. }
  446. #endregion
  447. #region Vent Valve
  448. /// <summary>
  449. /// Vent Valve On
  450. /// </summary>
  451. /// <returns></returns>
  452. public bool VentValveOn()
  453. {
  454. return WriteVariableValue(VENT_VALVE, true);
  455. }
  456. /// <summary>
  457. /// Vent Valve Off
  458. /// </summary>
  459. /// <returns></returns>
  460. public bool VentValveOff()
  461. {
  462. return WriteVariableValue(VENT_VALVE, false);
  463. }
  464. #endregion
  465. #region Drain Valve
  466. /// <summary>
  467. /// Drain Valve On
  468. /// </summary>
  469. /// <returns></returns>
  470. public bool DrainValveOn()
  471. {
  472. return WriteVariableValue(DRAIN_VALVE, true);
  473. }
  474. /// <summary>
  475. /// Drain Valve Off
  476. /// </summary>
  477. /// <returns></returns>
  478. public bool DrainValveOff()
  479. {
  480. return WriteVariableValue(DRAIN_VALVE, false);
  481. }
  482. #endregion
  483. #region Vacuum
  484. /// <summary>
  485. /// Vacuum valve on
  486. /// </summary>
  487. /// <returns></returns>
  488. public bool VacuumValveOn()
  489. {
  490. return WriteVariableValue(VACUUM_VALVE, true);
  491. }
  492. /// <summary>
  493. /// Vacuum valve off
  494. /// </summary>
  495. /// <returns></returns>
  496. public bool VacuumValveOff()
  497. {
  498. return WriteVariableValue(VACUUM_VALVE, false);
  499. }
  500. #endregion
  501. /// <summary>
  502. /// 写变量
  503. /// </summary>
  504. /// <param name="variable"></param>
  505. /// <param name="value"></param>
  506. /// <returns></returns>
  507. private bool WriteVariableValue(string variable, object value)
  508. {
  509. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{variable}");
  510. return IOModuleManager.Instance.WriteIoValue(ioName, value);
  511. }
  512. #endregion
  513. #region Axis
  514. /// <summary>
  515. /// 电机是否上电
  516. /// </summary>
  517. /// <returns></returns>
  518. public bool CheckRotationSwitchOn()
  519. {
  520. return _rotationAxis.IsSwitchOn;
  521. }
  522. /// <summary>
  523. /// Home rotation
  524. /// </summary>
  525. /// <returns></returns>
  526. public bool HomeRotation()
  527. {
  528. return _rotationAxis.Home();
  529. }
  530. /// <summary>
  531. /// 检验Rotation Home结果
  532. /// </summary>
  533. /// <returns></returns>
  534. public bool CheckHomeEndStatus()
  535. {
  536. return CheckRotationEndStatus() && _rotationAxis.IsHomed;
  537. }
  538. /// <summary>
  539. /// 检验Rotation结束状态
  540. /// </summary>
  541. /// <returns></returns>
  542. public bool CheckRotationEndStatus()
  543. {
  544. return _rotationAxis.Status == PunkHPX8_Core.RState.End;
  545. }
  546. /// <summary>
  547. /// 检验Rotation失败状态
  548. /// </summary>
  549. /// <returns></returns>
  550. public bool CheckRotationStopStatus()
  551. {
  552. return _rotationAxis.Status == PunkHPX8_Core.RState.Failed;
  553. }
  554. /// <summary>
  555. /// 设置速度
  556. /// </summary>
  557. /// <param name="speed"></param>
  558. /// <returns></returns>
  559. public bool SetRotationSpeed(int speed)
  560. {
  561. _rotationAxis.SetProfileSpeed(speed);
  562. return true;
  563. }
  564. /// <summary>
  565. /// 改变速度
  566. /// </summary>
  567. /// <param name="speed"></param>
  568. /// <returns></returns>
  569. public bool ChangeRotationSpeed(int speed)
  570. {
  571. return _rotationAxis.ChangeSpeed(speed);
  572. }
  573. /// <summary>
  574. /// 电机运动
  575. /// </summary>
  576. /// <param name="position"></param>
  577. /// <returns></returns>
  578. public bool RotationProfilePosition(double position)
  579. {
  580. VpwMainDevice vpwCellDevice = DEVICE.GetDevice<VpwMainDevice>(ModuleName.VPWMain1.ToString());
  581. if (vpwCellDevice != null)
  582. {
  583. if (vpwCellDevice.CommonData.ChamberOpened && !vpwCellDevice.CommonData.ChamberClosed)
  584. {
  585. LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "chamber is not closed, Cannot execute Rotation Profile Position");
  586. return false;
  587. }
  588. }
  589. return _rotationAxis.ProfilePositionOperation(position);
  590. }
  591. /// <summary>
  592. /// 停止运动
  593. /// </summary>
  594. /// <returns></returns>
  595. public bool StopProfilePosition()
  596. {
  597. return _rotationAxis.StopPositionOperation();
  598. }
  599. /// <summary>
  600. /// 是否Rotation运动
  601. /// </summary>
  602. /// <returns></returns>
  603. public bool CheckRotationRunning()
  604. {
  605. return _rotationAxis.IsRun;
  606. }
  607. #endregion
  608. /// <summary>
  609. /// 定时器
  610. /// </summary>
  611. /// <returns></returns>
  612. public bool OnTimer()
  613. {
  614. if (_rotationAxis != null)
  615. {
  616. _rotationAxis.OnTimer();
  617. }
  618. //cell flow满足条件过一段时间自动打开排水阀
  619. CellFlowMonitor();
  620. return true;
  621. }
  622. //cell flow满足条件过一段时间自动打开排水阀
  623. private void CellFlowMonitor()
  624. {
  625. _cellFLowSetValue = SC.GetValue<double>("VPWMain.Plumbing.CellFlowStartLowLimit");
  626. _dripValveOpenIdlePeriod = SC.GetValue<int>($"{Module}.DripValveOpenIdlePeriod");
  627. if (_commonData.DiwFlow > _cellFLowSetValue)
  628. {
  629. if (!_cellFlowOK)
  630. {
  631. _cellFlowOK = true;
  632. _cellFlowOkDetectTime = DateTime.Now;
  633. }
  634. if ((DateTime.Now - _cellFlowOkDetectTime).TotalSeconds > _dripValveOpenIdlePeriod * 60 && !_commonData.DrainValve)
  635. {
  636. LOG.WriteLog(eEvent.WARN_VPW, Module, $"cell flow is lower than start limit more than {_dripValveOpenIdlePeriod} min,Drin valve on!");
  637. DrainValveOn();
  638. _cellFlowOkDetectTime = DateTime.Now;
  639. }
  640. }
  641. else
  642. {
  643. _cellFlowOK = false;
  644. }
  645. }
  646. /// <summary>
  647. /// 监控
  648. /// </summary>
  649. public void Monitor()
  650. {
  651. }
  652. public void Reset()
  653. {
  654. }
  655. public void Terminate()
  656. {
  657. }
  658. }
  659. }