Parcourir la source

optimize the batch collecting logic of xray .

gsp il y a 4 mois
Parent
commit
c7b39df0c7

+ 238 - 133
OTSCPP/OTSControl/Bruker/OTSBrukerImpl.cpp

@@ -1313,6 +1313,106 @@ BOOL COTSBrukerImpl::StopSpectrumMeasure(void)
 	return TRUE;
 }
 
+BOOL COTSBrukerImpl::GetXRayByFeaturesOnHardwareLimit(CPosXrayList& a_vXPoints, std::vector<BrukerFeature> a_vFeatures, SHORT a_nACTimeMS)
+{
+	if (a_vXPoints.size() > XrayQuantityLimitPerTime)
+	{
+		LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints:Too many features on a single collection!"));
+		return false;
+	}
+	// do nothing if points list is empty
+	if (a_vXPoints.empty())
+	{
+		// points list is empty
+		LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures: poits list is empty."));
+		return TRUE;
+	}
+
+	// lists size check
+	if (a_vXPoints.size() != a_vFeatures.size())
+	{
+		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures:Feature size(%d) doesn't match xray point size(%d)"), a_vFeatures.size(), a_vXPoints.size());
+		return FALSE;
+	}
+
+
+
+	// create array of BrukerSegment
+	long nCollectCount = (long)a_vXPoints.size();
+	long nTotalPixelCount = 0;
+
+	SHORT* pixelTimes = new SHORT[nCollectCount];
+	BrukerDll::PFeatureDataList features = new BrukerDll::TFeatureData[nCollectCount];
+
+
+	for (size_t i = 0; i < nCollectCount; i++)
+	{
+		BrukerFeature ofeature = a_vFeatures[i];
+
+		if (ofeature.SegmentCount > 0)
+		{
+			features[i].SegmentCount = ofeature.SegmentCount;
+			int segCount = features[i].SegmentCount;
+			//auto ofeature = a_vFeatures[i];
+			features[i].Segments = new BrukerDll::TSegment[segCount];
+			for (int j = 0; j < segCount; j++)
+			{
+				features[i].Segments[j].XStart = ofeature.pSegment[j].XStart;
+				features[i].Segments[j].XCount = ofeature.pSegment[j].XCount;
+				features[i].Segments[j].Y = ofeature.pSegment[j].Y;
+			}
+
+			// calculate pixel time
+			int nPixelCount = 0;
+
+
+			for (int j = 0; j < ofeature.SegmentCount; j++)
+			{
+				nPixelCount += ofeature.pSegment[j].XCount;
+			}
+			SHORT pt = (SHORT)(ceil((double)a_nACTimeMS * 1000.0 / (double)nPixelCount));
+			pixelTimes[i] = pt;
+
+			nTotalPixelCount += nPixelCount;
+		}
+		else
+		{
+			// will generate according to the x-ray position
+			// this shouldn't happen
+
+
+			BrukerDll::TSegment* extraSegments = new BrukerDll::TSegment[1];
+
+			extraSegments[0].XStart = a_vXPoints[i]->GetPosition().x;
+			extraSegments[0].Y = a_vXPoints[i]->GetPosition().y;
+			extraSegments[0].XCount = 1;
+			features[i].SegmentCount = 1;
+			features[i].Segments = extraSegments;
+			pixelTimes[i] = (SHORT)(a_nACTimeMS * 1000);
+
+		}
+	}
+
+	// ask bruker to collect a set of x-ray data
+	if (BrukerDll::StartFeatureListMeasurement(m_nClientID, m_nSPU, nCollectCount, features, pixelTimes) != 0)
+	{
+		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::StartFeatureListMeasurement:Call StartFeatureListMeasurement failed: client id is %d"), m_nClientID);
+		return FALSE;
+	}
+
+
+	// get the specs for a_vXPoints
+	if (!SetXRayPointsByFeature(a_vXPoints, a_nACTimeMS))
+	{
+		// failed to call ReadXRayPointsByFeature method
+		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures: failed to call ReadXRayPointsByFeature method."));
+		return FALSE;
+	}
+	delete[] pixelTimes;
+	delete[] features;
+	return TRUE;
+}
+
 BOOL COTSBrukerImpl::ReadSpectrum(long* a_pXRayData, DWORD a_nBufferSize)
 {
 	// read spectrum
@@ -1449,6 +1549,87 @@ void COTSBrukerImpl::SetQuantificationParam(BOOL ifAuto, CString knownElements)
 	m_ifAutoId = ifAuto;
 	m_knownElements = knownElements;
 }
