Browse Source

1 revise vpw recipe
2 revise kollmorgenstopPostion

chenzk 2 weeks ago
parent
commit
cbdb1fbeef

+ 6 - 6
Framework/Common/RecipeCenter/VpwRecipe.cs

@@ -31,7 +31,7 @@ namespace MECF.Framework.Common.RecipeCenter
         private bool _vacuumPrewetSmallEnable;
         private bool _vacuumPrewetLargeEnable;
         private ObservableCollection<VpwRinseStep> _vacuumRinseStep;
-        private int _vacuumPrewetFlowSetPoint;
+        private double _vacuumPrewetFlowSetPoint;
         private int _vacuumPrewetFlowWarningPercent;
         private int _vacuumPrewetFlowErrorPercent;
 
@@ -39,7 +39,7 @@ namespace MECF.Framework.Common.RecipeCenter
         private bool _ventPrewetSmallEnable;
         private bool _ventPrewetLargeEnable;
         private ObservableCollection<VpwRinseStep> _ventRinseStep;
-        private int _ventPrewetFlowSetPoint;
+        private double _ventPrewetFlowSetPoint;
         private int _ventPrewetFlowWarningPercent;
         private int _ventPrewetFlowErrorPercent;
 
@@ -47,7 +47,7 @@ namespace MECF.Framework.Common.RecipeCenter
         private bool _extendCleanSmallEnable;
         private bool _extendCleanLargeEnable;
         private ObservableCollection<VpwRinseStep> _extendCleanRinseStep;
-        private int _extendCleanFlowSetPoint;
+        private double _extendCleanFlowSetPoint;
         private int _extendCleanFlowWarningPercent;
         private int _extendCleanFlowErrorPercent;
 
@@ -105,7 +105,7 @@ namespace MECF.Framework.Common.RecipeCenter
         [JsonProperty]
         public ObservableCollection<VpwRinseStep> VacuumRinseStep { get { return _vacuumRinseStep; } set { _vacuumRinseStep = value; InvokePropertyChanged(nameof(VacuumRinseStep)); } }
         [JsonProperty]
-        public int VacuumPrewetFlowSetPoint { get { return _vacuumPrewetFlowSetPoint; } set { _vacuumPrewetFlowSetPoint = value; InvokePropertyChanged(nameof(VacuumPrewetFlowSetPoint)); } }
+        public double VacuumPrewetFlowSetPoint { get { return _vacuumPrewetFlowSetPoint; } set { _vacuumPrewetFlowSetPoint = value; InvokePropertyChanged(nameof(VacuumPrewetFlowSetPoint)); } }
         [JsonProperty]
         public int VacuumPrewetFlowWarningPercent { get { return _vacuumPrewetFlowWarningPercent; } set { _vacuumPrewetFlowWarningPercent = value; InvokePropertyChanged(nameof(VacuumPrewetFlowWarningPercent)); } }
         [JsonProperty]
@@ -124,7 +124,7 @@ namespace MECF.Framework.Common.RecipeCenter
         public ObservableCollection<VpwRinseStep> VentRinseStep { get { return _ventRinseStep; } set { _ventRinseStep = value; InvokePropertyChanged(nameof(VentRinseStep)); } }
 
         [JsonProperty]
-        public int VentPrewetFlowSetPoint { get { return _ventPrewetFlowSetPoint; } set { _ventPrewetFlowSetPoint = value; InvokePropertyChanged(nameof(VentPrewetFlowSetPoint)); } }
+        public double VentPrewetFlowSetPoint { get { return _ventPrewetFlowSetPoint; } set { _ventPrewetFlowSetPoint = value; InvokePropertyChanged(nameof(VentPrewetFlowSetPoint)); } }
         [JsonProperty]
         public int VentPrewetFlowWarningPercent { get { return _ventPrewetFlowWarningPercent; } set { _ventPrewetFlowWarningPercent = value; InvokePropertyChanged(nameof(VentPrewetFlowWarningPercent)); } }
         [JsonProperty]
