|
@@ -5,12 +5,16 @@ using CyberX8_Core;
|
|
|
using CyberX8_RT.Devices.LinMot;
|
|
|
using CyberX8_RT.Devices.Prewet;
|
|
|
using MECF.Framework.Common.Alarm;
|
|
|
+using MECF.Framework.Common.CommonData.Prewet;
|
|
|
using MECF.Framework.Common.Routine;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace CyberX8_RT.Modules.Prewet
|
|
|
{
|
|
|
public class PrewetKeepWetRoutine : RoutineBase, IRoutine
|
|
|
{
|
|
|
+ private const int LOTTRACK_TIME = 1000;
|
|
|
private enum KeepwetStep
|
|
|
{
|
|
|
Idle_KeepwetPrepare,
|
|
@@ -29,6 +33,18 @@ namespace CyberX8_RT.Modules.Prewet
|
|
|
/// linmot axis
|
|
|
/// </summary>
|
|
|
private LinMotAxis _linMotAxis;
|
|
|
+ /// <summary>
|
|
|
+ /// Lottrack time
|
|
|
+ /// </summary>
|
|
|
+ private DateTime _lotTackTime = DateTime.Now;
|
|
|
+ /// <summary>
|
|
|
+ /// LotTrack数据
|
|
|
+ /// </summary>
|
|
|
+ private List<PrewetLotTrackData> _datas = new List<PrewetLotTrackData>();
|
|
|
+ /// <summary>
|
|
|
+ /// LotTrack数据
|
|
|
+ /// </summary>
|
|
|
+ public List<PrewetLotTrackData> PrewetLotTrackDatas { get { return _datas; } }
|
|
|
#endregion
|
|
|
/// <summary>
|
|
|
/// 构造函数
|
|
@@ -57,6 +73,7 @@ namespace CyberX8_RT.Modules.Prewet
|
|
|
/// <returns></returns>
|
|
|
public RState Monitor()
|
|
|
{
|
|
|
+ LottrackRecord();
|
|
|
Runner.Run(KeepwetStep.Idle_KeepwetPrepare, ResetLinmot, _delay_1ms)
|
|
|
.WaitWithStopCondition(KeepwetStep.Idle_KeepwetPrepareWait, CheckResetLinmotEndStatus, CheckResetLinmotStopStatus)
|
|
|
.Run(KeepwetStep.Idle_KeepWetStart, ExecuteWetScan, _delay_1s)
|
|
@@ -94,7 +111,12 @@ namespace CyberX8_RT.Modules.Prewet
|
|
|
/// <returns></returns>
|
|
|
private bool CheckResetLinmotStopStatus()
|
|
|
{
|
|
|
- return _linMotAxis.Status == RState.Failed || _linMotAxis.Status == RState.Timeout;
|
|
|
+ if(_linMotAxis.Status == RState.Failed || _linMotAxis.Status == RState.Timeout)
|
|
|
+ {
|
|
|
+ AddLotTrackData();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// execute Keep Wet Scan
|
|
@@ -178,6 +200,7 @@ namespace CyberX8_RT.Modules.Prewet
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ AddLotTrackData();
|
|
|
_prewetDevice.PumpValveClose();
|
|
|
return true;
|
|
|
}
|
|
@@ -226,7 +249,42 @@ namespace CyberX8_RT.Modules.Prewet
|
|
|
public RState Start(params object[] objs)
|
|
|
{
|
|
|
_prewetDevice = DEVICE.GetDevice<PrewetDevice>(Module);
|
|
|
+ _datas.Clear();
|
|
|
+ _lotTackTime = DateTime.Now;
|
|
|
return Runner.Start(Module, "Start Keepwet");
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 记录Lottrack
|
|
|
+ /// </summary>
|
|
|
+ private void LottrackRecord()
|
|
|
+ {
|
|
|
+ //记录Lottrack
|
|
|
+ if (DateTime.Now.Subtract(_lotTackTime).TotalMilliseconds >= LOTTRACK_TIME)
|
|
|
+ {
|
|
|
+ AddLotTrackData();
|
|
|
+ _lotTackTime = DateTime.Now;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取Lot Track数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private void AddLotTrackData()
|
|
|
+ {
|
|
|
+ PrewetLotTrackData data = new PrewetLotTrackData();
|
|
|
+ data.TimeStamp = DateTime.Now;
|
|
|
+ data.StateMachine = Runner.CurrentStep.ToString();
|
|
|
+ data.Pressure = _prewetDevice.PrewetPumpData.PumpPressureData.Value;
|
|
|
+ data.Flow = _prewetDevice.PrewetPumpData.PumpFlowData.Value;
|
|
|
+ data.PumpMode = _prewetDevice.PrewetPumpData.PumpModel;
|
|
|
+ data.PressureTarget = _prewetDevice.PrewetPumpData.PressureTarget;
|
|
|
+ data.CurrentScan = _linMotAxis.ScanCount;
|
|
|
+ data.ScanOn = _linMotAxis.IsMotorOn;
|
|
|
+ data.ValveState = _prewetDevice.PrewetPumpData.PumpValve;
|
|
|
+ data.PumpSpeed = _prewetDevice.LastPumpSpeed;
|
|
|
+ data.PumpControlCurrent = _prewetDevice.PrewetPumpData.PumpCurrent;
|
|
|
+
|
|
|
+ _datas.Add(data);
|
|
|
+ }
|
|
|
}
|
|
|
}
|