Browse Source

add rinse run recipe

chenzk 3 weeks ago
parent
commit
3705df9310

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

@@ -341,7 +341,7 @@
 	</Module>
 	<Module Name="Rinse1">
 	<IO Name="Rinse1.WaterLevel" IOName="r_QDRD1_WATER_LEVEL"/>
-	<IO Name="Rinse1.WaferHolderClamp" IOName="c_QDRD1_WS_CLAMP"/>
+	<IO Name="Rinse1.WaferHolderClamp" IOName="c_QDRD1_WH_CLAMP"/>
 	<IO Name="Rinse1.N2Valve" IOName="c_QDRD1_LO_PRESSURE"/>
 	<IO Name="Rinse1.FillValve" IOName="c_QDRD1_DI_FILL"/>
 	<IO Name="Rinse1.DrainValve" IOName="c_QDRD1_DUMP"/>
@@ -349,7 +349,7 @@
 	</Module>  
 	<Module Name="Rinse2">
 	<IO Name="Rinse2.WaterLevel" IOName="r_QDRD2_WATER_LEVEL"/>
-	<IO Name="Rinse2.WaferHolderClamp" IOName="c_QDRD2_WS_CLAMP"/>
+	<IO Name="Rinse2.WaferHolderClamp" IOName="c_QDRD2_WH_CLAMP"/>
 	<IO Name="Rinse2.N2Valve" IOName="c_QDRD2_LO_PRESSURE"/>
 	<IO Name="Rinse2.FillValve" IOName="c_QDRD2_DI_FILL"/>
 	<IO Name="Rinse2.DrainValve" IOName="c_QDRD2_DUMP"/>
@@ -358,7 +358,7 @@
   
 	<Module Name="Rinse3">
 	<IO Name="Rinse3.WaterLevel" IOName="r_QDRD3_WATER_LEVEL"/>
-	<IO Name="Rinse3.WaferHolderClamp" IOName="c_QDRD3_WS_CLAMP"/>
+	<IO Name="Rinse3.WaferHolderClamp" IOName="c_QDRD3_WH_CLAMP"/>
 	<IO Name="Rinse3.N2Valve" IOName="c_QDRD3_LO_PRESSURE"/>
 	<IO Name="Rinse3.FillValve" IOName="c_QDRD3_DI_FILL"/>
 	<IO Name="Rinse3.DrainValve" IOName="c_QDRD3_DUMP"/>
@@ -367,7 +367,7 @@
   
 	<Module Name="Rinse4">
 	<IO Name="Rinse4.WaterLevel" IOName="r_QDRD4_WATER_LEVEL"/>
-	<IO Name="Rinse4.WaferHolderClamp" IOName="c_QDRD4_WS_CLAMP"/>
+	<IO Name="Rinse4.WaferHolderClamp" IOName="c_QDRD4_WH_CLAMP"/>
 	<IO Name="Rinse4.N2Valve" IOName="c_QDRD4_LO_PRESSURE"/>
 	<IO Name="Rinse4.FillValve" IOName="c_QDRD4_DI_FILL"/>
 	<IO Name="Rinse4.DrainValve" IOName="c_QDRD4_DUMP"/>
@@ -376,7 +376,7 @@
   
 	<Module Name="Rinse5">
 	<IO Name="Rinse5.WaterLevel" IOName="r_QDRD5_WATER_LEVEL"/>
-	<IO Name="Rinse5.WaferHolderClamp" IOName="c_QDRD5_WS_CLAMP"/>
+	<IO Name="Rinse5.WaferHolderClamp" IOName="c_QDRD5_WH_CLAMP"/>
 	<IO Name="Rinse5.N2Valve" IOName="c_QDRD5_LO_PRESSURE"/>
 	<IO Name="Rinse5.FillValve" IOName="c_QDRD5_DI_FILL"/>
 	<IO Name="Rinse5.DrainValve" IOName="c_QDRD5_DUMP"/>
@@ -385,7 +385,7 @@
   
 	<Module Name="Rinse6">
 	<IO Name="Rinse6.WaterLevel" IOName="r_QDRD6_WATER_LEVEL"/>
-	<IO Name="Rinse6.WaferHolderClamp" IOName="c_QDRD6_WS_CLAMP"/>
+	<IO Name="Rinse6.WaferHolderClamp" IOName="c_QDRD6_WH_CLAMP"/>
 	<IO Name="Rinse6.N2Valve" IOName="c_QDRD6_LO_PRESSURE"/>
 	<IO Name="Rinse6.FillValve" IOName="c_QDRD6_DI_FILL"/>
 	<IO Name="Rinse6.DrainValve" IOName="c_QDRD6_DUMP"/>

+ 9 - 1
CyberX8_RT/Devices/EFEM/SunWayRobot.cs

@@ -592,7 +592,15 @@ namespace CyberX8_RT.Devices.EFEM
             };
             _status = RState.Running;
             string strVacuum = VacuumState ? "ON" : "OFF";
-            string cmd = $"VAC {strVacuum} ARM {_armString[Hand.Blade1]}\r";
+            string cmd = "";
+            if (ModuleName.Aligner1 == mod)
+            {
+                 cmd = $"ALIGN VAC {strVacuum}\r";
+            }
+            else
+            {
+                 cmd = $"VAC {strVacuum} ARM {_armString[Hand.Blade1]}\r";
+            }
             return WriteCommand(cmd);
         }
 

+ 1 - 23
CyberX8_RT/Modules/Rinse/RinseEntity.cs

@@ -411,34 +411,13 @@ namespace CyberX8_RT.Modules.Rinse
             }
             _rinseDevice.UpdateStateMachine("Idle");
             _rinseDevice.UpdateStatus("Idle");
-            if (!CheckSafety())
-            {
-                return false;
-            }
             if (!_rinseDevice.IOInitialized)
             {
                 return false;
             }
             return _rinseDevice.IOInitialized;
         }
-        /// <summary>
-        /// 检验Safety
-        /// </summary>
-        /// <returns></returns>
-        private bool CheckSafety()
-        {
-            SafetyDevice safetyDevice = DEVICE.GetDevice<SafetyDevice>("Safety");
-            if (safetyDevice != null)
-            {
-                bool result= safetyDevice.SafetyData.TwincatState == 8;
-                if (!result)
-                {
-                    LOG.WriteLog(eEvent.ERR_RINSE, Module.ToString(), "Twincat Status is not OP status");
-                    return false;
-                }
-            }
-            return true;
-        }
+
 
         #endregion
 
@@ -523,7 +502,6 @@ namespace CyberX8_RT.Modules.Rinse
                 processTimeDic.Add("RinseSecondStep.Recipe_SecondRinseCycleWaitDrainExtraTime", _recipe.DumpTimeSeconds * _recipe.Step2NumberOfRinse);
 
                 processTimeDic.Add("RinseThirdStep.Recipe_ThirdRinseWaitEndFillTime", _concurrentFillTimeSeconds);
-                processTimeDic.Add("RinseThirdStep.Recipe_ThirdRinseWaitClampTime", _recipe.FinalRinsePulseClampTime);
                 processTimeDic.Add("RinseThirdStep.Recipe_ThirdRinseCycleWaitSlowDrainTime", _recipe.FinalRinseSlowDrainTime);
                 processTimeDic.Add("RinseThirdStep.Recipe_ThirdRinseCycleWaitDrainExtraTime", _recipe.DumpTimeSeconds);
             }

+ 42 - 41
CyberX8_RT/Modules/Rinse/RinseFirstStepRoutine.cs

@@ -120,12 +120,12 @@ namespace CyberX8_RT.Modules.Rinse
             //配置项规范性验证
             if (_checkIsFillingTimeSeconds + _checkIsFullTimeSeconds > _concurrentFillTimeSeconds)
             {
-                NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalCheckFillWaterTimeSeconds' plus 'QDR.NominalCheckFillFullTimeSeconds' is large than QDR.ConcurrentFillTimeSeconds",-1);
+                NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalCheckFillWaterTimeSeconds' plus 'QDR.NominalCheckFillFullTimeSeconds' is large than QDR.ConcurrentFillTimeSeconds", -1);
                 return RState.Failed;
             }
             if (_normalDrainTimeSeconds > _recipe.DumpTimeSeconds)
             {
-                NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalDrainTimeSeconds' is large than 'recipe.DumpTimeSeconds",-1);
+                NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalDrainTimeSeconds' is large than 'recipe.DumpTimeSeconds", -1);
                 return RState.Failed;
             }
             return Runner.Start(Module, "Start Rinse First Step");
