LoadPortBaseDevice.cs 108 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843
  1. using Aitex.Core.RT.Device;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Net.Configuration;
  6. using System.Text;
  7. using System.Text.RegularExpressions;
  8. using System.Threading.Tasks;
  9. using Aitex.Core.Common;
  10. using Aitex.Core.RT.DataCenter;
  11. using Aitex.Core.RT.Event;
  12. using Aitex.Core.RT.OperationCenter;
  13. using Aitex.Core.RT.SCCore;
  14. using Aitex.Core.Util;
  15. using Aitex.Sorter.Common;
  16. using MECF.Framework.Common.Equipment;
  17. using MECF.Framework.Common.SubstrateTrackings;
  18. using Aitex.Core.RT.Device.Unit;
  19. using System.Threading;
  20. using static Aitex.Core.RT.Device.Unit.IOE84Passive;
  21. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders.CarrierIDReaderBase;
  22. using Aitex.Core.RT.Fsm;
  23. using MECF.Framework.Common.Event;
  24. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  25. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK;
  26. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase
  27. {
  28. public abstract class LoadPortBaseDevice : Entity, IEntity, ILoadPort
  29. {
  30. public enum CarrierOnLPState
  31. {
  32. Unknow = 0,
  33. On,
  34. Off,
  35. }
  36. public LoadPortBaseDevice(string module, string name, RobotBaseDevice robot = null, IE84CallBack e84 = null) : base()
  37. {
  38. Module = module;
  39. Name = name;
  40. LPModuleName = (ModuleName)Enum.Parse(typeof(ModuleName), Name);
  41. _robot = robot;
  42. if (_robot != null)
  43. MapRobot.OnSlotMapRead += MapRobot_OnSlotMapRead;
  44. _lpE84Callback = e84;
  45. InitializeLP();
  46. }
  47. public virtual int TimelimitAction
  48. {
  49. get
  50. {
  51. if (SC.ContainsItem($"LoadPort.{Name}.TimeLimitAction"))
  52. return SC.GetValue<int>($"LoadPort.{Name}.TimeLimitAction");
  53. return 90;
  54. }
  55. }
  56. public virtual int TimelimitHome
  57. {
  58. get
  59. {
  60. if (SC.ContainsItem($"LoadPort.{Name}.TimeLimitLoadportHome"))
  61. return SC.GetValue<int>($"LoadPort.{Name}.TimeLimitLoadportHome");
  62. return 90;
  63. }
  64. }
  65. public virtual bool IsAutoReadCarrierID
  66. {
  67. get
  68. {
  69. return SC.ContainsItem($"LoadPort.{LPModuleName}.EnableAutoCarrierIdRead") ?
  70. SC.GetValue<bool>($"LoadPort.{LPModuleName}.EnableAutoCarrierIdRead") : true;
  71. }
  72. }
  73. public virtual bool IsAutoUnloadAfterProcess
  74. {
  75. get
  76. {
  77. return SC.ContainsItem($"LoadPort.{LPModuleName}.EnableAutoUnload") ?
  78. SC.GetValue<bool>($"LoadPort.{LPModuleName}.EnableAutoUnload") : true;
  79. }
  80. }
  81. public virtual bool IsCloseDoorWhenIdle
  82. {
  83. get
  84. {
  85. return SC.ContainsItem($"LoadPort.{LPModuleName}.CloseDoorWhenIdle") ?
  86. SC.GetValue<bool>($"LoadPort.{LPModuleName}.CloseDoorWhenIdle") : false;
  87. }
  88. }
  89. public virtual bool IsBypassCarrierIDReader
  90. {
  91. get
  92. {
  93. return SC.ContainsItem($"LoadPort.{LPModuleName}.BypassCarrierIDReader") ?
  94. SC.GetValue<bool>($"LoadPort.{LPModuleName}.BypassCarrierIDReader") : false;
  95. }
  96. }
  97. public virtual bool IsAutoDetectCarrierType
  98. {
  99. get
  100. {
  101. return SC.ContainsItem($"LoadPort.{LPModuleName}.AutoDetectCarrierType") ?
  102. SC.GetValue<bool>($"LoadPort.{LPModuleName}.AutoDetectCarrierType") : true;
  103. }
  104. }
  105. public virtual Tuple<int, string>[] ValidCarrierTypeList
  106. {
  107. get
  108. {
  109. List<Tuple<int, string>> ret = new List<Tuple<int, string>>();
  110. for (int i = 0; i <= 15; i++)
  111. {
  112. if (!SC.ContainsItem($"CarrierInfo.CarrierName{i}"))
  113. continue;
  114. if (SC.ContainsItem($"CarrierInfo.EnableCarrier{i}") && !SC.GetValue<bool>($"CarrierInfo.EnableCarrier{i}"))
  115. continue;
  116. string carriertype = "Carrier Type: " + SC.GetStringValue($"CarrierInfo.CarrierName{i}")
  117. + (SC.ContainsItem($"CarrierInfo.CarrierWaferSize{i}") ? ($";WaferSize:WS{SC.GetValue<int>($"CarrierInfo.CarrierWaferSize{i}")}") : "");
  118. ret.Add(new Tuple<int, string>(i, carriertype));
  119. }
  120. return ret.ToArray();
  121. }
  122. }
  123. public virtual DispatchLPType DspLpType
  124. {
  125. get
  126. {
  127. if (SC.ContainsItem($"LoadPort.{Name}.DispatchLpType"))
  128. {
  129. int inttype = SC.GetValue<int>($"LoadPort.{Name}.DispatchLpType");
  130. return (DispatchLPType)inttype;
  131. }
  132. return DispatchLPType.NA;
  133. }
  134. }
  135. private void MapRobot_OnSlotMapRead(ModuleName arg1, string arg2)
  136. {
  137. if (arg1 == LPModuleName)
  138. OnSlotMapRead(arg2);
  139. }
  140. private void InitializeLP()
  141. {
  142. BuildTransitionTable();
  143. SubscribeDataVariable();
  144. SubscribeOperation();
  145. SubscribeDeviceOperation();
  146. RegisterOperation();
  147. }
  148. private void BuildTransitionTable()
  149. {
  150. fsm = new StateMachine<LoadPortBaseDevice>(Name + ".LPStateMachine", (int)LoadPortStateEnum.Init, 50);
  151. AnyStateTransition(LoadPortMsg.Error, fError, LoadPortStateEnum.Error);
  152. AnyStateTransition((int)FSM_MSG.ALARM, fError, (int)LoadPortStateEnum.Error);
  153. AnyStateTransition(LoadPortMsg.Abort, fStartAbort, LoadPortStateEnum.Init);
  154. Transition(LoadPortStateEnum.Init, LoadPortMsg.Reset, fStartReset, LoadPortStateEnum.Resetting);
  155. Transition(LoadPortStateEnum.Error, LoadPortMsg.Reset, fStartReset, LoadPortStateEnum.Resetting);
  156. Transition(LoadPortStateEnum.Idle, LoadPortMsg.Reset, fStartReset, LoadPortStateEnum.Resetting);
  157. Transition(LoadPortStateEnum.Resetting, LoadPortMsg.ResetComplete, fCompleteReset, LoadPortStateEnum.Idle);
  158. Transition(LoadPortStateEnum.Resetting, LoadPortMsg.ActionDone, fCompleteReset, LoadPortStateEnum.Idle);
  159. Transition(LoadPortStateEnum.Resetting, FSM_MSG.TIMER, fMonitorReset, LoadPortStateEnum.Idle);
  160. Transition(LoadPortStateEnum.Init, LoadPortMsg.Init, fStartInit, LoadPortStateEnum.Initializing);
  161. Transition(LoadPortStateEnum.Idle, LoadPortMsg.Init, fStartInit, LoadPortStateEnum.Initializing);
  162. Transition(LoadPortStateEnum.Error, LoadPortMsg.Init, fStartInit, LoadPortStateEnum.Initializing);
  163. Transition(LoadPortStateEnum.Error, LoadPortMsg.InitComplete, fCompleteInit, LoadPortStateEnum.Idle);
  164. Transition(LoadPortStateEnum.Init, LoadPortMsg.InitComplete, fCompleteInit, LoadPortStateEnum.Idle);
  165. Transition(LoadPortStateEnum.Initializing, LoadPortMsg.ActionDone, fCompleteInit, LoadPortStateEnum.Idle);
  166. Transition(LoadPortStateEnum.Initializing, LoadPortMsg.InitComplete, fCompleteInit, LoadPortStateEnum.Idle);
  167. Transition(LoadPortStateEnum.Initializing, FSM_MSG.TIMER, fMonitorInit, LoadPortStateEnum.Idle);
  168. Transition(LoadPortStateEnum.Init, LoadPortMsg.StartHome, fStartHomet, LoadPortStateEnum.Homing);
  169. Transition(LoadPortStateEnum.Idle, LoadPortMsg.StartHome, fStartHomet, LoadPortStateEnum.Homing);
  170. Transition(LoadPortStateEnum.Error, LoadPortMsg.StartHome, fStartHomet, LoadPortStateEnum.Homing);
  171. Transition(LoadPortStateEnum.Homing, LoadPortMsg.ActionDone, fCompleteHome, LoadPortStateEnum.Idle);
  172. Transition(LoadPortStateEnum.Homing, LoadPortMsg.HomeComplete, fCompleteHome, LoadPortStateEnum.Idle);
  173. Transition(LoadPortStateEnum.Init, LoadPortMsg.HomeComplete, fCompleteHome, LoadPortStateEnum.Idle);
  174. Transition(LoadPortStateEnum.Error, LoadPortMsg.HomeComplete, fCompleteHome, LoadPortStateEnum.Idle);
  175. Transition(LoadPortStateEnum.Idle, LoadPortMsg.Load, fStartLoad, LoadPortStateEnum.Loading);
  176. Transition(LoadPortStateEnum.Loading, LoadPortMsg.ActionDone, fCompleteLoad, LoadPortStateEnum.Idle);
  177. Transition(LoadPortStateEnum.Loading, LoadPortMsg.LoadComplete, fCompleteLoad, LoadPortStateEnum.Idle);
  178. Transition(LoadPortStateEnum.Loading, FSM_MSG.TIMER, fMonitorLoad, LoadPortStateEnum.Idle);
  179. Transition(LoadPortStateEnum.Idle, LoadPortMsg.Unload, fStartUnload, LoadPortStateEnum.Unloading);
  180. Transition(LoadPortStateEnum.Unloading, LoadPortMsg.ActionDone, fCompleteUnload, LoadPortStateEnum.Idle);
  181. Transition(LoadPortStateEnum.Unloading, LoadPortMsg.UnloadComplete, fCompleteUnload, LoadPortStateEnum.Idle);
  182. Transition(LoadPortStateEnum.Unloading, FSM_MSG.TIMER, fMonitorUnload, LoadPortStateEnum.Idle);
  183. Transition(LoadPortStateEnum.Idle, LoadPortMsg.StartExecute, fStartExecute, LoadPortStateEnum.Executing);
  184. Transition(LoadPortStateEnum.Executing, LoadPortMsg.ActionDone, fCompleteExecute, LoadPortStateEnum.Idle);
  185. Transition(LoadPortStateEnum.Executing, LoadPortMsg.MoveComplete, fCompleteExecute, LoadPortStateEnum.Idle);
  186. Transition(LoadPortStateEnum.Executing, FSM_MSG.TIMER, fMonitorExecuting, LoadPortStateEnum.Idle);
  187. Transition(LoadPortStateEnum.Idle, LoadPortMsg.StartReadData, fStartRead, LoadPortStateEnum.ReadingData);
  188. Transition(LoadPortStateEnum.ReadingData, LoadPortMsg.ActionDone, fCompleteRead, LoadPortStateEnum.Idle);
  189. Transition(LoadPortStateEnum.ReadingData, LoadPortMsg.ReadComplete, fCompleteRead, LoadPortStateEnum.Idle);
  190. Transition(LoadPortStateEnum.Idle, LoadPortMsg.StartWriteData, fStartWrite, LoadPortStateEnum.WrittingData);
  191. Transition(LoadPortStateEnum.WrittingData, LoadPortMsg.ActionDone, fCompleteWrite, LoadPortStateEnum.Idle);
  192. Transition(LoadPortStateEnum.WrittingData, LoadPortMsg.MoveComplete, fCompleteWrite, LoadPortStateEnum.Idle);
  193. Transition(LoadPortStateEnum.Idle, LoadPortMsg.StartAccess, fStartAccess, LoadPortStateEnum.TransferBlock);
  194. Transition(LoadPortStateEnum.TransferBlock, LoadPortMsg.CompleteAccess, fCompleteAccess, LoadPortStateEnum.Idle);
  195. Transition(LoadPortStateEnum.TransferBlock, LoadPortMsg.ActionDone, fCompleteAccess, LoadPortStateEnum.Idle);
  196. Transition(LoadPortStateEnum.TransferBlock, FSM_MSG.TIMER, fMonitorTransferBlock, LoadPortStateEnum.TransferBlock);
  197. }
  198. protected virtual bool fMonitorTransferBlock(object[] param)
  199. {
  200. return true;
  201. }
  202. protected virtual bool fMonitorExecuting(object[] param)
  203. {
  204. return false;
  205. }
  206. protected virtual bool fMonitorInit(object[] param)
  207. {
  208. return false;
  209. }
  210. protected virtual bool fMonitorReset(object[] param)
  211. {
  212. return false;
  213. }
  214. protected virtual bool fMonitorUnload(object[] param)
  215. {
  216. return false;
  217. }
  218. protected virtual bool fMonitorLoad(object[] param)
  219. {
  220. return false;
  221. }
  222. protected virtual bool fCompleteAccess(object[] param)
  223. {
  224. return true;
  225. }
  226. protected virtual bool fStartAccess(object[] param)
  227. {
  228. return true;
  229. }
  230. protected virtual bool fCompleteHome(object[] param)
  231. {
  232. return true;
  233. }
  234. protected virtual bool fStartHomet(object[] param)
  235. {
  236. return true;
  237. }
  238. protected virtual bool fCompleteWrite(object[] param)
  239. {
  240. return true;
  241. }
  242. protected abstract bool fStartWrite(object[] param);
  243. protected virtual bool fCompleteRead(object[] param)
  244. {
  245. return true;
  246. }
  247. protected abstract bool fStartRead(object[] param);
  248. protected virtual bool fCompleteMove(object[] param)
  249. {
  250. return true;
  251. }
  252. protected abstract bool fStartExecute(object[] param);
  253. protected virtual bool fCompleteExecute(object[] param)
  254. {
  255. return true;
  256. }
  257. protected abstract bool fStartUnload(object[] param);
  258. protected virtual bool fCompleteUnload(object[] param)
  259. {
  260. OnUnloaded();
  261. return true;
  262. }
  263. protected virtual bool fCompleteLoad(object[] param)
  264. {
  265. OnLoaded();
  266. return true;
  267. }
  268. protected abstract bool fStartLoad(object[] param);
  269. protected virtual bool fCompleteInit(object[] param)
  270. {
  271. return true;
  272. }
  273. protected abstract bool fStartInit(object[] param);
  274. protected virtual bool fCompleteReset(object[] param)
  275. {
  276. return true;
  277. }
  278. protected abstract bool fStartReset(object[] param);
  279. protected virtual bool fStartAbort(object[] param)
  280. {
  281. return true;
  282. }
  283. protected virtual bool fError(object[] param)
  284. {
  285. return true;
  286. }
  287. private void SubscribeDeviceOperation()
  288. {
  289. }
  290. private void SubscribeOperation()
  291. {
  292. }
  293. private void SubscribeDataVariable()
  294. {
  295. DoorState = FoupDoorState.Unknown;
  296. WaferManager.Instance.SubscribeLocation(LPModuleName, 25);
  297. CarrierManager.Instance.SubscribeLocation(LPModuleName.ToString());
  298. DATA.Subscribe(Name, "IsPresent", () => _isPresent);
  299. DATA.Subscribe(Name, "IsPlaced", () => _isPlaced);
  300. DATA.Subscribe(Name, "IsClamped", () => ClampState == FoupClampState.Close);
  301. DATA.Subscribe(Name, "IsDocked", () => DockState == FoupDockState.Docked);
  302. DATA.Subscribe(Name, "IsDoorOpen", () => DoorState == FoupDoorState.Open);
  303. DATA.Subscribe(Name, "IsAccessSwPressed", () => IsAccessSwPressed);
  304. DATA.Subscribe(Name, "CarrierId", () => _carrierId);
  305. DATA.Subscribe(Name, "LPLotID", () => _lplotID);
  306. DATA.Subscribe(Name, "IsMapped", () => _isMapped);
  307. DATA.Subscribe(Name, "IsAutoDetectCarrierType", () => IsAutoDetectCarrierType);
  308. DATA.Subscribe(Name, "ValidCarrierTypeList", () => ValidCarrierTypeList);
  309. DATA.Subscribe($"{Name}.LoadportState", () => CurrentState.ToString());
  310. DATA.Subscribe($"{Name}.Status", () => CurrentState.ToString());
  311. //DATA.Subscribe($"{Name}.LoadportBusy", () => );
  312. DATA.Subscribe($"{Name}.LoadportError", () => ErrorCode);
  313. DATA.Subscribe($"{Name}.CassetteState", () => CassetteState);
  314. DATA.Subscribe($"{Name}.FoupClampState", () => ClampState);
  315. DATA.Subscribe($"{Name}.FoupDockState", () => DockState);
  316. DATA.Subscribe($"{Name}.FoupDoorState", () => DoorState);
  317. DATA.Subscribe($"{Name}.FoupDoorPosition", () => DoorPosition);
  318. DATA.Subscribe($"{Name}.SlotMap", () => SlotMap);
  319. DATA.Subscribe($"{Name}.IndicatiorLoad", () => IndicatiorLoad);
  320. DATA.Subscribe($"{Name}.IndicatiorUnload", () => IndicatiorUnload);
  321. DATA.Subscribe($"{Name}.IndicatiorPresence", () => IndicatiorPresence);
  322. DATA.Subscribe($"{Name}.IndicatiorPlacement", () => IndicatiorPlacement);
  323. DATA.Subscribe($"{Name}.IndicatiorAlarm", () => IndicatorAlarm);
  324. DATA.Subscribe($"{Name}.IndicatiorAccessAuto", () => IndicatiorAccessAuto);
  325. DATA.Subscribe($"{Name}.IndicatiorAccessManual", () => IndicatiorAccessManual);
  326. DATA.Subscribe($"{Name}.IndicatiorOpAccess", () => IndicatiorOpAccess);
  327. DATA.Subscribe($"{Name}.IndicatiorStatus1", () => IndicatiorStatus1);
  328. DATA.Subscribe($"{Name}.IndicatiorStatus2", () => IndicatiorStatus2);
  329. DATA.Subscribe($"{Name}.CasstleType", () => (int)CasstleType);
  330. DATA.Subscribe($"{Name}.InfoPadCarrierType", () => SpecCarrierType);
  331. DATA.Subscribe($"{Name}.InfoPadCarrierTypeInformation", () => SpecCarrierInformation);
  332. DATA.Subscribe($"{Name}.InfoPadCarrierIndex", () => InfoPadCarrierIndex);
  333. DATA.Subscribe($"{Name}.CarrierWaferSize", () => GetCurrentWaferSize().ToString());
  334. DATA.Subscribe($"{Name}.IsError", () => CurrentState == LoadPortStateEnum.Error);
  335. DATA.Subscribe($"{Name}.PreDefineWaferCount", () => PreDefineWaferCount);
  336. DATA.Subscribe($"{Name}.IsVerifyPreDefineWaferCount", () => IsVerifyPreDefineWaferCount);
  337. EV.Subscribe(new EventItem("Event", EventCarrierArrived, "Carrier arrived"));
  338. EV.Subscribe(new EventItem("Event", EventCarrierRemoved, "Carrier removed"));
  339. EV.Subscribe(new EventItem("Event", EventCarrierIdRead, "Carrier ID read"));
  340. EV.Subscribe(new EventItem("Event", EventCarrierIdReadFailed, "Carrier ID read failed"));
  341. EV.Subscribe(new EventItem("Event", EventCarrierIdWrite, "Carrier ID write"));
  342. EV.Subscribe(new EventItem("Event", EventCarrierIdWriteFailed, "Carrier ID write failed"));
  343. EV.Subscribe(new EventItem("Event", EventSlotMapAvailable, "Slot map available"));
  344. EV.Subscribe(new EventItem("Event", EventCarrierUnloaded, "Carrier unloaded"));
  345. EV.Subscribe(new EventItem("Event", EventCarrierloaded, "Carrier loaded"));
  346. EV.Subscribe(new EventItem("Event", EventRfIdRead, "Carrier RFID read"));
  347. EV.Subscribe(new EventItem("Event", EventRfIdReadFailed, "Carrier RFID read failed"));
  348. EV.Subscribe(new EventItem("Event", EventRfIdWrite, "Carrier RFID write"));
  349. EV.Subscribe(new EventItem("Event", EventRfIdWriteFailed, "Carrier RFID write failed"));
  350. SubscribeAlarm();
  351. IndicatorStateFeedback = new IndicatorState[20];
  352. if (_lpE84Callback != null)
  353. {
  354. _lpE84Callback.OnE84ActiveSignalChange += _lpE84Callback_OnE84ActiveSignalChange;
  355. _lpE84Callback.OnE84PassiveSignalChange += _lpE84Callback_OnE84PassiveSignalChange;
  356. _lpE84Callback.OnE84HandOffComplete += _lpE84Callback_OnE84HandOffComplete;
  357. _lpE84Callback.OnE84HandOffStart += _lpE84Callback_OnE84HandOffStart;
  358. _lpE84Callback.OnE84HandOffTimeout += _lpE84Callback_OnE84HandOffTimeout;
  359. }
  360. }
  361. private void SubscribeAlarm()
  362. {
  363. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortError, $"Load Port {Name} occurred error.", EventLevel.Alarm, EventType.EventUI_Notify));
  364. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortCommunicationError, $"Load Port {Name}error.", EventLevel.Alarm, EventType.EventUI_Notify));
  365. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortWaferProtrusion, $"Load Port {Name} wafer protrusion error.", EventLevel.Alarm, EventType.EventUI_Notify));
  366. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortLoadTimeOut, $"Load Port {Name} load timeout.", EventLevel.Alarm, EventType.EventUI_Notify));
  367. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortLoadFailed, $"Load Port {Name} load failed.", EventLevel.Alarm, EventType.EventUI_Notify));
  368. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortUnloadTimeOut, $"Load Port {Name} unload timeout.", EventLevel.Alarm, EventType.EventUI_Notify));
  369. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortUnloadFailed, $"Load Port {Name} unload failed.", EventLevel.Alarm, EventType.EventUI_Notify));
  370. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortMappingError, $"Load Port {Name} mapping error.", EventLevel.Alarm, EventType.EventUI_Notify));
  371. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortMappingTimeout, $"Load Port {Name} mapping Timeout.", EventLevel.Alarm, EventType.EventUI_Notify));
  372. EV.Subscribe(new EventItem("Alarm", AlarmCarrierIDReadError, $"Load Port {Name} occurred error when read carrier ID.", EventLevel.Alarm, EventType.EventUI_Notify));
  373. EV.Subscribe(new EventItem("Alarm", AlarmCarrierIDWriteError, $"Load Port {Name} occurred error when write carrierID.", EventLevel.Alarm, EventType.EventUI_Notify));
  374. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortMapCrossedWafer, $"Load Port {Name} mapped crossed wafer.", EventLevel.Alarm, EventType.EventUI_Notify));
  375. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortMapDoubleWafer, $"Load Port {Name} mapped double wafer.", EventLevel.Alarm, EventType.EventUI_Notify));
  376. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortMapUnknownWafer, $"Load Port {Name} mapped unknown wafer.", EventLevel.Alarm, EventType.EventUI_Notify));
  377. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortCarrierIDIndexConfigError, $"Load Port {Name} carrierID reader configuration is invalid.", EventLevel.Alarm, EventType.EventUI_Notify));
  378. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortHomeFailed, $"Load Port {Name} occurred error when home.", EventLevel.Alarm, EventType.EventUI_Notify));
  379. EV.Subscribe(new EventItem("Alarm", AlarmLoadPortHomeTimeout, $"Load Port {Name} home timeout.", EventLevel.Alarm, EventType.EventUI_Notify));
  380. EV.Subscribe(new EventItem("Alarm", AlarmLoadE84TP1Timeout, $"Load Port {Name} occurred TP1 timeout during loading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  381. EV.Subscribe(new EventItem("Alarm", AlarmLoadE84TP2Timeout, $"Load Port {Name} occurred TP2 timeout during loading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  382. EV.Subscribe(new EventItem("Alarm", AlarmLoadE84TP3Timeout, $"Load Port {Name} occurred TP3 timeout during loading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  383. EV.Subscribe(new EventItem("Alarm", AlarmLoadE84TP4Timeout, $"Load Port {Name} occurred TP4 timeout during loading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  384. EV.Subscribe(new EventItem("Alarm", AlarmLoadE84TP5Timeout, $"Load Port {Name} occurred TP5 timeout during loading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  385. EV.Subscribe(new EventItem("Alarm", AlarmLoadE84TP6Timeout, $"Load Port {Name} occurred TP6 timeout during loading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  386. EV.Subscribe(new EventItem("Alarm", AlarmUnloadE84TP1Timeout, $"Load Port {Name} occurred TP1 timeout during unloading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  387. EV.Subscribe(new EventItem("Alarm", AlarmUnloadE84TP2Timeout, $"Load Port {Name} occurred TP2 timeout during unloading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  388. EV.Subscribe(new EventItem("Alarm", AlarmUnloadE84TP3Timeout, $"Load Port {Name} occurred TP3 timeout during unloading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  389. EV.Subscribe(new EventItem("Alarm", AlarmUnloadE84TP4Timeout, $"Load Port {Name} occurred TP4 timeout during unloading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  390. EV.Subscribe(new EventItem("Alarm", AlarmUnloadE84TP5Timeout, $"Load Port {Name} occurred TP5 timeout during unloading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  391. EV.Subscribe(new EventItem("Alarm", AlarmUnloadE84TP6Timeout, $"Load Port {Name} occurred TP6 timeout during unloading foup.", EventLevel.Alarm, EventType.EventUI_Notify));
  392. }
  393. public LoadPortStateEnum CurrentState => (LoadPortStateEnum)fsm.State;
  394. public LoadPortStateEnum PreviousState => (LoadPortStateEnum)fsm.PrevState;
  395. public ModuleName LPModuleName { get; protected set; }
  396. public virtual int InfoPadCarrierIndex { get; set; }
  397. public string SpecPortName { get; set; } = string.Empty;
  398. public string Module { get; set; }
  399. public string Name { get; set; }
  400. protected event Action<bool> ActionDone;
  401. public event Action<string, AlarmEventItem> OnDeviceAlarmStateChanged;
  402. public bool IsBusy { get; set; }
  403. public bool IsIdle
  404. {
  405. get
  406. {
  407. return fsm.State == (int)LoadPortStateEnum.Idle && fsm.CheckExecuted() && !IsBusy;
  408. }
  409. }
  410. public virtual bool IsReady()
  411. {
  412. return fsm.State == (int)LoadPortStateEnum.Idle && !IsBusy;
  413. }
  414. public IndicatorState IndicatiorLoad { get; set; }
  415. public IndicatorState IndicatiorUnload { get; set; }
  416. public IndicatorState IndicatiorPresence { get; set; }
  417. public IndicatorState IndicatorAlarm { get; set; }
  418. public IndicatorState IndicatiorPlacement { get; set; }
  419. public IndicatorState IndicatiorOpAccess { get; set; }
  420. public IndicatorState IndicatiorAccessAuto { get; set; }
  421. public IndicatorState IndicatiorAccessManual { get; set; }
  422. public IndicatorState IndicatiorStatus1 { get; set; }
  423. public IndicatorState IndicatiorStatus2 { get; set; }
  424. public IndicatorState IndicatiorManualMode { get; set; }
  425. public IndicatorState IndicatiorClampUnclamp { get; set; }
  426. public IndicatorState IndicatiorDockUndock { get; set; }
  427. public static Dictionary<IndicatorType, Indicator> LoadPortIndicatorLightMap =
  428. new Dictionary<IndicatorType, Indicator>()
  429. {
  430. {IndicatorType.Load, Indicator.LOAD},
  431. {IndicatorType.Unload, Indicator.UNLOAD},
  432. {IndicatorType.AccessAuto, Indicator.ACCESSAUTO },
  433. {IndicatorType.AccessManual, Indicator.ACCESSMANUL},
  434. {IndicatorType.Alarm, Indicator.ALARM},
  435. {IndicatorType.Presence, Indicator.PRESENCE},
  436. {IndicatorType.Placement, Indicator.PLACEMENT},
  437. {IndicatorType.Status1, Indicator.RESERVE1},
  438. {IndicatorType.Status2, Indicator.RESERVE2},
  439. };
  440. public IndicatorState[] IndicatorStateFeedback { get; set; }
  441. public virtual FoupClampState ClampState { get; set; }
  442. public virtual FoupDockState DockState { get; set; }
  443. public virtual FoupDoorState DoorState { get; set; }
  444. public virtual FoupDoorPostionEnum DoorPosition { get; set; }
  445. public virtual bool IsVacuumON { get; set; }
  446. public virtual CasstleType CasstleType { get; set; }
  447. public virtual string SlotMap
  448. {
  449. get
  450. {
  451. WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
  452. string slot = "";
  453. for (int i = 0; i < 25; i++)
  454. {
  455. slot += wafers[i].IsEmpty ? "0" : "1";
  456. }
  457. return slot;
  458. }
  459. }
  460. //Hirata
  461. public int WaferCount { get; set; }
  462. public string LoadPortType { get; protected set; }
  463. public virtual bool IsInfoPadAOn { get; set; }
  464. public virtual bool IsInfoPadBOn { get; set; }
  465. public virtual bool IsInfoPadCOn { get; set; }
  466. public virtual bool IsInfoPadDOn { get; set; }
  467. public virtual bool IsWaferProtrude { get; set; }
  468. public virtual string SpecCarrierType
  469. {
  470. get; set;
  471. } = "";
  472. public virtual string SpecCarrierInformation
  473. {
  474. get
  475. {
  476. if (_isPresent)
  477. return "Index:" + InfoPadCarrierIndex.ToString() + "\r\n"
  478. + "Type:" + SpecCarrierType + "\r\n"
  479. + "Size:" + GetCurrentWaferSize().ToString() +
  480. (IsVerifyPreDefineWaferCount ? ("\r\n" + "Pre-Count:" + PreDefineWaferCount.ToString()) : "");
  481. return "";
  482. }
  483. }
  484. public virtual LoadportCassetteState CassetteState
  485. {
  486. get;
  487. set;
  488. }
  489. public virtual int PreDefineWaferCount
  490. {
  491. get; set;
  492. }
  493. public virtual bool IsVerifyPreDefineWaferCount
  494. {
  495. get => false;
  496. }
  497. public WaferSize Size
  498. {
  499. get; set;
  500. } = WaferSize.WS12;
  501. public virtual WaferSize GetCurrentWaferSize()
  502. {
  503. return Size;
  504. }
  505. public bool IsMapWaferByLoadPort { get; set; }
  506. public bool IsPresent
  507. {
  508. get { return _isPresent; }
  509. }
  510. public bool IsPlacement
  511. {
  512. get { return _isPlaced; }
  513. }
  514. public bool IsMapped
  515. {
  516. get { return _isMapped; }
  517. }
  518. public virtual bool IsLoaded
  519. {
  520. get
  521. {
  522. return DockState == FoupDockState.Docked && DoorState == FoupDoorState.Open && DoorPosition == FoupDoorPostionEnum.Down;
  523. }
  524. }
  525. public bool IsComplete { get; set; }
  526. public bool IsAccessSwPressed
  527. {
  528. get { return _isAccessSwPressed; }
  529. }
  530. public virtual bool IsError { get; set; }
  531. public virtual string ErrorCode { get; set; } = "";
  532. public bool MapError { get; protected set; }
  533. public bool ReadCarrierIDError { get; set; }
  534. /// <summary>
  535. /// 是否处于FOSB模式
  536. /// </summary>
  537. ///
  538. private bool _isRequestFosbMode;
  539. public bool IsRequestFOSBMode
  540. {
  541. get => _isRequestFosbMode;
  542. set
  543. {
  544. if (value != _isRequestFosbMode)
  545. {
  546. _isRequestFosbMode = value;
  547. EV.PostInfoLog(Module, $"{Name} fosb mode was set to {_isRequestFosbMode}");
  548. }
  549. }
  550. }
  551. public bool IsFosbModeActual { get; set; }
  552. public string CarrierId
  553. {
  554. get { return _carrierId; }
  555. }
  556. public string LPLotID
  557. {
  558. get { return _lplotID; }
  559. }
  560. public RD_TRIG PresentTrig
  561. {
  562. get { return _presentTrig; }
  563. }
  564. public RD_TRIG PlacedtTrig
  565. {
  566. get { return _placetTrig; }
  567. }
  568. public RD_TRIG AccessSwPressedTrig
  569. {
  570. get { return _accessSwPressedTrig; }
  571. }
  572. public RD_TRIG ClampedTrig
  573. {
  574. get { return _clampTrig; }
  575. }
  576. public RD_TRIG DockTrig
  577. {
  578. get { return _dockTrig; }
  579. }
  580. public RD_TRIG DoorTrig
  581. {
  582. get { return _doorTrig; }
  583. }
  584. protected virtual bool _isPresent { get; set; }
  585. protected virtual bool _isPlaced { get; set; }
  586. protected bool _isDocked { get => DockState == FoupDockState.Docked; }
  587. protected bool _isAccessSwPressed;
  588. protected string _carrierId = string.Empty;
  589. protected string _carrierIdToBeWrite = string.Empty;
  590. protected string _rfid;
  591. protected string _lplotID;
  592. protected bool _isMapped;
  593. private readonly RD_TRIG _presentTrig = new RD_TRIG();
  594. private readonly RD_TRIG _placetTrig = new RD_TRIG();
  595. private readonly RD_TRIG _accessSwPressedTrig = new RD_TRIG();
  596. private readonly RD_TRIG _clampTrig = new RD_TRIG();
  597. private readonly RD_TRIG _dockTrig = new RD_TRIG();
  598. private readonly RD_TRIG _doorTrig = new RD_TRIG();
  599. public R_TRIG TrigWaferProtrude = new R_TRIG();
  600. public int PortID
  601. {
  602. get => (int)LPModuleName;
  603. }
  604. protected string EventCarrierArrived = "CARRIER_ARRIVED";
  605. protected string EventCarrierIdRead = "CARRIER_ID_READ";
  606. protected string EventCarrierIdReadFailed = "CARRIER_ID_READ_FAILED";
  607. protected string EventCarrierIdWrite = "CARRIER_ID_WRITE";
  608. protected string EventCarrierIdWriteFailed = "CARRIER_ID_WRITE_FAILED";
  609. protected string EventSlotMapAvailable = "SLOT_MAP_AVAILABLE";
  610. protected string EventCarrierRemoved = "CARRIER_REMOVED";
  611. protected string EventCarrierUnloaded = "CARRIER_UNLOADED";
  612. protected string EventCarrierloaded = "CARRIR_DOCK_COMPLETE";
  613. protected string EventLPHomed = "LP_HOMED";
  614. //protected string PORT_ID = "PORT_ID";
  615. //protected string CAR_ID = "CAR_ID";
  616. //protected string SLOT_MAP = "SLOT_MAP";
  617. //protected string PORT_CTGRY = "PORT_CTGRY";
  618. //protected string RF_ID = "RF_ID";
  619. //protected string PORT_CARRIER_TYPE = "PORT_CARRIER_TYPE";
  620. private string EventRfIdRead = "RF_ID_READ";
  621. private string EventRfIdReadFailed = "RF_ID_READ_FAILED";
  622. private string EventRfIdWrite = "RF_ID_WRITE";
  623. private string EventRfIdWriteFailed = "RF_ID_WRITE_FAILED";
  624. public string AlarmLoadPortError { get => LPModuleName.ToString() + "Error"; }
  625. public string AlarmLoadPortCommunicationError { get => LPModuleName.ToString() + "CommunicationError"; }
  626. public string AlarmLoadPortWaferProtrusion { get => LPModuleName.ToString() + "WaferProtrusion"; }
  627. public string AlarmLoadPortLoadTimeOut { get => LPModuleName.ToString() + "LoadTimeOut"; }
  628. public string AlarmLoadPortLoadFailed { get => LPModuleName.ToString() + "LoadFailed"; }
  629. public string AlarmLoadPortUnloadTimeOut { get => LPModuleName.ToString() + "UnloadTimeOut"; }
  630. public string AlarmLoadPortUnloadFailed { get => LPModuleName.ToString() + "UnloadFailed"; }
  631. public string AlarmLoadPortMappingError { get => LPModuleName.ToString() + "MappingError"; }
  632. public string AlarmLoadPortMappingTimeout { get => LPModuleName.ToString() + "MappingTimeout"; }
  633. public string AlarmCarrierIDReadError { get => LPModuleName.ToString() + "CarrierIDReadFail"; }
  634. public string AlarmCarrierIDWriteError { get => LPModuleName.ToString() + "CarrierIDWriteFail"; }
  635. public string AlarmLoadPortHomeFailed { get => LPModuleName.ToString() + "HomeFailed"; }
  636. public string AlarmLoadPortHomeTimeout { get => LPModuleName.ToString() + "HomeTimeout"; }
  637. public string AlarmLoadE84TP1Timeout { get => LPModuleName.ToString() + "E84LoadTP1TimeOut"; }
  638. public string AlarmLoadE84TP2Timeout { get => LPModuleName.ToString() + "E84LoadTP2TimeOut"; }
  639. public string AlarmLoadE84TP3Timeout { get => LPModuleName.ToString() + "E84LoadTP3TimeOut"; }
  640. public string AlarmLoadE84TP4Timeout { get => LPModuleName.ToString() + "E84LoadTP4TimeOut"; }
  641. public string AlarmLoadE84TP5Timeout { get => LPModuleName.ToString() + "E84LoadTP5TimeOut"; }
  642. public string AlarmLoadE84TP6Timeout { get => LPModuleName.ToString() + "E84LoadTP6TimeOut"; }
  643. public string AlarmUnloadE84TP1Timeout { get => LPModuleName.ToString() + "E84UnloadTP1TimeOut"; }
  644. public string AlarmUnloadE84TP2Timeout { get => LPModuleName.ToString() + "E84UnloadTP2TimeOut"; }
  645. public string AlarmUnloadE84TP3Timeout { get => LPModuleName.ToString() + "E84UnloadTP3TimeOut"; }
  646. public string AlarmUnloadE84TP4Timeout { get => LPModuleName.ToString() + "E84UnloadTP4TimeOut"; }
  647. public string AlarmUnloadE84TP5Timeout { get => LPModuleName.ToString() + "E84UnloadTP5TimeOut"; }
  648. public string AlarmUnloadE84TP6Timeout { get => LPModuleName.ToString() + "E84UnloadTP6TimeOut"; }
  649. public string AlarmLoadPortMapCrossedWafer => LPModuleName.ToString() + "MapCrossedWafer";
  650. public string AlarmLoadPortMapDoubleWafer => LPModuleName.ToString() + "MapDoubleWafer";
  651. public string AlarmLoadPortMapUnknownWafer => LPModuleName.ToString() + "MapUnknownWafer";
  652. public string AlarmLoadPortCarrierIDIndexConfigError => LPModuleName.ToString() + "LoadPortCarrierIDIndexConfigError";
  653. private IE87CallBack _lpcallback = null;
  654. public IE87CallBack LPCallBack
  655. {
  656. get { return _lpcallback; }
  657. set { _lpcallback = value; }
  658. }
  659. private IE84CallBack _lpE84Callback = null;
  660. public IE84CallBack LPE84Callback
  661. {
  662. get { return _lpE84Callback; }
  663. set
  664. {
  665. _lpE84Callback = value;
  666. _lpE84Callback.OnE84ActiveSignalChange += _lpE84Callback_OnE84ActiveSignalChange;
  667. _lpE84Callback.OnE84PassiveSignalChange += _lpE84Callback_OnE84PassiveSignalChange;
  668. _lpE84Callback.OnE84HandOffComplete += _lpE84Callback_OnE84HandOffComplete;
  669. _lpE84Callback.OnE84HandOffStart += _lpE84Callback_OnE84HandOffStart;
  670. _lpE84Callback.OnE84HandOffTimeout += _lpE84Callback_OnE84HandOffTimeout;
  671. }
  672. }
  673. private ICarrierIDReader _carrierIDReadercallback = null;
  674. public ICarrierIDReader CarrierIDReaderCallBack
  675. {
  676. get { return _carrierIDReadercallback; }
  677. set { _carrierIDReadercallback = value; }
  678. }
  679. public virtual CIDReaderBaseDevice[] CIDReaders
  680. {
  681. get;
  682. set;
  683. }
  684. private RobotBaseDevice _robot = null;
  685. public RobotBaseDevice MapRobot
  686. {
  687. get { return _robot; }
  688. set { _robot = value; }
  689. }
  690. public LoadPortBaseDevice()
  691. {
  692. }
  693. private void _lpE84Callback_OnE84PassiveSignalChange(E84SignalID arg2, bool arg3)
  694. {
  695. ;
  696. }
  697. private void _lpE84Callback_OnE84HandOffTimeout(E84Timeout _timeout, string LoadorUnload)
  698. {
  699. if (LoadorUnload == "Load")
  700. {
  701. switch (_timeout)
  702. {
  703. case E84Timeout.TP1:
  704. EV.Notify(AlarmLoadE84TP1Timeout);
  705. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Load TP1 timeout");
  706. break;
  707. case E84Timeout.TP2:
  708. EV.Notify(AlarmLoadE84TP2Timeout);
  709. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Load TP2 timeout");
  710. break;
  711. case E84Timeout.TP3:
  712. EV.Notify(AlarmLoadE84TP3Timeout);
  713. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Load TP3 timeout");
  714. break;
  715. case E84Timeout.TP4:
  716. EV.Notify(AlarmLoadE84TP4Timeout);
  717. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Load TP4 timeout");
  718. break;
  719. case E84Timeout.TP5:
  720. EV.Notify(AlarmLoadE84TP5Timeout);
  721. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Load TP5 timeout");
  722. break;
  723. default:
  724. break;
  725. }
  726. }
  727. if (LoadorUnload == "Unload")
  728. {
  729. switch (_timeout)
  730. {
  731. case E84Timeout.TP1:
  732. EV.Notify(AlarmUnloadE84TP1Timeout);
  733. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Unload TP1 timeout");
  734. break;
  735. case E84Timeout.TP2:
  736. EV.Notify(AlarmUnloadE84TP2Timeout);
  737. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Unload TP2 timeout");
  738. break;
  739. case E84Timeout.TP3:
  740. EV.Notify(AlarmUnloadE84TP3Timeout);
  741. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Unload TP3 timeout");
  742. break;
  743. case E84Timeout.TP4:
  744. EV.Notify(AlarmUnloadE84TP4Timeout);
  745. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Unload TP4 timeout");
  746. break;
  747. case E84Timeout.TP5:
  748. EV.Notify(AlarmUnloadE84TP5Timeout);
  749. EV.PostAlarmLog("LoadPort", $"{LPModuleName} with carrier:{CarrierId} occurred E84 Unload TP5 timeout");
  750. break;
  751. default:
  752. break;
  753. }
  754. }
  755. }
  756. private void _lpE84Callback_OnE84HandOffStart(string arg2)
  757. {
  758. OnE84HandOffStart(arg2 == "Load");
  759. }
  760. private void _lpE84Callback_OnE84HandOffComplete(string arg2)
  761. {
  762. OnE84HandOffComplete(arg2 == "Load");
  763. }
  764. private void _lpE84Callback_OnE84ActiveSignalChange(E84SignalID arg2, bool arg3)
  765. {
  766. ;
  767. }
  768. public virtual bool Connect()
  769. {
  770. return true;
  771. }
  772. private void RegisterOperation()
  773. {
  774. OP.Subscribe($"{Name}.SetPreDefineWaferCount", (string cmd, object[] param) =>
  775. {
  776. PreDefineWaferCount = Convert.ToInt32(param[0]);
  777. EV.PostInfoLog(Module, $"{Name} set pre define wafer count to {PreDefineWaferCount}");
  778. return true;
  779. });
  780. OP.Subscribe($"{Name}.SetInfoPadIndex", (string cmd, object[] param) =>
  781. {
  782. if (IsAutoDetectCarrierType)
  783. {
  784. EV.PostWarningLog(Module, $"{Name} can not set carrier type index when auto detection is enable.");
  785. return false;
  786. }
  787. if (SC.ContainsItem($"LoadPort.{LPModuleName}.CarrierIndex"))
  788. {
  789. SC.SetItemValue($"LoadPort.{LPModuleName}.CarrierIndex", Convert.ToInt32(param[0]));
  790. }
  791. InfoPadCarrierIndex = Convert.ToInt32(param[0]);
  792. EV.PostInfoLog(Module, $"{Name} set carrier type index to {InfoPadCarrierIndex}");
  793. return true;
  794. });
  795. OP.Subscribe($"{Name}.ReadCarrierIDByIndex", (string cmd, object[] param) =>
  796. {
  797. if (!ReadCarrierIDByIndex(param))
  798. {
  799. EV.PostWarningLog(Module, $"{Name} can not read carrier ID");
  800. return false;
  801. }
  802. EV.PostInfoLog(Module, $"{Name} start read carrierID");
  803. return true;
  804. });
  805. OP.Subscribe($"{Name}.WriteCarrierIDByIndex", (string cmd, object[] param) =>
  806. {
  807. if (!WriteCarrierIDByIndex(param))
  808. {
  809. EV.PostWarningLog(Module, $"{Name} can not write carrier ID");
  810. return false;
  811. }
  812. EV.PostInfoLog(Module, $"{Name} start write carrierID");
  813. return true;
  814. });
  815. OP.Subscribe($"{Name}.ReadCarrierID", (string cmd, object[] param) =>
  816. {
  817. if (!ReadCarrierID(param))
  818. {
  819. EV.PostWarningLog(Module, $"{Name} can not read carrier ID");
  820. return false;
  821. }
  822. EV.PostInfoLog(Module, $"{Name} start read carrierID");
  823. return true;
  824. });
  825. OP.Subscribe($"{Name}.ReadCarrierIDByLP", (string cmd, object[] param) =>
  826. {
  827. string reason;
  828. if (!ReadCarrierIDByLP(param, out reason))
  829. {
  830. EV.PostWarningLog(Module, $"{Name} can not read carrier ID:{reason}");
  831. return false;
  832. }
  833. EV.PostInfoLog(Module, $"{Name} start read carrierID");
  834. return true;
  835. });
  836. OP.Subscribe($"{Name}.LoadportHome", (string cmd, object[] param) =>
  837. {
  838. if (!Home(out string reason))
  839. {
  840. EV.PostWarningLog(Module, $"{Name} can not start home, {reason}");
  841. return false;
  842. }
  843. EV.PostInfoLog(Module, $"{Name} start home");
  844. return true;
  845. });
  846. OP.Subscribe($"{Name}.LoadportHomeModule", (string cmd, object[] param) =>
  847. {
  848. if (!HomeModule(out string reason))
  849. {
  850. EV.PostWarningLog(Module, $"{Name} can not start home, {reason}");
  851. return false;
  852. }
  853. EV.PostInfoLog(Module, $"{Name} start home");
  854. return true;
  855. });
  856. OP.Subscribe($"{Name}.LoadportReset", (string cmd, object[] param) =>
  857. {
  858. if (!LoadportReset(out string reason))
  859. {
  860. EV.PostWarningLog(Module, $"{Name} can not reset, {reason}");
  861. return false;
  862. }
  863. EV.PostInfoLog(Module, $"{Name} start reset");
  864. return true;
  865. });
  866. OP.Subscribe($"{Name}.LoadportStop", (string cmd, object[] param) =>
  867. {
  868. if (!Stop(out string reason))
  869. {
  870. EV.PostWarningLog(Module, $"{Name} can not stop, {reason}");
  871. return false;
  872. }
  873. EV.PostInfoLog(Module, $"{Name} stop");
  874. return true;
  875. });
  876. OP.Subscribe($"{Name}.LoadportLoad", (string cmd, object[] param) =>
  877. {
  878. if (!Load(out string reason))
  879. {
  880. EV.PostWarningLog(Module, $"{Name} can not load, {reason}");
  881. return false;
  882. }
  883. EV.PostInfoLog(Module, $"{Name} start load");
  884. return true;
  885. });
  886. OP.Subscribe($"{Name}.LoadportLoadWithoutMap", (string cmd, object[] param) =>
  887. {
  888. if (!LoadWithoutMap(out string reason))
  889. {
  890. EV.PostWarningLog(Module, $"{Name} can not load without map, {reason}");
  891. return false;
  892. }
  893. EV.PostInfoLog(Module, $"{Name} start load without map");
  894. return true;
  895. });
  896. OP.Subscribe($"{Name}.LoadportLoadWithMap", (string cmd, object[] param) =>
  897. {
  898. if (!Load(out string reason))
  899. {
  900. EV.PostWarningLog(Module, $"{Name} can not load with map, {reason}");
  901. return false;
  902. }
  903. EV.PostInfoLog(Module, $"{Name} start load with map");
  904. return true;
  905. });
  906. OP.Subscribe($"{Name}.LoadportUnload", (string cmd, object[] param) =>
  907. {
  908. if (!Unload(out string reason))
  909. {
  910. EV.PostWarningLog(Module, $"{Name} can not unload, {reason}");
  911. return false;
  912. }
  913. EV.PostInfoLog(Module, $"{Name} start unload");
  914. return true;
  915. });
  916. OP.Subscribe($"{Name}.LoadportUnloadWithMap", (string cmd, object[] param) =>
  917. {
  918. if (!UnloadWithMap(out string reason))
  919. {
  920. EV.PostWarningLog(Module, $"{Name} can not unload, {reason}");
  921. return false;
  922. }
  923. EV.PostInfoLog(Module, $"{Name} start unload");
  924. return true;
  925. });
  926. OP.Subscribe($"{Name}.LoadportClamp", (string cmd, object[] param) =>
  927. {
  928. if (!Clamp(out string reason))
  929. {
  930. EV.PostWarningLog(Module, $"{Name} can not clamp, {reason}");
  931. return false;
  932. }
  933. EV.PostInfoLog(Module, $"{Name} start clamp");
  934. return true;
  935. });
  936. OP.Subscribe($"{Name}.LoadportUnclamp", (string cmd, object[] param) =>
  937. {
  938. if (!Unclamp(out string reason))
  939. {
  940. EV.PostWarningLog(Module, $"{Name} can not unclamp, {reason}");
  941. return false;
  942. }
  943. EV.PostInfoLog(Module, $"{Name} start unclamp");
  944. return true;
  945. });
  946. OP.Subscribe($"{Name}.LoadportOpenDoor", (string cmd, object[] param) =>
  947. {
  948. if (!OpenDoor(out string reason))
  949. {
  950. EV.PostWarningLog(Module, $"{Name} can not open door, {reason}");
  951. return false;
  952. }
  953. EV.PostInfoLog(Module, $"{Name} start open door");
  954. return true;
  955. });
  956. OP.Subscribe($"{Name}.LoadportOpenDoorNoMap", (string cmd, object[] param) =>
  957. {
  958. if (!OpenDoorNoMap(out string reason))
  959. {
  960. EV.PostWarningLog(Module, $"{Name} can not open door, {reason}");
  961. return false;
  962. }
  963. EV.PostInfoLog(Module, $"{Name} start open door");
  964. return true;
  965. });
  966. OP.Subscribe($"{Name}.LoadportCloseDoor", (string cmd, object[] param) =>
  967. {
  968. if (!CloseDoor(out string reason))
  969. {
  970. EV.PostWarningLog(Module, $"{Name} can not close door, {reason}");
  971. return false;
  972. }
  973. EV.PostInfoLog(Module, $"{Name} start close door");
  974. return true;
  975. });
  976. OP.Subscribe($"{Name}.LoadportDock", (string cmd, object[] param) =>
  977. {
  978. if (!Dock(out string reason))
  979. {
  980. EV.PostWarningLog(Module, $"{Name} can not dock, {reason}");
  981. return false;
  982. }
  983. EV.PostInfoLog(Module, $"{Name} start dock");
  984. return true;
  985. });
  986. OP.Subscribe($"{Name}.LoadportUndock", (string cmd, object[] param) =>
  987. {
  988. if (!Undock(out string reason))
  989. {
  990. EV.PostWarningLog(Module, $"{Name} can not undock, {reason}");
  991. return false;
  992. }
  993. EV.PostInfoLog(Module, $"{Name} start undock");
  994. return true;
  995. });
  996. OP.Subscribe($"{Name}.LoadportQueryState", (string cmd, object[] param) =>
  997. {
  998. if (!QueryState(out string reason))
  999. {
  1000. EV.PostWarningLog(Module, $"{Name} can not query state, {reason}");
  1001. return false;
  1002. }
  1003. EV.PostInfoLog(Module, $"{Name} start query state");
  1004. return true;
  1005. });
  1006. OP.Subscribe($"{Name}.LoadportQueryLED", (string cmd, object[] param) =>
  1007. {
  1008. if (!QueryIndicator(out string reason))
  1009. {
  1010. EV.PostWarningLog(Module, $"{Name} can not query led state, {reason}");
  1011. return false;
  1012. }
  1013. EV.PostInfoLog(Module, $"{Name} start query led state");
  1014. return true;
  1015. });
  1016. OP.Subscribe($"{Name}.LoadportSetLED", (string cmd, object[] param) =>
  1017. {
  1018. int light = (int)param[0];
  1019. int state = (int)param[1];
  1020. if (!SetIndicator((Indicator)light, (IndicatorState)state, out string reason))
  1021. {
  1022. EV.PostWarningLog(Module, $"{Name} can not set led state, {reason}");
  1023. return true;
  1024. }
  1025. EV.PostInfoLog(Module, $"{Name} start set led state");
  1026. return true;
  1027. });
  1028. OP.Subscribe($"{Name}.LoadportMap", (string cmd, object[] param) =>
  1029. {
  1030. if (!LoadPortMap(out string reason))
  1031. {
  1032. EV.PostWarningLog(Module, $"{Name} can not start loadport map, {reason}");
  1033. return false;
  1034. }
  1035. EV.PostInfoLog(Module, $"{Name} start loadport map");
  1036. return true;
  1037. });
  1038. OP.Subscribe($"{Name}.MapWafer", (string cmd, object[] param) =>
  1039. {
  1040. if (!MapWafer(out string reason))
  1041. {
  1042. EV.PostWarningLog(Module, $"{Name} can not map, {reason}");
  1043. return false;
  1044. }
  1045. EV.PostInfoLog(Module, $"{Name} start map");
  1046. return true;
  1047. });
  1048. OP.Subscribe($"{Name}.SetCassetteType", (string cmd, object[] param) =>
  1049. {
  1050. if (!SetCassetteType(param, out string reason))
  1051. {
  1052. EV.PostWarningLog(Module, $"{Name} can not set type, {reason}");
  1053. return false;
  1054. }
  1055. EV.PostInfoLog(Module, $"{Name} cassette type have set to {CasstleType}");
  1056. return true;
  1057. });
  1058. OP.Subscribe($"{Name}.LoadportForceHome", (string cmd, object[] param) =>
  1059. {
  1060. if (!ForceHome(out string reason))
  1061. {
  1062. EV.PostWarningLog(Module, $"{Name} can not start force home, {reason}");
  1063. return false;
  1064. }
  1065. EV.PostInfoLog(Module, $"{Name} start force home");
  1066. return true;
  1067. });
  1068. OP.Subscribe($"{Name}.LoadportFOSBMode", (string cmd, object[] param) =>
  1069. {
  1070. if (!FOSBMode(out string reason))
  1071. {
  1072. EV.PostWarningLog(Module, $"{Name} can not change to FOSB mode, {reason}");
  1073. return false;
  1074. }
  1075. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  1076. return true;
  1077. });
  1078. OP.Subscribe($"{Name}.LoadportFOUPMode", (string cmd, object[] param) =>
  1079. {
  1080. if (!FOUPMode(out string reason))
  1081. {
  1082. EV.PostWarningLog(Module, $"{Name} can not change to FOSB mode, {reason}");
  1083. return false;
  1084. }
  1085. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  1086. return true;
  1087. });
  1088. OP.Subscribe($"{Name}.LoadportQueryFOSBMode", (string cmd, object[] param) =>
  1089. {
  1090. if (!QueryFOSBMode(out string reason))
  1091. {
  1092. EV.PostWarningLog(Module, $"{Name} can not change to FOUP mode, {reason}");
  1093. return false;
  1094. }
  1095. EV.PostInfoLog(Module, $"{Name} changed to FOSB mode");
  1096. return true;
  1097. });
  1098. OP.Subscribe($"{Name}.SetLoadportLotID", (string cmd, object[] param) =>
  1099. {
  1100. if (!SetLotID(param, out string reason))
  1101. {
  1102. return false;
  1103. }
  1104. EV.PostInfoLog(Module, $"{Name} set lotID for loadport.");
  1105. return true;
  1106. });
  1107. OP.Subscribe($"{Name}.LoadportExecuteCommand", (string cmd, object[] param) =>
  1108. {
  1109. if (!LoadPortExecute(param, out string reason))
  1110. {
  1111. return false;
  1112. }
  1113. EV.PostInfoLog(Module, $"{Name} execute command {cmd[0].ToString()}.");
  1114. return true;
  1115. });
  1116. OP.Subscribe($"{Name}.E84Retry", (string cmd, object[] param) =>
  1117. {
  1118. if (!LoadPortE84Retry(param, out string reason))
  1119. {
  1120. return false;
  1121. }
  1122. EV.PostInfoLog(Module, $"{Name} execute command {cmd[0].ToString()}.");
  1123. return true;
  1124. });
  1125. OP.Subscribe($"{Name}.E84Complete", (string cmd, object[] param) =>
  1126. {
  1127. if (!LoadPortE84Complete(param, out string reason))
  1128. {
  1129. return false;
  1130. }
  1131. EV.PostInfoLog(Module, $"{Name} execute command {cmd[0].ToString()}.");
  1132. return true;
  1133. });
  1134. OP.Subscribe($"{Name}.ManualSetCarrierID", (string cmd, object[] param) =>
  1135. {
  1136. OnCarrierIdRead(param[0].ToString());
  1137. EV.PostInfoLog(Module, $"{Name} execute command {cmd[0].ToString()}.");
  1138. return true;
  1139. });
  1140. }
  1141. private bool LoadPortE84Complete(object[] param, out string reason)
  1142. {
  1143. if (_lpE84Callback != null)
  1144. {
  1145. _lpE84Callback.Complete();
  1146. }
  1147. reason = "";
  1148. return true;
  1149. }
  1150. private bool LoadPortE84Retry(object[] param, out string reason)
  1151. {
  1152. if (_lpE84Callback != null)
  1153. {
  1154. _lpE84Callback.ResetE84();
  1155. }
  1156. reason = "";
  1157. return true;
  1158. }
  1159. private bool LoadPortMap(out string reason)
  1160. {
  1161. reason = "";
  1162. if (!IsMapWaferByLoadPort)
  1163. {
  1164. reason = "LoadPort Map not support, pls use robot map";
  1165. EV.PostAlarmLog("LoadPort", $"{LPModuleName} Map not support, pls use robot map");
  1166. return false;
  1167. }
  1168. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "MapWafer" });
  1169. if (!ret)
  1170. {
  1171. reason = $"Can't execute on {CurrentState}";
  1172. return false;
  1173. }
  1174. return true;
  1175. }
  1176. public bool LoadPortExecute(object[] para, out string reason)
  1177. {
  1178. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, para);
  1179. if (!ret)
  1180. {
  1181. reason = $"Can't execute on {CurrentState}";
  1182. return false;
  1183. }
  1184. reason = "";
  1185. return true;
  1186. }
  1187. public bool LoadportReset(out string reason)
  1188. {
  1189. reason = "";
  1190. return CheckToPostMessage((int)LoadPortMsg.Reset, null);
  1191. }
  1192. private bool SetLotID(object[] param, out string reason)
  1193. {
  1194. reason = "";
  1195. if (param == null || param.Length == 0) return false;
  1196. _lplotID = param[0].ToString();
  1197. return true;
  1198. }
  1199. private bool SetCassetteType(object[] param, out string reason)
  1200. {
  1201. reason = "";
  1202. if (param.Length != 1)
  1203. {
  1204. reason = "Invalid setting parameter.";
  1205. return false;
  1206. }
  1207. CasstleType = (CasstleType)int.Parse(param[0].ToString());
  1208. return true;
  1209. }
  1210. public virtual int ValidSlotsNumber
  1211. {
  1212. get => 25;
  1213. }
  1214. public virtual bool Load(out string reason)
  1215. {
  1216. if (!IsEnableLoad(out reason))
  1217. {
  1218. return false;
  1219. }
  1220. reason = "";
  1221. bool ret;
  1222. if (IsMapWaferByLoadPort)
  1223. ret = CheckToPostMessage((int)LoadPortMsg.Load, new object[] { "LoadWithMap" });
  1224. else
  1225. ret = CheckToPostMessage((int)LoadPortMsg.Load, new object[] { "LoadWithoutMap" });
  1226. if (!ret)
  1227. {
  1228. reason = $"Can't execute on {CurrentState}";
  1229. return false;
  1230. }
  1231. return true;
  1232. }
  1233. public virtual bool LoadWithCloseDoor(out string reason)
  1234. {
  1235. if (!IsEnableLoad(out reason))
  1236. return false;
  1237. reason = "";
  1238. bool ret;
  1239. if (IsMapWaferByLoadPort)
  1240. ret = CheckToPostMessage((int)LoadPortMsg.Load, new object[] { "LoadWithCloseDoor" });
  1241. else
  1242. ret = CheckToPostMessage((int)LoadPortMsg.Load, new object[] { "LoadWithoutMapWithCloseDoor" });
  1243. if (!ret)
  1244. {
  1245. reason = $"Can't execute on {CurrentState}";
  1246. return false;
  1247. }
  1248. return true;
  1249. }
  1250. public virtual bool LoadWithMap(out string reason)
  1251. {
  1252. if (!IsEnableLoad(out reason))
  1253. return false;
  1254. reason = "";
  1255. bool ret = CheckToPostMessage((int)LoadPortMsg.Load, new object[] { "LoadWithMap" });
  1256. if (!ret)
  1257. {
  1258. reason = $"Can't execute on {CurrentState}";
  1259. return false;
  1260. }
  1261. return true;
  1262. }
  1263. public virtual bool LoadWithoutMap(out string reason)
  1264. {
  1265. if (!IsEnableLoad(out reason))
  1266. return false;
  1267. reason = "";
  1268. bool ret = CheckToPostMessage((int)LoadPortMsg.Load, new object[] { "LoadWithoutMap" });
  1269. if (!ret)
  1270. {
  1271. reason = $"Can't execute on {CurrentState}";
  1272. return false;
  1273. }
  1274. return true;
  1275. }
  1276. public virtual bool MapWafer(out string reason)
  1277. {
  1278. reason = "";
  1279. if (!IsMapWaferByLoadPort)
  1280. {
  1281. if (_robot == null)
  1282. {
  1283. reason = "No mapping tools";
  1284. return false;
  1285. }
  1286. if (!_robot.IsReady())
  1287. {
  1288. reason = "Robot not ready";
  1289. return false;
  1290. }
  1291. if (!IsEnableMapWafer(out reason))
  1292. {
  1293. EV.PostAlarmLog("System", $"{LPModuleName} with carrier:{CarrierId} is not ready:{reason}.");
  1294. return false;
  1295. }
  1296. return _robot.WaferMapping(LPModuleName, out reason);
  1297. }
  1298. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "MapWafer" });
  1299. if (!ret)
  1300. {
  1301. reason = $"Can't execute on {CurrentState}";
  1302. return false;
  1303. }
  1304. return true;
  1305. }
  1306. public virtual bool QueryWaferMap(out string reason)
  1307. {
  1308. reason = "";
  1309. bool ret = CheckToPostMessage((int)LoadPortMsg.StartReadData, new object[] { "MapData" });
  1310. if (!ret)
  1311. {
  1312. reason = $"Can't execute on {CurrentState}";
  1313. return false;
  1314. }
  1315. return true;
  1316. }
  1317. public virtual bool QueryFOSBMode(out string reason)
  1318. {
  1319. reason = "";
  1320. bool ret = CheckToPostMessage((int)LoadPortMsg.StartReadData, new object[] { "FOSBMode" });
  1321. if (!ret)
  1322. {
  1323. reason = $"Can't execute on {CurrentState}";
  1324. return false;
  1325. }
  1326. return true;
  1327. }
  1328. /// <summary>
  1329. /// FOSB模式下的Dock指令
  1330. /// </summary>
  1331. /// <param name="reason"></param>
  1332. /// <returns></returns>
  1333. public virtual bool FOSBDock(out string reason)
  1334. {
  1335. reason = "";
  1336. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "Dock" });
  1337. if (!ret)
  1338. {
  1339. reason = $"Can't execute on {CurrentState}";
  1340. return false;
  1341. }
  1342. return true;
  1343. }
  1344. /// <summary>
  1345. /// FOSB模式下的FOSBUnDock指令
  1346. /// </summary>
  1347. /// <param name="reason"></param>
  1348. /// <returns></returns>
  1349. public virtual bool FOSBUnDock(out string reason)
  1350. {
  1351. reason = "";
  1352. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "UnDock" });
  1353. if (!ret)
  1354. {
  1355. reason = $"Can't execute on {CurrentState}";
  1356. return false;
  1357. }
  1358. return true;
  1359. }
  1360. /// <summary>
  1361. /// FOSB模式下的开门指令
  1362. /// </summary>
  1363. /// <param name="reason"></param>
  1364. /// <returns></returns>
  1365. public virtual bool FOSBDoorOpen(out string reason)
  1366. {
  1367. reason = "";
  1368. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "FOSBDoorOpen" });
  1369. if (!ret)
  1370. {
  1371. reason = $"Can't execute on {CurrentState}";
  1372. return false;
  1373. }
  1374. return true;
  1375. }
  1376. /// <summary>
  1377. /// FOSB模式下的关门指令
  1378. /// </summary>
  1379. /// <param name="reason"></param>
  1380. /// <returns></returns>
  1381. public virtual bool FOSBDoorClose(out string reason)
  1382. {
  1383. reason = "";
  1384. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "FOSBDoorClose" });
  1385. if (!ret)
  1386. {
  1387. reason = $"Can't execute on {CurrentState}";
  1388. return false;
  1389. }
  1390. return true;
  1391. }
  1392. /// <summary>
  1393. /// FOSB模式下的门下移指令
  1394. /// </summary>
  1395. /// <param name="reason"></param>
  1396. /// <returns></returns>
  1397. public virtual bool DoorDown(out string reason)
  1398. {
  1399. reason = "";
  1400. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "DoorDown" });
  1401. if (!ret)
  1402. {
  1403. reason = $"Can't execute on {CurrentState}";
  1404. return false;
  1405. }
  1406. return true;
  1407. }
  1408. /// <summary>
  1409. /// FOSB模式下的门上移指令
  1410. /// </summary>
  1411. /// <param name="reason"></param>
  1412. /// <returns></returns>
  1413. public virtual bool DoorUp(out string reason)
  1414. {
  1415. reason = "";
  1416. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "DoorUp" });
  1417. if (!ret)
  1418. {
  1419. reason = $"Can't execute on {CurrentState}";
  1420. return false;
  1421. }
  1422. return true;
  1423. }
  1424. public virtual bool SetIndicator(IndicatorType light, IndicatorState state)
  1425. {
  1426. if (LoadPortIndicatorLightMap.ContainsKey(light))
  1427. {
  1428. SetIndicator(LoadPortIndicatorLightMap[light], state, out string _);
  1429. return true;
  1430. }
  1431. EV.PostWarningLog(Module, $"Not supported indicator {light}");
  1432. return false;
  1433. }
  1434. public IndicatorState GetIndicator(IndicatorType light)
  1435. {
  1436. if (LoadPortIndicatorLightMap.ContainsKey(light))
  1437. {
  1438. return IndicatorStateFeedback[(int)LoadPortIndicatorLightMap[light]];
  1439. }
  1440. EV.PostWarningLog(Module, $"Not supported indicator {light}");
  1441. return IndicatorState.OFF;
  1442. }
  1443. public virtual bool SetE84Available(out string reason)
  1444. {
  1445. if (_lpE84Callback != null)
  1446. {
  1447. _lpE84Callback.SetHoAutoControl(false);
  1448. _lpE84Callback.SetHoAvailable(true);
  1449. }
  1450. reason = "";
  1451. return true;
  1452. }
  1453. public virtual bool SetE84Unavailable(out string reason)
  1454. {
  1455. if (_lpE84Callback != null)
  1456. {
  1457. _lpE84Callback.SetHoAutoControl(false);
  1458. _lpE84Callback.SetHoAvailable(false);
  1459. }
  1460. reason = "";
  1461. return true;
  1462. }
  1463. public virtual bool SetIndicator(Indicator light, IndicatorState state, out string reason)
  1464. {
  1465. reason = "";
  1466. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "SetIndicator", light, state });
  1467. if (!ret)
  1468. {
  1469. reason = $"Can't execute on {CurrentState}";
  1470. }
  1471. return ret;
  1472. }
  1473. public virtual bool QueryIndicator(out string reason)
  1474. {
  1475. reason = "";
  1476. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "QueryIndicator" });
  1477. if (!ret)
  1478. {
  1479. reason = $"Can't execute on {CurrentState}";
  1480. }
  1481. return ret;
  1482. }
  1483. public virtual bool QueryState(out string reason)
  1484. {
  1485. reason = "";
  1486. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "QueryState" });
  1487. if (!ret)
  1488. {
  1489. reason = $"Can't execute on {CurrentState}";
  1490. }
  1491. return ret;
  1492. }
  1493. public virtual bool Undock(out string reason)
  1494. {
  1495. reason = "";
  1496. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "Undock" });
  1497. if (!ret)
  1498. {
  1499. reason = $"Can't execute on {CurrentState}";
  1500. }
  1501. return ret;
  1502. }
  1503. public virtual bool Dock(out string reason)
  1504. {
  1505. reason = "";
  1506. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "Dock" });
  1507. if (!ret)
  1508. {
  1509. reason = $"Can't execute on {CurrentState}";
  1510. }
  1511. return ret;
  1512. }
  1513. public virtual bool CloseDoor(out string reason)
  1514. {
  1515. reason = "";
  1516. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "CloseDoor" });
  1517. if (!ret)
  1518. {
  1519. reason = $"Can't execute on {CurrentState}";
  1520. }
  1521. return ret;
  1522. }
  1523. public virtual bool OpenDoor(out string reason)
  1524. {
  1525. reason = "";
  1526. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "OpenDoor" });
  1527. if (!ret)
  1528. {
  1529. reason = $"Can't execute on {CurrentState}";
  1530. }
  1531. return ret;
  1532. }
  1533. public virtual bool OpenDoorAndDown(out string reason)
  1534. {
  1535. reason = "";
  1536. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "OpenDoorAndDown" });
  1537. if (!ret)
  1538. {
  1539. reason = $"Can't execute on {CurrentState}";
  1540. }
  1541. return ret;
  1542. }
  1543. public virtual bool DoorUpAndClose(out string reason)
  1544. {
  1545. reason = "";
  1546. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "DoorUpAndClose" });
  1547. if (!ret)
  1548. {
  1549. reason = $"Can't execute on {CurrentState}";
  1550. }
  1551. return ret;
  1552. }
  1553. public virtual bool OpenDoorNoMap(out string reason)
  1554. {
  1555. reason = "";
  1556. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "OpenDoorNoMap" });
  1557. if (!ret)
  1558. {
  1559. reason = $"Can't execute on {CurrentState}";
  1560. }
  1561. return ret;
  1562. }
  1563. public virtual bool OpenDoorAndMap(out string reason)
  1564. {
  1565. reason = "";
  1566. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "OpenDoorAndMap" });
  1567. if (!ret)
  1568. {
  1569. reason = $"Can't execute on {CurrentState}";
  1570. }
  1571. return ret;
  1572. }
  1573. public virtual bool Unclamp(out string reason)
  1574. {
  1575. reason = "";
  1576. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "Unclamp" });
  1577. if (!ret)
  1578. {
  1579. reason = $"Can't execute on {CurrentState}";
  1580. }
  1581. return ret;
  1582. }
  1583. public virtual bool Clamp(out string reason)
  1584. {
  1585. reason = "";
  1586. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "Clamp" });
  1587. if (!ret)
  1588. {
  1589. reason = $"Can't execute on {CurrentState}";
  1590. }
  1591. return ret;
  1592. }
  1593. public virtual bool Unload(out string reason)
  1594. {
  1595. reason = "";
  1596. if (!IsEnableUnload(out reason))
  1597. return false;
  1598. bool ret = CheckToPostMessage((int)LoadPortMsg.Unload, "UnloadWithoutMap");
  1599. if (!ret)
  1600. {
  1601. reason = $"Can't execute on {CurrentState}";
  1602. }
  1603. return ret;
  1604. }
  1605. public virtual bool UnloadWithMap(out string reason)
  1606. {
  1607. reason = "";
  1608. if (!IsEnableUnload(out reason))
  1609. return false;
  1610. bool ret = CheckToPostMessage((int)LoadPortMsg.Unload, "UnloadWithMap");
  1611. if (!ret)
  1612. {
  1613. reason = $"Can't execute on {CurrentState}";
  1614. }
  1615. return ret;
  1616. }
  1617. public virtual bool Stop(out string reason)
  1618. {
  1619. reason = "";
  1620. bool ret = CheckToPostMessage((int)LoadPortMsg.Abort, null);
  1621. if (!ret)
  1622. {
  1623. reason = $"Can't execute on {CurrentState}";
  1624. }
  1625. return ret;
  1626. }
  1627. public virtual bool ClearError(out string reason)
  1628. {
  1629. reason = "";
  1630. return true;
  1631. }
  1632. public virtual bool Init(out string reason)
  1633. {
  1634. reason = "";
  1635. bool ret = CheckToPostMessage((int)LoadPortMsg.Init, new object[] { "Init" });
  1636. if (!ret)
  1637. {
  1638. reason = $"Can't execute on {CurrentState}";
  1639. }
  1640. return ret;
  1641. }
  1642. public virtual bool Home(out string reason)
  1643. {
  1644. reason = "";
  1645. bool ret = CheckToPostMessage((int)LoadPortMsg.Init, new object[] { "Home" });
  1646. if (!ret)
  1647. {
  1648. reason = $"Can't execute on {CurrentState}";
  1649. }
  1650. return ret;
  1651. }
  1652. public virtual bool HomeModule(out string reason)
  1653. {
  1654. reason = "";
  1655. bool ret = CheckToPostMessage((int)LoadPortMsg.StartHome, new object[] { "Home" });
  1656. if (!ret)
  1657. {
  1658. reason = $"Can't execute on {CurrentState}";
  1659. }
  1660. return ret;
  1661. }
  1662. public virtual bool ForceHome(out string reason)
  1663. {
  1664. reason = "";
  1665. bool ret = CheckToPostMessage((int)LoadPortMsg.Init, new object[] { "ForceHome" });
  1666. if (!ret)
  1667. {
  1668. reason = $"Can't execute on {CurrentState}";
  1669. }
  1670. return ret;
  1671. }
  1672. public virtual bool FOSBMode(out string reason)
  1673. {
  1674. reason = "";
  1675. return true;
  1676. }
  1677. public virtual bool FOUPMode(out string reason)
  1678. {
  1679. reason = "";
  1680. return true;
  1681. }
  1682. public virtual bool ReadCarrierIDByLP(object[] para, out string reason)
  1683. {
  1684. reason = "";
  1685. if (para != null && para.Length == 2)
  1686. return ReadCarrierIDByLP(Convert.ToInt32(para[0]), Convert.ToInt32(para[1]), out reason);
  1687. return
  1688. ReadCarrierIDByLP(0, 8, out reason);
  1689. }
  1690. public virtual bool ReadCarrierIDByLP(int offset, int length, out string reason)
  1691. {
  1692. reason = "";
  1693. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "ReadCarrierID", offset, length });
  1694. if (!ret)
  1695. {
  1696. reason = $"Can't execute on {CurrentState}";
  1697. }
  1698. return ret;
  1699. }
  1700. public virtual bool WriteCarrierID(string cid, int offset, int length, out string reason)
  1701. {
  1702. reason = "";
  1703. bool ret = CheckToPostMessage((int)LoadPortMsg.StartExecute, new object[] { "WriteCarrierID", cid, offset, length });
  1704. if (!ret)
  1705. {
  1706. reason = $"Can't execute on {CurrentState}";
  1707. }
  1708. return ret;
  1709. }
  1710. public virtual bool ChangeAccessMode(bool auto, out string reason)
  1711. {
  1712. reason = "";
  1713. return true;
  1714. }
  1715. public virtual bool SetServiceCommand(bool inService, out string reason)
  1716. {
  1717. reason = "";
  1718. return true;
  1719. }
  1720. public virtual bool GetE84HandoffActiveSignalState(E84PioPosition piopostion, E84PioSignalAtoP AtoPsignal)
  1721. {
  1722. if (_lpE84Callback == null) return false;
  1723. switch (AtoPsignal)
  1724. {
  1725. case E84PioSignalAtoP.AM_AVBL:
  1726. return _lpE84Callback.GetE84SignalState(E84SignalID.AM_AVBL);
  1727. case E84PioSignalAtoP.BUSY:
  1728. return _lpE84Callback.GetE84SignalState(E84SignalID.BUSY);
  1729. case E84PioSignalAtoP.COMPT:
  1730. return _lpE84Callback.GetE84SignalState(E84SignalID.COMPT);
  1731. case E84PioSignalAtoP.CONT:
  1732. return _lpE84Callback.GetE84SignalState(E84SignalID.CONT);
  1733. case E84PioSignalAtoP.CS_0:
  1734. return _lpE84Callback.GetE84SignalState(E84SignalID.CS_0);
  1735. case E84PioSignalAtoP.CS_1:
  1736. return _lpE84Callback.GetE84SignalState(E84SignalID.CS_1);
  1737. case E84PioSignalAtoP.TR_REQ:
  1738. return _lpE84Callback.GetE84SignalState(E84SignalID.TR_REQ);
  1739. case E84PioSignalAtoP.VALID:
  1740. return _lpE84Callback.GetE84SignalState(E84SignalID.VALID);
  1741. default:
  1742. return false;
  1743. }
  1744. }
  1745. public virtual bool GetE84HandoffPassiveSignalState(E84PioPosition piopostion, E84PioSignalPtoA PtoAsignal)
  1746. {
  1747. if (_lpE84Callback == null) return false;
  1748. switch (PtoAsignal)
  1749. {
  1750. case E84PioSignalPtoA.ES:
  1751. return _lpE84Callback.GetE84SignalState(E84SignalID.ES);
  1752. case E84PioSignalPtoA.HO_AVBL:
  1753. return _lpE84Callback.GetE84SignalState(E84SignalID.HO_AVBL);
  1754. case E84PioSignalPtoA.L_REQ:
  1755. return _lpE84Callback.GetE84SignalState(E84SignalID.L_REQ);
  1756. case E84PioSignalPtoA.READY:
  1757. return _lpE84Callback.GetE84SignalState(E84SignalID.READY);
  1758. case E84PioSignalPtoA.U_REQ:
  1759. return _lpE84Callback.GetE84SignalState(E84SignalID.U_REQ);
  1760. default:
  1761. return false;
  1762. }
  1763. }
  1764. public virtual void SetE84HandoffSignalState(E84PioPosition piopostion, E84PioSignalPtoA PtoAsignal, bool state)
  1765. {
  1766. if (_lpE84Callback == null) return;
  1767. switch (PtoAsignal)
  1768. {
  1769. case E84PioSignalPtoA.ES:
  1770. _lpE84Callback.SetE84SignalState(E84PassiveSignal.ES, state);
  1771. break;
  1772. case E84PioSignalPtoA.HO_AVBL:
  1773. _lpE84Callback.SetE84SignalState(E84PassiveSignal.HOAvbl, state);
  1774. break;
  1775. case E84PioSignalPtoA.L_REQ:
  1776. _lpE84Callback.SetE84SignalState(E84PassiveSignal.LoadReq, state);
  1777. break;
  1778. case E84PioSignalPtoA.READY:
  1779. _lpE84Callback.SetE84SignalState(E84PassiveSignal.Ready, state);
  1780. break;
  1781. case E84PioSignalPtoA.U_REQ:
  1782. _lpE84Callback.SetE84SignalState(E84PassiveSignal.UnloadReq, state);
  1783. break;
  1784. default:
  1785. break;
  1786. }
  1787. }
  1788. public virtual void Monitor()
  1789. {
  1790. _presentTrig.CLK = _isPresent;
  1791. _placetTrig.CLK = _isPlaced;
  1792. _dockTrig.CLK = _isDocked;
  1793. _clampTrig.CLK = ClampState == FoupClampState.Close;
  1794. _doorTrig.CLK = DoorState == FoupDoorState.Close;
  1795. _accessSwPressedTrig.CLK = _isAccessSwPressed;
  1796. if (_lpE84Callback != null)
  1797. {
  1798. _lpE84Callback.SetFoupStatus(_isPlaced);
  1799. if (CurrentState == LoadPortStateEnum.Idle && ClampState == FoupClampState.Open &&
  1800. DockState == FoupDockState.Undocked)
  1801. _lpE84Callback.SetReadyTransferStatus(true);
  1802. else
  1803. _lpE84Callback.SetReadyTransferStatus(false);
  1804. }
  1805. }
  1806. public virtual void Reset()
  1807. {
  1808. MapError = false;
  1809. ReadCarrierIDError = false;
  1810. if (_carrierIDReadercallback != null)
  1811. _carrierIDReadercallback.Reset();
  1812. }
  1813. public virtual bool IsEnableDualTransfer(out string reason)
  1814. {
  1815. reason = "";
  1816. return false;
  1817. }
  1818. public virtual bool IsEnableMapWafer(out string reason)
  1819. {
  1820. reason = "";
  1821. if (!_isPlaced)
  1822. {
  1823. reason = "No carrier placed";
  1824. return false;
  1825. }
  1826. if (!_isDocked)
  1827. {
  1828. reason = "carrier is not docked";
  1829. return false;
  1830. }
  1831. if (!IsReady())
  1832. {
  1833. reason = "Not Ready";
  1834. return false;
  1835. }
  1836. if (DoorState != FoupDoorState.Open)
  1837. {
  1838. reason = "Door is not opened";
  1839. return false;
  1840. }
  1841. if (DoorPosition != FoupDoorPostionEnum.Down)
  1842. {
  1843. reason = "Door is not down";
  1844. return false;
  1845. }
  1846. return true;
  1847. }
  1848. public virtual bool IsEnableTransferWafer(out string reason)
  1849. {
  1850. reason = "";
  1851. if(CurrentState == LoadPortStateEnum.Error)
  1852. {
  1853. reason = "LoadPort In Error";
  1854. return false;
  1855. }
  1856. if (!_isPlaced)
  1857. {
  1858. reason = "No carrier placed";
  1859. return false;
  1860. }
  1861. if (!_isMapped)
  1862. {
  1863. reason = "Not Mapped";
  1864. return false;
  1865. }
  1866. if (!IsReady())
  1867. {
  1868. reason = "Not Ready";
  1869. return false;
  1870. }
  1871. WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
  1872. foreach (WaferInfo wafer in wafers)
  1873. {
  1874. if (wafer.IsEmpty) continue;
  1875. if (wafer.Status == WaferStatus.Crossed || wafer.Status == WaferStatus.Double)
  1876. {
  1877. //EV.PostWarningLog(Name, $"At least one wafer is {wafer.Status.ToString()}.");
  1878. reason = $"At least one wafer is {wafer.Status.ToString()}.";
  1879. return false;
  1880. }
  1881. }
  1882. return true;
  1883. }
  1884. public virtual bool IsEnableLoad(out string reason)
  1885. {
  1886. if (!_isPlaced)
  1887. {
  1888. reason = "No carrier placed";
  1889. return false;
  1890. }
  1891. if (_isDocked)
  1892. {
  1893. reason = "Carrier is docked";
  1894. return false;
  1895. }
  1896. if (!IsReady())
  1897. {
  1898. reason = "Not Ready";
  1899. return false;
  1900. }
  1901. reason = "";
  1902. return true;
  1903. }
  1904. public virtual bool IsEnableUnload(out string reason)
  1905. {
  1906. if (!_isPlaced)
  1907. {
  1908. reason = "No carrier placed";
  1909. return false;
  1910. }
  1911. if (!_isDocked)
  1912. {
  1913. reason = "Carrier is undocked";
  1914. return false;
  1915. }
  1916. if (!IsReady())
  1917. {
  1918. reason = "Not Ready";
  1919. return false;
  1920. }
  1921. reason = "";
  1922. return true;
  1923. }
  1924. public virtual bool IsForbidAccessSlotAboveWafer()
  1925. {
  1926. return false;
  1927. }
  1928. public CarrierOnLPState _CarrierOnState { get; private set; } = CarrierOnLPState.Unknow;
  1929. public bool HasAlarm => throw new NotImplementedException();
  1930. protected void ConfirmAddCarrier()
  1931. {
  1932. if (_isPresent && _isPlaced)
  1933. {
  1934. if (_CarrierOnState != CarrierOnLPState.On)
  1935. {
  1936. CarrierManager.Instance.CreateCarrier(Name);
  1937. _CarrierOnState = CarrierOnLPState.On;
  1938. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  1939. dvid["PortID"] = PortID;
  1940. dvid["PORT_CTGRY"] = SpecPortName;
  1941. dvid["CarrierType"] = SpecCarrierType;
  1942. EV.Notify(EventCarrierArrived, dvid);
  1943. if (_lpcallback != null)
  1944. _lpcallback.CarrierArrive();
  1945. _isMapped = false;
  1946. EV.PostInfoLog("LoadPort", $"{LPModuleName} carrier arrived.");
  1947. }
  1948. IsComplete = false;
  1949. }
  1950. }
  1951. protected void ConfirmRemoveCarrier()
  1952. {
  1953. if (!_isPlaced)
  1954. {
  1955. if (_CarrierOnState != CarrierOnLPState.Off)
  1956. {
  1957. for (int i = 0; i < 25; i++)
  1958. {
  1959. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, 25);
  1960. }
  1961. CarrierManager.Instance.DeleteCarrier(Name);
  1962. _CarrierOnState = CarrierOnLPState.Off;
  1963. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  1964. dvid["PortID"] = PortID;
  1965. dvid["PORT_CTGRY"] = SpecPortName;
  1966. dvid["CarrierType"] = SpecCarrierType;
  1967. dvid["CarrierID"] = _carrierId ?? "";
  1968. EV.Notify(EventCarrierRemoved, dvid);
  1969. if (_lpcallback != null) _lpcallback.CarrerRemove(_carrierId);
  1970. EV.PostInfoLog("LoadPort", $"{LPModuleName} carrier:{_carrierId} was removed.");
  1971. }
  1972. IsComplete = false;
  1973. for (int i = 0; i < 25; i++)
  1974. {
  1975. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, 25);
  1976. }
  1977. _isMapped = false;
  1978. _carrierId = "";
  1979. }
  1980. }
  1981. public virtual void OnSlotMapRead(string _slotMap)
  1982. {
  1983. if (!IsMapWaferByLoadPort)
  1984. OnActionDone(new object[] { });
  1985. if (_slotMap.Length != ValidSlotsNumber)
  1986. {
  1987. EV.PostAlarmLog("LoadPort", "Mapping Data Error.");
  1988. }
  1989. for (int i = 0; i < _slotMap.Length; i++)
  1990. {
  1991. // No wafer: "0", Wafer: "1", Crossed:"2", Undefined: "?", Overlapping wafers: "W"
  1992. WaferInfo wafer = null;
  1993. switch (_slotMap[i])
  1994. {
  1995. case '0':
  1996. WaferManager.Instance.DeleteWafer(LPModuleName, i);
  1997. CarrierManager.Instance.UnregisterCarrierWafer(Name, i);
  1998. break;
  1999. case '1':
  2000. wafer = WaferManager.Instance.CreateWafer(LPModuleName, i, WaferStatus.Normal);
  2001. WaferManager.Instance.UpdateWaferSize(LPModuleName, i, GetCurrentWaferSize());
  2002. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  2003. break;
  2004. case '2':
  2005. wafer = WaferManager.Instance.CreateWafer(LPModuleName, i, WaferStatus.Crossed);
  2006. WaferManager.Instance.UpdateWaferSize(LPModuleName, i, GetCurrentWaferSize());
  2007. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  2008. EV.Notify(AlarmLoadPortMapCrossedWafer);
  2009. EV.PostInfoLog("LoadPort", $"{LPModuleName} map crossed wafer on carrier:{_carrierId},slot:{i+1}.");
  2010. break;
  2011. case 'W':
  2012. wafer = WaferManager.Instance.CreateWafer(LPModuleName, i, WaferStatus.Double);
  2013. WaferManager.Instance.UpdateWaferSize(LPModuleName, i, GetCurrentWaferSize());
  2014. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  2015. EV.Notify(AlarmLoadPortMapDoubleWafer);
  2016. EV.PostInfoLog("LoadPort", $"{LPModuleName} map double wafer on carrier:{_carrierId},slot:{i + 1}.");
  2017. break;
  2018. case '?':
  2019. wafer = WaferManager.Instance.CreateWafer(LPModuleName, i, WaferStatus.Unknown);
  2020. WaferManager.Instance.UpdateWaferSize(LPModuleName, i, GetCurrentWaferSize());
  2021. CarrierManager.Instance.RegisterCarrierWafer(Name, i, wafer);
  2022. EV.PostInfoLog("LoadPort", $"{LPModuleName} map unknown wafer on carrier:{_carrierId},slot:{i + 1}.");
  2023. break;
  2024. }
  2025. }
  2026. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  2027. dvid["SlotMap"] = _slotMap;
  2028. dvid["PortID"] = PortID;
  2029. dvid["PORT_CTGRY"] = SpecPortName;
  2030. dvid["CarrierType"] = SpecCarrierType;
  2031. dvid["CarrierID"] = CarrierId;
  2032. EV.Notify(EventSlotMapAvailable, dvid);
  2033. if (_slotMap.Contains("2"))
  2034. {
  2035. MapError = true;
  2036. EV.Notify(AlarmLoadPortMappingError);
  2037. }
  2038. if (_slotMap.Contains("W"))
  2039. {
  2040. MapError = true;
  2041. EV.Notify(AlarmLoadPortMappingError);
  2042. }
  2043. if (_slotMap.Contains("?"))
  2044. {
  2045. MapError = true;
  2046. EV.Notify(AlarmLoadPortMappingError);
  2047. }
  2048. if (LPCallBack != null)
  2049. LPCallBack.MappingComplete(_carrierId, _slotMap);
  2050. _isMapped = true;
  2051. }
  2052. /// <summary>
  2053. /// 获取LP中空缺Slot
  2054. /// </summary>
  2055. /// <returns>返回一个list, 顺序为从下到上.(0-25)</returns>
  2056. public virtual bool ReadCarrierIDByIndex(int offset = 0, int length = 16, int index = 0)
  2057. {
  2058. if (CIDReaders == null || CIDReaders.Length <= index) return false;
  2059. return CIDReaders[index].ReadCarrierID(offset, length);
  2060. }
  2061. public virtual bool WriteCarrierIDByIndex(string cid, int offset = 0, int length = 16, int index = 0)
  2062. {
  2063. if (CIDReaders == null || CIDReaders.Length <= index) return false;
  2064. _carrierIdToBeWrite = cid;
  2065. return CIDReaders[index].WriteCarrierID(offset, length, cid);
  2066. }
  2067. public bool ReadCarrierIDByIndex(object[] para)
  2068. {
  2069. int offset = SC.ContainsItem($"LoadPort.{LPModuleName}.StartPage") ?
  2070. SC.GetValue<int>($"LoadPort.{LPModuleName}.StartPage") : 0;
  2071. int length = SC.ContainsItem($"LoadPort.{LPModuleName}.DataReadSize") ?
  2072. SC.GetValue<int>($"LoadPort.{LPModuleName}.DataReadSize") : 16;
  2073. int index = 0;
  2074. if (para != null)
  2075. index = Convert.ToInt32(para[0]);
  2076. return ReadCarrierIDByIndex(offset, length, index);
  2077. }
  2078. public bool WriteCarrierIDByIndex(object[] para)
  2079. {
  2080. int offset = SC.ContainsItem($"LoadPort.{LPModuleName}.StartPage") ?
  2081. SC.GetValue<int>($"LoadPort.{LPModuleName}.StartPage") : 0;
  2082. int length = SC.ContainsItem($"LoadPort.{LPModuleName}.DataReadSize") ?
  2083. SC.GetValue<int>($"LoadPort.{LPModuleName}.DataReadSize") : 16;
  2084. if (para == null) return false;
  2085. int index = Convert.ToInt32(para[0]);
  2086. string cid = para[1].ToString();
  2087. return WriteCarrierIDByIndex(cid, offset, length, index);
  2088. }
  2089. public virtual bool ReadCarrierID(int offset = 0, int length = 16)
  2090. {
  2091. if (SC.ContainsItem($"CarrierInfo.{LPModuleName}CIDReaderIndex{InfoPadCarrierIndex}"))
  2092. {
  2093. int cidindex = SC.GetValue<int>($"CarrierInfo.{LPModuleName}CIDReaderIndex{InfoPadCarrierIndex}");
  2094. if (CIDReaders != null && CIDReaders.Length > cidindex)
  2095. _carrierIDReadercallback = CIDReaders[cidindex];
  2096. else
  2097. {
  2098. return true;
  2099. //EV.Notify(AlarmLoadPortCarrierIDIndexConfigError);
  2100. }
  2101. }
  2102. if (_carrierIDReadercallback != null)
  2103. return _carrierIDReadercallback.ReadCarrierID(offset, length);
  2104. return false;
  2105. }
  2106. public virtual bool ReadCarrierID(object[] para)
  2107. {
  2108. if (para != null && para.Length == 2)
  2109. {
  2110. return ReadCarrierID(Convert.ToInt32(para[0]), Convert.ToInt32(para[1]));
  2111. }
  2112. return ReadCarrierID();
  2113. }
  2114. public virtual bool WriteCarrierID(string carrierID, int offset = 0, int length = 16)
  2115. {
  2116. if (_carrierIDReadercallback != null)
  2117. return _carrierIDReadercallback.WriteCarrierID(offset, length, carrierID);
  2118. return false;
  2119. }
  2120. public void OnCarrierIdRead(string carrierId, int readerIndex = 1, int startPage = 1,int length =16)
  2121. {
  2122. if (_isPlaced && _isPresent)
  2123. {
  2124. _carrierId = carrierId;
  2125. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  2126. dvid["PORT_ID"] = PortID;
  2127. dvid["PortID"] = PortID;
  2128. dvid["PORT_CTGRY"] = SpecPortName;
  2129. dvid["CarrierType"] = SpecCarrierType;
  2130. dvid["CarrierID"] = CarrierId;
  2131. dvid["CIDReaderIndex"] = readerIndex;
  2132. dvid["StartPage"] = startPage;
  2133. dvid["PageLength"] = length;
  2134. EV.Notify(EventCarrierIdRead, dvid);
  2135. EV.PostInfoLog("LoadPort", $"{LPModuleName} carrierID read successfully:{_carrierId}.");
  2136. CarrierManager.Instance.UpdateCarrierId(Name, carrierId);
  2137. if (_lpcallback != null) _lpcallback.CarrierIDReadSuccess(_carrierId);
  2138. ReadCarrierIDError = false;
  2139. }
  2140. else
  2141. {
  2142. EV.PostWarningLog(Module, $"No FOUP found, carrier id {carrierId} not saved");
  2143. }
  2144. }
  2145. public bool NoteTransferStart()
  2146. {
  2147. return CheckToPostMessage((int)LoadPortMsg.StartAccess, null);
  2148. }
  2149. public bool NoteTransferStop()
  2150. {
  2151. return CheckToPostMessage((int)LoadPortMsg.CompleteAccess, null);
  2152. }
  2153. public void ProceedSetCarrierID(string cid)
  2154. {
  2155. _carrierId = cid;
  2156. CarrierManager.Instance.UpdateCarrierId(Name, cid);
  2157. }
  2158. public void OnCarrierIdWrite(string carrierId,int readerIndex=1,int startPage=1,int length =16)
  2159. {
  2160. _carrierId = carrierId;
  2161. if (_isPlaced && _isPresent)
  2162. {
  2163. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  2164. dvid["PORT_ID"] = PortID;
  2165. dvid["PortID"] = PortID;
  2166. dvid["PORT_CTGRY"] = SpecPortName;
  2167. dvid["CarrierType"] = SpecCarrierType;
  2168. dvid["CarrierID"] = carrierId;
  2169. dvid["CIDReaderIndex"] = readerIndex;
  2170. dvid["StartPage"] = startPage;
  2171. dvid["PageLength"] = length;
  2172. EV.Notify(EventCarrierIdWrite, dvid);
  2173. EV.PostInfoLog("LoadPort", $"{LPModuleName} carrierID write successfully:{_carrierId}.");
  2174. }
  2175. else
  2176. {
  2177. EV.PostWarningLog(Module, $"No FOUP found, carrier id {carrierId} not saved");
  2178. }
  2179. }
  2180. public void OnCarrierIdReadFailed(int readerIndex = 1)
  2181. {
  2182. if (_isPlaced && _isPresent)
  2183. {
  2184. _carrierId = "";
  2185. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  2186. dvid["PORT_ID"] = PortID;
  2187. dvid["PortID"] = PortID;
  2188. dvid["PORT_CTGRY"] = SpecPortName;
  2189. dvid["CarrierType"] = SpecCarrierType;
  2190. dvid["CIDReaderIndex"] = readerIndex;
  2191. EV.Notify(EventCarrierIdReadFailed, dvid);
  2192. if (_lpcallback != null) _lpcallback.CarrierIDReadFail();
  2193. EV.Notify(AlarmCarrierIDReadError, new SerializableDictionary<string, object> {
  2194. {"AlarmText","CarrierID read fail." }
  2195. });
  2196. ReadCarrierIDError = true;
  2197. EV.PostInfoLog("LoadPort", $"{LPModuleName} carrierID read fail.");
  2198. }
  2199. else
  2200. {
  2201. EV.PostWarningLog(Module, "No FOUP found, carrier id read is not valid");
  2202. }
  2203. }
  2204. public void OnCarrierIdWriteFailed(int readerIndex = 1)
  2205. {
  2206. if (_isPlaced && _isPresent)
  2207. {
  2208. SerializableDictionary<string, object> dvid = new SerializableDictionary<string, object>();
  2209. dvid["PORT_ID"] = PortID;
  2210. dvid["PortID"] = PortID;
  2211. dvid["PORT_CTGRY"] = SpecPortName;
  2212. dvid["CarrierType"] = SpecCarrierType;
  2213. dvid["CIDReaderIndex"] = readerIndex;
  2214. EV.Notify(EventCarrierIdWriteFailed, dvid);
  2215. EV.PostInfoLog("LoadPort", $"{LPModuleName} carrierID write fail carrierID:{_carrierIdToBeWrite ?? ""}.");
  2216. }
  2217. else
  2218. {
  2219. EV.PostWarningLog(Module, "No FOUP found, carrier id not valid");
  2220. }
  2221. }
  2222. public void OnCarrierIdRead(ModuleName module, string carrierId,int readerIndex=1, int startPage = 1, int length = 16)
  2223. {
  2224. OnCarrierIdRead(carrierId,readerIndex,startPage,length);
  2225. }
  2226. public void OnCarrierIdReadFailed(ModuleName module, int readerIndex = 1)
  2227. {
  2228. OnCarrierIdReadFailed(readerIndex);
  2229. }
  2230. public void OnCarrierIdWrite(ModuleName module, string carrierId,int readerIndex=1, int startPage = 1, int length = 16)
  2231. {
  2232. OnCarrierIdWrite(carrierId,readerIndex,startPage,length);
  2233. }
  2234. public void OnCarrierIdWriteFailed(ModuleName module, int readerIndex = 1)
  2235. {
  2236. OnCarrierIdWriteFailed(readerIndex);
  2237. }
  2238. public void OnLoaded()
  2239. {
  2240. var dvid = new SerializableDictionary<string, object>
  2241. {
  2242. ["CarrierID"] = _carrierId ?? "",
  2243. ["CAR_ID"] = _carrierId ?? "",
  2244. ["PORT_ID"] = PortID,
  2245. ["PortID"] = PortID,
  2246. ["PORT_CTGRY"] = SpecPortName,
  2247. ["CarrierType"] = SpecCarrierType
  2248. };
  2249. EV.Notify(EventCarrierloaded, dvid);
  2250. EV.PostInfoLog("LoadPort", $"{LPModuleName} load complete with carrier type:{SpecCarrierType ?? ""}.");
  2251. //if (_lpcallback != null) _lpcallback.LoadComplete();
  2252. //}
  2253. }
  2254. public void OnUnloaded()
  2255. {
  2256. var dvid = new SerializableDictionary<string, object>();
  2257. dvid["PortID"] = PortID;
  2258. dvid["PORT_CTGRY"] = SpecPortName;
  2259. dvid["CarrierType"] = SpecCarrierType;
  2260. dvid["CarrierID"] = _carrierId;
  2261. dvid["CAR_ID"] = _carrierId ?? "";
  2262. dvid["PORT_ID"] = PortID;
  2263. EV.Notify(EventCarrierUnloaded, dvid);
  2264. EV.PostInfoLog("LoadPort", $"{LPModuleName} unload complete with carrier:{CarrierId ?? ""}.");
  2265. //}
  2266. DockState = FoupDockState.Undocked;
  2267. if (_lpcallback != null) _lpcallback.UnloadComplete();
  2268. //_isMapped = false;
  2269. }
  2270. public void OnE84HandOffStart(bool isload)
  2271. {
  2272. if (_lpcallback != null) _lpcallback.OnE84HandoffStart(isload);
  2273. }
  2274. public void OnE84HandOffComplete(bool isload)
  2275. {
  2276. if (_lpcallback != null) _lpcallback.OnE84HandoffComplete(isload);
  2277. }
  2278. public void OnCarrierUndock()
  2279. {
  2280. var dvid = new SerializableDictionary<string, object>();
  2281. dvid["PortID"] = PortID;
  2282. dvid["PORT_ID"] = PortID;
  2283. dvid["PORT_CTGRY"] = SpecPortName;
  2284. dvid["CarrierType"] = SpecCarrierType;
  2285. dvid["CarrierID"] = _carrierId ?? "";
  2286. dvid["CAR_ID"] = _carrierId ?? "";
  2287. EV.Notify(EventCarrierUnloaded, dvid);
  2288. EV.PostInfoLog("LoadPort", $"{LPModuleName} unload complete with carrier:{CarrierId ?? ""}.");
  2289. //}
  2290. if (_lpcallback != null) _lpcallback.UnloadComplete();
  2291. }
  2292. public void OnHomed()
  2293. {
  2294. //for (int i = 0; i < 25; i++)
  2295. //{
  2296. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Name), 0, 25);
  2297. //}
  2298. _isMapped = false;
  2299. var dvid = new SerializableDictionary<string, object>();
  2300. dvid["PortID"] = PortID;
  2301. dvid["PORT_CTGRY"] = SpecPortName;
  2302. dvid["CarrierType"] = SpecCarrierType;
  2303. dvid["CarrierID"] = _carrierId;
  2304. EV.Notify(EventLPHomed);
  2305. EV.PostInfoLog("LoadPort", $"{LPModuleName} home complete with carrier:{CarrierId ?? ""}.");
  2306. if (_lpcallback != null) _lpcallback.OnLPHomed();
  2307. }
  2308. public virtual void OnError(string error = "")
  2309. {
  2310. EV.Notify(AlarmLoadPortError);
  2311. EV.PostAlarmLog("LoadPort", $"{LPModuleName} occurried error:{error} with carrier:{CarrierId??""}.");
  2312. IsBusy = false;
  2313. CheckToPostMessage((int)LoadPortMsg.Error, null);
  2314. if (ActionDone != null)
  2315. ActionDone(false);
  2316. }
  2317. protected void SetPresent(bool isPresent)
  2318. {
  2319. _isPresent = isPresent;
  2320. if (_isPresent)
  2321. {
  2322. //ConfirmAddCarrier();
  2323. }
  2324. else
  2325. {
  2326. //ConfirmRemoveCarrier();
  2327. }
  2328. }
  2329. protected virtual void SetPlaced(bool isPlaced)
  2330. {
  2331. _isPlaced = isPlaced;
  2332. if (_isPlaced)
  2333. {
  2334. ConfirmAddCarrier();
  2335. }
  2336. else
  2337. {
  2338. ConfirmRemoveCarrier();
  2339. }
  2340. }
  2341. public virtual bool OnActionDone(object[] param)
  2342. {
  2343. IsBusy = false;
  2344. CheckToPostMessage((int)LoadPortMsg.ActionDone, new object[] { "ActionDone" });
  2345. if (ActionDone != null)
  2346. ActionDone(true);
  2347. return true;
  2348. }
  2349. public void OnActionDone(bool result)
  2350. {
  2351. if (ActionDone != null)
  2352. ActionDone(result);
  2353. }
  2354. public bool CheckToPostMessage(int msg, params object[] args)
  2355. {
  2356. if (!fsm.FindTransition(fsm.State, msg))
  2357. {
  2358. if ((LoadPortMsg)msg != LoadPortMsg.ActionDone && (LoadPortMsg)msg != LoadPortMsg.StartExecute)
  2359. EV.PostInfoLog(Name, $"{Name} is in { (LoadPortStateEnum)fsm.State} state,can not do {(LoadPortMsg)msg}");
  2360. return false;
  2361. }
  2362. CurrentParamter = args;
  2363. if (msg < 10)
  2364. IsBusy = true;
  2365. else
  2366. IsBusy = false;
  2367. fsm.PostMsg(msg, args);
  2368. return true;
  2369. }
  2370. public bool CheckToPostMessage(LoadPortMsg msg, params object[] args)
  2371. {
  2372. if (!fsm.FindTransition(fsm.State, (int)msg))
  2373. {
  2374. if ((LoadPortMsg)msg != LoadPortMsg.ActionDone && (LoadPortMsg)msg != LoadPortMsg.StartExecute)
  2375. EV.PostWarningLog(Name, $"{Name} is in { (LoadPortStateEnum)fsm.State} state,can not do {(LoadPortMsg)msg}");
  2376. return false;
  2377. }
  2378. CurrentParamter = args;
  2379. if ((int)msg < 10)
  2380. IsBusy = true;
  2381. else
  2382. IsBusy = false;
  2383. fsm.PostMsg((int)msg, args);
  2384. return true;
  2385. }
  2386. public bool Check(int msg, out string reason, params object[] args)
  2387. {
  2388. if (!fsm.FindTransition(fsm.State, msg))
  2389. {
  2390. reason = String.Format("{0} is in {1} state,can not do {2}", Name, (LoadPortStateEnum)fsm.State, (LoadPortMsg)msg);
  2391. return false;
  2392. }
  2393. reason = "";
  2394. return true;
  2395. }
  2396. public virtual bool FALoad(out string reason)
  2397. {
  2398. reason = "";
  2399. return true;
  2400. }
  2401. public virtual bool FAUnload(out string reason)
  2402. {
  2403. reason = "";
  2404. return true;
  2405. }
  2406. public virtual bool WriteRfid(string cid, int startpage, int length, out string reason)
  2407. {
  2408. reason = "";
  2409. return true;
  2410. }
  2411. public virtual bool ReadRfId(out string reason)
  2412. {
  2413. reason = "";
  2414. return true;
  2415. }
  2416. public object[] CurrentParamter { get; private set; }
  2417. public virtual DeviceState State
  2418. {
  2419. get
  2420. {
  2421. if (CurrentState == LoadPortStateEnum.Idle)
  2422. {
  2423. return DeviceState.Idle;
  2424. }
  2425. if (MapError || ReadCarrierIDError|| CurrentState == LoadPortStateEnum.Error)
  2426. {
  2427. return DeviceState.Error;
  2428. }
  2429. if (IsBusy)
  2430. return DeviceState.Busy;
  2431. return DeviceState.Unknown;
  2432. }
  2433. }
  2434. public string InfoPadCarrierType { get; set; }
  2435. }
  2436. public enum LoadPortStateEnum
  2437. {
  2438. Undefined = 0,
  2439. Init,
  2440. Initializing,
  2441. Homing,
  2442. Resetting,
  2443. Idle,
  2444. Mapping,
  2445. Loading,
  2446. Unloading,
  2447. Executing,
  2448. Error,
  2449. ReadingData,
  2450. WrittingData,
  2451. TransferBlock,
  2452. };
  2453. public enum LoadPortMsg
  2454. {
  2455. Init,
  2456. StartReadData,
  2457. StartWriteData,
  2458. Load,
  2459. Unload,
  2460. Reset,
  2461. StartExecute,
  2462. StartHome,
  2463. InitComplete = 10,
  2464. ReadComplete,
  2465. WriteComplete,
  2466. LoadComplete,
  2467. UnloadComplete,
  2468. ResetComplete,
  2469. HomeComplete,
  2470. Error,
  2471. Abort,
  2472. Stop,
  2473. MoveComplete,
  2474. ActionDone,
  2475. StartAccess,
  2476. CompleteAccess,
  2477. }
  2478. public enum DispatchLPType
  2479. {
  2480. NA,
  2481. Loader,
  2482. Unloader,
  2483. }
  2484. }