首次上传
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,180 @@
|
||||
|
||||
using MECF.Framework.RT.Core.IoProviders.Siemens;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Aitex.Core.RT.Event;
|
||||
using MECF.Framework.RT.Core.IoProviders.Siemens.Transfer;
|
||||
using MECF.Framework.RT.Core.IoProviders.Siemens.Net;
|
||||
|
||||
namespace SicRT.Equipments
|
||||
{
|
||||
/// <summary>
|
||||
/// DEMO程序的一些静态变量信息
|
||||
/// </summary>
|
||||
public class DemoUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// 统一的读取结果的数据解析,显示
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型对象</typeparam>
|
||||
/// <param name="result">读取的结果值</param>
|
||||
/// <param name="address">地址信息</param>
|
||||
/// <param name="textBox">输入的控件</param>
|
||||
//public static void ReadResultRender<T>(OperateResult<T> result, string address, TextBox textBox)
|
||||
//{
|
||||
// if (result.IsSuccess)
|
||||
// {
|
||||
// if (result.Content is Array)
|
||||
// {
|
||||
// textBox.AppendText(DateTime.Now.ToString("[HH:mm:ss] ") + $"[{address}] {SoftBasic.ArrayFormat(result.Content)}{Environment.NewLine}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// textBox.AppendText(DateTime.Now.ToString("[HH:mm:ss] ") + $"[{address}] {result.Content}{Environment.NewLine}");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// MessageBox.Show(DateTime.Now.ToString("[HH:mm:ss] ") + $"[{address}] Read Failed {Environment.NewLine}Reason:{result.ToMessageShowString()}");
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 统一的数据写入的结果显示
|
||||
/// </summary>
|
||||
/// <param name="result">写入的结果信息</param>
|
||||
/// <param name="address">地址信息</param>
|
||||
public static void WriteResultRender(OperateResult result, string address)
|
||||
{
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show(DateTime.Now.ToString("[HH:mm:ss] ") + $"[{address}] Write Success");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(DateTime.Now.ToString("[HH:mm:ss] ") + $"[{address}] Write Failed {Environment.NewLine} Reason:{result.ToMessageShowString()}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统一的数据写入的结果显示
|
||||
/// </summary>
|
||||
/// <param name="result">写入的结果信息</param>
|
||||
/// <param name="address">地址信息</param>
|
||||
public static void WriteResultRender(OperateResult result)
|
||||
{
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show(DateTime.Now.ToString("[HH:mm:ss] ") + $"Success");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(DateTime.Now.ToString("[HH:mm:ss] ") + $"Failed {Environment.NewLine} Reason:{result.ToMessageShowString()}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统一的数据写入的结果显示
|
||||
/// </summary>
|
||||
/// <param name="result">写入的结果信息</param>
|
||||
/// <param name="address">地址信息</param>
|
||||
public static void WriteResultRender(Func<OperateResult> write, string address)
|
||||
{
|
||||
try
|
||||
{
|
||||
OperateResult result = write();
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show(DateTime.Now.ToString("[HH:mm:ss] ") + $"[{address}] Write Success");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(DateTime.Now.ToString("[HH:mm:ss] ") + $"[{address}] Write Failed {Environment.NewLine} Reason:{result.ToMessageShowString()}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 主要是为了捕获写入的值不正确的情况
|
||||
MessageBox.Show("Data for writting is not corrent: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool BulkReadRenderResult(IReadWriteNet readWrite, string Adrress, ushort length,out byte[] data)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (readWrite == null)
|
||||
{
|
||||
data = null;
|
||||
return false;
|
||||
}
|
||||
OperateResult<byte[]> read = readWrite.Read(Adrress, length);// ushort.Parse(lengthTextBox.Text));
|
||||
if (read.IsSuccess)
|
||||
{
|
||||
data = read.Content;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
data = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// EV.PostAlarmLog ( ,"Read Failed:" + ex.Message);
|
||||
}
|
||||
|
||||
data = null;
|
||||
return false;
|
||||
}
|
||||
public static bool BulkWriteFloatRenderResult(IReadWriteNet readWrite, string Adrress, float data)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (readWrite == null)
|
||||
{
|
||||
data =0;
|
||||
return false;
|
||||
}
|
||||
OperateResult write = readWrite.Write(Adrress, data);
|
||||
|
||||
return write.IsSuccess;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// MessageBox.Show("Read Failed:" + ex.Message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool BulkWriteByteRenderResult(IReadWriteNet readWrite, string Adrress, byte[] data)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (readWrite == null)
|
||||
{
|
||||
data = null;
|
||||
return false;
|
||||
}
|
||||
OperateResult write = readWrite.Write(Adrress, data);
|
||||
return write.IsSuccess;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// MessageBox.Show("Read Failed:" + ex.Message);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static readonly string IpAddressInputWrong = "IpAddress input wrong";
|
||||
public static readonly string PortInputWrong = "Port input wrong";
|
||||
public static readonly string SlotInputWrong = "Slot input wrong";
|
||||
public static readonly string BaudRateInputWrong = "Baud rate input wrong";
|
||||
public static readonly string DataBitsInputWrong = "Data bit input wrong";
|
||||
public static readonly string StopBitInputWrong = "Stop bit input wrong";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.RT.Routine;
|
||||
using Aitex.Core.RT.SCCore;
|
||||
using Aitex.Core.Util;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using SicModules.Buffers;
|
||||
using SicModules.LLs;
|
||||
using SicModules.PMs;
|
||||
using SicModules.TMs;
|
||||
using SicRT.Equipments.Systems;
|
||||
|
||||
namespace SicRT.Modules
|
||||
{
|
||||
public class HomeAll
|
||||
{
|
||||
private bool IsPM2Install = SC.GetConfigItem("System.SetUp.IsPM2Installed").BoolValue;
|
||||
|
||||
List<List<IModuleDevice>> _lstModules = new List<List<IModuleDevice>>();
|
||||
List<IModuleDevice> _homingModules = new List<IModuleDevice>();
|
||||
|
||||
public HomeAll()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Result Start(params object[] objs)
|
||||
{
|
||||
if(Debugger.IsAttached)
|
||||
EV.PostInfoLog("System",
|
||||
"这是一个长字符串用于测试MainWindow的LOG下拉框是否约束了显示宽度这是一个长字符串用于测试MainWindow的LOG下拉框是否约束了显示宽度这是一个长字符串用于测试MainWindow的LOG下拉框是否约束了显示宽度");
|
||||
|
||||
_lstModules.Clear();
|
||||
_homingModules.Clear();
|
||||
|
||||
var dicModules = new Dictionary<string, bool>();
|
||||
|
||||
var tm = Singleton<EquipmentManager>.Instance.Modules[ModuleName.TM] as TMModule;
|
||||
List<IModuleDevice> lstA = new List<IModuleDevice>();
|
||||
if (tm.IsInstalled)
|
||||
{
|
||||
lstA.Add(Singleton<EquipmentManager>.Instance.Modules[ModuleName.TM] as IModuleDevice );
|
||||
dicModules.Add(tm.Module, tm.IsBusy);
|
||||
}
|
||||
|
||||
var lstModules = new List<IModuleDevice>();
|
||||
|
||||
_lstModules.Add(lstA);
|
||||
|
||||
|
||||
var ll = Singleton<EquipmentManager>.Instance.Modules[ModuleName.LoadLock] as LoadLockModule;
|
||||
if (ll.IsInstalled)
|
||||
{
|
||||
lstModules.Add(Singleton<EquipmentManager>.Instance.Modules[ModuleName.LoadLock] as IModuleDevice);
|
||||
dicModules.Add(ll.Module, ll.IsBusy);
|
||||
}
|
||||
|
||||
var buffer = Singleton<EquipmentManager>.Instance.Modules[ModuleName.Buffer] as BufferModule;
|
||||
if (buffer.IsInstalled)
|
||||
{
|
||||
lstModules.Add(Singleton<EquipmentManager>.Instance.Modules[ModuleName.Buffer] as IModuleDevice);
|
||||
dicModules.Add(buffer.Module, buffer.IsBusy);
|
||||
}
|
||||
|
||||
var pm1 = Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule;
|
||||
if (pm1.IsInstalled)
|
||||
{
|
||||
lstModules.Add(Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as IModuleDevice);
|
||||
dicModules.Add(pm1.Module, pm1.IsBusy);
|
||||
}
|
||||
|
||||
var pm2 = Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM2] as PMModule;
|
||||
if (pm2.IsInstalled)
|
||||
{
|
||||
lstModules.Add(Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM2] as IModuleDevice);
|
||||
dicModules.Add(pm2.Module, pm2.IsBusy);
|
||||
}
|
||||
|
||||
_lstModules.Add(lstModules);
|
||||
|
||||
|
||||
foreach (var item in dicModules)
|
||||
{
|
||||
if (item.Value)
|
||||
{
|
||||
EV.PostWarningLog("System", $"{item.Key} is busy,can not do Initialize");
|
||||
return Result.FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
public Result Monitor(params object[] objs)
|
||||
{
|
||||
if (_homingModules.Count == 0 && _lstModules.Count == 0)
|
||||
return Result.DONE;
|
||||
|
||||
if (_homingModules.Count > 0)
|
||||
{
|
||||
foreach (var module in _homingModules)
|
||||
{
|
||||
if (module.IsError)
|
||||
return Result.FAIL;
|
||||
|
||||
if (!module.IsReady)
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
_homingModules.Clear();
|
||||
if (_lstModules.Count == 0)
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
if (_homingModules.Count == 0)
|
||||
{
|
||||
foreach (var moduleEntity in _lstModules[0])
|
||||
{
|
||||
if (!moduleEntity.IsReady)
|
||||
{
|
||||
if (!moduleEntity.Home(out string reason))
|
||||
return Result.FAIL;
|
||||
|
||||
_homingModules.Add(moduleEntity);
|
||||
}
|
||||
}
|
||||
|
||||
_lstModules.RemoveAt(0);
|
||||
}
|
||||
|
||||
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_lstModules.Clear();
|
||||
_homingModules.Clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
using System.Collections.Generic;
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.RT.Routine;
|
||||
using Aitex.Sorter.Common;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.Schedulers;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicRT.Modules.Schedulers;
|
||||
|
||||
namespace SicRT.Equipments
|
||||
{
|
||||
public class MoveItemEx : MoveItem
|
||||
{
|
||||
public int CoolingTime { get; set; }
|
||||
|
||||
public MoveItemEx(ModuleName sourceModule, int sourceSlot, ModuleName destinationModule, int destinationSlot, int coolingTime)
|
||||
: base(sourceModule, sourceSlot, destinationModule, destinationSlot, Hand.Blade1)
|
||||
{
|
||||
CoolingTime = coolingTime;
|
||||
}
|
||||
}
|
||||
|
||||
public class ManualTransfer : SchedulerModuleFactory
|
||||
{
|
||||
private Queue<IRoutine> _moveTaskQueue = new Queue<IRoutine>();
|
||||
private IRoutine _activeTask;
|
||||
|
||||
public Result Start(object[] objs)
|
||||
{
|
||||
_moveTaskQueue.Clear();
|
||||
|
||||
ModuleName source = (ModuleName)objs[0];
|
||||
int sourceSlot = (int)objs[1];
|
||||
ModuleName target = (ModuleName)objs[2];
|
||||
int destinationSlot = (int)objs[3];
|
||||
|
||||
//判断传盘路径是否valid
|
||||
if (!CheckCanMoveRange(source, target))
|
||||
{
|
||||
EV.PostWarningLog("System", $"Invalid path,can not transfer from {source} to {target}");
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
//TM范围内传盘
|
||||
if (IsTmRobotRange(source) && IsTmRobotRange(target))
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasTray(source, sourceSlot))
|
||||
{
|
||||
EV.PostWarningLog("System", "source no tray");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!WaferManager.Instance.CheckNoTray(target, destinationSlot))
|
||||
{
|
||||
EV.PostWarningLog("System", "destination has tray");
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
_moveTaskQueue.Enqueue(new TmRobotMover(new MoveItemEx(source, sourceSlot, target, destinationSlot, 0)));
|
||||
}
|
||||
|
||||
_activeTask = _moveTaskQueue.Dequeue();
|
||||
|
||||
return _activeTask.Start();
|
||||
}
|
||||
|
||||
|
||||
public Result Monitor(object[] objs)
|
||||
{
|
||||
Result ret = _activeTask.Monitor();
|
||||
if (ret == Result.FAIL)
|
||||
return ret;
|
||||
|
||||
if (ret == Result.DONE)
|
||||
{
|
||||
if (_moveTaskQueue.Count > 0)
|
||||
{
|
||||
_activeTask = _moveTaskQueue.Dequeue();
|
||||
return _activeTask.Start();
|
||||
}
|
||||
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_moveTaskQueue.Clear();
|
||||
_activeTask = null;
|
||||
}
|
||||
|
||||
private bool IsTmRobotRange(ModuleName module)
|
||||
{
|
||||
return module == ModuleName.LoadLock || module == ModuleName.Load || ModuleHelper.IsPm(module)
|
||||
|| module == ModuleName.Buffer || module == ModuleName.TMRobot;
|
||||
}
|
||||
|
||||
private bool CheckCanMoveRange(ModuleName fromModule, ModuleName desModule)
|
||||
{
|
||||
if (IsTmRobotRange(fromModule) && IsTmRobotRange(desModule))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class TmRobotMover : SchedulerModuleFactory, IRoutine
|
||||
{
|
||||
private MoveItemEx _moveTask;
|
||||
|
||||
private SchedulerModule _source;
|
||||
private SchedulerModule _destination;
|
||||
|
||||
public TmRobotMover(MoveItemEx moveTask)
|
||||
{
|
||||
_moveTask = moveTask;
|
||||
}
|
||||
|
||||
public Result Start()
|
||||
{
|
||||
_source = GetModule(_moveTask.SourceModule.ToString());
|
||||
_destination = GetModule(_moveTask.DestinationModule.ToString());
|
||||
|
||||
System.Diagnostics.Debug.Assert(_source != null, $"{_moveTask.SourceModule} not valid");
|
||||
System.Diagnostics.Debug.Assert(_destination != null, $"{_moveTask.DestinationModule} not valid");
|
||||
|
||||
_source.ResetTask();
|
||||
_destination.ResetTask();
|
||||
_tmRobot.ResetTask();
|
||||
|
||||
if (!WaferManager.Instance.CheckHasTray(_moveTask.SourceModule, _moveTask.SourceSlot))
|
||||
{
|
||||
EV.PostWarningLog("System", $"Failed transfer, source {_moveTask.SourceModule} slot {_moveTask.SourceSlot + 1} has not tray");
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
if (WaferManager.Instance.CheckHasTray(_moveTask.DestinationModule, _moveTask.DestinationSlot))
|
||||
{
|
||||
EV.PostWarningLog("System", $"Failed transfer, destination {_moveTask.DestinationModule} slot {_moveTask.DestinationSlot + 1} has tray");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!_tmRobot.IsOnline)
|
||||
{
|
||||
EV.PostWarningLog("System", $"Failed transfer, TM is not online");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!_source.IsAvailable)
|
||||
{
|
||||
EV.PostWarningLog("System", $"Failed transfer, source {_moveTask.SourceModule} not ready");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!_destination.IsAvailable)
|
||||
{
|
||||
EV.PostWarningLog("System", $"Failed transfer, Destination {_moveTask.DestinationModule} not ready");
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
if (_moveTask.SourceModule == ModuleName.TMRobot)
|
||||
_moveTask.RobotHand = (Hand)_moveTask.SourceSlot;
|
||||
if (_moveTask.DestinationModule == ModuleName.TMRobot)
|
||||
_moveTask.RobotHand = (Hand)_moveTask.DestinationSlot;
|
||||
|
||||
return Result.RUN;
|
||||
}
|
||||
public Result Start(params object[] objs)
|
||||
{
|
||||
return this.Start();
|
||||
}
|
||||
|
||||
public Result Monitor()
|
||||
{
|
||||
if (_source.NoTray(_moveTask.SourceSlot) && _destination.HasTray(_moveTask.DestinationSlot) &&
|
||||
_tmRobot.IsAvailable)
|
||||
{
|
||||
if (_source.IsWaitTransfer(ModuleName.TMRobot))
|
||||
_source.StopWaitTransfer(ModuleName.TMRobot);
|
||||
|
||||
if (_destination.IsWaitTransfer(ModuleName.TMRobot))
|
||||
_destination.StopWaitTransfer(ModuleName.TMRobot);
|
||||
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
//Pick
|
||||
if (_moveTask.SourceModule != ModuleName.TMRobot)
|
||||
{
|
||||
if (_source.HasTray(_moveTask.SourceSlot))
|
||||
{
|
||||
if (!_source.IsAvailable)
|
||||
{
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return Result.RUN;
|
||||
|
||||
if (!_source.IsReadyForPick(ModuleName.TMRobot, _moveTask.SourceSlot))
|
||||
{
|
||||
if (!_source.PrepareTransfer(ModuleName.TMRobot, EnumTransferType.Pick, _moveTask.SourceSlot))
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
if (!_source.IsAvailable)
|
||||
{
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
if (!_tmRobot.HasTray((int)_moveTask.RobotHand))
|
||||
{
|
||||
if (!_tmRobot.Pick(_moveTask.SourceModule, _moveTask.SourceSlot, _moveTask.RobotHand))
|
||||
{
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
_source.WaitTransfer(ModuleName.TMRobot);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return Result.RUN;
|
||||
|
||||
if (_source.IsWaitTransfer(ModuleName.TMRobot))
|
||||
_source.StopWaitTransfer(ModuleName.TMRobot);
|
||||
}
|
||||
}
|
||||
|
||||
//Place
|
||||
if (_moveTask.DestinationModule != ModuleName.TMRobot)
|
||||
{
|
||||
if (!_destination.IsAvailable)
|
||||
return Result.RUN;
|
||||
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return Result.RUN;
|
||||
|
||||
if (_destination.NoTray(_moveTask.DestinationSlot))
|
||||
{
|
||||
if (!_destination.IsReadyForPlace(ModuleName.TMRobot, _moveTask.DestinationSlot))
|
||||
{
|
||||
if (!_destination.PrepareTransfer(ModuleName.TMRobot, EnumTransferType.Place,
|
||||
_moveTask.DestinationSlot))
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
if (!_destination.IsAvailable)
|
||||
return Result.RUN;
|
||||
|
||||
if (_tmRobot.HasTray((int)_moveTask.RobotHand))
|
||||
{
|
||||
if (!_tmRobot.Place(_moveTask.DestinationModule, _moveTask.DestinationSlot, _moveTask.RobotHand))
|
||||
return Result.FAIL;
|
||||
|
||||
_destination.WaitTransfer(ModuleName.TMRobot);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return Result.RUN;
|
||||
|
||||
if (_destination.IsWaitTransfer(ModuleName.TMRobot))
|
||||
_destination.StopWaitTransfer(ModuleName.TMRobot);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.RUN;
|
||||
}
|
||||
public void Abort()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_tmRobot.ResetTask();
|
||||
_source?.ResetTask();
|
||||
_destination?.ResetTask();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,757 @@
|
||||
using System.Collections.Generic;
|
||||
using Aitex.Core.Common;
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.RT.Routine;
|
||||
using Aitex.Core.RT.SCCore;
|
||||
using Aitex.Sorter.Common;
|
||||
using SicRT.Modules.Schedulers;
|
||||
using SicRT.Scheduler;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.Schedulers;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
|
||||
namespace SicRT.Modules
|
||||
{
|
||||
public class ReturnAllWafer : SchedulerModuleFactory
|
||||
{
|
||||
//private bool needAligner = false;
|
||||
Dictionary<ModuleName, int> _checkPosition = new Dictionary<ModuleName, int>()
|
||||
{
|
||||
{ModuleName.PM1, 1},
|
||||
{ModuleName.LoadLock, 1},
|
||||
{ModuleName.UnLoad, 1},
|
||||
{ModuleName.WaferRobot, 1},
|
||||
{ModuleName.TrayRobot, 1},
|
||||
{ModuleName.TMRobot, 1},
|
||||
{ModuleName.Aligner, 1},
|
||||
};
|
||||
|
||||
|
||||
public ReturnAllWafer()
|
||||
{
|
||||
}
|
||||
|
||||
public Result Start()
|
||||
{
|
||||
if (!_tmRobot.IsAvailable)
|
||||
{
|
||||
EV.PostWarningLog("Scheduler", "can not return wafer, TmRobort is not available!");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!_trayRobot.IsAvailable)
|
||||
{
|
||||
EV.PostWarningLog("Scheduler", "can not return wafer, TrayRobort is not available!");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!_waferRobot.IsAvailable)
|
||||
{
|
||||
EV.PostWarningLog("Scheduler", "can not return wafer, WaferRobort is not available!");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!_load.IsAvailable)
|
||||
{
|
||||
EV.PostWarningLog("Scheduler", "can not return wafer, Load is not available!");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!_unload.IsAvailable)
|
||||
{
|
||||
EV.PostWarningLog("Scheduler", "can not return wafer, UnLoad is not available!");
|
||||
return Result.FAIL;
|
||||
}
|
||||
if (!_buffer.IsAvailable)
|
||||
{
|
||||
EV.PostWarningLog("Scheduler", "can not return wafer, Buffer is not available!");
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
public Result Monitor()
|
||||
{
|
||||
MonitorModuleTasks();
|
||||
|
||||
if (MonitorTaskDone())
|
||||
{
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
public Result MonitorModuleTasks()
|
||||
{
|
||||
//Load和UnLoad不能同时抽气
|
||||
//System.Diagnostics.Debug.Assert(!((_tmRobot.IsInPumping && _load.IsInPumping) || (_tmRobot.IsInPumping && _unload.IsInPumping) || (_unload.IsInPumping && _load.IsInPumping)), $"检测到 _load.IsInPumping :{_load.IsInPumping}, _unload.IsInPumping :{_unload.IsInPumping}, _tmRobot.IsInPumping :{_tmRobot.IsInPumping}");
|
||||
|
||||
|
||||
MonitorPMTask();
|
||||
MonitorLoadTask();
|
||||
MonitorUnLoadTask();
|
||||
MonitorBufferTask();
|
||||
MonitorAlignerTask();
|
||||
|
||||
MonitorTmRobotTask();
|
||||
MonitorWaferRobotTask();
|
||||
MonitorTrayRobotTask();
|
||||
|
||||
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
private bool MonitorTaskDone()
|
||||
{
|
||||
foreach (var positions in _checkPosition)
|
||||
{
|
||||
for (int i = 0; i < positions.Value; i++)
|
||||
{
|
||||
if (CheckWaferCouldBeReturn(positions.Key, i))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_buffer.HasWafer(0) || _buffer.HasWafer(1) || _buffer.HasWafer(2))
|
||||
return false;
|
||||
if (_buffer.HasTrayAndExceedProcessCount(0) || _buffer.HasTrayAndExceedProcessCount(1) || _buffer.HasTrayAndExceedProcessCount(2))
|
||||
return false;
|
||||
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return false;
|
||||
if (!_waferRobot.IsAvailable)
|
||||
return false;
|
||||
if (!_trayRobot.IsAvailable)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void MonitorTmRobotTask()
|
||||
{
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
foreach (var pm in _lstPms)
|
||||
{
|
||||
if (pm.IsWaitTransfer(ModuleName.TMRobot))
|
||||
pm.StopWaitTransfer(ModuleName.TMRobot);
|
||||
}
|
||||
|
||||
if (_buffer.IsWaitTransfer(ModuleName.TMRobot))
|
||||
_buffer.StopWaitTransfer(ModuleName.TMRobot);
|
||||
|
||||
if (_load.IsWaitTransfer(ModuleName.TMRobot))
|
||||
_load.StopWaitTransfer(ModuleName.TMRobot);
|
||||
|
||||
if (_unload.IsWaitTransfer(ModuleName.TMRobot))
|
||||
_unload.StopWaitTransfer(ModuleName.TMRobot);
|
||||
|
||||
MonitorTmRobotPMTask();
|
||||
|
||||
MonitorTmRobotBufferTask();
|
||||
|
||||
MonitorTmRobotLoadTask();
|
||||
|
||||
MonitorTmRobotUnLoadTask();
|
||||
}
|
||||
|
||||
private void MonitorWaferRobotTask()
|
||||
{
|
||||
foreach (var cass in _lstWaferCassettes)
|
||||
{
|
||||
if (cass.IsWaitTransfer(ModuleName.WaferRobot))
|
||||
cass.StopWaitTransfer(ModuleName.WaferRobot);
|
||||
}
|
||||
|
||||
if (_aligner.IsWaitTransfer(ModuleName.WaferRobot))
|
||||
_aligner.StopWaitTransfer(ModuleName.WaferRobot);
|
||||
|
||||
if (_load.IsWaitTransfer(ModuleName.WaferRobot))
|
||||
_load.StopWaitTransfer(ModuleName.WaferRobot);
|
||||
|
||||
if (_unload.IsWaitTransfer(ModuleName.WaferRobot))
|
||||
_unload.StopWaitTransfer(ModuleName.WaferRobot);
|
||||
|
||||
MonitorWaferRobotCassetteTask();
|
||||
MonitorWaferRobotAligerTask();
|
||||
MonitorWaferRobotLoadTask();
|
||||
MonitorWaferRobotUnLoadTask();
|
||||
}
|
||||
|
||||
private void MonitorTrayRobotTask()
|
||||
{
|
||||
if (_cassetteBL.IsWaitTransfer(ModuleName.TrayRobot))
|
||||
_cassetteBL.StopWaitTransfer(ModuleName.TrayRobot);
|
||||
|
||||
if (_load.IsWaitTransfer(ModuleName.TrayRobot))
|
||||
_load.StopWaitTransfer(ModuleName.TrayRobot);
|
||||
|
||||
MonitorTrayRobotLoadTask();
|
||||
|
||||
MonitorTrayRobotCassetteTask();
|
||||
}
|
||||
|
||||
|
||||
private void MonitorTmRobotLoadTask()
|
||||
{
|
||||
if (!_load.IsAvailable)
|
||||
return;
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
//place Robot有次数耗尽的Tray无Wafer,Load无Tray
|
||||
bool canPlace = _tmRobot.HasTrayAndExceedProcessCount(0) && _tmRobot.NoWafer(0) && _load.NoTray(0);
|
||||
if (canPlace)
|
||||
{
|
||||
if (_load.IsReadyForPlace(ModuleName.TMRobot, 0))
|
||||
{
|
||||
if (_tmRobot.Place(_load.Module, 0, Hand.Blade1))
|
||||
{
|
||||
_load.WaitTransfer(ModuleName.TMRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorTmRobotUnLoadTask()
|
||||
{
|
||||
if (!_unload.IsAvailable)
|
||||
return;
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
//UnLoad取盘只关心LoadLock是否有空位
|
||||
|
||||
//place Robot有Wafer,UnLoad无Tray无Wafer
|
||||
bool canPlaceUnLoad = _tmRobot.HasWafer(0)
|
||||
&& _unload.NoTray(0)
|
||||
&& _unload.NoWafer(0);
|
||||
if (canPlaceUnLoad)
|
||||
{
|
||||
if (_unload.IsReadyForPlace(ModuleName.TMRobot, 0))
|
||||
{
|
||||
if (_tmRobot.Place(_unload.Module, 0, Hand.Blade1))
|
||||
{
|
||||
_unload.WaitTransfer(ModuleName.TMRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!_unload.IsAvailable)
|
||||
return;
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
//pick UnLoad有Tray,TM无Tray,UnLoad分离完成
|
||||
bool canPickUnLoad = _tmRobot.NoTray(0)
|
||||
&& _unload.HasTray(0)
|
||||
&& _unload.CheckWaferTraySeparated();
|
||||
if (canPickUnLoad)
|
||||
{
|
||||
if (_unload.IsReadyForPick(ModuleName.TMRobot, 0) && !_load.IsInPumping)
|
||||
{
|
||||
if (_tmRobot.Pick(_unload.Module, 0, Hand.Blade1))
|
||||
{
|
||||
_unload.WaitTransfer(ModuleName.TMRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorTmRobotBufferTask()
|
||||
{
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return;
|
||||
if (!_buffer.IsAvailable)
|
||||
return;
|
||||
|
||||
//place 次数未耗尽的Tray放入Buffer中
|
||||
bool canPalce = _tmRobot.NoWafer(0) && _tmRobot.HasTrayAndNotExceedProcessCount(0);
|
||||
if (canPalce)
|
||||
{
|
||||
SlotItem bufferEmptySlot = null;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (_buffer.NoTray(i) && _buffer.NoWafer(i))
|
||||
{
|
||||
bufferEmptySlot = new SlotItem(ModuleName.Buffer, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bufferEmptySlot == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_buffer.IsReadyForPlace(ModuleName.TMRobot, bufferEmptySlot.Slot))
|
||||
{
|
||||
if (_tmRobot.Place(_buffer.Module, bufferEmptySlot.Slot, Hand.Blade1))
|
||||
{
|
||||
_buffer.WaitTransfer(ModuleName.TMRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return;
|
||||
if (!_buffer.IsAvailable)
|
||||
return;
|
||||
|
||||
//pick 当前步(UnLoad没有Wafer),Buffer有Tray,机械手没有Tray
|
||||
bool canPick = _tmRobot.NoTray(0) && _unload.NoTray(0) && _unload.NoWafer(0);
|
||||
if (canPick)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (_buffer.HasTray(i) && _buffer.HasWafer(i))
|
||||
{
|
||||
if (_buffer.IsReadyForPick(ModuleName.TMRobot, i))
|
||||
{
|
||||
if (_tmRobot.Pick(_buffer.Module, i, Hand.Blade1))
|
||||
{
|
||||
_buffer.WaitTransfer(ModuleName.TMRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_buffer.HasTrayAndExceedProcessCount(i))
|
||||
{
|
||||
if (_buffer.IsReadyForPick(ModuleName.TMRobot, i))
|
||||
{
|
||||
if (_tmRobot.Pick(_buffer.Module, i, Hand.Blade1))
|
||||
{
|
||||
_buffer.WaitTransfer(ModuleName.TMRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void MonitorTmRobotPMTask()
|
||||
{
|
||||
if (!_tmRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
//pick from pm
|
||||
if (_tmRobot.NoWafer(0) && _tmRobot.NoTray(0) && _unload.NoWafer(0) && _unload.NoTray(0))
|
||||
{
|
||||
Hand pickBlade = Hand.Blade1;
|
||||
|
||||
ModuleName pickPm = ModuleName.System;
|
||||
foreach (var schedulerPm in _lstPms)
|
||||
{
|
||||
//增加温度低于900才能Pick的限制
|
||||
if (!schedulerPm.IsAvailable
|
||||
|| GetModule(schedulerPm.Module).NoWafer(0)
|
||||
|| _tmRobot.HasWafer((int)pickBlade))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!schedulerPm.CheckPMToTMRobotTemp())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
pickPm = schedulerPm.Module;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pickPm != ModuleName.System)
|
||||
{
|
||||
SchedulerModule pm = GetModule(pickPm.ToString());
|
||||
if (pm.IsReadyForPick(ModuleName.TMRobot, 0))
|
||||
{
|
||||
if (_tmRobot.Pick(pm.Module, 0, pickBlade))
|
||||
{
|
||||
pm.WaitTransfer(ModuleName.TMRobot);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorWaferRobotLoadTask()
|
||||
{
|
||||
if (!_waferRobot.IsAvailable)
|
||||
return;
|
||||
if (!_load.IsAvailable)
|
||||
return;
|
||||
|
||||
bool canPick = _waferRobot.NoWafer(0)
|
||||
&& _load.HasWafer(0);
|
||||
//&& _load.CheckWaferTraySeparated();
|
||||
|
||||
if (canPick)
|
||||
{
|
||||
if (_load.IsReadyForPick(ModuleName.WaferRobot, 0))
|
||||
{
|
||||
if (_waferRobot.Pick(_load.Module, 0, Hand.Blade1))
|
||||
{
|
||||
_load.WaitTransfer(ModuleName.WaferRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorWaferRobotUnLoadTask()
|
||||
{
|
||||
if (!_waferRobot.IsAvailable)
|
||||
return;
|
||||
if (!_unload.IsAvailable)
|
||||
return;
|
||||
|
||||
//pick UnLoad有Wafer没有Tray,Robot没有Wafer,步骤都完成了或者下一步的模块没有片子 (其它:UnLoad 夹爪夹住,顶针下降,SlitValve都关了,大气)
|
||||
bool canPick = _waferRobot.NoWafer(0)
|
||||
&& _unload.HasWafer(0)
|
||||
&& _unload.NoTray(0);
|
||||
|
||||
if (canPick)
|
||||
{
|
||||
if (_unload.IsReadyForPick(ModuleName.WaferRobot, 0))
|
||||
{
|
||||
if (_waferRobot.Pick(_unload.Module, 0, Hand.Blade1))
|
||||
{
|
||||
_unload.WaitTransfer(ModuleName.WaferRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorWaferRobotAligerTask()
|
||||
{
|
||||
if (_load.HasWafer(0) && _load.GetWaferInfo(0).NextStation != (int)ModuleName.Aligner)
|
||||
_load.GetWaferInfo(0).NextStation = (int)ModuleName.Aligner;
|
||||
|
||||
if (_unload.HasWafer(0) && _unload.GetWaferInfo(0).NextStation != (int)ModuleName.Aligner)
|
||||
_unload.GetWaferInfo(0).NextStation = (int)ModuleName.Aligner;
|
||||
|
||||
if (_waferRobot.HasWafer(0) && _waferRobot.GetWaferInfo(0).NextStation != (int)ModuleName.Aligner && _waferRobot.GetWaferInfo(0).NextStation != (int)ModuleName.System)
|
||||
_waferRobot.GetWaferInfo(0).NextStation = (int)ModuleName.Aligner;
|
||||
|
||||
if (!_waferRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
if (!_aligner.IsAvailable)
|
||||
return;
|
||||
|
||||
//place 任务还没完成,下一步是Aligner,Robot有片子,Aligner没片子
|
||||
bool canPlaceAligner = _aligner.NoWafer(0)
|
||||
&& _waferRobot.HasWafer(0)
|
||||
&& _waferRobot.GetWaferInfo(0).NextStation == (int)ModuleName.Aligner;
|
||||
if (canPlaceAligner)
|
||||
{
|
||||
if (_aligner.IsReadyForPlace(ModuleName.WaferRobot, 0))
|
||||
{
|
||||
if (_waferRobot.Place(_aligner.Module, 0, Hand.Blade1))
|
||||
{
|
||||
_aligner.WaitTransfer(ModuleName.WaferRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!_waferRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
if (!_aligner.IsAvailable)
|
||||
return;
|
||||
|
||||
//pick Robot没片子,Aligner有片子
|
||||
bool canPickAligner = _aligner.HasWafer(0)
|
||||
&& _waferRobot.NoWafer(0);
|
||||
|
||||
if (canPickAligner)
|
||||
{
|
||||
if (_aligner.IsReadyForPick(ModuleName.WaferRobot, 0))
|
||||
{
|
||||
if (_waferRobot.Pick(_aligner.Module, 0, Hand.Blade1))
|
||||
{
|
||||
_aligner.WaitTransfer(ModuleName.WaferRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorWaferRobotCassetteTask()
|
||||
{
|
||||
if (!_waferRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
//place
|
||||
bool canPlaceCassette = _waferRobot.HasWafer(0)&& _waferRobot.GetWaferInfo(0).NextStation!=(int)ModuleName.Aligner;
|
||||
if (canPlaceCassette)
|
||||
{
|
||||
var wafer = _waferRobot.GetWaferInfo(0);
|
||||
if (wafer.WaferOriginStation == ModuleName.CassAL.ToString())
|
||||
{
|
||||
if (_cassetteAL.IsReadyForPlace(ModuleName.WaferRobot, wafer.WaferOriginSlot) && WaferManager.Instance.CheckNoWafer(ModuleName.CassAL, wafer.WaferOriginSlot))
|
||||
{
|
||||
if (_waferRobot.Place(_cassetteAL.Module, wafer.WaferOriginSlot, Hand.Blade1))
|
||||
{
|
||||
_cassetteAL.WaitTransfer(ModuleName.WaferRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (wafer.WaferOriginStation == ModuleName.CassAR.ToString())
|
||||
{
|
||||
if (_cassetteAR.IsReadyForPlace(ModuleName.WaferRobot, wafer.WaferOriginSlot) && WaferManager.Instance.CheckNoWafer(ModuleName.CassAR, wafer.WaferOriginSlot))
|
||||
{
|
||||
if (_waferRobot.Place(_cassetteAR.Module, wafer.WaferOriginSlot, Hand.Blade1))
|
||||
{
|
||||
_cassetteAR.WaitTransfer(ModuleName.WaferRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorTrayRobotLoadTask()
|
||||
{
|
||||
if (!_trayRobot.IsAvailable)
|
||||
return;
|
||||
if (!_load.IsAvailable)
|
||||
return;
|
||||
|
||||
//先取Wafer再取石墨盘
|
||||
bool canPick = _load.HasTray(0) && _load.NoWafer(0);
|
||||
if (canPick)
|
||||
{
|
||||
SlotItem emptyTraySlot = GetTrayOrignSlot(ModuleName.LoadLock, 0);
|
||||
if (emptyTraySlot != null)
|
||||
{
|
||||
if (_load.IsReadyForPick(ModuleName.TrayRobot, 0))
|
||||
{
|
||||
if (_trayRobot.Pick(_load.Module, 0, Hand.Blade1))
|
||||
{
|
||||
_load.WaitTransfer(ModuleName.TrayRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void MonitorTrayRobotCassetteTask()
|
||||
{
|
||||
if (!_trayRobot.IsAvailable)
|
||||
return;
|
||||
|
||||
if (!_cassetteBL.IsAvailable)
|
||||
return;
|
||||
|
||||
//place Robot有盘 其它逻辑跟Load的Pick一致
|
||||
bool canPlace = _trayRobot.HasTray(0);
|
||||
if (canPlace)
|
||||
{
|
||||
SlotItem slotItem = GetTrayOrignSlot(ModuleName.TrayRobot, 0); //GetEmptyTraySlot(13);
|
||||
if (slotItem != null)
|
||||
{
|
||||
if (_cassetteBL.IsReadyForPlace(ModuleName.TrayRobot, slotItem.Slot))
|
||||
{
|
||||
if (_trayRobot.Place(slotItem.Module, slotItem.Slot, Hand.Blade1))
|
||||
{
|
||||
_cassetteBL.WaitTransfer(ModuleName.TrayRobot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void MonitorBufferTask()
|
||||
{
|
||||
if (!_buffer.IsAvailable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_buffer.IsReadyForPick(ModuleName.TMRobot, 0))
|
||||
{
|
||||
_buffer.PrepareTransfer(ModuleName.TMRobot, EnumTransferType.Place, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorAlignerTask()
|
||||
{
|
||||
if (!_aligner.IsAvailable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_aligner.HasWafer(0) && _aligner.GetWaferInfo(0).NextStation==(int)ModuleName.Aligner)
|
||||
{
|
||||
_aligner.Aligning();
|
||||
_aligner.GetWaferInfo(0).NextStation = (int)ModuleName.System;
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorPMTask()
|
||||
{
|
||||
foreach (var pm in _lstPms)
|
||||
{
|
||||
if (!pm.IsAvailable)
|
||||
continue;
|
||||
if (pm.NoTray(0) && pm.NoWafer(0))
|
||||
continue;
|
||||
|
||||
if (!pm.IsReadyForPick(ModuleName.TMRobot, 0))
|
||||
{
|
||||
pm.PrepareTransfer(ModuleName.TMRobot, EnumTransferType.Pick, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MonitorLoadTask()
|
||||
{
|
||||
if (!_load.IsAvailable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//bool canExcute = _load.HasWafer(0) ;
|
||||
//if (canExcute)
|
||||
//{
|
||||
// if (!_load.CheckWaferTraySeparated())
|
||||
// {
|
||||
// _load.SeparateWaferTray();
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
if (_load.HasWafer(0))
|
||||
{
|
||||
if (/*_load.CheckWaferTraySeparated() &&*/ !_load.IsReadyForPick(ModuleName.WaferRobot, 0) && !_unload.IsInPumping && !_tmRobot.IsInPumping)
|
||||
{
|
||||
_load.PrepareTransfer(ModuleName.WaferRobot, EnumTransferType.Pick, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (_load.HasTray(0))
|
||||
{
|
||||
if (/*_load.CheckWaferTraySeparated() &&*/ !_load.IsReadyForPick(ModuleName.TrayRobot, 0) && !_unload.IsInPumping && !_tmRobot.IsInPumping)
|
||||
{
|
||||
_load.PrepareTransfer(ModuleName.TrayRobot, EnumTransferType.Pick, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
else if (_tmRobot.HasTrayAndExceedProcessCount(0) && _tmRobot.NoWafer(0))
|
||||
{
|
||||
if (!_load.IsReadyForPlace(ModuleName.TMRobot, 0) && !_unload.IsInPumping && !_tmRobot.IsInPumping)
|
||||
{
|
||||
_load.PrepareTransfer(ModuleName.TMRobot, EnumTransferType.Place, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void MonitorUnLoadTask()
|
||||
{
|
||||
if (!_unload.IsAvailable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool canExcuteUnLoad = _unload.HasWafer(0);
|
||||
if (canExcuteUnLoad)
|
||||
{
|
||||
if (!_unload.CheckWaferTraySeparated())
|
||||
{
|
||||
_unload.SeparateWaferTray();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (_unload.HasTray(0))
|
||||
{
|
||||
if (/*_unload.CheckWaferTraySeparated() && */!_unload.IsReadyForPick(ModuleName.TMRobot, 0) && !_load.IsInPumping && !_tmRobot.IsInPumping)
|
||||
{
|
||||
_unload.PrepareTransfer(ModuleName.TMRobot, EnumTransferType.Pick, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (_unload.HasWafer(0))
|
||||
{
|
||||
if (_unload.CheckWaferTraySeparated() && !_unload.IsReadyForPick(ModuleName.WaferRobot, 0) && !_load.IsInPumping && !_tmRobot.IsInPumping)
|
||||
{
|
||||
_unload.PrepareTransfer(ModuleName.WaferRobot, EnumTransferType.Pick, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_unload.IsReadyForPlace(ModuleName.TMRobot, 0) && !_load.IsInPumping && !_tmRobot.IsInPumping)
|
||||
{
|
||||
_unload.PrepareTransfer(ModuleName.TMRobot, EnumTransferType.Place, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SlotItem GetEmptyTraySlot()
|
||||
{
|
||||
for (int i = 0; i < WaferManager.Instance.GetWafers(ModuleName.CassBL).Length; i++)
|
||||
{
|
||||
if (WaferManager.Instance.CheckNoTray(ModuleName.CassBL, i))
|
||||
{
|
||||
return new SlotItem(ModuleName.CassBL, i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private SlotItem GetTrayOrignSlot(ModuleName module, int slot)
|
||||
{
|
||||
var wafer = GetModule(module).GetWaferInfo(slot);
|
||||
if (wafer != null && GetModule(module).HasTray(slot) && _cassetteBL.NoTray(wafer.TrayOriginSlot))
|
||||
{
|
||||
return new SlotItem(ModuleName.CassBL, wafer.TrayOriginSlot);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool CheckWaferCouldBeReturn(ModuleName module, int slot)
|
||||
{
|
||||
var wafer = WaferManager.Instance.GetWafer(module, slot);
|
||||
if (!wafer.IsWaferEmpty)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (wafer.TrayStatus == TrayStatus.Normal)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using Aitex.Core.RT.Fsm;
|
||||
using Aitex.Core.Util;
|
||||
using SicRT.Scheduler;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicRT.Equipments;
|
||||
using SicRT.Equipments.Systems;
|
||||
using Aitex.Core.RT.Device;
|
||||
using SicModules.Aligners;
|
||||
|
||||
namespace SicRT.Modules.Schedulers
|
||||
{
|
||||
public class SchedulerAligner : SchedulerModule
|
||||
{
|
||||
public override bool IsAvailable
|
||||
{
|
||||
get { return _aliger.IsIdle && _aliger.IsOnline && CheckTaskDone(); }
|
||||
|
||||
}
|
||||
public override bool IsOnline
|
||||
{
|
||||
get { return _aliger.IsOnline; }
|
||||
|
||||
}
|
||||
public override bool IsError
|
||||
{
|
||||
get { return _aliger.IsError; }
|
||||
|
||||
}
|
||||
|
||||
private AlignerModuleBase _aliger = null;
|
||||
|
||||
private int _entityTaskToken = (int)FSM_MSG.NONE;
|
||||
|
||||
public SchedulerAligner(ModuleName module) : base(module.ToString())
|
||||
{
|
||||
_module = module.ToString();
|
||||
_aliger = Singleton<EquipmentManager>.Instance.Modules[module] as AlignerModule;
|
||||
}
|
||||
|
||||
public bool Monitor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Aligning()
|
||||
{
|
||||
_task = TaskType.Align;
|
||||
_entityTaskToken = _aliger.InvokeAligner();
|
||||
LogTaskStart(_task, $"{Module} Aligning");
|
||||
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
var taskSucceed = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
taskSucceed = true;
|
||||
break;
|
||||
case TaskType.Align:
|
||||
taskSucceed = _aliger.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
}
|
||||
|
||||
return SuperCheckTaskDone(taskSucceed, _aliger.IsIdle | _aliger.IsError);
|
||||
}
|
||||
|
||||
public override bool IsReadyForPick(ModuleName robot, int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool IsReadyForPlace(ModuleName robot, int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using Aitex.Core.RT.Fsm;
|
||||
using Aitex.Core.Util;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using SicRT.Equipments.Systems;
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.Device.Devices;
|
||||
using SicModules.Buffers;
|
||||
|
||||
namespace SicRT.Modules.Schedulers
|
||||
{
|
||||
public class SchedulerBuffer : SchedulerModule
|
||||
{
|
||||
public override bool IsAvailable
|
||||
{
|
||||
get { return _buffer.IsIdle && _buffer.IsOnline && CheckTaskDone(); }
|
||||
|
||||
}
|
||||
public override bool IsOnline
|
||||
{
|
||||
get { return _buffer.IsOnline; }
|
||||
|
||||
}
|
||||
public override bool IsError
|
||||
{
|
||||
get { return _buffer.IsError; }
|
||||
|
||||
}
|
||||
|
||||
private BufferModuleBase _buffer = null;
|
||||
|
||||
private int _entityTaskToken = (int)FSM_MSG.NONE;
|
||||
|
||||
public SchedulerBuffer(ModuleName module) : base(module.ToString())
|
||||
{
|
||||
_module = module.ToString();
|
||||
_buffer = Singleton<EquipmentManager>.Instance.Modules[module] as BufferModuleBase;
|
||||
}
|
||||
|
||||
internal float GetTemperature()
|
||||
{
|
||||
var deviceBufferTemp = DEVICE.GetDevice<IoTempMeter>($"Buffer.BufferTemp");
|
||||
return deviceBufferTemp.FeedBack;
|
||||
}
|
||||
|
||||
public override bool Cooling(bool coolingTypeIsTime,int coolingValue)
|
||||
{
|
||||
_task = TaskType.Cooling;
|
||||
|
||||
_entityTaskToken = _buffer.InvokeCooling(coolingTypeIsTime, coolingValue);
|
||||
|
||||
if (coolingTypeIsTime)
|
||||
{
|
||||
LogTaskStart(_task, $"{Module} cooling {coolingValue} seconds");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogTaskStart(_task, $"{Module} cooling wait temprature below {coolingValue}℃");
|
||||
}
|
||||
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public bool PreHeat(int preTemp)
|
||||
{
|
||||
_task = TaskType.WarmUp;
|
||||
LogTaskStart(_task, $"{Module} warm up to {preTemp} ℃");
|
||||
_entityTaskToken = _buffer.InvokeWarmUp(preTemp);
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
var taskSucceed = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
taskSucceed = true;
|
||||
break;
|
||||
case TaskType.Cooling:
|
||||
taskSucceed = _buffer.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.WarmUp:
|
||||
taskSucceed = _buffer.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
}
|
||||
|
||||
return SuperCheckTaskDone(taskSucceed, _buffer.IsIdle | _buffer.IsError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using Aitex.Core.RT.Fsm;
|
||||
using Aitex.Core.Util;
|
||||
using SicRT.Scheduler;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicModules.Cassettes;
|
||||
using SicRT.Equipments;
|
||||
using SicRT.Equipments.Systems;
|
||||
|
||||
namespace SicRT.Modules.Schedulers
|
||||
{
|
||||
public class SchedulerCassette : SchedulerModule
|
||||
{
|
||||
public override bool IsAvailable
|
||||
{
|
||||
get { return _cass.IsOnline; }
|
||||
|
||||
}
|
||||
public override bool IsOnline
|
||||
{
|
||||
get { return _cass.IsOnline; }
|
||||
|
||||
}
|
||||
public override bool IsError
|
||||
{
|
||||
get { return _cass.IsError; }
|
||||
|
||||
}
|
||||
|
||||
private CassetteModule _cass = null;
|
||||
|
||||
private int _entityTaskToken = (int)FSM_MSG.NONE;
|
||||
|
||||
public SchedulerCassette(ModuleName module) : base(module.ToString())
|
||||
{
|
||||
_module = module.ToString();
|
||||
_cass = Singleton<EquipmentManager>.Instance.Modules[module] as CassetteModule;
|
||||
}
|
||||
|
||||
public bool Monitor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool IsReadyForPlace(ModuleName robot, int slot)
|
||||
{
|
||||
return WaferManager.Instance.CheckNoWafer(_cass.Module, slot) && WaferManager.Instance.CheckNoTray(ModuleHelper.Converter(_cass.Module), slot);
|
||||
}
|
||||
|
||||
public override bool IsReadyForPick(ModuleName robot, int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
var taskSucceed = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
taskSucceed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return SuperCheckTaskDone(taskSucceed, _cass.IsIdle | _cass.IsError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aitex.Core.Common;
|
||||
using MECF.Framework.Common.DBCore;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.Jobs;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
|
||||
namespace SicRT.Equipments.Schedulers
|
||||
{
|
||||
|
||||
class SchedulerDBCallback
|
||||
{
|
||||
public void LotCreated(ControlJobInfo cj)
|
||||
{
|
||||
ModuleName module = ModuleHelper.Converter(cj.Module);
|
||||
Guid carrierGuid = CarrierManager.Instance.GetCarrier(cj.Module).InnerId;
|
||||
|
||||
LotDataRecorder.StartLot(cj.LotInnerId.ToString(), carrierGuid.ToString(), "", cj.LotName, cj.Module, cj.Module, cj.LotWafers.Count);
|
||||
|
||||
foreach (var waferInfo in cj.LotWafers)
|
||||
{
|
||||
LotDataRecorder.InsertLotWafer(cj.LotInnerId.ToString(), waferInfo.WaferInnerID.ToString());
|
||||
|
||||
WaferDataRecorder.SetWaferSequence(waferInfo.WaferInnerID.ToString(), waferInfo.ProcessJobID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void LotFinished(ControlJobInfo cj)
|
||||
{
|
||||
|
||||
int unprocessed = 0;
|
||||
int aborted = 0;
|
||||
foreach (var waferInfo in cj.LotWafers)
|
||||
{
|
||||
if (waferInfo.ProcessState == WaferProcessStatus.Failed)
|
||||
{
|
||||
aborted++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (waferInfo.ProcessState != WaferProcessStatus.Completed)
|
||||
{
|
||||
unprocessed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LotDataRecorder.EndLot(cj.LotInnerId.ToString(), aborted, unprocessed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
using System.Linq;
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.Fsm;
|
||||
using Aitex.Core.Util;
|
||||
using Aitex.Sorter.Common;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.Schedulers;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicRT.Equipments.Systems;
|
||||
using SicRT.Modules.Schedulers;
|
||||
using Aitex.Core.RT.Device.Devices;
|
||||
using Aitex.Core.RT.Event;
|
||||
using SicModules.LLs;
|
||||
|
||||
namespace SicRT.Scheduler
|
||||
{
|
||||
public class SchedulerLoadLock : SchedulerModule
|
||||
{
|
||||
#region Variables
|
||||
|
||||
/// <summary>
|
||||
/// 最后一次传盘动作是Pick还是Place。
|
||||
/// </summary>
|
||||
private TaskType _lastTransferAction;
|
||||
|
||||
/// <summary>
|
||||
/// 最后一次传盘的槽位。
|
||||
/// </summary>
|
||||
private int _lastTransferSlot;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public override bool IsAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ll.IsIdle && _ll.IsOnline && CheckTaskDone() && _ll.CheckSlitValveClosed();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsOnline
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ll.IsOnline;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsError
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ll.IsError;
|
||||
}
|
||||
}
|
||||
|
||||
private LoadLockModuleBase _ll = null;
|
||||
|
||||
private ModuleName _taskRobot;
|
||||
private int _taskSlot;
|
||||
private int _entityTaskToken = (int)FSM_MSG.NONE;
|
||||
private bool _separated = false;
|
||||
private bool _purged = false;
|
||||
public bool IsInPumping { get => _task == TaskType.Pump || _task == TaskType.Purge || _task == TaskType.PrepareTransfer ; }
|
||||
|
||||
public SchedulerLoadLock(ModuleName module) : base(module.ToString())
|
||||
{
|
||||
_module = module.ToString();
|
||||
_ll = Singleton<EquipmentManager>.Instance.Modules[module] as LoadLockModuleBase;
|
||||
}
|
||||
|
||||
public override bool PrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
|
||||
{
|
||||
_task = TaskType.PrepareTransfer;
|
||||
_taskRobot = robot;
|
||||
_taskSlot = slot;
|
||||
|
||||
LogTaskStart(_task, $"{robot} {type} slot {slot + 1}");
|
||||
return _ll.PrepareTransfer(robot, Hand.Blade1, slot, type, out _);
|
||||
}
|
||||
|
||||
internal bool CheckAtAtm()
|
||||
{
|
||||
SicLoadLock deviceLL = DEVICE.GetDevice<SicLoadLock>($"{_module}.{_module}");
|
||||
|
||||
return deviceLL.CheckAtm();
|
||||
}
|
||||
internal bool CheckAtVacuum()
|
||||
{
|
||||
SicLoadLock deviceLL = DEVICE.GetDevice<SicLoadLock>($"{_module}.{_module}");
|
||||
|
||||
return deviceLL.CheckVacuum();
|
||||
}
|
||||
internal void SetJobStatue()
|
||||
{
|
||||
SicLoadLock deviceLL = DEVICE.GetDevice<SicLoadLock>($"{_module}.{_module}");
|
||||
deviceLL.SetJobDoneStatus();
|
||||
}
|
||||
|
||||
public override bool IsReadyForPick(ModuleName robot, int slot)
|
||||
{
|
||||
if (robot == ModuleName.TMRobot)
|
||||
{
|
||||
return _ll.CheckReadyForTransfer(robot, Hand.Blade1, slot, EnumTransferType.Pick, out _);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsReadyForPlace(ModuleName robot, int slot)
|
||||
{
|
||||
if (robot == ModuleName.TMRobot)
|
||||
{
|
||||
return _ll.CheckReadyForTransfer(robot, Hand.Blade1, slot, EnumTransferType.Place, out _);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsReadyForTransfer(ModuleName robot, int slot)
|
||||
{
|
||||
if (robot == ModuleName.WaferRobot)
|
||||
{
|
||||
return _ll.CheckReadyForTransfer(robot, Hand.Blade1, slot, EnumTransferType.Place, out _);
|
||||
}
|
||||
else if (robot == ModuleName.TMRobot || robot == ModuleName.TrayRobot)
|
||||
{
|
||||
return _ll.CheckReadyForTransfer(robot, Hand.Blade1, slot, EnumTransferType.Place, out _)
|
||||
&& WaferManager.Instance.CheckNoTray(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public bool Vent()
|
||||
{
|
||||
_task = TaskType.Vent;
|
||||
|
||||
_entityTaskToken = _ll.InvokeVent();
|
||||
|
||||
LogTaskStart(_task, $"{Module} vent to ATM");
|
||||
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public bool Pump()
|
||||
{
|
||||
_entityTaskToken = _ll.InvokePump();
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
_task = TaskType.Pump;
|
||||
LogTaskStart(_task, $"{Module} pump to Vaccum");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public bool Purge(params object[] objs)
|
||||
{
|
||||
_entityTaskToken = _ll.InvokePurge(objs);
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
_task = TaskType.Purge;
|
||||
LogTaskStart(_task, $"{Module} purge for new job");
|
||||
_purged = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GroupWaferTray()
|
||||
{
|
||||
_entityTaskToken = _ll.InvokeGroupWaferTray();
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
_task = TaskType.Group;
|
||||
LogTaskStart(_task, $"{Module} start group wafer and tray");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SeparateWaferTray()
|
||||
{
|
||||
_entityTaskToken = _ll.InvokeSeparateWaferTray();
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
_task = TaskType.Separate;
|
||||
LogTaskStart(_task, $"{Module} start separate wafer and tray");
|
||||
}
|
||||
_separated = _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
|
||||
public int? GetWaferPurgeCount(int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(Module, slot))
|
||||
return null;
|
||||
|
||||
var wafer = WaferManager.Instance.GetWafer(Module, slot);
|
||||
|
||||
if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
|
||||
return null;
|
||||
|
||||
if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count)
|
||||
return null;
|
||||
|
||||
if (!wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules.Any(m => m == ModuleName.LoadLock || m == ModuleName.Load))
|
||||
return null;
|
||||
|
||||
if (!wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepParameter.ContainsKey("PurgeCount"))
|
||||
return null;
|
||||
|
||||
if (int.TryParse(wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepParameter["PurgeCount"].ToString(), out int purgeCount))
|
||||
{
|
||||
return purgeCount;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int? GetWaferPumpDelayTime(int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(Module, slot))
|
||||
return null;
|
||||
|
||||
var wi = WaferManager.Instance.GetWafer(Module, slot);
|
||||
|
||||
if (wi.ProcessJob?.Sequence == null)
|
||||
return null;
|
||||
|
||||
if (wi.NextSequenceStep >= wi.ProcessJob.Sequence.Steps.Count)
|
||||
return null;
|
||||
|
||||
if (!wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepModules.Any(m => m == ModuleName.LoadLock || m == ModuleName.Load))
|
||||
return null;
|
||||
|
||||
if (!wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepParameter.ContainsKey("PumpDelayTime"))
|
||||
return null;
|
||||
|
||||
if (int.TryParse(wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepParameter["PumpDelayTime"].ToString(), out int pumpDelayTime))
|
||||
{
|
||||
return pumpDelayTime;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool CheckWaferNextStepIsThis(ModuleName module, int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(module, slot))
|
||||
return false;
|
||||
|
||||
var wi = WaferManager.Instance.GetWafer(module, slot);
|
||||
|
||||
if (wi.ProcessJob?.Sequence == null)
|
||||
return false;
|
||||
|
||||
if (wi.NextSequenceStep >= wi.ProcessJob.Sequence.Steps.Count)
|
||||
return false;
|
||||
|
||||
if (!wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepModules.Any(m => m == ModuleName.LoadLock || m == ModuleName.Load))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CheckWaferTrayGrouped()
|
||||
{
|
||||
return !_ll.CheckWaferClamped() && WaferManager.Instance.CheckHasWafer(Module, 0);
|
||||
}
|
||||
|
||||
public override bool CheckWaferTraySeparated()
|
||||
{
|
||||
return _separated;
|
||||
}
|
||||
|
||||
public override bool CheckSlitValveClosed()
|
||||
{
|
||||
return _ll.CheckSlitValveClosed();
|
||||
}
|
||||
|
||||
public override bool CheckTrayPlaced()
|
||||
{
|
||||
return _ll.CheckTrayPlaced();
|
||||
}
|
||||
|
||||
public bool WaitTransfer(ModuleName robot, bool isPick, int slot)
|
||||
{
|
||||
_lastTransferAction = isPick ? TaskType.Pick : TaskType.Place;
|
||||
_lastTransferSlot = slot;
|
||||
return base.WaitTransfer(robot);
|
||||
}
|
||||
|
||||
|
||||
/*public override bool StopWaitTransfer(ModuleName robot)
|
||||
{
|
||||
|
||||
var ret = base.StopWaitTransfer(robot);
|
||||
if (ret)
|
||||
{
|
||||
// 传盘结束后,如果上个动作是Place,Wafer回到Cassette,则响蜂鸣器进行提示。
|
||||
if (_lastTransferAction == TaskType.Place
|
||||
&& WaferManager.Instance.CheckHasWafer(ModuleName.LoadLock.ToString(), 0))
|
||||
{
|
||||
EV.PostMessage(Module.ToString(), EventEnum.PJ_DONE, "LoadLock", "0");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}*/
|
||||
|
||||
public override void ResetTask()
|
||||
{
|
||||
base.ResetTask();
|
||||
_lastTransferAction = TaskType.None;
|
||||
_lastTransferSlot = -1;
|
||||
}
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
var taskSucceed = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
taskSucceed = true;
|
||||
break;
|
||||
case TaskType.PrepareTransfer:
|
||||
taskSucceed = _ll.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Cooling:
|
||||
taskSucceed = _ll.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Vent:
|
||||
taskSucceed = _ll.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Pump:
|
||||
taskSucceed = _ll.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Purge:
|
||||
taskSucceed = _ll.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Group:
|
||||
taskSucceed = _ll.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Separate:
|
||||
taskSucceed = _ll.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return SuperCheckTaskDone(taskSucceed, _ll.IsIdle | _ll.IsError);
|
||||
}
|
||||
|
||||
internal float GetTemperature()
|
||||
{
|
||||
IoTempMeter deviceLoadTemp = DEVICE.GetDevice<IoTempMeter>($"Buffer.BufferTemp");
|
||||
return deviceLoadTemp.FeedBack;
|
||||
}
|
||||
|
||||
public bool CheckPurged()
|
||||
{
|
||||
return _purged;
|
||||
}
|
||||
|
||||
public void ResetPurged()
|
||||
{
|
||||
_purged = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,614 @@
|
||||
using System.Collections.Generic;
|
||||
using Aitex.Core.Common;
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.Util;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.Schedulers;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
|
||||
namespace SicRT.Modules.Schedulers
|
||||
{
|
||||
public class SchedulerModule
|
||||
{
|
||||
protected enum TaskType
|
||||
{
|
||||
None,
|
||||
|
||||
PrepareTransfer,
|
||||
|
||||
Pick,
|
||||
|
||||
Place,
|
||||
|
||||
PickAndPlace,
|
||||
|
||||
Preprocess,
|
||||
Process,
|
||||
PostProcess,
|
||||
|
||||
OpenCover,
|
||||
CloseCover,
|
||||
|
||||
Load,
|
||||
Unload,
|
||||
|
||||
Align,
|
||||
|
||||
TransferTarget,
|
||||
|
||||
Cooling,
|
||||
WarmUp,
|
||||
|
||||
Vent,
|
||||
Pump,
|
||||
Purge,
|
||||
Group,
|
||||
Separate,
|
||||
Map
|
||||
}
|
||||
|
||||
#region Variables
|
||||
|
||||
private readonly R_TRIG[] firstDetectWaferArriveTrigs = new R_TRIG[25];
|
||||
private readonly R_TRIG[] firstDetectWaferLeaveTrigs = new R_TRIG[25];
|
||||
private readonly R_TRIG[] firstDetectTrayArriveTrigs = new R_TRIG[25];
|
||||
private readonly R_TRIG[] firstDetectTrayLeaveTrigs = new R_TRIG[25];
|
||||
|
||||
protected string _module;
|
||||
protected TaskType _task = TaskType.None;
|
||||
protected ModuleName _inProcessRobot;
|
||||
|
||||
/// <summary>
|
||||
/// 检测调度器TransferTarget任务是否超时。
|
||||
/// </summary>
|
||||
private readonly DeviceTimer _timTransferTargetStatusTimeout = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public SchedulerModule(string module)
|
||||
{
|
||||
_module = module;
|
||||
for (var i = 0; i < firstDetectWaferArriveTrigs.Length; i++)
|
||||
{
|
||||
firstDetectWaferArriveTrigs[i] = new R_TRIG();
|
||||
}
|
||||
for (var i = 0; i < firstDetectWaferLeaveTrigs.Length; i++)
|
||||
{
|
||||
firstDetectWaferLeaveTrigs[i] = new R_TRIG();
|
||||
}
|
||||
for (var i = 0; i < firstDetectTrayArriveTrigs.Length; i++)
|
||||
{
|
||||
firstDetectTrayArriveTrigs[i] = new R_TRIG();
|
||||
}
|
||||
for (var i = 0; i < firstDetectTrayLeaveTrigs.Length; i++)
|
||||
{
|
||||
firstDetectTrayLeaveTrigs[i] = new R_TRIG();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public ModuleName Module
|
||||
{
|
||||
get { return ModuleHelper.Converter(_module); }
|
||||
}
|
||||
public virtual bool IsAvailable { get; }
|
||||
|
||||
public virtual bool IsOnline { get; }
|
||||
|
||||
public virtual bool IsError { get; }
|
||||
|
||||
public virtual bool IsReady { get; }
|
||||
|
||||
public virtual bool IsService { get; }
|
||||
|
||||
public virtual string State { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// 检查调度器是否空闲。
|
||||
/// </summary>
|
||||
/// <Remarks>
|
||||
/// 调度器空闲的条件除调度器无任务执行,还需要判断Module的状态是否为Idle或Error。
|
||||
/// 因为如果调度器执行过程中,Module发生错误,也应该将调度器标记为空闲,否则调度器可能卡死而导致Auto流程无法继续。
|
||||
/// 以下为调度器和Module可能出现冲突的状态,和判决方法:
|
||||
/// <para>1. 如果调度器无任务,但Module还未Idle,则说明上个Routine还未执行完毕,则认为Task还未完成。</para>
|
||||
/// <para>2. 如果调度器有任务,但Module已经Idle或Error,则说明Routine已执行完毕,但可能出错,则认为Task完成。</para>
|
||||
/// </Remarks>
|
||||
/// <param name="isTaskDone">调度器执行的任务是否结束。</param>
|
||||
/// <param name="fsmStopped">调度器关联的Module的状态机是否Idle或Alarm</param>
|
||||
/// <returns></returns>
|
||||
protected bool SuperCheckTaskDone(bool isTaskDone, bool fsmStopped)
|
||||
{
|
||||
// Transfer状态需特殊对待。该状态在调度器的CheckTaskDone()中未处理,因为机械手的异常可能导致被操作的调度器卡死在Transfer任务中。
|
||||
// 因此需要建立超时机制,如果调度器停留在Transfer状态时间过长,则可能是机械手发生异常,需要自动退出Transfer任务。
|
||||
if (_task == TaskType.TransferTarget)
|
||||
{
|
||||
if (_timTransferTargetStatusTimeout.IsTimeout())
|
||||
{
|
||||
// 强制结束TransferTarget任务
|
||||
_task = TaskType.None;
|
||||
_timTransferTargetStatusTimeout.Stop();
|
||||
isTaskDone = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 调度器仍然在Transfer任务中
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
isTaskDone &= fsmStopped;
|
||||
|
||||
if (isTaskDone)
|
||||
{
|
||||
if (_task != TaskType.None)
|
||||
{
|
||||
LogTaskDone(_task, "");
|
||||
_task = TaskType.None;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (fsmStopped)
|
||||
{
|
||||
LogTaskDone(_task, "Task Failed");
|
||||
_task = TaskType.None;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected void LogTaskStart(TaskType cmd, string message)
|
||||
{
|
||||
EV.PostInfoLog("Scheduler", $"Task start:{_module},{cmd} {message}");
|
||||
|
||||
}
|
||||
protected void LogTaskDone(TaskType cmd, string message)
|
||||
{
|
||||
EV.PostInfoLog("Scheduler", $"Task done:{_module},{cmd} {message}");
|
||||
}
|
||||
public virtual void ResetTask()
|
||||
{
|
||||
_task = TaskType.None;
|
||||
_timTransferTargetStatusTimeout.Stop();
|
||||
}
|
||||
|
||||
public bool WaitTransfer(ModuleName robot)
|
||||
{
|
||||
_task = TaskType.TransferTarget;
|
||||
_inProcessRobot = robot;
|
||||
_timTransferTargetStatusTimeout.Start(30000);
|
||||
LogTaskStart(_task, $"Note {robot} in transfer");
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsWaitTransfer(ModuleName robot)
|
||||
{
|
||||
return _task == TaskType.TransferTarget && _inProcessRobot == robot;
|
||||
}
|
||||
|
||||
public virtual bool StopWaitTransfer(ModuleName robot)
|
||||
{
|
||||
LogTaskDone(_task, $"Note {robot} transfer complete");
|
||||
_timTransferTargetStatusTimeout.Stop();
|
||||
_inProcessRobot = ModuleName.System;
|
||||
|
||||
_task = TaskType.None;
|
||||
return true;
|
||||
}
|
||||
|
||||
public WaferInfoRt GetWaferInfo(int slot)
|
||||
{
|
||||
return WaferManager.Instance.GetWafer(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
|
||||
public bool CheckWaferStatus(int slot, WaferStatus waferStatus)
|
||||
{
|
||||
return WaferManager.Instance.CheckWafer(ModuleHelper.Converter(_module), slot, waferStatus);
|
||||
}
|
||||
|
||||
public bool HasWafer(int slot)
|
||||
{
|
||||
return WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
|
||||
public bool NoWafer(int slot)
|
||||
{
|
||||
return WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
|
||||
public bool HasTray(int slot)
|
||||
{
|
||||
return WaferManager.Instance.CheckHasTray(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
|
||||
public bool NoTray(int slot)
|
||||
{
|
||||
return WaferManager.Instance.CheckNoTray(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
|
||||
public bool FirstDetectWaferArrive(int slot)
|
||||
{
|
||||
firstDetectWaferArriveTrigs[slot].CLK = HasWafer(slot);
|
||||
return firstDetectWaferArriveTrigs[slot].Q;
|
||||
}
|
||||
|
||||
public bool FirstDetectWaferLeave(int slot)
|
||||
{
|
||||
firstDetectWaferLeaveTrigs[slot].CLK = NoWafer(slot);
|
||||
return firstDetectWaferLeaveTrigs[slot].Q;
|
||||
}
|
||||
|
||||
public bool FirstDetectTrayArrive(int slot)
|
||||
{
|
||||
firstDetectTrayArriveTrigs[slot].CLK = HasTray(slot);
|
||||
return firstDetectTrayArriveTrigs[slot].Q;
|
||||
}
|
||||
|
||||
public bool FirstDetectTrayLeave(int slot)
|
||||
{
|
||||
firstDetectTrayLeaveTrigs[slot].CLK = NoTray(slot);
|
||||
return firstDetectTrayLeaveTrigs[slot].Q;
|
||||
}
|
||||
|
||||
public bool HasTrayAndExceedProcessCount(int slot)
|
||||
{
|
||||
var wi = WaferManager.Instance.GetWafer(ModuleHelper.Converter(_module), slot);
|
||||
return wi.TrayStatus == TrayStatus.Normal && wi.TrayProcessCount <=0;
|
||||
}
|
||||
|
||||
public bool HasTrayAndNotExceedProcessCount(int slot)
|
||||
{
|
||||
var wi = WaferManager.Instance.GetWafer(ModuleHelper.Converter(_module), slot);
|
||||
return wi.TrayStatus == TrayStatus.Normal && wi.TrayProcessCount >0;
|
||||
}
|
||||
|
||||
public virtual bool CheckWaferNextStepIsThis(ModuleName module, int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(module, slot))
|
||||
return false;
|
||||
|
||||
var wafer = WaferManager.Instance.GetWafer(module, slot);
|
||||
|
||||
if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
|
||||
return false;
|
||||
|
||||
if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count)
|
||||
return false;
|
||||
|
||||
if (!wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules.Contains(Module))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断下一步的模块是否有Wafer
|
||||
/// </summary>
|
||||
/// <param name="slot"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool CheckWaferNextStepModuleNoWafer(int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(Module, slot))
|
||||
return false;
|
||||
|
||||
var wafer = WaferManager.Instance.GetWafer(Module, slot);
|
||||
|
||||
if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
|
||||
return false;
|
||||
|
||||
if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count)
|
||||
return false;
|
||||
|
||||
List<ModuleName> lstModuleName = wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules;
|
||||
if (lstModuleName.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < lstModuleName.Count; i++)
|
||||
{
|
||||
if (WaferManager.Instance.CheckNoWafer(lstModuleName[i], 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool CheckWaferNextStepBufferNoTray(int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(Module, slot))
|
||||
return false;
|
||||
|
||||
var wafer = WaferManager.Instance.GetWafer(Module, slot);
|
||||
|
||||
if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
|
||||
return false;
|
||||
|
||||
if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count)
|
||||
return false;
|
||||
|
||||
List<ModuleName> lstModuleName = wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules;
|
||||
if (lstModuleName.Count > 0)
|
||||
{
|
||||
for (int j = 0; j < lstModuleName.Count; j++)
|
||||
{
|
||||
if (CheckWaferNeedProcess(slot, ModuleName.PM1))
|
||||
{
|
||||
if (WaferManager.Instance.CheckNoTray(ModuleName.Buffer, 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (CheckWaferNeedProcess(slot, ModuleName.PM2))
|
||||
{
|
||||
if (WaferManager.Instance.CheckNoTray(ModuleName.Buffer, 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool CheckWaferNextStepModuleNoTray(int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(Module, slot))
|
||||
return false;
|
||||
|
||||
var wafer = WaferManager.Instance.GetWafer(Module, slot);
|
||||
|
||||
if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
|
||||
return false;
|
||||
|
||||
if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count)
|
||||
return false;
|
||||
|
||||
List<ModuleName> lstModuleName = wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules;
|
||||
if (lstModuleName.Count > 0)
|
||||
{
|
||||
for (int j = 0; j < lstModuleName.Count; j++)
|
||||
{
|
||||
if (lstModuleName[j] == ModuleName.Buffer)
|
||||
{
|
||||
if (CheckWaferNeedProcess(slot, ModuleName.PM1))
|
||||
{
|
||||
if (WaferManager.Instance.CheckNoTray(ModuleName.Buffer, 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (CheckWaferNeedProcess(slot, ModuleName.PM2))
|
||||
{
|
||||
if (WaferManager.Instance.CheckNoTray(ModuleName.Buffer, 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (WaferManager.Instance.CheckNoTray(lstModuleName[j], 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断Wafer的步骤是否都完成了
|
||||
/// </summary>
|
||||
/// <param name="waferModule"></param>
|
||||
/// <param name="waferSlot"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool CheckWaferSequenceStepDone(int slot)
|
||||
{
|
||||
var wafer = WaferManager.Instance.GetWafer(Module, slot);
|
||||
|
||||
if (wafer.IsWaferEmpty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count && wafer.ProcessJob.Sequence.Steps.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool CheckWaferNeedProcess(int waferSlot, ModuleName processIn = ModuleName.System)
|
||||
{
|
||||
var wafer = WaferManager.Instance.GetWafer(Module, waferSlot);
|
||||
|
||||
if (wafer.IsWaferEmpty)
|
||||
return false;
|
||||
|
||||
if (wafer.WaferStatus == WaferStatus.Dummy && wafer.ProcessState == WaferProcessStatus.Wait)
|
||||
{
|
||||
if (ModuleHelper.IsPm(processIn))
|
||||
{
|
||||
return (CheckNeedRunClean(out bool withWafer, out _) && withWafer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wafer.ProcessJob == null || wafer.ProcessJob.Sequence == null || wafer.ProcessJob.Sequence.Steps == null)
|
||||
return false;
|
||||
|
||||
if (wafer.NextSequenceStep >= wafer.ProcessJob.Sequence.Steps.Count || wafer.ProcessJob.Sequence.Steps[wafer.NextSequenceStep].StepModules == null)
|
||||
return false;
|
||||
|
||||
if (processIn != ModuleName.System)
|
||||
{
|
||||
for (int i = wafer.NextSequenceStep; i < wafer.ProcessJob.Sequence.Steps.Count; i++)
|
||||
{
|
||||
foreach (var stepModule in wafer.ProcessJob.Sequence.Steps[i].StepModules)
|
||||
{
|
||||
if (ModuleHelper.IsPm(stepModule)&& stepModule==processIn)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasPm = false;
|
||||
for (int i = wafer.NextSequenceStep; i < wafer.ProcessJob.Sequence.Steps.Count; i++)
|
||||
{
|
||||
foreach (var stepModule in wafer.ProcessJob.Sequence.Steps[i].StepModules)
|
||||
{
|
||||
if (ModuleHelper.IsPm(stepModule))
|
||||
{
|
||||
hasPm = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPm)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!hasPm)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool CheckNeedRunClean(out bool withWafer, out string recipeName)
|
||||
{
|
||||
recipeName = string.Empty;
|
||||
withWafer = false;
|
||||
|
||||
//SequenceInfo seq = GetCurrentSequenceInfo();
|
||||
//int waferProcessed = StatsDataManager.Instance.GetValue($"{Module}.WaferProcessedSincePreviousClean");
|
||||
|
||||
//if (seq == null)
|
||||
// return false;
|
||||
|
||||
|
||||
//foreach (var stepInfo in seq.Steps)
|
||||
//{
|
||||
// if (!stepInfo.StepModules.Contains(Module))
|
||||
// continue;
|
||||
|
||||
// if (stepInfo.StepParameter.ContainsKey("CleanIntervalWaferless")
|
||||
// && int.TryParse((string)stepInfo.StepParameter["CleanIntervalWaferless"], out int interval)
|
||||
// && stepInfo.StepParameter.ContainsKey("CleanRecipeWaferless")
|
||||
// && !string.IsNullOrEmpty((string)stepInfo.StepParameter["CleanRecipeWaferless"]))
|
||||
// {
|
||||
// if (interval > 0 && waferProcessed >= interval)
|
||||
// {
|
||||
// recipeName = (string)stepInfo.StepParameter["CleanRecipeWaferless"];
|
||||
// withWafer = false;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (stepInfo.StepParameter.ContainsKey("CleanIntervalWafer")
|
||||
// && int.TryParse((string)stepInfo.StepParameter["CleanIntervalWafer"], out interval)
|
||||
// && stepInfo.StepParameter.ContainsKey("CleanRecipeWafer")
|
||||
// && !string.IsNullOrEmpty((string)stepInfo.StepParameter["CleanRecipeWafer"]))
|
||||
// {
|
||||
// if (interval > 0 && waferProcessed >= interval)
|
||||
// {
|
||||
// recipeName = (string)stepInfo.StepParameter["CleanRecipeWafer"];
|
||||
// withWafer = true;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool IsReadyForPick(ModuleName robot, int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool IsReadyForPlace(ModuleName robot, int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool IsReadyForTransfer(ModuleName robot, int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public virtual bool PrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool PostTransfer(ModuleName robot, EnumTransferType type, int slot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool Process(string recipeName, bool isCleanRecipe, bool withDummyWafer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool Cooling(bool coolingType, int coolingTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool Aligning()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool WarmUp(int warmUpTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public virtual bool CheckWaferTraySeparated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool CheckWaferTrayGrouped()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool CheckSlitValveClosed() //检查闸板阀是否关闭
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool CheckTrayPlaced()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using SicRT.Scheduler;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SicRT.Modules.Schedulers
|
||||
{
|
||||
public class SchedulerModuleFactory
|
||||
{
|
||||
protected SchedulerTMRobot _tmRobot = new();
|
||||
protected SchedulerWaferRobot _waferRobot = new();
|
||||
protected SchedulerTrayRobot _trayRobot = new();
|
||||
|
||||
protected SchedulerBuffer _buffer = new(ModuleName.Buffer);
|
||||
protected SchedulerLoadLock _load = new(ModuleName.LoadLock);
|
||||
protected SchedulerUnLoad _unload = new(ModuleName.UnLoad);
|
||||
protected SchedulerAligner _aligner = new(ModuleName.Aligner);
|
||||
protected SchedulerPM _pm1 = new(ModuleName.PM1);
|
||||
protected SchedulerPM _pm2 = new(ModuleName.PM2);
|
||||
|
||||
protected SchedulerCassette _cassetteAL = new(ModuleName.CassAL);
|
||||
protected SchedulerCassette _cassetteAR = new(ModuleName.CassAR);
|
||||
protected SchedulerCassette _cassetteBL = new(ModuleName.CassBL);
|
||||
|
||||
protected List<SchedulerPM> _lstPms = new();
|
||||
protected List<SchedulerCassette> _lstWaferCassettes = new();
|
||||
|
||||
protected SchedulerModuleFactory()
|
||||
{
|
||||
_lstPms.AddRange(new[] { _pm1,_pm2 });
|
||||
|
||||
_lstWaferCassettes.AddRange(new[] { _cassetteAL, _cassetteAR});
|
||||
}
|
||||
|
||||
protected SchedulerModule GetModule(string name)
|
||||
{
|
||||
switch (ModuleHelper.Converter(name))
|
||||
{
|
||||
case ModuleName.Buffer:
|
||||
return _buffer;
|
||||
case ModuleName.TMRobot:
|
||||
return _tmRobot;
|
||||
case ModuleName.WaferRobot:
|
||||
return _waferRobot;
|
||||
case ModuleName.TrayRobot:
|
||||
return _trayRobot;
|
||||
case ModuleName.PM1:
|
||||
return _pm1;
|
||||
case ModuleName.PM2:
|
||||
return _pm2;
|
||||
case ModuleName.CassAL:
|
||||
return _cassetteAL;
|
||||
case ModuleName.CassAR:
|
||||
return _cassetteAR;
|
||||
case ModuleName.CassBL:
|
||||
return _cassetteBL;
|
||||
case ModuleName.LoadLock:
|
||||
case ModuleName.Load:
|
||||
return _load;
|
||||
case ModuleName.UnLoad:
|
||||
return _unload;
|
||||
case ModuleName.Aligner:
|
||||
return _aligner;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected SchedulerModule GetModule(ModuleName name)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case ModuleName.Buffer:
|
||||
return _buffer;
|
||||
case ModuleName.TMRobot:
|
||||
return _tmRobot;
|
||||
case ModuleName.WaferRobot:
|
||||
return _waferRobot;
|
||||
case ModuleName.TrayRobot:
|
||||
return _trayRobot;
|
||||
case ModuleName.PM1:
|
||||
return _pm1;
|
||||
case ModuleName.PM2:
|
||||
return _pm2;
|
||||
case ModuleName.CassAL:
|
||||
return _cassetteAL;
|
||||
case ModuleName.CassAR:
|
||||
return _cassetteAR;
|
||||
case ModuleName.CassBL:
|
||||
return _cassetteBL;
|
||||
case ModuleName.LoadLock:
|
||||
case ModuleName.Load:
|
||||
return _load;
|
||||
case ModuleName.UnLoad:
|
||||
return _unload;
|
||||
case ModuleName.Aligner:
|
||||
return _aligner;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_tmRobot.ResetTask();
|
||||
foreach (var pm in _lstPms)
|
||||
{
|
||||
pm.ResetTask();
|
||||
}
|
||||
|
||||
_buffer.ResetTask();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
using Aitex.Core.Common;
|
||||
using Aitex.Core.RT.Fsm;
|
||||
using Aitex.Core.RT.SCCore;
|
||||
using Aitex.Core.Util;
|
||||
using SicRT.Modules;
|
||||
using SicRT.Modules.Schedulers;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.Schedulers;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicRT.Equipments;
|
||||
using SicRT.Equipments.Systems;
|
||||
using Aitex.Core.RT.Device;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
|
||||
using Aitex.Core.RT.Device.Devices;
|
||||
using Aitex.Core.RT.DataCenter;
|
||||
|
||||
namespace SicRT.Scheduler
|
||||
{
|
||||
public class SchedulerPM : SchedulerModule
|
||||
{
|
||||
public override bool IsAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SC.GetValue<bool>("System.IsATMMode"))
|
||||
{
|
||||
return _pm.IsIdle && _pm.IsOnline && CheckTaskDone();
|
||||
}
|
||||
else
|
||||
{
|
||||
return _pm.IsProcessIdle && _pm.IsOnline && CheckTaskDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsOnline
|
||||
{
|
||||
get { return _pm.IsOnline; }
|
||||
}
|
||||
public override bool IsError
|
||||
{
|
||||
get { return _pm.IsError; }
|
||||
}
|
||||
|
||||
public bool IsLineHeaterEnable
|
||||
{
|
||||
get { return (bool)DATA.Poll($"{_pm.Name}.OmronTemp.Enable"); }
|
||||
}
|
||||
|
||||
public override bool IsService
|
||||
{
|
||||
get { return _pm.IsService; }
|
||||
}
|
||||
|
||||
public override string State
|
||||
{
|
||||
get { return _pm.StringFsmStatus; }
|
||||
}
|
||||
|
||||
|
||||
private PMModuleBase _pm = null;
|
||||
|
||||
private ModuleName _taskRobot;
|
||||
private EnumTransferType _taskTransferType;
|
||||
private int _taskSlot;
|
||||
private int _entityTaskToken = (int)FSM_MSG.NONE;
|
||||
|
||||
private DeviceTimer _timer = new DeviceTimer();
|
||||
|
||||
public SchedulerPM(ModuleName chamber) : base(chamber.ToString())
|
||||
{
|
||||
_pm = Singleton<EquipmentManager>.Instance.Modules[chamber] as PMModuleBase;
|
||||
System.Diagnostics.Trace.Assert(_pm != null);
|
||||
}
|
||||
|
||||
public override bool IsReadyForPick(ModuleName robot, int slot)
|
||||
{
|
||||
return _pm.IsPrepareTransferReady(robot, EnumTransferType.Pick, slot);
|
||||
}
|
||||
|
||||
public override bool IsReadyForPlace(ModuleName robot, int slot)
|
||||
{
|
||||
return _pm.IsPrepareTransferReady(robot, EnumTransferType.Place, slot);
|
||||
}
|
||||
|
||||
public override bool PrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
|
||||
{
|
||||
_task = TaskType.PrepareTransfer;
|
||||
_taskRobot = robot;
|
||||
_taskSlot = slot;
|
||||
_taskTransferType = type;
|
||||
_entityTaskToken = _pm.InvokePrepareTransfer(robot, type, slot);
|
||||
|
||||
LogTaskStart(_task, $"{robot} {type} slot {slot + 1}");
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public override bool Process(string recipeName, bool isCleanRecipe, bool withWafer)
|
||||
{
|
||||
_task = TaskType.Process;
|
||||
|
||||
if (SC.GetValue<bool>("System.IsATMMode"))
|
||||
{
|
||||
_timer.Start(5000);
|
||||
|
||||
_entityTaskToken = (int)FSM_MSG.TIMER;
|
||||
|
||||
WaferManager.Instance.GetWafer(Module, 0).ProcessState = WaferProcessStatus.InProcess;
|
||||
}
|
||||
else
|
||||
{
|
||||
_entityTaskToken = _pm.InvokeProcess(recipeName, isCleanRecipe, withWafer);
|
||||
}
|
||||
|
||||
LogTaskStart(_task, $"recipe: {recipeName}, clean: {isCleanRecipe}, with wafer: {withWafer}");
|
||||
|
||||
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
bool ret = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
ret = true;
|
||||
break;
|
||||
case TaskType.PrepareTransfer:
|
||||
ret = _pm.CheckAcked(_entityTaskToken) && _pm.IsPrepareTransferReady(_taskRobot, _taskTransferType, _taskSlot);
|
||||
break;
|
||||
case TaskType.Process:
|
||||
|
||||
if (SC.GetValue<bool>("System.IsATMMode"))
|
||||
{
|
||||
ret = _timer.IsTimeout();
|
||||
|
||||
if (ret)
|
||||
WaferManager.Instance.GetWafer(Module, 0).ProcessState = WaferProcessStatus.Completed;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = _pm.CheckAcked(_entityTaskToken) && _pm.IsProcessed();
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret && _task != TaskType.None)
|
||||
{
|
||||
LogTaskDone(_task, "");
|
||||
_task = TaskType.None;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public bool Monitor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//TMRobot从Buffer放到PM时检查
|
||||
public bool CheckBufferToPMTemp()
|
||||
{
|
||||
bool psuEnable = SC.GetValue<bool>($"PM.{Module}.PreTransferPSUEnable");
|
||||
bool scrEnable = SC.GetValue<bool>($"PM.{Module}.PreTransferSCREnable");
|
||||
|
||||
if(!psuEnable)
|
||||
{
|
||||
_pm.ClosePSUEnable(out _);
|
||||
}
|
||||
|
||||
if(!scrEnable)
|
||||
{
|
||||
_pm.CloseSCREnable(out _);
|
||||
}
|
||||
|
||||
//IoInterLock pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{_module}.PMInterLock");
|
||||
//if (pmIoInterLock != null)
|
||||
//{
|
||||
// return pmIoInterLock.DiHeaterTempBelow900CSW && _pm.CheckPlacetoPMTemp();
|
||||
//}
|
||||
|
||||
//return false;
|
||||
|
||||
return _pm.CheckPlacetoPMTemp();
|
||||
}
|
||||
|
||||
//TMRobot从PM取Tray时检查
|
||||
public bool CheckPMToTMRobotTemp()
|
||||
{
|
||||
bool psuEnable = SC.GetValue<bool>($"PM.{Module}.PreTransferPSUEnable");
|
||||
bool scrEnable = SC.GetValue<bool>($"PM.{Module}.PreTransferSCREnable");
|
||||
|
||||
if (!psuEnable)
|
||||
{
|
||||
_pm.ClosePSUEnable(out _);
|
||||
}
|
||||
|
||||
if (!scrEnable)
|
||||
{
|
||||
_pm.CloseSCREnable(out _);
|
||||
}
|
||||
|
||||
//IoInterLock pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{_module}.PMInterLock");
|
||||
//if (pmIoInterLock != null)
|
||||
//{
|
||||
// return pmIoInterLock.DiHeaterTempBelow900CSW;
|
||||
//}
|
||||
|
||||
//return false;
|
||||
|
||||
return _pm.CheckPickFromPMTemp();
|
||||
}
|
||||
|
||||
public bool CheckTempBelow900()
|
||||
{
|
||||
IoInterLock pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{_module}.PMInterLock");
|
||||
if (pmIoInterLock != null)
|
||||
{
|
||||
return pmIoInterLock.DiHeaterTempBelow900CSW;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using Aitex.Core.Util;
|
||||
using Aitex.Sorter.Common;
|
||||
using SicRT.Modules.Schedulers;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicModules.TMs;
|
||||
using SicRT.Equipments.Systems;
|
||||
|
||||
namespace SicRT.Scheduler
|
||||
{
|
||||
public class SchedulerTMRobot : SchedulerModule
|
||||
{
|
||||
public override bool IsAvailable => _tmRobot.IsIdle && _tmRobot.IsOnline && CheckTaskDone();
|
||||
|
||||
public override bool IsOnline => _tmRobot.IsOnline;
|
||||
|
||||
public override bool IsError => _tmRobot.IsError;
|
||||
|
||||
private TMModuleBase _tmRobot = null;
|
||||
|
||||
private Hand _taskHand;
|
||||
|
||||
private ModuleName _target;
|
||||
|
||||
public bool IsInPumping => ((_task == TaskType.Pick || _task == TaskType.Place) &&
|
||||
(_target == ModuleName.UnLoad || _target == ModuleName.LoadLock ||
|
||||
_target == ModuleName.Load));
|
||||
|
||||
public SchedulerTMRobot() : base(ModuleName.TMRobot.ToString())
|
||||
{
|
||||
_tmRobot = Singleton<EquipmentManager>.Instance.Modules[ModuleName.TM] as TMModuleBase;
|
||||
}
|
||||
|
||||
|
||||
public bool IsReadyForPick(Hand blade)
|
||||
{
|
||||
return WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, (int)blade);
|
||||
}
|
||||
|
||||
public bool IsReadyForPlace(Hand blade)
|
||||
{
|
||||
return WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot, (int)blade);
|
||||
}
|
||||
|
||||
|
||||
public bool Pick(ModuleName target, int slot, Hand hand)
|
||||
{
|
||||
if (_tmRobot.Pick(target, hand, slot, out string reason))
|
||||
{
|
||||
_task = TaskType.Pick;
|
||||
_taskHand = hand;
|
||||
_target = target;
|
||||
LogTaskStart(_task, $"{target}.{slot + 1}=>{Module}.{hand}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Place(ModuleName target, int slot, Hand hand)
|
||||
{
|
||||
if (_tmRobot.Place(target, hand, slot, out string reason))
|
||||
{
|
||||
_task = TaskType.Place;
|
||||
_taskHand = hand;
|
||||
_target = target;
|
||||
LogTaskStart(_task, $"{Module}.{hand}=>{target}.{slot + 1}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Goto(ModuleName chamber, int slot, Hand hand)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Monitor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
var taskSucceed = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
taskSucceed = true;
|
||||
break;
|
||||
case TaskType.Pick:
|
||||
taskSucceed = WaferManager.Instance.CheckHasTray(ModuleName.TMRobot, (int)_taskHand);
|
||||
break;
|
||||
case TaskType.Place:
|
||||
taskSucceed = WaferManager.Instance.CheckNoTray(ModuleName.TMRobot, (int)_taskHand);
|
||||
break;
|
||||
}
|
||||
|
||||
return SuperCheckTaskDone(taskSucceed, _tmRobot.IsIdle | _tmRobot.IsError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using Aitex.Core.Util;
|
||||
using Aitex.Sorter.Common;
|
||||
using SicRT.Modules.Schedulers;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicModules.EFEMs;
|
||||
using SicRT.Equipments.Systems;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.HineAutomation;
|
||||
|
||||
namespace SicRT.Scheduler
|
||||
{
|
||||
public class SchedulerTrayRobot : SchedulerModule
|
||||
{
|
||||
public override bool IsAvailable
|
||||
{
|
||||
get { return _efem.IsIdle && _efem.IsOnline && _efem.TrayRobotModule.IsIdle && _efem.TrayRobotModule.IsOnline && CheckTaskDone(); }
|
||||
}
|
||||
|
||||
public override bool IsOnline
|
||||
{
|
||||
get { return _efem.IsOnline && _efem.TrayRobotModule.IsOnline; }
|
||||
|
||||
}
|
||||
public override bool IsError
|
||||
{
|
||||
get { return _efem.IsError || _efem.TrayRobotModule.IsError; }
|
||||
|
||||
}
|
||||
|
||||
private EFEMModule _efem = null;
|
||||
|
||||
private Hand _taskHand;
|
||||
public SchedulerTrayRobot() : base(ModuleName.TrayRobot.ToString())
|
||||
{
|
||||
_efem = Singleton<EquipmentManager>.Instance.Modules[ModuleName.EFEM] as EFEMModule;
|
||||
}
|
||||
|
||||
|
||||
public bool IsReadyForPick(Hand blade)
|
||||
{
|
||||
return WaferManager.Instance.CheckNoWafer(ModuleName.TrayRobot, (int)blade);
|
||||
}
|
||||
|
||||
public bool IsReadyForPlace(Hand blade)
|
||||
{
|
||||
return WaferManager.Instance.CheckHasWafer(ModuleName.TrayRobot, (int)blade);
|
||||
}
|
||||
|
||||
|
||||
public bool Pick(ModuleName target, int slot, Hand hand)
|
||||
{
|
||||
if (_efem.PickTray(target, hand, slot))
|
||||
{
|
||||
_task = TaskType.Pick;
|
||||
_taskHand = hand;
|
||||
LogTaskStart(_task, $"{target}.{slot + 1}=>{Module}.{hand}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Place(ModuleName target, int slot, Hand hand)
|
||||
{
|
||||
if (_efem.PlaceTray(target, hand, slot))
|
||||
{
|
||||
_task = TaskType.Place;
|
||||
_taskHand = hand;
|
||||
LogTaskStart(_task, $"{Module}.{hand}=>{target}.{slot + 1}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Goto(ModuleName chamber, int slot, Hand hand)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Monitor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
var taskSucceed = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
taskSucceed = true;
|
||||
break;
|
||||
case TaskType.Pick:
|
||||
taskSucceed = WaferManager.Instance.CheckHasTray(ModuleName.TrayRobot, (int)_taskHand);
|
||||
break;
|
||||
case TaskType.Place:
|
||||
taskSucceed = WaferManager.Instance.CheckNoTray(ModuleName.TrayRobot, (int)_taskHand);
|
||||
break;
|
||||
}
|
||||
return SuperCheckTaskDone(taskSucceed, _efem.TrayRobotModule.IsIdle | _efem.TrayRobotModule.IsError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
using System.Linq;
|
||||
using Aitex.Core.Common;
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.Fsm;
|
||||
using Aitex.Core.Util;
|
||||
using Aitex.Sorter.Common;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.Schedulers;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicModules.LLs;
|
||||
using SicModules.UnLoads;
|
||||
using SicRT.Equipments.Systems;
|
||||
using SicRT.Modules.Schedulers;
|
||||
|
||||
namespace SicRT.Scheduler
|
||||
{
|
||||
public class SchedulerUnLoad : SchedulerModule
|
||||
{
|
||||
public override bool IsAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return _unL.IsIdle && _unL.IsOnline && CheckTaskDone() && _unL.CheckSlitValveClosed();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsOnline
|
||||
{
|
||||
get
|
||||
{
|
||||
return _unL.IsOnline;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsError
|
||||
{
|
||||
get
|
||||
{
|
||||
return _unL.IsError;
|
||||
}
|
||||
}
|
||||
|
||||
private UnLoadModuleBase _unL = null;
|
||||
|
||||
private ModuleName _taskRobot;
|
||||
private int _taskSlot;
|
||||
private int _entityTaskToken = (int)FSM_MSG.NONE;
|
||||
private bool _separated = false;
|
||||
private bool _purged = false;
|
||||
private bool _coolingCompleted = false;
|
||||
private DeviceTimer _timerCooling = new DeviceTimer();
|
||||
|
||||
public bool IsInPumping { get => _task == TaskType.Pump || _task == TaskType.Purge || _task == TaskType.PrepareTransfer; }
|
||||
|
||||
public SchedulerUnLoad(ModuleName module) : base(module.ToString())
|
||||
{
|
||||
_module = module.ToString();
|
||||
_unL = Singleton<EquipmentManager>.Instance.Modules[module] as UnLoadModuleBase;
|
||||
}
|
||||
|
||||
public override bool PrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
|
||||
{
|
||||
_task = TaskType.PrepareTransfer;
|
||||
_taskRobot = robot;
|
||||
_taskSlot = slot;
|
||||
|
||||
LogTaskStart(_task, $"{robot} {type} slot {slot + 1}");
|
||||
|
||||
return _unL.PrepareTransfer(robot, Hand.Blade1, slot, type, out _);
|
||||
}
|
||||
|
||||
internal bool CheckAtAtm()
|
||||
{
|
||||
SicLoadLock deviceLL = DEVICE.GetDevice<SicLoadLock>($"{_module}.{_module}");
|
||||
|
||||
return deviceLL.CheckAtm();
|
||||
}
|
||||
internal bool CheckAtVacuum()
|
||||
{
|
||||
SicLoadLock deviceLL = DEVICE.GetDevice<SicLoadLock>($"{_module}.{_module}");
|
||||
|
||||
return deviceLL.CheckVacuum();
|
||||
}
|
||||
internal void SetJobStatue()
|
||||
{
|
||||
SicLoadLock deviceLL = DEVICE.GetDevice<SicLoadLock>($"{_module}.{_module}");
|
||||
//deviceLL.SetJobDoneStatus();
|
||||
}
|
||||
|
||||
public override bool IsReadyForPick(ModuleName robot, int slot)
|
||||
{
|
||||
if (robot == ModuleName.WaferRobot)
|
||||
{
|
||||
return _unL.CheckReadyForTransfer(robot, Hand.Blade1, slot, EnumTransferType.Pick, out _)
|
||||
&& WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
else if (robot == ModuleName.TMRobot)
|
||||
{
|
||||
return _unL.CheckReadyForTransfer(robot, Hand.Blade1, slot, EnumTransferType.Pick, out _)
|
||||
&& WaferManager.Instance.CheckHasTray(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsReadyForPlace(ModuleName robot, int slot)
|
||||
{
|
||||
return _unL.CheckReadyForTransfer(robot, Hand.Blade1, slot, EnumTransferType.Place, out _)
|
||||
&& WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot)
|
||||
&& WaferManager.Instance.CheckNoTray(ModuleHelper.Converter(_module), slot);
|
||||
}
|
||||
|
||||
|
||||
public bool Vent()
|
||||
{
|
||||
_task = TaskType.Vent;
|
||||
|
||||
_entityTaskToken = _unL.InvokeVent();
|
||||
|
||||
LogTaskStart(_task, $"{Module} vent to ATM");
|
||||
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public bool Pump()
|
||||
{
|
||||
_entityTaskToken = _unL.InvokePump();
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
_task = TaskType.Pump;
|
||||
LogTaskStart(_task, $"{Module} pump to Vaccum");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public override bool Cooling(bool coolingType, int coolingTime)
|
||||
{
|
||||
_entityTaskToken = _unL.InvokeCooling(coolingTime);
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
_task = TaskType.Cooling;
|
||||
LogTaskStart(_task, $"{Module} cooling {coolingTime} seconds");
|
||||
}
|
||||
_coolingCompleted = _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public bool Purge(params object[] objs)
|
||||
{
|
||||
_entityTaskToken = _unL.InvokePurge(objs);
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
_task = TaskType.Purge;
|
||||
LogTaskStart(_task, $"{Module} purge for new job");
|
||||
_purged = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Monitor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool GroupWaferTray()
|
||||
{
|
||||
_entityTaskToken = _unL.InvokeGroupWaferTray();
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
|
||||
_task = TaskType.Group;
|
||||
LogTaskStart(_task, $"{Module} start group wafer and tray");
|
||||
}
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public bool SeparateWaferTray()
|
||||
{
|
||||
_entityTaskToken = _unL.InvokeSeparateWaferTray();
|
||||
if (_entityTaskToken != (int)FSM_MSG.NONE)
|
||||
{
|
||||
_task = TaskType.Separate;
|
||||
LogTaskStart(_task, $"{Module} start separate wafer and tray");
|
||||
}
|
||||
_separated = _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
return _entityTaskToken != (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
public void ResetPurgedAndSeparatedStatus()
|
||||
{
|
||||
_coolingCompleted = false;
|
||||
_separated = false;
|
||||
_purged = false;
|
||||
}
|
||||
|
||||
public bool CheckCoolingCompleted()
|
||||
{
|
||||
return _coolingCompleted;
|
||||
}
|
||||
|
||||
public override bool CheckWaferTraySeparated()
|
||||
{
|
||||
return _separated;
|
||||
}
|
||||
|
||||
public bool CheckPurged()
|
||||
{
|
||||
return _purged;
|
||||
}
|
||||
|
||||
public override bool CheckSlitValveClosed()
|
||||
{
|
||||
return _unL.CheckSlitValveClosed();
|
||||
}
|
||||
|
||||
public int? GetWaferPurgeCount(int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(Module, slot))
|
||||
return null;
|
||||
|
||||
var wi = WaferManager.Instance.GetWafer(Module, slot);
|
||||
|
||||
if (wi.ProcessJob?.Sequence == null)
|
||||
return null;
|
||||
|
||||
if (wi.NextSequenceStep >= wi.ProcessJob.Sequence.Steps.Count)
|
||||
return null;
|
||||
|
||||
if (!wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepModules.Contains(Module))
|
||||
return null;
|
||||
|
||||
if (!wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepParameter.ContainsKey("PurgeCount"))
|
||||
return null;
|
||||
|
||||
if (int.TryParse(wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepParameter["PurgeCount"].ToString(), out int purgeCount))
|
||||
{
|
||||
return purgeCount;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int? GetWaferPumpDelayTime(int slot)
|
||||
{
|
||||
if (!WaferManager.Instance.CheckHasWafer(Module, slot))
|
||||
return null;
|
||||
|
||||
var wi = WaferManager.Instance.GetWafer(Module, slot);
|
||||
|
||||
if (wi.ProcessJob?.Sequence == null)
|
||||
return null;
|
||||
|
||||
if (wi.NextSequenceStep >= wi.ProcessJob.Sequence.Steps.Count)
|
||||
return null;
|
||||
|
||||
if (!wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepModules.Contains(Module))
|
||||
return null;
|
||||
|
||||
if (!wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepParameter.ContainsKey("PumpDelayTime"))
|
||||
return null;
|
||||
|
||||
if (int.TryParse(wi.ProcessJob.Sequence.Steps[wi.NextSequenceStep].StepParameter["PumpDelayTime"].ToString(), out int pumpDelayTime))
|
||||
{
|
||||
return pumpDelayTime;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
var taskSucceed = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
taskSucceed = true;
|
||||
break;
|
||||
case TaskType.PrepareTransfer:
|
||||
taskSucceed = _unL.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Cooling:
|
||||
taskSucceed = _unL.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Vent:
|
||||
taskSucceed = _unL.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Pump:
|
||||
taskSucceed = _unL.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Group:
|
||||
taskSucceed = _unL.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Purge:
|
||||
taskSucceed = _unL.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
case TaskType.Separate:
|
||||
taskSucceed = _unL.CheckAcked(_entityTaskToken);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return SuperCheckTaskDone(taskSucceed, _unL.IsIdle | _unL.IsError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using Aitex.Core.Util;
|
||||
using Aitex.Sorter.Common;
|
||||
using SicRT.Modules.Schedulers;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using SicModules.EFEMs;
|
||||
using SicRT.Equipments.Systems;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.EFEM;
|
||||
|
||||
namespace SicRT.Scheduler
|
||||
{
|
||||
public class SchedulerWaferRobot : SchedulerModule
|
||||
{
|
||||
public override bool IsAvailable
|
||||
{
|
||||
get { return _efem.IsIdle && _efem.IsOnline && _efem.WaferRobotModule.IsIdle && _efem.WaferRobotModule.IsOnline && CheckTaskDone(); }
|
||||
}
|
||||
|
||||
public override bool IsOnline
|
||||
{
|
||||
get { return _efem.IsOnline && _efem.WaferRobotModule.IsOnline; }
|
||||
|
||||
}
|
||||
public override bool IsError
|
||||
{
|
||||
get { return _efem.IsError || _efem.WaferRobotModule.IsError; }
|
||||
|
||||
}
|
||||
|
||||
private EFEMModule _efem = null;
|
||||
|
||||
private Hand _taskHand;
|
||||
|
||||
private Hand _taskSwapPickHand;
|
||||
private Hand _taskSwapPlaceHand;
|
||||
|
||||
public SchedulerWaferRobot() : base(ModuleName.WaferRobot.ToString())
|
||||
{
|
||||
_efem = Singleton<EquipmentManager>.Instance.Modules[ModuleName.EFEM] as EFEMModule;
|
||||
}
|
||||
|
||||
|
||||
public bool IsReadyForPick(Hand blade)
|
||||
{
|
||||
return WaferManager.Instance.CheckNoWafer(ModuleName.WaferRobot, (int)blade);
|
||||
}
|
||||
|
||||
public bool IsReadyForPlace(Hand blade)
|
||||
{
|
||||
return WaferManager.Instance.CheckHasWafer(ModuleName.WaferRobot, (int)blade);
|
||||
}
|
||||
|
||||
|
||||
public bool Pick(ModuleName target, int slot, Hand hand)
|
||||
{
|
||||
if (_efem.PickWafer(target, hand, slot))
|
||||
{
|
||||
_task = TaskType.Pick;
|
||||
_taskHand = hand;
|
||||
LogTaskStart(_task, $"{target}.WaferRobot.{slot + 1}=>{Module}.{hand}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Place(ModuleName target, int slot, Hand hand)
|
||||
{
|
||||
if (_efem.PlaceWafer(target, hand, slot))
|
||||
{
|
||||
_task = TaskType.Place;
|
||||
_taskHand = hand;
|
||||
LogTaskStart(_task, $"{Module}.WaferRobot.{hand}=>{target}.{slot + 1}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Map(ModuleName target)
|
||||
{
|
||||
if (_efem.MapWafer(target))
|
||||
{
|
||||
_task = TaskType.Map;
|
||||
LogTaskStart(_task, $"{Module}.WaferRobot Map");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Goto(ModuleName chamber, int slot, Hand hand)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Monitor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CheckTaskDone()
|
||||
{
|
||||
var taskSucceed = false;
|
||||
switch (_task)
|
||||
{
|
||||
case TaskType.None:
|
||||
taskSucceed = true;
|
||||
break;
|
||||
case TaskType.Pick:
|
||||
taskSucceed = WaferManager.Instance.CheckHasWafer(ModuleName.WaferRobot, (int)_taskHand);
|
||||
break;
|
||||
case TaskType.Place:
|
||||
taskSucceed = WaferManager.Instance.CheckNoWafer(ModuleName.WaferRobot, (int)_taskHand);
|
||||
break;
|
||||
}
|
||||
|
||||
return SuperCheckTaskDone(taskSucceed, _efem.WaferRobotModule.IsIdle | _efem.WaferRobotModule.IsError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.SCCore;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Breakers.NSXCOM;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.UPS;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Temps;
|
||||
|
||||
namespace SicRT.Instances
|
||||
{
|
||||
public class DeviceEntity : DeviceEntityT<DeviceManager>
|
||||
{
|
||||
public DeviceEntity()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceManager : DeviceManagerBase
|
||||
{
|
||||
public DeviceManager()
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Initialize()
|
||||
{
|
||||
//if (SC.GetConfigItem("AETemp.EnableDevice").BoolValue)
|
||||
//{
|
||||
// string _address = SC.GetStringValue("AETemp.Address");
|
||||
// bool _enableLog = SC.GetValue<bool>("AETemp.EnableLogMessage");
|
||||
|
||||
// var aeTemp = new AETemp("PM", "AETemp", "AETemp");
|
||||
// aeTemp.Initialize(_address, _enableLog);
|
||||
// QueueDevice(aeTemp);
|
||||
//}
|
||||
|
||||
if (SC.GetConfigItem("NSXBreakerII.EnableDevice").BoolValue)
|
||||
{
|
||||
var NSX = new NSXBreakerII("TM", "NSXBreakerII", "NSXBreakerII");
|
||||
NSX.Initialize();
|
||||
}
|
||||
|
||||
if (SC.GetConfigItem("PM.PM1.ITAUPSA.EnableDevice").BoolValue)
|
||||
{
|
||||
var ITPM1A = new ITAUPS("PM1", "ITAUPSA", "ITAUPSA");
|
||||
ITPM1A.Initialize();
|
||||
QueueDevice(ITPM1A);
|
||||
}
|
||||
|
||||
if (SC.GetConfigItem("PM.PM1.ITAUPSB.EnableDevice").BoolValue)
|
||||
{
|
||||
var ITPM1B = new ITAUPS("PM1", "ITAUPSB", "ITAUPSB");
|
||||
ITPM1B.Initialize();
|
||||
QueueDevice(ITPM1B);
|
||||
}
|
||||
|
||||
if (SC.GetConfigItem("PM.PM2.ITAUPSA.EnableDevice").BoolValue)
|
||||
{
|
||||
var ITPM2A = new ITAUPS("PM2", "ITAUPSA", "ITAUPSA");
|
||||
ITPM2A.Initialize();
|
||||
QueueDevice(ITPM2A);
|
||||
}
|
||||
|
||||
if (SC.GetConfigItem("PM.PM2.ITAUPSB.EnableDevice").BoolValue)
|
||||
{
|
||||
var ITPM2B = new ITAUPS("PM2", "ITAUPSB", "ITAUPSB");
|
||||
ITPM2B.Initialize();
|
||||
QueueDevice(ITPM2B);
|
||||
}
|
||||
|
||||
if (SC.GetConfigItem("PM.PM1.EATONUPS.EnableDevice").BoolValue)
|
||||
{
|
||||
var EATONUPS1 = new EATONUPS("PM1", "EATONUPS", "EATONUPS");
|
||||
EATONUPS1.Initialize();
|
||||
QueueDevice(EATONUPS1);
|
||||
}
|
||||
|
||||
if (SC.GetConfigItem("PM.PM2.EATONUPS.EnableDevice").BoolValue)
|
||||
{
|
||||
var EATONUPS2 = new EATONUPS("PM2", "EATONUPS", "EATONUPS");
|
||||
EATONUPS2.Initialize();
|
||||
QueueDevice(EATONUPS2);
|
||||
}
|
||||
|
||||
//if (SC.GetConfigItem("AKunTemp.EnableDevice").BoolValue)
|
||||
//{
|
||||
// var AkOptics = new AKunTemp("PM1", "AKunTemp");
|
||||
// AkOptics.Initialize();
|
||||
// QueueDevice(AkOptics);
|
||||
//}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void QueueDevice(IDevice device)
|
||||
{
|
||||
QueueDevice($"{device.Module}.{device.Name}", device);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user