Ejemplo n.º 1
0
        protected override void CheckAlarm(object sender, ValueChangingEventArgs <Storage> e)
        {
            if (_enable)
            {
                SubCondition condition;
                float        value = _tag.ScaleToValue(e.NewValue);
                for (int i = 0; i < _subConditions.Length; i++)
                {
                    if (_subConditions[i].IsEnabled)
                    {
                        condition = _subConditions[i];
                        if (i < 2) //Hi Alarm
                        {
                            if (value > condition.Threshold)
                            {
                                OnActive(condition, e.NewValue, e.NewTimeStamp);
                                return;
                            }
                            else if (_deadBand > 0 && ActiveSubCondition == condition.SubAlarmType &&
                                     value > condition.Threshold - _deadBand)
                            {
                                return;
                            }
                        }
                        else   //Low Alarm
                        {
                            if (value < condition.Threshold)
                            {
                                OnActive(condition, e.NewValue, e.NewTimeStamp);
                                return;
                            }
                            else if (_deadBand > 0 && ActiveSubCondition == condition.SubAlarmType &&
                                     value > condition.Threshold + _deadBand)
                            {
                                return;
                            }
                        }
                    }
                }

                OnInActive(e.NewValue);
            }
        }
Ejemplo n.º 2
0
 protected abstract void CheckAlarm(object sender, ValueChangingEventArgs <Storage> e);