Browse Source

Add SRDLiftUpRoutine; Revise IO ModuleIOCfg.xml and SRD UI; Add SRD related Simulator;

niuyx 2 weeks ago
parent
commit
48517b7d99

+ 1 - 1
CyberX8_MainPages/Views/SRDHomePageView.xaml

@@ -148,7 +148,7 @@
                                          WaferID="{Binding WaferID}" />
         </Grid>
         <Grid Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" >
-            <UserControls:SRDFlipperControl HorizontalAlignment="Left" Margin="65,5,0,0" VerticalAlignment="Top"
+            <UserControls:SRDFlipperControl HorizontalAlignment="Left" Margin="115,5,0,0" VerticalAlignment="Top"
                                           IsEnabled="{Binding IsEnabled}" ModuleName="{Binding Module}" CommonData="{Binding SRDCommonData}" Width="580"/>
         </Grid>
     </Grid>

+ 1 - 1
CyberX8_RT/Config/Devices/ModuleIOCfg.xml

@@ -223,7 +223,7 @@
 	<IO Name="SRD2.LiftUp" IOName="c_SRD2_LIFT_UP"/>
 	<IO Name="SRD2.LiftUpStatus" IOName="r_SRD2_LIFT_UP"/>
 	<IO Name="SRD2.Flipper1Out150Status" IOName="r_SRD2_150_FLIPPER1_OUT"/>
-	<IO Name="SRD2.Fipper2Out150Status" IOName="r_SRD2_150_FLIPPER2_OUT"/>
+	<IO Name="SRD2.Flipper2Out150Status" IOName="r_SRD2_150_FLIPPER2_OUT"/>
 	<IO Name="SRD2.Flipper3Out150Status" IOName="r_SRD2_150_FLIPPER3_OUT"/>
 	<IO Name="SRD2.Flipper1Out200Status" IOName="r_SRD2_200_FLIPPER1_OUT"/>
 	<IO Name="SRD2.Flipper2Out200Status" IOName="r_SRD2_200_FLIPPER2_OUT"/>

+ 7 - 7
CyberX8_RT/Config/Devices/WagoControllerCfg-Simulator.xml

@@ -400,7 +400,7 @@
 				<DI Name="r_SRD_FLUID_LEVEL"  Address="0" Invert="true"/>
 				<DI Name="r_SRD1_CHUCK_VAC_OK"  Address="1" Invert="false"/>
 				<DI Name="r_SRD1_WAFER_PRESENT"  Address="2" Invert="false"/>
-				<DI Name="r_SRD1_LIFT_UP"  Address="3" Invert="false"/>
+				<DI Name="r_SRD1_LIFT_UP"  Address="3" Invert="true"/>
 				<DI Name="DI4"  Address="4" Invert="false"/>
 				<DI Name="r_SRD1_SHUTTER_OPEN"  Address="5" Invert="false"/>
 				<DI Name="r_SRD1_SHUTTER_CLOSED"  Address="6" Invert="false"/>
@@ -418,8 +418,8 @@
 			</DIGroup>
 			<DIGroup Name="5">
 				<DI Name="r_SRD2_CHUCK_VAC_OK"  Address="16" Invert="false"/>
-				<DI Name="r_SRD2_WAFER_PRESENT"  Address="17" Invert="true"/>
-				<DI Name="r_SRD2_LIFT_UP"  Address="18" Invert="false"/>
+				<DI Name="r_SRD2_WAFER_PRESENT"  Address="17" Invert="false"/>
+				<DI Name="r_SRD2_LIFT_UP"  Address="18" Invert="true"/>
 				<DI Name="DI19"  Address="19" Invert="true"/>
 				<DI Name="r_SRD2_SHUTTER_OPEN "  Address="20" Invert="false"/>
 				<DI Name="r_SRD2_SHUTTER_CLOSED"  Address="21" Invert="true"/>
