DeviceManager.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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, Venus_Core.VenusDevice.Rf));
  44. }
  45. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  46. {
  47. if(SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  48. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  49. {
  50. AddCustomModuleDevice(new CometRF(mod, SC.GetStringValue($"{mod}.BiasRf.IPAddress")));
  51. }
  52. else if(SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  53. {
  54. AddCustomModuleDevice(new AdTecGenerator(mod, Venus_Core.VenusDevice.BiasRf));
  55. }
  56. }
  57. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  58. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  59. {
  60. if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  61. {
  62. AddCustomModuleDevice(new SMCChiller(mod, "Chiller"));
  63. }
  64. else if(SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  65. {
  66. AddCustomModuleDevice(new AIRSYSChiller(mod, "Chiller"));
  67. }
  68. }
  69. if (SC.GetValue<bool>($"{mod}.match.EnableMatch") &&
  70. SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232 &&
  71. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.AdTec)
  72. {
  73. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.Match));
  74. }
  75. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  76. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  77. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  78. {
  79. AddCustomModuleDevice(new AdTecMatch(mod, Venus_Core.VenusDevice.BiasMatch));
  80. }
  81. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  82. {
  83. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  84. {
  85. AddCustomModuleDevice(new SkyPump(mod));
  86. }
  87. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  88. {
  89. AddCustomModuleDevice(new EdwardsPump(mod));
  90. }
  91. }
  92. AddCustomModuleDevice(new ESC5HighVoltage(mod));
  93. AddCustomModuleDevice(new AdixenTurboPump(mod));
  94. AddCustomModuleDevice(new PendulumValve(mod));
  95. AddCustomModuleDevice(new EPDClient(mod));
  96. AddCustomDevice(new JetPM(mod));
  97. }
  98. private WaferSize MapWaferSize(int value)
  99. {
  100. switch (value)
  101. {
  102. case 3: return WaferSize.WS3;
  103. case 4: return WaferSize.WS4;
  104. case 6: return WaferSize.WS6;
  105. case 8: return WaferSize.WS8;
  106. }
  107. return WaferSize.WS0;
  108. }
  109. private bool Invoke(string arg1, object[] args)
  110. {
  111. string name = (string)args[0];
  112. string func = (string)args[1];
  113. object[] param = new object[args.Length - 2];
  114. for (int i = 2; i < args.Length; i++)
  115. param[i - 2] = args[i].ToString();
  116. DEVICE.Do(string.Format("{0}.{1}", name, func), 0, true, param);
  117. return true;
  118. }
  119. }
  120. }