+BOOL COTSBrukerImpl::GetXRayByPointsOnHardwareLimit(CPosXrayList& a_listXrayPois, DWORD a_nACTimeMS)
+{
+	if (a_listXrayPois.size() > XrayQuantityLimitPerTime)
+	{
+		LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints:Too many points on a single collection!"));
+		return false;
+	}
+	try
+	{
+
+		// do nothing if points list is empty
+		if (a_listXrayPois.empty())
+		{
+			// points list is empty
+			LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: poits list is empty."));
+			return TRUE;
+		}
+
+
+
+		// create array of BrukerSegment
+		long nCollectCount = (long)a_listXrayPois.size();
+
+		boost::scoped_array<BrukerDll::TSegment> segmentArray(new BrukerDll::TSegment[nCollectCount]);
+
+		for (int i = 0; i < nCollectCount; ++i)
+		{
+			CPoint poi = a_listXrayPois[i]->GetPosition();
+			segmentArray[i].Y = poi.y;
+			segmentArray[i].XStart = poi.x;
+			segmentArray[i].XCount = 1;
+		}
+
+
+		if (BrukerDll::StartPointListMeasurement(m_nClientID, m_nSPU, nCollectCount, segmentArray.get(), a_nACTimeMS) != 0)
+		{
+			LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::StartPointListMeasurement£ºCall StartPointListMeasurement failed: client id is %d(%d, %d, %d)"), m_nClientID, m_nSPU, nCollectCount, a_nACTimeMS);
+			return FALSE;
+		}
+
+		// get the specs for a_vXPoints
+		static DWORD nChannelData[(int)BRUKER_PARAM::RT_SPECTRUM_CHANNELS];
+		for (int i = 0; i < nCollectCount; ++i)
+		{
+			// cleanup data storage
+			memset(nChannelData, 0, sizeof(DWORD) * (int)BRUKER_PARAM::RT_SPECTRUM_CHANNELS);
+
+			// get spectrum data of a point
+			bool success = GetPointListSpectrum(i, (long*)nChannelData);
+			if (!success)
+			{
+				// error
+				CPoint poi = a_listXrayPois[i]->GetPosition();
+				LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::SetXRayPoints:Call GetPointListSpectrum failed : index = %d(x : %d, y : %d)"),
+					i,
+					poi.x,
+					poi.y);
+
+				return FALSE;
+			}
+
+			// set spectrum data for the x-ray point
+			a_listXrayPois[i]->SetXrayData(nChannelData);
+		}
+		if (m_bDoQuantification)
+		{
+			QuantifyPosXrayPointsOnLine(a_listXrayPois);
+		}
+
+		return TRUE;
+
+	}
+	catch (const std::exception&)
+	{
+		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: exception."));
+	}
+
+
+	// error, return false
+	return FALSE;
+}
 BOOL COTSBrukerImpl::QuantifySpectrumFile(LPCTSTR a_sFilePathName, CString a_strMethodName, CElementChemistriesList& a_vElementChemistry)
 {
 
@@ -2170,79 +2351,51 @@ CString COTSBrukerImpl::GetQuantificationSpectrumPathName()
 
 BOOL COTSBrukerImpl::GetXRayByPoints(CPosXrayList& a_listXrayPois, DWORD a_nACTimeMS)
 {
-	try
-	{
+	int nSize = a_listXrayPois.size();
+	CPosXrayList singleGroup;
 
-		// do nothing if points list is empty
-		if (a_listXrayPois.empty())
-		{
-			// points list is empty
-			LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: poits list is empty."));
-			return TRUE;
-		}
 
+		int nTimes = nSize / XrayQuantityLimitPerTime;
+		for (int i = 0; i < nTimes; i++)
+		{
+			singleGroup.clear();
 		
+			for (int m = 0; m < XrayQuantityLimitPerTime; m++)
+			{
+				singleGroup.push_back(a_listXrayPois[i * XrayQuantityLimitPerTime + m]);
+				
+			}
 
-		// create array of BrukerSegment
-		long nCollectCount = (long)a_listXrayPois.size();
-
-		boost::scoped_array<BrukerDll::TSegment> segmentArray(new BrukerDll::TSegment[nCollectCount]);
-
-		for (int i = 0; i < nCollectCount; ++i)
-		{
-			CPoint poi = a_listXrayPois[i]->GetPosition();
-			segmentArray[i].Y = poi.y;
-			segmentArray[i].XStart = poi.x;
-			segmentArray[i].XCount = 1;
-		}
+			if (!GetXRayByPointsOnHardwareLimit(singleGroup, a_nACTimeMS))
+			{
+				
+				return false;
+			}
 
 
-		if (BrukerDll::StartPointListMeasurement(m_nClientID, m_nSPU, nCollectCount, segmentArray.get(), a_nACTimeMS) != 0)
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::StartPointListMeasurement£ºCall StartPointListMeasurement failed: client id is %d(%d, %d, %d)"), m_nClientID, m_nSPU, nCollectCount, a_nACTimeMS);
-			return FALSE;
 		}
 
-		// get the specs for a_vXPoints
-		static DWORD nChannelData[(int)BRUKER_PARAM::RT_SPECTRUM_CHANNELS];
-		for (int i = 0; i < nCollectCount; ++i)
+		int nLast = nSize % XrayQuantityLimitPerTime;
+		if (nLast != 0)
 		{
-			// cleanup data storage
-			memset(nChannelData, 0, sizeof(DWORD) * (int)BRUKER_PARAM::RT_SPECTRUM_CHANNELS);
 
-			// get spectrum data of a point
-			bool success = GetPointListSpectrum(i, (long*)nChannelData);
-			if (!success)
+			singleGroup.clear();
+			for (int m = 0; m < nLast; m++)
 			{
-				// error
-				CPoint poi = a_listXrayPois[i]->GetPosition();
-				LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::SetXRayPoints:Call GetPointListSpectrum failed : index = %d(x : %d, y : %d)"),
-					i,
-					poi.x,
-					poi.y);
+				singleGroup.push_back(a_listXrayPois[ m]);
+			}
 
-				return FALSE;
+			if (!GetXRayByPointsOnHardwareLimit(singleGroup, a_nACTimeMS))
+			{
+				return false;
 			}
 
-			// set spectrum data for the x-ray point
-			a_listXrayPois[i]->SetXrayData(nChannelData);
-		}
-		if (m_bDoQuantification)
-		{
-			QuantifyPosXrayPointsOnLine(a_listXrayPois);
+
 		}
-		
-		return TRUE;
 
-	}
-	catch (const std::exception&)
-	{
-		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: exception."));
-	}
-	
 
-	// error, return false
-	return FALSE;
+	
+	
 }
 
 BOOL COTSBrukerImpl::QuantifyPosXrayPointsOnLine(CPosXrayList& a_listXrayPois)
@@ -2307,98 +2460,50 @@ BOOL COTSBrukerImpl::QuantifyPosXrayPointsOnLine(CPosXrayList& a_listXrayPois)
 
 BOOL COTSBrukerImpl::GetXRayByFeatures(CPosXrayList& a_vXPoints, std::vector<BrukerFeature> a_vFeatures, SHORT a_nACTimeMS)
 {
+	int nSize = a_vXPoints.size();
+	CPosXrayList singleGroup;
+	std::vector<BrukerFeature> singleGroupFeature;
 
-	// do nothing if points list is empty
-	if (a_vXPoints.empty())
+	int nTimes = nSize / XrayQuantityLimitPerTime;
+	for (int i = 0; i < nTimes; i++)
 	{
-		// points list is empty
-		LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures: poits list is empty."));
-		return TRUE;
-	}
-
-	// lists size check
-	if (a_vXPoints.size() != a_vFeatures.size())
-	{
-		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures:Feature size(%d) doesn't match xray point size(%d)"), a_vFeatures.size(), a_vXPoints.size());
-		return FALSE;
-	}
+		singleGroup.clear();
+		singleGroupFeature.clear();
+		for (int m = 0; m < XrayQuantityLimitPerTime; m++)
+		{
+			singleGroup.push_back(a_vXPoints[i * XrayQuantityLimitPerTime + m]);
+			singleGroupFeature.push_back(a_vFeatures[i * XrayQuantityLimitPerTime + m]);
+		}
 
+		if (!GetXRayByFeaturesOnHardwareLimit(singleGroup, singleGroupFeature, a_nACTimeMS))
+		{
 
+			return false;
+		}
 
-	// create array of BrukerSegment
-	long nCollectCount = (long)a_vXPoints.size();
-	long nTotalPixelCount = 0;
 
-	SHORT* pixelTimes=new SHORT[nCollectCount];
-	BrukerDll::PFeatureDataList features = new BrukerDll::TFeatureData[nCollectCount];
-	
+	}
 
