|
@@ -53,28 +53,24 @@ namespace OxfordExtenderWrapper
|
|
|
private IAutoIdSettings autoIdSettings = null;
|
|
|
private ISEMQuantSettings quantSettings = null;
|
|
|
|
|
|
- private IEdChordListAcquisitionController _edsChordListController = null;
|
|
|
- private OxfordControllerState m_nState;
|
|
|
+ //private IEdChordListAcquisitionController _edsChordListController = null;
|
|
|
+ //private OxfordControllerState m_nState;
|
|
|
private IEdChordListSettings _edsChordListSetting;
|
|
|
private int XRayChannelLength = 2000;
|
|
|
|
|
|
private int EDSColletionTimeOut = 10000;
|
|
|
- private AutoResetEvent m_endControllerEvent;
|
|
|
+ //private AutoResetEvent m_endControllerEvent;
|
|
|
|
|
|
//当前feature的pixel数控制
|
|
|
- private long m_nCollectedPixelCounts;
|
|
|
- private long m_nPixelNum;
|
|
|
- private List<Element> m_listElementResult;
|
|
|
+ //private long m_nCollectedPixelCounts;
|
|
|
+ //private long m_nPixelNum;
|
|
|
+ //private List<Element> m_listElementResult;
|
|
|
|
|
|
|
|
|
const int g_nOxfordControllerProcessTime = 4;
|
|
|
const int g_nOxfordControllerEnergyRange = 20;
|
|
|
|
|
|
|
|
|
- // feature计数控制
|
|
|
- private long m_nXrayDataCount;
|
|
|
- private long m_nCollectedXrayCounts;
|
|
|
-
|
|
|
private bool m_bXrayDone = false;
|
|
|
//电压
|
|
|
private double m_dHighVoltage;
|
|
@@ -98,7 +94,7 @@ namespace OxfordExtenderWrapper
|
|
|
private double m_dStageR;
|
|
|
private double m_dStageT;
|
|
|
|
|
|
- private double m_dStageXMax;
|
|
|
+
|
|
|
|
|
|
//构造函数
|
|
|
public ExtenderWrapper1()
|
|
@@ -145,7 +141,6 @@ namespace OxfordExtenderWrapper
|
|
|
private void ControlerThread()
|
|
|
{
|
|
|
|
|
|
- log.Info("this has been initialized");
|
|
|
while (true)
|
|
|
{
|
|
|
|
|
@@ -156,7 +151,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
- //Thread.Sleep(50);
|
|
|
+
|
|
|
Application.DoEvents();
|
|
|
}
|
|
|
|
|
@@ -182,7 +177,7 @@ namespace OxfordExtenderWrapper
|
|
|
while (!m_StageUpdated)
|
|
|
{
|
|
|
Application.DoEvents();
|
|
|
- Thread.Sleep(100);
|
|
|
+
|
|
|
time2 = Environment.TickCount;
|
|
|
if (time2 - time1 > 20000)
|
|
|
{
|
|
@@ -210,9 +205,9 @@ namespace OxfordExtenderWrapper
|
|
|
imageAcquisitionController.BeginMultipleAcquisition();
|
|
|
IEnumerable<IElectronImage> images = imageAcquisitionController.StartAcquisition(imageAcquisitionSettings);
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
+ var time1 = Environment.TickCount;
|
|
|
while (true)
|
|
|
{
|
|
|
if (m_bAcquistionDone)
|
|
@@ -224,9 +219,9 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
Application.DoEvents();
|
|
|
|
|
|
- Thread.Sleep(100);
|
|
|
- lastingTime += 100;
|
|
|
- if (lastingTime > EDSColletionTimeOut * 6)
|
|
|
+
|
|
|
+ var time2 = Environment.TickCount;
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 6)
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
}
|
|
@@ -269,31 +264,36 @@ namespace OxfordExtenderWrapper
|
|
|
try
|
|
|
{
|
|
|
m_bXrayDone = false;
|
|
|
- int lastingTime = 0;
|
|
|
+ var time1 = Environment.TickCount;
|
|
|
|
|
|
IEdSpectrum edSpectrum = EdSpectrumAcquisitionController.StartAcquisition(EdSpectrumSettings);
|
|
|
|
|
|
|
|
|
while (true)
|
|
|
{
|
|
|
+
|
|
|
if (m_bXrayDone)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
currentCommand.returnType = true;
|
|
|
break;
|
|
|
}
|
|
|
Application.DoEvents();
|
|
|
|
|
|
- Thread.Sleep(100);
|
|
|
- lastingTime += 100;
|
|
|
- if (lastingTime > EDSColletionTimeOut * 3)
|
|
|
+ var time2 = Environment.TickCount;
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 2)
|
|
|
{
|
|
|
-
|
|
|
+ EdSpectrumAcquisitionController.EndMultipleAcquisition();
|
|
|
log.Warn("XrayStartAcquisition 超时!");
|
|
|
-
|
|
|
+
|
|
|
currentCommand.returnType = false;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
catch (InvalidSettingsException invalidSettingsException)
|
|
|
{
|
|
@@ -362,7 +362,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ var time1 = Environment.TickCount;
|
|
|
while (true)
|
|
|
{
|
|
|
if (m_bXrayDone)
|
|
@@ -372,9 +372,9 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
Application.DoEvents();
|
|
|
|
|
|
- Thread.Sleep(100);
|
|
|
- lastingTime += 100;
|
|
|
- if (lastingTime > EDSColletionTimeOut * 3)
|
|
|
+
|
|
|
+ var time2 = Environment.TickCount;
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 3)
|
|
|
{
|
|
|
EdSpectrumAcquisitionController.EndMultipleAcquisition();
|
|
|
log.Warn("XrayStartAcquisition 超时!");
|
|
@@ -388,7 +388,7 @@ namespace OxfordExtenderWrapper
|
|
|
case OxfordCommandType.XrayAreaCollection:
|
|
|
{
|
|
|
AreaXrayParam p = currentCommand.areaXrayPrm;
|
|
|
- log.Info("线程:开始面扫xray");
|
|
|
+
|
|
|
|
|
|
m_bXrayDone = false;
|
|
|
|
|
@@ -407,7 +407,7 @@ namespace OxfordExtenderWrapper
|
|
|
int lastingTime = 0;
|
|
|
IEdSpectrum edSpectrum = EdSpectrumAcquisitionController.StartAcquisition(EdSpectrumSettings);
|
|
|
|
|
|
-
|
|
|
+ var time1 = Environment.TickCount;
|
|
|
while (true)
|
|
|
{
|
|
|
if (m_bXrayDone)
|
|
@@ -417,10 +417,10 @@ namespace OxfordExtenderWrapper
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- Thread.Sleep(100);
|
|
|
+
|
|
|
Application.DoEvents();
|
|
|
- lastingTime += 100;
|
|
|
- if (lastingTime > EDSColletionTimeOut * 8)
|
|
|
+ var time2 = Environment.TickCount;
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 3)
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
|
|
@@ -446,9 +446,8 @@ namespace OxfordExtenderWrapper
|
|
|
case OxfordCommandType.COLLECT_XRAYFEATURES:
|
|
|
{
|
|
|
var p = currentCommand.XrayPrmForFeatures;
|
|
|
- currentCommand.AreaXrayDataReceived = 0;
|
|
|
- log.Info("线程:开始线扫xray");
|
|
|
- //m_XrayData = null;
|
|
|
+ currentCommand.AreaXrayDataReceived = 0;
|
|
|
+
|
|
|
m_bXrayDone = false;
|
|
|
int lastingTime = 0;
|
|
|
|
|
@@ -492,7 +491,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ var time1 = Environment.TickCount;
|
|
|
while (true)
|
|
|
{
|
|
|
if (m_bXrayDone)
|
|
@@ -501,11 +500,9 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
- Application.DoEvents();
|
|
|
-
|
|
|
- Thread.Sleep(100);
|
|
|
- lastingTime += 100;
|
|
|
- if (lastingTime > EDSColletionTimeOut * 3)
|
|
|
+ Application.DoEvents();
|
|
|
+ var time2 = Environment.TickCount;
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 3)
|
|
|
{
|
|
|
EdSpectrumAcquisitionController.EndMultipleAcquisition();
|
|
|
log.Warn("XrayStartAcquisition 超时!");
|
|
@@ -552,7 +549,7 @@ namespace OxfordExtenderWrapper
|
|
|
IEnumerable<IElectronImage> images = imageAcquisitionController.StartAcquisition(imageAcquisitionSettings);
|
|
|
|
|
|
|
|
|
-
|
|
|
+ var time1 = Environment.TickCount;
|
|
|
while (true)
|
|
|
{
|
|
|
if (m_bAcquistionDone)
|
|
@@ -565,8 +562,8 @@ namespace OxfordExtenderWrapper
|
|
|
Application.DoEvents();
|
|
|
|
|
|
Thread.Sleep(100);
|
|
|
- lastingTime += 100;
|
|
|
- if (lastingTime > EDSColletionTimeOut * 6)
|
|
|
+ var time2 = Environment.TickCount;
|
|
|
+ if (time2 - time1 > EDSColletionTimeOut * 6)
|
|
|
{
|
|
|
currentCommand.returnType = false;
|
|
|
break;
|
|
@@ -586,7 +583,7 @@ namespace OxfordExtenderWrapper
|
|
|
string msg = string.Format(@"AcquisitionStartException: {0}", startException.Message);
|
|
|
NLog.LogManager.GetCurrentClassLogger().Error(msg);
|
|
|
}
|
|
|
-
|
|
|
+ imageAcquisitionController.EndMultipleAcquisition();
|
|
|
if (currentCommand.returnType == true)
|
|
|
{
|
|
|
|
|
@@ -674,10 +671,19 @@ namespace OxfordExtenderWrapper
|
|
|
}
|
|
|
public bool CollectXrayByPoints(ref List<PointXrayParam> a_listPoints, uint a_nXRayAQTime, bool a_bElementInfo)
|
|
|
{
|
|
|
+ foreach (var prm in a_listPoints)
|
|
|
+ {
|
|
|
|
|
|
+ prm.b_quant = a_bElementInfo;
|
|
|
+ prm.dMilliSecondsTime = a_nXRayAQTime;
|
|
|
+ }
|
|
|
|
|
|
currentCommand.XrayPrmForPoints = a_listPoints;
|
|
|
- currentCommand.commandType = OxfordCommandType.COLLECT_XRAYPOINTS;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ currentCommand.commandType = OxfordCommandType.COLLECT_XRAYPOINTS;
|
|
|
startEvent.Set();
|
|
|
|
|
|
while (true)
|
|
@@ -702,7 +708,12 @@ namespace OxfordExtenderWrapper
|
|
|
public bool CollectXrayByFeatures(ref List<AreaXrayParam> a_listFeatures, double a_nXRayAQTime, bool a_bElementInfo)
|
|
|
{
|
|
|
|
|
|
+ foreach (var prm in a_listFeatures)
|
|
|
+ {
|
|
|
|
|
|
+ prm.b_quant = a_bElementInfo;
|
|
|
+ prm.dMilliSecondsTime = a_nXRayAQTime;
|
|
|
+ }
|
|
|
currentCommand.XrayPrmForFeatures = a_listFeatures;
|
|
|
|
|
|
|
|
@@ -747,10 +758,10 @@ namespace OxfordExtenderWrapper
|
|
|
void InitMicroscopeController()
|
|
|
{
|
|
|
this.microscopeController = AcquireFactory.CreateMicroscopeControl();
|
|
|
- this.microscopeController.ColumnChange += this.OnMicroscopeColumnChange;
|
|
|
- this.microscopeController.StageChange += this.OnMicroscopeStageChange;
|
|
|
- //this.microscopeController.ColumnConnected += this.OnMicroscopeColumnConnected;
|
|
|
- //this.microscopeController.StageConnected += this.OnMicroscopeStageConnected;
|
|
|
+ //this.microscopeController.ColumnChange += this.OnMicroscopeColumnChange;
|
|
|
+ //this.microscopeController.StageChange += this.OnMicroscopeStageChange;
|
|
|
+ this.microscopeController.ColumnConnected += this.OnMicroscopeColumnConnected;
|
|
|
+ this.microscopeController.StageConnected += this.OnMicroscopeStageConnected;
|
|
|
this.microscopeController.ChangeCompleted += this.OnMicroscopeChangeCompleted;
|
|
|
|
|
|
ReadMicroscopeColumn();
|
|
@@ -764,8 +775,8 @@ namespace OxfordExtenderWrapper
|
|
|
if (microscopeController != null)
|
|
|
{
|
|
|
|
|
|
- this.microscopeController.ColumnChange -= this.OnMicroscopeColumnChange;
|
|
|
- this.microscopeController.StageChange -= this.OnMicroscopeStageChange;
|
|
|
+ //this.microscopeController.ColumnChange -= this.OnMicroscopeColumnChange;
|
|
|
+ //this.microscopeController.StageChange -= this.OnMicroscopeStageChange;
|
|
|
this.microscopeController.ColumnConnected -= this.OnMicroscopeColumnConnected;
|
|
|
this.microscopeController.StageConnected -= this.OnMicroscopeStageConnected;
|
|
|
this.microscopeController.ChangeCompleted -= this.OnMicroscopeChangeCompleted;
|
|
@@ -824,12 +835,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)
|
|
@@ -852,20 +863,20 @@ namespace OxfordExtenderWrapper
|
|
|
private void OnMicroscopeColumnChange(object sender, EventArgs e)
|
|
|
{
|
|
|
|
|
|
- ReadMicroscopeColumn();
|
|
|
+ //ReadMicroscopeColumn();
|
|
|
}
|
|
|
|
|
|
//样品台控制改变事件
|
|
|
private void OnMicroscopeStageChange(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
- ReadStage();
|
|
|
+
|
|
|
+ //ReadStage();
|
|
|
}
|
|
|
|
|
|
//列控制连接或断开时的事件
|
|
|
private void OnMicroscopeColumnConnected(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+ ReadMicroscopeColumn();
|
|
|
}
|
|
|
|
|
|
//样品台控制连接或断开时的事件
|
|
@@ -1023,8 +1034,8 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
|
{
|
|
|
- { Stage.StageX, (double)stageX },
|
|
|
- { Stage.StageY, (double)stageY },
|
|
|
+ { Stage.StageX, (double)stageX/1000.0 },
|
|
|
+ { Stage.StageY, (double)stageY/1000.0 },
|
|
|
{ Stage.StageZ, (double)stageZ },
|
|
|
{ Stage.StageT, (double)stageT },
|
|
|
{ Stage.StageR, (double)stageR }
|
|
@@ -1061,7 +1072,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
|
{
|
|
|
- { Stage.StageX, (double)stageX }
|
|
|
+ { Stage.StageX, (double)stageX/1000.0 }
|
|
|
};
|
|
|
|
|
|
this.microscopeController.SetStageConditions(stageDictionary);
|
|
@@ -1075,7 +1086,7 @@ namespace OxfordExtenderWrapper
|
|
|
|
|
|
var stageDictionary = new Dictionary<Stage, double>
|
|
|
{
|
|
|
- { Stage.StageY, (double)stageY }
|
|
|
+ { Stage.StageY, (double)stageY/1000.0 }
|
|
|
};
|
|
|
|
|
|
this.microscopeController.SetStageConditions(stageDictionary);
|
|
@@ -1185,7 +1196,7 @@ namespace OxfordExtenderWrapper
|
|
|
imageAcquisitionController = AcquireFactory.CreateImageServer();
|
|
|
imageAcquisitionSettings = AcquireFactory.CreateImageSettings();
|
|
|
//imageAcquisitionSettings.
|
|
|
- imageAcquisitionController.ExperimentStarted += this.OnImageExperimentStarted;
|
|
|
+ //imageAcquisitionController.ExperimentStarted += this.OnImageExperimentStarted;
|
|
|
imageAcquisitionController.ExperimentFinished += this.OnImageExperimentFinished;
|
|
|
|
|
|
}
|
|
@@ -1206,7 +1217,7 @@ namespace OxfordExtenderWrapper
|
|
|
{
|
|
|
if (imageAcquisitionController != null)
|
|
|
{
|
|
|
- imageAcquisitionController.ExperimentStarted -= this.OnImageExperimentStarted;
|
|
|
+ //imageAcquisitionController.ExperimentStarted -= this.OnImageExperimentStarted;
|
|
|
imageAcquisitionController.ExperimentFinished -= this.OnImageExperimentFinished;
|
|
|
imageAcquisitionController = null;
|
|
|
}
|