|
@@ -10,6 +10,8 @@ using MECF.Framework.Common.CommonData.Vpw;
|
|
|
using MECF.Framework.Common.IOCore;
|
|
|
using MECF.Framework.Common.Persistent.Prewet;
|
|
|
using MECF.Framework.Common.Persistent.VpwMain;
|
|
|
+using PunkHPX8_RT.Modules;
|
|
|
+using PunkHPX8_RT.Modules.VpwMain;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -22,8 +24,8 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
public class VpwMainDevice : BaseDevice, IDevice
|
|
|
{
|
|
|
#region 常量
|
|
|
- private const string COMMON_DATA = "CommonData1";
|
|
|
- private const string PERSISTENT_VALUE = "CommonData";
|
|
|
+ private const string COMMON_DATA = "CommonData";
|
|
|
+ private const string PERSISTENT_VALUE = "PersistentValue";
|
|
|
private const string CHAMBER_CLOSED = "ChamberClosed";
|
|
|
private const string CHAMBER_OPENED = "ChamberOpened";
|
|
|
private const string CHAMBER_CLOSE = "ChamberClose";
|
|
@@ -60,7 +62,7 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
/// <summary>
|
|
|
/// 持久性数值
|
|
|
/// </summary>
|
|
|
- private VpwMainPersistentValue _persistentValue;
|
|
|
+ private VpwMainPersistentValue _vpwMainPersistentValue;
|
|
|
/// <summary>
|
|
|
/// 上一次Booster泵速
|
|
|
/// </summary>
|
|
@@ -69,6 +71,8 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
/// 定时器任务
|
|
|
/// </summary>
|
|
|
private PeriodicJob _periodicJob;
|
|
|
+
|
|
|
+ private bool _isDataInitialized;
|
|
|
#endregion
|
|
|
|
|
|
#region 属性
|
|
@@ -104,10 +108,10 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
/// </summary>
|
|
|
private void InitializeParameter()
|
|
|
{
|
|
|
- _persistentValue = VpwMainPersistentManager.Instance.GetPersistentValue(Module);
|
|
|
- if (_persistentValue != null)
|
|
|
+ _vpwMainPersistentValue = VpwMainPersistentManager.Instance.GetPersistentValue(Module);
|
|
|
+ if (_vpwMainPersistentValue != null)
|
|
|
{
|
|
|
- _lastBoosterPumpSpeed = _persistentValue.Speed;
|
|
|
+ _lastBoosterPumpSpeed = _vpwMainPersistentValue.Speed;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -127,7 +131,7 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
/// </summary>
|
|
|
private void SubscribeData()
|
|
|
{
|
|
|
- DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => null, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
+ DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _vpwMainPersistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
DATA.Subscribe($"{Module}.{COMMON_DATA}", () => CommonData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -143,6 +147,7 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
IoSubscribeUpdateVariable(BOOSTER_PUMP_CURRENT);
|
|
|
IoSubscribeUpdateVariable(DEGAS_PURGE);
|
|
|
IoSubscribeUpdateVariable(DEGAS_ADJUST);
|
|
|
+ IoSubscribeUpdateVariable(DEGAS_PUMP_PRESSURE);
|
|
|
IoSubscribeUpdateVariable(DEGAS_PUMP_ENABLE);
|
|
|
IoSubscribeUpdateVariable(DIW_ENABLE);
|
|
|
IoSubscribeUpdateVariable(DIW_PROCESS);
|
|
@@ -173,6 +178,11 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
/// <param name="value"></param>
|
|
|
private void UpdateVariableValue(string variable, object value)
|
|
|
{
|
|
|
+ if (!_commonData.IsDataInitialized)
|
|
|
+ {
|
|
|
+ _commonData.IsDataInitialized = true;
|
|
|
+ _commonData.BoosterPumpModel = "Manual";
|
|
|
+ }
|
|
|
PropertyInfo property = _commonData.GetType().GetProperty(variable);
|
|
|
if (property != null)
|
|
|
{
|
|
@@ -226,6 +236,13 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
|
|
|
OP.Subscribe($"{Module}.BoosterPumpSpeedAuto", (cmd, para) => { return BoosterPumpSpeedAutoOperation(); });
|
|
|
OP.Subscribe($"{Module}.BoosterPumpSpeedManual", (cmd, para) => { return BoosterPumpSpeedManualOperation(); });
|
|
|
+
|
|
|
+ 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
|
|
|
|
|
@@ -387,7 +404,7 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
bool result = BoosterPumpSpeed(speed);
|
|
|
if (result)
|
|
|
{
|
|
|
- _persistentValue.Speed = speed;
|
|
|
+ _vpwMainPersistentValue.Speed = speed;
|
|
|
_lastBoosterPumpSpeed = speed;
|
|
|
PrewetPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
}
|
|
@@ -440,6 +457,121 @@ namespace PunkHPX8_RT.Devices.VpwMain
|
|
|
_commonData.BoosterPumpStatusContent = $"{_commonData.BoosterPumpModel}: {statusContent}";
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// DisabledAction
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cmd"></param>
|
|
|
+ /// <param name="param"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool DisabledOperation(string cmd, object[] args)
|
|
|
+ {
|
|
|
+ string currentOperation = "Disabled";
|
|
|
+ VpwMainEntity vpwMainEntity = Singleton<RouteManager>.Instance.GetModule<VpwMainEntity>(Module);
|
|
|
+ if (vpwMainEntity != null && _vpwMainPersistentValue != null && _vpwMainPersistentValue.OperatingMode != currentOperation)
|
|
|
+ {
|
|
|
+ string preOperation = _vpwMainPersistentValue.OperatingMode;
|
|
|
+ if (vpwMainEntity.IsBusy)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Disabled mode");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ vpwMainEntity.EnterInit();
|
|
|
+
|
|
|
+ _vpwMainPersistentValue.OperatingMode = currentOperation;
|
|
|
+
|
|
|
+ LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
+ VpwMainPersistentManager.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";
|
|
|
+ VpwMainEntity vpwMainEntity = Singleton<RouteManager>.Instance.GetModule<VpwMainEntity>(Module);
|
|
|
+ if (vpwMainEntity != null && _vpwMainPersistentValue != null && _vpwMainPersistentValue.OperatingMode != currentOperation)
|
|
|
+ {
|
|
|
+ string preOperation = _vpwMainPersistentValue.OperatingMode;
|
|
|
+ if (vpwMainEntity.IsBusy)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Manual mode");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ vpwMainEntity.EnterInit();
|
|
|
+ _vpwMainPersistentValue.OperatingMode = currentOperation;
|
|
|
+
|
|
|
+ LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
+ VpwMainPersistentManager.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";
|
|
|
+ VpwMainEntity vpwMainEntity = Singleton<RouteManager>.Instance.GetModule<VpwMainEntity>(Module);
|
|
|
+ if (vpwMainEntity != null && _vpwMainPersistentValue != null && _vpwMainPersistentValue.OperatingMode != currentOperation)
|
|
|
+ {
|
|
|
+ string preOperation = _vpwMainPersistentValue.OperatingMode;
|
|
|
+ if (vpwMainEntity.IsBusy)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_VPWMAIN, Module, $"{Module} is Busy, can't switch to Auto mode");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ vpwMainEntity.EnterInit();
|
|
|
+ _vpwMainPersistentValue.OperatingMode = currentOperation;
|
|
|
+
|
|
|
+ LOG.WriteLog(eEvent.INFO_VPWMAIN, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
|
|
|
+ }
|
|
|
+
|
|
|
+ VpwMainPersistentManager.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 (_vpwMainPersistentValue != null)
|
|
|
+ {
|
|
|
+ _vpwMainPersistentValue.RecipeOperatingMode = currentRecipeOperation;
|
|
|
+ }
|
|
|
+ VpwMainPersistentManager.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 (_vpwMainPersistentValue != null)
|
|
|
+ {
|
|
|
+ _vpwMainPersistentValue.RecipeOperatingMode = currentRecipeOperation;
|
|
|
+ }
|
|
|
+ VpwMainPersistentManager.Instance.UpdatePersistentValue(Module);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|