using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Model.Monitor { /// /// 过滤参数 /// public class FilterParameters : JsonModel { /// /// 最大阀值 /// public double? MaxThresholdValue { get; set; } /// /// 最小阀值 /// public double? MinThresholdValue { get; set; } /// /// 突变阀值 /// public double? MutThresholdValue { get; set; } /// /// 过滤 /// public bool Filter(double value_current, double? value_pre) { if (MaxThresholdValue != null) { if (value_current > MaxThresholdValue.Value) { return false; } } if (MinThresholdValue != null) { if (value_current < MinThresholdValue.Value) { return false; } } if (value_pre != null) { if (MutThresholdValue != null) { if (Math.Abs(value_current - value_pre.Value) > MutThresholdValue) { return false; } } } return true; } } }