YaskawaRobotHhCcmc.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.Device.Unit;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.Log;
  7. using Aitex.Core.RT.OperationCenter;
  8. using Aitex.Core.RT.SCCore;
  9. using Aitex.Core.Util;
  10. using MECF.Framework.Common.Communications;
  11. using MECF.Framework.Common.Equipment;
  12. using MECF.Framework.Common.SubstrateTrackings;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  14. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  15. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Text;
  19. using System.Threading;
  20. using EventType = Aitex.Core.RT.Event.EventType;
  21. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.YaskawaRobots
  22. {
  23. public class YaskawaSR100RobotHhCcmc : YaskawaSR100Robot
  24. {
  25. public YaskawaSR100RobotHhCcmc(string module, string name, string scRoot, IoSensor[] dis, IoTrigger[] dos) : base(module, name, scRoot, dis, dos)
  26. {
  27. }
  28. protected override bool fStartPickWafer(object[] param)
  29. {
  30. IsOnReadyPosition = false;
  31. RobotArmEnum arm = (RobotArmEnum)param[0];
  32. ModuleName module = (ModuleName)Enum.Parse(typeof(ModuleName), param[1].ToString());
  33. if (!ModuleHelper.IsLoadPort(module))
  34. {
  35. return base.fStartPickWafer(param);
  36. }
  37. else
  38. {
  39. var lp = DEVICE.GetDevice<LoadPortBaseDevice>(module.ToString());
  40. if(!SC.GetValue<bool>($"CarrierInfo.Carrier{lp.InfoPadCarrierIndex}.EnableComplexPickAction"))
  41. {
  42. return base.fStartPickWafer(param);
  43. }
  44. if (lp != null)
  45. lp.NoteTransferStart();
  46. }
  47. try
  48. {
  49. BladeTarget = module;
  50. Blade1Target = module;
  51. Blade2Target = module;
  52. int slot = (int)param[2] + 1;
  53. float x = 0, y = 0, z = 0, w = 0;
  54. if (param.Length > 3)
  55. {
  56. x = (float)param[3];
  57. y = (float)param[4];
  58. z = (float)param[5];
  59. w = (float)param[6];
  60. }
  61. string TrsSt = GetStationsName(module, true);
  62. if (string.IsNullOrEmpty(TrsSt))
  63. {
  64. EV.PostAlarmLog("Robot", "Invalid Paramter.");
  65. return false;
  66. }
  67. int intXvalue = Convert.ToInt32(x * 1000);
  68. int intYvalue = Convert.ToInt32(y * 1000);
  69. int intZvalue = Convert.ToInt32(z * 1000);
  70. int intWvalue = Convert.ToInt32(w * 1000);
  71. string strpara = $"G,{TrsSt},{slot:D2},A,{(arm == RobotArmEnum.Both ? "F" : ((int)arm + 1).ToString())},G4";
  72. if (x != 0 || y != 0 || z != 0)
  73. {
  74. string strxoffset = intXvalue >= 0 ? $"{intXvalue:D8}" : $"{intXvalue:D7}";
  75. string stryoffset = intYvalue >= 0 ? $"{intYvalue:D8}" : $"{intYvalue:D7}";
  76. string strzoffset = intZvalue >= 0 ? $"{intZvalue:D8}" : $"{intZvalue:D7}";
  77. string strwoffset = intWvalue >= 0 ? $"{intWvalue:D8}" : $"{intWvalue:D7}";
  78. strpara += $",{strxoffset},{stryoffset},{strzoffset},{strwoffset}";
  79. }
  80. if (w != 0)
  81. {
  82. strpara += $",{intWvalue:D8}";
  83. }
  84. lock (_locker)
  85. {
  86. double exlength1 = SC.GetValue<double>($"Robot.{Name}.Extend1Distance");
  87. double exlength2 = SC.GetValue<double>($"Robot.{Name}.Extend2Distance");
  88. double outlength1 = SC.GetValue<double>($"Robot.{Name}.Out1Distance");
  89. double outlength2 = SC.GetValue<double>($"Robot.{Name}.Out2Distance");
  90. double lowOffset = SC.GetValue<double>($"Robot.{Name}.LowOffset");
  91. double upOffset = SC.GetValue<double>($"Robot.{Name}.UpOffset");
  92. double upOffset1 = SC.GetValue<double>($"Robot.{Name}.UpOffset1");
  93. double downOffset = SC.GetValue<double>($"Robot.{Name}.DownOffset");
  94. if (lowOffset > 5000 || upOffset > 3000 || upOffset1 > 3000 || downOffset > 6000)
  95. {
  96. EV.PostAlarmLog("Robot", "Z轴位置超限");
  97. return false;
  98. }
  99. string arms = arm == RobotArmEnum.Both ? "F" : ((int)arm + 1).ToString();
  100. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MTRS", $"G,{TrsSt},{slot:D2},A,{arms},G1"));
  101. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Y,{arms},H,{exlength1}"));
  102. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Z,{arms},H,{lowOffset}"));
  103. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "CSOL", $"{arms},1,0"));
  104. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Z,{arms},H,{upOffset1}"));
  105. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "CSOL", $"{arms},1,0"));
  106. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Y,{arms},H,-{outlength1}"));
  107. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "CSOL", $"{arms},0,0"));
  108. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Z,{arms},H,-{downOffset}"));
  109. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Y,{arms},H,{exlength2}"));
  110. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Z,{arms},H,{lowOffset}"));
  111. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "CSOL", $"{arms},1,0"));
  112. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Z,{arms},H,{upOffset}"));
  113. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "CSOL", $"{arms},1,0"));
  114. _lstHandlers.AddLast(new SR100RobotMotionHandler(this, "MREL", $"Y,{arms},H,-{outlength2}"));
  115. }
  116. return true;
  117. }
  118. catch (Exception ex)
  119. {
  120. LOG.Write(ex);
  121. return false;
  122. }
  123. }
  124. }
  125. }