using System; using System.Collections.Generic; using Aitex.Core.RT.IOCore.Interlock.DataProvider; namespace Aitex.Core.RT.IOCore; public class DoubleDataPollLimit : InterlockLimit { #region Constructors public DoubleDataPollLimit(IInterlockLimitDataProvider dataProvider, string value, string tip, Dictionary cultureTip) : base(dataProvider, value, tip, cultureTip) { LimitRange = new InterlockLimitRangeDouble(value); } #endregion #region Properties private InterlockLimitRangeDouble LimitRange { get; } public override double CurrentValue => (double)DataProvider.GetValue(); public override string LimitReason => $"{DataProvider.Name} = {CurrentValue:F1}, in the range [{LimitRange}]{(string.IsNullOrEmpty(Tip) ? "" : $",{Tip}")}"; public override string DaemonReason => $"{DataProvider.Name} = {CurrentValue:F1}, in the range [{LimitRange}]{(string.IsNullOrEmpty(Tip) ? "" : $",{Tip}")}"; #endregion #region Methods protected override bool CheckInRange() { return LimitRange.CheckIsInRange(CurrentValue); } public override string ToString() { return $"{Name}, Limit={LimitRange}"; } #endregion }