diff --git a/App/Modules/SicModules/Config/TM/IODefinePlatform.xml b/App/Modules/SicModules/Config/TM/IODefinePlatform.xml index 9985d55..9ba2179 100644 --- a/App/Modules/SicModules/Config/TM/IODefinePlatform.xml +++ b/App/Modules/SicModules/Config/TM/IODefinePlatform.xml @@ -164,7 +164,7 @@ - + @@ -292,14 +292,14 @@ - + diff --git a/App/SicRT/Config/System.sccfg b/App/SicRT/Config/System.sccfg index 4833280..9b3c4c8 100644 --- a/App/SicRT/Config/System.sccfg +++ b/App/SicRT/Config/System.sccfg @@ -1230,11 +1230,13 @@ + + - + @@ -1869,6 +1871,8 @@ + + diff --git a/Framework/MECF.Framework.Common/Aitex/Core/RT/Device/ErrorDetectableBaseDevice.cs b/Framework/MECF.Framework.Common/Aitex/Core/RT/Device/ErrorDetectableBaseDevice.cs index 86514ce..e8d69af 100644 --- a/Framework/MECF.Framework.Common/Aitex/Core/RT/Device/ErrorDetectableBaseDevice.cs +++ b/Framework/MECF.Framework.Common/Aitex/Core/RT/Device/ErrorDetectableBaseDevice.cs @@ -95,48 +95,67 @@ namespace MECF.Framework.Common.Aitex.Core.RT.Device EventLevel.Warning); _alarmEvent = SubscribeAlarm($"{Module}.{Display}.ToleranceAlarm", "", ResetAlarmChecker); + if (SC.ContainsItem($"{ScBasePath}.{Display}.EnableAlarm")) + { + SC.RegisterValueChangedCallback($"{ScBasePath}.{Display}.EnableAlarm", (newValue) => + { + if (!bool.TryParse(newValue.ToString(), out _isEnableErrDetection)) + { + _isEnableErrDetection = false; + LOG.Error($"Unable to convert {ScBasePath}.{Display}.EnableAlarm value {newValue} to bool"); + } - SC.RegisterValueChangedCallback($"{ScBasePath}.{Display}.EnableAlarm", (newValue) => + }); + } + + if (SC.ContainsItem($"{ScBasePath}.AlarmRange")) { - if (!bool.TryParse(newValue.ToString(), out _isEnableErrDetection)) + SC.RegisterValueChangedCallback($"{ScBasePath}.AlarmRange", (newValue) => { - _isEnableErrDetection = false; - LOG.Error($"Unable to convert {ScBasePath}.{Display}.EnableAlarm value {newValue} to bool"); - } - - }); - SC.RegisterValueChangedCallback($"{ScBasePath}.AlarmRange", (newValue) => + if (!double.TryParse(newValue.ToString(), out _alarmRange)) + { + _alarmRange = double.NaN; + LOG.Error($"Unable to convert {ScBasePath}.{Display}.AlarmRange value {newValue} to double"); + } + }); + } + + if (SC.ContainsItem($"{ScBasePath}.AlarmTime")) { - if (!double.TryParse(newValue.ToString(), out _alarmRange)) + SC.RegisterValueChangedCallback($"{ScBasePath}.AlarmTime", (newValue) => { - _alarmRange = double.NaN; - LOG.Error($"Unable to convert {ScBasePath}.{Display}.AlarmRange value {newValue} to double"); - } - }); - SC.RegisterValueChangedCallback($"{ScBasePath}.AlarmTime", (newValue) => + if (!double.TryParse(newValue.ToString(), out _alarmTime)) + { + _alarmTime = int.MinValue; + LOG.Error($"Unable to convert {ScBasePath}.{Display}.AlarmRange value {newValue} to double"); + } + }); + } + + if (SC.ContainsItem($"{ScBasePath}.WarningRange")) { - if (!double.TryParse(newValue.ToString(), out _alarmTime)) + SC.RegisterValueChangedCallback($"{ScBasePath}.WarningRange", (newValue) => { - _alarmTime = int.MinValue; - LOG.Error($"Unable to convert {ScBasePath}.{Display}.AlarmRange value {newValue} to double"); - } - }); - SC.RegisterValueChangedCallback($"{ScBasePath}.WarningRange", (newValue) => + if (!double.TryParse(newValue.ToString(), out _warningRange)) + { + _warningRange = double.NaN; + LOG.Error($"Unable to convert {ScBasePath}.{Display}.WarningRange value {newValue} to double"); + } + }); + } + + if (SC.ContainsItem($"{ScBasePath}.WarningTime")) { - if (!double.TryParse(newValue.ToString(), out _warningRange)) + SC.RegisterValueChangedCallback($"{ScBasePath}.WarningTime", (newValue) => { - _warningRange = double.NaN; - LOG.Error($"Unable to convert {ScBasePath}.{Display}.WarningRange value {newValue} to double"); - } - }); - SC.RegisterValueChangedCallback($"{ScBasePath}.WarningTime", (newValue) => - { - if (!double.TryParse(newValue.ToString(), out _warningTime)) - { - _warningTime = int.MinValue; - LOG.Error($"Unable to convert {ScBasePath}.{Display}.WarningTime value {newValue} to double"); - } - }); + if (!double.TryParse(newValue.ToString(), out _warningTime)) + { + _warningTime = int.MinValue; + LOG.Error($"Unable to convert {ScBasePath}.{Display}.WarningTime value {newValue} to double"); + } + }); + } + } #endregion diff --git a/Framework/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowUnit.cs b/Framework/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowUnit.cs index ff6b27a..50a68f5 100644 --- a/Framework/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowUnit.cs +++ b/Framework/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/GasFlow/GasFlowUnit.cs @@ -61,7 +61,10 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.GasFlow public void Initialize(string moduleName) { ModuleName = moduleName; - SC.RegisterValueChangedCallback($"PM.{ModuleName}.Efficiency.{GasFlowRatioName}", OnGasFlowRatioSCChanged); + if (SC.ContainsItem($"PM.{ModuleName}.Efficiency.{GasFlowRatioName}")) + { + SC.RegisterValueChangedCallback($"PM.{ModuleName}.Efficiency.{GasFlowRatioName}", OnGasFlowRatioSCChanged); + } GasFlowRatioValue = SC.SafeGetValue($"PM.{ModuleName}.Efficiency.{GasFlowRatioName}", 1d); if (GasName == "O2_Vent")