Sic.Framework-Nanjing-Baishi/MECF.Framework.Common/Aitex/Core/RT/IOCore/Interlock/AiLimit.cs

41 lines
937 B
C#

using System.Collections.Generic;
namespace Aitex.Core.RT.IOCore;
/// <summary>
/// 基于AI判断的互锁限制条件。
/// </summary>
internal class AiLimit : InterlockLimit<AIAccessor, double>
{
#region Constructors
public AiLimit(AIAccessor io, string value, string tip, Dictionary<string, string> cultureTip)
: base(io, value, tip, cultureTip)
{
LimitRange = new InterlockLimitRangeDouble(value);
}
#endregion
#region Properties
private InterlockLimitRangeDouble LimitRange { get; }
public override double CurrentValue => Io.FloatValue;
public override string LimitReason =>
$"AI-{Io.IoTableIndex}({Io.Name}) out of range [{LimitRange}]{(string.IsNullOrEmpty(Tip) ? "" : $",{Tip}")}";
#endregion
#region Methods
protected override bool CheckInRange()
{
return LimitRange.CheckIsInRange(CurrentValue);
}
#endregion
}