Kaynağa Gözat

revise robot cycle bug

chenzk 2 hafta önce
ebeveyn
işleme
2ea59fe258

+ 2 - 1
CyberX8_Core/RtState.cs

@@ -74,7 +74,8 @@ namespace CyberX8_Core
         ConfirmCompleting,
         ErrorPicking,
         ErrorPlacing,
-        RobotCycleing
+        RobotCycleing,
+        ErrorInitingAL
     }
     public enum PUFSTATE
     {

+ 338 - 282
CyberX8_MainPages/ViewModels/RobotCycleViewModel.cs

@@ -1,299 +1,355 @@
-using Aitex.Core.UI.MVVM;
-using CyberX8_Core;
-using CyberX8_MainPages.Roles;
-using CyberX8_MainPages.Views;
-using MECF.Framework.Common.ControlDataContext;
-using MECF.Framework.Common.DataCenter;
-using MECF.Framework.Common.Equipment;
-using MECF.Framework.Common.OperationCenter;
-using MECF.Framework.Common.Utilities;
-using OpenSEMI.ClientBase.Command;
-using Prism.Mvvm;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using System.Windows.Input;
-using System.Windows.Threading;
-
-namespace CyberX8_MainPages.ViewModels
-{
-    public class RobotCycleViewModel : BindableBase
-    {
-
-        #region 内部变量
-        /// <summary>
-        /// 选择的LP
-        /// </summary>
-        private ModuleName _selectedLPName = ModuleName.LP1;
-        private ModuleName _selectedAlignerName = ModuleName.Aligner1;
-        /// <summary>
-        /// 选择的Dummy
-        /// </summary>
-        private ModuleName _selectedDummyName = ModuleName.Dummy1;
-        private ModuleName _selectedSrdName = ModuleName.SRD1;
-        private ModuleName _selectedPufName = ModuleName.PUF1;
-        /// <summary>
-        /// 输入的Cycle次数
-        /// </summary>
-        private int _inPutCycleTimes = 1;
-        /// <summary>
-        /// Align调整角度度数
-        /// </summary>
-        private int _inPutAlignDegree = 0;
-        /// <summary>
-        /// 当前正在执行第几次Cycle
-        /// </summary>
-        private int _currentCycle;
-        /// <summary>
-        /// 是否选中dummy
-        /// </summary>
-        private bool _isDummySelected = false;
-        /// <summary>
-        /// 是否选中srd
-        /// </summary>
+using Aitex.Core.UI.MVVM;
+using CyberX8_Core;
+using CyberX8_MainPages.Roles;
+using CyberX8_MainPages.Views;
+using MECF.Framework.Common.ControlDataContext;
+using MECF.Framework.Common.DataCenter;
+using MECF.Framework.Common.Equipment;
+using MECF.Framework.Common.OperationCenter;
+using MECF.Framework.Common.Utilities;
+using OpenSEMI.ClientBase.Command;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Windows.Input;
+using System.Windows.Threading;
+
+namespace CyberX8_MainPages.ViewModels
+{
+    public class RobotCycleViewModel : BindableBase
+    {
+
+        #region 内部变量
+        /// <summary>
+        /// 选择的LP
+        /// </summary>
+        private ModuleName _selectedLPName = ModuleName.LP1;
+        private ModuleName _selectedAlignerName = ModuleName.Aligner1;
+        /// <summary>
+        /// 选择的Dummy
+        /// </summary>
+        private ModuleName _selectedDummyName = ModuleName.Dummy1;
+        private ModuleName _selectedSrdName = ModuleName.SRD1;
+        private ModuleName _selectedPufName = ModuleName.PUF1;
+        /// <summary>
+        /// 输入的Cycle次数
+        /// </summary>
+        private int _inPutCycleTimes = 1;
+        /// <summary>
+        /// Align调整角度度数
+        /// </summary>
+        private int _inPutAlignDegree = 0;
+        /// <summary>
+        /// 当前正在执行第几次Cycle
+        /// </summary>
+        private int _currentCycle;
+        /// <summary>
+        /// 是否选中dummy
+        /// </summary>
+        private bool _isDummySelected = false;
+        /// <summary>
+        /// 是否选中srd
+        /// </summary>
         private bool _isSrdSelected = false ;
-        /// <summary>
-        /// 是否选中puf
-        /// </summary>
-        private bool _isPufSelected = false;
-        #region 系统数据
-        /// <summary>
-        /// 定时器
-        /// </summary>
-        DispatcherTimer _timer;
-        /// <summary>
-        /// 查询后台数据集合
-        /// </summary>
-        private List<string> _rtDataKeys = new List<string>();
-        /// <summary>
-        /// rt查询key数值字典
-        /// </summary>
-        private Dictionary<string, object> _rtDataValueDic = new Dictionary<string, object>();
-        #endregion
-        #endregion
-
-        #region 属性
-        public ModuleName SelectedLPName
-        {
-            get { return _selectedLPName; }
-            set { SetProperty(ref _selectedLPName, value); }
-        }
-        public ModuleName SelectedAlignerName
-        {
-            get { return _selectedAlignerName; }
-            set { SetProperty(ref _selectedAlignerName, value); }
-        }
-        public ModuleName SelectedDummyName
-        {
-            get { return _selectedDummyName; }
-            set { SetProperty(ref _selectedDummyName, value); }
-        }
-        public ModuleName SelectedSrdName
-        {
-            get { return _selectedSrdName; }
-            set { SetProperty(ref _selectedSrdName, value); }
+        /// <summary>
+        /// 是否选中puf
+        /// </summary>
+        private bool _isPufSelected = false;
+
+        private bool _isSrd1Checked = true;
+        private bool _isSrd2Checked = false;
+        private bool _isDummy1Checked = true;
+        private bool _isDummy2Checked = false;
+        #region 系统数据
+        /// <summary>
+        /// 定时器
+        /// </summary>
+        DispatcherTimer _timer;
+        /// <summary>
+        /// 查询后台数据集合
+        /// </summary>
+        private List<string> _rtDataKeys = new List<string>();
+        /// <summary>
+        /// rt查询key数值字典
+        /// </summary>
+        private Dictionary<string, object> _rtDataValueDic = new Dictionary<string, object>();
+        #endregion
+        #endregion
+
+        #region 属性
+        public ModuleName SelectedLPName
+        {
+            get { return _selectedLPName; }
+            set { SetProperty(ref _selectedLPName, value); }
+        }
+        public ModuleName SelectedAlignerName
+        {
+            get { return _selectedAlignerName; }
+            set { SetProperty(ref _selectedAlignerName, value); }
+        }
+        public ModuleName SelectedDummyName
+        {
+            get { return _selectedDummyName; }
+            set { SetProperty(ref _selectedDummyName, value); }
+        }
+        public ModuleName SelectedSrdName
+        {
+            get { return _selectedSrdName; }
+            set { SetProperty(ref _selectedSrdName, value); }
+        }
+        public ModuleName SelectedPufName
+        {
+            get { return _selectedPufName; }
+            set { SetProperty(ref _selectedPufName, value); }
         }
-        public ModuleName SelectedPufName
-        {
-            get { return _selectedPufName; }
-            set { SetProperty(ref _selectedPufName, value); }
-        }
-        public int InPutCycleTimes
-        {
-            get { return _inPutCycleTimes; }
-            set { SetProperty(ref _inPutCycleTimes, value); }
-        }
-        public int CurrentCycle
-        {
-            get { return _currentCycle; }
-            set { SetProperty(ref _currentCycle, value); }
-        }
-        public int InPutAlignDegree
-        {
-            get { return _inPutAlignDegree; }
-            set { SetProperty(ref _inPutAlignDegree, value); }
-        }
-
-        public bool IsDummySelected
-        {
-            get { return _isDummySelected; }
-            set { SetProperty(ref _isDummySelected, value); }
-        }
-        public bool IsSrdSelected
-        {
-            get { return _isSrdSelected; }
-            set { SetProperty(ref _isSrdSelected, value); }
+        public int InPutCycleTimes
+        {
+            get { return _inPutCycleTimes; }
+            set { SetProperty(ref _inPutCycleTimes, value); }
+        }
+        public int CurrentCycle
+        {
+            get { return _currentCycle; }
+            set { SetProperty(ref _currentCycle, value); }
         }
-        public bool IsPufSelected
-        {
-            get { return _isPufSelected; }
-            set { SetProperty(ref _isPufSelected, value); }
-        }
-        #endregion
-
-        #region 命令
-
-        public ICommand RobotCycleStartCommand { get; set; }
-  
-        public ICommand RobotCycleAbortCommand { get; set; }
-
-        public ICommand LPChangeCommand { get; set; }
- 
-        public ICommand AlignerChangeCommand { get; set; }
-        
-        public ICommand PufChangeCommand { get; set; }
-   
-        public ICommand DummyChangeCommand { get; set; }
-        
-        public ICommand SrdChangeCommand { get; set; }
-        #endregion
-
-        /// <summary>
-        /// 构造器
-        /// </summary>
-        public RobotCycleViewModel() 
-        {
-            RobotCycleStartCommand = new DelegateCommand<object>(RobotCycleStartAction);
-            RobotCycleAbortCommand = new DelegateCommand<object>(RobotCycleAbortAction);
-            LPChangeCommand = new DelegateCommand<object>(LPChangeAction);
-            AlignerChangeCommand = new DelegateCommand<object>(AlignerChangeAction);
-            PufChangeCommand = new DelegateCommand<object>(PufChangeAction);
-            DummyChangeCommand = new DelegateCommand<object>(DummyChangeAction);
-            SrdChangeCommand = new DelegateCommand<object>(SrdChangeAction);
-        }
-
-        private void RobotCycleStartAction(object param)
-        {
-            if (!IsDummySelected)
-            {
-                SelectedDummyName = ModuleName.Unknown;
-            }
-            if (!IsSrdSelected)
-            {
-                SelectedSrdName = ModuleName.Unknown;
+        public int InPutAlignDegree
+        {
+            get { return _inPutAlignDegree; }
+            set { SetProperty(ref _inPutAlignDegree, value); }
+        }
+
+        public bool IsDummySelected
+        {
+            get { return _isDummySelected; }
+            set { SetProperty(ref _isDummySelected, value); }
+        }
+        public bool IsSrdSelected
+        {
+            get { return _isSrdSelected; }
+            set { SetProperty(ref _isSrdSelected, value); }
+        }
+        public bool IsPufSelected
+        {
+            get { return _isPufSelected; }
+            set { SetProperty(ref _isPufSelected, value); }
+        }
+
+        public bool IsSrd1Checkd
+        {
+            get { return _isSrd1Checked; }
+            set { SetProperty(ref _isSrd1Checked, value); }
+        }
+        public bool IsSrd2Checkd
+        {
+            get { return _isSrd2Checked; }
+            set { SetProperty(ref _isSrd2Checked, value); }
+        }
+        public bool IsDummy1Checkd
+        {
+            get { return _isDummy1Checked; }
+            set { SetProperty(ref _isDummy1Checked, value); }
+        }
+        public bool IsDummy2Checkd
+        {
+            get { return _isDummy2Checked; }
+            set { SetProperty(ref _isDummy2Checked, value); }
+        }
+        #endregion
+
+        #region 命令
+
+        public ICommand RobotCycleStartCommand { get; set; }
+  
+        public ICommand RobotCycleAbortCommand { get; set; }
+
+        public ICommand LPChangeCommand { get; set; }
+ 
+        public ICommand AlignerChangeCommand { get; set; }
+        
+        public ICommand PufChangeCommand { get; set; }
+   
+        public ICommand DummyChangeCommand { get; set; }
+        
+        public ICommand SrdChangeCommand { get; set; }
+        #endregion
+
+        /// <summary>
+        /// 构造器
+        /// </summary>
+        public RobotCycleViewModel() 
+        {
+            RobotCycleStartCommand = new DelegateCommand<object>(RobotCycleStartAction);
+            RobotCycleAbortCommand = new DelegateCommand<object>(RobotCycleAbortAction);
+            LPChangeCommand = new DelegateCommand<object>(LPChangeAction);
+            AlignerChangeCommand = new DelegateCommand<object>(AlignerChangeAction);
+            //PufChangeCommand = new DelegateCommand<object>(PufChangeAction);
+            //DummyChangeCommand = new DelegateCommand<object>(DummyChangeAction);
+            //SrdChangeCommand = new DelegateCommand<object>(SrdChangeAction);
+        }
+
+        private void RobotCycleStartAction(object param)
+        {
+            if (!IsDummySelected)
+            {
+                SelectedDummyName = ModuleName.Unknown;
+            }
+            else
+            {
+                if (IsDummy1Checkd)
+                {
+                    SelectedDummyName = ModuleName.Dummy1;
+                }
+                else
+                {
+                    SelectedDummyName = ModuleName.Dummy2;
+                }
+            }
+
+            if (!IsSrdSelected)
+            {
+                SelectedSrdName = ModuleName.Unknown;
+            }
+            else
+            {
+                if (IsSrd1Checkd)
+                {
+                    SelectedSrdName = ModuleName.SRD1;
+                }
+                else
+                {
+                    SelectedSrdName = ModuleName.SRD2;
+                }
+            }
+
+            if (!IsPufSelected)
+            {
+                SelectedPufName = ModuleName.Unknown;
+            }
+            else
+            {
+                SelectedPufName = ModuleName.PUF1;
             }
-            if (!IsPufSelected)
-            {
-                SelectedPufName = ModuleName.Unknown;
-            }
-            if (!IsDummySelected && !IsSrdSelected)
-            {
-                MessageBox.Show("Selected at least on module between srd and dummy!");
-                return;
-            }
-            List<string> sequences = new List<string>();
-            sequences.Add(SelectedLPName.ToString());
+
+
+            if (!IsDummySelected && !IsSrdSelected)
+            {
+                MessageBox.Show("Selected at least on module between srd and dummy!");
+                return;
+            }
+            List<string> sequences = new List<string>();
+            sequences.Add(SelectedLPName.ToString());
             sequences.Add(SelectedAlignerName.ToString());
             if (SelectedPufName != ModuleName.Unknown)
             {
                 sequences.Add(SelectedPufName.ToString());
-            }
+            }
             if (SelectedSrdName != ModuleName.Unknown)
             {
                 sequences.Add(SelectedSrdName.ToString());
-            }
+            }
             if (SelectedDummyName != ModuleName.Unknown)
             {
                 sequences.Add(SelectedDummyName.ToString());
-            }
-            InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.RobotCycle}",string.Join("-",sequences), InPutCycleTimes, InPutAlignDegree);
-        }
-        private void RobotCycleAbortAction(object param)
-        {
-            InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
-        }
-        private void LPChangeAction(object param)
-        {
-            if ("LP1".Equals((string)param))
-            {
-                SelectedLPName = ModuleName.LP1;
-            }
-            else if ("LP2".Equals((string)param))
-            {
-                SelectedLPName = ModuleName.LP2;
-            }
-            else
-            {
-                SelectedLPName = ModuleName.LP3;
-            }
-            
-        }
-        private void AlignerChangeAction(object param)
-        {
-            
+            }
+            InvokeClient.Instance.Service.DoOperation($"EFEM.{EfemOperation.RobotCycle}",string.Join("-",sequences), InPutCycleTimes, InPutAlignDegree);
+        }
+        private void RobotCycleAbortAction(object param)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName.EfemRobot}.{EfemOperation.Abort}");
         }
-        private void PufChangeAction(object param)
+        private void LPChangeAction(object param)
+        {
+            if ("LP1".Equals((string)param))
+            {
+                SelectedLPName = ModuleName.LP1;
+            }
+            else if ("LP2".Equals((string)param))
+            {
+                SelectedLPName = ModuleName.LP2;
+            }
+            else
+            {
+                SelectedLPName = ModuleName.LP3;
+            }
+            
+        }
+        private void AlignerChangeAction(object param)
+        {
+            
+        }
+        private void PufChangeAction(object param)
         {
 
-        }
-        private void DummyChangeAction(object param)
-        {
-            if ("Dummy1".Equals((string)param))
-            {
-                SelectedDummyName = ModuleName.Dummy1;
-            }
-            else
-            {
-                SelectedDummyName = ModuleName.Dummy2;
-            }
-        }
-        private void SrdChangeAction(object param)
-        {
-            if ("SRD1".Equals((string)param))
-            {
-                SelectedSrdName = ModuleName.SRD1;
-            }
-            else
-            {
-                SelectedSrdName = ModuleName.SRD2;
-            }
-        }
-
-        /// <summary>
-        /// 加载数据
-        /// </summary>
-        public void LoadData(string systemName)
-        {
-            _rtDataKeys.Clear();
-            _rtDataKeys.Add("EFEM.CurrentRobotCycleTime");
-            if (_timer == null)
-            {
-                _timer = new DispatcherTimer();
-                _timer.Interval = TimeSpan.FromMilliseconds(200);
-                _timer.Tick += Timer_Tick;
-            }
-            _timer.Start();
-        }
-
-        /// <summary>
-        /// 定时器执行
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void Timer_Tick(object sender, EventArgs e)
-        {
-            if (_rtDataKeys.Count != 0)
-            {
-                _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
-                if (_rtDataValueDic != null)
-                {
-                    CurrentCycle = CommonFunction.GetValue<int>(_rtDataValueDic, $"EFEM.CurrentRobotCycleTime");
-                }
-
-            }
-
-        }
-        /// <summary>
-        /// 隐藏
-        /// </summary>
-        public void Hide()
-        {
-
-        }
-    }
-}
+        }
+        private void DummyChangeAction(object param)
+        {
+            if ("Dummy1".Equals((string)param))
+            {
+                SelectedDummyName = ModuleName.Dummy1;
+            }
+            else
+            {
+                SelectedDummyName = ModuleName.Dummy2;
+            }
+        }
+        private void SrdChangeAction(object param)
+        {
+            if ("SRD1".Equals((string)param))
+            {
+                SelectedSrdName = ModuleName.SRD1;
+            }
+            else
+            {
+                SelectedSrdName = ModuleName.SRD2;
+            }
+        }
+
+        /// <summary>
+        /// 加载数据
+        /// </summary>
+        public void LoadData(string systemName)
+        {
+            _rtDataKeys.Clear();
+            _rtDataKeys.Add("EFEM.CurrentRobotCycleTime");
+            if (_timer == null)
+            {
+                _timer = new DispatcherTimer();
+                _timer.Interval = TimeSpan.FromMilliseconds(200);
+                _timer.Tick += Timer_Tick;
+            }
+            _timer.Start();
+        }
+
+        /// <summary>
+        /// 定时器执行
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void Timer_Tick(object sender, EventArgs e)
+        {
+            if (_rtDataKeys.Count != 0)
+            {
+                _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
+                if (_rtDataValueDic != null)
+                {
+                    CurrentCycle = CommonFunction.GetValue<int>(_rtDataValueDic, $"EFEM.CurrentRobotCycleTime");
+                }
+
+            }
+
+        }
+        /// <summary>
+        /// 隐藏
+        /// </summary>
+        public void Hide()
+        {
+
+        }
+    }
+}

