DeviceManager.cs 5.8 KB

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