| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935 | 
							- 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 MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.Event;
 
- using MECF.Framework.Common.Minics;
 
- 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<int, List<AITAuxData>> _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 string _toolType;
 
-         private Dictionary<string, float> _auxScaleDic;
 
-         private Stopwatch _initTimer = new Stopwatch();
 
-         private List<string> _auxNames = new List<string>();
 
-         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;
 
-         private void InitAUX()
 
-         {
 
-             if (SC.ContainsItem("Minics.EnableMinics") && SC.GetValue<bool>("Minics.EnableMinics"))
 
-                 return;
 
-             GetAuxNames();
 
-             IsHFClnOn = SC.GetValue<bool>($"PM1.IsHFClnOn");
 
-             IsF2ClnOn = SC.GetValue<bool>($"PM1.IsF2ClnOn");
 
-             _toolType = (string)SC.GetStringValue("System.SetUp.ToolType");
 
-             _auxDic = new Dictionary<int, List<AITAuxData>>();
 
-             for (int table = 1; table < 5; table++)
 
-             {
 
-                 List<AITAuxData> auxs = new List<AITAuxData>();
 
-                 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<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.Set"),
 
-                         SetPointConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.Set"),
 
-                         WarningLowLimit = (float)SC.GetValue<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningLowLimit"),
 
-                         WarningLowLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningLowLimit"),
 
-                         WarningHighLimit = (float)SC.GetValue<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningHighLimit"),
 
-                         WarningHighLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.WarningHighLimit"),
 
-                         AlarmLowLimit = (float)SC.GetValue<double>($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmLowLimit"),
 
-                         AlarmLowLimitConfig = SC.GetConfigItem($"PM1.RecipeEditParameter.AUX.Table{table}.{index}.AlarmLowLimit"),
 
-                         AlarmHighLimit = (float)SC.GetValue<double>($"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<bool>($"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<string, float>()
 
-             {
 
-                 { "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<AITAuxData> GetCurrentAuxData()
 
-         {
 
-             var datas = new List<AITAuxData>();
 
-             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<bool>("Minics.EnableMinics"))
 
-             {
 
-                 if (_initTimer.IsRunning && _initTimer.ElapsedMilliseconds < 3000)
 
-                 {
 
-                     _initTimer.Stop();
 
-                     return;
 
-                 }
 
-                 if (IsHTR1Enable != SC.GetValue<bool>("PM1.IsHTR1Enable"))
 
-                     IsHTR1Enable = SC.GetValue<bool>("PM1.IsHTR1Enable");
 
-                 if (IsHTR2Enable != SC.GetValue<bool>("PM1.IsHTR2Enable"))
 
-                     IsHTR2Enable = SC.GetValue<bool>("PM1.IsHTR2Enable");
 
-                 if (IsHTR3Enable != SC.GetValue<bool>("PM1.IsHTR3Enable"))
 
-                     IsHTR3Enable = SC.GetValue<bool>("PM1.IsHTR3Enable");
 
-                 if (IsHTR1Enable && IsF2ClnOn)
 
-                 {
 
-                     var config2Name = SC.ContainsItem("Minics.Config2") ? SC.GetStringValue("Minics.Config2") : "";
 
-                     if (_currentTableName != config2Name)
 
-                     {
 
-                         Singleton<MinicsManager>.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<MinicsManager>.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<MinicsManager>.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<bool>("PM1.IsHTR1Enable"))
 
-                 IsHTR1Enable = SC.GetValue<bool>("PM1.IsHTR1Enable");
 
-             if (IsHTR2Enable != SC.GetValue<bool>("PM1.IsHTR2Enable"))
 
-                 IsHTR2Enable = SC.GetValue<bool>("PM1.IsHTR2Enable");
 
-             if (IsHTR3Enable != SC.GetValue<bool>("PM1.IsHTR3Enable"))
 
-                 IsHTR3Enable = SC.GetValue<bool>("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<bool>("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 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;
 
-         }
 
-     }
 
- }
 
 
  |