+ 8 - 24
CyberX8_MainPages/Views/RobotCycleView.xaml

@@ -72,19 +72,11 @@
 
             <GroupBox Header="Dummy Select" FontSize="14" FontWeight="Bold"  Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" IsEnabled="{Binding IsDummySelected}">
                 <Grid>
-                    <RadioButton  Content="Dummy1"  x:Name="dummy1" IsChecked="True" Margin="215,0,0,0" FontSize="19" VerticalContentAlignment="Center" HorizontalAlignment="Left">
-                        <i:Interaction.Triggers>
-                            <i:EventTrigger EventName="Checked">
-                                <i:InvokeCommandAction Command="{Binding DummyChangeCommand}" CommandParameter="{Binding ElementName=dummy1,Path=Content}"/>
-                            </i:EventTrigger>
-                        </i:Interaction.Triggers>
+                    <RadioButton  Content="Dummy1"  x:Name="dummy1" IsChecked="{Binding IsDummy1Checkd,Mode=TwoWay}" Margin="215,0,0,0" FontSize="19" VerticalContentAlignment="Center" HorizontalAlignment="Left">
+                
                     </RadioButton>
-                    <RadioButton  Content="Dummy2"  x:Name="dummy2" IsChecked="False" Margin="300,0,0,0" FontSize="19" VerticalContentAlignment="Center" HorizontalAlignment="Center">
-                        <i:Interaction.Triggers>
-                            <i:EventTrigger EventName="Checked">
-                                <i:InvokeCommandAction Command="{Binding DummyChangeCommand}" CommandParameter="{Binding ElementName=dummy2,Path=Content}"/>
-                            </i:EventTrigger>
-                        </i:Interaction.Triggers>
+                    <RadioButton  Content="Dummy2"  x:Name="dummy2" IsChecked="{Binding IsDummy2Checkd,Mode=TwoWay}" Margin="300,0,0,0" FontSize="19" VerticalContentAlignment="Center" HorizontalAlignment="Center">
+              
                     </RadioButton>
                 </Grid>
             </GroupBox>
