HongHuTM.cs 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.SCCore;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using Venus_Core;
  13. namespace Venus_RT.Devices
  14. {
  15. public class HongHuTM : TM
  16. {
  17. /// <summary>
  18. /// 针对VenusSE设计
  19. /// </summary>
  20. #region io 信号抽象
  21. //控制阀信号
  22. private readonly IoValve _TMFastPumpValve;
  23. private readonly IoValve _TMSoftPumpValve;
  24. private readonly IoValve _VCESoftPumpValve;
  25. private readonly IoValve _VCEFastPumpValve;
  26. private readonly IoValve _TMFastVentValve;
  27. private readonly IoValve _TMSoftVentValve;
  28. private readonly IoValve _VCESoftVentValve;
  29. private readonly IoValve _VCEFastVentValve;
  30. //判断信号
  31. private readonly IoSensor _VCESlitDoorOpen;
  32. private readonly IoSensor _PMASlitDoorOpen;
  33. private readonly IoSensor _PMBSlitDoorOpen;
  34. private readonly IoSensor _PMCSlitDoorOpen;
  35. private readonly IoSensor _VCESlitDoorOpenEnable;
  36. private readonly IoSensor _PMASlitDoorOpenEnable;
  37. private readonly IoSensor _PMBSlitDoorOpenEnable;
  38. private readonly IoSensor _PMCSlitDoorOpenEnable;
  39. private readonly IoSensor _TMExtendVCEEnable;
  40. private readonly IoSensor _TMExtendPMAEnable;
  41. private readonly IoSensor _TMExtendPMBEnable;
  42. private readonly IoSensor _TMExtendPMCEnable;
  43. private readonly IoSensor _TMATMSensor;
  44. private readonly IoSensor _VCEATMSensor;
  45. //控制门信号
  46. private readonly IoCylinder _VCESlitDoor;
  47. private readonly IoCylinder _PMASlitDoor;
  48. private readonly IoCylinder _PMBSlitDoor;
  49. private readonly IoCylinder _PMCSlitDoor;
  50. //控压
  51. private readonly IoTMPressureCtrl _presureCtrl;
  52. //安装的module
  53. private string _allInstalledModules { get { return SC.GetStringValue("System.InstalledModules").ToString(); } }
  54. #endregion
  55. #region 暴露变量
  56. //ATM VAC信号
  57. public bool IsTMATM => _TMATMSensor.Value;
  58. public bool IsVCEATM => _VCEATMSensor.Value;
  59. //valve开关状态
  60. public bool IsTMFastPumpOpen => _TMFastPumpValve.Status;
  61. public bool IsTMSoftPumpOpen => _TMSoftPumpValve.Status;
  62. public bool IsTMFastVentOpen => _TMFastVentValve.Status;
  63. public bool IsTMSoftVentOpen => _TMSoftVentValve.Status;
  64. public bool IsVCEFastPumpOpen => _VCEFastPumpValve.Status;
  65. public bool IsVCESoftPumpOpen => _VCESoftPumpValve.Status;
  66. public bool IsVCEFastVentOpen => _VCEFastVentValve.Status;
  67. public bool IsVCESoftVentOpen => _VCESoftVentValve.Status;
  68. //SlitDoor
  69. public bool VCESlitDoorClosed => _VCESlitDoor.State == CylinderState.Close;
  70. public bool PMASlitDoorClosed
  71. {
  72. get
  73. {
  74. if (_allInstalledModules.Contains("PMA"))
  75. return _PMASlitDoor.State == CylinderState.Close;
  76. else
  77. return true;
  78. }
  79. }
  80. public bool PMBSlitDoorClosed
  81. {
  82. get
  83. {
  84. if (_allInstalledModules.Contains("PMB"))
  85. return _PMBSlitDoor.State == CylinderState.Close;
  86. else
  87. return true;
  88. }
  89. }
  90. public bool PMCSlitDoorClosed
  91. {
  92. get
  93. {
  94. if (_allInstalledModules.Contains("PMC"))
  95. return _PMCSlitDoor.State == CylinderState.Close;
  96. else
  97. return true;
  98. }
  99. }
  100. public bool AllPMSlitDoorClosed
  101. {
  102. get
  103. {
  104. if (PMASlitDoorClosed && PMBSlitDoorClosed && PMCSlitDoorClosed)
  105. return true;
  106. else
  107. return false;
  108. }
  109. }
  110. public bool VCESlitDoorOpenEnable => _VCESlitDoorOpenEnable.Value;
  111. public bool PMASlitDoorOpenEnable => _PMASlitDoorOpenEnable.Value;
  112. public bool PMBSlitDoorOpenEnable => _PMBSlitDoorOpenEnable.Value;
  113. public bool PMCSlitDoorOpenEnable => _PMCSlitDoorOpenEnable.Value;
  114. //Robot动作
  115. public bool TMExtendVCEEnable => _TMExtendVCEEnable.Value;
  116. public bool TMExtendPMAEnable => _TMExtendPMAEnable.Value;
  117. public bool TMExtendPMBEnable => _TMExtendPMBEnable.Value;
  118. public bool TMExtendPMCEnable => _TMExtendPMCEnable.Value;
  119. #endregion
  120. public HongHuTM(string module) : base(module)
  121. {
  122. _TMFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMFastPumpValve}");
  123. _TMSoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMSoftPumpValve}");
  124. _VCESoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.VCESoftPumpValve}");
  125. _VCEFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.VCEFastPumpValve}");
  126. _TMFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMFastPumpValve}");
  127. _TMSoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMSoftVentValve}");
  128. _VCESoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.VCESoftVentValve}");
  129. _VCEFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.VCEFastVentValve}");
  130. _VCESlitDoorOpenEnable = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.VCESlitDoorOpenEnable}");
  131. _PMASlitDoorOpenEnable = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.PMASlitDoorOpenEnable}");
  132. _PMBSlitDoorOpenEnable = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.PMBSlitDoorOpenEnable}");
  133. _PMCSlitDoorOpenEnable = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.PMCSlitDoorOpenEnable}");
  134. _TMExtendVCEEnable = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMExtendVCEEnable}");
  135. _TMExtendPMAEnable = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMExtendPMAEnable}");
  136. _TMExtendPMBEnable = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMExtendPMBEnable}");
  137. _TMExtendPMCEnable = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMExtendPMCEnable}");
  138. _TMATMSensor = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMATMSensor}");
  139. _VCEATMSensor = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.VCEATMSensor}");
  140. _VCESlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.VCESlitDoor}");
  141. _PMASlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.PMASlitDoor}");
  142. _PMBSlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.PMBSlitDoor}");
  143. _PMCSlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.PMCSlitDoor}");
  144. }
  145. #region IO控制方法
  146. //slitdoor
  147. public void TurnSlitDoor(ModuleName mod, bool bOn)
  148. {
  149. switch(mod)
  150. {
  151. case ModuleName.VCE1:
  152. _VCESlitDoor.SetCylinder(bOn, out _);
  153. break;
  154. case ModuleName.PMA:
  155. _PMASlitDoor.SetCylinder(bOn, out _);
  156. break;
  157. case ModuleName.PMB:
  158. _PMBSlitDoor.SetCylinder(bOn, out _);
  159. break;
  160. case ModuleName.PMC:
  161. _PMCSlitDoor.SetCylinder(bOn, out _);
  162. break;
  163. }
  164. }
  165. //valve
  166. public void TurnFastPumpValve(ModuleName mod, bool bOn)
  167. {
  168. switch (mod)
  169. {
  170. case ModuleName.TM:
  171. _TMFastPumpValve.TurnValve(bOn, out string _);
  172. break;
  173. case ModuleName.VCE1:
  174. _VCEFastPumpValve.TurnValve(bOn, out string _);
  175. break;
  176. }
  177. }
  178. public void TurnSoftPumpValve(ModuleName mod, bool bOn)
  179. {
  180. switch (mod)
  181. {
  182. case ModuleName.TM:
  183. _TMSoftPumpValve.TurnValve(bOn, out string _);
  184. break;
  185. case ModuleName.VCE1:
  186. _VCESoftPumpValve.TurnValve(bOn, out string _);
  187. break;
  188. }
  189. }
  190. public void TurnFastVentValve(ModuleName mod, bool bOn)
  191. {
  192. switch (mod)
  193. {
  194. case ModuleName.TM:
  195. _TMFastVentValve.TurnValve(bOn, out string _);
  196. break;
  197. case ModuleName.VCE1:
  198. _VCEFastVentValve.TurnValve(bOn, out string _);
  199. break;
  200. }
  201. }
  202. public void TurnSoftVentValve(ModuleName mod, bool bOn)
  203. {
  204. switch (mod)
  205. {
  206. case ModuleName.TM:
  207. _TMSoftVentValve.TurnValve(bOn, out string _);
  208. break;
  209. case ModuleName.VCE1:
  210. _VCESoftVentValve.TurnValve(bOn, out string _);
  211. break;
  212. }
  213. }
  214. public bool CloseAllSlitDoor()
  215. {
  216. _VCESlitDoor.SetCylinder(false,out _);
  217. if (_allInstalledModules.Contains("PMA"))
  218. _PMASlitDoor.SetCylinder(false,out _);
  219. if(_allInstalledModules.Contains("PMB"))
  220. _PMBSlitDoor.SetCylinder(false,out _);
  221. if (_allInstalledModules.Contains("PMC"))
  222. _PMCSlitDoor.SetCylinder(false,out _);
  223. return true;
  224. }
  225. public void HomeVceSlitDoor()
  226. {
  227. //由SlitDoor的状态对其下发同样的指令
  228. if (VCESlitDoorClosed == true)
  229. _VCESlitDoor.SetCylinder(false, out _);
  230. else
  231. _VCESlitDoor.SetCylinder(true, out _);
  232. }
  233. #endregion
  234. }
  235. }