-	for (size_t i = 0; i < nCollectCount; i++)
+	int nLast = nSize % XrayQuantityLimitPerTime;
+	if (nLast != 0)
 	{
-		BrukerFeature ofeature = a_vFeatures[i];
-		
-		if (ofeature.SegmentCount > 0)
-		{
-			features[i].SegmentCount = ofeature.SegmentCount;
-			int segCount = features[i].SegmentCount;
-			//auto ofeature = a_vFeatures[i];
-			features[i].Segments = new BrukerDll::TSegment[segCount];
-			for (int j = 0; j < segCount; j++)
-			{
-				features[i].Segments[j].XStart = ofeature.pSegment[j].XStart;
-				features[i].Segments[j].XCount = ofeature.pSegment[j].XCount;
-				features[i].Segments[j].Y = ofeature.pSegment[j].Y;
-			}
 
-			// calculate pixel time
-			int nPixelCount = 0;
-	
-
-			for (int j = 0; j < ofeature.SegmentCount; j++)
-			{
-				nPixelCount += ofeature.pSegment[j].XCount;
-			}
-			SHORT pt= (SHORT)(ceil((double)a_nACTimeMS * 1000.0 / (double)nPixelCount));
-			pixelTimes[i] = pt;
-
-			nTotalPixelCount += nPixelCount;
+		singleGroup.clear();
+		singleGroupFeature.clear();
+		for (int m = 0; m < nLast; m++)
+		{
+			singleGroup.push_back(a_vXPoints[m]);
+			singleGroupFeature.push_back(a_vFeatures[ m]);
 		}
-		else
+
+		if (!GetXRayByFeaturesOnHardwareLimit(singleGroup, singleGroupFeature, a_nACTimeMS))
 		{
-			// will generate according to the x-ray position
-			// this shouldn't happen
-			
-		
-			BrukerDll::TSegment* extraSegments=new BrukerDll::TSegment[1];
-			
-			extraSegments[0].XStart = a_vXPoints[i]->GetPosition().x;
-			extraSegments[0].Y = a_vXPoints[i]->GetPosition().y;
-			extraSegments[0].XCount = 1;
-			features[i].SegmentCount = 1;
-			features[i].Segments = extraSegments;
-			pixelTimes[i] = (SHORT)(a_nACTimeMS * 1000);
-			
+			return false;
 		}
-	}
 
-	// ask bruker to collect a set of x-ray data
-	if (BrukerDll::StartFeatureListMeasurement(m_nClientID, m_nSPU, nCollectCount, features, pixelTimes) != 0)
-	{
-		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::StartFeatureListMeasurement:Call StartFeatureListMeasurement failed: client id is %d"), m_nClientID);
-		return FALSE;
-	}
-	
 
-	// get the specs for a_vXPoints
-	if (!SetXRayPointsByFeature(a_vXPoints, a_nACTimeMS))
-	{
-		// failed to call ReadXRayPointsByFeature method
-		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::CollectXRayPointsByFeatures: failed to call ReadXRayPointsByFeature method."));
-		return FALSE;
 	}
-	delete[] pixelTimes;
-	delete[] features;
-	return TRUE;
+	
 }
 
 BOOL COTSBrukerImpl::SetXRayPointsByFeature(CPosXrayList& a_vXPoints, const DWORD a_nACTimeMS)

+ 3 - 0
OTSCPP/OTSControl/Bruker/OTSBrukerImpl.h

@@ -146,7 +146,9 @@ namespace OTSController {
 		void SetQuantificationParam(BOOL ifAuto, CString knownElements);
 
 	private:
+		BOOL GetXRayByPointsOnHardwareLimit(CPosXrayList& a_listXrayPois, DWORD a_nACTimeMS);
 
+		BOOL GetXRayByFeaturesOnHardwareLimit(CPosXrayList& a_vXPoints, std::vector<BrukerFeature> a_vFeatures, SHORT a_nACTimeMS);
 		BOOL ReadSpectrum(long* a_pnCounts, DWORD a_nBufferSize);
 
 
@@ -238,6 +240,7 @@ namespace OTSController {
 		int m_expectCount;
 		BOOL m_ifAutoId=TRUE;
 		CString m_knownElements;
+		const int XrayQuantityLimitPerTime = 256;
 
 	};
 

+ 1 - 1
OTSCPP/OTSControl/Bruker/OTSEDSBrucker.cpp

@@ -225,7 +225,7 @@ namespace OTSController {
 
 		std::vector<CPosXrayPtr> listXRayPointsTemp;
 	
-			if (!m_pBrukerImpl->GetXRayByPoints(a_vXRayPoints, a_nXRayAQTime))// one point per time,or we cann't get the full element data. gsp 2020-11-30
+			if (!m_pBrukerImpl->GetXRayByPoints(a_vXRayPoints, a_nXRayAQTime))
 			{
 				LogErrorTrace(__FILE__, __LINE__, _T("GetXRayByPoints: failed to get element."));
 			}

+ 7 - 2
OTSIncAMeasureApp/CRegistration.cs

@@ -20,9 +20,14 @@ namespace OTSMeasureApp
                 //return false;
                 try
                 {
-
+                    uint[] code;
+                    code = new uint[1];
+                    code[0] = 101;
+                    code[1] = 102;
                     //狗加密法
-                    SenseShield.DogDecrypting.decrypting(101);//参数为许可号
+                    SenseShield.DogDecrypting.decrypting(code);//参数为许可号
+
+                   
                 }
                 catch (Exception ex)
                 {

+ 13 - 62
OTSIncAMeasureApp/ServiceCenter/CPP(Bruker)API/EDSController.cs

@@ -198,73 +198,24 @@ namespace OTSModelSharp.ServiceCenter
                     }
                 }
             }