@@ -92,19 +84,11 @@
                IsChecked="{Binding IsDummySelected,Mode=TwoWay}"/>
             <GroupBox Header="SRD Select" FontSize="14" FontWeight="Bold"  Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" IsEnabled="{Binding IsSrdSelected}">
                 <Grid>
-                    <RadioButton  Content="SRD1"  x:Name="srd1" IsChecked="True" Margin="215,0,0,0" FontSize="19" VerticalContentAlignment="Center" HorizontalAlignment="Left">
-                        <i:Interaction.Triggers>
-                            <i:EventTrigger EventName="Checked">
-                                <i:InvokeCommandAction Command="{Binding SrdChangeCommand}" CommandParameter="{Binding ElementName=srd1,Path=Content}"/>
-                            </i:EventTrigger>
-                        </i:Interaction.Triggers>
+                    <RadioButton  Content="SRD1"  x:Name="srd1" IsChecked="{Binding IsSrd1Checkd,Mode=TwoWay}" Margin="215,0,0,0" FontSize="19" VerticalContentAlignment="Center" HorizontalAlignment="Left">
+             
                     </RadioButton>
-                    <RadioButton  Content="SRD2"  x:Name="srd2" IsChecked="False" Margin="265,0,0,0" FontSize="19" VerticalContentAlignment="Center" HorizontalAlignment="Center">
-                        <i:Interaction.Triggers>
-                            <i:EventTrigger EventName="Checked">
-                                <i:InvokeCommandAction Command="{Binding SrdChangeCommand}" CommandParameter="{Binding ElementName=srd2,Path=Content}"/>
-                            </i:EventTrigger>
-                        </i:Interaction.Triggers>
+                    <RadioButton  Content="SRD2"  x:Name="srd2" IsChecked="{Binding IsSrd2Checkd,Mode=TwoWay}" Margin="265,0,0,0" FontSize="19" VerticalContentAlignment="Center" HorizontalAlignment="Center">
+            
                     </RadioButton>
                 </Grid>
             </GroupBox>

