DeviceManager.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using Aitex.Core.Common;
  5. using Aitex.Core.RT.Device;
  6. using Aitex.Core.RT.OperationCenter;
  7. using Aitex.Core.RT.SCCore;
  8. using MECF.Framework.Common.Equipment;
  9. using Venus_RT.Modules;
  10. using Venus_RT.Devices;
  11. using Venus_RT.Devices.EPD;
  12. namespace Venus_RT.Instances
  13. {
  14. public class DeviceEntity : DeviceEntityT<DeviceManager>
  15. {
  16. public DeviceEntity()
  17. {
  18. }
  19. }
  20. public class DeviceManager : DeviceManagerBase
  21. {
  22. private readonly string device_model_file;
  23. public DeviceManager()
  24. {
  25. device_model_file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", RtInstance.DeviceModelFileName);
  26. }
  27. public override bool Initialize()
  28. {
  29. if (SC.GetValue<bool>("System.PMAIsInstalled"))
  30. InitPM(ModuleName.PMA);
  31. if (SC.GetValue<bool>("System.PMBIsInstalled"))
  32. InitPM(ModuleName.PMB);
  33. AddCustomModuleDevice(new VenusSignalTower("System", "SignalTower"));
  34. OP.Subscribe("DeviceOperation", this.Invoke);
  35. return true;
  36. }
  37. private void InitPM(ModuleName mod)
  38. {
  39. Initialize(device_model_file, RtInstance.SystemName, mod, mod.ToString());
  40. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  41. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  42. {
  43. AddCustomModuleDevice(new AdTecGenerator(mod));
  44. }
  45. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
  46. SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  47. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  48. {
  49. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  50. }
  51. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  52. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  53. {
  54. if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  55. {
  56. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  57. }
  58. else if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  59. {
  60. AddCustomModuleDevice(new AIRSYSChiller(mod, "Chiller"));
  61. }
  62. }
  63. if (SC.GetValue<bool>($"{mod}.match.EnableMatch") &&
  64. SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232 &&
  65. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.AdTec)
  66. {
  67. AddCustomModuleDevice(new AdTecMatch(mod));
  68. }
  69. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  70. {
  71. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  72. {
  73. AddCustomModuleDevice(new SkyPump(mod));
  74. }
  75. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  76. {
  77. AddCustomModuleDevice(new EdwardsPump(mod));
  78. }
  79. }
  80. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  81. AddCustomModuleDevice(new AdixenTurboPump(mod));
  82. AddCustomModuleDevice(new PendulumValve(mod));
  83. AddCustomModuleDevice(new EPDClient(mod));
  84. AddCustomDevice(new JetPM(mod));
  85. }
  86. private WaferSize MapWaferSize(int value)
  87. {
  88. switch (value)
  89. {
  90. case 3: return WaferSize.WS3;
  91. case 4: return WaferSize.WS4;
  92. case 6: return WaferSize.WS6;
  93. case 8: return WaferSize.WS8;
  94. }
  95. return WaferSize.WS0;
  96. }
  97. private bool Invoke(string arg1, object[] args)
  98. {
  99. string name = (string)args[0];
  100. string func = (string)args[1];
  101. object[] param = new object[args.Length - 2];
  102. for (int i = 2; i < args.Length; i++)
  103. param[i - 2] = args[i].ToString();
  104. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  105. return true;
  106. }
  107. }
  108. }