-           
+
             int nSize = a_listParticles.Count;
-            if (nSize > 1024)
+           
+            Point[] allpoints = new Point[nSize];
+            COTSParticleClr[] partsTemp = new COTSParticleClr[nSize];
+            for (int m = 0; m < nSize; m++)
             {
-               
-                COTSParticleClr[] partsTemp = new COTSParticleClr[1024];
-                Point[] PsTemp = new Point[1024];
-
-                int nTimes = nSize / 1024;
-                for (int i = 0; i < nTimes; i++)
-                {
-                    NLog.LogManager.GetCurrentClassLogger().Warn("begin 1024 batch");
-                    for (int m = 0; m < 1024; m++)
-                    {
-                        partsTemp[m]=a_listParticles[i * 1024 + m];
-                        PsTemp[m] = Ps[i * 1024 + m];
-                    }
-
-                    if (!eds.GetXRayByPoints(a_nXRayAQTime, PsTemp, partsTemp, a_bElementInfo))
-                    {
-                        NLog.LogManager.GetCurrentClassLogger().Error("GetXRayByPoints: failed to get element.");
-                        return false;
-                    }
-                   
-
-                }
-
-                int nLast = nSize % 1024;
-                if (nLast != 0)
-                {
-                   
-                    COTSParticleClr[] lastParts = new COTSParticleClr[nLast];
-                    Point[] lastPs = new Point[nLast];
-                   
-                    for (int m = 0; m < nLast; m++)
-                    {
-                        
-                        lastParts[m] = a_listParticles[nTimes * 1024 + m];
-                        lastPs[m] = Ps[nTimes * 1024 + m];
-                    }
-                    
-                    if (!eds.GetXRayByPoints(a_nXRayAQTime, lastPs, lastParts, a_bElementInfo))
-                    {
-                        NLog.LogManager.GetCurrentClassLogger().Error("GetXRayByPoints: failed to get element.");
-                        return false;
-                    }                 
-
-                   
-
-                }
-
-
+                partsTemp[m] = a_listParticles[m];
+                allpoints[m] = Ps[m];
             }
-            else 
+            if (!eds.GetXRayByPoints(a_nXRayAQTime, allpoints, partsTemp, a_bElementInfo))
             {
-                COTSParticleClr[] parts = a_listParticles.ToArray();
-
-                if (delayQuant)
-                {
-                    a_bElementInfo = false;
-                }
-
-                result = eds.GetXRayByPoints(a_nXRayAQTime, Ps, parts, a_bElementInfo);
-
-
-
+                NLog.LogManager.GetCurrentClassLogger().Error("GetXRayByPoints: failed to get element.");
+                return false;
             }
+                   
+
+         
 
             if (result == true)
             {

+ 1 - 0
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -2450,6 +2450,7 @@ namespace OTSIncAReportGraph.Controls
 
                             }
                         }
+                       
                         var pfirst = parts[0];
                         float top = pfirst.OTSRect.GetTopLeft().Y;
                         float bottom = pfirst.OTSRect.GetBottomRight().Y;

+ 233 - 142
OxfordExtenderWrapper/ExtenderWrapper.cs

@@ -96,23 +96,23 @@ namespace OxfordExtenderWrapper
     };
     enum OxfordCommandType
     {
-        
+
         GetMagnification = 0,
         SetMagnification = 1,
 
-       
+
         GetWorkingDistance = 2,
         SetWorkingDistance = 3,
 
-     
+
         GetBrightness = 4,
         SetBrightness = 5,
 
-      
+
         GetContrast = 6,
         SetContrast = 7,
 
-    
+
         GetSEMVoltage = 8,
         SetSEMVoltage = 9,
 
@@ -139,14 +139,14 @@ namespace OxfordExtenderWrapper
         //获取分辨率
         GetImageResolution = 25,
         //设置分辨率
-        SetImageResolution= 26,
+        SetImageResolution = 26,
         //获取bitmap
         GetBitmap = 27,
 
         //X-ray
         //点采集
         XrayPointCollection = 29,
-        COLLECT_XRAYPOINTS=30,
+        COLLECT_XRAYPOINTS = 30,
         //面采集
         XrayAreaCollection = 31,
         COLLECT_XRAYFEATURES = 32,
@@ -160,8 +160,8 @@ namespace OxfordExtenderWrapper
     {
         public enum ImageRegionType
         {
-          FullField=0,
-          Rectangle=1
+            FullField = 0,
+            Rectangle = 1
 
         }
         public ImageAquistionParam()
@@ -208,7 +208,7 @@ namespace OxfordExtenderWrapper
             this.listElement = new Dictionary<string, double>();
         }
         public double dMilliSecondsTime;
-        public List<Segment> a_listChord=new List<Segment>();
+        public List<Segment> a_listChord = new List<Segment>();
         public uint[] XrayData;
         public Dictionary<string, double> listElement;
         public bool b_quant;
@@ -234,14 +234,14 @@ namespace OxfordExtenderWrapper
         public List<AreaXrayParam> XrayPrmForFeatures;
         public int AreaXrayDataReceived;
     }
-    public class ExtenderWrapper:MarshalByRefObject
+    public class ExtenderWrapper : MarshalByRefObject
     {
 
         NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
 
         private oxfordCommandData currentCommand;
 
-       
+
         //控制电镜
         private IMicroscopeController microscopeController = null;
         /// <summary>
@@ -262,18 +262,18 @@ namespace OxfordExtenderWrapper
         private ISEMQuantSettings quantSettings = null;
 
         //private IEdChordListAcquisitionController _edsChordListController = null;
-   
+
         private IEdChordListSettings _edsChordListSetting;
         private int XRayChannelLength = 2000;
 
         private int EDSColletionTimeOut = 10000;
-  
-   
+
+
 
         const int g_nOxfordControllerProcessTime = 4;
         const int g_nOxfordControllerEnergyRange = 20;
 
-
+        const int XrayQuantityLimitPerTime = 256;
 
         private bool m_bXrayDone = false;
         //电压
@@ -298,8 +298,8 @@ namespace OxfordExtenderWrapper
         private double m_dStageR;
         private double m_dStageT;
 
-    
-       
+
+
         private byte[] m_ImageBit = null;
         private long m_nImageWidth = 0;
         private long m_nImageHeight = 0;
@@ -341,7 +341,7 @@ namespace OxfordExtenderWrapper
                 InitMicroscopeController();
                 InitImageAcquisition();
                 InitXrayAcquistion();
-               
+
                 return true;
             }
             catch (Exception e)
@@ -349,25 +349,20 @@ namespace OxfordExtenderWrapper
                 log.Error(e.Message);
                 return false;
             }
-           
+
 
         }
-       
+
         //结束
         public void CloseExtender()
         {
-            
-
-                CloseMicroscopeController();
-                CloseImageAcquisition();
-                CloseXrayAcquistion();
-           
-           
-
 
+            CloseMicroscopeController();
+            CloseImageAcquisition();
+            CloseXrayAcquistion();
 
         }
-       
+
         public bool AquisitionImage(ref ImageAquistionParam p)
         {
             currentCommand.grabImgParam = p;
@@ -393,18 +388,18 @@ namespace OxfordExtenderWrapper
 
                         break;
                     }
-                 
+
 
                     Application.DoEvents();
                     int time2;
-                    
-                        time2 = Environment.TickCount;
-                        if (time2 - time1 > EDSColletionTimeOut*6)
-                        {
-                            currentCommand.returnType = false;
-                            break;
-                        }
-                   
+
+                    time2 = Environment.TickCount;
+                    if (time2 - time1 > EDSColletionTimeOut * 6)
+                    {
+                        currentCommand.returnType = false;
+                        break;
+                    }
+
                 }
             }
             catch (InvalidSettingsException settingsException)
@@ -420,7 +415,7 @@ namespace OxfordExtenderWrapper
                 string msg = string.Format(@"AcquisitionStartException: {0}", startException.Message);
                 NLog.LogManager.GetCurrentClassLogger().Error(msg);
             }