+ 11 - 11
CyberX8_RT/Config/Devices/PowerSupplierCfg.xml

@@ -1,30 +1,30 @@
 <?xml version="1.0" encoding="utf-8"?>
 <PowerSupplierConfig>
-  <PowerSupplierDeviceConfig Name="Power1" IpAddress="10.0.10.101" Port="820" Type="0" SendTimeout="2000" RecvTimeout="2000" > 
-    <Device Name="Power1-1" Address="1" UnitSetScale="1000" UnitScale="10000" />
+  <PowerSupplierDeviceConfig Name="Power1" IpAddress="192.168.0.239" Port="820" Type="1" SendTimeout="2000" RecvTimeout="2000" > 
+    <Device Name="Power1-1" Address="1" VoltageUnitSetScale ="1000" UnitSetScale="1000000" UnitScale="10000"/>
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power2" IpAddress="10.0.10.102" Port="820" Type="1" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="Power2-1" Address="1" UnitSetScale="1000" UnitScale="10000" />
+    <Device Name="Power2-1" Address="1" VoltageUnitSetScale ="1000" UnitSetScale="1000000" UnitScale="10000" />
   </PowerSupplierDeviceConfig>
-  <PowerSupplierDeviceConfig Name="Power3" IpAddress="10.0.10.103" Port="820" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="Power3-1" Address="1" UnitSetScale="1000" UnitScale="10000" />
+  <PowerSupplierDeviceConfig Name="Power3" IpAddress="192.168.0.220" Port="820" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
+    <Device Name="Power3-1" Address="1" VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power4" IpAddress="10.0.10.104" Port="820" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="Power4-1" Address="1" UnitSetScale="1000" UnitScale="10000" />
+    <Device Name="Power4-1" Address="1" VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power5" IpAddress="10.0.10.105" Port="820" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="Power5-1" Address="1" UnitSetScale="1000" UnitScale="10000" />
+    <Device Name="Power5-1" Address="1" VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power6" IpAddress="10.0.10.106" Port="820" Type="0" SendTimeout="2000" RecvTimeout="2000" > 
-    <Device Name="Power6-1" Address="1" UnitSetScale="1000" UnitScale="10000" />
+    <Device Name="Power6-1" Address="1" VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power7" IpAddress="10.0.10.107" Port="820" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="Power7-1" Address="1" UnitSetScale="1000" UnitScale="10000" />
+    <Device Name="Power7-1" Address="1" VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power8" IpAddress="10.0.10.108" Port="820" Type="0" SendTimeout="2000" RecvTimeout="2000" > 
-    <Device Name="Power8-1" Address="1" UnitSetScale="1000" UnitScale="10000" />
+    <Device Name="Power8-1" Address="1" VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="CMMPower1" IpAddress="127.0.10.1"  Port="505" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="CMMPower1-1" Address="2" UnitSetScale="1000" UnitScale="10000" />
+    <Device Name="CMMPower1-1" Address="2" VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" />
   </PowerSupplierDeviceConfig>
 </PowerSupplierConfig>

