浏览代码

update process Module

sangwq 2 年之前
父节点
当前提交
0050803370

+ 100 - 0
Venus/Venus_RT/Devices/JetPM.cs

@@ -98,6 +98,10 @@ namespace Venus_RT.Devices
 
         private readonly SMCChiller _Chiller;
 
+        private readonly RfPowerBase _Generator;
+        private readonly RfPowerBase _GeneratorBias;
+        private readonly RfMatchBase _Match;
+
         private readonly IoSignalTower _SignalTower;
 
         private readonly IoHeater _ForelineTC;
@@ -316,6 +320,28 @@ namespace Venus_RT.Devices
             {
                 _Chiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VenusDevice.Chiller}");
             }
+
+            // RS223 AdTec Generator
+            if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
+                SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
+            {
+                _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.Rf}");
+            }
+
+            // Ethernet Comet Generator Bias
+            if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
+                SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
+                SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
+            {
+                _GeneratorBias = DEVICE.GetDevice<CometRF>($"{Module}.{VenusDevice.BiasRf}");
+            }
+
+            // RS232 AdTec match
+            if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232 &&
+                SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.AdTec)
+            {
+                _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.Match}");
+            }
         }
 
 
@@ -580,5 +606,79 @@ namespace Venus_RT.Devices
         {
             return _Chiller != null && _Chiller.IsRunning && !_Chiller.IsError;
         }
+
+
+        public void SetGeneratorCommunicationMode(int mode)
+        {
+            _Generator?.SetCommunicationMode(mode);
+        }
+
+        public bool GeneratorPowerOn(bool on)
+        {
+            if (_Generator == null) return false;
+
+            if (on && !IsRFGInterlockOn)
+            {
+                EV.PostAlarmLog(Module.ToString(), "射频电源 Interlock条件不满足");
+                return false;
+            }
+
+            return _Generator.SetPowerOnOff(on, out _);
+        }
+
+        public bool GeneratorSetpower(float val)
+        {
+            if (_Generator == null) return false;
+
+            if (Math.Abs(val) > 0.01)
+                _Generator.SetPower((ushort)val);
+            return true;
+        }
+
+        public bool GeneratorBiasPowerOn(bool on)
+        {
+            if (_GeneratorBias == null) return false;
+
+            if (on && !IsRFGInterlockOn)
+            {
+                EV.PostAlarmLog(Module.ToString(), "Bias射频电源 Interlock条件不满足");
+                return false;
+            }
+
+            return _GeneratorBias.SetPowerOnOff(on, out _);
+        }
+
+        public bool GeneratorBiasSetpower(float val)
+        {
+            if (_GeneratorBias == null) return false;
+
+            if (Math.Abs(val) > 0.01)
+                _GeneratorBias.SetPower((ushort)val);
+            return true;
+        }
+
+        public bool GeneratorBiasSetMatchMode(bool val)
+        {
+            if (_GeneratorBias == null) return false;
+            string reason = string.Empty;
+            _GeneratorBias.SetMatchingAutoMode(val, out reason);
+            return true;
+        }
+
+        public bool SetMatchPosition(float c1, float c2)
+        {
+            if (_Match == null) return false;
+            string reason = string.Empty;
+            _Match.SetMatchPosition(c1, c2, out reason);
+            return true;
+        }
+
+        public bool SetBiasMatchPosition(float c1, float c2)
+        {
+            if (_GeneratorBias == null) return false;
+            string reason = string.Empty;
+            _GeneratorBias.SetMatchPosition(c1, c2, out reason);
+            return true;
+        }
     }
 }

+ 187 - 0
Venus/Venus_RT/Modules/PMs/ProcessDefine.cs

