瀏覽代碼

releated power supply and simulator

chenzk 1 月之前
父節點
當前提交
8c714316dc

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

@@ -10,6 +10,7 @@ using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 
 namespace MECF.Framework.Common.Device.PowerSupplier
@@ -152,7 +153,7 @@ 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 * scale,0);
+                command.Datas[0 + STEP_PERIOD_LENGTH * i] = (ushort)Math.Round(data.Voltage * voltageUnitSetScale, 0);
                 command.Datas[1 + STEP_PERIOD_LENGTH * i] = (ushort)Math.Round(stepDatas[i].Current * scale, 0);
                 command.Datas[2 + STEP_PERIOD_LENGTH * i] = stepDatas[i].Hour;
                 command.Datas[3 + STEP_PERIOD_LENGTH * i] = stepDatas[i].Minute;

+ 10 - 1
PunkHPX8_RT/Config/Devices/PowerSupplierCfg-Simulator.xml

@@ -16,7 +16,16 @@
     <Device Name="Power2-1" Address="1"  VoltageUnitSetScale ="1000" UnitSetScale="1000000" UnitScale="1000000" VoltageUnitScale="10000"/>
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power3" IpAddress="192.168.0.200" Port="20" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
-    <Device Name="Power3-1" Address="1"  VoltageUnitSetScale ="1000" UnitSetScale="10000" UnitScale="10000" VoltageUnitScale="10000"/>
+    <Device Name="Power3-1" Address="1"  
+			VoltageUnitSetScale ="1000"
+			VoltageUnitScale="100"
+            HighGradeCurrentSetScale="1000" 
+            HighGradeCurrentScale="1000" 
+			MiddleGradeCurrentSetScale="100000"
+			MiddleGradeCurrentScale="100000"
+			LowGradeCurrentSetScale="1000000"
+			LowGradeCurrentScale="1000000"
+            />
   </PowerSupplierDeviceConfig>
   <PowerSupplierDeviceConfig Name="Power4" IpAddress="127.0.0.1" Port="823" Type="0" SendTimeout="2000" RecvTimeout="2000"> 
     <Device Name="Power4-1" Address="1"  VoltageUnitSetScale ="1000" UnitSetScale="1000" UnitScale="10000" VoltageUnitScale="10000"/>

+ 0 - 1
PunkHPX8_RT/Config/System.sccfg

@@ -79,7 +79,6 @@
 		<config default="false" name="IsLoadPort1Unable" nameView="Is LoadPort1 Unable" description="LP1是否无法使用" max="" min="" paramter="" tag="" unit="" type="Bool" />
 		<config default="false" name="IsLoadPort2Unable" nameView="Is LoadPort2 Unable" description="LP2是否无法使用" max="" min="" paramter="" tag="" unit="" type="Bool" />
 		<config default="false" name="IsLoadPort3Unable" nameView="Is LoadPort3 Unable" description="LP3是否无法使用" max="" min="" paramter="" tag="" unit="" type="Bool" />
-		<config default="false" name="IsLoadPort3Unable" nameView="Is LoadPort3 Unable" description="LP3是否无法使用" max="" min="" paramter="" tag="" unit="" type="Bool" />
 		<config default="-500" name="ChuckVacuumIsValid" nameView="ChuckVacuumIsValid" description="EFEM is invalid when vacuum level is less than this value" max="0" min="-1000" paramter="" tag="" unit="mmHg" type="Double" />
 		<config default="0" name="AlignerOffsetAngle" nameView="Aligner Offset Angle" description="Aligner Offset Angle" max="360" min="0" paramter="" tag="" unit="deg" type="Integer" />
 		

+ 7 - 4
PunkHPX8_RT/Devices/PowerSupplier/CellPowerSupplier.cs

@@ -627,9 +627,11 @@ namespace PunkHPX8_RT.Devices.PowerSupplier
             byte grade = (byte)args[0];
             PowerSupplierDeviceConfigManager.Instance.SetPowerRunmodelControl(Module, _channel, (byte)PowerRunModelEnum.Normal);
             bool result = PowerSupplierDeviceConfigManager.Instance.SetPowerGrade(Module, _channel, grade);