+ 156 - 154
CyberX8_RT/Modules/EFEM/CycleRobotCycleNewRoutine.cs

@@ -1,80 +1,80 @@
-using Aitex.Core.Common;
-using Aitex.Core.RT.Device;
-using Aitex.Core.RT.Log;
-using Aitex.Core.RT.Routine;
-using Aitex.Core.Util;
-using CyberX8_Core;
-using CyberX8_RT.Devices.AXIS;
-using CyberX8_RT.Devices.EFEM;
-using CyberX8_RT.Modules.LPs;
-using CyberX8_RT.Modules.Rinse;
-using MECF.Framework.Common.Equipment;
-using MECF.Framework.Common.Routine;
-using MECF.Framework.Common.Schedulers;
-using MECF.Framework.Common.SubstrateTrackings;
-using MECF.Framework.Common.Utilities;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace CyberX8_RT.Modules.EFEM
-{
-    public class CycleRobotCycleNewRoutine : ModuleRoutineBase, IRoutine
-    {
-        private enum CycleRobotCycleStep
-        {
-            LoopStart,
-            LoopRunRobotCycle,
-            LoopRunRobotCycleWait,
-            LoopEnd,
-            End
-
-        }
-        /// <summary>
-        /// Cycle次数
-        /// </summary>
-        private int _cycleTimes;
-        /// <summary>
-        /// 当前处于第几次Cycle
-        /// </summary>
-        private int _currentCycle;
-        private RobotCycleMoveRoutine _cycleMoveRoutine;
-        private List<ModuleName> _sequences;
-        private int _alignerAngle;
-        private List<EfemCycleAction> _actions;
-        private int _dummySlotNumber = 25; //当前cycle中的dummy slot 数量
-
-        public CycleRobotCycleNewRoutine(EfemBase efem) : base(ModuleName.EfemRobot)
-        {
-            _cycleMoveRoutine = new RobotCycleMoveRoutine(efem);
-        }
-
-        public RState Start(params object[] objs)
-        {
-            _currentCycle = 0;
-            string str = objs[0].ToString();
-            _sequences = new List<ModuleName>();
+using Aitex.Core.Common;
+using Aitex.Core.RT.Device;
+using Aitex.Core.RT.Log;
+using Aitex.Core.RT.Routine;
+using Aitex.Core.Util;
+using CyberX8_Core;
+using CyberX8_RT.Devices.AXIS;
+using CyberX8_RT.Devices.EFEM;
+using CyberX8_RT.Modules.LPs;
+using CyberX8_RT.Modules.Rinse;
+using MECF.Framework.Common.Equipment;
+using MECF.Framework.Common.Routine;
+using MECF.Framework.Common.Schedulers;
+using MECF.Framework.Common.SubstrateTrackings;
+using MECF.Framework.Common.Utilities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CyberX8_RT.Modules.EFEM
+{
+    public class CycleRobotCycleNewRoutine : ModuleRoutineBase, IRoutine
+    {
+        private enum CycleRobotCycleStep
+        {
+            LoopStart,
+            LoopRunRobotCycle,
+            LoopRunRobotCycleWait,
+            LoopEnd,
+            End
+
+        }
+        /// <summary>
+        /// Cycle次数
+        /// </summary>
+        private int _cycleTimes;
+        /// <summary>
+        /// 当前处于第几次Cycle
+        /// </summary>
+        private int _currentCycle;
+        private RobotCycleMoveRoutine _cycleMoveRoutine;
+        private List<ModuleName> _sequences;
+        private int _alignerAngle;
+        private List<EfemCycleAction> _actions;
+        private int _dummySlotNumber = 25; //当前cycle中的dummy slot 数量
+
+        public CycleRobotCycleNewRoutine(EfemBase efem) : base(ModuleName.EfemRobot)
+        {
+            _cycleMoveRoutine = new RobotCycleMoveRoutine(efem);
+        }
+
+        public RState Start(params object[] objs)
+        {
+            _currentCycle = 0;
+            string str = objs[0].ToString();
+            _sequences = new List<ModuleName>();
             foreach(string item in str.Split('-'))
             {
                 _sequences.Add((ModuleName)Enum.Parse(typeof(ModuleName), item));
-            }
+            }
             if(!CheckRobotCyclePreCondiction(_sequences))
             {
                 return RState.Failed;
-            }
-            _cycleTimes=(int)objs[1];
-            _alignerAngle = (int)objs[2];
-            _actions = new List<EfemCycleAction>();
-            GenerateCycleAction();
-            if (_cycleTimes < 1)
-            {
-                LOG.Write(eEvent.ERR_EFEM_ROBOT, Module, $"Input Robot Cycle Times{_cycleTimes} error");
-                return RState.Failed;
-            }
-            return Runner.Start(Module, "Start CycleRobotCycleRoutine");
-        }
+            }
+            _cycleTimes=(int)objs[1];
+            _alignerAngle = (int)objs[2];
+            _actions = new List<EfemCycleAction>();
+            GenerateCycleAction();
+            if (_cycleTimes < 1)
+            {
+                LOG.Write(eEvent.ERR_EFEM_ROBOT, Module, $"Input Robot Cycle Times{_cycleTimes} error");
+                return RState.Failed;
+            }
+            return Runner.Start(Module, "Start CycleRobotCycleRoutine");
+        }
         private void GenerateCycleAction()
         {
             if (!ModuleHelper.IsLoadPort(_sequences[0]))
@@ -92,16 +92,18 @@ namespace CyberX8_RT.Modules.EFEM
                 _actions.AddRange(GenerateCycle(_sequences[0], item.Slot, _sequences[1], ModuleHelper.IsDummy(_sequences[1]) ? count : 0));
                 for (int i = 1; i < _sequences.Count; i++)
                 {
-                    if (i == 1)
-                    {
-                        _actions.AddRange(GenerateCycle(_sequences[i], ModuleHelper.IsDummy(_sequences[i]) ? count : 0, _sequences[i + 1],
-                            ModuleHelper.IsDummy(_sequences[i + 1]) ? count : 0));
-                    }
-                    else if (i == _sequences.Count - 1)
+                 
+                    if (i == _sequences.Count - 1)
                     {
                         _actions.AddRange(GenerateCycle(_sequences[i], ModuleHelper.IsDummy(_sequences[i]) ? count : 0, _sequences[0],
                             item.Slot));
                     }
+                    //else (i == 1)
+                    else
+                    {
+                        _actions.AddRange(GenerateCycle(_sequences[i], ModuleHelper.IsDummy(_sequences[i]) ? count : 0, _sequences[i + 1],
+                            ModuleHelper.IsDummy(_sequences[i + 1]) ? count : 0));
+                    }
                     if (ModuleHelper.IsDummy(_sequences[i]))
                     {
                         WaferInfo[] dummywaferInfos = WaferManager.Instance.GetWafers(_sequences[i]);
@@ -117,8 +119,8 @@ namespace CyberX8_RT.Modules.EFEM
                     count = 0;
                 }
             }
-        }
-
+        }
+
         private List<EfemCycleAction> GenerateCycle(ModuleName source,int sourceSlot,ModuleName destModule,int destSlot)
         {
             List<EfemCycleAction> actions = new List<EfemCycleAction>();
@@ -144,62 +146,62 @@ namespace CyberX8_RT.Modules.EFEM
             place.Action = "Place";
             actions.Add(place);
             return actions;
-        }
-        public RState Monitor()
-        {
-            Runner.LoopStart(CycleRobotCycleStep.LoopStart, "Loop StartCycleRobotCycleRoutine", _cycleTimes, NullFun, _delay_1ms)
-                .LoopRun(CycleRobotCycleStep.LoopRunRobotCycle, () => _cycleMoveRoutine.Start(_actions) == RState.Running,_delay_1ms)
-                .LoopRunWithStopStatus(CycleRobotCycleStep.LoopRunRobotCycleWait, () => { return CommonFunction.CheckRoutineEndState(_cycleMoveRoutine); },
-                 () => CheckRoutineStopStatus(_cycleMoveRoutine, "CycleRobotCycleRoutine failed"), 86400000)//24小时
-                .LoopEnd(CycleRobotCycleStep.LoopEnd, UpdateCycleCount, _delay_1ms)
-                .End(CycleRobotCycleStep.End, AchievedCycleCount, _delay_1ms);
-            return Runner.Status;
-        }
-
-        private bool CheckRoutineStopStatus(IRoutine routine, string error)
-        {
-            bool result = CommonFunction.CheckRoutineStopState(routine);
-            if (result)
-            {
-                Stop($"{error}");
-            }
-            return result;
-        }
-        
-        /// <summary>
-        /// Abort
-        /// </summary>
-        public void Abort()
-        {
-            Runner.Stop("CycleRobotCycleRoutine Abort");
-        }
-
-        /// <summary>
-        /// 统计完成的Cycle次数
-        /// </summary>
-        /// <returns></returns>
-        private bool UpdateCycleCount()
-        {
-            _currentCycle += 1;
-            return true;
-        }
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <returns></returns>
-        private bool AchievedCycleCount()
-        {
-            _currentCycle -= 1;
-            return true;
-        }
-        /// <summary>
-        /// 获取当前Cycle次数
-        /// </summary>
-        /// <returns></returns>
-        public int GetCurrentCycle()
-        {
-            return _currentCycle;
-        }
+        }
+        public RState Monitor()
+        {
+            Runner.LoopStart(CycleRobotCycleStep.LoopStart, "Loop StartCycleRobotCycleRoutine", _cycleTimes, NullFun, _delay_1ms)
+                .LoopRun(CycleRobotCycleStep.LoopRunRobotCycle, () => _cycleMoveRoutine.Start(_actions) == RState.Running,_delay_1ms)
+                .LoopRunWithStopStatus(CycleRobotCycleStep.LoopRunRobotCycleWait, () => { return CommonFunction.CheckRoutineEndState(_cycleMoveRoutine); },
+                 () => CheckRoutineStopStatus(_cycleMoveRoutine, "CycleRobotCycleRoutine failed"), 86400000)//24小时
+                .LoopEnd(CycleRobotCycleStep.LoopEnd, UpdateCycleCount, _delay_1ms)
+                .End(CycleRobotCycleStep.End, AchievedCycleCount, _delay_1ms);
+            return Runner.Status;
+        }
+
+        private bool CheckRoutineStopStatus(IRoutine routine, string error)
+        {
+            bool result = CommonFunction.CheckRoutineStopState(routine);
+            if (result)
+            {
+                Stop($"{error}");
+            }
+            return result;
+        }
+        
+        /// <summary>
+        /// Abort
+        /// </summary>
+        public void Abort()
+        {
+            Runner.Stop("CycleRobotCycleRoutine Abort");
+        }
+
+        /// <summary>
+        /// 统计完成的Cycle次数
+        /// </summary>
+        /// <returns></returns>
+        private bool UpdateCycleCount()
+        {
+            _currentCycle += 1;
+            return true;
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        private bool AchievedCycleCount()
+        {
+            _currentCycle -= 1;
+            return true;
+        }
+        /// <summary>
+        /// 获取当前Cycle次数
+        /// </summary>
+        /// <returns></returns>
+        public int GetCurrentCycle()
+        {
+            return _currentCycle;
+        }
         private bool CheckRobotCyclePreCondiction(List<ModuleName> lists)
         {
             bool result = true;
@@ -266,8 +268,8 @@ namespace CyberX8_RT.Modules.EFEM
                 };
             }
             return result;
