Repository navigation
VXI 11 and HiSLIP
Since 0.5.0 scpi-sim speaks the two VISA LAN protocols besides the raw socket. If your script opens one of these, it runs against the simulator unchanged — only the address changes:
| Your script opens | Protocol | Start scpi-sim with |
|---|---|---|
TCPIP::192.168.1.20::5025::SOCKET |
raw socket | nothing extra |
TCPIP::192.168.1.20::INSTR or ::inst0::INSTR
|
VXI-11 | --vxi11 |
TCPIP::192.168.1.20::hislip0::INSTR |
HiSLIP | --hislip |
$ scpi-sim serve --hislip --vxi11 --no-portmapper --profile keysight-34461a
scpi-sim: keysight-34461a (34461A) listening on 127.0.0.1:5025 (Ctrl+C to stop)
scpi-sim: HiSLIP on 127.0.0.1:4880
scpi-sim: VXI-11 on 127.0.0.1:40651, no port mapper
scpi-sim: keysight-34461a (34461A): TCPIP0::127.0.0.1::hislip0::INSTR
scpi-sim: keysight-34461a (34461A): TCPIP0::127.0.0.1,40651::inst0::INSTRThe last lines are the resource strings to use. The options go before the
instrument (serve --hislip psu) and work with --profile and --bench too.
-
HiSLIP is the easy one: one fixed port (4880), no privileges needed, and
it is what newer instruments recommend. If your script can use
hislip0, use that. -
VXI-11 is what older scripts and most
TCPIP::host::INSTRstrings mean. It needs a port mapper — see the next section. - The raw socket stays the simplest for new code and for tools that are not
VISA (
nc, C#TcpClient, LabVIEW TCP functions).
A VXI-11 client first asks the port mapper on port 111 where the instrument
listens, then connects there. scpi-sim brings its own port mapper, but port 111
is a privileged port, and on many Linux machines rpcbind already uses it.
Pick what fits:
| Situation | Do this | Resource string |
|---|---|---|
| Docker available | run the image; it serves the port mapper on 111 | TCPIP0::localhost::psu::INSTR |
| PyVISA-py, no Docker | --vxi11 --no-portmapper |
TCPIP0::127.0.0.1,PORT::inst0::INSTR (PORT from the output) |
| fixed port, e.g. for a firewall | --vxi11 --vxi11-port 5098 --no-portmapper |
TCPIP0::127.0.0.1,5098::inst0::INSTR |
| NI-VISA / Keysight VISA, Linux | port mapper must be on 111: Docker, or root, or stop rpcbind
|
TCPIP0::127.0.0.1::inst0::INSTR |
The host,PORT form skips the port mapper. PyVISA-py understands it; NI-VISA
and Keysight VISA do not, they always ask port 111.
Docker with everything published:
docker run --rm -p 5025-5027:5025-5027 -p 111:111 -p 111:111/udp -p 5098:5098 -p 4880:4880 \
ghcr.io/steitec/scpi-simMap 5098 to the same port outside: the port mapper reports the port inside the container.
One simulator serves several instruments on one VXI-11 port and one HiSLIP port, so the device name in the resource string picks the instrument:
| by position in the bench file | by name | |
|---|---|---|
| VXI-11 |
inst0, inst1, … |
psu, dmm, … |
| HiSLIP |
hislip0, hislip1, … |
hislip_psu, hislip_dmm, … |
PyVISA-py treats a device name as HiSLIP only if it starts with hislip,
hence hislip_psu rather than psu. From Python, bench.resource("psu", "hislip") and bench.resource("psu", "vxi11") build the right string,
including the port when it is not the standard one.
VXI-11 and HiSLIP follow the IEEE 488.2 message exchange rules; the raw socket just streams lines. You notice it in four places:
-
An answer waits until you read it.
write("*IDN?")thenread()works.read()after a command without a query (write("VOLT 5")) runs into the client's timeout — as on a real instrument. -
Query interrupted. Writing a new message before reading the previous
answer discards that answer and puts
-410,"Query INTERRUPTED"in the error queue. This finds a classic bug: awrite("MEAS?")whose answer is never read. -
Status byte.
read_stb()works without sending*STB?; bit 4 (MAV, 16) is set while an answer waits, bit 2 (4) while the error queue is not empty. -
Device clear.
clear()drops pending input and answers — also a delayed one — but keeps the error queue and the settings.
Locks (lock_excl() / unlock() over VXI-11; AsyncLock in HiSLIP) are
exclusive and shared across both protocols: a VXI-11 link and a HiSLIP session
cannot hold the same instrument at the same time. PyVISA-py does not implement
HiSLIP locks itself, so over HiSLIP you can only use them from other clients. A lock is
released when its link is destroyed or when the client's connection closes;
since 0.7.2 that covers every link the connection opened, not only the first.
Faults work on every transport: no_response, delay (a device clear cancels
a delayed answer), disconnect (closes the VXI-11 link or the whole HiSLIP
session).
Service requests (SRQ, the VXI-11 interrupt channel), device_docmd, HiSLIP
overlapped mode, HiSLIP 2.0 (TLS, authentication), shared locks (granted as
exclusive), GPIB-over-LAN names such as gpib0,5, mDNS discovery.
Tested with PyVISA-py on Linux, Windows and macOS. Not yet verified with NI-VISA or Keysight VISA — if you try it, please report how it went.
scpi-sim · MIT licensed · instrument names are trademarks of their owners; scpi-sim is not affiliated with them.