-            _readCommandList.Enqueue(POWER_GRADE);
-            _readCommandList.Enqueue(POWER_RUN_MODEL);
-            return true;
+            if (result) //挡位设置成功则默认当前挡位
+            {
+                PowerSupplierData.PowerGrade = grade;
+            }
+            return result;
         }
         /// <summary>
         /// 启动
@@ -849,11 +851,12 @@ namespace PunkHPX8_RT.Devices.PowerSupplier
         private void SetPowerCCStatus()
         {
             _readCommandList.Enqueue(POWER_STATUS);
+            _readCommandList.Enqueue(POWER_GRADE);
             _readCommandList.Enqueue(SET_POINT);
             _readCommandList.Enqueue(ENABLED);
             _readCommandList.Enqueue(POWER_CONTROL);
             _readCommandList.Enqueue(POWER_RUN_MODEL);
-            _readCommandList.Enqueue(POWER_GRADE);
+        
         }
         #endregion
 

+ 1 - 157
PunkHPX8_RT/Modules/Reservoir/DMReservoirInitializeRoutine.cs

@@ -159,34 +159,7 @@ namespace PunkHPX8_RT.Modules.Reservoir
             }
             return false;
         }
-        /// <summary>
-        /// 启用HED
-        /// </summary>
-        /// <returns></returns>
-        private bool EnableHED()
-        {
-            return _temperatureController.EnableOperation("", null);
-        }
-        /// <summary>
-        /// 检验所有Metal处于Manual
-        /// </summary>
-        /// <returns></returns>
-        private bool CheckAutoAndAllMetalAuto()
-        {
-            //if (_reservoirDevice.OperationMode != AUTO)
-            //{
-            //    return false;
-            //}
-            //for (int i = 0; i < _metalDevices.Count; i++)
-            //{
-            //    CompactMembranMetalDevice hotMetalDevice = _metalDevices[i];
-            //    if (hotMetalDevice.OperationMode != AUTO)
-            //    {
-            //        return false;
-            //    }
-            //}
-            return true;
-        }
+       
         /// <summary>
         /// 自动HED On
         /// </summary>
@@ -231,135 +204,6 @@ namespace PunkHPX8_RT.Modules.Reservoir
             return true;
         }
         /// <summary>
