|
@@ -1,5 +1,12 @@
|
|
|
-using Aitex.Core.RT.Routine;
|
|
|
+using Aitex.Core.RT.Device;
|
|
|
+using Aitex.Core.RT.Log;
|
|
|
+using Aitex.Core.RT.Routine;
|
|
|
+using Aitex.Core.RT.SCCore;
|
|
|
using CyberX8_Core;
|
|
|
+using CyberX8_RT.Devices.Facilities;
|
|
|
+using CyberX8_RT.Devices.Resistivity;
|
|
|
+using CyberX8_RT.Devices.Rinse;
|
|
|
+using MECF.Framework.Common.CommonData.Rinse;
|
|
|
using MECF.Framework.Common.Routine;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -11,15 +18,45 @@ namespace CyberX8_RT.Modules.Rinse
|
|
|
{
|
|
|
public class RinseKeepwetRoutine : RoutineBase, IRoutine
|
|
|
{
|
|
|
+ private const int LOTTRACK_TIME = 1000;
|
|
|
+ private const string DI_WATER_PRESSURE_VALUE = "DiWaterPressure";
|
|
|
private enum KeepwetStep
|
|
|
{
|
|
|
- LoopStart,
|
|
|
- LoopDelay,
|
|
|
- LoopEnd,
|
|
|
+ KeepWetStart,
|
|
|
+ KeepWetWait,
|
|
|
+ CloseFillValve,
|
|
|
+ KeepWetSlowDrain,
|
|
|
End
|
|
|
}
|
|
|
#region 内部变量
|
|
|
- private int _cycleCount = 100;
|
|
|
+ /// <summary>
|
|
|
+ /// 低于Clamp的水位
|
|
|
+ /// </summary>
|
|
|
+ private double _belowClampWaterLevel = 0;
|
|
|
+ /// <summary>
|
|
|
+ /// 设备对象
|
|
|
+ /// </summary>
|
|
|
+ private RinseDevice _device;
|
|
|
+ /// <summary>
|
|
|
+ /// 注满数值
|
|
|
+ /// </summary>
|
|
|
+ private int _sensorReadingFull;
|
|
|
+ /// <summary>
|
|
|
+ /// lock track time
|
|
|
+ /// </summary>
|
|
|
+ private DateTime _lotTackTime = DateTime.Now;
|
|
|
+ /// <summary>
|
|
|
+ /// LotTrack数据
|
|
|
+ /// </summary>
|
|
|
+ private List<RinseLotTrackData> _datas = new List<RinseLotTrackData>();
|
|
|
+ /// <summary>
|
|
|
+ /// LotTrack数据
|
|
|
+ /// </summary>
|
|
|
+ public List<RinseLotTrackData> RinseLotTrackDatas { get { return _datas; } }
|
|
|
+ /// <summary>
|
|
|
+ /// Facilities
|
|
|
+ /// </summary>
|
|
|
+ private SystemFacilities _facilities;
|
|
|
#endregion
|
|
|
/// <summary>
|
|
|
/// 构造函数
|
|
@@ -42,10 +79,12 @@ namespace CyberX8_RT.Modules.Rinse
|
|
|
/// <returns></returns>
|
|
|
public RState Monitor()
|
|
|
{
|
|
|
- Runner.LoopStart(KeepwetStep.LoopStart, "rinse keepwet", _cycleCount, NullFun, _delay_1ms)
|
|
|
- .LoopDelay(KeepwetStep.LoopDelay, _delay_60s)
|
|
|
- .LoopEnd(KeepwetStep.LoopEnd, NullFun, _delay_1ms)
|
|
|
- .End(KeepwetStep.End, NullFun, _delay_1ms);
|
|
|
+ LottrackRecord();
|
|
|
+ Runner.Run(KeepwetStep.KeepWetStart, () => _device.FillValveOn(), _delay_1ms)
|
|
|
+ .Wait(KeepwetStep.KeepWetWait, CheckFillFullStatus)
|
|
|
+ .Wait(KeepwetStep.CloseFillValve, () => _device.FillValveOff(), _delay_1ms)
|
|
|
+ .Wait(KeepwetStep.KeepWetSlowDrain, CheckDrainStatus)
|
|
|
+ .End(KeepwetStep.End, NullFun, _delay_1ms);
|
|
|
return Runner.Status;
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -55,7 +94,77 @@ namespace CyberX8_RT.Modules.Rinse
|
|
|
/// <returns></returns>
|
|
|
public RState Start(params object[] objs)
|
|
|
{
|
|
|
+ _belowClampWaterLevel = SC.GetValue<double>("QDR.QDRKeepWetBelowClampWaterLevel");
|
|
|
+ _sensorReadingFull = SC.GetValue<int>("QDR.SensorReadingFull");
|
|
|
+ _device = DEVICE.GetDevice<RinseDevice>(Module);
|
|
|
+ _facilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
|
|
|
+ if (_facilities == null)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_RINSE, Module, "Facility is null");
|
|
|
+ return RState.Failed;
|
|
|
+ }
|
|
|
+ _datas.Clear();
|
|
|
return Runner.Start(Module, "Start Rinse Keepwet");
|
|
|
}
|
|
|
+ /// 记录Lottrack
|
|
|
+ /// </summary>
|
|
|
+ private void LottrackRecord()
|
|
|
+ {
|
|
|
+ //记录Lottrack
|
|
|
+ if (DateTime.Now.Subtract(_lotTackTime).TotalMilliseconds >= LOTTRACK_TIME)
|
|
|
+ {
|
|
|
+ AddLotTrackData();
|
|
|
+ _lotTackTime = DateTime.Now;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 检验是否注满
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CheckFillFullStatus()
|
|
|
+ {
|
|
|
+ double currentWaterLevel = _device.RinseData.WaterLevel;
|
|
|
+ bool result = currentWaterLevel > _sensorReadingFull;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 检验是否排空
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CheckDrainStatus()
|
|
|
+ {
|
|
|
+ double currentWaterLevel = _device.RinseData.WaterLevel;
|
|
|
+ bool result = currentWaterLevel < _belowClampWaterLevel;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取Lot Track数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private void AddLotTrackData()
|
|
|
+ {
|
|
|
+ RinseLotTrackData data = new RinseLotTrackData();
|
|
|
+ data.TimeStamp = DateTime.Now;
|
|
|
+ data.WaterLevel = _device.RinseData.WaterLevel;
|
|
|
+ data.DIFillEnabled = _device.RinseData.FillValve;
|
|
|
+ data.DumpEnabled = _device.RinseData.DrainValve;
|
|
|
+ data.WaterPressure = _facilities.GetCommonLimitDataByName(DI_WATER_PRESSURE_VALUE).Value;
|
|
|
+ ResistivityController resistivityController = DEVICE.GetDevice<ResistivityController>(_device.RinseItem.ResistivityID);
|
|
|
+ if (resistivityController != null)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ data.Resistivity = double.Parse(resistivityController.ResisitivityValue.Trim());
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ data.Resistivity = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ _datas.Add(data);
|
|
|
+ }
|
|
|
}
|
|
|
}
|