Skip to content

Multiple create_links create multiple instrument instances and do not return the same link #23

@ignamv

Description

@ignamv

Hi,

First of all thanks for this project, it's super useful for mocking instruments so I can test my drivers.

I made a mock instrument which worked OK when talking to it using Keysight Interactive IO, but I got errors when talking to it from another measurement software (IC-CAP). IC-CAP's VISA calls end up making two connections to the instrument, each of which calls create_link. Then it sends on one connection commands meant for the other link (which causes an "invalid link ID" error in the Vxi11CoreHandler methods)

One additional problem was that each connection creates a new instance of the instrument class. If this is supposed to mock a real lab setup, multiple connections should go to the same instrument (so changing an instrument setting in connection 1 has an impact on connection 2).

I made some quick and dirty changes to python-vxi11-server which allow this to work. Before, the Vxi11CoreHandler instances had their own instrument instance+link id, and would check that the incoming command's link id matches. Now, the instrument instances live on the Vxi11Server. The instrument instance and link are created earlier, in register(). create_link now simply returns this existing link (with repeated calls returning the same). The handler methods in Vxi11CoreHandler now just fetch the correct instrument instance from Vxi11Server based on the command's link id. destroy_link does nothing now.

Justification

I believe the VXI-11 specification says that create_link should return the same link (or at least the same abort port) when called multiple times, and should support at least two links.

RULE B.2.7:
The network instrument server SHALL return the same abort port number in all replies to create_link sent on the same core channel.

image

After the first create_link, the network instrument client may create an RPC client for the abort channel,
but no additional client creations are necessary after subsequent create_links. These connections may be
torn down by the network instrument client once all links have been closed with destroy_link. The whole
sequence could then start over.

RECOMMENDATION B.4.1:
An instrument's host should support at least two network instrument servers simultaneously.

RECOMMENDATION B.4.2:
An instrument's host should support simultaneous routing of at least two links to any device. The links
may be through the same or different network instrument servers.
RULE B.4.1:
A network instrument server SHALL support links to every device accessible to any other network
instrument server in the host.
OBSERVATION B.4.3:
The intent of this rule is to prevent the dedication of particular devices to particular network instrument
servers.

If we can agree on the correct behavior should be, then I can polish the changes and make a merge request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions