Explorar el Código

fix bruker eds problem (1 don't release control rights when measure 2 cann't maintain the rotate angle problem 3 change the point mode batch xray collection to real batch collection not a cycle calling)

CXS hace 3 años
padre
commit
76d458527b

+ 5 - 1
OTSCPP/OTSClrInterface/ControlClr/OTSControlFunExport.h

@@ -337,7 +337,11 @@ namespace OTSCLRINTERFACE
 			BOOL bRev = m_pSem->SetPositionXY(a_dPositionX, a_dPositionY, a_dPositionR);
 			return bRev;
 		}
-
+		bool SetSemPositionXY(double a_dPositionX, double a_dPositionY)
+		{
+			BOOL bRev = m_pSem->SetPositionXY(a_dPositionX, a_dPositionY);
+			return bRev;
+		}
 
 		//»ñµÃ½¹µã³ß´ç
 		bool GetSemSpotSize(double% a_dSpotSize)

+ 5 - 19
OTSCPP/OTSControl/Bruker/OTSBrukerImpl.cpp

@@ -1,8 +1,10 @@
+#pragma once
 #include "stdafx.h"
 #include "OTSBrukerImpl.h"
 #include "3Parties\dibapi.h"
 #include "BrukerSPXFileMgr.h"
 #include "ControllerHelper.h"
+#include <COTSUtilityDllFunExport.h>
 
 
 namespace OTSController {
@@ -2907,8 +2909,7 @@ BOOL COTSBrukerImpl::StartFeatureListMeasurement(
 	return TRUE;
 }
 
-// instance termination
-//void COTSBrukerImpl::FinishedInstance(void) { ; }
+
 
 // 
 CString COTSBrukerImpl::GetQuantificationSpectrumPathName()
@@ -2938,13 +2939,7 @@ BOOL COTSBrukerImpl::GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACT
 			return TRUE;
 		}
 
-		//// turn SEM to external
-		//if (!SetSEMExternalOn())
-		//{
-		//	// failed to call SetSEMExternalOn method
-		//	LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: failed to call SetSEMExternalOn method."));
-		//	return FALSE;
-		//}
+		
 
 		// create array of BrukerSegment
 		long nCollectCount = (long)a_listXrayPois.size();
@@ -2980,16 +2975,7 @@ BOOL COTSBrukerImpl::GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACT
 	{
 		LogErrorTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: exception."));
 	}
-	//finally
-	//{
-	//	// turn SEM to external OFF
-	//	if (!SetSEMExternalOff())
-	//	{
-	//		// failed to call SetSEMExternalOn method
-	//		LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: failed to call SetSEMExternalOff method."));
-	//		
-	//	}
-	//}
+	
 
 	// error, return false
 	return FALSE;

+ 32 - 8
OTSCPP/OTSControl/Bruker/OTSEDSBrucker.cpp

@@ -230,21 +230,34 @@ namespace OTSController {
 		}
 		std::vector<CPosXrayPtr> listXRayPointsTemp;
 
-
+		// turn SEM to external
+		if (!m_pBrukerImpl->SetSEMExternalOn())
+		{
+			// failed to call SetSEMExternalOn method
+			LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: failed to call SetSEMExternalOn method."));
+			return FALSE;
+		}
 
 
 		for (int i = 0; i < (int)a_vXRayPoints.size(); i++)
 		{
 			listXRayPointsTemp.push_back( a_vXRayPoints[i]);
 
+		
+			
+		}
+		if (!m_pBrukerImpl->GetXRayByPoints(listXRayPointsTemp, a_nXRayAQTime))// one point per time,or we cann't get the full element data. gsp 2020-11-30
+		{
+			LogErrorTrace(__FILE__, __LINE__, _T("GetXRayByPoints: failed to get element."));
+		}
+		listXRayPointsTemp.clear();
+
+		if (!m_pBrukerImpl->SetSEMExternalOff())
+		{
+			// failed to call SetSEMExternalOn method
+			LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: failed to call SetSEMExternalOff method."));
 
-			if (!m_pBrukerImpl->GetXRayByPoints(listXRayPointsTemp, a_nXRayAQTime))// one point per time,or we cann't get the full element data. gsp 2020-11-30
-			{
-				LogErrorTrace(__FILE__, __LINE__, _T("GetXRayByPoints: failed to get element."));
-			}
-			listXRayPointsTemp.clear();
 		}
-		
 
 		return TRUE;
 	}
@@ -261,7 +274,13 @@ namespace OTSController {
 			LogErrorTrace(__FILE__, __LINE__, _T("COTSEDSBrucker::GetXRayByFeatures: invalid m_pBrukerImpl."));
 			return FALSE;
 		}
-
+		// turn SEM to external
+		if (!m_pBrukerImpl->SetSEMExternalOn())
+		{
+			// failed to call SetSEMExternalOn method
+			LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: failed to call SetSEMExternalOn method."));
+			return FALSE;
+		}
 		// collect x-Ray points (area scan)
 		if (!m_pBrukerImpl->GetXRayByFeatures(a_listXRayPoints, a_listFeatures, a_nXRayAQTime))
 		{
@@ -269,7 +288,12 @@ namespace OTSController {
 			LogErrorTrace(__FILE__, __LINE__, _T("COTSEDSBrucker::CollectXRayPointsByFeatures: failed to call bruker controller CollectXRayPointsByFeatures method."));
 			return FALSE;
 		}
+		if (!m_pBrukerImpl->SetSEMExternalOff())
+		{
+			// failed to call SetSEMExternalOn method
+			LogTrace(__FILE__, __LINE__, _T("COTSBrukerImpl::GetXRayByPoints: failed to call SetSEMExternalOff method."));
 
+		}
 		// ok, return TRUE
 		return TRUE;
 	}

+ 36 - 0
OTSCPP/OTSControl/Bruker/OTSSEMBruker.cpp

@@ -535,6 +535,42 @@ namespace OTSController {
 		// ok, return TRUE
 		return TRUE;
 	}
+	BOOL COTSSEMBruker::SetPositionXY(double a_dPositionX, double a_dPositionY)
+	{
+		// m_pBrukerImplPtr check
+		ASSERT(m_pBrukerImplPtr);
+		if (!m_pBrukerImplPtr)
+		{
+			LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetPositionXY: m_pBrukerImplPtr is invalid."));
+			return FALSE;
+		}
+
+		// get position
+		double dPositionX, dPositionY, dPositionZ, dTilt, dRotation;
+		if (!m_pBrukerImplPtr->GetSEMStageData(dPositionX, dPositionY, dPositionZ, dTilt, dRotation))
+		{
+			// failed to call GetSEMStageData method
+			LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetPositionXY : failed to call GetSEMStageData method."));
+			return FALSE;
+		}
+
+		// need to convert a_dPositionX, a_dPositionY from OTS position to SEM position
+
+		// set position
+		dPositionX = a_dPositionX;
+		dPositionY = a_dPositionY;
+		//dRotation = a_dPositionR;
+		LogTrace(__FILE__, __LINE__, _T("COTSSEMBruker::Start to SetPositionXY "));
+		if (!m_pBrukerImplPtr->SetSEMStageData(dPositionX, dPositionY, dPositionZ, dTilt, dRotation))
+		{
+			// failed to call SetSEMStageData method
+			LogErrorTrace(__FILE__, __LINE__, _T("COTSSEMBruker::SetPositionXY : failed to call SetSEMStageData method."));
+			return FALSE;
+		}
+		LogTrace(__FILE__, __LINE__, _T("COTSSEMBruker::Finished SetPositionXY "));
+		// ok, return TRUE
+		return TRUE;
+	}
 
 	// spot size 
 	BOOL COTSSEMBruker::GetSpotSize(double& a_dSpotSize)

+ 1 - 0
OTSCPP/OTSControl/Bruker/OTSSEMBruker.h

@@ -48,6 +48,7 @@ namespace OTSController {
 
 		virtual BOOL GetPositionXY(double& a_dPositionX, double& a_dPositionY, double& a_dPositionR) override;
 		virtual BOOL SetPositionXY(double a_dPositionX, double a_dPositionY, double a_dPositionR) override;
+		virtual BOOL SetPositionXY(double a_dPositionX, double a_dPositionY) override;
 
 		virtual BOOL GetSpotSize(double& a_dSpotSize) override;
 		virtual BOOL SetSpotSize(double a_dSpotSize) override;

+ 1 - 0
OTSCPP/OTSControl/OTSSemBase.h

@@ -98,6 +98,7 @@ namespace OTSController {
 		// position 
 		virtual BOOL GetPositionXY(double& a_dPositionX, double& a_dPositionY, double& a_dRotation) = 0;
 		virtual BOOL SetPositionXY(double a_dPositionX, double a_dPositionY, double a_dRotation) = 0;
+		virtual BOOL SetPositionXY(double a_dPositionX, double a_dPositionY) = 0;
 
 		// scan field100
 		virtual CSize GetScanField100() { return m_oScanField100; }

+ 10 - 1
OTSCPP/OTSControl/Oxford/OTSOxfordImpl.cpp

@@ -321,7 +321,16 @@
 				LogErrorTrace(__FILE__, __LINE__, _T("SetExternal command failed."));
 				return false;
 			}
-			LogWarn(__FILE__, __LINE__, _T("SetExternal: ") + CString(std::to_string(a_bExternal).c_str()));
+			CString s = __T("");
+				if (a_bExternal)
+				{
+					s = __T("On");
+				}
+				else
+				{
+					s = __T("Off");
+				}
+			LogWarn(__FILE__, __LINE__, _T("SetExternal: ") +s);
 			return true;
         }
 

+ 19 - 0
OTSCPP/OTSControl/Oxford/OTSSEMOxford.cpp

@@ -134,6 +134,25 @@ namespace OTSController {
 		}
 
 
