12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- using Aitex.Core.Util;
- namespace Aitex.Core.RT.IOCore
- {
- /*
- *
- <Action do="DO_MFC1_valve__" value="true" tip="" tip.zh-CN="" tip.en-US="">
- <Limit di="DI_Chamber_door_sw" value="true" tip="" tip.zh-CN="" tip.en-US="" />
- </Action>
- *
- */
- internal class InterlockLimit
- {
- public string Name
- {
- get { return _di.Name; }
- }
- public bool Value
- {
- get { return _limitValue; }
- }
- public string Tip
- {
- get
- {
- return _tip;
- }
- }
- public string Module
- {
- get { return _module; }
- }
-
- private DIAccessor _di;
- private bool _limitValue;
- private string _tip;
- private string _module;
- private Dictionary<string, string> _cultureTip = new Dictionary<string, string>();
- R_TRIG _trigger = new R_TRIG();
- public InterlockLimit(DIAccessor diItem, bool value, string tip, Dictionary<string, string> cultureTip, string module)
- {
- _di = diItem;
- _limitValue = value;
- _tip = tip;
- _cultureTip = cultureTip;
- _module = module;
- }
- public bool IsSame(string diName, bool value)
- {
- return (diName == _di.Name) && (_limitValue == value);
- }
- public bool IsSame(InterlockLimit limit)
- {
- return (limit.Name == _di.Name) && (_limitValue == limit.Value);
- }
- public bool IsTriggered()
- {
- _trigger.CLK = _di.Value != _limitValue;
- return _trigger.Q;
- }
- public bool CanDo(out string reason)
- {
- reason = string.Empty;
- if (_di.Value == _limitValue)
- return true;
- reason = string.Format("DI-{0}({1}) = [{2}],{3}", _di.IoTableIndex, _di.Name, _di.Value ? "ON" : "OFF", _tip);
- return false;
- }
- }
- }
|