@@ -440,8 +440,8 @@
 		<Dig_Out>
 			<DOGroup Name="7">
 				<DO Name="c_SRD1_LIFT_UP"  Address="512" Invert="false"/>
-				<DO Name="c_SRD1_150_FLIPPERS_IN"  Address="513" Invert="false"/>
-				<DO Name="c_SRD1_200_FLIPPERS_IN"  Address="514" Invert="false"/>
+				<DO Name="c_SRD1_150_FLIPPERS_IN"  Address="513" Invert="true"/>
+				<DO Name="c_SRD1_200_FLIPPERS_IN"  Address="514" Invert="true"/>
 				<DO Name="c_SRD1_Shutter_Close"  Address="515" Invert="false"/>
 				<DO Name="c_SRD1_WATER_ON"  Address="516" Invert="false"/>
 				<DO Name="c_SRD1_CHUCK_VACUUM"  Address="517" Invert="false"/>
@@ -450,8 +450,8 @@
 			</DOGroup>
 			<DOGroup Name="8">
 				<DO Name="c_SRD2_LIFT_UP"  Address="520" Invert="false"/>
-				<DO Name="c_SRD2_150_FLIPPERS_IN"  Address="521" Invert="false"/>
-				<DO Name="c_SRD2_200_FLIPPERS_IN"  Address="522" Invert="false"/>
+				<DO Name="c_SRD2_150_FLIPPERS_IN"  Address="521" Invert="true"/>
+				<DO Name="c_SRD2_200_FLIPPERS_IN"  Address="522" Invert="true"/>
 				<DO Name="c_SRD2_Shutter_Close"  Address="523" Invert="false"/>
 				<DO Name="c_SRD2_WATER_ON"  Address="524" Invert="false"/>
 				<DO Name="c_SRD2_CHUCK_VACUUM"  Address="525" Invert="false"/>

+ 7 - 7
CyberX8_RT/Config/Devices/WagoControllerCfg.xml

@@ -400,7 +400,7 @@
 				<DI Name="r_SRD_FLUID_LEVEL"  Address="0" Invert="true"/>
 				<DI Name="r_SRD1_CHUCK_VAC_OK"  Address="1" Invert="false"/>
 				<DI Name="r_SRD1_WAFER_PRESENT"  Address="2" Invert="false"/>
-				<DI Name="r_SRD1_LIFT_UP"  Address="3" Invert="false"/>
+				<DI Name="r_SRD1_LIFT_UP"  Address="3" Invert="true"/>
 				<DI Name="DI4"  Address="4" Invert="false"/>
 				<DI Name="r_SRD1_SHUTTER_OPEN"  Address="5" Invert="false"/>
 				<DI Name="r_SRD1_SHUTTER_CLOSED"  Address="6" Invert="false"/>
@@ -418,8 +418,8 @@
 			</DIGroup>
 			<DIGroup Name="5">
 				<DI Name="r_SRD2_CHUCK_VAC_OK"  Address="16" Invert="false"/>
-				<DI Name="r_SRD2_WAFER_PRESENT"  Address="17" Invert="true"/>
-				<DI Name="r_SRD2_LIFT_UP"  Address="18" Invert="false"/>
+				<DI Name="r_SRD2_WAFER_PRESENT"  Address="17" Invert="false"/>
+				<DI Name="r_SRD2_LIFT_UP"  Address="18" Invert="true"/>
 				<DI Name="DI19"  Address="19" Invert="true"/>
 				<DI Name="r_SRD2_SHUTTER_OPEN "  Address="20" Invert="false"/>
 				<DI Name="r_SRD2_SHUTTER_CLOSED"  Address="21" Invert="true"/>
@@ -440,8 +440,8 @@
 		<Dig_Out>
 			<DOGroup Name="7">
 				<DO Name="c_SRD1_LIFT_UP"  Address="512" Invert="false"/>