-        }
-        //检查robot状态
+        }
+        //检查robot状态
         private bool CheckRobotStatus()
         {
             bool result = true;
@@ -277,8 +279,8 @@ namespace CyberX8_RT.Modules.EFEM
                 result =  false;
             }
             return result;
-        }
-        //检查loadport状态
+        }
+        //检查loadport状态
         private bool CheckLoadPortStatus(ModuleName loadpoartName)
         {
             bool result = true;
@@ -309,8 +311,8 @@ namespace CyberX8_RT.Modules.EFEM
         {
             LoadPortModule loadPortModule = Singleton<RouteManager>.Instance.EFEM.GetLoadportModule(station - ModuleName.LP1);
             return loadPortModule.LPDevice;
-        }
-        //Dummy状态判断
+        }
+        //Dummy状态判断
         private bool CheckDummyStatus(ModuleName dummyName)
         {
             bool result = true;
@@ -342,8 +344,8 @@ namespace CyberX8_RT.Modules.EFEM
                 }
             }
             return result;
-        }
-        //检查puf
+        }
+        //检查puf
         private bool CheckPufStatus(ModuleName pufName)
         {
             bool result = true;
@@ -365,19 +367,19 @@ namespace CyberX8_RT.Modules.EFEM
                 return false;
             }
             return result;
