using Aitex.Core.Common.DeviceData; using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.Device; using Aitex.Core.RT.Event; using Aitex.Core.RT.IOCore; using Aitex.Core.RT.Log; using Aitex.Core.RT.OperationCenter; using Aitex.Core.RT.SCCore; using Aitex.Core.Util; using Aitex.Core.Utilities; using FurnaceRT.Devices; using FurnaceRT.Extraction; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.Event; using MECF.Framework.Common.OperationCenter; using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace FurnaceRT.Equipments.PMs { public partial class PMModule { private Dictionary> _auxDic; private int _currentAuxTable = 1; private string _currentTableName = ""; private bool _isF2ClnOn; private bool _isHFClnOn; private bool _isDEPOOn; private bool _isHTR1Enable; private bool _isHTR2Enable; private bool _isHTR3Enable; private bool _isCEXHOn; private bool _isDPROn; private string _toolType; private Dictionary _auxScaleDic; private Stopwatch _initTimer = new Stopwatch(); private List _auxNames = new List(); public bool IsHTR1Enable { get { return _isHTR1Enable; } set { _isHTR1Enable = value; SC.SetItemValue($"PM1.IsHTR1Enable", value); TrigHTR1SWON?.SetTrigger(value, out _); //_HTR1Group.ForEach(x => x.SetEnable(value)); } } public bool IsHTR2Enable { get { return _isHTR2Enable; } set { _isHTR2Enable = value; SC.SetItemValue($"PM1.IsHTR2Enable", value); TrigHTR2SWON?.SetTrigger(value, out _); _HTR2Group.ForEach(x => x.SetEnable(value)); } } public bool IsHTR3Enable { get { return _isHTR3Enable; } set { _isHTR3Enable = value; SC.SetItemValue($"PM1.IsHTR3Enable", value); TrigHTR3SWON?.SetTrigger(value, out _); TrigForlineHeaterOn.SetTrigger(value, out _); } } public bool IsF2ClnOn { get { return _isF2ClnOn; } set { _isF2ClnOn = value; SC.SetItemValue($"PM1.IsF2ClnOn", value); TrigF2CleanSwitchB?.SetTrigger(value, out _); } } public bool IsHFClnOn { get { return _isHFClnOn; } set { _isHFClnOn = value; SC.SetItemValue($"PM1.IsHFClnOn", value); TrigHFCleanSwitchB?.SetTrigger(value, out _); } } public bool IsDEPOOn { get { return _isDEPOOn; } set { _isDEPOOn = value; SC.SetItemValue($"PM1.IsDEPOOn", value); TrigDEPOSW?.SetTrigger(value, out _); } } public bool IsCREFOn { get { return _isCREFOn; } set { _isCREFOn = value; TrigCREFON?.SetTrigger(value, out _); } } private bool _isCREFOn; public bool IsSIREFOn { get { return _isSIREFOn; } set { _isSIREFOn = value; TrigSIREFON?.SetTrigger(value, out _); } } private bool _isSIREFOn; public bool IsCEXHOn { get { return _isCEXHOn; } set { _isCEXHOn = value; TrigCEXHON?.SetTrigger(value, out _); } } public bool IsDPROn { get { return _isDPROn; } set { _isDPROn = value; SC.SetItemValue($"PM1.IsDPROn", value); TrigDPRON?.SetTrigger(value, out _); } } private void InitAUX() { if (SC.ContainsItem("Minics.EnableMinics") && SC.GetValue("Minics.EnableMinics")) return; GetAuxNames(); IsHFClnOn = SC.GetValue($"PM1.IsHFClnOn"); IsF2ClnOn = SC.GetValue($"PM1.IsF2ClnOn"); _toolType = (string)SC.GetStringValue("System.SetUp.ToolType"); _auxDic = new Dictionary>(); for (int table = 1; table < 5; table++) { List auxs = new List(); for (int index = 1; index < 256; index++) { if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.Set")) continue; if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningLowLimit")) continue; if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningHighLimit")) continue; if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmLowLimit")) continue; if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmHighLimit")) continue; if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.{index}.Display")) continue; if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.{index}.AI")) continue; if (!SC.ContainsItem($"PM1.RecipeEditParameter.AUX.{index}.Unit")) continue; AITAuxData aux = new AITAuxData() { DisplayName = SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display"), DisplayNameConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.{index}.Display"), IOName = SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI"), AO = IO.AO[$"{Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO")}"], AISV = IO.AI[$"{Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI").Replace("PV", "SV")}"], AOAlarmHigher = IO.AO[$"{Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO").Replace("SV", "AlarmHigher")}"], AOAlarmLower = IO.AO[$"{Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO").Replace("SV", "AlarmLower")}"], Unit = SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Unit"), UnitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.{index}.Unit"), SetPoint = (float)SC.GetValue($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.Set"), SetPointConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.Set"), WarningLowLimit = (float)SC.GetValue($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningLowLimit"), WarningLowLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningLowLimit"), WarningHighLimit = (float)SC.GetValue($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningHighLimit"), WarningHighLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningHighLimit"), AlarmLowLimit = (float)SC.GetValue($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmLowLimit"), AlarmLowLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmLowLimit"), AlarmHighLimit = (float)SC.GetValue($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmHighLimit"), AlarmHighLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmHighLimit"), WarningLowLimitTrig = new R_TRIG(), WarningHighLimitTrig = new R_TRIG(), AlarmLowLimitTrig = new R_TRIG(), AlarmHighLimitTrig = new R_TRIG(), Index = index, WarningLowLimitEvent = SubscribeAlarm(new AlarmEventItem() { EventEnum = $"{Name}.WarningLowLimit.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}", Description = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display")} Low Limit", Solution = "No information available. Press[Clear] to delete alarm message.", Explaination = "No information available.", AutoRecovery = false, Level = EventLevel.Warning, Action = EventAction.Clear, Category = "TubeAlarm", }, () => { ResetAUXTrig(); return true; }), WarningHighLimitEvent = SubscribeAlarm(new AlarmEventItem() { EventEnum = $"{Name}.WarningHighLimit.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}", Description = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display")} High Limit", Solution = "No information available. Press[Clear] to delete alarm message.", Explaination = "No information available.", AutoRecovery = false, Level = EventLevel.Warning, Action = EventAction.Clear, Category = "TubeAlarm", }, () => { ResetAUXTrig(); return true; }), AlarmLowLimitEvent = SubscribeAlarm(new AlarmEventItem() { EventEnum = $"{Name}.AlarmLowLimit.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}", Description = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display")} Low Limit", Solution = "No information available. Press[Clear] to delete alarm message.", Explaination = "No information available.", AutoRecovery = false, Level = EventLevel.Alarm, Action = EventAction.Clear, Category = "TubeAlarm", }, () => { ResetAUXTrig(); return true; }), AlarmHighLimitEvent = SubscribeAlarm(new AlarmEventItem() { EventEnum = $"{Name}.AlarmHighLimit.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}", Description = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.Display")} High Limit", Solution = "No information available. Press[Clear] to delete alarm message.", Explaination = "No information available.", AutoRecovery = false, Level = EventLevel.Alarm, Action = EventAction.Clear, Category = "TubeAlarm", }, () => { ResetAUXTrig(); return true; }), }; if (SC.ContainsItem($"PM1.RecipeEditParameter.AUX.{index}.IsInstalled") && SC.GetValue($"PM1.RecipeEditParameter.AUX.{index}.IsInstalled") == false) { aux.IsInstalled = false; } else { aux.IsInstalled = true; } if (SC.GetStringValue("System.SetUp.ToolType") == "ELK") { if (index <= 96) { if (aux.DisplayName.Length > 5) aux.Module = aux.DisplayName.Substring(0, 5).Replace("Unit", "GasLine"); aux.IOName = $"{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AI")}"; aux.AO = IO.AO[$"{aux.Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO")}"]; aux.AISV = null; aux.AOAlarmHigher = IO.AO[$"{aux.Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO").Replace("SV", "AlarmHigherPoint")}"]; aux.AOAlarmLower = IO.AO[$"{aux.Module}.{SC.GetStringValue($"PM1.RecipeEditParameter.AUX.{index}.AO").Replace("SV", "AlarmLowerPoint")}"]; } } else { //需求: aux只需要gasline heater,Foline heater的alarm 不需要报警(序号68之后都是Foline heater) if (index >= 68) { aux.WarningLowLimitEvent = new AlarmEventItem(); aux.WarningHighLimitEvent = new AlarmEventItem(); aux.AlarmLowLimitEvent = new AlarmEventItem(); aux.AlarmHighLimitEvent = new AlarmEventItem(); } } auxs.Add(aux); } if (auxs.Any()) _auxDic.Add(table, auxs); } _auxScaleDic = new Dictionary() { { "AI_ForelineHeater1TempPV", 1}, { "AI_ForelineHeater2TempPV", 1}, { "AI_ForelineHeater3TempPV", 1}, { "AI_ForelineHeater4TempPV", 1}, { "AI_ForelineHeater5TempPV", 1}, { "AI_ForelineHeater6TempPV", 1}, { "AI_ForelineHeater7TempPV", 1}, { "AI_ForelineHeater8TempPV", 1}, { "AI_ForelineHeater9TempPV", 1}, { "AI_ForelineHeater10TempPV", 1}, { "AI_ForelineHeater11TempPV", 1}, { "AI_ForelineHeater12TempPV", 1}, { "AI_CapHeaterTempPV", 1}, { "AI_APCExternalHeaterTempPV", 1}, { "AI_APCRingHeaterTempPV", 1}, { "AI_GaslineHeater1PV", 1}, { "AI_GaslineHeater2PV", 1}, { "AI_GaslineHeater3PV", 1}, { "AI_GaslineHeater4PV", 1}, { "AI_GaslineHeater5PV", 1}, { "AI_GaslineHeater6PV", 1}, { "AI_GaslineHeater7PV", 1}, { "AI_GaslineHeater8PV", 1}, { "AI_GaslineHeater9PV", 1}, { "AI_GaslineHeater10PV", 1}, { "AI_GaslineHeater11PV", 1}, { "AI_GaslineHeater12PV", 1}, { "AI_GaslineHeater13PV", 1}, { "AI_GaslineHeater14PV", 1}, { "AI_GaslineHeater15PV", 1}, { "AI_GaslineHeater16PV", 1}, { "AI_GaslineHeater17PV", 1}, { "AI_GaslineHeater18PV", 1}, { "AI_GaslineHeater19PV", 1}, { "AI_GaslineHeater20PV", 1}, { "AI_GaslineHeater21PV", 1}, { "AI_GaslineHeater22PV", 1}, { "AI_GaslineHeater23PV", 1}, { "AI_GaslineHeater24PV", 1}, { "AI_GaslineHeater25PV", 1}, { "AI_GaslineHeater26PV", 1}, { "AI_GaslineHeater27PV", 1}, { "AI_GaslineHeater28PV", 1}, { "AI_GaslineHeater29PV", 1}, { "AI_GaslineHeater30PV", 1}, { "AI_GaslineHeater31PV", 1}, { "AI_GaslineHeater32PV", 1}, { "AI_GaslineHeater33PV", 1}, { "AI_GaslineHeater34PV", 1}, { "AI_GaslineHeater35PV", 1}, { "AI_GaslineHeater36PV", 1}, { "AI_GaslineHeater37PV", 1}, { "AI_GaslineHeater38PV", 1}, { "AI_GaslineHeater39PV", 1}, { "AI_GaslineHeater40PV", 1}, { "AI_GaslineHeater44PV", 1}, { "AI_GaslineHeater45PV", 1}, { "AI_GaslineHeater49PV", 1}, { "AI_GaslineHeater50PV", 1}, { "AI_GaslineHeater51PV", 1}, { "AI_GaslineHeater52PV", 1}, { "AI_GaslineHeater53PV", 1}, { "AI_GaslineHeater54PV", 1}, { "AI_GaslineHeater55PV", 1}, { "AI_GaslineHeater56PV", 1}, { "AI_GaslineHeater57PV", 1}, { "AI_GaslineHeater58PV", 1}, { "AI_GaslineHeater59PV", 1}, { "AI_GaslineHeater60PV", 1}, { "AI_GaslineHeater61PV", 1}, { "AI_GaslineHeater62PV", 1}, { "AI_GaslineHeater63PV", 1}, { "AI_GaslineHeater64PV", 1}, }; DATA.Subscribe($"{Module}.CurrentAuxData", () => GetCurrentAuxData()); _initTimer.Start(); } private void GetAuxNames() { for (int i = 52; i < 63; i++) { _auxNames.Add($"Gasline heater{i} PV"); } } private void ResetAUXTrig() { if (_auxDic != null && _auxDic.ContainsKey(_currentAuxTable)) { foreach (var item in _auxDic[_currentAuxTable]) { if (item == null) continue; item.WarningLowLimitTrig.RST = true; item.WarningHighLimitTrig.RST = true; item.AlarmLowLimitTrig.RST = true; item.AlarmHighLimitTrig.RST = true; } } } private List GetCurrentAuxData() { var datas = new List(); if (_auxDic != null && _auxDic.ContainsKey(_currentAuxTable)) { foreach (var item in _auxDic[_currentAuxTable]) { if (item == null) continue; var data = new AITAuxData(); data.AlarmHighLimit = item.AlarmHighLimit; data.AlarmLowLimit = item.AlarmLowLimit; data.WarningLowLimit = item.WarningLowLimit; data.WarningHighLimit = item.WarningHighLimit; data.SetPoint = item.AISV != null ? item.AISV.FloatValue : item.SetPoint; data.DisplayName = item.DisplayName; data.IOName = item.IOName; data.Unit = item.Unit; data.Feedback = item.Feedback; data.Index = item.Index; data.IsInstalled = item.IsInstalled; datas.Add(data); } } return datas; } private void MonitorFfu() { _isCEXHOn = _fFUs != null && !_fFUs.Any(x => !x.IsEnable); } private void MonitorAux() { if (SC.ContainsItem("Minics.EnableMinics") && SC.GetValue("Minics.EnableMinics")) { if (_initTimer.IsRunning && _initTimer.ElapsedMilliseconds < 3000) { _initTimer.Stop(); return; } if (IsHTR1Enable != SC.GetValue("PM1.IsHTR1Enable")) IsHTR1Enable = SC.GetValue("PM1.IsHTR1Enable"); if (IsHTR2Enable != SC.GetValue("PM1.IsHTR2Enable")) IsHTR2Enable = SC.GetValue("PM1.IsHTR2Enable"); if (IsHTR3Enable != SC.GetValue("PM1.IsHTR3Enable")) IsHTR3Enable = SC.GetValue("PM1.IsHTR3Enable"); if (IsHTR1Enable && IsF2ClnOn) { var config2Name = SC.ContainsItem("Minics.Config2") ? SC.GetStringValue("Minics.Config2") : ""; if (_currentTableName != config2Name) { Singleton.Instance.SelectMinicsConfig(config2Name); _currentTableName = config2Name; LOG.Write($"minics table switch to config2 {config2Name}"); } } else if (IsHTR1Enable && IsHTR2Enable && IsHFClnOn) { var config3Name = SC.ContainsItem("Minics.Config3") ? SC.GetStringValue("Minics.Config3") : ""; if (_currentTableName != config3Name) { Singleton.Instance.SelectMinicsConfig(config3Name); _currentTableName = config3Name; LOG.Write($"minics table switch to config3 {config3Name}"); } } else if (IsHTR1Enable) { var config1Name = SC.ContainsItem("Minics.Config1") ? SC.GetStringValue("Minics.Config1") : ""; if (_currentTableName != config1Name) { Singleton.Instance.SelectMinicsConfig(config1Name); _currentTableName = config1Name; LOG.Write($"minics table switch to config1 {config1Name}"); } } return; } #region old if (_initTimer.IsRunning && _initTimer.ElapsedMilliseconds < 3000) { _initTimer.Stop(); return; } if (IsHTR1Enable != SC.GetValue("PM1.IsHTR1Enable")) IsHTR1Enable = SC.GetValue("PM1.IsHTR1Enable"); if (IsHTR2Enable != SC.GetValue("PM1.IsHTR2Enable")) IsHTR2Enable = SC.GetValue("PM1.IsHTR2Enable"); if (IsHTR3Enable != SC.GetValue("PM1.IsHTR3Enable")) IsHTR3Enable = SC.GetValue("PM1.IsHTR3Enable"); if (IsHTR1Enable && IsHTR2Enable && IsF2ClnOn) { if (_currentAuxTable != 2) { _currentAuxTable = 2; LOG.Write($"AUC table switch to {_currentAuxTable}"); } } else if (IsHTR1Enable && IsHTR2Enable && IsHFClnOn) { if (_currentAuxTable != 3) { _currentAuxTable = 3; LOG.Write($"AUC table switch to {_currentAuxTable}"); } } else if (IsHTR1Enable) { if (_currentAuxTable != 1) { _currentAuxTable = 1; LOG.Write($"AUC table switch to {_currentAuxTable}"); } } if (TrigGasLine1PowerOn != null && IsHTR1Enable != TrigGasLine1PowerOn.Value) { TrigGasLine1PowerOn?.SetTrigger(IsHTR1Enable, out _); } if (TrigGasLine2PowerOn != null && IsHTR1Enable != TrigGasLine2PowerOn.Value) { TrigGasLine2PowerOn?.SetTrigger(IsHTR1Enable, out _); } if (TrigGasLine3PowerOn != null && IsHTR1Enable != TrigGasLine3PowerOn.Value) { TrigGasLine3PowerOn?.SetTrigger(IsHTR1Enable, out _); } if (TrigGasLine4PowerOn != null) { if (IsF2ClnOn || IsHTR2Enable) { TrigGasLine4PowerOn?.SetTrigger(true, out _); } else { TrigGasLine4PowerOn?.SetTrigger(false, out _); } } if (TrigGasLine6PowerOn != null) { if (IsF2ClnOn || IsHTR2Enable) { TrigGasLine6PowerOn?.SetTrigger(true, out _); } else { TrigGasLine6PowerOn?.SetTrigger(false, out _); } } if (TrigGasLine7PowerOn != null) { if (IsF2ClnOn || IsHTR2Enable) { TrigGasLine7PowerOn?.SetTrigger(true, out _); } else { TrigGasLine7PowerOn?.SetTrigger(false, out _); } } if (IsHTR1Enable || IsHTR2Enable || IsHTR3Enable) { if (IsHTR1Enable && IsF2ClnOn) { if (TrigGasLine1RecipeChange != null && TrigGasLine1RecipeChange.AOValue != 2) TrigGasLine1RecipeChange.SetAOTrigger(2, out _); if (TrigGasLine2RecipeChange != null && TrigGasLine2RecipeChange.AOValue != 2) TrigGasLine2RecipeChange.SetAOTrigger(2, out _); if (TrigGasLine3RecipeChange != null && TrigGasLine3RecipeChange.AOValue != 2) TrigGasLine3RecipeChange.SetAOTrigger(2, out _); if (TrigGasLine4RecipeChange != null && TrigGasLine4RecipeChange.AOValue != 2) TrigGasLine4RecipeChange.SetAOTrigger(2, out _); if (TrigGasLine6RecipeChange != null && TrigGasLine6RecipeChange.AOValue != 2) TrigGasLine6RecipeChange.SetAOTrigger(2, out _); if (TrigGasLine7RecipeChange != null && TrigGasLine7RecipeChange.AOValue != 2) TrigGasLine7RecipeChange.SetAOTrigger(2, out _); } else { if (TrigGasLine1RecipeChange != null && TrigGasLine1RecipeChange.AOValue != 1) { TrigGasLine1RecipeChange?.SetAOTrigger(1, out _); } if (TrigGasLine2RecipeChange != null && TrigGasLine2RecipeChange.AOValue != 1) { TrigGasLine2RecipeChange?.SetAOTrigger(1, out _); } if (TrigGasLine3RecipeChange != null && TrigGasLine3RecipeChange.AOValue != 1) { TrigGasLine3RecipeChange?.SetAOTrigger(1, out _); } if (TrigGasLine4RecipeChange != null && TrigGasLine4RecipeChange.AOValue != 1) { TrigGasLine4RecipeChange?.SetAOTrigger(1, out _); } if (TrigGasLine6RecipeChange != null && TrigGasLine6RecipeChange.AOValue != 1) { TrigGasLine6RecipeChange?.SetAOTrigger(1, out _); } if (TrigGasLine7RecipeChange != null && TrigGasLine7RecipeChange.AOValue != 1) { TrigGasLine7RecipeChange?.SetAOTrigger(1, out _); } } } else { if (TrigGasLine1RecipeChange != null && TrigGasLine1RecipeChange.AOValue != 0) TrigGasLine1RecipeChange.SetAOTrigger(0, out _); if (TrigGasLine2RecipeChange != null && TrigGasLine2RecipeChange.AOValue != 0) TrigGasLine2RecipeChange.SetAOTrigger(0, out _); if (TrigGasLine3RecipeChange != null && TrigGasLine3RecipeChange.AOValue != 0) TrigGasLine3RecipeChange.SetAOTrigger(0, out _); if (TrigGasLine4RecipeChange != null && TrigGasLine4RecipeChange.AOValue != 0) TrigGasLine4RecipeChange.SetAOTrigger(0, out _); if (TrigGasLine6RecipeChange != null && TrigGasLine6RecipeChange.AOValue != 0) TrigGasLine6RecipeChange.SetAOTrigger(0, out _); if (TrigGasLine7RecipeChange != null && TrigGasLine7RecipeChange.AOValue != 0) TrigGasLine7RecipeChange.SetAOTrigger(0, out _); } if (IsHTR1Enable && IsHTR2Enable && IsF2ClnOn) { if (TrigGasLineHeaterMemoryChange != null && TrigGasLineHeaterMemoryChange.AOValue != 2) TrigGasLineHeaterMemoryChange.SetAOTrigger(2, out _); } else if (IsHTR1Enable || IsHTR2Enable) { if (IsHTR1Enable) { if (TrigGasLineHeaterMemoryChange != null && TrigGasLineHeaterMemoryChange.AOValue != 1) { TrigGasLineHeaterMemoryChange.SetAOTrigger(1, out _); } } else { if (TrigGasLineHeaterMemoryChange != null && TrigGasLineHeaterMemoryChange.AOValue != 0) { TrigGasLineHeaterMemoryChange.SetAOTrigger(0, out _); } } } else { if (TrigGasLineHeaterMemoryChange != null && TrigGasLineHeaterMemoryChange.AOValue != 0) TrigGasLineHeaterMemoryChange.SetAOTrigger(0, out _); } if (_auxDic != null && _auxDic.ContainsKey(_currentAuxTable)) { if (IsProcessing) { foreach (var item in _auxDic[_currentAuxTable]) { if (item == null) continue; item.AlarmHighLimit = (float)item.AlarmHighLimitConfig.DoubleValue; item.AlarmLowLimit = (float)item.AlarmLowLimitConfig.DoubleValue; item.WarningHighLimit = (float)item.WarningHighLimitConfig.DoubleValue; item.WarningLowLimit = (float)item.WarningLowLimitConfig.DoubleValue; //item.SetPoint = (float)item.SetPointConfig.DoubleValue; item.Unit = item.UnitConfig.StringValue; item.DisplayName = item.DisplayNameConfig.StringValue; if (SC.GetStringValue("System.SetUp.ToolType") == "ELK" && item.Index <= 96) { item.Feedback = IO.AI[$"{item.Module}.{item.IOName}"] != null ? IO.AI[$"{item.Module}.{item.IOName}"].FloatValue : 0; item.SetPoint = item.AO != null ? item.AO.FloatValue : 0; } else { item.Feedback = IO.AI[$"{Module}.{item.IOName}"] != null ? IO.AI[$"{Module}.{item.IOName}"].FloatValue : 0; } if (item.AO != null && Math.Abs(item.AO.FloatValue - item.SetPoint) > 0.0001 && item.SetPoint > 0 && (item.IOName.Contains("ForelineHeater") || item.IOName.Contains("SiSource") || item.IOName.Contains("CSource")))//只有ForelineHeater需要写,GasLine heater之类不写 { item.AO.FloatValue = item.SetPoint;//process 过程中,不写ao } if (item.AOAlarmHigher != null && Math.Abs(item.AOAlarmHigher.FloatValue - item.AlarmHighLimit) > 0.0001) { item.AOAlarmHigher.FloatValue = item.AlarmHighLimit;//process 过程中,不写ao } if (item.AOAlarmLower != null && Math.Abs(item.AOAlarmLower.FloatValue - item.AlarmLowLimit) > 0.0001) { item.AOAlarmLower.FloatValue = item.AlarmLowLimit;//process 过程中,不写ao } } } else { foreach (var item in _auxDic[_currentAuxTable]) { if (item == null) continue; item.WarningHighLimit = (float)item.WarningHighLimitConfig.DoubleValue; item.WarningLowLimit = (float)item.WarningLowLimitConfig.DoubleValue; item.SetPoint = (float)item.SetPointConfig.DoubleValue; item.Unit = item.UnitConfig.StringValue; item.DisplayName = item.DisplayNameConfig.StringValue; item.AlarmHighLimit = (float)item.AlarmHighLimitConfig.DoubleValue; item.AlarmLowLimit = (float)item.AlarmLowLimitConfig.DoubleValue; if (SC.GetStringValue("System.SetUp.ToolType") == "ELK" && item.Index <= 96) { item.Feedback = IO.AI[$"{item.Module}.{item.IOName}"] != null ? IO.AI[$"{item.Module}.{item.IOName}"].FloatValue : 0; item.SetPoint = item.AO != null ? item.AO.FloatValue : 0; } else { item.Feedback = IO.AI[$"{Module}.{item.IOName}"] != null ? IO.AI[$"{Module}.{item.IOName}"].FloatValue : 0; } //item.Feedback = IO.AI[$"{Module}.{item.IOName}"] != null ? IO.AI[$"{Module}.{item.IOName}"].FloatValue : 0; if (item.AO != null && Math.Abs(item.AO.FloatValue - (float)item.SetPointConfig.DoubleValue) > 0.0001 && item.SetPoint > 0 && (item.IOName.Contains("ForelineHeater") || item.IOName.Contains("SiSource") || item.IOName.Contains("CSource")))//只有ForelineHeater需要写,GasLine heater之类不写 ELK除了GasLine需要设置 { item.AO.FloatValue = (float)item.SetPointConfig.DoubleValue; } if (item.AOAlarmHigher != null && Math.Abs(item.AOAlarmHigher.FloatValue - item.AlarmHighLimit) > 0.0001) { item.AOAlarmHigher.FloatValue = item.AlarmHighLimit; } if (item.AOAlarmLower != null && Math.Abs(item.AOAlarmLower.FloatValue - item.AlarmLowLimit) > 0.0001) { item.AOAlarmLower.FloatValue = item.AlarmLowLimit; } if (item.Feedback > item.SetPoint + item.AlarmHighLimit) { //注释AUX报警 //item.AlarmHighLimitTrig.CLK = true; //if (item.AlarmHighLimitTrig.Q) //{ // var reason = $"{item.DisplayName} feedback={item.Feedback}, alarm high limit is {item.SetPoint + item.AlarmHighLimit}"; // item.AlarmHighLimitEvent.Set(reason); //} } else if (item.Feedback < item.SetPoint - item.AlarmLowLimit) { //注释AUX报警 //item.AlarmLowLimitTrig.CLK = true; //if (item.AlarmLowLimitTrig.Q) //{ // var reason = $"{item.DisplayName} feedback={item.Feedback}, alarm low limit is {item.SetPoint - item.AlarmLowLimit}"; // item.AlarmLowLimitEvent.Set(reason); //} } else if (item.Feedback > item.SetPoint + item.WarningHighLimit) { //注释AUX报警 //item.WarningHighLimitTrig.CLK = true; //if (item.WarningHighLimitTrig.Q) //{ // var reason = $"{item.DisplayName} feedback={item.Feedback}, warning high limit is {item.SetPoint + item.WarningHighLimit}"; // item.AlarmHighLimitEvent.Set(reason); //} } else if (item.Feedback < item.SetPoint - item.WarningLowLimit) { //注释AUX报警 //item.WarningLowLimitTrig.CLK = true; //if (item.WarningLowLimitTrig.Q) //{ // var reason = $"{item.DisplayName} feedback={item.Feedback}, warning low limit is {item.SetPoint - item.WarningLowLimit}"; // item.AlarmLowLimitEvent.Set(reason); //} } } } } #endregion } private void SetAUXParameters(object[] param) { if (SC.ContainsItem("Minics.EnableMinics") && SC.GetValue("Minics.EnableMinics")) return; if (param != null && param.Length > 0 && _auxDic != null && _auxDic.ContainsKey(_currentAuxTable)) { var array = param[0].ToString().Split(';'); if (array != null && array.Length > 0) { for (int i = 0; i < array.Length; i++) { var auxItems = array[i].Split(','); if (auxItems == null || auxItems.Length < 6) continue; int.TryParse(auxItems[0], out int index); float.TryParse(auxItems[1], out float set); bool.TryParse(auxItems[2], out bool isCheck); float.TryParse(auxItems[3], out float checkHigh); float.TryParse(auxItems[4], out float checkLow); var checkUnit = auxItems[5]; var aux = _auxDic[_currentAuxTable].SingleOrDefault(x => x.Index == index); if (aux != null) { if (checkUnit.ToLower() == "%sv") { checkHigh = set * checkHigh; checkLow = set * checkLow; } else if (checkUnit.ToLower() == "%fs") { checkHigh = (_auxScaleDic.ContainsKey(aux.IOName) ? _auxScaleDic[aux.IOName] : 1) * checkHigh; checkLow = (_auxScaleDic.ContainsKey(aux.IOName) ? _auxScaleDic[aux.IOName] : 1) * checkLow; } if (set > 0) aux.SetPoint = set; aux.IsWait = isCheck; aux.WaitHigh = checkHigh; aux.WaitLow = checkLow; } } } } } public bool CheckAUXWaitCondition(out string reason) { reason = ""; bool allFinish = true; if (_auxDic != null && _auxDic.ContainsKey(_currentAuxTable)) { foreach (var item in _auxDic[_currentAuxTable]) { if (item == null) continue; if (!item.IsWait || item.WaitHigh == 0 || item.WaitLow == 0) continue; if (item.Feedback < item.SetPoint - item.WaitLow || item.Feedback > item.SetPoint + item.WaitHigh) { allFinish = false; reason += $"{item.DisplayName} feedback={item.Feedback}, limit is ({item.SetPoint - item.WaitLow}, {item.SetPoint + item.WaitHigh}) \n"; } } } return allFinish; } private void SetVFD(bool setValue) { if (SC.ContainsItem("PM1.RHC.RHCVDFFrequency")) { if (setValue) { TrigVFD?.SetAOTrigger((float)SC.GetValue("PM1.RHC.RHCVDFFrequency"), out _); } else { SC.SetItemValue("PM1.RHC.RHCVDFFrequency", 0.0d); TrigVFD?.SetAOTrigger((float)SC.GetValue("PM1.RHC.RHCVDFFrequency"), out _); } } } private bool SetBWREnable(object[] param) { if (param != null && param.Length > 0) { bool.TryParse(param[0].ToString(), out bool isEnable); SetVFD(isEnable); } return true; } private bool SetF2ClnEnable(object[] param) { if (param != null && param.Length > 0) { bool.TryParse(param[0].ToString(), out bool isEnable); IsF2ClnOn = isEnable; } return true; } private bool SetHFClnEnable(object[] param) { if (param != null && param.Length > 0) { bool.TryParse(param[0].ToString(), out bool isEnable); IsHFClnOn = isEnable; } return true; } private bool SetDEPOEnable(object[] param) { if (param != null && param.Length > 0) { bool.TryParse(param[0].ToString(), out bool isEnable); IsDEPOOn = isEnable; } return true; } private bool SetCREFEnable(object[] param) { if (param != null && param.Length > 0) { bool.TryParse(param[0].ToString(), out bool isEnable); IsCREFOn = isEnable; } return true; } private bool SetSIREFEnable(object[] param) { if (param != null && param.Length > 0) { bool.TryParse(param[0].ToString(), out bool isEnable); IsSIREFOn = isEnable; } return true; } } }