Browse Source

Add LoaderHomeAll and SwitchAllOn

niuyx 1 month ago
parent
commit
d73f84fd67

+ 1 - 1
CyberX8_RT/Config/Devices/FestoControllerCfg-Simulator.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FestoControllerConfig>
-	<FestoDeviceConfig Name="Festo3" IpAddress="10.0.0.42" Port="502" SendTimeout="2000" RecvTimeout="2000" DIStartAddress="45395" Channel="1">
+	<FestoDeviceConfig Name="Festo3" IpAddress="127.0.0.1" Port="502" SendTimeout="2000" RecvTimeout="2000" DIStartAddress="45395" Channel="1">
 		<DO Name="c_Transporter_Clamp"  Address="40003" Invert="false" Bit="0"/>
 		<DO Name="Festo.DO1" Address="40003" Invert="false" Bit="1"/>
 		<DO Name="c_Transporter2_Clamp"  Address="40003" Invert="false" Bit="2"/>

+ 1 - 1
CyberX8_RT/Devices/AXIS/AxisManager.cs

@@ -88,7 +88,7 @@ namespace CyberX8_RT.Devices.AXIS
                 {
                     if (!axis.IsSwitchOn)
                     {
-                        LOG.WriteLog(eEvent.ERROR_PUF_NOT_SWITCHON, $"{module}.{name}", $"{axis.Name} is switch off");
+                        LOG.WriteLog(eEvent.ERROR_PUF_NOT_SWITCHON, $"{module}", $"{axis.Name} is switch off");
                         return false;
                     }
                 }

+ 98 - 198
CyberX8_RT/Modules/Loader/LoaderHomeAllRoutine.cs

