PlatingCellDevice.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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.Metal;
  9. using MECF.Framework.Common.CommonData.PlatingCell;
  10. using MECF.Framework.Common.CommonData.Reservoir;
  11. using MECF.Framework.Common.Equipment;
  12. using MECF.Framework.Common.IOCore;
  13. using MECF.Framework.Common.Persistent.Reservoirs;
  14. using MECF.Framework.Common.ToolLayout;
  15. using PunkHPX8_Core;
  16. using PunkHPX8_RT.Devices.AXIS;
  17. using PunkHPX8_RT.Devices.LinMot;
  18. using PunkHPX8_RT.Devices.PowerSupplier;
  19. using PunkHPX8_RT.Devices.Reservoir;
  20. using PunkHPX8_RT.Devices.VpwMain;
  21. using PunkHPX8_RT.Modules;
  22. using PunkHPX8_RT.Modules.PlatingCell;
  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.PlatingCell
  30. {
  31. public class PlatingCellDevice : BaseDevice, IDevice
  32. {
  33. #region 常量
  34. private const string PERSISTENT_VALUE = "PersistentValue";
  35. private const string PLATINGCELLDATA = "PlatingCellData";
  36. private const string AUTO = "Auto";
  37. private const string MANUAL = "Manual";
  38. private const string STRATUS = "Stratus";
  39. private const string DISABLED = "Disabled";
  40. private const string IS_HEAD_TILT = "IsHeadTilt";
  41. private const string IS_HEAD_VERTICAL = "IsHeadVertical";
  42. private const string CLAMSHELL_DISTANCE = "ClamShellDistance";
  43. private const string CLAMSHELL_CYLINDER_PRESSURE = "ClamShellCylinderPressure";
  44. private const string OVERFLOW_LEVEL = "OverFlowLevel";
  45. private const string CLAMSHELL_CLOSE = "ClamShellClose";
  46. private const string HEAD_TILT = "HeadTilt";
  47. private const string CCR_ENABLE = "CCREnable";
  48. private const string RINSE_ENABLE = "RinseEnable";
  49. #endregion
  50. #region 内部变量
  51. /// 变量是否初始化字典
  52. /// </summary>
  53. private Dictionary<string, bool> _variableInitializeDic = new Dictionary<string, bool>();
  54. /// <summary>
  55. /// 操作当前状态
  56. /// </summary>
  57. protected RState _status;
  58. /// <summary>
  59. /// 持久化数据
  60. /// </summary>
  61. protected PlatingCellPersistentValue _persistentValue;
  62. /// <summary>
  63. /// PlatingCell项
  64. /// </summary>
  65. private PlatingCellItem _platingCellItem;
  66. /// <summary>
  67. /// overflow
  68. /// </summary>
  69. private int _overflowLevelHigh = 85;
  70. private int _overflowLevelLow = 25;
  71. /// <summary>
  72. /// 对应reservoir的名字
  73. /// </summary>
  74. private string _reservoirName;
  75. /// <summary>
  76. /// PowerSupplier
  77. /// </summary>
  78. protected CellPowerSupplier _powerSupplier;
  79. /// <summary>
  80. /// vertical电机
  81. /// </summary>
  82. private JetAxisBase _verticalAxis;
  83. /// <summary>
  84. /// vertical电机
  85. /// </summary>
  86. private JetAxisBase _rotationAxis;
  87. #endregion
  88. #region 属性
  89. /// <summary>
  90. /// 状态
  91. /// </summary>
  92. public RState Status { get { return _status; } }
  93. /// <summary>
  94. /// 是否禁用
  95. /// </summary>
  96. public bool IsDisable { get { return _persistentValue == null || _persistentValue.OperatingMode == DISABLED; } }
  97. /// <summary>
  98. /// 操作模式
  99. /// </summary>
  100. public string OperationMode { get { return _persistentValue.OperatingMode; } }
  101. /// <summary>
  102. /// 工程模式
  103. /// </summary>
  104. public string EngineerMode { get { return _persistentValue.RecipeOperatingMode; } }
  105. /// <summary>
  106. /// 是否为Auto
  107. /// </summary>
  108. public bool IsAuto { get { return _persistentValue != null ? _persistentValue.OperatingMode == AUTO : false; } }
  109. /// <summary>
  110. /// 是否为Auto
  111. /// </summary>
  112. public bool IsManual { get { return _persistentValue != null ? _persistentValue.OperatingMode == MANUAL : false; } }
  113. /// <summary>
  114. /// A面PowerSupplier
  115. /// </summary>
  116. public CellPowerSupplier PowerSupplier { get { return _powerSupplier; } }
  117. #endregion
  118. #region 共享变量
  119. /// <summary>
  120. /// 数据
  121. /// </summary>
  122. protected PlatingCellData _platingCellData = new PlatingCellData();
  123. /// <summary>
  124. /// 对应reservoir数据
  125. /// </summary>
  126. protected ReservoirData _reservoirData = new ReservoirData();
  127. #endregion
  128. #region 属性
  129. /// <summary>
  130. /// 设备数据
  131. /// </summary>
  132. public PlatingCellData PlatingCellDeviceData { get { return _platingCellData; } }
  133. #endregion
  134. /// <summary>
  135. /// 构造函数
  136. /// </summary>
  137. /// <param name="moduleName"></param>
  138. public PlatingCellDevice(string moduleName) : base(moduleName, moduleName, moduleName, moduleName)
  139. {
  140. }
  141. /// <summary>
  142. /// 初始化
  143. /// </summary>
  144. /// <returns></returns>
  145. public virtual bool Initialize()
  146. {
  147. InitializeParameter();
  148. SubscribeData();
  149. InitializeOperation();
  150. SubscribeValueAction();
  151. return true;
  152. }
  153. /// <summary>
  154. /// 定时器执行
  155. /// </summary>
  156. public bool OnTimer(int interval)
  157. {
  158. if (_verticalAxis != null)
  159. {
  160. _verticalAxis.OnTimer();
  161. }
  162. if (_rotationAxis != null)
  163. {
  164. _rotationAxis.OnTimer();
  165. }
  166. return true;
  167. }
  168. /// <summary>
  169. /// 初始化参数
  170. /// </summary>
  171. private void InitializeParameter()
  172. {
  173. _persistentValue = PlatingCellPersistentManager.Instance.GetPlatingCellPersistentValue(Module);
  174. if (_persistentValue == null)
  175. {
  176. LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Persistent Value Object is not exist");
  177. }
  178. _platingCellItem = PlatingCellItemManager.Instance.GetPlatingCellItem(Module);
  179. if (_platingCellItem != null)
  180. {
  181. }
  182. _platingCellItem = PlatingCellItemManager.Instance.GetPlatingCellItem(Module);
  183. if (_platingCellItem != null)
  184. {
  185. _powerSupplier = DEVICE.GetDevice<CellPowerSupplier>(_platingCellItem.PlatingPowerSupplyID);
  186. }
  187. _overflowLevelHigh = SC.GetValue<int>($"PlatingCell.OverflowLevelHigh");
  188. _overflowLevelLow = SC.GetValue<int>($"PlatingCell.OverflowLevelLow");
  189. _reservoirData = GetReservoirDevice().ReservoirData;
  190. _reservoirName = GetReservoirDevice().Module;
  191. if("PlatingCell1".Equals(Module) || "PlatingCell2".Equals(Module))
  192. {
  193. _verticalAxis = DEVICE.GetDevice<JetAxisBase>("PlatingCell1_2.Vertical");
  194. }
  195. else
  196. {
  197. _verticalAxis = DEVICE.GetDevice<JetAxisBase>("PlatingCell3_4.Vertical");
  198. }
  199. _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
  200. }
  201. protected virtual void SubscribeValueAction()
  202. {
  203. IoSubscribeUpdateVariable(IS_HEAD_TILT);
  204. IoSubscribeUpdateVariable(IS_HEAD_VERTICAL);
  205. IoSubscribeUpdateVariable(CLAMSHELL_DISTANCE);
  206. IoSubscribeUpdateVariable(CLAMSHELL_CYLINDER_PRESSURE);
  207. IoSubscribeUpdateVariable(OVERFLOW_LEVEL);
  208. IoSubscribeUpdateVariable(CLAMSHELL_CLOSE);
  209. IoSubscribeUpdateVariable(HEAD_TILT);
  210. IoSubscribeUpdateVariable(CCR_ENABLE);
  211. IoSubscribeUpdateVariable(RINSE_ENABLE);
  212. }
  213. /// <summary>
  214. /// 订阅IO变量
  215. /// </summary>
  216. /// <param name="variable"></param>
  217. protected void IoSubscribeUpdateVariable(string variable)
  218. {
  219. _variableInitializeDic[variable] = false;
  220. IOModuleManager.Instance.SubscribeModuleVariable(Module, variable, UpdateVariableValue);
  221. }
  222. /// <summary>
  223. /// 更新变量数值
  224. /// </summary>
  225. /// <param name="variable"></param>
  226. /// <param name="value"></param>
  227. private void UpdateVariableValue(string variable, object value)
  228. {
  229. if (!_platingCellData.IsDataInitialized)
  230. {
  231. _platingCellData.IsDataInitialized = true;
  232. }
  233. PropertyInfo property = _platingCellData.GetType().GetProperty(variable);
  234. if (property != null)
  235. {
  236. property.SetValue(_platingCellData, value);
  237. if (variable == OVERFLOW_LEVEL)
  238. {
  239. double waterLevel = CurrentToWaterLevel(Convert.ToDouble(value));
  240. _platingCellData.OverFlowLevel = waterLevel;
  241. if (_platingCellData.OverFlowLevel >= _overflowLevelHigh)
  242. {
  243. _platingCellData.OverFlowStatus = "High";
  244. }
  245. else if(_platingCellData.OverFlowLevel <= _overflowLevelLow)
  246. {
  247. _platingCellData.OverFlowStatus = "Empty";
  248. }
  249. else
  250. {
  251. _platingCellData.OverFlowStatus = "Full";
  252. }
  253. }
  254. }
  255. if (_variableInitializeDic.ContainsKey(variable) && !_variableInitializeDic[variable])
  256. {
  257. _variableInitializeDic[variable] = true;
  258. }
  259. }
  260. /// <summary>
  261. /// 把电流mA转成水深mm
  262. /// </summary>
  263. /// <param name="current"></param>
  264. private double CurrentToWaterLevel(double current)
  265. {
  266. double result = (current - 4) / 8 / 9.8 * 1000;
  267. return result;
  268. }
  269. /// <summary>
  270. /// 写变量
  271. /// </summary>
  272. /// <param name="variable"></param>
  273. /// <param name="value"></param>
  274. /// <returns></returns>
  275. protected bool WriteVariableValue(string variable, object value)
  276. {
  277. string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{variable}");
  278. return IOModuleManager.Instance.WriteIoValue(ioName, value);
  279. }
  280. /// <summary>
  281. /// 订阅数据
  282. /// </summary>
  283. private void SubscribeData()
  284. {
  285. DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _persistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  286. DATA.Subscribe($"{Module}.{PLATINGCELLDATA}", () => _platingCellData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  287. DATA.Subscribe($"{Module}.ReservoirCommonData", () => _reservoirData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  288. DATA.Subscribe($"{Module}.ReservoirName", () => _reservoirName, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  289. DATA.Subscribe($"{Module}.PowerSupplierData", () => _powerSupplier.PowerSupplierData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  290. DATA.Subscribe($"{Module}.PowerSupplier.ID", () => _powerSupplier.Module, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  291. DATA.Subscribe($"{Module}.PowerSupplier.IsConnected", () => _powerSupplier.IsConnected, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  292. DATA.Subscribe($"{Module}.PowerSupplier.Voltage", () => _powerSupplier.PowerSupplierData.Voltage, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  293. DATA.Subscribe($"{Module}.PowerSupplier.Current", () => _powerSupplier.PowerSupplierData.Current, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  294. DATA.Subscribe($"{Module}.PowerSupplier.SetPoint", () => _powerSupplier.PowerSupplierData.SetPoint, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  295. DATA.Subscribe($"{Module}.PowerSupplier.RunModel", () => _powerSupplier.PowerSupplierData.PowerRunModelContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  296. DATA.Subscribe($"{Module}.PowerSupplier.PowerControl", () => _powerSupplier.PowerSupplierData.PowerControlContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  297. DATA.Subscribe($"{Module}.PowerSupplier.PowerStatus", () => _powerSupplier.PowerSupplierData.PowerStatusContent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  298. DATA.Subscribe($"{Module}.PowerSupplier.Enable", () => _powerSupplier.PowerSupplierData.Enabled, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  299. }
  300. /// <summary>
  301. /// 初始化操作
  302. /// </summary>
  303. protected virtual void InitializeOperation()
  304. {
  305. OP.Subscribe($"{Module}.DisabledAction", DisabledOperation);
  306. OP.Subscribe($"{Module}.ManualAction", ManualOperation);
  307. OP.Subscribe($"{Module}.AutoAction", AutoOperation);
  308. OP.Subscribe($"{Module}.EngineeringModeAction", EngineeringModeOperation);
  309. OP.Subscribe($"{Module}.ProductionModeAction", ProductionModeOperation);
  310. OP.Subscribe($"{Module}.SetPlatingCellWaferSize", (cmd, args) => { return SetPlatingCellWaferSize(cmd, args); });
  311. OP.Subscribe($"{Module}.ClamShellClose", (cmd, para) => { return ClamShellClose(); });
  312. OP.Subscribe($"{Module}.ClamShellOpen", (cmd, para) => { return ClamShellOpen(); });
  313. OP.Subscribe($"{Module}.HeadtTilt", (cmd, para) => { return HeadtTiltAction(); });
  314. OP.Subscribe($"{Module}.HeadVertical", (cmd, para) => { return HeadtVerticalAction(); });
  315. OP.Subscribe($"{Module}.CCREnable", (cmd, para) => { return CCREnableAction(); });
  316. OP.Subscribe($"{Module}.CCRDisable", (cmd, para) => { return CCRDiableAction(); });
  317. OP.Subscribe($"{Module}.RinseEnable", (cmd, para) => { return RinseEnableAction(); });
  318. OP.Subscribe($"{Module}.RinseDisable", (cmd, para) => { return RinseDisableAction(); });
  319. OP.Subscribe($"{Module}.StartRotation", StartRotationAction);
  320. OP.Subscribe($"{Module}.StopRotation", StopRotationAction);
  321. }
  322. #region Operation
  323. private bool StartRotationAction(string cmd, object[] args)
  324. {
  325. if (args.Length < 2 && (int)args[0] < 0 && (int)args[1] < 0)
  326. {
  327. LOG.WriteLog(eEvent.ERR_VPW, Module, $"Start rotation paramater is wrong");
  328. return false;
  329. }
  330. double targetPostion = (int)args[0] * 6 * (int)args[1];
  331. object[] param = new object[] { "", targetPostion };
  332. int degSpeed = (int)args[0] * 6;
  333. SetRotationSpeed(degSpeed);
  334. double AfterChangetargetPostion = (int)args[0] * 6 * (int)args[1];
  335. return RotationProfilePosition(AfterChangetargetPostion);
  336. }
  337. private bool StopRotationAction(string cmd, object[] args)
  338. {
  339. return _rotationAxis.StopPositionOperation();
  340. }
  341. public bool ClamShellClose()
  342. {
  343. return WriteVariableValue(CLAMSHELL_CLOSE, true);
  344. }
  345. public bool ClamShellOpen()
  346. {
  347. return WriteVariableValue(CLAMSHELL_CLOSE, false);
  348. }
  349. public bool HeadtTiltAction()
  350. {
  351. return WriteVariableValue(HEAD_TILT, true);
  352. }
  353. public bool HeadtVerticalAction()
  354. {
  355. return WriteVariableValue(HEAD_TILT, false);
  356. }
  357. public bool CCREnableAction()
  358. {
  359. return WriteVariableValue(CCR_ENABLE, true);
  360. }
  361. public bool CCRDiableAction()
  362. {
  363. return WriteVariableValue(CCR_ENABLE, false);
  364. }
  365. public bool RinseEnableAction()
  366. {
  367. return WriteVariableValue(RINSE_ENABLE, true);
  368. }
  369. public bool RinseDisableAction()
  370. {
  371. return WriteVariableValue(RINSE_ENABLE, false);
  372. }
  373. /// <summary>
  374. /// DisabledAction
  375. /// </summary>
  376. /// <param name="cmd"></param>
  377. /// <param name="param"></param>
  378. /// <returns></returns>
  379. public bool DisabledOperation(string cmd, object[] args)
  380. {
  381. string currentOperation = "Disabled";
  382. PlatingCellEntity platingCellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(Module);
  383. if (platingCellEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
  384. {
  385. string preOperation = _persistentValue.OperatingMode;
  386. if (platingCellEntity.IsBusy)
  387. {
  388. LOG.WriteLog(eEvent.ERR_METAL, Module, $"{Module} is Busy, can't switch to Disabled mode");
  389. return false;
  390. }
  391. //if (SchedulerMetalTimeManager.Instance.Contained(Module))
  392. //{
  393. // LOG.WriteLog(eEvent.ERR_METAL, Module, $"{Module} is in scheduler, can't switch to Disabled mode");
  394. // return false;
  395. //}
  396. platingCellEntity.EnterInit();
  397. _persistentValue.OperatingMode = currentOperation;
  398. LOG.WriteLog(eEvent.INFO_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
  399. }
  400. PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
  401. return true;
  402. }
  403. /// <summary>
  404. /// ManualAction
  405. /// </summary>
  406. /// <param name="cmd"></param>
  407. /// <param name="param"></param>
  408. /// <returns></returns>
  409. public bool ManualOperation(string cmd, object[] args)
  410. {
  411. string currentOperation = "Manual";
  412. PlatingCellEntity platingCellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(Module);
  413. if (platingCellEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
  414. {
  415. string preOperation = _persistentValue.OperatingMode;
  416. if (platingCellEntity.IsBusy)
  417. {
  418. LOG.WriteLog(eEvent.ERR_METAL, Module, $"{Module} is Busy, can't switch to Manual mode");
  419. return false;
  420. }
  421. //if (SchedulerMetalTimeManager.Instance.Contained(Module))
  422. //{
  423. // LOG.WriteLog(eEvent.ERR_METAL, Module, $"{Module} is in scheduler, can't switch to Manual mode");
  424. // return false;
  425. //}
  426. platingCellEntity.EnterInit();
  427. _persistentValue.OperatingMode = currentOperation;
  428. LOG.WriteLog(eEvent.INFO_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
  429. }
  430. PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
  431. return true;
  432. }
  433. /// <summary>
  434. /// AutoAction
  435. /// </summary>
  436. /// <param name="cmd"></param>
  437. /// <param name="param"></param>
  438. /// <returns></returns>
  439. public bool AutoOperation(string cmd, object[] args)
  440. {
  441. string currentOperation = "Auto";
  442. PlatingCellEntity platingCellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(Module);
  443. if (platingCellEntity != null && _persistentValue != null && _persistentValue.OperatingMode != currentOperation)
  444. {
  445. string preOperation = _persistentValue.OperatingMode;
  446. if (platingCellEntity.IsBusy)
  447. {
  448. LOG.WriteLog(eEvent.ERR_METAL, Module, $"{Module} is Busy, can't switch to Auto mode");
  449. return false;
  450. }
  451. platingCellEntity.EnterInit();
  452. _persistentValue.OperatingMode = currentOperation;
  453. LOG.WriteLog(eEvent.INFO_METAL, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
  454. }
  455. PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
  456. return true;
  457. }
  458. /// <summary>
  459. /// EngineeringModeAction
  460. /// </summary>
  461. /// <param name="cmd"></param>
  462. /// <param name="param"></param>
  463. /// <returns></returns>
  464. private bool EngineeringModeOperation(string cmd, object[] args)
  465. {
  466. string currentRecipeOperation = "Engineering";
  467. if (_persistentValue != null)
  468. {
  469. _persistentValue.RecipeOperatingMode = currentRecipeOperation;
  470. }
  471. PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
  472. return true;
  473. }
  474. /// <summary>
  475. /// ProductionAction
  476. /// </summary>
  477. /// <param name="cmd"></param>
  478. /// <param name="param"></param>
  479. /// <returns></returns>
  480. private bool ProductionModeOperation(string cmd, object[] args)
  481. {
  482. string currentRecipeOperation = "Production";
  483. if (_persistentValue != null)
  484. {
  485. _persistentValue.RecipeOperatingMode = currentRecipeOperation;
  486. }
  487. PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
  488. return true;
  489. }
  490. private bool SetPlatingCellWaferSize(string cmd, object[] args)
  491. {
  492. string metalWaferSize = args[0] as string;
  493. if (_persistentValue != null)
  494. {
  495. _persistentValue.PlatingCellWaferSize = int.Parse(metalWaferSize);
  496. }
  497. PlatingCellPersistentManager.Instance.UpdatePersistentValue(Module);
  498. return true;
  499. }
  500. /// <summary>
  501. /// 获取Reservoir设备
  502. /// </summary>
  503. /// <returns></returns>
  504. private ReservoirDevice GetReservoirDevice()
  505. {
  506. string reservoir = ReservoirItemManager.Instance.GetReservoirByPlatingCell(Module);
  507. return DEVICE.GetDevice<ReservoirDevice>(reservoir);
  508. }
  509. #endregion
  510. #region RotationAxis
  511. /// <summary>
  512. /// 电机是否上电
  513. /// </summary>
  514. /// <returns></returns>
  515. public bool CheckRotationSwitchOn()
  516. {
  517. return _rotationAxis.IsSwitchOn;
  518. }
  519. /// <summary>
  520. /// Home rotation
  521. /// </summary>
  522. /// <returns></returns>
  523. public bool HomeRotation()
  524. {
  525. return _rotationAxis.Home();
  526. }
  527. /// <summary>
  528. /// 检验Rotation Home结果
  529. /// </summary>
  530. /// <returns></returns>
  531. public bool CheckHomeEndStatus()
  532. {
  533. return CheckRotationEndStatus() && _rotationAxis.IsHomed;
  534. }
  535. /// <summary>
  536. /// 检验Rotation结束状态
  537. /// </summary>
  538. /// <returns></returns>
  539. public bool CheckRotationEndStatus()
  540. {
  541. return _rotationAxis.Status == PunkHPX8_Core.RState.End;
  542. }
  543. /// <summary>
  544. /// 检验Rotation失败状态
  545. /// </summary>
  546. /// <returns></returns>
  547. public bool CheckRotationStopStatus()
  548. {
  549. return _rotationAxis.Status == PunkHPX8_Core.RState.Failed;
  550. }
  551. /// <summary>
  552. /// 设置速度
  553. /// </summary>
  554. /// <param name="speed"></param>
  555. /// <returns></returns>
  556. public bool SetRotationSpeed(int speed)
  557. {
  558. _rotationAxis.SetProfileSpeed(speed);
  559. return true;
  560. }
  561. /// <summary>
  562. /// 改变速度
  563. /// </summary>
  564. /// <param name="speed"></param>
  565. /// <returns></returns>
  566. public bool ChangeRotationSpeed(int speed)
  567. {
  568. return _rotationAxis.ChangeSpeed(speed);
  569. }
  570. /// <summary>
  571. /// 电机运动
  572. /// </summary>
  573. /// <param name="position"></param>
  574. /// <returns></returns>
  575. public bool RotationProfilePosition(double position)
  576. {
  577. return _rotationAxis.ProfilePositionOperation(position);
  578. }
  579. /// <summary>
  580. /// 停止运动
  581. /// </summary>
  582. /// <returns></returns>
  583. public bool StopProfilePosition()
  584. {
  585. return _rotationAxis.StopPositionOperation();
  586. }
  587. /// <summary>
  588. /// 是否Rotation运动
  589. /// </summary>
  590. /// <returns></returns>
  591. public bool CheckRotationRunning()
  592. {
  593. return _rotationAxis.IsRun;
  594. }
  595. #endregion
  596. public virtual void Monitor()
  597. {
  598. }
  599. public virtual void Reset()
  600. {
  601. }
  602. public virtual void Terminate()
  603. {
  604. }
  605. }
  606. }