123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- using System;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using JetVirgoPM.Devices;
- namespace JetVirgoPM.PMs.Routines
- {
- class RfPowerRoutine : PMRoutineBase, IStepRoutine
- {
- private enum RoutineStep
- {
- kRFPowerOn,
- kRFPowerOFF,
- MatchOn,
- End,
- };
- private readonly bool _ON;
- private R_TRIG _rf1TimeoutTrig = new R_TRIG();
- private R_TRIG _rf2TimeoutTrig = new R_TRIG();
- public bool EnableRF1 => Math.Abs(_rf1PowerOnTime) > 0.01;
- public bool EnableRF2 => Math.Abs(_rf2PowerOnTime) > 0.01;
- private bool _enableBias1;
- private double _rf1Power;
- private double _rf1PowerBias;
- private BiasRfMatchMode _match1Mode;
- private double _match1C1;
- private double _match1C2;
- private double _rf1PowerOnTime;
- private bool _enableBias2;
- private double _rf2Power;
- private double _rf2PowerBias;
- private BiasRfMatchMode _match2Mode;
- private double _match2C1;
- private double _match2C2;
- private double _rf2PowerOnTime;
- public RfPowerRoutine(JetDualPM chamber, bool bON) : base(chamber)
- {
- Name = "RF Power";
- _ON = bON;
- }
- public RState Start(params object[] objs)
- {
- if (!_chamber.IsFastPumpOpened)
- {
- Stop("Pump 阀没有打开");
- return RState.Failed;
- }
- if (_ON && _chamber.TotalGasSetpoint <= 0)
- {
- Stop("No gas flowing for RF power on");
- return RState.Failed;
- }
- Reset();
- _enableBias1 = SC.GetValue<bool>($"{_chamber.Module}.BiasRf1.EnableBiasRF");
- _enableBias2 = SC.GetValue<bool>($"{_chamber.Module}.BiasRf2.EnableBiasRF");
- if (_ON)
- {
- if (objs == null || objs.Length < 12)
- throw new ArgumentException("RF routine argument error");
- _rf1Power = Convert.ToDouble(objs[0]);
- _rf1PowerBias = Convert.ToDouble(objs[1]);
- _rf1PowerOnTime = Convert.ToDouble(objs[2]);
- _match1Mode = objs[3].ToString() == "Preset" ? BiasRfMatchMode.Preset : BiasRfMatchMode.Hold;
- _match1C1 = Convert.ToDouble(objs[4]);
- _match1C2 = Convert.ToDouble(objs[5]);
- _rf2Power = Convert.ToDouble(objs[6]);
- _rf2PowerBias = Convert.ToDouble(objs[7]);
- _rf2PowerOnTime = Convert.ToDouble(objs[8]);
- _match2Mode = objs[9].ToString() == "Preset" ? BiasRfMatchMode.Preset : BiasRfMatchMode.Hold;
- _match2C1 = Convert.ToDouble(objs[10]);
- _match2C2 = Convert.ToDouble(objs[11]);
- }
- else
- {
- _rf1Power = 0.0;
- _rf1PowerBias = 0.0;
- _match1Mode = BiasRfMatchMode.Preset;
- _match1C1 = 0.0;
- _match1C2 = 0.0;
- _rf1PowerOnTime = 0.0;
- _rf2Power = 0.0;
- _rf2PowerBias = 0.0;
- _match2Mode = BiasRfMatchMode.Preset;
- _match2C1 = 0.0;
- _match2C2 = 0.0;
- _rf2PowerOnTime = 0.0;
- }
- return Runner.Start(_chamber.Module.ToString(), Name);
- }
- public RState Monitor()
- {
- if (_ON)
- {
- Runner.Run(RoutineStep.kRFPowerOn, RFPowerOn, CheckRFPowerOn, Math.Max((int)_rf1PowerOnTime, (int)_rf2PowerOnTime) * 1000)
- .End(RoutineStep.End, EndFunc, _delay_0s);
- }
- else
- {
- Runner.Run(RoutineStep.kRFPowerOFF, RFPowerOFF, CheckRFPowerOff, 2000)
- .End(RoutineStep.End, EndFunc, _delay_0s);
- }
- return Runner.Status;
- }
- bool RFPowerOn()
- {
- if (!EnableRF1 && !EnableRF2)
- {
- Notify($"放电结束");
- return false;
- }
- if (EnableRF1)
- {
- if (_enableBias1)
- Notify($"放电开始, 源射频1设定值 {_rf1Power}, 偏压射频1设定值 {_rf1PowerBias}");
- else
- Notify($"放电开始, 源射频1设定值 {_rf1Power}");
- if (Math.Abs(_rf1Power) > 0.01 && Math.Abs(_rf1PowerBias) > 0.01)
- {
- _chamber.Generator1Setpower((float)_rf1Power);
- _chamber.GeneratorBias1Setpower((float)_rf1PowerBias);
- if (_match1Mode == BiasRfMatchMode.Preset)
- {
- _chamber.GeneratorBias1SetMatchMode(true);
- Notify($"Bias RF 1 Match C1设定值 {_match1C1}, Bias RF 1 Match C2设定值 {_match1C2}");
- _chamber.SetBias1MatchPosition((float)_match1C1, (float)_match1C2);
- }
- else if (_match1Mode == BiasRfMatchMode.Hold)
- {
- _chamber.GeneratorBias1SetMatchMode(false);
- }
- _chamber.Generator1PowerOn(true);
- _chamber.GeneratorBias1PowerOn(true);
- }
- else if (Math.Abs(_rf1Power) < 0.01 && Math.Abs(_rf1PowerBias) > 0.01)
- {
- if (_match1Mode == BiasRfMatchMode.Preset)
- {
- _chamber.GeneratorBias1SetMatchMode(true);
- Notify($"Bias RF 1 Match C1设定值 {_match1C1}, Bias RF 1 Match C2设定值 {_match1C2}");
- _chamber.SetBias1MatchPosition((float)_match1C1, (float)_match1C2);
- }
- else if (_match1Mode == BiasRfMatchMode.Hold)
- {
- _chamber.GeneratorBias1SetMatchMode(false);
- }
- _chamber.GeneratorBias1Setpower((float)_rf1PowerBias);
- _chamber.GeneratorBias1PowerOn(true);
- }
- else if (Math.Abs(_rf1Power) > 0.01 && Math.Abs(_rf1PowerBias) < 0.01)
- {
- _chamber.Generator1Setpower((float)_rf1Power);
- _chamber.Generator1PowerOn(true);
- }
- }
- if (EnableRF2)
- {
- if (_enableBias2)
- Notify($"放电开始, 源射频2设定值 {_rf2Power}, 偏压射频2设定值 {_rf2PowerBias}");
- else
- Notify($"放电开始, 源射频2设定值 {_rf2Power}");
- if (Math.Abs(_rf2Power) > 0.01 && Math.Abs(_rf2PowerBias) > 0.01)
- {
- _chamber.Generator2Setpower((float)_rf2Power);
- _chamber.GeneratorBias2Setpower((float)_rf2PowerBias);
- if (_match2Mode == BiasRfMatchMode.Preset)
- {
- _chamber.GeneratorBias2SetMatchMode(true);
- Notify($"Bias RF 2 Match C1设定值 {_match2C1}, Bias RF 2 Match C2设定值 {_match2C2}");
- _chamber.SetBias2MatchPosition((float)_match2C1, (float)_match2C2);
- }
- else if (_match2Mode == BiasRfMatchMode.Hold)
- {
- _chamber.GeneratorBias2SetMatchMode(false);
- }
- _chamber.Generator2PowerOn(true);
- _chamber.GeneratorBias2PowerOn(true);
- }
- else if (Math.Abs(_rf2Power) < 0.01 && Math.Abs(_rf2PowerBias) > 0.01)
- {
- if (_match2Mode == BiasRfMatchMode.Preset)
- {
- _chamber.GeneratorBias2SetMatchMode(true);
- Notify($"Bias RF 2 Match C1设定值 {_match2C1}, Bias RF 2 Match C2设定值 {_match2C2}");
- _chamber.SetBias2MatchPosition((float)_match2C1, (float)_match2C2);
- }
- else if (_match2Mode == BiasRfMatchMode.Hold)
- {
- _chamber.GeneratorBias2SetMatchMode(false);
- }
- _chamber.GeneratorBias2Setpower((float)_rf2PowerBias);
- _chamber.GeneratorBias2PowerOn(true);
- }
- else if (Math.Abs(_rf2Power) > 0.01 && Math.Abs(_rf2PowerBias) < 0.01)
- {
- _chamber.Generator2Setpower((float)_rf2Power);
- _chamber.Generator2PowerOn(true);
- }
- }
- return true;
- }
- bool CheckRFPowerOn()
- {
- _rf1TimeoutTrig.CLK = Elapsed >= _rf1PowerOnTime;
- if (_rf1TimeoutTrig.Q)
- {
- Notify("RF1放电结束");
- _chamber.Generator1PowerOn(false);
- _chamber.GeneratorBias1PowerOn(false);
- }
- _rf2TimeoutTrig.CLK = Elapsed >= _rf2PowerOnTime;
- if (_rf2TimeoutTrig.Q)
- {
- Notify("RF2放电结束");
- _chamber.Generator2PowerOn(false);
- _chamber.GeneratorBias2PowerOn(false);
- }
- if (Elapsed >= _rf1PowerOnTime && Elapsed >= _rf2PowerOnTime)
- {
- Notify("结束");
- _chamber.StopAllGases();
- _chamber.OpenValve(ValveType.PROCESS, false);
- _chamber.OpenValve(ValveType.PURGE, false);
- _chamber.Generator1PowerOn(false);
- _chamber.GeneratorBias1PowerOn(false);
- _chamber.Generator2PowerOn(false);
- _chamber.GeneratorBias2PowerOn(false);
- return true;
- }
- return false;
- }
- bool RFPowerOFF()
- {
- Notify("放电停止");
- _chamber.Generator1PowerOn(false);
- _chamber.Generator2PowerOn(false);
- if (_enableBias1)
- _chamber.GeneratorBias1PowerOn(false);
- if (_enableBias2)
- _chamber.GeneratorBias2PowerOn(false);
- return true;
- }
- bool CheckRFPowerOff()
- {
- return true;
- }
- public override void Abort()
- {
- _chamber.Generator1Setpower(0);
- _chamber.GeneratorBias1Setpower(0);
- _chamber.Generator1PowerOn(false);
- _chamber.GeneratorBias1PowerOn(false);
- _chamber.Generator2Setpower(0);
- _chamber.GeneratorBias2Setpower(0);
- _chamber.Generator2PowerOn(false);
- _chamber.GeneratorBias2PowerOn(false);
- }
- }
- }
|