@@ -135,7 +135,7 @@ namespace CyberX8_RT.Modules.Rinse
         /// Abort
         /// </summary>
         public void Abort()
-        {           
+        {
             Runner.Stop("Manual abort");
         }
         /// <summary>
@@ -146,35 +146,35 @@ namespace CyberX8_RT.Modules.Rinse
         {
             _currentStateMachine = Runner.CurrentStep.ToString();
             _device.UpdateStateMachine(_currentStateMachine);
-                //1.2-Start
-            Runner.Run(RinseFirstStep.StartPrepare,StartPrepareAction, _delay_1ms)
-                //1.3-WatiDrained
-               .Run(RinseFirstStep.FirstDrain,OpenDrainValveandCheckMetalValve, _delay_1ms)
-               .RunDelay(RinseFirstStep.CheckDrain, CheckWaterLevelEmpty, _normalDrainTimeSeconds*1000)
-                //1.4-ExtraDrainDeylay
-               .RunIf(RinseFirstStep.WaitDrianEmpty, _recipe.DumpTimeSeconds - _normalDrainTimeSeconds > 0, NullFun ,(_recipe.DumpTimeSeconds - _normalDrainTimeSeconds) * 1000)
-                //1.5-N2PreCharge
-               .RunIf(RinseFirstStep.N2BubbleOn, _recipe.Step1N2BubbleOn, N2ValveOn, _delay_1ms) 
-               .RunIf(RinseFirstStep.N2BubbleOnDelay, _recipe.Step1N2BubbleOn, NullFun, _recipe.N2ChargeTimeSeconds*1000)
-                //1.6-StartFirstRinseCylce
+            //1.2-Start
+            Runner.Run(RinseFirstStep.StartPrepare, StartPrepareAction, _delay_1ms)
+               //1.3-WatiDrained
+               .Run(RinseFirstStep.FirstDrain, OpenDrainValveandCheckMetalValve, _delay_1ms)
+               .RunDelay(RinseFirstStep.CheckDrain, CheckWaterLevelEmpty, _normalDrainTimeSeconds * 1000)
+               //1.4-ExtraDrainDeylay
+               .RunIf(RinseFirstStep.WaitDrianEmpty, _recipe.DumpTimeSeconds - _normalDrainTimeSeconds > 0, NullFun, (_recipe.DumpTimeSeconds - _normalDrainTimeSeconds) * 1000)
+               //1.5-N2PreCharge
+               .RunIf(RinseFirstStep.N2BubbleOn, _recipe.Step1N2BubbleOn, N2ValveOn, _delay_1ms)
+               .RunIf(RinseFirstStep.N2BubbleOnDelay, _recipe.Step1N2BubbleOn, NullFun, _recipe.N2ChargeTimeSeconds * 1000)
+               //1.6-StartFirstRinseCylce
                .LoopStart(RinseFirstStep.Recipe_StartFirstRinseCycle, "Rinse first step", _recipe.Step1NumberOfRinse, PrepareStart, _delay_1ms)
                //1.7-PerformFirstRinseCycle
-               .LoopRun(RinseFirstStep.Recipe_PerformFirstRinseCycle,OpenN2ValveAndCloseDumpValve,_delay_1ms)
-                //1.8-FirstRinseCycleStartFilling
+               .LoopRun(RinseFirstStep.Recipe_PerformFirstRinseCycle, OpenN2ValveAndCloseDumpValve, _delay_1ms)
+               //1.8-FirstRinseCycleStartFilling
                .LoopRun(RinseFirstStep.Recipe_FirstRinseCycleStartFilling, () => _device.FillValveOn(), _delay_1ms)
-               .LoopRun(RinseFirstStep.Recipe_FirstRinseCycleRecordStartWaterLevel,  CheckFillValveOn, _delay_1ms)
+               .LoopRun(RinseFirstStep.Recipe_FirstRinseCycleRecordStartWaterLevel, CheckFillValveOn, _delay_1ms)
                .LoopRunOnlyTimeOutFault(RinseFirstStep.Recipe_FirstRinseCycleStartFillingWait, CheckFillNormalStatus, _checkIsFillingTimeSeconds * 1000)
-                //1.9-FirstRinseCycleWaitFillingDetected  and 2.0-FirstRinseCycleWaitFull
+               //1.9-FirstRinseCycleWaitFillingDetected  and 2.0-FirstRinseCycleWaitFull
                .LoopRunOnlyTimeOutFault(RinseFirstStep.Recipe_FirstRinseCycleWaitFillingDetected, CheckFillFullStatus, _checkIsFullTimeSeconds * 1000)
-                //2.1-FirstRinseCycleWaitEndFillTime
-               .LoopDelay(RinseFirstStep.Recipe_FirstRinseCycleWaitEndFillTime, (_concurrentFillTimeSeconds - _checkIsFillingTimeSeconds- _checkIsFullTimeSeconds) * 1000)
-                //2.2-FirstRinseCycleWaitDwell
+               //2.1-FirstRinseCycleWaitEndFillTime
+               .LoopDelay(RinseFirstStep.Recipe_FirstRinseCycleWaitEndFillTime, (_concurrentFillTimeSeconds - _checkIsFillingTimeSeconds - _checkIsFullTimeSeconds) * 1000)
+               //2.2-FirstRinseCycleWaitDwell
                .LoopRunDelay(RinseFirstStep.Recipe_FirstRinseCycleWaitDwell, StartDwell, _recipe.Step1DwellTimeSeconds * 1000)
-                //2.3-FirstRinseCycleWaitDrain 
-               .LoopRun(RinseFirstStep.Recipe_FirstRinseCycleWaitDrain, StartOpenDumpValve,_delay_1ms)
-               .LoopRunOnlyTimeOutFault(RinseFirstStep.Recipe_FirstRinseCycleCheckDrain,CheckWaterLevelEmpty, _normalDrainTimeSeconds * 1000)
-                //2.4-FirstRinseCycleWaitDrainExtraTime
-               .LoopRunIf(RinseFirstStep.Recipe_FirstRinseCycleWaitDrainExtraTime, _recipe.DumpTimeSeconds - _normalDrainTimeSeconds > 0,NullFun, (_recipe.DumpTimeSeconds - _normalDrainTimeSeconds) * 1000 )
+               //2.3-FirstRinseCycleWaitDrain 
+               .LoopRun(RinseFirstStep.Recipe_FirstRinseCycleWaitDrain, StartOpenDumpValve, _delay_1ms)
+               .LoopRunOnlyTimeOutFault(RinseFirstStep.Recipe_FirstRinseCycleCheckDrain, CheckWaterLevelEmpty, _normalDrainTimeSeconds * 1000)
+               //2.4-FirstRinseCycleWaitDrainExtraTime
+               .LoopRunIf(RinseFirstStep.Recipe_FirstRinseCycleWaitDrainExtraTime, _recipe.DumpTimeSeconds - _normalDrainTimeSeconds > 0, NullFun, (_recipe.DumpTimeSeconds - _normalDrainTimeSeconds) * 1000)
                .LoopEnd(RinseFirstStep.Recipe_FirstRinseCycleEnd, NullFun, _delay_1ms)
                .End(RinseFirstStep.Recipe_FirstRinseCycleComplete, NullFun, _delay_1ms);
             return Runner.Status;
@@ -189,7 +189,7 @@ namespace CyberX8_RT.Modules.Rinse
             bool result = _device.FillValveOff();
             if (!result)
             {
-                NotifyError(eEvent.ERR_RINSE, "Close Fill Valve error",0);
+                NotifyError(eEvent.ERR_RINSE, "Close Fill Valve error", 0);
                 return false;
             }
             result = _device.WaferHolderClampValveOn();
@@ -209,7 +209,7 @@ namespace CyberX8_RT.Modules.Rinse
             bool result = _device.DrainValveOn();
             if (!result)
             {
-                NotifyError(eEvent.ERR_RINSE, "Open Drain Valve error",0);
+                NotifyError(eEvent.ERR_RINSE, "Open Drain Valve error", 0);
                 return false;
             }
             if (_recipe.Step1NumberOfDumpToMetalDrain > 0)
@@ -258,17 +258,17 @@ namespace CyberX8_RT.Modules.Rinse
         private bool OpenN2ValveAndCloseDumpValve()
         {
             bool result = true;
-            if(_recipe.Step1N2BubbleOn)
+            if (_recipe.Step1N2BubbleOn)
             {
                 result = _device.N2ValveOn();
-                if(!result)
+                if (!result)
                 {
-                    NotifyError(eEvent.ERR_RINSE, "Open N2 Valve error",0);
+                    NotifyError(eEvent.ERR_RINSE, "Open N2 Valve error", 0);
                     return false;
                 }
             }
             result = _device.DrainValveOff();
-            if(!result)
+            if (!result)
             {
                 NotifyError(eEvent.ERR_RINSE, "Close Dump Valve error", 0);
             }
@@ -283,6 +283,7 @@ namespace CyberX8_RT.Modules.Rinse
         {
             _startFillTime = DateTime.Now;
             _fillingDetectStartWaterLevel = _device.RinseData.WaterLevel;
+            LOG.WriteLog(eEvent.INFO_RINSE, Module, $"Start Fill Valve WaterLevel {_fillingDetectStartWaterLevel}");
             return true;
         }
         /// <summary>
@@ -292,7 +293,7 @@ namespace CyberX8_RT.Modules.Rinse
         private bool CheckFillNormalStatus()
         {
             double currentWaterLevel = _device.RinseData.WaterLevel;
-            bool result =(currentWaterLevel-_fillingDetectStartWaterLevel)>_fillingStartedDelta;
+            bool result = (currentWaterLevel - _fillingDetectStartWaterLevel) > _fillingStartedDelta;
             return result;
         }
         /// <summary>
@@ -302,7 +303,7 @@ namespace CyberX8_RT.Modules.Rinse
         private bool CheckFillFullStatus()
         {
             double currentWaterLevel = _device.RinseData.WaterLevel;
-            bool result= currentWaterLevel > _sensorReadingFull;
+            bool result = currentWaterLevel > _sensorReadingFull;
             return result;
         }
         /// <summary>
@@ -312,15 +313,15 @@ namespace CyberX8_RT.Modules.Rinse
         private bool StartDwell()
         {
             bool result = _device.FillValveOff();
-            if(!result)
+            if (!result)
             {
-                NotifyError(eEvent.ERR_RINSE, "Fill Valve off error",0);
+                NotifyError(eEvent.ERR_RINSE, "Fill Valve off error", 0);
                 return false;
             }
-            if(_recipe.Step1N2BubbleOn)
+            if (_recipe.Step1N2BubbleOn)
             {
                 result = _device.N2ValveOff();
-                if(!result)
+                if (!result)
                 {
                     NotifyError(eEvent.ERR_RINSE, "N2 Valve off error", 0);
                     return false;
@@ -336,9 +337,9 @@ namespace CyberX8_RT.Modules.Rinse
         {
             CheckNeedCloseMetalDrain();
             bool result = _device.DrainValveOn();
-            if(!result)
+            if (!result)
             {
-                NotifyError(eEvent.ERR_RINSE, "Open Dump valve error",0);
+                NotifyError(eEvent.ERR_RINSE, "Open Dump valve error", 0);
                 return false;
             }
             return result;
@@ -363,7 +364,7 @@ namespace CyberX8_RT.Modules.Rinse
         /// <returns></returns>
         private void CheckNeedCloseMetalDrain()
         {
-            if (Runner.LoopCounter + 1>_recipe.Step1NumberOfDumpToMetalDrain)
+            if (Runner.LoopCounter + 1 > _recipe.Step1NumberOfDumpToMetalDrain)
             {
                 bool result = _device.WasteValveOn();
                 if (!result)

+ 42 - 39
CyberX8_RT/Modules/Rinse/RinseSecondStepRoutine.cs

@@ -20,7 +20,7 @@ using System.Windows.Documents;
 
 namespace CyberX8_RT.Modules.Rinse
 {
-    public class RinseSecondStepRoutine:RoutineBase,IRoutine
+    public class RinseSecondStepRoutine : RoutineBase, IRoutine
     {
         private enum RinseSecondStep
         {
@@ -128,7 +128,7 @@ namespace CyberX8_RT.Modules.Rinse
         /// <param name="module"></param>
         public RinseSecondStepRoutine(string module) : base(module)
         {
-            
+
         }
         /// <summary>
         /// 启动
@@ -142,6 +142,8 @@ namespace CyberX8_RT.Modules.Rinse
             _resistivitySample.Clear();
             _readResistivityCount = 0;
             _recipe = objects[0] as QdrRecipe;
+            _fillingDetectStartWaterLevel = 0;
+            _rinseCycleTwo_RinsesCompleted = 0;
             _concurrentFillTimeSeconds = SC.GetValue<int>("QDR.ConcurrentFillTimeSeconds");
             _fillingStartedDelta = SC.GetValue<double>("QDR.FillingStartedDelta");
             _sensorReadingFull = SC.GetValue<int>("QDR.SensorReadingFull");
@@ -152,12 +154,12 @@ namespace CyberX8_RT.Modules.Rinse
             //配置项规范性验证
             if (_checkIsFillingTimeSeconds + _checkIsFullTimeSeconds > _concurrentFillTimeSeconds)
             {
-               NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalCheckFillWaterTimeSeconds' plus 'QDR.NominalCheckFillFullTimeSeconds' is large than QDR.ConcurrentFillTimeSeconds", 0);
+                NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalCheckFillWaterTimeSeconds' plus 'QDR.NominalCheckFillFullTimeSeconds' is large than QDR.ConcurrentFillTimeSeconds", 0);
                 return RState.Failed;
             }
             if (_normalDrainTimeSeconds > _recipe.DumpTimeSeconds)
             {
-               NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalDrainTimeSeconds' is large than 'recipe.DumpTimeSeconds",0);
+                NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalDrainTimeSeconds' is large than 'recipe.DumpTimeSeconds", 0);
                 return RState.Failed;
             }
             return Runner.Start(Module, "Start Rinse Second Step");
@@ -172,24 +174,24 @@ namespace CyberX8_RT.Modules.Rinse
             _currentStateMachine = Runner.CurrentStep.ToString();
             _device.UpdateStateMachine(_currentStateMachine);
             Runner.RunIf(RinseSecondStep.PrepareStart, _recipe.Step2N2BubbleOn, N2ValveOff, _delay_1ms)
-                 //2.6-StartSecondRinseCycle
+                //2.6-StartSecondRinseCycle
                 .LoopStart(RinseSecondStep.Recipe_StartSecondRinseCycle, "Rinse Second step", _recipe.Step2NumberOfRinse, NullFun, _delay_1ms)
-                 //2.7-PerformSecondRinseCycle
+                //2.7-PerformSecondRinseCycle
                 .LoopRun(RinseSecondStep.Recipe_PerformSecondRinseCycle, OpenN2ValveAndCloseDumpValve, _delay_1ms)
-                 //2.8-SecondRinseCycleStartFilling
+                //2.8-SecondRinseCycleStartFilling
                 .LoopRun(RinseSecondStep.Recipe_SecondRinseCycleStartFilling, () => _device.FillValveOn(), _delay_1ms)
                 .LoopRun(RinseSecondStep.Recipe_SecondRinseCycleRecordStartWaterLevel, CheckFillValveOn, _delay_1ms)
                 .LoopRunOnlyTimeOutFault(RinseSecondStep.Recipe_SecondRinseCycleStartFillingWait, CheckFillNormalStatus, _checkIsFillingTimeSeconds * 1000)
-                 //2.9-SecondRinseCycleWaitFillingDetected  //3.0-SecondRinseCycleWaitFull
+                //2.9-SecondRinseCycleWaitFillingDetected  //3.0-SecondRinseCycleWaitFull
                 .LoopRunOnlyTimeOutFault(RinseSecondStep.Recipe_SecondRinseCycleWaitFillingDetected, CheckFillFullStatus, _checkIsFullTimeSeconds * 1000)
-                 //.LoopRun(RinseSecondStep.Recipe_SecondRinseCycleWaitFull, CheckFillFullStatus, _delay_1s)
-                 //3.1-SecondRinseCycleWaitEndFillTime
+                //.LoopRun(RinseSecondStep.Recipe_SecondRinseCycleWaitFull, CheckFillFullStatus, _delay_1s)
+                //3.1-SecondRinseCycleWaitEndFillTime
                 .LoopDelay(RinseSecondStep.Recipe_SecondRinseCycleWaitEndFillTime, (_concurrentFillTimeSeconds - _checkIsFillingTimeSeconds - _checkIsFullTimeSeconds) * 1000)
-                 //3.2-SecondRinseCycleWaitDwell  
+                //3.2-SecondRinseCycleWaitDwell  
                 .LoopRunIf(RinseSecondStep.Recipe_SecondRinseCycleWaitDwell, ((_rinseCycleTwo_RinsesCompleted < _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry)
-                                          || ((_rinseCycleTwo_RinsesCompleted < _recipe.Step2NumberOfRinse) && _recipe.FinalRinseDry), 
+                                          || ((_rinseCycleTwo_RinsesCompleted < _recipe.Step2NumberOfRinse) && _recipe.FinalRinseDry),
                                           StartDwell, _recipe.Step2DwellTimeSeconds * 1000)
-                 //3.3-SecondRinseCycleWaitDrain
+                //3.3-SecondRinseCycleWaitDrain
                 .LoopRunIf(RinseSecondStep.Recipe_SecondRinseCycleWaitDrain, ((_rinseCycleTwo_RinsesCompleted < _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry)
                                           || ((_rinseCycleTwo_RinsesCompleted < _recipe.Step2NumberOfRinse) && _recipe.FinalRinseDry),
                                           StartOpenDumpValve, _delay_1ms)
@@ -202,24 +204,24 @@ namespace CyberX8_RT.Modules.Rinse
                                           NullFun, (_recipe.DumpTimeSeconds - _normalDrainTimeSeconds) * 1000)
                 //3.7-SecondRinseCycleWaitResistivityStart   条件:(Final Rinse == false && RinseComplete ==  _recipe.Step2NumberOfRinse - 1)
                 .LoopRunIf(RinseSecondStep.Recipe_SecondRinseCycleWaitResistivityStart, (_rinseCycleTwo_RinsesCompleted == _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry,
-                                          ResistivityStart, _recipe.ResistivityStartTimeSeconds*1000)
-                 //3.8-SecondRinseCycleResistivityAveraging   条件:(Final Rinse == false && RinseComplete ==  _recipe.Step2NumberOfRinse - 1)
+                                          ResistivityStart, _recipe.ResistivityStartTimeSeconds * 1000)
+                //3.8-SecondRinseCycleResistivityAveraging   条件:(Final Rinse == false && RinseComplete ==  _recipe.Step2NumberOfRinse - 1)
                 .LoopRunIf(RinseSecondStep.Recipe_SecondRinseCycleResistivityAveraging, (_rinseCycleTwo_RinsesCompleted == _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry,
                                           ResistivityAveraging, _delay_1ms)
                 //3.9-SecondRinseCycleCheckResistivity   条件:(Final Rinse == false && RinseComplete ==  _recipe.Step2NumberOfRinse - 1)
-                .LoopWaitIf(RinseSecondStep.Recipe_SecondRinseCycleCheckResistivity, (_rinseCycleTwo_RinsesCompleted == _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry, 
-                                          ResitivitySampleResitivity,_recipe.ResistivityDurationSeconds*1000) 
-                 //4.0-SecondRinseCycleWaitDrain   条件:(Final Rinse == false && RinseComplete ==  _recipe.Step2NumberOfRinse - 1)
+                .LoopWaitIf(RinseSecondStep.Recipe_SecondRinseCycleCheckResistivity, (_rinseCycleTwo_RinsesCompleted == _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry,
+                                          ResitivitySampleResitivity, _recipe.ResistivityDurationSeconds * 1000)
+                //4.0-SecondRinseCycleWaitDrain   条件:(Final Rinse == false && RinseComplete ==  _recipe.Step2NumberOfRinse - 1)
                 .LoopRunIf(RinseSecondStep.Recipe_SecondRinseCycleWaitDrain2, (_rinseCycleTwo_RinsesCompleted == _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry,
                                           StartOpenDumpValve, _delay_1ms)
                 .LoopRunIfOnlyTimeOutFault(RinseSecondStep.Recipe_SecondRinseCycleCheckDrain2, (_rinseCycleTwo_RinsesCompleted == _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry,
                                           CheckWaterLevelEmpty, _normalDrainTimeSeconds * 1000)
                 //4.1-Recipe_SecondRinseCycleWaitDrain2ExtraTime   条件:(Final Rinse == false && RinseComplete ==  _recipe.Step2NumberOfRinse - 1)
                 .LoopRunIf(RinseSecondStep.Recipe_SecondRinseCycleWaitDrain2ExtraTime, (_rinseCycleTwo_RinsesCompleted == _recipe.Step2NumberOfRinse - 1) && !_recipe.FinalRinseDry && _recipe.DumpTimeSeconds - _normalDrainTimeSeconds > 0,
-                                          NullFun, (_recipe.DumpTimeSeconds - _normalDrainTimeSeconds) * 1000) 
+                                          NullFun, (_recipe.DumpTimeSeconds - _normalDrainTimeSeconds) * 1000)
                 .LoopEnd(RinseSecondStep.Recipe_SecondRinseCycleEnd, CountNumberofRinsesComplete, _delay_1ms)
                 .End(RinseSecondStep.Recipe_SecondRinseCycleComplete, ResetRinseComplete, _delay_1ms);
-                return Runner.Status;
+            return Runner.Status;
         }
         /// <summary>
         /// N2 Valve Off
@@ -263,14 +265,14 @@ namespace CyberX8_RT.Modules.Rinse
                 result = _device.N2ValveOn();
                 if (!result)
                 {
-                   NotifyError(eEvent.ERR_RINSE, "Open N2 Valve error", 0);
+                    NotifyError(eEvent.ERR_RINSE, "Open N2 Valve error", 0);
                     return false;
                 }
             }
             result = _device.DrainValveOff();
             if (!result)
             {
-               NotifyError(eEvent.ERR_RINSE, "Close Dump Valve error",0);
+                NotifyError(eEvent.ERR_RINSE, "Close Dump Valve error", 0);
             }
             return result;
         }
@@ -283,6 +285,7 @@ namespace CyberX8_RT.Modules.Rinse
         {
             _startFillTime = DateTime.Now;
             _fillingDetectStartWaterLevel = _device.RinseData.WaterLevel;
+            LOG.WriteLog(eEvent.INFO_RINSE, Module, $"Start Fill Valve WaterLevel {_fillingDetectStartWaterLevel}");
             return true;
         }
 
@@ -324,7 +327,7 @@ namespace CyberX8_RT.Modules.Rinse
             bool result = _device.FillValveOff();
             if (!result)
             {
-               NotifyError(eEvent.ERR_RINSE, "Fill Valve off error", 0);
+                NotifyError(eEvent.ERR_RINSE, "Fill Valve off error", 0);
                 return false;
             }
             if (_recipe.Step2N2BubbleOn)
@@ -332,7 +335,7 @@ namespace CyberX8_RT.Modules.Rinse
                 result = _device.N2ValveOff();
                 if (!result)
                 {
-                   NotifyError(eEvent.ERR_RINSE, "N2 Valve off error",0);
+                    NotifyError(eEvent.ERR_RINSE, "N2 Valve off error", 0);
                     return false;
                 }
             }
@@ -348,7 +351,7 @@ namespace CyberX8_RT.Modules.Rinse
             bool result = _device.DrainValveOn();
             if (!result)
             {
-               NotifyError(eEvent.ERR_RINSE, "Open Dump valve error", 0);
+                NotifyError(eEvent.ERR_RINSE, "Open Dump valve error", 0);
                 return false;
             }
             return result;
@@ -363,7 +366,7 @@ namespace CyberX8_RT.Modules.Rinse
             bool reseult = currentWaterLevel < _sensorReadingEmpty;
             if (!reseult)
             {
-               NotifyError(eEvent.ERR_RINSE, $"current water level: {currentWaterLevel} is large than sensorReadingEmpty: {_sensorReadingEmpty}",0);
+                NotifyError(eEvent.ERR_RINSE, $"current water level: {currentWaterLevel} is large than sensorReadingEmpty: {_sensorReadingEmpty}", 0);
             }
             return reseult;
         }
@@ -379,8 +382,8 @@ namespace CyberX8_RT.Modules.Rinse
                 bool result = _device.WasteValveOn();
                 if (!result)
                 {
-                   NotifyError(eEvent.ERR_RINSE, "Close Metal Drain Valve error", 0);
-   
+                    NotifyError(eEvent.ERR_RINSE, "Close Metal Drain Valve error", 0);
+
                 }
             }
         }
@@ -394,7 +397,7 @@ namespace CyberX8_RT.Modules.Rinse
             result = _device.FillValveOff();
             if (!result)
             {
-               NotifyError(eEvent.ERR_RINSE, "Fill Valve Off error",0);
+                NotifyError(eEvent.ERR_RINSE, "Fill Valve Off error", 0);
                 return false;
             }
             if (_recipe.Step2N2BubbleOn)
@@ -402,7 +405,7 @@ namespace CyberX8_RT.Modules.Rinse
                 result = _device.N2ValveOff();
                 if (!result)
                 {
-                   NotifyError(eEvent.ERR_RINSE, "N2 Valve Off error",0);
+                    NotifyError(eEvent.ERR_RINSE, "N2 Valve Off error", 0);
                     return false;
                 }
             }
@@ -422,7 +425,7 @@ namespace CyberX8_RT.Modules.Rinse
             {
                 _startSampleTime = DateTime.Now;
                 _sampeIntervalTime = DateTime.Now;
-                _startSample = true;                
+                _startSample = true;
             }
             return true;
         }
@@ -438,16 +441,16 @@ namespace CyberX8_RT.Modules.Rinse
             }
             int sampleTotalCount = (int)Math.Ceiling(_recipe.ResistivityDurationSeconds / 0.1);
             //每隔100毫秒采样
-            if(DateTime.Now.Subtract(_sampeIntervalTime).TotalMilliseconds>=100)
+            if (DateTime.Now.Subtract(_sampeIntervalTime).TotalMilliseconds >= 100)
             {
-                _sampeIntervalTime= DateTime.Now;
+                _sampeIntervalTime = DateTime.Now;
                 _readResistivityCount++;
                 _resistivitySample.Add(GetResitivity());
             }
             //ResistivityDurationSeconds时长减去0.1s,避免超时
-            if (DateTime.Now.Subtract(_startSampleTime).TotalMilliseconds>=_recipe.ResistivityDurationSeconds*1000-100)
+            if (DateTime.Now.Subtract(_startSampleTime).TotalMilliseconds >= _recipe.ResistivityDurationSeconds * 1000 - 100)
             {
-                bool result= CheckResistivity();
+                bool result = CheckResistivity();
                 //if (!result)
                 //{
                 //    Runner.Stop("Sample Resitiviy abormal", true);
@@ -482,15 +485,15 @@ namespace CyberX8_RT.Modules.Rinse
         /// <returns></returns>
         private bool CheckResistivity()
         {
-            if(_recipe.ResistivityMegaOhms == 0)
+            if (_recipe.ResistivityMegaOhms == 0)
             {
                 _resistivitySample.Clear();
                 return true;
             }
             double resistivityAverageValue = _resistivitySample.Average();
-            if((_resistivitySample.Count == 1 && _resistivitySample[0]<_recipe.ResistivityMegaOhms)|| resistivityAverageValue < _recipe.ResistivityMegaOhms)
+            if ((_resistivitySample.Count == 1 && _resistivitySample[0] < _recipe.ResistivityMegaOhms) || resistivityAverageValue < _recipe.ResistivityMegaOhms)
             {
-               NotifyError(eEvent.ERR_RINSE, $"The detected resistivity value is abnormal,:{resistivityAverageValue}",0);
+                NotifyError(eEvent.ERR_RINSE, $"The detected resistivity value is abnormal,:{resistivityAverageValue}", 0);
             }
             _resistivitySample.Clear();
             return true;
@@ -501,7 +504,7 @@ namespace CyberX8_RT.Modules.Rinse
             _rinseCycleTwo_RinsesCompleted = 0;
             return true;
         }
-  
+
         /// <summary>
         /// Abort
         /// </summary>

+ 36 - 34
CyberX8_RT/Modules/Rinse/RinseThirdStepRoutine.cs

@@ -7,18 +7,18 @@ using MECF.Framework.Common.DataCenter;
 using MECF.Framework.Common.RecipeCenter;
 using MECF.Framework.Common.Routine;
 using MECF.Framework.Common.Utilities;
-using CyberX8_Core;
-using CyberX8_RT.Devices.Resistivity;
-using CyberX8_RT.Devices.Rinse;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using CyberX8_Core;
+using CyberX8_RT.Devices.Resistivity;
+using CyberX8_RT.Devices.Rinse;
 
 namespace CyberX8_RT.Modules.Rinse
 {
-    public class RinseThirdStepRoutine:RoutineBase,IRoutine
+    public class RinseThirdStepRoutine : RoutineBase, IRoutine
     {
 
         private enum RinseThirdStep
@@ -145,6 +145,7 @@ namespace CyberX8_RT.Modules.Rinse
             _device = DEVICE.GetDevice<RinseDevice>(Module);
             _recipe = objects[0] as QdrRecipe;
             _concurrentFillTimeSeconds = SC.GetValue<int>("QDR.ConcurrentFillTimeSeconds");
+            _fillingDetectStartWaterLevel = 0;
             _fillingStartedDelta = SC.GetValue<double>("QDR.FillingStartedDelta");
             _sensorReadingFull = SC.GetValue<int>("QDR.SensorReadingFull");
             _sensorReadingEmpty = SC.GetValue<int>("QDR.SensorReadingEmpty");
@@ -156,12 +157,12 @@ namespace CyberX8_RT.Modules.Rinse
             //配置项规范性验证
             if (_checkIsFillingTimeSeconds + _checkIsFullTimeSeconds > _concurrentFillTimeSeconds)
             {
-               NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalCheckFillWaterTimeSeconds' plus 'QDR.NominalCheckFillFullTimeSeconds' is large than QDR.ConcurrentFillTimeSeconds", 0);
+                NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalCheckFillWaterTimeSeconds' plus 'QDR.NominalCheckFillFullTimeSeconds' is large than QDR.ConcurrentFillTimeSeconds", 0);
                 return RState.Failed;
             }
             if (_normalDrainTimeSeconds > _recipe.DumpTimeSeconds)
             {
-               NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalDrainTimeSeconds' is large than 'recipe.DumpTimeSeconds",0);
+                NotifyError(eEvent.ERR_RINSE, $"configuration item 'QDR.NominalDrainTimeSeconds' is large than 'recipe.DumpTimeSeconds", 0);
                 return RState.Failed;
             }
             return Runner.Start(Module, "Start Rinse Third Step");
@@ -177,40 +178,40 @@ namespace CyberX8_RT.Modules.Rinse
             _device.UpdateStateMachine(_currentStateMachine);
             //3.6-StartThirdRinseCycle
             Runner.Run(RinseThirdStep.Recipe_StartThirdRinseCycle, OpenN2ValveAndCloseDumpValve, _delay_1ms)
-                   //3.7-ThirdRinseStartFilling
+                  //3.7-ThirdRinseStartFilling
                   .Run(RinseThirdStep.Recipe_ThirdRinseStartFilling, () => _device.FillValveOn(), _delay_1ms)
                   .Run(RinseThirdStep.Recipe_ThirdRinseRecordStartWaterLevel, CheckFillValveOn, _delay_1ms)
-                  .RunDelay(RinseThirdStep.Recipe_ThirdRinseStartFillingWait, CheckFillNormalStatus, _checkIsFillingTimeSeconds *1000)
+                  .RunDelay(RinseThirdStep.Recipe_ThirdRinseStartFillingWait, CheckFillNormalStatus, _checkIsFillingTimeSeconds * 1000)
                   //3.8-ThirdRinseWaitFillingDetected and 3.9-ThirdRinseWaitFull
-                  .RunDelay(RinseThirdStep.Recipe_ThirdRinseWaitFillingDetected,  CheckFillFullStatus, _checkIsFullTimeSeconds *1000)
-                   //.Run(RinseThirdStep.Recipe_ThirdRinseWaitFull, CheckFillFullStatus, _delay_1s)
-                   //4.0-ThirdRinseWaitEndFillTime
+                  .RunDelay(RinseThirdStep.Recipe_ThirdRinseWaitFillingDetected, CheckFillFullStatus, _checkIsFullTimeSeconds * 1000)
+                  //.Run(RinseThirdStep.Recipe_ThirdRinseWaitFull, CheckFillFullStatus, _delay_1s)
+                  //4.0-ThirdRinseWaitEndFillTime
                   .Delay(RinseThirdStep.Recipe_ThirdRinseWaitEndFillTime, (_concurrentFillTimeSeconds - _checkIsFillingTimeSeconds - _checkIsFullTimeSeconds) * 1000)
-                   //4.1-ThirdRinseWaitResistivityStart
-                  .Run(RinseThirdStep.Recipe_ThirdRinseWaitResistivityStart, ResistivityStart, _recipe.ResistivityStartTimeSeconds*1000)
-                   //4.2-ThirdRinseResistivityAveraging
-                  .Run(RinseThirdStep.Recipe_ThirdRinseResistivityAveraging, ResistivityAveraging,_delay_1ms)
-                   //4.3-ThirdRinseCheckResistivity
+                  //4.1-ThirdRinseWaitResistivityStart
+                  .Run(RinseThirdStep.Recipe_ThirdRinseWaitResistivityStart, ResistivityStart, _recipe.ResistivityStartTimeSeconds * 1000)
+                  //4.2-ThirdRinseResistivityAveraging
+                  .Run(RinseThirdStep.Recipe_ThirdRinseResistivityAveraging, ResistivityAveraging, _delay_1ms)
+                  //4.3-ThirdRinseCheckResistivity
                   .Wait(RinseThirdStep.Recipe_ThirdRinseCheckResistivity, ResitivitySampleResitivity, _recipe.ResistivityDurationSeconds * 1000)
-                   //4.4-ThirdRinseWaitClampTime
+                  //4.4-ThirdRinseWaitClampTime
                   .Delay(RinseThirdStep.Recipe_ThirdRinseWaitClampTime, (_recipe.FinalRinsePulseClampTime - _recipe.ResistivityStartTimeSeconds - _recipe.ResistivityDurationSeconds) * 1000)
                   .LoopStart(RinseThirdStep.Recipe_StartThirdRinseClampCycle, "Clamp On/Off Cycle", _numberClampCyclesToComplete, NullFun, _delay_1ms)
-                   //4.5-ThirdRinseCycleClampOff
-                  .LoopRun(RinseThirdStep.Recipe_ThirdRinseCycleClampOff, () =>  _device.WaferHolderClampValveOff(), (int)_clampCycleTimeSeconds*1000)
-                   //4.6-ThirdRinseCycleClampOn
-                  .LoopRun(RinseThirdStep.Recipe_ThirdRinseCycleClampOn, () =>  _device.WaferHolderClampValveOn(), (int)_clampCycleTimeSeconds * 1000)
+                  //4.5-ThirdRinseCycleClampOff
+                  .LoopRun(RinseThirdStep.Recipe_ThirdRinseCycleClampOff, () => _device.WaferHolderClampValveOff(), (int)(_clampCycleTimeSeconds * 1000))
+                  //4.6-ThirdRinseCycleClampOn
+                  .LoopRun(RinseThirdStep.Recipe_ThirdRinseCycleClampOn, () => _device.WaferHolderClampValveOn(), (int)(_clampCycleTimeSeconds * 1000))
                   .LoopEnd(RinseThirdStep.Recipe_ThirdRinseCycleEnd, NullFun, _delay_1ms)
                    //4.8-ThirdRinseCycleWaitSlowDrainTime
-                   .Delay(RinseThirdStep.Recipe_ThirdRinseCycleWaitSlowDrainTime,(_recipe.FinalRinseSlowDrainTime - (int)_clampCycleTimeSeconds * 2 * _numberClampCyclesToComplete) * 1000)
-                   //4.9-ThirdRinseWaitDrain
+                   .Delay(RinseThirdStep.Recipe_ThirdRinseCycleWaitSlowDrainTime, (int)((_recipe.FinalRinseSlowDrainTime - _recipe.FinalRinsePulseClampTime - _clampCycleTimeSeconds * 2 * _numberClampCyclesToComplete) * 1000))
+                  //4.9-ThirdRinseWaitDrain
                   .Run(RinseThirdStep.Recipe_ThirdRinseWaitDrain, StartOpenDumpValve, _delay_1ms)
                   .RunDelay(RinseThirdStep.Recipe_ThirdRinseCheckDrain, CheckWaterLevelEmpty, _normalDrainTimeSeconds * 1000)
-                   //5.0-ThirdRinseWaitDrainExtraTime
+                  //5.0-ThirdRinseWaitDrainExtraTime
                   .RunIf(RinseThirdStep.Recipe_ThirdRinseWaitDrainExtraTime, _recipe.DumpTimeSeconds - _normalDrainTimeSeconds > 0, NullFun, (_recipe.DumpTimeSeconds - _normalDrainTimeSeconds) * 1000)
-                   //5.1-Recipe_Complete
+                  //5.1-Recipe_Complete
                   .Run(RinseThirdStep.Recipe_ThirdRinseComplete, () => _device.WasteValveOff(), _delay_1ms)
                   .End(RinseThirdStep.Recipe_Complete, NullFun, _delay_1ms);
-             return Runner.Status;
+            return Runner.Status;
         }
 
 
@@ -226,14 +227,14 @@ namespace CyberX8_RT.Modules.Rinse
                 result = _device.N2ValveOn();
                 if (!result)
                 {
-                   NotifyError(eEvent.ERR_RINSE, "Open N2 Valve error", 0);
+                    NotifyError(eEvent.ERR_RINSE, "Open N2 Valve error", 0);
                     return false;
                 }
             }
             result = _device.DrainValveOff();
             if (!result)
             {
-               NotifyError(eEvent.ERR_RINSE, "Close Dump Valve error",0);
+                NotifyError(eEvent.ERR_RINSE, "Close Dump Valve error", 0);
             }
             return result;
         }
@@ -246,6 +247,7 @@ namespace CyberX8_RT.Modules.Rinse
         {
             _startFillTime = DateTime.Now;
             _fillingDetectStartWaterLevel = _device.RinseData.WaterLevel;
+            LOG.WriteLog(eEvent.INFO_RINSE, Module, $"Start Fill Valve WaterLevel {_fillingDetectStartWaterLevel}");
             return true;
         }
 
@@ -280,7 +282,7 @@ namespace CyberX8_RT.Modules.Rinse
             bool result = _device.DrainValveOn();
             if (!result)
             {
-               NotifyError(eEvent.ERR_RINSE, "Open Dump valve error", 0);
+                NotifyError(eEvent.ERR_RINSE, "Open Dump valve error", 0);
                 return false;
             }
             return result;
@@ -312,7 +314,7 @@ namespace CyberX8_RT.Modules.Rinse
                 bool result = _device.WasteValveOn();
                 if (!result)
                 {
-                   NotifyError(eEvent.ERR_RINSE, "Close Metal Drain Valve error", 0);
+                    NotifyError(eEvent.ERR_RINSE, "Close Metal Drain Valve error", 0);
                 }
             }
 
@@ -327,7 +329,7 @@ namespace CyberX8_RT.Modules.Rinse
             result = _device.FillValveOff();
             if (!result)
             {
-               NotifyError(eEvent.ERR_RINSE, "Fill Valve Off error",0);
+                NotifyError(eEvent.ERR_RINSE, "Fill Valve Off error", 0);
                 return false;
             }
             if (_recipe.Step2N2BubbleOn)
@@ -335,7 +337,7 @@ namespace CyberX8_RT.Modules.Rinse
                 result = _device.N2ValveOff();
                 if (!result)
                 {
-                   NotifyError(eEvent.ERR_RINSE, "N2 Valve Off error", 0);
+                    NotifyError(eEvent.ERR_RINSE, "N2 Valve Off error", 0);
                     return false;
                 }
             }
@@ -400,7 +402,7 @@ namespace CyberX8_RT.Modules.Rinse
                 {
                     resistivity = double.Parse(resistivityController.ResisitivityValue.Trim());
                 }
-                catch 
+                catch
                 {
                     resistivity = 0;
                 }
@@ -422,7 +424,7 @@ namespace CyberX8_RT.Modules.Rinse
             double resistivityAverageValue = _resistivitySample.Average();
             if ((_resistivitySample.Count == 1 && _resistivitySample[0] < _recipe.ResistivityMegaOhms) || resistivityAverageValue < _recipe.ResistivityMegaOhms)
             {
-               NotifyError(eEvent.ERR_RINSE, $"The detected resistivity value is abnormal,: {resistivityAverageValue}",0);
+                NotifyError(eEvent.ERR_RINSE, $"The detected resistivity value is abnormal,: {resistivityAverageValue}", 0);
             }
             else
             {

+ 1 - 1
CyberX8_RT/Schedulers/SchedulerSequenceManager.cs

@@ -62,7 +62,7 @@ namespace CyberX8_RT.Schedulers
             SchedulerSequence alignerSequence=CreateAlignerSequence(sequenceRecipe.AlignmentAngle,ref index);
             schedulerSequences.Add(alignerSequence);
             //从Aligner至Puf B面
-            MoveItem moveItem2 = new MoveItem(ModuleName.Aligner1, 0, pufModule, 1, Aitex.Sorter.Common.Hand.Blade1);
+            MoveItem moveItem2 = new MoveItem(ModuleName.Aligner1, 0, pufModule, 0, Aitex.Sorter.Common.Hand.Blade1);
             SchedulerSequence secondEfemRobotSequence = CreateEfemRobotSequence(moveItem2,null,ref index);
             schedulerSequences.Add(secondEfemRobotSequence);
             SchedulerSequence pufSequence=CreatePufSequence(pufModule,sequenceRecipe,side,true,ref index);

+ 8 - 0
CyberX8_Simulator/Config/SimulatorIOMapCfg.xml

@@ -13,4 +13,12 @@
 	<SimulatorIOMapItem SourceIOName="c_TRANSPORT1_DROP_BLOCK_LOCK" TargetIONameA="ProcessTransporterLock"/>			
 	<SimulatorIOMapItem SourceIOName="c_TRANSPORT2_DROP_BLOCK_LOCK" TargetIONameA="LoaderTransporterLock"/>
 	<SimulatorIOMapItem SourceIOName="c_Flow_Test_Clamp" TargetIONameA="FlowTestClamp"/>
+	<SimulatorIOMapItem SourceIOName="c_QDRD1_DI_FILL" TargetIONameA="r_QDRD1_WATER_LEVEL"/>
+	<SimulatorIOMapItem SourceIOName="c_QDRD1_DUMP" TargetIONameA="r_QDRD1_WATER_LEVEL"/>
+	<SimulatorIOMapItem SourceIOName="c_QDRD2_DI_FILL" TargetIONameA="r_QDRD2_WATER_LEVEL"/>
+	<SimulatorIOMapItem SourceIOName="c_QDRD2_DUMP" TargetIONameA="r_QDRD2_WATER_LEVEL"/>
+	<SimulatorIOMapItem SourceIOName="c_QDRD3_DI_FILL" TargetIONameA="r_QDRD3_WATER_LEVEL"/>
+	<SimulatorIOMapItem SourceIOName="c_QDRD3_DUMP" TargetIONameA="r_QDRD3_WATER_LEVEL"/>
+	<SimulatorIOMapItem SourceIOName="c_QDRD4_DI_FILL" TargetIONameA="r_QDRD4_WATER_LEVEL"/>
+	<SimulatorIOMapItem SourceIOName="c_QDRD4_DUMP" TargetIONameA="r_QDRD4_WATER_LEVEL"/>
 </SimulatorIOMapConfig>

+ 131 - 10
CyberX8_Simulator/Devices/WagoSocketSimulator.cs

@@ -30,13 +30,13 @@ namespace CyberX8_Simulator.Devices
         private IByteTransform byteTransform = new BigEndianByteTransformBase();
 
         //存储模拟器数据的数组
-        public byte[] DOBytes = new byte[100];
+        public byte[] DOBytes = new byte[200];
 
-        public short[] AOShorts = new short[100];
+        public short[] AOShorts = new short[200];
 
-        public byte[] DIBytes = new byte[100];
+        public byte[] DIBytes = new byte[200];
 
-        public short[] AIShorts = new short[100];
+        public short[] AIShorts = new short[200];
 
         /// <summary>
         /// 写DO锁
@@ -53,8 +53,17 @@ namespace CyberX8_Simulator.Devices
         /// <summary>
         /// 定时器
         /// </summary>
-        private PeriodicJob _periodicJob;
+        private PeriodicJob _LoaderPeriodicJob;
+        private PeriodicJob _Wago2PeriodicJob;
 
+        private bool _rinse1FillValve = false;
+        private bool _rinse1DumpValve = false;
+        private bool _rinse2FillValve = false;
+        private bool _rinse2DumpValve = false;
+        private bool _rinse3FillValve = false;
+        private bool _rinse3DumpValve = false;
+        private bool _rinse4FillValve = false;
+        private bool _rinse4DumpValve = false;
         //delegate
         #region Delegate
         public delegate void VariableValueChanged(object obj);
@@ -77,7 +86,7 @@ namespace CyberX8_Simulator.Devices
             InitializeData(port);    
         }  
         
-        private void UpdataDataCausedByOtherModule(string name, bool value, bool invert)
+        private void UpdataDataCausedByOtherModule(string sourceName,string name, bool value, bool invert)
         {
             value = invert ? !value : value;
             //AI Data
@@ -103,7 +112,39 @@ namespace CyberX8_Simulator.Devices
                         break;
                     default:
                         break;
-                }          
+                }
+            }
+            if (!string.IsNullOrEmpty(sourceName))
+            {
+                switch (sourceName)
+                {
+                    case "c_QDRD1_DI_FILL":
+                        _rinse1FillValve = value;
+                        break;
+                    case "c_QDRD1_DUMP":
+                        _rinse1DumpValve = value;
+                        break;
+                    case "c_QDRD2_DI_FILL":
+                        _rinse2FillValve = value;
+                        break;
+                    case "c_QDRD2_DUMP":
+                        _rinse2DumpValve = value;
+                        break;
+                    case "c_QDRD3_DI_FILL":
+                        _rinse3FillValve = value;
+                        break;
+                    case "c_QDRD3_DUMP":
+                        _rinse3DumpValve = value;
+                        break;
+                    case "c_QDRD4_DI_FILL":
+                        _rinse4FillValve = value;
+                        break;
+                    case "c_QDRD4_DUMP":
+                        _rinse4DumpValve = value;
+                        break;
+                    default:
+                        break;
+                }
             }
             //DI Data
             UpdataDIBytes(name, value ? 1 : 0);
@@ -152,9 +193,13 @@ namespace CyberX8_Simulator.Devices
                     {
                         if (port == config.Port)
                         {
-                            if(config.Module == "Loader" && _periodicJob == null)
+                            if(config.Module == "Loader" && _LoaderPeriodicJob == null)
                             {
-                                _periodicJob = new PeriodicJob(100, OnTimer, $"Wago {config.Module} timer",true);
+                                _LoaderPeriodicJob = new PeriodicJob(100, OnTimer, $"Wago {config.Module} timer",true);
+                            }
+                            if (config.Module == "Wago2" && _Wago2PeriodicJob == null)
+                            {
+                                _Wago2PeriodicJob = new PeriodicJob(100, OnTimer1, $"Wago {config.Module} timer", true);
                             }
                             //加载DO
                             int i = 0;
@@ -229,6 +274,12 @@ namespace CyberX8_Simulator.Devices
             if (AINameIndexDic.ContainsKey("r_SYSTEM_EXHAUST")) AIShorts[AINameIndexDic["r_SYSTEM_EXHAUST"]] = 0x3A98;
             if (DONameIndexDic.ContainsKey("c_HVD_1_ENABLE")) DOBytes[DONameIndexDic["c_HVD_1_ENABLE"]] = 1;
             if (DONameIndexDic.ContainsKey("c_HVD_2_ENABLE")) DOBytes[DONameIndexDic["c_HVD_2_ENABLE"]] = 1;
+
+            if (AINameIndexDic.ContainsKey("r_QDRD1_WATER_LEVEL")) AIShorts[AINameIndexDic["r_QDRD1_WATER_LEVEL"]] = 4000;
+            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;
+
         }
         #region 公共方法
         public void UpdataDOBytes(string name,int value)
@@ -542,7 +593,15 @@ namespace CyberX8_Simulator.Devices
             LeakTestSimulator();
             return true;
         }
-
+        /// <summary>
+        /// Wago2定时器
+        /// </summary>
+        /// <returns></returns>
+        private bool OnTimer1()
+        {
+            RinseWaterLelveSimulator();
+            return true;
+        }
         #region 模拟方法
         /// <summary>
         /// Loader LeakTest模拟
@@ -565,6 +624,68 @@ namespace CyberX8_Simulator.Devices
                     AIShorts[AINameIndexDic["r_LOADER_GasFlowSensor_FLOW"]] -= 140;
                 }
             }
+        }
+
+        /// <summary>
+        /// QDR水位模拟
+        /// </summary>
+        private void RinseWaterLelveSimulator()
+        {
+            //QDR1
+            if (_rinse1FillValve && AIShorts[AINameIndexDic["r_QDRD1_WATER_LEVEL"]] < 25000)
+            {
+                AIShorts[AINameIndexDic["r_QDRD1_WATER_LEVEL"]] += 250;
+            }
+            if (_rinse1DumpValve && AIShorts[AINameIndexDic["r_QDRD1_WATER_LEVEL"]] > 3500) //快排
+            {
+                AIShorts[AINameIndexDic["r_QDRD1_WATER_LEVEL"]] -= 350;
+            }
+            if (AIShorts[AINameIndexDic["r_QDRD1_WATER_LEVEL"]] > 3500)//慢排
+            {
+                AIShorts[AINameIndexDic["r_QDRD1_WATER_LEVEL"]] -= 2;
+            }
+
+            //QDR2
+            if (_rinse2FillValve && AIShorts[AINameIndexDic["r_QDRD2_WATER_LEVEL"]] < 25000)
+            {
+                AIShorts[AINameIndexDic["r_QDRD2_WATER_LEVEL"]] += 250;
+            }
+            if (_rinse2DumpValve && AIShorts[AINameIndexDic["r_QDRD2_WATER_LEVEL"]] > 3500)
+            {
+                AIShorts[AINameIndexDic["r_QDRD2_WATER_LEVEL"]] -= 300;
+            }
+            if (AIShorts[AINameIndexDic["r_QDRD2_WATER_LEVEL"]] > 3500)//慢排
+            {
+                AIShorts[AINameIndexDic["r_QDRD2_WATER_LEVEL"]] -= 2;
+            }
+
+            //QDR3
+            if (_rinse3FillValve && AIShorts[AINameIndexDic["r_QDRD3_WATER_LEVEL"]] < 25000)
+            {
+                AIShorts[AINameIndexDic["r_QDRD3_WATER_LEVEL"]] += 250;
+            }
+            if (_rinse3DumpValve && AIShorts[AINameIndexDic["r_QDRD3_WATER_LEVEL"]] > 3500)
+            {
+                AIShorts[AINameIndexDic["r_QDRD3_WATER_LEVEL"]] -= 300;
+            }
+            if (AIShorts[AINameIndexDic["r_QDRD3_WATER_LEVEL"]] > 3500)//慢排
+            {
+                AIShorts[AINameIndexDic["r_QDRD3_WATER_LEVEL"]] -= 2;
+            }
+
+            //QDR4
+            if (_rinse4FillValve && AIShorts[AINameIndexDic["r_QDRD4_WATER_LEVEL"]] < 25000)
+            {
+                AIShorts[AINameIndexDic["r_QDRD4_WATER_LEVEL"]] += 250;
+            }
+            if (_rinse4DumpValve && AIShorts[AINameIndexDic["r_QDRD4_WATER_LEVEL"]] > 3500)
+            {
+                AIShorts[AINameIndexDic["r_QDRD4_WATER_LEVEL"]] -= 300;
+            }
+            if (AIShorts[AINameIndexDic["r_QDRD4_WATER_LEVEL"]] > 3500)//慢排
+            {
+                AIShorts[AINameIndexDic["r_QDRD4_WATER_LEVEL"]] -= 2;
+            }
         }
         #endregion
     }