@@ -14,6 +14,12 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using CyberX8_RT.Devices.Safety;
+using Aitex.Core.Util;
+using CyberX8_RT.Modules.PUF;
+using CyberX8_RT.Modules.Transporter;
+using Aitex.Core.Common;
+using static Mono.Security.X509.X520;
+using Aitex.Core.RT.SCCore;
 
 namespace CyberX8_RT.Modules.Loader
 {
@@ -21,45 +27,36 @@ namespace CyberX8_RT.Modules.Loader
     {
         private enum HomeAllStep
         {
-            CheckSafety,
-            SideADoorUnlock,
-            WaitSideADoorUnlock,
+            CheckPreCondition,
             TiltAHome,
             WaitTiltAHome,
-            TiltAGotoVertical,
-            TiltAGotoVerticalCheck,
-            SideBDoorUnlock,
-            WaitSideBDoorUnlock,
+            TiltAGotoVERT,
+            TiltAGotoVERTCheck,
             TiltBHome,
             WaitTiltBHome,
-            TiltBGotoVertical,
-            TiltBGotoVerticalCheck,
+            TiltBGotoVERT,
+            TiltBGotoVERTCheck,
             ShuttleAHome,
             WaitShuttleAHome,
-            ShuttleAGotoClose,
-            ShuttleAGotoCloseCheck,
+            ShuttleAGotoMID,
+            ShuttleAGotoMIDCheck,
             ShuttleBHome,
             WaitShuttleBHome,
-            ShuttleBGotoClose,
-            ShuttleBGotoCloseCheck,
-            SideADoorLockOn,
-            SideADoorLockOnCheck,
-            SideBDoorLockOn,
-            SideBDoorLockOnCheck,
-            CheckDupfCondition,
+            ShuttleBGotoMID,
+            ShuttleBGotoMIDCheck,
+            LSAHome,
+            WaitLSAHome,
+            LSAGotoSetup,
+            LSAGotoSetupCheck,
+            LSBHome,
+            WaitLSBHome,
+            LSBGotoSetup,
+            LSBGotoSetupCheck,
             RotationHome,
             WaitRotationHome,
             RotationGotoTrnpa,
             RotationGotoTrnpaCheck,
-            CRSAHome,
-            WaitCRSAHome,
-            CRSAGotoSetUp,
-            CRSAGotoSetUpCheck,
-            CRSBHome,
-            WaitCRSBHome,
-            CRSBGotoSetUp,
-            CRSBGotoSetUpCheck,
-            End
+            End     
         }
 
         #region 内部变量
@@ -68,15 +65,12 @@ namespace CyberX8_RT.Modules.Loader
         private JetAxisBase _tiltAAxis;
         private JetAxisBase _tiltBAxis;
         private JetAxisBase _rotationAxis;
-        private JetAxisBase _crsAAxis;
-        private JetAxisBase _crsBAxis;
-        private JetAxisBase _puf1VerticalAxis;
-        private JetAxisBase _puf2VerticalAxis;
-        private JetAxisBase _puf2RotationAxis;
+        private JetAxisBase _lsAAxis;
+        private JetAxisBase _lsBAxis;   
         private LoaderSideDevice _sideADevice;
-        private bool _isExecuteSideAUnlock = false;
         private LoaderSideDevice _sideBDevice;
-        private bool _isExecuteSideBUnlock = false;
+        private int _sideAWaferSize;
+        private int _sideBWaferSize;
         #endregion
 
         public LoaderHomeAllRoutine(string module) : base(module)
@@ -87,8 +81,8 @@ namespace CyberX8_RT.Modules.Loader
             _tiltAAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.TiltA");
             _tiltBAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.TiltB");
 
-            _crsAAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.LSA");
-            _crsBAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.LSB");
+            _lsAAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.LSA");
+            _lsBAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.LSB");
 
             _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.Rotation");
         }
@@ -100,222 +94,128 @@ namespace CyberX8_RT.Modules.Loader
 
         public RState Monitor()
         {
+                
+            Runner.Run(HomeAllStep.CheckPreCondition, CheckPreCondition, _delay_1ms)
                 //Home Tilt Goto VERT
-            Runner.Run(HomeAllStep.CheckSafety,CheckSafety,_delay_1ms)
-                .Run(HomeAllStep.SideADoorUnlock, () => SideDoorUnlock(_sideADevice, ref _isExecuteSideAUnlock), _delay_1ms)
-                .WaitWithStopCondition(HomeAllStep.WaitSideADoorUnlock, () => CheckSideDoorUnlockedEndStatus(_sideADevice, _isExecuteSideAUnlock),
-                () => CheckSideDoorUnlockedStopStatus(_sideADevice, _isExecuteSideAUnlock))
                 .Run(HomeAllStep.TiltAHome, () => { return _tiltAAxis.Home(); },_delay_1ms)
                 .WaitWithStopCondition(HomeAllStep.WaitTiltAHome, () => { return _tiltAAxis.Status == RState.End; }, () => {return _tiltAAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.TiltAGotoVertical, () => { return _tiltAAxis.PositionStation("VERT",true); },100)
-                .WaitWithStopCondition(HomeAllStep.TiltAGotoVerticalCheck, () => { return _tiltAAxis.Status == RState.End; }, () => { return _tiltAAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.SideBDoorUnlock, () => SideDoorUnlock(_sideBDevice, ref _isExecuteSideBUnlock), _delay_1ms)
-                .WaitWithStopCondition(HomeAllStep.WaitSideBDoorUnlock, () => CheckSideDoorUnlockedEndStatus(_sideBDevice, _isExecuteSideBUnlock),
-                () => CheckSideDoorUnlockedStopStatus(_sideADevice, _isExecuteSideBUnlock))
+                .Run(HomeAllStep.TiltAGotoVERT, () => { return _tiltAAxis.PositionStation("VERT",true); },100)
+                .WaitWithStopCondition(HomeAllStep.TiltAGotoVERTCheck, () => { return _tiltAAxis.Status == RState.End; }, () => { return _tiltAAxis.Status == RState.Failed; })
                 .Run(HomeAllStep.TiltBHome, () => { return _tiltBAxis.Home(); }, _delay_1ms)
                 .WaitWithStopCondition(HomeAllStep.WaitTiltBHome, () => { return _tiltBAxis.Status == RState.End; }, () => { return _tiltBAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.TiltBGotoVertical, () => { return _tiltBAxis.PositionStation("VERT",true); }, 100)
-                .WaitWithStopCondition(HomeAllStep.TiltBGotoVerticalCheck, () => { return _tiltBAxis.Status == RState.End; }, () => { return _tiltBAxis.Status == RState.Failed; })
-                //Home Shuttle Goto CLOSED
+                .Run(HomeAllStep.TiltBGotoVERT, () => { return _tiltBAxis.PositionStation("VERT",true); }, 100)
+                .WaitWithStopCondition(HomeAllStep.TiltBGotoVERTCheck, () => { return _tiltBAxis.Status == RState.End; }, () => { return _tiltBAxis.Status == RState.Failed; })
+                //Home Shuttle Goto MID
                 .Run(HomeAllStep.ShuttleAHome, () => { return _shuttleAAxis.Home(); }, _delay_1ms)
                 .WaitWithStopCondition(HomeAllStep.WaitShuttleAHome, () => { return _shuttleAAxis.Status == RState.End; }, () => { return _shuttleAAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.ShuttleAGotoClose, () => { return _shuttleAAxis.PositionStation("CLOSED",true); }, 100)
-                .WaitWithStopCondition(HomeAllStep.ShuttleAGotoCloseCheck, () => { return _shuttleAAxis.Status == RState.End; }, () => { return _shuttleAAxis.Status == RState.Failed; })
+                .Run(HomeAllStep.ShuttleAGotoMID, () => { return _shuttleAAxis.PositionStation("MID",true); }, 100)
+                .WaitWithStopCondition(HomeAllStep.ShuttleAGotoMIDCheck, () => { return _shuttleAAxis.Status == RState.End; }, () => { return _shuttleAAxis.Status == RState.Failed; })
                 .Run(HomeAllStep.ShuttleBHome, () => { return _shuttleBAxis.Home(); }, _delay_1ms)
                 .WaitWithStopCondition(HomeAllStep.WaitShuttleBHome, () => { return _shuttleBAxis.Status == RState.End; }, () => { return _shuttleBAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.ShuttleBGotoClose, () => { return _shuttleBAxis.PositionStation("CLOSED", true); }, 100)
-                .WaitWithStopCondition(HomeAllStep.ShuttleBGotoCloseCheck, () => { return _shuttleBAxis.Status == RState.End; }, () => { return _shuttleBAxis.Status == RState.Failed; })
-                //Door Lock On
-                .Run(HomeAllStep.SideADoorLockOn, () => { return _sideADevice.DoorLockOnAction(); }, 100)
-                .WaitWithStopCondition(HomeAllStep.SideADoorLockOnCheck, () => { return _sideADevice.Status==RState.End; }, () => { return _sideADevice.Status==RState.Failed; })
-                .Run(HomeAllStep.SideBDoorLockOn, () => { return _sideBDevice.DoorLockOnAction(); }, 100)
-                .WaitWithStopCondition(HomeAllStep.SideBDoorLockOnCheck, () => { return _sideBDevice.Status==RState.End; }, () => { return _sideBDevice.Status==RState.Failed; })
+                .Run(HomeAllStep.ShuttleBGotoMID, () => { return _shuttleBAxis.PositionStation("MID", true); }, 100)
+                .WaitWithStopCondition(HomeAllStep.ShuttleBGotoMIDCheck, () => { return _shuttleBAxis.Status == RState.End; }, () => { return _shuttleBAxis.Status == RState.Failed; })                               
+                //Home LS Goto Setup
+                .Run(HomeAllStep.LSAHome, () => { return _lsAAxis.Home(); }, _delay_1ms)
+                .WaitWithStopCondition(HomeAllStep.WaitLSAHome, () => { return _lsAAxis.Status == RState.End; }, () => { return _lsAAxis.Status == RState.Failed; })
+                .Run(HomeAllStep.LSAGotoSetup, () => { return _lsAAxis.PositionStation($"Setup{_sideAWaferSize}", true); }, _delay_1ms)
+                .WaitWithStopCondition(HomeAllStep.LSAGotoSetupCheck, () => { return _lsAAxis.Status == RState.End; }, () => { return _lsAAxis.Status == RState.Failed; })
+                .Run(HomeAllStep.LSBHome, () => { return _lsBAxis.Home(); }, _delay_1ms)
+                .WaitWithStopCondition(HomeAllStep.WaitLSBHome, () => { return _lsBAxis.Status == RState.End; }, () => { return _lsBAxis.Status == RState.Failed; })
+                .Run(HomeAllStep.LSBGotoSetup, () => { return _lsBAxis.PositionStation($"Setup{_sideBWaferSize}",true); }, 100)
+                .WaitWithStopCondition(HomeAllStep.LSBGotoSetupCheck, () => { return _lsBAxis.Status == RState.End; }, () => { return _lsBAxis.Status == RState.Failed; })
                 //Home Rotation Goto TRNPA
-                .Run(HomeAllStep.CheckDupfCondition,CheckDupufCondition,_delay_1ms)
-                .Run(HomeAllStep.RotationHome, () => { return _rotationAxis.Home(); },_delay_1ms)
+                .Run(HomeAllStep.RotationHome, () => { return _rotationAxis.Home(); }, _delay_1ms)
                 .WaitWithStopCondition(HomeAllStep.WaitRotationHome, () => { return _rotationAxis.Status == RState.End; }, () => { return _rotationAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.RotationGotoTrnpa, () => { return _rotationAxis.PositionStation("TRNPA",true); }, 100)
+                .Run(HomeAllStep.RotationGotoTrnpa, () => { return _rotationAxis.PositionStation("TRNPA", true); }, 100)
                 .WaitWithStopCondition(HomeAllStep.RotationGotoTrnpaCheck, () => { return _rotationAxis.Status == RState.End; }, () => { return _rotationAxis.Status == RState.Failed; })
-                //Home CRS
-                .Run(HomeAllStep.CRSAHome, () => { return _crsAAxis.Home(); }, _delay_1ms)
-                .WaitWithStopCondition(HomeAllStep.WaitCRSAHome, () => { return _crsAAxis.Status == RState.End; }, () => { return _crsAAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.CRSAGotoSetUp, () => { return _crsAAxis.PositionStation("Setup", true); }, _delay_1ms)
-                .WaitWithStopCondition(HomeAllStep.CRSAGotoSetUpCheck, () => { return _crsAAxis.Status == RState.End; }, () => { return _crsAAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.CRSBHome, () => { return _crsBAxis.Home(); }, _delay_1ms)
-                .WaitWithStopCondition(HomeAllStep.WaitCRSBHome, () => { return _crsBAxis.Status == RState.End; }, () => { return _crsBAxis.Status == RState.Failed; })
-                .Run(HomeAllStep.CRSBGotoSetUp, () => { return _crsBAxis.PositionStation("Setup",true); }, 100)
-                .WaitWithStopCondition(HomeAllStep.CRSBGotoSetUpCheck, () => { return _crsBAxis.Status == RState.End; }, () => { return _crsBAxis.Status == RState.Failed; })
                 .End(HomeAllStep.End,NullFun);
 
             return Runner.Status; 
-        }
-        /// <summary>
-        /// 检验Safety
-        /// </summary>
-        /// <returns></returns>
-        private bool CheckSafety()
-        {
-            SafetyDevice safetyDevice = DEVICE.GetDevice<SafetyDevice>("Safety");
-            if (safetyDevice == null)
-            {
-                LOG.WriteLog(eEvent.ERR_LOADER, Module.ToString(), "Safety device is null");
-                return false;
-            }
-            if (safetyDevice.SafetyData.TwincatState != 8)
-            {
-                LOG.WriteLog(eEvent.ERR_LOADER, Module.ToString(), "Twincat Status is not OP status");
-                return false;
-            }
-            if (safetyDevice.SafetyData.LoaderPufCommErr)
-            {
-                LOG.WriteLog(eEvent.ERR_LOADER, Module.ToString(), "Twincat Loader Communication status is error");
-                return false;
-            }
-            if (safetyDevice.SafetyData.LoaderPufFunctionBlockErr)
-            {
-                LOG.WriteLog(eEvent.ERR_LOADER, Module.ToString(), "Twincat Loader function block status is error");
-                return false;
-            }
-            return true;
-        }
-        /// <summary>
-        /// Side Door Unlock
-        /// </summary>
-        /// <returns></returns>
-        private bool SideDoorUnlock(LoaderSideDevice sideDevice,ref bool execute)
-        {
-            if (sideDevice.SideData.DoorLowerLocked || sideDevice.SideData.DoorUpperLocked)
-            {
-                execute = true;
-                return sideDevice.DoorLockOffAction();
-            }
-            else
-            {
-                return true;
-            }
-        }
-        /// <summary>
-        /// 校验Side Unlocked
-        /// </summary>
-        /// <param name="sideDevice"></param>
-        /// <param name="execute"></param>
-        /// <returns></returns>
-        private bool CheckSideDoorUnlockedEndStatus(LoaderSideDevice sideDevice,bool execute)
+        }        
+                
+        public RState Start(params object[] objs)
         {
-            if(execute)
+            _sideADevice = DEVICE.GetDevice<LoaderSideDevice>($"{Module}.SideA");
+            _sideBDevice = DEVICE.GetDevice<LoaderSideDevice>($"{Module}.SideB");
+            if (SC.ContainsItem($"Loader1.SideAWaferSize"))
             {
-                return sideDevice.Status == RState.End;
+                _sideAWaferSize = SC.GetValue<int>($"Loader1.SideAWaferSize");
             }
-            else
+            if (SC.ContainsItem($"Loader1.SideBWaferSize"))
             {
-                return true;
+                _sideBWaferSize = SC.GetValue<int>($"Loader1.SideBWaferSize");
             }
+            Runner.Start(Module, "Home All");
+            return RState.Running;
         }
         /// <summary>
-        /// 校验Side Unlocked
+        /// 检验前置条件
         /// </summary>
-        /// <param name="sideDevice"></param>
-        /// <param name="execute"></param>
         /// <returns></returns>
-        private bool CheckSideDoorUnlockedStopStatus(LoaderSideDevice sideDevice, bool execute)
+        private bool CheckPreCondition()
         {
-            if (execute)
+            if (!CheckHomeCondition())
             {
-                return sideDevice.Status == RState.Failed;
+                return false;
             }
-            else
+            if (!CheckAxisCondition())
             {
-                return true;
+                return false;
             }
+            return true;
         }
         /// <summary>
-        /// 检验puf条件
+        /// 检验Home条件
         /// </summary>
         /// <returns></returns>
-        private bool CheckDupufCondition()
+        private bool CheckHomeCondition()
         {
-            if (ModuleHelper.IsInstalled(ModuleName.PUF1))
+            //检验PUF、Loader Transporter,Robot均Homed
+            //Efem Home
+            if (ModuleHelper.IsInstalled(ModuleName.EFEM))
             {
-                if (!_puf1VerticalAxis.IsHomed)
-                { 
-                    LOG.WriteLog(eEvent.ERR_LOADER, Module.ToString(), "Puf1 Vertical is not homed");
-                    return false;
-                }
-                JetAxisBase puf1VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Vertical");
-                double puf1VerticalPosition = puf1VerticalAxis.MotionData.MotorPosition;
-                if (!puf1VerticalAxis.CheckPositionIsInStation(puf1VerticalPosition, "Park"))
+                EfemEntity efemEntity = Singleton<RouteManager>.Instance.GetModule<EfemEntity>(ModuleName.EFEM.ToString());
+                if (!efemEntity.IsHomed)
                 {
-                    LOG.Write(eEvent.ERR_LOADER, Module, $"PUF1 Vertical {puf1VerticalPosition} is not in Park station,Cannot execute GotoSavedPosition");
+                    LOG.WriteLog(eEvent.ERR_EFEM_ROBOT, Module, $"{ModuleName.EFEM.ToString()} is not home, Cannot execute GotoSavedPosition");
                     return false;
                 }
             }
-            if (ModuleHelper.IsInstalled(ModuleName.PUF2))
+            if (ModuleHelper.IsInstalled(ModuleName.PUF1))
             {
-                if (!_puf2VerticalAxis.IsHomed)
+                PUFEntity puf1Entity = Singleton<RouteManager>.Instance.GetModule<PUFEntity>(ModuleName.PUF1.ToString());
+                if (!puf1Entity.IsHomed)
                 {
-                    LOG.WriteLog(eEvent.ERR_LOADER, Module.ToString(), "Puf2 Vertical is not homed");
+                    NotifyError(eEvent.ERR_LOADER, "PUF1 is not homed", -1);
                     return false;
                 }
-
-                JetAxisBase puf2VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF2}.Vertical");
-                double puf2VerticalPosition = puf2VerticalAxis.MotionData.MotorPosition;
-                if (!puf2VerticalAxis.CheckPositionIsInStation(puf2VerticalPosition, "Park") && 
-                    !puf2VerticalAxis.CheckPositionIsInStation(puf2VerticalPosition, "Robot"))
-                {
-                    LOG.Write(eEvent.ERR_LOADER, Module, $"PUF2 Vertical {puf2VerticalPosition} is not in Park and Robot station,Cannot execute GotoSavedPosition");
-                    return false;
-                }
-
-                if (!_puf2RotationAxis.IsHomed)
-                {
-                    LOG.WriteLog(eEvent.ERR_LOADER, Module.ToString(), "Puf2 Rotation is not homed");
-                    return false;
-                }
-
-                JetAxisBase puf2RotationAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF2}.Rotation");
-                double puf2RotationPosition = puf2RotationAxis.MotionData.MotorPosition;
-                if (!puf2RotationAxis.CheckPositionIsInStation(puf2RotationPosition, "Park") && 
-                    !puf2RotationAxis.CheckPositionIsInStation(puf2RotationPosition, "Robot"))
+            }
+            if (ModuleHelper.IsInstalled(ModuleName.Transporter2))
+            {
+                TransporterEntity loaderTransportEntity = Singleton<RouteManager>.Instance.GetModule<TransporterEntity>(ModuleName.Transporter2.ToString());
+                if (!loaderTransportEntity.IsHomed)
                 {
-                    LOG.Write(eEvent.ERR_LOADER, Module, $"PUF2 Rotation {puf2RotationPosition} is not in Park and Robot station,Cannot execute GotoSavedPosition");
+                    NotifyError(eEvent.ERR_LOADER, "Loader Transporter is not homed", -1);
                     return false;
                 }
             }
             return true;
         }
-        public RState Start(params object[] objs)
-        {
-            _sideADevice = DEVICE.GetDevice<LoaderSideDevice>($"{Module}.SideA");
-            _sideBDevice = DEVICE.GetDevice<LoaderSideDevice>($"{Module}.SideB");
-            _puf1VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Vertical");
-            _puf2VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF2}.Vertical");
-            _puf2RotationAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF2}.Rotation");
-            _isExecuteSideAUnlock = false;
-            _isExecuteSideBUnlock = false;
-            if(!CheckPreCondition())
-            {
-                return RState.Failed;
-            }
-            Runner.Start(Module, "Home All");
-            return RState.Running;
-        }
         /// <summary>
-        /// 检验前置条件
+        /// 检验Axis条件
         /// </summary>
+        /// <param name="side"></param>
         /// <returns></returns>
-        private bool CheckPreCondition()
+        private bool CheckAxisCondition()
         {
-            //if(_sideADevice.SideData.WaferPresent)
-            //{
-            //    LOG.WriteLog(eEvent.ERR_AXIS, Module.ToString(), "Side A wafer present,cannot home");
-            //    return false;
-            //}
-            //if (_sideBDevice.SideData.WaferPresent)
-            //{
-            //    LOG.WriteLog(eEvent.ERR_AXIS, Module.ToString(), "Side B wafer present,cannot home");
-            //    return false;
-            //}
+            //Check all motor switch on
+            if (!AxisManager.Instance.CheckModuleAxisSwitchOn(Module, ""))
+            {
+                return false;
+            }
+
             return true;
         }
+
     }
 }

+ 8 - 8
CyberX8_RT/Modules/Loader/LoaderSwitchAllOnRoutine.cs

@@ -20,8 +20,8 @@ namespace CyberX8_RT.Modules.Loader
             ShuttleBSwitchOn,
             TiltASwitchOn,
             TiltBSwitchOn,
-            CRSASwitchOn,
-            CRSBSwitchOn,
+            LSASwitchOn,
+            LSBSwitchOn,
             RotationSwitchOn,
             End
         }
@@ -31,8 +31,8 @@ namespace CyberX8_RT.Modules.Loader
         private JetAxisBase _tiltAAxis;
         private JetAxisBase _tiltBAxis;
         private JetAxisBase _rotationAxis;
-        private JetAxisBase _crsAAxis;
-        private JetAxisBase _crsBAxis;
+        private JetAxisBase _lsAAxis;
+        private JetAxisBase _lsBAxis;
         private int _timeOut = 6000;
         #endregion
         public LoaderSwitchAllOnRoutine(string module) : base(module)
@@ -43,8 +43,8 @@ namespace CyberX8_RT.Modules.Loader
             _tiltAAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.TiltA");
             _tiltBAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.TiltB");
 
-            _crsAAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.LSA");
-            _crsBAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.LSB");
+            _lsAAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.LSA");
+            _lsBAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.LSB");
 
             _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.Rotation");
         }