-				<DO Name="c_SRD1_150_FLIPPERS_IN"  Address="513" Invert="false"/>
-				<DO Name="c_SRD1_200_FLIPPERS_IN"  Address="514" Invert="false"/>
+				<DO Name="c_SRD1_150_FLIPPERS_IN"  Address="513" Invert="true"/>
+				<DO Name="c_SRD1_200_FLIPPERS_IN"  Address="514" Invert="true"/>
 				<DO Name="c_SRD1_Shutter_Close"  Address="515" Invert="false"/>
 				<DO Name="c_SRD1_WATER_ON"  Address="516" Invert="false"/>
 				<DO Name="c_SRD1_CHUCK_VACUUM"  Address="517" Invert="false"/>
@@ -450,8 +450,8 @@
 			</DOGroup>
 			<DOGroup Name="8">
 				<DO Name="c_SRD2_LIFT_UP"  Address="520" Invert="false"/>
-				<DO Name="c_SRD2_150_FLIPPERS_IN"  Address="521" Invert="false"/>
-				<DO Name="c_SRD2_200_FLIPPERS_IN"  Address="522" Invert="false"/>
+				<DO Name="c_SRD2_150_FLIPPERS_IN"  Address="521" Invert="true"/>
+				<DO Name="c_SRD2_200_FLIPPERS_IN"  Address="522" Invert="true"/>
 				<DO Name="c_SRD2_Shutter_Close"  Address="523" Invert="false"/>
 				<DO Name="c_SRD2_WATER_ON"  Address="524" Invert="false"/>
 				<DO Name="c_SRD2_CHUCK_VACUUM"  Address="525" Invert="false"/>

+ 1 - 0
CyberX8_RT/CyberX8_RT.csproj

@@ -254,6 +254,7 @@
     <Compile Include="Devices\Safety\SafetyNewAllOnRoutine.cs" />
     <Compile Include="Devices\Safety\SafetyAllOnRoutine.cs" />
     <Compile Include="Devices\Safety\SafetyArmResetRoutine.cs" />
+    <Compile Include="Devices\SRD\SrdCommonLiftUpRoutine.cs" />
     <Compile Include="Devices\SRD\SRDDeviceTimer.cs" />
     <Compile Include="Devices\SRD\TotalSRDDevice.cs" />
     <Compile Include="Devices\TransPorter\TransporterDeviceTimer.cs" />

+ 31 - 8
CyberX8_RT/Devices/SRD/SrdCommonDevice.cs

@@ -35,6 +35,8 @@ namespace CyberX8_RT.Devices.SRD
             DoorOpen,
             ChuckVacuumOn,
             ChuckVacuumOff,
+            LiftUpOn,
+            LiftUpOff  
         }
 
         #region 常量
@@ -109,6 +111,10 @@ namespace CyberX8_RT.Devices.SRD
         /// Vacuum Routine
         /// </summary>
         private SrdCommonChuckVacuumRoutine _chuckVacuumRoutine;
+        /// <summary>
+        /// Lift Up routine
+        /// </summary>
+        private SrdCommonLiftUpRoutine _liftUpRoutine;
         #endregion
 
         #endregion
@@ -168,6 +174,7 @@ namespace CyberX8_RT.Devices.SRD
         {
             _doorCloseRoutine = new SrdCommonDoorCloseRoutine(Module);
             _chuckVacuumRoutine = new SrdCommonChuckVacuumRoutine(Module);
+            _liftUpRoutine = new SrdCommonLiftUpRoutine(Module);
         }
         /// <summary>
         /// 订阅数据
@@ -608,7 +615,16 @@ namespace CyberX8_RT.Devices.SRD
         /// <returns></returns>
         public bool LiftUpOnAction(string cmd, object[] args)
         {
-            return LiftUp(true);
+            if (!JudgeRunningState(SrdCommonOperation.LiftUpOn))
+            {
+                _currentOperation = SrdCommonOperation.LiftUpOn;
+                _status = _liftUpRoutine.Start(true);
+                return _status == RState.Running;
+            }
+            else
+            {
+                return false;
+            }
         }
         /// <summary>
         /// Lift Up Off