+ 4 - 4
Framework/Common/Device/Common/SimulatorCommManager.cs

@@ -19,7 +19,7 @@ namespace Aitex.Core.RT.Device
 
         //delegate
         #region Delegate
-        public delegate void UpdateVariableValueChanged(string name, bool value, bool revert);
+        public delegate void UpdateVariableValueChanged(string sourceName, string targetName, bool value, bool revert);
         #endregion
 
         #region 事件
@@ -45,11 +45,11 @@ namespace Aitex.Core.RT.Device
         /// 通知受关联模块变化的变量以及变化的值
         /// </summary>
         /// <param name="data"></param>
-        private void UpdateVariableValue(string name, bool value, bool invert)
+        private void UpdateVariableValue(string sourceName,string targetName, bool value, bool invert)
         {
             if (OnUpdateVariableValueChanged != null)
             {
-                OnUpdateVariableValueChanged(name, value, invert);
+                OnUpdateVariableValueChanged(sourceName,targetName, value, invert);
             }
         }
 
@@ -63,7 +63,7 @@ namespace Aitex.Core.RT.Device
         {
             if (_relatedDictionary.ContainsKey(name))
             {
-                UpdateVariableValue(_relatedDictionary[name], value, invert);
+                UpdateVariableValue(name, _relatedDictionary[name], value, invert);
             }
             
         }

