123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233 |
- 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 MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- namespace Aitex.Core.RT.Device.Unit
- {
- public class IoCoolingBuffer : BaseDevice, IDevice
- {
- enum DeviceState
- {
- 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.Idle;
- 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);
- }
- public bool ManualOperation = false;
- public bool Initialize()
- {
- _state = DeviceState.Idle;
- 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)
- {
- 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()
- {
- }
- }
- }
|