@@ -60,8 +60,8 @@ namespace CyberX8_RT.Modules.Loader
                 .Run(SwitchOnAllStep.ShuttleBSwitchOn, () => { _shuttleBAxis.SwitchOn(); return true; }, () => { return _shuttleBAxis.IsSwitchOn; }, _timeOut)
                 .Run(SwitchOnAllStep.TiltASwitchOn, () => { _tiltAAxis.SwitchOn();return true; }, () => { return _tiltAAxis.IsSwitchOn; }, _timeOut)
                 .Run(SwitchOnAllStep.TiltBSwitchOn, () => { _tiltBAxis.SwitchOn(); return true; }, () => { return _tiltBAxis.IsSwitchOn; }, _timeOut)
-                .Run(SwitchOnAllStep.CRSASwitchOn, () => { _crsAAxis.SwitchOn(); return true; }, () => { return _crsAAxis.IsSwitchOn; }, _timeOut)
-                .Run(SwitchOnAllStep.CRSBSwitchOn, () => { _crsBAxis.SwitchOn(); return true; }, () => { return _crsBAxis.IsSwitchOn; }, _timeOut)
+                .Run(SwitchOnAllStep.LSASwitchOn, () => { _lsAAxis.SwitchOn(); return true; }, () => { return _lsAAxis.IsSwitchOn; }, _timeOut)
+                .Run(SwitchOnAllStep.LSBSwitchOn, () => { _lsBAxis.SwitchOn(); return true; }, () => { return _lsBAxis.IsSwitchOn; }, _timeOut)
                 .Run(SwitchOnAllStep.RotationSwitchOn, () => { _rotationAxis.SwitchOn(); return true; }, () => { return _rotationAxis.IsSwitchOn; }, _timeOut)
                 .End(SwitchOnAllStep.End,NullFun);
 

