| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Xml;using Aitex.Core.Common.DeviceData;using Aitex.Core.RT.DataCenter;using Aitex.Core.RT.Device;using Aitex.Core.RT.Event;using Aitex.Core.RT.IOCore;using Aitex.Core.RT.Log;using Aitex.Core.RT.OperationCenter;using Aitex.Core.RT.SCCore;using Aitex.Core.Util;using FACore.E87FA;using FurnaceRT.Equipments.LPs;using FurnaceRT.Equipments.Systems;using MECF.Framework.Common.Equipment;using MECF.Framework.Common.SubstrateTrackings;using MECF.Framework.FA.Core.E87FA;namespace FurnaceRT.Devices{    public enum SignalType    {        Acitvie,        Passive,    }    public enum SignalID    {        LightCurtain,        CS_0,        CS_1,        AM_AVBL,        VALID,        TR_REQ,        BUSY,        COMPT,        CONT,        L_REQ,        U_REQ,        HO_AVBL,        READY,        ES    }    public class Signal    {        public bool Value        {            get            {                if (_di != null)                    return _di.Value;                if (_do != null)                    return _do.Value;                return false;            }        }        private SignalID _id;        private RD_TRIG _trig = new RD_TRIG();        private DIAccessor _di = null;        private DOAccessor _do = null;        public event Action<SignalID, bool> OnChanged;        public Signal(SignalID id, DIAccessor diAccessor, DOAccessor doAccessor)        {            _id = id;            _di = diAccessor;            _do = doAccessor;        }        public void Monitor()        {            if (_di != null)                _trig.CLK = _di.Value;            if (_do != null)                _trig.CLK = _do.Value;            if (_trig.R)            {                if (OnChanged != null)                    OnChanged(_id, true);            }            if (_trig.M)            {                if (OnChanged != null)                    OnChanged(_id, false);            }        }        public void Reset()        {            _trig.RST = true;        }    }    public class E84Passiver : BaseDevice, IDevice    {        public enum E84State        {            Normal,            LD_TP1_Timeout,            LD_TP2_Timeout,            LD_TP3_Timeout,            LD_TP4_Timeout,            LD_TP5_Timeout,            LD_TP6_Timeout,            ULD_TP1_Timeout,            ULD_TP2_Timeout,            ULD_TP3_Timeout,            ULD_TP4_Timeout,            ULD_TP5_Timeout,            ULD_TP6_Timeout,            Error,        }        public enum Timeout        {            TP1,            TP2,            TP3,            TP4,            TP5,        }        public bool LightCurtainBroken { get { return !DiLightCurtain; } }   //interlock        public AccessMode Mode { get; set; }        public LPTransferState TransferState { get; set; }        public LPReservationState LPReserved { get; set; }        public IFALoadPort Provider { get; set; }        public bool DiLightCurtain { get; set; }        public bool DiValid { get { return _diValid != null ? _diValid.Value : false; } }        public bool DiCS0 { get { return _diCS0 != null ? _diCS0.Value : false; } }        public bool DiCS1 { get { return _diCS1 != null ? _diCS1.Value : false; } }        public bool DiTrReq { get { return _diTrReq != null ? _diTrReq.Value : false; } }        public bool DiBusy { get { return _diBusy != null ? _diBusy.Value : false; } }        public bool DiCompt { get { return _diCompt != null ? _diCompt.Value : false; } }        public bool DiCont { get { return _diCont != null ? _diCont.Value : false; } }        public bool DiAmAvbl { get { return _diAmAvbl != null ? _diAmAvbl.Value : false; } }        public bool DoLoadReq { get { return _doLoadReq != null ? _doLoadReq.Value : false; } }        public bool DoUnloadReq { get { return _doUnloadReq != null ? _doUnloadReq.Value : false; } }        public bool DoReady { get { return _doReady != null ? _doReady.Value : false; } }        public bool DoHOAvbl { get { return _doHOAvbl != null ? _doHOAvbl.Value : false; } }        public bool DoES { get { return _doES != null ? _doES.Value : false; } }        public string EventE84LoadTransactionStart => $"E84{Module}LoadTransactionStart";        public string EventE84UnloadTransactionStart => $"E84{Module}UnloadTransactionStart";        public string EventE84LoadTransactionComplete => $"E84{Module}LoadTransactionComplete";        public string EventE84UnloadTransactionComplete => $"E84{Module}UnloadTransactionComplete";        public string EventE84LoadTransactionRestart => $"E84{Module}LoadTransactionRestart";        public string EventE84UnloadTransactionRestart => $"E84{Module}UnloadTransactionRestart";        public string EventE84ChangeAccessModeToAuto => $"E84{Module}ChangeAccessModeToAuto";        public string EventE84ChangeAccessModeToManual => $"E84{Module}ChangeAccessModeToManual";        public static string EventE84TP1Timeout = "E84TP1Timeout";        public static string EventE84TP2Timeout = "E84TP2Timeout";        public static string EventE84TP3Timeout = "E84TP3Timeout";        public static string EventE84TP4Timeout = "E84TP4Timeout";        public static string EventE84TP5Timeout = "E84TP5Timeout";        public static string EventE84TP6Timeout = "E84TP6Timeout";        public bool IsFoupPresent        {            get            {                //if (SC.GetValue<bool>("System.IsSimulatorMode"))                //    return CarrierManager.Instance.HasCarrier(Module);                if (_diPresent1 != null && _diPresent2 != null && _diPresent3 != null && _diSeat != null)                    return _diPresent1.Value && _diPresent2.Value && _diPresent3.Value && _diSeat.Value;                return false;            }        }        //Active equipment signal        private DIAccessor _diLightCurtain;        private DIAccessor _diValid;        private DIAccessor _diCS0;        private DIAccessor _diCS1;        private DIAccessor _diAmAvbl;        private DIAccessor _diTrReq;        private DIAccessor _diBusy;        private DIAccessor _diCompt;        private DIAccessor _diCont;        private DIAccessor _diPresent1;        private DIAccessor _diPresent2;        private DIAccessor _diPresent3;        private DIAccessor _diSeat;        //Passive         private DOAccessor _doLoadReq;        private DOAccessor _doUnloadReq;        private DOAccessor _doReady;        private DOAccessor _doHOAvbl;        private DOAccessor _doES;        private DeviceTimer _timer = new DeviceTimer();        private DeviceTimer _timer_TP1 = new DeviceTimer();        private DeviceTimer _timer_TP2 = new DeviceTimer();        private DeviceTimer _timer_TP3 = new DeviceTimer();        private DeviceTimer _timer_TP4 = new DeviceTimer();        private DeviceTimer _timer_TP5 = new DeviceTimer();        private DeviceTimer _timer_TP6 = new DeviceTimer();        private R_TRIG _trigReset = new R_TRIG();        private List<Signal> _signals = new List<Signal>();        //timeout        private SCConfigItem _scTimeoutTP1;        private SCConfigItem _scTimeoutTP2;        private SCConfigItem _scTimeoutTP3;        private SCConfigItem _scTimeoutTP4;        private SCConfigItem _scTimeoutTP5;        private SCConfigItem _scTimeoutTP6;        private SCConfigItem _scTimeoutTP7;        private SCConfigItem _scTimeoutTP8;        //private int reqOnTimeout    = 2;        //L_REQ|U_REQ_ON ON ---> TR REQ ON        //private int readyOnTimeout  = 2;        //READY ON ---> BUSY ON          //private int busyOnTimeout   = 2;        //BUSYON -- CARRIAGE DETECT|CARRIAGE REMOVE        //private int reqOffTimeout   = 2;        //L_REQ|U_REQ off --->BUSY off        //private int readyOffTimeout = 2;        //Ready off --->Valid off        private E84State _state;        private string _lastSignalValue = "";        //private Timeout _tp;        /// <summary>        /// This constructor uses DeviceModel's node to define IOs        /// </summary>        /// <param name="module"></param>        /// <param name="node"></param>        /// <param name="ioModule"></param>        public E84Passiver(string module, XmlElement node, string ioModule = "")        {            base.Module = node.GetAttribute("module");            base.Name = node.GetAttribute("id");            base.Display = node.GetAttribute("display");            base.DeviceID = node.GetAttribute("schematicId");            _diLightCurtain = ParseDiNode("LightCurtain", node, ioModule);            _signals.Add(new Signal(SignalID.LightCurtain, _diLightCurtain, null));            //Indicates that the signal transition is active and selected            //ON: valid; OFF: not valid            _diValid = ParseDiNode("VALID", node, ioModule);            _signals.Add(new Signal(SignalID.VALID, _diValid, null));            //Carrier stage 0            //ON: Use the load port for carrier handoff; vice versa            _diCS0 = ParseDiNode("CS0", node, ioModule);            _signals.Add(new Signal(SignalID.CS_0, _diCS0, null));            //Carrier stage 1            //ON: Use the load port for carrier handoff; vice versa            _diCS1 = ParseDiNode("CS1", node, ioModule);            _signals.Add(new Signal(SignalID.CS_1, _diCS1, null));            //Transfer Arm Available            //ON: Handoff is available; OFF: Handoff is unavailable with any error            _diAmAvbl = ParseDiNode("AMAVBL", node, ioModule);            _signals.Add(new Signal(SignalID.AM_AVBL, _diAmAvbl, null));            //Transfer Request            //ON: Request Handoff; vice versa            _diTrReq = ParseDiNode("TRREQ", node, ioModule);            _signals.Add(new Signal(SignalID.TR_REQ, _diTrReq, null));            //BUSY for transfer            //ON: Handoff is in progress; vice versa            _diBusy = ParseDiNode("BUSY", node, ioModule);            _signals.Add(new Signal(SignalID.BUSY, _diBusy, null));            //Complete Transfer            //ON:The handoff is completed; vice versa            _diCompt = ParseDiNode("COMPT", node, ioModule);            _signals.Add(new Signal(SignalID.COMPT, _diCompt, null));            //Continuous Handoff            //ON: Continuous Handoff; vice versa            _diCont = ParseDiNode("CONT", node, ioModule);            _signals.Add(new Signal(SignalID.CONT, _diCont, null));            _diPresent1 = ParseDiNode("Present1", node, ioModule);            _diPresent2 = ParseDiNode("Present2", node, ioModule);            _diPresent3 = ParseDiNode("Present3", node, ioModule);            _diSeat = ParseDiNode("Seat", node, ioModule);            //Load Request            //ON: The load port is assigned to load a carrier; vice versa            //CS_0 && VALID && !CarrierLoaded            _doLoadReq = ParseDoNode("LREQ", node, ioModule);            _signals.Add(new Signal(SignalID.L_REQ, null, _doLoadReq));            //Unload Request            //ON: The load port is assigned to unload a carrier; vice versa            //CS_0 && VALID && !CarrierUnloaded            _doUnloadReq = ParseDoNode("UREQ", node, ioModule);            _signals.Add(new Signal(SignalID.U_REQ, null, _doUnloadReq));            //READY for transfer(after accepted the transfer request set ON, turned OFF when COMPT ON)            //ON: Ready for handoff; vice versa            _doReady = ParseDoNode("READY", node, ioModule);            _signals.Add(new Signal(SignalID.READY, null, _doReady));            //Indicates the passive equipment is not available for the handoff.            //ON: Handoff is available; OFF: vice versa but with error            //ON when normal; OFF when : Maintenance mode / Error State             _doHOAvbl = ParseDoNode("HOAVBL", node, ioModule);            _signals.Add(new Signal(SignalID.HO_AVBL, null, _doHOAvbl));            //Emergency stop            _doES = ParseDoNode("ES", node, ioModule);            _signals.Add(new Signal(SignalID.ES, null, _doES));            foreach (var signal in _signals)            {                signal.OnChanged += OnSignalChange;            }            _scTimeoutTP1 = SC.GetConfigItem("FA.E84.TP1");            _scTimeoutTP2 = SC.GetConfigItem("FA.E84.TP2");            _scTimeoutTP3 = SC.GetConfigItem("FA.E84.TP3");            _scTimeoutTP4 = SC.GetConfigItem("FA.E84.TP4");            _scTimeoutTP5 = SC.GetConfigItem("FA.E84.TP5");            _scTimeoutTP6 = SC.GetConfigItem("FA.E84.TP6");            _scTimeoutTP7 = SC.GetConfigItem("FA.E84.TP7");            _scTimeoutTP8 = SC.GetConfigItem("FA.E84.TP8");            OP.Subscribe($"{Module}.E84Place", (cmd, param) =>            {                if (!AutoLoad(out var reason))                {                    EV.PostWarningLog(Module, $"{Name} can not Place, {reason}");                    return false;                }                return true;            });            OP.Subscribe($"{Module}.E84Pick", (cmd, param) =>            {                if (!AutoUnLoad(out var reason))                {                    EV.PostWarningLog(Module, $"{Name} can not Pick, {reason}");                    return false;                }                return true;            });            OP.Subscribe($"{Module}.E84Retry", (cmd, param) =>            {                if (!E84Retry(out var reason))                {                    EV.PostWarningLog(Module, $"{Name} can not retry E84 transaction, {reason}");                    return false;                }                return true;            });            OP.Subscribe($"{Module}.E84Complete", (cmd, param) =>            {                if (!E84Complete(out var reason))                {                    EV.PostWarningLog(Module, $"{Name} can not complete E84 transaction, {reason}");                    return false;                }                return true;            });            DATA.Subscribe($"{Module}.E84State", () => _state.ToString());            //DATA.Subscribe($"{Module}.TransferState", () => TransferState.ToString());            //DATA.Subscribe($"{Module}.AccessMode", () => Mode.ToString());            DATA.Subscribe($"{Module}_E84STATE", () => (ushort)_state);            //DATA.Subscribe($"{Module}_TRANSFER_STATE", () => (ushort)TransferState);            //DATA.Subscribe($"{Module}_ACCESS_MODE", () => (ushort)Mode);            DATA.Subscribe($"{Module}.LightCurtain", () => (_diLightCurtain != null ? _diLightCurtain.Value : true));            DATA.Subscribe($"{Module}.Valid", () => _diValid.Value);            DATA.Subscribe($"{Module}.TransferRequest", () => _diTrReq.Value);            DATA.Subscribe($"{Module}.Busy", () => _diBusy.Value);            DATA.Subscribe($"{Module}.TransferComplete", () => _diCompt.Value);            DATA.Subscribe($"{Module}.CS0", () => _diCS0.Value);            DATA.Subscribe($"{Module}.CS1", () => _diCS1.Value);            DATA.Subscribe($"{Module}.CONT", () => _diCont.Value);            DATA.Subscribe($"{Module}.LoadRequest", () => _doLoadReq.Value);            DATA.Subscribe($"{Module}.UnloadRequest", () => _doUnloadReq.Value);            DATA.Subscribe($"{Module}.ReadyToTransfer", () => _doReady.Value);            DATA.Subscribe($"{Module}.HandoffAvailable", () => _doHOAvbl.Value);            DATA.Subscribe($"{Module}.ES", () => _doES.Value);            int index = (int)(ModuleName)(Enum.Parse(typeof(ModuleName), Module)) - 1;            EV.Subscribe(new EventItem(60061 + 10 * index, "Event", AlarmTP1timeout, $"{Module} Occurred TP1 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem(60062 + 10 * index, "Event", AlarmTP2timeout, $"{Module} Occurred TP2 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem(60063 + 10 * index, "Event", AlarmTP3timeout, $"{Module} Occurred TP3 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem(60064 + 10 * index, "Event", AlarmTP4timeout, $"{Module} Occurred TP4 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem(60065 + 10 * index, "Event", AlarmTP5timeout, $"{Module} Occurred TP5 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem("Event", EventE84LoadTransactionStart, $"{Module} Load Transaction Start", EventLevel.Information, Aitex.Core.RT.Event.EventType.EventUI_Notify));            EV.Subscribe(new EventItem("Event", EventE84UnloadTransactionStart, $"{Module} Unload Transaction Start", EventLevel.Information, Aitex.Core.RT.Event.EventType.EventUI_Notify));            EV.Subscribe(new EventItem("Event", EventE84LoadTransactionComplete, $"{Module} Load Transaction Complete", EventLevel.Information, Aitex.Core.RT.Event.EventType.EventUI_Notify));            EV.Subscribe(new EventItem("Event", EventE84UnloadTransactionComplete, $"{Module} Unload Transaction Complete", EventLevel.Information, Aitex.Core.RT.Event.EventType.EventUI_Notify));            EV.Subscribe(new EventItem("Event", EventE84LoadTransactionRestart, $"{Module} Load Transaction Restart", EventLevel.Information, Aitex.Core.RT.Event.EventType.EventUI_Notify));            EV.Subscribe(new EventItem("Event", EventE84UnloadTransactionRestart, $"{Module} Unload Transaction Restart", EventLevel.Information, Aitex.Core.RT.Event.EventType.EventUI_Notify));            EV.Subscribe(new EventItem("Event", EventE84ChangeAccessModeToAuto, $"{Module} Change Access Mode To Auto", EventLevel.Information, Aitex.Core.RT.Event.EventType.EventUI_Notify));            EV.Subscribe(new EventItem("Event", EventE84ChangeAccessModeToManual, $"{Module} Change Access Mode To Manual", EventLevel.Information, Aitex.Core.RT.Event.EventType.EventUI_Notify));            _thread = new PeriodicJob(10, OnTimer, $"{Module}.{Name} MonitorE84Handler", true);        }        private string AlarmTP1timeout { get => $"{Module}TP1Timeout"; }        private string AlarmTP2timeout { get => $"{Module}TP2Timeout"; }        private string AlarmTP3timeout { get => $"{Module}TP3Timeout"; }        private string AlarmTP4timeout { get => $"{Module}TP4Timeout"; }        private string AlarmTP5timeout { get => $"{Module}TP5Timeout"; }        /// <summary>        /// This constructor gets IO signals using GetIO        /// </summary>        /// <param name="module"></param>        /// <param name="name"></param>        /// <param name="display"></param>        /// <param name="deviceId"></param>        public E84Passiver(string module, string name, string display, string deviceId)        {            Module = module;            Name = name;            Display = display;            DeviceID = deviceId;            _diLightCurtain = IO.DI[$"DI_{module}_LightCurtain"];            _signals.Add(new Signal(SignalID.LightCurtain, _diLightCurtain, null));            //Indicates that the signal transition is active and selected            //ON: valid; OFF: not valid            _diValid = IO.DI[$"DI_{module}_VALID"];            _signals.Add(new Signal(SignalID.VALID, _diValid, null));            //Carrier stage 0            //ON: Use the load port for carrier handoff; vice versa            _diCS0 = IO.DI[$"DI_{module}_CS_0"];            _signals.Add(new Signal(SignalID.CS_0, _diCS0, null));            //Carrier stage 1            //ON: Use the load port for carrier handoff; vice versa            _diCS1 = IO.DI[$"DI_{module}_CS_1"] ?? IO.DI[$"DI_{module}_CS_0"];            _signals.Add(new Signal(SignalID.CS_1, _diCS1, null));            //Transfer Arm Available            //ON: Handoff is available; OFF: Handoff is unavailable with any error            _diAmAvbl = IO.DI[$"DI_{module}_AM_AVBL"];            _signals.Add(new Signal(SignalID.AM_AVBL, _diAmAvbl, null));            //Transfer Request            //ON: Request Handoff; vice versa            _diTrReq = IO.DI[$"DI_{module}_TR_REQ"];            _signals.Add(new Signal(SignalID.TR_REQ, _diTrReq, null));            //BUSY for transfer            //ON: Handoff is in progress; vice versa            _diBusy = IO.DI[$"DI_{module}_BUSY"];            _signals.Add(new Signal(SignalID.BUSY, _diBusy, null));            //Complete Transfer            //ON:The handoff is completed; vice versa            _diCompt = IO.DI[$"DI_{module}_COMPT"];            _signals.Add(new Signal(SignalID.COMPT, _diCompt, null));            //Continuous Handoff            //ON: Continuous Handoff; vice versa            _diCont = IO.DI[$"DI_{module}_CONT"];            _signals.Add(new Signal(SignalID.CONT, _diCont, null));            //Load Request            //ON: The load port is assigned to load a carrier; vice versa            //CS_0 && VALID && !CarrierLoaded            _doLoadReq = IO.DO[$"DI_{module}_L_REQ"];            _signals.Add(new Signal(SignalID.L_REQ, null, _doLoadReq));            //Unload Request            //ON: The load port is assigned to unload a carrier; vice versa            //CS_0 && VALID && !CarrierUnloaded            _doUnloadReq = IO.DO[$"DI_{module}_U_REQ"];            _signals.Add(new Signal(SignalID.U_REQ, null, _doUnloadReq));            //READY for transfer(after accepted the transfer request set ON, turned OFF when COMPT ON)            //ON: Ready for handoff; vice versa            _doReady = IO.DO[$"DI_{module}_READY"];            _signals.Add(new Signal(SignalID.READY, null, _doReady));            //Indicates the passive equipment is not available for the handoff.            //ON: Handoff is available; OFF: vice versa but with error            //ON when normal; OFF when : Maintenance mode / Error State             _doHOAvbl = IO.DO[$"DI_{module}_HO_AVBL"];            _signals.Add(new Signal(SignalID.HO_AVBL, null, _doHOAvbl));            //Emergency stop            _doES = IO.DO[$"DI_{module}_ES"];            _signals.Add(new Signal(SignalID.ES, null, _doES));            foreach (var signal in _signals)            {                signal.OnChanged += OnSignalChange;            }            _scTimeoutTP1 = SC.GetConfigItem("FA.E84.TP1");            _scTimeoutTP2 = SC.GetConfigItem("FA.E84.TP2");            _scTimeoutTP3 = SC.GetConfigItem("FA.E84.TP3");            _scTimeoutTP4 = SC.GetConfigItem("FA.E84.TP4");            _scTimeoutTP5 = SC.GetConfigItem("FA.E84.TP5");            _scTimeoutTP6 = SC.GetConfigItem("FA.E84.TP6");            _scTimeoutTP7 = SC.GetConfigItem("FA.E84.TP7");            _scTimeoutTP8 = SC.GetConfigItem("FA.E84.TP8");            OP.Subscribe($"{Module}.E84Place", (cmd, param) =>            {                if (!AutoLoad(out var reason))                {                    EV.PostWarningLog(Module, $"{Name} can not Place, {reason}");                    return false;                }                return true;            });            OP.Subscribe($"{Module}.E84Pick", (cmd, param) =>            {                if (!AutoUnLoad(out var reason))                {                    EV.PostWarningLog(Module, $"{Name} can not Pick, {reason}");                    return false;                }                return true;            });            OP.Subscribe($"{Module}.E84Retry", (cmd, param) =>            {                if (!E84Retry(out var reason))                {                    EV.PostWarningLog(Module, $"{Name} can not retry E84 transaction, {reason}");                    return false;                }                return true;            });            OP.Subscribe($"{Module}.E84Complete", (cmd, param) =>            {                if (!E84Complete(out var reason))                {                    EV.PostWarningLog(Module, $"{Name} can not complete E84 transaction, {reason}");                    return false;                }                return true;            });            DATA.Subscribe($"{Module}.E84State", () => _state.ToString());            //DATA.Subscribe($"{Module}.TransferState", () => TransferState.ToString());            // DATA.Subscribe($"{Module}.AccessMode", () => Mode.ToString());            DATA.Subscribe($"{Module}.LightCurtain", () => _diLightCurtain.Value);            DATA.Subscribe($"{Module}.Valid", () => _diValid.Value);            DATA.Subscribe($"{Module}.TransferRequest", () => _diTrReq.Value);            DATA.Subscribe($"{Module}.Busy", () => _diBusy.Value);            DATA.Subscribe($"{Module}.TransferComplete", () => _diCompt.Value);            DATA.Subscribe($"{Module}.CS0", () => _diCS0.Value);            DATA.Subscribe($"{Module}.CS1", () => _diCS1.Value);            DATA.Subscribe($"{Module}.CONT", () => _diCont.Value);            DATA.Subscribe($"{Module}.LoadRequest", () => _doLoadReq.Value);            DATA.Subscribe($"{Module}.UnloadRequest", () => _doUnloadReq.Value);            DATA.Subscribe($"{Module}.ReadyToTransfer", () => _doReady.Value);            DATA.Subscribe($"{Module}.HandoffAvailable", () => _doHOAvbl.Value);            DATA.Subscribe($"{Module}.ES", () => _doES.Value);            int index = (int)(ModuleName)(Enum.Parse(typeof(ModuleName), Module)) - 1;            EV.Subscribe(new EventItem(60061 + 10 * index, "Event", AlarmTP1timeout, $"{Module} Occurred TP1 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem(60062 + 10 * index, "Event", AlarmTP2timeout, $"{Module} Occurred TP2 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem(60063 + 10 * index, "Event", AlarmTP3timeout, $"{Module} Occurred TP3 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem(60064 + 10 * index, "Event", AlarmTP4timeout, $"{Module} Occurred TP4 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            EV.Subscribe(new EventItem(60065 + 10 * index, "Event", AlarmTP5timeout, $"{Module} Occurred TP5 Timeout", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));            _thread = new PeriodicJob(10, OnTimer, $"{Module}.{Name} MonitorE84Handler", true);        }        private PeriodicJob _thread;        public bool Stop(out string reason)        {            reason = String.Empty;            ResetSignal();            return false;        }        public bool AutoLoad(out string reason)        {            //reason = String.Empty;            //if (Mode != LPAccessMode.AUTO)            //{            //    if (!SetAMHS(out reason))            //    {            //        return false;            //    }            //}            //if (Provider.ReadyForLoad())            //{            //    TransferState = LPTransferState.READY_TO_LOAD;            //    return true;            //}            reason = "Not Ready For Auto Load";            return false;        }        public bool AutoUnLoad(out string reason)        {            //reason = String.Empty;            //if (Mode != LPAccessMode.AUTO)            //{            //    if (!SetAMHS(out reason))            //    {            //        return false;            //    }            //}            //if (Provider.ReadyForUnload())            //{            //    TransferState = LPTransferState.READY_TO_UNLOAD;            //    return true;            //}            reason = "Not Ready For Auto Load";            return false;        }        public bool SetAMHS(out string reason)        {            reason = "";            Provider.SetAccessMode(true, out reason);            return true;        }        public bool SetManual(out string reason)        {            reason = "";            Provider.SetAccessMode(false, out reason);            return true;        }        public bool E84Retry(out string reason)        {            reason = "";            var dvid = new SerializableDictionary<string, object>();            int portID = 0;            dvid["PORT_ID"] = int.TryParse(Module.Replace("LP", ""), out portID) ? portID : portID;            ResetSignal();            //Provider.E84Retry();            return true;        }        public bool E84Complete(out string reason)        {            reason = "";            var dvid = new SerializableDictionary<string, object>();            int portID = 0;            dvid["PORT_ID"] = int.TryParse(Module.Replace("LP", ""), out portID) ? portID : portID;            switch (_state)            {                case E84State.Error:                    ResetSignal();                    break;                case E84State.LD_TP1_Timeout:                    if (IsFoupPresent)                    {                        EV.Notify(EventE84LoadTransactionComplete, dvid);                        ResetSignal();                    }                    else                    {                        reason = "Foup not detected";                        return false;                    }                    break;                case E84State.LD_TP2_Timeout:                    if (IsFoupPresent)                    {                        EV.Notify(EventE84LoadTransactionComplete, dvid);                        ResetSignal();                    }                    else                    {                        reason = "Foup not detected";                        return false;                    }                    break;                case E84State.LD_TP3_Timeout:                    if (IsFoupPresent)                    {                        EV.Notify(EventE84LoadTransactionComplete, dvid);                        ResetSignal();                    }                    else                    {                        reason = "Foup not detected";                        return false;                    }                    break;                case E84State.LD_TP4_Timeout:                    if (IsFoupPresent)                    {                        EV.Notify(EventE84LoadTransactionComplete, dvid);                        ResetSignal();                    }                    else                    {                        reason = "Foup not detected";                        return false;                    }                    break;                case E84State.LD_TP5_Timeout:                    ResetSignal();                    break;                case E84State.ULD_TP1_Timeout:                    if (!IsFoupPresent)                    {                        EV.Notify(EventE84UnloadTransactionComplete, dvid);                        ResetSignal();                    }                    else                    {                        reason = "Foup detected";                        return false;                    }                    break;                case E84State.ULD_TP2_Timeout:                    if (!IsFoupPresent)                    {                        EV.Notify(EventE84UnloadTransactionComplete, dvid);                        ResetSignal();                    }                    else                    {                        reason = "Foup detected";                        return false;                    }                    break;                case E84State.ULD_TP3_Timeout:                    if (!IsFoupPresent)                    {                        EV.Notify(EventE84UnloadTransactionComplete, dvid);                        ResetSignal();                    }                    else                    {                        reason = "Foup detected";                        return false;                    }                    break;                case E84State.ULD_TP4_Timeout:                    if (!IsFoupPresent)                    {                        EV.Notify(EventE84UnloadTransactionComplete, dvid);                        ResetSignal();                    }                    else                    {                        reason = "Foup detected";                        return false;                    }                    break;                case E84State.ULD_TP5_Timeout:                    ResetSignal();                    break;                default:                    ResetSignal();                    break;            }            return true;        }        public bool Initialize()        {            ResetSignal();            return true;        }        private bool InvokeReset(string arg1, object[] arg2)        {            //string reason;            EV.PostInfoLog(Module, $"E84 reset {Module}.{Name}");            ResetSignal();            return true;        }        public void Terminate()        {            ResetSignal();        }        private void ResetSignal()        {            _doLoadReq.SetValue(false, out _);            _doUnloadReq.SetValue(false, out _);            _doReady.SetValue(false, out _);            _doHOAvbl.SetValue(false, out _);            _doES.SetValue(false, out _);            _timer_TP1.Stop();            _timer_TP2.Stop();            _timer_TP3.Stop();            _timer_TP4.Stop();            _timer_TP5.Stop();            _state = E84State.Normal;            foreach (var signal in _signals)            {                signal.Reset();            }        }        private LPTransferState preTranState;        private bool OnTimer()        {            try            {                foreach (var signal in _signals)                {                    signal.Monitor();                }                RecordSignalChange();                if (Provider == null)                    return true;                TransferState = (LPTransferState)Provider.GetTransferState();                Mode = (AccessMode)Provider.GetAccessMode();                LPReserved = (LPReservationState)Provider.GetReservedState();                if (_diLightCurtain != null)                {                    DiLightCurtain = _diLightCurtain.Value;                    if (SC.ContainsItem("Fa.E84.BypassLightCurtain") && SC.GetValue<bool>("Fa.E84.BypassLightCurtain"))                        DiLightCurtain = true;                }                else DiLightCurtain = true;                if (LightCurtainBroken || TransferState == LPTransferState.OUT_OF_SERVICE || Mode != AccessMode.Auto)                {                    _doHOAvbl.SetValue(false, out _);                    _doLoadReq.SetValue(false, out _);                    _doUnloadReq.SetValue(false, out _);                    _doReady.SetValue(false, out _);                    _doES.SetValue(false, out _);                    _timer_TP1.Stop();                    _timer_TP2.Stop();                    _timer_TP3.Stop();                    _timer_TP4.Stop();                    _timer_TP5.Stop();                    _timer_TP6.Stop();                    preTranState = TransferState;                    return true;                }                if (_state != E84State.Normal)                    return true;                _doHOAvbl.SetValue(true, out _);                _doES.SetValue(true, out _);                var dvid = new SerializableDictionary<string, object>();                int portID = 0;                dvid["PORT_ID"] = int.TryParse(Module.Replace("LP", ""), out portID) ? portID : portID;                if (TransferState == LPTransferState.READY_TO_LOAD && !IsFoupPresent)                {                    preTranState = TransferState;                    if (DiCS0 && DiValid && !_doLoadReq.Value)                    {                        _doLoadReq.SetValue(true, out _);                    }                    if (DiCS0 && DiValid && _doLoadReq.Value && !DiTrReq)                    {                        if (_timer_TP1.IsIdle()) _timer_TP1.Start(_scTimeoutTP1.IntValue * 1000);                    }                    if (DiCS0 && DiValid && _doLoadReq.Value && DiTrReq && !_doReady.Value)                    {                        _timer_TP1.Stop();                        _doReady.SetValue(true, out _);                        if (Provider != null) Provider.OnE84HandoffStart(true, out _);                        EV.Notify(EventE84LoadTransactionStart, dvid);                    }                }                if (TransferState == LPTransferState.TRANSFER_BLOCKED && preTranState == LPTransferState.READY_TO_LOAD)  //Load Sequence                {                    if (DiCS0 && DiValid && _doLoadReq.Value && DiTrReq && _doReady.Value && !DiBusy)                    {                        if (_timer_TP2.IsIdle()) _timer_TP2.Start(_scTimeoutTP2.IntValue * 1000);                    }                    if (DiCS0 && DiValid && _doLoadReq.Value && DiTrReq && _doReady.Value && DiBusy)                    {                        _timer_TP2.Stop();                        if (!IsFoupPresent)                        {                            if (_timer_TP3.IsIdle()) _timer_TP3.Start(_scTimeoutTP3.IntValue * 1000);                        }                        else                        {                            _timer_TP3.Stop();                            _doLoadReq.SetValue(false, out _);                        }                    }                    if (DiCS0 && DiValid && !_doLoadReq.Value && DiTrReq && _doReady.Value && DiBusy)                    {                        if (_timer_TP4.IsIdle()) _timer_TP4.Start(_scTimeoutTP4.IntValue * 1000);                    }                    if (DiCS0 && DiValid && !_doLoadReq.Value && _doReady.Value && !DiBusy)                    {                        _timer_TP4.Stop();                    }                    if (DiCS0 && DiValid && !_doLoadReq.Value && _doReady.Value && DiCompt)                    {                        _doReady.SetValue(false, out _);                        _timer_TP4.Stop();                        if (_timer_TP5.IsIdle()) _timer_TP5.Start(_scTimeoutTP5.IntValue * 1000);                    }                    if (!DiCS0 && !_doLoadReq.Value && !_doUnloadReq.Value && !DiTrReq && !_doReady.Value && !DiBusy && !DiCompt)                    {                        _timer_TP5.Stop();                        EV.Notify(EventE84LoadTransactionComplete, dvid);                        preTranState = LPTransferState.TRANSFER_BLOCKED;                        var lpmodule = Singleton<EquipmentManager>.Instance.Modules[ModuleHelper.Converter(Module)] as LoadPortModule;                        if (IsFoupPresent)                            lpmodule.Invoke("ReadID");                        //if (Provider != null) Provider.OnE84HandoffComplete(true,out _);                    }                }                if (TransferState == LPTransferState.READY_TO_UNLOAD)                {                    preTranState = TransferState;                    if (DiCS0 && DiValid && !_doUnloadReq.Value)                    {                        _doUnloadReq.SetValue(true, out _);                        //Provider.LPTSTrans();                        //EV.Notify(EventE84UnloadTransactionStart, dvid);                    }                    if (DiCS0 && DiValid && _doUnloadReq.Value && !DiTrReq)                    {                        if (_timer_TP1.IsIdle()) _timer_TP1.Start(_scTimeoutTP1.IntValue * 1000);                    }                    if (DiCS0 && DiValid && _doUnloadReq.Value && DiTrReq && !_doReady.Value)                    {                        _timer_TP1.Stop();                        _doReady.SetValue(true, out _);                        EV.Notify(EventE84UnloadTransactionStart, dvid);                        if (Provider != null) Provider.OnE84HandoffStart(false, out _);                    }                }                if (TransferState == LPTransferState.TRANSFER_BLOCKED && preTranState == LPTransferState.READY_TO_UNLOAD)  //Unload Sequence                {                    if (DiCS0 && DiValid && _doUnloadReq.Value && DiTrReq && _doReady.Value && !DiBusy)                    {                        if (_timer_TP2.IsIdle()) _timer_TP2.Start(_scTimeoutTP1.IntValue * 1000);                    }                    if (DiCS0 && DiValid && _doUnloadReq.Value && DiTrReq && _doReady.Value && DiBusy)                    {                        _timer_TP2.Stop();                        if (IsFoupPresent)                        {                            if (_timer_TP3.IsIdle()) _timer_TP3.Start(_scTimeoutTP3.IntValue * 1000);                        }                        else                        {                            _timer_TP3.Stop();                            _doUnloadReq.SetValue(false, out _);                        }                    }                    if (DiCS0 && DiValid && !_doUnloadReq.Value && DiTrReq && _doReady.Value && DiBusy)                    {                        if (_timer_TP4.IsIdle()) _timer_TP4.Start(_scTimeoutTP4.IntValue * 1000);                    }                    if (DiCS0 && DiValid && DiTrReq && _doReady.Value && !DiBusy)                    {                        _timer_TP4.Stop();                    }                    if (DiCS0 && DiValid && !_doUnloadReq.Value && _doReady.Value && DiCompt)                    {                        _doReady.SetValue(false, out _);                        _timer_TP4.Stop();                        if (_timer_TP5.IsIdle()) _timer_TP5.Start(_scTimeoutTP5.IntValue * 1000);                    }                    if (!DiValid && !_doUnloadReq.Value && !DiTrReq && !_doReady.Value && !DiBusy && !DiCompt)                    {                        _timer_TP5.Stop();                        EV.Notify(EventE84UnloadTransactionComplete, dvid);                        preTranState = LPTransferState.TRANSFER_BLOCKED;                        if (Provider != null) Provider.OnE84HandoffComplete(false, out _);                    }                }                if (_timer_TP1.IsTimeout())                {                    if (preTranState == LPTransferState.READY_TO_LOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP1Timeout, dvid);                        _state = E84State.LD_TP1_Timeout;                        _timer_TP1.Stop();                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    if (preTranState == LPTransferState.READY_TO_UNLOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP1Timeout, dvid);                        _state = E84State.ULD_TP1_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    _timer_TP1.Stop();                    EV.Notify(AlarmTP1timeout);                }                if (_timer_TP2.IsTimeout())                {                    if (preTranState == LPTransferState.READY_TO_LOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP2Timeout, dvid);                        _state = E84State.LD_TP2_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    if (preTranState == LPTransferState.READY_TO_UNLOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP2Timeout, dvid);                        _state = E84State.ULD_TP2_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    _timer_TP2.Stop();                    EV.Notify(AlarmTP2timeout);                }                if (_timer_TP3.IsTimeout())                {                    if (preTranState == LPTransferState.READY_TO_LOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP3Timeout, dvid);                        _state = E84State.LD_TP3_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    if (preTranState == LPTransferState.READY_TO_UNLOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP3Timeout, dvid);                        _state = E84State.ULD_TP3_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    _timer_TP3.Stop();                    EV.Notify(AlarmTP3timeout);                }                if (_timer_TP4.IsTimeout())                {                    if (preTranState == LPTransferState.READY_TO_LOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP4Timeout, dvid);                        _state = E84State.LD_TP4_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    if (preTranState == LPTransferState.READY_TO_UNLOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP4Timeout, dvid);                        _state = E84State.ULD_TP4_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    _timer_TP4.Stop();                    EV.Notify(AlarmTP4timeout);                }                if (_timer_TP5.IsTimeout())                {                    if (preTranState == LPTransferState.READY_TO_LOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP5Timeout, dvid);                        _state = E84State.LD_TP5_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    if (preTranState == LPTransferState.READY_TO_UNLOAD)                    {                        _doLoadReq.SetValue(false, out _);                        _doUnloadReq.SetValue(false, out _);                        _doReady.SetValue(false, out _);                        _doHOAvbl.SetValue(false, out _);                        //EV.Notify(EventE84TP5Timeout, dvid);                        _state = E84State.ULD_TP5_Timeout;                        if (Provider != null) Provider.E84Error(_state.ToString());                    }                    _timer_TP5.Stop();                    EV.Notify(AlarmTP5timeout);                }            }            catch (Exception ex)            {                LOG.Write(ex);            }            return true;        }        public void Reset()        {            //_doLoadReq.SetValue(false, out _);            //_doUnloadReq.SetValue(false, out _);            //_doReady.SetValue(false, out _);            //_doHOAvbl.SetValue(false, out _);            //_doES.SetValue(false, out _);            //_state = E84State.Normal;            //foreach (var signal in _signals)            //{            //    signal.Reset();            //}                        }        private void RecordSignalChange()        {            string tempSignal = $"{Name} E84 signal change to following,Active: Valid:{_diValid.Value}," +                $"CS0:{_diCS0.Value},TransferRequest:{_diTrReq.Value},Busy:{_diBusy.Value},Complete:{_diCompt.Value}," +                $"Passive:LoadRequest:{_doLoadReq.Value},UnloadRequest:{_doUnloadReq.Value},Ready:{_doReady.Value}," +                $"HoAvl:{_doHOAvbl.Value},ES:{_doES.Value},LightCurtain:" +                $"{(_diLightCurtain == null ? "None" : _diLightCurtain.Value.ToString())}," +                $"Present Sensor1:{(_diPresent1 == null ? "None" : _diPresent1.Value.ToString())}," +                $"Present Sensor2:{(_diPresent2 == null ? "None" : _diPresent2.Value.ToString())}," +                $"Present Sensor3:{(_diPresent3 == null ? "None" : _diPresent3.Value.ToString())}," +                $"Seat Sensor:{(_diSeat == null ? "None" : _diSeat.Value.ToString())},";            if (tempSignal != _lastSignalValue)            {                _lastSignalValue = tempSignal;                LOG.Write(_lastSignalValue);            }        }        private void autoRecovery()        {            var dvid = new SerializableDictionary<string, object>();            int portID = 0;            dvid["PORT_ID"] = int.TryParse(Module.Replace("LP", ""), out portID) ? portID : portID;            switch (_state)            {                case E84State.Error:                    break;                case E84State.LD_TP1_Timeout:                    if (IsFoupPresent) EV.Notify(EventE84LoadTransactionComplete, dvid);                    else EV.Notify(EventE84LoadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.LD_TP2_Timeout:                    if (IsFoupPresent) EV.Notify(EventE84LoadTransactionComplete, dvid);                    else EV.Notify(EventE84LoadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.LD_TP3_Timeout:                    if (IsFoupPresent) EV.Notify(EventE84LoadTransactionComplete, dvid);                    else EV.Notify(EventE84LoadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.LD_TP4_Timeout:                    if (IsFoupPresent) EV.Notify(EventE84LoadTransactionComplete, dvid);                    else EV.Notify(EventE84LoadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.LD_TP5_Timeout:                    if (!IsFoupPresent) EV.Notify(EventE84LoadTransactionComplete, dvid);                    else EV.Notify(EventE84LoadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.ULD_TP1_Timeout:                    if (!IsFoupPresent) EV.Notify(EventE84UnloadTransactionComplete, dvid);                    else EV.Notify(EventE84UnloadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.ULD_TP2_Timeout:                    if (!IsFoupPresent) EV.Notify(EventE84UnloadTransactionComplete, dvid);                    else EV.Notify(EventE84UnloadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.ULD_TP3_Timeout:                    if (!IsFoupPresent) EV.Notify(EventE84UnloadTransactionComplete, dvid);                    else EV.Notify(EventE84UnloadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.ULD_TP4_Timeout:                    if (!IsFoupPresent) EV.Notify(EventE84UnloadTransactionComplete, dvid);                    else EV.Notify(EventE84UnloadTransactionRestart, dvid);                    ResetSignal();                    break;                case E84State.ULD_TP5_Timeout:                    if (!IsFoupPresent) EV.Notify(EventE84UnloadTransactionComplete, dvid);                    else EV.Notify(EventE84UnloadTransactionRestart, dvid);                    ResetSignal();                    break;                default: break;            }            ResetSignal();        }        private void OnSignalChange(SignalID signal, bool value)        {        }        public void Monitor()        {        }    }}
 |