@@ -144,7 +144,7 @@ namespace MECF.Framework.Common.RecipeCenter
         public ObservableCollection<VpwRinseStep> ExtendCleanRinseStep { get { return _extendCleanRinseStep; } set { _extendCleanRinseStep = value; InvokePropertyChanged(nameof(ExtendCleanRinseStep)); } }
 
         [JsonProperty]
-        public int ExtendCleanFlowSetPoint { get { return _extendCleanFlowSetPoint; } set { _extendCleanFlowSetPoint = value; InvokePropertyChanged(nameof(ExtendCleanFlowSetPoint)); } }
+        public double ExtendCleanFlowSetPoint { get { return _extendCleanFlowSetPoint; } set { _extendCleanFlowSetPoint = value; InvokePropertyChanged(nameof(ExtendCleanFlowSetPoint)); } }
         [JsonProperty]
         public int ExtendCleanFlowWarningPercent { get { return _extendCleanFlowWarningPercent; } set { _extendCleanFlowWarningPercent = value; InvokePropertyChanged(nameof(ExtendCleanFlowWarningPercent)); } }
         [JsonProperty]

+ 7 - 10
PunkHPX8_MainPages/Views/VpwRecipeView.xaml

@@ -86,10 +86,7 @@
                 <Label Content="{Binding Recipe.TotalTime}" Height="30" Width="195" VerticalAlignment="Center" HorizontalAlignment="Left" Foreground="White" Background="Gray" 
                              HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Column="1" Margin="6,0,0,0"></Label>
             </GroupBox>
-            <GroupBox Header="Wafer Size" IsEnabled="{Binding Enable}"  Grid.Row="2" Grid.Column="4">
-                <ComboBox Height="30" Margin="0,0,20,0" ItemsSource="{Binding WaferSizeLst}" SelectedItem="{Binding Recipe.WaferSize, Mode=TwoWay}">
-                </ComboBox>
-            </GroupBox>
+
         </Grid>
         <Grid Grid.Row="2" Grid.Column="2">
             <Grid.RowDefinitions>
