123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Device.Unit;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.IOCore;
- using Aitex.Core.RT.OperationCenter;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Event;
- using MECF.Framework.Common.SubstrateTrackings;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Xml;
- namespace Aitex.Core.RT.Device.Unit
- {
- public class IoAutoShutter : BaseDevice, IDevice
- {
- public enum ASOpenCloseStatus
- {
- Unknown,
- Open,
- Close,
- }
- public enum ASUpDownStatus
- {
- Unknown,
- Up,
- Down,
- }
- public IoAutoShutter(string module, XmlElement node, string ioModule = "")
- {
- base.Module = string.IsNullOrEmpty(node.GetAttribute("module")) ? module : node.GetAttribute("module");
- base.Name = node.GetAttribute("id");
- base.Display = node.GetAttribute("display");
- base.DeviceID = node.GetAttribute("schematicId");
- _diOpen = ParseDiNode("diOpen", node, ioModule);
- _diClose = ParseDiNode("diClose", node, ioModule);
- _diUp = ParseDiNode("diUp", node, ioModule);
- _diDown = ParseDiNode("diDown", node, ioModule);
- _doOpen = ParseDoNode("doOpen", node, ioModule);
- _doClose = ParseDoNode("doClose", node, ioModule);
- _doUp = ParseDoNode("doUp", node, ioModule);
- _doDown = ParseDoNode("doDown", node, ioModule);
- }
- #region fields
- private DIAccessor _diOpen;
- private DIAccessor _diClose;
- private DIAccessor _diUp;
- private DIAccessor _diDown;
- private DOAccessor _doOpen;
- private DOAccessor _doClose;
- private DOAccessor _doUp;
- private DOAccessor _doDown;
- #endregion
- public AlarmEventItem AutoShutterMoveFailedForInterlock { get; set; }
- public AlarmEventItem AutoShutterOpenTimeOut { get; set; }
- public AlarmEventItem AutoShutterCloseTimeOut { get; set; }
- public AlarmEventItem AutoShutterUpTimeOut { get; set; }
- public AlarmEventItem AutoShutterDownTimeOut { get; set; }
- #region properties
- public ASOpenCloseStatus OpenCloseStatus
- {
- get
- {
- if (_diOpen != null && _diClose != null && _diOpen.Value && !_diClose.Value)
- return ASOpenCloseStatus.Open;
- if (_diOpen != null && _diClose != null && !_diOpen.Value && _diClose.Value)
- return ASOpenCloseStatus.Close;
- return ASOpenCloseStatus.Unknown;
- }
- }
- public ASUpDownStatus UpDownStatus
- {
- get
- {
- if (_diUp != null && _diDown != null && _diUp.Value && !_diDown.Value)
- return ASUpDownStatus.Up;
- if (_diUp != null && _diDown != null && !_diUp.Value && _diDown.Value)
- return ASUpDownStatus.Down;
- return ASUpDownStatus.Unknown;
- }
- }
- #endregion
- public bool Initialize()
- {
- DATA.Subscribe(Name, "OpenCloseStatus", () => OpenCloseStatus.ToString());
- DATA.Subscribe(Name, "UpDownStatus", () => UpDownStatus.ToString());
- return true;
- }
- public void Monitor()
- {
- }
- public void Reset()
- {
- }
- public void Terminate()
- {
- }
- public bool SetOpen(bool isOpen, out string reason)
- {
- if (isOpen)
- {
- _doClose.SetValue(!isOpen, out reason);
- return _doOpen.SetValue(isOpen, out reason);
- }
- else
- {
- _doOpen.SetValue(isOpen, out reason);
- return _doClose.SetValue(!isOpen, out reason);
- }
- }
- public bool SetUp(bool isUp, out string reason)
- {
- if (isUp)
- {
- _doDown.SetValue(!isUp, out reason);
- return _doUp.SetValue(isUp, out reason);
- }
- else
- {
- _doUp.SetValue(isUp, out reason);
- return _doDown.SetValue(!isUp, out reason);
- }
- }
- }
- }
|