@@ -0,0 +1,187 @@
+using System;
+using System.Collections.Generic;
+//using System.
+using Venus_RT.Devices;
+using Venus_RT.Modules;
+using Aitex.Core.Util;
+using Venus_Core;
+//#pragma warning disable 0436
+
+namespace Venus_RT.Modules.PMs
+{
+
+    class ProcessHelper
+    {
+        static protected JetPM Chamber;
+
+        private Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> startHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>
+        {
+            {"PressureUnitByPressureMode",  PressureUnitByPressureMode_Start},
+            {"PressureUnitByValveMode",     PressureUnitByValveMode_Start},
+            {"TCPUnit",                     TCPUnit_Start},
+            {"BiasUnit",                    BiasUnit_Start},
+            {"GasControlUnit",              GasControlUnit_Start },
+            {"ESCHVUnit",                   ESCHVUnit_Start },
+            {"ProcessKitUnit",              ProcessKitUnit_Start },
+        };
+
+        private Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> checkerHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>
+        {
+            {"PressureUnitByPressureMode",  PressureUnitByPressureMode_Check},
+            {"PressureUnitByValveMode",     PressureUnitByValveMode_Check},
+            {"TCPUnit",                     TCPUnit_Check},
+            {"BiasUnit",                    BiasUnit_Check},
+            {"GasControlUnit",              GasControlUnit_Check},
+            {"ESCHVUnit",                   ESCHVUnit_Check},
+            {"ProcessKitUnit",              ProcessKitUnit_Check}
+
+        };
+
+        public ProcessHelper(JetPM pm)
+        {
+            Chamber = pm;
+        }
+
+        static private RState PressureUnitByPressureMode_Start(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as PressureUnitByPressureMode;
+            if (Chamber.SetPVPressure(ProcessUnit.StartPressure))
+            {
+                return RState.Running;
+            }
+
+            return RState.Failed;
+        }
+
+        static private RState PressureUnitByPressureMode_Check(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as PressureUnitByPressureMode;
+            if(ProcessUnit.EnableRamp)
+            {
+                if (Chamber.SetPVPressure(ProcessUnit.StartPressure + (int)((ProcessUnit.TargetPressure - ProcessUnit.StartPressure) * step.RampFactor())))
+                    return RState.Running;
+                else
+                    return RState.Failed;
+            }
+
+            if(step.Type == StepType.Stable && Chamber.ChamberPressure == ProcessUnit.StartPressure)
+            {
+                return RState.End;
+            }
+
+            return RState.Running;
+        }
+
+        static private RState PressureUnitByValveMode_Start(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as PressureUnitByValveMode;
+            if(Chamber.SetPVPostion(ProcessUnit.StartPosition))
+            {
+                return RState.Running;
+            }
+
+            return RState.Failed;
+        }
+
+        static private RState PressureUnitByValveMode_Check(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as PressureUnitByValveMode;
+            if(ProcessUnit.EnableRamp)
+            {
+                if (Chamber.SetPVPostion(ProcessUnit.StartPosition + (int)((ProcessUnit.TargetPosition - ProcessUnit.StartPosition) * step.RampFactor())))
+                    return RState.Running;
+                else
+                    return RState.Failed;
+            }
+
+            return RState.Running;
+        }
+
+        static private RState TCPUnit_Start(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as TCPUnit;
+            return RState.Running;
+        }
+
+        static private RState TCPUnit_Check(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as TCPUnit;
+            return RState.Running;
+        }
+
+        static private RState BiasUnit_Start(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as BiasUnit;
+            return RState.Running;
+        }
+
+        static private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as BiasUnit;
+            return RState.Running;
+        }
+
+        static private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as GasControlUnit;
+            return RState.Running;
+        }
+
+        static private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as GasControlUnit;
+            return RState.Running;
+        }
+
+        static private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as ESCHVUnit;
+            return RState.Running;
+        }
+
+        static private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as ESCHVUnit;
+            return RState.Running;
+        }
+
+        static private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as ProcessKitUnit;
+            return RState.Running;
+        }
+
+        static private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
+        {
+            var ProcessUnit = unit as ProcessKitUnit;
+            return RState.Running;
+        }
+
+        public bool LoadMethods(ProcessUnitBase unit)
+        {
+            var className = unit.GetType().Name;
+            if(startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className))
+            {
+                unit.starter = startHelper[className];
+                unit.checker = checkerHelper[className];
+
+                return true;
+            }
+
+            return false;
+        }
+    }
+
+    public class test
+    {
+        test()
+        {
+            //PressureUnitByPressureMode mode = new PressureUnitByPressureMode();
+            //mode.Start();
+            //mode.Run();
+            //mode.
+           
+        }
+    }
+
+}

+ 160 - 0
Venus/Venus_RT/Modules/PMs/RFPowerSwitchRoutine.cs