@@ -122,8 +119,8 @@
                     <Button Grid.Row="6" Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding Enable}" Content="Move Down" Height="26" Width="80" FontSize="10" Command="{Binding MoveDownCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,165,-20,-50" ></Button>
                     <Button Grid.Row="6" Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding Enable}" Content="Delete" Height="26" Width="80" FontSize="10" Command="{Binding DeleteCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,210,-20,-80"/>
 
-                    <UserControls:GroupTextBoxControl Grid.Row="6" Title="Flow Set Ponit" Unit="L/min" MinValue="0" MaxValue="10" Width="120" Margin="0,0,200,119"
-                                       IntValue="{Binding Recipe.VacuumPrewetFlowSetPoint,Mode=TwoWay}" 
+                    <UserControls:GroupDigitalBoxControl Grid.Row="6" Title="Flow Set Point" Unit="L/min" MinValue="0" MaxValue="10" Width="120" Margin="0,0,200,119"
+                                       DigitalValue="{Binding Recipe.VacuumPrewetFlowSetPoint,Mode=TwoWay}" 
                                        ValidResult="{Binding PropertyValidResultDic[VacuumPrewetFlowSetPoint],Mode=TwoWay}"  />
                     <UserControls:GroupTextBoxControl Grid.Row="6" Title="Flow Warning" Unit="%" MinValue="0" MaxValue="100" Margin="97,0,105,118" Width="120"
                         IntValue="{Binding Recipe.VacuumPrewetFlowWarningPercent,Mode=TwoWay}" 
@@ -252,8 +249,8 @@ Command="{Binding AutoCurrentBasedFalseCommand}"  IsChecked="{Binding Recipe.Vac
                     <Button Grid.Row="6" Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding Enable}" Content="Move Down" Height="25" Width="80" FontSize="10" Command="{Binding VentPrewetMoveDownCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,110,-20,0"></Button>
                     <Button Grid.Row="6" Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding Enable}" Content="Delete" Height="25" Width="80" FontSize="10" Command="{Binding VentPrewetDeleteCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,180,-20,0"></Button>
 
-                    <UserControls:GroupTextBoxControl Grid.Row="3" Title="Flow Set Ponit" Unit="L/min" MinValue="0" MaxValue="10" Width="120" Margin="-1,2,201,220"
-                                                          IntValue="{Binding Recipe.VentPrewetFlowSetPoint,Mode=TwoWay}" 
+                    <UserControls:GroupDigitalBoxControl Grid.Row="3" Title="Flow Set Point" Unit="L/min" MinValue="0" MaxValue="10" Width="120" Margin="-1,2,201,220"
+                                                          DigitalValue="{Binding Recipe.VentPrewetFlowSetPoint,Mode=TwoWay}" 
                                                           ValidResult="{Binding PropertyValidResultDic[VentPrewetFlowSetPoint],Mode=TwoWay}"  />
                     <UserControls:GroupTextBoxControl Grid.Row="3" Title="Flow Warning" Unit="%" MinValue="0" MaxValue="100" Margin="96,2,84,220" Width="120"
                                            IntValue="{Binding Recipe.VentPrewetFlowWarningPercent,Mode=TwoWay}" 
@@ -322,8 +319,8 @@ Command="{Binding AutoCurrentBasedFalseCommand}"  IsChecked="{Binding Recipe.Ven
                     <Button Grid.Row="6" Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding Enable}" Content="Move Up" Height="25" Width="80" FontSize="10" Command="{Binding ExtendCleanMoveUpCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,150,-20,0"></Button>
                     <Button Grid.Row="3" Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding Enable}" Content="Move Down" FontSize="10" Height="26" Width="80" Command="{Binding ExtendCleanMoveDownCommand}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,-20,-23"/>
                     <Button Grid.Row="3" Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding Enable}" Content="Delete" Height="24" Width="80" FontSize="10" Command="{Binding ExtendCleanDeleteCommand}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,-20,-57"></Button>
-                    <UserControls:GroupTextBoxControl Grid.Row="3" Title="Flow Set Ponit" Unit="L/min" MinValue="0" MaxValue="10" Width="120" Margin="1,3,199,123"
-                                       IntValue="{Binding Recipe.ExtendCleanFlowSetPoint,Mode=TwoWay}" 
+                    <UserControls:GroupDigitalBoxControl Grid.Row="3" Title="Flow Set Point" Unit="L/min" MinValue="0" MaxValue="10" Width="120" Margin="1,3,199,123"
+                                       DigitalValue="{Binding Recipe.ExtendCleanFlowSetPoint,Mode=TwoWay}" 
                                        ValidResult="{Binding PropertyValidResultDic[ExtendCleanFlowSetPoint],Mode=TwoWay}"  />
                     <UserControls:GroupTextBoxControl Grid.Row="3" Title="Flow Warning" Unit="%" MinValue="0" MaxValue="100" Margin="100,2,105,122" Width="120"
                         IntValue="{Binding Recipe.ExtendCleanFlowWarningPercent,Mode=TwoWay}" 

+ 8 - 8
PunkHPX8_RT/Devices/AXIS/Kollmorgen/KollmorgenStopPositionRoutine.cs