@@ -618,13 +634,17 @@ namespace CyberX8_RT.Devices.SRD
         /// <returns></returns>
         public bool LiftUpOffAction(string cmd, object[] args)
         {
-            return LiftUp(false);
-        }
-        private bool LiftUp(bool value)
-        {
-            string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{LIFT_UP}");
-            return IOModuleManager.Instance.WriteIoValue(ioName, value);
-        }
+            if (!JudgeRunningState(SrdCommonOperation.LiftUpOff))
+            {
+                _currentOperation = SrdCommonOperation.LiftUpOff;
+                _status = _liftUpRoutine.Start(false);
+                return _status == RState.Running;
+            }
+            else
+            {
+                return false;
+            }
+        }       
         #endregion
 
         #region ChuckATM
@@ -839,6 +859,9 @@ namespace CyberX8_RT.Devices.SRD
                 case SrdCommonOperation.ChuckVacuumOn:
                 case SrdCommonOperation.ChuckVacuumOff:
                     return _chuckVacuumRoutine;
+                case SrdCommonOperation.LiftUpOn:
+                case SrdCommonOperation.LiftUpOff:
+                    return _liftUpRoutine;
                 default:
                     return null;
             }

+ 86 - 0
CyberX8_RT/Devices/SRD/SrdCommonLiftUpRoutine.cs

@@ -0,0 +1,86 @@
+using Aitex.Core.RT.Device;
+using Aitex.Core.RT.Log;
+using Aitex.Core.RT.Routine;
+using Aitex.Core.RT.SCCore;
+using CyberX8_Core;
+using MECF.Framework.Common.Beckhoff.ModuleIO;
+using MECF.Framework.Common.IOCore;
+using MECF.Framework.Common.Routine;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CyberX8_RT.Devices.SRD
+{
+    public class SrdCommonLiftUpRoutine : RoutineBase, IRoutine
+    {
+        #region 常量 
+        private const string LIFT_UP = "LiftUp";
+        #endregion
+        private enum LiftUpStep
+        {
+            LiftUp,
+            End
+        }
+        #region 内部变量
+        private bool _liftUp;
+        private SrdCommonDevice _srdCommon;
+        private int _timeout = 1000;
+        #endregion
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="module"></param>
+        public SrdCommonLiftUpRoutine(string module) : base(module)
+        {
+        }
+
+        public void Abort()
+        {
+            Runner.Stop("Manual Abort");
+        }
+
+        public RState Monitor()
+        {
+            Runner.Run(LiftUpStep.LiftUp, LiftUp, CheckLiftUpStatus, _timeout)
+                .End(LiftUpStep.End, NullFun, 100);
+            return Runner.Status;
+        }
+
+        private bool LiftUp()
+        {
+            string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{LIFT_UP}");
+            return IOModuleManager.Instance.WriteIoValue(ioName, _liftUp);
+        }
+
+        private bool CheckLiftUpStatus()
+        {
+            if (_srdCommon.CommonData.LiftUpStatus == _liftUp)
+            {
+                LOG.WriteLog(eEvent.INFO_SRD, Module, $"LiftUp Sensor is {_liftUp}");
+                return true;
+            }
+            else
+            {
+                LOG.WriteLog(eEvent.INFO_SRD, Module, $"LiftUp Sensor is {_liftUp}");
+                return false;
+            }
+        }
+
+        public RState Start(params object[] objs)
+        {
+            _liftUp = (bool)objs[0];
+            _srdCommon = DEVICE.GetDevice<SrdCommonDevice>($"{Module}.Common");
+            if (_liftUp)
+            {
+                return Runner.Start(Module, "Lift Up On");
+            }
+            else
+            {
+                return Runner.Start(Module, "Lift Up Off");
+            }
+        }
+    }
+}

+ 133 - 1
CyberX8_Simulator/Devices/WagoSocketSimulator.cs

