VISA Test Equipment Automation with HIL SDK
The HIL SDK supports test equipment automation, allowing you to connect an oscilloscope, digital multimeter, or power supply to your gateway, and then use them as part of your tests on the HIL.
How the HIL SDK interacts with Test Equipment
VISA
VISA stands for "Virtual Instrument Software Architecture", and is a standard way of talking to testing equipment via the above listed physical communication layers. There are multiple implementations of the VISA standard, but the most popular are National Instruments's and Keysight’s library implementations. Note that while the VISA specification has explicit bindings to Visual Basic, C, and G (LabVIEW’s graphical language), it doesn’t list other language options. However, a python-only implementation also exists, pyvisa-py, and supports most VISA functionality, but as a bonus, is purely python, so it isn’t as OS-specific as the other libraries. These libraries let you interface with test equipment with different physical connections.
Pyvisa
Pyvisa is a python front-end that lets you write consistent python code regardless of which VISA library you’re using (NI-VISA, Keysight, or pyvisa-py). This lets you interact with test equipment via python, giving you easy-to-write code and access to all the many other python libraries available out there. So if you want to interact with your test equipment in your pytest tests, you can simply do some imports and it will auto-magically work.
Sending Commands
The commands are all sent as ascii strings and interpreted by the test equipment. The two standards for these commands are:
IEEE 488.2
The 488.2 is a set of codes and formats to be used by devices using GPIB. However, that standard was quickly adopted by everyone interacting with test equipment. The standard defines how to send data to a device regardless of underlying physical layer, and includes commands asking about things like device ID, serial number, and other universal commands. They are denoted by an asterisk at the start of the command (e.g. *IDN?
when querying for the instrument type and software version).
SCPI
Pronounced “skippy”, SCPI are vendor-defined commands that are less standardized than the IEEE 488.2 commands, though normally commands are standardized across a particular vendor and equipment type. For example, most Keysight oscilloscopes will implement the same SCPI commands for all shared functionality. Otherwise, though, you’ll have to get your particular test equipment’s programming guide from the manufacturer in order to see what commands are supported. These commands are what let you actually control your test equipment by setting input/output, configuring scope setup, and so on. As an example, the Siglent SDS804x, an entry level 4-channel scope, has a programming guide here that lists the supported SCPI and 488.2 commands.
Using the HIL SDK Interfaces
The interfaces in the Interfaces Reference are the currently supported VISA test equipment. The SDK simplifies things by letting you create a fixture for a particular device, and it will automatically find the correct connected device on the gateway and use that during the test. There are also some default functionality on those fixtures, so you do not have to do the SCPI commands yourself, simply call the function (such as take_screenshot()
) and the correct commands will be done for you.