123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- using System;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using JetVirgoPM.Devices;
- namespace JetVirgoPM.PMs.Routines
- {
- class TemperatureControlRoutine : PMRoutineBase, IStepRoutine
- {
- private enum TCSequence
- {
- CheckCoolantTemp1,
- CheckCoolantTemp2,
- kCheckTemperature1,
- kCheckTemperature2,
- kCheckLETemperature,
- kEnd
- }
- private int _checkChamberTempTimeout = 60;
- private double _TargetTemp = 0.0f;
- private double _TargetTemp1 = 0.0f;
- private double _TargetTemp2 = 0.0f;
- private double _Chiller1OffsetTemp = 0.0f;
- private double _Chiller2OffsetTemp = 0.0f;
- private double _tolerance;
- private bool _enableChiller1;
- private bool _enableChiller2;
- private bool _enableLE1;
- private bool _enableLE2;
- public bool _Chamber1Disabled;
- public bool _Chamber2Disabled;
- public TemperatureControlRoutine(JetDualPM chamber) : base(chamber)
- {
- Name = "PreHeat";
- bUINotify = true;
- }
- public void Terminate()
- {
- }
- public RState Start(params object[] objs)
- {
- try
- {
- Reset();
- _Chamber1Disabled = SC.GetValue<bool>($"System.SetUp.{Module}Chamber1Disabled.IsInstalled");
- _Chamber2Disabled = SC.GetValue<bool>($"System.SetUp.{Module}Chamber2Disabled.IsInstalled");
- _enableChiller1 = SC.GetValue<bool>($"{Module}.Chiller1.EnableChiller");
- _enableChiller2 = SC.GetValue<bool>($"{Module}.Chiller2.EnableChiller");
- _TargetTemp1 =Convert.ToDouble(objs[0]);
- _TargetTemp2 = Convert.ToDouble(objs[1]);
- _checkChamberTempTimeout = SC.GetValue<int>($"{Module}.CheckChamberTempTimeout");
- _tolerance = SC.GetValue<double>($"System.MaxTemperatureToleranceToTarget");
- _Chiller1OffsetTemp = SC.GetValue<double>($"{Module}.Chiller1.ChillerTemperatureOffset");
- _Chiller2OffsetTemp = SC.GetValue<double>($"{Module}.Chiller2.ChillerTemperatureOffset");
- Notify($"开始,TemperatureControl 1 目标 {_TargetTemp1} ℃, 偏移值 { _Chiller1OffsetTemp} ℃");
- Notify($"开始,TemperatureControl 2 目标 {_TargetTemp2} ℃, 偏移值 { _Chiller2OffsetTemp} ℃");
- _enableLE1 = true;
- _enableLE2 = true;
- return Runner.Start(_chamber.Module.ToString(), Name);
- }
- catch
- {
- return RState.Failed;
- }
- }
- public RState Monitor()
- {
- Runner.Run(TCSequence.CheckCoolantTemp1, SetCoolant1Temp, CheckCoolant1Temp, _checkChamberTempTimeout * 1000)
- .Run(TCSequence.CheckCoolantTemp2, SetCoolant2Temp, CheckCoolant2Temp, _checkChamberTempTimeout * 1000)
- .Run(TCSequence.kCheckLETemperature, SetLETemp, CheckLETemp, _checkChamberTempTimeout * 1000)
- .Run(TCSequence.kCheckTemperature1, SetLETemp1, CheckLETemp1, _checkChamberTempTimeout * 1000)
- .Run(TCSequence.kCheckTemperature2, SetLETemp2, CheckLETemp2, _checkChamberTempTimeout * 1000)
- .End(TCSequence.kEnd, EndFunc, _delay_0s);
- return Runner.Status;
- }
- bool SetCoolant1Temp()
- {
- if (_enableChiller1 && !_Chamber1Disabled && _TargetTemp1 > 0 )
- {
- _enableLE1 = false;
- return SetCoolant1Temp(_TargetTemp1, _Chiller1OffsetTemp, _tolerance);
- }
- return true;
- }
- bool CheckCoolant1Temp()
- {
- if (_enableChiller1 && !_Chamber1Disabled && _TargetTemp1 > 0 )
- {
- return CheckCoolant1Temp(_TargetTemp1, _Chiller1OffsetTemp, _tolerance);
- }
- return true;
- }
- bool SetCoolant2Temp()
- {
- if (_enableChiller2 && !_Chamber2Disabled && _TargetTemp2 > 0 )
- {
- _enableLE2 = false;
- return SetCoolant2Temp(_TargetTemp2, _Chiller2OffsetTemp, _tolerance);
- }
- return true;
- }
- bool CheckCoolant2Temp()
- {
- if (_enableChiller2 && !_Chamber2Disabled && _TargetTemp2 > 0)
- {
- return CheckCoolant2Temp(_TargetTemp2, _Chiller2OffsetTemp, _tolerance);
- }
- return true;
- }
- bool SetLETemp()
- {
- if ((_enableLE1 && !_Chamber1Disabled && _TargetTemp1 > 0) && (_enableLE2 && !_Chamber2Disabled && _TargetTemp2 > 0))
- {
- return SetLETemp(_TargetTemp1, _TargetTemp2, _tolerance, _enableLE1, _enableLE2);
- }
- return true;
- }
- bool CheckLETemp()
- {
- if ((_enableLE1 && !_Chamber1Disabled && _TargetTemp1 > 0) && (_enableLE2 && !_Chamber2Disabled && _TargetTemp2 > 0))
- {
- return CheckLETemp(_TargetTemp1, _TargetTemp2, _tolerance, _enableLE1, _enableLE2);
- }
- return true;
- }
- bool SetLETemp1()
- {
- if (_enableLE1 && !_Chamber1Disabled && _TargetTemp1 > 0)
- {
- return SetLETemp(_TargetTemp1, 0, _tolerance, _enableLE1, false);
- }
- return true;
- }
- bool CheckLETemp1()
- {
- if (_enableLE1 && !_Chamber1Disabled && _TargetTemp1 > 0)
- {
- return CheckLETemp(_TargetTemp1, 0, _tolerance, _enableLE1, false);
- }
- return true;
- }
- bool SetLETemp2()
- {
- if (_enableLE2 && !_Chamber2Disabled && _TargetTemp2 > 0)
- {
- return SetLETemp(0, _TargetTemp2, _tolerance, false, _enableLE2);
- }
- return true;
- }
- bool CheckLETemp2()
- {
- if (_enableLE2 && !_Chamber2Disabled && _TargetTemp2 > 0)
- {
- return CheckLETemp(0, _TargetTemp2, _tolerance, false, _enableLE2);
- }
- return true;
- }
- public override void Abort() { }
- }
- }
|