-        /// 检验Metal A/B PowerSupplier通信状态
-        /// </summary>
-        /// <returns></returns>
-        private bool AutoMetalsPowerSupplierCommuncationStatus()
-        {
-            //for (int i = 0; i < _metalDevices.Count; i++)
-            //{
-            //    CompactMembranMetalDevice hotMetalDevice = _metalDevices[i];
-            //    if (hotMetalDevice.IsAuto)
-            //    {
-            //        if (hotMetalDevice.SideAPowerSupplier == null)
-            //        {
-            //            LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Side A PowerSupplier is null");
-            //            return false;
-            //        }
-            //        if (hotMetalDevice.SideBPowerSupplier == null)
-            //        {
-            //            LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Side B PowerSupplier is null");
-            //            return false;
-            //        }
-            //        if (!hotMetalDevice.SideAPowerSupplier.IsConnected)
-            //        {
-            //            LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Side A PowerSupplier {hotMetalDevice.SideAPowerSupplier.Name} is not connected");
-            //            return false;
-            //        }
-            //        if (!hotMetalDevice.SideBPowerSupplier.IsConnected)
-            //        {
-            //            LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Side B PowerSupplier {hotMetalDevice.SideBPowerSupplier.Name} is not connected");
-            //            return false;
-            //        }
-            //    }
-            //}
-            return true;
-        }
-        /// <summary>
-        /// Auto Metal reset linmot
-        /// </summary>
-        /// <returns></returns>
-        private bool AutoMetalResetLinmot()
-        {
-            //for (int i = 0; i < _metalDevices.Count; i++)
-            //{
-            //    CompactMembranMetalDevice hotMetalDevice = _metalDevices[i];
-
-            //    if (hotMetalDevice.OperationMode == AUTO)
-            //    {
-            //        bool result = hotMetalDevice.ResetLinmot();
-            //        if (!result)
-            //        {
-            //            LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Reset linmot error");
-            //            return false;
-            //        }
-            //    }
-            //}
-            return true;
-        }
-        /// <summary>
-        /// Auto Metal reset linmot
-        /// </summary>
-        /// <returns></returns>
-        private bool CheckAutoMetalResetStatus()
-        {
-            //if (_reservoirDevice.OperationMode == MANUAL)
-            //{
-            //    return true;
-            //}
-            //for (int i = 0; i < _metalDevices.Count; i++)
-            //{
-            //    CompactMembranMetalDevice metalDevice = _metalDevices[i];
-
-            //    if (metalDevice.OperationMode == AUTO)
-            //    {
-            //        bool result = metalDevice.CheckLinmotRoutineEnd();
-            //        if (!result)
-            //        {
-            //            return false;
-            //        }
-            //    }
-            //}
-            return true;
-        }
-
-
-        /// <summary>
-        /// Auto Metal reset linmot
-        /// </summary>
-        /// <returns></returns>
-        private bool CheckAutoMetalResetStopStatus()
-        {
-            //if (_reservoirDevice.OperationMode == MANUAL)
-            //{
-            //    return false;
-            //}
-            //for (int i = 0; i < _metalDevices.Count; i++)
-            //{
-            //    CompactMembranMetalDevice hotMetalDevice = _metalDevices[i];
-
-            //    if (hotMetalDevice.OperationMode == AUTO)
-            //    {
-            //        bool result = hotMetalDevice.CheckLinmotRoutineError();
-            //        if (result)
-            //        {
-            //            return true;
-            //        }
-            //    }
-            //}
-            return false;
-        }
-        /// Metal WS Unclamp
-        /// </summary>
-        /// <returns></returns>
-        private bool MetalsWHUnclampOn()
-        {
-            //for (int i = 0; i < _metalDevices.Count; i++)
-            //{
-            //    CompactMembranMetalDevice hotMetalDevice = _metalDevices[i];
-            //    if (hotMetalDevice != null && !hotMetalDevice.IsDisable)
-            //    {
-            //        bool result = hotMetalDevice.WaferHolderUnclampOn("", null);
-            //        if (!result)
-            //        {
-            //            return false;
-            //        }
-            //    }
-            //}
-            //_reservoirDevice.InitializeCrossDose(true);
-            return true;
-        }
-        /// <summary>
         /// 清除alarm界面相关的dataerror
         /// </summary>
         private bool ClearAlarmDataError()

+ 14 - 13
PunkHPX8_Simulator/Devices/PowerSupplierSocketSimulator.cs

@@ -52,7 +52,7 @@ namespace PunkHPX8_Simulator.Devices
         private int _currentLength = 0;
         private DateTime _currentTime = DateTime.Now;
         private bool _isGoldPower = false;
-        private int _currentSetScale;
+        private int _currentSetScale= 1000;
 
         private int _highSetScale=1000;
         private int _middleSetScale=100000;
@@ -69,7 +69,8 @@ namespace PunkHPX8_Simulator.Devices
         {
             PowerSupplierData powerSupplierData1 = new PowerSupplierData();
             powerSupplierData1.Current = 0;
-            powerSupplierData1.Voltage = 56000;
+            powerSupplierData1.CurrentSetting = 0;
+            powerSupplierData1.Voltage = 560;
             _powerSupplierDic[1] = powerSupplierData1;
 
             PowerSupplierData powerSupplierData2 = new PowerSupplierData();
@@ -160,7 +161,7 @@ namespace PunkHPX8_Simulator.Devices
                 }
                 else
                 {
-                    _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[_currentStep].Current * _currentSetScale);
+                    _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[_currentStep].Current);
                 }
             }
         }
@@ -270,8 +271,8 @@ namespace PunkHPX8_Simulator.Devices
                                 _powerSupplierDic[channel].Current = count / _currentSetScale;
                             }
                             else
-                            {
-                                _powerSupplierDic[channel].Current = _powerSupplierDic[channel].CurrentSetting * _currentSetScale;
+                            { 
+                                _powerSupplierDic[channel].Current = _powerSupplierDic[channel].CurrentSetting; 
                             }
                         }
                     }
