JetMainframeDeviceManager.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using Aitex.Common.Util;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.SCCore;
  5. using Aitex.Core.Util;
  6. using Aitex.Sorter.Common;
  7. using MECF.Framework.Common.Equipment;
  8. using MECF.Framework.Common.IOCore;
  9. using MECF.Framework.RT.Core.IoProviders;
  10. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF;
  11. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HongHu;
  12. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Rorze;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.SUNWAY;
  14. using static JetMainframe.TMs.TMModule;
  15. namespace JetMainframe
  16. {
  17. public class JetMainframeDeviceManager : Singleton<JetMainframeDeviceManager>
  18. {
  19. private DeviceController _controller;
  20. private DeviceManagerBase _device;
  21. public JetMainframeDeviceManager()
  22. {
  23. _controller = new DeviceController();
  24. _device = new DeviceManagerBase(true);
  25. }
  26. public void Initialize()
  27. {
  28. string ioProviderPathFile = PathManager.GetCfgDir() + "JetMainframe//IoProviderConfig.xml";
  29. IoProviderManager.Instance.Initialize(ioProviderPathFile, "System", "io");
  30. IoManager.Instance.Initialize(PathManager.GetCfgDir() + "JetMainframe//interlockMainFrame.xml");
  31. _device.Initialize(PathManager.GetCfgDir() + "JetMainframe//DeviceModelMainframe.xml", "JetMainframe", ModuleName.System,
  32. "System");
  33. if(SC.GetTMRobotType() == (int)TMRobotType.Rorze751)
  34. {
  35. _device.AddCustomDevice(new RorzeRobot751("TM", "TMRobot", "TM", null, null));
  36. }
  37. else if(SC.GetTMRobotType() == (int)TMRobotType.SUNWAYSPaceTRan)
  38. {
  39. _device.AddCustomDevice(new SPaceTRanRobot("TM", "TMRobot", "TM", null, null));
  40. }
  41. else
  42. {
  43. var ioSensors = new IoSensor[] { DEVICE.GetDevice<IoSensor>($"System.SensorTMRBReady"),
  44. DEVICE.GetDevice<IoSensor>($"System.SensorLowArmHasWafer"),
  45. DEVICE.GetDevice<IoSensor>($"System.SensorUpArmHasWafer") };
  46. _device.AddCustomDevice(new HHADRRobot21("TM", "TMRobot", "TM", ioSensors, null));
  47. }
  48. _device.AddCustomDevice(new FfuAAF("TM", "FFU", "TM"));
  49. _controller.Start(_device);
  50. }
  51. public void Reset()
  52. {
  53. _controller.Reset();
  54. }
  55. public void Terminate()
  56. {
  57. _controller.Terminate();
  58. }
  59. }
  60. }