123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- 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
- {
- public enum CMPressure
- {
- CM1,
- CM2,
- }
- class PMVATPerformanceRoutine : PMRoutineBase, IRoutine
- {
- public StringBuilder m_sb = new StringBuilder();
- int gasIndex;
- //int GasMaxScale;
- public int counter;
- int gasTime;
- int gasSetPoint;
- ValveType[] valveTypes = new ValveType[4] { ValveType.PV11, ValveType.PV21, ValveType.PV31, ValveType.PV41 };//ValveType.PV11, ValveType.PV21, ValveType.PV31, ValveType.PV41,ValveType.PV51,ValveType.PV61,ValveType.PV71,ValveType.PV81, ValveType.PV91, ValveType.PVA1, ValveType.PVB1, ValveType.PVC1,
- List<int> Positions = new List<int>() {50,100,150,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,950,1000};
- public VATPerformanceResult m_VATPerformanceResult;
- private CMPressure currentCMPressure = CMPressure.CM1;
- private enum VATPerformanceStep
- {
- kDelay_1s,
- kStartGas,
- kReadChamberPressure,
- kEnd,
- }
- public PMVATPerformanceRoutine(JetPMBase chamber) : base(chamber)
- {
- Name = "PMVATPerformance";
- }
- 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];
- gasSetPoint = (int)objs[2];
- m_VATPerformanceResult = new VATPerformanceResult();
- m_VATPerformanceResult.StartTime = DateTime.Now.ToString("yyyyMMddHHmm");
- m_VATPerformanceResult.FlowTime = gasTime;
- m_VATPerformanceResult.GasName = $"Gas{gasIndex.ToString()}";
- currentCMPressure = CMPressure.CM1;
- m_sb.Clear();
- return Runner.Start(Module, Name);
- }
- public RState Monitor()
- {
- Runner.Delay(VATPerformanceStep.kDelay_1s, 1000 * 1)
- .LoopStart(VATPerformanceStep.kStartGas, "VAT Performance Test", Positions.Count, () => SetPositionGas(), gasTime)
- .LoopEnd(VATPerformanceStep.kReadChamberPressure, ReadChamberPressure, 2000)
- .End(VATPerformanceStep.kEnd, () =>
- {
- m_VATPerformanceResult.EndTime=DateTime.Now.ToString("yyyyMMddHHmm");
- _chamber.CloseValves();
- SerializeHelper.Instance.WriteToJsonFile<VATPerformanceResult>(m_VATPerformanceResult, $"VATPerformanceResult/{_chamber.Module}/{m_VATPerformanceResult.GasName}/{m_VATPerformanceResult.StartTime}.json");
- return true;
- }, 500);
- return Runner.Status;
- }
- private bool SetPositionGas()
- {
- if (!_chamber.SetPVPostion(Positions[counter - 1]))
- {
- return false;
- }
- 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, gasSetPoint);
- }
- else
- {
- if (gasIndex <= 4)
- {
- _chamber.OpenValve(valveTypes[gasIndex - 1], true);
- }
- _chamber.OpenValve(ValveType.GasFinal, true);
- _chamber.FlowGas(gasIndex - 1, gasSetPoint);
- }
- return true;
- }
- private bool ReadChamberPressure()
- {
- double criticalValue = 0;
- if (_chamber.ChamberType == JetChamber.Kepler2200A || _chamber.ChamberType == JetChamber.Kepler2200B)
- {
- criticalValue = 2000;
- }
- else
- {
- criticalValue = 100;
- }
- double pressureValue;
- if (currentCMPressure == CMPressure.CM1)
- {
- pressureValue = _chamber.ProcessPressure;
- if (Math.Abs(pressureValue - criticalValue) < 3)
- {
- pressureValue = _chamber.ChamberPressure;
- currentCMPressure = CMPressure.CM2;
- }
- }
- else
- {
- pressureValue = _chamber.ChamberPressure;
- if (pressureValue < criticalValue)
- {
- if (_chamber.IsGuageValveOpened == false)
- {
- _chamber.OpenValve(ValveType.Guage, true);
- System.Threading.Thread.Sleep(3000);
- }
- pressureValue = _chamber.ProcessPressure;
- currentCMPressure = CMPressure.CM1;
- }
- }
- var value =Math.Round(gasSetPoint / pressureValue,3);
- m_VATPerformanceResult.ValuePairs.Add(value);
- m_sb.Append(value.ToString());
- m_sb.Append(',');
- counter += 1;
- return true;
- }
- public void Abort()
- {
- _chamber.CloseValves();
- }
- }
- }
|