PlatingCellDevice.cs 26 KB

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