DeviceManager.cs 4.7 KB

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