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
| Signature | Description |
|---|---|
string ToString() | Summary string |
Key properties
| Property | Type | Description |
|---|---|---|
HaveDevice | bool | Container occupied |
Id / PartId | string | Device / part IDs |
Rank | int | Grade (e.g. bin class) |
OrderNumber / OrderItemNumber | string | Order / item IDs |
Recipe | string | Recipe payload |
Measure | string | Accumulated measurements |
Bincode | int | Bin / reorder number |
AlignResultX / AlignResultY / AlignResultTh | double | Alignment result |
EjectMode | bool | Ejection flag |
Tips
- Check
HaveDevicefirst — if empty, callDEVICEMGR.AddDevicebefore 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 callRemoveDevicein the last unit.