CMeasure.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. using System.Collections.Generic;
  2. using OTSDataType;
  3. using System;
  4. using System.Drawing;
  5. using static OTSDataType.otsdataconst;
  6. using OTSModelSharp.ImageProcess;
  7. using OTSModelSharp.ServiceInterface;
  8. using System.Threading;
  9. namespace OTSModelSharp
  10. {
  11. // enum and struct used for send message to App
  12. public enum ENUM_MSG_TYPE
  13. {
  14. MTHREADSTATUS = 1001,
  15. MSAMPLESTATUS = 1002,
  16. MSAMPLERESULT = 1003
  17. };
  18. public enum MSAMPLE_RET
  19. {
  20. BSE_DATA = 0,
  21. FIELD_DATA = 1,
  22. START_MSR_FIELD = 2
  23. };
  24. public struct SMSR_COMPLETE_DATA
  25. {
  26. public OTS_MSR_THREAD_STATUS MsrStatus;
  27. public string csMsrStartTime;
  28. public int iMsrCompleteSampleCount;
  29. public int iMsrCompleteFieldCount;
  30. public int iParticleCount;
  31. public TimeSpan MsrUsedTime;
  32. public string csMsrEndTime;
  33. };
  34. public struct STMThreadStatus
  35. {
  36. public OTS_MSR_THREAD_STATUS iMsrStatu; //OTS_MSR_THREAD_STATUS
  37. public string csMsrStartTime; //MSR_START_TIME
  38. public string csMsrEndTime; //MSR_END_TIME
  39. public SMSR_COMPLETE_DATA SMsrCompleteData;
  40. };
  41. public struct STMSampleStatus
  42. {
  43. public OTS_MSR_SAMPLE_STATUS iMsrSampleStatu; //OTS_MSR_SAMPLE_STATUS
  44. public string cSampleName;
  45. public string csSampleMsrStartTime;
  46. public List<Point> BCompleteFieldList;
  47. };
  48. public struct STMSampleResultData
  49. {
  50. public MSAMPLE_RET iRetDataType; //ENUM_MEASURE_SAMPLE_RESULT
  51. public struct RBSEDATA
  52. {
  53. public System.Drawing.Point pos;
  54. public int iBSEDataHeight;
  55. public int iBSEDataWidth;
  56. public byte[] lpBSEData;
  57. };
  58. public struct SAMPLEFIELDDATA
  59. {
  60. public System.Drawing.Point FieldPos;
  61. public int iMeasureFieldCount;
  62. public int iCompleteFieldCount;
  63. public int iSParticleCount; // Field particle count
  64. public TimeSpan TUsedTime;
  65. };
  66. public struct StartToMsrField
  67. {
  68. public System.Drawing.Point FieldPos;
  69. };
  70. public RBSEDATA BSEData;
  71. public SAMPLEFIELDDATA SFieldData;
  72. public StartToMsrField SMsrField;
  73. };
  74. public struct ST_MSTMsg
  75. {
  76. public ENUM_MSG_TYPE iMsgType;
  77. public STMThreadStatus STMThreadStu;
  78. public STMSampleStatus STMSampleStu;
  79. public STMSampleResultData STMSampleRetData;
  80. };
  81. public class CMeasure
  82. {
  83. private const string UNTITLED_FILE_NAME = "Untitled";
  84. public delegate void ProgressEventHandler(ST_MSTMsg msg);
  85. public event ProgressEventHandler ProgressEvent;
  86. COTSMsrPrjResultData m_pProjData;
  87. List< COTSSample> m_listMeasurableSamples=new List<COTSSample>();
  88. string m_strWorkingFolder;
  89. CMsrThreadStatus m_ThreadStatus;
  90. SemController m_SemController;// there is no correspondense clr,so use this instead temporarilly
  91. protected static NLog.Logger loger = NLog.LogManager.GetCurrentClassLogger();
  92. public SortedDictionary<string, CSmplMeasure> mapSmplMsr = new SortedDictionary<string, CSmplMeasure>();//use this map to hold all the smplMeasure object
  93. public List<COTSSample> GetListMeasurableSamples()
  94. {
  95. return m_listMeasurableSamples;
  96. }
  97. public void SetListMeasurableSamples(List<COTSSample> value)
  98. {
  99. m_listMeasurableSamples = value;
  100. }
  101. public CMeasure()
  102. {
  103. m_strWorkingFolder = "";
  104. m_ThreadStatus = new CMsrThreadStatus();
  105. m_SemController = SemController.GetSEMController();
  106. }
  107. public COTSMsrPrjResultData GetProjResultData()
  108. {
  109. return m_pProjData;
  110. }
  111. public ISemController GetSEMController()
  112. {
  113. // get SEM, scanner and x-ray controller via hardware manager
  114. return m_SemController;
  115. }
  116. public CMsrThreadStatus GetMsrThreadStatus() { return m_ThreadStatus; }
  117. public void Init(COTSMsrPrjResultData a_pProjMgrFile)
  118. {
  119. m_pProjData = a_pProjMgrFile;
  120. SetListMeasurableSamples(a_pProjMgrFile.GetSampleList());
  121. return ;
  122. }
  123. void ThreadOver()
  124. {
  125. DateTime timeEnd = m_ThreadStatus.GetEndTime();
  126. ST_MSTMsg MsrMsg = new ST_MSTMsg();
  127. MsrMsg.iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
  128. MsrMsg.STMThreadStu.iMsrStatu = m_ThreadStatus.GetStatus();
  129. MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToString("yyyy-MM-dd HH:mm:ss");
  130. ProgressEvent(MsrMsg);
  131. }
  132. void ThreadOverWithoutDisConnect()
  133. {
  134. DateTime timeEnd = m_ThreadStatus.GetEndTime();
  135. ST_MSTMsg MsrMsg = new ST_MSTMsg();
  136. MsrMsg.iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
  137. MsrMsg.STMThreadStu.iMsrStatu = m_ThreadStatus.GetStatus();
  138. MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToString("yyyy-MM-dd HH:mm:ss");
  139. ProgressEvent(MsrMsg);
  140. }
  141. void SetWorkingFolderStr()
  142. {
  143. // get project file pathname
  144. string strSettingFilePathName = m_pProjData.GetPathName();
  145. strSettingFilePathName.Trim();
  146. if (strSettingFilePathName == "")
  147. {
  148. loger .Error("SetWorkingFolderStr: project file pathname is an empty string");
  149. return ;
  150. }
  151. else if (strSettingFilePathName==UNTITLED_FILE_NAME)
  152. {
  153. loger .Error ("SetWorkingFolderStr: project file pathname is an invalid string");
  154. return ;
  155. }
  156. // working folder string
  157. m_strWorkingFolder = FileHelper.GetFolderName(strSettingFilePathName);
  158. return ;
  159. }
  160. public void SendMessageToMeasureApp(ST_MSTMsg msg)
  161. {
  162. ProgressEvent(msg);
  163. }
  164. public bool IsMeasureStopped()
  165. {
  166. return m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.STOPPED;
  167. }
  168. public bool IsMeasureRunning() { return m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.INPROCESS; }
  169. public bool IsMeasureFailed() { return m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.FAILED; }
  170. public bool IsMeasureCompleted() { return m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.COMPLETED; }
  171. public void DoMeasure()
  172. {
  173. // start measurement, creat thread measure status class, let the main thread know that measurement started
  174. m_ThreadStatus.SetStartTime(System.DateTime.Now);
  175. DateTime timeStart = m_ThreadStatus.GetStartTime();
  176. ST_MSTMsg MsgMsrStart=new ST_MSTMsg();
  177. MsgMsrStart.iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
  178. MsgMsrStart.STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.INPROCESS;
  179. MsgMsrStart.STMThreadStu.csMsrStartTime = timeStart.ToShortDateString();
  180. ProgressEvent (MsgMsrStart);
  181. loger.Info("Measurement started!");
  182. // connect hardware
  183. loger.Info("Connect SEM!");
  184. if (!m_SemController.Connect())
  185. {
  186. loger .Error("DoMeasure: failed to connect hardware.");
  187. m_ThreadStatus.SetStatus(OTS_MSR_THREAD_STATUS.FAILED);
  188. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  189. ThreadOver();
  190. return;
  191. }
  192. // set working directory which is the same directory of the setting file
  193. SetWorkingFolderStr();
  194. List <string > listMeasuredSamples = m_ThreadStatus.GetCompletedSamples();
  195. // got through measure list
  196. foreach (var pSample in GetListMeasurableSamples())
  197. {// check and break if stop button is clicked
  198. if (m_ThreadStatus.GetStatus()== OTS_MSR_THREAD_STATUS.STOPPED )
  199. {
  200. // stop button clicked
  201. loger .Info("DoMeasure: stop button is clicked.");
  202. // record end time
  203. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  204. ThreadOver();
  205. return;
  206. }
  207. if (m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.PAUSED)
  208. {
  209. // stop button clicked
  210. loger.Info("DoMeasure: stop button is clicked.");
  211. // record end time
  212. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  213. while (m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.PAUSED)
  214. {
  215. Thread.Sleep(300);
  216. }
  217. //return;
  218. }
  219. if (!pSample.GetSwitch())
  220. {
  221. continue;
  222. }
  223. var sta = pSample.GetMsrStatus().GetStatus();
  224. if (sta == OTS_MSR_SAMPLE_STATUS.SUCCESSED || sta == OTS_MSR_SAMPLE_STATUS.STOPPED)
  225. {
  226. continue;
  227. }
  228. CSmplMeasure pSmplMeasure;
  229. if (!mapSmplMsr.ContainsKey(pSample.GetName()))
  230. {// create a sample measure object for the sample
  231. switch (m_pProjData.m_nPackId)
  232. {
  233. case OTS_SysType_ID.IncA:
  234. pSmplMeasure = new CSmplMeasureInclution(m_strWorkingFolder, pSample);
  235. break;
  236. case OTS_SysType_ID.CleannessA:
  237. pSmplMeasure = new CSmplMeasureCleanliness(m_strWorkingFolder, pSample);
  238. break;
  239. default:
  240. pSmplMeasure = new CSmplMeasureInclution(m_strWorkingFolder, pSample);
  241. break;
  242. }
  243. // set measure thread
  244. pSmplMeasure.SetMsrThread(this);
  245. mapSmplMsr[pSample.GetName()] = pSmplMeasure;
  246. }
  247. else
  248. {
  249. pSmplMeasure = mapSmplMsr[pSample.GetName()];
  250. pSample.GetMsrStatus().SetStatus(OTS_MSR_SAMPLE_STATUS.INPROCESS);
  251. m_ThreadStatus.SetStatus(OTS_MSR_THREAD_STATUS.INPROCESS);
  252. }
  253. pSmplMeasure.DoMeasureForOneSample();
  254. // check if measurement is successful
  255. if (pSample.GetMsrStatus().GetStatus() == OTS_MSR_SAMPLE_STATUS.PAUSED)
  256. {// record end time
  257. m_ThreadStatus.SetStatus(OTS_MSR_THREAD_STATUS.PAUSED);
  258. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  259. // update thread measure status class, let the main thread know that this sample measurement stopped
  260. ST_MSTMsg MsgSmpStop = new ST_MSTMsg();
  261. MsgSmpStop.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
  262. MsgSmpStop.STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.PAUSED;
  263. MsgSmpStop.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.PAUSED;
  264. MsgSmpStop.STMThreadStu.csMsrEndTime = DateTime.Now.ToShortDateString();
  265. MsgSmpStop.STMThreadStu.iMsrStatu = OTS_MSR_THREAD_STATUS.PAUSED;
  266. ProgressEvent(MsgSmpStop);
  267. ThreadOver();
  268. return;
  269. }else if (pSample.GetMsrStatus().GetStatus() == OTS_MSR_SAMPLE_STATUS.STOPPED)
  270. {// record end time
  271. m_ThreadStatus.SetStatus(OTS_MSR_THREAD_STATUS.STOPPED);
  272. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  273. // update thread measure status class, let the main thread know that this sample measurement stopped
  274. ST_MSTMsg MsgSmpStop = new ST_MSTMsg();
  275. MsgSmpStop.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
  276. MsgSmpStop.STMThreadStu.iMsrStatu= OTS_MSR_THREAD_STATUS.STOPPED;
  277. MsgSmpStop.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.STOPPED;
  278. MsgSmpStop.STMThreadStu.csMsrEndTime = DateTime .Now .ToShortDateString();
  279. MsgSmpStop.STMThreadStu.iMsrStatu= OTS_MSR_THREAD_STATUS.STOPPED;
  280. ProgressEvent(MsgSmpStop);
  281. ThreadOver();
  282. break;
  283. }
  284. else if (pSample.GetMsrStatus().GetStatus() == OTS_MSR_SAMPLE_STATUS.FAILED)
  285. {
  286. // measurement failed
  287. m_ThreadStatus.SetStatus(OTS_MSR_THREAD_STATUS.FAILED);
  288. // record end time
  289. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  290. // update thread measure status class, let the main thread know that this sample measurement failed
  291. ST_MSTMsg MsgSmpFailed=new ST_MSTMsg();
  292. MsgSmpFailed.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
  293. MsgSmpFailed.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.FAILED;
  294. ProgressEvent(MsgSmpFailed);
  295. ThreadOver();
  296. return;
  297. }
  298. // update thread measure status class, let the main thread know that this sample measurement successes
  299. ST_MSTMsg MsgSmpSuccess = new ST_MSTMsg();
  300. MsgSmpSuccess.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
  301. MsgSmpSuccess.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.SUCCESSED;
  302. ProgressEvent(MsgSmpSuccess);
  303. // continue to the next sample
  304. listMeasuredSamples.Add(pSample.GetName());
  305. }
  306. // measurement completed
  307. m_ThreadStatus.SetStatus(OTS_MSR_THREAD_STATUS.COMPLETED);
  308. // record end time
  309. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  310. ThreadOver();
  311. }
  312. //public bool DoReMeasure(List<Particle> particles, int imgscanspeed_index, int xrayscanmode_index, int scantime_count)
  313. //{
  314. // // got through measure list
  315. // foreach (var pSample in m_listMeasurableSamples)
  316. // {
  317. // // check and break if stop button is clicked
  318. // if (m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.STOPPED)
  319. // {
  320. // // stop button clicked
  321. // loger.Info("DoMeasure: stop button is clicked.");
  322. // // record end time
  323. // m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  324. // ThreadOver();
  325. // return false;
  326. // }
  327. // CSmplMeasure pSmplMeasure;
  328. // // create a sample measure object for the sample
  329. // switch (m_pProjData.m_nPackId)
  330. // {
  331. // case OTS_SysType_ID.IncA:
  332. // pSmplMeasure = new CSmplMeasureInclution(m_strWorkingFolder, pSample);
  333. // break;
  334. // case OTS_SysType_ID.CleannessA:
  335. // pSmplMeasure = new CSmplMeasureCleanliness(m_strWorkingFolder, pSample);
  336. // break;
  337. // default:
  338. // pSmplMeasure = new CSmplMeasureInclution(m_strWorkingFolder, pSample);
  339. // break;
  340. // }
  341. // // set measure thread
  342. // pSmplMeasure.SetMsrThread(this);
  343. // pSmplMeasure.DoMeasureForOneSample();
  344. // }
  345. // // measurement completed
  346. // m_ThreadStatus.SetStatus(OTS_MSR_THREAD_STATUS.COMPLETED);
  347. // // record end time
  348. // m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  349. // ThreadOver();
  350. // return true;
  351. //}
  352. // hole preview
  353. public void DoHolePreview(int a_nHoleID, CDomain a_pMeasureArea)
  354. {
  355. // start measurement, creat thread measure status class, let the main thread know that measurement started
  356. // set measure status to in-process
  357. //record time
  358. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.START);
  359. DateTime timeStart = m_ThreadStatus.GetStartTime();
  360. ST_MSTMsg MsgMsrStart = new ST_MSTMsg();
  361. MsgMsrStart.iMsgType = ENUM_MSG_TYPE.MTHREADSTATUS;
  362. MsgMsrStart.STMThreadStu.iMsrStatu =OTS_MSR_THREAD_STATUS.INPROCESS;
  363. SendMessageToMeasureApp(MsgMsrStart);
  364. // connect hardware
  365. if (!m_SemController.Connect())
  366. {
  367. // failed to connect hardware
  368. SetMsrLoopStatus(otsdataconst.OTS_MSR_THREAD_STATUS.FAILED);
  369. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  370. ThreadOverWithoutDisConnect();
  371. }
  372. COTSSample pSampleHole = CreateHoleSample(a_pMeasureArea);
  373. // create a sample measure object for the sample
  374. CSmplMeasure pSmplMeasure = new CSmplMeasureCleanliness(m_strWorkingFolder,pSampleHole);
  375. // set measure thread
  376. pSmplMeasure.SetMsrThread(this);
  377. // update thread measure status class, let the main thread know that this sample measurement starts
  378. // set working folder string
  379. pSmplMeasure.SetSample(pSampleHole);
  380. pSmplMeasure.SetWorkingFolder(m_strWorkingFolder);
  381. // do measure
  382. pSmplMeasure.DoHolePreview(a_nHoleID);
  383. // check if measurement is successful
  384. if (pSampleHole.GetMsrStatus().GetStatus() == OTS_MSR_SAMPLE_STATUS.STOPPED)
  385. {
  386. // record end time
  387. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  388. // measurement stopped
  389. SetMsrLoopStatus(otsdataconst.OTS_MSR_THREAD_STATUS.STOPPED);
  390. // update thread measure status class, let the main thread know that this sample measurement stopped
  391. ST_MSTMsg MsgSmpStop = new ST_MSTMsg();
  392. MsgSmpStop.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
  393. MsgSmpStop.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.STOPPED;
  394. SendMessageToMeasureApp(MsgSmpStop);
  395. ThreadOverWithoutDisConnect();
  396. return;
  397. }
  398. else if (pSampleHole.GetMsrStatus().GetStatus() == OTS_MSR_SAMPLE_STATUS.FAILED)
  399. {
  400. // measurement failed
  401. SetMsrLoopStatus(otsdataconst.OTS_MSR_THREAD_STATUS.FAILED);
  402. // record end time
  403. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  404. // update thread measure status class, let the main thread know that this sample measurement failed
  405. ST_MSTMsg MsgSmpFailed = new ST_MSTMsg();
  406. MsgSmpFailed.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
  407. MsgSmpFailed.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.FAILED;
  408. SendMessageToMeasureApp(MsgSmpFailed);
  409. ThreadOverWithoutDisConnect();
  410. return;
  411. }
  412. // record end time
  413. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  414. // update thread measure status class, let the main thread know that this sample measurement successes
  415. ST_MSTMsg MsgSmpSuccess = new ST_MSTMsg();
  416. MsgSmpSuccess.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
  417. MsgSmpSuccess.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.SUCCESSED;
  418. SendMessageToMeasureApp(MsgSmpSuccess);
  419. // measurement completed
  420. SetMsrLoopStatus(otsdataconst.OTS_MSR_THREAD_STATUS.COMPLETED);
  421. // record end time
  422. m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
  423. ThreadOverWithoutDisConnect();
  424. }
  425. public COTSSample CreateHoleSample(CDomain a_pMsrArea)
  426. {
  427. COTSSample pHoleSample = new COTSSample();
  428. pHoleSample.SetMsrArea(a_pMsrArea);
  429. // get min magnification
  430. CSEMStageData pSEMStageData = m_pProjData.GetSEMStageData();
  431. double dMinMag = pSEMStageData.GetMinMag();
  432. // get scan field size 100
  433. int nScanFieldSize100 = pSEMStageData.GetScanFieldSize100();
  434. // get working distance
  435. double dWorkingDistance = 0.0;
  436. if (!GetSEMWorkingDistanceFromHW(ref dWorkingDistance))
  437. {
  438. return null;
  439. }
  440. CSEMDataMsr poSEMDataMsr = new CSEMDataMsr();
  441. poSEMDataMsr.SetScanFieldSize100(nScanFieldSize100);
  442. poSEMDataMsr.SetWorkingDistance(dWorkingDistance);
  443. poSEMDataMsr.SetMagnification(dMinMag);
  444. pHoleSample.SetSEMDataMsr(poSEMDataMsr);
  445. // Set image scan param
  446. COTSImgScanPrm poImageScanParam = new COTSImgScanPrm();
  447. poImageScanParam.SetStopMode(((int)OTS_MEASURE_STOP_MODE.CoverMode).ToString());
  448. poImageScanParam.SetStartImageMode(OTS_GET_IMAGE_MODE.FROM_CENTER);
  449. poImageScanParam.SetScanImageSpeed(OTS_IMAGE_SCANSPEED_OPTIONS.low);
  450. //poImageScanParam.SetImagePixelSize(OTS_FIVE_TIES_OPTIONS.TIE1);
  451. CSampleParam poMsrParams = pHoleSample.GetMsrParams();
  452. poImageScanParam.SetImageResulotion(GetListMeasurableSamples()[0].GetMsrParams().GetImageScanParam().GetImageResulotion());//由于各样品分辨率应该一致,故此处没有读取选取的特定样品孔样品
  453. poMsrParams.SetImageScanParam(poImageScanParam);
  454. pHoleSample.SetMsrParams(poMsrParams);
  455. poMsrParams.GetImageProcessParam().SetOverlapParam(GetListMeasurableSamples()[0].GetMsrParams().GetImageProcessParam().GetOverlapParam());
  456. return pHoleSample;
  457. }
  458. public bool GetSEMWorkingDistanceFromHW(ref double a_dWorkingDistance)
  459. {
  460. m_SemController.GetWorkingDistance(ref a_dWorkingDistance);
  461. return true;
  462. }
  463. // measure status
  464. public void SetMsrLoopStatus(otsdataconst.OTS_MSR_THREAD_STATUS a_nMsrLoopStatus)
  465. {
  466. m_ThreadStatus.SetStatus( a_nMsrLoopStatus);
  467. }
  468. }
  469. }