+ 3 - 3
Framework/Common/Simulator/MotorSimulator.cs

@@ -84,7 +84,7 @@ namespace MECF.Framework.Common.Simulator
         #region Delegate
         public delegate void UpdateVariableValueMotionDatasChanged(Dictionary<string, SimulatorMotionData> datasDic);
         public delegate void UpdateVariableValueInputDatasChanged(string module, string VariableName, bool value);
-        public delegate void UpdateVariableValueWagoDatasChanged(string name, bool value, bool invert);
+        public delegate void UpdateVariableValueWagoDatasChanged(string sourceName,string targetName, bool value, bool invert);
         #endregion
 
         #region 事件
@@ -245,7 +245,7 @@ namespace MECF.Framework.Common.Simulator
         {
             if (OnUpdateWagoDatasChanged != null && CheckMutiMotionData(out string variableName, out bool value))
             {
-                OnUpdateWagoDatasChanged(variableName, value, false);
+                OnUpdateWagoDatasChanged("",variableName, value, false);
             }
         }
         /// <summary>
@@ -470,7 +470,7 @@ namespace MECF.Framework.Common.Simulator
         /// </summary>
         /// <param name="name"></param>
         /// <param name="value"></param>
-        private void UpdataDataCausedByOtherModule(string name, bool value, bool revert)
+        private void UpdataDataCausedByOtherModule(string sourceName,string name, bool value, bool revert)
         {
             if (_otherModuleDataDic.ContainsKey(name))
             {