2023-04-23 16:43:08 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
namespace Aitex.Core.RT.IOCore;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 基于AO判断的互锁限制条件。
|
|
|
|
/// </summary>
|
|
|
|
internal class AoLimit : InterlockLimit<AOAccessor, double>
|
|
|
|
{
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
public AoLimit(AOAccessor 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 =>
|
2023-04-24 14:14:08 +08:00
|
|
|
$"AO-{Io.IoTableIndex}({Io.Name}) out of range [{LimitRange}]{(string.IsNullOrEmpty(Tip) ? "" : $",{Tip}")}";
|
2023-04-23 16:43:08 +08:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Methods
|
|
|
|
|
|
|
|
protected override bool CheckInRange()
|
|
|
|
{
|
|
|
|
return LimitRange.CheckIsInRange(CurrentValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|