@@ -51,6 +51,14 @@ namespace CyberX8_Simulator.Devices
         /// </summary>
         private Dictionary<string, bool> _festoDataBuffer = new Dictionary<string, bool>();
         /// <summary>
+        /// Name-WagoDO dictionary
+        /// </summary>
+        private Dictionary<string, WagoDO> _doNameWagoDODic = new Dictionary<string, WagoDO>();
+        /// <summary>
+        /// Name-WagoDI dictionary
+        /// </summary>
+        private Dictionary<string, WagoDI> _diNameWagoDIDic = new Dictionary<string, WagoDI>();
+        /// <summary>
         /// 定时器
         /// </summary>
         private PeriodicJob _LoaderPeriodicJob;
@@ -64,6 +72,8 @@ namespace CyberX8_Simulator.Devices
         private bool _rinse3DumpValve = false;
         private bool _rinse4FillValve = false;
         private bool _rinse4DumpValve = false;
+        private int _srd1currentVacuumValue;
+        private int _srd2currentVacuumValue;
         //delegate
         #region Delegate
         public delegate void VariableValueChanged(object obj);
@@ -158,23 +168,121 @@ namespace CyberX8_Simulator.Devices
         /// <param name="value"></param>
         private void UpdateDataCausedByWago(int position, bool value)
         {
+            //Puf Simulator
             if (DONameIndexDic.ContainsKey("c_PUF_CHUCK") && position == DONameIndexDic["c_PUF_CHUCK"])
             {
+                value = _doNameWagoDODic["c_PUF_CHUCK"].Invert? !value : value;
                 UpdataDIBytes("r_PUF_A_CHUCK_OUT", value ? 1 : 0);
                 UpdataDIBytes("r_PUF_B_CHUCK_OUT", value ? 1 : 0);
                 UpdataDIBytes("r_PUF_A_CHUCK_IN", !value ? 1 : 0);
                 UpdataDIBytes("r_PUF_B_CHUCK_IN", !value ? 1 : 0);                             
             }
+            //HVD Simulator
             if (DONameIndexDic.ContainsKey("c_HVD_1_HIGH") && position == DONameIndexDic["c_HVD_1_HIGH"])
             {
+                value = _doNameWagoDODic["c_HVD_1_HIGH"].Invert ? !value : value;
                 UpdataAIShorts("r_HVD_1_ANALOG", value ? 4500 : 0);
             }
 
             if (DONameIndexDic.ContainsKey("c_HVD_2_HIGH") && position == DONameIndexDic["c_HVD_2_HIGH"])
             {
+                value = _doNameWagoDODic["c_HVD_2_HIGH"].Invert ? !value : value;
                 UpdataAIShorts("r_HVD_2_ANALOG", value ? 4500 : 0);
             }
-            
+            //SRD Simulator
+            //Lift UP
+            if (DONameIndexDic.ContainsKey("c_SRD1_LIFT_UP") && position == DONameIndexDic["c_SRD1_LIFT_UP"])
+            {
+                value = (_doNameWagoDODic["c_SRD1_LIFT_UP"].Invert ^ _diNameWagoDIDic["r_SRD1_LIFT_UP"].Invert) ? !value : value;
+                UpdataDIBytes("r_SRD1_LIFT_UP", value ? 1 : 0);
+            }
+            if (DONameIndexDic.ContainsKey("c_SRD2_LIFT_UP") && position == DONameIndexDic["c_SRD2_LIFT_UP"])
+            {
+                value = (_doNameWagoDODic["c_SRD2_LIFT_UP"].Invert ^ _diNameWagoDIDic["r_SRD2_LIFT_UP"].Invert) ? !value : value;
+                UpdataDIBytes("r_SRD2_LIFT_UP", value ? 1 : 0);
+            }
+            //Flippers
+            if (DONameIndexDic.ContainsKey("c_SRD1_150_FLIPPERS_IN") && position == DONameIndexDic["c_SRD1_150_FLIPPERS_IN"])
+            {
+                value = (_doNameWagoDODic["c_SRD1_150_FLIPPERS_IN"].Invert ^ _diNameWagoDIDic["r_SRD1_150_FLIPPER1_OUT"].Invert) ? !value : value;
+                UpdataDIBytes("r_SRD1_150_FLIPPER1_OUT", value ? 0 : 1);
+                UpdataDIBytes("r_SRD1_150_FLIPPER2_OUT", value ? 0 : 1);
+                UpdataDIBytes("r_SRD1_150_FLIPPER3_OUT", value ? 0 : 1);
+            }
+            if (DONameIndexDic.ContainsKey("c_SRD2_150_FLIPPERS_IN") && position == DONameIndexDic["c_SRD2_150_FLIPPERS_IN"])
+            {
+                value = (_doNameWagoDODic["c_SRD2_150_FLIPPERS_IN"].Invert ^ _diNameWagoDIDic["r_SRD2_150_FLIPPER1_OUT"].Invert) ? !value : value;
+                UpdataDIBytes("r_SRD2_150_FLIPPER1_OUT", value ? 0 : 1);
+                UpdataDIBytes("r_SRD2_150_FLIPPER2_OUT", value ? 0 : 1);
+                UpdataDIBytes("r_SRD2_150_FLIPPER3_OUT", value ? 0 : 1);
+            }
+            if (DONameIndexDic.ContainsKey("c_SRD1_200_FLIPPERS_IN") && position == DONameIndexDic["c_SRD1_200_FLIPPERS_IN"])
+            {
+                value = (_doNameWagoDODic["c_SRD1_200_FLIPPERS_IN"].Invert ^ _diNameWagoDIDic["r_SRD1_200_FLIPPER1_OUT"].Invert) ? !value : value;
+                UpdataDIBytes("r_SRD1_200_FLIPPER1_OUT", value ? 0 : 1);
+                UpdataDIBytes("r_SRD1_200_FLIPPER2_OUT", value ? 0 : 1);
+                UpdataDIBytes("r_SRD1_200_FLIPPER3_OUT", value ? 0 : 1);
+            }
+            if (DONameIndexDic.ContainsKey("c_SRD2_200_FLIPPERS_IN") && position == DONameIndexDic["c_SRD2_200_FLIPPERS_IN"])
+            {
+                value = (_doNameWagoDODic["c_SRD2_200_FLIPPERS_IN"].Invert ^ _diNameWagoDIDic["r_SRD2_200_FLIPPER1_OUT"].Invert) ? !value : value;
+                UpdataDIBytes("r_SRD2_200_FLIPPER1_OUT", value ? 0 : 1);
+                UpdataDIBytes("r_SRD2_200_FLIPPER2_OUT", value ? 0 : 1);
+                UpdataDIBytes("r_SRD2_200_FLIPPER3_OUT", value ? 0 : 1);
+            }
+            //Shuttle
+            if (DONameIndexDic.ContainsKey("c_SRD1_Shutter_Close") && position == DONameIndexDic["c_SRD1_Shutter_Close"])
+            {
+                value = (_doNameWagoDODic["c_SRD1_Shutter_Close"].Invert ^ _diNameWagoDIDic["r_SRD1_SHUTTER_OPEN"].Invert) ? !value : value;
+                UpdataDIBytes("r_SRD1_SHUTTER_OPEN", value ? 0 : 1);
+                UpdataDIBytes("r_SRD1_SHUTTER_CLOSED", value ? 1 : 0);                
+            }
+            if (DONameIndexDic.ContainsKey("c_SRD2_Shutter_Close") && position == DONameIndexDic["c_SRD2_Shutter_Close"])
+            {
+                value = (_doNameWagoDODic["c_SRD2_Shutter_Close"].Invert ^ _diNameWagoDIDic["r_SRD2_SHUTTER_OPEN"].Invert) ? !value : value;
+                UpdataDIBytes("r_SRD2_SHUTTER_OPEN", value ? 0 : 1);
+                UpdataDIBytes("r_SRD2_SHUTTER_CLOSED", value ? 1 : 0);
+            }
+            //Vacuum
+            if (DONameIndexDic.ContainsKey("c_SRD1_CHUCK_VACUUM") && position == DONameIndexDic["c_SRD1_CHUCK_VACUUM"])
+            {
+                value = (_doNameWagoDODic["c_SRD1_CHUCK_VACUUM"].Invert ) ? !value : value;
+                _srd1currentVacuumValue = value ? 5000 : 15000;
+                UpdataAIShorts("r_SRD1_CHUCK_VACUUM_anlg", _srd1currentVacuumValue);
+                UpdataDIBytes("r_SRD1_CHUCK_VAC_OK", value ? 0 : 1);
+                
+            } 
+            if (DONameIndexDic.ContainsKey("c_SRD2_CHUCK_VACUUM") && position == DONameIndexDic["c_SRD2_CHUCK_VACUUM"])
+            {
+                value = _doNameWagoDODic["c_SRD2_CHUCK_VACUUM"].Invert ? !value : value;
+                _srd2currentVacuumValue = value ? 5000 : 15000;
+                UpdataAIShorts("r_SRD2_CHUCK_VACUUM_anlg", _srd2currentVacuumValue);
+                UpdataDIBytes("r_SRD2_CHUCK_VAC_OK", value ? 0 : 1);
+            }
+            if (DONameIndexDic.ContainsKey("c_SRD1_CHUCK_ATM_ON") && position == DONameIndexDic["c_SRD1_CHUCK_ATM_ON"])
+            {
+                value = _doNameWagoDODic["c_SRD1_CHUCK_ATM_ON"].Invert ? !value : value;
+                _srd1currentVacuumValue = value ? 5000 : 15000;
+                UpdataAIShorts("r_SRD1_CHUCK_VACUUM_anlg", _srd1currentVacuumValue);
+                
+            }
+            if (DONameIndexDic.ContainsKey("c_SRD2_CHUCK_ATM_ON") && position == DONameIndexDic["c_SRD2_CHUCK_ATM_ON"])
+            {
+                value = _doNameWagoDODic["c_SRD2_CHUCK_ATM_ON"].Invert ? !value : value;
+                _srd2currentVacuumValue = value ? 5000 : 15000;
+                UpdataAIShorts("r_SRD2_CHUCK_VACUUM_anlg", _srd2currentVacuumValue);
+            }
+            //Water
+            if (DONameIndexDic.ContainsKey("c_SRD1_WATER_ON") && position == DONameIndexDic["c_SRD1_WATER_ON"])
+            {
+                value = _doNameWagoDODic["c_SRD1_WATER_ON"].Invert ? !value : value;
+                UpdataAIShorts("r_SRD1_WATER_FLOW", value ? 30000 : 3277);
+            }
+            if (DONameIndexDic.ContainsKey("c_SRD2_WATER_ON") && position == DONameIndexDic["c_SRD2_WATER_ON"])
+            {
+                value = _doNameWagoDODic["c_SRD2_WATER_ON"].Invert ? !value : value;
+                UpdataAIShorts("r_SRD2_WATER_FLOW", value ? 30000 : 3277);
+            }
         }
         /// <summary>
         /// 初始化字典
