45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System.Collections.Generic;
|
||
using Aitex.Core.RT.IOCore.Interlock.Base;
|
||
|
||
namespace Aitex.Core.RT.IOCore
|
||
{
|
||
public class InterlockAction : InterlockActionBase
|
||
{
|
||
public InterlockAction(string module, DOAccessor doItem, bool value, string tip, Dictionary<string, string> cultureTip)
|
||
: base(module, doItem, value, tip, cultureTip)
|
||
{
|
||
}
|
||
|
||
#region Methods
|
||
|
||
/// <summary>
|
||
/// 如果命中某个互锁限制条件,则将DO电平恢复到Action定义的反向电平。
|
||
/// </summary>
|
||
/// <param name="reason">执行恢复电平动作的信息。</param>
|
||
/// <returns>
|
||
/// True:执行了电平恢复操作;False:未操作电平
|
||
/// </returns>
|
||
public bool TryReverse(out string reason)
|
||
{
|
||
reason = string.Empty;
|
||
|
||
// 如果DO当前电平不等于Action定义的电平,则啥也不干
|
||
if (_do.Value != _actionValue)
|
||
return false;
|
||
|
||
// 如果DO已经输出Action定义的电平,则反向
|
||
if (_do.SetValue(!_actionValue, out reason))
|
||
reason =
|
||
$"Interlock Force set DO-{_do.IoTableIndex}({_do.Name}) = [{((!_actionValue) ? "ON" : "OFF")}]";
|
||
return true;
|
||
}
|
||
|
||
#endregion
|
||
|
||
public override void Monitor()
|
||
{
|
||
throw new System.NotSupportedException();
|
||
}
|
||
}
|
||
}
|