DeviceManager.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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 Aitex.RT.Device.Custom;
  9. using MECF.Framework.Common.Equipment;
  10. using SorterRT.Modules;
  11. using VirgoCommon;
  12. using VirgoRT.Devices;
  13. namespace VirgoRT.Instances
  14. {
  15. public class DeviceEntity : DeviceEntityT<DeviceManager>
  16. {
  17. public DeviceEntity()
  18. {
  19. }
  20. }
  21. public class DeviceManager : DeviceManagerBase
  22. {
  23. public WaferSize SmallPinWaferSize { get; set; }
  24. public WaferSize MediumPinWaferSize { get; set; }
  25. public WaferSize BigPinWaferSize { get; set; }
  26. private readonly string device_model_file;
  27. public DeviceManager()
  28. {
  29. device_model_file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\", GetDeviceModelFileName());
  30. }
  31. private string GetDeviceModelFileName()
  32. {
  33. return (SC.ContainsItem("System.ChamberType") && SC.GetValue<int>("System.ChamberType") == (int)JetChamber.VirgoR) ? RtInstance.DeviceModelFileName_R : RtInstance.DeviceModelFileName;
  34. }
  35. public override bool Initialize()
  36. {
  37. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  38. InitPM(ModuleName.PMA);
  39. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  40. InitPM(ModuleName.PMB);
  41. AddCustomModuleDevice(new VirgoSignalTower("System", "SignalTower"));
  42. OP.Subscribe("DeviceOperation", this.Invoke);
  43. return true;
  44. }
  45. private void InitPM(ModuleName mod)
  46. {
  47. Initialize(device_model_file, RtInstance.SystemName, mod, mod.ToString());
  48. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  49. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  50. {
  51. AddCustomModuleDevice(new AdTecGenerator(mod));
  52. }
  53. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
  54. SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  55. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  56. {
  57. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  58. }
  59. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  60. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232 &&
  61. SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  62. {
  63. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  64. }
  65. if (SC.GetValue<bool>($"{mod}.GridChiller.EnableChiller") &&
  66. SC.GetValue<int>($"{mod}.GridChiller.CommunicationType") == (int)CommunicationType.RS232 &&
  67. SC.GetValue<int>($"{mod}.GridChiller.MFG") == (int)ChillerMFG.SMC)
  68. {
  69. AddCustomModuleDevice(new SMCChiller(mod, "GridChiller"));
  70. }
  71. if (SC.GetValue<bool>($"{mod}.match.EnableMatch") &&
  72. SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232 &&
  73. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.AdTec)
  74. {
  75. AddCustomModuleDevice(new AdTecMatch(mod));
  76. }
  77. if (SC.GetValue<bool>($"{mod}.match.EnableMatch") &&
  78. SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.Ethernet &&
  79. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.Revtech)
  80. {
  81. AddCustomModuleDevice(new RevtechMatch(mod, VirgoDevice.Match.ToString(), VirgoDevice.Match.ToString().ToLower()));
  82. }
  83. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
  84. SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.RS232 &&
  85. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  86. {
  87. AddCustomModuleDevice(new AdTecGenerator(mod, VirgoDevice.BiasRf.ToString()));
  88. }
  89. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  90. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.Ethernet &&
  91. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  92. {
  93. AddCustomModuleDevice(new RevtechMatch(mod, VirgoDevice.BiasMatch.ToString(), VirgoDevice.BiasMatch.ToString()));
  94. }
  95. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  96. {
  97. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  98. {
  99. AddCustomModuleDevice(new SkyPump(mod));
  100. }
  101. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  102. {
  103. AddCustomModuleDevice(new EdwardsPump(mod));
  104. }
  105. }
  106. AddCustomDevice(new JetPM(mod));
  107. SmallPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.SmallWafer"));
  108. MediumPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.MidWafer"));
  109. BigPinWaferSize = MapWaferSize(SC.GetValue<int>($"System.BigWafer"));
  110. if (SC.GetValue<bool>($"{mod}.EPD.IsEnabled") && SC.GetValue<bool>("System.SetUp.EPDInstalled"))
  111. {
  112. AddCustomModuleDevice(new EPDDevice(mod.ToString(), "EPD"));
  113. }
  114. }
  115. private WaferSize MapWaferSize(int value)
  116. {
  117. switch (value)
  118. {
  119. case 3: return WaferSize.WS3;
  120. case 4: return WaferSize.WS4;
  121. case 6: return WaferSize.WS6;
  122. case 8: return WaferSize.WS8;
  123. }
  124. return WaferSize.WS0;
  125. }
  126. private bool Invoke(string arg1, object[] args)
  127. {
  128. string name = (string)args[0];
  129. string func = (string)args[1];
  130. object[] param = new object[args.Length - 2];
  131. for (int i = 2; i < args.Length; i++)
  132. param[i - 2] = args[i].ToString();
  133. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  134. return true;
  135. }
  136. }
  137. }