|
@@ -1,430 +1,430 @@
|
|
|
-using Aitex.Core.Common;
|
|
|
-using Aitex.Core.RT.DataCenter;
|
|
|
-using Aitex.Core.RT.Device;
|
|
|
-using Aitex.Core.RT.Fsm;
|
|
|
-using Aitex.Core.RT.Log;
|
|
|
-using Aitex.Core.RT.OperationCenter;
|
|
|
-using Aitex.Core.RT.RecipeCenter;
|
|
|
-using Aitex.Core.RT.SCCore;
|
|
|
-using Aitex.Core.Util;
|
|
|
-using Aitex.Core.Utilities;
|
|
|
-using CyberX12_RT.Modules.VpwCell;
|
|
|
-using MECF.Framework.Common.Equipment;
|
|
|
-using MECF.Framework.Common.Persistent.Reservoirs;
|
|
|
-using MECF.Framework.Common.ProcessCell;
|
|
|
-using MECF.Framework.Common.RecipeCenter;
|
|
|
-using MECF.Framework.Common.Routine;
|
|
|
-using MECF.Framework.Common.SubstrateTrackings;
|
|
|
-using MECF.Framework.Common.ToolLayout;
|
|
|
-using MECF.Framework.RT.Core.Equipments;
|
|
|
-using PunkHPX8_Core;
|
|
|
-using PunkHPX8_RT.Devices.PlatingCell;
|
|
|
-using PunkHPX8_RT.Devices.PowerSupplier;
|
|
|
-using PunkHPX8_RT.Devices.Reservoir;
|
|
|
-using PunkHPX8_RT.Devices.Temperature;
|
|
|
-using PunkHPX8_RT.Modules.Reservoir;
|
|
|
-using PunkHPX8_RT.Modules.VpwCell;
|
|
|
-using PunkHPX8_RT.Modules.VpwMain;
|
|
|
-using System;
|
|
|
-using System.Collections.Generic;
|
|
|
-using System.Linq;
|
|
|
-using System.Text;
|
|
|
-using System.Threading.Tasks;
|
|
|
-
|
|
|
-namespace PunkHPX8_RT.Modules.PlatingCell
|
|
|
-{
|
|
|
- public class PlatingCellEntity : Entity, IEntity, IModuleEntity
|
|
|
- {
|
|
|
- public enum PlatingCellMsg
|
|
|
- {
|
|
|
- NONE,
|
|
|
- Error,
|
|
|
- ResumeError,
|
|
|
- Initialize,
|
|
|
- Manual,
|
|
|
- Auto,
|
|
|
- CloseFlowValve,
|
|
|
- OpenFlowValve,
|
|
|
- RunRecipe,
|
|
|
- Abort,
|
|
|
- Init,
|
|
|
- CCR,
|
|
|
- CCRAbort
|
|
|
- }
|
|
|
-
|
|
|
- #region 常量
|
|
|
- private const string STRATUS = "Stratus";
|
|
|
- private const string AUTO = "Auto";
|
|
|
- private const string MANUAL = "Manual";
|
|
|
- private const string DISABLED = "Disabled";
|
|
|
- private const string ENGINEERING = "Engineering";
|
|
|
- private const string PRODUCTION = "Production";
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 内部变量
|
|
|
- /// <summary>
|
|
|
- /// 持久化数值
|
|
|
- /// </summary>
|
|
|
- private PlatingCellPersistentValue _persistentValue;
|
|
|
- /// <summary>
|
|
|
- /// 当前recipe
|
|
|
- /// </summary>
|
|
|
- private DepRecipe _currentRecipe;
|
|
|
- /// <summary>
|
|
|
- /// recipe时间
|
|
|
- /// </summary>
|
|
|
- private int _recipeTime;
|
|
|
- /// <summary>
|
|
|
- /// c&m Initialize routine
|
|
|
- /// </summary>
|
|
|
- private PlatingCellInitializeRoutine _initializeRoutine;
|
|
|
- /// <summary>
|
|
|
- /// CCR routine
|
|
|
- /// </summary>
|
|
|
- private PlatingCellCCRRoutine _platingCellCRRoutine;
|
|
|
+using Aitex.Core.Common;
|
|
|
+using Aitex.Core.RT.DataCenter;
|
|
|
+using Aitex.Core.RT.Device;
|
|
|
+using Aitex.Core.RT.Fsm;
|
|
|
+using Aitex.Core.RT.Log;
|
|
|
+using Aitex.Core.RT.OperationCenter;
|
|
|
+using Aitex.Core.RT.RecipeCenter;
|
|
|
+using Aitex.Core.RT.SCCore;
|
|
|
+using Aitex.Core.Util;
|
|
|
+using Aitex.Core.Utilities;
|
|
|
+using CyberX12_RT.Modules.VpwCell;
|
|
|
+using MECF.Framework.Common.Equipment;
|
|
|
+using MECF.Framework.Common.Persistent.Reservoirs;
|
|
|
+using MECF.Framework.Common.ProcessCell;
|
|
|
+using MECF.Framework.Common.RecipeCenter;
|
|
|
+using MECF.Framework.Common.Routine;
|
|
|
+using MECF.Framework.Common.SubstrateTrackings;
|
|
|
+using MECF.Framework.Common.ToolLayout;
|
|
|
+using MECF.Framework.RT.Core.Equipments;
|
|
|
+using PunkHPX8_Core;
|
|
|
+using PunkHPX8_RT.Devices.PlatingCell;
|
|
|
+using PunkHPX8_RT.Devices.PowerSupplier;
|
|
|
+using PunkHPX8_RT.Devices.Reservoir;
|
|
|
+using PunkHPX8_RT.Devices.Temperature;
|
|
|
+using PunkHPX8_RT.Modules.Reservoir;
|
|
|
+using PunkHPX8_RT.Modules.VpwCell;
|
|
|
+using PunkHPX8_RT.Modules.VpwMain;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+
|
|
|
+namespace PunkHPX8_RT.Modules.PlatingCell
|
|
|
+{
|
|
|
+ public class PlatingCellEntity : Entity, IEntity, IModuleEntity
|
|
|
+ {
|
|
|
+ public enum PlatingCellMsg
|
|
|
+ {
|
|
|
+ NONE,
|
|
|
+ Error,
|
|
|
+ ResumeError,
|
|
|
+ Initialize,
|
|
|
+ Manual,
|
|
|
+ Auto,
|
|
|
+ CloseFlowValve,
|
|
|
+ OpenFlowValve,
|
|
|
+ RunRecipe,
|
|
|
+ Abort,
|
|
|
+ Init,
|
|
|
+ CCR,
|
|
|
+ CCRAbort
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 常量
|
|
|
+ private const string STRATUS = "Stratus";
|
|
|
+ private const string AUTO = "Auto";
|
|
|
+ private const string MANUAL = "Manual";
|
|
|
+ private const string DISABLED = "Disabled";
|
|
|
+ private const string ENGINEERING = "Engineering";
|
|
|
+ private const string PRODUCTION = "Production";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 内部变量
|
|
|
+ /// <summary>
|
|
|
+ /// 持久化数值
|
|
|
+ /// </summary>
|
|
|
+ private PlatingCellPersistentValue _persistentValue;
|
|
|
+ /// <summary>
|
|
|
+ /// 当前recipe
|
|
|
+ /// </summary>
|
|
|
+ private DepRecipe _currentRecipe;
|
|
|
+ /// <summary>
|
|
|
+ /// recipe时间
|
|
|
+ /// </summary>
|
|
|
+ private int _recipeTime;
|
|
|
+ /// <summary>
|
|
|
+ /// c&m Initialize routine
|
|
|
+ /// </summary>
|
|
|
+ private PlatingCellInitializeRoutine _initializeRoutine;
|
|
|
+ /// <summary>
|
|
|
+ /// CCR routine
|
|
|
+ /// </summary>
|
|
|
+ private PlatingCellCCRRoutine _platingCellCRRoutine;
|
|
|
/// <summary>
|
|
|
/// Run recipe routine
|
|
|
- /// </summary>
|
|
|
- private PlatingCellRunRecipeRoutine _runRecipeRoutine;
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 属性
|
|
|
- /// <summary>
|
|
|
- /// 模块名称
|
|
|
- /// </summary>
|
|
|
- public ModuleName Module { get; private set; }
|
|
|
- /// <summary>
|
|
|
- /// 是否Init
|
|
|
- /// </summary>
|
|
|
- public bool IsInit
|
|
|
- {
|
|
|
- get { return fsm.State == (int)PlatingCellState.Init; }
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 是否Idle
|
|
|
- /// </summary>
|
|
|
- public bool IsIdle
|
|
|
- {
|
|
|
- get
|
|
|
- {
|
|
|
- return fsm.State == (int)PlatingCellState.Idle;
|
|
|
- }
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 是否错误
|
|
|
- /// </summary>
|
|
|
- public bool IsError
|
|
|
- {
|
|
|
- get { return fsm.State == (int)PlatingCellState.Error; }
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 正在忙碌
|
|
|
- /// </summary>
|
|
|
- public bool IsBusy
|
|
|
- {
|
|
|
- get { return fsm.State == (int)PlatingCellState.Initializing; }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 化学液
|
|
|
- /// </summary>
|
|
|
- public string Chemistry
|
|
|
- {
|
|
|
- get { return _currentRecipe != null ? _currentRecipe.Chemistry : ""; }
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 是否禁用
|
|
|
- /// </summary>
|
|
|
- public bool IsDisable { get { return _persistentValue == null || _persistentValue.OperatingMode == DISABLED; } }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 自动模式
|
|
|
- /// </summary>
|
|
|
- public bool IsAuto { get { return _persistentValue != null && _persistentValue.OperatingMode == AUTO; } }
|
|
|
- /// <summary>
|
|
|
- /// 自动模式
|
|
|
- /// </summary>
|
|
|
- public bool IsManual { get { return _persistentValue != null && _persistentValue.OperatingMode == MANUAL; } }
|
|
|
- /// <summary>
|
|
|
- /// 是否为工程模式
|
|
|
- /// </summary>
|
|
|
- public bool IsEngineering { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == ENGINEERING; } }
|
|
|
- /// <summary>
|
|
|
- /// 是否为产品模式
|
|
|
- /// </summary>
|
|
|
- public bool IsProduction { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == PRODUCTION; } }
|
|
|
- /// <summary>
|
|
|
- /// 状态机状态
|
|
|
- /// </summary>
|
|
|
- public PlatingCellState State { get { return (PlatingCellState)fsm.State; } }
|
|
|
- /// <summary>
|
|
|
- /// 是否初始化完成
|
|
|
- /// </summary>
|
|
|
- public bool IsInitialized { get { return fsm.State >= (int)PlatingCellState.Initialized; } }
|
|
|
- /// <summary>
|
|
|
- /// Reservoir项
|
|
|
- /// </summary>
|
|
|
+ /// </summary>
|
|
|
+ private PlatingCellRunRecipeRoutine _runRecipeRoutine;
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 属性
|
|
|
+ /// <summary>
|
|
|
+ /// 模块名称
|
|
|
+ /// </summary>
|
|
|
+ public ModuleName Module { get; private set; }
|
|
|
+ /// <summary>
|
|
|
+ /// 是否Init
|
|
|
+ /// </summary>
|
|
|
+ public bool IsInit
|
|
|
+ {
|
|
|
+ get { return fsm.State == (int)PlatingCellState.Init; }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 是否Idle
|
|
|
+ /// </summary>
|
|
|
+ public bool IsIdle
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return fsm.State == (int)PlatingCellState.Idle;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 是否错误
|
|
|
+ /// </summary>
|
|
|
+ public bool IsError
|
|
|
+ {
|
|
|
+ get { return fsm.State == (int)PlatingCellState.Error; }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 正在忙碌
|
|
|
+ /// </summary>
|
|
|
+ public bool IsBusy
|
|
|
+ {
|
|
|
+ get { return fsm.State == (int)PlatingCellState.Initializing; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 化学液
|
|
|
+ /// </summary>
|
|
|
+ public string Chemistry
|
|
|
+ {
|
|
|
+ get { return _currentRecipe != null ? _currentRecipe.Chemistry : ""; }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 是否禁用
|
|
|
+ /// </summary>
|
|
|
+ public bool IsDisable { get { return _persistentValue == null || _persistentValue.OperatingMode == DISABLED; } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 自动模式
|
|
|
+ /// </summary>
|
|
|
+ public bool IsAuto { get { return _persistentValue != null && _persistentValue.OperatingMode == AUTO; } }
|
|
|
+ /// <summary>
|
|
|
+ /// 自动模式
|
|
|
+ /// </summary>
|
|
|
+ public bool IsManual { get { return _persistentValue != null && _persistentValue.OperatingMode == MANUAL; } }
|
|
|
+ /// <summary>
|
|
|
+ /// 是否为工程模式
|
|
|
+ /// </summary>
|
|
|
+ public bool IsEngineering { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == ENGINEERING; } }
|
|
|
+ /// <summary>
|
|
|
+ /// 是否为产品模式
|
|
|
+ /// </summary>
|
|
|
+ public bool IsProduction { get { return _persistentValue != null && _persistentValue.RecipeOperatingMode == PRODUCTION; } }
|
|
|
+ /// <summary>
|
|
|
+ /// 状态机状态
|
|
|
+ /// </summary>
|
|
|
+ public PlatingCellState State { get { return (PlatingCellState)fsm.State; } }
|
|
|
+ /// <summary>
|
|
|
+ /// 是否初始化完成
|
|
|
+ /// </summary>
|
|
|
+ public bool IsInitialized { get { return fsm.State >= (int)PlatingCellState.Initialized; } }
|
|
|
+ /// <summary>
|
|
|
+ /// Reservoir项
|
|
|
+ /// </summary>
|
|
|
private ReservoirItem _reservoirItem;
|
|
|
- /// <summary>
|
|
|
- /// Wafer信息
|
|
|
- /// </summary>
|
|
|
+ /// <summary>
|
|
|
+ /// Wafer信息
|
|
|
+ /// </summary>
|
|
|
public WaferInfo WaferInfo { get { return WaferManager.Instance.GetWafer(Module,0); } }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 当前Metal设置的WaferSize
|
|
|
/// </summary>
|
|
|
- public int MetalWaferSize { get { return _persistentValue.PlatingCellWaferSize; } }
|
|
|
- #endregion
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 构造函数
|
|
|
- /// </summary>
|
|
|
- /// <param name="module"></param>
|
|
|
- public PlatingCellEntity(ModuleName module)
|
|
|
- {
|
|
|
- this.Module = module;
|
|
|
- InitialFsm();
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 初始化
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- protected override bool Init()
|
|
|
+ public int MetalWaferSize { get { return _persistentValue.PlatingCellWaferSize; } }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 构造函数
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="module"></param>
|
|
|
+ public PlatingCellEntity(ModuleName module)
|
|
|
+ {
|
|
|
+ this.Module = module;
|
|
|
+ InitialFsm();
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ protected override bool Init()
|
|
|
+ {
|
|
|
+ WaferManager.Instance.SubscribeLocation(Module, 1);
|
|
|
+ InitializeRoutine();
|
|
|
+ InitializeDATA();
|
|
|
+ InitializeOperation();
|
|
|
+ InitializeParameter();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化参数
|
|
|
+ /// </summary>
|
|
|
+ private void InitializeParameter()
|
|
|
+ {
|
|
|
+ _persistentValue = PlatingCellPersistentManager.Instance.GetPlatingCellPersistentValue(Module.ToString());
|
|
|
+ if (_persistentValue == null)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module.ToString(), "Persistent Value Object is not exist");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化Routine
|
|
|
+ /// </summary>
|
|
|
+ private void InitializeRoutine()
|
|
|
+ {
|
|
|
+ _initializeRoutine = new PlatingCellInitializeRoutine(Module.ToString());
|
|
|
+ _platingCellCRRoutine = new PlatingCellCCRRoutine(Module.ToString());
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化DATA
|
|
|
+ /// </summary>
|
|
|
+ private void InitializeDATA()
|
|
|
{
|
|
|
- WaferManager.Instance.SubscribeLocation(Module, 1);
|
|
|
- InitializeRoutine();
|
|
|
- InitializeDATA();
|
|
|
- InitializeOperation();
|
|
|
- InitializeParameter();
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 初始化参数
|
|
|
- /// </summary>
|
|
|
- private void InitializeParameter()
|
|
|
- {
|
|
|
- _persistentValue = PlatingCellPersistentManager.Instance.GetPlatingCellPersistentValue(Module.ToString());
|
|
|
- if (_persistentValue == null)
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module.ToString(), "Persistent Value Object is not exist");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 初始化Routine
|
|
|
- /// </summary>
|
|
|
- private void InitializeRoutine()
|
|
|
- {
|
|
|
- _initializeRoutine = new PlatingCellInitializeRoutine(Module.ToString());
|
|
|
- _platingCellCRRoutine = new PlatingCellCCRRoutine(Module.ToString());
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 初始化DATA
|
|
|
- /// </summary>
|
|
|
- private void InitializeDATA()
|
|
|
- {
|
|
|
- DATA.Subscribe($"{Module}.FsmState", () => ((PlatingCellState)fsm.State).ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.CurrentRecipe", () => _currentRecipe != null ? _currentRecipe.Ppid : "", SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.TotalTime", () => _recipeTime, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.TimeRemain", () => _recipeTime != 0 && _runRecipeRoutine != null ? (_recipeTime - Math.Round((double)_runRecipeRoutine.ElapsedMilliseconds / 1000, 0)) : 0, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.Chemistry", () => _currentRecipe != null ? _currentRecipe.Chemistry : "", SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
-
|
|
|
- DATA.Subscribe($"{Module}.IsInit", () => IsInit, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.IsIdle", () => IsIdle, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.IsError", () => IsError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.IsBusy", () => IsBusy, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- DATA.Subscribe($"{Module}.IsDisable", () => IsDisable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 初始化Operation
|
|
|
- /// </summary>
|
|
|
- private void InitializeOperation()
|
|
|
- {
|
|
|
- OP.Subscribe($"{Module}.InitializeAll", (cmd, args) => { return CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_RESERVOIR, Module.ToString(), (int)PlatingCellMsg.Initialize); });
|
|
|
- OP.Subscribe($"{Module}.ManualCCRStart", (cmd, args) => { return CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_RESERVOIR, Module.ToString(), (int)PlatingCellMsg.CCR); });
|
|
|
- OP.Subscribe($"{Module}.ManualCCRStop", (cmd, args) => { return CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_RESERVOIR, Module.ToString(), (int)PlatingCellMsg.CCRAbort); });
|
|
|
- }
|
|
|
-
|
|
|
- /// 初始化状态机
|
|
|
- /// </summary>
|
|
|
- private void InitialFsm()
|
|
|
- {
|
|
|
- fsm = new StateMachine<PlatingCellEntity>(Module.ToString(), (int)PlatingCellState.Idle, 100);
|
|
|
- fsm.EnableRepeatedMsg(true);
|
|
|
-
|
|
|
- AnyStateTransition(PlatingCellMsg.Error, NullFunc, PlatingCellState.Error);
|
|
|
- //Initialized
|
|
|
- Transition(PlatingCellState.Error, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
|
|
|
- Transition(PlatingCellState.Init, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
|
|
|
- Transition(PlatingCellState.Idle, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
|
|
|
- Transition(PlatingCellState.Initializing, FSM_MSG.TIMER, InitializeAllMonitor, PlatingCellState.Idle);
|
|
|
-
|
|
|
- //CCR
|
|
|
- Transition(PlatingCellState.Idle, PlatingCellMsg.CCR, ManualCCRStart, PlatingCellState.CCRing);
|
|
|
- Transition(PlatingCellState.CCRing, FSM_MSG.TIMER, CCRMonitor, PlatingCellState.Idle);
|
|
|
+ DATA.Subscribe($"{Module}.FsmState", () => ((PlatingCellState)fsm.State).ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.CurrentRecipe", () => _currentRecipe != null ? _currentRecipe.Ppid : "", SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.TotalTime", () => _recipeTime, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.TimeRemain", () => _recipeTime != 0 && _runRecipeRoutine != null ? (_recipeTime - Math.Round((double)_runRecipeRoutine.ElapsedMilliseconds / 1000, 0)) : 0, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.Chemistry", () => _currentRecipe != null ? _currentRecipe.Chemistry : "", SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+
|
|
|
+ DATA.Subscribe($"{Module}.IsInit", () => IsInit, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.IsIdle", () => IsIdle, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.IsError", () => IsError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.IsBusy", () => IsBusy, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.IsDisable", () => IsDisable, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化Operation
|
|
|
+ /// </summary>
|
|
|
+ private void InitializeOperation()
|
|
|
+ {
|
|
|
+ OP.Subscribe($"{Module}.InitializeAll", (cmd, args) => { return CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_RESERVOIR, Module.ToString(), (int)PlatingCellMsg.Initialize); });
|
|
|
+ OP.Subscribe($"{Module}.ManualCCRStart", (cmd, args) => { return CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_RESERVOIR, Module.ToString(), (int)PlatingCellMsg.CCR); });
|
|
|
+ OP.Subscribe($"{Module}.ManualCCRStop", (cmd, args) => { return CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_RESERVOIR, Module.ToString(), (int)PlatingCellMsg.CCRAbort); });
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 初始化状态机
|
|
|
+ /// </summary>
|
|
|
+ private void InitialFsm()
|
|
|
+ {
|
|
|
+ fsm = new StateMachine<PlatingCellEntity>(Module.ToString(), (int)PlatingCellState.Idle, 100);
|
|
|
+ fsm.EnableRepeatedMsg(true);
|
|
|
+
|
|
|
+ AnyStateTransition(PlatingCellMsg.Error, NullFunc, PlatingCellState.Error);
|
|
|
+ //Initialized
|
|
|
+ Transition(PlatingCellState.Error, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
|
|
|
+ Transition(PlatingCellState.Init, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
|
|
|
+ Transition(PlatingCellState.Idle, PlatingCellMsg.Initialize, InitializeAll, PlatingCellState.Initializing);
|
|
|
+ Transition(PlatingCellState.Initializing, FSM_MSG.TIMER, InitializeAllMonitor, PlatingCellState.Idle);
|
|
|
+
|
|
|
+ //CCR
|
|
|
+ Transition(PlatingCellState.Idle, PlatingCellMsg.CCR, ManualCCRStart, PlatingCellState.CCRing);
|
|
|
+ Transition(PlatingCellState.CCRing, FSM_MSG.TIMER, CCRMonitor, PlatingCellState.Idle);
|
|
|
Transition(PlatingCellState.CCRing, PlatingCellMsg.CCRAbort, CCRAbort, PlatingCellState.Init);
|
|
|
//Cycle Manual Process
|
|
|
Transition(PlatingCellState.Idle, PlatingCellMsg.RunRecipe, CycleManualProcess, PlatingCellState.RunReciping);
|
|
|
Transition(PlatingCellState.RunReciping, FSM_MSG.TIMER, CycleManualMonitor, PlatingCellState.Idle);
|
|
|
- Transition(PlatingCellState.RunReciping, VPWCellMsg.Abort, RunRecipeAbort, PlatingCellState.Idle);
|
|
|
- //直接进入Idle
|
|
|
- Transition(PlatingCellState.Initialized, FSM_MSG.TIMER, NullFunc, PlatingCellState.Idle);
|
|
|
- //Enter Init
|
|
|
- Transition(PlatingCellState.Idle, PlatingCellMsg.Init, NullFunc, PlatingCellState.Init);
|
|
|
-
|
|
|
- EnumLoop<PlatingCellState>.ForEach((item) => { fsm.MapState((int)item, item.ToString()); });
|
|
|
-
|
|
|
- EnumLoop<PlatingCellState>.ForEach((item) => { fsm.MapMessage((int)item, item.ToString()); });
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 手动CCR
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- private bool ManualCCRStart(object[] param)
|
|
|
- {
|
|
|
- bool result = _platingCellCRRoutine.Start() == RState.Running;
|
|
|
- return result;
|
|
|
-
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// CCR 监控
|
|
|
- /// </summary>
|
|
|
- /// <param name="param"></param>
|
|
|
- /// <returns></returns>
|
|
|
- private bool CCRMonitor(object[] param)
|
|
|
- {
|
|
|
- RState rsstate = RState.Running;
|
|
|
- rsstate = _platingCellCRRoutine.Monitor();
|
|
|
- if (rsstate == RState.End)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else if (rsstate == RState.Failed || rsstate == RState.Timeout)
|
|
|
- {
|
|
|
- PostMsg(PlatingCellMsg.Error);
|
|
|
- return false;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// CCR abort
|
|
|
- /// </summary>
|
|
|
- /// <param name="param"></param>
|
|
|
- /// <returns></returns>
|
|
|
- private bool CCRAbort(object[] param)
|
|
|
- {
|
|
|
- if(_platingCellCRRoutine.Monitor() == RState.Running)
|
|
|
- {
|
|
|
- _platingCellCRRoutine.Abort();
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 初始化
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- private bool InitializeAll(object[] param)
|
|
|
- {
|
|
|
- if (_persistentValue == null)
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.ERR_RESERVOIR, Module.ToString(), "persistent is null");
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (fsm.State == (int)PlatingCellState.Initializing)
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.WARN_PLATINGCELL, Module.ToString(), "state is Initializing,cannot do initialize");
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!CheckReservoirInitialized())
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.ERR_METAL, Module.ToString(), "Reservoir is not initialized");
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!MetalUsageMointor(Module.ToString()))
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if ("Auto".Equals(_persistentValue.OperatingMode))
|
|
|
- {
|
|
|
- if (!CheckReservoirIsAuto())
|
|
|
- {
|
|
|
- LOG.WriteLog(eEvent.ERR_METAL, Module.ToString(), "Reservoir is not in Auto OperationMode");
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- bool result = _initializeRoutine.Start(_persistentValue) == RState.Running;
|
|
|
- return result;
|
|
|
-
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 检验Reservoir是否Auto
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- private bool CheckReservoirIsAuto()
|
|
|
- {
|
|
|
- string reservoir = ReservoirItemManager.Instance.GetReservoirByPlatingCell(Module.ToString());
|
|
|
- ReservoirsPersistentValue reservoirsPersistentValue = ReservoirsPersistentManager.Instance.GetReservoirsPersistentValue(reservoir);
|
|
|
- if ("Auto".Equals(reservoirsPersistentValue.OperatingMode))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 检验Reservoir是否Initialized
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- private bool CheckReservoirInitialized()
|
|
|
- {
|
|
|
- string reservoir = ReservoirItemManager.Instance.GetReservoirByPlatingCell(Module.ToString());
|
|
|
- ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(reservoir);
|
|
|
- if (reservoirEntity != null)
|
|
|
- {
|
|
|
- return reservoirEntity.IsInitialized;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 监控 PM Counter Metal用量
|
|
|
- /// </summary>
|
|
|
- private bool MetalUsageMointor(string Module)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// Initialize 监控
|
|
|
- /// </summary>
|
|
|
- /// <param name="param"></param>
|
|
|
- /// <returns></returns>
|
|
|
- private bool InitializeAllMonitor(object[] param)
|
|
|
- {
|
|
|
- RState rsstate = RState.Running;
|
|
|
- rsstate = _initializeRoutine.Monitor();
|
|
|
- if (rsstate == RState.End)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else if (rsstate == RState.Failed || rsstate == RState.Timeout)
|
|
|
- {
|
|
|
- PostMsg(PlatingCellMsg.Error);
|
|
|
- return false;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// EnterInit
|
|
|
- /// </summary>
|
|
|
- public void EnterInit()
|
|
|
- {
|
|
|
- if ((PlatingCellState)fsm.State != PlatingCellState.Idle) return;
|
|
|
- else
|
|
|
- {
|
|
|
- CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_PLATINGCELL, Module.ToString(), (int)PlatingCellMsg.Init);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ Transition(PlatingCellState.RunReciping, VPWCellMsg.Abort, RunRecipeAbort, PlatingCellState.Idle);
|
|
|
+ //直接进入Idle
|
|
|
+ Transition(PlatingCellState.Initialized, FSM_MSG.TIMER, NullFunc, PlatingCellState.Idle);
|
|
|
+ //Enter Init
|
|
|
+ Transition(PlatingCellState.Idle, PlatingCellMsg.Init, NullFunc, PlatingCellState.Init);
|
|
|
+
|
|
|
+ EnumLoop<PlatingCellState>.ForEach((item) => { fsm.MapState((int)item, item.ToString()); });
|
|
|
+
|
|
|
+ EnumLoop<PlatingCellState>.ForEach((item) => { fsm.MapMessage((int)item, item.ToString()); });
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 手动CCR
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool ManualCCRStart(object[] param)
|
|
|
+ {
|
|
|
+ bool result = _platingCellCRRoutine.Start() == RState.Running;
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// CCR 监控
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CCRMonitor(object[] param)
|
|
|
+ {
|
|
|
+ RState rsstate = RState.Running;
|
|
|
+ rsstate = _platingCellCRRoutine.Monitor();
|
|
|
+ if (rsstate == RState.End)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else if (rsstate == RState.Failed || rsstate == RState.Timeout)
|
|
|
+ {
|
|
|
+ PostMsg(PlatingCellMsg.Error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// CCR abort
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CCRAbort(object[] param)
|
|
|
+ {
|
|
|
+ if(_platingCellCRRoutine.Monitor() == RState.Running)
|
|
|
+ {
|
|
|
+ _platingCellCRRoutine.Abort();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool InitializeAll(object[] param)
|
|
|
+ {
|
|
|
+ if (_persistentValue == null)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_RESERVOIR, Module.ToString(), "persistent is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (fsm.State == (int)PlatingCellState.Initializing)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.WARN_PLATINGCELL, Module.ToString(), "state is Initializing,cannot do initialize");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!CheckReservoirInitialized())
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_METAL, Module.ToString(), "Reservoir is not initialized");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!MetalUsageMointor(Module.ToString()))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if ("Auto".Equals(_persistentValue.OperatingMode))
|
|
|
+ {
|
|
|
+ if (!CheckReservoirIsAuto())
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_METAL, Module.ToString(), "Reservoir is not in Auto OperationMode");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bool result = _initializeRoutine.Start(_persistentValue) == RState.Running;
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 检验Reservoir是否Auto
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CheckReservoirIsAuto()
|
|
|
+ {
|
|
|
+ string reservoir = ReservoirItemManager.Instance.GetReservoirByPlatingCell(Module.ToString());
|
|
|
+ ReservoirsPersistentValue reservoirsPersistentValue = ReservoirsPersistentManager.Instance.GetReservoirsPersistentValue(reservoir);
|
|
|
+ if ("Auto".Equals(reservoirsPersistentValue.OperatingMode))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 检验Reservoir是否Initialized
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CheckReservoirInitialized()
|
|
|
+ {
|
|
|
+ string reservoir = ReservoirItemManager.Instance.GetReservoirByPlatingCell(Module.ToString());
|
|
|
+ ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(reservoir);
|
|
|
+ if (reservoirEntity != null)
|
|
|
+ {
|
|
|
+ return reservoirEntity.IsInitialized;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 监控 PM Counter Metal用量
|
|
|
+ /// </summary>
|
|
|
+ private bool MetalUsageMointor(string Module)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// Initialize 监控
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool InitializeAllMonitor(object[] param)
|
|
|
+ {
|
|
|
+ RState rsstate = RState.Running;
|
|
|
+ rsstate = _initializeRoutine.Monitor();
|
|
|
+ if (rsstate == RState.End)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else if (rsstate == RState.Failed || rsstate == RState.Timeout)
|
|
|
+ {
|
|
|
+ PostMsg(PlatingCellMsg.Error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// EnterInit
|
|
|
+ /// </summary>
|
|
|
+ public void EnterInit()
|
|
|
+ {
|
|
|
+ if ((PlatingCellState)fsm.State != PlatingCellState.Idle) return;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CheckToPostMessage<PlatingCellState, PlatingCellMsg>(eEvent.ERR_PLATINGCELL, Module.ToString(), (int)PlatingCellMsg.Init);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
#region cycle manual process
|
|
|
/// <summary>
|
|
|
/// process
|
|
@@ -474,20 +474,20 @@ namespace PunkHPX8_RT.Modules.PlatingCell
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
- #endregion
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ public bool Check(int msg, out string reason, params object[] args)
|
|
|
+ {
|
|
|
+ reason = "";
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool CheckAcked(int msg)
|
|
|
+ {
|
|
|
+ throw new NotImplementedException();
|
|
|
+ }
|
|
|
|
|
|
- public bool Check(int msg, out string reason, params object[] args)
|
|
|
- {
|
|
|
- reason = "";
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public bool CheckAcked(int msg)
|
|
|
- {
|
|
|
- throw new NotImplementedException();
|
|
|
- }
|
|
|
-
|
|
|
- public int Invoke(string function, params object[] args)
|
|
|
+ public int Invoke(string function, params object[] args)
|
|
|
{
|
|
|
switch (function)
|
|
|
{
|
|
@@ -504,8 +504,8 @@ namespace PunkHPX8_RT.Modules.PlatingCell
|
|
|
{
|
|
|
return (int)FSM_MSG.NONE;
|
|
|
}
|
|
|
- }
|
|
|
- return (int)FSM_MSG.NONE;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ }
|
|
|
+ return (int)FSM_MSG.NONE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|