+ 1 - 2
CyberX8_Simulator/Config/UILayout.xml

@@ -49,7 +49,6 @@
 	</Navigation>
 
 	<Navigation Id="Festo" Name="Festo">
-		<SubView Id="Festo0" Name="Festo0" ViewClass="CyberX8_Simulator.Views.FestoView" Assembly="CyberX8_Simulator" Port="502"/>
-		<SubView Id="Festo1" Name="Festo1" ViewClass="CyberX8_Simulator.Views.FestoView" Assembly="CyberX8_Simulator" Port="503"/>
+		<SubView Id="Festo3" Name="Festo3" ViewClass="CyberX8_Simulator.Views.FestoView" Assembly="CyberX8_Simulator" Port="502"/>
 	</Navigation>
 </MECFUI>

+ 7 - 2
CyberX8_Simulator/Devices/FestoSocketSimulator.cs

@@ -17,9 +17,13 @@ namespace CyberX8_Simulator.Devices
         private const int FESTO_REGISTER_COUNT = 100;
         private IByteTransform byteTransform = new BigEndianByteTransformBase();
         /// <summary>
-        /// 数据(DO_address - data)
+        /// 数据(index - data)
         /// </summary>
         private short[] _festoOutputDataDic = new short[FESTO_REGISTER_COUNT];
