PicoSmartEDSController.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using FEIApiControl;
  2. using OTSCLRINTERFACE;
  3. using OTSModelSharp.ServiceCenter;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace OTSMeasureApp.ServiceCenter.PicoSmart
  10. {
  11. //class PicoSmartEDSController : EDSController
  12. //{
  13. //public PicoSmartEDSController(string deviceType, int expectcount, bool ifautoid, string knownelements) : base(deviceType, expectcount, ifautoid, knownelements)
  14. //{
  15. //}
  16. class PicoSmartEDSController : IEDSController
  17. {
  18. public PicoSmartApi_cshape m_api = null;
  19. private static string EdsDeviceType = "Bruker";
  20. private IEDSController m_eds=null;
  21. private int imgwidth=640 ;
  22. private int imgheight = 480;
  23. public static void set_EdsDeviceType(string DeviceType)
  24. {
  25. EdsDeviceType=DeviceType;
  26. }
  27. private int AnalyExpCount = 100000;
  28. private string strResolution = "";
  29. public PicoSmartEDSController(string deviceType, int imgwidth, int imgheight, int expectcount, bool ifautoid, string knownelements)
  30. {
  31. m_api = PicoSmartSemController.GetApiClassInstance();
  32. AnalyExpCount = expectcount;
  33. Connect();
  34. m_eds = EDSController.GetEDSController(EdsDeviceType, imgwidth, imgheight, expectcount, ifautoid, knownelements);
  35. this.imgwidth = imgwidth;
  36. this.imgheight = imgheight;
  37. //加载能谱
  38. }
  39. public bool CollectSpectrum(uint a_nXRayAQTime, ref uint[] a_XrayData)
  40. {
  41. return m_eds.CollectSpectrum(a_nXRayAQTime, ref a_XrayData);
  42. }
  43. public bool Connect()
  44. {
  45. string FEIIP = FileHelper.GetXMLInformations("FEIIP");
  46. string FEIPORT = FileHelper.GetXMLInformations("FEIPORT");
  47. if (FEIIP == "" || FEIPORT == "")
  48. {
  49. NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!");
  50. return false;
  51. }
  52. m_api.set_ip(FEIIP);
  53. m_api.set_port(int.Parse(FEIPORT));
  54. if (m_api.isStart() == 1)
  55. {
  56. return true;
  57. }
  58. else if (m_api.start() == 1)
  59. {
  60. return true;
  61. }
  62. return false;
  63. }
  64. public EDSTYPE GetEDSType()
  65. {
  66. return EDSTYPE.COXM;
  67. }
  68. public int GetExpectCount()
  69. {
  70. return m_eds.GetExpectCount();
  71. }
  72. public bool GetIfDelayQuantify()
  73. {
  74. return m_eds.GetIfDelayQuantify();
  75. }
  76. public bool GetXRayByFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)
  77. {
  78. return m_eds.GetXRayByFeatures(a_listParticles, a_nXRayAQTime, a_bElementInfo);
  79. }
  80. public bool GetXRayByParts(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo)
  81. {
  82. return m_eds.GetXRayByParts(a_listParticles, a_nXRayAQTime, a_bElementInfo);
  83. }
  84. public bool QuantifyXrayByPart(COTSParticleClr part)
  85. {
  86. return m_eds.QuantifyXrayByPart(part);
  87. }
  88. public void SetFilterKeyEleNames(List<string> KeyNameList)
  89. {
  90. m_eds.SetFilterKeyEleNames(KeyNameList);
  91. }
  92. public void SetResolution(int resolutionWidth, int resolutionHeight)
  93. {
  94. imgwidth = resolutionWidth;
  95. imgheight = resolutionHeight;
  96. m_eds.SetResolution(resolutionWidth, resolutionHeight);
  97. }
  98. bool IEDSController.GetXRayByExpandFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)
  99. {
  100. return m_eds.GetXRayByExpandFeatures(a_listParticles, a_nXRayAQTime, a_bElementInfo);
  101. }
  102. void IEDSController.SetQuantifiCationParam(bool IfAutoId, string knownElements)
  103. {
  104. m_eds.SetQuantifiCationParam(IfAutoId, knownElements);
  105. }
  106. }
  107. }