@@ -53,14 +53,14 @@ namespace PunkHPX8_RT.Devices.AXIS.Kollmorgen
         {
             Runner.Run(StopPositionStep.SetHaltControlWord, () => { return _beckhoffCommonAxis.WriteControlWord(0X10F); }, () => { return CheckControlWord(0X10F); }, 1000)
                 .WaitWithStopCondition(StopPositionStep.CheckStop, CheckStop, CheckErrorOrWarning, _timeout)
-                .Delay(StopPositionStep.Delay,_delay_1s)
-                .Run(StopPositionStep.WriteTargePosition, () => { return WriteTargetPosition(); }, NullFun, 100)
-                .Run(StopPositionStep.NoneModeOfOperation, () => { return _beckhoffCommonAxis.WriteModeOfMode(AxisModeOfOperation.None); }, () => { return CheckModeOfOperation((byte)AxisModeOfOperation.None); }, 1000)
-                .Run(StopPositionStep.QuickStop, () => { return _beckhoffCommonAxis.WriteControlWord(0x02); }, () => { return CheckControlWord(0x02); }, 1000)
-                .Run(StopPositionStep.ControlOffControlWord, () => { return _beckhoffCommonAxis.WriteControlWord(0x06); }, () => { return CheckControlWord(0x06); }, 1000)
-                .Run(StopPositionStep.ControlOnControlWord, () => { return _beckhoffCommonAxis.WriteControlWord(0x07); }, () => { return CheckControlWord(0x07); }, 1000)
-                .Run(StopPositionStep.EnableOperation, () => { return _beckhoffCommonAxis.WriteControlWord(0x0F); }, () => { return CheckControlWord(0x0F); }, 1000)
-                .End(StopPositionStep.End, NullFun, 100);
+                .Delay(StopPositionStep.Delay, 500)
+                .Run(StopPositionStep.WriteTargePosition, () => { return WriteTargetPosition(); }, NullFun, _delay_1ms)
+                .Run(StopPositionStep.NoneModeOfOperation, () => { return _beckhoffCommonAxis.WriteModeOfMode(AxisModeOfOperation.None); }, () => { return CheckModeOfOperation((byte)AxisModeOfOperation.None); }, _delay_1ms)
+                .Run(StopPositionStep.QuickStop, () => { return _beckhoffCommonAxis.WriteControlWord(0x02); }, () => { return CheckControlWord(0x02); }, _delay_1ms)
+                .Run(StopPositionStep.ControlOffControlWord, () => { return _beckhoffCommonAxis.WriteControlWord(0x06); }, () => { return CheckControlWord(0x06); }, _delay_1ms)
+                .Run(StopPositionStep.ControlOnControlWord, () => { return _beckhoffCommonAxis.WriteControlWord(0x07); }, () => { return CheckControlWord(0x07); }, _delay_1ms)
+                .Run(StopPositionStep.EnableOperation, () => { return _beckhoffCommonAxis.WriteControlWord(0x0F); }, () => { return CheckControlWord(0x0F); }, _delay_1ms)
+                .End(StopPositionStep.End, NullFun);
             return Runner.Status;
         }
 

+ 1 - 1
PunkHPX8_RT/Devices/Reservoir/ReservoirDevice.cs

@@ -256,7 +256,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
             SubscribeData();
             InitializeOperation();
             SubscribeValueAction();
-            _periodicJob = new PeriodicJob(200, OnTimer, $"{Module}.Timer", true, true);
+            _periodicJob = new PeriodicJob(20, OnTimer, $"{Module}.Timer", true, true);
             return true;
         }
         /// <summary>

+ 149 - 12
PunkHPX8_RT/Modules/PlatingCell/PlatingCellRunRecipeRoutine.cs

@@ -4,6 +4,7 @@ using Aitex.Core.RT.Routine;
 using Aitex.Core.Util;
 using MECF.Framework.Common.Beckhoff.AxisProvider;
 using MECF.Framework.Common.Beckhoff.Station;
+using MECF.Framework.Common.CommonData.PowerSupplier;
 using MECF.Framework.Common.RecipeCenter;
 using MECF.Framework.Common.Routine;
 using MECF.Framework.Common.SubstrateTrackings;
@@ -13,9 +14,12 @@ using PunkHPX8_Core;
 using PunkHPX8_RT.Devices.AXIS;
 using PunkHPX8_RT.Devices.Facilities;
 using PunkHPX8_RT.Devices.PlatingCell;