+		// set position
+		if (!m_oxfordImpl->SetPositionXY(a_dPositionX, a_dPositionY))
+		{
+			// OK, return TRUE
+			return TRUE;
+		}
+		LogTrace(__FILE__, __LINE__, _T("setpostionxy %f,  %f"), a_dPositionX, a_dPositionY);
+		return TRUE;
+	}
+	BOOL COTSSEMOxford::SetPositionXY(double a_dPositionX, double a_dPositionY)
+	{
+		// controller checking
+		ASSERT(m_oxfordImpl);
+		if (!m_oxfordImpl)
+		{
+			return FALSE;
+		}
+
+
 		// set position
 		if (!m_oxfordImpl->SetPositionXY(a_dPositionX, a_dPositionY))
 		{

+ 1 - 0
OTSCPP/OTSControl/Oxford/OTSSEMOxford.h

@@ -58,6 +58,7 @@ namespace OTSController {
 
 		virtual BOOL GetPositionXY(double& a_dPositionX, double& a_dPositionY, double& a_dPositionR) override;
 		virtual BOOL SetPositionXY(double a_dPositionX, double a_dPositionY, double a_dPositionR) override;
+		virtual BOOL SetPositionXY(double a_dPositionX, double a_dPositionY) override;
 
 		virtual BOOL GetSpotSize(double& /*a_dSpotSize*/) override { return true; }
 		virtual BOOL SetSpotSize(double /*a_dSpotSize*/) override { return true; }

+ 7 - 0
OTSCPP/OTSControl/Simulate/OTSSemSim.h

@@ -68,7 +68,14 @@ namespace OTSController {
 
 			return TRUE;
 		}
+		virtual BOOL SetPositionXY(double a_dPositionX, double a_dPositionY) override
+		{
+			m_dCurrentPositionX = a_dPositionX;
+			m_dCurrentPositionY = a_dPositionY;
+			/*m_dCurrentPositionR = a_dRotation;*/
 
+			return TRUE;
+		}
 		virtual BOOL GetSpotSize(double& a_dSpotSize) override { a_dSpotSize = m_dSpotSize; return TRUE; }
 		virtual BOOL SetSpotSize(double a_dSpotSize) override { m_dSpotSize = a_dSpotSize; return TRUE; }
 

+ 1 - 1
OTSCPP/OTSLog/COTSUtilityDllFunExport.h

@@ -21,7 +21,7 @@
 extern "C" __declspec(dllexport) void InitLogFile(LPCTSTR lpLogName);     // 由APP加载DLL成功后设置路径,设置Log文件保存的路径,如 "C:\\OPTON\\APP"      (APP为保存的log名字
 extern "C" __declspec(dllexport) void  LogToFile(LPCTSTR szFile, long lLine, LPCTSTR lpTraceLog, ...);
 extern "C" __declspec(dllexport) void LogTrace(LPCTSTR szFile, long lLine, LPCTSTR lpTraceLog, ...);       //记录日志
-extern "C" __declspec(dllexport) void  LogWarn(LPCTSTR szFile, long lLine, LPCTSTR lpTraceLog, ...);
+extern "C" __declspec(dllexport) void LogWarn(LPCTSTR szFile, long lLine, LPCTSTR lpTraceLog, ...);
 extern "C" __declspec(dllexport) void LogInfoTrace(LPCTSTR szFile, long lLine, LPCTSTR lpTraceLog, ...);       //记录日志
 extern "C" __declspec(dllexport) void LogErrorTrace(LPCTSTR szFile, long lLine, LPCTSTR lpErrorTrace, ...);   // 记录错误或者异常
 extern "C"  __declspec(dllexport) void LogBinaryTrace(LPCTSTR szHead, BYTE* pbyData, UINT nLen);  //记录二进制数据 日志

+ 23 - 8
OTSIncAMeasureApp/0-OTSModel/Measure/1-OTSInclution/SmplMeasureInclution.cs

@@ -205,22 +205,37 @@ namespace OTSModelSharp
 
             if (xraymode == OTS_X_RAY_SCAN_MODE.FeatureMode)
             {
-                log.Info("Begin  feature mode xray collection for big particles!AQTime:"+nXRayAQTime+" xrayNum:"+ bigparts.Count);
-                m_EDSHardwareMgr.GetXRayByFeatures(bigparts, nXRayAQTime, true);
+                if (bigparts.Count > 0)
+                {
+
+                    log.Info("Begin  feature mode xray collection for big particles!AQTime:" + nXRayAQTime + " xrayNum:" + bigparts.Count);
+                    m_EDSHardwareMgr.GetXRayByFeatures(bigparts, nXRayAQTime, true);
+                }
+                
     
 
             }
             else 
             {
-                log.Info("Begin  point mode xray collection for big particles!AQTime:" + nXRayAQTime + " xrayNum:" + bigparts.Count);
-                // get x-ray list (analysis) by points
-                m_EDSHardwareMgr.GetXRayByPoints(bigparts, nXRayAQTime, true);
+                if (bigparts.Count > 0)
+                {
+                    log.Info("Begin  point mode xray collection for big particles!AQTime:" + nXRayAQTime + " xrayNum:" + bigparts.Count);
+                    // get x-ray list (analysis) by points
+                    m_EDSHardwareMgr.GetXRayByPoints(bigparts, nXRayAQTime, true);
+
+                }
+               
      
 
             }
-            log.Info("Begin  point mode xray collection for small particles!AQTime:" + nFastXrayAQTime + " xrayNum:" + smallparts.Count);
-            // get x-ray list (analysis) by points
-            m_EDSHardwareMgr.GetXRayByPoints(smallparts, nFastXrayAQTime, true);
+            if (smallparts.Count > 0)
+            {
+                log.Info("Begin  point mode xray collection for small particles!AQTime:" + nFastXrayAQTime + " xrayNum:" + smallparts.Count);
+                // get x-ray list (analysis) by points
+                m_EDSHardwareMgr.GetXRayByPoints(smallparts, nFastXrayAQTime, true);
+
+            }
+          
 
 
             return ;

+ 18 - 18
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -450,7 +450,7 @@ namespace OTSModelSharp
             log.Info("Begin to move SEM stage to " + a_SEMpt.X + "," + a_SEMpt.Y);
           
             // move SEM to the position (rotation 0)
-            if (!pSEMController.MoveSEMToPoint(a_SEMpt, 0))
+            if (!pSEMController.MoveSEMToPoint(a_SEMpt))
             {
                 log.Error("MoveSEMToPoint: failed to call MoveSEMToPoint method.");
                 return false;
@@ -533,14 +533,14 @@ namespace OTSModelSharp
                     return;
                 }
                 // get SEM external controll on
-                if (!SetSEMExteralOn())
-                {
-                    log.Error("DoMeasure: fail to set SEM external.");
-                    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);                  
-                    pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
-
-                    return;
-                }
+                //if (!SetSEMExteralOn())
+                //{
+                //    log.Error("DoMeasure: fail to set SEM external.");
+                //    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);                  
+                //    pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
+
+                //    return;
+                //}
                 // set the BSE scan param
                 if (!SetBSEParam())
                 {
@@ -821,15 +821,15 @@ namespace OTSModelSharp
                 }
 
                 // get SEM external controll on
-                if (!SetSEMExteralOn())
-                {
-                    log.Error("DoMeasure: fail to set SEM external.");
-                    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                    // record end time
-                    pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
-
-                    return;
-                }
+                //if (!SetSEMExteralOn())
+                //{
+                //    log.Error("DoMeasure: fail to set SEM external.");
+                //    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+                //    // record end time
+                //    pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
+
+                //    return;
+                //}
                 // set the BSE scan param
                 if (!SetHoleBSEParam())
                 {

+ 2 - 2
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SEMDATAFieldManage.cs

@@ -267,7 +267,7 @@ namespace OTSMeasureApp
 
                     //调用C++ controller中的方法
                     //移动至当前位置
-                    bool result = cSemfun.MoveSEMToPoint(new Point(SEMPoint.X, SEMPoint.Y), 0);
+                    bool result = cSemfun.MoveSEMToPoint(new Point(SEMPoint.X, SEMPoint.Y));
                     if (result)
                     {
                         return result;
@@ -324,7 +324,7 @@ namespace OTSMeasureApp
                             //移动至帧图中心位置 
                             int moveCenterX = lTLocation.X - diffX;
                             int moveCenterY = lTLocation.Y + diffY;
-                            bool result = cSemfun.MoveSEMToPoint(new Point(moveCenterX, moveCenterY), 0);
+                            bool result = cSemfun.MoveSEMToPoint(new Point(moveCenterX, moveCenterY));
                             if (result)
                             {
                                 return result;

+ 2 - 1
OTSIncAMeasureApp/ServiceCenter/IMeasureHardware.cs

@@ -26,7 +26,8 @@ namespace OTSModelSharp.ServiceInterface
 
        bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR);
         bool MoveSEMToPoint(Point poi, double rotation);
-         OTSCLRINTERFACE.COTSControlFunExport GetHardwareInterface();
+        bool MoveSEMToPoint(Point poi);
+        OTSCLRINTERFACE.COTSControlFunExport GetHardwareInterface();
     }
     public interface IScanController
     {

+ 2 - 2
OTSIncAMeasureApp/ServiceCenter/IpcSEMController.cs

@@ -11,13 +11,13 @@ namespace OTSMeasureApp.ServiceCenter
      public   class IpcSEMController: MarshalByRefObject
     {
         private SemController sem= SemController.GetSEMController();
-        public bool MoveSEMToPoint(Point poi, double rotation)
+        public bool MoveSEMToPoint(Point poi)
         {
             if (!sem.IsConnected())
             {
                 return false;
             }
-            return sem.MoveSEMToPoint(poi, rotation);
+            return sem.MoveSEMToPoint(poi);
         }
         public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
         {

+ 10 - 3
OTSIncAMeasureApp/ServiceCenter/SemController.cs

@@ -108,15 +108,22 @@ namespace OTSModelSharp.ServiceInterface
             return hw.GetSemWorkingDistance(ref a_distance);
         }
 
-      
-
         public bool MoveSEMToPoint(Point poi, double rotation)
         {
             if (!hw.IsConnected())
             {
                 return false;
             }
-            return hw.MoveSEMToPoint(poi.X, poi.Y, rotation);
+            return hw.MoveSEMToPoint(poi.X, poi.Y,rotation);
+        }
+
+        public bool MoveSEMToPoint(Point poi)
+        {
+            if (!hw.IsConnected())
+            {
+                return false;
+            }
+            return hw.MoveSEMToPoint(poi.X, poi.Y);
         }
 
         public bool SetMagnification(double a_dMagnification)

+ 1 - 1
OTSIncAReportApp/3-ServiceCenter/HardwareController.cs

@@ -76,7 +76,7 @@ namespace ServiceInterface
 
             try
             {
-                return remoteObj.MoveSEMToPoint(poi, rotation);
+                return remoteObj.MoveSEMToPoint(poi);
             }
             catch (Exception e)
             {

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 200 - 189
OTSSysMgrApp/SemTestForms.Designer.cs


+ 1 - 1
OTSSysMgrApp/SemTestForms.cs

@@ -596,7 +596,7 @@ namespace OTSSysMgrApp
                 //赋值
                 double PositionX = Convert.ToDouble(tbSPositionX.Text);
                 double PositionY = Convert.ToDouble(tbSPositionY.Text);
-                double PositionR = 0;//Convert.ToDouble(tbSPositionR.Text);
+                double PositionR = Convert.ToDouble(tbSPositionR.Text);
                 bool result = cfun.SetSemPositionXY(PositionX, PositionY, PositionR);
                 if (result)
                 {

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio