首次上传

This commit is contained in:
hanqiangqiang
2026-03-24 15:04:02 +08:00
commit 2e080a8764
1392 changed files with 406579 additions and 0 deletions
@@ -0,0 +1,404 @@
using System;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.RT.Routine;
using Aitex.Core.Util;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
using MECF.Framework.Common.MECF.Framework.Common.RecipeCenter.Recipe;
using SicModules.PMs.Routines;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.RecipeExecutions
{
public class CleanRecipe : PMBaseRoutine
{
public enum RoutineStep
{
SetServoUp,
SetChamberPressure,
EnableRotation,
OpenH2Valve,
EnableHeater,
PcCalibartion,
RunStepOne,
Wait,
CheckCondition,
WaitTempReach,
}
enum RecipeRunningState
{
Error,
RecipeCompleted,
ExecStep,
TimeWait,
ConditionWait,
StepCompleted,
Paused,
}
private string _recipeName;
private object _recipeLocker = new object();
private bool _isPSUHeaterJumpMode;
private bool _isSCRHeaterJumpMode;
private bool _isMFCJumpMode;
private int _currentStepNumber;
private DeviceTimer _stepTimer = new DeviceTimer();
private DeviceTimer _recipeTimer = new DeviceTimer();
private RecipeRunningState _state = RecipeRunningState.ExecStep;
private PMServoToPressure _pmServoToPressure;
public CleanRecipe(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "CleanRecipe";
_pmServoToPressure = new PMServoToPressure(module, pm1);
}
public void Init(string recipeName)
{
if (!recipeName.Contains("Sic\\Clean\\") && recipeName!="")
{
recipeName = "Sic\\Clean\\" + recipeName;
}
_recipeName = recipeName;
}
public override Result Start(params object[] objs)
{
Reset();
if (!RecipeParser.Parse(_recipeName, Module, out var recipeHead, out var recipeSteps, out string reason))
{
Stop($"Load recipe {_recipeName} failed, {reason}");
return Result.FAIL;
}
if (WaferManager.Instance.CheckHasWafer(PmDevice.Module, 0))
{
EV.PostWarningLog(Module, $"can not run clean recipe, Has wafer at {Module}");
return Result.FAIL;
}
if (!PmDevice.Pump.IsOn || PmDevice.Pump.IsError)
{
EV.PostWarningLog(Module, $"can not run process, pump state is not correct");
return Result.FAIL;
}
if (!PmDevice._ioThrottleValve.TVValveEnable)
{
EV.PostWarningLog(Module, $"can not run process, TV is not enable");
return Result.FAIL;
}
if (PmDevice._ioThrottleValve.ControlModeFeedback != PressureCtrlMode.TVPressureCtrl)
{
EV.PostWarningLog(Module, $"can not run process, TV is not Pressure Ctrol Mode");
return Result.FAIL;
}
if (!PmDevice.CheckIOValueByGroup(IoGroupName.I, true))
{
EV.PostAlarmLog(Module, $"can not run process,I valves is not open!");
return Result.FAIL;
}
if (!PmDevice.CheckIOValueByGroup(IoGroupName.E, false))
{
EV.PostAlarmLog(Module, $"can not run process,E valves is not closed!");
return Result.FAIL;
}
if (!PmDevice.CheckIOValueByGroup(IoGroupName.K, false))
{
EV.PostAlarmLog(Module, $"can not run process,K valves is not closed!");
return Result.FAIL;
}
if (!PmDevice.CheckIOValueByGroup(IoGroupName.VentPump, true))
{
EV.PostAlarmLog(Module, $"can not run process,V72 is not open!");
return Result.FAIL;
}
if (!PmDevice.PSU1.AllHeatEnable)
{
EV.PostAlarmLog(Module, $"can not run process,Heater is disable!");
return Result.FAIL;
}
_currentStepNumber = 0;
PmDevice.RecipeRunningInfo.RecipeName = _recipeName;
PmDevice.RecipeRunningInfo.Head = recipeHead;
PmDevice.RecipeRunningInfo.RecipeStepList = recipeSteps;
PmDevice.RecipeRunningInfo.TotalTime = CalcRecipeTime();
_state = RecipeRunningState.ExecStep;
return Result.RUN;
}
public override Result Monitor()
{
try
{
SetConfinementRingUpAndWait((int)RoutineStep.SetServoUp, 30);
ExecuteRoutine((int)RoutineStep.SetChamberPressure, _pmServoToPressure);
EnableRotation((int)RoutineStep.EnableRotation, 5);
OpenH2Valve((int)RoutineStep.OpenH2Valve, PmDevice, 2);
EnableHeater((int)RoutineStep.EnableHeater, PmDevice, 5);
MonitorRecipeRunInfo();
lock (_recipeLocker)
{
try
{
switch (_state)
{
case RecipeRunningState.ExecStep:
if (_currentStepNumber == 0)
{
_recipeTimer.Start(int.MaxValue);
}
_stepTimer.Start(PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime * 1000);
Notify($"Running step {_currentStepNumber + 1} : {PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName}");
//执行工艺程序命令
foreach (var recipeCmd in PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands.Keys)
{
if (recipeCmd == "SusHeaterSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd] == "Jump")
_isPSUHeaterJumpMode = true;
else
_isPSUHeaterJumpMode = false;
continue;
}
if (recipeCmd == "WWHeaterSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd] == "Jump")
_isSCRHeaterJumpMode = true;
else
_isSCRHeaterJumpMode = false;
continue;
}
if (recipeCmd == "FlowSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd] == "Jump")
_isMFCJumpMode = true;
else
_isMFCJumpMode = false;
continue;
}
if (IsCmdSkip(recipeCmd)) // 不是注册的方法,需要跳过
continue;
if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out string reason, PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd]))
{
EV.PostAlarmLog(Module, $"Can not execute {recipeCmd}, {reason}");
return Result.FAIL;
}
else
{
int time = (int)PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime * 1000;
if (recipeCmd.StartsWith("TC1") && _isPSUHeaterJumpMode)
{
time = 1;
}
if (recipeCmd.StartsWith("TC2") && _isSCRHeaterJumpMode)
{
time = 1;
}
if (recipeCmd.StartsWith("Mfc") && recipeCmd.EndsWith(".Ramp") && !PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsDummyStep)
{
if (_isMFCJumpMode)
{
time = 1;
}
}
if ((recipeCmd == "TV.SetPressure"
|| recipeCmd == "PMServo.SetActualSpeed"
|| recipeCmd.StartsWith("Pressure") && recipeCmd.EndsWith(".Ramp")
|| recipeCmd.StartsWith("Mfc") && recipeCmd.EndsWith(".Ramp"))
&& !PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsDummyStep)
{
if (_currentStepNumber >= 1)
{
int previousStepNumber = _currentStepNumber - 1;
if (PmDevice.RecipeRunningInfo.RecipeStepList[previousStepNumber].IsDummyStep)
previousStepNumber = _currentStepNumber - 2;
if (PmDevice.RecipeRunningInfo.RecipeStepList[previousStepNumber].RecipeCommands.ContainsKey(recipeCmd))
{
string previousValue = PmDevice.RecipeRunningInfo.RecipeStepList[previousStepNumber].RecipeCommands[recipeCmd];
string currentValue = PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd];
if (previousValue == currentValue)
{
time = 1;
}
}
}
}
OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd]);
}
}
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].EndBy == EnumEndByCondition.ByTime)
_state = RecipeRunningState.TimeWait;
else
_state = RecipeRunningState.ConditionWait;
break;
case RecipeRunningState.TimeWait:
if (_stepTimer.IsTimeout())
{
_state = RecipeRunningState.StepCompleted;
}
break;
case RecipeRunningState.ConditionWait:
{
if (_stepTimer.IsTimeout())
{
_state = RecipeRunningState.StepCompleted;
}
}
break;
case RecipeRunningState.StepCompleted:
_currentStepNumber++;
if (_currentStepNumber >= PmDevice.RecipeRunningInfo.RecipeStepList.Count)
{
_currentStepNumber = PmDevice.RecipeRunningInfo.RecipeStepList.Count - 1;
_state = RecipeRunningState.RecipeCompleted;
}
else
{
_state = RecipeRunningState.ExecStep;
}
break;
case RecipeRunningState.RecipeCompleted:
{
_recipeTimer.Stop();
Notify("Finished");
return Result.DONE;
}
}
return Result.RUN;
}
catch (Exception ex)
{
LOG.Write(ex);
return Result.FAIL;
}
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
catch (Exception ex)
{
LOG.Write(ex, String.Format("CleanRecipe has exception"));
throw (ex);
}
Notify("Finished");
return Result.DONE;
}
protected void EnableHeater(int id, PMModuleBase pm, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Set {pm.Name} Heater Enable");
if (!pm.EnableHeater(true, out string reason))
{
Stop($"Set {pm.Name} Heater Enable failed, {reason}");
return false;
}
return true;
}, () =>
{
return pm.CheckHeaterEnable();
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
if (ret.Item2 == Result.TIMEOUT)
{
Stop($"Set {pm.Name} Heater Enable timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
protected int CalcRecipeTime()
{
double total = 0;
for (int i = 0; i < PmDevice.RecipeRunningInfo.RecipeStepList.Count; i++)
{
if (!PmDevice.RecipeRunningInfo.RecipeStepList[i].IsDummyStep) // 不统计虚拟Step的时间
{
total += PmDevice.RecipeRunningInfo.RecipeStepList[i].StepTime;
}
}
return (int)total;
}
private void MonitorRecipeRunInfo()
{
try
{
PmDevice.RecipeRunningInfo.StepNumber = _currentStepNumber + 1;
PmDevice.RecipeRunningInfo.StepName = PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName;
PmDevice.RecipeRunningInfo.StepTime = PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime;
PmDevice.RecipeRunningInfo.TotalElapseTime = _recipeTimer.GetElapseTime() / 1000;
}
catch (Exception ex)
{
}
}
}
}
@@ -0,0 +1,188 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Xml;
using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.SCCore;
using Aitex.Core.Util;
using MECF.Framework.Common.CommonData;
using MECF.Framework.Common.SCCore;
namespace SicModules.PMs.RecipeExecutions
{
public class Fdc
{
public List<FdcDataItem> DataList
{
get
{
return _lstItems;
}
}
private List<FdcDataItem> _lstItems = new List<FdcDataItem>();
private PeriodicJob _monitorThread;
private string _module;
private Stopwatch _delaytimer = new Stopwatch();
private int _delayTime;
private Dictionary<string, string> _setpointDataMap = new Dictionary<string, string>();
public Fdc(string module )
{
_monitorThread = new PeriodicJob(300, OnMonitor, "fdc thread");
_module = module;
}
public void Reset()
{
_lstItems.Clear();
_setpointDataMap.Clear();
string groupName = SC.GetStringValue("System.FDC.DataGroupName");
if (string.IsNullOrEmpty(groupName))
groupName = "Process";
int interval = SC.GetValue<int>("System.FDC.SampleInterval");
if (interval < 50)
interval = 50;
_delayTime = SC.GetValue<int>("System.FDC.DelayTime");
if (_delayTime < 0)
_delayTime = 10;
var content = TypedConfigManager.Instance.GetTypedConfigContent("DataGroup", "");
XmlDocument xmlContent = new XmlDocument();
xmlContent.LoadXml(content);
var items = xmlContent.SelectNodes($"DataGroupConfig/DataGroup[@name='{groupName}']/DataItem");
foreach (var item in items)
{
var node = item as XmlElement;
string name = node.GetAttribute("name");
if (!string.IsNullOrEmpty(name) && name.StartsWith($"{_module}.") && (_lstItems.FirstOrDefault(x=>x.Name==name)==null))
{
var dataType = Singleton<DataManager>.Instance.GetDataType(name);
if (dataType == typeof(double) || dataType == typeof(float) ||
dataType == typeof(int) || dataType == typeof(ushort) || dataType == typeof(short))
{
_lstItems.Add(new FdcDataItem()
{
Name = name,
});
}
}
}
var fdcMap = xmlContent.SelectNodes($"DataGroupConfig/DataGroup[@name='Fdc']/DataItem");
foreach (var item in fdcMap)
{
var node = item as XmlElement;
string name = node.GetAttribute("name");
if (!string.IsNullOrEmpty(name) && name.StartsWith($"{_module}.") && (_lstItems.FirstOrDefault(x => x.Name == name) != null))
{
string controlName = node.GetAttribute("control_name");
if (!string.IsNullOrEmpty(controlName))
_setpointDataMap[name] = controlName;
}
}
_monitorThread.ChangeInterval(interval);
}
//pair: controlname - setpoint value
public void Start(Dictionary<string, string> setpointControlData)
{
ClearPreviousData();
foreach (var fdcDataItem in _lstItems)
{
if (!_setpointDataMap.ContainsKey(fdcDataItem.Name))
continue;
if (!setpointControlData.ContainsKey(_setpointDataMap[fdcDataItem.Name]))
continue;
if (!float.TryParse(setpointControlData[_setpointDataMap[fdcDataItem.Name]], out float floatValue))
continue;
fdcDataItem.SetPoint = floatValue;
}
_delaytimer.Restart();
_monitorThread.Start();
}
public void Stop()
{
_monitorThread.Pause();
ClearPreviousData();
}
public void ClearPreviousData()
{
foreach (var fdcDataItem in _lstItems)
{
fdcDataItem.Clear();
}
}
private bool OnMonitor()
{
try
{
if (_delaytimer.IsRunning)
{
if (_delaytimer.ElapsedMilliseconds < _delayTime)
return true;
else
{
_delaytimer.Stop();
}
}
foreach (var fdcDataItem in _lstItems)
{
var objValue = DATA.Poll(fdcDataItem.Name);
float floatValue = 0f;
if (objValue != null)
{
float.TryParse(objValue.ToString(), out floatValue);
}
fdcDataItem.Update(floatValue);
}
}
catch (Exception ex)
{
LOG.Write(ex);
}
return true;
}
}
}
@@ -0,0 +1,16 @@
using System.Collections.Generic;
using MECF.Framework.Common.CommonData;
namespace SicModules.PMs.RecipeExecutions
{
public interface IRecipeDBCallback
{
void RecipeStart(string module, int slot, string guid, string recipeName);
void RecipeComplete(string guid);
void RecipeStepStart(string recipeGuid, int stepNumber, string stepName, float stepTime);
void RecipeStepEnd(string recipeGuid, int stepNumber, List<FdcDataItem> data);
void RecipeFailed(string guid);
}
}
@@ -0,0 +1,22 @@
using MECF.Framework.Common.MECF.Framework.Common.RecipeCenter.Recipe;
namespace SicModules.PMs.RecipeExecutions
{
public interface IRecipeExecutor
{
bool IsError { get; }
bool IsPaused { get; set; }
RecipeRunningInfo RecipeRunningInfo { get;}
bool CheckEnableRunProcess(out string reason);
void ResetToleranceChecker();
void OnProcessStart(string v1, string recipeName, bool v2);
void PauseRecipe(out string reason);
bool CheckEndPoint();
bool CheckAllDevicesStable(float v1, float v2, float v3, float v4, float v5, float v6, float v7, float v8, float v9);
void AbortRunProcess(out string reason);
}
}
@@ -0,0 +1,291 @@
using System.Collections.Generic;
using System.Diagnostics;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.RecipeExecutions
{
public class PostProcess : PMBaseRoutine
{
private enum RoutineStep
{
SetV31,
SetV32,
SetV35V36,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupK,
SetGroupD,
SetGroupG,
SetV65,
SetV68,
SetM1to16,
SetM17M18,
SetM2toM40,
SetPC,
SetEPV2,
VentPumpClose,
SetGroupV25,
SetGroupJOpen,
SetTVEnable,
SetTVPressMode,
SetPressUpOrDown,
SetPressureUp,
WaitPressureUp,
EnableRotation,
SetRotation1,
SetRotation2,
EnableTC1,
SetTC1Mode,
SetTC1Ratio,
SetTC1Ratio1,
CloseTC1,
SetScrReset,
EnableTC2,
SetTC2Mode,
SetTC2Ratio,
SetTC2Ratio1,
CloseTC2,
WaitRotation1,
SetV103,
SetV105,
TimeDelay1,
TimeDelay2,
TimeDelay3,
}
private int _IoValueOpenCloseTimeout = 10;
private int _routineTimeOut = 10;
private IoThrottleValve2 _IoThrottle;
private double _pmPressureMaxDiff;
private int _throttleTimeout;
private double _pressureMax;
private int _rotationSpeed = 60;
private bool _psuHeatEnable = false;
private int _psuHeatMode = 0;
private float _psuL1Ratio = 0;
private float _psuL2Ratio = 0;
private float _psuL3Ratio = 0;
private bool _scrHeatEnable = false;
private int _scrHeatMode = 0;
private float _scrL1Ratio = 0;
private float _scrL2Ratio = 0;
private float _scrL3Ratio = 0;
private IoInterLock _pmInterLock;
private Stopwatch _swTimer = new Stopwatch();
public PostProcess(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "PostProcess";
_pmInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public override Result Start(params object[] objs)
{
Reset();
if (SC.GetValue<bool>("System.IsATMMode"))
{
return Result.DONE;
}
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.ProcessIdle.RoutineTimeOut");
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
_throttleTimeout = SC.GetValue<int>($"PM.{Module}.ThrottlePressureTimeout");
_pressureMax = SC.GetValue<double>($"PM.{Module}.ProcessIdle.FinalPressure");
_rotationSpeed = SC.GetValue<int>($"PM.{Module}.ProcessIdle.RotationSpeed");
_psuHeatEnable = SC.GetValue<bool>($"PM.{Module}.ProcessIdle.PSUHeaterEnable");
_psuHeatMode = SC.GetValue<int>($"PM.{Module}.ProcessIdle.PSUHeaterMode");
_psuL1Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUInnerRatio");
_psuL2Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUMiddleRatio");
_psuL3Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUOuterRatio");
_scrHeatEnable = SC.GetValue<bool>($"PM.{Module}.ProcessIdle.SCRHeaterEnable");
_scrHeatMode = SC.GetValue<int>($"PM.{Module}.ProcessIdle.SCRHeaterMode");
_scrL1Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.SCRUpperRatio");
_scrL2Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.SCRMiddleRatio");
_scrL3Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.SCRLowerRatio");
if (!_pmInterLock.SetPMPostProcessRunning(true, out string reason))
{
EV.PostAlarmLog(Module, $"can not run PostProcess, {reason}");
return Result.FAIL;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
////打开V65
//SetIoValueByGroup((int)RoutineStep.SetV65, IoGroupName.V65, true, _IoValueOpenCloseTimeout);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
//M2、M9、M15、M19-M40 MFC 30s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 5);
//M1 - M16 MFC 30s ramp 到 default 值(M2、M9、M15除外)
SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, 5);
SetMfcToDefaultByGroup((int)RoutineStep.SetM17M18, MfcGroupName.M17M18, 5);
//所有PC设定为默认值
SetPcToDefault((int)RoutineStep.SetPC, _lstPcList);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
//打开J Valves
SetIoValueByGroup((int)RoutineStep.SetGroupJOpen, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//打开V72,关闭V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, false, _IoValueOpenCloseTimeout);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//使用动态流量伺服到300mbar
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown, PressureUpOrDown.Uping);
SetThrottleToTargetAndNoWait((int)RoutineStep.SetPressureUp, _IoThrottle, _pressureMax);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.WaitPressureUp, _IoThrottle, _pressureMax, _pmPressureMaxDiff, _throttleTimeout);
//转速Enable,加热Enable, 电流功率可配置
EnableRotation((int)RoutineStep.EnableRotation, 5);
SetRotationValveAndNoWait((int)RoutineStep.SetRotation1, _rotationSpeed);
if (_psuHeatEnable)
{
//打开PSU加热
SetPSUEnable((int)RoutineStep.EnableTC1, true, 5);
SetPSUHeatMode((int)RoutineStep.SetTC1Mode, _psuHeatMode);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
SetPSUHeatRatio((int)RoutineStep.SetTC1Ratio, _psuL1Ratio, _psuL2Ratio, _psuL3Ratio);
}
else
{
//关闭PSU加热
SetPSUHeatRatio((int)RoutineStep.SetTC1Ratio1, 0, 0, 0);
SetPSUEnable((int)RoutineStep.CloseTC1, false, 5);
}
if (_scrHeatEnable)
{
//打开SCR加热
SetSCRReset((int)RoutineStep.SetScrReset);
TimeDelay((int)RoutineStep.TimeDelay2, 1);
SetSCREnable((int)RoutineStep.EnableTC2, true, 5);
SetSCRHeatMode((int)RoutineStep.SetTC2Mode, _scrHeatMode);
TimeDelay((int)RoutineStep.TimeDelay3, 1);
SetSCRHeatRatio((int)RoutineStep.SetTC2Ratio, _scrL1Ratio, _scrL2Ratio, _scrL3Ratio);
}
else
{
//关闭SCR加热
SetSCRHeatRatio((int)RoutineStep.SetTC1Ratio1, 0, 0, 0);
SetSCREnable((int)RoutineStep.CloseTC2, false, 5);
}
WaitRotationValve((int)RoutineStep.WaitRotation1, _rotationSpeed, true, _rotationSpeed / 2);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
_pmInterLock.SetPMPostProcessRunning(false, out _);
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
return Result.DONE;
}
private void CheckRoutineTimeOut()
{
if (_routineTimeOut > 10)
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
EV.PostAlarmLog(Module, $"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
}
public override void Abort()
{
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetHeaterStopRamp();
PmDevice.SetRotationStopRamp();
_pmInterLock.SetPMPostProcessRunning(false, out _);
base.Abort();
}
}
}
@@ -0,0 +1,573 @@
using System;
using System.Collections.Generic;
using Aitex.Core.Common;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Device.Bases;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
using SicModules.PMs.Routines;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.RecipeExecutions
{
public class PreProcess : PMBaseRoutine
{
public enum RoutineStep
{
SetServoUp,
SetChamberPressure,
EnableRotation,
OpenH2Valve,
EnableHeater,
PcCalibartion,
RunStepOne,
Wait,
CheckCondition,
WaitTempReach,
SetRotation,
TimeDelay1,
//DelayForTest,
//CheckDoor,
//CheckDryPump,
//CloseSlitValve,
//CloseAllVavle,
//OpenPumpingValve,
//OpenGateVlave,
//CheckVAC,
//SetRfMatchMode,
//SetElectrodeTemp,
//NoteInProcess,
//NoteProcessFailed,
//SetThrottlePressureControlMode,
//Pump,
//End,
//NoteProcessComplete,
}
private double _pumpBasePressure;
private int _pumpTimeout;
private string _recipeName;
private bool _isCleanRecipe;
private bool _withWafer;
private bool _isSlitDoorOpened;
private ThrottleValveBase _throttleValve;
private bool _isThrottlePressureControlMode;
private Guid _guidProcess;
private bool _isDryRun;
private bool _isPSUHeaterJumpMode;
private bool _isSCRHeaterJumpMode;
private bool _isMFCJumpMode;
private int _delayTimeRamp;
private int _servoUpDelay;
private double _targetPressure;
private double _preTemp;
private int _rotationSpeed;
private IoInterLock _pmInterLock;
private PMServoToPressure _pmServoToPressure;
private PMPcCalibrationRoutine _pmPcCalibrationRoutine;
public PreProcess(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "PreProcess";
_pmInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
_pmServoToPressure = new PMServoToPressure(module, pm1);
_pmPcCalibrationRoutine = new PMPcCalibrationRoutine(module, pm1);
}
public void Init(string recipeName, bool isClean, bool withWafer)
{
_recipeName = recipeName;
_isCleanRecipe = isClean;
_withWafer = withWafer;
}
public override Result Start(params object[] objs)
{
Reset();
if (!RecipeParser.Parse(_recipeName, Module, out var recipeHead, out var recipeSteps, out string reason))
{
Stop($"Load recipe {_recipeName} failed, {reason}");
return Result.FAIL;
}
if (!RecipeParser.CheckDataAvalible(_recipeName, Module, out string reason1))
{
Stop($"Recipe data is error! " + reason1);
return Result.FAIL;
}
if (!_withWafer && WaferManager.Instance.CheckHasWafer(PmDevice.Module, 0))
{
EV.PostWarningLog(Module, $"can not run waferless process, Has wafer at {Module}");
return Result.FAIL;
}
if (_withWafer && !WaferManager.Instance.CheckHasWafer(PmDevice.Module, 0))
{
EV.PostWarningLog(Module, $"can not run process, no wafer at {Module}");
return Result.FAIL;
}
if (!PmDevice.Pump.IsOn || PmDevice.Pump.IsError)
{
EV.PostWarningLog(Module, $"can not run process, pump state is not correct");
return Result.FAIL;
}
if (!PmDevice._ioThrottleValve.TVValveEnable)
{
EV.PostWarningLog(Module, $"can not run process, TV is not enable");
return Result.FAIL;
}
if (PmDevice._ioThrottleValve.ControlModeFeedback != PressureCtrlMode.TVPressureCtrl)
{
EV.PostWarningLog(Module, $"can not run process, TV is not Pressure Ctrol Mode");
return Result.FAIL;
}
if (!PmDevice.CheckIOValueByGroup(IoGroupName.I, true))
{
EV.PostAlarmLog(Module, $"can not run process,I valves is not open!");
return Result.FAIL;
}
if (!PmDevice.CheckIOValueByGroup(IoGroupName.E, false))
{
EV.PostAlarmLog(Module, $"can not run process,E valves is not closed!");
return Result.FAIL;
}
if (!PmDevice.CheckIOValueByGroup(IoGroupName.K, false))
{
EV.PostAlarmLog(Module, $"can not run process,K valves is not closed!");
return Result.FAIL;
}
if (!PmDevice.CheckIOValueByGroup(IoGroupName.VentPump, true))
{
EV.PostAlarmLog(Module, $"can not run process,V72 is not open!");
return Result.FAIL;
}
if (!PmDevice.PSU1.AllHeatEnable)
{
EV.PostAlarmLog(Module, $"can not run process,Heater is disable!");
return Result.FAIL;
}
if (!_pmInterLock.SetPMPreProcessRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not run preProcess, {reason}");
return Result.FAIL;
}
_rotationSpeed = SC.GetValue<int>($"PM.{Module}.ProcessIdle.RotationSpeed");
_isDryRun = SC.GetValue<bool>($"PM.{Module}.DryRun.IsDryRun");
_delayTimeRamp = SC.GetValue<int>($"PM.{Module}.PreProcess.RampDelayTime");
_servoUpDelay = SC.GetValue<int>($"PM.{Module}.PreProcess.ServoBeforeUpDelay");
_targetPressure = SC.GetValue<double>($"PM.{Module}.PreProcess.ChamberPressure");
_preTemp = SC.GetValue<double>($"PM.{Module}.PreProcess.ProcessBeginTempCondition"); //等待温度到达这个温度才开始工艺
_pmServoToPressure.Init(_targetPressure);
_guidProcess = Guid.NewGuid();
PmDevice.RecipeRunningInfo.RecipeName = _recipeName;
PmDevice.RecipeRunningInfo.Head = recipeHead;
PmDevice.RecipeRunningInfo.RecipeStepList = recipeSteps;
Notify($"Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//EnableRotation((int)RoutineStep.EnableRotation, 5);
//SetRotationValveAndNoWait((int)RoutineStep.SetRotation, _rotationSpeed);
//TimeDelay((int)RoutineStep.TimeDelay1, _servoUpDelay);
//SetConfinementRingUpAndWait((int)RoutineStep.SetServoUp, 30);
if (SC.GetValue<bool>("System.IsSimulatorMode"))
{
return Result.DONE;
}
ExecuteRoutine((int)RoutineStep.SetChamberPressure, _pmServoToPressure);
OpenH2Valve((int)RoutineStep.OpenH2Valve, PmDevice, 2);
EnableHeater((int)RoutineStep.EnableHeater, PmDevice, 5);
if (!_isDryRun) // 空跑工艺
{
RunStepOne((int)RoutineStep.RunStepOne, PmDevice, _delayTimeRamp);
Wait((int)RoutineStep.Wait, $"Chamber:{Name}:Wait", _delayTimeRamp);
CheckCondition((int)RoutineStep.CheckCondition, PmDevice, PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands);
WaitTempratureToBeginProcess((int)RoutineStep.WaitTempReach, _preTemp, 600);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
//NoteProcessFailed((int)Routine.NoteProcessFailed);
return Result.FAIL;
}
catch (Exception ex)
{
LOG.Write(ex, String.Format("Preprocess Monitor has exception"));
throw (ex);
}
_pmInterLock.SetPMPreProcessRunning(false, out string reason);
Notify("Finished");
return Result.DONE;
}
protected void EnableHeater(int id, PMModuleBase pm, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Set {pm.Name} Heater Enable");
if (!pm.EnableHeater(true, out string reason))
{
Stop($"Set {pm.Name} Heater Enable failed, {reason}");
return false;
}
return true;
}, () =>
{
return pm.CheckHeaterEnable();
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
if (ret.Item2 == Result.TIMEOUT)
{
Stop($"Set {pm.Name} Heater Enable timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
protected void RunStepOne(int id, PMModuleBase pm, int delayTime)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Run {pm.Name} recipe step one");
string reason = string.Empty;
//执行工艺程序命令
foreach (var recipeCmd in PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands.Keys)
{
if (recipeCmd == "SusHeaterSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd] == "Jump")
_isPSUHeaterJumpMode = true;
else
_isPSUHeaterJumpMode = false;
continue;
}
if (recipeCmd == "WWHeaterSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd] == "Jump")
_isSCRHeaterJumpMode = true;
else
_isSCRHeaterJumpMode = false;
continue;
}
if (recipeCmd == "FlowSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd] == "Jump")
_isMFCJumpMode = true;
else
_isMFCJumpMode = false;
continue;
}
if (IsCmdSkip(recipeCmd))
continue;
if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out reason, PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]))
{
Stop($"Can not execute {recipeCmd}, {reason}");
return false;
}
else
{
int time = delayTime * 1000;
if (recipeCmd.StartsWith("TC1") && _isPSUHeaterJumpMode)
{
time = 1;
}
if (recipeCmd.StartsWith("TC2") && _isSCRHeaterJumpMode)
{
time = 1;
}
if (recipeCmd.StartsWith("Mfc") && recipeCmd.EndsWith(".Ramp") && _isMFCJumpMode)
{
time = 1;
}
//if (recipeCmd == "Pressure5.Ramp")
//{
// double pc5Pressure = Convert.ToDouble(PMDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]) + _pc5Offset;
// OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, pc5Pressure.ToString());
//}
//else if (recipeCmd == "Pressure6.Ramp")
//{
// double pc6Pressure = Convert.ToDouble(PMDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]) + _pc6Offset;
// OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, pc6Pressure.ToString());
//}
//else if (recipeCmd == "Pressure7.Ramp")
//{
// double pc7Pressure = Convert.ToDouble(PMDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]) + _pc7Offset;
// OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, pc7Pressure.ToString());
//}
//else
{
OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]);
}
}
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
public void Wait(int id, string stepName, int delayTime)
{
Tuple<bool, Result> ret = Delay(id, () =>
{
Notify($"Wait for {delayTime} seconds");
_stepSpan = new TimeSpan(0, 0, 0, (int)delayTime);
_stepStartTime = DateTime.Now;
_stepName = stepName;
return true;
}, delayTime * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
protected void CheckCondition(int id, PMModuleBase pm, Dictionary<string, string> recipeCommands)
{
string reason = String.Empty;
Tuple<bool, Result> ret = Wait(id, () =>
{
if (!pm.CheckPreProcessCondition(recipeCommands, out reason))
{
return false;
}
return true;
}, 60 * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop(reason);
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop(reason);
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
/// <summary>
/// 等待温度到达工艺温度
/// </summary>
protected void WaitTempratureToBeginProcess(int id,double targetTemp,int timeout)
{
string reason = String.Empty;
Tuple<bool, Result> ret = Wait(id, () =>
{
if (PmDevice.TC1.L2PVFeedBack >= targetTemp)
{
return true;
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop(reason);
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop(reason);
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
protected void NoteInProcess(int id, int slot)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Update process information, process in {ModuleName.PM1} start");
ModuleName mod = ModuleName.PM1;
WaferManager.Instance.UpdateWaferProcessStatus(mod, slot, WaferProcessStatus.InProcess);
//_pm.OnProcessStart(_guidProcess.ToString(), _recipeName, false);
return true;
});
if (ret.Item1)
{
throw (new RoutineBreakException());
}
}
protected void NoteProcessComplete(int id, int slot)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Update process information, process in {ModuleName.PM1} completed");
ModuleName mod = ModuleName.PM1;
WaferManager.Instance.UpdateWaferProcessStatus(mod, slot, WaferProcessStatus.Completed);
return true;
});
if (ret.Item1)
{
throw (new RoutineBreakException());
}
}
public void Exit()
{
}
public override void Abort()
{
_pmInterLock.SetPMPreProcessRunning(false, out string reason);
PmDevice.AbortRunProcess(out reason);
//_pm.StopAllGasFlow(out string reason);
//_pm.SetPowerOnOff(false, out reason);
//_pm.SetPower(0, false);
//_pm.CloseValvesForPumping(out reason);
//_executor.RecipeRunningInfo.Step = 0;
//_executor.RecipeRunningInfo.ElapsedTime = 0;
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,192 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Aitex.Core.RT.Event;
using Aitex.Core.UI.ControlDataContext;
using MECF.Framework.Common.DBCore;
namespace SicModules.PMs.RecipeExecutions
{
public partial class Process
{
private Dictionary<string, string> processDataDictionary;
private List<HistoryDataItem> dbFeedBack = new List<HistoryDataItem>();
private List<HistoryDataItem> dbSetPoint = new List<HistoryDataItem>();
private List<HistoryDataItem> dbMfcGap = new List<HistoryDataItem>();
private List<HistoryDataItem> dbPcGap = new List<HistoryDataItem>();
private List<RecipeEndDataItem> dbMfcGapResults = new List<RecipeEndDataItem>();
private List<RecipeEndDataItem> dbPcGapResults = new List<RecipeEndDataItem>();
private List<RecipeEndDataItem> dbMfcSetPointResults = new List<RecipeEndDataItem>();
private List<RecipeEndDataItem> dbPcSetPointResults = new List<RecipeEndDataItem>();
private void Initialize()
{
processDataDictionary = new Dictionary<string, string>()
{
{ $"{Module}.Mfc1.FeedBack", $"{Module}.Mfc1.SetPoint" },
{ $"{Module}.Mfc2.FeedBack", $"{Module}.Mfc2.SetPoint" },
{ $"{Module}.Mfc3.FeedBack", $"{Module}.Mfc3.SetPoint" },
{ $"{Module}.Mfc4.FeedBack", $"{Module}.Mfc4.SetPoint" },
{ $"{Module}.Mfc5.FeedBack", $"{Module}.Mfc5.SetPoint" },
{ $"{Module}.Mfc6.FeedBack", $"{Module}.Mfc6.SetPoint" },
{ $"{Module}.Mfc7.FeedBack", $"{Module}.Mfc7.SetPoint" },
{ $"{Module}.Mfc8.FeedBack", $"{Module}.Mfc8.SetPoint" },
{ $"{Module}.Mfc9.FeedBack", $"{Module}.Mfc9.SetPoint" },
{ $"{Module}.Mfc10.FeedBack", $"{Module}.Mfc10.SetPoint" },
{ $"{Module}.Mfc11.FeedBack", $"{Module}.Mfc11.SetPoint" },
{ $"{Module}.Mfc12.FeedBack", $"{Module}.Mfc12.SetPoint" },
{ $"{Module}.Mfc13.FeedBack", $"{Module}.Mfc13.SetPoint" },
{ $"{Module}.Mfc14.FeedBack", $"{Module}.Mfc14.SetPoint" },
{ $"{Module}.Mfc15.FeedBack", $"{Module}.Mfc15.SetPoint" },
{ $"{Module}.Mfc16.FeedBack", $"{Module}.Mfc16.SetPoint" },
{ $"{Module}.Mfc17.FeedBack", $"{Module}.Mfc17.SetPoint" },
{ $"{Module}.Mfc18.FeedBack", $"{Module}.Mfc18.SetPoint" },
{ $"{Module}.Mfc19.FeedBack", $"{Module}.Mfc19.SetPoint" },
{ $"{Module}.Mfc20.FeedBack", $"{Module}.Mfc20.SetPoint" },
{ $"{Module}.Mfc22.FeedBack", $"{Module}.Mfc22.SetPoint" },
{ $"{Module}.Mfc23.FeedBack", $"{Module}.Mfc23.SetPoint" },
{ $"{Module}.Mfc25.FeedBack", $"{Module}.Mfc25.SetPoint" },
{ $"{Module}.Mfc26.FeedBack", $"{Module}.Mfc26.SetPoint" },
{ $"{Module}.Mfc27.FeedBack", $"{Module}.Mfc27.SetPoint" },
{ $"{Module}.Mfc28.FeedBack", $"{Module}.Mfc28.SetPoint" },
{ $"{Module}.Mfc29.FeedBack", $"{Module}.Mfc29.SetPoint" },
{ $"{Module}.Mfc31.FeedBack", $"{Module}.Mfc31.SetPoint" },
{ $"{Module}.Mfc32.FeedBack", $"{Module}.Mfc32.SetPoint" },
{ $"{Module}.Mfc33.FeedBack", $"{Module}.Mfc33.SetPoint" },
{ $"{Module}.Mfc35.FeedBack", $"{Module}.Mfc35.SetPoint" },
{ $"{Module}.Mfc36.FeedBack", $"{Module}.Mfc36.SetPoint" },
{ $"{Module}.Mfc37.FeedBack", $"{Module}.Mfc37.SetPoint" },
{ $"{Module}.Mfc38.FeedBack", $"{Module}.Mfc38.SetPoint" },
{ $"{Module}.Pressure1.FeedBack", $"{Module}.Pressure1.SetPoint" },
{ $"{Module}.Pressure2.FeedBack", $"{Module}.Pressure2.SetPoint" },
{ $"{Module}.Pressure3.FeedBack", $"{Module}.Pressure3.SetPoint" },
{ $"{Module}.Pressure4.FeedBack", $"{Module}.Pressure4.SetPoint" },
{ $"{Module}.Pressure5.FeedBack", $"{Module}.Pressure5.SetPoint" },
{ $"{Module}.Pressure6.FeedBack", $"{Module}.Pressure6.SetPoint" },
{ $"{Module}.Pressure7.FeedBack", $"{Module}.Pressure7.SetPoint" },
};
}
private bool Calculte()
{
GetStepHistoryData();
GetGapList();
dbMfcGapResults = CalculateProcessData(dbMfcGap);
dbPcGapResults = CalculateProcessData(dbPcGap);
dbMfcSetPointResults = CalculateProcessData(dbSetPoint.Where(m => m.dbName.Contains("Mfc")).ToList());
dbPcSetPointResults = CalculateProcessData(dbSetPoint.Where(m => m.dbName.Contains("Pressure")).ToList());
return true;
}
private void GetStepHistoryData()
{
if (_stepTimer.GetElapseTime() > 5 * 60 * 1000)
{
DateTime begin = DateTime.Now.AddMilliseconds(-5 * 60 * 1000);
DateTime end = DateTime.Now;
dbFeedBack = ProcessDataRecorder.GetHistoryDataFromStartToEnd(processDataDictionary.Keys, begin, end, Module);
List<string> processDataValueList = new List<string>();
foreach (var item in processDataDictionary.Values)
{
if (!string.IsNullOrEmpty(item))
processDataValueList.Add(item);
}
dbSetPoint = ProcessDataRecorder.GetHistoryDataFromStartToEnd(processDataValueList, begin, end, Module);
}
}
private void GetGapList()
{
foreach (var setPoint in dbSetPoint)
{
foreach (var feedBack in dbFeedBack)
{
if (setPoint.dateTime == feedBack.dateTime && setPoint.dbName == feedBack.dbName)
{
var gap = new HistoryDataItem();
gap.dateTime = feedBack.dateTime;
gap.dbName = feedBack.dbName;
gap.value = feedBack.value - setPoint.value;
if (gap.dbName.Contains("Mfc"))
{
dbMfcGap.Add(gap);
}
else if (gap.dbName.Contains("Pressure"))
{
dbPcGap.Add(gap);
}
}
}
}
}
private List<RecipeEndDataItem> CalculateProcessData(List<HistoryDataItem> dbGap)
{
List<string> feedBackNames = new List<string>(processDataDictionary.Keys);
List<RecipeEndDataItem> dbGapResults = new List<RecipeEndDataItem>();
foreach (var feedBackName in feedBackNames)
{
var gapList = dbGap.FindAll(item => item.dbName == feedBackName);
dbGapResults.Add(new RecipeEndDataItem(feedBackName, gapList));
}
return dbGapResults;
}
#region RotationAlarm
private bool CalculteRotationAlarm()
{
float fActualSpeed = this._pmSicServo.ActualCurrentFeedback;
float fSetPoint = this._pmSicServo.SpeedSetpoint;
float fAbsValue = Math.Abs(fActualSpeed - fSetPoint);
if(this.fThreshold<fAbsValue)
{
this.iT++;
}
if(this.iT > this.iTimes )
{
if(this.bAlarm)
{
EV.PostAlarmLog(Module, "Rotation is out of gauge" + iTimes.ToString() + " times.");
}
else
{
EV.PostWarningLog(Module, "Rotation is out of gauge" + iTimes.ToString() + " times.");
}
//
iT = 0;
}
else
{
iT = 0; //需要连续超限才会报错
}
return true;
}
#endregion
}
}
@@ -0,0 +1,46 @@
using System.Collections.Generic;
using MECF.Framework.Common.CommonData;
using MECF.Framework.Common.DBCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
namespace SicModules.PMs.RecipeExecutions
{
class RecipeDBCallback : IRecipeDBCallback
{
public void RecipeStart(string module, int slot, string guid, string recipeName)
{
string waferId = "";
if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(module), 0).IsWaferEmpty)
waferId = WaferManager.Instance.GetWafer(ModuleHelper.Converter(module), 0).WaferID.ToString();
ProcessDataRecorder.Start(guid, recipeName, waferId, module.ToString());
}
public void RecipeUpdateStatus(string guid, string status)
{
ProcessDataRecorder.UpdateStatus(guid, status);
}
public void RecipeComplete(string guid)
{
ProcessDataRecorder.End(guid, "Succeed");
}
public void RecipeStepStart(string recipeGuid, int stepNumber, string stepName, float stepTime)
{
ProcessDataRecorder.StepStart(recipeGuid, stepNumber+1, stepName, stepTime);
}
public void RecipeStepEnd(string recipeGuid, int stepNumber, List<FdcDataItem> fdc)
{
ProcessDataRecorder.StepEnd(recipeGuid, stepNumber+1, fdc);
}
public void RecipeFailed(string guid)
{
ProcessDataRecorder.End(guid, "Failed");
}
}
}
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Aitex.Core.UI.ControlDataContext;
namespace SicModules.PMs.RecipeExecutions
{
public class RecipeEndDataItem
{
public RecipeEndDataItem(string name, List<HistoryDataItem> historyDataItem)
{
Name = name;
HistoryDataItem = historyDataItem;
}
public List<HistoryDataItem> HistoryDataItem { get; set; }
public string Name { get; }
public string Max
{
get { return HistoryDataItem.Count > 0 ? HistoryDataItem.Max(item => item.value).ToString("F2") : "0"; }
}
public string Min
{
get { return HistoryDataItem.Count > 0 ? HistoryDataItem.Min(item => item.value).ToString("F2") : "0"; }
}
public string Mean
{
get { return HistoryDataItem.Count > 0 ? HistoryDataItem.Average(item => item.value).ToString("F2") : "0"; }
}
/// <summary>
/// 样本标准差
/// </summary>
public string StdDev
{
get
{
if (HistoryDataItem.Count == 0)
return "0";
double avg = HistoryDataItem.Average(item => item.value); // 计算平均数
double sum = HistoryDataItem.Sum(item => Math.Pow(item.value - avg, 2)); // 计算各数值与平均数的差值的平方,然后求和
double stdDev = Math.Sqrt(sum / (HistoryDataItem.Count - 1)); // 除以数量减1,然后开方
return stdDev.ToString("F2");
}
}
}
}
@@ -0,0 +1,633 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using Aitex.Common.Util;
using Aitex.Core.Backend;
using Aitex.Core.RT.Device.PmDevices;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.RecipeCenter;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.FAServices;
using MECF.Framework.Common.MECF.Framework.Common.RecipeCenter.Recipe;
using static Aitex.Core.RT.Device.PmDevices.DicMode;
namespace SicModules.PMs.RecipeExecutions
{
public class RecipeDataColumn
{
public string disPlay { get; set; }
public double maxNum { get; set; }
public double minMum { get; set; }
}
public class RecipeParser
{
public static bool Parse(string recipeFile, string module, out RecipeHead recipeHead, out List<RecipeStepInfo> recipeData, out string reason)
{
reason = string.Empty;
recipeHead = new RecipeHead();
recipeData = new List<RecipeStepInfo>();
var content = RecipeFileManager.Instance.LoadRecipe("", recipeFile, false);
if (string.IsNullOrEmpty(content))
{
reason = $"{recipeFile} is not a valid recipe file";
return false;
}
return ParseXmlString(content, module, out recipeHead, out recipeData, out reason);
}
private static void InsertRecipeCommand(IReadOnlyCollection<string> allowCommands, ref Dictionary<string, string> dictCommands, string command,
string value)
{
var altCmdName = command;
// Recipe中C3H8.SetValue更名为C2H4.SetValue
if (altCmdName.Contains("C3H8"))
altCmdName = altCmdName.Replace("C3H8", "C2H4");
if (allowCommands.Contains(altCmdName))
{
dictCommands.Add(altCmdName, value);
}
else
{
LOG.Warning($"Recipe Command {command} is not found in allow-list.");
}
}
public static bool ParseXmlString(string xmlRecipeContent, string module, out RecipeHead recipeHead, out List<RecipeStepInfo> recipeData, out string reason)
{
reason = string.Empty;
recipeHead = new RecipeHead();
recipeData = new List<RecipeStepInfo>();
var content = xmlRecipeContent;
if (string.IsNullOrEmpty(content))
{
reason = $"Recipe content is empty";
return false;
}
try
{
//获取工艺程序文件中允许的命令字符串列表
//目的:如果工艺程序文件中含有规定之外的命令,则被禁止执行
var recipeAllowedCommands = new HashSet<string>();
var rcpFormatDoc = new XmlDocument();
var sicRecipe = new SicRecipeFileContext();
var rFormat = sicRecipe.GetRecipeFormat(module);
var recipeSchema = PathManager.GetCfgDir() + $@"\Recipe\Sic\Process\{rFormat}.xml";
rcpFormatDoc.Load(recipeSchema);
var rcpItemNodeList = rcpFormatDoc.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step");
foreach (XmlElement item in rcpItemNodeList)
recipeAllowedCommands.Add(item.Attributes["ControlName"].Value);
//获取工艺程序文件中所有步的内容
var rcpDataDoc = new XmlDocument();
rcpDataDoc.LoadXml(content);
var nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Module[@Name='{module}']");
if (nodeModule == null)
{
reason = $"Recipe file does not contains step content for {module}";
return false;
}
var nodeConfig = nodeModule.SelectSingleNode($"Config") as XmlElement;
recipeHead.ProcessPurgeCount = (nodeConfig != null && nodeConfig.HasAttribute("StepNo")) ? nodeConfig.Attributes["StepNo"].Value : "";
var stepNodeList = nodeModule.SelectNodes($"Step");
for (var i = 0; i < stepNodeList.Count; i++)
{
var recipeStep = new RecipeStepInfo();
recipeData.Add(recipeStep);
var stepNode = stepNodeList[i] as XmlElement;
var dic = new Dictionary<string, string>();
//遍历Step节点
foreach (XmlAttribute att in stepNode.Attributes)
{
InsertRecipeCommand(recipeAllowedCommands, ref dic, att.Name, att.Value);
}
//遍历Step子节点中所有的attribute属性节点
foreach (XmlElement subStepNode in stepNode.ChildNodes)
{
foreach (XmlAttribute att in subStepNode.Attributes)
{
InsertRecipeCommand(recipeAllowedCommands, ref dic, att.Name, att.Value);
}
//遍历Step子节点的子节点中所有的attribute属性节点
foreach (XmlElement subsubStepNode in subStepNode.ChildNodes)
{
foreach (XmlAttribute att in subsubStepNode.Attributes)
{
InsertRecipeCommand(recipeAllowedCommands, ref dic, att.Name, att.Value);
}
}
}
recipeStep.StepName = dic["Name"];
recipeStep.StepUid = dic["StepUid"];
recipeStep.StepTime = Convert.ToDouble(dic["Time"]);
recipeStep.GrowthRate = Convert.ToDouble(dic["GrowthRate"]);
recipeStep.EndBy = EnumEndByCondition.ByTime;
if (dic.TryGetValue("Loop", out var loopStr))
{
recipeStep.IsLoopStartStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop\x20\d+\s*$").Success;
recipeStep.IsLoopEndStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop End$").Success;
if (recipeStep.IsLoopStartStep)
recipeStep.LoopCount = Convert.ToInt32(loopStr.Replace("Loop", string.Empty));
else
recipeStep.LoopCount = 0;
}
//if (recipeData.Count >= 2)
//{
// RecipeStep dummyStep = GetDummyStep(recipeData[recipeData.Count - 2].RecipeCommands, dic, module);
// if (dummyStep.RecipeCommands.Count > 0)
// {
// dummyStep.IsDummyStep = true;
// dummyStep.StepTime = 1; // 默认1秒
// dummyStep.EndBy = EnumEndByCondition.ByTime;
// recipeData.Insert(recipeData.Count - 1, dummyStep);
// }
//}
#region Remove
//dic.Remove("StepNo");
//dic.Remove("Name");
//dic.Remove("Time");
//dic.Remove("GrowthRate");
//Recipe Step去除Mfc30.Ramp
//dic.Remove("Mfc30.Ramp");
var psuControlMode = (HeatStrategy)Enum.Parse(typeof(HeatStrategy), dic["TC1.SetHeaterMode"]);
var scrControlMode = (HeatStrategy)Enum.Parse(typeof(HeatStrategy), dic["TC2.SetHeaterMode2"]);
dic["TC1.SetHeaterMode"] = ((int)psuControlMode).ToString();
dic["TC2.SetHeaterMode2"] = ((int)scrControlMode).ToString();
//if (PSUControlMode == HeaterControlMode.Pyro)
//{
// dic.Remove("TC1.RecipeSetL1Ratio");
// dic.Remove("TC1.RecipeSetL2Ratio");
// dic.Remove("TC1.RecipeSetL3Ratio");
//}
//else if (PSUControlMode == HeaterControlMode.TC)
//{
// dic.Remove("TC1.RecipeSetL1Ratio");
// dic.Remove("TC1.RecipeSetL2Ratio");
// dic.Remove("TC1.RecipeSetL3Ratio");
// dic.Remove("TC1.SetL1TargetSP");
// dic.Remove("TC1.SetL3TargetSP");
//}
//Power模式不在移除TargetSP,也需要设置
//if (PSUControlMode == HeaterControlMode.Power)
//{
// dic.Remove("TC1.SetL1TargetSP");
// dic.Remove("TC1.SetL2TargetSP");
// dic.Remove("TC1.SetL3TargetSP");
//}
//if (SCRControlMode == HeaterControlMode.Pyro)
//{
// dic.Remove("TC2.RecipeSetL1Ratio");
// dic.Remove("TC2.RecipeSetL2Ratio");
// dic.Remove("TC2.RecipeSetL3Ratio");
//}
//else if (SCRControlMode == HeaterControlMode.TC)
//{
// dic.Remove("TC2.RecipeSetL1Ratio");
// dic.Remove("TC2.RecipeSetL2Ratio");
// dic.Remove("TC2.RecipeSetL3Ratio");
//}
if (scrControlMode == HeatStrategy.Power)
{
dic.Remove("TC2.SetL3TargetSP");
}
//if (dic["GRPurgeHCI"] == "Disable")
//{
// dic.Remove("Mfc30.Ramp");
//}
dic.Remove("SHTotalFlow");
dic.Remove("SHTotalFlowSplitRatio");
//dic.Remove("SiSourTotalFlow");
dic.Remove("SiSourSplitRatio");
//dic.Remove("CSourTotalFlow");
dic.Remove("CSourSplitRatio");
//dic.Remove("DopeTotalFlow");
dic.Remove("N2ActualFlow");
dic.Remove("NH3_2ActualFlow");
dic.Remove("DopeSplitRatio");
dic.Remove("SHSuppTotalFlow");
dic.Remove("SHInnerFlow");
dic.Remove("SHMidFlow");
dic.Remove("SHOutterFlow");
//dic.Remove("GRPurgeHCI");
//dic.Remove("TotalVentFlow");
#endregion
foreach (var key in dic.Keys)
recipeStep.RecipeCommands.Add(key, dic[key]);
}
}
catch (Exception ex)
{
LOG.Write(ex);
reason = $"Recipe content not valid, {ex.Message}";
return false;
}
return true;
}
/// <summary>
/// Check Run Vent Purge Switch, Add Dummy Step
/// </summary>
/// <param name="previousStep"></param>
/// <param name="currentStep"></param>
/// <returns></returns>
private static RecipeStepInfo GetDummyStep(Dictionary<string, string> previousStep, Dictionary<string, string> currentStep, string module)
{
RecipeStepInfo step = new RecipeStepInfo();
List<string> lstFlowMode = new List<string>() { FlowMode.Run.ToString(), FlowMode.Vent.ToString() };
bool isTotalVentFlowRunSwitch = false;
#region Flow Mode
string previousSiH4FlowMode = previousStep["SiH4.SetValve"];
string previousTCSFlowMode = previousStep["TCS.SetValve"];
string previousHClFlowMode = previousStep["HCl.SetValve"];
string previousC2H4FlowMode = previousStep["C2H4.SetValve"];
string previousN2FlowMode = previousStep["N2Dilution.SetValve"];
string previousN2HighFlowMode = previousStep["N2HighDoping.SetValve"];
string previousTMAFlowMode = previousStep["TMA.SetValve"];
string currentSiH4FlowMode = currentStep["SiH4.SetValve"];
string currentTCSFlowMode = currentStep["TCS.SetValve"];
string currentHClFlowMode = currentStep["HCl.SetValve"];
string currentC2H4FlowMode = currentStep["C2H4.SetValve"];
string currentN2FlowMode = currentStep["N2Dilution.SetValve"];
string currentN2HighFlowMode = currentStep["N2HighDoping.SetValve"];
string currentTMAFlowMode = currentStep["TMA.SetValve"];
#endregion
#region Check Si Source
double previousSiSourTotalFlow = Convert.ToDouble(previousStep["SiSourTotalFlow"]);
double previousTCSBubbHighFlow = Convert.ToDouble(previousStep["Mfc10.Ramp"]);
double previousTCSBubbLowFlow = Convert.ToDouble(previousStep["Mfc11.Ramp"]);
double previousTCSPushFlow = Convert.ToDouble(previousStep["Mfc12.Ramp"]);
double previousHClFlow = Convert.ToDouble(previousStep["Mfc13.Ramp"]);
double previousSiH4Flow = Convert.ToDouble(previousStep["Mfc14.Ramp"]);
double TCSFlow = 0;
double TCS_Eff = SC.GetValue<double>($"PM.{module}.Efficiency.TCS-Eff");
if (currentTCSFlowMode == FlowMode.Run.ToString() || currentTCSFlowMode == FlowMode.Vent.ToString())
TCSFlow = (previousTCSBubbHighFlow + previousTCSBubbLowFlow) * TCS_Eff + previousTCSPushFlow;
else if (currentTCSFlowMode == FlowMode.Purge.ToString())
TCSFlow = previousTCSBubbHighFlow + previousTCSBubbLowFlow + previousTCSPushFlow;
bool isSiSourRunVentSwitch = false;
if ((previousSiH4FlowMode != currentSiH4FlowMode) && lstFlowMode.Contains(previousSiH4FlowMode) && lstFlowMode.Contains(currentSiH4FlowMode))
{
isSiSourRunVentSwitch = true;
isTotalVentFlowRunSwitch = true;
step.RecipeCommands.Add("SiH4.SetValve", currentSiH4FlowMode);
}
if ((previousTCSFlowMode != currentTCSFlowMode) && lstFlowMode.Contains(previousTCSFlowMode) && lstFlowMode.Contains(currentTCSFlowMode))
{
isSiSourRunVentSwitch = true;
isTotalVentFlowRunSwitch = true;
step.RecipeCommands.Add("TCS.SetValve", currentTCSFlowMode);
}
if ((previousHClFlowMode != currentHClFlowMode) && lstFlowMode.Contains(previousHClFlowMode) && lstFlowMode.Contains(currentHClFlowMode))
{
isSiSourRunVentSwitch = true;
isTotalVentFlowRunSwitch = true;
step.RecipeCommands.Add("HCl.SetValve", currentHClFlowMode);
}
if (isSiSourRunVentSwitch)
{
double startM9Flow = previousSiSourTotalFlow - (currentSiH4FlowMode == FlowMode.Run.ToString() ? previousSiH4Flow : 0)
- (currentTCSFlowMode == FlowMode.Run.ToString() ? TCSFlow : 0) - (currentHClFlowMode == FlowMode.Run.ToString() ? previousHClFlow : 0);
step.RecipeCommands.Add("Mfc9.Ramp", startM9Flow.ToString("F1"));
}
#endregion
#region Check C Source
double previousCSourTotalFlow = Convert.ToDouble(previousStep["CSourTotalFlow"]);
double previousC2H4Flow = Convert.ToDouble(previousStep["Mfc16.Ramp"]);
bool isCSourRunVentSwitch = false;
if ((previousC2H4FlowMode != currentC2H4FlowMode) && lstFlowMode.Contains(previousC2H4FlowMode) && lstFlowMode.Contains(currentC2H4FlowMode))
{
isCSourRunVentSwitch = true;
isTotalVentFlowRunSwitch = true;
step.RecipeCommands.Add("C2H4.SetValve", currentC2H4FlowMode);
}
if (isCSourRunVentSwitch)
{
double startM15Flow = previousCSourTotalFlow - (currentC2H4FlowMode == FlowMode.Run.ToString() ? previousC2H4Flow : 0);
step.RecipeCommands.Add("Mfc15.Ramp", startM15Flow.ToString("F1"));
}
#endregion
#region Check Dope
double previousDopeTotalFlow = Convert.ToDouble(previousStep["DopeTotalFlow"]);
double previousN2HighFlow = Convert.ToDouble(previousStep["Mfc5.Ramp"]);
double previousDilutedN2Flow = Convert.ToDouble(previousStep["Mfc6.Ramp"]);
double previousTMABubbFlow = Convert.ToDouble(previousStep["Mfc7.Ramp"]);
double previousTMAPushFlow = Convert.ToDouble(previousStep["Mfc8.Ramp"]);
double TMAFlow = 0;
double TMA_Eff = SC.GetValue<double>($"PM.{module}.Efficiency.TMA-Eff");
if (currentTMAFlowMode == FlowMode.Run.ToString() || currentTMAFlowMode == FlowMode.Vent.ToString())
TMAFlow = previousTMABubbFlow * TMA_Eff + previousTMAPushFlow;
else if (currentTMAFlowMode == FlowMode.Purge.ToString())
TMAFlow = previousTMABubbFlow + previousTMAPushFlow;
bool isDopeRunVentSwitch = false;
if ((previousN2FlowMode != currentN2FlowMode) && lstFlowMode.Contains(previousN2FlowMode) && lstFlowMode.Contains(currentN2FlowMode))
{
isDopeRunVentSwitch = true;
isTotalVentFlowRunSwitch = true;
step.RecipeCommands.Add("N2Dilution.SetValve", currentN2FlowMode);
}
if ((previousN2HighFlowMode != currentN2HighFlowMode) && lstFlowMode.Contains(previousN2HighFlowMode) && lstFlowMode.Contains(currentN2HighFlowMode))
{
isDopeRunVentSwitch = true;
isTotalVentFlowRunSwitch = true;
step.RecipeCommands.Add("N2HighDoping.SetValve", currentN2HighFlowMode);
//#region M5 Control
//step.RecipeCommands.Add("Mfc5.SetMode", "Normal");
//step.RecipeCommands.Add("Mfc5.Ramp", (currentN2HighFlowMode == FlowMode.Run.ToString() ? currentN2HighFlow : 0).ToString("F1"));
//#endregion
}
if (previousTMAFlowMode != currentTMAFlowMode && lstFlowMode.Contains(previousTMAFlowMode) && lstFlowMode.Contains(currentTMAFlowMode))
{
isDopeRunVentSwitch = true;
isTotalVentFlowRunSwitch = true;
step.RecipeCommands.Add("TMA.SetValve", currentTMAFlowMode);
}
if (isDopeRunVentSwitch)
{
double startM2Flow = previousDopeTotalFlow - (currentTMAFlowMode == FlowMode.Run.ToString() ? TMAFlow : 0)
- (currentN2FlowMode == FlowMode.Run.ToString() ? previousDilutedN2Flow + (currentN2HighFlowMode == FlowMode.Run.ToString() ? previousN2HighFlow : 0) : 0);
step.RecipeCommands.Add("Mfc2.Ramp", startM2Flow.ToString("F1"));
}
#endregion
#region Check Total Vent Flow
double previousTotalVentFlow = Convert.ToDouble(previousStep["TotalVentFlow"]);
double currentN2LowFlow = Convert.ToDouble(currentStep["Mfc4.Ramp"]);
double currentDiluFlowForN2 = Convert.ToDouble(currentStep["Mfc3.Ramp"]);
double currentSiSourTotalFlowForPurge = (currentSiH4FlowMode != FlowMode.Run.ToString() ? previousSiH4Flow : 0)
+ (currentTCSFlowMode != FlowMode.Run.ToString() ? TCSFlow : 0) + (currentHClFlowMode != FlowMode.Run.ToString() ? previousHClFlow : 0);
double currentCSourTotalFlowForPurge = currentC2H4FlowMode != FlowMode.Run.ToString() ? previousC2H4Flow : 0;
double N2Flow = (currentN2FlowMode != FlowMode.Run.ToString() ? previousDilutedN2Flow : 0) + (currentN2HighFlowMode != FlowMode.Run.ToString() ? previousN2HighFlow : 0);
double currentDopeTotalFlowForPurge = N2Flow + (currentTMAFlowMode != FlowMode.Run.ToString() ? TMAFlow : 0);
if (isTotalVentFlowRunSwitch)
{
double startM1Flow = previousTotalVentFlow - currentSiSourTotalFlowForPurge - currentCSourTotalFlowForPurge - currentDopeTotalFlowForPurge;
step.RecipeCommands.Add("Mfc1.Ramp", startM1Flow.ToString("F1"));
}
#endregion
return step;
}
public static bool CheckDataAvalible(string recipeFile, string module, out string strErrorInfo)
{
strErrorInfo = "";
return true;
Dictionary<string, RecipeDataColumn> lstRecipeDataColumn = new Dictionary<string, RecipeDataColumn>();
//获取模板的Double类型,并读取最大值最小值
var fileName = SC.GetStringValue($"PM.{module}.RecipeFormat");
var str = RecipeFileManager.Instance.GetRecipeFormatXml("Sic//Process", fileName);//LoadRecipeFormat();
XmlDocument doc = new XmlDocument();
try
{
doc.LoadXml(str);
XmlNode nodeRoot = doc.SelectSingleNode("TableRecipeFormat");
}
catch (Exception ex)
{
LOG.Write(ex);
}
XmlNodeList nodes = doc.SelectNodes("TableRecipeFormat/Catalog/Group");
foreach (XmlNode node in nodes)
{
XmlNodeList childNodes = node.SelectNodes("Step");
foreach (XmlNode step in childNodes)
{
if (step.Attributes["InputType"].Value == "DoubleInput")
{
string recipeName = step.Attributes["ControlName"].Value;
if (recipeName == "Time")
{
continue;
}
//MFC和PC的最大值读取MFC的设定
string displayText = new Regex(@"\(M\d+\)").Match(step.Attributes["DisplayName"].Value).Value;
string maxConfig = $"PM.{module}.RecipeConfig.{strAbc(node.Attributes["DisplayName"].Value)}.{strAbc(step.Attributes["DisplayName"].Value)}.Max";
string minConfig = $"PM.{module}.RecipeConfig.{strAbc(node.Attributes["DisplayName"].Value)}.{strAbc(step.Attributes["DisplayName"].Value)}.Min";
if (displayText.Contains("M"))
{
maxConfig = $"PM.{module}.MFC.Mfc{displayText.Replace("(M", "").Replace(")", "")}.N2Scale";
}
else
{
displayText = new Regex(@"\(PC\d+\)").Match(step.Attributes["DisplayName"].Value).Value;
if (displayText.Contains("PC"))
{
maxConfig = $"PM.{module}.PC.PC{displayText.Replace("(PC", "").Replace(")", "")}.Scale";
}
}
double max = 0;// GetDoubleValueByName("PM", maxConfig);
double mix = 0;// GetDoubleValueByName("PM", minConfig);
if (displayText.Contains("M"))
{
max = GetDoubleValueByName("PM", maxConfig);
mix = max * GetDoubleValueByName("PM", $"PM.{module}.MFC.MinScale") / 100.0;
}
else
{
max = GetDoubleValueByName("PM", maxConfig);
mix = GetDoubleValueByName("PM", minConfig);
}
lstRecipeDataColumn.Add(recipeName, new RecipeDataColumn() { maxNum = max, minMum = mix, disPlay = step.Attributes["DisplayName"].Value });
}
}
}
string content = RecipeFileManager.Instance.LoadRecipe("", recipeFile, false);
if (string.IsNullOrEmpty(content))
{
return false;
}
//获取工艺程序文件中所有步的内容
XmlDocument rcpDataDoc = new XmlDocument();
rcpDataDoc.LoadXml(content);
XmlNode nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Module[@Name='{module}']");
if (nodeModule == null)
{
return false;
}
XmlNodeList stepNodeList = nodeModule.SelectNodes($"Step");
for (int i = 0; i < stepNodeList.Count; i++)
{
XmlElement stepNode = stepNodeList[i] as XmlElement;
string stepNo = "";
foreach (XmlAttribute att in stepNode.Attributes)
{
//att.Name, att.Value
if (att.Name == "StepNo")
{
stepNo = att.Value;
}
if (lstRecipeDataColumn.ContainsKey(att.Name))
{
double cValue = 0;
double maxValue = lstRecipeDataColumn[att.Name].maxNum;
double minValue = lstRecipeDataColumn[att.Name].minMum;
string columnDisplay = lstRecipeDataColumn[att.Name].disPlay;
if (!double.TryParse(att.Value, out cValue))
{
strErrorInfo += "\r\n" + $"Step[{stepNo}]: Column [{columnDisplay}] value [{att.Value}] is incorrect numerical format";
}
else if (cValue > maxValue || cValue < minValue)
{
strErrorInfo += "\r\n" + $"Step {stepNo} {columnDisplay}: value {cValue} is out of range {minValue}-{maxValue}";
}
}
}
}
if (!String.IsNullOrEmpty(strErrorInfo))
{
return false;
}
return true;
}
/// <summary>
/// 去除小数点、箭头、括号(含括号里的内容)、横杠
/// </summary>
/// <param name="DisplayName"></param>
/// <returns></returns>
private static string strAbc(string DisplayName)
{
string displayname = DisplayName;
if (Regex.IsMatch(displayname.Substring(0, 1), @"^[+-]?\d*[.]?\d*$"))
{
displayname = displayname.Remove(0, displayname.IndexOf(".") + 1);//去除序号
}
displayname = displayname.Trim().Replace(" ", "").Replace(".", "").Replace("->", "_").Replace("-", "");
if (displayname.Contains("(") && displayname.Contains(")"))
{
displayname = displayname.Remove(displayname.IndexOf("("), displayname.IndexOf(")") - displayname.IndexOf("(") + 1);
}
return displayname;
}
private static double GetDoubleValueByName(string module, string name)
{
try
{
SCConfigItem item = SC.GetConfigItem(name);
if (item != null)
{
if (item.Type == "Integer")
{
return item.IntValue;
}
else if (item.Type == "Double")
{
return item.DoubleValue;
}
}
if (name.EndsWith(".Default"))
{
return 0;
}
else if (name.EndsWith(".Min"))
{
return 0;
}
else if (name.EndsWith(".Max"))
{
return 10000;
}
return 0;
}
catch
{
return 0;
}
}
}
}
@@ -0,0 +1,135 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using Aitex.Common.Util;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.RecipeCenter;
using Aitex.Core.RT.SCCore;
namespace SicModules.PMs.RecipeExecutions
{
public class SicRecipeFileContext : IRecipeFileContext
{
public string GetRecipeDefiniton(string chamberId, string module)
{
try
{
var recipeFormatNme = module.Contains("PM") ? GetRecipeFormat(module) : module;
string recipeSchema = PathManager.GetCfgDir() + $@"\Recipe\{chamberId}\{recipeFormatNme}.xml";
XmlDocument xmlDom = new XmlDocument();
xmlDom.Load(recipeSchema);
return xmlDom.OuterXml;
}
catch (Exception ex)
{
LOG.Write(ex);
return "";
}
}
public string GetRecipeFormat(string module)
{
var rName = "PN2DopingRecipe";
var scValue = SC.GetStringValue($"PM.{module}.OperationView");
if (String.IsNullOrEmpty(scValue))
return rName;
return scValue;
}
public string GetSingleNodePath(int sourceIndex, int gasIndex)
{
return $"/Aitex/TableRecipeFormat/Catalog[@DisplayName=\"Source{sourceIndex}\"]/Group/Step/Item[@ControlName=\"Gas{gasIndex}\"]";
}
public IEnumerable<string> GetRecipes(string path, bool includingUsedRecipe)
{
try
{
var recipes = new List<string>();
string recipePath = PathManager.GetRecipeDir() + path + "\\";
if (!Directory.Exists(recipePath))
return recipes;
var di = new DirectoryInfo(recipePath);
var fis = di.GetFiles("*.rcp", SearchOption.AllDirectories);
foreach (var fi in fis)
{
string str = fi.FullName.Substring(di.FullName.Length);
str = str.Substring(0, str.LastIndexOf('.'));
if (includingUsedRecipe || (!includingUsedRecipe && !str.Contains("HistoryRecipe\\")))
{
recipes.Add(str);
}
}
return recipes;
}
catch (Exception ex)
{
LOG.Write(ex);
return new List<string>();
}
}
public void PostInfoEvent(string message)
{
EV.PostMessage("System", EventEnum.GeneralInfo, message);
}
public void PostWarningEvent(string message)
{
EV.PostMessage("System", EventEnum.DefaultWarning, message);
}
public void PostAlarmEvent(string message)
{
EV.PostMessage("System", EventEnum.DefaultAlarm, message);
}
public void PostDialogEvent(string message)
{
EV.PostNotificationMessage(message);
}
public void PostInfoDialogMessage(string message)
{
EV.PostMessage("System", EventEnum.GeneralInfo, message);
EV.PostPopDialogMessage(EventLevel.Information, "System Information", message);
}
public void PostWarningDialogMessage(string message)
{
EV.PostMessage("System", EventEnum.GeneralInfo, message);
EV.PostPopDialogMessage(EventLevel.Warning, "System Warning", message);
}
public void PostAlarmDialogMessage(string message)
{
EV.PostMessage("System", EventEnum.GeneralInfo, message);
EV.PostPopDialogMessage(EventLevel.Alarm, "System Alarm", message);
}
public string GetRecipeTemplate(string chamberId, string module)
{
string schema = GetRecipeDefiniton(chamberId, module);
XmlDocument dom = new XmlDocument();
dom.LoadXml(schema);
XmlNode nodeTemplate = dom.SelectSingleNode("/Aitex/TableRecipeData");
return nodeTemplate.OuterXml;
}
}
}