1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237 |
- using System;
- using System.Xml;
- using Aitex.Core.Common;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.DataCenter;
- 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 EFEM.RT.Devices.Flipper;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- namespace Aitex.Core.RT.Device.Unit
- {
- public class IoCoolingBuffer : BaseDevice, IDevice
- {
- enum DeviceState
- {
- Init,
- Idle,
- Homing,
- MovingUp,
- MovingDown,
- Error,
- Disable,
- }
- public enum LiftState
- {
- Unknown = 0,
- Down = 1,
- Up = 2,
- Error = 3,
- }
- private DIAccessor _diLiftUp;
- private DIAccessor _diLiftDown;
- private DIAccessor _di3InchExtend;
- private DIAccessor _di3InchRetract;
- private DIAccessor _di4InchExtend;
- private DIAccessor _di4InchRetract;
- private DIAccessor _di6InchExtend;
- private DIAccessor _di6InchRetract;
- private DOAccessor _doLiftUp;
- private DOAccessor _doLiftDown;
- private DOAccessor _do3InchExtend;
- private DOAccessor _do3InchRetract;
- private DOAccessor _do4InchExtend;
- private DOAccessor _do4InchRetract;
- private DOAccessor _do6InchExtend;
- private DOAccessor _do6InchRetract;
- private DeviceState _state = DeviceState.Init;
- private DeviceTimer _timer = new DeviceTimer();
- private WaferSize _size = WaferSize.WS8;
- private SCConfigItem _scLiftUpTimeout;
- private SCConfigItem _scLiftDownTimeout;
- public bool Busy
- {
- get
- {
- return _state != DeviceState.Idle;
- }
- }
- public bool Moving
- {
- get
- {
- return _state != DeviceState.Idle && _state != DeviceState.Error;
- }
- }
- public bool Error
- {
- get
- {
- return _state == DeviceState.Error;
- }
- }
- //public bool IsUp
- //{
- // get
- // {
- // return _diLiftUp.Value && !_diLiftDown.Value;
- // }
- //}
- //public bool IsDown
- //{
- // get
- // {
- // return !_diLiftUp.Value && _diLiftDown.Value;
- // }
- //}
- public bool IsEnableMultiWaferSize
- {
- get
- {
- if (SC.ContainsItem("System.IsEnableMultiWaferSize"))
- return SC.GetValue<bool>("System.IsEnableMultiWaferSize");
- return false;
- }
- }
- public bool SamallPinDisable
- {
- get
- {
- if (SC.ContainsItem("System.SamallPinDisable"))
- return SC.GetValue<bool>("System.SamallPinDisable");
- return false;
- }
- }
- public bool Disable
- {
- get
- {
- if (SC.ContainsItem($"System.{Name}Disable"))
- {
- return SC.GetValue<bool>($"System.{Name}Disable");
- }
- return false;
- }
- }
- public bool IsEnableMultiWaferSizeShow
- {
- get
- {
- if (SC.ContainsItem("System.IsEnableMultiWaferSizeShow"))
- return SC.GetValue<bool>("System.IsEnableMultiWaferSizeShow");
- return false;
- }
- }
- public int CstSizeKind
- {
- get
- {
- return SC.GetValue<int>($"System.CstSizeKind");
- }
- }
- public LiftState Feedback3Inch
- {
- get
- {
- if (_di3InchExtend.Value && !_di3InchRetract.Value)
- return LiftState.Up;
- if (!_di3InchExtend.Value && _di3InchRetract.Value)
- return LiftState.Down;
- return LiftState.Unknown;
- }
- }
- public LiftState Feedback4Inch
- {
- get
- {
- //if (_di4InchExtend.Value && _di4InchRetract.Value)
- // return LiftState.Error;
- if (_di4InchExtend.Value && !_di4InchRetract.Value)
- return LiftState.Up;
- if (!_di4InchExtend.Value && _di4InchRetract.Value)
- return LiftState.Down;
- //if (!_di4InchExtend.Value && !_di4InchRetract.Value)
- return LiftState.Unknown;
- }
- }
- public LiftState Feedback6Inch
- {
- get
- {
- //if (_di4InchExtend.Value && _di4InchRetract.Value)
- // return LiftState.Error;
- if (_di6InchExtend !=null && _di6InchExtend.Value && !_di6InchRetract.Value)
- return LiftState.Up;
- if (_di6InchExtend != null && !_di6InchExtend.Value && _di6InchRetract.Value)
- return LiftState.Down;
- //if (!_di4InchExtend.Value && !_di4InchRetract.Value)
- return LiftState.Unknown;
- }
- }
- public LiftState FeedbackLift
- {
- get
- {
- //if (_diLiftUp.Value && _diLiftDown.Value)
- // return LiftState.Error;
- if (_diLiftUp.Value && !_diLiftDown.Value)
- return LiftState.Up;
- if (!_diLiftUp.Value && _diLiftDown.Value)
- return LiftState.Down;
- //if (!_di3InchExtend.Value && !_di3InchRetract.Value)
- return LiftState.Unknown;
- }
- }
- public LiftState SetPoint3Inch
- {
- get
- {
- //if (_do3InchExtend.Value && _do3InchRetract.Value)
- // return LiftState.Error;
- if (_do3InchExtend.Value && !_do3InchRetract.Value)
- return LiftState.Up;
- if (!_do3InchExtend.Value && _do3InchRetract.Value)
- return LiftState.Down;
- //if (!_do3InchExtend.Value && !_do3InchRetract.Value)
- return LiftState.Unknown;
- }
- }
- public LiftState SetPoint4Inch
- {
- get
- {
- //if (_do4InchExtend.Value && _do4InchRetract.Value)
- // return LiftState.Error;
- if (_do4InchExtend.Value && !_do4InchRetract.Value)
- return LiftState.Up;
- if (!_do4InchExtend.Value && _do4InchRetract.Value)
- return LiftState.Down;
- //if (!_do4InchExtend.Value && !_do4InchRetract.Value)
- return LiftState.Unknown;
- }
- }
- public LiftState SetPoint6Inch
- {
- get
- {
- //if (_do4InchExtend.Value && _do4InchRetract.Value)
- // return LiftState.Error;
- if (_do6InchExtend != null && _do6InchExtend.Value && !_do6InchRetract.Value)
- return LiftState.Up;
- if (_do6InchExtend != null &&!_do6InchExtend.Value && _do6InchRetract.Value)
- return LiftState.Down;
- //if (!_do4InchExtend.Value && !_do4InchRetract.Value)
- return LiftState.Unknown;
- }
- }
- public LiftState SetPointLift
- {
- get
- {
- //if (_doLiftUp.Value && _doLiftDown.Value)
- // return LiftState.Error;
- if (_doLiftUp.Value && !_doLiftDown.Value)
- return LiftState.Up;
- if (!_doLiftUp.Value && _doLiftDown.Value)
- return LiftState.Down;
- //if (!_do3InchExtend.Value && !_do3InchRetract.Value)
- return LiftState.Unknown;
- }
- }
- public IoCoolingBuffer(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");
- WaferManager.Instance.SubscribeLocation(Module, 1);
- _diLiftUp = ParseDiNode("diLiftUp", node, ioModule);
- _diLiftDown = ParseDiNode("diLiftDown", node, ioModule);
- _di3InchExtend = ParseDiNode("diAligner1Extend", node, ioModule);
- _di3InchRetract = ParseDiNode("diAligner1Retract", node, ioModule);
- _di4InchExtend = ParseDiNode("diAligner2Extend", node, ioModule);
- _di4InchRetract = ParseDiNode("diAligner2Retract", node, ioModule);
- _di6InchExtend = ParseDiNode("diAligner3Extend", node, ioModule);
- _di6InchRetract = ParseDiNode("diAligner3Retract", node, ioModule);
- _doLiftUp = ParseDoNode("doLiftUp", node, ioModule);
- _doLiftDown = ParseDoNode("doLiftDown", node, ioModule);
- _do3InchExtend = ParseDoNode("doAligner1Extend", node, ioModule);
- _do3InchRetract = ParseDoNode("doAligner1Retract", node, ioModule);
- _do4InchExtend = ParseDoNode("doAligner2Extend", node, ioModule);
- _do4InchRetract = ParseDoNode("doAligner2Retract", node, ioModule);
- _do6InchExtend = ParseDoNode("doAligner3Extend", node, ioModule);
- _do6InchRetract = ParseDoNode("doAligner3Retract", node, ioModule);
- _scLiftUpTimeout = ParseScNode("scUpTimeout", node);
- _scLiftDownTimeout = ParseScNode("scDownTimeout", node);
- DATA.Subscribe($"{module}.{module}.Status", () => _state.ToString());
- }
- public bool ManualOperation = false;
- public bool Initialize()
- {
- _state = DeviceState.Init;
- if (Module == "System")
- {
- LOG.Write($"IoCoolingBuffer module is System.");
- }
-
- DATA.Subscribe($"{Module}.{Name}.Feedback3Inch", () => _di3InchExtend != null ? Feedback3Inch.ToString(): LiftState.Unknown.ToString());
- DATA.Subscribe($"{Module}.{Name}.Feedback4Inch", () => _di4InchExtend != null ? Feedback4Inch.ToString() : LiftState.Unknown.ToString()) ;
- DATA.Subscribe($"{Module}.{Name}.Feedback6Inch", () => _di6InchExtend !=null ? Feedback6Inch.ToString() : LiftState.Unknown.ToString());
- DATA.Subscribe($"{Module}.{Name}.FeedbackLift", () => FeedbackLift.ToString());
- DATA.Subscribe($"{Module}.{Name}.SetPoint3Inch", () => _do6InchExtend != null ? SetPoint3Inch.ToString() : LiftState.Unknown.ToString());
- DATA.Subscribe($"{Module}.{Name}.SetPoint4Inch", () => _do4InchExtend != null ? SetPoint4Inch.ToString() : LiftState.Unknown.ToString());
- DATA.Subscribe($"{Module}.{Name}.SetPoint6Inch", () => _do6InchExtend != null ? SetPoint6Inch.ToString() : LiftState.Unknown.ToString());
- DATA.Subscribe($"{Module}.{Name}.SetPointLift", () => SetPointLift.ToString());
- DATA.Subscribe($"{Module}.{Name}.Status", () => _state.ToString());
- DATA.Subscribe($"{Module}.{Name}.WaferSizeByWafer", () => WaferManager.Instance.GetWaferSize(ModuleHelper.Converter(Module), 0));//WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).Size.ToString());
- DATA.Subscribe($"{Module}.{Name}.WaferSizeBySetPoint", () => waferSize.ToString());
-
- OP.Subscribe($"{Module}.{Name}.MoveUp3", (string reason, object[] param) =>
- {
- ManualOperation = true;
- reason = "";
- return Move(WaferSize.WS3, true, out reason);
- });
- OP.Subscribe($"{Module}.{Name}.MoveUp4", (string reason, object[] param) =>
- {
- ManualOperation = true;
- reason = "";
- return Move(WaferSize.WS4, true, out reason);
- });
- OP.Subscribe($"{Module}.{Name}.MoveUp6", (string reason, object[] param) =>
- {
- ManualOperation = true;
- reason = "";
- return Move(WaferSize.WS6, true, out reason);
- });
- OP.Subscribe($"{Module}.{Name}.MoveUpLift", (string reason, object[] param) =>
- {
- ManualOperation = true;
- reason = "";
- return Move(WaferSize.WS8, true, out reason);
- });
- OP.Subscribe($"{Module}.{Name}.MoveDown3", (string reason, object[] param) =>
- {
- ManualOperation = true;
- reason = "";
- return Move(WaferSize.WS3, false, out reason);
- });
- OP.Subscribe($"{Module}.{Name}.MoveDown4", (string reason, object[] param) =>
- {
- ManualOperation = true;
- reason = "";
- return Move(WaferSize.WS4, false, out reason);
- });
- OP.Subscribe($"{Module}.{Name}.MoveDown6", (string reason, object[] param) =>
- {
- ManualOperation = true;
- reason = "";
- return Move(WaferSize.WS6, false, out reason);
- });
- OP.Subscribe($"{Module}.{Name}.MoveDownLift", (string reason, object[] param) =>
- {
- ManualOperation = true;
- reason = "";
- return Move(WaferSize.WS8, false, out reason);
- });
- return true;
- }
- public WaferSize waferSize
- {
- get
- {
- if (CstSizeKind == 1)
- {
- WaferSize size = WaferSize.WS0;
- switch (_size)
- {
- case WaferSize.WS4:
- size = WaferSize.WS3;
- break;
- case WaferSize.WS6:
- size = WaferSize.WS4;
- break;
- case WaferSize.WS8:
- size = WaferSize.WS6;
- break;
- }
- return size;
- }
- return _size;
- }
- }
- public void Monitor()
- {
- if (SC.ContainsItem($"System.{Name}Disable"))
- {
- if (SC.GetValue<bool>($"System.{Name}Disable"))
- {
- _state = DeviceState.Disable;
- return;
- }
- else
- {
- if(_state == DeviceState.Disable)
- _state = DeviceState.Idle;
- }
- }
- if (IsEnableMultiWaferSize)
- {
- switch (_state)
- {
- case DeviceState.MovingUp:
- if (ManualOperation||!IsEnableMultiWaferSizeShow)
- {
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- {
- if (CheckPinUp())
- {
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- ManualOperation = false;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} LiftPin Can not move up in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- ManualOperation = false;
- }
- else
- {
- if (CheckPinUp())
- {
- //Set3InchDown(out _);
- //Set4InchDown(out _);
- }
- }
- }
- }
- break;
- case WaferSize.WS6:
- {
- if (Check6InchUp())
- {
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- ManualOperation = false;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} 6InchPin Can not move up in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- ManualOperation = false;
- }
- else
- {
- if (Check6InchUp())
- {
- //Set3InchDown(out _);
- //Set4InchDown(out _);
- }
- }
- }
- }
- break;
- case WaferSize.WS4:
- {
- if (Check4InchUp())
- {
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- ManualOperation = false;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} 4InchPin Can not move up in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- ManualOperation = false;
- }
- else
- {
- if (Check4InchUp())
- {
- //Set3InchDown(out _);
- //Set4InchDown(out _);
- }
- }
- }
- }
- break;
- }
- }
- else
- {
- if (CheckPinUp() /*&& Check3InchDown() && Check4InchDown()*/)
- {
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} Can not move up in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- }
- else
- {
- if (CheckPinUp())
- {
- //Set3InchDown(out _);
- //Set4InchDown(out _);
- }
- }
- }
- }
- break;
- case DeviceState.MovingDown:
- if (ManualOperation ||!IsEnableMultiWaferSizeShow)
- {
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- {
- if (CheckPinDown())
- {
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- ManualOperation = false;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} LiftPin Can not move down in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- ManualOperation = false;
- }
- else
- {
- if (CheckPinDown())
- {
- //Set3InchDown(out _);
- //Set4InchDown(out _);
- }
- }
- }
- }
- break;
- case WaferSize.WS6:
- {
- if (Check6InchDown())
- {
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- ManualOperation = false;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} 6InchPin Can not move down in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- ManualOperation = false;
- }
- else
- {
- if (Check6InchDown())
- {
- //Set3InchDown(out _);
- //Set4InchDown(out _);
- }
- }
- }
- }
- break;
- case WaferSize.WS4:
- {
- if (Check4InchDown())
- {
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- ManualOperation = false;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} 4InchPin Can not move down in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- ManualOperation = false;
- }
- else
- {
- if (Check4InchDown())
- {
- //Set3InchDown(out _);
- //Set4InchDown(out _);
- }
- }
- }
- }
- break;
- }
-
- }
- else
- {
- bool guided = CheckGuided(_size);
- if (CheckPinDown() && guided)
- {
- _state = DeviceState.Idle;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} Can not move down in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- }
- else
- {
- if (guided)
- {
- SetPinDown(out _);
- }
- }
- }
- }
- break;
- case DeviceState.Homing:
- if (IsEnableMultiWaferSizeShow)
- {
- if (!SamallPinDisable)
- {
- if (Check6InchDown() && CheckPinDown())
- //if(CheckPinDown())
- _state = DeviceState.Idle;
- }
- else
- {
- if (Check4InchDown() && Check6InchDown() && CheckPinDown())
- //if(CheckPinDown())
- _state = DeviceState.Idle;
- }
- }
- else
- {
- if(CheckPinDown())
- _state = DeviceState.Idle;
- }
- break;
- default:
- break;
- }
- }
- else
- {
- switch (_state)
- {
- case DeviceState.MovingUp:
- if (CheckPinUp() /*&& Check3InchDown() && Check4InchDown()*/)
- {
- LOG.Write($"{Module} move pin up complete");
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} Can not move up in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- }
- else
- {
- if (CheckPinUp())
- {
- //Set3InchDown(out _);
- //Set4InchDown(out _);
- }
- }
- }
- break;
- case DeviceState.MovingDown:
- // bool guided = CheckGuided(_size);
- if (CheckPinDown()) //&& guided)
- {
- LOG.Write($"{Module} move pin down complete");
- LOG.Write($"state:{_state.ToString()}");
- _state = DeviceState.Idle;
- }
- else
- {
- if (_timer.IsTimeout())
- {
- EV.PostAlarmLog(Module, $"{Module} {Name} Can not move down in {_scLiftUpTimeout.IntValue} seconds");
- _state = DeviceState.Error;
- }
- else
- {
- if (CheckPinDown())
- {
- }
- //if (guided)
- //{
- // SetPinDown(out _);
- //}
- }
- }
- break;
- case DeviceState.Homing:
- //if (Check3InchDown() && Check4InchDown() && CheckPinDown())
- if (CheckPinDown())
- _state = DeviceState.Idle;
- break;
- default:
- break;
- }
- }
- }
- public void Terminate()
- {
- }
- public bool Home(out string reason)
- {
- ModuleName _module;
- if (!Enum.TryParse<ModuleName>(Module, out _module))
- {
- reason = $"{Module} isn't exist";
- return false;
- }
- if (_state != DeviceState.Error && _state != DeviceState.Idle && _state != DeviceState.Init)
- {
- reason = $"{Module} is in {_state} state.";
- return false;
- }
- if (_state == DeviceState.Disable)
- {
- reason = string.Empty;
- return true;
- }
- WaferInfo info = WaferManager.Instance.GetWafer(_module, 0);
- if (IsEnableMultiWaferSize && IsEnableMultiWaferSizeShow)
- {
- if(SamallPinDisable)
- _do4InchExtend.SetValue(false, out reason);
- if(_do6InchExtend!=null)
- _do6InchExtend.SetValue(false, out reason);
- _doLiftUp.SetValue(false, out reason);
-
- if (SamallPinDisable)
- _do4InchRetract.SetValue(true, out reason);
- if (_do6InchRetract != null)
- _do6InchRetract.SetValue(true, out reason);
- _doLiftDown.SetValue(true, out reason);
- }
- else
- { //_do3InchExtend.SetValue(false, out reason);
- //_do4InchExtend.SetValue(false, out reason);
- _doLiftUp.SetValue(false, out reason);
- //_do3InchRetract.SetValue(true, out reason);
- //_do4InchRetract.SetValue(true, out reason);
- _doLiftDown.SetValue(true, out reason);
- }
- _state = DeviceState.Homing;
- return true;
- }
- public bool Move(WaferSize size, bool up, out string reason)
- {
- _size = size;
- if(CstSizeKind==1)
- {
- switch(size)
- {
- case WaferSize.WS3:
- _size = WaferSize.WS4;
- break;
- case WaferSize.WS4:
- _size = WaferSize.WS6;
- break;
- case WaferSize.WS6:
- _size = WaferSize.WS8;
- break;
- }
- }
- if (up)
- {
- return MoveUp(out reason);
- }
- return MoveDown(out reason);
- }
- public bool Check3InchUp() { return Feedback3Inch == LiftState.Up; }
- public bool Check3InchDown() { return Feedback3Inch == LiftState.Down; }
- public bool Check4InchUp() { return Feedback4Inch == LiftState.Up; }
- public bool Check4InchDown() { return Feedback4Inch == LiftState.Down; }
- public bool Check6InchUp() { return Feedback6Inch == LiftState.Up; }
- public bool Check6InchDown() { return Feedback6Inch == LiftState.Down; }
- public bool CheckPinUp() { return FeedbackLift == LiftState.Up; }
- public bool CheckPinDown() { return FeedbackLift == LiftState.Down; }
- private bool Set3InchUp(out string reason)
- {
- if (SetPoint3Inch != LiftState.Up)
- EV.PostInfoLog(Module, $"{Module} move 3 inch up");
- return _do3InchExtend.SetValue(true, out reason) && _do3InchRetract.SetValue(false, out reason);
- }
- private bool Set3InchDown(out string reason)
- {
- if (SetPoint3Inch != LiftState.Down)
- EV.PostInfoLog(Module, $"{Module} move 3 inch down");
- return _do3InchExtend.SetValue(false, out reason) && _do3InchRetract.SetValue(true, out reason);
- }
- private bool Set4InchUp(out string reason)
- {
- if (SetPoint4Inch != LiftState.Up)
- EV.PostInfoLog(Module, $"{Module} move 4 inch up");
- return _do4InchExtend.SetValue(true, out reason) && _do4InchRetract.SetValue(false, out reason);
- }
- private bool Set4InchDown(out string reason)
- {
- if (SetPoint4Inch != LiftState.Down)
- EV.PostInfoLog(Module, $"{Module} move 4 inch down");
- return _do4InchExtend.SetValue(false, out reason) && _do4InchRetract.SetValue(true, out reason);
- }
- private bool Set6InchUp(out string reason)
- {
- if (SetPoint6Inch != LiftState.Up)
- EV.PostInfoLog(Module, $"{Module} move 6 inch up");
- return _do6InchExtend.SetValue(true, out reason) && _do6InchRetract.SetValue(false, out reason);
- }
- private bool Set6InchDown(out string reason)
- {
- if (SetPoint6Inch != LiftState.Down)
- EV.PostInfoLog(Module, $"{Module} move 6 inch down");
- return _do6InchExtend.SetValue(false, out reason) && _do6InchRetract.SetValue(true, out reason);
- }
- private bool SetPinUp(out string reason)
- {
- if (SetPointLift != LiftState.Up)
- EV.PostInfoLog(Module, $"{Module} move pin up");
- return _doLiftDown.SetValue(false, out reason) && _doLiftUp.SetValue(true, out reason);
- }
- private bool SetPinDown(out string reason)
- {
- if (SetPointLift != LiftState.Down)
- EV.PostInfoLog(Module, $"{Module} move pin down");
- return _doLiftUp.SetValue(false, out reason) && _doLiftDown.SetValue(true, out reason);
- }
- public bool CheckMovedUp()
- {
- // return CheckPinUp() && Check3InchDown() && Check4InchDown();
- return CheckPinUp();
- }
- public bool CheckMovedDown()
- {
- return CheckPinDown(); //&& CheckGuided(_size);
- }
- private bool CheckGuided(WaferSize size)
- {
- bool guided = false;
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- {
- if (!SamallPinDisable)
- guided = Check6InchDown();
- else
- guided = Check6InchDown() && Check4InchDown();
- }
- break;
- case WaferSize.WS6:
- {
- if (!SamallPinDisable)
- guided = Check6InchUp();
- else
- guided = Check6InchUp() && Check4InchDown();
- }
- break;
- case WaferSize.WS3:
- {
- guided = Check3InchUp() && Check4InchDown();
- }
- break;
- case WaferSize.WS4:
- {
- guided = Check6InchDown() && Check4InchUp();
- }
- break;
- }
- return guided;
- }
- private bool MoveUp(out string reason)
- {
- reason = string.Empty;
- bool ret = true;
- if (IsEnableMultiWaferSize)
- {
- if (ManualOperation|| !IsEnableMultiWaferSizeShow)
- {
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- {
- if (!SetPinUp(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS6:
- {
- if (!Set6InchUp(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS3:
- {
- if (!Set3InchUp(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS4:
- {
- if (!Set4InchUp(out reason))
- {
- ret = false;
- }
- }
- break;
- }
-
- }
- else
- {
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- {
- if ((SamallPinDisable&&!Set4InchDown(out reason)) || !Set6InchDown(out reason) || !SetPinUp(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS6:
- {
- if ((SamallPinDisable&&!Set4InchDown(out reason)) || !Set6InchUp(out reason) || !SetPinUp(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS3:
- {
- if (!SetPinUp(out reason))//!Set3InchUp(out reason) || !Set4InchDown(out reason) || !SetPinUp(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS4:
- {
- if (!Set6InchDown(out reason) || (!Set4InchUp(out reason)) || !SetPinUp(out reason))
- {
- ret = false;
- }
- }
- break;
- }
- // ManualOperation = false;
- }
- LOG.Write($"ret:{ret}");
- if (!ret)
- return false;
- _timer.Start(_scLiftUpTimeout.IntValue * 1000);
- _state = DeviceState.MovingUp;
- }
- else
- {
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- case WaferSize.WS6:
- {
- if (!SetPinUp(out reason))//!Set3InchDown(out reason) || !Set4InchDown(out reason) || !SetPinUp(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS3:
- {
- if (!SetPinUp(out reason))//!Set3InchUp(out reason) || !Set4InchDown(out reason) || !SetPinUp(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS4:
- {
- if (!SetPinUp(out reason))//!Set3InchDown(out reason) || !Set4InchUp(out reason) || !SetPinUp(out reason))
- {
- ret = false;
- }
- }
- break;
- }
- LOG.Write($"ret:{ret}");
- if (!ret)
- return false;
- _timer.Start(_scLiftUpTimeout.IntValue * 1000);
- _state = DeviceState.MovingUp;
- }
- return true;
- }
- private bool MoveDown(out string reason)
- {
- reason = string.Empty;
- bool ret = true;
- if (IsEnableMultiWaferSize)
- {
- if (ManualOperation|| !IsEnableMultiWaferSizeShow)
- {
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- {
- if (!SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS6:
- {
- if (!Set6InchDown(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS3:
- {
- if (!SetPinDown(out reason))//!Set3InchUp(out reason) || Set4InchDown(out reason)||!SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS4:
- {
- if (!Set4InchDown(out reason))
- {
- ret = false;
- }
- }
- break;
- }
- }
- else
- {
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- {
- if ((SamallPinDisable&&!Set4InchDown(out reason)) || !Set6InchDown(out reason) || !SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS6:
- {
- if (!Set6InchUp(out reason) ||(SamallPinDisable&&!Set4InchDown(out reason)) || !SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS3:
- {
- if (!SetPinDown(out reason))//!Set3InchUp(out reason) || Set4InchDown(out reason)||!SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS4:
- {
- if ((!Set4InchUp(out reason)) || !Set6InchDown(out reason) || !SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- }
-
- //ManualOperation = false;
- }
- LOG.Write($"ret:{ret}");
- if (!ret)
- return false;
- _timer.Start(_scLiftDownTimeout.IntValue * 1000);
- _state = DeviceState.MovingDown;
- }
- else
- {
- switch (_size)
- {
- case WaferSize.WS0:
- case WaferSize.WS8:
- case WaferSize.WS6:
- {
- if (!SetPinDown(out reason)) //(!Set3InchDown(out reason) || !Set4InchDown(out reason)||!SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS3:
- {
- if (!SetPinDown(out reason))//!Set3InchUp(out reason) || Set4InchDown(out reason)||!SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- case WaferSize.WS4:
- {
- if (!SetPinDown(out reason))//!Set4InchUp(out reason) || !Set3InchDown(out reason)||!SetPinDown(out reason))
- {
- ret = false;
- }
- }
- break;
- }
- LOG.Write($"ret:{ret}");
- if (!ret)
- return false;
- _timer.Start(_scLiftDownTimeout.IntValue * 1000);
- _state = DeviceState.MovingDown;
- }
- return true;
- }
- public void Reset()
- {
- }
- }
- }
|