DeviceManager.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. private readonly string device_model_file_MF;
  24. public DeviceManager()
  25. {
  26. device_model_file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", RtInstance.DeviceModelFileName);
  27. device_model_file_MF = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", RtInstance.DeviceModelFileName_MF);
  28. }
  29. public override bool Initialize()
  30. {
  31. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  32. InitPM(ModuleName.PMA);
  33. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  34. InitPM(ModuleName.PMB);
  35. if (ModuleHelper.IsInstalled(ModuleName.TM))
  36. InitTM(ModuleName.TM);
  37. AddCustomModuleDevice(new VenusSignalTower("System", "SignalTower"));
  38. OP.Subscribe("DeviceOperation", this.Invoke);
  39. return true;
  40. }
  41. private void InitPM(ModuleName mod)
  42. {
  43. Initialize(device_model_file, RtInstance.SystemName, mod, mod.ToString());
  44. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  45. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  46. {
  47. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.Rf));
  48. }
  49. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  50. {
  51. if(SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  52. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  53. {
  54. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  55. }
  56. else if(SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  57. {
  58. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.BiasRf));
  59. }
  60. }
  61. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  62. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  63. {
  64. if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  65. {
  66. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  67. }
  68. else if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  69. {
  70. AddCustomModuleDevice(new AIRSYSChiller(mod, "Chiller"));
  71. }
  72. }
  73. if (SC.GetValue<bool>($"{mod}.Match.EnableMatch") &&
  74. SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&
  75. SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.AdTec)
  76. {
  77. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.Match));
  78. }
  79. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  80. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  81. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  82. {
  83. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  84. }
  85. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  86. {
  87. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  88. {
  89. AddCustomModuleDevice(new SkyPump(mod));
  90. }
  91. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  92. {
  93. AddCustomModuleDevice(new EdwardsPump(mod));
  94. }
  95. }
  96. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  97. AddCustomModuleDevice(new AdixenTurboPump(mod));
  98. AddCustomModuleDevice(new PendulumValve(mod));
  99. AddCustomModuleDevice(new EPDClient(mod));
  100. AddCustomDevice(new JetPM(mod));
  101. }
  102. private void InitTM(ModuleName mod)
  103. {
  104. Initialize(device_model_file_MF, RtInstance.SystemName, mod, mod.ToString());
  105. AddCustomDevice(new JetTM());
  106. }
  107. private WaferSize MapWaferSize(int value)
  108. {
  109. switch (value)
  110. {
  111. case 3: return WaferSize.WS3;
  112. case 4: return WaferSize.WS4;
  113. case 6: return WaferSize.WS6;
  114. case 8: return WaferSize.WS8;
  115. }
  116. return WaferSize.WS0;
  117. }
  118. private bool Invoke(string arg1, object[] args)
  119. {
  120. string name = (string)args[0];
  121. string func = (string)args[1];
  122. object[] param = new object[args.Length - 2];
  123. for (int i = 2; i < args.Length; i++)
  124. param[i - 2] = args[i].ToString();
  125. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  126. return true;
  127. }
  128. }
  129. }