+        /// <summary>
+        /// 数据(DOName - index)
+        /// </summary>
+        private Dictionary<string, int> _festoNameIndexDic = new Dictionary<string, int>();
 
         /// <summary>
         /// 构造函数
@@ -31,6 +35,7 @@ namespace CyberX8_Simulator.Devices
             {
                 _festoOutputDataDic[i] = 0x00;
             }
+
         }
         /// <summary>
         /// 解析信息
@@ -51,7 +56,7 @@ namespace CyberX8_Simulator.Devices
                 {
                     for (int i = 0; i < registerCount; i++)
                     {
-                        Array.Copy(byteTransform.GetBytes(_festoOutputDataDic[i]), 0, bytes, i * 2, 2);
+                        Array.Copy(byteTransform.GetBytes(_festoOutputDataDic[startAddress - FESTO_DI_START_ADDRESS + i]), 0, bytes, i * 2, 2);
                     }
                     OnWriteMessage(CreateReadResponse(flag, channel, command, registerCount, bytes));
                 }

+ 8 - 1
CyberX8_Simulator/Views/FestoView.xaml.cs

@@ -3,6 +3,7 @@ using CyberX8_Simulator.Devices;
 using MECF.Framework.Simulator.Core.Commons;
 using System.Windows;
 using System.Windows.Controls;
+using System.Windows.Input;
 
 namespace CyberX8_Simulator.Views
 {
@@ -28,13 +29,19 @@ namespace CyberX8_Simulator.Views
             get { return "Festo Simulator"; }
         }
 
-
+        public ICommand SetDOCommand { get; set; }
         private FestoSocketSimulator _sim;
         public FestoViewModel(string str) : base("FestoViewModel")
         {
             int.TryParse(str, out int port);
             _sim = new FestoSocketSimulator(port);
             Init(_sim);
+            SetDOCommand = new DelegateCommand<object>(SetDOAction);
+        }
+
+        private void SetDOAction(object obj)
+        {
+            //_sim.UpdataDOBytes(DOSelectedItem, DOInputValue);
         }
     }
 }