+using PunkHPX8_RT.Devices.PowerSupplier;
 using PunkHPX8_RT.Modules.Reservoir;
+using SecsGem.Core.ItemModel;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -38,8 +42,12 @@ namespace PunkHPX8_RT.Modules.PlatingCell
             VerticalGotoPlate,
             WaitEntryCurrentProtectedFromRinse,
             WaitEntryCurrentProtectedFromHome,
-            EntryCurrentProtected,
-            CheckVertical,
+            RunPowerStepWithEntryProtect,
+            CheckVerticalGotoPlate,
+            AngleVertical,
+            WaitPlatingDelay,
+            RunPowerStep,
+            RunPowerStepWait,
             End
         }
         #region 常量 
@@ -101,7 +109,33 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// <summary>
         /// run recipe 过程中电机会停的位置(需要根据recipe计算出来)
         /// </summary>
-        private List<int> _targetPositionList = new List<int>(); 
+        private List<int> _targetPositionList = new List<int>();
+
+
+        #region 电镀通电相关
+        /// <summary>
+        /// PlatingDelay计时
+        /// </summary>
+        private DateTime _hotPlatingRunTime;
+        /// <summary>
+        /// 不通电
+        /// </summary>
+        private bool _isZeroCurrent = false;
+        /// <summary>
+        /// 通电时长
+        /// </summary>
+        private int _totalMicrosecond = 0;
+        /// <summary>
+        /// Power 集合
+        /// </summary>
+        List<PowerSupplierStepPeriodData> _powerSupplierStepPeriodDatas = new List<PowerSupplierStepPeriodData>();
+        /// <summary>
+        /// 记录dep recipe中出现的最大电流,用于启动电源前切换挡位
+        /// </summary>
+        private double _maxCurrent = 0;
+        #endregion
+
+
         #endregion
         /// <summary>
         /// 构造函数
