123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620 |
- using System;
- using System.Collections.Generic;
- using System.IO.Ports;
- using System.Linq;
- using System.Threading;
- using Aitex.Core.Common;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Device.Unit;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.OperationCenter;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using MECF.Framework.Common.CommonData;
- using MECF.Framework.Common.Communications;
- using MECF.Framework.Common.Device.Bases;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
- using Newtonsoft.Json;
- namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.SiasunPhoenixB
- {
- public class RobotSiasunPhoenixB : RobotBaseDevice, IConnection
- {
- public string Address => Connection.Address;
- public bool IsConnected => Connection.IsConnected && !_connection.IsCommunicationError;
- public bool Connect()
- {
- return _connection.Connect();
- }
- public bool Disconnect()
- {
- return _connection.Disconnect();
- }
- public string PortStatus { get; set; } = "Closed";
- public Dictionary<string, int> ModuleAssociateStationDic
- {
- get => _moduleAssociateStationDic;
- set
- {
- _moduleAssociateStationDic = value;
- }
- }
- private RobotSiasunPhoenixBTCPConnection _connection;
- public RobotSiasunPhoenixBTCPConnection Connection
- {
- get { return _connection; }
- }
- private R_TRIG _trigError = new R_TRIG();
- private bool _isAlarm;
- private R_TRIG _trigCommunicationError = new R_TRIG();
- private R_TRIG _trigRetryConnect = new R_TRIG();
- private PeriodicJob _thread;
- private LinkedList<HandlerBase> _lstHandler = new LinkedList<HandlerBase>();
- private LinkedList<HandlerBase> _lstMonitorHandler = new LinkedList<HandlerBase>();
- public List<IOResponse> IOResponseList { get; set; } = new List<IOResponse>();
- private Dictionary<string, string> _errorCodeReferenceDic;
- private Dictionary<string, int> _moduleAssociateStationDic;
- private object _locker = new object();
- private SCConfigItem _scHomeTimeout;
- private SCConfigItem _scMotionTimeout;
- private SCConfigItem _scBladeSlots;
- private List<ModuleName> _disabledIntlkModules = new List<ModuleName>();
- public int BladeSlots => _scBladeSlots == null ? 1 : _scBladeSlots.IntValue;
- private bool _enableLog;
- private string _scRoot;
- public RobotSiasunPhoenixB(string module, string name, string scRoot, string endof = "\r\n") : base(module, name)
- {
- _scRoot = scRoot;
- ResetPropertiesAndResponses();
- string deviceIP = "";
- if (string.IsNullOrEmpty(_scRoot))
- {
- deviceIP = SC.GetStringValue($"{Module}.Address");
- _enableLog = SC.GetValue<bool>($"{Module}.EnableLogMessage");
- _scHomeTimeout = SC.GetConfigItem($"{Module}.HomeTimeout");
- _scMotionTimeout = SC.GetConfigItem($"{Module}.MotionTimeout");
- _scBladeSlots = SC.GetConfigItem($"{Module}.BladeSlots");
- }
- else
- {
- if(SC.ContainsItem($"{_scRoot}.{Module}.{Name}.Address"))
- {
- deviceIP = SC.GetStringValue($"{_scRoot}.{Module}.{Name}.Address");
- _enableLog = SC.GetValue<bool>($"{_scRoot}.{Module}.{Name}.EnableLogMessage");
- _scHomeTimeout = SC.GetConfigItem($"{_scRoot}.{Module}.{Module}.HomeTimeout");
- _scMotionTimeout = SC.GetConfigItem($"{_scRoot}.{Module}.{Module}.MotionTimeout");
- _scBladeSlots = SC.GetConfigItem($"{_scRoot}.{Module}.{Module}.BladeSlots");
- }
- else
- {
- deviceIP = SC.GetStringValue($"{_scRoot}.Address");
- _enableLog = SC.GetValue<bool>($"{_scRoot}.EnableLogMessage");
- _scHomeTimeout = SC.GetConfigItem($"{_scRoot}.HomeTimeout");
- _scMotionTimeout = SC.GetConfigItem($"{_scRoot}.MotionTimeout");
- _scBladeSlots = SC.GetConfigItem($"{_scRoot}.BladeSlots");
- }
- }
- WaferManager.Instance.SubscribeLocation(Name, BladeSlots * 2);
- _connection = new RobotSiasunPhoenixBTCPConnection(deviceIP, endof);
- _connection.EnableLog(_enableLog);
- if (_connection.Connect())
- {
- PortStatus = "Open";
- EV.PostInfoLog(Module, $"{Module}.{Name} connected");
- }
- else
- {
- PortStatus = "Close";
- EV.PostInfoLog(Module, $"{Module}.{Name} connect failed");
- }
- _thread = new PeriodicJob(100, OnTimer, $"{Module}.{Name} MonitorHandler", true);
- DATA.Subscribe($"{Module}.IsConnected", () => IsConnected);
- DATA.Subscribe($"{Module}.Address", () => Address);
- OP.Subscribe($"{Module}.Reconnect", (string cmd, object[] args) =>
- {
- Disconnect();
- Connect();
- return true;
- });
- _moduleAssociateStationDic = new Dictionary<string, int>()
- {
- {$"{ModuleName.PM1 }", 1 },
- {$"{ModuleName.PM2}", 2 },
- {$"{ModuleName.PMC}", 3 },
- {$"{ModuleName.PMD}", 4 },
- {$"{ModuleName.VCEA}", 5 },
- {$"{ModuleName.VCEB}", 6 },
- {$"{ModuleName.AlignerA}", 7 },
- {$"{ModuleName.AlignerB}", 8 },
- {$"{ModuleName.LL1}", 3 },//A1=5,A2=6,A both=7
- {$"{ModuleName.LLA}", 7 },//A1=5,A2=6,A both=7
- {$"{ModuleName.LLA}.01", 5 },//A1=5,A2=6,A both=7
- {$"{ModuleName.LLA}.02", 6 },//A1=5,A2=6,A both=7
- {$"{ModuleName.LLA}.Both", 7 },//A1=5,A2=6,A both=7
- {$"{ModuleName.LLB}", 10 },//B1=8,B2=9,B both=10
- {$"{ModuleName.LLB}.01", 8 },//B1=8,B2=9,B both=10
- {$"{ModuleName.LLB}.02", 9 },//B1=8,B2=9,B both=10
- {$"{ModuleName.LLB}.Both", 10 },//B1=8,B2=9,B both=10
- };
- _errorCodeReferenceDic = new Dictionary<string, string>()
- {
- {"901", "Main power EMO" },
- {"902", "Teach pendant EMO" },
- {"962", "Driver RDY sensor disconnect" },
- {"3001", "Robot collision" },
- {"7300", "Rotation sensor forbidden" },
- {"7301", "Extend sensor forbidden" },
- {"2200", "Output port Number not exist" },
- {"3120", "Joint N speed out of range" },
- {"3100", "Joint N position out of range" },
- {"100", "Robot power on fail" },
- {"7307", "GOTO station out of range" },
- {"7308", "Sensor type not support" },
- {"7312", "PICK station out of range" },
- {"7313", "PLACE station out of range" },
- {"7314", "XFER station out of range" },
- {"7315", "REMOVE not support IO type" },
- {"7316", "RQ INTLCK parameter invalid" },
- {"7319", "RQ STN station out of range" },
- {"7320", "wafre(WAF_SEN) parameter not set" },
- {"7321", "wafex(RETRACT_PIN) parameter not set" },
- {"7322", "svlv(SBIT_SVLV_SEN) parameter not set" },
- {"7323", "ens(EX_ENABLE) parameter not set" },
- {"7324", "RQ parameter invalid" },
- {"7325", "SET INTLOCK WAF_SEN parameter invalid" },
- {"7326", "SET INTLOCK RZ parameter invalid" },
- {"7327", "SET INTLOCK parameter invalid" },
- {"7328", "SET IO ECHO parameter invalid" },
- {"7329", "SET IO STATE not support" },
- {"7330", "SET IO parameter invalid" },
- {"7331", "SET STN station out of range" },
- {"7332", "Robot read parameter fail" },
- {"7333", "WAF_SEN parameter invalid" },
- {"7334", "SET sensor type not support" },
- {"7335", "SET parameter invalid" },
- {"7336", "STORE IO parameter invalid" },
- {"7337", "STORE LOAD parameter invalid" },
- {"7338", "STORE STN station out of range" },
- {"7339", "STORE STN parameter invalid" },
- {"7340", "STORE sensor type not support" },
- {"7341", "STORE parameter invalid" },
- {"7342", "Command invalid" },
- {"7343", "HOME parameter not set" },
- {"7344", "GOTO R axis parameter not set" },
- {"7345", "GOTO Z axis parameter not set" },
- {"7346", "ARM parameter invalid" },
- {"7347", "GOTO parameter not set" },
- {"7349", "MOVE parameter not set" },
- {"7350", "MOVE parameter invalid" },
- {"7351", "PICK parameter not set" },
- {"7352", "PLACE parameter not set" },
- {"7353", "REMOVE parameter not set" },
- {"7354", "Command excute not finished" },
- {"7355", "GOTO station parameter not set" },
- {"7356", "PICK station parameter not set" },
- {"7357", "PLACE station parameter not set" },
- {"7358", "ABS parameter not set" },
- {"7359", "REL parameter not set" },
- {"7360", "Robot not set main thread" },
- {"7361", "Robot not open main thread" },
- {"7362", "Current thread not main thread" },
- {"7363", "ex_ena(EX_ENABLE_SEN) parameter not set" },
- {"7364", "stable(STABLE_ SIGNAL) parameter not set" },
- {"7365", "MOVE parameter invalid" },
- {"7366", "System not on" },
- {"7367", "extend(EX_SIGNAL) parameter not set" },
- {"7368", "retract(RE_ SIGNAL) parameter not set" },
- {"7371", "Wafer not present before place" },
- {"7372", "Wafer present before pick" },
- {"7373", "Wafer present after place" },
- {"7374", "Wafer not present after pick" },
- {"7375", "Servo not on" },
- {"7376", "Exist not number parameter" },
- {"7385", "Driver stop abnormal" },
- {"7387", "Driver ID1 alarm" },
- {"7388", "Driver ID2 alarm" },
- {"7389", "Driver ID3 alarm" },
- {"7391", "AWC station out of range" },
- {"7392", "AWC out of range alarm" },
- {"7393", "AWC sensor set fail" },
- {"7398", "AWC calculate fail" },
- {"7399", "AWC trig number error" },
- {"7401", "Wafer maybe present on blade" },
- {"7402", "Wafer maybe not present on blade" },
- {"7403", "Load status in ON, not correct" },
- {"7404", "Load status in OFF, not correct" },
- {"7405", "Slot not exist" },
- {"7495", "ID1 encoder error" },
- {"7496", "ID2 encoder error" },
- {"7497", "ID3 encoder error" },
- };
- }
- private void ResetPropertiesAndResponses()
- {
- foreach (var ioResponse in IOResponseList)
- {
- ioResponse.ResonseContent = null;
- ioResponse.ResonseRecievedTime = DateTime.Now;
- }
- }
- public override bool IsReady()
- {
- return ((!_connection.IsBusy) && (_lstHandler.Count == 0) && (!_connection.IsCommunicationError) && (!IsBusy) && (RobotState == RobotStateEnum.Idle)) && !_isAlarm;
- }
- protected override bool Init()
- {
- return true;
- }
- private bool OnTimer()
- {
- try
- {
- //return true;
- _connection.MonitorTimeout();
- if (!_connection.IsConnected || _connection.IsCommunicationError)
- {
- lock (_locker)
- {
- _lstHandler.Clear();
- }
- _trigRetryConnect.CLK = !_connection.IsConnected;
- if (_trigRetryConnect.Q)
- {
- if (!_connection.Connect())
- {
- EV.PostAlarmLog(Module, $"Can not connect with {_connection.Address}, {Module}.{Name}");
- }
- else
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBQueryPinHandler(this, _deviceAddress));
- //_lstHandler.AddLast(new RobotSiasunPhoenixBSetCommModeHandler(this, _deviceAddress, EnumRfPowerCommunicationMode.Host));
- }
- }
- return true;
- }
- HandlerBase handler = null;
- if (!_connection.IsBusy)
- {
- lock (_locker)
- {
- if (_lstHandler.Count == 0)
- {
- foreach (var monitorHandler in _lstMonitorHandler)
- {
- _lstHandler.AddLast(monitorHandler);
- }
- }
- if (_lstHandler.Count > 0)
- {
- handler = _lstHandler.First.Value;
- _lstHandler.RemoveFirst();
- }
- }
- if (handler != null)
- {
- _connection.Execute(handler);
- }
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- return true;
- }
- public override void Monitor()
- {
- try
- {
- //_connection.EnableLog(_enableLog);
- _trigCommunicationError.CLK = _connection.IsCommunicationError;
- if (_trigCommunicationError.Q)
- {
- EV.PostAlarmLog(Module, $"{Module}.{Name} communication error, {_connection.LastCommunicationError}");
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- }
- protected override void SubscribeWaferLocation()
- {
- //do nothing
- }
- public override void Reset()
- {
- _trigError.RST = true;
- IsBusy = false;
- _connection.SetCommunicationError(false, "");
- _trigCommunicationError.RST = true;
- _trigWarningMessage.RST = true;
- //_enableLog = SC.GetValue<bool>($"{ScBasePath}.{Name}.EnableLogMessage");
- _trigRetryConnect.RST = true;
- base.Reset();
- }
- public void SetDisabledIntlkModules(IEnumerable<ModuleName> units)
- {
- _disabledIntlkModules.AddRange(units);
- }
- #region Command Functions
- public void PerformRawCommand(string command, string comandArgument)
- {
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBRawCommandHandler(this, command, comandArgument));
- }
- }
- public void PerformRawCommand(string command)
- {
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBRawCommandHandler(this, command));
- }
- }
- public void ResetRobot()
- {
- _connection.SendMessage("RESET\r");
- }
- public void Goto(GotoArgument gotoArg)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBGotoHandler(this, JsonConvert.SerializeObject(gotoArg)));
- }
- }
- public void Goto(object gotoArg)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBGotoHandler(this, gotoArg.ToString()));
- }
- }
- public void SevoOn()
- {
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBSevoOnOffHandler(this, true));
- }
- }
- public void SevoOff()
- {
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBSevoOnOffHandler(this, false));
- }
- }
- public void Halt()
- {
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBHaltHandler(this));
- }
- }
- public void HomeAxis(string axis)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBHomeAxisHandler(this, axis));
- }
- }
- public void Pick(PickPlaceArgument pickArg)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBPickHandler(this, JsonConvert.SerializeObject(pickArg)));
- }
- }
- public void Pick(object gotoArg)
- {
- lock (_locker)
- {
- // _lstHandler.AddLast(new RobotSiasunPhoenixBPickHandler(this, gotoArg.ToString()));
- }
- }
- public void Place(PickPlaceArgument placeArg)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBPlaceHandler(this, JsonConvert.SerializeObject(placeArg)));
- }
- }
- public void Place(object placeArg)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBPlaceHandler(this, placeArg.ToString()));
- }
- }
- public void Transfer(string arm, string fromStation, string toStation)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBTransferHandler(this, fromStation, toStation, arm));
- }
- }
- public void Transfer(string fromStation, string toStation)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBTransferHandler(this, fromStation, toStation));
- }
- }
- internal void NoteSetCommEchoCompleted(bool value)
- {
- SetCommEchoCompleted = value;
- }
- public void Retract()
- {
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBRetractHandler(this, _scMotionTimeout.IntValue));
- }
- }
- public void SetCommunicationEcho(string echoStatus)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBSetCommunicationEchoHandler(this, echoStatus));
- }
- }
- public void SetLoad(string arm, string status)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBSetLoadHandler(this, arm, status));
- }
- }
- public void MonitorRawCommand(bool isSelected, string command, string comandArgument)
- {
- lock (_locker)
- {
- string msg = comandArgument == null ? $"{command}\r" : $"{command} {comandArgument}\r";
- var existHandlers = _lstMonitorHandler.Where(handler => handler.GetType() == typeof(RobotSiasunPhoenixBRawCommandHandler) && handler.SendText == msg);
- if (isSelected)
- {
- if (!existHandlers.Any())
- _lstMonitorHandler.AddFirst(new RobotSiasunPhoenixBRawCommandHandler(this, command, comandArgument));
- }
- else
- {
- if (existHandlers.Any())
- {
- _lstMonitorHandler.Remove(existHandlers.First());
- }
- }
- }
- }
- public void MonitorRawCommand(bool isSelected, string command)
- {
- lock (_locker)
- {
- string msg = $"{command}\r";
- var existHandlers = _lstMonitorHandler.Where(handler => handler.GetType() == typeof(RobotSiasunPhoenixBRawCommandHandler) && handler.SendText == msg);
- if (isSelected)
- {
- if (!existHandlers.Any())
- _lstMonitorHandler.AddFirst(new RobotSiasunPhoenixBRawCommandHandler(this, command));
- }
- else
- {
- if (existHandlers.Any())
- {
- _lstMonitorHandler.Remove(existHandlers.First());
- }
- }
- }
- }
- public void RequestWaferOnOff(bool isSelected, string load)
- {
- lock (_locker)
- {
- //var existHandlers = _lstMonitorHandler.Where(handler => handler.GetType() == typeof(RobotSiasunPhoenixBQueryWaferOnOffHandler) && handler.SendText.Contains(" " + load.ToString()));
- //if (isSelected)
- //{
- // if (!existHandlers.Any())
- // _lstMonitorHandler.AddFirst(new RobotSiasunPhoenixBQueryWaferOnOffHandler(this, load));
- //}
- //else
- //{
- // if (existHandlers.Any())
- // {
- // _lstMonitorHandler.Remove(existHandlers.First());
- // }
- //}
- }
- }
- internal void NoteCommEchoStatus(bool echoStatus)
- {
- CommEchoOn = echoStatus;
- }
- public void RequestWaferOnOff(bool isSelected)
- {
- lock (_locker)
- {
- //var existHandlers = _lstMonitorHandler.Where(handler => handler.GetType() == typeof(RobotSiasunPhoenixBQueryWaferOnOffHandler) && handler.SendText == "RQ LOAD\r");
- //if (isSelected)
- //{
- // if (!existHandlers.Any())
- // _lstMonitorHandler.AddFirst(new RobotSiasunPhoenixBQueryWaferOnOffHandler(this, null));
- //}
- //else
- //{
- // if (existHandlers.Any())
- // {
- // _lstMonitorHandler.Remove(existHandlers.First());
- // }
- //}
- }
- }
- internal void NoteWafeCenData(string requestResponse)
- {
- WafeCenData = requestResponse;
- var dataArray = requestResponse.Split(' ');
- if (dataArray.Length == 15)
- {
- Offset_R = dataArray[10];
- Offset_T = dataArray[11];
- }
- else
- {
- NoteError("RequestWafeCenData Response Error");
- }
- }
- public void RequestCommunicationEcho(bool isSelected)
- {
- lock (_locker)
- {
- //var existHandlers = _lstMonitorHandler.Where(handler => handler.GetType() == typeof(RobotSiasunPhoenixBRequestCommunicationEchoHandler));
- //if (isSelected)
- //{
- // if (!existHandlers.Any())
- // _lstMonitorHandler.AddFirst(new RobotSiasunPhoenixBRequestCommunicationEchoHandler(this));
- //}
- //else
- //{
- // if (existHandlers.Any())
- // {
- // _lstMonitorHandler.Remove(existHandlers.First());
- // }
- //}
- }
- }
- public void RequestWaferCentData(bool isSelected)
- {
- lock (_locker)
- {
- var existHandlers = _lstMonitorHandler.Where(handler => handler.GetType() == typeof(RobotSiasunPhoenixBRequestWaferCentDataHandler));
- if (isSelected)
- {
- if (!existHandlers.Any())
- _lstMonitorHandler.AddFirst(new RobotSiasunPhoenixBRequestWaferCentDataHandler(this));
- }
- else
- {
- if (existHandlers.Any())
- {
- _lstMonitorHandler.Remove(existHandlers.First());
- }
- }
- }
- }
- #endregion
- #region Properties
- public bool SevoOnOff { get; private set; }
- public bool CommEchoOn { get; private set; }
- public bool SetCommEchoCompleted { get; private set; }
- public string WafeCenData { get; private set; }
- public string Offset_R { get; private set; }
- public string Offset_T { get; private set; }
- #endregion
- #region Note Functions
- private R_TRIG _trigWarningMessage = new R_TRIG();
- public void NoteError(string reason)
- {
- if (reason != null)
- {
- _trigWarningMessage.CLK = true;
- var content = reason;
- if (_errorCodeReferenceDic.ContainsKey(reason))
- content = _errorCodeReferenceDic[reason];
- if (_trigWarningMessage.Q)
- {
- EV.PostWarningLog(Module, $"{Module}.{Name} error, {reason} {content}");
- }
- _isAlarm = true;
- ErrorCode = reason;
- }
- else
- {
- _isAlarm = false;
- }
- }
- internal void NoteSevoOnOff(bool isOn)
- {
- SevoOnOff = isOn;
- }
- internal void NoteActionCompleted()
- {
- Blade1Target = ModuleName.System;
- Blade2Target = ModuleName.System;
- IsBusy = false;
- CheckToPostMessage((int)RobotMsg.ActionDone);
- }
- internal void NoteAxisHomed()
- {
- Blade1Target = ModuleName.System;
- Blade2Target = ModuleName.System;
- IsBusy = false;
- CheckToPostMessage((int)RobotMsg.InitComplete);
- }
- internal void NoteReadDataComplete()
- {
- IsBusy = false;
- CheckToPostMessage((int)RobotMsg.ReadDataComplete);
- }
- internal void NoteSetParametersComplete()
- {
- IsBusy = false;
- CheckToPostMessage((int)RobotMsg.SetParametersComplete);
- }
- internal void NoteWafeOnOff(string arm, bool isOn, bool isUnknown)
- {
- IsBusy = false;
- if (isUnknown)
- {
- if (arm == "A")
- {
- IsWaferPresenceOnBlade1 = false;
- WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Module), 0);
- EV.PostWarningLog(Module, $"{Module}.{Name} arm {arm} status is unkonwn");
- }
- if (arm == "B")
- {
- IsWaferPresenceOnBlade2 = false;
- WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Module), 1);
- EV.PostWarningLog(Module, $"{Module}.{Name} arm {arm} status is unkonwn");
- }
- }
- else
- {
- if (arm == "A")
- {
- IsWaferPresenceOnBlade1 = isOn;
- }
- else
- {
- IsWaferPresenceOnBlade2 = isOn;
- }
- }
- }
- internal void NoteRawCommandInfo(string command, string data)
- {
- //var curIOResponse = IOResponseList.Find(res => res.SourceCommandName == command);
- //if (curIOResponse != null)
- //{
- // IOResponseList.Remove(curIOResponse);
- //}
- //IOResponseList.Add(new IOResponse() { SourceCommandName = command, ResonseContent = data, ResonseRecievedTime = DateTime.Now });
- }
- protected override bool fStartHome(object[] param)
- {
- lock (_locker)
- {
- //_lstHandler.AddLast(new RobotSiasunPhoenixBSetCommunicationEchoHandler(this, false));
- //_lstHandler.AddLast(new RobotSiasunPhoenixBSevoOnOffHandler(this, true));
- _lstHandler.AddLast(new RobotSiasunPhoenixBHomeAxisHandler(this, _scHomeTimeout.IntValue));
- }
- return true;
- }
- protected override bool fClear(object[] param)
- {
- //lock (_locker)
- //{
- // _lstHandler.AddLast(new RobotSiasunPhoenixBResetHandler(this));
- //}
- return true;
- }
- public override bool ReadParameter(object[] param)
- {
- IsBusy = true;
- return CheckToPostMessage((int)RobotMsg.ReadData, param);
- }
- public override bool GoTo(object[] param)
- {
- if (param.Length < 1) return false;
- string command = param[0].ToString();
- var length = param.Length;
- var args = param.Skip(1).Take(length - 1).ToArray();
- if (!IsReady())
- return false;
- switch (command)
- {
- case "GoTo":
- if (PostMessageWithoutCheck((int)RobotMsg.GoToPosition, args))
- {
- IsBusy = true;
- string log = "";
- foreach (var obj in args)
- {
- log += obj.ToString() + ",";
- }
- LOG.Write($"{RobotModuleName} start go to {log}");
- return true;
- }
- break;
- case "ExtendForPick":
- if (PostMessageWithoutCheck((int)RobotMsg.ExtendForPick, args))
- {
- IsBusy = true;
- string log = "";
- foreach (var obj in args)
- {
- log += obj.ToString() + ",";
- }
- LOG.Write($"{RobotModuleName} start extend for pick {log}");
- return true;
- }
- break;
- case "ExtendForPlace":
- if (PostMessageWithoutCheck((int)RobotMsg.ExtendForPlace, args))
- {
- IsBusy = true;
- string log = "";
- foreach (var obj in args)
- {
- log += obj.ToString() + ",";
- }
- LOG.Write($"{RobotModuleName} start extend for place {log}");
- return true;
- }
- break;
- case "RetractFromPick":
- if (PostMessageWithoutCheck((int)RobotMsg.RetractFromPick, args))
- {
- IsBusy = true;
- string log = "";
- foreach (var obj in args)
- {
- log += obj.ToString() + ",";
- }
- LOG.Write($"{RobotModuleName} start retract from pick {log}");
- return true;
- }
- break;
- case "RetractFromPlace":
- if (PostMessageWithoutCheck((int)RobotMsg.RetractFromPlace, args))
- {
- IsBusy = true;
- string log = "";
- foreach (var obj in args)
- {
- log += obj.ToString() + ",";
- }
- LOG.Write($"{RobotModuleName} start retract from place {log}");
- return true;
- }
- break;
- default:
- break;
- }
- return false;
- }
- protected override bool fStartReadData(object[] param)
- {
- if (param.Length < 1) return false;
- string readcommand = param[0].ToString();
- switch (readcommand)
- {
- case "QueryWaferPresent":
- lock (_locker)
- {
- RobotArmEnum arm = (RobotArmEnum)param[1];
- _lstHandler.AddLast(new RobotSiasunPhoenixBQueryWaferPresentHandler(this, arm));
- }
- break;
- case "QueryWaferCentData":
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBRequestWaferCentDataHandler(this));
- }
- break;
- case "CheckLoad":
- lock (_locker)
- {
- RobotArmEnum arm = (RobotArmEnum)param[1];
- int checkLoadStation = 20;
- _lstHandler.AddLast(new RobotSiasunPhoenixBCheckLoadHandler(this, checkLoadStation, arm, _scHomeTimeout.IntValue * 2));
- }
- break;
- case "CheckLoad1":
- lock (_locker)
- {
- RobotArmEnum arm = (RobotArmEnum)param[1];
- int checkLoadStation = 18;
- _lstHandler.AddLast(new RobotSiasunPhoenixBCheckLoadHandler(this, checkLoadStation, arm, _scHomeTimeout.IntValue * 2));
- }
- break;
- case "CheckLoad2":
- lock (_locker)
- {
- RobotArmEnum arm = (RobotArmEnum)param[1];
- int checkLoadStation = 19;
- _lstHandler.AddLast(new RobotSiasunPhoenixBCheckLoadHandler(this, checkLoadStation, arm, _scHomeTimeout.IntValue * 2));
- }
- break;
- default:
- break;
- }
- return true;
- }
- protected override bool fStartSetParameters(object[] param)
- {
- if (param.Length < 1) return false;
- string readcommand = param[0].ToString();
- switch (readcommand)
- {
- case "SetLoad":
- lock (_locker)
- {
- RobotArmEnum arm = (RobotArmEnum)param[1];
- bool.TryParse(param[2].ToString(), out bool isOn);
- _lstHandler.AddLast(new RobotSiasunPhoenixBSetLoadHandler(this, arm, isOn));
- }
- break;
- default:
- break;
- }
- return true;
- }
- protected override bool fStartTransferWafer(object[] param)
- {
- return true;
- }
- protected override bool fStartUnGrip(object[] param)
- {
- return true;
- }
- protected override bool fStartGrip(object[] param)
- {
- return true;
- }
- //(arm, module, slot, isRetract, isZaxisDown)
- protected override bool fStartGoTo(object[] param)
- {
- try
- {
- RobotArmEnum arm = (RobotArmEnum)param[0];
- ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- int slot = 1;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- if (BladeSlots == 1)
- {
- module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- }
- else if (BladeSlots == 2)
- {
- module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- slot = (int)param[2] / 2 + 1;
- }
- bool isRetract = true;
- bool isZaxisDown = true;
- if (param.Length >= 5)
- {
- bool.TryParse(param[3].ToString(), out isRetract);
- bool.TryParse(param[4].ToString(), out isZaxisDown);
- }
- MoveInfo = new RobotMoveInfo()
- {
- Action = RobotAction.Moving,
- ArmTarget = arm == RobotArmEnum.Blade1 ? RobotArm.ArmA : RobotArm.ArmB,
- BladeTarget = (CmdRobotArm == RobotArmEnum.Upper ? "ArmB" : "ArmA") + "." + $"{(isRetract ? ModuleName.System : module)}",
- };
- int station = 0;
- if (!_moduleAssociateStationDic.ContainsKey(module.ToString()))
- {
- EV.PostAlarmLog("Robot", "Invalid Paramter.");
- return false;
- }
- station = _moduleAssociateStationDic[module.ToString()];
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBGotoHandler(this, module, slot, arm, isRetract, isZaxisDown, _scMotionTimeout.IntValue));
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return false;
- }
- return true;
- }
- protected override bool fStartMapWafer(object[] param)
- {
- return false;
- }
- protected override bool fStartSwapWafer(object[] param)
- {
- return false;
- }
- //(arm, module, slot, ro, to)
- protected override bool fStartPlaceWafer(object[] param)
- {
- try
- {
- RobotArmEnum arm = (RobotArmEnum)param[0];
- ModuleName module = ModuleName.System;
- int slot = 1;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- if (BladeSlots == 1)
- {
- module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- }
- else if (BladeSlots == 2)
- {
- var paramArray = param[1].ToString().Split('.');
- module = (ModuleName)Enum.Parse(typeof(ModuleName), paramArray[0].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- if (paramArray.Length > 1)
- {
- slot = (int)param[2] / 2 + 1;
- }
- }
- int ro = 0;
- int to = 0;
- if (param.Length >= 5)
- {
- int.TryParse(param[3].ToString(), out ro);
- int.TryParse(param[4].ToString(), out to);
- }
- bool isDisableInterlock = _disabledIntlkModules.Contains(module);
- MoveInfo = new RobotMoveInfo()
- {
- Action = RobotAction.Moving,
- ArmTarget = arm == RobotArmEnum.Blade1 ? RobotArm.ArmA : RobotArm.ArmB,
- BladeTarget = (CmdRobotArm == RobotArmEnum.Upper ? "ArmB" : "ArmA") + "." + $"{module}",
- };
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBPlaceHandler(this,
- ModuleHelper.IsLoadLock(module) ? param[1].ToString() : module.ToString(),
- slot, arm, ro, to, _scMotionTimeout.IntValue, isDisableInterlock));
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return false;
- }
- return true;
- }
- //(arm, module, slot, ro, to)
- protected override bool fStartPickWafer(object[] param)
- {
- try
- {
- RobotArmEnum arm = (RobotArmEnum)param[0];
- ModuleName module = ModuleName.System;
- int slot = 1;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- if (BladeSlots == 1)
- {
- module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- }
- else if (BladeSlots == 2)
- {
- var paramArray = param[1].ToString().Split('.');
- module = (ModuleName)Enum.Parse(typeof(ModuleName), paramArray[0].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- if (paramArray.Length > 1)
- {
- slot = (int)param[2] / 2 + 1;
- }
- }
- float ro = 0;
- float to = 0;
- if (param.Length >= 5)
- {
- float.TryParse(param[3].ToString(), out ro);
- float.TryParse(param[4].ToString(), out to);
- }
- bool isDisableInterlock = _disabledIntlkModules.Contains(module);
- MoveInfo = new RobotMoveInfo()
- {
- Action = RobotAction.Picking,
- ArmTarget = arm == RobotArmEnum.Blade1 ? RobotArm.ArmA : RobotArm.ArmB,
- BladeTarget = (CmdRobotArm == RobotArmEnum.Upper ? "ArmB" : "ArmA") + "." + $"{module}",
- };
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBPickHandler(this,
- ModuleHelper.IsLoadLock(module) ? param[1].ToString() : module.ToString(),
- slot, arm, (int)ro, (int)to, _scMotionTimeout.IntValue, isDisableInterlock));
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return false;
- }
- return true;
- }
- protected override bool fPlaceComplete(object[] param)
- {
- Blade1Target = ModuleName.System;
- Blade2Target = ModuleName.System;
- RobotArmEnum arm = (RobotArmEnum)CurrentParamter[0];
- ModuleName sourcemodule;
- int Sourceslotindex;
- if (!int.TryParse(CurrentParamter[2].ToString(), out Sourceslotindex)) return false;
- if (BladeSlots == 1)
- {
- if (!Enum.TryParse(CurrentParamter[1].ToString(), out sourcemodule)) return false;
- if (arm == RobotArmEnum.Blade1)
- WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, Sourceslotindex);
- if (arm == RobotArmEnum.Blade2)
- WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, Sourceslotindex);
- }
- else if (BladeSlots == 2)
- {
- var array = CurrentParamter[1].ToString().Split('.');
- if (!Enum.TryParse(array[0].ToString(), out sourcemodule)) return false;
- if (ModuleHelper.IsPm(sourcemodule))
- {
- if (arm == RobotArmEnum.Blade1)
- {
- WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, 0);
- WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, 1);
- }
- if (arm == RobotArmEnum.Blade2)
- {
- WaferManager.Instance.WaferMoved(RobotModuleName, 2, sourcemodule, 0);
- WaferManager.Instance.WaferMoved(RobotModuleName, 3, sourcemodule, 1);
- }
- }
- if (ModuleHelper.IsLoadLock(sourcemodule))
- {
- if (arm == RobotArmEnum.Blade1)
- {
- WaferManager.Instance.WaferMoved(RobotModuleName, 0, sourcemodule, Sourceslotindex / 2 * 2);
- WaferManager.Instance.WaferMoved(RobotModuleName, 1, sourcemodule, Sourceslotindex / 2 * 2 + 1);
- }
- if (arm == RobotArmEnum.Blade2)
- {
- WaferManager.Instance.WaferMoved(RobotModuleName, 2, sourcemodule, Sourceslotindex / 2 * 2);
- WaferManager.Instance.WaferMoved(RobotModuleName, 3, sourcemodule, Sourceslotindex / 2 * 2 + 1);
- }
- }
- }
- return base.fPlaceComplete(param);
- }
- protected override bool fPickComplete(object[] param)
- {
- Blade1Target = ModuleName.System;
- Blade2Target = ModuleName.System;
- RobotArmEnum arm = (RobotArmEnum)CurrentParamter[0];
- ModuleName sourcemodule;
- int SourceslotIndex;
- if (!int.TryParse(CurrentParamter[2].ToString(), out SourceslotIndex)) return false;
- if (BladeSlots == 1)
- {
- if (!Enum.TryParse(CurrentParamter[1].ToString(), out sourcemodule)) return false;
- if (arm == RobotArmEnum.Blade1)
- WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 0);
- if (arm == RobotArmEnum.Blade2)
- WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex, RobotModuleName, 1);
- }
- else if (BladeSlots == 2)
- {
- var array = CurrentParamter[1].ToString().Split('.');
- if (!Enum.TryParse(array[0].ToString(), out sourcemodule)) return false;
- if (ModuleHelper.IsPm(sourcemodule))
- {
- if (arm == RobotArmEnum.Blade1)
- {
- WaferManager.Instance.WaferMoved(sourcemodule, 0, RobotModuleName, 0);
- WaferManager.Instance.WaferMoved(sourcemodule, 1, RobotModuleName, 1);
- }
- if (arm == RobotArmEnum.Blade2)
- {
- WaferManager.Instance.WaferMoved(sourcemodule, 0, RobotModuleName, 2);
- WaferManager.Instance.WaferMoved(sourcemodule, 1, RobotModuleName, 3);
- }
- }
- if (ModuleHelper.IsLoadLock(sourcemodule))
- {
- if (arm == RobotArmEnum.Blade1)
- {
- WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex / 2 * 2, RobotModuleName, 0);
- WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex / 2 * 2 + 1, RobotModuleName, 1);
- }
- if (arm == RobotArmEnum.Blade2)
- {
- WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex / 2 * 2, RobotModuleName, 2);
- WaferManager.Instance.WaferMoved(sourcemodule, SourceslotIndex / 2 * 2 + 1, RobotModuleName, 3);
- }
- }
- }
- return base.fPickComplete(param);
- }
- protected override bool fResetToReady(object[] param)
- {
- return true;
- }
- protected override bool fReset(object[] param)
- {
- _trigError.RST = true;
- _connection.SetCommunicationError(false, "");
- _trigCommunicationError.RST = true;
- //_enableLog = SC.GetValue<bool>($"{ScBasePath}.{Name}.EnableLogMessage");
- _trigRetryConnect.RST = true;
- if (_isAlarm)
- {
- //lock (_locker)
- //{
- // _lstHandler.AddLast(new RobotSiasunPhoenixBResetHandler(this));
- //}
- //Thread.Sleep(100);
- CheckToPostMessage((int)RobotMsg.ActionDone);
- }
- IsBusy = false;
- return true;
- }
- protected override bool fMonitorReset(object[] param)
- {
- IsBusy = false;
- return true;
- }
- protected override bool fStartInit(object[] param)
- {
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBSetCommunicationEchoHandler(this, false));
- if (!SevoOnOff)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBSevoOnOffHandler(this, true));
- }
- _lstHandler.AddLast(new RobotSiasunPhoenixBHomeAxisHandler(this, _scHomeTimeout.IntValue));
- }
- return true;
- }
- protected override bool fError(object[] param)
- {
- return true;
- }
- protected override bool fStartExtendForPick(object[] param)
- {
- try
- {
- RobotArmEnum arm = (RobotArmEnum)param[0];
- ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- int slot = 1;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- int station = 0;
- if (!_moduleAssociateStationDic.ContainsKey(module.ToString()))
- {
- EV.PostAlarmLog("Robot", "Invalid Paramter.");
- return false;
- }
- station = _moduleAssociateStationDic[module.ToString()];
- MoveInfo = new RobotMoveInfo()
- {
- Action = RobotAction.Moving,
- ArmTarget = arm == RobotArmEnum.Blade1 ? RobotArm.ArmA : RobotArm.ArmB,
- BladeTarget = (CmdRobotArm == RobotArmEnum.Upper ? "ArmB" : "ArmA") + "." + $"{module}",
- };
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBPickExtendHandler(this, module, slot, arm, 0, 0, _scMotionTimeout.IntValue));
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return false;
- }
- return true;
- }
- protected override bool fStartExtendForPlace(object[] param)
- {
- try
- {
- RobotArmEnum arm = (RobotArmEnum)param[0];
- ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- int slot = 1;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- int station = 0;
- if (!_moduleAssociateStationDic.ContainsKey(module.ToString()))
- {
- EV.PostAlarmLog("Robot", "Invalid Paramter.");
- return false;
- }
- station = _moduleAssociateStationDic[module.ToString()];
- MoveInfo = new RobotMoveInfo()
- {
- Action = RobotAction.Moving,
- ArmTarget = arm == RobotArmEnum.Blade1 ? RobotArm.ArmA : RobotArm.ArmB,
- BladeTarget = (CmdRobotArm == RobotArmEnum.Upper ? "ArmB" : "ArmA") + "." + $"{module}",
- };
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBPlaceExtendHandler(this, module, slot, arm, 0, 0, _scMotionTimeout.IntValue));
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return false;
- }
- return true;
- }
- protected override bool fStartRetractFromPick(object[] param)
- {
- try
- {
- RobotArmEnum arm = (RobotArmEnum)param[0];
- ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- int slot = 1;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- int station = 0;
- if (!_moduleAssociateStationDic.ContainsKey(module.ToString()))
- {
- EV.PostAlarmLog("Robot", "Invalid Paramter.");
- return false;
- }
- station = _moduleAssociateStationDic[module.ToString()];
- MoveInfo = new RobotMoveInfo()
- {
- Action = RobotAction.Moving,
- ArmTarget = arm == RobotArmEnum.Blade1 ? RobotArm.ArmA : RobotArm.ArmB,
- BladeTarget = (CmdRobotArm == RobotArmEnum.Upper ? "ArmB" : "ArmA") + "." + $"{ModuleName.System}",
- };
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBPickRetractHandler(this, module, slot, arm, 0, 0, _scMotionTimeout.IntValue));
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return false;
- }
- return true;
- }
- protected override bool fStartRetractFromPlace(object[] param)
- {
- try
- {
- RobotArmEnum arm = (RobotArmEnum)param[0];
- ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
- if (arm == RobotArmEnum.Blade1)
- Blade1Target = module;
- if (arm == RobotArmEnum.Blade2)
- Blade2Target = module;
- int slot = 1;
- if (param.Length >= 3)
- slot = (int)param[2] + 1;
- int station = 0;
- if (!_moduleAssociateStationDic.ContainsKey(module.ToString()))
- {
- EV.PostAlarmLog("Robot", "Invalid Paramter.");
- return false;
- }
- station = _moduleAssociateStationDic[module.ToString()];
- MoveInfo = new RobotMoveInfo()
- {
- Action = RobotAction.Moving,
- ArmTarget = arm == RobotArmEnum.Blade1 ? RobotArm.ArmA : RobotArm.ArmB,
- BladeTarget = (CmdRobotArm == RobotArmEnum.Upper ? "ArmB" : "ArmA") + "." + $"{ModuleName.System}",
- };
- lock (_locker)
- {
- _lstHandler.AddLast(new RobotSiasunPhoenixBPlaceRetractHandler(this, module, slot, arm, 0, 0, _scMotionTimeout.IntValue));
- }
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- return false;
- }
- return true;
- }
- public override RobotArmWaferStateEnum GetWaferState(RobotArmEnum arm)
- {
- if (arm == RobotArmEnum.Blade1)
- {
- return IsWaferPresenceOnBlade1 ? RobotArmWaferStateEnum.Present : RobotArmWaferStateEnum.Absent;
- }
- if (arm == RobotArmEnum.Blade2)
- {
- return IsWaferPresenceOnBlade2 ? RobotArmWaferStateEnum.Present : RobotArmWaferStateEnum.Absent;
- }
- return RobotArmWaferStateEnum.Unknown;
- }
- protected override bool fStop(object[] param)
- {
- lock (_locker)
- {
- IsBusy = false;
- _connection.ForceClear();
- _lstHandler.Clear();
- }
- return true;
- }
- protected override bool fAbort(object[] param)
- {
- lock (_locker)
- {
- IsBusy = false;
- _connection.ForceClear();
- _lstHandler.Clear();
- _lstHandler.AddLast(new RobotSiasunPhoenixBHaltHandler(this));
- }
- return true;
- }
- #endregion
- }
- public class GotoArgument
- {
- /// <summary>
- ///
- /// </summary>
- public int Station { get; set; }
- /// <summary>
- ///
- /// </summary>
- public string R { get; set; }
- /// <summary>
- ///
- /// </summary>
- public string Z { get; set; }
- /// <summary>
- ///
- /// </summary>
- public int Slot { get; set; }
- /// <summary>
- ///
- /// </summary>
- public string Arm { get; set; }
- }
- public class PickPlaceArgument
- {
- /// <summary>
- ///
- /// </summary>
- public int Station { get; set; }
- /// <summary>
- ///
- /// </summary>
- public int Slot { get; set; }
- /// <summary>
- ///
- /// </summary>
- public string Arm { get; set; }
- /// <summary>
- ///
- /// </summary>
- public int Step { get; set; }
- /// <summary>
- ///
- /// </summary>
- public string Offset { get; set; }
- }
- }
|