@@ -0,0 +1,160 @@
+using Aitex.Core.RT.Routine;
+using Aitex.Core.RT.SCCore;
+using Venus_RT.Devices;
+using MECF.Framework.Common.Routine;
+using Venus_Core;
+using Aitex.Core.Common.DeviceData;
+using System;
+
+namespace Venus_RT.Modules.PMs
+{
+    class RFPowerSwitchRoutine : PMRoutineBase, IRoutine
+    {
+        enum RFPowerStep
+        {
+            kSetPower,
+            kEnd,
+        }
+        private bool _bOn = true;
+        private bool _enableBias;
+        private double _rfPower;
+        private double _rfPowerBias;
+        private BiasRfMatchMode _matchMode;
+        private double _matchC1;
+        private double _matchC2;
+        private int _rfPowerOnTime;
+        public RFPowerSwitchRoutine(JetPM chamber, bool bOn) : base(chamber)
+        {
+            Name = "RF Power Switch";
+            _bOn = bOn;
+        }
+
+        public RState Start(params object[] objs)
+        {
+            if (!_chamber.IsFastPumpOpened)
+            {
+                Stop("Pump 阀没有打开");
+                return RState.Failed;
+            }
+
+            _enableBias = SC.GetValue<bool>($"{_chamber.Module}.BiasRf.EnableBiasRF");
+            if (_bOn)
+            {
+                if (objs == null || objs.Length < 3)
+                {
+                    Stop("RF routine argument error");
+                    return RState.Failed;
+                }
+
+                _rfPower = Convert.ToDouble(objs[0]);
+                _rfPowerBias = Convert.ToDouble(objs[1]);
+                _rfPowerOnTime = (int)Convert.ToDouble(objs[2]) * 1000;
+                _matchMode = Convert.ToInt32(objs[3]) == 1 ? BiasRfMatchMode.Preset : BiasRfMatchMode.Hold;
+                _matchC1 = Convert.ToDouble(objs[4]);
+                _matchC2 = Convert.ToDouble(objs[5]);
+            }
+            else
+            {
+                _rfPower = 0.0;
+                _rfPowerBias = 0.0;
+                _matchMode = BiasRfMatchMode.Preset;
+                _matchC1 = 0.0;
+                _matchC2 = 0.0;
+                _rfPowerOnTime = 2000;
+            }
+
+            return Runner.Start(Module, Name);
+        }
+        public RState Monitor()
+        {
+            Runner.Run((int)RFPowerStep.kSetPower,  SetRFPower,         _rfPowerOnTime)
+                .End((int)RFPowerStep.kEnd,         RFPowerFinished,    _delay_1s);
+
+            return Runner.Status;
+        }
+
+        private bool SetRFPower()
+        {
+            if(_bOn)
+            {
+                if (_enableBias)
+                    Notify($"放电开始, 源射频设定值 {_rfPower}, 偏压射频设定值 {_rfPowerBias}");
+                else
+                    Notify($"放电开始, 源射频设定值 {_rfPower}");
+
+                if (Math.Abs(_rfPower) > 0.01 && Math.Abs(_rfPowerBias) > 0.01)
+                {
+                    _chamber.GeneratorSetpower((float)_rfPower);
+                    _chamber.GeneratorBiasSetpower((float)_rfPowerBias);
+                    if (_matchMode == BiasRfMatchMode.Preset)
+                    {
+                        _chamber.GeneratorBiasSetMatchMode(true);
+                        Notify($"Bias RF Match C1设定值 {_matchC1}, Bias RF Match C2设定值 {_matchC2}");
+                        _chamber.SetBiasMatchPosition((float)_matchC1, (float)_matchC2);
+                    }
+                    else if (_matchMode == BiasRfMatchMode.Hold)
+                    {
+                        _chamber.GeneratorBiasSetMatchMode(false);
+                    }
+                    return _chamber.GeneratorPowerOn(true) && _chamber.GeneratorBiasPowerOn(true);
+                }
+                else if (Math.Abs(_rfPower) < 0.01 && Math.Abs(_rfPowerBias) > 0.01)
+                {
+                    if (_matchMode == BiasRfMatchMode.Preset)
+                    {
+                        _chamber.GeneratorBiasSetMatchMode(true);
+                        Notify($"Bias RF Match C1设定值 {_matchC1}, Bias RF Match C2设定值 {_matchC2}");
+                        _chamber.SetBiasMatchPosition((float)_matchC1, (float)_matchC2);
+                    }
+                    else if (_matchMode == BiasRfMatchMode.Hold)
+                    {
+                        _chamber.GeneratorBiasSetMatchMode(false);
+                    }
+                    _chamber.GeneratorBiasSetpower((float)_rfPowerBias);
+                    return _chamber.GeneratorBiasPowerOn(true);
+                }
+                else if (Math.Abs(_rfPower) > 0.01 && Math.Abs(_rfPowerBias) < 0.01)
+                {
+                    _chamber.GeneratorSetpower((float)_rfPower);
+                    return _chamber.GeneratorPowerOn(true);
+                }
+                else
+                {
+                    Notify("放电结束");
+                    return false;
+                }
+            }
+            else
+            {
+                Notify("放电停止");
+                if (!_enableBias)
+                    return _chamber.GeneratorPowerOn(false);
+                return _chamber.GeneratorPowerOn(false) && _chamber.GeneratorBiasPowerOn(false);
+            }
+        }
+
+        private bool RFPowerFinished()
+        {
+            if(_bOn)
+            {
+                Notify("放电结束");
+
+                _chamber.StopAllGases();
+                _chamber.OpenValve(ValveType.GasFinal, false);
+                _chamber.GeneratorPowerOn(false);
+                _chamber.GeneratorBiasPowerOn(false);
+            }
+
+            return true;
+        }
+
+
+        public void Abort()
+        {
+            _chamber.GeneratorSetpower(0);
+            _chamber.GeneratorBiasSetpower(0);
+            _chamber.GeneratorPowerOn(false);
+            _chamber.GeneratorBiasPowerOn(false);
+        }
+    }
+}

+ 1 - 0
Venus/Venus_RT/Venus_RT.csproj

@@ -152,6 +152,7 @@
     <Compile Include="Modules\PMs\PMRoutineBase.cs" />
     <Compile Include="Modules\PMs\ProcessUnitDefine.cs" />
     <Compile Include="Modules\PMs\PumpDownRoutine.cs" />
+    <Compile Include="Modules\PMs\RFPowerSwitchRoutine.cs" />
     <Compile Include="Modules\PMs\StartDryPumpRoutine.cs" />
     <Compile Include="Modules\PMs\StartTurboPumpRoutine.cs" />
     <Compile Include="Modules\PMs\VentRoutine.cs" />