Bladeren bron

fix 新增炉子 超温报警配置及其逻辑(待提交参数)

jiangjinyuan 3 dagen geleden
bovenliggende
commit
df58a183fd

+ 50 - 30
Furnace/FurnaceRT/Devices/IoHeater.cs

@@ -1,6 +1,8 @@
 using Aitex.Common.Util;
 using Aitex.Core.Common.DeviceData;
 using Aitex.Core.RT.DataCenter;
+using Aitex.Core.RT.Device;
+using Aitex.Core.RT.Device.Unit;
 using Aitex.Core.RT.Event;
 using Aitex.Core.RT.IOCore;
 using Aitex.Core.RT.Log;
@@ -9,6 +11,8 @@ using Aitex.Core.RT.ParameterCenter;
 using Aitex.Core.RT.SCCore;
 using Aitex.Core.RT.Tolerance;
 using Aitex.Core.Util;
+using FurnaceRT.Equipments.PMs;
+using FurnaceRT.Equipments.Systems;
 using MECF.Framework.Common.CommonData;
 using MECF.Framework.Common.Device.Bases;
 using MECF.Framework.Common.Equipment;
@@ -26,6 +30,7 @@ namespace FurnaceRT.Devices
 {
     public class IoHeater : HeaterBase
     {
+        private R_TRIG _trigTrigFurnaceTempabnormal = new R_TRIG();
         public IoHeater(string module, XmlElement node, string ioModule = "")
         {
             base.Module = string.IsNullOrEmpty(node.GetAttribute("module")) ? module : node.GetAttribute("module");
@@ -227,7 +232,7 @@ namespace FurnaceRT.Devices
                 {
                     if (_isFloatAioType)
                     {
-                        if(ControlMode == 0)
+                        if (ControlMode == 0)
                         {
                             if (Math.Abs(_aoCascadeControlModeSetPoint.FloatValue - value) > 0.0001)
                                 _aoCascadeControlModeSetPoint.FloatValue = value;
@@ -388,9 +393,9 @@ namespace FurnaceRT.Devices
                 DeviceSchematicId = DeviceID,
                 DisplayName = Display,
                 Module = Module,
-               
+
                 Scale = SC.GetValue<double>($"{_scRoot}.{Name}.Range"),
-                OverTempScale= SC.GetValue<double>($"{_scRoot}.{Name}.OverTempRange"),
+                OverTempScale = SC.GetValue<double>($"{_scRoot}.{Name}.OverTempRange"),
                 //Scale = 1200,
                 Unit = "°C",
                 //SetPoint = TempSetPoint,
@@ -483,7 +488,7 @@ namespace FurnaceRT.Devices
 
         public override void Monitor()
         {
-            if(!string.IsNullOrEmpty(_writeLog))
+            if (!string.IsNullOrEmpty(_writeLog))
             {
                 LOG.Write(_writeLog);
                 _writeLog = "";
@@ -501,9 +506,9 @@ namespace FurnaceRT.Devices
 
                     if (_tempSetpoint == 0)
                     {
-                        if(ControlMode == 0)
+                        if (ControlMode == 0)
                         {
-                            if(_aoCascadeControlModeSetPoint != null && _aoCascadeControlModeSetPoint.FloatValue > 0)
+                            if (_aoCascadeControlModeSetPoint != null && _aoCascadeControlModeSetPoint.FloatValue > 0)
                             {
                                 _tempSetpoint = _aoCascadeControlModeSetPoint.FloatValue;
                             }
@@ -519,8 +524,8 @@ namespace FurnaceRT.Devices
                     SetPIDParameters(SC.GetStringValue("PM1.Heater.PID"));
                 }
             }
-            
-            if(DeviceData != null)
+
+            if (DeviceData != null)
             {
                 DeviceData.CascadePID_P = _aoCascadePID_P == null ? 0 : _aoCascadePID_P.FloatValue;
                 DeviceData.CascadePID_I = _aoCascadePID_I == null ? 0 : _aoCascadePID_I.FloatValue;
@@ -552,22 +557,36 @@ namespace FurnaceRT.Devices
                     DeviceData.ProfilePreheatTime = _preheatTime - _profileTimer.ElapsedMilliseconds / 1000 > 0 ? _preheatTime - _profileTimer.ElapsedMilliseconds / 1000 : 0;
                 }
 
-                if(_profileStableTimer != null && _profileStableTimer.IsRunning)
+                if (_profileStableTimer != null && _profileStableTimer.IsRunning)
                 {
                     DeviceData.ProfileCheckTime = _checkTime - _profileStableTimer.ElapsedMilliseconds / 1000 > 0 ? _checkTime - _profileStableTimer.ElapsedMilliseconds / 1000 : 0;
                 }
             }
-           
+
             MonitorTolerance();
 
             Ramping();
 
+            MonitorToOverTemp();
             _tcBreakTrig.CLK = IsError;
             if (_tcBreakTrig.Q)
                 TCOpenOffsetOffset = _profileCorrect;
             base.Monitor();
         }
+        private void MonitorToOverTemp()
+        {
+            //        < !--7个温区中的任意一个温区的 aiCascadePV或者aiHeaterPV或者aiOverTemp达到限定值, 关闭使能 >
+            var heaterLimitData = SC.ContainsItem("System.Heater.") ? SC.GetValue<double>("System.Heater.") : 1000;
 
+            _trigTrigFurnaceTempabnormal.CLK = (_aiCascadePV != null && _aiCascadePV.FloatValue >= heaterLimitData) || (_aiHeaterPV != null && _aiHeaterPV.FloatValue >= heaterLimitData) || (_aiOverTemp != null && _aiOverTemp.FloatValue >= heaterLimitData);
+            if (_trigTrigFurnaceTempabnormal.Q)
+            {
+                var pm = Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule;
+                pm.FurnaceTempabnormalAlarm.Set($"{Name}  trigger  FurnaceTempabnormal, Feedback:{TempFeedback} ,Temperature exceeding {heaterLimitData}.");
+                pm.InitFurnaceZone(false);
+            }
+
+        }
         public override void SetTemperature(float temperature)
         {
             //if (temperature != SetpointFeedback)
@@ -583,6 +602,7 @@ namespace FurnaceRT.Devices
         }
         private void SetManualParameters(object[] param)
         {
+            SetEnable(true);
             //value:ramp
             if (param == null || param.Length < 1)
             {
@@ -616,18 +636,17 @@ namespace FurnaceRT.Devices
             _tempSetpoint = temperature;
             TempSetPoint = actualSet;
             LOG.Write($"{Name} setpoint={temperature} control mode={controlMode}");
-
             //Ramp(actualSet, (int)rampTime);
         }
         public void SetControlMode(string mode, string recipeProfileFileName = "")
         {
             var reason = "";
             DeviceData.ControlModeSetpoint = mode;
-            switch(mode.ToLower())
+            switch (mode.ToLower())
             {
                 case "heater":
                 case "heater control":
-                    if(_doSelect.Value)
+                    if (_doSelect.Value)
                         _doSelect.SetValue(false, out reason);
                     if (!_doCascadeMode.Value)
                         _doCascadeMode.SetValue(true, out reason);
@@ -647,13 +666,13 @@ namespace FurnaceRT.Devices
                         _doCascadeMode.SetValue(true, out reason);
                     break;
                 default:
-                    if(mode.ToLower().StartsWith("profile"))
+                    if (mode.ToLower().StartsWith("profile"))
                     {
-                        var arry = mode.Replace(")","").Split('(');
-                        if(arry != null && arry.Length > 1)
+                        var arry = mode.Replace(")", "").Split('(');
+                        if (arry != null && arry.Length > 1)
                         {
                             var profileArray = arry[1].Split(',');
-                            if(profileArray != null && profileArray.Length > 2)
+                            if (profileArray != null && profileArray.Length > 2)
                             {
                                 var profileFileName = profileArray[0];
                                 int.TryParse(profileArray[1], out int profileTableIndex);
@@ -679,6 +698,7 @@ namespace FurnaceRT.Devices
 
         public void SetParameters(object[] param)
         {
+            SetEnable(true);
             if (param != null && param.Length > 0)
             {
                 string zoneName = "";
@@ -740,7 +760,7 @@ namespace FurnaceRT.Devices
                 //var actualSet = temperature - profileCorrect < 0 ? 0 : temperature - profileCorrect;
                 var actualSet = temperature + _profileTCCalib;//加上flat zone的值  
                 float _rampTime = 0;
-                if(DPR && BWR)
+                if (DPR && BWR)
                 {
                     DownRate = 0;
                     UpRate = 0;
@@ -762,7 +782,7 @@ namespace FurnaceRT.Devices
                         DownRate = ramp;//单位是°C/min
                         UpRate = ramp;//单位是°C/min
                     }
-                }               
+                }
 
                 DeviceData.SetPoint = temperature;
                 DeviceData.RampSetPoint = _rampTime;
@@ -866,7 +886,7 @@ namespace FurnaceRT.Devices
         {
             return _doEnableIn.SetValue(isEnable, out _);
         }
-        
+
         public bool ResetWarningChecker()
         {
             _toleranceCheckerWarning.Reset(_warningJudgmentTime);
@@ -1017,7 +1037,7 @@ namespace FurnaceRT.Devices
             var fileName = string.Join("\\", para.ToArray());
             if (!string.IsNullOrEmpty(recipeCorrectFileName))
                 fileName = recipeCorrectFileName;
-            
+
             CurrentCorrectFileName = fileName;
             CurrentCorrectIndex = index;
             var content = ParameterFileManager.Instance.LoadParameter("Parameter\\TempCorrection", fileName, false);
@@ -1039,7 +1059,7 @@ namespace FurnaceRT.Devices
             }
 
             Dictionary<int, CorrectTableParameter> dic = new Dictionary<int, CorrectTableParameter>();
-            for(int i= 0;i < nodeSteps.Count;i++)
+            for (int i = 0; i < nodeSteps.Count; i++)
             {
                 var step = nodeSteps[i];
                 XmlElement stepNode = step as XmlElement;
@@ -1149,17 +1169,17 @@ namespace FurnaceRT.Devices
                 dic.Add(tableIndex, correctTableParameter);
             }
 
-            if(dic.ContainsKey(index))
+            if (dic.ContainsKey(index))
             {
                 var item = dic[index];
                 var heaterIndex = GetHeaterIndex() - 1;//U的index是0
-                if(item.CorrectParameterLst.Count > heaterIndex)
+                if (item.CorrectParameterLst.Count > heaterIndex)
                 {
                     _profileTemp = item.CorrectParameterLst[heaterIndex].ProfileTemp;
                     _profileCorrect = item.CorrectParameterLst[heaterIndex].ProfileCorrect;
                     _profileTCCalib = item.CorrectParameterLst[heaterIndex].ProfileTCCalib;
                     _cascadeTCCorrect = item.CorrectParameterLst[heaterIndex].CascadeTCCorrect;
-                  
+
 
                 }
                 else
@@ -1181,7 +1201,7 @@ namespace FurnaceRT.Devices
             }
             var temperature = DeviceData.SetPoint;
             var actualSet = temperature + _profileTCCalib;
-            if(temperature > 0)
+            if (temperature > 0)
                 TempSetPoint = (float)actualSet;
             DeviceData.CorrectTable = name;
             if (SC.GetStringValue("PM1.TempCorrection") != name)
@@ -1506,9 +1526,9 @@ namespace FurnaceRT.Devices
                         if (!_profileStableTimer.IsRunning)
                             _profileStableTimer.Restart();
 
-                        if(Math.Abs(TempFeedback - TempSetPoint)  > _checkLimit)
+                        if (Math.Abs(TempFeedback - TempSetPoint) > _checkLimit)
                             _profileStableTimer.Restart();
-             
+
                         _profileAlarmLimitTrig.CLK = Math.Abs(TempFeedback - TempSetPoint) > _alarmLimit && _alarmLimit > 0;
                         if (_profileAlarmLimitTrig.Q)
                             EV.PostWarningLog(ModuleName.PM1.ToString(), $"{Name} profile success setpoint={TempSetPoint} feedback={TempFeedback}, difference={Math.Abs(TempFeedback - TempSetPoint)} is more than alarm limit={_alarmLimit}");
@@ -1517,7 +1537,7 @@ namespace FurnaceRT.Devices
                         if (_profileStableTimer.ElapsedMilliseconds > _checkTime * 1000)
                         {
                             IsProfileSuccess = true;
-                            if(_profileSuccessTrig.Q)
+                            if (_profileSuccessTrig.Q)
                                 LOG.Write($"{Name} profile success setpoint={TempSetPoint} feedback={TempFeedback}");
                             return true;
                         }
@@ -1599,7 +1619,7 @@ namespace FurnaceRT.Devices
             public float TableUseRangeMax { get; set; }
             public int ProfileConditionTableNo { get; set; }
             public int TempPIDTableNo { get; set; }
-            public List<CorrectParameter> CorrectParameterLst{ get; set; }
+            public List<CorrectParameter> CorrectParameterLst { get; set; }
         }
         struct ProfileParameter
         {

+ 12 - 0
Furnace/FurnaceRT/Equipments/PMs/PMModuleAlarmDefine.cs

@@ -251,6 +251,7 @@ namespace FurnaceRT.Equipments.PMs
         public AlarmEventItem InterlockAlarm { get; set; }
         public AlarmEventItem BoatMoveToLoadPositionTimeoutWarning { get; set; }
         public AlarmEventItem Mini8ConnectAlarm { get; set; }
+        public AlarmEventItem FurnaceTempabnormalAlarm { get; set; }
         #endregion
 
         #region PLC alarm
@@ -316,6 +317,17 @@ namespace FurnaceRT.Equipments.PMs
         {
 
             InitIoAlarmSignalAlarmEvent();
+            FurnaceTempabnormalAlarm = SubscribeAlarm(new AlarmEventItem()
+            {
+                EventEnum = $"{Name}.FurnaceTempabnormalAlarm",
+                Description = $"",
+                Solution = "No information available. Press[Clear] to delete alarm message.",
+                Explaination = "No information available.",
+                AutoRecovery = false,
+                Level = EventLevel.Alarm,
+                Action = EventAction.Clear,
+                Category = "TubeAlarm",
+            }, () => { return true; });
             Mini8ConnectAlarm = SubscribeAlarm(new AlarmEventItem()
             {
                 EventEnum = $"{Name}.Mini8ConnectAlarm",

+ 12 - 6
Furnace/FurnaceRT/Equipments/PMs/PMModuleDevice.cs

@@ -644,7 +644,7 @@ namespace FurnaceRT.Equipments.PMs
         public IoAlarmSignal AlarmSignalPS13HStatus { get; set; }
         [Tag("AlarmSignalPS13LStatus")]
         public IoAlarmSignal AlarmSignalPS13LStatus { get; set; }
-      
+
         [Tag("AlarmSignalDG1Output1")]
         public IoAlarmSignal AlarmSignalDG1Output1 { get; set; }
         [Tag("AlarmSignalDG1Output2")]
@@ -1958,11 +1958,7 @@ namespace FurnaceRT.Equipments.PMs
             };
             //SensorLidClosed.OnSignalChanged += SensorLidClosed_OnSignalChanged;
 
-            TrigFurnaceUZoneHeatingEnable.SetTrigger(true, out _);
-            TrigFurnaceCUZoneHeatingEnable.SetTrigger(true, out _);
-            TrigFurnaceCZoneHeatingEnable.SetTrigger(true, out _);
-            TrigFurnaceCLZoneHeatingEnable.SetTrigger(true, out _);
-            TrigFurnaceLZoneHeatingEnable.SetTrigger(true, out _);
+            InitFurnaceZone(true);
             MINI8AlarmReset?.Reset();
             PLCCPUReset?.Reset();
             InitN2PurgeConfigData();
@@ -1970,6 +1966,16 @@ namespace FurnaceRT.Equipments.PMs
             BackUpFileDataMethod();
             CreateZIPMethod();
         }
+        public void InitFurnaceZone(bool setValue)
+        {
+            TrigFurnaceUZoneHeatingEnable?.SetTrigger(setValue, out _);
+            TrigFurnaceCUZoneHeatingEnable?.SetTrigger(setValue, out _);
+            TrigFurnaceCZoneHeatingEnable?.SetTrigger(setValue, out _);
+            TrigFurnaceCLZoneHeatingEnable?.SetTrigger(setValue, out _);
+            TrigFurnaceLZoneHeatingEnable?.SetTrigger(setValue, out _);
+            _heaters.ForEach(a => a?.SetEnable(setValue));
+
+        }
         private void InitSCToAODO()
         {