-            
+
             if (currentCommand.returnType == true)
             {
 
@@ -435,12 +430,12 @@ namespace OxfordExtenderWrapper
         }
         public bool MoveStageXY(float x, float y)
         {
-          
+
             currentCommand.moveStagePrm = new MoveStageParam();
             currentCommand.moveStagePrm.x = x;
             currentCommand.moveStagePrm.y = y;
             currentCommand.commandType = OxfordCommandType.MoveStageXY;
-          
+
 
 
             var stageDictionary = new Dictionary<Stage, double>
@@ -451,18 +446,18 @@ namespace OxfordExtenderWrapper
             m_StageUpdated = false;
             this.microscopeController.SetStageConditions(stageDictionary);
             currentCommand.returnType = true;
-          
+
             int time1 = Environment.TickCount;
             int time2;
 
             while (!m_StageUpdated)
             {
                 Application.DoEvents();
-              
 
-              
+
+
                 time2 = Environment.TickCount;
-                if (time2-time1 > 60000)
+                if (time2 - time1 > 60000)
                 {
                     currentCommand.returnType = false;
                     break;
@@ -480,7 +475,7 @@ namespace OxfordExtenderWrapper
         }
         public bool XrayAreaCollecting(ref AreaXrayParam p)
         {
-           
+
             currentCommand.areaXrayPrm = p;
             currentCommand.commandType = OxfordCommandType.XrayAreaCollection;
             m_bXrayDone = false;
@@ -493,12 +488,12 @@ namespace OxfordExtenderWrapper
                 Chord chord = new Chord(seg.X, seg.Y, seg.Length);
                 Chords.Add(chord);
             }
-           var chordsList = new ChordList(Chords, m_dImagePixelsize);
+            var chordsList = new ChordList(Chords, m_dImagePixelsize);
             EdSpectrumSettings.ScanSettings.AcquisitionRegion.CreateChordListRegion(chordsList);
             EdSpectrumAcquisitionController.BeginMultipleAcquisition();
             try
             {
-                
+
                 IEdSpectrum edSpectrum = EdSpectrumAcquisitionController.StartAcquisition(EdSpectrumSettings);
 
                 var time1 = Environment.TickCount;
@@ -511,10 +506,10 @@ namespace OxfordExtenderWrapper
                         break;
                     }
 
-                   
+
                     Application.DoEvents();
                     var time2 = Environment.TickCount;
-                    if (time2-time1 > EDSColletionTimeOut * 6)
+                    if (time2 - time1 > EDSColletionTimeOut * 6)
                     {
                         currentCommand.returnType = false;
                         break;
@@ -533,7 +528,7 @@ namespace OxfordExtenderWrapper
                 string msg = string.Format(@"Acquisition Start Exception:{0}", acquisitionStartException.Message);
                 log.Error(msg);
             }
-           
+
             if (currentCommand.returnType == true)
             {
 
@@ -547,7 +542,7 @@ namespace OxfordExtenderWrapper
         }
         public bool XrayPointCollecting(ref PointXrayParam p)
         {
-            
+
             currentCommand.pointXrayPrm = p;
             currentCommand.commandType = OxfordCommandType.XrayPointCollection;
 
@@ -558,13 +553,13 @@ namespace OxfordExtenderWrapper
 
             SetXrayAcquisitionParam(p.dMilliSecondsTime);
 
-           
+
             EdSpectrumSettings.ScanSettings.AcquisitionRegion.CreatePointRegion(new System.Windows.Point(p.x * m_dImagePixelsize, p.y * m_dImagePixelsize));
             EdSpectrumAcquisitionController.BeginMultipleAcquisition();
             try
             {
                 m_bXrayDone = false;
-               
+
 
                 IEdSpectrum edSpectrum = EdSpectrumAcquisitionController.StartAcquisition(EdSpectrumSettings);
 
@@ -580,7 +575,7 @@ namespace OxfordExtenderWrapper
                     Application.DoEvents();
 
                     var time2 = Environment.TickCount;
-                    if (time2-time1 > EDSColletionTimeOut * 6)
+                    if (time2 - time1 > EDSColletionTimeOut * 6)
                     {
                         EdSpectrumAcquisitionController.EndMultipleAcquisition();
                         log.Warn("XrayStartAcquisition 超时!");
@@ -603,7 +598,7 @@ namespace OxfordExtenderWrapper
                 string msg = string.Format(@"Acquisition Start Exception:{0}", acquisitionStartException.Message);
                 log.Error(msg);
             }
-      
+
             if (currentCommand.returnType == true)
             {
 
@@ -617,18 +612,66 @@ namespace OxfordExtenderWrapper
         }
         public bool CollectXrayByPoints(ref List<PointXrayParam> a_listPoints, uint a_nXRayAQTime, bool a_bElementInfo)
         {
+            int nSize = a_listPoints.Count;
+            List<PointXrayParam> singleGroup = new List<PointXrayParam>();
+
+
+            int nTimes = nSize / XrayQuantityLimitPerTime;
+            for (int i = 0; i < nTimes; i++)
+            {
+                singleGroup.Clear();
 
+                for (int m = 0; m < XrayQuantityLimitPerTime; m++)
+                {
+                    singleGroup.Add(a_listPoints[i * XrayQuantityLimitPerTime + m]);
+
+                }
+
+                if (!CollectXrayByPointsOnHardwareLimit(ref singleGroup, a_nXRayAQTime, a_bElementInfo))
+                {
+
+                    return false;
+                }
+
+
+            }
+
+            int nLast = nSize % XrayQuantityLimitPerTime;
+            if (nLast != 0)
+            {
+
+                singleGroup.Clear();
+                for (int m = 0; m < nLast; m++)
+                {
+                    singleGroup.Add(a_listPoints[m]);
+                }
+
+                if (!CollectXrayByPointsOnHardwareLimit(ref singleGroup, a_nXRayAQTime, a_bElementInfo))
+                {
+                    return false;
+                }
+
+
+            }
+            return true;
+        }
+        public bool CollectXrayByPointsOnHardwareLimit(ref List<PointXrayParam> a_listPoints, uint a_nXRayAQTime, bool a_bElementInfo)
+        {
+            if (a_listPoints.Count > XrayQuantityLimitPerTime)
+            {
+                return false;
+            }
 
             currentCommand.XrayPrmForPoints = a_listPoints;
             currentCommand.commandType = OxfordCommandType.COLLECT_XRAYPOINTS;
-          
+
 
             //log.Info("线程:开始采集多点xray");
             var PointXrayDatas = currentCommand.XrayPrmForPoints;
             currentCommand.PointXrayDataReceived = 0;
 
             m_bXrayDone = false;
-            
+
 
             var dMilliSecondsTime = PointXrayDatas[0].dMilliSecondsTime;
             SetXrayAcquisitionParam(dMilliSecondsTime);
@@ -677,18 +720,18 @@ namespace OxfordExtenderWrapper
                 Application.DoEvents();
 
                 var time2 = Environment.TickCount;
-                
-                if (time2-time1 > EDSColletionTimeOut * PointXrayDatas.Count)
+
+                if (time2 - time1 > EDSColletionTimeOut * PointXrayDatas.Count)
                 {
                     EdSpectrumAcquisitionController.EndMultipleAcquisition();
-                   
+
                     currentCommand.returnType = false;
                 }
             }
 
             if (currentCommand.returnType == true)
             {
-             
+
                 return true;
             }
             else
@@ -699,18 +742,66 @@ namespace OxfordExtenderWrapper
         }
         public bool CollectXrayByFeatures(ref List<AreaXrayParam> a_listFeatures, double a_nXRayAQTime, bool a_bElementInfo)
         {
+            int nSize = a_listFeatures.Count;
+            List<AreaXrayParam> singleGroup = new List<AreaXrayParam>();
+
+
+            int nTimes = nSize / XrayQuantityLimitPerTime;
+            for (int i = 0; i < nTimes; i++)
+            {
+                singleGroup.Clear();
+
+                for (int m = 0; m < XrayQuantityLimitPerTime; m++)
+                {
+                    singleGroup.Add(a_listFeatures[i * XrayQuantityLimitPerTime + m]);
+
+                }
+
+                if (!CollectXrayByFeaturesOnHardwareLimit(ref singleGroup, a_nXRayAQTime, a_bElementInfo))
+                {
+
+                    return false;
+                }
+
+
+            }
+
+            int nLast = nSize % XrayQuantityLimitPerTime;
+            if (nLast != 0)
+            {
+
+                singleGroup.Clear();
+                for (int m = 0; m < nLast; m++)
+                {
+                    singleGroup.Add(a_listFeatures[m]);
+                }
+
+                if (!CollectXrayByFeaturesOnHardwareLimit(ref singleGroup, a_nXRayAQTime, a_bElementInfo))
+                {
+                    return false;
+                }
 
 
+            }
+            return true;
+        }
+        public bool CollectXrayByFeaturesOnHardwareLimit(ref List<AreaXrayParam> a_listFeatures, double a_nXRayAQTime, bool a_bElementInfo)
+        {
+            if (a_listFeatures.Count > XrayQuantityLimitPerTime)
+            {
+                return false;
+            }
+
             currentCommand.XrayPrmForFeatures = a_listFeatures;
 
 
             currentCommand.commandType = OxfordCommandType.COLLECT_XRAYFEATURES;
             var p = currentCommand.XrayPrmForFeatures;
             currentCommand.AreaXrayDataReceived = 0;
-          
-          
+
+
             m_bXrayDone = false;
-           
+
 
             var dMilliSecondsTime = p[0].dMilliSecondsTime;
             SetXrayAcquisitionParam(p[0].dMilliSecondsTime);
@@ -724,13 +815,13 @@ namespace OxfordExtenderWrapper
                 {
                     if (seg.Length >= 3)
                     {
-                         chord = new Chord(seg.X+1, seg.Y, seg.Length-2);//get the middle part
+                        chord = new Chord(seg.X + 1, seg.Y, seg.Length - 2);//get the middle part
                     }
-                    else 
+                    else
                     {
-                         chord = new Chord(seg.X, seg.Y, seg.Length);
+                        chord = new Chord(seg.X, seg.Y, seg.Length);
                     }
-                    
+
                     Chords.Add(chord);
                 }
                 var chordsList = new ChordList(Chords, m_dImagePixelsize);
@@ -774,13 +865,13 @@ namespace OxfordExtenderWrapper
                 }
                 Application.DoEvents();
 
-             
+
                 var time2 = Environment.TickCount;
-                if (time2-time1 > EDSColletionTimeOut * p.Count)
+                if (time2 - time1 > EDSColletionTimeOut * p.Count)
                 {
                     EdSpectrumAcquisitionController.EndMultipleAcquisition();
-                 
-                
+
+
                     currentCommand.returnType = false;
                     break;
                 }
@@ -799,8 +890,8 @@ namespace OxfordExtenderWrapper
 
 
         }
-     
-    
+
+
 
         //控制电镜初始化
         void InitMicroscopeController()
@@ -811,7 +902,7 @@ namespace OxfordExtenderWrapper
             this.microscopeController.ColumnConnected += this.OnMicroscopeColumnConnected;
             this.microscopeController.StageConnected += this.OnMicroscopeStageConnected;
             this.microscopeController.ChangeCompleted += this.OnMicroscopeChangeCompleted;
-           
+
 
             //ReadMicroscopeColumn();
 
@@ -824,7 +915,7 @@ namespace OxfordExtenderWrapper
         {
             if (microscopeController != null)
             {
-              
+
                 this.microscopeController.ColumnChange -= this.OnMicroscopeColumnChange;
                 this.microscopeController.StageChange -= this.OnMicroscopeStageChange;
                 this.microscopeController.ColumnConnected -= this.OnMicroscopeColumnConnected;
@@ -832,7 +923,7 @@ namespace OxfordExtenderWrapper
                 this.microscopeController.ChangeCompleted -= this.OnMicroscopeChangeCompleted;
                 microscopeController = null;
             }
-           
+
         }
 
         //读取当前的电镜控制值
@@ -888,12 +979,12 @@ namespace OxfordExtenderWrapper
             }
             if (stageCapabilities.StageX.CanRead)
             {
-                this.m_dStageX = stageConditions.StageX*1000.0;
+                this.m_dStageX = stageConditions.StageX * 1000.0;
             }
 
             if (stageCapabilities.StageY.CanRead)
             {
-                this.m_dStageY = stageConditions.StageY*1000.0;
+                this.m_dStageY = stageConditions.StageY * 1000.0;
             }
 
             if (stageCapabilities.StageZ.CanRead)
@@ -915,14 +1006,14 @@ namespace OxfordExtenderWrapper
         //电镜控制改变事件
         private void OnMicroscopeColumnChange(object sender, EventArgs e)
         {
-          
+
             ReadMicroscopeColumn();
         }
 
         //样品台控制改变事件
         private void OnMicroscopeStageChange(object sender, EventArgs e)
         {
-           
+
             ReadStage();
         }
 
@@ -935,7 +1026,7 @@ namespace OxfordExtenderWrapper
         //样品台控制连接或断开时的事件
         private void OnMicroscopeStageConnected(object sender, EventArgs e)
         {
-          
+
             ReadStage();
         }
 
@@ -946,9 +1037,9 @@ namespace OxfordExtenderWrapper
             {
                 if (e.Success)
                 {
-                 
+
                     m_StageUpdated = true;
-                 
+
                 }
 
             }
@@ -966,7 +1057,7 @@ namespace OxfordExtenderWrapper
                 {
                     m_ExternalScanUpdated = true;
                 }
-            
+
             }
             ReadMicroscopeColumn();
             ReadStage();
