Sic02-new/Modules/Mainframe/LLs/SicLoadLock.cs

310 lines
8.9 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Aitex.Core.Common;
using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.IOCore;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using Aitex.Core.Util;
using Aitex.Sorter.Common;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Schedulers;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using System.Xml;
namespace Mainframe.LLs
{
public class SicLoadLock : LoadLock
{
public override bool EnableLift
{
get
{
return _enableLift;
}
}
private IoLift _lift;
private IoDoor _door;
private IoSensor _lid;
private IoValve _slowVentValve;
private IoValve _fastVentValve;
private IoValve _slowPumpValve;
private IoValve _fastPumpValve;
private IoValve _equalAtmVentValve;
private IoSensor _LLWaferPresence;
private IoPressureMeter3 _forelineGuage;
private IoPressureMeter3 _chamberGuage;
private R_TRIG _trigWafer = new R_TRIG();
private F_TRIG _trigNoWafer = new F_TRIG();
private DeviceTimer _timerJobDone = new DeviceTimer();
//private IoSensor _sensorAtm;
//private IoSensor _sensorVacuum;
//private IoSensor _sensorAboveAtm;
//private IoSensor _sensorBelowAtm;
public override double ChamberPressure
{
get
{
return _chamberGuage.Value;
}
}
public override double ForelinePressure
{
get
{
return _forelineGuage.Value;
}
}
public bool JobDone
{
get;set;
}
private bool _enableLift;
public SicLoadLock(string module, XmlElement node, string ioModule = "") : base(module)
{
var attrModule = node.GetAttribute("module");
base.Module = string.IsNullOrEmpty(attrModule) ? module : attrModule;
base.Name = node.GetAttribute("id");
base.Display = node.GetAttribute("display");
}
public override bool Initialize()
{
_slowPumpValve = DEVICE.GetDevice<IoValve>("TM.LLSlowRough");
_fastPumpValve = DEVICE.GetDevice<IoValve>("TM.LLFastRough");
_slowVentValve = DEVICE.GetDevice<IoValve>("TM.LLSlowVent");
_fastVentValve = DEVICE.GetDevice<IoValve>("TM.LLFastVent");
_lid = DEVICE.GetDevice<IoSensor>("TM.LLLidClosed");
_LLWaferPresence = DEVICE.GetDevice<IoSensor>("TM.LLWaferPresence");
_chamberGuage = DEVICE.GetDevice<IoPressureMeter3>("TM.LLPressure");
_forelineGuage = DEVICE.GetDevice<IoPressureMeter3>("TM.ForelinePressure");
DATA.Subscribe($"{Name}.JobDone", () => JobDone);
return base.Initialize();
}
public bool CheckLidClosed()
{
return _lid.Value == true;
}
public override bool CheckAtm()
{
return _chamberGuage.Value >= SC.GetValue<double>("LoadLock.AtmPressureBase");
////if (SC.GetValue<bool>("System.IsBypassIoATMSensor"))
////{
//// return _chamberGuage.Value > SC.GetValue<double>("LoadLock.AtmPressureBase");
////}
//return _sensorAtm.Value && !_sensorVacuum.Value &&
// _chamberGuage.Value > SC.GetValue<double>("LoadLock.AtmPressureBase");
}
public override bool CheckVacuum()
{
return _chamberGuage.Value <= SC.GetValue<double>("LoadLock.VacuumPressureBase");
//if (SC.GetValue<bool>("System.IsBypassIoATMSensor"))
//{
// return _chamberGuage.Value < SC.GetValue<double>("LoadLock.VacuumPressureBase");
//}
//return _sensorVacuum.Value && !_sensorAtm.Value &&
// _chamberGuage.Value < SC.GetValue<double>("LoadLock.VacuumPressureBase");
}
public override bool CheckIsPumping()
{
return _slowPumpValve.Status || _fastPumpValve.Status;
}
public override bool CheckDoorClose()
{
return CheckLidClosed(); // _door.IsClose;
}
public override bool CheckDoorOpen()
{
return !CheckLidClosed(); // _door.IsOpen;
}
public override bool SetLift(bool isUp, out string reason)
{
reason = string.Empty;
if (!_enableLift)
{
return true;
}
return _lift.Move(isUp, out reason);
}
public override bool CheckLiftDown()
{
if (!_enableLift)
{
return true;
}
return _lift.IsDown;
}
public override bool CheckLiftUp()
{
if (!_enableLift)
{
return true;
}
return _lift.IsUp;
}
public override bool SetDoor(bool isOpen, out string reason)
{
reason = string.Empty;
return true; // _door.SetDoor(isOpen, out reason);
}
public override bool SetSlowPumpValve(bool isOpen, out string reason)
{
return _slowPumpValve.TurnValve(isOpen, out reason);
}
public override bool SetFastPumpValve(bool isOpen, out string reason)
{
return _fastPumpValve.TurnValve(isOpen, out reason);
}
public override bool SetFastVentValve(bool isOpen, out string reason)
{
return _fastVentValve.TurnValve(isOpen, out reason);
}
public override bool SetSlowVentValve(bool isOpen, out string reason)
{
return _slowVentValve.TurnValve(isOpen, out reason);
}
public override bool SetEqualVentValve(bool isOpen, out string reason)
{
return _equalAtmVentValve.TurnValve(isOpen, out reason);
}
// lift up 对应 slot 0 lift down 对应 slot 1
public override bool SetLift(int slot, out string reason)
{
reason = string.Empty;
if (!_enableLift)
{
return true;
}
return SetLift(slot == 0, out reason);
}
public override bool CheckLift(int slot)
{
if (!_enableLift)
{
return true;
}
return slot == 0 ? CheckLiftUp() : CheckLiftDown();
}
public override bool CheckEnableTransfer(EnumTransferType type)
{
return CheckLiftUp() || CheckLiftDown();
}
public void SetJobDoneStatus()
{
EV.PostInfoLog(Module, "Set LoadLock Job Done!");
JobDone = true;
_timerJobDone.Start(30*1000);
}
int times = 0;
public override void Monitor()
{
if (_chamberGuage.Value >= SC.GetValue<double>("LoadLock.VentMaxPressure") && SC.GetValue<double>("LoadLock.VentMaxPressure")> SC.GetValue<double>("LoadLock.AtmPressureBase") && times>20)
{
if (_fastVentValve.Status)
{
SetFastVentValve(false, out string reason);
}
if (_slowVentValve.Status)
{
SetSlowVentValve(false, out string reason);
}
}
times++;
if (times > 22)
{
times = 0;
}
if (!CheckLidClosed())
{
_trigWafer.CLK = _LLWaferPresence.Value;
_trigNoWafer.CLK = _LLWaferPresence.Value;
if (_trigWafer.Q)
{
if (WaferManager.Instance.CheckNoWafer(ModuleName.LoadLock, 0))
{
WaferManager.Instance.CreateWafer(ModuleName.LoadLock, 0, WaferStatus.Normal);
}
_trigNoWafer.RST = true;
}
if (_trigNoWafer.Q)
{
if (WaferManager.Instance.CheckHasWafer(ModuleName.LoadLock, 0))
{
WaferManager.Instance.DeleteWafer(ModuleName.LoadLock, 0);
}
_trigWafer.RST = true;
}
}
//设置JobDone状态,10秒后恢复为false
if (_timerJobDone.IsTimeout())
{
JobDone = false;
_timerJobDone.Stop();
}
}
public override void Reset()
{
_trigWafer.RST = true;
_trigNoWafer.RST = true;
}
}
}