123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- using FEIApiControl;
- using OTSCLRINTERFACE;
- using OTSModelSharp.ServiceCenter;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OTSMeasureApp.ServiceCenter.PicoSmart
- {
- //class PicoSmartEDSController : EDSController
- //{
- //public PicoSmartEDSController(string deviceType, int expectcount, bool ifautoid, string knownelements) : base(deviceType, expectcount, ifautoid, knownelements)
- //{
- //}
- class PicoSmartEDSController : IEDSController
- {
- public PicoSmartApi_cshape m_api = null;
- private static string EdsDeviceType = "Bruker";
- private IEDSController m_eds=null;
- private int imgwidth=640 ;
- private int imgheight = 480;
- public static void set_EdsDeviceType(string DeviceType)
- {
- EdsDeviceType=DeviceType;
- }
- private int AnalyExpCount = 100000;
- private string strResolution = "";
-
- public PicoSmartEDSController(string SemType,string deviceType, int imgwidth, int imgheight, int expectcount, bool ifautoid, string knownelements)
- {
- EdsDeviceType= deviceType;
- m_api = PicoSmartSemController.GetApiClassInstance();
- AnalyExpCount = expectcount;
- Connect();
- //get eds
- switch (deviceType)
- {
- case "Oxford":
- m_eds = new OxfordEDSController(expectcount, ifautoid, knownelements);
- break;
- case "Bruker":
- {
- var ctrl = new EDSController("Bruker", expectcount, ifautoid, knownelements);
- //var delayQuant = Convert.ToBoolean(FileHelper.GetIfDelayQuantify());
- var delayQuant = false;//Now it has proved that this method won't increase the speed of xray analysis.So deactivate it here.
- ctrl.delayQuant = delayQuant;
- m_eds = ctrl;
- }
- break;
- default:
- m_eds = new EDSController("OffLine", expectcount, ifautoid, knownelements);
- break;
- }
- this.imgwidth = imgwidth;
- this.imgheight = imgheight;
- //加载能谱
- }
- public bool CollectSpectrum(uint a_nXRayAQTime, ref uint[] a_XrayData)
- {
- return m_eds.CollectSpectrum(a_nXRayAQTime, ref a_XrayData);
- }
- public bool Connect()
- {
- string FEIIP = FileHelper.GetXMLInformations("FEIIP");
- string FEIPORT = FileHelper.GetXMLInformations("FEIPORT");
- if (FEIIP == "" || FEIPORT == "")
- {
- NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!");
- return false;
- }
- m_api.set_ip(FEIIP);
- m_api.set_port(int.Parse(FEIPORT));
- if (m_api.isStart() == 1)
- {
- return true;
- }
- else if (m_api.start() == 1)
- {
- return true;
- }
- return false;
- }
- public EDSTYPE GetEDSType()
- {
- return EDSTYPE.COXM;
- }
- public int GetExpectCount()
- {
- return m_eds.GetExpectCount();
- }
- public bool GetIfDelayQuantify()
- {
- return m_eds.GetIfDelayQuantify();
- }
- public bool GetXRayByFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)
- {
- return m_eds.GetXRayByFeatures(a_listParticles, a_nXRayAQTime, a_bElementInfo);
- }
- public bool GetXRayByParts(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo)
- {
- return m_eds.GetXRayByParts(a_listParticles, a_nXRayAQTime, a_bElementInfo);
- }
- public bool QuantifyXrayByPart(COTSParticleClr part)
- {
- return m_eds.QuantifyXrayByPart(part);
- }
- public void SetFilterKeyEleNames(List<string> KeyNameList)
- {
- m_eds.SetFilterKeyEleNames(KeyNameList);
- }
- public void SetResolution(int resolutionWidth, int resolutionHeight)
- {
- imgwidth = resolutionWidth;
- imgheight = resolutionHeight;
- m_eds.SetResolution(resolutionWidth, resolutionHeight);
- }
- bool IEDSController.GetXRayByExpandFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)
- {
- return m_eds.GetXRayByExpandFeatures(a_listParticles, a_nXRayAQTime, a_bElementInfo);
- }
- void IEDSController.SetQuantifiCationParam(bool IfAutoId, string knownElements)
- {
- m_eds.SetQuantifiCationParam(IfAutoId, knownElements);
- }
- }
- }
|