| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 | 
							- 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 };
 
-         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((int)VATPerformanceStep.kDelay_1s, 1000 * 1)
 
-                   .LoopStart((int)VATPerformanceStep.kStartGas, "VAT Performance Test", Positions.Count, () => SetPositionGas(), gasTime)
 
-                   .LoopEnd((int)VATPerformanceStep.kReadChamberPressure, ReadChamberPressure, 2000)
 
-                   .End((int)VATPerformanceStep.kEnd, () =>
 
-                   {
 
-                       m_VATPerformanceResult.EndTime=DateTime.Now.ToString("yyyyMMddHHmm");
 
-                       _chamber.CloseValves();
 
-                       SerializeHelper.Instance.WriteToJsonFile<VATPerformanceResult>(m_VATPerformanceResult, $"VATPerformanceResult/{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 (gasIndex <= 4)
 
-             {
 
-                 _chamber.OpenValve(valveTypes[gasIndex - 1], true);
 
-             }
 
-             _chamber.OpenValve(ValveType.GasFinal, true);
 
-             _chamber.FlowGas(gasIndex - 1, gasSetPoint);
 
-             return true;
 
-         }
 
-         private  bool ReadChamberPressure()
 
-         {
 
-             double pressureValue;
 
-             if (currentCMPressure == CMPressure.CM1)
 
-             {
 
-                 pressureValue = _chamber.ProcessLowPressure;
 
-                 if (Math.Abs(pressureValue - 100) < 3)
 
-                 {
 
-                     pressureValue = _chamber.ProcessHighPressure;
 
-                     currentCMPressure = CMPressure.CM2;
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 pressureValue = _chamber.ProcessHighPressure;
 
-                 if (pressureValue < 100)
 
-                 {
 
-                     if (_chamber.IsGuageValveOpened == false)
 
-                     {
 
-                         _chamber.OpenValve(ValveType.Guage, true);
 
-                         System.Threading.Thread.Sleep(3000);
 
-                     }
 
-                     pressureValue = _chamber.ProcessLowPressure;
 
-                     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();
 
-         }
 
-     }
 
- }
 
 
  |