@@ -212,6 +320,7 @@ namespace CyberX8_Simulator.Devices
                                     {
                                         DONameIndexDic[item.Name] = i;
                                         i++;
+                                        _doNameWagoDODic[item.Name] = item;
                                     }
                                 }
                             }
@@ -226,6 +335,7 @@ namespace CyberX8_Simulator.Devices
                                     {
                                         DINameIndexDic[item.Name] = i;
                                         i++;
+                                        _diNameWagoDIDic[item.Name] = item;
                                     }
                                 }
                             }
@@ -279,6 +389,28 @@ namespace CyberX8_Simulator.Devices
             if (AINameIndexDic.ContainsKey("r_QDRD2_WATER_LEVEL")) AIShorts[AINameIndexDic["r_QDRD2_WATER_LEVEL"]] = 4000;
             if (AINameIndexDic.ContainsKey("r_QDRD3_WATER_LEVEL")) AIShorts[AINameIndexDic["r_QDRD3_WATER_LEVEL"]] = 4000;
             if (AINameIndexDic.ContainsKey("r_QDRD4_WATER_LEVEL")) AIShorts[AINameIndexDic["r_QDRD4_WATER_LEVEL"]] = 4000;
+            //SRD
+            if (AINameIndexDic.ContainsKey("r_SRD1_CHUCK_VACUUM_anlg")) AIShorts[AINameIndexDic["r_SRD1_CHUCK_VACUUM_anlg"]] = 15000;
+            if (AINameIndexDic.ContainsKey("r_SRD2_CHUCK_VACUUM_anlg")) AIShorts[AINameIndexDic["r_SRD2_CHUCK_VACUUM_anlg"]] = 15000;
+            if (DINameIndexDic.ContainsKey("r_SRD1_SHUTTER_OPEN")) DIBytes[DINameIndexDic["r_SRD1_SHUTTER_OPEN"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD1_SHUTTER_CLOSED")) DIBytes[DINameIndexDic["r_SRD1_SHUTTER_CLOSED"]] = 0;
+            if (DINameIndexDic.ContainsKey("r_SRD2_SHUTTER_OPEN")) DIBytes[DINameIndexDic["r_SRD2_SHUTTER_OPEN"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD2_SHUTTER_CLOSED")) DIBytes[DINameIndexDic["r_SRD2_SHUTTER_CLOSED"]] = 0;
+            if (DINameIndexDic.ContainsKey("r_SRD_FLUID_LEVEL")) DIBytes[DINameIndexDic["r_SRD_FLUID_LEVEL"]] = 0;
+            if (DINameIndexDic.ContainsKey("r_SRD1_CHUCK_VAC_OK")) DIBytes[DINameIndexDic["r_SRD1_CHUCK_VAC_OK"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD2_CHUCK_VAC_OK")) DIBytes[DINameIndexDic["r_SRD2_CHUCK_VAC_OK"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD1_150_FLIPPER1_OUT")) DIBytes[DINameIndexDic["r_SRD1_150_FLIPPER1_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD1_150_FLIPPER2_OUT")) DIBytes[DINameIndexDic["r_SRD1_150_FLIPPER2_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD1_150_FLIPPER3_OUT")) DIBytes[DINameIndexDic["r_SRD1_150_FLIPPER3_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD1_200_FLIPPER1_OUT")) DIBytes[DINameIndexDic["r_SRD1_200_FLIPPER1_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD1_200_FLIPPER2_OUT")) DIBytes[DINameIndexDic["r_SRD1_200_FLIPPER2_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD1_200_FLIPPER3_OUT")) DIBytes[DINameIndexDic["r_SRD1_200_FLIPPER3_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD2_150_FLIPPER1_OUT")) DIBytes[DINameIndexDic["r_SRD2_150_FLIPPER1_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD2_150_FLIPPER2_OUT")) DIBytes[DINameIndexDic["r_SRD2_150_FLIPPER2_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD2_150_FLIPPER3_OUT")) DIBytes[DINameIndexDic["r_SRD2_150_FLIPPER3_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD2_200_FLIPPER1_OUT")) DIBytes[DINameIndexDic["r_SRD2_200_FLIPPER1_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD2_200_FLIPPER2_OUT")) DIBytes[DINameIndexDic["r_SRD2_200_FLIPPER2_OUT"]] = 1;
+            if (DINameIndexDic.ContainsKey("r_SRD2_200_FLIPPER3_OUT")) DIBytes[DINameIndexDic["r_SRD2_200_FLIPPER3_OUT"]] = 1;
 
         }
         #region 公共方法