| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711 | 
							- using Aitex.Core.RT.DataCenter;
 
- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.RT.OperationCenter;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using MECF.Framework.Common.Beckhoff.ModuleIO;
 
- using MECF.Framework.Common.CommonData.Prewet;
 
- using MECF.Framework.Common.CommonData.Vpw;
 
- using MECF.Framework.Common.Equipment;
 
- using MECF.Framework.Common.IOCore;
 
- using MECF.Framework.Common.Persistent.SRD;
 
- using MECF.Framework.Common.Persistent.Temperature;
 
- using MECF.Framework.Common.Persistent.VpwCell;
 
- using MECF.Framework.Common.Persistent.VpwMain;
 
- using MECF.Framework.Common.ToolLayout;
 
- using MECF.Framework.Common.Utilities;
 
- using PunkHPX8_RT.Devices.AXIS;
 
- using PunkHPX8_RT.Devices.Resistivity;
 
- using PunkHPX8_RT.Devices.VpwMain;
 
- using PunkHPX8_RT.Modules;
 
- using PunkHPX8_RT.Modules.Reservoir;
 
- using PunkHPX8_RT.Modules.VpwMain;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Reflection;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- namespace PunkHPX8_RT.Devices.VpwCell
 
- {
 
-     public class VpwCellDevice : BaseDevice, IDevice
 
-     {
 
-         #region 常量 
 
-         private const string COMMON_DATA = "CommonData";
 
-         private const string DIW_FLOW = "DiwFlow";
 
-         private const string VACUUM_PRESSURE = "VacuumPressure";
 
-         private const string FLOW_DRIP = "FlowDrip";
 
-         private const string FLOW_SMALL = "FlowSmall";
 
-         private const string FLOW_LARGE = "FlowLarge";
 
-         private const string VACUUM_VALVE = "VacuumValve";
 
-         private const string VENT_VALVE = "VentValve";
 
-         private const string DRAIN_VALVE = "DrainValve";
 
-         private const string PERSISTENT_VALUE = "PersistentValue";
 
-         private const string LOOPDO_VALUE = "LoopDoValue";
 
-         #endregion
 
-         #region 内部变量
 
-         /// <summary>
 
-         /// 变量是否初始化字典
 
-         /// </summary>
 
-         private Dictionary<string, bool> _variableInitializeDic = new Dictionary<string, bool>();
 
-         /// <summary>
 
-         /// 数据
 
-         /// </summary>
 
-         private VpwCellCommonData _commonData=new VpwCellCommonData();
 
-         /// Vpw main数据
 
-         /// </summary>
 
-         private VpwMainCommonData _mainCommonData = new VpwMainCommonData();
 
-         /// <summary>
 
-         /// 持久性数值
 
-         /// </summary>
 
-         private VpwCellPersistentValue _vpwCellPersistentValue;
 
-         /// <summary>
 
-         /// 水平电机
 
-         /// </summary>
 
-         private JetAxisBase _rotationAxis;
 
-         /// <summary>
 
-         /// 水阻计控制器
 
-         /// </summary>
 
-         private ResistivityController _resistivityController;
 
-         /// <summary>
 
-         /// 水阻值
 
-         /// </summary>
 
-         private double _resistivityValue;
 
-         /// <summary>
 
-         /// main device
 
-         /// </summary>
 
-         private VpwMainDevice _vpwMainDevice;
 
-         /// <summary>
 
-         /// cell flow 初始设定值
 
-         /// </summary>
 
-         private double _cellFlowSetValue;
 
-         /// <summary>
 
-         /// total flow 初始设定值
 
-         /// </summary>
 
-         private double _totalFlowSetValue;
 
-         /// <summary>
 
-         /// total流量满足初始设定值自动打开排水阀的时间
 
-         /// </summary>
 
-         private int _dripValveOpenIdlePeriod;
 
-         /// <summary>
 
-         /// 检测到total flow 满足设定条件的时间
 
-         /// </summary>
 
-         private DateTime _totalFlowOkDetectTime;
 
-         /// <summary>
 
-         /// 是否在检测totalflow的周期中
 
-         /// </summary>
 
-         private bool _isIntotalFlowCheck=false;
 
-         #endregion
 
-         #region 属性
 
-         /// <summary>
 
-         /// 数据
 
-         /// </summary>
 
-         public VpwCellCommonData CommonData { get { return _commonData; } }
 
-         /// <summary>
 
-         /// vpw main数据
 
-         /// </summary>
 
-         public VpwMainCommonData MainCommonData { get { return _mainCommonData; } }
 
-         /// <summary>
 
-         /// 操作模式
 
-         /// </summary>
 
-         public string OperationMode { get { return _vpwCellPersistentValue.OperatingMode; } }
 
-         /// <summary>
 
-         /// 工程模式
 
-         /// </summary>
 
-         public string EngineerMode { get { return _vpwCellPersistentValue.RecipeOperatingMode; } }
 
-         /// <summary>
 
-         /// LoopDO数值
 
-         /// </summary>
 
-         public double LoopDOValue { get { return GetLoopDOValue(); } }
 
-         #endregion
 
-         /// <summary>
 
-         /// 构造函数
 
-         /// </summary>
 
-         /// <param name="moduleName"></param>
 
-         public VpwCellDevice(string moduleName) : base(moduleName, moduleName, moduleName, moduleName)
 
-         {
 
-     
 
-         }
 
-         #region 初始化
 
-         /// <summary>
 
-         /// 初始化
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool Initialize()
 
-         {
 
-             InitializeParameter();
 
-             InitializeRoutine();
 
-             SubscribeData();
 
-             SubscribeValueAction();
 
-             InitializeOperation();
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 初始化参数
 
-         /// </summary>
 
-         private void InitializeParameter()
 
-         {
 
-             _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
 
-             _vpwCellPersistentValue = VpwCellPersistentManager.Instance.GetPersistentValue(Module);     
 
-             VpwCellItem vpwCellItem=VpwCellItemManager.Instance.GetVpwItem(Module);
 
-             if (vpwCellItem != null)
 
-             {
 
-                 _resistivityController = DEVICE.GetDevice<ResistivityController>(vpwCellItem.ResistivityID);
 
-             }
 
-             _vpwMainDevice = DEVICE.GetDevice<VpwMainDevice>($"VPWMain1");
 
-             if(_vpwMainDevice != null)
 
-             {
 
-                 _mainCommonData = _vpwMainDevice.CommonData;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 初始化Routine
 
-         /// </summary>
 
-         private void InitializeRoutine()
 
-         {
 
-         }
 
-         /// <summary>
 
-         /// 订阅
 
-         /// </summary>
 
-         private void SubscribeData()
 
-         {
 
-             DATA.Subscribe($"{Module}.{COMMON_DATA}", () => CommonData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.{PERSISTENT_VALUE}", () => _vpwCellPersistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.DiwCellFlow", () => CommonData.DiwFlow, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.VacuumValve", () => CommonData.VacuumValve, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-             DATA.Subscribe($"{Module}.{LOOPDO_VALUE}", ()=> { return GetLoopDOValue(); }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
-         }
 
-         /// <summary>
 
-         /// 获取Loop do数值
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private double GetLoopDOValue()
 
-         {
 
-             if (_resistivityController != null)
 
-             {
 
-                 string value = _resistivityController.ResisitivityValue;
 
-                 if (double.TryParse(value, out _resistivityValue))
 
-                 {
 
-                     return _resistivityValue;
 
-                 }
 
-                 else
 
-                 {
 
-                     _resistivityValue = 0;
 
-                     return 0;
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 return 0;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 订阅数据
 
-         /// </summary>
 
-         private void SubscribeValueAction()
 
-         {
 
-             IoSubscribeUpdateVariable(DIW_FLOW);
 
-             IoSubscribeUpdateVariable(DRAIN_VALVE);
 
-             IoSubscribeUpdateVariable(VACUUM_PRESSURE);
 
-             IoSubscribeUpdateVariable(VACUUM_VALVE);
 
-             IoSubscribeUpdateVariable(VENT_VALVE);
 
-             IoSubscribeUpdateVariable(FLOW_DRIP);
 
-             IoSubscribeUpdateVariable(FLOW_LARGE);
 
-             IoSubscribeUpdateVariable(FLOW_SMALL);
 
-         }
 
-         /// <summary>
 
-         /// 初始化变量
 
-         /// </summary>
 
-         /// <param name="variable"></param>
 
-         private void IoSubscribeUpdateVariable(string variable)
 
-         {
 
-             _variableInitializeDic[variable] = false;
 
-             IOModuleManager.Instance.SubscribeModuleVariable(Module, variable, UpdateVariableValue);
 
-         }
 
-         /// <summary>
 
-         /// 更新变量数值
 
-         /// </summary>
 
-         /// <param name="variable"></param>
 
-         /// <param name="value"></param>
 
-         private void UpdateVariableValue(string variable, object value)
 
-         {
 
-             PropertyInfo property = _commonData.GetType().GetProperty(variable);
 
-             if (property != null)
 
-             {
 
-                 property.SetValue(_commonData, value);
 
-                 if (variable == VACUUM_PRESSURE)
 
-                 {
 
-                     double torr = UnitUtil.ConvertToTorr((double)value);
 
-                     property.SetValue(_commonData, torr);
 
-                 }
 
-             }
 
-             if (_variableInitializeDic.ContainsKey(variable) && !_variableInitializeDic[variable])
 
-             {
 
-                 _variableInitializeDic[variable] = true;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 初始化OP
 
-         /// </summary>
 
-         private void InitializeOperation()
 
-         {
 
-             OP.Subscribe($"{Module}.FlowDripOn", (cmd,para)=> { return FlowDripOn(); });
 
-             OP.Subscribe($"{Module}.FlowDripOff", (cmd, para) => { return FlowDripOff(); });
 
-             OP.Subscribe($"{Module}.FlowSmallOn", (cmd, para) => { return FlowSmallOn(); });
 
-             OP.Subscribe($"{Module}.FlowSmallOff", (cmd, para) => { return FlowSmallOff(); });
 
-             OP.Subscribe($"{Module}.FlowLargeOn", (cmd, para) => { return FlowLargeOn(); });
 
-             OP.Subscribe($"{Module}.FlowLargeOff", (cmd, para) => { return FlowLargeOff(); });
 
-             OP.Subscribe($"{Module}.VentValveOn", (cmd, para) => { return VentValveOn(); });
 
-             OP.Subscribe($"{Module}.VentValveOff", (cmd, para) => { return VentValveOff(); });
 
-             OP.Subscribe($"{Module}.DrainValveOn", (cmd, para) => { return DrainValveOn(); });
 
-             OP.Subscribe($"{Module}.DrainValveOff", (cmd, para) => { return DrainValveOff(); });
 
-             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);
 
-             
 
-             OP.Subscribe($"{Module}.StartRotation", StartRotationAction);
 
-             OP.Subscribe($"{Module}.StopRotation", StopRotationAction);
 
-         }
 
-         #endregion
 
-         #region Action
 
-         private bool StartRotationAction(string cmd, object[] args)
 
-         {
 
-             if (args.Length < 2 && (int)args[0] < 0 && (int)args[1] < 0)
 
-             {
 
-                 LOG.WriteLog(eEvent.ERR_VPW, Module, $"Start rotation paramater is wrong");
 
-                 return false;
 
-             }
 
-             double targetPostion = (int)args[0]  * 6 * (int)args[1];
 
-             object[] param = new object[] { "",targetPostion };
 
-             int degSpeed = (int)args[0] * 6;
 
-             SetRotationSpeed(degSpeed);
 
-             //return _rotationAxis.JogUpPosition("", param);
 
-             double AfterChangetargetPostion = (int)args[0] * 6 * (int)args[1];
 
-             return RotationProfilePosition(AfterChangetargetPostion);
 
-         }
 
-         private bool StopRotationAction(string cmd, object[] args)
 
-         {
 
-             return _rotationAxis.StopPositionOperation();
 
-         }
 
-         #region Flow
 
-         /// <summary>
 
-         /// Flow Drip on
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool FlowDripOn()
 
-         {
 
-             return WriteVariableValue(FLOW_DRIP, true);
 
-         }
 
-         /// <summary>
 
-         /// Flow Drip Off
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool FlowDripOff()
 
-         {
 
-             return WriteVariableValue(FLOW_DRIP, false);
 
-         }
 
-         /// <summary>
 
-         /// Flow Small On
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool FlowSmallOn()
 
-         {
 
-             return WriteVariableValue(FLOW_SMALL, true);
 
-         }
 
-         /// <summary>
 
-         /// Flow Small Off
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool FlowSmallOff()
 
-         {
 
-             return WriteVariableValue(FLOW_SMALL, false);
 
-         }
 
-         /// <summary>
 
-         /// Flow Large On
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool FlowLargeOn()
 
-         {
 
-             return WriteVariableValue(FLOW_LARGE, true);
 
-         }
 
-         /// <summary>
 
-         /// Flow Large Off
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool FlowLargeOff()
 
-         {
 
-             return WriteVariableValue(FLOW_LARGE, false);
 
-         }
 
-         #endregion
 
-         #region Mode Switch
 
-         /// <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;
 
-         }
 
-         #endregion
 
-         #region Vent Valve
 
-         /// <summary>
 
-         /// Vent Valve On
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool VentValveOn()
 
-         {
 
-             return WriteVariableValue(VENT_VALVE, true);
 
-         }
 
-         /// <summary>
 
-         /// Vent Valve Off
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool VentValveOff()
 
-         {
 
-             return WriteVariableValue(VENT_VALVE, false);
 
-         }
 
-         #endregion
 
-         #region Drain Valve
 
-         /// <summary>
 
-         /// Drain Valve On
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool DrainValveOn()
 
-         {
 
-             return WriteVariableValue(DRAIN_VALVE, true);
 
-         }
 
-         /// <summary>
 
-         /// Drain Valve Off
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool DrainValveOff()
 
-         {
 
-             return WriteVariableValue(DRAIN_VALVE, false);
 
-         }
 
-         #endregion
 
-         #region Vacuum
 
-         /// <summary>
 
-         /// Vacuum valve on
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool VacuumValveOn()
 
-         {
 
-             return WriteVariableValue(VACUUM_VALVE, true);
 
-         }
 
-         /// <summary>
 
-         /// Vacuum valve off
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool VacuumValveOff()
 
-         {
 
-             return WriteVariableValue(VACUUM_VALVE, false);
 
-         }
 
-         #endregion
 
-         /// <summary>
 
-         /// 写变量
 
-         /// </summary>
 
-         /// <param name="variable"></param>
 
-         /// <param name="value"></param>
 
-         /// <returns></returns>
 
-         private bool WriteVariableValue(string variable, object value)
 
-         {
 
-             string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{variable}");
 
-             return IOModuleManager.Instance.WriteIoValue(ioName, value);
 
-         }
 
-         #endregion
 
-         #region Axis
 
-         /// <summary>
 
-         /// 电机是否上电
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRotationSwitchOn()
 
-         {
 
-             return _rotationAxis.IsSwitchOn;
 
-         }
 
-         /// <summary>
 
-         /// Home rotation
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool HomeRotation()
 
-         {
 
-             return _rotationAxis.Home();
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation Home结果
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckHomeEndStatus()
 
-         {
 
-             return CheckRotationEndStatus() && _rotationAxis.IsHomed;
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation结束状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRotationEndStatus()
 
-         {
 
-             return _rotationAxis.Status == PunkHPX8_Core.RState.End;
 
-         }
 
-         /// <summary>
 
-         /// 检验Rotation失败状态
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRotationStopStatus()
 
-         {
 
-             return _rotationAxis.Status == PunkHPX8_Core.RState.Failed;
 
-         }
 
-         /// <summary>
 
-         /// 设置速度
 
-         /// </summary>
 
-         /// <param name="speed"></param>
 
-         /// <returns></returns>
 
-         public bool SetRotationSpeed(int speed)
 
-         {
 
-             _rotationAxis.SetProfileSpeed(speed);
 
-             return true;
 
-         }
 
-         /// <summary>
 
-         /// 改变速度
 
-         /// </summary>
 
-         /// <param name="speed"></param>
 
-         /// <returns></returns>
 
-         public bool ChangeRotationSpeed(int speed)
 
-         {
 
-             return _rotationAxis.ChangeSpeed(speed);
 
-         }
 
-         /// <summary>
 
-         /// 电机运动
 
-         /// </summary>
 
-         /// <param name="position"></param>
 
-         /// <returns></returns>
 
-         public bool RotationProfilePosition(double position)
 
-         {
 
-             VpwMainDevice vpwMainDevice = DEVICE.GetDevice<VpwMainDevice>(ModuleName.VPWMain1.ToString());
 
-             if (vpwMainDevice != null)
 
-             {
 
-                 if (vpwMainDevice.CommonData.ChamberOpened && !vpwMainDevice.CommonData.ChamberClosed)
 
-                 {
 
-                     LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "chamber is not closed, Cannot execute Rotation Profile Position");
 
-                     return false;
 
-                 }
 
-             }
 
-             return _rotationAxis.ProfilePositionOperation(position);
 
-         }
 
-         /// <summary>
 
-         /// 停止运动 
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool StopProfilePosition()
 
-         {
 
-             return _rotationAxis.StopPositionOperation();
 
-         }
 
-         /// <summary>
 
-         /// 是否Rotation运动
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool CheckRotationRunning()
 
-         {
 
-             return _rotationAxis.IsRun;
 
-         }
 
-         #endregion
 
-         /// <summary>
 
-         /// 定时器
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public bool OnTimer()
 
-         {
 
-             if (_rotationAxis != null)
 
-             {
 
-                 _rotationAxis.OnTimer();
 
-             }
 
-             //cell flow满足条件过一段时间自动打开排水阀 (非run recipe期间)
 
-             VpwCellEntity vpwcellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(Module);
 
-             if(vpwcellEntity != null && vpwcellEntity.IsIdle)
 
-             {
 
-                 CellFlowMonitor();
 
-             }
 
-             else
 
-             {
 
-                 _isIntotalFlowCheck = false;
 
-             }
 
-             return true;
 
-         }
 
-         //cell flow满足条件过一段时间自动打开drip阀
 
-         private void CellFlowMonitor()
 
-         {
 
-             _cellFlowSetValue = SC.GetValue<double>("VPWMain.Plumbing.CellFlowStartLowLimit");
 
-             _totalFlowSetValue = SC.GetValue<double>("VPWMain.Plumbing.TotalFlowStartLowLimit");
 
-             _dripValveOpenIdlePeriod = SC.GetValue<int>($"{Module}.DripValveOpenIdlePeriod");
 
-             if (MainCommonData.DiwTotalFlow > _totalFlowSetValue)
 
-             {
 
-                 if (!_isIntotalFlowCheck)
 
-                 {
 
-                     _totalFlowOkDetectTime = DateTime.Now;
 
-                     _isIntotalFlowCheck = true;
 
-                 }
 
-                 else if((DateTime.Now - _totalFlowOkDetectTime).TotalSeconds > (_dripValveOpenIdlePeriod * 60) && !_commonData.FlowDrip)
 
-                 {
 
-                     _isIntotalFlowCheck = false;//重置监控周期
 
-                     LOG.WriteLog(eEvent.INFO_VPW, Module, $"total flow is large than start limit more than {_dripValveOpenIdlePeriod} min,Drip valve on!");
 
-                     FlowDripOn();
 
-                     if(_commonData.DiwFlow <= 0)
 
-                     {
 
-                         LOG.WriteLog(eEvent.WARN_VPW, Module, $"Drip valve open failed!");
 
-                     }
 
-                 }
 
-             }
 
-             
 
-         }
 
-         /// <summary>
 
-         /// 监控
 
-         /// </summary>
 
-         public void Monitor()
 
-         {
 
-         }
 
-         public void Reset()
 
-         {
 
-         }
 
-         public void Terminate()
 
-         {
 
-         }
 
-     }
 
- }
 
 
  |