|
@@ -4,6 +4,7 @@ using Aitex.Core.RT.Device.Unit;
|
|
|
using Aitex.Core.RT.Log;
|
|
|
using Aitex.Core.RT.SCCore;
|
|
|
using Aitex.Core.Util;
|
|
|
+using DocumentFormat.OpenXml.Packaging;
|
|
|
using FurnaceRT.Devices;
|
|
|
using FurnaceRT.Equipments.PMs.Devices;
|
|
|
using FurnaceRT.Extraction;
|
|
@@ -11,6 +12,7 @@ using MECF.Framework.Common.CommonData.SorterDefines;
|
|
|
using MECF.Framework.Common.Equipment;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Diagnostics;
|
|
|
|
|
|
namespace FurnaceRT.Equipments.PMs
|
|
|
{
|
|
@@ -27,9 +29,13 @@ namespace FurnaceRT.Equipments.PMs
|
|
|
|
|
|
private Dictionary<string, Tuple<R_TRIG, List<Tuple<IDevice, string>>>> _n2PurgeSequenceAction;
|
|
|
private Dictionary<string, Func<bool>> _n2PurgeSequenceStatus;
|
|
|
+ private Dictionary<string, R_TRIG> _rTrigDict;
|
|
|
private N2PurgeModeEnum _N2PurgeMode = N2PurgeModeEnum.Auto;
|
|
|
private double _n2PurgeData = 20;
|
|
|
private double _n2ToAirData = 185000;
|
|
|
+ private double _stabilityTime = 30;
|
|
|
+
|
|
|
+ private Dictionary<string, Stopwatch> _allTimeDict = new Dictionary<string, Stopwatch>();
|
|
|
private void InitN2PurgeData()
|
|
|
{
|
|
|
DATA.Subscribe($"{Module}.O2DensityData", () => GetO2DensityData(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
|
|
@@ -42,6 +48,7 @@ namespace FurnaceRT.Equipments.PMs
|
|
|
{
|
|
|
_n2PurgeData = SC.ContainsItem($"System.N2PurgeData") ? SC.GetValue<double>("System.N2PurgeData") : 20;
|
|
|
_n2ToAirData = SC.ContainsItem($"System.N2PurgeData") ? SC.GetValue<double>("System.N2ToAirData") : 185000;
|
|
|
+ _stabilityTime = SC.ContainsItem($"System.StabilityTime") ? SC.GetValue<double>("System.StabilityTime") : 30;
|
|
|
|
|
|
_n2PurgeSequenceAction = ExtractionMethods.GetN2PurgeSequenceAction();
|
|
|
_n2PurgeSequenceStatus = new Dictionary<string, Func<bool>>()
|
|
@@ -59,7 +66,16 @@ namespace FurnaceRT.Equipments.PMs
|
|
|
{N2PurgeModeEnum.Manual_phase4.ToString(),()=> GetN2PurgePhase4() },
|
|
|
|
|
|
};
|
|
|
+ _allTimeDict = new Dictionary<string, Stopwatch>()
|
|
|
+ {
|
|
|
+ {N2PurgeModeEnum.Manual_phase1.ToString(),new Stopwatch() },
|
|
|
+ {N2PurgeModeEnum.Manual_phase2.ToString(),new Stopwatch()},
|
|
|
+ {N2PurgeModeEnum.Manual_phase3.ToString(),new Stopwatch()},
|
|
|
+ {N2PurgeModeEnum.Manual_phase4.ToString(),new Stopwatch() }
|
|
|
+ };
|
|
|
+ _rTrigDict = new Dictionary<string, R_TRIG>();
|
|
|
}
|
|
|
+
|
|
|
private void MonitorN2Purge()
|
|
|
{
|
|
|
var selectN2PurgeMode = SC.ContainsItem("PM1.SelectN2PurgeMode") ? SC.GetStringValue("PM1.SelectN2PurgeMode") : "";
|
|
@@ -97,12 +113,32 @@ namespace FurnaceRT.Equipments.PMs
|
|
|
|
|
|
private void ProcessPhase(R_TRIG r_TRIG, string modeKey)
|
|
|
{
|
|
|
- r_TRIG.CLK = _n2PurgeSequenceStatus[modeKey].Invoke();
|
|
|
- if (r_TRIG.Q)
|
|
|
+ if (_n2PurgeSequenceStatus[modeKey].Invoke())
|
|
|
{
|
|
|
- LOG.Info($"N2PurgeMode Trigger {modeKey}!,O2:{GetO2Density()}");
|
|
|
- SetN2PurgeValveData(modeKey);
|
|
|
+ if (!_allTimeDict[modeKey].IsRunning)
|
|
|
+ {
|
|
|
+ _allTimeDict[modeKey].Restart();
|
|
|
+ }
|
|
|
+ r_TRIG.CLK = _allTimeDict[modeKey].ElapsedMilliseconds > _stabilityTime * 1000;
|
|
|
+ if (r_TRIG.Q)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (_n2PurgeSequenceStatus[modeKey].Invoke())
|
|
|
+ {
|
|
|
+ LOG.Info($"N2PurgeMode Trigger {modeKey}!,O2:{GetO2Density()}");
|
|
|
+ SetN2PurgeValveData(modeKey);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _allTimeDict[modeKey].Stop();
|
|
|
+ _allTimeDict[modeKey].Reset();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
public void RestAllN2PrugeRD()
|
|
@@ -227,7 +263,7 @@ namespace FurnaceRT.Equipments.PMs
|
|
|
}
|
|
|
private bool GetN2PurgePhase4()
|
|
|
{
|
|
|
- return GetO2Density() >= _n2ToAirData && !GetLADoorOpenStatus();
|
|
|
+ return GetO2Density() >= _n2ToAirData ;
|
|
|
}
|
|
|
private bool GetN2PurgeAIRTo20PPMStatus()
|
|
|
{
|