Browse Source

Add SimulatorIOMapCfg.xml and related codes;

niuyx 1 month ago
parent
commit
36274fb83c

+ 11 - 0
CyberX8_Simulator/Config/SimulatorIOMapCfg.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SimulatorIOMapConfig>
+	<SimulatorIOMapItem SourceIOName="c_LOADERA_WS_BLADDER" TargetIONameA="r_LOADERA_WS_BLADDER_PRESSURE"/>
+	<SimulatorIOMapItem SourceIOName="c_LOADERB_WS_BLADDER" TargetIONameA="r_LOADERB_WS_BLADDER_PRESSURE"/>
+	<SimulatorIOMapItem SourceIOName="c_LOADERA_BERNOULLI_BLADDER" TargetIONameA="r_LOADERA_CHUCK_BLADDER"/>
+	<SimulatorIOMapItem SourceIOName="c_LOADERB_BERNOULLI_BLADDER" TargetIONameA="r_LOADERB_CHUCK_BLADDER"/>
+	<SimulatorIOMapItem SourceIOName="c_LoaderA_LS_Vacuum" TargetIONameA="r_LoaderA_LS_Vacuum_anlg"/>
+	<SimulatorIOMapItem SourceIOName="c_LoaderB_LS_Vacuum" TargetIONameA="r_LoaderB_LS_Vacuum_anlg"/>
+	<SimulatorIOMapItem SourceIOName="c_LOADERA_BERNOULLI_N2" TargetIONameA="r_LOADERA_BERNOULLI_PRESSURE"/>
+	<SimulatorIOMapItem SourceIOName="c_LOADERB_BERNOULLI_N2" TargetIONameA="r_LOADERB_BERNOULLI_PRESSURE"/>
+</SimulatorIOMapConfig>

+ 3 - 0
CyberX8_Simulator/CyberX8_Simulator.csproj

@@ -294,6 +294,9 @@
   </ItemGroup>
   <ItemGroup />
   <ItemGroup>
+    <Content Include="Config\SimulatorIOMapCfg.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <Content Include="Config\_ioDefineVenusDE.xml">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

+ 2 - 0
Framework/Common/Common.csproj

@@ -471,6 +471,8 @@
     <Compile Include="Routine\RoutineRunner.cs" />
     <Compile Include="SCCore\TypedConfigManager.cs" />
     <Compile Include="Beckhoff\Station\BeckhoffStationLocationManager.cs" />
+    <Compile Include="Simulator\SimulatorIOMapConfig.cs" />
+    <Compile Include="Simulator\SimulatorIOMapItem.cs" />
     <Compile Include="SubstrateTrackings\MaterialInfo.cs" />
     <Compile Include="RecipeCenter\RecipeNode.cs" />
     <Compile Include="RecipeCenter\RecipeNodeType.cs" />

+ 12 - 17
Framework/Common/Device/Common/SimulatorCommManager.cs

@@ -1,9 +1,8 @@
-using Aitex.Core.Util;
-using System;
+using Aitex.Common.Util;
+using Aitex.Core.Util;
+using MECF.Framework.Common.Simulator;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO;
 
 namespace Aitex.Core.RT.Device
 {
@@ -15,6 +14,7 @@ namespace Aitex.Core.RT.Device
         /// 关联变量字典
         /// </summary>
         private Dictionary<string, string> _relatedDictionary = new Dictionary<string, string>();
+
         #endregion
 
         //delegate
@@ -32,20 +32,15 @@ namespace Aitex.Core.RT.Device
 
         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");
+            //加载相关联的IO映射配置文件
+            string xmlPath = PathManager.GetCfgDir() + "SimulatorIOMapCfg.xml";
+            SimulatorIOMapConfig cfg = CustomXmlSerializer.Deserialize<SimulatorIOMapConfig>(new FileInfo(xmlPath));
+            foreach (var item in cfg.SimulatorIOMapConfigs)
+            {
+                _relatedDictionary[item.SourceIOName] = item.TargetIONameA;
+            }
         }
 
-
         /// <summary>
         /// 通知受关联模块变化的变量以及变化的值
         /// </summary>

+ 13 - 0
Framework/Common/Simulator/SimulatorIOMapConfig.cs

@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace MECF.Framework.Common.Simulator
+{
+    [XmlRoot("SimulatorIOMapConfig")]
+    public class SimulatorIOMapConfig
+    {
+        [XmlElement(Type = typeof(SimulatorIOMapItem), ElementName = "SimulatorIOMapItem", IsNullable = false, Form = XmlSchemaForm.Qualified)]
+        public List<SimulatorIOMapItem> SimulatorIOMapConfigs { get; set; }
+    }
+}

+ 17 - 0
Framework/Common/Simulator/SimulatorIOMapItem.cs

@@ -0,0 +1,17 @@
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace MECF.Framework.Common.Simulator
+{
+    public class SimulatorIOMapItem
+    {
+        [XmlAttribute(AttributeName = "SourceIOName", Form = XmlSchemaForm.Unqualified, DataType = "string")]
+        public string SourceIOName { get; set; }
+
+        [XmlAttribute(AttributeName = "TargetIONameA", Form = XmlSchemaForm.Unqualified, DataType = "string")]
+        public string TargetIONameA { get; set; }
+
+        [XmlAttribute(AttributeName = "TargetIONameB", Form = XmlSchemaForm.Unqualified, DataType = "string")]
+        public string TargetIONameB { get; set; }
+    }
+}