首次上传

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,291 @@
using System;
using Aitex.Core.RT.Device;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.NX100.AL
{
public class AlignerHandler : 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 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))
{
if (error == 0)
{
update(items);
}
return true;
}
return !background;
}
protected virtual void update(string[] data)
{
}
}
public class AlInitHandler : AlignerHandler
{
public AlInitHandler()
{
background = true;
}
public override string package(params object[] args)
{
return ",INIT,00,";
}
protected override void update(string[] data)
{
_device.Initalized = true;
}
}
public class AlHomeHandler : AlignerHandler
{
public AlHomeHandler()
{
background = true;
}
public override string package(params object[] args)
{
return ",MHOM,F,";
}
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;
}
//Command wafer hold/release signal to the solenoid of the specified unit.
//$ <UNo> (<SeqNo>) CSOL <Fork> <Sw> <Sum> <CR>
//• Fork: Fork specified(1 byte)
//• ‘A’: Extension axis 1 (Blade 1), pre-aligner
//• ‘B’: Extension axis 2 (Blade 2)
//• Sw: Chucking command(1 byte)
//• ‘0’: Chucking OFF
//• ‘1’: Chucking ON
public override string package(params object[] args)
{
bool bHold = (bool)args[1];
// bool bHold = (bool)args[0];
if (bHold)
return ",CSOL,A,1,";
return ",CSOL,A,0,";
}
}
public class ALMoveToReadyPositionHandler : AlignerHandler
{
public ALMoveToReadyPositionHandler()
{
background = true;
}
public override string package(params object[] args)
{
return ",MTRS,GP,00,AL,A,";
}
}
public class ALLiftHandler : AlignerHandler
{
public ALLiftHandler()
{
background = true;
}
//$ <UNo> (<SeqNo>) CLFT<Sw> <Sum> <CR>
//• UNo: Unit number(1 byte)
//• ‘1’ to ‘4’: Unit specified
//• SeqNo: Sequence number(Non/1/2/3 byte)
//• Sw: Lifter command(1 byte)
//• ‘0’: Lifter down
//• ‘1’: Lifter up
public override string package(params object[] args)
{
bool bUp = (bool)args[0];
if (bUp)
return ",CLFT,1,";
return ",CLFT,0,";
}
}
public class AlStopHandler : AlignerHandler
{
public AlStopHandler()
{
background = true;
}
public override string package(params object[] args)
{
return ",CHLT,";
}
}
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
{
private int _angle = 0;
public AlAlignHandler()
{
background = true;
}
// $ <UNo> (<SeqNo>) MALN <TUNo> <TrsSt> <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)
{
// • TUNo: Unit number to be compensated for (1 byte)
//• ‘1’ to ‘4’: Unit specified
//• TrsSt: Target station(2 Byte)
//• ”P1” - ”P2”: At the time of PA stage specification
//Note: P1 and P2 station are effective only when two or more PA stations exist.
//When it does not exist in addition to P1 station, specification of an target station is nothing.
//• Angle: Positioning angle(6 bytes)
//• Relative angle from the position set by alignment calibration as the reference point.
//• Specified in the range between "000000" and "035999"(0 to 359.99 degree.Resolution: 0.01[deg])
//• If a value is less than specified digits, fill the higher digit with ‘0’ so that the field always has specfied digits
//_angle is 0.001 pecent
_angle =(int)Math.Round((double)args[0]* 100.0,2);
return string.Format(",MALN,1,{0:D6},",_angle);
//return string.Format(",MALN,2,{0:D6},", _angle);
}
//!,<UNo>(,<SeqNo>),<Sts>,<Errcd>,MALN,<ExeTime>,<PosData1>…,<PosDataN>,<Value1>…,<Value10>(,<Sum>)<CR>
protected override void update(string[] data)
{
/*
$ <UNo> (<SeqNo>) <StsN> <Ackcd> <Sum> <CR>
*/
_device.Notch = _angle;
}
}
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 Aitex.Sorter.Common;
using Aitex.Core.RT.Device;
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.NX100.AL
{
public class NX100AlignerHandlerFactory : IAlignerHandlerFactory
{
private TokenGenerator _tokener = new TokenGenerator("Aligner.AlignerCommunicationToken");
private IDevice _device = null;
public NX100AlignerHandlerFactory(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()
{
return new handler<ALMoveToReadyPositionHandler>(_device, ref _tokener);
}
}
}
@@ -0,0 +1,261 @@
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.NX100
{
public class NX100RobotHandlerFactory : IRobotHandlerFactory
{
private TokenGenerator _tokener;
private IDevice _device = null;
public NX100RobotHandlerFactory(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()
{
return new handler<RbArmHomeHandler>(_device, ref _tokener);
}
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)
{
throw new NotImplementedException(); //SR100新加入了此指令, NX100未修改.
}
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)
{
return new handler<PickReadyPositionHandler>(_device, ref _tokener, chamber, slot, hand);
}
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)
{
return new handler<PlaceReadyPositionHandler>(_device, ref _tokener, chamber, slot, hand);
}
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 Exchange(ModuleName chamber, int slot, Hand hand)
{
return new handler<ExchangeHandler>(_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 string GetError(int error)
{
return "UNDEFINITION";
}
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 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)
{
return new handler<ExchangeReadyPositionHandler>(_device, ref _tokener, chamber, slot, pickHand, placeHand);
}
public IHandler ExchangePickExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
return new handler<ExchangePickExtendHandler>(_device, ref _tokener, chamber, slot, pickHand, placeHand);
}
public IHandler ExchangePlaceExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
return new handler<ExchangePlaceExtendHandler>(_device, ref _tokener, chamber, slot, pickHand, placeHand);
}
public IHandler ExchangePlaceRetract(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
return new handler<ExchangePlaceRetractHandler>(_device, ref _tokener, chamber, slot, pickHand, placeHand);
}
public IHandler ExchangeReadyExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
return new handler<ExchangeReadyExtHandler>(_device, ref _tokener, chamber, slot, pickHand, placeHand);
}
public IHandler ExchangeAfterReadyExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand)
{
return new handler<ExchangeAfterReadyHandler>(_device, ref _tokener, chamber, slot, pickHand, placeHand);
}
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();
}
public IHandler SetWaferSize(int size)
{
throw new NotImplementedException();
}
public IHandler QueryWaferSize()
{
throw new NotImplementedException();
}
public IHandler PositionAdjustment(Axis axis, Hand hand, int value)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,267 @@
using System.Collections.Generic;
using Aitex.Core.Common;
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.NX100
{
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, "C1"},
{ModuleName.LP2, "C2"},
{ModuleName.LP3, "C3"},
{ModuleName.LP4, "C4"},
{ModuleName.LP5, "C5"},
{ModuleName.LP6, "C6"},
{ModuleName.LP7, "C7"},
{ModuleName.LP8, "C8"},
{ModuleName.LP9, "C9"},
{ModuleName.LP10, "CA"},
{ModuleName.Aligner, "P1"},
{ModuleName.Buffer, "C5"},
{ModuleName.TurnOverStation, "S1"},
{ModuleName.PM1, "S1"},
{ModuleName.PM2, "S2"},
{ModuleName.PM3, "S3"},
{ModuleName.PM4, "S4"},
{ModuleName.PM5, "S5"},
{ModuleName.PM6, "S6"},
{ModuleName.PM7, "S7"},
{ModuleName.PM8, "S8"},
{ModuleName.Spin1L, "S1"},
{ModuleName.Spin1H, "S2"},
{ModuleName.Spin2L, "S3"},
{ModuleName.Spin2H, "S4"},
{ModuleName.Spin3L, "S5"},
{ModuleName.Spin3H, "S6"},
{ModuleName.Spin4L, "S7"},
{ModuleName.Spin4H, "S8"},
{ModuleName.LL1, "S1"},
{ModuleName.LL2, "SA"},
{ModuleName.LL3, "SB"},
{ModuleName.LL4, "SC"},
};
public static string chamber2staion(ModuleName chamber)
{
if (!TeachStation.ContainsKey(chamber))
{
LOG.Error($"not define teach position {chamber}");
return "";
}
if (chamber == ModuleName.Aligner && SC.ContainsItem("Aligner.AlignerStation"))
return SC.GetStringValue("Aligner.AlignerStation");
int index = SC.ContainsItem($"CarrierInfo.{chamber.ToString()}CarrierIndex") ?
SC.GetValue<int>($"CarrierInfo.{chamber.ToString()}CarrierIndex") : -1;
if (SC.ContainsItem($"CarrierInfo.{chamber.ToString()}Station{index}"))
return SC.GetStringValue($"CarrierInfo.{chamber.ToString()}Station{index}");
return TeachStation[chamber];
}
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 = "";
if (SC.ContainsItem("Robot.BladeUpDownReverse") && SC.GetValue<bool>("Robot.BladeUpDownReverse"))
{
switch (hand)
{
case Hand.Blade1:
st = "A"; //单手臂 下
break;
case Hand.Blade2:
st = "B"; //4手臂 上
break;
case Hand.Both:
st = "W";
break;
}
}
else
{
switch (hand)
{
case Hand.Blade1:
st = "B"; //单手臂 下
break;
case Hand.Blade2:
st = "A"; //4手臂 上
break;
case Hand.Both:
st = "W";
break;
}
}
return st;
}
public static string NextMotion2String(Motion motion,Hand hand)
{
string st = "";
switch (motion)
{
case Motion.Pick:
st = string.Format("G{0}", hand2string(hand));
break;
case Motion.Place:
st = string.Format("P{0}", hand2string(hand));
break;
case Motion.Exchange:
st = string.Format("E{0}", hand2string(hand));
break;
default:
st = "AL";
break;
}
return st;
}
public static string Offset2String(int offset)
{
string st = "";
if (offset >= 0)
{
st = string.Format("{0:D5}", offset);
}
else
{
st = string.Format("{0:D4}", offset);
}
return st;
}
public static int WaferSize2Int(WaferSize size)
{
int ret = 0;
switch (size)
{
case WaferSize.WS3:
ret = 625000; //
break;
case WaferSize.WS4:
ret = 750000; //
break;
case WaferSize.WS6:
ret = 1000000; //
break;
}
return ret;
}
public static int MappingOffset2Int(WaferSize size)
{
int ret = 0;
switch (size)
{
case WaferSize.WS3:
ret = 2357000; //
break;
case WaferSize.WS4:
ret = 2452000; //
break;
case WaferSize.WS6:
ret = 2732000; //
break;
}
return ret;
}
}
}