@@ -282,7 +283,7 @@ namespace PunkHPX8_Simulator.Devices
                 }
                 else if (startAddress == 0x0101)
                 {
-                    UpdateChannelCurrent(flag,channel, command, startAddress, value);
+                    UpdateChannelCurrent(flag,channel, command, startAddress, (ushort)value);
                 }
                 else if (startAddress == POWER_CONTROL_ADDRESS)
                 {
@@ -349,7 +350,7 @@ namespace PunkHPX8_Simulator.Devices
                     _cycle = (byte)byteTransform.TransInt16(data, 17);
                     _currentLength = (_powerSupplierDatas[0].Hour * 3600 + _powerSupplierDatas[0].Minute * 60 +
                         _powerSupplierDatas[0].Second);
-                    _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[0].Current*10);
+                    _powerSupplierDic[1].Current = (int)(_powerSupplierDatas[0].Current);
                     _currentTime = DateTime.Now;
                     _currentStep = 0;
                     _timer.Start();
@@ -362,7 +363,7 @@ namespace PunkHPX8_Simulator.Devices
                     Array.Copy(data, 13, vauleData, 0, 4);
                     _powerSupplierSetPoint = vauleData;
                     int count = byteTransform.TransInt32(vauleData, 0);
-                    UpdateChannelGoldCurrent(flag, channel, command, (short)count);
+                    UpdateChannelGoldCurrent(flag, channel, command, (ushort)count);
                 }
                 else if(startAddress == GOLD_STEP_PERIOD_ADDRESS) //设置步阶数据  32位变量
                 {
@@ -417,12 +418,12 @@ namespace PunkHPX8_Simulator.Devices
             Array.Copy(values,0,bytes, 9, values.Length);
             return bytes;
         }
-        private void UpdateChannelCurrent(short flag,byte channel, byte command, short startAddress, short value)
+        private void UpdateChannelCurrent(short flag,byte channel, byte command, short startAddress, ushort value)
         {
             _powerSupplierDic[channel].CurrentSetting = value;
-            OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, value));
+            OnWriteMessage(CreateWriteResponse(flag, channel, command, startAddress, (short)value));
         }
-        private void UpdateChannelGoldCurrent(short flag, byte channel, byte command, short count)
+        private void UpdateChannelGoldCurrent(short flag, byte channel, byte command, ushort count)
         {
             _powerSupplierDic[channel].CurrentSetting = count;
             OnWriteMessage(CreateMultiWriteResponse(flag, channel, command, 2));
@@ -509,7 +510,7 @@ namespace PunkHPX8_Simulator.Devices
     internal class PowerSupplierData
     {
         private short _voltageSetting;
-        private short _currentSetting;
+        private ushort _currentSetting;
         private byte _outputSwitchControl;
         private int _voltage;
         private int _current;
@@ -523,7 +524,7 @@ namespace PunkHPX8_Simulator.Devices
         private bool _enabled;
         public short VoltageSetting { get { return _voltageSetting; } set { _voltageSetting = value; } }
 
-        public short CurrentSetting { get { return _currentSetting; } set { _currentSetting = value;  } }
+        public ushort CurrentSetting { get { return _currentSetting; } set { _currentSetting = value;  } }
 
         public byte OutputSwitchControl { get { return _outputSwitchControl; } set { _outputSwitchControl = value; } }
 

+ 16 - 1
PunkHPX8_Themes/UserControls/PowerSupplyChannelControl.xaml.cs

@@ -305,7 +305,22 @@ namespace PunkHPX8_Themes.UserControls
 
         private void SetPoint_Click(object sender, RoutedEventArgs e)
         {
-            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SetPoint","TargetPoint",InputSetPoint);
+            if("Low".Equals(PowerGrade) && (InputSetPoint > 0.02 || InputSetPoint < 0))
+            {
+                MessageBox.Show("Current model set value between 0~0.02", "Invaild current set value", MessageBoxButton.OK, MessageBoxImage.Error);
+                return;
+            }
+            if ("Middle".Equals(PowerGrade) && (InputSetPoint > 0.6 || InputSetPoint < 0))
+            {
+                MessageBox.Show("Current model set value between 0~0.6", "Invaild current set value", MessageBoxButton.OK, MessageBoxImage.Error);
+                return;
+            }
+            if ("High".Equals(PowerGrade) && (InputSetPoint > 20 || InputSetPoint < 0))
+            {
+                MessageBox.Show("Current model set value between 0~20", "Invaild current set value", MessageBoxButton.OK, MessageBoxImage.Error);
+                return;
+            }
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SetPoint", "TargetPoint", InputSetPoint);
         }
         /// <summary>
         /// 启动