-        }
-        //检查srd
+        }
+        //检查srd
         private bool CheckSrdStatus(ModuleName SrdName)
-        { 
-            bool result = true;
+        { 
+            bool result = true;
             if (!ModuleHelper.IsInstalled(SrdName))
             {
                 Stop($"{SrdName} is not install");
                 return false;
-            }
-
-            return result;
-        }
-    }
-}
-
+            }
+
+            return result;
+        }
+    }
+}
+

+ 7 - 1
CyberX8_RT/Modules/EFEM/EfemEntity.cs

@@ -74,7 +74,8 @@ namespace CyberX8_RT.Modules
             ConfirmCompleting,
             ErrorPicking,
             ErrorPlacing,
-            RobotCycleing
+            RobotCycleing,
+            ErrorInitingAL
         }
 
         public enum MSG
@@ -128,6 +129,8 @@ namespace CyberX8_RT.Modules
             ReadTagData,
             WriteTagData,
             RobotCycle
+        
+           
         }
 
         public enum EfemType
@@ -425,6 +428,8 @@ namespace CyberX8_RT.Modules
             // Home Aligner
             Transition(STATE.Idle,          MSG.HomeAL,             fnHomeAligner,      STATE.InitingAL);
             Transition(STATE.InitingAL,     FSM_MSG.TIMER,          fnHomingAlignTimeout,    STATE.Idle);
+            Transition(STATE.Error, MSG.HomeAL, fnHomeAligner, STATE.ErrorInitingAL);
+            Transition(STATE.ErrorInitingAL, FSM_MSG.TIMER, fnHomingAlignTimeout, STATE.Error);
 
             // Pick wafer
             Transition(STATE.Idle,          MSG.Pick,               FnStartPick,        STATE.Picking);
