private bool CheckAlarm(Channel channel, TrendingDataPoint trendingPoint, AlarmRangeLimitRow rangeLimit) { double perUnitValue; double highLimit = 0.0D; double lowLimit = 0.0D; bool highValid = true; bool lowValid = true; perUnitValue = channel.PerUnitValue ?? 1.0D; if (!rangeLimit.IsHighNull()) { highLimit = Convert.ToBoolean(rangeLimit.PerUnit) ? (rangeLimit.High * perUnitValue) : rangeLimit.High; highValid = Convert.ToBoolean(rangeLimit.RangeInclusive) ^ (trendingPoint.Value <= highLimit); } if (!rangeLimit.IsLowNull()) { lowLimit = Convert.ToBoolean(rangeLimit.PerUnit) ? (rangeLimit.Low * perUnitValue) : rangeLimit.Low; lowValid = Convert.ToBoolean(rangeLimit.RangeInclusive) ^ (trendingPoint.Value >= lowLimit); } return(!lowValid || !highValid); }
private Tuple <int, SeriesID, DateTime> GetKey(TrendingDataPoint trendingDataPoint) { return(Tuple.Create(trendingDataPoint.ChannelID, trendingDataPoint.SeriesID, trendingDataPoint.Timestamp)); }