ASCII / SCPI
YAML key: ascii
The ASCII adapter serves simple text protocols such as SCPI. It listens on TCP (or UDP), parses newline-terminated commands, and maps them to attributes or custom handlers.
Configuration Example
communication:
ascii:
port: 5025
terminator: "\n"
response_delay: 0.01
response_jitter: 0.0
mappings:
"MEAS:VOLT?": "#out(voltage)"
"CONF:MODE {mode}":
"#attr(measurement_mode)": "mode"
response: "ACK"{
"communication": {
"ascii": {
"port": 5025,
"terminator": "\n",
"response_delay": 0.01,
"response_jitter": 0.0,
"mappings": {
"MEAS:VOLT?": "#out(voltage)",
"CONF:MODE {mode}": {
"#attr(measurement_mode)": "mode",
"response": "ACK"
}
}
}
}
}Key fields
host(default:0.0.0.0) — bind addressport: TCP port. If omitted, SPX auto-assigns a free port starting at5025and writes the effective value into the instance atcommunication.ascii.port.transport(default:tcp) —tcp|udpterminator: command delimiter (\n,\r\n, etc.).response_delay: base delay inserted before responding (seconds).response_jitter: random delta added to delay (seconds).mappings: legacy command dictionary (still supported; converted internally tobindings). Each key is a command pattern.A string value returns the referenced attribute.
A mapping updates attributes or invokes handlers; optional
responseoverrides the reply.
bindings: explicit binding definitions (see the spx-examples SCPI multimeter model for a concrete pattern).
Tip: In
spx-examples, the SCPI multimeter model omitsportso it can run multiple instances without collisions. Seemultimeter__scpi.yaml.
Placeholders
Commands may include placeholders ({mode}) that the adapter passes into the mapping as variables. You can write them back to attributes or use them in responses.
Scenarios
Use scenarios to simulate link issues:
Tips
Normalize commands to uppercase to avoid case mismatches.
Use
response_delayandresponse_jitterto emulate slow hardware.Validate mappings with MiL tests against SPX Server (see
spx-examplesmultimeter__scpi.yamlandscpi_multimeter_sut_example.py).
Last updated

