Explorar o código

add simulatorcomManager

chenzk hai 4 meses
pai
achega
0c91d3f021
Modificáronse 1 ficheiros con 76 adicións e 0 borrados
  1. 76 0
      Framework/Common/Device/Common/SimulatorCommManager.cs

+ 76 - 0
Framework/Common/Device/Common/SimulatorCommManager.cs

@@ -0,0 +1,76 @@
+using Aitex.Core.Util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Aitex.Core.RT.Device
+{
+    public class SimulatorCommManager:Singleton<SimulatorCommManager>
+    {
+
+        #region 内部变量
+        /// <summary>
+        /// 关联变量字典
+        /// </summary>
+        private Dictionary<string, string> _relatedDictionary = new Dictionary<string, string>();
+        #endregion
+
+        //delegate
+        #region Delegate
+        public delegate void UpdateVariableValueChanged(string name,bool value);
+        #endregion
+
+        #region 事件
+        /// <summary>
+        /// 变量变更事件
+        /// </summary>
+        public event UpdateVariableValueChanged OnUpdateVariableValueChanged;
+        #endregion
+
+
+        public void Initialize()
+        {
+            _relatedDictionary.Add("c_LOADERA_WS_BLADDER", "r_LOADERA_WS_BLADDER_PRESSURE");//Wafershuttle bladder
+            _relatedDictionary.Add("c_LOADERB_WS_BLADDER", "r_LOADERB_WS_BLADDER_PRESSURE");
+            
+            _relatedDictionary.Add("c_LOADERA_BERNOULLI_BLADDER", "r_LOADERA_CHUCK_BLADDER");//bernoulli bladder
+            _relatedDictionary.Add("c_LOADERB_BERNOULLI_BLADDER", "r_LOADERB_CHUCK_BLADDER");
+            
+            _relatedDictionary.Add("c_LoaderA_LS_Vacuum", "r_LoaderA_LS_Vacuum_anlg");//Ls vacuum
+            _relatedDictionary.Add("c_LoaderB_LS_Vacuum", "r_LoaderB_LS_Vacuum_anlg");
+            
+            _relatedDictionary.Add("c_LOADERA_BERNOULLI_N2", "r_LOADERA_BERNOULLI_PRESSURE"); //bernoulli N2
+            _relatedDictionary.Add("c_LOADERB_BERNOULLI_N2", "r_LOADERB_BERNOULLI_PRESSURE");
+        }
+
+
+        /// <summary>
+        /// 通知受关联模块变化的变量以及变化的值
+        /// </summary>
+        /// <param name="data"></param>
+        private void UpdateVariableValue(string name, bool value)
+        {
+            if (OnUpdateVariableValueChanged != null)
+            {
+                OnUpdateVariableValueChanged(name, value);
+            }
+        }
+
+        /// <summary>
+        /// 检查变化的值是否影响别的模块
+        /// </summary>
+        /// <param name="name"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public void CheckDataChanged(string name, bool value)
+        {
+            if (_relatedDictionary.ContainsKey(name))
+            {
+                UpdateVariableValue(name, value);
+            }
+            
+        }
+    }
+}