@@ -124,25 +158,77 @@ namespace PunkHPX8_RT.Modules.PlatingCell
         /// <returns></returns>
         public RState Monitor()
         {        //vertical去rinse位置
-            Runner.RunIf(RunRecipeStep.VerticalGotoRinse, _recipe.RinseBeforeEntryEnable, () => { return StartVertical("Rinse",_recipe.IntervalRinseZoffset); }, _delay_1ms)
+            Runner.RunIf(RunRecipeStep.VerticalGotoRinse, _recipe.RinseBeforeEntryEnable, () => { return StartVertical("Rinse", _recipe.IntervalRinseZoffset); }, _delay_1ms)
                 .WaitWithStopConditionIf(RunRecipeStep.CheckVerticalGotoRinse, _recipe.RinseBeforeEntryEnable, CheckVerticalEnd, CheckVerticalError)
-                 //执行interval rinse
+                //执行interval rinse
                 .RunIf(RunRecipeStep.InterRinse, _recipe.RinseBeforeEntryEnable, () => { return _interRinseRoutine.Start(_recipe, _rotationAxis, _device, _rotationProviderAxis, _targetPositionList[0]) == RState.Running; })
                 .WaitWithStopConditionIf(RunRecipeStep.CheckInterRinse, _recipe.RinseBeforeEntryEnable, CheckInterRinseEndStatus,
                         () => CommonFunction.CheckRoutineStopState(_interRinseRoutine))
-                 //启动Rotation/Rotation 设置为entry 转速
-                .RunIf(RunRecipeStep.RotationStartEntry, !_recipe.RinseBeforeEntryEnable, RotationStartEntry, _delay_1ms)  //没有intercal rinse 在entry开始的时候启动rotation
-                .RunIf(RunRecipeStep.RotationChangeToEntrySpeed, _recipe.RinseBeforeEntryEnable, () => { return ChangeSpeed(_recipe.EntrySpinSpeed); }, _delay_1ms)  //有intercal rinse 直接变速
+                //启动Rotation/Rotation 设置为entry 转速 (没有intercal rinse 在entry开始的时候启动rotation)
+                .RunIf(RunRecipeStep.RotationStartEntry, !_recipe.RinseBeforeEntryEnable, RotationStartEntry, _delay_1ms)
+                 //有intercal rinse 直接变速 (rotation在interval rinse的时候已经启动了)
+                .RunIf(RunRecipeStep.RotationChangeToEntrySpeed, _recipe.RinseBeforeEntryEnable, () => { return ChangeSpeed(_recipe.EntrySpinSpeed); }, _delay_1ms) 
                  //Angle tilt 操作
-                .Run(RunRecipeStep.AngleTilt, _device.HeadtTiltAction, () => { return _device.PlatingCellDeviceData.HeadTilt; }, _delay_1s)
+                .Run(RunRecipeStep.AngleTilt, _device.HeadtTiltAction, () => { return _device.PlatingCellDeviceData.IsHeadTilt; }, _delay_1s)
+                 //vertical goto plate
                 .Run(RunRecipeStep.VerticalGotoPlate, () => { return StartVertical("Plate", _recipe.EntryZoffset); }, _delay_1ms)
-                .DelayIf(RunRecipeStep.WaitEntryCurrentProtectedFromRinse, !_recipe.RinseBeforeEntryEnable,CalculateVerticaMoveTime("Rinse","Entry") - 110 > 0 ? CalculateVerticaMoveTime("Rinse", "Entry"):0) //提前110ms,多10ms
-                .DelayIf(RunRecipeStep.WaitEntryCurrentProtectedFromHome, _recipe.RinseBeforeEntryEnable,CalculateVerticaMoveTime("Home","Entry") - 110 > 0 ? CalculateVerticaMoveTime("Home", "Entry") : 0)
-
+                 //vertical 到达entry位置前110ms
+                .DelayIf(RunRecipeStep.WaitEntryCurrentProtectedFromRinse, !_recipe.RinseBeforeEntryEnable, CalculateVerticaMoveTime("Rinse", "Entry") - 110 > 0 ? CalculateVerticaMoveTime("Rinse", "Entry") : 0) //提前110ms,多10ms
+                .DelayIf(RunRecipeStep.WaitEntryCurrentProtectedFromHome, _recipe.RinseBeforeEntryEnable, CalculateVerticaMoveTime("Home", "Entry") - 110 > 0 ? CalculateVerticaMoveTime("Home", "Entry") : 0)
+                 //有上电保护,此刻给电
+                .RunIf(RunRecipeStep.RunPowerStepWithEntryProtect, !_recipe.IsEntryTypeCold,StartPowerStep, _delay_1ms)
+                 //检查vertical到达plate位置
+                .WaitWithStopCondition(RunRecipeStep.CheckVerticalGotoPlate, CheckVerticalEnd, CheckVerticalError)
+                //Angle vertical操作
+                .Run(RunRecipeStep.AngleVertical, _device.HeadtVerticalAction, () => { return _device.PlatingCellDeviceData.IsHeadVertical; }, _delay_1s)
+                //如果不需要上电保护,执行plating delay
+                .RunIf(RunRecipeStep.WaitPlatingDelay, _recipe.IsEntryTypeCold, NullFun, _recipe.PlatingDelay)
+                 //没有上电保护,此刻给电
+                .RunIf(RunRecipeStep.RunPowerStep, _recipe.IsEntryTypeCold, StartPowerStep, _delay_1ms)
+                .WaitWithStopCondition(RunRecipeStep.RunPowerStepWait, CheckRecipeStepEndStatus, CheckRecipeStepStopStatus, _delay_1ms)
                 .End(RunRecipeStep.End, NullFun);
             return Runner.Status;
         }
         /// <summary>
