|
@@ -1,5 +1,6 @@
|
|
|
using Aitex.Core.RT.DataCenter;
|
|
|
using Aitex.Core.RT.Device;
|
|
|
+using Aitex.Core.RT.Log;
|
|
|
using Aitex.Core.RT.OperationCenter;
|
|
|
using Aitex.Core.Util;
|
|
|
using MECF.Framework.Common.Beckhoff.ModuleIO;
|
|
@@ -7,7 +8,11 @@ using MECF.Framework.Common.CommonData.Prewet;
|
|
|
using MECF.Framework.Common.CommonData.Vpw;
|
|
|
using MECF.Framework.Common.IOCore;
|
|
|
using MECF.Framework.Common.Persistent.SRD;
|
|
|
+using MECF.Framework.Common.Persistent.VpwCell;
|
|
|
+using MECF.Framework.Common.Persistent.VpwMain;
|
|
|
using PunkHPX8_RT.Devices.AXIS;
|
|
|
+using PunkHPX8_RT.Modules;
|
|
|
+using PunkHPX8_RT.Modules.VpwMain;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -28,7 +33,8 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
private const string FLOW_LARGE = "FlowLarge";
|
|
|
private const string VACUUM_VALVE = "VacuumValve";
|
|
|
private const string VENT_VALVE = "VentValve";
|
|
|
- private const string DIW_DRAIN = "DiwDrain";
|
|
|
+ private const string DRAIN_VALVE = "DrainValve";
|
|
|
+ private const string PERSISTENT_VALUE = "PersistentValue";
|
|
|
#endregion
|
|
|
|
|
|
#region 内部变量
|
|
@@ -41,6 +47,10 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
/// </summary>
|
|
|
private VpwCellCommonData _commonData=new VpwCellCommonData();
|
|
|
/// <summary>
|
|
|
+ /// 持久性数值
|
|
|
+ /// </summary>
|
|
|
+ private VpwCellPersistentValue _vpwCellPersistentValue;
|
|
|
+ /// <summary>
|
|
|
/// 水平电机
|
|
|
/// </summary>
|
|
|
private JetAxisBase _rotationAxis;
|
|
@@ -81,6 +91,8 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
private void InitializeParameter()
|
|
|
{
|
|
|
_rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
|
|
|
+ _vpwCellPersistentValue = VpwCellPersistentManager.Instance.GetPersistentValue(Module);
|
|
|
+
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 初始化Routine
|
|
@@ -95,6 +107,7 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
private void SubscribeData()
|
|
|
{
|
|
|
DATA.Subscribe($"{Module}.{COMMON_DATA}", () => CommonData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _vpwCellPersistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 订阅数据
|
|
@@ -102,7 +115,7 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
private void SubscribeValueAction()
|
|
|
{
|
|
|
IoSubscribeUpdateVariable(DIW_FLOW);
|
|
|
- IoSubscribeUpdateVariable(DIW_DRAIN);
|
|
|
+ IoSubscribeUpdateVariable(DRAIN_VALVE);
|
|
|
IoSubscribeUpdateVariable(VACUUM_PRESSURE);
|
|
|
IoSubscribeUpdateVariable(VACUUM_VALVE);
|
|
|
IoSubscribeUpdateVariable(VENT_VALVE);
|
|
@@ -155,6 +168,12 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
OP.Subscribe($"{Module}.VacuumValveOn", (cmd, para) => { return VacuumValveOn(); });
|
|
|
OP.Subscribe($"{Module}.VacuumValveOff", (cmd, para) => { return VacuumValveOff(); });
|
|
|
|
|
|
+ OP.Subscribe($"{Module}.DisabledAction", DisabledOperation);
|
|
|
+ OP.Subscribe($"{Module}.ManualAction", ManualOperation);
|
|
|
+ OP.Subscribe($"{Module}.AutoAction", AutoOperation);
|
|
|
+ OP.Subscribe($"{Module}.EngineeringModeAction", EngineeringModeOperation);
|
|
|
+ OP.Subscribe($"{Module}.ProductionModeAction", ProductionModeOperation);
|
|
|
+
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
@@ -233,7 +252,7 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
/// <returns></returns>
|
|
|
private bool DrainValveOn()
|
|
|
{
|
|
|
- return WriteVariableValue(DIW_DRAIN, true);
|
|
|
+ return WriteVariableValue(DRAIN_VALVE, true);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// Vent Valve Off
|
|
@@ -241,7 +260,7 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
/// <returns></returns>
|
|
|
private bool DrainValveOff()
|
|
|
{
|
|
|
- return WriteVariableValue(DIW_DRAIN, false);
|
|
|
+ return WriteVariableValue(DRAIN_VALVE, false);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// Vacuum valve on
|
|
@@ -260,6 +279,120 @@ namespace PunkHPX8_RT.Devices.VpwCell
|
|
|
return WriteVariableValue(VACUUM_VALVE, false);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// DisabledAction
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cmd"></param>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool DisabledOperation(string cmd, object[] args)
|
|
|
+ {
|
|
|
+ string currentOperation = "Disabled";
|
|
|
+ VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
|
|
|
+ if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
|
|
|
+ {
|
|
|
+ string preOperation = _vpwCellPersistentValue.OperatingMode;
|
|
|
+ if (vpwCellEntity.IsBusy)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Disabled mode");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ vpwCellEntity.EnterInit();
|
|
|
+
|
|
|
+ _vpwCellPersistentValue.OperatingMode = currentOperation;
|
|
|
+
|
|
|
+ LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
+ VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// ManualAction
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cmd"></param>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool ManualOperation(string cmd, object[] args)
|
|
|
+ {
|
|
|
+ string currentOperation = "Manual";
|
|
|
+ VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
|
|
|
+ if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
|
|
|
+ {
|
|
|
+ string preOperation = _vpwCellPersistentValue.OperatingMode;
|
|
|
+ if (vpwCellEntity.IsBusy)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Manual mode");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ vpwCellEntity.EnterInit();
|
|
|
+ _vpwCellPersistentValue.OperatingMode = currentOperation;
|
|
|
+
|
|
|
+ LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
+ VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// AutoAction
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cmd"></param>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool AutoOperation(string cmd, object[] args)
|
|
|
+ {
|
|
|
+ string currentOperation = "Auto";
|
|
|
+ VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
|
|
|
+ if (vpwCellEntity != null && _vpwCellPersistentValue != null && _vpwCellPersistentValue.OperatingMode != currentOperation)
|
|
|
+ {
|
|
|
+ string preOperation = _vpwCellPersistentValue.OperatingMode;
|
|
|
+ if (vpwCellEntity.IsBusy)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Auto mode");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ vpwCellEntity.EnterInit();
|
|
|
+ _vpwCellPersistentValue.OperatingMode = currentOperation;
|
|
|
+
|
|
|
+ LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
+
|
|
|
+ VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// EngineeringModeAction
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cmd"></param>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool EngineeringModeOperation(string cmd, object[] args)
|
|
|
+ {
|
|
|
+ string currentRecipeOperation = "Engineering";
|
|
|
+ if (_vpwCellPersistentValue != null)
|
|
|
+ {
|
|
|
+ _vpwCellPersistentValue.RecipeOperatingMode = currentRecipeOperation;
|
|
|
+ }
|
|
|
+ VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// ProductionAction
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cmd"></param>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool ProductionModeOperation(string cmd, object[] args)
|
|
|
+ {
|
|
|
+ string currentRecipeOperation = "Production";
|
|
|
+ if (_vpwCellPersistentValue != null)
|
|
|
+ {
|
|
|
+ _vpwCellPersistentValue.RecipeOperatingMode = currentRecipeOperation;
|
|
|
+ }
|
|
|
+ VpwCellPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 写变量
|
|
|
/// </summary>
|