|
@@ -1,14 +1,13 @@
|
|
|
-using Aitex.Core.RT.Device;
|
|
|
+using Aitex.Common.Util;
|
|
|
+using Aitex.Core.RT.Device;
|
|
|
+using Aitex.Core.RT.Log;
|
|
|
+using Aitex.Core.Util;
|
|
|
+using MECF.Framework.Common.Device.Wago;
|
|
|
using MECF.Framework.Common.Net;
|
|
|
using MECF.Framework.Simulator.Core.Driver;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
-using System.Diagnostics.Eventing.Reader;
|
|
|
-using System.Linq;
|
|
|
-using System.Text;
|
|
|
-using System.Threading;
|
|
|
-using System.Threading.Tasks;
|
|
|
-using System.Timers;
|
|
|
+using System.IO;
|
|
|
|
|
|
namespace CyberX8_Simulator.Devices
|
|
|
{
|
|
@@ -79,120 +78,75 @@ namespace CyberX8_Simulator.Devices
|
|
|
/// </summary>
|
|
|
private void InitializeData(int port) //端口用于初始化不同Wago设备的字典
|
|
|
{
|
|
|
- switch (port)
|
|
|
+ //加载对应配置文件 WagoControllerCfg-Simulator.xml
|
|
|
+ try
|
|
|
{
|
|
|
- case 501:
|
|
|
- DONameIndexDic = new Dictionary<string, int>
|
|
|
- {{"c_System_Alarm",0 },
|
|
|
- {"c_Pole_Red",1},
|
|
|
- {"c_Pole_Amber",2},
|
|
|
- {"c_Pole_Green",3},
|
|
|
- {"c_Pole_Blue",4},
|
|
|
- {"c_System_Alarm2",5},
|
|
|
- {"c_BACKSIDE_PRESSURE_TEST",6},
|
|
|
- {"c_VACUUM_TEST",7},
|
|
|
- {"DO8",8},
|
|
|
- {"DO9",9},
|
|
|
- {"DO10",10},
|
|
|
- {"DO11",11},
|
|
|
- {"DO12",12},
|
|
|
- {"DO13",13},
|
|
|
- {"DO14",14},
|
|
|
- {"DO15",15},
|
|
|
- {"DO16",16},
|
|
|
- {"DO17",17},
|
|
|
- {"DO18",18},
|
|
|
- {"DO19",19},
|
|
|
- {"DO20",20},
|
|
|
- {"DO21",21}};
|
|
|
-
|
|
|
- DINameIndexDic = new Dictionary<string, int>
|
|
|
- {{"r_Cassette_1_150",0 },
|
|
|
- {"r_Cassette_1_100",1},
|
|
|
- {"r_Cassette_1_200",2},
|
|
|
- {"r_Cassette_2_150",3},
|
|
|
- {"r_Cassette_2_100",4},
|
|
|
- {"r_Cassette_2_200",5},
|
|
|
- {"r_Cassette_3_150",6},
|
|
|
- {"r_Cassette_3_100",7},
|
|
|
- {"r_Cassette_3_200",8 },
|
|
|
- {"r_Dummy_1_150",9},
|
|
|
- {"r_Dummy_1_100",10},
|
|
|
- {"r_Dummy_1_200",11},
|
|
|
- {"r_Dummy_2_150",12},
|
|
|
- {"r_Dummy_2_100",13},
|
|
|
- {"r_Dummy_2_200",14},
|
|
|
- {"DI15",15},
|
|
|
- {"r_LoaderA_Wafer_Present",16},
|
|
|
- {"r_LoaderB_Wafer_Present",17},
|
|
|
- {"r_Cathode_Present",18},
|
|
|
- {"DI19",19},
|
|
|
- {"DI20",20},
|
|
|
- {"DI21",21},
|
|
|
- {"DI22",22},
|
|
|
- {"DI23",23},
|
|
|
- {"DI24",24},
|
|
|
- {"DI25",25},
|
|
|
- {"r_LOADERA_CRS_CURTAIN_1",26},
|
|
|
- {"r_LOADERA_CRS_CURTAIN_2",27},
|
|
|
- {"r_LOADERA_CRS_CURTAIN_3",28},
|
|
|
- {"r_LOADERA_CRS_CURTAIN_4",29},
|
|
|
- {"r_LOADERA_CRS_CURTAIN_5",30},
|
|
|
- {"r_LOADERA_CRS_CURTAIN_6",31}};
|
|
|
-
|
|
|
- AINameIndexDic = new Dictionary<string, int>
|
|
|
- {{"AI1",0 },
|
|
|
- {"AI2",1},
|
|
|
- {"AI3",2},
|
|
|
- {"r_LoaderA_LS_Vacuum_anlg",3},
|
|
|
- {"r_LoaderB_LS_Vacuum_anlg",4},
|
|
|
- {"AI6",5},
|
|
|
- {"r_LOADER_GasFlowSensor_FLOW",6},
|
|
|
- {"r_LOADERA_BERNOULLI_PRESSURE",7},
|
|
|
- {"r_LOADERB_BERNOULLI_PRESSURE",8},
|
|
|
- {"r_LOADERA_CHUCK_BLADDER",9},
|
|
|
- {"r_LOADERB_CHUCK_BLADDER",10},
|
|
|
- {"r_LOADERA_WS_BLADDER_PRESSURE",11},
|
|
|
- {"r_LOADERB_WS_BLADDER_PRESSURE",12},
|
|
|
- {"r_SPUF_VAC",13},
|
|
|
- {"r_LOADER_GasFlowSensor_VACUUM",14},};
|
|
|
+ string oldXmlPath = PathManager.GetCfgDir();
|
|
|
+ string newXmlPath = oldXmlPath.Replace("CyberX8_Simulator", "CyberX8_RT") + "Devices\\WagoControllerCfg-Simulator.xml";
|
|
|
+ WagoControllerCfg cfg = CustomXmlSerializer.Deserialize<WagoControllerCfg>(new FileInfo(newXmlPath));
|
|
|
+ if (cfg != null)
|
|
|
+ {
|
|
|
+ foreach (WagoDeviceConfig config in cfg.WagoDeviceConfigs)
|
|
|
+ {
|
|
|
+ if (port == config.Port)
|
|
|
+ {
|
|
|
+ //加载DO
|
|
|
+ int i = 0;
|
|
|
+ DONameIndexDic = new Dictionary<string, int>();
|
|
|
+ foreach (var group in config.WagoDigOut.WagoDOGroups)
|
|
|
+ {
|
|
|
+ foreach (var item in group.WagoDOs)
|
|
|
+ {
|
|
|
+ DONameIndexDic[item.Name] = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //加载DI
|
|
|
+ i = 0;
|
|
|
+ DINameIndexDic = new Dictionary<string, int>();
|
|
|
+ foreach (var group in config.WagoDigIn.WagoDIGroups)
|
|
|
+ {
|
|
|
+ foreach(var item in group.WagoDIs)
|
|
|
+ {
|
|
|
+ DINameIndexDic[item.Name] = i;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //加载AO
|
|
|
+ i = 0;
|
|
|
+ AONameIndexDic = new Dictionary<string, int>();
|
|
|
+ foreach (var group in config.WagoAnoOut.WagoAOGroups)
|
|
|
+ {
|
|
|
+ foreach (var item in group.WagoAOs)
|
|
|
+ {
|
|
|
+ AONameIndexDic[item.Name] = i;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //加载AI
|
|
|
+ i = 0;
|
|
|
+ AINameIndexDic = new Dictionary<string, int>();
|
|
|
+ foreach (var group in config.WagoAnoIn.WagoAIGroups)
|
|
|
+ {
|
|
|
+ foreach (var item in group.WagoAIs)
|
|
|
+ {
|
|
|
+ AINameIndexDic[item.Name] = i;
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- AONameIndexDic = new Dictionary<string, int>
|
|
|
- {{"AO1",0},
|
|
|
- {"AO2",1},
|
|
|
- {"AO3",2},
|
|
|
- {"AO4",3},
|
|
|
- {"AO5",4},
|
|
|
- {"AO6",5},
|
|
|
- {"AO7",6},
|
|
|
- {"AO8",7},
|
|
|
- {"AO9",8},
|
|
|
- {"AO10",9},
|
|
|
- {"AO11",10},
|
|
|
- {"AO12",11},
|
|
|
- {"AO13",12},
|
|
|
- {"AO14",13},
|
|
|
- {"AO15",14},
|
|
|
- {"AO16",15}};
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_WAGO, "Wago", "Load wago WagoControllerCfg-Simulator.xml failed");
|
|
|
+ }
|
|
|
|
|
|
- //设置IO变量默认值
|
|
|
- AIShorts[AINameIndexDic["r_LoaderA_LS_Vacuum_anlg"]] = 0x32C8;
|
|
|
- AIShorts[AINameIndexDic["r_LoaderB_LS_Vacuum_anlg"]] = 0x32C8;
|
|
|
- break;
|
|
|
- case 550:
|
|
|
- DONameIndexDic = new Dictionary<string, int>
|
|
|
- {{"DO0",0 }, {"DO1",1 }};
|
|
|
- DINameIndexDic = new Dictionary<string, int>
|
|
|
- {{"DI0",0 }, {"DI1",1 }};
|
|
|
- AONameIndexDic = new Dictionary<string, int>
|
|
|
- {{"AO0",0 }, {"AO1",0 }};
|
|
|
- AINameIndexDic = new Dictionary<string, int>
|
|
|
- {{"AI0",0 }, {"AI1",0 }};
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
+ //设置IO变量默认值
|
|
|
+ if(AINameIndexDic.ContainsKey("r_LoaderA_LS_Vacuum_anlg")) AIShorts[AINameIndexDic["r_LoaderA_LS_Vacuum_anlg"]] = 0x32C8;
|
|
|
+ if(AINameIndexDic.ContainsKey("r_LoaderB_LS_Vacuum_anlg")) AIShorts[AINameIndexDic["r_LoaderB_LS_Vacuum_anlg"]] = 0x32C8;
|
|
|
+
|
|
|
}
|
|
|
#region 公共方法
|
|
|
public void UpdataDOBytes(string name,int value)
|