XScript Manual · Chapter 22

title: "DEVICE — device/container object" chapter: 22

DEVICE — device/container object

DEVICE["container"] or DEVICE["container", index]. A data object that travels with each workpiece (bowl, tray, cassette, PCB …) on the line — used for ID tracking, alignment results, and order-state handoff.

Basic example

if (DEVICE["INCV"].HaveDevice == true)
{
    Log("ID = {0}, RANK = {1}", DEVICE["INCV"].Id, DEVICE["INCV"].Rank);
    Log("Result X={0}, Y={1}, TH={2}",
        DEVICE["INCV"].AlignResultX,
        DEVICE["INCV"].AlignResultY,
        DEVICE["INCV"].AlignResultTh);
}
else
{
    DEVICEMGR.AddDevice("INCV");
 
    DEVICE["INCV"].Id = "INCV_ID";
    DEVICE["INCV"].Rank = 1;
    DEVICE["INCV"].AlignResultX = rx;
    DEVICE["INCV"].AlignResultY = ry;
    DEVICE["INCV"].AlignResultTh = rth;
}

Real-world — carrying order state

From Unit.xms: per-container order info that flows between units via DEVICEMGR.MoveDevice.

DEVICEMGR.AddDevice(DEVICE_NAME, 0);
 
DEVICE[DEVICE_NAME, unitIndex].OrderNumber = orderNumber;
DEVICE[DEVICE_NAME, unitIndex].OrderItemNumber = orderItemId;
DEVICE[DEVICE_NAME, unitIndex].Recipe = recipe;
DEVICE[DEVICE_NAME, unitIndex].Measure = "";
DEVICE[DEVICE_NAME, unitIndex].Bincode = reorderNo;
 
// Hand off to the next unit
DEVICEMGR.MoveDevice(DEVICE_NAME, unitIndex - 1, DEVICE_NAME, unitIndex);

Methods

SignatureDescription
string ToString()Summary string

Key properties

PropertyTypeDescription
HaveDeviceboolContainer occupied
Id / PartIdstringDevice / part IDs
RankintGrade (e.g. bin class)
OrderNumber / OrderItemNumberstringOrder / item IDs
RecipestringRecipe payload
MeasurestringAccumulated measurements
BincodeintBin / reorder number
AlignResultX / AlignResultY / AlignResultThdoubleAlignment result
EjectModeboolEjection flag

Tips

  • Check HaveDevice first — if empty, call DEVICEMGR.AddDevice before writing fields.
  • Store order state (Measure, OrderNumber, Recipe) on the device object so it travels with the workpiece, simplifying unit-to-unit interfaces.
  • Mark ejection with EjectMode = ON, then call RemoveDevice in the last unit.