@@ -471,6 +476,7 @@ namespace CyberX8_RT.Modules
             Transition(STATE.Ungripping,    MSG.ActionDone,         fnActionDone,       STATE.Idle);
 
             // Aligner
+
             Transition(STATE.Idle,          MSG.Lift,               fnLift,             STATE.Lifting);
             //Transition(STATE.Lifting,       MSG.LiftActionDone,     fnActionDone,       STATE.Idle);
             Transition(STATE.Lifting,       FSM_MSG.TIMER,          fnLiftTimeout,    STATE.Idle);

+ 1 - 1
CyberX8_RT/Modules/EFEM/RobotCycleMoveRoutine.cs

@@ -79,7 +79,7 @@ namespace CyberX8_RT.Modules.EFEM
                     return _efemPlaceRoutine.Start(placeMoveItems) == RState.Running;
                 case "Align":
                     _currentRoutine = _efemAlignRoutine;
-                    object[] alignerParamater = new object[3];//初始化Align参数
+                    object[] alignerParamater = new object[4];//初始化Align参数
                     alignerParamater[0] = ModuleName.Aligner1;
                     alignerParamater[1] = 0;
                     alignerParamater[2] = action.Parameter;

+ 1 - 1
Framework/Common/Device/PowerSupplier/IPowerSupplierDevice.cs

@@ -77,7 +77,7 @@ namespace MECF.Framework.Common.Device.PowerSupplier
         /// <param name="name"></param>
         /// <param name="channel"></param>
         /// <param name="stepPeriodDatas"></param>
-        bool SetStepPeriod(byte channel, List<PowerSupplierStepPeriodData> stepPeriodDatas, int scale,int? voltageUnitSetScale);
+        bool SetStepPeriod(byte channel, List<PowerSupplierStepPeriodData> stepPeriodDatas, int scale,int voltageUnitSetScale);
         /// <summary>
         /// 启动步阶
         /// </summary>

+ 2 - 2
Framework/Common/Device/PowerSupplier/PowerSupplierDeviceConfigManager.cs

@@ -235,11 +235,11 @@ namespace MECF.Framework.Common.Device.PowerSupplier
         /// <param name="name"></param>
         /// <param name="channel"></param>
         /// <param name="stepPeriodDatas"></param>
-        public bool SetStepPeriod(string name,byte channel,List<PowerSupplierStepPeriodData> stepPeriodDatas,int scale, int? _voltageUnitSetScale)
+        public bool SetStepPeriod(string name,byte channel,List<PowerSupplierStepPeriodData> stepPeriodDatas,int scale, int voltageUnitSetScale)
         {
             if (_nameModbusDeviceDic.ContainsKey(name))
             {
-                return _nameModbusDeviceDic[name].SetStepPeriod(channel, stepPeriodDatas,scale, _voltageUnitSetScale);
+                return _nameModbusDeviceDic[name].SetStepPeriod(channel, stepPeriodDatas,scale, voltageUnitSetScale);
             }
             return false;
         }

+ 3 - 3
Framework/Common/Device/PowerSupplier/PowerSupplierGoldModbusDevice.cs

@@ -124,7 +124,7 @@ namespace MECF.Framework.Common.Device.PowerSupplier
         /// </summary>
         /// <param name="channel"></param>
         /// <param name="stepDatas"></param>
-        public bool SetStepPeriod(byte channel, List<PowerSupplierStepPeriodData> stepDatas, int scale, int? voltageUnitSetScale)
+        public bool SetStepPeriod(byte channel, List<PowerSupplierStepPeriodData> stepDatas, int scale, int voltageUnitSetScale)
         {
             PowerSupplierCommand command = new PowerSupplierCommand();
             command.Channel = channel;
@@ -135,8 +135,8 @@ namespace MECF.Framework.Common.Device.PowerSupplier
             for (int i = 0; i < stepDatas.Count; i++)
             {
                 PowerSupplierStepPeriodData data = stepDatas[i];
-                command.Datas[0 + STEP_PERIOD_LENGTH * i] = (ushort)(Math.Round(data.Voltage * (double)voltageUnitSetScale, 0)/0x10000);
-                command.Datas[1 + STEP_PERIOD_LENGTH * i] = (ushort)(Math.Round(data.Voltage * (double)voltageUnitSetScale, 0) % 0x10000);
+                command.Datas[0 + STEP_PERIOD_LENGTH * i] = (ushort)(Math.Round(data.Voltage * voltageUnitSetScale, 0)/0x10000);
+                command.Datas[1 + STEP_PERIOD_LENGTH * i] = (ushort)(Math.Round(data.Voltage * voltageUnitSetScale, 0) % 0x10000);
                 command.Datas[2 + STEP_PERIOD_LENGTH * i] = (ushort)(Math.Round(data.Current * scale, 0)/0x10000);
                 command.Datas[3 + STEP_PERIOD_LENGTH * i] = (ushort)(Math.Round(data.Current * scale, 0) % 0x10000);
                 command.Datas[4 + STEP_PERIOD_LENGTH * i] = 0;

+ 1 - 1
Framework/Common/Device/PowerSupplier/PowerSupplierModbusDevice.cs

@@ -123,7 +123,7 @@ namespace MECF.Framework.Common.Device.PowerSupplier
         /// </summary>
         /// <param name="channel"></param>
         /// <param name="stepDatas"></param>
-        public bool SetStepPeriod(byte channel, List<PowerSupplierStepPeriodData> stepDatas, int scale,int? voltageUnitSetScale)
+        public bool SetStepPeriod(byte channel, List<PowerSupplierStepPeriodData> stepDatas, int scale,int voltageUnitSetScale)
         {
             PowerSupplierCommand command = new PowerSupplierCommand();
             command.Channel = channel;