123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Venus_Core;
- using Venus_RT.Devices;
- using Venus_Unity;
- namespace Venus_RT.Modules.PMs
- {
- class PMPartialPressureRoutine : PMRoutineBase, IRoutine
- {
- int gasIndex;
- int GasMaxScale;
- public int counter;
- int gasTime;
- ValveType[] valveTypes = new ValveType[4] { ValveType.PV11, ValveType.PV21, ValveType.PV31, ValveType.PV41 };
- public PartialPressureResult m_PartialPressureResult=new PartialPressureResult ();
- public StringBuilder m_sb = new StringBuilder();
- private enum PartialPressureStep
- {
- kDelay_1s,
- kStartGas,
- kReadChamberPressure,
- kEnd,
- }
- public PMPartialPressureRoutine(JetPMBase chamber) : base(chamber)
- {
- Name = "PMPartialPressure";
- }
- public RState Start(params object[] objs)
- {
- if (!CheckTurboPump())
- {
- return RState.Failed;
- }
- if (_chamber.GetPVPosition() == 0)
- {
- Stop("钟摆阀没有打开");
- return RState.Failed;
- }
- _chamber.OpenValve(ValveType.Guage, true);
- _chamber.OpenValve(ValveType.TurboPumpPumping, true);
- _chamber.OpenValve(ValveType.TurboPumpPurge, true);
- counter = 1;
- Reset();
- gasIndex = (int)objs[0];
- gasTime = (int)objs[1];
- GasMaxScale = SC.GetValue<int>($"{Module}.MfcGas{gasIndex.ToString()}.MfcN2Scale");
- //_chamber.CloseValves();
- _chamber.SetPVPostion(1000);
- m_PartialPressureResult.StartTime= DateTime.Now.ToString("yyyyMMddHHmm");
- m_PartialPressureResult.FlowTime = gasTime;
- m_PartialPressureResult.GasName= $"Gas{gasIndex.ToString()}";
- m_PartialPressureResult.ValuePairs.Clear();
- m_sb.Clear();
- return Runner.Start(Module, Name);
- }
- public RState Monitor()
- {
- Runner.Delay(PartialPressureStep.kDelay_1s, 1000 * 1)
- .LoopStart(PartialPressureStep.kStartGas, "Partial Pressure Test", 10, () => SetGasPoint(), gasTime)
- .LoopEnd(PartialPressureStep.kReadChamberPressure, ReadChamberPressure, _delay_1s)
- .End(PartialPressureStep.kEnd, () =>
- {
- _chamber.CloseValves();
- m_PartialPressureResult.EndTime = DateTime.Now.ToString("yyyyMMddHHmm");
- SerializeHelper.Instance.WriteToJsonFile<PartialPressureResult>(m_PartialPressureResult, $"PartialPressureResult/{Module}/{m_PartialPressureResult.GasName}/{m_PartialPressureResult.StartTime}.json");
- return true;
- }, 500);
- return Runner.Status;
- }
- private bool SetGasPoint()
- {
- if (_chamber.ChamberType == JetChamber.VenusDE || _chamber.ChamberType == JetChamber.VenusSE)
- {
- valveTypes = new ValveType[12] { ValveType.PV11, ValveType.PV21, ValveType.PV31, ValveType.PV41, ValveType.PV51, ValveType.PV61, ValveType.PV71, ValveType.PV81, ValveType.PV91, ValveType.PVA1, ValveType.PVB1, ValveType.PVC1, };
- _chamber.OpenValve(valveTypes[gasIndex - 1], true);
- _chamber.OpenValve(ValveType.GasFinal, true);
- _chamber.FlowGas(gasIndex - 1, GasMaxScale * 0.1 * counter);
- return true;
- }
- else
- {
- if (gasIndex <= 4)
- {
- _chamber.OpenValve(valveTypes[gasIndex - 1], true);
- }
- _chamber.OpenValve(ValveType.GasFinal, true);
- _chamber.FlowGas(gasIndex - 1, GasMaxScale * 0.1 * counter);
- return true;
- }
- }
- private bool ReadChamberPressure()
- {
- var pressure = Math.Round(_chamber.ProcessPressure, 3);
- m_PartialPressureResult.ValuePairs.Add(new Value() { Flow = (GasMaxScale * 0.1 * counter).ToString(), Pressure = pressure });
- m_sb.Append(pressure.ToString());
- m_sb.Append(',');
- counter += 1;
- return true;
- }
- public void Abort()
- {
- _chamber.CloseValves();
- }
- }
- }
|