+        /// 启动PowerSupplier
+        /// </summary>
+        /// <returns></returns>
+        private bool StartPowerStep()
+        {
+            bool result = _device.PowerSupplier.StartSetStepPeriodNoWaitEnd(_powerSupplierStepPeriodDatas);
+            if (!result)
+            {
+                _device.PowerSupplier.DisableOperation("", null);
+                return false;
+            }
+            return true;
+        }
+        /// <summary>
+        /// 检验Powerstep是否启动完成
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckRecipeStepEndStatus()
+        {
+            if (_isZeroCurrent)
+            {
+                return true;
+            }
+            return _device.PowerSupplier.Status == RState.End;
+       
+        }
+        /// <summary>
+        /// 检验Powerstep是否启动失败
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckRecipeStepStopStatus()
+        {
+            if (_isZeroCurrent)
+            {
+                return false;
+            }
+            return _device.PowerSupplier.Status == RState.Failed || _device.PowerSupplier.Status == RState.Timeout;
+        }
+        /// <summary>
         /// 计算vertical 从一个位置移动到另一个位置用时
         /// </summary>
         /// <param name="sourceLocation"></param>
@@ -279,12 +365,63 @@ namespace PunkHPX8_RT.Modules.PlatingCell
                 return RState.Failed;
             }
             CalculatVerticalPosition(_recipe);
+            UpdatePowerStepDatas();
             _currentCycle = 0;
 
  
             return Runner.Start(Module, "Run Recipe");
         }
         /// <summary>
+        /// 初始化Power step步骤
+        /// </summary>
+        private bool UpdatePowerStepDatas()
+        {
+            _isZeroCurrent = false;
+            double current = 0;
+            _totalMicrosecond = 0;
+            _powerSupplierStepPeriodDatas.Clear();
+            if (!_recipe.IsEntryTypeCold)//如果entry带上电保护,那么把上电保护的部分加到步阶电流的第一步
+            {
+                PowerSupplierStepPeriodData step = new PowerSupplierStepPeriodData(); //上电保护时间(提前上电时间+延迟时间)
+                step.Hour = 0;
+                step.Minute = (ushort)((_recipe.PlatingDelay) / 60);
+                step.Second = (ushort)(_recipe.PlatingDelay % 60);  
+                step.Microsecond = 110; //到达entry位置提前100ms上电,提前一丢丢
+                step.Voltage = _recipe.DepMaxVoltageWarning;
+                _powerSupplierStepPeriodDatas.Add(step);
+
+            }
+            foreach (var item in _recipe.DepSteps)
+            {
+                PowerSupplierStepPeriodData step = new PowerSupplierStepPeriodData();
+                step.Current = item.CurrentValue;
+                if(item.CurrentValue > _maxCurrent)
+                {
+                    _maxCurrent = item.CurrentValue;
+                }
+                step.Hour = (ushort)(item.DurartionSeconds / 3600);
+                step.Minute = (ushort)((item.DurartionSeconds - step.Hour * 3600) / 60);
+                step.Second = (ushort)(item.DurartionSeconds % 60);
+                step.Microsecond = 0;
+                step.Voltage = _recipe.DepMaxVoltageWarning;
+                _powerSupplierStepPeriodDatas.Add(step);
+                current += step.Current;
+                _totalMicrosecond += item.DurartionSeconds * 1000;
+            }
+            if (current == 0)
+            {
+                _isZeroCurrent = true;
+            }
+            if(_maxCurrent > 0.6) //设置电源挡位,有超过0.6A的电流则用高档,否则用中挡
+            {
+                return _device.PowerSupplier.SetPowerGrade("set power grade high", new object[] { 2 });
+            }
+            else
+            {
+                return  _device.PowerSupplier.SetPowerGrade("set power grade high", new object[] { 1 });
+            }
+        }
+        /// <summary>
         /// 根据dep recipe计算出整个电镀过程中Rotation profile position可能去到的位置
         /// </summary>
         private void CalculatVerticalPosition(DepRecipe recipe)