Benches¶
A bench is an XPressServer: it reports its name and, for each of its drivers — the UART to the unit, the TCP link to a power supply, a digital I/O card — what it offers: values to read, values to set, and commands with their parameters and answers. The binding connects the data points of your workspace to that offering. A data point that is not bound is served by the operator, exactly as without a bench.
A bench is either a real bench — the XPressServer of a test stand on this computer, with its drivers — or a simulated bench: it runs in the page, declares its offering in the same form a real server reports it, and answers from what it declares.
Open Tests › Benches.
Getting the bench server¶
The server of a bench comes as one zip for every system, with example drivers, from the same place as XPressRT itself:
<address of XPressRT>/downloads/xpress-bench-0.1.0.zip
On the Benches page, Download bench server fetches the same zip.
It brings what macOS, Linux and Windows need. Unpack it where the bench lives and
start it with ./start.sh, on Windows .\start.ps1. It needs Python 3.11, 3.12
or 3.13 and nothing else: the first start installs what the zip brings, without
the internet. The README in the zip says the rest, among it ./start.sh check,
which tells you whether every driver is fit to run.
Its bench.json lets XPressRT at https://www.xpressrt.de connect:
"http": { "host": "127.0.0.1", "port": 8050, "allowed_origins": ["https://www.xpressrt.de"] }
A bench unpacked from an older zip has "allowed_origins": [] there: add the
address, then start its server again. XPressRT opened from another address
goes into that list too; pages of this computer (localhost, 127.0.0.1)
need no line.
Adding a bench¶
A real bench on this computer. Start the server of the bench; it prints its address and a six-digit code:
XPressServer HIL-02 on http://127.0.0.1:8050 -- pair with code 482910
Choose + Add bench, give the address and the code, and choose Connect.
The bench is named as its server reports itself, and its offering is what the
server describes — every driver with its values, requests, record types and
streams. Bind your data points to it as below. A value a driver hands over
only as a stream is offered in the Bind dialog as, for example, wave
(stream); the row then says "source": "stream" by itself, and READ takes the
newest sample of the stream.
When XPressRT is opened at its web address in Chrome, Chrome may ask once
whether it may reach devices on this computer and your network. If it asks,
choose Allow. Until you do, the connection waits silently — XPressRT says
so after eight seconds (No answer from … within 8 s) instead of waiting on.
A window that xpress.py run --window opens does not ask.
Pairing happens once per browser and address. The key the server hands out stays in this browser and nowhere else: not in the workspace, not in its history, not in a run or an export. Another browser, another computer, cleared site data or another port of the server: the bench page says Pair again with the code the bench shows and takes the code the server's window shows now — a code pairs one browser, then the server shows a new one. Pairing is done by a person at the bench; an assistant cannot pair.
Who is paired is listed on the bench's computer, and a computer that was
lost is locked out there: python -m xpress_bench clients bench.json lists
every client — an id, its name, since when, never its key —, and
python -m xpress_bench clients bench.json revoke <id> revokes one. The server closes that browser's
connection within a second, and its bench page says This browser's key was
revoked on the server at … Pair again with a new code. — not that the bench
cannot be reached. Listing and revoking from the Benches page comes later.
A simulated bench. Choose + Add simulated bench, type the name — the one
its server would report — and choose + Add. A simulated bench starts from a template with three
drivers: a UART to the unit (mode, diode_temp, SetSystemMode,
RunSelfTest), a power supply (ch1.volt, SetVoltage) and an I/O card
(relay.K1 … K4, in1). Change its offering and behaviour under
Technical details, in Simulation — see The simulation.
Each bench is a file benches/<name>.json in the workspace and travels with
it; every change is in the history. A bench is known by its name, not by
its file: two benches with the same name are an error. The address of a real
bench's server is kept per machine, in .xpress/benches.local.json — the same
bench can be reached differently from two computers. The card Connection on
the bench's page shows how it stands with the server: Connected, or Not
paired, No answer or Not connected, with the reason below. Change
address… changes the address.
As its server reports it now. Under What it can do, each driver of a real bench shows its state as the server reports it — connected, disconnected, disabled … — and its kind. Its documentation comes from the server too: what the driver is, and under Documentation each value it reads and sets and each command it runs, with its unit and description. Its version and the offset of its clock, with the uncertainty, stand under Technical details, in Drivers as the server reports them. None of it is written into the bench file; it is read whenever the page shows the bench. When a run holds the bench — this browser's or another client's —, the page says who since when and only reads until it ends; Safe state stays possible.
The file format¶
A bench file is JSON, and its format is described as a JSON Schema in
benches/bench.schema.json, beside the benches. XPressRT writes it there when
the workspace is opened and with the first bench; it is not part of the history,
and the list of benches does not count it as one. Edit a bench on the Benches
page or by hand — the schema says what each field is, and an editor that knows
JSON Schema checks a file against it.
The file carries its version: 1, or 2, 3 or 4 when it uses
something only that version knows. XPressRT decides it again at every save, so a
bench that uses nothing of it stays 1 and an older XPressRT keeps reading it;
one that knows only 1 refuses a 2, 3 or 4 and writes nothing over it.
Only in version 2:
| Where | What |
|---|---|
offering.drivers[].types |
the record types of a driver, in the names of the device |
offering.drivers[].events |
what arrives on its own over time — bound to a data point of kind event |
type "record", recordType, list, maxLength |
a value, a parameter or an event that is a record or a list |
points.<path>.fields |
a record point field by field: each field of the workspace to a field of the bench |
params.<p>.to "frame:cmd", fixed "frame:prio" |
a parameter or a fixed value that goes into a field of a record |
simulation.values |
a record (an object) or a list of records as the simulated value |
simulation.effects[].emit |
a message a command makes arrive, afterMs after its answer ok |
simulation.periodic |
a message that arrives every everyMs — a heartbeat, a fixed sequence |
Only in version 3:
| Where | What |
|---|---|
type "file", accept |
a value or a parameter that is a file — a picture, a log, a firmware |
simulation.values |
a sample file, the artifact by its name: { "artifact": "ref-display-ready" } |
simulation.rules |
a command answered otherwise until another one was answered ok in this run |
simulation.faults: "corrupt" |
a file that arrives changed — the transfer ends with hash mismatch |
points.<path>.status.blocked, blockedKinds |
an answer that says the bench does not do it now, with its kind — needs … first, busy, locked, not supported, out of range |
points.<path>.failedCause |
that a failed of this point means the bench, not the device |
Only in version 4 — what the server of a real bench describes. Note that in a
bench file maxLength is the length of a list, and maxChars the length of
a text — unlike datapoints.json, where a text point's maxLength counts
its characters and a list has maxItems:
| Where | What |
|---|---|
maxChars, pattern |
a text the driver takes at most so many characters of, or only of a form |
noUnit, integer |
a number without a unit, or only whole numbers |
codes |
the code of each enum name, as the driver reports it |
maxBytes |
a file the driver takes at most so many bytes of |
default |
what a command takes when a parameter is left out |
commands[].answerStatus, result, safeStateEffect, paramsFrom |
what each answer means, a file a command hands back, what it does to the safe state, parameters from a record type |
offering.drivers[].streams |
numbers at a fixed rate, recorded in blocks |
points.<path>.source "stream" |
a read point bound to a stream the driver only hands over: READ takes its newest recorded sample |
The schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://xpressrt.de/schemas/bench/4",
"$comment": "Written by XPressRT when the workspace is opened; changes here are overwritten. It describes versions 1 to 4.",
"title": "XPressRT bench file",
"type": "object",
"properties": {
"version": {
"type": "integer",
"enum": [
1,
2,
3,
4
],
"description": "1, or 2, 3 or 4 when the file uses something only that version knows. Decided again at every save."
},
"name": {
"type": "string",
"description": "The name its server reports; the file name follows from it."
},
"simulated": {
"type": "boolean",
"description": "A simulated bench runs in the page and has no address."
},
"testPlace": {
"type": "string"
},
"drivers": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"port": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"disabled": {
"type": "object",
"properties": {
"by": {
"type": "string"
},
"at": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": [
"by",
"at",
"reason"
]
}
},
"required": [
"type"
]
}
},
"offering": {
"$ref": "#/$defs/offering"
},
"simulation": {
"$ref": "#/$defs/simulation"
},
"points": {
"type": "object",
"description": "The binding: data point of the workspace -> row.",
"additionalProperties": {
"$ref": "#/$defs/row"
}
},
"proposals": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"row": {
"$ref": "#/$defs/row"
},
"by": {
"type": "string"
},
"at": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": [
"row",
"by",
"at",
"reason"
]
}
},
"commissioned": {
"type": "object",
"description": "Written when the bench is taken into use on the Benches page, never by hand."
},
"counter": {
"type": "integer",
"minimum": 0
}
},
"required": [
"version",
"name",
"drivers",
"points"
],
"$defs": {
"value": {
"type": "object",
"description": "A value the bench reads or sets, a parameter of a command, an event, or a field of a record type.",
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"numeric",
"enum",
"boolean",
"text",
"record",
"file"
],
"description": "\"record\" is version 2 only, \"file\" version 3 only."
},
"unit": {
"type": "string"
},
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"values": {
"type": "array",
"items": {
"type": "string"
},
"description": "For enum: the values, in the names of the device."
},
"recordType": {
"type": "string",
"description": "For a record: one of the types of the driver. Version 2 only."
},
"list": {
"type": "boolean",
"description": "A list of values of this type. Version 2 only."
},
"maxLength": {
"type": "integer",
"minimum": 1,
"description": "How long the list can be. Version 2 only."
},
"required": {
"type": "boolean",
"description": "For a parameter: without it the bench does not take the command."
},
"accept": {
"type": "array",
"items": {
"type": "string"
},
"description": "For a file: which files, as \".png\" or \"image/*\". Version 3 only."
},
"maxChars": {
"type": "integer",
"minimum": 1,
"description": "For a text: at most this many characters, counted as XPressRT counts them (UTF-16). Version 4 only."
},
"pattern": {
"type": "string",
"description": "For a text: the form the whole value has, in the part Python and JavaScript read alike. Version 4 only."
},
"noUnit": {
"type": "boolean",
"description": "For a number: it has no unit (a count, a code). Version 4 only."
},
"integer": {
"type": "boolean",
"description": "For a number: whole numbers only. Version 4 only."
},
"codes": {
"type": "object",
"additionalProperties": {
"type": "integer"
},
"description": "For an enum: the code of each name, as the driver reports it; the wire carries the name. Version 4 only."
},
"maxBytes": {
"type": "integer",
"minimum": 0,
"description": "For a file: at most this many bytes. Version 4 only."
},
"default": {
"description": "For a parameter: what the command takes when it is left out. Version 4 only."
},
"rateHz": {
"type": "number",
"exclusiveMinimum": 0,
"description": "For a stream: samples per second. Version 4 only."
}
},
"required": [
"name",
"type"
]
},
"offering": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"drivers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"port": {
"type": "string"
},
"read": {
"type": "array",
"items": {
"$ref": "#/$defs/value"
}
},
"set": {
"type": "array",
"items": {
"$ref": "#/$defs/value"
}
},
"commands": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"params": {
"type": "array",
"items": {
"$ref": "#/$defs/value"
}
},
"answers": {
"type": "array",
"items": {
"type": "string"
}
},
"answerStatus": {
"type": "object",
"additionalProperties": {
"type": "string",
"enum": [
"ok",
"failed",
"refused"
]
},
"description": "What each answer means, as the driver explains it. Version 4 only."
},
"result": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"file"
]
},
"accept": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"type"
],
"description": "What the command hands back besides its status: a file. Version 4 only."
},
"safeStateEffect": {
"type": "string",
"description": "What the command does to the safe state; \"none\" if nothing. Version 4 only."
},
"paramsFrom": {
"type": "string",
"description": "The parameters are the fields of this record type (written out in params). Version 4 only."
}
},
"required": [
"name",
"params",
"answers"
]
}
},
"safe_state": {
"type": "boolean"
},
"types": {
"type": "object",
"description": "The record types of this driver, in the names of the device. Version 2 only.",
"additionalProperties": {
"type": "object",
"properties": {
"fields": {
"type": "array",
"items": {
"$ref": "#/$defs/value"
}
}
},
"required": [
"fields"
]
}
},
"events": {
"type": "array",
"items": {
"$ref": "#/$defs/value"
},
"description": "What arrives on its own; every occurrence counts. Version 2 only."
},
"streams": {
"type": "array",
"items": {
"$ref": "#/$defs/value"
},
"description": "Numbers at a fixed rate (rateHz), recorded in blocks. Version 4 only."
}
},
"required": [
"id",
"type",
"read",
"set",
"commands"
]
}
}
},
"required": [
"name",
"drivers"
]
},
"row": {
"type": "object",
"description": "A row of the binding: a data point of the workspace and its target in the offering.",
"properties": {
"driver": {
"type": "string"
},
"name": {
"type": "string"
},
"values": {
"type": "object",
"description": "Translation of values: name in the workspace -> value of the bench.",
"additionalProperties": {
"type": [
"string",
"number",
"boolean"
]
}
},
"scale": {
"type": "number",
"description": "Bench = workspace x scale."
},
"fields": {
"type": "object",
"description": "A record point field by field: field of the workspace (code, detail:severity) -> field of the bench. Version 2 only.",
"additionalProperties": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"values": {
"type": "object",
"description": "Translation of values: name in the workspace -> value of the bench.",
"additionalProperties": {
"type": [
"string",
"number",
"boolean"
]
}
},
"scale": {
"type": "number"
}
},
"required": [
"name"
]
}
},
"params": {
"type": "object",
"description": "Parameter of the workspace -> parameter of the command. A field of a record parameter is named with a colon (frame:cmd), version 2 only.",
"additionalProperties": {
"type": "object",
"properties": {
"to": {
"type": "string"
},
"values": {
"type": "object",
"description": "Translation of values: name in the workspace -> value of the bench.",
"additionalProperties": {
"type": [
"string",
"number",
"boolean"
]
}
},
"scale": {
"type": "number"
}
},
"required": [
"to"
]
}
},
"fixed": {
"type": "object",
"description": "Fixed values the bench needs and the test does not know. A field of a record parameter with a colon (frame:prio), version 2 only. For a parameter that takes a file, the value is the name of an artifact.",
"additionalProperties": {
"type": "object",
"properties": {
"value": {},
"kind": {
"type": "string",
"enum": [
"technical",
"affects_result"
]
}
},
"required": [
"value"
]
}
},
"status": {
"type": "object",
"properties": {
"ok": {
"type": "array",
"items": {
"type": "string"
}
},
"refused": {
"type": "array",
"items": {
"type": "string"
}
},
"failed": {
"type": "array",
"items": {
"type": "string"
}
},
"timeout": {
"type": "array",
"items": {
"type": "string"
}
},
"blocked": {
"type": "array",
"items": {
"type": "string"
},
"description": "Answers that say the bench does not do it now: no test result, the step stops with its kind and sentence. Version 3 only."
}
},
"additionalProperties": false
},
"blockedKinds": {
"type": "object",
"description": "For each answer under status blocked its kind; needs with needs_first says what comes first. Version 3 only.",
"additionalProperties": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"needs_first",
"busy",
"locked",
"not_supported",
"out_of_range"
]
},
"needs": {
"type": "string"
}
},
"required": [
"kind"
],
"additionalProperties": false
}
},
"failedCause": {
"type": "string",
"enum": [
"bench",
"device"
],
"description": "Whom a failed of this point means: the bench, or the device (the default). Version 3 only."
},
"source": {
"type": "string",
"enum": [
"stream"
],
"description": "A read point bound to a stream the driver only hands over (offering streams, not read): READ takes the newest sample from the server's recording, never the driver. Version 4 only."
},
"sequence": {
"type": "array",
"items": {
"type": "object"
}
},
"enabled": {
"type": "boolean"
},
"disabled": {
"type": "object",
"properties": {
"by": {
"type": "string"
},
"at": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": [
"by",
"at",
"reason"
]
}
},
"required": [
"driver"
]
},
"effect": {
"type": "object",
"description": "An effect of a command answered ok: set a reading, or (version 2) make a message arrive.",
"properties": {
"set": {
"type": "string",
"description": "The reading, as driver.name."
},
"from": {
"type": "string",
"description": "The parameter whose value is taken -- for emit a field of it (frame:cmd)."
},
"value": {},
"overMs": {
"type": "number",
"exclusiveMinimum": 0,
"description": "A number moves there over this time instead of jumping."
},
"emit": {
"type": "string",
"description": "The event, as driver.name, that arrives as a message. Version 2 only."
},
"afterMs": {
"type": "number",
"minimum": 0,
"description": "How long after the answer ok the message arrives. Version 2 only."
},
"values": {
"type": "array",
"description": "Several messages one after the other. Version 2 only."
},
"everyMs": {
"type": "number",
"exclusiveMinimum": 0,
"description": "The time between them. Version 2 only."
}
}
},
"simulation": {
"type": "object",
"properties": {
"values": {
"type": "object",
"description": "What a reading reports, named driver.name: one value, or a list read in turn. A record or a list of records is version 2 only; a sample file, { \"artifact\": \"name\" }, version 3 only."
},
"answers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"delayMs": {
"type": "number",
"minimum": 0
},
"faults": {
"type": "object",
"additionalProperties": {
"type": "string",
"enum": [
"failed",
"timeout",
"corrupt"
]
},
"description": "failed or timeout for a data point of the workspace; corrupt for one that carries a file: it arrives changed (hash mismatch). corrupt is version 3 only."
},
"effects": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/$defs/effect"
}
}
},
"safeState": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/$defs/effect"
}
}
},
"rules": {
"type": "array",
"description": "A command answers answer, with reason, until after was answered ok in this run. Version 3 only.",
"items": {
"type": "object",
"properties": {
"command": {
"type": "string"
},
"after": {
"type": "string"
},
"answer": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": [
"command",
"after",
"answer",
"reason"
]
}
},
"periodic": {
"type": "object",
"description": "Per event (driver.name) a message every everyMs, with value or values in turn. Version 2 only.",
"additionalProperties": {
"type": "object",
"properties": {
"everyMs": {
"type": "number",
"exclusiveMinimum": 0
},
"value": {},
"values": {
"type": "array"
}
},
"required": [
"everyMs"
]
}
}
}
}
}
}
The simulation¶
A simulated bench answers from what it declares. Under Technical details on its page, in Simulation, stand its offering — in the form a real XPressServer will report it — and eight things that say how it behaves:
| What it says | Named by | Example | |
|---|---|---|---|
values |
What a reading reports: one value, or a list that is read in turn, one per reading, and starts again at its end. A record is an object in the bench's own field names; a reading that holds a list reports the list as one value — a list of lists is read in turn | the offering: driver.name |
"dut.mode": "RDY", "io.in1": [false, false, true] |
answers |
What a command answers, in the bench's own words. Without an entry it answers the first of its possible answers | the command | "SetSystemMode": "NOT_ALLOWED" |
delayMs |
How long every access takes, in milliseconds | — | "delayMs": 200 |
faults |
That a data point does not answer ok: failed — the bench answers with an error — or timeout — it does not answer at all. From version 3 also corrupt, for a point that carries a file: the file arrives changed, and the transfer ends with hash mismatch |
the data point of the workspace | "System/State": "timeout", "Unit/Flash": "corrupt" |
effects |
Which reading a command sets when it is answered ok — so that what was set is what is read afterwards. With overMs a number moves there over that time instead of jumping. With emit it makes an event arrive instead, afterMs after the answer |
the command; inside, the offering | "SetVoltage": [{ "set": "psu.ch1.volt", "from": "volt", "overMs": 2000 }] |
safeState |
What safe_state of a driver leaves behind |
the driver; inside, the offering | "psu": [{ "set": "psu.ch1.volt", "value": 0 }] |
periodic |
A message an event sends on its own, every everyMs from the moment the bench starts running — a heartbeat; with values they come in turn |
the offering: driver.name of an event |
"can0.heartbeat": { "everyMs": 1000, "value": true } |
rules |
That a command is answered otherwise until another one was answered ok in this run: it answers answer, with reason as the bench's own sentence |
a list of rules: command, after, answer, reason | [{ "command": "SelfTest", "after": "Init", "answer": "NOT_READY", "reason": "Init has not run yet" }] |
Files. A value of the offering can be a file ("type": "file", with
accept for the kinds it takes). The simulation answers a file read with a
sample file, named by an artifact:
"cam.snapshot": { "artifact": "ref-display-ready" } — the run keeps its name,
size and sha256, and the Data points page shows it under Read now. A request or
a setting with a file is taken and answered as the command answers, ok by
default. Rules say what a bench refuses: with
{ "command": "SelfTest", "after": "Init", "answer": "NOT_READY", "reason": "Init has not run yet" }
a SelfTest before an Init answered ok is not carried out. What its answer
means, the binding says: with "status": { "blocked": ["NOT_READY"] } and
"blockedKinds": { "NOT_READY": { "kind": "needs_first", "needs": "Init" } }
the step stops as Blocked by the bench SIM-1: Unit/SelfTest, needs Init first —
Init has not run yet, and it is not a test result (see
Reports).
A file on its way. A file goes to the bench and comes back as its content,
not as a path in a shared folder: in pieces of 256 KB, each with its sha256,
and the bench checks every piece and the whole file against the sha256 the run
knows. With "Unit/Flash": "corrupt" under faults the file arrives changed:
the step stops with hash mismatch after transfer and the piece it was in —
before the bench carries anything out, so nothing was flashed — and it is not a
test result. A file whose content is not on this machine (an artifact kept
local only elsewhere) cannot be sent either, and the step stops the same way.
faults is the one thing named by the data point of your workspace
(System/State): it says what a test meets. Everything else is named by what
the bench offers (dut.mode), because it says what the bench does.
All of it together:
"simulation": {
"values": {
"dut.mode": "RDY",
"dut.diode_temp": 25,
"psu.ch1.volt": 0,
"io.in1": [false, false, true]
},
"answers": { "SetSystemMode": "DONE", "SetVoltage": "DONE", "RunSelfTest": "DONE" },
"delayMs": 0,
"faults": { "Diode/Temp": "failed" },
"effects": {
"SetSystemMode": [{ "set": "dut.mode", "from": "mode" }],
"SetVoltage": [{ "set": "psu.ch1.volt", "from": "volt", "overMs": 2000 }]
},
"safeState": {
"dut": [{ "set": "dut.mode", "value": "STBY" }],
"psu": [{ "set": "psu.ch1.volt", "value": 0 }]
}
}
Effects. set names the reading; from the parameter of the command whose
value it takes — as it went to the bench, after translation and scale —, or
value a fixed one. The effect happens only when the command was answered ok:
a refused or failed command changes nothing. The template sets the voltage read
back from SetVoltage and the mode from SetSystemMode.
Messages. What a driver lists under events arrives on its own — a CAN
frame received, a log line, a heartbeat. Of a real bench these are the messages
its drivers declare with the direction from_device or both — the device sends
them; one declared to_device the device only takes, and it is no event (out and
in are the old names of the two). Nothing makes it arrive but the
simulation: an effect with emit names the event (can0.rx_error) and the
message — value, or from to take what was sent, a field of it too
(frame:cmd) —, afterMs after the command was answered ok; with values and
everyMs several arrive one after the other. periodic sends one every
everyMs for as long as the bench runs: a run on it, or the Data points page
operating it. An event nothing causes stays silent: nothing received, as
without a bench. Every message carries the moment it arrives, on the
bench's clock — the clock its answer to the command carries too —, not the
moment the runner picks it up. So COLLECT(…, since = AT("sent")) counts what
arrived after the mark, exactly once within 500 ms measures something, and
two messages where one is expected fail exactly that line. Watch shows every
message once, at its moment.
"simulation": {
"answers": { "send": "SENT" },
"effects": {
"send": [{ "emit": "can0.rx_error", "afterMs": 120, "value": { "err": 4711, "src": "SWV" } }]
},
"periodic": { "can0.heartbeat": { "everyMs": 1000, "value": true } }
}
This is version 2 of the bench file — see The file format.
Safe state. A driver either has safe_state or it has not — the offering
says only that ("safe_state": true per driver); what it does is the driver's
own, not a list of steps in the bench file. For a simulated bench, what it
leaves behind stands under safeState. Safe state on the Data points page
calls it on every driver. A driver that is disabled or does not offer it is not
called, and the answer says so — so that nobody takes safe state for the whole
bench when a part was not reached. Under What it can do every driver says
whether Safe state reaches it; Technical details shows safe_state as the
server reports it.
Where a simulated bench starts. A run always begins with what the bench
declares: the values as they stand in the file. What a run sets is gone when
it ends. Operating by hand on the Data points page is different: what you set
there stays, in that window, until you reload the page. So you can set a
voltage and read it back a minute later.
An entry that names a command, a reading, a driver or a parameter the bench does not offer is a finding of the check, with its place. The simulation is no part of the binding and does not change its version.
The box is read-only until you click Edit. While you edit, the page checks
the text as you type and says below the box what is wrong — text that is not
JSON, or an offering it cannot read (a driver without read, set or
commands, an entry without a name); until it is right, Save simulation
stays greyed out. What the check of the bench will report afterwards stands
there as a hint. After saving, the box is read-only again. The offering
belongs to taking it into use: change it here and the bench says the bench
offers something else now: take it into use again. A change under simulation
alone does not ask for that.
The binding¶
One row per data point: the driver, the target in its offering, and how they translate.
| Target | a value to read for a read point; a value to set or a command for a set point; a command — or a sequence of writes and a wait — for a request |
| Values | workspace names → the bench's values (Ready → RDY); for on/off, on and off |
| Scale | bench = workspace × scale, where the units differ (s → ms: 1000); empty means 1 |
| Fields | a record field by field: each field of the workspace → a field of the bench, with its own values and scale (source → src, swivel → SWV). A field of the bench the workspace does not know is not taken over |
| Parameters | each parameter of a request → a parameter of the command; a set point's value goes to the command as value. A field of a record parameter goes with a colon, on either side: detail:severity → status:sev, visbox → frame:cmd |
| Fixed values | parameters the bench needs and the test does not know, each marked technical (a channel, a baud rate) or affects the result (a ramp, a supply voltage) — a field of a record parameter too (frame:prio) |
| Answers | every answer of the command → ok, refused (refused by the unit), failed, timeout or blocked (blocked by the bench: it does not do it now, with its kind — needs … first and what, busy, locked, not supported, out of range). An answer without one counts as failed. With failed here means the bench a failed of this row counts as the bench's cause, not the unit's |
A row is edited as a table: your workspace on the left, the bench on the right. When you choose a data point to bind, the page says what it is: its direction, its type with range and unit, its named values with the number behind each, or for a request its parameters. Values are chosen, not typed: a named value of the workspace is mapped to one of the bench from a list, and a value of the bench shows its number too. A scale shows the range it turns the point's range into, and says when that leaves what the bench can hold. A fixed value is entered in its own type — a number within the bench's range, a choice from its names, on/off, for a file one of the artifacts of a type the driver takes — and the type stands beside it. A translation that no longer fits after the target changed is removed, and the ones that can be filled in are filled in for you.
A file as a fixed value. When a request needs a file that belongs to the bench and not to the test — each bench its own image, say — the binding names an artifact for that parameter. The test case stays the same when the bench changes. The binding holds the name; since an artifact's content never changes, that name fixes the file. A run sends the file like any other and keeps its name, size and sha256. A name that is no artifact, an artifact without its file, or a file of a type the driver does not take is a finding, and no run starts on the bench until it is fixed. One single file only: a parameter that takes a list of files cannot be fixed this way.
Records, lists and messages. A data point that holds a record is
bound to one entry of the offering as a whole, with a translation field by
field: the editor lists every field of your record on the left and lets you
choose the bench's field for it, with its values and scale; fields called the
same on both sides are filled in for you. Every field of your record has to be
mapped — a missing one is a finding with its name, never guessed. A list
is one value; the translation holds for every entry. A data point of kind
event is bound to an entry under events, a reading to one under read;
mixing them is a finding. The binding names no bytes: whether a record becomes
JSON, a UART frame or a CAN telegram is the driver's.
A simulated and a real bench bind them alike, field by field; on a real bench the record goes over the line as the driver describes it, with its own field names.
Streams. A value a driver hands over only as a stream — samples at a fixed
rate, Streams wave (V) · 2 kHz on its card — has no read of its own. The
Bind dialog offers it beside the reads as wave (stream) and writes
"source": "stream" into the row by itself; when the driver also reads a value
of that name, only the read is offered, and READ goes to the driver. A point
bound to a stream is read from the server's recording: READ — in a run, in
Operate now — takes its newest sample, with
that sample's own time, and Operate now says newest sample of the stream.
Before the stream delivered anything, READ says so at once: Hil/Wave is a stream
of hil and has delivered no sample yet; after the driver was connected again,
only samples of the new connection count. In a run, a READ on a stream counts
samples from the beginning of the test case on (around a procedure: of the run):
with none yet it waits up to one second, reads at once when one is there, and
otherwise the step ends Aborted by the bench with that sentence. In a series of
readings, the same sample as the reading before ends it the same way: …has delivered
no new sample since the reading before. An equal value at a new time is a new sample.
READ does not wait for a value to arrive: after a Set, or for a value that comes late,
put a WAIT_UNTIL or a WAIT before it. The check holds the row against what
the driver describes: a stream without source, or source on a name the
driver reads, is a finding. WAIT_UNTIL, COLLECT and Watch take a stream from
the recording, as before.
The check¶
The page checks the binding against the bench's offering and your data points, and says every deviation with its place and fix: a required parameter without a value, a unit without a scale or with a scale of 0, a value that does not fit, an answer mapped to nothing, a fixed value without its kind. A bench with such a finding needs attention and cannot be taken into use.
Which values have to fit depends on the direction:
- Reading — the bench reports, the workspace understands. Every value the bench can report stands for exactly one value of the data point. That the bench never reports ChangingToReady is fine; STBY standing for both Standby and EmergencyStop is not — the reading would be ambiguous.
- Setting and requests — the workspace sends, the bench has to take it. Every value of the data point arrives, and every translated value fits the target: true or false for a boolean, one of its values for an enum, its range for a number.
A fixed value that affects the result is a hint: it is a hidden test condition — add it to System/BringToState as a parameter so test cases state it. Two benches that fix the same such value differently get a hint as well: it explains why their results can differ.
A state bound to a number is a hint too. A data point with named states — LOW, HIGH — that reads a number of the bench can be handed values no name stands for. Such a value is not a reading: where the bench reports 25 and the binding translates 0 and 1, the access fails at the bench, with the value that came and the ones the binding knows. Read now and Watch show it as failed, taking it into use refuses the bench, and in a run the step is aborted by the bench — it is not counted as a failure of the unit under test.
The sentence at the top of the page says how many data points come from this bench. The binding lists those; Asked by hand lists the others, which the operator serves in a run on this bench, each with the reason. It is folded; its line says how many.
Disabling¶
A row or a whole driver can be disabled, with Disable… in its ⋯ — an instrument in calibration, a relay that sticks. It stays in the binding, greyed out, with who disabled it, when and why; a reason is required. Its data points are served by the operator until it is enabled again.
On a real bench, Disable and Enable of a driver go to its server first: it stops the driver (and starts it again), and only then is the bench file written. When the server says no — a run holds the bench —, nothing is written. Should the two ever differ, the driver says On its server it is …, in this workspace …. A row of the binding exists only in the workspace; its switch writes only the file.
A point set from a block or a Python step
A block or Python step that sets a point the bench does not serve — disabled, or not bound — asks the operator, the same as a form step: in one dialog for all the values of the step, see Values to set by hand. The list before a run starts and the page of the bench say so at such points. Before 2.4 such a step asked nobody, and a run from then says nobody applied it.
Disabling is an operating state, not a change of the binding: the version of the binding stays the same, and the bench stays taken into use. A run records what was disabled, with its reason.
Taking a bench into use¶
Check and take into use compares the binding with what the bench offers and, when nothing is wrong, marks the bench In use, with the date, the person and the version of the binding. On a real bench it first takes the offering as the server describes it now, checks the binding against it — an enum name with another code than in the catalogue, a file kind the other side does not take or a pattern Python and JavaScript would read differently is an error there.
It calls nothing on the bench: no read, no set, no request. In use says that the binding fits what the bench offers and that a person took it into use. It does not say that an interface answered. A read point that does not answer, a state the binding does not know or a request the device refuses shows only when you try it with Operate now, or in the first run, as an abort by the bench.
Benches taken into use before this kept what their probe calls answered in their file. It stays there, and nothing reads it any more.
Operate now on a bench¶
Operate now on a bench's page opens every interface its drivers offer, bound or not, so that you can try them before you bind anything: connect the bench, try its interfaces, bind the ones you need, take it into use. It is the main button while nothing is bound and once the bench is in use, and it needs a connection to the server. The ⋯ of a bound row opens that interface directly.
On the left stands the list per driver, with the names from the offering: ↓ read, ↑ set, ▷ request, ≈ a stream. A data point that is bound to an interface stands beside it. On the right stands the same surface as on the Data points page, for every kind of value, with three functions only: read, set and request. Waiting for a value or collecting one belongs to a test step. Messages a driver sends by itself are not in this list; What it can do names them.
You work in the driver's words and within its range only — the range of a bound data point does not apply here. For a bound interface the result also shows the value in the words of its data point. A stream reads its newest sample. Set shows what the driver reports it reached, where it says; nothing reads back by itself. A request shows its status, its answer, its message, what it returned and its file, which you can download from there. A call the driver cannot do now shows blocked with its reason and, where it says, the call that has to come first; so does the bench journal.
Before you press anything the page says what goes to the bench (Sends to …). Run… with dots asks first — here and on the Data points page: when the request can change the safe state, as its data point or its driver says; when it says nothing about the safe state; and whenever the binding fixes a file for it, because that click really sends the file. A value the binding fixes is filled in and can be changed here; the journal keeps what was actually sent.
A run on the bench leaves reading and Safe state open and locks set and request. Somebody else operating the same bench by hand locks nothing, but the page names them: when one of you leaves after a set or a request, the server takes the safe state for everyone. Everything you do here goes to the bench journal, never into a test result. On a simulated bench the answers come from its simulation; for an interface without a binding, the answers a driver names ok are ok, otherwise its first answer. Leaving after a set or a request asks whether to take the safe state, as on the Data points page.
Change the binding afterwards and the bench is Not yet in use again until it is taken into use anew. The same holds when the bench offers something else than it did when it was taken into use — a driver more or less, another range, a command that is new or gone: the page says the offering changed since and names what changed, and asks to check and take it into use again. With a real bench this is where a swap at the test place shows. No run starts on a real bench whose binding or offering is not the one taken into use. Operate now still works on such a bench: In use says the bench is checked for test runs, and operating by hand is not a test — it goes to the bench journal, never into a test result. A simulated bench is there to try things out: a run on it starts, and the list before the start and the top of the report say the binding changed since it was taken into use as v3.
The number of a binding counts every change, also one that takes a change back.
When the binding is the one taken into use again, the bench is In use
with a higher number than it was taken into use with; an assistant's
read_binding and list_benches then say binding v21, same content as
v15 taken into use.
An assistant cannot take a bench into use or operate it: that stays with a person.
The bench journal¶
Below What it can do on a bench's page stands its journal, folded until you open it: what somebody did on this bench outside a test — Read now, Set, Run and Safe state on the Data points page and in Operate now on the bench. Newest first, with who, when, the point or the interface, the value or the parameters, what went to the bench and what it answered; filter it by a data point or an interface. The list is read-only.
The journal is not a test result. No run contains it, and neither does a run list, a statistic, a plan report, a coverage run or a download of results. A value that stands only here was never measured in a test.
It is kept in results/bench-journal/<bench>/<date>.jsonl: one line per
operation, appended and never changed, each with its version number. It is not
part of the workspace history.
What an assistant does on a bench¶
An assistant reads benches with list_benches and read_binding. On the
binding of a bench, simulated or real, it can do three things:
- Write a row with
write_binding_row— a new one, or in place of the row that is there. The check runs first: a row it finds an error in is refused with the place and the fix, and nothing is written. A hint, such as a fixed value that affects the result, comes back with the answer. - Remove a row with
remove_binding_row. From then on the operator serves that point in a run on this bench. - Propose a row with
propose_binding, saying why, when you should decide. The proposal waits under Proposed rows, with its reason and what the check would find in it; nothing of the binding changes until you Accept it — or Reject it.
Every row it writes or removes names its reason, and the history keeps it with the assistant as the one who made the change. It is a new version of the binding, so the bench says take it into use again — and only a person takes a bench into use. On a real bench no run starts before that: a person stands before every run on real equipment, also when the assistant wrote the binding. A simulated bench is for trying out — a run starts on it, and list and report say that its binding is not taken into use.
An assistant cannot disable or enable a row or a driver — a row that was disabled stays disabled when it writes it again —, write a simulation, create a bench, take one into use or operate it.
When a bound data point changes¶
Renaming a data point, moving its folder, renaming a value, changing its unit or deleting it reaches every bench that binds it. The Data points page lists those benches before it writes and offers to carry the binding along where it can — see Renaming, changing what a point does and deleting. A row left behind makes the bench need attention; move it to the new point here, with Move the row to….
Renaming a field of a record type, a name of an enum field, or a
state of a data point carries the binding in the same change, without
asking: the keys under fields, the parameter keys (detail:severity) and the
translations follow the new name. What the bench names stays — nothing changed
at the bench. The preview of the rename names the benches it touches.
When an assistant renames a data point (rename_data_point), the binding moves
with it in the same change — catalogue, blocks, steps and binding are one entry
in the history, all or nothing. The bench then has a new version of its binding
and is taken into use again by a person.
Every change of a bench — adding it, a row, disabling with its reason, a proposal, accepting it, taking it into use — is a change of its file and stands in the history, with who made it and why.
Running on a bench¶
Choose the bench when you start a run — see
On a bench. Every value it served is recorded with
its clock (SIM-1/dut), with who served it, the bench and the driver — and for
a command with what was sent and the fixed values of the binding. run.json
names the bench and the version of its binding. The report, the run on Runs and
the plan report show it: see
Who served a value and
The plan report.
On a real bench the run goes through its server, with the same binding as on
a simulated one. Each value keeps the time the driver gave it, in UTC, and the
clock of that driver (HIL-1/motor). A wait or a collection that starts from a
moment the same driver named starts from that driver's own time; otherwise from
UTC, and the step says how uncertain that is. An answer the binding does not
map counts as the driver says it does.
- Somebody else holds the bench. While another client runs on it, a run does not start, and XPressRT says who holds it and since when: The bench is busy with a run started by … No run starts on HIL-1 now.
- The bench is at its disk limit. No run starts, and the page says what holds the space: … No run starts on HIL-1 now. The Benches page shows the same line for as long as the server reports it, and it goes by itself when there is room.
- The connection goes during the run. The server takes the safe state when it loses the connection. The run cannot go on on the bench, and nobody is asked anything more: the step that was going on is aborted by the bench, an operator dialog that is open says that the bench is gone, and every test case after it is not run, with the reason. The run is Incomplete: the connection to HIL-1 was lost at 10:43:00 UTC.
The run on Runs and the report name the server and each driver with its version
and clock under Technical details, the assistant in its answer: Server
XPressServer 0.1.0 · drivers motor 1.0.0 (clock HIL-1/motor, offset -137 µs ±
353 µs). A lost connection stands in view on both. run.json
keeps them under bench.server, bench.drivers and bench.connectionLost.
It never keeps the address or the key of the bench. An older XPressRT opens such
a run as before.
The recording of the run comes into its folder. When a run on a real bench
ends, XPressRT fetches everything the server recorded during it — every value,
complete, not thinned out — and puts it under bench/ in the run folder:
bench-run.json and one file per key. Always, without asking, so that a run
nobody watches is not held up. The run on Runs and the report say so under
Technical details: Recording of HIL-1: 3.2 MB, in bench/ of this
run's folder. The only limit is what the browser has free;
the download goes straight to disk, file by file, and only what was checked
completely, each file against the zip's checksum, becomes bench/. Then the run
says what it holds, and only then the server deletes its copy. When it cannot be
taken — the server is gone, the browser has no room, a file in it is not what a
recording holds —, the run says why, and the recording stays on the bench; the run
itself is valid either way.
run.json keeps this under bench.recording.
A recording that stayed on the bench comes at the next connection. A window that
went away during a run leaves its recording on the server, across a restart of the
server too. Any connection to that bench with the key that started the run fetches
it, into the workspace that is open: into the folder whose run.json names that run,
or else into a new one, which reads Incomplete because only the recording is there.
A toast says Recording fetched from HIL-1. Opening a workspace connects by itself to
the bench last chosen for a run in this browser, so this needs no visit to Benches; it
does not wait for that, and a bench that does not answer says nothing. With
--headless it does not ask. bench/ is in XPressRT's entry
in .gitignore: see Your workspace.
A server that reports another name¶
When the server at a bench's address reports another name than the bench has, no run starts on it. If the bench was renamed, take the binding over to the new name — only after you confirm; the file is renamed with it, and the history follows.