首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
@@ -0,0 +1,269 @@
using System;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.SCCore;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.SR100.AL
{
public class AlignerHandler : ITransferMsg
{
public int LastErrorCode { get; set; }
public bool background { get; protected set; }
public bool evt { get { return false; } }
public string deviceID { private get; set; }
public string _cmd = string.Empty;
public IDevice Robot { set { _device = (Aligner)value; } }
protected Aligner _device;
public AlignerHandler()
{
background = false;
}
public virtual string package(params object[] args)
{
return "";
}
public bool unpackage(string type, string[] items)
{
int value = Convert.ToInt32(items[3], 16);
_device.Status = value;
int error = Convert.ToInt32(items[4], 16);
_device.ErrorCode = error;
if (error > 0)
_device.LastErrorCode = error;
if (type.Equals(ProtocolTag.resp_tag_excute))
{
_device.ElapseTime = int.Parse(items[6]);
if (error == 0)
{
update(items);
}
return true;
}
return !background;
}
protected virtual void update(string[] data)
{
}
}
public class AlInitHandler : AlignerHandler
{
public AlInitHandler()
{
background = true;
}
//$,<UNo>(,<SeqNo>),CCLR,<CMode>(,<Sum>)<CR>
public override string package(params object[] args)
{
return ",CCLR,E,";
}
}
public class AlHomeHandler : AlignerHandler
{
public AlHomeHandler()
{
background = true;
}
public override string package(params object[] args)
{
if(SC.ContainsItem("Aligner.AlignerType") && SC.GetValue<int>("Aligner.AlignerType") == 1 )
{
return ",INIT,1,1,N,";
}
else return ",INIT,1,1,G,";
}
protected override void update(string[] data)
{
_device.Initalized = true;
}
}
public class AlClearErrorHandler : AlignerHandler
{
public AlClearErrorHandler()
{
background = true;
}
//$,<UNo>(,<SeqNo>),CCLR,<CMode>(,<Sum>)<CR>
public override string package(params object[] args)
{
return ",CCLR,E,";
}
}
public class AlGripHandler : AlignerHandler
{
public AlGripHandler()
{
background = true;
}
//$,<UNo>(,<SeqNo>),CSOL,<Sol>,<Sw>,<Wait>(,<Sum>)<CR>
//sol Solenoid control specification (1 byte) • ‘1’ : Blade 1. • ‘2’ : Blade 2. • ‘F’ : Blade 1 + Blade 2.
// Solenoid command (1 byte) • ‘0’ : Wafer release. / Lifter down. • ‘1’ : Wafer hold. / Lifter up.
public override string package(params object[] args)
{
// bool bHold = (bool)args[0];
bool bHold = (bool)args[1];
if (bHold)
return ",CSOL,1,1,0,";
return ",CSOL,1,0,0,";
}
}
public class ALLiftHandler : AlignerHandler
{
public ALLiftHandler()
{
background = true;
}
//$,<UNo>(,<SeqNo>),CSOL,<Sol>,<Sw>,<Wait>(,<Sum>)<CR>
//sol Solenoid control specification (1 byte) • ‘1’ : Blade 1. • ‘2’ : Blade 2. • ‘F’ : Blade 1 + Blade 2.
// Solenoid command (1 byte) • ‘0’ : Wafer release. / Lifter down. • ‘1’ : Wafer hold. / Lifter up.
public override string package(params object[] args)
{
bool bUp = (bool)args[0];
if (bUp)
return ",CSOL,2,1,0,";
return ",CSOL,2,0,0,";
}
}
public class AlStopHandler : AlignerHandler
{
public AlStopHandler()
{
background = true;
}
//$,<UNo>(,<SeqNo>),CSTP,<Sw>(,<Sum>)<CR>
//• ‘H’ : Deceleration to a stop.
//• ‘E’ : Emergency stop.
public override string package(params object[] args)
{
return ",CSTP,H,";
}
}
public class ALQueryStateHandler : ITransferMsg
{
public bool background { get; protected set; }
public bool evt { get { return false; } }
public string deviceID { private get; set; }
public string _cmd = string.Empty;
public IDevice Robot { set { _device = (Aligner)value; } }
protected Aligner _device;
public ALQueryStateHandler()
{
background = false;
}
//$,<UNo>(,<SeqNo>),RSTS(,<Sum>)<CR>
public string package(params object[] args)
{
return ",RSTS,";
}
public bool unpackage(string type, string[] items)
{
return !background;
}
}
public class AlAlignHandler : AlignerHandler
{
public AlAlignHandler()
{
background = true;
}
// $,<UNo>(,<SeqNo>),MALN,<Mode>,<Angle>(,<Sum>)<CR>
//Mode : Motion mode (1 byte) If the case of edge grip type pre-Aligner, specify ‘0’.
public override string package(params object[] args)
{
int angle = (int)Math.Round((double)args[0] * 1000.0, 2);
return string.Format(",MALN,0,{0:D8},", angle);
}
//!,<UNo>(,<SeqNo>),<Sts>,<Errcd>,MALN,<ExeTime>,<PosData1>…,<PosDataN>,<Value1>…,<Value10>(,<Sum>)<CR>
protected override void update(string[] data)
{
/*
• Value1 : Wafer eccentric amount before alignment operation (8 bytes, Resolution: 0.001 [mm])
• Value2 : Wafer eccentric angle direction before alignment operation (8 bytes, Resolution: 0.001 [deg])
• Value3 : Notch/Orientation Flat direction before alignment operation (8 bytes, Resolution: 0.001 [deg])
• Value4 : X direction offset amount before alignment operation (8 bytes, Resolution: 0.001 [mm])
• Value5 : Y direction offset amount before alignment operation (8 bytes, Resolution: 0.001 [mm])
• Value6 : Pre-aligner adjustment angle (8 bytes, Resolution: 0.001 [deg])
• Value7 : Manipulator adjustment amount (8 bytes, Resolution: 0.001 [mm])
• Value8 : Manipulator adjustment angle (8 bytes, Resolution: 0.001 [deg])
• Value9 : X direction offset amount after alignment operation (8 bytes, Resolution: 0.001 [mm])
• Value10 : Y direction offset amount after alignment operation (8 bytes, Resolution: 0.001 [mm])
* //value index is 9
*/
_device.Notch = int.Parse(data[11]);
}
}
public class ALEventHandler : ITransferMsg
{
public bool background { get { return false; } }
public bool evt { get { return true; } }
public string deviceID { private get; set; }
public string _cmd = string.Empty;
public IDevice Robot { set { _device = (Aligner)value; } }
protected Aligner _device;
public ALEventHandler()
{
}
//$,<UNo>(,<SeqNo>),RSTS(,<Sum>)<CR>
public string package(params object[] args)
{
return "";
}
public bool unpackage(string type, string[] items)
{
string evtType = items[3];
if (evtType.Equals(ProtocolTag.resp_evt_error))
{
int error = Convert.ToInt32(items[5], 16);
_device.ErrorCode = error;
if (error > 0)
_device.LastErrorCode = error;
return true;
}
return false;
}
}
}
@@ -0,0 +1,77 @@
using System;
using Aitex.Sorter.Common;
using Aitex.Core.RT.Device;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.SR100.AL
{
public class SR100AlignerHandlerFactory : IAlignerHandlerFactory
{
private TokenGenerator _tokener = new TokenGenerator("Aligner.AlignerCommunicationToken");
private IDevice _device = null;
public SR100AlignerHandlerFactory(IDevice device)
{
_device = device;
}
public IHandler Init()
{
return new handler<AlInitHandler>(_device, ref _tokener);
}
public IHandler Home()
{
return new handler<AlHomeHandler>(_device, ref _tokener);
}
public IHandler Event()
{
return new handler<ALEventHandler>(_device, ref _tokener, true);
}
public IHandler Grip(Hand hand)
{
return new handler<AlGripHandler>(_device, ref _tokener, hand, true);
}
public IHandler Release(Hand hand)
{
return new handler<AlGripHandler>(_device, ref _tokener, hand, false);
}
public IHandler QueryState()
{
return new handler<ALQueryStateHandler>(_device, ref _tokener);
}
public IHandler Clear()
{
return new handler<AlClearErrorHandler>(_device, ref _tokener);
}
public IHandler Stop()
{
return new handler<AlStopHandler>(_device, ref _tokener);
}
public IHandler Align(double angle)
{
return new handler<AlAlignHandler>(_device, ref _tokener, angle);
}
public IHandler LiftUp()
{
return new handler<ALLiftHandler>(_device, ref _tokener, true);
}
public IHandler LiftDown()
{
return new handler<ALLiftHandler>(_device, ref _tokener, false);
}
public IHandler MoveToReadyPostion()
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,263 @@
using Aitex.Core.RT.SCCore;
using System;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using Aitex.Core.RT.Device;
using Aitex.Core.Common;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.SR100
{
public class SR100RobotHandlerFactory : IRobotHandlerFactory
{
private TokenGenerator _tokener;
private IDevice _device = null;
public SR100RobotHandlerFactory(IDevice device)
{
_device = device;
if (SC.ContainsItem($"{device.Name}.RobotCommunicationToken"))
_tokener = new TokenGenerator($"{device.Name}.RobotCommunicationToken");
else
{
_tokener = new TokenGenerator($"Robot.RobotCommunicationToken");
}
}
public IHandler SetCommunication()
{
throw new NotImplementedException();
}
public IHandler SetLoad(Hand hand)
{
throw new NotImplementedException();
}
public IHandler CheckLoad(ModuleName chamber, int slot)
{
throw new NotImplementedException();
}
public IHandler RequestWaferPresent()
{
throw new NotImplementedException();
}
public IHandler RequestAWCData()
{
throw new NotImplementedException();
}
public IHandler Init()
{
return new handler<RbInitHandler>(_device, ref _tokener);
}
public IHandler Home()
{
return new handler<RbHomeHandler>(_device, ref _tokener);
}
public IHandler ArmHome()
{
throw new NotImplementedException();
}
public IHandler Event()
{
return new handler<RbEventHandler>(_device, ref _tokener, true);
}
public IHandler Grip(Hand hand)
{
return new handler<RbGripHandler>(_device, ref _tokener, hand, true);
}
public IHandler Release(Hand hand)
{
return new handler<RbGripHandler>(_device, ref _tokener, hand, false);
}
public IHandler QueryState()
{
return new handler<RBQueryStateHandler>(_device, ref _tokener);
}
public IHandler QueryPosition()
{
return new handler<RBQueryPositionHandler>(_device, ref _tokener);
}
public IHandler Clear()
{
return new handler<RbClearErrorHandler>(_device, ref _tokener);
}
public IHandler Stop(bool isEmergency)
{
return new handler<RbStopHandler>(_device, ref _tokener, isEmergency);
}
public IHandler Resume( )
{
return new handler<RbResumeHandler>(_device, ref _tokener);
}
public IHandler SetSpeed(int speed)
{
return new handler<RbSetSpeedHandler>(_device, ref _tokener, speed);
}
public IHandler Goto(ModuleName chamber, int slot, Motion next, Hand hand, int x, int y, int z)
{
return new handler<GotoHandler>(_device, ref _tokener, chamber, slot, next, hand, x, y , z);
}
public IHandler MoveTo(ModuleName chamber, int slot, Hand hand, bool isPick, int x, int y, int z)
{
return new handler<MoveToHandler>(_device, ref _tokener, chamber, slot, hand, isPick, x, y, z);
}
public IHandler Pick(ModuleName chamber, int slot, Hand hand)
{
return new handler<PickHandler>(_device, ref _tokener, chamber, slot, hand);
}
public IHandler PickExtend(ModuleName chamber, int slot, Hand hand)
{
return new handler<PickExtendHandler>(_device, ref _tokener, chamber, slot, hand);
}
public IHandler PickRetract(ModuleName chamber, int slot, Hand hand)
{
return new handler<PickRetractHandler>(_device, ref _tokener, chamber, slot, hand);
}
public IHandler PickReadyPosition(ModuleName chamber, int slot, Hand hand)
{
throw new NotImplementedException();
}
public IHandler Place(ModuleName chamber, int slot, Hand hand)
{
return new handler<PlaceHandler>(_device, ref _tokener, chamber, slot, hand);
}
public IHandler PlaceExtend(ModuleName chamber, int slot, Hand hand)
{
return new handler<PlaceExtendHandler>(_device, ref _tokener, chamber, slot, hand);
}
public IHandler PlaceRetract(ModuleName chamber, int slot, Hand hand)
{
return new handler<PlaceRetractHandler>(_device, ref _tokener, chamber, slot, hand);
}
public IHandler PlaceReadyPosition(ModuleName chamber, int slot, Hand hand)
{
throw new NotImplementedException();
}
public IHandler Exchange(ModuleName chamber, int slot, Hand hand)
{
return new handler<ExchangHandler>(_device, ref _tokener, chamber, slot, hand);
}
public IHandler WaferMapping(ModuleName chamber)
{
return new handler<RBWaferMappingHandler>(_device, ref _tokener, chamber);
}
public IHandler QueryWaferMap(ModuleName chamber)
{
return new handler<RBQueryWaferMapHandler>(_device, ref _tokener, chamber);
}
public IHandler PickEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z)
{
return new handler<PickHandlerEx>(_device, ref _tokener, chamber, slot, hand, x, y, z);
}
public IHandler PlaceEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z)
{
return new handler<PlaceHandlerEx>(_device, ref _tokener, chamber, slot, hand, x, y, z);
}
public IHandler Extend(ModuleName chamber, int slot, Hand hand)
{
throw new NotImplementedException();
}
public IHandler Retract(ModuleName chamber, int slot, Hand hand)
{
throw new NotImplementedException();
}
public IHandler ExchangeEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z)
{
throw new NotImplementedException();
}
public IHandler ExchangeReadyPosition(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
throw new NotImplementedException();
}
public IHandler ExchangePickExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
throw new NotImplementedException();
}
public IHandler ExchangePlaceExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
throw new NotImplementedException();
}
public IHandler ExchangePlaceRetract(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
throw new NotImplementedException();
}
public IHandler SetWaferSize(int size)
{
throw new NotImplementedException();
}
public IHandler QueryWaferSize()
{
throw new NotImplementedException();
}
public IHandler ExchangeReadyExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
throw new NotImplementedException();
}
public IHandler ExchangeAfterReadyExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
throw new NotImplementedException();
}
public IHandler PositionAdjustment(Axis axis, Hand hand, int value)
{
return new handler<PositionAdjustmentHandler>(_device, ref _tokener, axis, hand, value);
}
public IHandler SetWaferSize(int cmd, WaferSize size)
{
throw new NotImplementedException();
}
public IHandler QueryParameter(int parameter, string parameterType)
{
throw new NotImplementedException();
}
public IHandler SetServoOnOff(bool trueForOnFalseForOff)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,222 @@
using System.Collections.Generic;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.SCCore;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.SR100
{
public class ProtocolTag
{
public const string tag_end = "\r";
public const string tag_cmd_start = "$";
public const string cmd_token = ",";
public const string resp_tag_normal = "$";
public const string resp_tag_error = "?";
public const string resp_tag_excute = "!";
public const string resp_tag_event = ">";
public const string resp_evt_error = "100";
}
public class RobotConvertor
{
public static Dictionary<ModuleName, string> TeachStation = new Dictionary<ModuleName, string>()
{
{ModuleName.LP1, "C01"},
{ModuleName.LP2, "C02"},
{ModuleName.LP3, "C03"},
{ModuleName.LP4, "C04"},
{ModuleName.LP5, "C05"},
{ModuleName.LP6, "C06"},
{ModuleName.LP7, "C07"},
{ModuleName.LP8, "C08"},
{ModuleName.Aligner, "P01"},
{ModuleName.Buffer, "C05"},
{ModuleName.TurnOverStation, "S01"},
{ModuleName.PM1, "S01"},
{ModuleName.PM2, "S02"},
{ModuleName.PM3, "S03"},
{ModuleName.PM4, "S04"},
{ModuleName.PM5, "S05"},
{ModuleName.PM6, "S06"},
{ModuleName.PM7, "S07"},
{ModuleName.PM8, "S08"},
{ModuleName.Spin1L, "S01"},
{ModuleName.Spin1H, "S02"},
{ModuleName.Spin2L, "S03"},
{ModuleName.Spin2H, "S04"},
{ModuleName.Spin3L, "S05"},
{ModuleName.Spin3H, "S06"},
{ModuleName.Spin4L, "S07"},
{ModuleName.Spin4H, "S08"},
{ModuleName.LL1, "S01"},
{ModuleName.LL2, "S02"},
{ModuleName.LL3, "S03"},
{ModuleName.LL4, "S04"},
};
public static string chamber2staion(ModuleName chamber)
{
if (!TeachStation.ContainsKey(chamber))
{
LOG.Error($"not define teach position {chamber}");
return "";
}
string ret =TeachStation[chamber];
if(chamber == ModuleName.Aligner && SC.ContainsItem("Aligner.AlignerStation"))
return SC.GetStringValue("Aligner.AlignerStation");
if (SC.ContainsItem($"CarrierInfo.{chamber}CarrierIndex"))
{
int idex = SC.GetValue<int>($"CarrierInfo.{chamber}CarrierIndex");
if(SC.ContainsItem($"CarrierInfo.{chamber}Station{idex}"))
{
ret = SC.GetStringValue($"CarrierInfo.{chamber}Station{idex}");
}
}
return ret;
}
public static Dictionary<ModuleName, string> Slot2Slot = new Dictionary<ModuleName, string>()
{
{ModuleName.LP1, "SlotPlusOne"},
{ModuleName.LP2, "SlotPlusOne"},
{ModuleName.LP3, "SlotPlusOne"},
{ModuleName.LP4, "SlotPlusOne"},
{ModuleName.LP5, "SlotPlusOne"},
{ModuleName.LP6, "SlotPlusOne"},
{ModuleName.LP7, "SlotPlusOne"},
{ModuleName.LP8, "SlotPlusOne"},
{ModuleName.LP9, "SlotPlusOne"},
{ModuleName.LP10, "SlotPlusOne"},
{ModuleName.Buffer, "SlotPlusOne"},
{ModuleName.Aligner, "00"},
{ModuleName.Robot, "00"},
{ModuleName.PM1, "00"},
{ModuleName.PM2, "00"},
{ModuleName.PM3, "00"},
{ModuleName.PM4, "00"},
{ModuleName.PM5, "00"},
{ModuleName.PM6, "00"},
{ModuleName.PM7, "00"},
{ModuleName.PM8, "00"},
{ModuleName.Spin1L, "00"},
{ModuleName.Spin1H, "00"},
{ModuleName.Spin2L, "00"},
{ModuleName.Spin2H, "00"},
{ModuleName.Spin3L, "00"},
{ModuleName.Spin3H, "00"},
{ModuleName.Spin4L, "00"},
{ModuleName.Spin4H, "00"},
{ModuleName.LL1, "00"},
{ModuleName.LL2, "00"},
{ModuleName.LL3, "00"},
{ModuleName.LL4, "00"},
{ModuleName.LL5, "00"},
{ModuleName.LL6, "00"},
{ModuleName.LL7, "00"},
{ModuleName.LL8, "00"},
{ModuleName.LLA, "00"},
{ModuleName.LLB, "00"},
{ModuleName.LLC, "00"},
{ModuleName.LLD, "00"},
{ModuleName.TurnOverStation, "00"},
};
public static string chamberSlot2Slot(ModuleName chamber, int slot)
{
if (!Slot2Slot.ContainsKey(chamber))
{
LOG.Error($"not define slot2slot config {chamber}");
return "";
}
string sslot = Slot2Slot[chamber];
if(sslot == "SlotPlusOne")
{
sslot = string.Format("{0:D2}", slot + 1);
}
return sslot;
}
public static string hand2string(Hand hand)
{
string st = "";
switch (hand)
{
case Hand.Blade1:
st = "1";
break;
case Hand.Blade2:
st = "2";
break;
case Hand.Both:
st = "F";
break;
}
return st;
}
public static string AxisToStr(Axis axis)
{
string st = "";
switch (axis)
{
case Axis.S:
st = "S";
break;
case Axis.A:
st = "A";
break;
case Axis.H:
st = "H";
break;
case Axis.I:
st = "I";
break;
case Axis.Z:
st = "Z";
break;
default:
break;
}
return st;
}
public static string IsPick2Position(bool isPick)
{
var pos = isPick ? "P1" : "G1";
return pos;
}
public static string Offset2String(int offset)
{
string st = "";
if (offset >= 0)
{
st = string.Format("{0:D8}", offset);
}
else
{
st = string.Format("{0:D7}", offset);
}
return st;
}
}
}