@@ -998,7 +1089,7 @@ namespace OxfordExtenderWrapper
                 {
                     currentCommand.returnType = false;
                     return false;
-                   
+
                 }
             }
             return true;
@@ -1029,7 +1120,7 @@ namespace OxfordExtenderWrapper
                 if (time2 - time1 > 10000)
                 {
                     currentCommand.returnType = false;
-                    return false;                  
+                    return false;
                 }
             }
             return true;
@@ -1061,7 +1152,7 @@ namespace OxfordExtenderWrapper
                 {
                     currentCommand.returnType = false;
                     return false;
-                   
+
                 }
             }
             return true;
@@ -1114,7 +1205,7 @@ namespace OxfordExtenderWrapper
 
             };
 
-           
+
             m_CollumnUpdated = false;
             this.microscopeController.SetColumnConditions(columnDictionary);
             int time1 = Environment.TickCount;
@@ -1153,11 +1244,11 @@ namespace OxfordExtenderWrapper
                     //break;
                 }
             }
-            
-            
+
+
             return true;
         }
-       
+
         //样品台
         public float[] GetStagePosition()
         {
@@ -1175,15 +1266,15 @@ namespace OxfordExtenderWrapper
         public Boolean SetStagePosition(float[] set)
         {
             double stageX = (double)set[0];
-           
+
             double stageY = (double)set[1];
-            
+
             double stageZ = (double)set[2];
-            
+
             double stageT = (double)set[3];
-           
+
             double stageR = (double)set[4];
-           
+
 
             var stageDictionary = new Dictionary<Stage, double>
             {
@@ -1240,7 +1331,7 @@ namespace OxfordExtenderWrapper
         public Boolean SetStageGotoX(float set)
         {
             double stageX = (double)set;
-           
+
             var stageDictionary = new Dictionary<Stage, double>
             {
                 { Stage.StageX, (double)stageX/1000.0 }
@@ -1266,7 +1357,7 @@ namespace OxfordExtenderWrapper
         {
 
             double stageY = (double)set;
-    
+
 
             var stageDictionary = new Dictionary<Stage, double>
             {
@@ -1292,7 +1383,7 @@ namespace OxfordExtenderWrapper
         public Boolean SetStageGotoZ(float set)
         {
             double stageZ = (double)set;
-  
+
 
             var stageDictionary = new Dictionary<Stage, double>
             {
@@ -1337,7 +1428,7 @@ namespace OxfordExtenderWrapper
                 {
                     currentCommand.returnType = false;
                     return false;
-                  
+
                 }
             }
             return true;
@@ -1345,7 +1436,7 @@ namespace OxfordExtenderWrapper
         public Boolean SetStageGotoR(float set)
         {
             double stageR = (double)set;
-       
+
             var stageDictionary = new Dictionary<Stage, double>
             {
                 { Stage.StageR, (double)stageR }
@@ -1368,10 +1459,10 @@ namespace OxfordExtenderWrapper
             }
             return true;
         }
-      
+
 
         #region 拍图
-       
+
 
         //图像扫描尺寸
         public double[] ImageScanSize =
@@ -1391,7 +1482,7 @@ namespace OxfordExtenderWrapper
             4096,
             8192
         };
-       
+
 
         public double GetDImagePixelsize()
         {
@@ -1408,11 +1499,11 @@ namespace OxfordExtenderWrapper
 
             imageAcquisitionController = AcquireFactory.CreateImageServer();
             imageAcquisitionSettings = AcquireFactory.CreateImageSettings();
-           
-         
+
+
             imageAcquisitionController.ExperimentStarted += this.OnImageExperimentStarted;
             imageAcquisitionController.ExperimentFinished += this.OnImageExperimentFinished;
-          
+
         }
         void InitXrayAcquistion()
         {
@@ -1421,12 +1512,12 @@ namespace OxfordExtenderWrapper
             EdSpectrumProcessing = ProcessingFactory.CreateSpectrumProcessing();
             // Use the autoIdSettings to define elements that are known or elements that you want to exclude. They also list elements that cannot be identified
             autoIdSettings = ProcessingFactory.CreateAutoIdSettings();
-            
+
             quantSettings = ProcessingFactory.CreateSEMQuantSettings();
 
             EdSpectrumAcquisitionController.ExperimentFinished += this.OnEdSpectrumExperimentFinished;
             //EdSpectrumAcquisitionController.ExperimentStarted += this.OnEdSpectrumExperimentStarted;
-          
+
         }
         //控制电镜释放
         void CloseImageAcquisition()
@@ -1437,7 +1528,7 @@ namespace OxfordExtenderWrapper
                 imageAcquisitionController.ExperimentFinished -= this.OnImageExperimentFinished;
                 imageAcquisitionController = null;
             }
-            
+
         }
         void CloseXrayAcquistion()
         {
@@ -1469,7 +1560,7 @@ namespace OxfordExtenderWrapper
 
             if (!ReadImageData(electronImage, out m_ImageBit, out m_nImageWidth, out m_nImageHeight, out m_dImagePixelsize))
             {
-             
+
                 NLog.LogManager.GetCurrentClassLogger().Error("图像采集完成,获取图像像素失败!");
             }
 
@@ -1532,7 +1623,7 @@ namespace OxfordExtenderWrapper
 
         //a_dDwellTime : 1~100000之间的数 
         //a_sImageType : 1: SE, 2: Bse
-       
+
         public bool SetImageAcquistionSetting(ImageAquistionParam p)
         {
 
@@ -1571,20 +1662,20 @@ namespace OxfordExtenderWrapper
             {
                 scanSettings.AcquisitionRegion.CreateFullFieldRegion(pixelSize);
             }
-            else 
+            else
             {
 
-                scanSettings.AcquisitionRegion.CreateRectangleRegion(p.ImgRectRegion,pixelSize);
+                scanSettings.AcquisitionRegion.CreateRectangleRegion(p.ImgRectRegion, pixelSize);
             }
 
-           
 
-           
+
+
 
 
             return true;
         }
-        
+
 
 
         #endregion
@@ -1604,24 +1695,24 @@ namespace OxfordExtenderWrapper
             EdSpectrumSettings.EdSettings.ProcessTime = 4;
             EdSpectrumSettings.EdSettings.EnergyRange = 20;
             EdSpectrumSettings.EdSettings.NumberOfChannels = 4096;
-          
+
         }
-        private bool GetAtomicNumberByEleName(string name,out int atomicNum)
+        private bool GetAtomicNumberByEleName(string name, out int atomicNum)
         {
             var allelenames = theElementNameList.Split(',');
             for (int i = 0; i < allelenames.Length; i++)
             {
                 if (allelenames[i] == name)
                 {
-                    atomicNum= i+1;
+                    atomicNum = i + 1;
                     return true;
                 }
-            
+
             }
-            atomicNum=0;
+            atomicNum = 0;
             return false;
         }
- 
+
         /// <summary>
         /// Called when IEdSpectrumAcquisitionController Experiment Finished
         /// </summary>
@@ -1632,7 +1723,7 @@ namespace OxfordExtenderWrapper
 
             IEdSpectrumAcquisitionController edSpectrumAcquisitionController = sender as IEdSpectrumAcquisitionController;
 
-             uint[] m_XrayData;
+            uint[] m_XrayData;
 
             NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
             IEdSpectrum edSpectrum = e.Value;
@@ -1648,7 +1739,7 @@ namespace OxfordExtenderWrapper
             }
 
             //Quantify processing
-            bool bquant=false;
+            bool bquant = false;
             if (currentCommand.commandType == OxfordCommandType.XrayPointCollection)
             {
                 bquant = currentCommand.pointXrayPrm.b_quant;
@@ -1684,20 +1775,20 @@ namespace OxfordExtenderWrapper
                         int atomicnum;
                         if (GetAtomicNumberByEleName(ele, out atomicnum))
                         {
-                           
+
                             autoIdSettings.SetKnownElement(atomicnum, true);
                         }
 
                     }
 
                     log.Warn(autoIdSettings.KnownElements);
-                   
+
                 }
-                else 
+                else
                 {
-                   
+
                 }
-                
+
                 EdSpectrumProcessing.IdentifyElements(e.Value, autoIdSettings);
                 // While it is possible to choose other elements, Oxygen is the only supported element by stoichiometry.
                 quantSettings.CombinedElement = 8;
@@ -1708,7 +1799,7 @@ namespace OxfordExtenderWrapper
 
                 var ie = Results.GetEnumerator();
 
-               
+
 
                 while (ie.MoveNext())
                 {
@@ -1763,7 +1854,7 @@ namespace OxfordExtenderWrapper
                         m_bXrayDone = true;
                     }
                 }
-               
+
 
             }
 
@@ -1814,14 +1905,14 @@ namespace OxfordExtenderWrapper
 
             return true;
         }
-    
+
 
         public bool IsAcquiringSpectrum()
         {
             return EdSpectrumAcquisitionController.IsAcquiring;
         }
 
-      
+
 
 
         public void BeginMultipleAquisition()
@@ -1836,7 +1927,7 @@ namespace OxfordExtenderWrapper
         }
 
 
-       
+
         public bool GetSemBeamOn()
         {
             var beamon = microscopeController.ColumnConditions.BeamOn;
@@ -1844,16 +1935,16 @@ namespace OxfordExtenderWrapper
             {
                 return true;
             }
-            else 
+            else
             {
                 return false;
-            
+
             }
-           
+
         }
         public bool SetSemBeamOnOrOff(bool val)
         {
-            double beamon ;
+            double beamon;
             if (val)
             {
                 beamon = 1;