Ejemplo n.º 1
0
        private bool CheckAlarm(Channel channel, TrendingDataPoint trendingPoint, AlarmRangeLimit alarmRangeLimit)
        {
            double highLimit = 0.0D;
            double lowLimit  = 0.0D;
            bool   highValid = true;
            bool   lowValid  = true;

            double perUnitValue = channel.PerUnitValue ?? 1.0D;
            double factor       = alarmRangeLimit.PerUnit ? perUnitValue : 1.0D;

            if ((object)alarmRangeLimit.High != null)
            {
                highLimit = factor * alarmRangeLimit.High.GetValueOrDefault();
                highValid = Convert.ToBoolean(alarmRangeLimit.RangeInclusive) ^ (trendingPoint.Value <= highLimit);
            }

            if ((object)alarmRangeLimit.Low != null)
            {
                lowLimit = factor * alarmRangeLimit.Low.GetValueOrDefault();
                lowValid = Convert.ToBoolean(alarmRangeLimit.RangeInclusive) ^ (trendingPoint.Value >= lowLimit);
            }

            return(!lowValid || !highValid);
        }
Ejemplo n.º 2
0
 private Tuple <int, SeriesID, DateTime> GetKey(TrendingDataPoint trendingDataPoint)
 {
     return(Tuple.Create(trendingDataPoint.ChannelID, trendingDataPoint.SeriesID, trendingDataPoint.Timestamp));
 }